From 98ebe640b4e83ebe4b26b9793bda8cea35fb1d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 23 Aug 2016 10:41:48 -0400 Subject: [PATCH 1/2] update changelog for 1.16.3 --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8eec496b8f..84d33a1e985 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,18 @@ https://github.com/plotly/plotly.js/compare/vX.Y.Z...master where X.Y.Z is the semver of most recent plotly.js release. +## [1.16.3] -- 2016-08-23 + +### Fixed +- Fix SVG exports for graphs with layout images [#846] +- Properly handles duplicate categories in non-default `categoryorder` [#863] +- Fix range selector position logic for overlaying axes [#873] +- Autorange is now properly computed for heatmapgl and contourgl traces [#855, + #874] +- Trace toggling via legend preserves axis ranges in gl2d plots [#855, #874] +- Bump `mapbox-gl` dependency to 0.22.0 [#867] + + ## [1.16.2] -- 2016-08-09 ### Fixed From d4a373e8529c4d759a2dc6bf6344c2c78410b42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 23 Aug 2016 10:44:57 -0400 Subject: [PATCH 2/2] 1.16.3 --- dist/README.md | 42 +- dist/plotly-basic.js | 20 +- dist/plotly-basic.min.js | 14 +- dist/plotly-cartesian.js | 28 +- dist/plotly-cartesian.min.js | 28 +- dist/plotly-geo-assets.js | 4 +- dist/plotly-geo.js | 20 +- dist/plotly-geo.min.js | 24 +- dist/plotly-gl2d.js | 141 +- dist/plotly-gl2d.min.js | 28 +- dist/plotly-gl3d.js | 32 +- dist/plotly-gl3d.min.js | 22 +- dist/plotly-mapbox.js | 23118 ++++++++++++++++--------------- dist/plotly-mapbox.min.js | 66 +- dist/plotly-with-meta.js | 23940 +++++++++++++++++---------------- dist/plotly.js | 23928 ++++++++++++++++---------------- dist/plotly.min.js | 110 +- package.json | 2 +- src/assets/geo_assets.js | 2 +- src/core.js | 2 +- 20 files changed, 37229 insertions(+), 34342 deletions(-) diff --git a/dist/README.md b/dist/README.md index 50c4a58533b..a3badbfde9e 100644 --- a/dist/README.md +++ b/dist/README.md @@ -36,11 +36,11 @@ The main plotly.js bundle includes all the official (non-beta) trace modules. It be can imported as minified javascript - using dist file `dist/plotly.min.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.16.2.min.js +- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.16.3.min.js or as raw javascript: - using dist file `dist/plotly.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.16.2.js +- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.16.3.js - using CommonJS with `require('plotly.js')` If you would like to have access to the attribute meta information (including attribute descriptions as on the [schema reference page](https://plot.ly/javascript/reference/)), use dist file `dist/plotly-with-meta.js` @@ -49,7 +49,7 @@ The main plotly.js bundle weights in at: | plotly.js | plotly.min.js | plotly.min.js + gzip | plotly-with-meta.js | |-----------|---------------|----------------------|---------------------| -| 3.8 MB | 1.6 MB | 488.9 kB | 3.9 MB | +| 3.8 MB | 1.7 MB | 502.9 kB | 3.9 MB | ## Partial bundles @@ -72,13 +72,13 @@ The `basic` partial bundle contains the `scatter`, `bar` and `pie` trace modules | dist bundle (minified) | `dist/plotly-basic.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-basic-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-basic-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-basic-1.16.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.16.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-basic-1.16.3.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.16.3.min.js | | CommonJS | `require('plotly.js/lib/index-basic')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.4 MB | 549 kB | 180.6 kB | +| 1.4 MB | 549.2 kB | 180.6 kB | ### plotly.js cartesian @@ -90,13 +90,13 @@ The `cartesian` partial bundle contains the `scatter`, `bar`, `box`, `heatmap`, | dist bundle (minified) | `dist/plotly-cartesian.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-cartesian-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-cartesian-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.16.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.16.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.16.3.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.16.3.min.js | | CommonJS | `require('plotly.js/lib/index-cartesian')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.6 MB | 618.2 kB | 201.3 kB | +| 1.6 MB | 618.4 kB | 201.3 kB | ### plotly.js geo @@ -108,13 +108,13 @@ The `geo` partial bundle contains the `scatter`, `scattergeo` and `choropleth` t | dist bundle (minified) | `dist/plotly-geo.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-geo-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-geo-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-geo-1.16.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.16.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-geo-1.16.3.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.16.3.min.js | | CommonJS | `require('plotly.js/lib/index-geo')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.5 MB | 578.6 kB | 191.5 kB | +| 1.5 MB | 578.7 kB | 191.5 kB | ### plotly.js gl3d @@ -126,13 +126,13 @@ The `gl3d` partial bundle contains the `scatter`, `scatter3d`, `surface` and `me | dist bundle (minified) | `dist/plotly-gl3d.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-gl3d-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-gl3d-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl3d-1.16.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.16.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl3d-1.16.3.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.16.3.min.js | | CommonJS | `require('plotly.js/lib/index-gl3d')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.3 MB | 985.1 kB | 310.6 kB | +| 2.3 MB | 985.2 kB | 310.7 kB | ### plotly.js gl2d @@ -144,13 +144,13 @@ The `gl2d` partial bundle contains the `scatter`, `scattergl`, `heatmapgl` and ` | dist bundle (minified) | `dist/plotly-gl2d.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-gl2d-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-gl2d-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl2d-1.16.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.16.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl2d-1.16.3.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.16.3.min.js | | CommonJS | `require('plotly.js/lib/index-gl2d')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2 MB | 854.8 kB | 271 kB | +| 2 MB | 855.5 kB | 271.2 kB | ### plotly.js mapbox @@ -162,13 +162,13 @@ The `mapbox` partial bundle contains the `scatter` and `scattermapbox` trace mod | dist bundle (minified) | `dist/plotly-mapbox.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-mapbox-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-mapbox-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-mapbox-1.16.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.16.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-mapbox-1.16.3.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.16.3.min.js | | CommonJS | `require('plotly.js/lib/index-mapbox')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.3 MB | 957.9 kB | 285.1 kB | +| 2.4 MB | 1017.5 kB | 298.9 kB | ---------------- diff --git a/dist/plotly-basic.js b/dist/plotly-basic.js index befb95fda53..8212c1e1fbd 100644 --- a/dist/plotly-basic.js +++ b/dist/plotly-basic.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic) v1.16.2 +* plotly.js (basic) v1.16.3 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -17490,6 +17490,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = require('d3'); var Drawing = require('../drawing'); var Axes = require('../../plots/cartesian/axes'); +var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -17531,9 +17532,10 @@ module.exports = function draw(gd) { // Images must be converted to dataURL's for exporting. function setImage(d) { - var thisImage = d3.select(this); + thisImage.attr('xmlns', xmlnsNamespaces.svg); + var imagePromise = new Promise(function(resolve) { var img = new Image(); @@ -17571,7 +17573,6 @@ module.exports = function draw(gd) { } function applyAttributes(d) { - var thisImage = d3.select(this); // Axes if specified @@ -17619,7 +17620,9 @@ module.exports = function draw(gd) { yId = yref ? yref._id : '', clipAxes = xId + yId; - thisImage.call(Drawing.setClipUrl, 'clip' + fullLayout._uid + clipAxes); + if(clipAxes) { + thisImage.call(Drawing.setClipUrl, 'clip' + fullLayout._uid + clipAxes); + } } @@ -17649,7 +17652,7 @@ module.exports = function draw(gd) { imagesAbove.each(applyAttributes); }; -},{"../../plots/cartesian/axes":116,"../drawing":41,"d3":9}],53:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":88,"../../plots/cartesian/axes":116,"../drawing":41,"d3":9}],53:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20248,7 +20251,8 @@ function getPosDflt(containerOut, layout, counterAxes) { var posY = 0; for(var i = 0; i < anchoredList.length; i++) { - posY = Math.max(layout[anchoredList[i]].domain[1], posY); + var domain = layout[anchoredList[i]].domain; + if(domain) posY = Math.max(domain[1], posY); } return [containerOut.domain[0], posY + constants.yPad]; @@ -23233,7 +23237,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.16.2'; +exports.version = '1.16.3'; // plot api exports.plot = Plotly.plot; @@ -36122,7 +36126,7 @@ function flattenUniqueSort(axisLetter, sortFunction, data) { insertionIndex = bisector(categoryArray, category); // skip loop on already encountered values - if(insertionIndex < categoryArray.length - 1 && categoryArray[insertionIndex] === category) continue; + if(insertionIndex < categoryArray.length && categoryArray[insertionIndex] === category) continue; // insert value categoryArray.splice(insertionIndex, 0, category); diff --git a/dist/plotly-basic.min.js b/dist/plotly-basic.min.js index 41aaf003a7a..3be3739640a 100644 --- a/dist/plotly-basic.min.js +++ b/dist/plotly-basic.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic - minified) v1.16.2 +* plotly.js (basic - minified) v1.16.3 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -11,14 +11,14 @@ if(a=e.charCodeAt(l++),37===a){if(i=e.charAt(l++),o=S[i in xl?e.charAt(l++):i],! return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cr(n(t)).cells.forEach(function(n,r){for(var a,o,i=n.site,l=n.edges.sort(Xn),s=-1,c=l.length,u=l[c-1].edge,f=u.l===i?u.r:u.l;++s=c,d=r>=u,h=d<<1|f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=pr()),f?a=c:l=c,d?i=u:s=u,o(t,e,n,r,a,i,l,s)}var u,f,d,h,p,g,v,m,y,x=zt(l),b=zt(s);if(null!=e)g=e,v=n,m=r,y=a;else if(m=y=-(g=v=1/0),f=[],d=[],p=t.length,i)for(h=0;p>h;++h)u=t[h],u.xm&&(m=u.x),u.y>y&&(y=u.y),f.push(u.x),d.push(u.y);else for(h=0;p>h;++h){var _=+x(u=t[h],h),w=+b(u,h);g>_&&(g=_),v>w&&(v=w),_>m&&(m=_),w>y&&(y=w),f.push(_),d.push(w)}var k=m-g,M=y-v;k>M?y=v+k:m=g+M;var A=pr();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,v,m,y)},A.visit=function(t){gr(t,A,g,v,m,y)},A.find=function(t){return vr(A,t[0],t[1],g,v,m,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=ms.get(n)||vs,r=ys.get(r)||b,kr(r(n.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=Ir,ui.interpolateHsl=Rr,ui.interpolateLab=jr,ui.interpolateRound=Fr,ui.transform=function(t){var e=hi.createElementNS(ui.ns.prefix.svg,"g");return(ui.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new qr(n?n.matrix:xs)})(t)},qr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var xs={a:1,b:0,c:0,d:1,e:0,f:0};ui.interpolateTransform=$r,ui.layout={},ui.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++nl*l/m){if(g>s){var c=e.charge/s;t.px-=o*c,t.py-=i*c}return!0}if(e.point&&s&&g>s){var c=e.pointCharge/s;t.px-=o*c,t.py-=i*c}}return!e.charge}}function e(t){t.px=ui.event.x,t.py=ui.event.y,s.resume()}var n,r,a,o,i,l,s={},c=ui.dispatch("start","tick","end"),u=[1,1],f=.9,d=bs,h=_s,p=-30,g=ws,v=.1,m=.64,y=[],x=[];return s.tick=function(){if((a*=.99)<.005)return n=null,c.end({type:"end",alpha:a=0}),!0;var e,r,s,d,h,g,m,b,_,w=y.length,k=x.length;for(r=0;k>r;++r)s=x[r],d=s.source,h=s.target,b=h.x-d.x,_=h.y-d.y,(g=b*b+_*_)&&(g=a*i[r]*((g=Math.sqrt(g))-o[r])/g,b*=g,_*=g,h.x-=b*(m=d.weight+h.weight?d.weight/(d.weight+h.weight):.5),h.y-=_*m,d.x+=b*(m=1-m),d.y+=_*m);if((m=a*v)&&(b=u[0]/2,_=u[1]/2,r=-1,m))for(;++r0?a=t:(n.c=null,n.t=NaN,n=null,c.end({type:"end",alpha:a=0})):t>0&&(c.start({type:"start",alpha:a=t}),n=Pt(s.tick)),s):a},s.start=function(){function t(t,r){if(!n){for(n=new Array(a),s=0;a>s;++s)n[s]=[];for(s=0;c>s;++s){var o=x[s];n[o.source.index].push(o.target),n[o.target.index].push(o.source)}}for(var i,l=n[e],s=-1,u=l.length;++se;++e)(r=y[e]).index=e,r.weight=0;for(e=0;c>e;++e)r=x[e],"number"==typeof r.source&&(r.source=y[r.source]),"number"==typeof r.target&&(r.target=y[r.target]),++r.source.weight,++r.target.weight;for(e=0;a>e;++e)r=y[e],isNaN(r.x)&&(r.x=t("x",f)),isNaN(r.y)&&(r.y=t("y",g)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(o=[],"function"==typeof d)for(e=0;c>e;++e)o[e]=+d.call(this,x[e],e);else for(e=0;c>e;++e)o[e]=d;if(i=[],"function"==typeof h)for(e=0;c>e;++e)i[e]=+h.call(this,x[e],e);else for(e=0;c>e;++e)i[e]=h;if(l=[],"function"==typeof p)for(e=0;a>e;++e)l[e]=+p.call(this,y[e],e);else for(e=0;a>e;++e)l[e]=p;return s.resume()},s.resume=function(){return s.alpha(.1)},s.stop=function(){return s.alpha(0)},s.drag=function(){return r||(r=ui.behavior.drag().origin(b).on("dragstart.force",ea).on("drag.force",e).on("dragend.force",na)),arguments.length?void this.on("mouseover.force",ra).on("mouseout.force",aa).call(r):r},ui.rebind(s,c,"on")};var bs=20,_s=1,ws=1/0;ui.layout.hierarchy=function(){function t(a){var o,i=[a],l=[];for(a.depth=0;null!=(o=i.pop());)if(l.push(o),(c=n.call(t,o,o.depth))&&(s=c.length)){for(var s,c,u;--s>=0;)i.push(u=c[s]),u.parent=o,u.depth=o.depth+1;r&&(o.value=0),o.children=c}else r&&(o.value=+r.call(t,o,o.depth)||0),delete o.children;return sa(a,function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)}),l}var e=fa,n=ca,r=ua;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(la(e,function(t){t.children&&(t.value=0)}),sa(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},ui.layout.partition=function(){function t(e,n,r,a){var o=e.children;if(e.x=n,e.y=e.depth*a,e.dx=r,e.dy=a,o&&(i=o.length)){var i,l,s,c=-1;for(r=e.value?r/e.value:0;++cf?-1:1),p=ui.sum(c),g=p?(f-s*h)/p:0,v=ui.range(s),m=[];return null!=n&&v.sort(n===ks?function(t,e){return c[e]-c[t]}:function(t,e){return n(i[t],i[e])}),v.forEach(function(t){m[t]={data:i[t],value:l=c[t],startAngle:u,endAngle:u+=l*g+h,padAngle:d}}),m}var e=Number,n=ks,r=0,a=Hi,o=0;return t.value=function(n){return arguments.length?(e=n,t):e},t.sort=function(e){return arguments.length?(n=e,t):n},t.startAngle=function(e){return arguments.length?(r=e,t):r},t.endAngle=function(e){return arguments.length?(a=e,t):a},t.padAngle=function(e){return arguments.length?(o=e,t):o},t};var ks={};ui.layout.stack=function(){function t(l,s){if(!(d=l.length))return l;var c=l.map(function(n,r){return e.call(t,n,r)}),u=c.map(function(e){return e.map(function(e,n){return[o.call(t,e,n),i.call(t,e,n)]})}),f=n.call(t,u,s);c=ui.permute(c,f),u=ui.permute(u,f);var d,h,p,g,v=r.call(t,u,s),m=c[0].length;for(p=0;m>p;++p)for(a.call(t,c[0][p],g=v[p],u[0][p][1]),h=1;d>h;++h)a.call(t,c[h][p],g+=u[h-1][p][1],u[h][p][1]);return l}var e=b,n=va,r=ma,a=ga,o=ha,i=pa;return t.values=function(n){return arguments.length?(e=n,t):e},t.order=function(e){return arguments.length?(n="function"==typeof e?e:Ms.get(e)||va,t):n},t.offset=function(e){return arguments.length?(r="function"==typeof e?e:As.get(e)||ma,t):r},t.x=function(e){return arguments.length?(o=e,t):o},t.y=function(e){return arguments.length?(i=e,t):i},t.out=function(e){return arguments.length?(a=e,t):a},t};var Ms=ui.map({"inside-out":function(t){var e,n,r=t.length,a=t.map(ya),o=t.map(xa),i=ui.range(r).sort(function(t,e){return a[t]-a[e]}),l=0,s=0,c=[],u=[];for(e=0;r>e;++e)n=i[e],s>l?(l+=o[n],c.push(n)):(s+=o[n],u.push(n));return u.reverse().concat(c)},reverse:function(t){return ui.range(t.length).reverse()},"default":va}),As=ui.map({silhouette:function(t){var e,n,r,a=t.length,o=t[0].length,i=[],l=0,s=[];for(n=0;o>n;++n){for(e=0,r=0;a>e;e++)r+=t[e][n][1];r>l&&(l=r),i.push(r)}for(n=0;o>n;++n)s[n]=(l-i[n])/2;return s},wiggle:function(t){var e,n,r,a,o,i,l,s,c,u=t.length,f=t[0],d=f.length,h=[];for(h[0]=s=c=0,n=1;d>n;++n){for(e=0,a=0;u>e;++e)a+=t[e][n][1];for(e=0,o=0,l=f[n][0]-f[n-1][0];u>e;++e){for(r=0,i=(t[e][n][1]-t[e][n-1][1])/(2*l);e>r;++r)i+=(t[r][n][1]-t[r][n-1][1])/l;o+=i*t[e][n][1]}h[n]=s-=a?o/a*l:0,c>s&&(c=s)}for(n=0;d>n;++n)h[n]-=c;return h},expand:function(t){var e,n,r,a=t.length,o=t[0].length,i=1/a,l=[];for(n=0;o>n;++n){for(e=0,r=0;a>e;e++)r+=t[e][n][1];if(r)for(e=0;a>e;e++)t[e][n][1]/=r;else for(e=0;a>e;e++)t[e][n][1]=i}for(n=0;o>n;++n)l[n]=0;return l},zero:ma});ui.layout.histogram=function(){function t(t,o){for(var i,l,s=[],c=t.map(n,this),u=r.call(this,c,o),f=a.call(this,u,c,o),o=-1,d=c.length,h=f.length-1,p=e?1:1/d;++o0)for(o=-1;++o=u[0]&&l<=u[1]&&(i=s[ui.bisect(f,l,1,h)-1],i.y+=p,i.push(t[o]));return s}var e=!0,n=Number,r=ka,a=_a;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=zt(e),t):r},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:zt(e),t):a},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},ui.layout.pack=function(){function t(t,o){var i=n.call(this,t,o),l=i[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,sa(l,function(t){t.r=+u(t.value)}),sa(l,za),r){var f=r*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;sa(l,function(t){t.r+=f}),sa(l,za),sa(l,function(t){t.r-=f})}return Ea(l,s/2,c/2,e?1:1/Math.max(2*l.r/s,2*l.r/c)),i}var e,n=ui.layout.hierarchy().sort(Ma),r=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ia(t,n)},ui.layout.tree=function(){function t(t,a){var u=i.call(this,t,a),f=u[0],d=e(f);if(sa(d,n),d.parent.m=-d.z,la(d,r),c)la(f,o);else{var h=f,p=f,g=f;la(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var v=l(h,p)/2-h.x,m=s[0]/(p.x+l(p,h)/2+v),y=s[1]/(g.depth||1);la(f,function(t){t.x=(t.x+v)*m,t.y=t.depth*y})}return u}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var a,o=e.children,i=0,l=o.length;l>i;++i)r.push((o[i]=a={_:o[i],parent:e,children:(a=o[i].children)&&a.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:i}).a=a);return n.children[0]}function n(t){var e=t.children,n=t.parent.children,r=t.i?n[t.i-1]:null;if(e.length){Ra(t);var o=(e[0].z+e[e.length-1].z)/2;r?(t.z=r.z+l(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+l(t._,r._));t.parent.A=a(t,r,t.parent.A||n[0])}function r(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function a(t,e,n){if(e){for(var r,a=t,o=t,i=e,s=a.parent.children[0],c=a.m,u=o.m,f=i.m,d=s.m;i=Da(i),a=Na(a),i&&a;)s=Na(s),o=Da(o),o.a=t,r=i.z+f-a.z-c+l(i._,a._),r>0&&(Ia(ja(i,t,n),t,r),c+=r,u+=r),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Da(o)&&(o.t=i,o.m+=f-u),a&&!Na(s)&&(s.t=a,s.m+=c-d,n=t)}return n}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var i=ui.layout.hierarchy().sort(null).value(null),l=Pa,s=[1,1],c=null;return t.separation=function(e){return arguments.length?(l=e,t):l},t.size=function(e){return arguments.length?(c=null==(s=e)?o:null,t):c?null:s},t.nodeSize=function(e){return arguments.length?(c=null==(s=e)?null:o,t):c?s:null},ia(t,i)},ui.layout.cluster=function(){function t(t,o){var i,l=e.call(this,t,o),s=l[0],c=0;sa(s,function(t){var e=t.children;e&&e.length?(t.x=qa(e),t.y=Fa(e)):(t.x=i?c+=n(t,i):0,t.y=0,i=t)});var u=Ba(s),f=Ha(s),d=u.x-n(u,f)/2,h=f.x+n(f,u)/2;return sa(s,a?function(t){t.x=(t.x-s.x)*r[0],t.y=(s.y-t.y)*r[1]}:function(t){t.x=(t.x-d)/(h-d)*r[0],t.y=(1-(s.y?t.y/s.y:1))*r[1]}),l}var e=ui.layout.hierarchy().sort(null).value(null),n=Pa,r=[1,1],a=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(a=null==(r=e),t):a?null:r},t.nodeSize=function(e){return arguments.length?(a=null!=(r=e),t):a?r:null},ia(t,e)},ui.layout.treemap=function(){function t(t,e){for(var n,r,a=-1,o=t.length;++ae?0:e),n.area=isNaN(r)||0>=r?0:r}function e(n){var o=n.children;if(o&&o.length){var i,l,s,c=f(n),u=[],d=o.slice(),p=1/0,g="slice"===h?c.dx:"dice"===h?c.dy:"slice-dice"===h?1&n.depth?c.dy:c.dx:Math.min(c.dx,c.dy);for(t(d,c.dx*c.dy/n.value),u.area=0;(s=d.length)>0;)u.push(i=d[s-1]),u.area+=i.area,"squarify"!==h||(l=r(u,g))<=p?(d.pop(),p=l):(u.area-=u.pop().area,a(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(a(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,i=f(e),l=r.slice(),s=[];for(t(l,i.dx*i.dy/e.value),s.area=0;o=l.pop();)s.push(o),s.area+=o.area,null!=o.z&&(a(s,o.z?i.dx:i.dy,i,!l.length),s.length=s.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,a=0,o=1/0,i=-1,l=t.length;++in&&(o=n),n>a&&(a=n));return r*=r,e*=e,r?Math.max(e*a*p/r,r/(e*o*p)):1/0}function a(t,e,n,r){var a,o=-1,i=t.length,l=n.x,c=n.y,u=e?s(t.area/e):0;if(e==n.dx){for((r||u>n.dy)&&(u=n.dy);++on.dx)&&(u=n.dx);++on&&(e=1),1>n&&(t=0),function(){var n,r,a;do n=2*Math.random()-1,r=2*Math.random()-1,a=n*n+r*r;while(!a||a>1);return t+e*n*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=ui.random.normal.apply(ui,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ui.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;t>n;n++)e+=Math.random();return e}}},ui.scale={};var Ts={floor:b,ceil:b};ui.scale.linear=function(){return Wa([0,1],[0,1],_r,!1)};var Ls={s:1,g:1,p:1,r:1,e:1};ui.scale.log=function(){return oo(ui.scale.linear().domain([0,1]),10,!0,[1,10])};var zs=ui.format(".0e"),Ss={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};ui.scale.pow=function(){return io(ui.scale.linear(),1,[0,1])},ui.scale.sqrt=function(){return ui.scale.pow().exponent(.5)},ui.scale.ordinal=function(){return so([],{t:"range",a:[[]]})},ui.scale.category10=function(){return ui.scale.ordinal().range(Cs)},ui.scale.category20=function(){return ui.scale.ordinal().range(Es)},ui.scale.category20b=function(){return ui.scale.ordinal().range(Os)},ui.scale.category20c=function(){return ui.scale.ordinal().range(Ps)};var Cs=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(_t),Es=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(_t),Os=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(_t),Ps=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(_t);ui.scale.quantile=function(){return co([],[])},ui.scale.quantize=function(){return uo(0,1,[0,1])},ui.scale.threshold=function(){return fo([.5],[0,1])},ui.scale.identity=function(){return ho([0,1])},ui.svg={},ui.svg.arc=function(){function t(){var t=Math.max(0,+n.apply(this,arguments)),c=Math.max(0,+r.apply(this,arguments)),u=i.apply(this,arguments)-Zi,f=l.apply(this,arguments)-Zi,d=Math.abs(f-u),h=u>f?0:1;if(t>c&&(p=c,c=t,t=p),d>=Vi)return e(c,h)+(t?e(t,1-h):"")+"Z";var p,g,v,m,y,x,b,_,w,k,M,A,T=0,L=0,z=[];if((m=(+s.apply(this,arguments)||0)/2)&&(v=o===Ns?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=rt(v/c*Math.sin(m))),t&&(T=rt(v/t*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var S=Math.abs(f-u-2*L)<=Bi?0:1;if(L&&bo(y,x,b,_)===h^S){var C=(u+f)/2;y=c*Math.cos(C),x=c*Math.sin(C),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),k=t*Math.sin(f-T),M=t*Math.cos(u+T),A=t*Math.sin(u+T);var E=Math.abs(u-f+2*T)<=Bi?0:1;if(T&&bo(w,k,M,A)===1-h^E){var O=(u+f)/2;w=t*Math.cos(O),k=t*Math.sin(O),M=A=null}}else w=k=0;if(d>Fi&&(p=Math.min(Math.abs(c-t)/2,+a.apply(this,arguments)))>.001){g=c>t^h?0:1;var P=p,N=p;if(Bi>d){var D=null==M?[w,k]:null==b?[y,x]:In([y,x],[M,A],[b,_],[w,k]),I=y-D[0],R=x-D[1],j=b-D[0],F=_-D[1],q=1/Math.sin(Math.acos((I*j+R*F)/(Math.sqrt(I*I+R*R)*Math.sqrt(j*j+F*F)))/2),B=Math.sqrt(D[0]*D[0]+D[1]*D[1]);N=Math.min(p,(t-B)/(q-1)),P=Math.min(p,(c-B)/(q+1))}if(null!=b){var H=_o(null==M?[w,k]:[M,A],[y,x],c,P,h),V=_o([b,_],[w,k],c,P,h);p===P?z.push("M",H[0],"A",P,",",P," 0 0,",g," ",H[1],"A",c,",",c," 0 ",1-h^bo(H[1][0],H[1][1],V[1][0],V[1][1]),",",h," ",V[1],"A",P,",",P," 0 0,",g," ",V[0]):z.push("M",H[0],"A",P,",",P," 0 1,",g," ",V[0])}else z.push("M",y,",",x);if(null!=M){var Z=_o([y,x],[M,A],t,-N,h),Y=_o([w,k],null==b?[y,x]:[b,_],t,-N,h);p===N?z.push("L",Y[0],"A",N,",",N," 0 0,",g," ",Y[1],"A",t,",",t," 0 ",h^bo(Y[1][0],Y[1][1],Z[1][0],Z[1][1]),",",1-h," ",Z[1],"A",N,",",N," 0 0,",g," ",Z[0]):z.push("L",Y[0],"A",N,",",N," 0 0,",g," ",Z[0])}else z.push("L",w,",",k)}else z.push("M",y,",",x),null!=b&&z.push("A",c,",",c," 0 ",S,",",h," ",b,",",_),z.push("L",w,",",k),null!=M&&z.push("A",t,",",t," 0 ",E,",",1-h," ",M,",",A);return z.push("Z"),z.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var n=go,r=vo,a=po,o=Ns,i=mo,l=yo,s=xo;return t.innerRadius=function(e){return arguments.length?(n=zt(e),t):n},t.outerRadius=function(e){return arguments.length?(r=zt(e),t):r},t.cornerRadius=function(e){return arguments.length?(a=zt(e),t):a},t.padRadius=function(e){return arguments.length?(o=e==Ns?Ns:zt(e),t):o},t.startAngle=function(e){return arguments.length?(i=zt(e),t):i},t.endAngle=function(e){return arguments.length?(l=zt(e),t):l},t.padAngle=function(e){return arguments.length?(s=zt(e),t):s},t.centroid=function(){var t=(+n.apply(this,arguments)+ +r.apply(this,arguments))/2,e=(+i.apply(this,arguments)+ +l.apply(this,arguments))/2-Zi;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Ns="auto";ui.svg.line=function(){return wo(b)};var Ds=ui.map({linear:ko,"linear-closed":Mo,step:Ao,"step-before":To,"step-after":Lo,basis:Po,"basis-open":No,"basis-closed":Do,bundle:Io,cardinal:Co,"cardinal-open":zo,"cardinal-closed":So,monotone:Ho});Ds.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var Is=[0,2/3,1/3,0],Rs=[0,1/3,2/3,0],js=[0,1/6,2/3,1/6];ui.svg.line.radial=function(){var t=wo(Vo);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},To.reverse=Lo,Lo.reverse=To,ui.svg.area=function(){return Zo(b)},ui.svg.area.radial=function(){var t=Zo(Vo);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},ui.svg.chord=function(){function t(t,l){var s=e(this,o,t,l),c=e(this,i,t,l);return"M"+s.p0+r(s.r,s.p1,s.a1-s.a0)+(n(s,c)?a(s.r,s.p1,s.r,s.p0):a(s.r,s.p1,c.r,c.p0)+r(c.r,c.p1,c.a1-c.a0)+a(c.r,c.p1,s.r,s.p0))+"Z"}function e(t,e,n,r){var a=e.call(t,n,r),o=l.call(t,a,r),i=s.call(t,a,r)-Zi,u=c.call(t,a,r)-Zi;return{r:o,a0:i,a1:u,p0:[o*Math.cos(i),o*Math.sin(i)],p1:[o*Math.cos(u),o*Math.sin(u)]}}function n(t,e){return t.a0==e.a0&&t.a1==e.a1}function r(t,e,n){return"A"+t+","+t+" 0 "+ +(n>Bi)+",1 "+e}function a(t,e,n,r){return"Q 0,0 "+r}var o=_n,i=wn,l=Yo,s=mo,c=yo;return t.radius=function(e){return arguments.length?(l=zt(e),t):l},t.source=function(e){return arguments.length?(o=zt(e),t):o},t.target=function(e){return arguments.length?(i=zt(e),t):i},t.startAngle=function(e){return arguments.length?(s=zt(e),t):s},t.endAngle=function(e){return arguments.length?(c=zt(e),t):c},t},ui.svg.diagonal=function(){function t(t,a){var o=e.call(this,t,a),i=n.call(this,t,a),l=(o.y+i.y)/2,s=[o,{x:o.x,y:l},{x:i.x,y:l},i];return s=s.map(r),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var e=_n,n=wn,r=Uo;return t.source=function(n){return arguments.length?(e=zt(n),t):e},t.target=function(e){return arguments.length?(n=zt(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},ui.svg.diagonal.radial=function(){var t=ui.svg.diagonal(),e=Uo,n=t.projection;return t.projection=function(t){return arguments.length?n(Xo(e=t)):e},t},ui.svg.symbol=function(){function t(t,r){return(Fs.get(e.call(this,t,r))||Qo)(n.call(this,t,r))}var e=$o,n=Go;return t.type=function(n){return arguments.length?(e=zt(n),t):e},t.size=function(e){return arguments.length?(n=zt(e),t):n},t};var Fs=ui.map({circle:Qo,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*Bs)),n=e*Bs;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",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/qs),n=e*qs/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/qs),n=e*qs/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ui.svg.symbolTypes=Fs.keys();var qs=Math.sqrt(3),Bs=Math.tan(30*Yi);Ei.transition=function(t){for(var e,n,r=Hs||++Us,a=ei(t),o=[],i=Vs||{time:Date.now(),ease:zr,delay:0,duration:250},l=-1,s=this.length;++lo;o++){a.push(e=[]);for(var n=this[o],l=0,s=n.length;s>l;l++)(r=n[l])&&t.call(r,r.__data__,l,o)&&e.push(r)}return Jo(a,this.namespace,this.id)},Ys.tween=function(t,e){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(t):Y(this,null==e?function(e){e[r][n].tween.remove(t)}:function(a){a[r][n].tween.set(t,e)})},Ys.attr=function(t,e){function n(){this.removeAttribute(l)}function r(){this.removeAttributeNS(l.space,l.local)}function a(t){return null==t?n:(t+="",function(){var e,n=this.getAttribute(l);return n!==t&&(e=i(n,t),function(t){this.setAttribute(l,e(t))})})}function o(t){return null==t?r:(t+="",function(){var e,n=this.getAttributeNS(l.space,l.local);return n!==t&&(e=i(n,t),function(t){this.setAttributeNS(l.space,l.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var i="transform"==t?$r:_r,l=ui.ns.qualify(t);return Ko(this,"attr."+t,e,l.local?o:a)},Ys.attrTween=function(t,e){function n(t,n){var r=e.call(this,t,n,this.getAttribute(a));return r&&function(t){this.setAttribute(a,r(t))}}function r(t,n){var r=e.call(this,t,n,this.getAttributeNS(a.space,a.local));return r&&function(t){this.setAttributeNS(a.space,a.local,r(t))}}var a=ui.ns.qualify(t);return this.tween("attr."+t,a.local?r:n)},Ys.style=function(t,e,n){function a(){this.style.removeProperty(t)}function o(e){return null==e?a:(e+="",function(){var a,o=r(this).getComputedStyle(this,null).getPropertyValue(t);return o!==e&&(a=_r(o,e),function(e){this.style.setProperty(t,a(e),n)})})}var i=arguments.length;if(3>i){if("string"!=typeof t){2>i&&(e="");for(n in t)this.style(n,t[n],e);return this}n=""}return Ko(this,"style."+t,e,o)},Ys.styleTween=function(t,e,n){function a(a,o){var i=e.call(this,a,o,r(this).getComputedStyle(this,null).getPropertyValue(t));return i&&function(e){this.style.setProperty(t,i(e),n)}}return arguments.length<3&&(n=""),this.tween("style."+t,a)},Ys.text=function(t){return Ko(this,"text",t,ti)},Ys.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Ys.ease=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].ease:("function"!=typeof t&&(t=ui.ease.apply(ui,arguments)),Y(this,function(r){r[n][e].ease=t}))},Ys.delay=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].delay:Y(this,"function"==typeof t?function(r,a,o){r[n][e].delay=+t.call(r,r.__data__,a,o)}:(t=+t,function(r){r[n][e].delay=t}))},Ys.duration=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].duration:Y(this,"function"==typeof t?function(r,a,o){r[n][e].duration=Math.max(1,t.call(r,r.__data__,a,o))}:(t=Math.max(1,t),function(r){r[n][e].duration=t}))},Ys.each=function(t,e){var n=this.id,r=this.namespace;if(arguments.length<2){var a=Vs,o=Hs;try{Hs=n,Y(this,function(e,a,o){Vs=e[r][n],t.call(e,e.__data__,a,o)})}finally{Vs=a,Hs=o}}else Y(this,function(a){var o=a[r][n];(o.event||(o.event=ui.dispatch("start","end","interrupt"))).on(t,e)});return this},Ys.transition=function(){for(var t,e,n,r,a=this.id,o=++Us,i=this.namespace,l=[],s=0,c=this.length;c>s;s++){l.push(t=[]);for(var e=this[s],u=0,f=e.length;f>u;u++)(n=e[u])&&(r=n[i][a],ni(n,u,i,o,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),t.push(n)}return Jo(l,i,o)},ui.svg.axis=function(){function t(t){t.each(function(){var t,c=ui.select(this),u=this.__chart__||n,f=this.__chart__=n.copy(),d=null==s?f.ticks?f.ticks.apply(f,l):f.domain():s,h=null==e?f.tickFormat?f.tickFormat.apply(f,l):b:e,p=c.selectAll(".tick").data(d,f),g=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Fi),v=ui.transition(p.exit()).style("opacity",Fi).remove(),m=ui.transition(p.order()).style("opacity",1),y=Math.max(a,0)+i,x=Ua(f),_=c.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),ui.transition(_));g.append("line"),g.append("text");var k,M,A,T,L=g.select("line"),z=m.select("line"),S=p.select("text").text(h),C=g.select("text"),E=m.select("text"),O="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(t=ri,k="x",A="y",M="x2",T="y2",S.attr("dy",0>O?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+O*o+"V0H"+x[1]+"V"+O*o)):(t=ai,k="y",A="x",M="y2",T="x2",S.attr("dy",".32em").style("text-anchor",0>O?"end":"start"),w.attr("d","M"+O*o+","+x[0]+"H0V"+x[1]+"H"+O*o)),L.attr(T,O*a),C.attr(A,O*y),z.attr(M,0).attr(T,O*a),E.attr(k,0).attr(A,O*y),f.rangeBand){var P=f,N=P.rangeBand()/2;u=f=function(t){return P(t)+N}}else u.rangeBand?u=f:v.call(t,f,u);g.call(t,u,f),m.call(t,f,f)})}var e,n=ui.scale.linear(),r=Xs,a=6,o=6,i=3,l=[10],s=null;return t.scale=function(e){ return arguments.length?(n=e,t):n},t.orient=function(e){return arguments.length?(r=e in Gs?e+"":Xs,t):r},t.ticks=function(){return arguments.length?(l=di(arguments),t):l},t.tickValues=function(e){return arguments.length?(s=e,t):s},t.tickFormat=function(n){return arguments.length?(e=n,t):e},t.tickSize=function(e){var n=arguments.length;return n?(a=+e,o=+arguments[n-1],t):a},t.innerTickSize=function(e){return arguments.length?(a=+e,t):a},t.outerTickSize=function(e){return arguments.length?(o=+e,t):o},t.tickPadding=function(e){return arguments.length?(i=+e,t):i},t.tickSubdivide=function(){return arguments.length&&t},t};var Xs="bottom",Gs={top:1,right:1,bottom:1,left:1};ui.svg.brush=function(){function t(r){r.each(function(){var r=ui.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),i=r.selectAll(".background").data([0]);i.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),r.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var l=r.selectAll(".resize").data(g,b);l.exit().remove(),l.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return $s[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"),l.style("display",t.empty()?"none":null);var s,f=ui.transition(r),d=ui.transition(i);c&&(s=Ua(c),d.attr("x",s[0]).attr("width",s[1]-s[0]),n(f)),u&&(s=Ua(u),d.attr("y",s[0]).attr("height",s[1]-s[0]),a(f)),e(f)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+f[+/e$/.test(t)]+","+d[+/^s/.test(t)]+")"})}function n(t){t.select(".extent").attr("x",f[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(S||(x=null,E[0]-=f[1],E[1]-=d[1],S=2),T())}function g(){32==ui.event.keyCode&&2==S&&(E[0]+=f[1],E[1]+=d[1],S=0,T())}function v(){var t=ui.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),S||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),E[0]=f[+(t[0]u?(a=r,r=u):a=u),g[0]!=r||g[1]!=a?(n?l=null:i=null,g[0]=r,g[1]=a,!0):void 0}function y(){v(),M.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),ui.select("body").style("cursor",null),O.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),C(),k({type:"brushend"})}var x,b,_=this,w=ui.select(ui.event.target),k=s.of(_,arguments),M=ui.select(_),A=w.datum(),L=!/^(n|s)$/.test(A)&&c,z=!/^(e|w)$/.test(A)&&u,S=w.classed("extent"),C=W(_),E=ui.mouse(_),O=ui.select(r(_)).on("keydown.brush",o).on("keyup.brush",g);if(ui.event.changedTouches?O.on("touchmove.brush",v).on("touchend.brush",y):O.on("mousemove.brush",v).on("mouseup.brush",y),M.interrupt().selectAll("*").interrupt(),S)E[0]=f[0]-E[0],E[1]=d[0]-E[1];else if(A){var P=+/w$/.test(A),N=+/^n/.test(A);b=[f[1-P]-E[0],d[1-N]-E[1]],E[0]=f[P],E[1]=d[N]}else ui.event.altKey&&(x=E.slice());M.style("pointer-events","none").selectAll(".resize").style("display",null),ui.select("body").style("cursor",w.style("cursor")),k({type:"brushstart"}),v()}var i,l,s=z(t,"brushstart","brush","brushend"),c=null,u=null,f=[0,0],d=[0,0],h=!0,p=!0,g=Qs[0];return t.event=function(t){t.each(function(){var t=s.of(this,arguments),e={x:f,y:d,i:i,j:l},n=this.__chart__||e;this.__chart__=e,Hs?ui.select(this).transition().each("start.brush",function(){i=n.i,l=n.j,f=n.x,d=n.y,t({type:"brushstart"})}).tween("brush:brush",function(){var n=wr(f,e.x),r=wr(d,e.y);return i=l=null,function(a){f=e.x=n(a),d=e.y=r(a),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=e.i,l=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(c=e,g=Qs[!c<<1|!u],t):c},t.y=function(e){return arguments.length?(u=e,g=Qs[!c<<1|!u],t):u},t.clamp=function(e){return arguments.length?(c&&u?(h=!!e[0],p=!!e[1]):c?h=!!e:u&&(p=!!e),t):c&&u?[h,p]:c?h:u?p:null},t.extent=function(e){var n,r,a,o,s;return arguments.length?(c&&(n=e[0],r=e[1],u&&(n=n[0],r=r[0]),i=[n,r],c.invert&&(n=c(n),r=c(r)),n>r&&(s=n,n=r,r=s),n==f[0]&&r==f[1]||(f=[n,r])),u&&(a=e[0],o=e[1],c&&(a=a[1],o=o[1]),l=[a,o],u.invert&&(a=u(a),o=u(o)),a>o&&(s=a,a=o,o=s),a==d[0]&&o==d[1]||(d=[a,o])),t):(c&&(i?(n=i[0],r=i[1]):(n=f[0],r=f[1],c.invert&&(n=c.invert(n),r=c.invert(r)),n>r&&(s=n,n=r,r=s))),u&&(l?(a=l[0],o=l[1]):(a=d[0],o=d[1],u.invert&&(a=u.invert(a),o=u.invert(o)),a>o&&(s=a,a=o,o=s))),c&&u?[[n,a],[r,o]]:c?[n,r]:u&&[a,o])},t.clear=function(){return t.empty()||(f=[0,0],d=[0,0],i=l=null),t},t.empty=function(){return!!c&&f[0]==f[1]||!!u&&d[0]==d[1]},ui.rebind(t,s,"on")};var $s={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Qs=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ws=vl.format=wl.timeFormat,Js=Ws.utc,Ks=Js("%Y-%m-%dT%H:%M:%S.%LZ");Ws.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?oi:Ks,oi.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},oi.toString=Ks.toString,vl.second=Ht(function(t){return new ml(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),vl.seconds=vl.second.range,vl.seconds.utc=vl.second.utc.range,vl.minute=Ht(function(t){return new ml(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),vl.minutes=vl.minute.range,vl.minutes.utc=vl.minute.utc.range,vl.hour=Ht(function(t){var e=t.getTimezoneOffset()/60;return new ml(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),vl.hours=vl.hour.range,vl.hours.utc=vl.hour.utc.range,vl.month=Ht(function(t){return t=vl.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),vl.months=vl.month.range,vl.months.utc=vl.month.utc.range;var tc=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],ec=[[vl.second,1],[vl.second,5],[vl.second,15],[vl.second,30],[vl.minute,1],[vl.minute,5],[vl.minute,15],[vl.minute,30],[vl.hour,1],[vl.hour,3],[vl.hour,6],[vl.hour,12],[vl.day,1],[vl.day,2],[vl.week,1],[vl.month,1],[vl.month,3],[vl.year,1]],nc=Ws.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",Ee]]),rc={range:function(t,e,n){return ui.range(Math.ceil(t/n)*n,+e,n).map(li)},floor:b,ceil:b};ec.year=vl.year,vl.scale=function(){return ii(ui.scale.linear(),ec,nc)};var ac=ec.map(function(t){return[t[0].utc,t[1]]}),oc=Js.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",Ee]]);ac.year=vl.year.utc,vl.scale.utc=function(){return ii(ui.scale.linear(),ac,oc)},ui.text=St(function(t){return t.responseText}),ui.json=function(t,e){return Ct(t,"application/json",si,e)},ui.html=function(t,e){return Ct(t,"text/html",ci,e)},ui.xml=St(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=ui,t(ui)):"object"==typeof n&&n.exports?n.exports=ui:this.d3=ui}()},{}],10:[function(e,n,r){(function(r,a){(function(){"use strict";function o(t){return"function"==typeof t||"object"==typeof t&&null!==t}function i(t){return"function"==typeof t}function l(t){U=t}function s(t){Q=t}function c(){return function(){r.nextTick(p)}}function u(){return function(){Y(p)}}function f(){var t=0,e=new K(p),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function d(){var t=new MessageChannel;return t.port1.onmessage=p,function(){t.port2.postMessage(0)}}function h(){return function(){setTimeout(p,1)}}function p(){for(var t=0;$>t;t+=2){var e=nt[t],n=nt[t+1];e(n),nt[t]=void 0,nt[t+1]=void 0}$=0}function g(){try{var t=e,n=t("vertx");return Y=n.runOnLoop||n.runOnContext,u()}catch(r){return h()}}function v(t,e){var n=this,r=n._state;if(r===it&&!t||r===lt&&!e)return this;var a=new this.constructor(y),o=n._result;if(r){var i=arguments[r-1];Q(function(){N(r,a,i,o)})}else C(n,a,t,e);return a}function m(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(y);return T(n,t),n}function y(){}function x(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return st.error=e,st}}function w(t,e,n,r){try{t.call(e,n,r)}catch(a){return a}}function k(t,e,n){Q(function(t){var r=!1,a=w(n,e,function(n){r||(r=!0,e!==n?T(t,n):z(t,n))},function(e){r||(r=!0,S(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&a&&(r=!0,S(t,a))},t)}function M(t,e){e._state===it?z(t,e._result):e._state===lt?S(t,e._result):C(e,void 0,function(e){T(t,e)},function(e){S(t,e)})}function A(t,e,n){e.constructor===t.constructor&&n===rt&&constructor.resolve===at?M(t,e):n===st?S(t,st.error):void 0===n?z(t,e):i(n)?k(t,e,n):z(t,e)}function T(t,e){t===e?S(t,x()):o(e)?A(t,e,_(e)):z(t,e)}function L(t){t._onerror&&t._onerror(t._result),E(t)}function z(t,e){t._state===ot&&(t._result=e,t._state=it,0!==t._subscribers.length&&Q(E,t))}function S(t,e){t._state===ot&&(t._state=lt,t._result=e,Q(L,t))}function C(t,e,n,r){var a=t._subscribers,o=a.length;t._onerror=null,a[o]=e,a[o+it]=n,a[o+lt]=r,0===o&&t._state&&Q(E,t)}function E(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,a,o=t._result,i=0;ii;i++)C(r.resolve(t[i]),void 0,e,n);return a}function j(t){var e=this,n=new e(y);return S(n,t),n}function F(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function q(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function B(t){this._id=ht++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==t&&("function"!=typeof t&&F(),this instanceof B?D(this,t):q())}function H(t,e){this._instanceConstructor=t,this.promise=new t(y),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?z(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&z(this.promise,this._result))):S(this.promise,this._validationError())}function V(){var t;if("undefined"!=typeof a)t=a;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;n&&"[object Promise]"===Object.prototype.toString.call(n.resolve())&&!n.cast||(t.Promise=pt)}var Z;Z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var Y,U,X,G=Z,$=0,Q=function(t,e){nt[$]=t,nt[$+1]=e,$+=2,2===$&&(U?U(p):X())},W="undefined"!=typeof window?window:void 0,J=W||{},K=J.MutationObserver||J.WebKitMutationObserver,tt="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);X=tt?c():K?f():et?d():void 0===W&&"function"==typeof e?g():h();var rt=v,at=m,ot=void 0,it=1,lt=2,st=new O,ct=new O,ut=I,ft=R,dt=j,ht=0,pt=B;B.all=ut,B.race=ft,B.resolve=at,B.reject=dt,B._setScheduler=l,B._setAsap=s,B._asap=Q,B.prototype={constructor:B,then:rt,"catch":function(t){return this.then(null,t)}};var gt=H;H.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},H.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ot&&t>n;n++)this._eachEntry(e[n],n)},H.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===at){var a=_(t);if(a===rt&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof a)this._remaining--,this._result[e]=t;else if(n===pt){var o=new n(y);A(o,t,a),this._willSettleAt(o,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},H.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ot&&(this._remaining--,t===lt?S(r,n):this._result[e]=n),0===this._remaining&&z(r,this._result)},H.prototype._willSettleAt=function(t,e){var n=this;C(t,void 0,function(t){n._settledAt(it,e,t)},function(t){n._settledAt(lt,e,t)})};var vt=V,mt={Promise:pt,polyfill:vt};"function"==typeof t&&t.amd?t(function(){return mt}):"undefined"!=typeof n&&n.exports?n.exports=mt:"undefined"!=typeof this&&(this.ES6Promise=mt),vt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:8}],11:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;n>r;r++)if(e=t.charCodeAt(r),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],12:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,v=o*l,m=o*s;return t[0]=1-f-p,t[1]=u+m,t[2]=d-v,t[3]=0,t[4]=u-m,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+v,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],13:[function(e,n,r){!function(){function e(t,n){if(t=t?t:"",n=n||{},t instanceof e)return t;if(!(this instanceof e))return new e(t,n);var a=r(t);this._originalInput=t,this._r=a.r,this._g=a.g,this._b=a.b,this._a=a.a,this._roundA=B(100*this._a)/100,this._format=n.format||a.format,this._gradientType=n.gradientType,this._r<1&&(this._r=B(this._r)),this._g<1&&(this._g=B(this._g)),this._b<1&&(this._b=B(this._b)),this._ok=a.ok,this._tc_id=F++}function r(t){var e={r:0,g:0,b:0},n=1,r=!1,o=!1;return"string"==typeof t&&(t=D(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(e=a(t.r,t.g,t.b),r=!0,o="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=O(t.s),t.v=O(t.v),e=s(t.h,t.s,t.v),r=!0,o="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=O(t.s),t.l=O(t.l),e=i(t.h,t.s,t.l),r=!0,o="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=A(n),{ok:r,format:t.format||o,r:H(255,V(e.r,0)),g:H(255,V(e.g,0)),b:H(255,V(e.b,0)),a:n}}function a(t,e,n){return{r:255*T(t,255),g:255*T(e,255),b:255*T(n,255)}}function o(t,e,n){t=T(t,255),e=T(e,255),n=T(n,255);var r,a,o=V(t,e,n),i=H(t,e,n),l=(o+i)/2;if(o==i)r=a=0;else{var s=o-i;switch(a=l>.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(n>e?6:0);break;case e:r=(n-t)/s+2;break;case n:r=(t-e)/s+4}r/=6}return{h:r,s:a,l:l}}function i(t,e,n){function r(t,e,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?t+6*(e-t)*n:.5>n?e:2/3>n?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=T(t,360),e=T(e,100),n=T(n,100),0===e)a=o=i=n;else{var l=.5>n?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function l(t,e,n){t=T(t,255),e=T(e,255),n=T(n,255);var r,a,o=V(t,e,n),i=H(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(n>e?6:0);break;case e:r=(n-t)/s+2;break;case n:r=(t-e)/s+4}r/=6}return{h:r,s:a,v:l}}function s(t,e,n){t=6*T(t,360),e=T(e,100),n=T(n,100);var r=q.floor(t),a=t-r,o=n*(1-e),i=n*(1-a*e),l=n*(1-(1-a)*e),s=r%6,c=[n,i,o,o,l,n][s],u=[l,n,n,i,o,o][s],f=[o,o,l,n,n,i][s];return{r:255*c,g:255*u,b:255*f}}function c(t,e,n,r){var a=[E(B(t).toString(16)),E(B(e).toString(16)),E(B(n).toString(16))];return r&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function u(t,e,n,r){var a=[E(P(r)),E(B(t).toString(16)),E(B(e).toString(16)),E(B(n).toString(16))];return a.join("")}function f(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.s-=n/100,r.s=L(r.s),e(r)}function d(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.s+=n/100,r.s=L(r.s),e(r)}function h(t){return e(t).desaturate(100)}function p(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.l+=n/100,r.l=L(r.l),e(r)}function g(t,n){n=0===n?0:n||10;var r=e(t).toRgb();return r.r=V(0,H(255,r.r-B(255*-(n/100)))),r.g=V(0,H(255,r.g-B(255*-(n/100)))),r.b=V(0,H(255,r.b-B(255*-(n/100)))),e(r)}function v(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.l-=n/100,r.l=L(r.l),e(r)}function m(t,n){var r=e(t).toHsl(),a=(B(r.h)+n)%360;return r.h=0>a?360+a:a,e(r)}function y(t){var n=e(t).toHsl();return n.h=(n.h+180)%360,e(n)}function x(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+120)%360,s:n.s,l:n.l}),e({h:(r+240)%360,s:n.s,l:n.l})]}function b(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+90)%360,s:n.s,l:n.l}),e({h:(r+180)%360,s:n.s,l:n.l}),e({h:(r+270)%360,s:n.s,l:n.l})]}function _(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+72)%360,s:n.s,l:n.l}),e({h:(r+216)%360,s:n.s,l:n.l})]}function w(t,n,r){n=n||6,r=r||30;var a=e(t).toHsl(),o=360/r,i=[e(t)];for(a.h=(a.h-(o*n>>1)+720)%360;--n;)a.h=(a.h+o)%360,i.push(e(a));return i}function k(t,n){n=n||6;for(var r=e(t).toHsv(),a=r.h,o=r.s,i=r.v,l=[],s=1/n;n--;)l.push(e({h:a,s:o,v:i})),i=(i+s)%1;return l}function M(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function A(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function T(t,e){S(t)&&(t="100%");var n=C(t);return t=H(e,V(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),q.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function L(t){return H(1,V(0,t))}function z(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function C(t){return"string"==typeof t&&-1!=t.indexOf("%")}function E(t){return 1==t.length?"0"+t:""+t}function O(t){return 1>=t&&(t=100*t+"%"),t}function P(t){return Math.round(255*parseFloat(t)).toString(16)}function N(t){return z(t)/255}function D(t){t=t.replace(R,"").replace(j,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=X.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=X.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=X.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=X.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=X.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=X.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=X.hex8.exec(t))?{a:N(n[1]),r:z(n[2]),g:z(n[3]),b:z(n[4]),format:e?"name":"hex8"}:(n=X.hex6.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),format:e?"name":"hex"}:(n=X.hex3.exec(t))?{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function I(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var R=/^\s+/,j=/\s+$/,F=0,q=Math,B=q.round,H=q.min,V=q.max,Z=q.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,n,r,a,o,i=this.toRgb();return t=i.r/255,e=i.g/255,n=i.b/255,r=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),a=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),o=.03928>=n?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o},setAlpha:function(t){return this._a=A(t),this._roundA=B(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=B(360*t.h),n=B(100*t.s),r=B(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=B(360*t.h),n=B(100*t.s),r=B(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return u(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:B(this._r),g:B(this._g),b:B(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+B(this._r)+", "+B(this._g)+", "+B(this._b)+")":"rgba("+B(this._r)+", "+B(this._g)+", "+B(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:B(100*T(this._r,255))+"%",g:B(100*T(this._g,255))+"%",b:B(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+B(100*T(this._r,255))+"%, "+B(100*T(this._g,255))+"%, "+B(100*T(this._b,255))+"%)":"rgba("+B(100*T(this._r,255))+"%, "+B(100*T(this._g,255))+"%, "+B(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:U[c(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+u(this._r,this._g,this._b,this._a),r=n,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=e(t);r=o.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(g,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(d,arguments)},greyscale:function(){return this._applyModification(h,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(x,arguments)},tetrad:function(){return this._applyCombination(b,arguments)}},e.fromRatio=function(t,n){if("object"==typeof t){var r={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?r[a]=t[a]:r[a]=O(t[a]));t=r}return e(t,n)},e.equals=function(t,n){return t&&n?e(t).toRgbString()==e(n).toRgbString():!1},e.random=function(){return e.fromRatio({r:Z(),g:Z(),b:Z()})},e.mix=function(t,n,r){r=0===r?0:r||50;var a,o=e(t).toRgb(),i=e(n).toRgb(),l=r/100,s=2*l-1,c=i.a-o.a;a=s*c==-1?s:(s+c)/(1+s*c),a=(a+1)/2;var u=1-a,f={r:i.r*a+o.r*u,g:i.g*a+o.g*u,b:i.b*a+o.b*u,a:i.a*l+o.a*(1-l)};return e(f)},e.readability=function(t,n){var r=e(t),a=e(n);return(Math.max(r.getLuminance(),a.getLuminance())+.05)/(Math.min(r.getLuminance(),a.getLuminance())+.05)},e.isReadable=function(t,n,r){var a,o,i=e.readability(t,n);switch(o=!1,a=I(r),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},e.mostReadable=function(t,n,r){var a,o,i,l,s=null,c=0;r=r||{},o=r.includeFallbackColors,i=r.level,l=r.size;for(var u=0;uc&&(c=a,s=e(n[u]));return e.isReadable(t,s,{level:i,size:l})||!o?s:(r.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],r))};var Y=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=e.hexNames=M(Y),X=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+a),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof n&&n.exports?n.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],14:[function(t,e,n){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],15:[function(t,e,n){"use strict";var r=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":94,"../../plots/cartesian/constants":121,"../../plots/font_attributes":134,"./arrow_paths":14}],16:[function(t,e,n){"use strict";function r(t,e){function n(e,n){return c.coerce(t,r,v.layoutAttributes,e,n)}var r={};n("opacity"),n("align"),n("bgcolor");var a=n("bordercolor"),o=f.opacity(a);n("borderpad");var i=n("borderwidth"),l=n("showarrow");l&&(n("arrowcolor",o?r.bordercolor:f.defaultLine),n("arrowhead"),n("arrowsize"),n("arrowwidth",2*(o&&i||1)),n("ax"),n("ay"),n("axref"),n("ayref"),c.noneOrAll(t,r,["ax","ay"])),n("text",l?" ":"new text"),n("textangle"),c.coerceFont(n,"font",e.font); for(var s=["x","y"],d=0;2>d;d++){var h=s[d],p={_fullLayout:e},g=u.coerceRef(t,r,p,h),m=u.coerceARef(t,r,p,h),y=.5;if("paper"!==g){var x=u.getFromId(p,g);if(y=x.range[0]+y*(x.range[1]-x.range[0]),-1!==["date","category"].indexOf(x.type)&&"string"==typeof t[h]){var b;if("date"===x.type){if(b=c.dateTime2ms(t[h]),b!==!1&&(t[h]=b),m===g){var _=c.dateTime2ms(t["a"+h]);_!==!1&&(t["a"+h]=_)}}else(x._categories||[]).length&&(b=x._categories.indexOf(t[h]),-1!==b&&(t[h]=b))}}n(h,y),l||n(h+"anchor")}return c.noneOrAll(t,r,["x","y"]),r}function a(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=u.getFromId(t,e.xref),r=u.getFromId(t,e.yref);if(n||r){var a=(e._xsize||0)/2,o=e._xshift||0,i=(e._ysize||0)/2,l=e._yshift||0,s=a-o,c=a+o,f=i-l,d=i+l;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;s=Math.max(s,h),c=Math.max(c,h),f=Math.max(f,h),d=Math.max(d,h)}n&&n.autorange&&u.expand(n,[n.l2c(e.x)],{ppadplus:c,ppadminus:s}),r&&r.autorange&&u.expand(r,[r.l2c(e.y)],{ppadplus:d,ppadminus:f})}})}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,v=(c*f-s*d)/p;return 0>v||v>1||0>g||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../lib"),u=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),h=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),g=t("../dragelement"),v=e.exports={};v.ARROWPATHS=t("./arrow_paths"),v.layoutAttributes=t("./attributes"),v.supplyLayoutDefaults=function(t,e){for(var n=t.annotations||[],a=e.annotations=[],o=0;ot?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var r=G.select(".annotation-math-group"),a=!r.empty(),l=d.bBox((a?r:tt).node()),h=l.width,m=l.height,y=Math.round(h+2*W),x=Math.round(m+2*W);B._w=h,B._h=m;var b=!1;if(["x","y"].forEach(function(e){var r,a=B[e+"ref"]||e,o=u.getFromId(t,a),i=(Y+("x"===e?0:90))*Math.PI/180,l=y*Math.abs(Math.cos(i))+x*Math.abs(Math.sin(i)),s=B[e+"anchor"];if(o){if(!o.autorange&&(B[e]-o.range[0])*(B[e]-o.range[1])>0&&(B["a"+e+"ref"]===a?(B["a"+e]-o.range[0])*(B["a"+e]-o.range[1])>0&&(b=!0):b=!0,b))return;Z[e]=o._offset+o.l2p(B[e]),r=.5}else r=B[e],"y"===e&&(r=1-r),Z[e]="x"===e?S.l+S.w*r:S.t+S.h*r;var c=0;B["a"+e+"ref"]===a?Z["aa"+e]=o._offset+o.l2p(B["a"+e]):(c=B.showarrow?B["a"+e]:l*n(r,s),Z[e]+=c),B["_"+e+"type"]=o&&o.type,B["_"+e+"size"]=l,B["_"+e+"shift"]=c}),b)return void G.remove();var w,k;B.showarrow&&(w=B.axref===B.xref?Z.x:c.constrain(Z.x-B.ax,1,_.width-1),k=B.ayref===B.yref?Z.y:c.constrain(Z.y-B.ay,1,_.height-1)),Z.x=c.constrain(Z.x,1,_.width-1),Z.y=c.constrain(Z.y,1,_.height-1);var M=W-l.top,A=W-l.left;a?r.select("svg").attr({x:W-1,y:W}):(tt.attr({x:A,y:M}),tt.selectAll("tspan.line").attr({y:M,x:A})),J.call(d.setRect,$/2,$/2,y-$,x-$);var T=0,L=0;T=B.axref===B.xref?Math.round(Z.aax-y/2):Math.round(Z.x-y/2),L=B.ayref===B.yref?Math.round(Z.aay-x/2):Math.round(Z.y-x/2),G.call(c.setTranslate,T,L);var z="annotations["+e+"]",C=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=B.axref===B.xref?Z.aax+n:Z.x+n,l=B.ayref===B.yref?Z.aay+r:Z.y+r;var u=c.rotationXYMatrix(Y,a,l),d=c.apply2DTransform(u),h=c.apply2DTransform2(u),p=J.attr("width")/2,m=J.attr("height")/2,y=[[a-p,l-m,a-p,l+m],[a-p,l+m,a+p,l+m],[a+p,l+m,a+p,l-m],[a+p,l-m,a-p,l-m]].map(h);if(!y.reduce(function(t,e){return t^!!o(w,k,w+1e6,k+1e6,e[0],e[1],e[2],e[3])},!1)){y.forEach(function(t){var e=o(a,l,w,k,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var x=B.arrowwidth,b=B.arrowcolor,_=U.append("g").style({opacity:f.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=_.append("path").attr("d","M"+a+","+l+"L"+w+","+k).style("stroke-width",x+"px").call(f.stroke,f.rgb(b));v.arrowhead(M,B.arrowhead,"end",B.arrowsize);var A=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-w)+","+(l-k),transform:"translate("+w+","+k+")"}).style("stroke-width",x+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,C;g.init({element:A.node(),prepFn:function(){var t=c.getTranslate(G);L=t.x,C=t.y,T={},H&&H.autorange&&(T[H._name+".autorange"]=!0),V&&V.autorange&&(T[V._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var n=d(L,C),r=n[0]+t,a=n[1]+e;G.call(c.setTranslate,r,a),T[z+".x"]=H?B.x+t/H._m:(w+t-S.l)/S.w,T[z+".y"]=V?B.y+e/V._m:1-(k+e-S.t)/S.h,B.axref===B.xref&&(T[z+".ax"]=H?B.ax+t/H._m:(w+t-S.l)/S.w),B.ayref===B.yref&&(T[z+".ay"]=V?B.ay+e/V._m:1-(k+e-S.t)/S.h),X.attr({transform:"rotate("+Y+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};B.showarrow&&C(0,0);var E=c.rotationXYMatrix(Y,Z.x,Z.y),O=c.apply2DTransform(E);if(t._context.editable){var P,N,D;g.init({element:G.node(),prepFn:function(){var t=c.getTranslate(G);P=t.x,N=t.y,D={}},moveFn:function(t,e){G.call(c.setTranslate,P+t,N+e);var n="pointer";if(B.showarrow)B.axref===B.xref?D[z+".ax"]=H.p2l(H.l2p(B.ax)+t):D[z+".ax"]=B.ax+t,B.ayref===B.yref?D[z+".ay"]=V.p2l(V.l2p(B.ay)+e):D[z+".ay"]=B.ay+e,C(t,e);else{if(H)D[z+".x"]=B.x+t/H._m;else{var r=B._xsize/S.w,a=B.x+B._xshift/S.w-r/2;D[z+".x"]=g.align(a+t/S.w,r,0,1,B.xanchor)}if(V)D[z+".y"]=B.y+e/V._m;else{var o=B._ysize/S.h,i=B.y-B._yshift/S.h-o/2;D[z+".y"]=g.align(i-e/S.h,o,0,1,B.yanchor)}H&&V||(n=g.getCursor(H?.5:D[z+".x"],V?.5:D[z+".y"],B.xanchor,B.yanchor))}var l=O(P,N),s=l[0]+t,u=l[1]+e;G.call(c.setTranslate,P+t,N+e),X.attr({transform:"rotate("+Y+","+s+","+u+")"}),p(G,n)},doneFn:function(e){if(p(G),e){s.relayout(t,D);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var x,b=t.layout,_=t._fullLayout;if(!l(e)||-1===e){if(!e&&Array.isArray(a))return b.annotations=a,v.supplyLayoutDefaults(b,_),void v.drawAll(t);if("remove"===a)return delete b.annotations,_.annotations=[],void v.drawAll(t);if(n&&"add"!==a){for(x=0;x<_.annotations.length;x++)v.draw(t,x,n,a);return}e=_.annotations.length,_.annotations.push({})}if(!n&&a){if("remove"===a){for(_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),_.annotations.splice(e,1),b.annotations.splice(e,1),x=e;x<_.annotations.length;x++)_._infolayer.selectAll('.annotation[data-index="'+(x+1)+'"]').attr("data-index",String(x)),v.draw(t,x);return}if("add"===a||c.isPlainObject(a)){_.annotations.splice(e,0,{});var w=c.isPlainObject(a)?c.extendFlat({},a):{text:"New text"};for(b.annotations?b.annotations.splice(e,0,w):b.annotations=[w],x=_.annotations.length-1;x>e;x--)_._infolayer.selectAll('.annotation[data-index="'+(x-1)+'"]').attr("data-index",String(x)),v.draw(t,x)}}_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var k=b.annotations[e],M=_.annotations[e];if(k){var A={xref:k.xref,yref:k.yref},T={};"string"==typeof n&&n?T[n]=a:c.isPlainObject(n)&&(T=n);var L=Object.keys(T);for(x=0;xx;x++){var E=C[x];if(void 0===T[E]&&void 0!==k[E]){var O=u.getFromId(t,u.coerceRef(A,{},t,E)),P=u.getFromId(t,u.coerceRef(k,{},t,E)),N=k[E],D=M["_"+E+"type"];if(void 0!==T[E+"ref"]){var I="auto"===k[E+"anchor"],R="x"===E?S.w:S.h,j=(M["_"+E+"size"]||0)/(2*R);if(O&&P)N=(N-O.range[0])/(O.range[1]-O.range[0]),N=P.range[0]+N*(P.range[1]-P.range[0]);else if(O){if(N=(N-O.range[0])/(O.range[1]-O.range[0]),N=O.domain[0]+N*(O.domain[1]-O.domain[0]),I){var F=N+j,q=N-j;2/3>N+q?N=q:N+F>4/3&&(N=F)}}else P&&(I&&(1/3>N?N+=j:N>2/3&&(N-=j)),N=(N-P.domain[0])/(P.domain[1]-P.domain[0]),N=P.range[0]+N*(P.range[1]-P.range[0]))}P&&P===O&&D&&("log"===D&&"log"!==P.type?N=Math.pow(10,N):"log"!==D&&"log"===P.type&&(N=N>0?Math.log(N)/Math.LN10:void 0)),k[E]=N}}var B=r(k,_);_.annotations[e]=B;var H=u.getFromId(t,B.xref),V=u.getFromId(t,B.yref),Z={x:0,y:0},Y=+B.textangle||0,U=_._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",B.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:k,fullAnnotation:B})}),X=U.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),G=X.append("g"),$=B.borderwidth,Q=B.borderpad,W=$+Q,J=G.append("rect").attr("class","bg").style("stroke-width",$+"px").call(f.stroke,B.bordercolor).call(f.fill,B.bgcolor),K=B.font,tt=G.append("text").classed("annotation",!0).attr("data-unformatted",B.text).text(B.text);t._context.editable?tt.call(h.makeEditable,G).call(m).on("edit",function(n){B.text=n,this.attr({"data-unformatted":B.text}),this.call(m);var r={};r["annotations["+e+"].text"]=B.text,H&&H.autorange&&(r[H._name+".autorange"]=!0),V&&V.autorange&&(r[V._name+".autorange"]=!0),s.relayout(t,r)}):tt.call(m),X.attr({transform:"rotate("+Y+","+Z.x+","+Z.y+")"}).call(d.setPosition,Z.x,Z.y)}},v.arrowhead=function(t,e,n,r){l(r)||(r=1);var a=t.node(),o=v.ARROWPATHS[e||0];if(o){"string"==typeof n&&n||(n="end");var s,c,u,h,p=(d.getPx(t,"stroke-width")||1)*r,g=t.style("stroke")||f.defaultLine,m=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=o.backoff*p;if("line"===a.nodeName){if(s={x:+t.attr("x1"),y:+t.attr("y1")},c={x:+t.attr("x2"),y:+t.attr("y2")},u=Math.atan2(s.y-c.y,s.x-c.x),h=u+Math.PI,b){var _=b*Math.cos(u),w=b*Math.sin(u);y&&(s.x-=_,s.y-=w,t.attr({x1:s.x,y1:s.y})),x&&(c.x+=_,c.y+=w,t.attr({x2:c.x,y2:c.y}))}}else if("path"===a.nodeName){var k=a.getTotalLength(),M="";if(y){var A=a.getPointAtLength(0),T=a.getPointAtLength(.1);u=Math.atan2(A.y-T.y,A.x-T.x),s=a.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=a.getPointAtLength(k),z=a.getPointAtLength(k-.1);if(h=Math.atan2(L.y-z.y,L.x-z.x),c=a.getPointAtLength(Math.max(0,k-b)),b){var S=M?2*b:b;M+=k-S+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var C=function(n,r){e>5&&(r=0),i.select(a.parentElement).append("path").attr({"class":t.attr("class"),d:o.path,transform:"translate("+n.x+","+n.y+")rotate("+180*r/Math.PI+")scale("+p+")"}).style({fill:g,opacity:m,"stroke-width":0})};y&&C(s,u),x&&C(c,h)}},v.calcAutorange=function(t){var e=t._fullLayout,n=e.annotations;if(n.length&&t._fullData.length){var r={};n.forEach(function(t){r[t.xref]=!0,r[t.yref]=!0});var o=u.list(t).filter(function(t){return t.autorange&&r[t._id]});if(o.length)return c.syncOrAsync([v.drawAll,a],t)}}},{"../../lib":95,"../../lib/setcursor":104,"../../lib/svg_text_utils":106,"../../plotly":113,"../../plots/cartesian/axes":116,"../color":18,"../dragelement":39,"../drawing":41,"./arrow_paths":14,"./attributes":15,d3:9,"fast-isnumeric":11}],17:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],18:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;es&&(o[1]-=(it-s)/2)):n.node()&&!n.classed("js-placeholder")&&(it=d.bBox(e.node()).height),it){if(it+=5,"top"===b.titleside)J.domain[1]-=it/A.h,o[1]*=-1;else{J.domain[0]+=it/A.h;var u=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-u)*s}e.attr("transform","translate("+o+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(A.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?L[0]:(S[e]+S[e-1])/2,e===S.length-1?L[1]:(S[e]+S[e+1])/2].map(J.c2p).map(Math.round);e!==S.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=E(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:U,width:Math.max(F,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var h=at.select(".cblines").selectAll("path.cbline").data(b.line.color&&b.line.width?z:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){r.select(this).attr("d","M"+U+","+(Math.round(J.c2p(t))+b.line.width/2%1)+"h"+F).call(d.lineGroupStyle,b.line.width,C(t),b.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=U+F+(b.outlinewidth||0)/2-("outside"===b.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(-1===["top","bottom"].indexOf(b.titleside)){var e=J.titlefont.size,n=J._offset+J._length/2,a=A.l+(J.position||0)*A.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));w("h"+J._id+"title",{avoid:{selection:r.select(t).selectAll("g."+J._id+"tick"),side:b.titleside,offsetLeft:A.l,offsetTop:A.t,maxShift:M.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,n){var r,a=x();r=i.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:J,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},l="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+l+",."+l+"-math-group").remove(),p.draw(t,e,u(o,n||{}))}function k(){var n=F+b.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(I=ot.select("text"),I.node()&&!I.classed("js-placeholder")){var r,a=ot.select(".h"+J._id+"title-math-group").node();r=a&&-1!==["top","bottom"].indexOf(b.titleside)?d.bBox(a).width:d.bBox(ot.node()).right-U-A.l,n=Math.max(n,r)}var o=2*b.xpad+n+b.borderwidth+b.outlinewidth/2,l=$-Q;at.select(".cbbg").attr({x:U-b.xpad-(b.borderwidth+b.outlinewidth)/2,y:Q-Z,width:Math.max(o,2),height:Math.max(l+2*Z,2)}).call(h.fill,b.bgcolor).call(h.stroke,b.bordercolor).style({"stroke-width":b.borderwidth}),at.selectAll(".cboutline").attr({x:U,y:Q+b.ypad+("top"===b.titleside?it:0),width:Math.max(F,2),height:Math.max(l-2*b.ypad-it,2)}).call(h.stroke,b.outlinecolor).style({fill:"None","stroke-width":b.outlinewidth});var s=({center:.5,right:1}[b.xanchor]||0)*o;at.attr("transform","translate("+(A.l-s)+","+A.t+")"),i.autoMargin(t,e,{x:b.x,y:b.y,l:o*({right:1,center:.5}[b.xanchor]||0),r:o*({left:1,center:.5}[b.xanchor]||0),t:l*({bottom:1,middle:.5}[b.yanchor]||0),b:l*({top:1,middle:.5}[b.yanchor]||0)})}var M=t._fullLayout,A=M._size;if("function"!=typeof b.fillcolor&&"function"!=typeof b.line.color)return void M._infolayer.selectAll("g."+e).remove();var T,L=r.extent(("function"==typeof b.fillcolor?b.fillcolor:b.line.color).domain()),z=[],S=[],C="function"==typeof b.line.color?b.line.color:function(){return b.line.color},E="function"==typeof b.fillcolor?b.fillcolor:function(){return b.fillcolor},O=b.levels.end+b.levels.size/100,P=b.levels.size,N=1.001*L[0]-.001*L[1],D=1.001*L[1]-.001*L[0];for(T=b.levels.start;0>(T-O)*P;T+=P)T>N&&D>T&&z.push(T);if("function"==typeof b.fillcolor)if(b.filllevels)for(O=b.filllevels.end+b.filllevels.size/100,P=b.filllevels.size,T=b.filllevels.start;0>(T-O)*P;T+=P)T>L[0]&&T1){var rt=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));tt*=rt*c.roundUp(nt/rt,[2,5,10]),(Math.abs(b.levels.start)/b.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=tt}J.domain=[G+Y,G+H-Y],J.setScale();var at=M._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(A.l)+","+Math.round(A.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(A.l)+",-"+Math.round(A.t)+")");J._axislayer=at.select(".cbaxis");var it=0;if(-1!==["top","bottom"].indexOf(b.titleside)){var lt,st=A.l+(b.x+V)*A.w,ct=J.titlefont.size;lt="top"===b.titleside?(1-(G+H-Y))*A.h+A.t+3+.75*ct:(1-(G+Y))*A.h+A.t-3-.25*ct,w(J._id+"title",{attributes:{x:st,y:lt,"text-anchor":"start"}})}var ut=c.syncOrAsync([i.previousPromises,_,i.previousPromises,k],t);if(ut&&ut.then&&(t._promises||[]).push(ut),t._context.editable){var ft,dt,ht;s.init({element:at.node(),prepFn:function(){ft=at.attr("transform"),f(at)},moveFn:function(t,e){at.attr("transform",ft+" translate("+t+","+e+")"),dt=s.align(X+t/A.w,q,0,1,b.xanchor),ht=s.align(G-e/A.h,H,0,1,b.yanchor);var n=s.getCursor(dt,ht,b.xanchor,b.yanchor);f(at,n)},doneFn:function(e){f(at),e&&void 0!==dt&&void 0!==ht&&o.restyle(t,{"colorbar.x":dt,"colorbar.y":ht},x().index)}})}return ut}function x(){var n,r,a=e.substr(2);for(n=0;nu*f?a.RdBu:u>=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":95,"./flip_scale":29,"./scales":36}],26:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":94,"./attributes":24,"./scales.js":36}],27:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":36}],28:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,v=p[d+"min"],m=p[d+"max"],y=p.colorscale,x=r(v)&&r(m)&&m>v;c(f+d+"auto",!x),c(f+d+"min"),c(f+d+"max");var b;void 0!==y&&(b=!l(y)),c(f+"autocolorscale",b);var _=c(f+"colorscale"),w=c(f+"reversescale");if(w&&(g.colorscale=s(_)),"marker.line."!==f){var k;f&&(k=o(p));var M=c(f+"showscale",k);M&&i(p,g,n)}}},{"../../lib":95,"../colorbar/defaults":20,"../colorbar/has_colorbar":22,"./flip_scale":29,"./is_valid_scale":33,"fast-isnumeric":11}],29:[function(t,e,n){"use strict";e.exports=function(t){for(var e,n=t.length,r=new Array(n),a=n-1,o=0;a>=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],30:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":27,"./is_valid_scale_array":34,"./scales":36}],31:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;sd;d++)s=t[d],u[d]=e+s[0]*(n-e),f[d]=a(s[1]).toRgb();var h=r.scale.linear().domain(u).interpolate(r.interpolateObject).range(f);return function(t){if(o(t)){var r=i.constrain(t,e,n),s=h(r);return a(s).toRgbString()}return a(t).isValid()?t:l.defaultLine}}},{"../../lib":95,"../color":18,d3:9,"fast-isnumeric":11,tinycolor2:13}],36:[function(t,e,n){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]], -Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],37:[function(t,e,n){"use strict";e.exports=function(t,e,n,r,a){var o=(t-n)/(r-n),i=o+e/(r-n),l=(o+i)/2;return"left"===a||"bottom"===a?o:"center"===a||"middle"===a?l:"right"===a||"top"===a?i:2/3-l>o?o:i>4/3-l?i:l}},{}],38:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":95}],39:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},v=1,m=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":95,"../../plotly":113,"../../plots/cartesian/constants":121,"./align":37,"./cursor":38,"./unhover":40}],40:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":93}],41:[function(t,e,n){"use strict";function r(t,e,n,r){var o=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(o*o+i*i,b/2),u=Math.pow(l*l+s*s,b/2),f=(u*u*o-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[a.round(e[0]+(h&&f/h),2),a.round(e[1]+(h&&d/h),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&d/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../plots/plots"),l=t("../color"),s=t("../colorscale"),c=t("../../lib"),u=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),h=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(l.fill,r)},p.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},p.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},p.setRect=function(t,e,n,r,a){t.call(p.setPosition,e,n).call(p.setSize,r,a)},p.translatePoints=function(t,e,n){t.each(function(t){var r=t.xp||e.c2p(t.x),i=t.yp||n.c2p(t.y),l=a.select(this);o(r)&&o(i)?"text"===this.nodeName?l.attr("x",r).attr("y",i):l.attr("transform","translate("+r+","+i+")"):l.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):n||0},p.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},i=e||o.width||0,s=r||o.dash||"";a.select(this).call(l.stroke,n||o.color).call(p.dashLine,s,i)})},p.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(l.fill,e[0].trace.fillcolor)}catch(r){c.error(r,t),n.remove()}})};var g=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=p.symbolNames.length,m="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=n.line;if(i.traceIs(e,"symbols")){var o=h(e);t.attr("d",function(t){var r;r="various"===t.ms||"various"===n.size?3:d.isBubble(e)?o(t.ms):(n.size||6)/2,t.mrc=r;var a=p.symbolNumber(t.mx||n.symbol)||0,i=a%100;return t.om=a%200>=100,p.symbolFuncs[i](r)+(a>=200?m:"")}).style("opacity",function(t){return(t.mo+1||n.opacity+1)-1})}var s=(e._input||{}).marker||{},c=p.tryColorscale(n,s,""),u=p.tryColorscale(n,s,"line.");t.each(function(t){var e,o,i;t.so?(i=r.outlierwidth,o=r.outliercolor,e=n.outliercolor):(i=(t.mlw+1||r.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(r.color)?l.defaultLine:r.color,e="mc"in t?t.mcc=c(t.mc):Array.isArray(n.color)?l.defaultLine:n.color||"rgba(0,0,0,0)");var s=a.select(this);t.om?s.call(l.stroke,e).style({"stroke-width":(i||1)+"px",fill:"none"}):(s.style("stroke-width",i+"px").call(l.fill,e),i&&s.call(l.stroke,o))})}},p.tryColorscale=function(t,e,n){var r=c.nestedProperty(t,n+"color").get(),a=c.nestedProperty(t,n+"colorscale").get(),i=c.nestedProperty(t,n+"cauto").get(),l=c.nestedProperty(t,n+"cmin"),u=c.nestedProperty(t,n+"cmax"),f=l.get(),d=u.get();return a&&Array.isArray(r)?(!i&&o(f)&&o(d)||(f=1/0,d=-(1/0),r.forEach(function(t){o(t)&&(f>t&&(f=+t),t>d&&(d=+t))}),f>d&&(f=0,d=1),l.set(f),u.set(d),c.nestedProperty(e,n+"cmin").set(f),c.nestedProperty(e,n+"cmax").set(d)),s.makeScaleFunction(a,f,d)):c.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;p.textPointStyle=function(t,e){t.each(function(t){var n=a.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var i=t.tp||e.textposition,l=-1!==i.indexOf("top")?"top":-1!==i.indexOf("bottom")?"bottom":"middle",s=-1!==i.indexOf("left")?"end":-1!==i.indexOf("right")?"start":"middle",c=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;c=o(c)&&c>0?c:0,n.call(p.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(u.convertToTspans);var d=a.select(this.parentNode),h=n.selectAll("tspan.line"),g=((h[0].length||1)-1)*x+1,v=y[s]*f,m=.75*c+y[l]*f+(y[l]-1)*g*c/2;d.attr("transform","translate("+v+","+m+")"),g>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,a="M"+t[0],o=[];for(n=1;nn;n++)i.push(r(t[n-1],t[n],t[n+1],e));for(i.push(r(t[o-1],t[o],t[0],e)),n=1;o>=n;n++)a+="C"+i[n-1][1]+" "+i[n][0]+" "+t[n];return a+="C"+i[o][1]+" "+i[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+a.round(e[0],2)+"V"+a.round(e[1],2)},vh:function(t,e){return"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},hvh:function(t,e){return"H"+a.round((t[0]+e[0])/2,2)+"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},vhv:function(t,e){return"V"+a.round((t[1]+e[1])/2,2)+"H"+a.round(e[0],2)+"V"+a.round(e[1],2)}},w=function(t,e){return"L"+a.round(e[0],2)+","+a.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var n="M"+a.round(t[0][0],2)+","+a.round(t[0][1],2),r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(s),c.extendFlat({},s)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=a.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":88,"../../lib":95,"../../lib/svg_text_utils":106,"../../plots/plots":136,"../../traces/scatter/make_bubble_size_func":187,"../../traces/scatter/subtypes":192,"../color":18,"../colorscale":32,"./symbol_defs":42,d3:9,"fast-isnumeric":11}],42:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:9}],43:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],44:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&-1!==["linear","log"].indexOf(n.type),c=[];if(s){for(var u=l(o),f=0;fl;l++)i[l]={x:n[l],y:a[l]};return i[0].trace=t,r.calc({calcdata:[i],_fullLayout:e}),i},r.plot=t("./plot"),r.style=t("./style"),r.hoverInfo=function(t,e,n){(e.error_y||{}).visible&&(n.yerr=t.yh-t.y,e.error_y.symmetric||(n.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(n.xerr=t.xh-t.x,e.error_x.symmetric||(n.xerrneg=t.x-t.xs))}},{"./attributes":43,"./calc":44,"./defaults":46,"./plot":48,"./style":49}],48:[function(t,e,n){"use strict";function r(t,e,n){var r={x:e.c2p(t.x),y:n.c2p(t.y)};return void 0!==t.yh&&(r.yh=n.c2p(t.yh),r.ys=n.c2p(t.ys),o(r.ys)||(r.noYS=!0,r.ys=n.c2p(t.ys,!0))),void 0!==t.xh&&(r.xh=e.c2p(t.xh),r.xs=e.c2p(t.xs),o(r.xs)||(r.noXS=!0,r.xs=e.c2p(t.xs,!0))),r}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../lib"),l=t("../../traces/scatter/subtypes");e.exports=function(t,e){var n=e.x(),s=e.y();t.each(function(t){var e=t[0].trace,c=e.error_x||{},u=e.error_y||{},f=l.hasMarkers(e)&&e.marker.maxdisplayed>0;if(u.visible||c.visible){var d=a.select(this).selectAll("g.errorbar").data(i.identity);d.enter().append("g").classed("errorbar",!0),d.each(function(t){var e=a.select(this),i=r(t,n,s);if(!f||t.vis){var l;if(u.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var d=u.width;l="M"+(i.x-d)+","+i.yh+"h"+2*d+"m-"+d+",0V"+i.ys,i.noYS||(l+="m-"+d+",0h"+2*d),e.append("path").classed("yerror",!0).attr("d",l)}if(c.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var h=(c.copy_ystyle?u:c).width;l="M"+i.xh+","+(i.y-h)+"v"+2*h+"m0,-"+h+"H"+i.xs,i.noXS||(l+="m0,-"+h+"v"+2*h),e.append("path").classed("xerror",!0).attr("d",l)}}})}})}},{"../../lib":95,"../../traces/scatter/subtypes":192,d3:9,"fast-isnumeric":11}],49:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":18,d3:9}],50:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":121}],51:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var l=0;2>l;l++){var s={_fullLayout:n},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,a=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],55:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":94,"../../plots/font_attributes":134,"../color/attributes":17}],56:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],57:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/plots"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n){function l(t,e){return r.coerce(d,h,o,t,e)}for(var s,c,u,f,d=t.legend||{},h=e.legend={},p=0,g="normal",v=0;v1);if(y!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),r.coerceFont(l,"font",e.font),l("orientation"),"h"===h.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(s=0,u="left",c=1.1,f="bottom"):(s=0,u="left",c=-.1,f="top")}l("traceorder",g),i.isGrouped(e.legend)&&l("tracegroupgap"),l("x",s),l("xanchor",u),l("y",c),l("yanchor",f),r.noneOrAll(d,h,["x","y"])}}},{"../../lib":95,"../../plots/plots":136,"./attributes":55,"./helpers":60}],58:[function(t,e,n){"use strict";function r(t,e){function n(n){u.util.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=d.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,a.legend.font).text(c),e._context.editable&&!l?f.call(u.util.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" "),u.restyle(e,"name",t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(d.traceIs(l,"pie")){var f=o.label,h=n.indexOf(f);-1===h?n.push(f):n.splice(h,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),h=d[0].length||1;n=s*h,r=u.node()&&p.bBox(u.node()).width;var g=s*(.3+(1-h)/2);u.attr("y",g),d.attr("y",g)}n=Math.max(n,16)+3,o.attr({x:0,y:-n/2,height:n}),a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=x.isGrouped(a);if(x.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),n.selectAll(".legendtoggle").attr("width",(t._context.editable?0:a.width)+40), -a.width=Math.ceil(a.width),a.height=Math.ceil(a.height);else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;d>u;u++){var h=s[u].map(function(t){return t[0].width}),p=40+Math.max.apply(null,h);a.width+=a.tracegroupgap+p,l.push(a.width)}e.each(function(t,e){f.setTranslate(this,l[e],0)}),e.each(function(){var t=c.select(this),e=t.selectAll("g.traces"),n=0;e.each(function(t){var e=t[0],r=e.height;f.setTranslate(this,0,5+o+n+r/2),n+=r}),a.height=Math.max(a.height,n)}),a.height+=10+2*o,a.width+=2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}else{a.width=0,a.height=0;var g=0,v=0,m=0,y=0;n.each(function(t){m=Math.max(40+t[0].width,m)}),n.each(function(t){var e=t[0],n=m,i=a.tracegroupgap||5;o+y+i+n>r.width-(r.margin.r+r.margin.l)&&(y=0,g+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+y,5+o+e.height/2+g),a.width+=i+n,a.height=Math.max(a.height,e.height),y+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}}function l(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center");var a="top";b.isBottomAnchor(n)?a="bottom":b.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../dragelement"),p=t("../drawing"),g=t("../color"),v=t("./constants"),m=t("./get_legend_data"),y=t("./style"),x=t("./helpers"),b=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(p.setRect,j,t,v.scrollBarWidth,v.scrollBarHeight),M.select("rect").attr({y:x.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var x=n.legend,_=n.showlegend&&m(t.calcdata,x),w=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({"class":"legend","pointer-events":"all"});var M=n._topdefs.selectAll("#"+o).data([0]);M.enter().append("clipPath").attr("id",o).append("rect");var A=k.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(g.stroke,x.bordercolor),A.call(g.fill,x.bgcolor),A.style("stroke-width",x.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var z=T.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var C=0!==k.enter().size();C&&(i(t,z,S),l(t));var E=0,O=n.width,P=0,N=n.height;i(t,z,S),x.height>N?s(t):l(t);var D=n._size,I=D.l+D.w*x.x,R=D.t+D.h*(1-x.y);b.isRightAnchor(x)?I-=x.width:b.isCenterAnchor(x)&&(I-=x.width/2),b.isBottomAnchor(x)?R-=x.height:b.isMiddleAnchor(x)&&(R-=x.height/2);var j=x.width,F=D.w;j>F?(I=D.l,j=F):(I+j>O&&(I=O-j),E>I&&(I=E),j=Math.min(O-I,x.width));var q=x.height,B=D.h;q>B?(R=D.t,q=B):(R+q>N&&(R=N-q),P>R&&(R=P),q=Math.min(N-R,x.height)),f.setTranslate(k,I,R);var H,V,Z=q-v.scrollBarHeight-2*v.scrollBarMargin,Y=x.height-q;if(x.height<=q||t._context.staticPlot)A.attr({width:j-x.borderwidth,height:q-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),f.setTranslate(T,0,0),M.select("rect").attr({width:j-2*x.borderwidth,height:q-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth}),T.call(p.setClipUrl,o);else{H=v.scrollBarMargin,V=T.attr("data-scroll")||0,A.attr({width:j-2*x.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:q-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),M.select("rect").attr({width:j-2*x.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:q-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth-V}),T.call(p.setClipUrl,o),C&&e(H,V),k.on("wheel",null),k.on("wheel",function(){V=f.constrain(T.attr("data-scroll")-c.event.deltaY/Z*Y,-Y,0),H=v.scrollBarMargin-V/Y*Z,e(H,V),c.event.preventDefault()}),L.on(".drag",null),T.on(".drag",null);var U=c.behavior.drag().on("drag",function(){H=f.constrain(c.event.y-v.scrollBarHeight/2,v.scrollBarMargin,v.scrollBarMargin+Z),V=-(H-v.scrollBarMargin)/Z*Y,e(H,V)});L.call(U),T.call(U)}if(t._context.editable){var X,G,$,Q;k.classed("cursor-move",!0),h.init({element:k.node(),prepFn:function(){var t=f.getTranslate(k);$=t.x,Q=t.y},moveFn:function(t,e){var n=$+t,r=Q+e;f.setTranslate(k,n,r),X=h.align(n,0,D.l,D.l+D.w,x.xanchor),G=h.align(r,0,D.t+D.h,D.t,x.yanchor)},doneFn:function(e){e&&void 0!==X&&void 0!==G&&u.relayout(t,{"legend.x":X,"legend.y":G})}})}}}},{"../../lib":95,"../../plotly":113,"../../plots/plots":136,"../color":18,"../dragelement":39,"../drawing":41,"./anchor_utils":54,"./constants":56,"./get_legend_data":59,"./helpers":60,"./style":62,d3:9}],59:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[n]]):l[t].push([n]);else{var r="~~i"+f;s.push(r),l[r]=[[n]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;oo;o++)m=l[s[o]],y[o]=a.isReversed(e)?m.reverse():m;else{for(y=[new Array(x)],o=0;x>o;o++)m=l[s[o]][0],y[0][a.isReversed(e)?x-o-1:o]=m;x=1}return e._lgroupsLength=x,y}},{"../../plots/plots":136,"./helpers":60}],60:[function(t,e,n){"use strict";var r=t("../../plots/plots");n.legendGetsTrace=function(t){return t.visible&&r.traceIs(t,"showLegend")},n.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},n.isVertical=function(t){return"h"!==t.orientation},n.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":136}],61:[function(t,e,n){"use strict";var r=e.exports={};r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw"),r.style=t("./style")},{"./attributes":55,"./defaults":57,"./draw":58,"./style":62}],62:[function(t,e,n){"use strict";function r(t){var e=t[0].trace,n=e.visible&&e.fill&&"none"!==e.fill,r=h.hasLines(e),a=s.select(this).select(".legendfill").selectAll("path").data(n?[t]:[]);a.enter().append("path").classed("js-fill",!0),a.exit().remove(),a.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var o=s.select(this).select(".legendlines").selectAll("path").data(r?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(f.lineGroupStyle)}function a(t){function e(t,e,n){var r=c.nestedProperty(i,t).get(),a=Array.isArray(r)&&e?e(r):r;if(n){if(an[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),u=h.hasText(i),d=h.hasLines(i);if(l||u||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(o,p)],a=c.minExtend(i,g)}var v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?r:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../lib"),u=t("../../plots/plots"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":95,"../../plots/plots":136,"../../traces/pie/style_one":171,"../../traces/scatter/subtypes":192,"../color":18,"../drawing":41,d3:9}],63:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,f=(1+u)/2,d=(1-u)/2,h=c.Axes.list(t,null,!0),p=0;py;y++){var x=l[y];d=m[x]={};for(var b=0;b1)return r(["resetViews","toggleHover"]),i(v,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||m||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(v,n)}function a(t){for(var e=s.Axes.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var v=u("bgcolor");u("activecolor",i.contrast(v,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":95,"../color":18,"./attributes":66,"./button_attributes":67,"./constants":68}],70:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;re){var n=e;e=t,t=n}l.setAttributes(w,{"data-min":t,"data-max":e}),l.setAttributes(P,{x:t,width:e-t}),l.setAttributes(A,{width:t}),l.setAttributes(T,{x:e,width:p-e}),l.setAttributes(L,{transform:"translate("+(t-v-1)+")"}),l.setAttributes(C,{transform:"translate("+e+")"})}var f=t._fullLayout,d=f._infolayer.selectAll("g.range-slider"),h=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*h.thickness,v=2,m=Math.floor(h.borderwidth/2),y=f.margin.l,x=f.height-g-f.margin.b,b=0,_=p,w=document.createElementNS(i,"g");l.setAttributes(w,{"class":"range-slider","data-min":b,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+x+")"});var k=document.createElementNS(i,"rect"),M=h.borderwidth%2===0?h.borderwidth:h.borderwidth-1;l.setAttributes(k,{fill:h.bgcolor,stroke:h.bordercolor,"stroke-width":h.borderwidth,height:g+M,width:p+M,transform:"translate(-"+m+", -"+m+")","shape-rendering":"crispEdges"});var A=document.createElementNS(i,"rect");l.setAttributes(A,{x:0,width:b,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(i,"rect");l.setAttributes(T,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var L=document.createElementNS(i,"g"),z=document.createElementNS(i,"rect"),S=document.createElementNS(i,"rect");l.setAttributes(L,{transform:"translate("+(b-v-1)+")"}),l.setAttributes(z,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),l.setAttributes(S,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(L,[S,z]);var C=document.createElementNS(i,"g"),E=document.createElementNS(i,"rect"),O=document.createElementNS(i,"rect"); -l.setAttributes(C,{transform:"translate("+_+")"}),l.setAttributes(E,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),l.setAttributes(O,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(C,[O,E]);var P=document.createElementNS(i,"rect");l.setAttributes(P,{x:b,width:_-b,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function n(t){var n,r,f=+t.clientX-o;switch(a){case P:w.style.cursor="ew-resize",n=+l+f,r=+s+f,u(n,r),c(e(n),e(r));break;case z:w.style.cursor="col-resize",n=+l+f,r=+s,u(n,r),c(e(n),e(r));break;case E:w.style.cursor="col-resize",n=+l,r=+s+f,u(n,r),c(e(n),e(r));break;default:w.style.cursor="ew-resize",n=i,r=i+f,u(n,r),c(e(n),e(r))}}function r(){window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r),w.style.cursor="auto"}var a=t.target,o=t.clientX,i=o-w.getBoundingClientRect().left,l=w.getAttribute("data-min"),s=w.getAttribute("data-max");window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)}),h.range||(h.range=a.getAutoRange(f.xaxis));var N=s(t,p,g);l.appendChildren(w,[k,N,A,T,P,L,C]),n(f.xaxis.range[0],f.xaxis.range[1]),d.data([0]).enter().append(function(){return h.setRange=n,w})}},{"../../constants/xmlns_namespaces":88,"../../lib":95,"../../plotly":113,"../../plots/cartesian/axes":116,"./helpers":76,"./range_plot":78}],75:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(t,e){return r.coerce(l,s,a,t,e)}if(t[n].rangeslider){var l=r.isPlainObject(t[n].rangeslider)?t[n].rangeslider:{},s=e[n].rangeslider={};if(i("bgcolor"),i("bordercolor"),i("borderwidth"),i("thickness"),i("visible"),i("range"),s.range&&!e[n].autorange){var c=s.range,u=e[n].range;c[0]=Math.min(c[0],u[0]),c[1]=Math.max(c[1],u[1])}else e[n]._needsExpand=!0;s.visible&&o.forEach(function(t){var n=e[t]||{};n.fixedrange=!0,e[t]=n})}}},{"../../lib":95,"./attributes":73}],76:[function(t,e,n){"use strict";n.setAttributes=function(t,e){for(var n in e)t.setAttribute(n,e[n])},n.appendChildren=function(t,e){for(var n=0;ns;s++){var c=l[s],u={_fullLayout:e},f=A.coerceRef(t,r,u,c);if("path"!==i){var d=.25,h=.75;if("paper"!==f){var p=A.getFromId(u,f),g=o(p);d=g(p.range[0]+d*(p.range[1]-p.range[0])),h=g(p.range[0]+h*(p.range[1]-p.range[0]))}n(c+"0",d),n(c+"1",h)}}return"path"===i?n("path"):M.noneOrAll(t,r,["x0","x1","y0","y1"]),r}function a(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function i(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function l(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function s(t,e,n){for(var r=0;re;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),C.draw(t,a)}function f(t,e,n,i){function l(n){var r={"data-index":e,"fill-rule":"evenodd",d:x(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",C.opacity).call(T.stroke,a).call(T.fill,C.fillcolor).call(L.dashLine,C.line.dash,C.line.width);E&&o.call(L.setClipUrl,"clip"+t._fullLayout._uid+E),t._context.editable&&d(t,o,C,e)}var s,c;h(t,e).selectAll('[data-index="'+e+'"]').remove();var u=t.layout.shapes[e];if(u){var f={xref:u.xref,yref:u.yref},g={};"string"==typeof n&&n?g[n]=i:M.isPlainObject(n)&&(g=n);var v=Object.keys(g);for(s=0;ss;s++){var b=y[s];if(void 0===g[b]&&void 0!==u[b]){var _,w=b.charAt(0),k=A.getFromId(t,A.coerceRef(f,{},t,w)),z=A.getFromId(t,A.coerceRef(u,{},t,w)),S=u[b];void 0!==g[w+"ref"]&&(k?(_=a(k)(S),S=(_-k.range[0])/(k.range[1]-k.range[0])):S=(S-z.domain[0])/(z.domain[1]-z.domain[0]),z?(_=z.range[0]+S*(z.range[1]-z.range[0]),S=o(z)(_)):S=k.domain[0]+S*(k.domain[1]-k.domain[0])),u[b]=S}}var C=r(u,t._fullLayout);t._fullLayout.shapes[e]=C;var E;if("below"!==C.layer)E=(C.xref+C.yref).replace(/paper/g,""),l(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)E="",l(t._fullLayout._shapeLowerLayer);else{var O,P=t._fullLayout._plots||{},N=Object.keys(P);for(s=0,c=N.length;c>s;s++)O=P[N[s]],E=N[s],p(t,C,O)&&l(O.shapelayer)}}}function d(t,e,n,r){function a(t){var n=W.right-W.left,r=W.bottom-W.top,a=t.clientX-W.left,o=t.clientY-W.top,i=n>G&&r>$&&!t.shiftKey?z.getCursor(a/n,1-o/r):"move";S(e,i),X=i.split("-")[0]}function o(e){B=A.getFromId(t,n.xref),H=A.getFromId(t,n.yref),V=m(t,B),Z=m(t,H,!0),Y=y(t,B),U=y(t,H,!0);var o="shapes["+r+"]";"path"===n.type?(F=n.path,q=o+".path"):(u=V(n.x0),f=Z(n.y0),d=V(n.x1),h=Z(n.y1),p=o+".x0",g=o+".y0",_=o+".x1",w=o+".y1"),d>u?(L=u,P=o+".x0",R="x0",C=d,N=o+".x1",j="x1"):(L=d,P=o+".x1",R="x1",C=u,N=o+".x0",j="x0"),h>f?(M=f,E=o+".y0",D="y0",T=h,O=o+".y1",I="y1"):(M=h,E=o+".y1",D="y1",T=f,O=o+".y0",I="y0"),c={},a(e),Q.moveFn="move"===X?l:s}function i(n){S(e),n&&k.relayout(t,c)}function l(r,a){if("path"===n.type){var o=function(t){return Y(V(t)+r)};B&&"date"===B.type&&(o=v(o));var i=function(t){return U(Z(t)+a)};H&&"date"===H.type&&(i=v(i)),n.path=b(F,o,i),c[q]=n.path}else c[p]=n.x0=Y(u+r),c[g]=n.y0=U(f+a),c[_]=n.x1=Y(d+r),c[w]=n.y1=U(h+a);e.attr("d",x(t,n))}function s(r,a){if("path"===n.type){var o=function(t){return Y(V(t)+r)};B&&"date"===B.type&&(o=v(o));var i=function(t){return U(Z(t)+a)};H&&"date"===H.type&&(i=v(i)),n.path=b(F,o,i),c[q]=n.path}else{var l=~X.indexOf("n")?M+a:M,s=~X.indexOf("s")?T+a:T,u=~X.indexOf("w")?L+r:L,f=~X.indexOf("e")?C+r:C;s-l>$&&(c[E]=n[D]=U(l),c[O]=n[I]=U(s)),f-u>G&&(c[P]=n[R]=Y(u),c[N]=n[j]=Y(f))}e.attr("d",x(t,n))}var c,u,f,d,h,p,g,_,w,M,T,L,C,E,O,P,N,D,I,R,j,F,q,B,H,V,Z,Y,U,X,G=10,$=10,Q={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Q.element.getBoundingClientRect();z.init(Q)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):M.log("getShapeLayer: undefined shape: index",e),r}function p(t,e,n){var r=k.Axes.getFromId(t,n.id,"x")._id,a=k.Axes.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function v(t){return function(e){return t(e).replace(" ","_")}}function m(t,e,n){var r,o=t._fullLayout._size;if(e){var i=a(e);r=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(r=g(r))}else r=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return r}function y(t,e,n){var r,a=t._fullLayout._size;if(e){var i=o(e);r=function(t){return i(e.p2l(t-e._offset))}}else r=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return r}function x(t,e){var n,r,o,i,l=e.type,s=A.getFromId(t,e.xref),c=A.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=a(s),r=function(t){return s._offset+s.l2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(o=a(c),i=function(t){return c._offset+c.l2p(o(t,!0))}):i=function(t){return u.t+u.h*(1-t)},"path"===l)return s&&"date"===s.type&&(r=g(r)),c&&"date"===c.type&&(i=g(i)),C.convertPath(e.path,r,i);var f=r(e.x0),d=r(e.x1),h=i(e.y0),p=i(e.y1);if("line"===l)return"M"+f+","+h+"L"+d+","+p;if("rect"===l)return"M"+f+","+h+"H"+d+"V"+p+"H"+f+"Z";var v=(f+d)/2,m=(h+p)/2,y=Math.abs(v-f),x=Math.abs(m-h),b="A"+y+","+x,_=v+y+","+m,w=v+","+(m-x);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function b(t,e,n){return t.replace(E,function(t){var r=0,a=t.charAt(0),o=P[a],i=N[a],l=D[a],s=t.substr(1).replace(O,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}function _(t,e,n,r,a){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(n)];if(r){var i,l,s,c,u,f=1/0,d=-(1/0),h=r.match(E);for("date"===t.type&&(o=g(o)),i=0;iu&&(f=u),u>d&&(d=u)));return d>=f?[f,d]:void 0}}var w=t("fast-isnumeric"),k=t("../../plotly"),M=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),L=t("../drawing"),z=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var n=t.shapes||[],a=e.shapes=[],o=0;ol&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),M.log("Ignoring extra params in segment "+t)),a+s})},C.calcAutorange=function(t){var e,n,r,a,o,i=t._fullLayout,l=i.shapes;if(l.length&&t._fullData.length)for(e=0;ed?n=d:(u.left-=x.offsetLeft,u.right-=x.offsetLeft,u.top-=x.offsetTop,u.bottom-=x.offsetTop,x.selection.each(function(){var t=s.bBox(this);l.bBoxIntersect(u,t,c)&&(n=Math.max(n,i*(t[x.side]-u[o])+c))}),n=Math.min(d,n)),n>0||0>d){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,S=E,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,v=n.propName,m=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var E="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(u.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",z)}},{"../../lib":95,"../../lib/svg_text_utils":106,"../../plotly":113,"../../plots/plots":136,"../color":18,"../drawing":41,d3:9,"fast-isnumeric":11}],82:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:i,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":94,"../../plots/font_attributes":134,"../color/attributes":17}],83:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],84:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(s.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),s.exit().remove(),s.exit().size()&&m(t),0!==n.length){var c=s.selectAll("g."+T.headerGroupClassName).data(n,a);c.enter().append("g").classed(T.headerGroupClassName,!0);var u=s.selectAll("g."+T.buttonGroupClassName).data([0]);u.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&u.call(v).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){y.select(this).remove(),u.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],88:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],89:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.16.2",n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=r.register,n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=r.Snapshot,n.PlotSchema=r.PlotSchema,n.Queue=r.Queue,n.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":110,"./plot_api/to_image":111,"./plot_api/validate":112,"./plotly":113,"./snapshot/download":143,d3:9}],90:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],91:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)}},"boolean":{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(i(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n?!0:"string"!=typeof t?!1:!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var s=i[0].split("-");if(s.length>3||3!==s.length&&i[1])return!1;if(4===s[0].length)n=Number(s[0]);else{if(2!==s[0].length)return!1;var c=(new Date).getFullYear();n=((Number(s[0])-c+70)%100+200)%100+c-70}return l(n)?1===s.length?new Date(n,0,1).getTime():(r=Number(s[1])-1,s[1].length>2||!(r>=0&&11>=r)?!1:2===s.length?new Date(n,r,1).getTime():(a=Number(s[2]),s[2].length>2||!(a>=1&&31>=a)?!1:(a=new Date(n,r,a).getTime(),i[1]?(s=i[1].split(":"),s.length>3?!1:(o=Number(s[0]),s[0].length>2||!(o>=0&&23>=o)?!1:(a+=36e5*o,1===s.length?a:(r=Number(s[1]),s[1].length>2||!(r>=0&&59>=r)?!1:(a+=6e4*r,2===s.length?a:(t=Number(s[2]),t>=0&&60>t?a+1e3*t:!1)))))):a))):!1},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){if("undefined"==typeof i)return void s.error("d3 is not defined.");e||(e=0);var n=new Date(t),a=i.time.format("%Y-%m-%d")(n);return 7776e6>e?(a+=" "+r(n.getHours(),2),432e6>e&&(a+=":"+r(n.getMinutes(),2),108e5>e&&(a+=":"+r(n.getSeconds(),2),3e5>e&&(a+="."+r(n.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var c={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"]},u={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"]},f=i.time.format.utc,d={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[], -D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){d[t].D.push(f(e)),["H","I","D"].forEach(function(n){c[n].forEach(function(r){var a=d[t][n];a.push(f(e+"~"+r)),a.push(f(r+"~"+e))})})})});var h=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,v=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},x=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,k=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return M[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(h,p).replace(g,"").replace(v,"~").replace(m,y).replace(k,A).trim().replace(T,"");var e,n,r=null,i=a(t),l=o(t);e=d[i][l],n=e.length;for(var s=0;n>s&&!(r=e[s].parse(t));s++);if(!(r instanceof Date))return!1;var c=r.getTimezoneOffset();return r.setTime(r.getTime()+60*c*1e3),r}},{"../lib":95,d3:9,"fast-isnumeric":11}],93:[function(t,e,n){"use strict";var r=t("events").EventEmitter,a={init:function(t){if(t._ev instanceof r)return t;var e=new r;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(n,r){"undefined"!=typeof jQuery&&jQuery(t).trigger(n,r),e.emit(n,r)},t},triggerHandler:function(t,e,n){var r,a;"undefined"!=typeof jQuery&&(r=jQuery(t).triggerHandler(e,n));var o=t._ev;if(!o)return r;var i=o._events[e];if(!i)return r;"function"==typeof i&&(i=[i]);for(var l=i.pop(),s=0;sm;m++){s=t[m];for(c in s)u=g[c],f=s[c],l&&i(f)?g[c]=f:e&&f&&(o(f)||(d=i(f)))?(d?(d=!1,h=u&&i(u)?u:[]):h=u&&o(u)?u:{},g[c]=a([h,f],e,n,l)):("undefined"!=typeof f||n)&&(g[c]=f)}return g}var o=t("./is_plain_object.js"),i=Array.isArray;n.extendFlat=function(){return a(arguments,!1,!1,!1)},n.extendDeep=function(){return a(arguments,!0,!1,!1)},n.extendDeepAll=function(){return a(arguments,!0,!0,!1)},n.extendDeepNoArrays=function(){return a(arguments,!0,!1,!0)}},{"./is_plain_object.js":96}],95:[function(t,e,n){"use strict";var r=t("d3"),a=e.exports={};a.nestedProperty=t("./nested_property"),a.isPlainObject=t("./is_plain_object");var o=t("./coerce");a.valObjects=o.valObjects,a.coerce=o.coerce,a.coerce2=o.coerce2,a.coerceFont=o.coerceFont,a.validate=o.validate;var i=t("./dates");a.dateTime2ms=i.dateTime2ms,a.isDateTime=i.isDateTime,a.ms2DateTime=i.ms2DateTime,a.parseDate=i.parseDate;var l=t("./search");a.findBin=l.findBin,a.sorterAsc=l.sorterAsc,a.sorterDes=l.sorterDes,a.distinctVals=l.distinctVals,a.roundUp=l.roundUp;var s=t("./stats");a.aggNums=s.aggNums,a.len=s.len,a.mean=s.mean,a.variance=s.variance,a.stdev=s.stdev,a.interp=s.interp;var c=t("./matrix");a.init2dArray=c.init2dArray,a.transposeRagged=c.transposeRagged,a.dot=c.dot,a.translationMatrix=c.translationMatrix,a.rotationMatrix=c.rotationMatrix,a.rotationXYMatrix=c.rotationXYMatrix,a.apply2DTransform=c.apply2DTransform,a.apply2DTransform2=c.apply2DTransform2;var u=t("./extend");a.extendFlat=u.extendFlat,a.extendDeep=u.extendDeep,a.extendDeepAll=u.extendDeepAll,a.extendDeepNoArrays=u.extendDeepNoArrays;var f=t("./loggers");a.log=f.log,a.warn=f.warn,a.error=f.error,a.notifier=t("./notifier"),a.swapAttrs=function(t,e,n,r){n||(n="x"),r||(r="y");for(var o=0;on?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.randstr=function d(t,e,n){if(n||(n=16),void 0===e&&(e=24),0>=e)return"0";var r,a,o,i=Math.log(Math.pow(2,e))/Math.log(n),l="";for(r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var s=i-Math.floor(i);for(r=0;r-1||c!==1/0&&c>=Math.pow(2,e)?d(t,e,n):l},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;s>n;n++)c[n]=(1-Math.cos(Math.PI*(n+1)/e))/(2*e);for(n=0;i>n;n++){for(o=0,r=0;s>r;r++)a=n+r+1-e,-i>a?a-=l*Math.round(a/l):a>=l&&(a-=l*Math.floor(a/l)),0>a?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;ra;a++)e[a][n]=t[a]},a.minExtend=function(t,e){var n={};"object"!=typeof e&&(e={});var r,o,i,l=3,s=Object.keys(t);for(r=0;r1?r+o[1]:"";if(a&&(o.length>1||i.length>4))for(;n.test(i);)i=i.replace(n,"$1"+a+"$2");return i+l}},{"./coerce":91,"./dates":92,"./extend":94,"./is_plain_object":96,"./loggers":97,"./matrix":98,"./nested_property":99,"./notifier":100,"./search":103,"./stats":105,d3:9}],96:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],97:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;er;r++)n[r]=new Array(e);return n},n.transposeRagged=function(t){var e,n,r=0,a=t.length;for(e=0;a>e;e++)r=Math.max(r,t[e].length);var o=new Array(r);for(e=0;r>e;e++)for(o[e]=new Array(a),n=0;a>n;n++)o[e][n]=t[n][e];return o},n.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var r,a,o=t.length;if(t[0].length)for(r=new Array(o),a=0;o>a;a++)r[a]=n.dot(t[a],e);else if(e[0].length){var i=n.transposeRagged(e);for(r=new Array(i.length),a=0;aa;a++)r+=t[a]*e[a];return r},n.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},n.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},n.rotationXYMatrix=function(t,e,r){return n.dot(n.dot(n.translationMatrix(e,r),n.rotationMatrix(t)),n.translationMatrix(-e,-r))},n.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var r=1===arguments.length?e[0]:[e[0],e[1]];return n.dot(t,[r[0],r[1],1]).slice(0,2)}},n.apply2DTransform2=function(t){var e=n.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],99:[function(t,e,n){"use strict";function r(t,e){return function(){var n,a,o,i,l,s=t;for(i=0;i=0;e--){if(r=t[e],i=!1,Array.isArray(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");ln||n>o||i>r||r>l?!1:!e||!c(t)}function n(t,e){var n=t[0],s=t[1];if(a>n||n>o||i>s||s>l)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],v=r[0][1],m=0;for(c=1;p>c;c++)if(u=g,f=v,g=r[c][0],v=r[c][1],d=Math.min(u,g),!(d>n||n>Math.max(u,g)||s>Math.max(f,v)))if(s=s&&n!==d&&m++}return m%2===1}var r=t.slice(),a=r[0][0],o=a,i=r[0][1],l=i;r.push(r[0]);for(var s=1;so;o++)if(i=[t[o][0]-s[0],t[o][1]-s[1]],l=r(i,c),0>l||l>u||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":98}],102:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;nt}function a(t,e){return e>=t}function o(t,e){return t>e}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("../lib");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;d>f&&h++<100;)c=Math.floor((f+d)/2),u(e[c],t)?f=c+1:d=c;return h>90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;r>l;l++)e[l+1]>e[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;o>a&&i++<100;)r=c((a+o)/2),e[r]<=t?a=r+l:o=r-s;return e[a]}},{"../lib":95,"fast-isnumeric":11}],104:[function(t,e,n){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],105:[function(t,e,n){"use strict";var r=t("fast-isnumeric");n.aggNums=function(t,e,a,o){var i,l;if(o||(o=a.length),r(e)||(e=!1),Array.isArray(a[0])){for(l=new Array(o),i=0;o>i;i++)l[i]=n.aggNums(t,e,a[i]);a=l}for(i=0;o>i;i++)r(e)?r(a[i])&&(e=t(+e,+a[i])):e=a[i];return e},n.len=function(t){return n.aggNums(function(t){return t+1},0,t)},n.mean=function(t,e){return e||(e=n.len(t)),n.aggNums(function(t,e){return t+e},0,t)/e},n.variance=function(t,e,a){return e||(e=n.len(t)),r(a)||(a=n.mean(t,e)),n.aggNums(function(t,e){return t+Math.pow(e-a,2)},0,t)/e},n.stdev=function(t,e,r){return Math.sqrt(n.variance(t,e,r))},n.interp=function(t,e){if(!r(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":11}],106:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,-1===v.indexOf(u.protocol)?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var v=d.getPlotDiv(l.node());(v&&v._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({"class":p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],v=parseInt(l.style("font-size"),10)||r(l,"height"),m=-v/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,m-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-d/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(m," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":87,"../constants/xmlns_namespaces":88,"../lib":95,d3:9}],107:[function(t,e,n){"use strict";function r(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function a(t){Array.isArray(t._promises)&&t._promises.length>0&&N.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),P.defaultConfig.setBackground(t,e)}function i(t,e){t._context||(t._context=N.extendFlat({},P.defaultConfig));var n=t._context;e&&(Object.keys(e).forEach(function(t){t in n&&("setBackground"===t&&"opaque"===e[t]?n[t]=o:n[t]=e[t])}),e.plot3dPixelRatio&&!n.plotGlPixelRatio&&(n.plotGlPixelRatio=n.plot3dPixelRatio)),n.staticPlot&&(n.editable=!1,n.autosizable=!1,n.scrollZoom=!1,n.doubleClick=!1,n.showTips=!1,n.showLink=!1,n.displayModeBar=!1)}function l(t,e,n){var r=C.select(t).selectAll(".plot-container").data([0]);r.enter().insert("div",":first-child").classed("plot-container plotly",!0);var a=r.selectAll(".svg-container").data([0]);a.enter().append("div").classed("svg-container",!0).style("position","relative"),a.html(""),e&&(t.data=e),n&&(t.layout=n),P.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(k(t,{}),t._fullLayout.autosize=n.autosize=!0),a.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=P.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},a.node()),t.framework.setUndoPoint();var o=t.framework.svg(),i=1,l=t._fullLayout.title;""!==l&&l||(i=0);var s="Click to enter title",c=function(){this.call(P.util.convertToTspans)},u=o.select(".title-group text").call(c);if(t._context.editable){u.attr({"data-unformatted":l}),l&&l!==s||(i=.2,u.attr({"data-unformatted":s}).text(s).style({opacity:i}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(P.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(c),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(c)})};u.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),R.addLinks(t),Promise.resolve()}function s(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var r=P.Axes.list({_fullLayout:t});for(e=0;ee;e++){var i=t.annotations[e];i.ref&&("paper"===i.ref?(i.xref="paper",i.yref="paper"):"data"===i.ref&&(i.xref="x",i.yref="y"),delete i.ref),c(i,"xref"),c(i,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(N.warn("Shapes must be an array."),delete t.shapes);var l=(t.shapes||[]).length;for(e=0;l>e;e++){var s=t.shapes[e];c(s,"xref"),c(s,"yref")}var u=t.legend;u&&(u.x>3?(u.x=1.02,u.xanchor="left"):u.x<-2&&(u.x=-.02,u.xanchor="right"),u.y>3?(u.y=1.02,u.yanchor="bottom"):u.y<-2&&(u.y=-.02,u.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=R.getSubplotIds(t,"gl3d");for(e=0;en;++n)x[n]=v[e]+m*y[2+4*n];h.camera={eye:{x:x[0],y:x[1],z:x[2]},center:{x:v[0],y:v[1],z:v[2]},up:{x:y[1],y:y[5],z:y[9]}},delete h.cameraposition}}return F.clean(t),t}function c(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=P.Axes.cleanId(n,r))}function u(t,e){for(var n=[],r=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),a=0;ao&&(l=N.randstr(r),-1!==n.indexOf(l));o++);i.uid=N.randstr(r),r.push(i.uid)}if(n.push(i.uid),"histogramy"===i.type&&"xbins"in i&&!("ybins"in i)&&(i.ybins=i.xbins,delete i.xbins),i.error_y&&"opacity"in i.error_y){var s=F.defaults,c=i.error_y.color||(R.traceIs(i,"bar")?F.defaultLine:s[a%s.length]);i.error_y.color=F.addOpacity(F.rgb(c),F.opacity(c)*i.error_y.opacity),delete i.error_y.opacity}if("bardir"in i&&("h"!==i.bardir||!R.traceIs(i,"bar")&&"histogram"!==i.type.substr(0,9)||(i.orientation="h",_(i)),delete i.bardir),"histogramy"===i.type&&_(i),"histogramx"!==i.type&&"histogramy"!==i.type||(i.type="histogram"),"scl"in i&&(i.colorscale=i.scl,delete i.scl),"reversescl"in i&&(i.reversescale=i.reversescl,delete i.reversescl),i.xaxis&&(i.xaxis=P.Axes.cleanId(i.xaxis,"x")),i.yaxis&&(i.yaxis=P.Axes.cleanId(i.yaxis,"y")),R.traceIs(i,"gl3d")&&i.scene&&(i.scene=R.subplotsRegistry.gl3d.cleanId(i.scene)),R.traceIs(i,"pie")||(Array.isArray(i.textposition)?i.textposition=i.textposition.map(f):i.textposition&&(i.textposition=f(i.textposition))),R.traceIs(i,"2dMap")&&("YIGnBu"===i.colorscale&&(i.colorscale="YlGnBu"),"YIOrRd"===i.colorscale&&(i.colorscale="YlOrRd")),R.traceIs(i,"markerColorscale")&&i.marker){var u=i.marker;"YIGnBu"===u.colorscale&&(u.colorscale="YlGnBu"),"YIOrRd"===u.colorscale&&(u.colorscale="YlOrRd")}if("surface"===i.type&&N.isPlainObject(i.contours)){var h=["x","y","z"];for(o=0;or?o.push(a+r):o.push(r);return o}function g(t,e,n){var r,a;for(r=0;r=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||0>a&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function v(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&g(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function m(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&s0){var l=w(t._boundingBoxMargins),s=l.left+l.right,c=l.bottom+l.top,u=o._container.node().getBoundingClientRect(),f=1-2*i.frameMargins;a=Math.round(f*(u.width-s)),r=Math.round(f*(u.height-c))}else n=window.getComputedStyle(t),r=parseFloat(n.height)||o.height,a=parseFloat(n.width)||o.width;return Math.abs(o.width-a)>1||Math.abs(o.height-r)>1?(o.height=t.layout.height=r,o.width=t.layout.width=a):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),R.sanitizeMargins(o),e}function M(t){var e=C.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===n.autosize&&(k(t,{}),n.autosize=!0,t.layout.autosize=!0),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];C.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=N.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0);var o=P.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),n._has("cartesian")&&T(t,o),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var i=n._paper.selectAll(".layer-subplot");n._imageSubplotLayer=i.selectAll(".imagelayer"),n._shapeSubplotLayer=i.selectAll(".shapelayer");var l=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=l.append("g").classed("imagelayer",!0),n._shapeUpperLayer=l.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var s=N.syncOrAsync([L,function(){return P.Axes.doTicks(t,"redraw")},j.init],t);return s&&s.then&&t._promises.push(s),s}function A(t,e){function n(e,n){return function(){return P.Axes.getFromId(t,e,n)}}for(var r,a,o=t._fullLayout._plots={},i=0;i0,_=P.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),k=w===_;b?t.framework===M&&!x&&k||(t.framework=M,M(t)):k?x&&M(t):(t.framework=M,M(t)),x&&P.Axes.saveRangeInitial(t);var A=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&h(t);for(var z=0;zG.range[0]?[1,2]:[2,1]);else{var Q=G.range[0],W=G.range[1];"log"===j?(0>=Q&&0>=W&&o(Y+".autorange",!0),0>=Q?Q=W/1e6:0>=W&&(W=Q/1e6),o(Y+".range[0]",Math.log(Q)/Math.LN10),o(Y+".range[1]",Math.log(W)/Math.LN10)):(o(Y+".range[0]",Math.pow(10,Q)),o(Y+".range[1]",Math.pow(10,W)))}else o(Y+".autorange",!0)}if("reverse"===B)U.range?U.range.reverse():(o(Y+".autorange",!0),U.range=[1,0]),X.autorange?w=!0:_=!0;else if("annotations"===D.parts[0]||"shapes"===D.parts[0]){var J=D.parts[1],K=D.parts[0],tt=g[K]||[],et=P[N.titleCase(K)],nt=tt[J]||{};2===D.parts.length&&("add"===m[E]||N.isPlainObject(m[E])?z[E]="remove":"remove"===m[E]?-1===J?(z[K]=tt,delete z[E]):z[E]=nt:N.log("???",m)),!i(nt,"x")&&!i(nt,"y")||N.containsAny(E,["color","opacity","align","dash"])||(w=!0),et.draw(t,J,D.parts.slice(2).join("."),m[E]),delete m[E]}else if("images"===D.parts[0]){var at=N.objectFromPath(E,j);N.extendDeepAll(t.layout,at),H.supplyLayoutDefaults(t.layout,t._fullLayout),H.draw(t)}else if("mapbox"===D.parts[0]&&"layers"===D.parts[1]){N.extendDeepAll(t.layout,N.objectFromPath(E,j));var ot=(t._fullLayout.mapbox||{}).layers||[];for(O=D.parts[2]+1-ot.length,p=0;O>p;p++)ot.push({});_=!0}else if("updatemenus"===D.parts[0]){N.extendDeepAll(t.layout,N.objectFromPath(E,j));var it=t._fullLayout.updatemenus||[];for(O=D.parts[2]+1-it.length,p=0;O>p;p++)it.push({});_=!0}else 0===D.parts[0].indexOf("scene")?_=!0:0===D.parts[0].indexOf("geo")?_=!0:0===D.parts[0].indexOf("ternary")?_=!0:!v._has("gl2d")||-1===E.indexOf("axis")&&"plot_bgcolor"!==D.parts[0]?"hiddenlabels"===E?w=!0:-1!==D.parts[0].indexOf("legend")?y=!0:-1!==E.indexOf("title")?x=!0:-1!==D.parts[0].indexOf("bgcolor")?b=!0:D.parts.length>1&&N.containsAny(D.parts[1],["tick","exponent","grid","zeroline"])?x=!0:-1!==E.indexOf(".linewidth")&&-1!==E.indexOf("axis")?x=b=!0:D.parts.length>1&&-1!==D.parts[1].indexOf("line")?b=!0:D.parts.length>1&&"mirror"===D.parts[1]?x=b=!0:"margin.pad"===E?x=b=!0:"margin"===D.parts[0]||"autorange"===D.parts[1]||"rangemode"===D.parts[1]||"type"===D.parts[1]||"domain"===D.parts[1]||E.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(E)?M=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(E)&&(_=!0):_=!0, +Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],37:[function(t,e,n){"use strict";e.exports=function(t,e,n,r,a){var o=(t-n)/(r-n),i=o+e/(r-n),l=(o+i)/2;return"left"===a||"bottom"===a?o:"center"===a||"middle"===a?l:"right"===a||"top"===a?i:2/3-l>o?o:i>4/3-l?i:l}},{}],38:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":95}],39:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},v=1,m=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":95,"../../plotly":113,"../../plots/cartesian/constants":121,"./align":37,"./cursor":38,"./unhover":40}],40:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":93}],41:[function(t,e,n){"use strict";function r(t,e,n,r){var o=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(o*o+i*i,b/2),u=Math.pow(l*l+s*s,b/2),f=(u*u*o-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[a.round(e[0]+(h&&f/h),2),a.round(e[1]+(h&&d/h),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&d/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../plots/plots"),l=t("../color"),s=t("../colorscale"),c=t("../../lib"),u=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),h=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(l.fill,r)},p.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},p.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},p.setRect=function(t,e,n,r,a){t.call(p.setPosition,e,n).call(p.setSize,r,a)},p.translatePoints=function(t,e,n){t.each(function(t){var r=t.xp||e.c2p(t.x),i=t.yp||n.c2p(t.y),l=a.select(this);o(r)&&o(i)?"text"===this.nodeName?l.attr("x",r).attr("y",i):l.attr("transform","translate("+r+","+i+")"):l.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):n||0},p.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},i=e||o.width||0,s=r||o.dash||"";a.select(this).call(l.stroke,n||o.color).call(p.dashLine,s,i)})},p.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(l.fill,e[0].trace.fillcolor)}catch(r){c.error(r,t),n.remove()}})};var g=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=p.symbolNames.length,m="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=n.line;if(i.traceIs(e,"symbols")){var o=h(e);t.attr("d",function(t){var r;r="various"===t.ms||"various"===n.size?3:d.isBubble(e)?o(t.ms):(n.size||6)/2,t.mrc=r;var a=p.symbolNumber(t.mx||n.symbol)||0,i=a%100;return t.om=a%200>=100,p.symbolFuncs[i](r)+(a>=200?m:"")}).style("opacity",function(t){return(t.mo+1||n.opacity+1)-1})}var s=(e._input||{}).marker||{},c=p.tryColorscale(n,s,""),u=p.tryColorscale(n,s,"line.");t.each(function(t){var e,o,i;t.so?(i=r.outlierwidth,o=r.outliercolor,e=n.outliercolor):(i=(t.mlw+1||r.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(r.color)?l.defaultLine:r.color,e="mc"in t?t.mcc=c(t.mc):Array.isArray(n.color)?l.defaultLine:n.color||"rgba(0,0,0,0)");var s=a.select(this);t.om?s.call(l.stroke,e).style({"stroke-width":(i||1)+"px",fill:"none"}):(s.style("stroke-width",i+"px").call(l.fill,e),i&&s.call(l.stroke,o))})}},p.tryColorscale=function(t,e,n){var r=c.nestedProperty(t,n+"color").get(),a=c.nestedProperty(t,n+"colorscale").get(),i=c.nestedProperty(t,n+"cauto").get(),l=c.nestedProperty(t,n+"cmin"),u=c.nestedProperty(t,n+"cmax"),f=l.get(),d=u.get();return a&&Array.isArray(r)?(!i&&o(f)&&o(d)||(f=1/0,d=-(1/0),r.forEach(function(t){o(t)&&(f>t&&(f=+t),t>d&&(d=+t))}),f>d&&(f=0,d=1),l.set(f),u.set(d),c.nestedProperty(e,n+"cmin").set(f),c.nestedProperty(e,n+"cmax").set(d)),s.makeScaleFunction(a,f,d)):c.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;p.textPointStyle=function(t,e){t.each(function(t){var n=a.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var i=t.tp||e.textposition,l=-1!==i.indexOf("top")?"top":-1!==i.indexOf("bottom")?"bottom":"middle",s=-1!==i.indexOf("left")?"end":-1!==i.indexOf("right")?"start":"middle",c=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;c=o(c)&&c>0?c:0,n.call(p.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(u.convertToTspans);var d=a.select(this.parentNode),h=n.selectAll("tspan.line"),g=((h[0].length||1)-1)*x+1,v=y[s]*f,m=.75*c+y[l]*f+(y[l]-1)*g*c/2;d.attr("transform","translate("+v+","+m+")"),g>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,a="M"+t[0],o=[];for(n=1;nn;n++)i.push(r(t[n-1],t[n],t[n+1],e));for(i.push(r(t[o-1],t[o],t[0],e)),n=1;o>=n;n++)a+="C"+i[n-1][1]+" "+i[n][0]+" "+t[n];return a+="C"+i[o][1]+" "+i[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+a.round(e[0],2)+"V"+a.round(e[1],2)},vh:function(t,e){return"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},hvh:function(t,e){return"H"+a.round((t[0]+e[0])/2,2)+"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},vhv:function(t,e){return"V"+a.round((t[1]+e[1])/2,2)+"H"+a.round(e[0],2)+"V"+a.round(e[1],2)}},w=function(t,e){return"L"+a.round(e[0],2)+","+a.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var n="M"+a.round(t[0][0],2)+","+a.round(t[0][1],2),r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(s),c.extendFlat({},s)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=a.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":88,"../../lib":95,"../../lib/svg_text_utils":106,"../../plots/plots":136,"../../traces/scatter/make_bubble_size_func":187,"../../traces/scatter/subtypes":192,"../color":18,"../colorscale":32,"./symbol_defs":42,d3:9,"fast-isnumeric":11}],42:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:9}],43:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],44:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&-1!==["linear","log"].indexOf(n.type),c=[];if(s){for(var u=l(o),f=0;fl;l++)i[l]={x:n[l],y:a[l]};return i[0].trace=t,r.calc({calcdata:[i],_fullLayout:e}),i},r.plot=t("./plot"),r.style=t("./style"),r.hoverInfo=function(t,e,n){(e.error_y||{}).visible&&(n.yerr=t.yh-t.y,e.error_y.symmetric||(n.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(n.xerr=t.xh-t.x,e.error_x.symmetric||(n.xerrneg=t.x-t.xs))}},{"./attributes":43,"./calc":44,"./defaults":46,"./plot":48,"./style":49}],48:[function(t,e,n){"use strict";function r(t,e,n){var r={x:e.c2p(t.x),y:n.c2p(t.y)};return void 0!==t.yh&&(r.yh=n.c2p(t.yh),r.ys=n.c2p(t.ys),o(r.ys)||(r.noYS=!0,r.ys=n.c2p(t.ys,!0))),void 0!==t.xh&&(r.xh=e.c2p(t.xh),r.xs=e.c2p(t.xs),o(r.xs)||(r.noXS=!0,r.xs=e.c2p(t.xs,!0))),r}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../lib"),l=t("../../traces/scatter/subtypes");e.exports=function(t,e){var n=e.x(),s=e.y();t.each(function(t){var e=t[0].trace,c=e.error_x||{},u=e.error_y||{},f=l.hasMarkers(e)&&e.marker.maxdisplayed>0;if(u.visible||c.visible){var d=a.select(this).selectAll("g.errorbar").data(i.identity);d.enter().append("g").classed("errorbar",!0),d.each(function(t){var e=a.select(this),i=r(t,n,s);if(!f||t.vis){var l;if(u.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var d=u.width;l="M"+(i.x-d)+","+i.yh+"h"+2*d+"m-"+d+",0V"+i.ys,i.noYS||(l+="m-"+d+",0h"+2*d),e.append("path").classed("yerror",!0).attr("d",l)}if(c.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var h=(c.copy_ystyle?u:c).width;l="M"+i.xh+","+(i.y-h)+"v"+2*h+"m0,-"+h+"H"+i.xs,i.noXS||(l+="m0,-"+h+"v"+2*h),e.append("path").classed("xerror",!0).attr("d",l)}}})}})}},{"../../lib":95,"../../traces/scatter/subtypes":192,d3:9,"fast-isnumeric":11}],49:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":18,d3:9}],50:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":121}],51:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var l=0;2>l;l++){var s={_fullLayout:n},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,a=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],55:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":94,"../../plots/font_attributes":134,"../color/attributes":17}],56:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],57:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/plots"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n){function l(t,e){return r.coerce(d,h,o,t,e)}for(var s,c,u,f,d=t.legend||{},h=e.legend={},p=0,g="normal",v=0;v1);if(y!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),r.coerceFont(l,"font",e.font),l("orientation"),"h"===h.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(s=0,u="left",c=1.1,f="bottom"):(s=0,u="left",c=-.1,f="top")}l("traceorder",g),i.isGrouped(e.legend)&&l("tracegroupgap"),l("x",s),l("xanchor",u),l("y",c),l("yanchor",f),r.noneOrAll(d,h,["x","y"])}}},{"../../lib":95,"../../plots/plots":136,"./attributes":55,"./helpers":60}],58:[function(t,e,n){"use strict";function r(t,e){function n(n){u.util.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=d.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,a.legend.font).text(c),e._context.editable&&!l?f.call(u.util.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" "),u.restyle(e,"name",t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(d.traceIs(l,"pie")){var f=o.label,h=n.indexOf(f);-1===h?n.push(f):n.splice(h,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),h=d[0].length||1;n=s*h,r=u.node()&&p.bBox(u.node()).width;var g=s*(.3+(1-h)/2);u.attr("y",g),d.attr("y",g)}n=Math.max(n,16)+3,o.attr({x:0,y:-n/2,height:n}),a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=x.isGrouped(a);if(x.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap), +n.selectAll(".legendtoggle").attr("width",(t._context.editable?0:a.width)+40),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height);else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;d>u;u++){var h=s[u].map(function(t){return t[0].width}),p=40+Math.max.apply(null,h);a.width+=a.tracegroupgap+p,l.push(a.width)}e.each(function(t,e){f.setTranslate(this,l[e],0)}),e.each(function(){var t=c.select(this),e=t.selectAll("g.traces"),n=0;e.each(function(t){var e=t[0],r=e.height;f.setTranslate(this,0,5+o+n+r/2),n+=r}),a.height=Math.max(a.height,n)}),a.height+=10+2*o,a.width+=2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}else{a.width=0,a.height=0;var g=0,v=0,m=0,y=0;n.each(function(t){m=Math.max(40+t[0].width,m)}),n.each(function(t){var e=t[0],n=m,i=a.tracegroupgap||5;o+y+i+n>r.width-(r.margin.r+r.margin.l)&&(y=0,g+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+y,5+o+e.height/2+g),a.width+=i+n,a.height=Math.max(a.height,e.height),y+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}}function l(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center");var a="top";b.isBottomAnchor(n)?a="bottom":b.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../dragelement"),p=t("../drawing"),g=t("../color"),v=t("./constants"),m=t("./get_legend_data"),y=t("./style"),x=t("./helpers"),b=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(p.setRect,j,t,v.scrollBarWidth,v.scrollBarHeight),M.select("rect").attr({y:x.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var x=n.legend,_=n.showlegend&&m(t.calcdata,x),w=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({"class":"legend","pointer-events":"all"});var M=n._topdefs.selectAll("#"+o).data([0]);M.enter().append("clipPath").attr("id",o).append("rect");var A=k.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(g.stroke,x.bordercolor),A.call(g.fill,x.bgcolor),A.style("stroke-width",x.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var z=T.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var C=0!==k.enter().size();C&&(i(t,z,S),l(t));var E=0,O=n.width,P=0,N=n.height;i(t,z,S),x.height>N?s(t):l(t);var D=n._size,I=D.l+D.w*x.x,R=D.t+D.h*(1-x.y);b.isRightAnchor(x)?I-=x.width:b.isCenterAnchor(x)&&(I-=x.width/2),b.isBottomAnchor(x)?R-=x.height:b.isMiddleAnchor(x)&&(R-=x.height/2);var j=x.width,F=D.w;j>F?(I=D.l,j=F):(I+j>O&&(I=O-j),E>I&&(I=E),j=Math.min(O-I,x.width));var q=x.height,B=D.h;q>B?(R=D.t,q=B):(R+q>N&&(R=N-q),P>R&&(R=P),q=Math.min(N-R,x.height)),f.setTranslate(k,I,R);var H,V,Z=q-v.scrollBarHeight-2*v.scrollBarMargin,Y=x.height-q;if(x.height<=q||t._context.staticPlot)A.attr({width:j-x.borderwidth,height:q-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),f.setTranslate(T,0,0),M.select("rect").attr({width:j-2*x.borderwidth,height:q-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth}),T.call(p.setClipUrl,o);else{H=v.scrollBarMargin,V=T.attr("data-scroll")||0,A.attr({width:j-2*x.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:q-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),M.select("rect").attr({width:j-2*x.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:q-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth-V}),T.call(p.setClipUrl,o),C&&e(H,V),k.on("wheel",null),k.on("wheel",function(){V=f.constrain(T.attr("data-scroll")-c.event.deltaY/Z*Y,-Y,0),H=v.scrollBarMargin-V/Y*Z,e(H,V),c.event.preventDefault()}),L.on(".drag",null),T.on(".drag",null);var U=c.behavior.drag().on("drag",function(){H=f.constrain(c.event.y-v.scrollBarHeight/2,v.scrollBarMargin,v.scrollBarMargin+Z),V=-(H-v.scrollBarMargin)/Z*Y,e(H,V)});L.call(U),T.call(U)}if(t._context.editable){var X,G,$,Q;k.classed("cursor-move",!0),h.init({element:k.node(),prepFn:function(){var t=f.getTranslate(k);$=t.x,Q=t.y},moveFn:function(t,e){var n=$+t,r=Q+e;f.setTranslate(k,n,r),X=h.align(n,0,D.l,D.l+D.w,x.xanchor),G=h.align(r,0,D.t+D.h,D.t,x.yanchor)},doneFn:function(e){e&&void 0!==X&&void 0!==G&&u.relayout(t,{"legend.x":X,"legend.y":G})}})}}}},{"../../lib":95,"../../plotly":113,"../../plots/plots":136,"../color":18,"../dragelement":39,"../drawing":41,"./anchor_utils":54,"./constants":56,"./get_legend_data":59,"./helpers":60,"./style":62,d3:9}],59:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[n]]):l[t].push([n]);else{var r="~~i"+f;s.push(r),l[r]=[[n]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;oo;o++)m=l[s[o]],y[o]=a.isReversed(e)?m.reverse():m;else{for(y=[new Array(x)],o=0;x>o;o++)m=l[s[o]][0],y[0][a.isReversed(e)?x-o-1:o]=m;x=1}return e._lgroupsLength=x,y}},{"../../plots/plots":136,"./helpers":60}],60:[function(t,e,n){"use strict";var r=t("../../plots/plots");n.legendGetsTrace=function(t){return t.visible&&r.traceIs(t,"showLegend")},n.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},n.isVertical=function(t){return"h"!==t.orientation},n.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":136}],61:[function(t,e,n){"use strict";var r=e.exports={};r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw"),r.style=t("./style")},{"./attributes":55,"./defaults":57,"./draw":58,"./style":62}],62:[function(t,e,n){"use strict";function r(t){var e=t[0].trace,n=e.visible&&e.fill&&"none"!==e.fill,r=h.hasLines(e),a=s.select(this).select(".legendfill").selectAll("path").data(n?[t]:[]);a.enter().append("path").classed("js-fill",!0),a.exit().remove(),a.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var o=s.select(this).select(".legendlines").selectAll("path").data(r?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(f.lineGroupStyle)}function a(t){function e(t,e,n){var r=c.nestedProperty(i,t).get(),a=Array.isArray(r)&&e?e(r):r;if(n){if(an[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),u=h.hasText(i),d=h.hasLines(i);if(l||u||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(o,p)],a=c.minExtend(i,g)}var v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?r:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../lib"),u=t("../../plots/plots"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":95,"../../plots/plots":136,"../../traces/pie/style_one":171,"../../traces/scatter/subtypes":192,"../color":18,"../drawing":41,d3:9}],63:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,f=(1+u)/2,d=(1-u)/2,h=c.Axes.list(t,null,!0),p=0;py;y++){var x=l[y];d=m[x]={};for(var b=0;b1)return r(["resetViews","toggleHover"]),i(v,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||m||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(v,n)}function a(t){for(var e=s.Axes.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var v=u("bgcolor");u("activecolor",i.contrast(v,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":95,"../color":18,"./attributes":66,"./button_attributes":67,"./constants":68}],70:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;re){var n=e;e=t,t=n}l.setAttributes(w,{"data-min":t,"data-max":e}),l.setAttributes(P,{x:t,width:e-t}),l.setAttributes(A,{width:t}),l.setAttributes(T,{x:e,width:p-e}),l.setAttributes(L,{transform:"translate("+(t-v-1)+")"}),l.setAttributes(C,{transform:"translate("+e+")"})}var f=t._fullLayout,d=f._infolayer.selectAll("g.range-slider"),h=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*h.thickness,v=2,m=Math.floor(h.borderwidth/2),y=f.margin.l,x=f.height-g-f.margin.b,b=0,_=p,w=document.createElementNS(i,"g");l.setAttributes(w,{"class":"range-slider","data-min":b,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+x+")"});var k=document.createElementNS(i,"rect"),M=h.borderwidth%2===0?h.borderwidth:h.borderwidth-1;l.setAttributes(k,{fill:h.bgcolor,stroke:h.bordercolor,"stroke-width":h.borderwidth,height:g+M,width:p+M,transform:"translate(-"+m+", -"+m+")","shape-rendering":"crispEdges"});var A=document.createElementNS(i,"rect");l.setAttributes(A,{x:0,width:b,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(i,"rect");l.setAttributes(T,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var L=document.createElementNS(i,"g"),z=document.createElementNS(i,"rect"),S=document.createElementNS(i,"rect");l.setAttributes(L,{transform:"translate("+(b-v-1)+")"}),l.setAttributes(z,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),l.setAttributes(S,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges" +}),l.appendChildren(L,[S,z]);var C=document.createElementNS(i,"g"),E=document.createElementNS(i,"rect"),O=document.createElementNS(i,"rect");l.setAttributes(C,{transform:"translate("+_+")"}),l.setAttributes(E,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),l.setAttributes(O,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(C,[O,E]);var P=document.createElementNS(i,"rect");l.setAttributes(P,{x:b,width:_-b,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function n(t){var n,r,f=+t.clientX-o;switch(a){case P:w.style.cursor="ew-resize",n=+l+f,r=+s+f,u(n,r),c(e(n),e(r));break;case z:w.style.cursor="col-resize",n=+l+f,r=+s,u(n,r),c(e(n),e(r));break;case E:w.style.cursor="col-resize",n=+l,r=+s+f,u(n,r),c(e(n),e(r));break;default:w.style.cursor="ew-resize",n=i,r=i+f,u(n,r),c(e(n),e(r))}}function r(){window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r),w.style.cursor="auto"}var a=t.target,o=t.clientX,i=o-w.getBoundingClientRect().left,l=w.getAttribute("data-min"),s=w.getAttribute("data-max");window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)}),h.range||(h.range=a.getAutoRange(f.xaxis));var N=s(t,p,g);l.appendChildren(w,[k,N,A,T,P,L,C]),n(f.xaxis.range[0],f.xaxis.range[1]),d.data([0]).enter().append(function(){return h.setRange=n,w})}},{"../../constants/xmlns_namespaces":88,"../../lib":95,"../../plotly":113,"../../plots/cartesian/axes":116,"./helpers":76,"./range_plot":78}],75:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(t,e){return r.coerce(l,s,a,t,e)}if(t[n].rangeslider){var l=r.isPlainObject(t[n].rangeslider)?t[n].rangeslider:{},s=e[n].rangeslider={};if(i("bgcolor"),i("bordercolor"),i("borderwidth"),i("thickness"),i("visible"),i("range"),s.range&&!e[n].autorange){var c=s.range,u=e[n].range;c[0]=Math.min(c[0],u[0]),c[1]=Math.max(c[1],u[1])}else e[n]._needsExpand=!0;s.visible&&o.forEach(function(t){var n=e[t]||{};n.fixedrange=!0,e[t]=n})}}},{"../../lib":95,"./attributes":73}],76:[function(t,e,n){"use strict";n.setAttributes=function(t,e){for(var n in e)t.setAttribute(n,e[n])},n.appendChildren=function(t,e){for(var n=0;ns;s++){var c=l[s],u={_fullLayout:e},f=A.coerceRef(t,r,u,c);if("path"!==i){var d=.25,h=.75;if("paper"!==f){var p=A.getFromId(u,f),g=o(p);d=g(p.range[0]+d*(p.range[1]-p.range[0])),h=g(p.range[0]+h*(p.range[1]-p.range[0]))}n(c+"0",d),n(c+"1",h)}}return"path"===i?n("path"):M.noneOrAll(t,r,["x0","x1","y0","y1"]),r}function a(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function i(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function l(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function s(t,e,n){for(var r=0;re;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),C.draw(t,a)}function f(t,e,n,i){function l(n){var r={"data-index":e,"fill-rule":"evenodd",d:x(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",C.opacity).call(T.stroke,a).call(T.fill,C.fillcolor).call(L.dashLine,C.line.dash,C.line.width);E&&o.call(L.setClipUrl,"clip"+t._fullLayout._uid+E),t._context.editable&&d(t,o,C,e)}var s,c;h(t,e).selectAll('[data-index="'+e+'"]').remove();var u=t.layout.shapes[e];if(u){var f={xref:u.xref,yref:u.yref},g={};"string"==typeof n&&n?g[n]=i:M.isPlainObject(n)&&(g=n);var v=Object.keys(g);for(s=0;ss;s++){var b=y[s];if(void 0===g[b]&&void 0!==u[b]){var _,w=b.charAt(0),k=A.getFromId(t,A.coerceRef(f,{},t,w)),z=A.getFromId(t,A.coerceRef(u,{},t,w)),S=u[b];void 0!==g[w+"ref"]&&(k?(_=a(k)(S),S=(_-k.range[0])/(k.range[1]-k.range[0])):S=(S-z.domain[0])/(z.domain[1]-z.domain[0]),z?(_=z.range[0]+S*(z.range[1]-z.range[0]),S=o(z)(_)):S=k.domain[0]+S*(k.domain[1]-k.domain[0])),u[b]=S}}var C=r(u,t._fullLayout);t._fullLayout.shapes[e]=C;var E;if("below"!==C.layer)E=(C.xref+C.yref).replace(/paper/g,""),l(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)E="",l(t._fullLayout._shapeLowerLayer);else{var O,P=t._fullLayout._plots||{},N=Object.keys(P);for(s=0,c=N.length;c>s;s++)O=P[N[s]],E=N[s],p(t,C,O)&&l(O.shapelayer)}}}function d(t,e,n,r){function a(t){var n=W.right-W.left,r=W.bottom-W.top,a=t.clientX-W.left,o=t.clientY-W.top,i=n>G&&r>$&&!t.shiftKey?z.getCursor(a/n,1-o/r):"move";S(e,i),X=i.split("-")[0]}function o(e){B=A.getFromId(t,n.xref),H=A.getFromId(t,n.yref),V=m(t,B),Z=m(t,H,!0),Y=y(t,B),U=y(t,H,!0);var o="shapes["+r+"]";"path"===n.type?(F=n.path,q=o+".path"):(u=V(n.x0),f=Z(n.y0),d=V(n.x1),h=Z(n.y1),p=o+".x0",g=o+".y0",_=o+".x1",w=o+".y1"),d>u?(L=u,P=o+".x0",R="x0",C=d,N=o+".x1",j="x1"):(L=d,P=o+".x1",R="x1",C=u,N=o+".x0",j="x0"),h>f?(M=f,E=o+".y0",D="y0",T=h,O=o+".y1",I="y1"):(M=h,E=o+".y1",D="y1",T=f,O=o+".y0",I="y0"),c={},a(e),Q.moveFn="move"===X?l:s}function i(n){S(e),n&&k.relayout(t,c)}function l(r,a){if("path"===n.type){var o=function(t){return Y(V(t)+r)};B&&"date"===B.type&&(o=v(o));var i=function(t){return U(Z(t)+a)};H&&"date"===H.type&&(i=v(i)),n.path=b(F,o,i),c[q]=n.path}else c[p]=n.x0=Y(u+r),c[g]=n.y0=U(f+a),c[_]=n.x1=Y(d+r),c[w]=n.y1=U(h+a);e.attr("d",x(t,n))}function s(r,a){if("path"===n.type){var o=function(t){return Y(V(t)+r)};B&&"date"===B.type&&(o=v(o));var i=function(t){return U(Z(t)+a)};H&&"date"===H.type&&(i=v(i)),n.path=b(F,o,i),c[q]=n.path}else{var l=~X.indexOf("n")?M+a:M,s=~X.indexOf("s")?T+a:T,u=~X.indexOf("w")?L+r:L,f=~X.indexOf("e")?C+r:C;s-l>$&&(c[E]=n[D]=U(l),c[O]=n[I]=U(s)),f-u>G&&(c[P]=n[R]=Y(u),c[N]=n[j]=Y(f))}e.attr("d",x(t,n))}var c,u,f,d,h,p,g,_,w,M,T,L,C,E,O,P,N,D,I,R,j,F,q,B,H,V,Z,Y,U,X,G=10,$=10,Q={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Q.element.getBoundingClientRect();z.init(Q)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):M.log("getShapeLayer: undefined shape: index",e),r}function p(t,e,n){var r=k.Axes.getFromId(t,n.id,"x")._id,a=k.Axes.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function v(t){return function(e){return t(e).replace(" ","_")}}function m(t,e,n){var r,o=t._fullLayout._size;if(e){var i=a(e);r=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(r=g(r))}else r=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return r}function y(t,e,n){var r,a=t._fullLayout._size;if(e){var i=o(e);r=function(t){return i(e.p2l(t-e._offset))}}else r=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return r}function x(t,e){var n,r,o,i,l=e.type,s=A.getFromId(t,e.xref),c=A.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=a(s),r=function(t){return s._offset+s.l2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(o=a(c),i=function(t){return c._offset+c.l2p(o(t,!0))}):i=function(t){return u.t+u.h*(1-t)},"path"===l)return s&&"date"===s.type&&(r=g(r)),c&&"date"===c.type&&(i=g(i)),C.convertPath(e.path,r,i);var f=r(e.x0),d=r(e.x1),h=i(e.y0),p=i(e.y1);if("line"===l)return"M"+f+","+h+"L"+d+","+p;if("rect"===l)return"M"+f+","+h+"H"+d+"V"+p+"H"+f+"Z";var v=(f+d)/2,m=(h+p)/2,y=Math.abs(v-f),x=Math.abs(m-h),b="A"+y+","+x,_=v+y+","+m,w=v+","+(m-x);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function b(t,e,n){return t.replace(E,function(t){var r=0,a=t.charAt(0),o=P[a],i=N[a],l=D[a],s=t.substr(1).replace(O,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}function _(t,e,n,r,a){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(n)];if(r){var i,l,s,c,u,f=1/0,d=-(1/0),h=r.match(E);for("date"===t.type&&(o=g(o)),i=0;iu&&(f=u),u>d&&(d=u)));return d>=f?[f,d]:void 0}}var w=t("fast-isnumeric"),k=t("../../plotly"),M=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),L=t("../drawing"),z=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var n=t.shapes||[],a=e.shapes=[],o=0;ol&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),M.log("Ignoring extra params in segment "+t)),a+s})},C.calcAutorange=function(t){var e,n,r,a,o,i=t._fullLayout,l=i.shapes;if(l.length&&t._fullData.length)for(e=0;ed?n=d:(u.left-=x.offsetLeft,u.right-=x.offsetLeft,u.top-=x.offsetTop,u.bottom-=x.offsetTop,x.selection.each(function(){var t=s.bBox(this);l.bBoxIntersect(u,t,c)&&(n=Math.max(n,i*(t[x.side]-u[o])+c))}),n=Math.min(d,n)),n>0||0>d){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,S=E,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,v=n.propName,m=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var E="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(u.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",z)}},{"../../lib":95,"../../lib/svg_text_utils":106,"../../plotly":113,"../../plots/plots":136,"../color":18,"../drawing":41,d3:9,"fast-isnumeric":11}],82:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:i,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":94,"../../plots/font_attributes":134,"../color/attributes":17}],83:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],84:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(s.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),s.exit().remove(),s.exit().size()&&m(t),0!==n.length){var c=s.selectAll("g."+T.headerGroupClassName).data(n,a);c.enter().append("g").classed(T.headerGroupClassName,!0);var u=s.selectAll("g."+T.buttonGroupClassName).data([0]);u.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&u.call(v).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){y.select(this).remove(),u.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],88:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],89:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.16.3",n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=r.register,n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=r.Snapshot,n.PlotSchema=r.PlotSchema,n.Queue=r.Queue,n.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":110,"./plot_api/to_image":111,"./plot_api/validate":112,"./plotly":113,"./snapshot/download":143,d3:9}],90:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],91:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)}},"boolean":{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(i(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n?!0:"string"!=typeof t?!1:!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var s=i[0].split("-");if(s.length>3||3!==s.length&&i[1])return!1;if(4===s[0].length)n=Number(s[0]);else{if(2!==s[0].length)return!1;var c=(new Date).getFullYear();n=((Number(s[0])-c+70)%100+200)%100+c-70}return l(n)?1===s.length?new Date(n,0,1).getTime():(r=Number(s[1])-1,s[1].length>2||!(r>=0&&11>=r)?!1:2===s.length?new Date(n,r,1).getTime():(a=Number(s[2]),s[2].length>2||!(a>=1&&31>=a)?!1:(a=new Date(n,r,a).getTime(),i[1]?(s=i[1].split(":"),s.length>3?!1:(o=Number(s[0]),s[0].length>2||!(o>=0&&23>=o)?!1:(a+=36e5*o,1===s.length?a:(r=Number(s[1]),s[1].length>2||!(r>=0&&59>=r)?!1:(a+=6e4*r,2===s.length?a:(t=Number(s[2]),t>=0&&60>t?a+1e3*t:!1)))))):a))):!1},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){if("undefined"==typeof i)return void s.error("d3 is not defined.");e||(e=0);var n=new Date(t),a=i.time.format("%Y-%m-%d")(n);return 7776e6>e?(a+=" "+r(n.getHours(),2),432e6>e&&(a+=":"+r(n.getMinutes(),2),108e5>e&&(a+=":"+r(n.getSeconds(),2),3e5>e&&(a+="."+r(n.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var c={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"]},u={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"]},f=i.time.format.utc,d={ +Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){d[t].D.push(f(e)),["H","I","D"].forEach(function(n){c[n].forEach(function(r){var a=d[t][n];a.push(f(e+"~"+r)),a.push(f(r+"~"+e))})})})});var h=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,v=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},x=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,k=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return M[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(h,p).replace(g,"").replace(v,"~").replace(m,y).replace(k,A).trim().replace(T,"");var e,n,r=null,i=a(t),l=o(t);e=d[i][l],n=e.length;for(var s=0;n>s&&!(r=e[s].parse(t));s++);if(!(r instanceof Date))return!1;var c=r.getTimezoneOffset();return r.setTime(r.getTime()+60*c*1e3),r}},{"../lib":95,d3:9,"fast-isnumeric":11}],93:[function(t,e,n){"use strict";var r=t("events").EventEmitter,a={init:function(t){if(t._ev instanceof r)return t;var e=new r;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(n,r){"undefined"!=typeof jQuery&&jQuery(t).trigger(n,r),e.emit(n,r)},t},triggerHandler:function(t,e,n){var r,a;"undefined"!=typeof jQuery&&(r=jQuery(t).triggerHandler(e,n));var o=t._ev;if(!o)return r;var i=o._events[e];if(!i)return r;"function"==typeof i&&(i=[i]);for(var l=i.pop(),s=0;sm;m++){s=t[m];for(c in s)u=g[c],f=s[c],l&&i(f)?g[c]=f:e&&f&&(o(f)||(d=i(f)))?(d?(d=!1,h=u&&i(u)?u:[]):h=u&&o(u)?u:{},g[c]=a([h,f],e,n,l)):("undefined"!=typeof f||n)&&(g[c]=f)}return g}var o=t("./is_plain_object.js"),i=Array.isArray;n.extendFlat=function(){return a(arguments,!1,!1,!1)},n.extendDeep=function(){return a(arguments,!0,!1,!1)},n.extendDeepAll=function(){return a(arguments,!0,!0,!1)},n.extendDeepNoArrays=function(){return a(arguments,!0,!1,!0)}},{"./is_plain_object.js":96}],95:[function(t,e,n){"use strict";var r=t("d3"),a=e.exports={};a.nestedProperty=t("./nested_property"),a.isPlainObject=t("./is_plain_object");var o=t("./coerce");a.valObjects=o.valObjects,a.coerce=o.coerce,a.coerce2=o.coerce2,a.coerceFont=o.coerceFont,a.validate=o.validate;var i=t("./dates");a.dateTime2ms=i.dateTime2ms,a.isDateTime=i.isDateTime,a.ms2DateTime=i.ms2DateTime,a.parseDate=i.parseDate;var l=t("./search");a.findBin=l.findBin,a.sorterAsc=l.sorterAsc,a.sorterDes=l.sorterDes,a.distinctVals=l.distinctVals,a.roundUp=l.roundUp;var s=t("./stats");a.aggNums=s.aggNums,a.len=s.len,a.mean=s.mean,a.variance=s.variance,a.stdev=s.stdev,a.interp=s.interp;var c=t("./matrix");a.init2dArray=c.init2dArray,a.transposeRagged=c.transposeRagged,a.dot=c.dot,a.translationMatrix=c.translationMatrix,a.rotationMatrix=c.rotationMatrix,a.rotationXYMatrix=c.rotationXYMatrix,a.apply2DTransform=c.apply2DTransform,a.apply2DTransform2=c.apply2DTransform2;var u=t("./extend");a.extendFlat=u.extendFlat,a.extendDeep=u.extendDeep,a.extendDeepAll=u.extendDeepAll,a.extendDeepNoArrays=u.extendDeepNoArrays;var f=t("./loggers");a.log=f.log,a.warn=f.warn,a.error=f.error,a.notifier=t("./notifier"),a.swapAttrs=function(t,e,n,r){n||(n="x"),r||(r="y");for(var o=0;on?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.randstr=function d(t,e,n){if(n||(n=16),void 0===e&&(e=24),0>=e)return"0";var r,a,o,i=Math.log(Math.pow(2,e))/Math.log(n),l="";for(r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var s=i-Math.floor(i);for(r=0;r-1||c!==1/0&&c>=Math.pow(2,e)?d(t,e,n):l},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;s>n;n++)c[n]=(1-Math.cos(Math.PI*(n+1)/e))/(2*e);for(n=0;i>n;n++){for(o=0,r=0;s>r;r++)a=n+r+1-e,-i>a?a-=l*Math.round(a/l):a>=l&&(a-=l*Math.floor(a/l)),0>a?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;ra;a++)e[a][n]=t[a]},a.minExtend=function(t,e){var n={};"object"!=typeof e&&(e={});var r,o,i,l=3,s=Object.keys(t);for(r=0;r1?r+o[1]:"";if(a&&(o.length>1||i.length>4))for(;n.test(i);)i=i.replace(n,"$1"+a+"$2");return i+l}},{"./coerce":91,"./dates":92,"./extend":94,"./is_plain_object":96,"./loggers":97,"./matrix":98,"./nested_property":99,"./notifier":100,"./search":103,"./stats":105,d3:9}],96:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],97:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;er;r++)n[r]=new Array(e);return n},n.transposeRagged=function(t){var e,n,r=0,a=t.length;for(e=0;a>e;e++)r=Math.max(r,t[e].length);var o=new Array(r);for(e=0;r>e;e++)for(o[e]=new Array(a),n=0;a>n;n++)o[e][n]=t[n][e];return o},n.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var r,a,o=t.length;if(t[0].length)for(r=new Array(o),a=0;o>a;a++)r[a]=n.dot(t[a],e);else if(e[0].length){var i=n.transposeRagged(e);for(r=new Array(i.length),a=0;aa;a++)r+=t[a]*e[a];return r},n.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},n.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},n.rotationXYMatrix=function(t,e,r){return n.dot(n.dot(n.translationMatrix(e,r),n.rotationMatrix(t)),n.translationMatrix(-e,-r))},n.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var r=1===arguments.length?e[0]:[e[0],e[1]];return n.dot(t,[r[0],r[1],1]).slice(0,2)}},n.apply2DTransform2=function(t){var e=n.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],99:[function(t,e,n){"use strict";function r(t,e){return function(){var n,a,o,i,l,s=t;for(i=0;i=0;e--){if(r=t[e],i=!1,Array.isArray(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");ln||n>o||i>r||r>l?!1:!e||!c(t)}function n(t,e){var n=t[0],s=t[1];if(a>n||n>o||i>s||s>l)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],v=r[0][1],m=0;for(c=1;p>c;c++)if(u=g,f=v,g=r[c][0],v=r[c][1],d=Math.min(u,g),!(d>n||n>Math.max(u,g)||s>Math.max(f,v)))if(s=s&&n!==d&&m++}return m%2===1}var r=t.slice(),a=r[0][0],o=a,i=r[0][1],l=i;r.push(r[0]);for(var s=1;so;o++)if(i=[t[o][0]-s[0],t[o][1]-s[1]],l=r(i,c),0>l||l>u||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":98}],102:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;nt}function a(t,e){return e>=t}function o(t,e){return t>e}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("../lib");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;d>f&&h++<100;)c=Math.floor((f+d)/2),u(e[c],t)?f=c+1:d=c;return h>90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;r>l;l++)e[l+1]>e[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;o>a&&i++<100;)r=c((a+o)/2),e[r]<=t?a=r+l:o=r-s;return e[a]}},{"../lib":95,"fast-isnumeric":11}],104:[function(t,e,n){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],105:[function(t,e,n){"use strict";var r=t("fast-isnumeric");n.aggNums=function(t,e,a,o){var i,l;if(o||(o=a.length),r(e)||(e=!1),Array.isArray(a[0])){for(l=new Array(o),i=0;o>i;i++)l[i]=n.aggNums(t,e,a[i]);a=l}for(i=0;o>i;i++)r(e)?r(a[i])&&(e=t(+e,+a[i])):e=a[i];return e},n.len=function(t){return n.aggNums(function(t){return t+1},0,t)},n.mean=function(t,e){return e||(e=n.len(t)),n.aggNums(function(t,e){return t+e},0,t)/e},n.variance=function(t,e,a){return e||(e=n.len(t)),r(a)||(a=n.mean(t,e)),n.aggNums(function(t,e){return t+Math.pow(e-a,2)},0,t)/e},n.stdev=function(t,e,r){return Math.sqrt(n.variance(t,e,r))},n.interp=function(t,e){if(!r(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":11}],106:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,-1===v.indexOf(u.protocol)?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var v=d.getPlotDiv(l.node());(v&&v._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({"class":p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],v=parseInt(l.style("font-size"),10)||r(l,"height"),m=-v/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,m-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-d/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(m," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":87,"../constants/xmlns_namespaces":88,"../lib":95,d3:9}],107:[function(t,e,n){"use strict";function r(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function a(t){Array.isArray(t._promises)&&t._promises.length>0&&N.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),P.defaultConfig.setBackground(t,e)}function i(t,e){t._context||(t._context=N.extendFlat({},P.defaultConfig));var n=t._context;e&&(Object.keys(e).forEach(function(t){t in n&&("setBackground"===t&&"opaque"===e[t]?n[t]=o:n[t]=e[t])}),e.plot3dPixelRatio&&!n.plotGlPixelRatio&&(n.plotGlPixelRatio=n.plot3dPixelRatio)),n.staticPlot&&(n.editable=!1,n.autosizable=!1,n.scrollZoom=!1,n.doubleClick=!1,n.showTips=!1,n.showLink=!1,n.displayModeBar=!1)}function l(t,e,n){var r=C.select(t).selectAll(".plot-container").data([0]);r.enter().insert("div",":first-child").classed("plot-container plotly",!0);var a=r.selectAll(".svg-container").data([0]);a.enter().append("div").classed("svg-container",!0).style("position","relative"),a.html(""),e&&(t.data=e),n&&(t.layout=n),P.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(k(t,{}),t._fullLayout.autosize=n.autosize=!0),a.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=P.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},a.node()),t.framework.setUndoPoint();var o=t.framework.svg(),i=1,l=t._fullLayout.title;""!==l&&l||(i=0);var s="Click to enter title",c=function(){this.call(P.util.convertToTspans)},u=o.select(".title-group text").call(c);if(t._context.editable){u.attr({"data-unformatted":l}),l&&l!==s||(i=.2,u.attr({"data-unformatted":s}).text(s).style({opacity:i}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(P.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(c),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(c)})};u.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),R.addLinks(t),Promise.resolve()}function s(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var r=P.Axes.list({_fullLayout:t});for(e=0;ee;e++){var i=t.annotations[e];i.ref&&("paper"===i.ref?(i.xref="paper",i.yref="paper"):"data"===i.ref&&(i.xref="x",i.yref="y"),delete i.ref),c(i,"xref"),c(i,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(N.warn("Shapes must be an array."),delete t.shapes);var l=(t.shapes||[]).length;for(e=0;l>e;e++){var s=t.shapes[e];c(s,"xref"),c(s,"yref")}var u=t.legend;u&&(u.x>3?(u.x=1.02,u.xanchor="left"):u.x<-2&&(u.x=-.02,u.xanchor="right"),u.y>3?(u.y=1.02,u.yanchor="bottom"):u.y<-2&&(u.y=-.02,u.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=R.getSubplotIds(t,"gl3d"); +for(e=0;en;++n)x[n]=v[e]+m*y[2+4*n];h.camera={eye:{x:x[0],y:x[1],z:x[2]},center:{x:v[0],y:v[1],z:v[2]},up:{x:y[1],y:y[5],z:y[9]}},delete h.cameraposition}}return F.clean(t),t}function c(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=P.Axes.cleanId(n,r))}function u(t,e){for(var n=[],r=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),a=0;ao&&(l=N.randstr(r),-1!==n.indexOf(l));o++);i.uid=N.randstr(r),r.push(i.uid)}if(n.push(i.uid),"histogramy"===i.type&&"xbins"in i&&!("ybins"in i)&&(i.ybins=i.xbins,delete i.xbins),i.error_y&&"opacity"in i.error_y){var s=F.defaults,c=i.error_y.color||(R.traceIs(i,"bar")?F.defaultLine:s[a%s.length]);i.error_y.color=F.addOpacity(F.rgb(c),F.opacity(c)*i.error_y.opacity),delete i.error_y.opacity}if("bardir"in i&&("h"!==i.bardir||!R.traceIs(i,"bar")&&"histogram"!==i.type.substr(0,9)||(i.orientation="h",_(i)),delete i.bardir),"histogramy"===i.type&&_(i),"histogramx"!==i.type&&"histogramy"!==i.type||(i.type="histogram"),"scl"in i&&(i.colorscale=i.scl,delete i.scl),"reversescl"in i&&(i.reversescale=i.reversescl,delete i.reversescl),i.xaxis&&(i.xaxis=P.Axes.cleanId(i.xaxis,"x")),i.yaxis&&(i.yaxis=P.Axes.cleanId(i.yaxis,"y")),R.traceIs(i,"gl3d")&&i.scene&&(i.scene=R.subplotsRegistry.gl3d.cleanId(i.scene)),R.traceIs(i,"pie")||(Array.isArray(i.textposition)?i.textposition=i.textposition.map(f):i.textposition&&(i.textposition=f(i.textposition))),R.traceIs(i,"2dMap")&&("YIGnBu"===i.colorscale&&(i.colorscale="YlGnBu"),"YIOrRd"===i.colorscale&&(i.colorscale="YlOrRd")),R.traceIs(i,"markerColorscale")&&i.marker){var u=i.marker;"YIGnBu"===u.colorscale&&(u.colorscale="YlGnBu"),"YIOrRd"===u.colorscale&&(u.colorscale="YlOrRd")}if("surface"===i.type&&N.isPlainObject(i.contours)){var h=["x","y","z"];for(o=0;or?o.push(a+r):o.push(r);return o}function g(t,e,n){var r,a;for(r=0;r=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||0>a&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function v(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&g(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function m(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&s0){var l=w(t._boundingBoxMargins),s=l.left+l.right,c=l.bottom+l.top,u=o._container.node().getBoundingClientRect(),f=1-2*i.frameMargins;a=Math.round(f*(u.width-s)),r=Math.round(f*(u.height-c))}else n=window.getComputedStyle(t),r=parseFloat(n.height)||o.height,a=parseFloat(n.width)||o.width;return Math.abs(o.width-a)>1||Math.abs(o.height-r)>1?(o.height=t.layout.height=r,o.width=t.layout.width=a):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),R.sanitizeMargins(o),e}function M(t){var e=C.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===n.autosize&&(k(t,{}),n.autosize=!0,t.layout.autosize=!0),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];C.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=N.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0);var o=P.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),n._has("cartesian")&&T(t,o),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var i=n._paper.selectAll(".layer-subplot");n._imageSubplotLayer=i.selectAll(".imagelayer"),n._shapeSubplotLayer=i.selectAll(".shapelayer");var l=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=l.append("g").classed("imagelayer",!0),n._shapeUpperLayer=l.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var s=N.syncOrAsync([L,function(){return P.Axes.doTicks(t,"redraw")},j.init],t);return s&&s.then&&t._promises.push(s),s}function A(t,e){function n(e,n){return function(){return P.Axes.getFromId(t,e,n)}}for(var r,a,o=t._fullLayout._plots={},i=0;i0,_=P.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),k=w===_;b?t.framework===M&&!x&&k||(t.framework=M,M(t)):k?x&&M(t):(t.framework=M,M(t)),x&&P.Axes.saveRangeInitial(t);var A=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&h(t);for(var z=0;zG.range[0]?[1,2]:[2,1]);else{var Q=G.range[0],W=G.range[1];"log"===j?(0>=Q&&0>=W&&o(Y+".autorange",!0),0>=Q?Q=W/1e6:0>=W&&(W=Q/1e6),o(Y+".range[0]",Math.log(Q)/Math.LN10),o(Y+".range[1]",Math.log(W)/Math.LN10)):(o(Y+".range[0]",Math.pow(10,Q)),o(Y+".range[1]",Math.pow(10,W)))}else o(Y+".autorange",!0)}if("reverse"===B)U.range?U.range.reverse():(o(Y+".autorange",!0),U.range=[1,0]),X.autorange?w=!0:_=!0;else if("annotations"===D.parts[0]||"shapes"===D.parts[0]){var J=D.parts[1],K=D.parts[0],tt=g[K]||[],et=P[N.titleCase(K)],nt=tt[J]||{};2===D.parts.length&&("add"===m[E]||N.isPlainObject(m[E])?z[E]="remove":"remove"===m[E]?-1===J?(z[K]=tt,delete z[E]):z[E]=nt:N.log("???",m)),!i(nt,"x")&&!i(nt,"y")||N.containsAny(E,["color","opacity","align","dash"])||(w=!0),et.draw(t,J,D.parts.slice(2).join("."),m[E]),delete m[E]}else if("images"===D.parts[0]){var at=N.objectFromPath(E,j);N.extendDeepAll(t.layout,at),H.supplyLayoutDefaults(t.layout,t._fullLayout),H.draw(t)}else if("mapbox"===D.parts[0]&&"layers"===D.parts[1]){N.extendDeepAll(t.layout,N.objectFromPath(E,j));var ot=(t._fullLayout.mapbox||{}).layers||[];for(O=D.parts[2]+1-ot.length,p=0;O>p;p++)ot.push({});_=!0}else if("updatemenus"===D.parts[0]){N.extendDeepAll(t.layout,N.objectFromPath(E,j));var it=t._fullLayout.updatemenus||[];for(O=D.parts[2]+1-it.length,p=0;O>p;p++)it.push({});_=!0}else 0===D.parts[0].indexOf("scene")?_=!0:0===D.parts[0].indexOf("geo")?_=!0:0===D.parts[0].indexOf("ternary")?_=!0:!v._has("gl2d")||-1===E.indexOf("axis")&&"plot_bgcolor"!==D.parts[0]?"hiddenlabels"===E?w=!0:-1!==D.parts[0].indexOf("legend")?y=!0:-1!==E.indexOf("title")?x=!0:-1!==D.parts[0].indexOf("bgcolor")?b=!0:D.parts.length>1&&N.containsAny(D.parts[1],["tick","exponent","grid","zeroline"])?x=!0:-1!==E.indexOf(".linewidth")&&-1!==E.indexOf("axis")?x=b=!0:D.parts.length>1&&-1!==D.parts[1].indexOf("line")?b=!0:D.parts.length>1&&"mirror"===D.parts[1]?x=b=!0:"margin.pad"===E?x=b=!0:"margin"===D.parts[0]||"autorange"===D.parts[1]||"rangemode"===D.parts[1]||"type"===D.parts[1]||"domain"===D.parts[1]||E.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(E)?M=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(E)&&(_=!0):_=!0, D.set(j)}I.add(t,rt,[t,z],rt,[t,T]),m.autosize&&(m=k(t,m)),(m.height||m.width||m.autosize)&&(w=!0);var lt=Object.keys(m),st=[R.previousPromises];if(_||w)st.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),P.plot(t,"",g)});else if(lt.length&&(R.supplyDefaults(t),v=t._fullLayout,y&&st.push(function(){return V.draw(t),R.previousPromises(t)}),b&&st.push(L),x&&st.push(function(){return P.Axes.doTicks(t,"redraw"),S(t),R.previousPromises(t)}),M)){var ct;for($(t),P.Fx.supplyLayoutDefaults(t.layout,v,t._fullData),P.Fx.init(t),ct=R.getSubplotIds(v,"gl3d"),p=0;p1)};c(n.width)&&c(n.height)||l(new Error("Height and width should be pixel values."));var u=r.clone(e,{format:"png",height:n.height,width:n.width}),f=u.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var d=r.getRedrawFunc(f);o.plot(f,u.data,u.layout,u.config).then(d).then(s).then(function(e){t(e)}).catch(function(t){l(t)})});return l}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib");e.exports=r},{"../lib":95,"../plotly":113,"../snapshot":145,"fast-isnumeric":11}],112:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,v=n.length,m=0;v>m;m++){var y=n[m],x=["data",m];if(p(y)){var b=u[m],_=b.type,w=l.traces[_].attributes;w.type={valType:"enumerated",values:[_]},b.visible===!1&&y.visible!==!1&&s.push(i("invisible",x)),r(y,b,w,s,x);var k=y.transforms,M=b.transforms;if(k){g(k)||s.push(i("array",x,["transforms"])),x.push("transforms");for(var A=0;Ac&&u>e&&(void 0===a[n]?o[f]=T.tickText(t,e):o[f]=l(t,e,String(a[n])),f++);return f=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function i(t,e){var n=t.match(B),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(B,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o=e.x,l=t._tickround,s=new Date(o),c="";n&&t.hoverformat?a=i(t.hoverformat,o):t.tickformat?a=i(t.tickformat,o):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[l]),"y"===l?a=D(s):"m"===l?a=I(s):(o!==t._tmin||n||(c="
"+D(s)),"d"===l?a=R(s):"H"===l?a=j(s):(o!==t._tmin||n||(c="
"+R(s)+", "+D(s)),a=F(s),"M"!==l&&(a+=q(s),"S"!==l&&(a+=d(m(o/1e3,1),t,"none",n).substr(1)))))),e.text=a+c}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&m(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,m(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>i?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=0>t,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat;if(r){var u={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(u),i=(Number(u._tickround)||0)+4,s=u._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),f>t)t="0",a=!1;else{if(t+=f,s&&(t*=Math.pow(10,-s),i+=s),0===i)t=String(Math.floor(t));else if(0>i){t=String(Math.round(t)),t=t.substr(0,t.length+i);for(var d=i;0>d;d++)t+="0"}else{t=String(t);var h=t.indexOf(".")+1;h&&(t=t.substr(0,h+i).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(s&&"hide"!==l){var p;p=0>s?"\u2212"+-s:"power"!==l?"+"+s:String(s),"e"===l||("SI"===l||"B"===l)&&(s>12||-15>s)?t+="e"+p:"E"===l?t+="E"+p:"power"===l?t+="\xd710"+p+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=H[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var p=r-1,g=r+1;n="tozero"===t.rangemode?0>r?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var n=T.list(t,"",!0),r=!1,a=0;ap&&(p=g/10),c=t.c2l(p),u=t.c2l(g),y&&(c=Math.min(0,c),u=Math.max(0,u)),r(c)){for(h=!0,i=0;i=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,v=e.length,m=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;6>o;o++)a(o);for(o=v-1;o>5;o--)a(o)}},T.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,i]};T.autoTicks(f,l);var d,h=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;yg&&(p>.3*b||a(o)||a(i))){var w=f.dtick/2;h+=o>h+w?w:-w}var k=1+Math.floor((i-h)/f.dtick);d=h+k*f.dtick}else for(d=h;i>=d;)d=T.tickIncrement(d,f.dtick);return{start:h,end:d,size:f.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return r(t);if("auto"===t.tickmode||!t.dtick){var e,n=t.nticks;n||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/e):(e="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var a=t.range[1]=l:l>=s)&&(i.push(s),!(i.length>1e3));s=T.tickIncrement(s,t.dtick,a));t._tmax=i[i.length-1];for(var c=new Array(i.length),u=0;u157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,S)):e>12096e5?(e/=26298e5,t.dtick="M"+a(e,1,C)):e>432e5?(t.dtick=a(e,864e5,O),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=a(e,36e5,C):e>3e4?t.dtick=a(e,6e4,E):e>500?t.dtick=a(e,1e3,E):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?N:P,s=t+.01*r,c=_.roundUp(m(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]r:r>c;)c=T.tickIncrement(c,a,e);return c}if("L"===u)return Math.log(n((Math.pow(10,r)-o)/f)*f+o)/Math.LN10;if("D"===u){var d="D2"===a?N:P,h=_.roundUp(m(r,1),d,e);return Math.floor(r)+Math.log(y.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(a)};var D=y.time.format("%Y"),I=y.time.format("%b %Y"),R=y.time.format("%b %-d"),j=y.time.format("%b %-d %Hh"),F=y.time.format("%H:%M"),q=y.time.format(":%S"),B=/%(\d?)f/g;T.tickText=function(t,e,n){function r(r){var a;return void 0===r?!0:n?"none"===r:(a={first:t._tmin,last:t._tmax}[r],"all"!==r&&e!==a)}var a,o,i=l(t,e),d="array"===t.tickmode,h=n||d;if(d&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&en&&(M=90),a(u,M)}c._lastangle=M}return i(e),e+" done"}function s(){c._boundingBox=n.node().getBoundingClientRect()}var u=n.selectAll("g."+C).data(z,S);if(!c.showticklabels||!x(r))return u.remove(),void i(e);var f,d,p,m,b;"x"===v?(b="bottom"===q?1:-1,f=function(t){return t.dx+D*b},m=r+(N+P)*b,d=function(t){return t.dy+m+t.fontSize*("bottom"===q?1:-.5)},p=function(t){return x(t)&&0!==t&&180!==t?0>t*b?"end":"start":"middle"}):(b="right"===q?1:-1,d=function(t){return t.dy+t.fontSize/2-D*b},f=function(t){return t.dx+r+(N+P+(90===Math.abs(c.tickangle)?t.fontSize/2:0))*b},p=function(t){return x(t)&&90===Math.abs(t)?"middle":"right"===q?"start":"end"; });var k=0,M=0,T=[];u.enter().append("g").classed(C,1).append("text").attr("text-anchor","middle").each(function(e){var n=y.select(this),r=t._promises.length;n.call(A.setPosition,f(e),d(e)).call(A.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),r=t._promises[r],r?T.push(t._promises.pop().then(function(){a(n,c.tickangle)})):a(n,c.tickangle)}),u.exit().remove(),u.each(function(t){k=Math.max(k,t.fontSize)}),a(u,c._lastangle||c.tickangle);var L=_.syncOrAsync([o,l,s]);return L&&L.then&&t._promises.push(L),L}function i(e){if(!n){var r,a,o,i,l=L.getFromId(t,e),s=y.select(t).selectAll("g."+e+"tick"),c={selection:s,side:l.side},f=e.charAt(0),d=t._fullLayout._size,h=1.5,p=l.titlefont.size;if(s.size()){var g=y.select(s.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);g&&(c.offsetLeft=+g[1],c.offsetTop=+g[2])}"x"===f?(a="free"===l.anchor?{_offset:d.t+(1-(l.position||0))*d.h,_length:0}:L.getFromId(t,l.anchor),o=l._offset+l._length/2,i=a._offset+("top"===l.side?-10-p*(h+(l.showticklabels?1:0)):a._length+10+p*(h+(l.showticklabels?1.5:.5))),l.rangeslider&&l.rangeslider.visible&&l._boundingBox&&(i+=(u.height-u.margin.b-u.margin.t)*l.rangeslider.thickness+l._boundingBox.height),c.side||(c.side="bottom")):(a="free"===l.anchor?{_offset:d.l+(l.position||0)*d.w,_length:0}:L.getFromId(t,l.anchor),i=l._offset+l._length/2,o=a._offset+("right"===l.side?a._length+10+p*(h+(l.showticklabels?1:.5)):-10-p*(h+(l.showticklabels?.5:0))),r={rotate:"-90",offset:0},c.side||(c.side="left")),k.draw(t,e+"title",{propContainer:l,propName:l._name+".title",dfltName:f.toUpperCase()+" axis",avoid:c,transform:r,attributes:{x:o,y:i,"text-anchor":"middle"}})}}function l(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:b.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[v]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===v}function s(e,n,a){var o=e.gridlayer,i=e.zerolinelayer,s=e["hidegrid"+v]?[]:H,u=c._gridpath||"M0,0"+("x"===v?"v":"h")+n._length,f=o.selectAll("path."+E).data(c.showgrid===!1?[]:s,S);if(f.enter().append("path").classed(E,1).classed("crisp",1).attr("d",u).each(function(t){c.zeroline&&("linear"===c.type||"-"===c.type)&&Math.abs(t.x)g;g++){var y=c.mirrors[i._id+d[g]];"ticks"!==y&&"labels"!==y||(f[g]=!0)}return void 0!==r[2]&&(f[2]=!0),f.forEach(function(t,e){var n=r[e],a=B[e];t&&x(n)&&(h+=p(n+P*a,a*c.ticklen))}),a(n,h),s(e,i,t),o(n,r[3])}}).filter(function(t){return t&&t.then});return Z.length?Promise.all(Z):0},T.swap=function(t,e){for(var n=h(t,e),r=0;r2*r}function u(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var f=t("fast-isnumeric"),d=t("tinycolor2").mix,h=t("../../lib"),p=t("../plots"),g=t("../../components/color/attributes").lightFraction,v=t("./layout_attributes"),m=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),x=t("./tick_label_defaults"),b=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),k=t("./clean_datum"),M=t("./axis_ids");e.exports=function(t,e,n,a){function o(n,r){return h.coerce2(t,e,v,n,r)}var i=a.letter,l=a.font||{},s="Click to enter "+(a.title||i.toUpperCase()+" axis")+" title";a.name&&(e._name=a.name,e._id=M.name2id(a.name));var c=n("type");"-"===c&&(r(e,a.data),"-"===e.type?e.type="linear":c=t.type=e.type),_(e);var u=n("color"),p=u===t.color?u:l.color;n("title",s),h.coerceFont(n,"titlefont",{family:l.family,size:Math.round(1.2*l.size),color:p});var k=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),A=n("autorange",!k);A&&n("rangemode");var T=n("range",[-1,"x"===i?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),h.noneOrAll(t.range,e.range,[0,1]),n("fixedrange"),m(t,e,n,c),x(t,e,n,c,a),y(t,e,n,a),b(t,e,n);var L=o("linecolor",u),z=o("linewidth"),S=n("showline",!!L||!!z);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&n("mirror");var C=o("gridcolor",d(u,a.bgColor,g).toRgbString()),E=o("gridwidth"),O=n("showgrid",a.showGrid||!!C||!!E);O||(delete e.gridcolor,delete e.gridwidth);var P=o("zerolinecolor",u),N=o("zerolinewidth"),D=n("zeroline",a.showGrid||!!P||!!N);return D||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===c?w(i,e.categoryorder,e.categoryarray,a.data):[],e}},{"../../components/color/attributes":17,"../../lib":95,"../plots":136,"./axis_ids":118,"./category_order_defaults":119,"./clean_datum":120,"./layout_attributes":125,"./ordered_categories":127,"./set_convert":130,"./tick_label_defaults":131,"./tick_mark_defaults":132,"./tick_value_defaults":133,"fast-isnumeric":11,tinycolor2:13}],118:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],120:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return a.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){a.error(e,t)}return t}},{"../../lib":95,"fast-isnumeric":11}],121:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],122:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?u.ms2DateTime(r,a):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/setcursor"),g=t("../../components/dragelement"),v=t("./axes"),m=t("./select"),y=t("./constants"),x=!0;e.exports=function(t,e,n,l,b,_,w,k){function M(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+gt+")").attr("d",st+"Z"),dt=ht.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+gt+")").attr("d","M0,0Z"),L();for(var o=0;oa?(ut="",it.r=it.l,it.t=it.b,dt.attr("d","M0,0Z")):(it.t=0,it.b=V,ut="x",dt.attr("d","M"+(it.l-.5)+","+(ot-Y-.5)+"h-3v"+(2*Y+1)+"h3ZM"+(it.r+.5)+","+(ot-Y-.5)+"h3v"+(2*Y+1)+"h-3Z")):!W||a.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function S(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),x=!1)))}function E(e,n){var a=1===(w+k).length;if(e)I();else if(2!==n||a){if(1===n&&a){var o=w?B[0]:q[0],i="s"===w||"w"===k?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",d="middle";if(o.fixedrange)return;w?(d="n"===w?"top":"bottom","right"===o.side&&(u="right")):"e"===k&&(u="right"),et.call(f.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:d}).on("edit",function(e){var n="category"===o.type?o.c2l(e):o.d2l(e);void 0!==n&&c.relayout(t,l,n)})}}else D()}function O(e){function n(t,e,n){if(!t.fixedrange){A(t.range);var r=t.range,a=r[0]+(r[1]-r[0])*e;t.range=[a+(r[0]-a)*n,a+(r[1]-a)*n]}}if(t._context.scrollZoom||j._enablescrollzoom){var r=t.querySelector(".plotly");if(!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(mt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void u.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,f=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-f);if(k){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,n){for(var a=1-e,o=0,i=0;i0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rT;T++){var L=o[T],z=h[L];if(z)M[T]=w.getFromId(t,z.xaxis._id),A[T]=w.getFromId(t,z.yaxis._id);else{var S=i[L]._subplot;M[T]=S.xaxis,A[T]=S.yaxis}}var C=e.hovermode||i.hovermode;if(-1===["x","y","closest"].indexOf(C)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var E,O,P,N,D,I,R,j,F,q,B,H,V=[],Z=[];if(Array.isArray(e))for(C="array",P=0;PY||Y>X.width||0>U||U>X.height)return _.unhoverRaw(t,e)}else Y="xpx"in e?e.xpx:M[0]._length/2,U="ypx"in e?e.ypx:A[0]._length/2;if(E="xval"in e?r(o,e.xval):a(M,Y),O="yval"in e?r(o,e.yval):a(A,U),!g(E[0])||!g(O[0]))return v.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var G=1/0;for(N=0;N1||-1!==I.hoverinfo.indexOf("name")?I.name:void 0,index:!1,distance:Math.min(G,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},H=V.length,"array"===j){var $=e[N];"pointNumber"in $?(B.index=$.pointNumber,j="closest"):(j="","xval"in $&&(F=$.xval,j="x"),"yval"in $&&(q=$.yval,j=j?"closest":"y"))}else F=E[R],q=O[R];if(I._module&&I._module.hoverPoints){var Q=I._module.hoverPoints(B,F,q,j);if(Q)for(var W,J=0;JH&&(V.splice(0,H),G=V[0].distance)}if(0===V.length)return _.unhoverRaw(t,e);var K="y"===C&&Z.length>1;V.sort(function(t,e){return t.distance-e.distance});var tt=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),et={hovermode:C,rotateLabels:K,bgColor:tt,container:i._hoverlayer,outerContainer:i._paperdiv},nt=c(V,et);u(V,K?"xa":"ya"),f(nt,K);var rt=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),v=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),v=d.node().getBoundingClientRect().width+2*O):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var m,k,L=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),N=L.width+E+O+v;t.ty0=_-L.top,t.bx=L.width+2*O,t.by=L.height+2*O,t.anchor="start",t.txwidth=L.width,t.tx2width=v,t.offset=0,o?(t.pos=z,m=M>=S+P/2+N,k=S-P/2-N>=0,"top"!==t.idealAlign&&m||!k?m?(S+=P/2,t.anchor="start"):t.anchor="middle":(S-=P/2,t.anchor="end")):(t.pos=S,m=w>=z+C/2+N,k=z-C/2-N>=0,"left"!==t.idealAlign&&m||!k?m?(z+=C/2,t.anchor="start"):t.anchor="middle":(z-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+S+")"+(o?"rotate("+T+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(.01>o)){if(-.01>a){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(0>=c);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=c);i++)if(s=t[i],s.pos=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(0>=c);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?z:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var v=f[i];for(l=v.length-1;l>=0;l--){var m=v[l],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(E+O),l=i+o*(t.txwidth+O),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=t.offset*S),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*E+s)+","+(E+c)+"v"+(t.by/2-E)+"h"+r*t.bx+"v-"+t.by+"H"+(r*E+s)+"V"+(c-E)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+O).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*O+s,c+t.ty0-t.by/2+O),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,n){function r(n,r){return v.coerce(t,e,A.layoutAttributes,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},A.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indext*e||0===t?k.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":18,"../../components/dragelement":39,"../../components/drawing":41,"../../lib":95,"../../lib/events":93,"../../lib/svg_text_utils":106,"./axes":116,"./constants":121,"./dragbox":122,d3:9,"fast-isnumeric":11,tinycolor2:13}],124:[function(t,e,n){"use strict";var r=t("../plots"),a=t("./constants");n.name="cartesian",n.attr=["xaxis","yaxis"],n.idRoot=["x","y"],n.idRegex=a.idRegex,n.attrRegex=a.attrRegex,n.attributes=t("./attributes"),n.plot=function(t){function e(t,e){for(var n=[],r=0;rf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":95,"fast-isnumeric":11}],129:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,v=a.element.getBoundingClientRect(),m=a.plotinfo.x()._offset,y=a.plotinfo.y()._offset,x=e-v.left,b=n-v.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",k+"Z");var C,E,O,P,N,D=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,j=[];for(C=0;C0)return Math.log(e)/Math.LN10;if(0>=e&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*u*Math.abs(r-a))}return i.BADNUM}function n(t){return Math.pow(10,t)}function c(t){return a(t)?Number(t):i.BADNUM}var u=10;if(t.c2l="log"===t.type?e:c,t.l2c="log"===t.type?n:c,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var r=s.getFromId(t._gd,t.overlaying);t.domain=r.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)a(t.range[e])||(t.range[e]=a(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):i.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=c,t.d2c=function(t){return t=l(t),a(t)?Number(t):i.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return a(t)?o.ms2DateTime(t):i.BADNUM},t.d2c=function(t){return a(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!a(t.range[0])&&a(f[0])&&(t.range[0]=f[0]),!a(t.range[1])&&a(f[1])&&(t.range[1]=f[1])}catch(d){o.error(d,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var n=t._categories.indexOf(e);return-1===n?i.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&a(t,i),l.text(i.text()&&c.text()?" - ":"")},h.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=h.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},h.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},a=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];h.supplyLayoutGlobalDefaults(a,r),r._dataLength=s.length,h.supplyDataDefaults(s,l,r),r._has=h._hasPlotType.bind(r);var c=r._modules;for(e=0;eo&&(e=(n-1)/(a.l+a.r),a.l=Math.floor(e*a.l),a.r=Math.floor(e*a.r)),0>i&&(e=(r-1)/(a.t+a.b),a.t=Math.floor(e*a.t),a.b=Math.floor(e*a.b))}},h.autoMargin=function(t,e,n){var r=t._fullLayout;if(r._pushmargin||(r._pushmargin={}),r.margin.autoexpand!==!1){if(n){var a=void 0===n.pad?12:n.pad;n.l+n.r>.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||h.doAutoMargin(t)}},h.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;return e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var v=s[t].t.val,m=s[t].t.size;if(v>d){var y=(h*v+(m-e.height)*d)/(v-d),x=(m*(1-d)+(h-e.height)*(1-v))/(v-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,t._replotting||"{}"===r||r===JSON.stringify(e._size)?void 0:u.plot(t)},h.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?f.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&h.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)}},{"../components/color":18,"../lib":95,"../plotly":113,"./attributes":114,"./font_attributes":134,"./layout_attributes":135,d3:9,"fast-isnumeric":11}],137:[function(t,e,n){"use strict";var r=t("../../traces/scatter/attributes"),a=r.marker;e.exports={r:r.r,t:r.t,marker:{color:a.color,size:a.size,symbol:a.symbol,opacity:a.opacity}}},{"../../traces/scatter/attributes":173}],138:[function(t,e,n){"use strict";function r(t,e){var n={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"] +var r=t[n];if("h"!==r.orientation){e=!1;break}}return e},A.init=function(t){var e=t._fullLayout;if(e._has("cartesian")&&!t._context.staticPlot){var n=Object.keys(e._plots||{}).sort(function(t,n){if((e._plots[t].mainplot&&!0)===(e._plots[n].mainplot&&!0)){var r=t.split("y"),a=n.split("y");return r[0]===a[0]?Number(r[1]||1)-Number(a[1]||1):Number(r[0]||1)-Number(a[0]||1)}return e._plots[t].mainplot?1:-1});n.forEach(function(n){var r=e._plots[n];if(e._has("cartesian")){var a=r.x(),o=r.y(),i=(a._linepositions[n]||[])[3],l=(o._linepositions[n]||[])[3],s=k.DRAGGERSIZE;if(g(i)&&"top"===a.side&&(i-=s),g(l)&&"right"!==o.side&&(l-=s),!r.mainplot){var c=M(t,r,0,0,a._length,o._length,"ns","ew");c.onmousemove=function(r){A.hover(t,r,n),e._lasthover=c,e._hoversubplot=n},c.onmouseout=function(e){t._dragging||_.unhover(t,e)},c.onclick=function(e){A.click(t,e)},M(t,r,-s,-s,s,s,"n","w"),M(t,r,a._length,-s,s,s,"n","e"),M(t,r,-s,o._length,s,s,"s","w"),M(t,r,a._length,o._length,s,s,"s","e")}g(i)&&("free"===a.anchor&&(i-=e._size.h*(1-o.domain[1])),M(t,r,.1*a._length,i,.8*a._length,s,"","ew"),M(t,r,0,i,.1*a._length,s,"","w"),M(t,r,.9*a._length,i,.1*a._length,s,"","e")),g(l)&&("free"===o.anchor&&(l-=e._size.w*a.domain[0]),M(t,r,l,.1*o._length,s,.8*o._length,"ns",""),M(t,r,l,.9*o._length,s,.1*o._length,"s",""),M(t,r,l,0,s,.1*o._length,"n",""))}});var r=e._hoverlayer.node();r.onmousemove=function(n){n.target=e._lasthover,A.hover(t,n,e._hoversubplot)},r.onclick=function(n){n.target=e._lasthover,A.click(t,n)},r.onmousedown=function(t){e._lasthover.onmousedown(t)}}};var T=k.YANGLE,L=Math.PI*T/180,z=1/Math.sin(L),S=Math.cos(L),C=Math.sin(L),E=k.HOVERARROWSIZE,O=k.HOVERTEXTPAD,P=k.HOVERFONTSIZE,N=k.HOVERFONT;A.hover=function(t,e,n){return"string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indext*e||0===t?k.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":18,"../../components/dragelement":39,"../../components/drawing":41,"../../lib":95,"../../lib/events":93,"../../lib/svg_text_utils":106,"./axes":116,"./constants":121,"./dragbox":122,d3:9,"fast-isnumeric":11,tinycolor2:13}],124:[function(t,e,n){"use strict";var r=t("../plots"),a=t("./constants");n.name="cartesian",n.attr=["xaxis","yaxis"],n.idRoot=["x","y"],n.idRegex=a.idRegex,n.attrRegex=a.attrRegex,n.attributes=t("./attributes"),n.plot=function(t){function e(t,e){for(var n=[],r=0;rf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":95,"fast-isnumeric":11}],129:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,v=a.element.getBoundingClientRect(),m=a.plotinfo.x()._offset,y=a.plotinfo.y()._offset,x=e-v.left,b=n-v.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",k+"Z");var C,E,O,P,N,D=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,j=[];for(C=0;C0)return Math.log(e)/Math.LN10;if(0>=e&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*u*Math.abs(r-a))}return i.BADNUM}function n(t){return Math.pow(10,t)}function c(t){return a(t)?Number(t):i.BADNUM}var u=10;if(t.c2l="log"===t.type?e:c,t.l2c="log"===t.type?n:c,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var r=s.getFromId(t._gd,t.overlaying);t.domain=r.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)a(t.range[e])||(t.range[e]=a(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):i.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=c,t.d2c=function(t){return t=l(t),a(t)?Number(t):i.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return a(t)?o.ms2DateTime(t):i.BADNUM},t.d2c=function(t){return a(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!a(t.range[0])&&a(f[0])&&(t.range[0]=f[0]),!a(t.range[1])&&a(f[1])&&(t.range[1]=f[1])}catch(d){o.error(d,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var n=t._categories.indexOf(e);return-1===n?i.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&a(t,i),l.text(i.text()&&c.text()?" - ":"")},h.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=h.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},h.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},a=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];h.supplyLayoutGlobalDefaults(a,r),r._dataLength=s.length,h.supplyDataDefaults(s,l,r),r._has=h._hasPlotType.bind(r);var c=r._modules;for(e=0;eo&&(e=(n-1)/(a.l+a.r),a.l=Math.floor(e*a.l),a.r=Math.floor(e*a.r)),0>i&&(e=(r-1)/(a.t+a.b),a.t=Math.floor(e*a.t),a.b=Math.floor(e*a.b))}},h.autoMargin=function(t,e,n){var r=t._fullLayout;if(r._pushmargin||(r._pushmargin={}),r.margin.autoexpand!==!1){if(n){var a=void 0===n.pad?12:n.pad;n.l+n.r>.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||h.doAutoMargin(t)}},h.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;return e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var v=s[t].t.val,m=s[t].t.size;if(v>d){var y=(h*v+(m-e.height)*d)/(v-d),x=(m*(1-d)+(h-e.height)*(1-v))/(v-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,t._replotting||"{}"===r||r===JSON.stringify(e._size)?void 0:u.plot(t)},h.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?f.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&h.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)}},{"../components/color":18,"../lib":95,"../plotly":113,"./attributes":114,"./font_attributes":134,"./layout_attributes":135,d3:9,"fast-isnumeric":11}],137:[function(t,e,n){"use strict";var r=t("../../traces/scatter/attributes"),a=r.marker;e.exports={r:r.r,t:r.t,marker:{color:a.color,size:a.size,symbol:a.symbol,opacity:a.opacity}}},{"../../traces/scatter/attributes":173}],138:[function(t,e,n){"use strict";function r(t,e){var n={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"] },ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,n)}var a=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,i=o({},a.domain,{});e.exports={radialaxis:r("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:i,orientation:{valType:"number"}}),angularaxis:r("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:i}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":94,"../cartesian/layout_attributes":125}],139:[function(t,e,n){var r=t("../../plotly"),a=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},i=r.Lib.extendDeepAll;o.Axis=function(){function t(t){n=t||n;var c=s.data,f=s.layout;return("string"==typeof n||n.nodeName)&&(n=a.select(n)),n.datum(c).each(function(t,n){function s(t,e){return l(t)%360+f.orientation}var c=t.slice();u={data:o.util.cloneJson(c),layout:o.util.cloneJson(f)};var d=0;c.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[d],d=(d+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:a.rgb(t.color).darker().toString()),u.data[e].color=t.color,u.data[e].strokeColor=t.strokeColor,u.data[e].strokeDash=t.strokeDash,u.data[e].strokeSize=t.strokeSize});var h=c.filter(function(t,e){var n=t.visible;return"undefined"==typeof n||n===!0}),p=!1,g=h.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var v=a.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(g),m=[],y=v.map(function(t,e){if("unstacked"===t.key)return t.values;var n=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,r){t.yStack=[n],m.push(n),n=o.util.sumArrays(t.r,n)}),t.values});h=a.merge(y)}h.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var x=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;x=Math.max(10,x);var b,_=[f.margin.left+x,f.margin.top+x];if(p){var w=a.max(o.util.sumArrays(o.util.arrayLast(h).r[0],o.util.arrayLast(m)));b=[0,w]}else b=a.extent(o.util.flattenArray(h.map(function(t,e){return t.r})));f.radialAxis.domain!=o.DATAEXTENT&&(b[0]=0),r=a.scale.linear().domain(f.radialAxis.domain!=o.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:b).range([0,x]),u.layout.radialAxis.domain=r.domain();var k,M=o.util.flattenArray(h.map(function(t,e){return t.t})),A="string"==typeof M[0];A&&(M=o.util.deduplicate(M),k=M.slice(),M=a.range(M.length),h=h.map(function(t,e){var n=t;return t.t=[M],p&&(n.yStack=t.yStack),n}));var T=h.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===h.length,L=null===f.needsEndSpacing?A||!T:f.needsEndSpacing,z=f.angularAxis.domain&&f.angularAxis.domain!=o.DATAEXTENT&&!A&&f.angularAxis.domain[0]>=0,S=z?f.angularAxis.domain:a.extent(M),C=Math.abs(M[1]-M[0]);T&&!A&&(C=0);var E=S.slice();L&&A&&(E[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(E[1]-E[0])/O);var P=f.angularAxis.ticksStep||(E[1]-E[0])/(O*(f.minorTicks+1));k&&(P=Math.max(Math.round(P),1)),E[2]||(E[2]=P);var N=a.range.apply(this,E);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=a.scale.linear().domain(E.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?C:0,e=a.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var D="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(D,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=a.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,F=e.select(".chart-group"),q={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=o.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});o.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:j,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=j.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),j.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Z=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Z[0]=Math.max(0,Z[0]),Z[1]=Math.max(0,Z[1]),e.select(".outer-group").attr("transform","translate("+Z+")"),f.title){var Y=e.select("g.title-group text").style(B).text(f.title),U=Y.node().getBBox();Y.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var X=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var G=X.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({"class":"grid-circle"}).style(q),G.attr("r",r),G.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(q);var $=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=a.svg.axis().scale(r).ticks(5).tickSize(5);X.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(q),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(q),J.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=W.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?270>n&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(180>=n&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=a.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=a.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return i(o[n].defaultConfig(),t)});o[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=o.tooltipPanel().config({container:ct,fontSize:8})(),ft=o.tooltipPanel().config({container:ct,fontSize:8})(),dt=o.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos($).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=o.util.convertToCartesian(x+12,n+180);ut.text(o.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos($).radius;pt.attr({r:n}).style({opacity:.5}),lt=r.invert(o.util.getMousePos($).radius);var a=o.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(o.util.round(lt)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var r=a.select(this),i=r.style("fill"),l="black",s=r.style("opacity")||1;if(r.attr({"data-opacity":s}),"none"!=i){r.attr({"data-fill":i}),l=a.hsl(i).darker().toString(),r.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-Z[0]-d.left,f.top+f.height/2-Z[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else i=r.style("stroke"),r.attr({"data-stroke":i}),l=a.hsl(i).darker().toString(),r.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=a.event.which?!1:void(a.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=a.select(this),r=n.attr("data-fill");r?n.style({fill:r,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,r,l,s={data:[],layout:{}},c={},u={},f=a.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),i(s.data[e],o.Axis.defaultConfig().data[0]),i(s.data[e],t)}),i(s.layout,o.Axis.defaultConfig().layout),i(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return r},d.angularScale=function(t){return l},d.svg=function(){return e},a.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:a.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},o.util._extend=function(t,e){for(var n in t)e[n]=t[n]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var n=e||6,r=a.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return r},o.util.dataFromEquation=function(t,e,n){var r=e||6,o=[],i=[];a.range(0,360+r,r).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return a.range(e).map(function(t,e){return n[e]||n[0]})},o.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=o.util.ensureArray(t[e],n)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},o.util.sumArrays=function(t,e){return a.zip(t,e).map(function(t,e){return a.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return-2===n},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},o.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},o.util.getMousePos=function(t){var e=a.mouse(t.node()),n=e[0],r=e[1],o={};return o.x=n,o.y=r,o.pos=e,o.angle=180*(Math.atan2(r,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+r*r),o},o.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;o>a;a++)e=t[a],e in n?(n[e]++,r[e]=n[e]):n[e]=1;return r},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,n,r){if(r){var a=n.slice();n=e,e=a}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,n,r){return"undefined"!=typeof t?(r===e.length-1&&delete t[n],t[n]):void 0},t),n.reduce(function(t,e,r){return"undefined"==typeof t[e]&&(t[e]={}),r===n.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=n[0].geometryConfig,e=t.container;"string"==typeof e&&(e=a.select(e)),e.datum(n).each(function(e,n){function r(e,n){var r=t.radialScale(e[1]),a=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:r,t:a}}function o(t){var e=t.r*Math.cos(t.t),n=t.r*Math.sin(t.t);return{x:e,y:n}}var i=!!e[0].data.yStack,s=e.map(function(t,e){return i?a.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):a.zip(t.data.t[0],t.data.r[0])}),c=t.angularScale,u=t.radialScale.domain()[0],f={};f.bar=function(n,r,o){var i=e[o].data,l=t.radialScale(n[1])-t.radialScale(0),s=t.radialScale(n[2]||0),u=i.barWidth;a.select(this).attr({"class":"mark bar",d:"M"+[[l+s,-u/2],[l+s,u/2],[s,u/2],[s,-u/2]].join("L")+"Z",transform:function(e,n){return"rotate("+(t.orientation+c(e[0]))+")"}})},f.dot=function(t,n,i){var l=t[2]?[t[0],t[1]+t[2]]:t,s=a.svg.symbol().size(e[i].data.dotSize).type(e[i].data.dotType)(t,n);a.select(this).attr({"class":"mark dot",d:s,transform:function(t,e){var n=o(r(l));return"translate("+[n.x,n.y]+")"}})};var d=a.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(n,r,o){var i=n[2]?s[o].map(function(t,e){return[t[0],t[1]+t[2]]}):s[o];if(a.select(this).each(f.dot).style({opacity:function(t,n){return+e[o].data.dotVisible},fill:v.stroke(n,r,o)}).attr({"class":"mark dot"}),!(r>0)){var l=a.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({"class":"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(n,r,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(n,r,o)},"stroke-width":function(t,e){return v["stroke-width"](n,r,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](n,r,o)},opacity:function(t,e){return v.opacity(n,r,o)},display:function(t,e){return v.display(n,r,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=a.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,r){a.select(this).attr({"class":"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var v={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},m=a.select(this).selectAll("g.layer").data(s);m.enter().append("g").attr({"class":"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,n=[o.PolyChart.defaultConfig()],r=a.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),i(n[e],o.PolyChart.defaultConfig()),i(n[e],t)}),this):n},t.getColorScale=function(){return e},a.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:a.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var n=e.legendConfig,r=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=i({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),o=a.merge(r);o=o.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(o=o.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=a.select(l));var s=o.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof o[0]:n.isContinuous,f=u?n.height:c*o.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=a.range(o.length),v=a.scale[u?"linear":"ordinal"]().domain(g).range(s),m=a.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=a.svg.symbolTypes.indexOf(t)?a.svg.symbol().type(t).size(n)():a.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,m(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=a.svg.axis().scale(m).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),n=a.dispatch("hover");return t.config=function(t){return arguments.length?(i(e,t),this):e},a.rebind(t,n,"on"),t},o.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},o.tooltipPanel=function(){var t,e,n,r={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){t=r.container.selectAll("g."+l).data([0]);var a=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=a.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=a.append("text").attr({dx:r.padding+s,dy:.3*+r.fontSize}),c};return c.text=function(o){var i=a.hsl(r.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":r.fontSize+"px"}).text(f);var d=r.padding,h=e.node().getBBox(),p={fill:r.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,v=h.height+2*d;return n.attr({d:"M"+[[s,-v/2],[s,-v/4],[r.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-v/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c):void 0},c.hide=function(){return t?(t.style({display:"none"}),c):void 0},c.show=function(){return t?(t.style({display:"block"}),c):void 0},c.config=function(t){return i(r,t),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=i({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var r=o.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var a=r.indexOf(t.geometry);-1!=a&&(n.data[e].groupId=a)})}if(t.layout){var l=i({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};a.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../plotly":113,"./micropolar_manager":140,d3:9}],140:[function(t,e,n){"use strict";var r=t("../../plotly"),a=t("d3"),o=t("./undo_manager"),i=e.exports={},l=r.Lib.extendDeepAll;i.framework=function(t){function e(e,o){return o&&(f=o),a.select(a.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?l(n,e):e,c||(c=r.micropolar.Axis()),u=r.micropolar.adapter.plotly().convert(n),c.config(u).render(f),t.data=n.data,t.layout=n.layout,i.fillLayout(t),n}var n,s,c,u,f,d=new o;return e.isPolar=!0,e.svg=function(){return c.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return r.micropolar.adapter.plotly().convert(c.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:c.angularScale(),r:c.radialScale()}},e.setUndoPoint=function(){var t=this,e=r.micropolar.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,s),s=r.micropolar.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},i.fillLayout=function(t){var e=a.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:r.Color.background,_container:e,_paperdiv:n,_paper:o};t._fullLayout=l(i,t.layout)}},{"../../plotly":113,"./undo_manager":141,d3:9}],141:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r-1}var o=t("../plotly"),i=o.Lib.extendFlat,l=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,s=t.data,c=t.layout,u=l([],s),f=l({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;ns;s++)r(n[s])&&h.push({p:n[s],s:l[s],b:0});return o(e,"marker")&&i(e,e.marker.color,"marker","c"),o(e,"marker.line")&&i(e,e.marker.line.color,"marker.line","c"),h}},{"../../components/colorscale/calc":25,"../../components/colorscale/has_colorscale":31,"../../plots/cartesian/axes":116,"fast-isnumeric":11}],152:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("../scatter/xy_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=o(t,e,u);return f?(u("orientation",e.x&&!e.y?"h":"v"),u("text"),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),void l(t,e,a.defaultLine,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/color":18,"../../components/errorbars/defaults":46,"../../lib":95,"../bar/style_defaults":160,"../scatter/xy_defaults":194,"./attributes":150}],153:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/graph_interact"),a=t("../../components/errorbars"),o=t("../../components/color");e.exports=function(t,e,n,i){var l,s=t.cd,c=s[0].trace,u=s[0].t,f=t.xa,d=t.ya,h="closest"===i?u.barwidth/2:u.dbar*(1-f._gd._fullLayout.bargap)/2;l="closest"!==i?function(t){return t.p}:"h"===c.orientation?function(t){return t.y}:function(t){return t.x};var p,g;"h"===c.orientation?(p=function(t){return r.inbox(t.b-e,t.x-e)+(t.x-e)/(t.x-t.b)},g=function(t){var e=l(t)-n;return r.inbox(e-h,e+h)}):(g=function(t){return r.inbox(t.b-n,t.y-n)+(t.y-n)/(t.y-t.b)},p=function(t){var n=l(t)-e;return r.inbox(n-h,n+h)});var v=r.getDistanceFunction(i,p,g);if(r.getClosest(s,v,t),t.index!==!1){var m=s[t.index],y=m.mcc||c.marker.color,x=m.mlcc||c.marker.line.color,b=m.mlw||c.marker.line.width;return o.opacity(y)?t.color=y:o.opacity(x)&&b&&(t.color=x),"h"===c.orientation?(t.x0=t.x1=f.c2p(m.x,!0),t.xLabelVal=m.s,t.y0=d.c2p(l(m)-h,!0),t.y1=d.c2p(l(m)+h,!0),t.yLabelVal=m.p):(t.y0=t.y1=d.c2p(m.y,!0),t.yLabelVal=m.s,t.x0=f.c2p(l(m)-h,!0),t.x1=f.c2p(l(m)+h,!0),t.xLabelVal=m.p),m.tx&&(t.text=m.tx),a.hoverInfo(m,c,t),[t]}}},{"../../components/color":18,"../../components/errorbars":47,"../../plots/cartesian/graph_interact":123}],154:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("./layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.calc=t("./calc"),r.setPositions=t("./set_positions"),r.colorbar=t("../scatter/colorbar"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.moduleType="trace",r.name="bar",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","oriented","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":124,"../scatter/colorbar":176,"./arrays_to_calcdata":149,"./attributes":150,"./calc":151,"./defaults":152,"./hover":153,"./layout_attributes":155,"./layout_defaults":156,"./plot":157,"./set_positions":158,"./style":159}],155:[function(t,e,n){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:""},bargap:{valType:"number",min:0,max:1},bargroupgap:{valType:"number",min:0,max:1,dflt:0}}},{}],156:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,n){function l(n,r){return o.coerce(t,e,i,n,r)}for(var s=!1,c=!1,u=!1,f={},d=0;d=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var d,h,p,g;if("h"===l.orientation?(p=u.c2p(n.poffset+e.p,!0),g=u.c2p(n.poffset+e.p+n.barwidth,!0),d=c.c2p(e.b,!0),h=c.c2p(e.s+e.b,!0)):(d=c.c2p(n.poffset+e.p,!0),h=c.c2p(n.poffset+e.p+n.barwidth,!0),g=u.c2p(e.s+e.b,!0),p=u.c2p(e.b,!0)),!(a(d)&&a(h)&&a(p)&&a(g)&&d!==h&&p!==g))return void r.select(this).remove();var v=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,m=r.round(v/2%1,2);if(!t._context.staticPlot){var y=i.opacity(e.mc||l.marker.color),x=1>y||v>.01?o:s;d=x(d,h),h=x(h,d),p=x(p,g),g=x(g,p)}r.select(this).attr("d","M"+d+","+p+"V"+g+"H"+h+"V"+p+"Z")})}),d.call(l.plot,e)}},{"../../components/color":18,"../../components/errorbars":47,"../../lib":95,"./arrays_to_calcdata":149,d3:9,"fast-isnumeric":11}],158:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/plots"),o=t("../../plots/cartesian/axes"),i=t("../../lib");e.exports=function(t,e){var n,l,s=t._fullLayout,c=e.x(),u=e.y();["v","h"].forEach(function(f){function d(e){function n(t){t[p]=t.p+d}var r=[];e.forEach(function(e){t.calcdata[e].forEach(function(t){r.push(t.p)})});var a=i.distinctVals(r),l=a.vals,c=a.minDiff,u=!1,f=[];"group"===s.barmode&&e.forEach(function(e){u||(t.calcdata[e].forEach(function(t){u||f.forEach(function(e){Math.abs(t.p-e)_&&(S=!0,A=_),_>M+P&&(S=!0,M=_))}o.expand(m,[A,M],{tozero:!0,padded:S})}else{var N=function(t){return t[g]=t.s,t.s};for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=(e._input||{}).marker||{},s=o.tryColorscale(n,l,""),c=o.tryColorscale(n,l,"line.");r.select(this).selectAll("path").each(function(t){var e,o,l=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=s(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",l+"px").call(a.fill,e),l&&(o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":18,"../../components/drawing":41,"../../components/errorbars":47,d3:9}],160:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":18,"../../components/colorscale/defaults":28,"../../components/colorscale/has_colorscale":31}],161:[function(t,e,n){"use strict";var r=t("../../components/color/attributes"),a=t("../../plots/font_attributes"),o=t("../../plots/attributes"),i=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array"},line:{color:{valType:"color",dflt:r.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:i({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:i({},a,{}),insidetextfont:i({},a,{}),outsidetextfont:i({},a,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":17,"../../lib/extend":94,"../../plots/attributes":114,"../../plots/font_attributes":134}],162:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;rs||(c=p[n],void 0!==c&&""!==c||(c=n),c=String(c),void 0===y[c]&&(y[c]=!0,u=o(e.marker.colors[n]),u.isValid()?(u=i.addOpacity(u,u.getAlpha()),m[c]||(m[c]=u)):m[c]?u=m[c]:(u=!1,x=!0),f=-1!==_.indexOf(c),f||(b+=s),g.push({v:s,label:c,color:u,i:n,hidden:f}))));if(e.sort&&g.sort(function(t,e){return e.v-t.v}),x)for(n=0;n")}return g};var s},{"../../components/color":18,"./helpers":165,"fast-isnumeric":11,tinycolor2:13}],164:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,v=g||"inside"===p,m=g||"outside"===p;if(v||m){var y=l(i,"textfont",o.font);v&&l(i,"insidetextfont",y),m&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":95,"./attributes":161}],165:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return-1!==n.lastIndexOf(".")&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return-1!==n.lastIndexOf(".")&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":95}],166:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":161,"./base_plot":162,"./calc":163,"./defaults":164,"./layout_attributes":167,"./layout_defaults":168,"./plot":169,"./style":170,"./style_one":171}],167:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],168:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":95,"./layout_attributes":167}],169:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),v={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},m=v.scale>d.scale?v:d;return c.scale<1&&m.scale>c.scale?m:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return 0>n&&(a*=-1),0>r&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),v=i?t.yLabelMin:t.yLabelMax,m=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-v;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-v-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(m+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,v,m;for(i=0;2>i;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;2>o;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),v=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&-1===h.indexOf(l.scalegroup)&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round","class":"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],v=c.trace,m=0,y=(v.depth||0)*c.r*Math.sin(m)/2,x=v.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(m),k=l.selectAll("g.part").data(v.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],m=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[v.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];-1!==l.indexOf("label")&&p.push(i.label),o.text&&o.text[i.i]&&-1!==l.indexOf("text")&&p.push(o.text[i.i]),-1!==l.indexOf("value")&&p.push(g.formatPieValue(i.v,h)),-1!==l.indexOf("percent")&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:-1!==l.indexOf("name")?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),v.pull){var z=+(Array.isArray(v.pull)?v.pull[i.i]:v.pull)||0;z>0&&(k+=z*i.pxmid[0],M+=z*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var S=v.hole;if(i.v===c.vTotal){var C="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";S?T.attr("d","M"+(k+S*i.px0[0])+","+(M+S*i.px0[1])+b(i.px0,i.pxmid,!1,S)+b(i.pxmid,i.px0,!1,S)+"Z"+C):T.attr("d",C)}else{var E=b(i.px0,i.px1,!0,1);if(S){var O=1-S;T.attr("d","M"+(k+S*i.px1[0])+","+(M+S*i.px1[1])+b(i.px1,i.px0,!1,S)+"l"+O*i.px0[0]+","+O*i.px0[1]+E+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+E+"Z")}var P=Array.isArray(v.textposition)?v.textposition[i.i]:v.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==P?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===P?v.outsidetextfont:v.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===P?e=o(n,i):(e=r(n,i,c),"auto"===P&&e.scale<1&&(t.call(h.font,v.outsidetextfont),v.outsidetextfont.family===v.insidetextfont.family&&v.outsidetextfont.size===v.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,m=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),m&&i(s,v),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,v.outsidetextfont.color).attr({"stroke-width":Math.min(2,v.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":18,"../../components/drawing":41,"../../lib/svg_text_utils":106,"../../plots/cartesian/graph_interact":123,"./helpers":165,d3:9}],170:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":171,d3:9}],171:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":18}],172:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":95}],173:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{ valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:a.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":26,"../../components/drawing":41,"../../lib/extend":94,"./constants":178}],174:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},v={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var m={type:"linear"};a.setConvert(m),s=m.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=v.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,a.expand(u,d,g),a.expand(f,h,v);var b=new Array(p);for(c=0;p>c;c++)b[c]=r(d[c])&&r(h[c])?{x:d[c],y:h[c]}:{x:!1,y:!1};return void 0!==typeof s&&o.mergeArray(s,b,"ms"),t.firstscatter=!1,b}},{"../../lib":95,"../../plots/cartesian/axes":116,"./colorscale_calc":177,"./subtypes":192,"fast-isnumeric":11}],175:[function(t,e,n){"use strict";e.exports=function(t){var e,n,r,a,o;for(e=0;e=0;a--)if(o=t[a],"scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}},{}],176:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,c=n.marker,u="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===c||!c.showscale)return void i.autoMargin(t,u);var f=l(c.colorscale),d=c.color,h=c.cmin,p=c.cmax;a(h)||(h=o.aggNums(Math.min,null,d)),a(p)||(p=o.aggNums(Math.max,null,d));var g=e[0].t.cb=s(t,u);g.fillcolor(r.scale.linear().domain(f.map(function(t){return h+t[0]*(p-h)})).range(f.map(function(t){return t[1]}))).filllevels({start:h,end:p,size:(p-h)/254}).options(c.colorbar)()}},{"../../components/colorbar/draw":21,"../../components/colorscale/get_scale":30,"../../lib":95,"../../plots/plots":136,d3:9,"fast-isnumeric":11}],177:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":25,"../../components/colorscale/has_colorscale":31,"./subtypes":192}],178:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],179:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var v=l(t,e,g),m=vB!=P>=B&&(C=z[T-1][0],E=z[T][0],S=C+(E-C)*(B-O)/(P-O),R=Math.min(R,S),j=Math.max(j,S));R=Math.max(R,0),j=Math.min(j,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:j,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":18,"../../components/errorbars":47,"../../lib":95,"../../plots/cartesian/constants":121,"../../plots/cartesian/graph_interact":123,"./get_trace_color":181}],183:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":124,"./arrays_to_calcdata":172,"./attributes":173,"./calc":174,"./clean_data":175,"./colorbar":176,"./defaults":179,"./hover":182,"./plot":189,"./select":190,"./style":191,"./subtypes":192}],184:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=(Array.isArray(l)?!1:l)||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":28,"../../components/colorscale/has_colorscale":31}],185:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=k.c2p(t[e].y);return n===z||r===z?!1:[n,r]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],z=r.BADNUM,S=.2,C=new Array(t.length),E=0;for(i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,c=f,h=!1):m>y&&(m=y,u=f,h=!0)}if(h?(C[E++]=c,s!==u&&(C[E++]=u)):(u!==l&&(C[E++]=u),s!==c&&(C[E++]=c)),C[E++]=s,i>=t.length||!f)break;C[E++]=f,l=f}}else C[E++]=c}L.push(C.slice(0,E))}return L}},{"../../plots/cartesian/axes":116}],186:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],187:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t){var e=t.marker,n=e.sizeref||1,a=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/n)}:function(t){return t/n};return function(t){var e=o(t/2);return r(e)&&e>0?Math.max(e,a):0}}},{"fast-isnumeric":11}],188:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":18,"../../components/colorscale/defaults":28,"../../components/colorscale/has_colorscale":31,"./subtypes":192}],189:[function(t,e,n){"use strict";function r(t,e,n){var r=e.x(),o=e.y(),i=a.extent(r.range.map(r.l2c)),l=a.extent(o.range.map(o.l2c));n.forEach(function(t,e){var r=t[0].trace;if(c.hasMarkers(r)){var a=r.marker.maxdisplayed;if(0!==a){var o=t.filter(function(t){return t.x>=i[0]&&t.x<=i[1]&&t.y>=l[0]&&t.y<=l[1]}),s=Math.ceil(o.length/a),u=0;n.forEach(function(t,n){var r=t[0].trace;c.hasMarkers(r)&&r.marker.maxdisplayed>0&&e>n&&u++});var f=Math.round(u*s/3+Math.floor(u/3)*s/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+f)%s)&&(t.vis=!0)})}}})}var a=t("d3"),o=t("../../lib"),i=t("../../components/drawing"),l=t("../../components/errorbars"),s=t("../../lib/polygon").tester,c=t("./subtypes"),u=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,n){function d(t){return t.filter(function(t){return t.vis})}r(t,e,n);var h=e.x(),p=e.y(),g=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(n);g.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),g.call(l.plot,e);var v,m,y,x,b="",_=[];g.each(function(t){var e=t[0].trace,n=e.line,r=a.select(this);if(e.visible===!0&&(m=e.fill.charAt(e.fill.length-1),"x"!==m&&"y"!==m&&(m=""),t[0].node3=r,u(t),c.hasLines(e)||"none"!==e.fill)){var o,l,d,g,w,k="",M="";v="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!b?r.append("path").classed("js-fill",!0):null,x&&(y=x.datum(t)),x=r.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(n.shape)?(d=i.steps(n.shape),g=i.steps(n.shape.split("").reverse().join(""))):d=g="spline"===n.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?i.smoothclosed(t.slice(1),n.smoothing):i.smoothopen(t,n.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return g(t.reverse())};var A,T=f(t,{xaxis:h,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(n.width||1,3)/4,linear:"linear"===n.shape}),L=e._polygons=new Array(T.length);for(A=0;A1&&r.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}v?z&&C&&(m?("y"===m?z[1]=C[1]=p.c2p(0,!0):"x"===m&&(z[0]=C[0]=h.c2p(0,!0)),v.attr("d",k+"L"+C+"L"+z+"Z")):v.attr("d",k+"Z")):"tonext"===e.fill.substr(0,6)&&k&&b&&("tonext"===e.fill?y.attr("d",k+"Z"+b+"Z"):y.attr("d",k+"L"+b.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),b=M,_=L}}}),g.selectAll("path:not([d])").remove(),g.append("g").attr("class","points").each(function(t){var e=t[0].trace,n=a.select(this),r=c.hasMarkers(e),l=c.hasText(e);!r&&!l||e.visible!==!0?n.remove():(r&&n.selectAll("path.point").data(e.marker.maxdisplayed?d:o.identity).enter().append("path").classed("point",!0).call(i.translatePoints,h,p),l&&n.selectAll("g").data(e.marker.maxdisplayed?d:o.identity).enter().append("g").append("text").call(i.translatePoints,h,p))})}},{"../../components/drawing":41,"../../components/errorbars":47,"../../lib":95,"../../lib/polygon":101,"./arrays_to_calcdata":172,"./line_points":185,"./subtypes":192,d3:9}],190:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;n=r&&c.x<=o&&c.y>=a&&c.y<=i?[[r,i],[o,i],[o,a],[r,a]]:[];u.point=t[l]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Fi)*Fi,y:Math.round(i(t,e)/Fi)*Fi,i:e}})}var r=En,a=On,o=r,i=a,l=hs;return t?e(t):(e.links=function(t){return cr(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cr(n(t)).cells.forEach(function(n,r){for(var a,o,i=n.site,l=n.edges.sort(Xn),s=-1,c=l.length,u=l[c-1].edge,f=u.l===i?u.r:u.l;++s=c,d=r>=u,h=d<<1|f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=pr()),f?a=c:l=c,d?i=u:s=u,o(t,e,n,r,a,i,l,s)}var u,f,d,h,p,g,m,v,y,x=zt(l),b=zt(s);if(null!=e)g=e,m=n,v=r,y=a;else if(v=y=-(g=m=1/0),f=[],d=[],p=t.length,i)for(h=0;p>h;++h)u=t[h],u.xv&&(v=u.x),u.y>y&&(y=u.y),f.push(u.x),d.push(u.y);else for(h=0;p>h;++h){var _=+x(u=t[h],h),w=+b(u,h);g>_&&(g=_),m>w&&(m=w),_>v&&(v=_),w>y&&(y=w),f.push(_),d.push(w)}var k=v-g,M=y-m;k>M?y=m+k:v=g+M;var A=pr();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,m,v,y)},A.visit=function(t){gr(t,A,g,m,v,y)},A.find=function(t){return mr(A,t[0],t[1],g,m,v,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=vs.get(n)||ms,r=ys.get(r)||b,kr(r(n.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=Ir,ui.interpolateHsl=Rr,ui.interpolateLab=jr,ui.interpolateRound=Fr,ui.transform=function(t){var e=hi.createElementNS(ui.ns.prefix.svg,"g");return(ui.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new qr(n?n.matrix:xs)})(t)},qr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var xs={a:1,b:0,c:0,d:1,e:0,f:0};ui.interpolateTransform=$r,ui.layout={},ui.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++nl*l/v){if(g>s){var c=e.charge/s;t.px-=o*c,t.py-=i*c}return!0}if(e.point&&s&&g>s){var c=e.pointCharge/s;t.px-=o*c,t.py-=i*c}}return!e.charge}}function e(t){t.px=ui.event.x,t.py=ui.event.y,s.resume()}var n,r,a,o,i,l,s={},c=ui.dispatch("start","tick","end"),u=[1,1],f=.9,d=bs,h=_s,p=-30,g=ws,m=.1,v=.64,y=[],x=[];return s.tick=function(){if((a*=.99)<.005)return n=null,c.end({type:"end",alpha:a=0}),!0;var e,r,s,d,h,g,v,b,_,w=y.length,k=x.length;for(r=0;k>r;++r)s=x[r],d=s.source,h=s.target,b=h.x-d.x,_=h.y-d.y,(g=b*b+_*_)&&(g=a*i[r]*((g=Math.sqrt(g))-o[r])/g,b*=g,_*=g,h.x-=b*(v=d.weight+h.weight?d.weight/(d.weight+h.weight):.5),h.y-=_*v,d.x+=b*(v=1-v),d.y+=_*v);if((v=a*m)&&(b=u[0]/2,_=u[1]/2,r=-1,v))for(;++r0?a=t:(n.c=null,n.t=NaN,n=null,c.end({type:"end",alpha:a=0})):t>0&&(c.start({type:"start",alpha:a=t}),n=Pt(s.tick)),s):a},s.start=function(){function t(t,r){if(!n){for(n=new Array(a),s=0;a>s;++s)n[s]=[];for(s=0;c>s;++s){var o=x[s];n[o.source.index].push(o.target),n[o.target.index].push(o.source)}}for(var i,l=n[e],s=-1,u=l.length;++se;++e)(r=y[e]).index=e,r.weight=0;for(e=0;c>e;++e)r=x[e],"number"==typeof r.source&&(r.source=y[r.source]),"number"==typeof r.target&&(r.target=y[r.target]),++r.source.weight,++r.target.weight;for(e=0;a>e;++e)r=y[e],isNaN(r.x)&&(r.x=t("x",f)),isNaN(r.y)&&(r.y=t("y",g)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(o=[],"function"==typeof d)for(e=0;c>e;++e)o[e]=+d.call(this,x[e],e);else for(e=0;c>e;++e)o[e]=d;if(i=[],"function"==typeof h)for(e=0;c>e;++e)i[e]=+h.call(this,x[e],e);else for(e=0;c>e;++e)i[e]=h;if(l=[],"function"==typeof p)for(e=0;a>e;++e)l[e]=+p.call(this,y[e],e);else for(e=0;a>e;++e)l[e]=p;return s.resume()},s.resume=function(){return s.alpha(.1)},s.stop=function(){return s.alpha(0)},s.drag=function(){return r||(r=ui.behavior.drag().origin(b).on("dragstart.force",ea).on("drag.force",e).on("dragend.force",na)),arguments.length?void this.on("mouseover.force",ra).on("mouseout.force",aa).call(r):r},ui.rebind(s,c,"on")};var bs=20,_s=1,ws=1/0;ui.layout.hierarchy=function(){function t(a){var o,i=[a],l=[];for(a.depth=0;null!=(o=i.pop());)if(l.push(o),(c=n.call(t,o,o.depth))&&(s=c.length)){for(var s,c,u;--s>=0;)i.push(u=c[s]),u.parent=o,u.depth=o.depth+1;r&&(o.value=0),o.children=c}else r&&(o.value=+r.call(t,o,o.depth)||0),delete o.children;return sa(a,function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)}),l}var e=fa,n=ca,r=ua;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(la(e,function(t){t.children&&(t.value=0)}),sa(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},ui.layout.partition=function(){function t(e,n,r,a){var o=e.children;if(e.x=n,e.y=e.depth*a,e.dx=r,e.dy=a,o&&(i=o.length)){var i,l,s,c=-1;for(r=e.value?r/e.value:0;++cf?-1:1),p=ui.sum(c),g=p?(f-s*h)/p:0,m=ui.range(s),v=[];return null!=n&&m.sort(n===ks?function(t,e){return c[e]-c[t]}:function(t,e){return n(i[t],i[e])}),m.forEach(function(t){v[t]={data:i[t],value:l=c[t],startAngle:u,endAngle:u+=l*g+h,padAngle:d}}),v}var e=Number,n=ks,r=0,a=Hi,o=0;return t.value=function(n){return arguments.length?(e=n,t):e},t.sort=function(e){return arguments.length?(n=e,t):n},t.startAngle=function(e){return arguments.length?(r=e,t):r},t.endAngle=function(e){return arguments.length?(a=e,t):a},t.padAngle=function(e){return arguments.length?(o=e,t):o},t};var ks={};ui.layout.stack=function(){function t(l,s){if(!(d=l.length))return l;var c=l.map(function(n,r){return e.call(t,n,r)}),u=c.map(function(e){return e.map(function(e,n){return[o.call(t,e,n),i.call(t,e,n)]})}),f=n.call(t,u,s);c=ui.permute(c,f),u=ui.permute(u,f);var d,h,p,g,m=r.call(t,u,s),v=c[0].length;for(p=0;v>p;++p)for(a.call(t,c[0][p],g=m[p],u[0][p][1]),h=1;d>h;++h)a.call(t,c[h][p],g+=u[h-1][p][1],u[h][p][1]);return l}var e=b,n=ma,r=va,a=ga,o=ha,i=pa;return t.values=function(n){return arguments.length?(e=n,t):e},t.order=function(e){return arguments.length?(n="function"==typeof e?e:Ms.get(e)||ma,t):n},t.offset=function(e){return arguments.length?(r="function"==typeof e?e:As.get(e)||va,t):r},t.x=function(e){return arguments.length?(o=e,t):o},t.y=function(e){return arguments.length?(i=e,t):i},t.out=function(e){return arguments.length?(a=e,t):a},t};var Ms=ui.map({"inside-out":function(t){var e,n,r=t.length,a=t.map(ya),o=t.map(xa),i=ui.range(r).sort(function(t,e){return a[t]-a[e]}),l=0,s=0,c=[],u=[];for(e=0;r>e;++e)n=i[e],s>l?(l+=o[n],c.push(n)):(s+=o[n],u.push(n));return u.reverse().concat(c)},reverse:function(t){return ui.range(t.length).reverse()},"default":ma}),As=ui.map({silhouette:function(t){var e,n,r,a=t.length,o=t[0].length,i=[],l=0,s=[];for(n=0;o>n;++n){for(e=0,r=0;a>e;e++)r+=t[e][n][1];r>l&&(l=r),i.push(r)}for(n=0;o>n;++n)s[n]=(l-i[n])/2;return s},wiggle:function(t){var e,n,r,a,o,i,l,s,c,u=t.length,f=t[0],d=f.length,h=[];for(h[0]=s=c=0,n=1;d>n;++n){for(e=0,a=0;u>e;++e)a+=t[e][n][1];for(e=0,o=0,l=f[n][0]-f[n-1][0];u>e;++e){for(r=0,i=(t[e][n][1]-t[e][n-1][1])/(2*l);e>r;++r)i+=(t[r][n][1]-t[r][n-1][1])/l;o+=i*t[e][n][1]}h[n]=s-=a?o/a*l:0,c>s&&(c=s)}for(n=0;d>n;++n)h[n]-=c;return h},expand:function(t){var e,n,r,a=t.length,o=t[0].length,i=1/a,l=[];for(n=0;o>n;++n){for(e=0,r=0;a>e;e++)r+=t[e][n][1];if(r)for(e=0;a>e;e++)t[e][n][1]/=r;else for(e=0;a>e;e++)t[e][n][1]=i}for(n=0;o>n;++n)l[n]=0;return l},zero:va});ui.layout.histogram=function(){function t(t,o){for(var i,l,s=[],c=t.map(n,this),u=r.call(this,c,o),f=a.call(this,u,c,o),o=-1,d=c.length,h=f.length-1,p=e?1:1/d;++o0)for(o=-1;++o=u[0]&&l<=u[1]&&(i=s[ui.bisect(f,l,1,h)-1],i.y+=p,i.push(t[o]));return s}var e=!0,n=Number,r=ka,a=_a;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=zt(e),t):r},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:zt(e),t):a},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},ui.layout.pack=function(){function t(t,o){var i=n.call(this,t,o),l=i[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,sa(l,function(t){t.r=+u(t.value)}),sa(l,za),r){var f=r*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;sa(l,function(t){t.r+=f}),sa(l,za),sa(l,function(t){t.r-=f})}return Ea(l,s/2,c/2,e?1:1/Math.max(2*l.r/s,2*l.r/c)),i}var e,n=ui.layout.hierarchy().sort(Ma),r=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ia(t,n)},ui.layout.tree=function(){function t(t,a){var u=i.call(this,t,a),f=u[0],d=e(f);if(sa(d,n),d.parent.m=-d.z,la(d,r),c)la(f,o);else{var h=f,p=f,g=f;la(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=l(h,p)/2-h.x,v=s[0]/(p.x+l(p,h)/2+m),y=s[1]/(g.depth||1);la(f,function(t){t.x=(t.x+m)*v,t.y=t.depth*y})}return u}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var a,o=e.children,i=0,l=o.length;l>i;++i)r.push((o[i]=a={_:o[i],parent:e,children:(a=o[i].children)&&a.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:i}).a=a);return n.children[0]}function n(t){var e=t.children,n=t.parent.children,r=t.i?n[t.i-1]:null;if(e.length){Ra(t);var o=(e[0].z+e[e.length-1].z)/2;r?(t.z=r.z+l(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+l(t._,r._));t.parent.A=a(t,r,t.parent.A||n[0])}function r(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function a(t,e,n){if(e){for(var r,a=t,o=t,i=e,s=a.parent.children[0],c=a.m,u=o.m,f=i.m,d=s.m;i=Da(i),a=Na(a),i&&a;)s=Na(s),o=Da(o),o.a=t,r=i.z+f-a.z-c+l(i._,a._),r>0&&(Ia(ja(i,t,n),t,r),c+=r,u+=r),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Da(o)&&(o.t=i,o.m+=f-u),a&&!Na(s)&&(s.t=a,s.m+=c-d,n=t)}return n}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var i=ui.layout.hierarchy().sort(null).value(null),l=Pa,s=[1,1],c=null;return t.separation=function(e){return arguments.length?(l=e,t):l},t.size=function(e){return arguments.length?(c=null==(s=e)?o:null,t):c?null:s},t.nodeSize=function(e){return arguments.length?(c=null==(s=e)?null:o,t):c?s:null},ia(t,i)},ui.layout.cluster=function(){function t(t,o){var i,l=e.call(this,t,o),s=l[0],c=0;sa(s,function(t){var e=t.children;e&&e.length?(t.x=qa(e),t.y=Fa(e)):(t.x=i?c+=n(t,i):0,t.y=0,i=t)});var u=Ba(s),f=Ha(s),d=u.x-n(u,f)/2,h=f.x+n(f,u)/2;return sa(s,a?function(t){t.x=(t.x-s.x)*r[0],t.y=(s.y-t.y)*r[1]}:function(t){t.x=(t.x-d)/(h-d)*r[0],t.y=(1-(s.y?t.y/s.y:1))*r[1]}),l}var e=ui.layout.hierarchy().sort(null).value(null),n=Pa,r=[1,1],a=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(a=null==(r=e),t):a?null:r},t.nodeSize=function(e){return arguments.length?(a=null!=(r=e),t):a?r:null},ia(t,e)},ui.layout.treemap=function(){function t(t,e){for(var n,r,a=-1,o=t.length;++ae?0:e),n.area=isNaN(r)||0>=r?0:r}function e(n){var o=n.children;if(o&&o.length){var i,l,s,c=f(n),u=[],d=o.slice(),p=1/0,g="slice"===h?c.dx:"dice"===h?c.dy:"slice-dice"===h?1&n.depth?c.dy:c.dx:Math.min(c.dx,c.dy);for(t(d,c.dx*c.dy/n.value),u.area=0;(s=d.length)>0;)u.push(i=d[s-1]),u.area+=i.area,"squarify"!==h||(l=r(u,g))<=p?(d.pop(),p=l):(u.area-=u.pop().area,a(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(a(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,i=f(e),l=r.slice(),s=[];for(t(l,i.dx*i.dy/e.value),s.area=0;o=l.pop();)s.push(o),s.area+=o.area,null!=o.z&&(a(s,o.z?i.dx:i.dy,i,!l.length),s.length=s.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,a=0,o=1/0,i=-1,l=t.length;++in&&(o=n),n>a&&(a=n));return r*=r,e*=e,r?Math.max(e*a*p/r,r/(e*o*p)):1/0}function a(t,e,n,r){var a,o=-1,i=t.length,l=n.x,c=n.y,u=e?s(t.area/e):0;if(e==n.dx){for((r||u>n.dy)&&(u=n.dy);++on.dx)&&(u=n.dx);++on&&(e=1),1>n&&(t=0),function(){var n,r,a;do n=2*Math.random()-1,r=2*Math.random()-1,a=n*n+r*r;while(!a||a>1);return t+e*n*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=ui.random.normal.apply(ui,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ui.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;t>n;n++)e+=Math.random();return e}}},ui.scale={};var Ts={floor:b,ceil:b};ui.scale.linear=function(){return Wa([0,1],[0,1],_r,!1)};var Ls={s:1,g:1,p:1,r:1,e:1};ui.scale.log=function(){return oo(ui.scale.linear().domain([0,1]),10,!0,[1,10])};var zs=ui.format(".0e"),Ss={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};ui.scale.pow=function(){return io(ui.scale.linear(),1,[0,1])},ui.scale.sqrt=function(){return ui.scale.pow().exponent(.5)},ui.scale.ordinal=function(){return so([],{t:"range",a:[[]]})},ui.scale.category10=function(){return ui.scale.ordinal().range(Cs)},ui.scale.category20=function(){return ui.scale.ordinal().range(Es)},ui.scale.category20b=function(){return ui.scale.ordinal().range(Os)},ui.scale.category20c=function(){return ui.scale.ordinal().range(Ps)};var Cs=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(_t),Es=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(_t),Os=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(_t),Ps=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(_t);ui.scale.quantile=function(){return co([],[])},ui.scale.quantize=function(){return uo(0,1,[0,1])},ui.scale.threshold=function(){return fo([.5],[0,1])},ui.scale.identity=function(){return ho([0,1])},ui.svg={},ui.svg.arc=function(){function t(){var t=Math.max(0,+n.apply(this,arguments)),c=Math.max(0,+r.apply(this,arguments)),u=i.apply(this,arguments)-Zi,f=l.apply(this,arguments)-Zi,d=Math.abs(f-u),h=u>f?0:1;if(t>c&&(p=c,c=t,t=p),d>=Vi)return e(c,h)+(t?e(t,1-h):"")+"Z";var p,g,m,v,y,x,b,_,w,k,M,A,T=0,L=0,z=[];if((v=(+s.apply(this,arguments)||0)/2)&&(m=o===Ns?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=rt(m/c*Math.sin(v))),t&&(T=rt(m/t*Math.sin(v)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var S=Math.abs(f-u-2*L)<=Bi?0:1;if(L&&bo(y,x,b,_)===h^S){var C=(u+f)/2;y=c*Math.cos(C),x=c*Math.sin(C),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),k=t*Math.sin(f-T),M=t*Math.cos(u+T),A=t*Math.sin(u+T);var E=Math.abs(u-f+2*T)<=Bi?0:1;if(T&&bo(w,k,M,A)===1-h^E){var O=(u+f)/2;w=t*Math.cos(O),k=t*Math.sin(O),M=A=null}}else w=k=0;if(d>Fi&&(p=Math.min(Math.abs(c-t)/2,+a.apply(this,arguments)))>.001){g=c>t^h?0:1;var P=p,N=p;if(Bi>d){var D=null==M?[w,k]:null==b?[y,x]:In([y,x],[M,A],[b,_],[w,k]),I=y-D[0],R=x-D[1],j=b-D[0],F=_-D[1],q=1/Math.sin(Math.acos((I*j+R*F)/(Math.sqrt(I*I+R*R)*Math.sqrt(j*j+F*F)))/2),B=Math.sqrt(D[0]*D[0]+D[1]*D[1]);N=Math.min(p,(t-B)/(q-1)),P=Math.min(p,(c-B)/(q+1))}if(null!=b){var H=_o(null==M?[w,k]:[M,A],[y,x],c,P,h),V=_o([b,_],[w,k],c,P,h);p===P?z.push("M",H[0],"A",P,",",P," 0 0,",g," ",H[1],"A",c,",",c," 0 ",1-h^bo(H[1][0],H[1][1],V[1][0],V[1][1]),",",h," ",V[1],"A",P,",",P," 0 0,",g," ",V[0]):z.push("M",H[0],"A",P,",",P," 0 1,",g," ",V[0])}else z.push("M",y,",",x);if(null!=M){var Z=_o([y,x],[M,A],t,-N,h),U=_o([w,k],null==b?[y,x]:[b,_],t,-N,h);p===N?z.push("L",U[0],"A",N,",",N," 0 0,",g," ",U[1],"A",t,",",t," 0 ",h^bo(U[1][0],U[1][1],Z[1][0],Z[1][1]),",",1-h," ",Z[1],"A",N,",",N," 0 0,",g," ",Z[0]):z.push("L",U[0],"A",N,",",N," 0 0,",g," ",Z[0])}else z.push("L",w,",",k)}else z.push("M",y,",",x),null!=b&&z.push("A",c,",",c," 0 ",S,",",h," ",b,",",_),z.push("L",w,",",k),null!=M&&z.push("A",t,",",t," 0 ",E,",",1-h," ",M,",",A);return z.push("Z"),z.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var n=go,r=mo,a=po,o=Ns,i=vo,l=yo,s=xo;return t.innerRadius=function(e){return arguments.length?(n=zt(e),t):n},t.outerRadius=function(e){return arguments.length?(r=zt(e),t):r},t.cornerRadius=function(e){return arguments.length?(a=zt(e),t):a},t.padRadius=function(e){return arguments.length?(o=e==Ns?Ns:zt(e),t):o},t.startAngle=function(e){return arguments.length?(i=zt(e),t):i},t.endAngle=function(e){return arguments.length?(l=zt(e),t):l},t.padAngle=function(e){return arguments.length?(s=zt(e),t):s},t.centroid=function(){var t=(+n.apply(this,arguments)+ +r.apply(this,arguments))/2,e=(+i.apply(this,arguments)+ +l.apply(this,arguments))/2-Zi;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Ns="auto";ui.svg.line=function(){return wo(b)};var Ds=ui.map({linear:ko,"linear-closed":Mo,step:Ao,"step-before":To,"step-after":Lo,basis:Po,"basis-open":No,"basis-closed":Do,bundle:Io,cardinal:Co,"cardinal-open":zo,"cardinal-closed":So,monotone:Ho});Ds.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var Is=[0,2/3,1/3,0],Rs=[0,1/3,2/3,0],js=[0,1/6,2/3,1/6];ui.svg.line.radial=function(){var t=wo(Vo);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},To.reverse=Lo,Lo.reverse=To,ui.svg.area=function(){return Zo(b)},ui.svg.area.radial=function(){var t=Zo(Vo);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},ui.svg.chord=function(){function t(t,l){var s=e(this,o,t,l),c=e(this,i,t,l);return"M"+s.p0+r(s.r,s.p1,s.a1-s.a0)+(n(s,c)?a(s.r,s.p1,s.r,s.p0):a(s.r,s.p1,c.r,c.p0)+r(c.r,c.p1,c.a1-c.a0)+a(c.r,c.p1,s.r,s.p0))+"Z"}function e(t,e,n,r){var a=e.call(t,n,r),o=l.call(t,a,r),i=s.call(t,a,r)-Zi,u=c.call(t,a,r)-Zi;return{r:o,a0:i,a1:u,p0:[o*Math.cos(i),o*Math.sin(i)],p1:[o*Math.cos(u),o*Math.sin(u)]}}function n(t,e){return t.a0==e.a0&&t.a1==e.a1}function r(t,e,n){return"A"+t+","+t+" 0 "+ +(n>Bi)+",1 "+e}function a(t,e,n,r){return"Q 0,0 "+r}var o=_n,i=wn,l=Uo,s=vo,c=yo;return t.radius=function(e){return arguments.length?(l=zt(e),t):l},t.source=function(e){return arguments.length?(o=zt(e),t):o},t.target=function(e){return arguments.length?(i=zt(e),t):i},t.startAngle=function(e){return arguments.length?(s=zt(e),t):s},t.endAngle=function(e){return arguments.length?(c=zt(e),t):c},t},ui.svg.diagonal=function(){function t(t,a){var o=e.call(this,t,a),i=n.call(this,t,a),l=(o.y+i.y)/2,s=[o,{x:o.x,y:l},{x:i.x,y:l},i];return s=s.map(r),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var e=_n,n=wn,r=Yo;return t.source=function(n){return arguments.length?(e=zt(n),t):e},t.target=function(e){return arguments.length?(n=zt(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},ui.svg.diagonal.radial=function(){var t=ui.svg.diagonal(),e=Yo,n=t.projection;return t.projection=function(t){return arguments.length?n(Xo(e=t)):e},t},ui.svg.symbol=function(){function t(t,r){return(Fs.get(e.call(this,t,r))||Qo)(n.call(this,t,r))}var e=$o,n=Go;return t.type=function(n){return arguments.length?(e=zt(n),t):e},t.size=function(e){return arguments.length?(n=zt(e),t):n},t};var Fs=ui.map({circle:Qo,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*Bs)),n=e*Bs;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",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/qs),n=e*qs/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/qs),n=e*qs/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ui.svg.symbolTypes=Fs.keys();var qs=Math.sqrt(3),Bs=Math.tan(30*Ui);Ei.transition=function(t){for(var e,n,r=Hs||++Ys,a=ei(t),o=[],i=Vs||{time:Date.now(),ease:zr,delay:0,duration:250},l=-1,s=this.length;++lo;o++){a.push(e=[]);for(var n=this[o],l=0,s=n.length;s>l;l++)(r=n[l])&&t.call(r,r.__data__,l,o)&&e.push(r)}return Jo(a,this.namespace,this.id)},Us.tween=function(t,e){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(t):U(this,null==e?function(e){e[r][n].tween.remove(t)}:function(a){a[r][n].tween.set(t,e)})},Us.attr=function(t,e){function n(){this.removeAttribute(l)}function r(){this.removeAttributeNS(l.space,l.local)}function a(t){return null==t?n:(t+="",function(){var e,n=this.getAttribute(l);return n!==t&&(e=i(n,t),function(t){this.setAttribute(l,e(t))})})}function o(t){return null==t?r:(t+="",function(){var e,n=this.getAttributeNS(l.space,l.local);return n!==t&&(e=i(n,t),function(t){this.setAttributeNS(l.space,l.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var i="transform"==t?$r:_r,l=ui.ns.qualify(t);return Ko(this,"attr."+t,e,l.local?o:a)},Us.attrTween=function(t,e){function n(t,n){var r=e.call(this,t,n,this.getAttribute(a));return r&&function(t){this.setAttribute(a,r(t))}}function r(t,n){var r=e.call(this,t,n,this.getAttributeNS(a.space,a.local));return r&&function(t){this.setAttributeNS(a.space,a.local,r(t))}}var a=ui.ns.qualify(t);return this.tween("attr."+t,a.local?r:n)},Us.style=function(t,e,n){function a(){this.style.removeProperty(t)}function o(e){return null==e?a:(e+="",function(){var a,o=r(this).getComputedStyle(this,null).getPropertyValue(t);return o!==e&&(a=_r(o,e),function(e){this.style.setProperty(t,a(e),n)})})}var i=arguments.length;if(3>i){if("string"!=typeof t){2>i&&(e="");for(n in t)this.style(n,t[n],e);return this}n=""}return Ko(this,"style."+t,e,o)},Us.styleTween=function(t,e,n){function a(a,o){var i=e.call(this,a,o,r(this).getComputedStyle(this,null).getPropertyValue(t));return i&&function(e){this.style.setProperty(t,i(e),n)}}return arguments.length<3&&(n=""),this.tween("style."+t,a)},Us.text=function(t){return Ko(this,"text",t,ti)},Us.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Us.ease=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].ease:("function"!=typeof t&&(t=ui.ease.apply(ui,arguments)),U(this,function(r){r[n][e].ease=t}))},Us.delay=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].delay:U(this,"function"==typeof t?function(r,a,o){r[n][e].delay=+t.call(r,r.__data__,a,o)}:(t=+t,function(r){r[n][e].delay=t}))},Us.duration=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].duration:U(this,"function"==typeof t?function(r,a,o){r[n][e].duration=Math.max(1,t.call(r,r.__data__,a,o))}:(t=Math.max(1,t),function(r){r[n][e].duration=t}))},Us.each=function(t,e){var n=this.id,r=this.namespace;if(arguments.length<2){var a=Vs,o=Hs;try{Hs=n,U(this,function(e,a,o){Vs=e[r][n],t.call(e,e.__data__,a,o)})}finally{Vs=a,Hs=o}}else U(this,function(a){var o=a[r][n];(o.event||(o.event=ui.dispatch("start","end","interrupt"))).on(t,e)});return this},Us.transition=function(){for(var t,e,n,r,a=this.id,o=++Ys,i=this.namespace,l=[],s=0,c=this.length;c>s;s++){l.push(t=[]);for(var e=this[s],u=0,f=e.length;f>u;u++)(n=e[u])&&(r=n[i][a],ni(n,u,i,o,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),t.push(n)}return Jo(l,i,o)},ui.svg.axis=function(){function t(t){t.each(function(){var t,c=ui.select(this),u=this.__chart__||n,f=this.__chart__=n.copy(),d=null==s?f.ticks?f.ticks.apply(f,l):f.domain():s,h=null==e?f.tickFormat?f.tickFormat.apply(f,l):b:e,p=c.selectAll(".tick").data(d,f),g=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Fi),m=ui.transition(p.exit()).style("opacity",Fi).remove(),v=ui.transition(p.order()).style("opacity",1),y=Math.max(a,0)+i,x=Ya(f),_=c.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"), ui.transition(_));g.append("line"),g.append("text");var k,M,A,T,L=g.select("line"),z=v.select("line"),S=p.select("text").text(h),C=g.select("text"),E=v.select("text"),O="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(t=ri,k="x",A="y",M="x2",T="y2",S.attr("dy",0>O?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+O*o+"V0H"+x[1]+"V"+O*o)):(t=ai,k="y",A="x",M="y2",T="x2",S.attr("dy",".32em").style("text-anchor",0>O?"end":"start"),w.attr("d","M"+O*o+","+x[0]+"H0V"+x[1]+"H"+O*o)),L.attr(T,O*a),C.attr(A,O*y),z.attr(M,0).attr(T,O*a),E.attr(k,0).attr(A,O*y),f.rangeBand){var P=f,N=P.rangeBand()/2;u=f=function(t){return P(t)+N}}else u.rangeBand?u=f:m.call(t,f,u);g.call(t,u,f),v.call(t,f,f)})}var e,n=ui.scale.linear(),r=Xs,a=6,o=6,i=3,l=[10],s=null;return t.scale=function(e){return arguments.length?(n=e,t):n},t.orient=function(e){return arguments.length?(r=e in Gs?e+"":Xs,t):r},t.ticks=function(){return arguments.length?(l=di(arguments),t):l},t.tickValues=function(e){return arguments.length?(s=e,t):s},t.tickFormat=function(n){return arguments.length?(e=n,t):e},t.tickSize=function(e){var n=arguments.length;return n?(a=+e,o=+arguments[n-1],t):a},t.innerTickSize=function(e){return arguments.length?(a=+e,t):a},t.outerTickSize=function(e){return arguments.length?(o=+e,t):o},t.tickPadding=function(e){return arguments.length?(i=+e,t):i},t.tickSubdivide=function(){return arguments.length&&t},t};var Xs="bottom",Gs={top:1,right:1,bottom:1,left:1};ui.svg.brush=function(){function t(r){r.each(function(){var r=ui.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),i=r.selectAll(".background").data([0]);i.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),r.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var l=r.selectAll(".resize").data(g,b);l.exit().remove(),l.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return $s[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"),l.style("display",t.empty()?"none":null);var s,f=ui.transition(r),d=ui.transition(i);c&&(s=Ya(c),d.attr("x",s[0]).attr("width",s[1]-s[0]),n(f)),u&&(s=Ya(u),d.attr("y",s[0]).attr("height",s[1]-s[0]),a(f)),e(f)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+f[+/e$/.test(t)]+","+d[+/^s/.test(t)]+")"})}function n(t){t.select(".extent").attr("x",f[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(S||(x=null,E[0]-=f[1],E[1]-=d[1],S=2),T())}function g(){32==ui.event.keyCode&&2==S&&(E[0]+=f[1],E[1]+=d[1],S=0,T())}function m(){var t=ui.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),S||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),E[0]=f[+(t[0]u?(a=r,r=u):a=u),g[0]!=r||g[1]!=a?(n?l=null:i=null,g[0]=r,g[1]=a,!0):void 0}function y(){m(),M.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),ui.select("body").style("cursor",null),O.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),C(),k({type:"brushend"})}var x,b,_=this,w=ui.select(ui.event.target),k=s.of(_,arguments),M=ui.select(_),A=w.datum(),L=!/^(n|s)$/.test(A)&&c,z=!/^(e|w)$/.test(A)&&u,S=w.classed("extent"),C=W(_),E=ui.mouse(_),O=ui.select(r(_)).on("keydown.brush",o).on("keyup.brush",g);if(ui.event.changedTouches?O.on("touchmove.brush",m).on("touchend.brush",y):O.on("mousemove.brush",m).on("mouseup.brush",y),M.interrupt().selectAll("*").interrupt(),S)E[0]=f[0]-E[0],E[1]=d[0]-E[1];else if(A){var P=+/w$/.test(A),N=+/^n/.test(A);b=[f[1-P]-E[0],d[1-N]-E[1]],E[0]=f[P],E[1]=d[N]}else ui.event.altKey&&(x=E.slice());M.style("pointer-events","none").selectAll(".resize").style("display",null),ui.select("body").style("cursor",w.style("cursor")),k({type:"brushstart"}),m()}var i,l,s=z(t,"brushstart","brush","brushend"),c=null,u=null,f=[0,0],d=[0,0],h=!0,p=!0,g=Qs[0];return t.event=function(t){t.each(function(){var t=s.of(this,arguments),e={x:f,y:d,i:i,j:l},n=this.__chart__||e;this.__chart__=e,Hs?ui.select(this).transition().each("start.brush",function(){i=n.i,l=n.j,f=n.x,d=n.y,t({type:"brushstart"})}).tween("brush:brush",function(){var n=wr(f,e.x),r=wr(d,e.y);return i=l=null,function(a){f=e.x=n(a),d=e.y=r(a),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=e.i,l=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(c=e,g=Qs[!c<<1|!u],t):c},t.y=function(e){return arguments.length?(u=e,g=Qs[!c<<1|!u],t):u},t.clamp=function(e){return arguments.length?(c&&u?(h=!!e[0],p=!!e[1]):c?h=!!e:u&&(p=!!e),t):c&&u?[h,p]:c?h:u?p:null},t.extent=function(e){var n,r,a,o,s;return arguments.length?(c&&(n=e[0],r=e[1],u&&(n=n[0],r=r[0]),i=[n,r],c.invert&&(n=c(n),r=c(r)),n>r&&(s=n,n=r,r=s),n==f[0]&&r==f[1]||(f=[n,r])),u&&(a=e[0],o=e[1],c&&(a=a[1],o=o[1]),l=[a,o],u.invert&&(a=u(a),o=u(o)),a>o&&(s=a,a=o,o=s),a==d[0]&&o==d[1]||(d=[a,o])),t):(c&&(i?(n=i[0],r=i[1]):(n=f[0],r=f[1],c.invert&&(n=c.invert(n),r=c.invert(r)),n>r&&(s=n,n=r,r=s))),u&&(l?(a=l[0],o=l[1]):(a=d[0],o=d[1],u.invert&&(a=u.invert(a),o=u.invert(o)),a>o&&(s=a,a=o,o=s))),c&&u?[[n,a],[r,o]]:c?[n,r]:u&&[a,o])},t.clear=function(){return t.empty()||(f=[0,0],d=[0,0],i=l=null),t},t.empty=function(){return!!c&&f[0]==f[1]||!!u&&d[0]==d[1]},ui.rebind(t,s,"on")};var $s={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Qs=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ws=ml.format=wl.timeFormat,Js=Ws.utc,Ks=Js("%Y-%m-%dT%H:%M:%S.%LZ");Ws.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?oi:Ks,oi.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},oi.toString=Ks.toString,ml.second=Ht(function(t){return new vl(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),ml.seconds=ml.second.range,ml.seconds.utc=ml.second.utc.range,ml.minute=Ht(function(t){return new vl(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),ml.minutes=ml.minute.range,ml.minutes.utc=ml.minute.utc.range,ml.hour=Ht(function(t){var e=t.getTimezoneOffset()/60;return new vl(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),ml.hours=ml.hour.range,ml.hours.utc=ml.hour.utc.range,ml.month=Ht(function(t){return t=ml.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),ml.months=ml.month.range,ml.months.utc=ml.month.utc.range;var tc=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],ec=[[ml.second,1],[ml.second,5],[ml.second,15],[ml.second,30],[ml.minute,1],[ml.minute,5],[ml.minute,15],[ml.minute,30],[ml.hour,1],[ml.hour,3],[ml.hour,6],[ml.hour,12],[ml.day,1],[ml.day,2],[ml.week,1],[ml.month,1],[ml.month,3],[ml.year,1]],nc=Ws.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",Ee]]),rc={range:function(t,e,n){return ui.range(Math.ceil(t/n)*n,+e,n).map(li)},floor:b,ceil:b};ec.year=ml.year,ml.scale=function(){return ii(ui.scale.linear(),ec,nc)};var ac=ec.map(function(t){return[t[0].utc,t[1]]}),oc=Js.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",Ee]]);ac.year=ml.year.utc,ml.scale.utc=function(){return ii(ui.scale.linear(),ac,oc)},ui.text=St(function(t){return t.responseText}),ui.json=function(t,e){return Ct(t,"application/json",si,e)},ui.html=function(t,e){return Ct(t,"text/html",ci,e)},ui.xml=St(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=ui,t(ui)):"object"==typeof n&&n.exports?n.exports=ui:this.d3=ui}()},{}],17:[function(e,n,r){(function(r,a){(function(){"use strict";function o(t){return"function"==typeof t||"object"==typeof t&&null!==t}function i(t){return"function"==typeof t}function l(t){Y=t}function s(t){Q=t}function c(){return function(){r.nextTick(p)}}function u(){return function(){U(p)}}function f(){var t=0,e=new K(p),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function d(){var t=new MessageChannel;return t.port1.onmessage=p,function(){t.port2.postMessage(0)}}function h(){return function(){setTimeout(p,1)}}function p(){for(var t=0;$>t;t+=2){var e=nt[t],n=nt[t+1];e(n),nt[t]=void 0,nt[t+1]=void 0}$=0}function g(){try{var t=e,n=t("vertx");return U=n.runOnLoop||n.runOnContext,u()}catch(r){return h()}}function m(t,e){var n=this,r=n._state;if(r===it&&!t||r===lt&&!e)return this;var a=new this.constructor(y),o=n._result;if(r){var i=arguments[r-1];Q(function(){N(r,a,i,o)})}else C(n,a,t,e);return a}function v(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(y);return T(n,t),n}function y(){}function x(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return st.error=e,st}}function w(t,e,n,r){try{t.call(e,n,r)}catch(a){return a}}function k(t,e,n){Q(function(t){var r=!1,a=w(n,e,function(n){r||(r=!0,e!==n?T(t,n):z(t,n))},function(e){r||(r=!0,S(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&a&&(r=!0,S(t,a))},t)}function M(t,e){e._state===it?z(t,e._result):e._state===lt?S(t,e._result):C(e,void 0,function(e){T(t,e)},function(e){S(t,e)})}function A(t,e,n){e.constructor===t.constructor&&n===rt&&constructor.resolve===at?M(t,e):n===st?S(t,st.error):void 0===n?z(t,e):i(n)?k(t,e,n):z(t,e)}function T(t,e){t===e?S(t,x()):o(e)?A(t,e,_(e)):z(t,e)}function L(t){t._onerror&&t._onerror(t._result),E(t)}function z(t,e){t._state===ot&&(t._result=e,t._state=it,0!==t._subscribers.length&&Q(E,t))}function S(t,e){t._state===ot&&(t._state=lt,t._result=e,Q(L,t))}function C(t,e,n,r){var a=t._subscribers,o=a.length;t._onerror=null,a[o]=e,a[o+it]=n,a[o+lt]=r,0===o&&t._state&&Q(E,t)}function E(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,a,o=t._result,i=0;ii;i++)C(r.resolve(t[i]),void 0,e,n);return a}function j(t){var e=this,n=new e(y);return S(n,t),n}function F(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function q(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function B(t){this._id=ht++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==t&&("function"!=typeof t&&F(),this instanceof B?D(this,t):q())}function H(t,e){this._instanceConstructor=t,this.promise=new t(y),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?z(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&z(this.promise,this._result))):S(this.promise,this._validationError())}function V(){var t;if("undefined"!=typeof a)t=a;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;n&&"[object Promise]"===Object.prototype.toString.call(n.resolve())&&!n.cast||(t.Promise=pt)}var Z;Z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var U,Y,X,G=Z,$=0,Q=function(t,e){nt[$]=t,nt[$+1]=e,$+=2,2===$&&(Y?Y(p):X())},W="undefined"!=typeof window?window:void 0,J=W||{},K=J.MutationObserver||J.WebKitMutationObserver,tt="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);X=tt?c():K?f():et?d():void 0===W&&"function"==typeof e?g():h();var rt=m,at=v,ot=void 0,it=1,lt=2,st=new O,ct=new O,ut=I,ft=R,dt=j,ht=0,pt=B;B.all=ut,B.race=ft,B.resolve=at,B.reject=dt,B._setScheduler=l,B._setAsap=s,B._asap=Q,B.prototype={constructor:B,then:rt,"catch":function(t){return this.then(null,t)}};var gt=H;H.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},H.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ot&&t>n;n++)this._eachEntry(e[n],n)},H.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===at){var a=_(t);if(a===rt&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof a)this._remaining--,this._result[e]=t;else if(n===pt){var o=new n(y);A(o,t,a),this._willSettleAt(o,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},H.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ot&&(this._remaining--,t===lt?S(r,n):this._result[e]=n),0===this._remaining&&z(r,this._result)},H.prototype._willSettleAt=function(t,e){var n=this;C(t,void 0,function(t){n._settledAt(it,e,t)},function(t){n._settledAt(lt,e,t)})};var mt=V,vt={Promise:pt,polyfill:mt};"function"==typeof t&&t.amd?t(function(){return vt}):"undefined"!=typeof n&&n.exports?n.exports=vt:"undefined"!=typeof this&&(this.ES6Promise=vt),mt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:15}],18:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;n>r;r++)if(e=t.charCodeAt(r),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],19:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,m=o*l,v=o*s;return t[0]=1-f-p,t[1]=u+v,t[2]=d-m,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+m,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],20:[function(e,n,r){!function(){function e(t,n){if(t=t?t:"",n=n||{},t instanceof e)return t;if(!(this instanceof e))return new e(t,n);var a=r(t);this._originalInput=t,this._r=a.r,this._g=a.g,this._b=a.b,this._a=a.a,this._roundA=B(100*this._a)/100,this._format=n.format||a.format,this._gradientType=n.gradientType,this._r<1&&(this._r=B(this._r)),this._g<1&&(this._g=B(this._g)),this._b<1&&(this._b=B(this._b)),this._ok=a.ok,this._tc_id=F++}function r(t){var e={r:0,g:0,b:0},n=1,r=!1,o=!1;return"string"==typeof t&&(t=D(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(e=a(t.r,t.g,t.b),r=!0,o="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=O(t.s),t.v=O(t.v),e=s(t.h,t.s,t.v),r=!0,o="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=O(t.s),t.l=O(t.l),e=i(t.h,t.s,t.l),r=!0,o="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=A(n),{ok:r,format:t.format||o,r:H(255,V(e.r,0)),g:H(255,V(e.g,0)),b:H(255,V(e.b,0)),a:n}}function a(t,e,n){return{r:255*T(t,255),g:255*T(e,255),b:255*T(n,255)}}function o(t,e,n){t=T(t,255),e=T(e,255),n=T(n,255);var r,a,o=V(t,e,n),i=H(t,e,n),l=(o+i)/2;if(o==i)r=a=0;else{var s=o-i;switch(a=l>.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(n>e?6:0);break;case e:r=(n-t)/s+2;break;case n:r=(t-e)/s+4}r/=6}return{h:r,s:a,l:l}}function i(t,e,n){function r(t,e,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?t+6*(e-t)*n:.5>n?e:2/3>n?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=T(t,360),e=T(e,100),n=T(n,100),0===e)a=o=i=n;else{var l=.5>n?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function l(t,e,n){t=T(t,255),e=T(e,255),n=T(n,255);var r,a,o=V(t,e,n),i=H(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(n>e?6:0);break;case e:r=(n-t)/s+2;break;case n:r=(t-e)/s+4}r/=6}return{h:r,s:a,v:l}}function s(t,e,n){t=6*T(t,360),e=T(e,100),n=T(n,100);var r=q.floor(t),a=t-r,o=n*(1-e),i=n*(1-a*e),l=n*(1-(1-a)*e),s=r%6,c=[n,i,o,o,l,n][s],u=[l,n,n,i,o,o][s],f=[o,o,l,n,n,i][s];return{r:255*c,g:255*u,b:255*f}}function c(t,e,n,r){var a=[E(B(t).toString(16)),E(B(e).toString(16)),E(B(n).toString(16))];return r&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function u(t,e,n,r){var a=[E(P(r)),E(B(t).toString(16)),E(B(e).toString(16)),E(B(n).toString(16))];return a.join("")}function f(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.s-=n/100,r.s=L(r.s),e(r)}function d(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.s+=n/100,r.s=L(r.s),e(r)}function h(t){return e(t).desaturate(100)}function p(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.l+=n/100,r.l=L(r.l),e(r)}function g(t,n){n=0===n?0:n||10;var r=e(t).toRgb();return r.r=V(0,H(255,r.r-B(255*-(n/100)))),r.g=V(0,H(255,r.g-B(255*-(n/100)))),r.b=V(0,H(255,r.b-B(255*-(n/100)))),e(r)}function m(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.l-=n/100,r.l=L(r.l),e(r)}function v(t,n){var r=e(t).toHsl(),a=(B(r.h)+n)%360;return r.h=0>a?360+a:a,e(r)}function y(t){var n=e(t).toHsl();return n.h=(n.h+180)%360,e(n)}function x(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+120)%360,s:n.s,l:n.l}),e({h:(r+240)%360,s:n.s,l:n.l})]}function b(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+90)%360,s:n.s,l:n.l}),e({h:(r+180)%360,s:n.s,l:n.l}),e({h:(r+270)%360,s:n.s,l:n.l})]}function _(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+72)%360,s:n.s,l:n.l}),e({h:(r+216)%360,s:n.s,l:n.l})]}function w(t,n,r){n=n||6,r=r||30;var a=e(t).toHsl(),o=360/r,i=[e(t)];for(a.h=(a.h-(o*n>>1)+720)%360;--n;)a.h=(a.h+o)%360,i.push(e(a));return i}function k(t,n){n=n||6;for(var r=e(t).toHsv(),a=r.h,o=r.s,i=r.v,l=[],s=1/n;n--;)l.push(e({h:a,s:o,v:i})),i=(i+s)%1;return l}function M(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function A(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function T(t,e){S(t)&&(t="100%");var n=C(t);return t=H(e,V(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),q.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function L(t){return H(1,V(0,t))}function z(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function C(t){return"string"==typeof t&&-1!=t.indexOf("%")}function E(t){return 1==t.length?"0"+t:""+t}function O(t){return 1>=t&&(t=100*t+"%"),t}function P(t){return Math.round(255*parseFloat(t)).toString(16)}function N(t){return z(t)/255}function D(t){t=t.replace(R,"").replace(j,"").toLowerCase();var e=!1;if(U[t])t=U[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=X.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=X.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=X.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=X.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=X.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=X.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=X.hex8.exec(t))?{a:N(n[1]),r:z(n[2]),g:z(n[3]),b:z(n[4]),format:e?"name":"hex8"}:(n=X.hex6.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),format:e?"name":"hex"}:(n=X.hex3.exec(t))?{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function I(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var R=/^\s+/,j=/\s+$/,F=0,q=Math,B=q.round,H=q.min,V=q.max,Z=q.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,n,r,a,o,i=this.toRgb();return t=i.r/255,e=i.g/255,n=i.b/255,r=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),a=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),o=.03928>=n?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o},setAlpha:function(t){return this._a=A(t),this._roundA=B(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=B(360*t.h),n=B(100*t.s),r=B(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=B(360*t.h),n=B(100*t.s),r=B(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return u(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:B(this._r),g:B(this._g),b:B(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+B(this._r)+", "+B(this._g)+", "+B(this._b)+")":"rgba("+B(this._r)+", "+B(this._g)+", "+B(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:B(100*T(this._r,255))+"%",g:B(100*T(this._g,255))+"%",b:B(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+B(100*T(this._r,255))+"%, "+B(100*T(this._g,255))+"%, "+B(100*T(this._b,255))+"%)":"rgba("+B(100*T(this._r,255))+"%, "+B(100*T(this._g,255))+"%, "+B(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:Y[c(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+u(this._r,this._g,this._b,this._a),r=n,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=e(t);r=o.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(g,arguments)},darken:function(){return this._applyModification(m,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(d,arguments)},greyscale:function(){return this._applyModification(h,arguments)},spin:function(){return this._applyModification(v,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(x,arguments)},tetrad:function(){return this._applyCombination(b,arguments)}},e.fromRatio=function(t,n){if("object"==typeof t){var r={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?r[a]=t[a]:r[a]=O(t[a]));t=r}return e(t,n)},e.equals=function(t,n){return t&&n?e(t).toRgbString()==e(n).toRgbString():!1},e.random=function(){return e.fromRatio({r:Z(),g:Z(),b:Z()})},e.mix=function(t,n,r){r=0===r?0:r||50;var a,o=e(t).toRgb(),i=e(n).toRgb(),l=r/100,s=2*l-1,c=i.a-o.a;a=s*c==-1?s:(s+c)/(1+s*c),a=(a+1)/2;var u=1-a,f={r:i.r*a+o.r*u,g:i.g*a+o.g*u,b:i.b*a+o.b*u,a:i.a*l+o.a*(1-l)};return e(f)},e.readability=function(t,n){var r=e(t),a=e(n);return(Math.max(r.getLuminance(),a.getLuminance())+.05)/(Math.min(r.getLuminance(),a.getLuminance())+.05)},e.isReadable=function(t,n,r){var a,o,i=e.readability(t,n);switch(o=!1,a=I(r),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},e.mostReadable=function(t,n,r){var a,o,i,l,s=null,c=0;r=r||{},o=r.includeFallbackColors,i=r.level,l=r.size;for(var u=0;uc&&(c=a,s=e(n[u]));return e.isReadable(t,s,{level:i,size:l})||!o?s:(r.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],r))};var U=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=e.hexNames=M(U),X=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+a),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof n&&n.exports?n.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],21:[function(t,e,n){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],22:[function(t,e,n){"use strict";var r=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"}, yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":101,"../../plots/cartesian/constants":129,"../../plots/font_attributes":142,"./arrow_paths":21}],23:[function(t,e,n){"use strict";function r(t,e){function n(e,n){return c.coerce(t,r,m.layoutAttributes,e,n)}var r={};n("opacity"),n("align"),n("bgcolor");var a=n("bordercolor"),o=f.opacity(a);n("borderpad");var i=n("borderwidth"),l=n("showarrow");l&&(n("arrowcolor",o?r.bordercolor:f.defaultLine),n("arrowhead"),n("arrowsize"),n("arrowwidth",2*(o&&i||1)),n("ax"),n("ay"),n("axref"),n("ayref"),c.noneOrAll(t,r,["ax","ay"])),n("text",l?" ":"new text"),n("textangle"),c.coerceFont(n,"font",e.font);for(var s=["x","y"],d=0;2>d;d++){var h=s[d],p={_fullLayout:e},g=u.coerceRef(t,r,p,h),v=u.coerceARef(t,r,p,h),y=.5;if("paper"!==g){var x=u.getFromId(p,g);if(y=x.range[0]+y*(x.range[1]-x.range[0]),-1!==["date","category"].indexOf(x.type)&&"string"==typeof t[h]){var b;if("date"===x.type){if(b=c.dateTime2ms(t[h]),b!==!1&&(t[h]=b),v===g){var _=c.dateTime2ms(t["a"+h]);_!==!1&&(t["a"+h]=_)}}else(x._categories||[]).length&&(b=x._categories.indexOf(t[h]),-1!==b&&(t[h]=b))}}n(h,y),l||n(h+"anchor")}return c.noneOrAll(t,r,["x","y"]),r}function a(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=u.getFromId(t,e.xref),r=u.getFromId(t,e.yref);if(n||r){var a=(e._xsize||0)/2,o=e._xshift||0,i=(e._ysize||0)/2,l=e._yshift||0,s=a-o,c=a+o,f=i-l,d=i+l;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;s=Math.max(s,h),c=Math.max(c,h),f=Math.max(f,h),d=Math.max(d,h)}n&&n.autorange&&u.expand(n,[n.l2c(e.x)],{ppadplus:c,ppadminus:s}),r&&r.autorange&&u.expand(r,[r.l2c(e.y)],{ppadplus:d,ppadminus:f})}})}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return 0>m||m>1||0>g||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../lib"),u=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),h=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),g=t("../dragelement"),m=e.exports={};m.ARROWPATHS=t("./arrow_paths"),m.layoutAttributes=t("./attributes"),m.supplyLayoutDefaults=function(t,e){for(var n=t.annotations||[],a=e.annotations=[],o=0;ot?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var r=G.select(".annotation-math-group"),a=!r.empty(),l=d.bBox((a?r:tt).node()),h=l.width,v=l.height,y=Math.round(h+2*W),x=Math.round(v+2*W);B._w=h,B._h=v;var b=!1;if(["x","y"].forEach(function(e){var r,a=B[e+"ref"]||e,o=u.getFromId(t,a),i=(U+("x"===e?0:90))*Math.PI/180,l=y*Math.abs(Math.cos(i))+x*Math.abs(Math.sin(i)),s=B[e+"anchor"];if(o){if(!o.autorange&&(B[e]-o.range[0])*(B[e]-o.range[1])>0&&(B["a"+e+"ref"]===a?(B["a"+e]-o.range[0])*(B["a"+e]-o.range[1])>0&&(b=!0):b=!0,b))return;Z[e]=o._offset+o.l2p(B[e]),r=.5}else r=B[e],"y"===e&&(r=1-r),Z[e]="x"===e?S.l+S.w*r:S.t+S.h*r;var c=0;B["a"+e+"ref"]===a?Z["aa"+e]=o._offset+o.l2p(B["a"+e]):(c=B.showarrow?B["a"+e]:l*n(r,s),Z[e]+=c),B["_"+e+"type"]=o&&o.type,B["_"+e+"size"]=l,B["_"+e+"shift"]=c}),b)return void G.remove();var w,k;B.showarrow&&(w=B.axref===B.xref?Z.x:c.constrain(Z.x-B.ax,1,_.width-1),k=B.ayref===B.yref?Z.y:c.constrain(Z.y-B.ay,1,_.height-1)),Z.x=c.constrain(Z.x,1,_.width-1),Z.y=c.constrain(Z.y,1,_.height-1);var M=W-l.top,A=W-l.left;a?r.select("svg").attr({x:W-1,y:W}):(tt.attr({x:A,y:M}),tt.selectAll("tspan.line").attr({y:M,x:A})),J.call(d.setRect,$/2,$/2,y-$,x-$);var T=0,L=0;T=B.axref===B.xref?Math.round(Z.aax-y/2):Math.round(Z.x-y/2),L=B.ayref===B.yref?Math.round(Z.aay-x/2):Math.round(Z.y-x/2),G.call(c.setTranslate,T,L);var z="annotations["+e+"]",C=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=B.axref===B.xref?Z.aax+n:Z.x+n,l=B.ayref===B.yref?Z.aay+r:Z.y+r;var u=c.rotationXYMatrix(U,a,l),d=c.apply2DTransform(u),h=c.apply2DTransform2(u),p=J.attr("width")/2,v=J.attr("height")/2,y=[[a-p,l-v,a-p,l+v],[a-p,l+v,a+p,l+v],[a+p,l+v,a+p,l-v],[a+p,l-v,a-p,l-v]].map(h);if(!y.reduce(function(t,e){return t^!!o(w,k,w+1e6,k+1e6,e[0],e[1],e[2],e[3])},!1)){y.forEach(function(t){var e=o(a,l,w,k,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var x=B.arrowwidth,b=B.arrowcolor,_=Y.append("g").style({opacity:f.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=_.append("path").attr("d","M"+a+","+l+"L"+w+","+k).style("stroke-width",x+"px").call(f.stroke,f.rgb(b));m.arrowhead(M,B.arrowhead,"end",B.arrowsize);var A=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-w)+","+(l-k),transform:"translate("+w+","+k+")"}).style("stroke-width",x+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,C;g.init({element:A.node(),prepFn:function(){var t=c.getTranslate(G);L=t.x,C=t.y,T={},H&&H.autorange&&(T[H._name+".autorange"]=!0),V&&V.autorange&&(T[V._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var n=d(L,C),r=n[0]+t,a=n[1]+e;G.call(c.setTranslate,r,a),T[z+".x"]=H?B.x+t/H._m:(w+t-S.l)/S.w,T[z+".y"]=V?B.y+e/V._m:1-(k+e-S.t)/S.h,B.axref===B.xref&&(T[z+".ax"]=H?B.ax+t/H._m:(w+t-S.l)/S.w),B.ayref===B.yref&&(T[z+".ay"]=V?B.ay+e/V._m:1-(k+e-S.t)/S.h),X.attr({transform:"rotate("+U+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};B.showarrow&&C(0,0);var E=c.rotationXYMatrix(U,Z.x,Z.y),O=c.apply2DTransform(E);if(t._context.editable){var P,N,D;g.init({element:G.node(),prepFn:function(){var t=c.getTranslate(G);P=t.x,N=t.y,D={}},moveFn:function(t,e){G.call(c.setTranslate,P+t,N+e);var n="pointer";if(B.showarrow)B.axref===B.xref?D[z+".ax"]=H.p2l(H.l2p(B.ax)+t):D[z+".ax"]=B.ax+t,B.ayref===B.yref?D[z+".ay"]=V.p2l(V.l2p(B.ay)+e):D[z+".ay"]=B.ay+e,C(t,e);else{if(H)D[z+".x"]=B.x+t/H._m;else{var r=B._xsize/S.w,a=B.x+B._xshift/S.w-r/2;D[z+".x"]=g.align(a+t/S.w,r,0,1,B.xanchor)}if(V)D[z+".y"]=B.y+e/V._m;else{var o=B._ysize/S.h,i=B.y-B._yshift/S.h-o/2;D[z+".y"]=g.align(i-e/S.h,o,0,1,B.yanchor)}H&&V||(n=g.getCursor(H?.5:D[z+".x"],V?.5:D[z+".y"],B.xanchor,B.yanchor))}var l=O(P,N),s=l[0]+t,u=l[1]+e;G.call(c.setTranslate,P+t,N+e),X.attr({transform:"rotate("+U+","+s+","+u+")"}),p(G,n)},doneFn:function(e){if(p(G),e){s.relayout(t,D);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var x,b=t.layout,_=t._fullLayout;if(!l(e)||-1===e){if(!e&&Array.isArray(a))return b.annotations=a,m.supplyLayoutDefaults(b,_),void m.drawAll(t);if("remove"===a)return delete b.annotations,_.annotations=[],void m.drawAll(t);if(n&&"add"!==a){for(x=0;x<_.annotations.length;x++)m.draw(t,x,n,a);return}e=_.annotations.length,_.annotations.push({})}if(!n&&a){if("remove"===a){for(_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),_.annotations.splice(e,1),b.annotations.splice(e,1),x=e;x<_.annotations.length;x++)_._infolayer.selectAll('.annotation[data-index="'+(x+1)+'"]').attr("data-index",String(x)),m.draw(t,x);return}if("add"===a||c.isPlainObject(a)){_.annotations.splice(e,0,{});var w=c.isPlainObject(a)?c.extendFlat({},a):{text:"New text"};for(b.annotations?b.annotations.splice(e,0,w):b.annotations=[w],x=_.annotations.length-1;x>e;x--)_._infolayer.selectAll('.annotation[data-index="'+(x-1)+'"]').attr("data-index",String(x)),m.draw(t,x)}}_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var k=b.annotations[e],M=_.annotations[e];if(k){var A={xref:k.xref,yref:k.yref},T={};"string"==typeof n&&n?T[n]=a:c.isPlainObject(n)&&(T=n);var L=Object.keys(T);for(x=0;xx;x++){var E=C[x];if(void 0===T[E]&&void 0!==k[E]){var O=u.getFromId(t,u.coerceRef(A,{},t,E)),P=u.getFromId(t,u.coerceRef(k,{},t,E)),N=k[E],D=M["_"+E+"type"];if(void 0!==T[E+"ref"]){var I="auto"===k[E+"anchor"],R="x"===E?S.w:S.h,j=(M["_"+E+"size"]||0)/(2*R);if(O&&P)N=(N-O.range[0])/(O.range[1]-O.range[0]),N=P.range[0]+N*(P.range[1]-P.range[0]);else if(O){if(N=(N-O.range[0])/(O.range[1]-O.range[0]),N=O.domain[0]+N*(O.domain[1]-O.domain[0]),I){var F=N+j,q=N-j;2/3>N+q?N=q:N+F>4/3&&(N=F)}}else P&&(I&&(1/3>N?N+=j:N>2/3&&(N-=j)),N=(N-P.domain[0])/(P.domain[1]-P.domain[0]),N=P.range[0]+N*(P.range[1]-P.range[0]))}P&&P===O&&D&&("log"===D&&"log"!==P.type?N=Math.pow(10,N):"log"!==D&&"log"===P.type&&(N=N>0?Math.log(N)/Math.LN10:void 0)),k[E]=N}}var B=r(k,_);_.annotations[e]=B;var H=u.getFromId(t,B.xref),V=u.getFromId(t,B.yref),Z={x:0,y:0},U=+B.textangle||0,Y=_._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",B.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:k,fullAnnotation:B})}),X=Y.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),G=X.append("g"),$=B.borderwidth,Q=B.borderpad,W=$+Q,J=G.append("rect").attr("class","bg").style("stroke-width",$+"px").call(f.stroke,B.bordercolor).call(f.fill,B.bgcolor),K=B.font,tt=G.append("text").classed("annotation",!0).attr("data-unformatted",B.text).text(B.text);t._context.editable?tt.call(h.makeEditable,G).call(v).on("edit",function(n){B.text=n,this.attr({"data-unformatted":B.text}),this.call(v);var r={};r["annotations["+e+"].text"]=B.text,H&&H.autorange&&(r[H._name+".autorange"]=!0),V&&V.autorange&&(r[V._name+".autorange"]=!0),s.relayout(t,r)}):tt.call(v),X.attr({transform:"rotate("+U+","+Z.x+","+Z.y+")"}).call(d.setPosition,Z.x,Z.y)}},m.arrowhead=function(t,e,n,r){l(r)||(r=1);var a=t.node(),o=m.ARROWPATHS[e||0];if(o){"string"==typeof n&&n||(n="end");var s,c,u,h,p=(d.getPx(t,"stroke-width")||1)*r,g=t.style("stroke")||f.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=o.backoff*p;if("line"===a.nodeName){if(s={x:+t.attr("x1"),y:+t.attr("y1")},c={x:+t.attr("x2"),y:+t.attr("y2")},u=Math.atan2(s.y-c.y,s.x-c.x),h=u+Math.PI,b){var _=b*Math.cos(u),w=b*Math.sin(u);y&&(s.x-=_,s.y-=w,t.attr({x1:s.x,y1:s.y})),x&&(c.x+=_,c.y+=w,t.attr({x2:c.x,y2:c.y}))}}else if("path"===a.nodeName){var k=a.getTotalLength(),M="";if(y){var A=a.getPointAtLength(0),T=a.getPointAtLength(.1);u=Math.atan2(A.y-T.y,A.x-T.x),s=a.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=a.getPointAtLength(k),z=a.getPointAtLength(k-.1);if(h=Math.atan2(L.y-z.y,L.x-z.x),c=a.getPointAtLength(Math.max(0,k-b)),b){var S=M?2*b:b;M+=k-S+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var C=function(n,r){e>5&&(r=0),i.select(a.parentElement).append("path").attr({"class":t.attr("class"),d:o.path,transform:"translate("+n.x+","+n.y+")rotate("+180*r/Math.PI+")scale("+p+")"}).style({fill:g,opacity:v,"stroke-width":0})};y&&C(s,u),x&&C(c,h)}},m.calcAutorange=function(t){var e=t._fullLayout,n=e.annotations;if(n.length&&t._fullData.length){var r={};n.forEach(function(t){r[t.xref]=!0,r[t.yref]=!0});var o=u.list(t).filter(function(t){return t.autorange&&r[t._id]});if(o.length)return c.syncOrAsync([m.drawAll,a],t)}}},{"../../lib":103,"../../lib/setcursor":112,"../../lib/svg_text_utils":114,"../../plotly":121,"../../plots/cartesian/axes":124,"../color":25,"../dragelement":46,"../drawing":48,"./arrow_paths":21,"./attributes":22,d3:16,"fast-isnumeric":18}],24:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],25:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;es&&(o[1]-=(it-s)/2)):n.node()&&!n.classed("js-placeholder")&&(it=d.bBox(e.node()).height),it){if(it+=5,"top"===b.titleside)J.domain[1]-=it/A.h,o[1]*=-1;else{J.domain[0]+=it/A.h;var u=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-u)*s}e.attr("transform","translate("+o+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(A.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?L[0]:(S[e]+S[e-1])/2,e===S.length-1?L[1]:(S[e]+S[e+1])/2].map(J.c2p).map(Math.round);e!==S.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=E(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:Y,width:Math.max(F,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var h=at.select(".cblines").selectAll("path.cbline").data(b.line.color&&b.line.width?z:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){r.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+b.line.width/2%1)+"h"+F).call(d.lineGroupStyle,b.line.width,C(t),b.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+F+(b.outlinewidth||0)/2-("outside"===b.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(-1===["top","bottom"].indexOf(b.titleside)){var e=J.titlefont.size,n=J._offset+J._length/2,a=A.l+(J.position||0)*A.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));w("h"+J._id+"title",{avoid:{selection:r.select(t).selectAll("g."+J._id+"tick"),side:b.titleside,offsetLeft:A.l,offsetTop:A.t,maxShift:M.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,n){var r,a=x();r=i.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:J,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},l="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+l+",."+l+"-math-group").remove(),p.draw(t,e,u(o,n||{}))}function k(){var n=F+b.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(I=ot.select("text"),I.node()&&!I.classed("js-placeholder")){var r,a=ot.select(".h"+J._id+"title-math-group").node();r=a&&-1!==["top","bottom"].indexOf(b.titleside)?d.bBox(a).width:d.bBox(ot.node()).right-Y-A.l,n=Math.max(n,r)}var o=2*b.xpad+n+b.borderwidth+b.outlinewidth/2,l=$-Q;at.select(".cbbg").attr({x:Y-b.xpad-(b.borderwidth+b.outlinewidth)/2,y:Q-Z,width:Math.max(o,2),height:Math.max(l+2*Z,2)}).call(h.fill,b.bgcolor).call(h.stroke,b.bordercolor).style({"stroke-width":b.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:Q+b.ypad+("top"===b.titleside?it:0),width:Math.max(F,2),height:Math.max(l-2*b.ypad-it,2)}).call(h.stroke,b.outlinecolor).style({fill:"None","stroke-width":b.outlinewidth});var s=({center:.5,right:1}[b.xanchor]||0)*o;at.attr("transform","translate("+(A.l-s)+","+A.t+")"),i.autoMargin(t,e,{x:b.x,y:b.y,l:o*({right:1,center:.5}[b.xanchor]||0),r:o*({left:1,center:.5}[b.xanchor]||0),t:l*({bottom:1,middle:.5}[b.yanchor]||0),b:l*({top:1,middle:.5}[b.yanchor]||0)})}var M=t._fullLayout,A=M._size;if("function"!=typeof b.fillcolor&&"function"!=typeof b.line.color)return void M._infolayer.selectAll("g."+e).remove();var T,L=r.extent(("function"==typeof b.fillcolor?b.fillcolor:b.line.color).domain()),z=[],S=[],C="function"==typeof b.line.color?b.line.color:function(){return b.line.color},E="function"==typeof b.fillcolor?b.fillcolor:function(){return b.fillcolor},O=b.levels.end+b.levels.size/100,P=b.levels.size,N=1.001*L[0]-.001*L[1],D=1.001*L[1]-.001*L[0];for(T=b.levels.start;0>(T-O)*P;T+=P)T>N&&D>T&&z.push(T);if("function"==typeof b.fillcolor)if(b.filllevels)for(O=b.filllevels.end+b.filllevels.size/100,P=b.filllevels.size,T=b.filllevels.start;0>(T-O)*P;T+=P)T>L[0]&&T1){var rt=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));tt*=rt*c.roundUp(nt/rt,[2,5,10]),(Math.abs(b.levels.start)/b.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=tt}J.domain=[G+U,G+H-U],J.setScale();var at=M._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(A.l)+","+Math.round(A.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(A.l)+",-"+Math.round(A.t)+")");J._axislayer=at.select(".cbaxis");var it=0;if(-1!==["top","bottom"].indexOf(b.titleside)){var lt,st=A.l+(b.x+V)*A.w,ct=J.titlefont.size;lt="top"===b.titleside?(1-(G+H-U))*A.h+A.t+3+.75*ct:(1-(G+U))*A.h+A.t-3-.25*ct,w(J._id+"title",{attributes:{x:st,y:lt,"text-anchor":"start"}})}var ut=c.syncOrAsync([i.previousPromises,_,i.previousPromises,k],t);if(ut&&ut.then&&(t._promises||[]).push(ut),t._context.editable){var ft,dt,ht;s.init({element:at.node(),prepFn:function(){ft=at.attr("transform"),f(at)},moveFn:function(t,e){at.attr("transform",ft+" translate("+t+","+e+")"),dt=s.align(X+t/A.w,q,0,1,b.xanchor),ht=s.align(G-e/A.h,H,0,1,b.yanchor);var n=s.getCursor(dt,ht,b.xanchor,b.yanchor);f(at,n)},doneFn:function(e){f(at),e&&void 0!==dt&&void 0!==ht&&o.restyle(t,{"colorbar.x":dt,"colorbar.y":ht},x().index)}})}return ut}function x(){var n,r,a=e.substr(2);for(n=0;nu*f?a.RdBu:u>=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":103,"./flip_scale":36,"./scales":43}],33:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":101,"./attributes":31,"./scales.js":43}],34:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":43}],35:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=r(m)&&r(v)&&v>m;c(f+d+"auto",!x),c(f+d+"min"),c(f+d+"max");var b;void 0!==y&&(b=!l(y)),c(f+"autocolorscale",b);var _=c(f+"colorscale"),w=c(f+"reversescale");if(w&&(g.colorscale=s(_)),"marker.line."!==f){var k;f&&(k=o(p));var M=c(f+"showscale",k);M&&i(p,g,n)}}},{"../../lib":103,"../colorbar/defaults":27,"../colorbar/has_colorbar":29,"./flip_scale":36,"./is_valid_scale":40,"fast-isnumeric":18}],36:[function(t,e,n){"use strict";e.exports=function(t){for(var e,n=t.length,r=new Array(n),a=n-1,o=0;a>=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],37:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":34,"./is_valid_scale_array":41,"./scales":43}],38:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;sd;d++)s=t[d],u[d]=e+s[0]*(n-e),f[d]=a(s[1]).toRgb();var h=r.scale.linear().domain(u).interpolate(r.interpolateObject).range(f);return function(t){if(o(t)){var r=i.constrain(t,e,n),s=h(r);return a(s).toRgbString()}return a(t).isValid()?t:l.defaultLine}}},{"../../lib":103,"../color":25,d3:16,"fast-isnumeric":18,tinycolor2:20}],43:[function(t,e,n){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]], -Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],44:[function(t,e,n){"use strict";e.exports=function(t,e,n,r,a){var o=(t-n)/(r-n),i=o+e/(r-n),l=(o+i)/2;return"left"===a||"bottom"===a?o:"center"===a||"middle"===a?l:"right"===a||"top"===a?i:2/3-l>o?o:i>4/3-l?i:l}},{}],45:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":103}],46:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":103,"../../plotly":121,"../../plots/cartesian/constants":129,"./align":44,"./cursor":45,"./unhover":47}],47:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":100}],48:[function(t,e,n){"use strict";function r(t,e,n,r){var o=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(o*o+i*i,b/2),u=Math.pow(l*l+s*s,b/2),f=(u*u*o-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[a.round(e[0]+(h&&f/h),2),a.round(e[1]+(h&&d/h),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&d/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../plots/plots"),l=t("../color"),s=t("../colorscale"),c=t("../../lib"),u=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),h=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(l.fill,r)},p.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},p.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},p.setRect=function(t,e,n,r,a){t.call(p.setPosition,e,n).call(p.setSize,r,a)},p.translatePoints=function(t,e,n){t.each(function(t){var r=t.xp||e.c2p(t.x),i=t.yp||n.c2p(t.y),l=a.select(this);o(r)&&o(i)?"text"===this.nodeName?l.attr("x",r).attr("y",i):l.attr("transform","translate("+r+","+i+")"):l.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):n||0},p.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},i=e||o.width||0,s=r||o.dash||"";a.select(this).call(l.stroke,n||o.color).call(p.dashLine,s,i)})},p.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(l.fill,e[0].trace.fillcolor)}catch(r){c.error(r,t),n.remove()}})};var g=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=p.symbolNames.length,v="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=n.line;if(i.traceIs(e,"symbols")){var o=h(e);t.attr("d",function(t){var r;r="various"===t.ms||"various"===n.size?3:d.isBubble(e)?o(t.ms):(n.size||6)/2,t.mrc=r;var a=p.symbolNumber(t.mx||n.symbol)||0,i=a%100;return t.om=a%200>=100,p.symbolFuncs[i](r)+(a>=200?v:"")}).style("opacity",function(t){return(t.mo+1||n.opacity+1)-1})}var s=(e._input||{}).marker||{},c=p.tryColorscale(n,s,""),u=p.tryColorscale(n,s,"line.");t.each(function(t){var e,o,i;t.so?(i=r.outlierwidth,o=r.outliercolor,e=n.outliercolor):(i=(t.mlw+1||r.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(r.color)?l.defaultLine:r.color,e="mc"in t?t.mcc=c(t.mc):Array.isArray(n.color)?l.defaultLine:n.color||"rgba(0,0,0,0)");var s=a.select(this);t.om?s.call(l.stroke,e).style({"stroke-width":(i||1)+"px",fill:"none"}):(s.style("stroke-width",i+"px").call(l.fill,e),i&&s.call(l.stroke,o))})}},p.tryColorscale=function(t,e,n){var r=c.nestedProperty(t,n+"color").get(),a=c.nestedProperty(t,n+"colorscale").get(),i=c.nestedProperty(t,n+"cauto").get(),l=c.nestedProperty(t,n+"cmin"),u=c.nestedProperty(t,n+"cmax"),f=l.get(),d=u.get();return a&&Array.isArray(r)?(!i&&o(f)&&o(d)||(f=1/0,d=-(1/0),r.forEach(function(t){o(t)&&(f>t&&(f=+t),t>d&&(d=+t))}),f>d&&(f=0,d=1),l.set(f),u.set(d),c.nestedProperty(e,n+"cmin").set(f),c.nestedProperty(e,n+"cmax").set(d)),s.makeScaleFunction(a,f,d)):c.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;p.textPointStyle=function(t,e){t.each(function(t){var n=a.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var i=t.tp||e.textposition,l=-1!==i.indexOf("top")?"top":-1!==i.indexOf("bottom")?"bottom":"middle",s=-1!==i.indexOf("left")?"end":-1!==i.indexOf("right")?"start":"middle",c=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;c=o(c)&&c>0?c:0,n.call(p.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(u.convertToTspans);var d=a.select(this.parentNode),h=n.selectAll("tspan.line"),g=((h[0].length||1)-1)*x+1,m=y[s]*f,v=.75*c+y[l]*f+(y[l]-1)*g*c/2;d.attr("transform","translate("+m+","+v+")"),g>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,a="M"+t[0],o=[];for(n=1;nn;n++)i.push(r(t[n-1],t[n],t[n+1],e));for(i.push(r(t[o-1],t[o],t[0],e)),n=1;o>=n;n++)a+="C"+i[n-1][1]+" "+i[n][0]+" "+t[n];return a+="C"+i[o][1]+" "+i[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+a.round(e[0],2)+"V"+a.round(e[1],2)},vh:function(t,e){return"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},hvh:function(t,e){return"H"+a.round((t[0]+e[0])/2,2)+"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},vhv:function(t,e){return"V"+a.round((t[1]+e[1])/2,2)+"H"+a.round(e[0],2)+"V"+a.round(e[1],2)}},w=function(t,e){return"L"+a.round(e[0],2)+","+a.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var n="M"+a.round(t[0][0],2)+","+a.round(t[0][1],2),r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(s),c.extendFlat({},s)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=a.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":95,"../../lib":103,"../../lib/svg_text_utils":114,"../../plots/plots":144,"../../traces/scatter/make_bubble_size_func":251,"../../traces/scatter/subtypes":256,"../color":25,"../colorscale":39,"./symbol_defs":49,d3:16,"fast-isnumeric":18}],49:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:16}],50:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],51:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&-1!==["linear","log"].indexOf(n.type),c=[];if(s){for(var u=l(o),f=0;fl;l++)i[l]={x:n[l],y:a[l]};return i[0].trace=t,r.calc({calcdata:[i],_fullLayout:e}),i},r.plot=t("./plot"),r.style=t("./style"),r.hoverInfo=function(t,e,n){(e.error_y||{}).visible&&(n.yerr=t.yh-t.y,e.error_y.symmetric||(n.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(n.xerr=t.xh-t.x,e.error_x.symmetric||(n.xerrneg=t.x-t.xs))}},{"./attributes":50,"./calc":51,"./defaults":53,"./plot":55,"./style":56}],55:[function(t,e,n){"use strict";function r(t,e,n){var r={x:e.c2p(t.x),y:n.c2p(t.y)};return void 0!==t.yh&&(r.yh=n.c2p(t.yh),r.ys=n.c2p(t.ys),o(r.ys)||(r.noYS=!0,r.ys=n.c2p(t.ys,!0))),void 0!==t.xh&&(r.xh=e.c2p(t.xh),r.xs=e.c2p(t.xs),o(r.xs)||(r.noXS=!0,r.xs=e.c2p(t.xs,!0))),r}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../lib"),l=t("../../traces/scatter/subtypes");e.exports=function(t,e){var n=e.x(),s=e.y();t.each(function(t){var e=t[0].trace,c=e.error_x||{},u=e.error_y||{},f=l.hasMarkers(e)&&e.marker.maxdisplayed>0;if(u.visible||c.visible){var d=a.select(this).selectAll("g.errorbar").data(i.identity);d.enter().append("g").classed("errorbar",!0),d.each(function(t){var e=a.select(this),i=r(t,n,s);if(!f||t.vis){var l;if(u.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var d=u.width;l="M"+(i.x-d)+","+i.yh+"h"+2*d+"m-"+d+",0V"+i.ys,i.noYS||(l+="m-"+d+",0h"+2*d),e.append("path").classed("yerror",!0).attr("d",l)}if(c.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var h=(c.copy_ystyle?u:c).width;l="M"+i.xh+","+(i.y-h)+"v"+2*h+"m0,-"+h+"H"+i.xs,i.noXS||(l+="m0,-"+h+"v"+2*h),e.append("path").classed("xerror",!0).attr("d",l)}}})}})}},{"../../lib":103,"../../traces/scatter/subtypes":256,d3:16,"fast-isnumeric":18}],56:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":25,d3:16}],57:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":129}],58:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var l=0;2>l;l++){var s={_fullLayout:n},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,a=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],62:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":101,"../../plots/font_attributes":142,"../color/attributes":24}],63:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],64:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/plots"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n){function l(t,e){return r.coerce(d,h,o,t,e)}for(var s,c,u,f,d=t.legend||{},h=e.legend={},p=0,g="normal",m=0;m1);if(y!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),r.coerceFont(l,"font",e.font),l("orientation"),"h"===h.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(s=0,u="left",c=1.1,f="bottom"):(s=0,u="left",c=-.1,f="top")}l("traceorder",g),i.isGrouped(e.legend)&&l("tracegroupgap"),l("x",s),l("xanchor",u),l("y",c),l("yanchor",f),r.noneOrAll(d,h,["x","y"])}}},{"../../lib":103,"../../plots/plots":144,"./attributes":62,"./helpers":67}],65:[function(t,e,n){"use strict";function r(t,e){function n(n){u.util.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=d.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,a.legend.font).text(c),e._context.editable&&!l?f.call(u.util.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" "),u.restyle(e,"name",t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(d.traceIs(l,"pie")){var f=o.label,h=n.indexOf(f);-1===h?n.push(f):n.splice(h,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),h=d[0].length||1;n=s*h,r=u.node()&&p.bBox(u.node()).width;var g=s*(.3+(1-h)/2);u.attr("y",g),d.attr("y",g)}n=Math.max(n,16)+3,o.attr({x:0,y:-n/2,height:n}),a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=x.isGrouped(a);if(x.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),n.selectAll(".legendtoggle").attr("width",(t._context.editable?0:a.width)+40),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height);else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;d>u;u++){var h=s[u].map(function(t){return t[0].width}),p=40+Math.max.apply(null,h);a.width+=a.tracegroupgap+p,l.push(a.width)}e.each(function(t,e){f.setTranslate(this,l[e],0)}),e.each(function(){var t=c.select(this),e=t.selectAll("g.traces"),n=0;e.each(function(t){var e=t[0],r=e.height;f.setTranslate(this,0,5+o+n+r/2),n+=r}),a.height=Math.max(a.height,n)}),a.height+=10+2*o,a.width+=2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}else{a.width=0,a.height=0;var g=0,m=0,v=0,y=0;n.each(function(t){v=Math.max(40+t[0].width,v)}),n.each(function(t){var e=t[0],n=v,i=a.tracegroupgap||5;o+y+i+n>r.width-(r.margin.r+r.margin.l)&&(y=0,g+=m,a.height=a.height+m,m=0),f.setTranslate(this,o+y,5+o+e.height/2+g),a.width+=i+n,a.height=Math.max(a.height,e.height),y+=i+n,m=Math.max(e.height,m)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}}function l(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center");var a="top";b.isBottomAnchor(n)?a="bottom":b.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../dragelement"),p=t("../drawing"),g=t("../color"),m=t("./constants"),v=t("./get_legend_data"),y=t("./style"),x=t("./helpers"),b=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(p.setRect,j,t,m.scrollBarWidth,m.scrollBarHeight),M.select("rect").attr({y:x.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var x=n.legend,_=n.showlegend&&v(t.calcdata,x),w=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({"class":"legend","pointer-events":"all"});var M=n._topdefs.selectAll("#"+o).data([0]);M.enter().append("clipPath").attr("id",o).append("rect");var A=k.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(g.stroke,x.bordercolor),A.call(g.fill,x.bgcolor),A.style("stroke-width",x.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var z=T.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var C=0!==k.enter().size();C&&(i(t,z,S),l(t));var E=0,O=n.width,P=0,N=n.height;i(t,z,S),x.height>N?s(t):l(t);var D=n._size,I=D.l+D.w*x.x,R=D.t+D.h*(1-x.y);b.isRightAnchor(x)?I-=x.width:b.isCenterAnchor(x)&&(I-=x.width/2),b.isBottomAnchor(x)?R-=x.height:b.isMiddleAnchor(x)&&(R-=x.height/2);var j=x.width,F=D.w;j>F?(I=D.l,j=F):(I+j>O&&(I=O-j),E>I&&(I=E),j=Math.min(O-I,x.width));var q=x.height,B=D.h;q>B?(R=D.t,q=B):(R+q>N&&(R=N-q),P>R&&(R=P),q=Math.min(N-R,x.height)),f.setTranslate(k,I,R);var H,V,Z=q-m.scrollBarHeight-2*m.scrollBarMargin,U=x.height-q;if(x.height<=q||t._context.staticPlot)A.attr({width:j-x.borderwidth,height:q-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),f.setTranslate(T,0,0),M.select("rect").attr({width:j-2*x.borderwidth,height:q-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth}),T.call(p.setClipUrl,o);else{H=m.scrollBarMargin,V=T.attr("data-scroll")||0,A.attr({width:j-2*x.borderwidth+m.scrollBarWidth+m.scrollBarMargin,height:q-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),M.select("rect").attr({width:j-2*x.borderwidth+m.scrollBarWidth+m.scrollBarMargin,height:q-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth-V}),T.call(p.setClipUrl,o),C&&e(H,V),k.on("wheel",null),k.on("wheel",function(){V=f.constrain(T.attr("data-scroll")-c.event.deltaY/Z*U,-U,0),H=m.scrollBarMargin-V/U*Z,e(H,V),c.event.preventDefault()}),L.on(".drag",null),T.on(".drag",null);var Y=c.behavior.drag().on("drag",function(){H=f.constrain(c.event.y-m.scrollBarHeight/2,m.scrollBarMargin,m.scrollBarMargin+Z),V=-(H-m.scrollBarMargin)/Z*U,e(H,V)});L.call(Y),T.call(Y)}if(t._context.editable){var X,G,$,Q;k.classed("cursor-move",!0),h.init({element:k.node(),prepFn:function(){var t=f.getTranslate(k);$=t.x,Q=t.y},moveFn:function(t,e){var n=$+t,r=Q+e;f.setTranslate(k,n,r),X=h.align(n,0,D.l,D.l+D.w,x.xanchor),G=h.align(r,0,D.t+D.h,D.t,x.yanchor)},doneFn:function(e){e&&void 0!==X&&void 0!==G&&u.relayout(t,{"legend.x":X,"legend.y":G})}})}}}},{"../../lib":103,"../../plotly":121,"../../plots/plots":144,"../color":25,"../dragelement":46,"../drawing":48,"./anchor_utils":61,"./constants":63,"./get_legend_data":66,"./helpers":67,"./style":69,d3:16}],66:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[n]]):l[t].push([n]);else{var r="~~i"+f;s.push(r),l[r]=[[n]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;oo;o++)v=l[s[o]],y[o]=a.isReversed(e)?v.reverse():v;else{for(y=[new Array(x)],o=0;x>o;o++)v=l[s[o]][0],y[0][a.isReversed(e)?x-o-1:o]=v;x=1}return e._lgroupsLength=x,y}},{"../../plots/plots":144,"./helpers":67}],67:[function(t,e,n){"use strict";var r=t("../../plots/plots");n.legendGetsTrace=function(t){return t.visible&&r.traceIs(t,"showLegend")},n.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},n.isVertical=function(t){return"h"!==t.orientation},n.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":144}],68:[function(t,e,n){"use strict";var r=e.exports={};r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw"),r.style=t("./style")},{"./attributes":62,"./defaults":64,"./draw":65,"./style":69}],69:[function(t,e,n){"use strict";function r(t){var e=t[0].trace,n=e.visible&&e.fill&&"none"!==e.fill,r=h.hasLines(e),a=s.select(this).select(".legendfill").selectAll("path").data(n?[t]:[]);a.enter().append("path").classed("js-fill",!0),a.exit().remove(),a.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var o=s.select(this).select(".legendlines").selectAll("path").data(r?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(f.lineGroupStyle)}function a(t){function e(t,e,n){var r=c.nestedProperty(i,t).get(),a=Array.isArray(r)&&e?e(r):r;if(n){if(an[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),u=h.hasText(i),d=h.hasLines(i);if(l||u||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(o,p)],a=c.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../lib"),u=t("../../plots/plots"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":103,"../../plots/plots":144,"../../traces/pie/style_one":235,"../../traces/scatter/subtypes":256,"../color":25,"../drawing":48,d3:16}],70:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,f=(1+u)/2,d=(1-u)/2,h=c.Axes.list(t,null,!0),p=0;py;y++){var x=l[y];d=v[x]={};for(var b=0;b1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.Axes.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":103,"../color":25,"./attributes":73,"./button_attributes":74,"./constants":75}],77:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;re){var n=e;e=t,t=n}l.setAttributes(w,{"data-min":t,"data-max":e}),l.setAttributes(P,{x:t,width:e-t}),l.setAttributes(A,{width:t}),l.setAttributes(T,{x:e,width:p-e}),l.setAttributes(L,{transform:"translate("+(t-m-1)+")"}),l.setAttributes(C,{transform:"translate("+e+")"})}var f=t._fullLayout,d=f._infolayer.selectAll("g.range-slider"),h=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*h.thickness,m=2,v=Math.floor(h.borderwidth/2),y=f.margin.l,x=f.height-g-f.margin.b,b=0,_=p,w=document.createElementNS(i,"g");l.setAttributes(w,{"class":"range-slider","data-min":b,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+x+")"});var k=document.createElementNS(i,"rect"),M=h.borderwidth%2===0?h.borderwidth:h.borderwidth-1; -l.setAttributes(k,{fill:h.bgcolor,stroke:h.bordercolor,"stroke-width":h.borderwidth,height:g+M,width:p+M,transform:"translate(-"+v+", -"+v+")","shape-rendering":"crispEdges"});var A=document.createElementNS(i,"rect");l.setAttributes(A,{x:0,width:b,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(i,"rect");l.setAttributes(T,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var L=document.createElementNS(i,"g"),z=document.createElementNS(i,"rect"),S=document.createElementNS(i,"rect");l.setAttributes(L,{transform:"translate("+(b-m-1)+")"}),l.setAttributes(z,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),l.setAttributes(S,{width:m,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(L,[S,z]);var C=document.createElementNS(i,"g"),E=document.createElementNS(i,"rect"),O=document.createElementNS(i,"rect");l.setAttributes(C,{transform:"translate("+_+")"}),l.setAttributes(E,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),l.setAttributes(O,{width:m,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(C,[O,E]);var P=document.createElementNS(i,"rect");l.setAttributes(P,{x:b,width:_-b,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function n(t){var n,r,f=+t.clientX-o;switch(a){case P:w.style.cursor="ew-resize",n=+l+f,r=+s+f,u(n,r),c(e(n),e(r));break;case z:w.style.cursor="col-resize",n=+l+f,r=+s,u(n,r),c(e(n),e(r));break;case E:w.style.cursor="col-resize",n=+l,r=+s+f,u(n,r),c(e(n),e(r));break;default:w.style.cursor="ew-resize",n=i,r=i+f,u(n,r),c(e(n),e(r))}}function r(){window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r),w.style.cursor="auto"}var a=t.target,o=t.clientX,i=o-w.getBoundingClientRect().left,l=w.getAttribute("data-min"),s=w.getAttribute("data-max");window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)}),h.range||(h.range=a.getAutoRange(f.xaxis));var N=s(t,p,g);l.appendChildren(w,[k,N,A,T,P,L,C]),n(f.xaxis.range[0],f.xaxis.range[1]),d.data([0]).enter().append(function(){return h.setRange=n,w})}},{"../../constants/xmlns_namespaces":95,"../../lib":103,"../../plotly":121,"../../plots/cartesian/axes":124,"./helpers":83,"./range_plot":85}],82:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(t,e){return r.coerce(l,s,a,t,e)}if(t[n].rangeslider){var l=r.isPlainObject(t[n].rangeslider)?t[n].rangeslider:{},s=e[n].rangeslider={};if(i("bgcolor"),i("bordercolor"),i("borderwidth"),i("thickness"),i("visible"),i("range"),s.range&&!e[n].autorange){var c=s.range,u=e[n].range;c[0]=Math.min(c[0],u[0]),c[1]=Math.max(c[1],u[1])}else e[n]._needsExpand=!0;s.visible&&o.forEach(function(t){var n=e[t]||{};n.fixedrange=!0,e[t]=n})}}},{"../../lib":103,"./attributes":80}],83:[function(t,e,n){"use strict";n.setAttributes=function(t,e){for(var n in e)t.setAttribute(n,e[n])},n.appendChildren=function(t,e){for(var n=0;ns;s++){var c=l[s],u={_fullLayout:e},f=A.coerceRef(t,r,u,c);if("path"!==i){var d=.25,h=.75;if("paper"!==f){var p=A.getFromId(u,f),g=o(p);d=g(p.range[0]+d*(p.range[1]-p.range[0])),h=g(p.range[0]+h*(p.range[1]-p.range[0]))}n(c+"0",d),n(c+"1",h)}}return"path"===i?n("path"):M.noneOrAll(t,r,["x0","x1","y0","y1"]),r}function a(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function i(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function l(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function s(t,e,n){for(var r=0;re;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),C.draw(t,a)}function f(t,e,n,i){function l(n){var r={"data-index":e,"fill-rule":"evenodd",d:x(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",C.opacity).call(T.stroke,a).call(T.fill,C.fillcolor).call(L.dashLine,C.line.dash,C.line.width);E&&o.call(L.setClipUrl,"clip"+t._fullLayout._uid+E),t._context.editable&&d(t,o,C,e)}var s,c;h(t,e).selectAll('[data-index="'+e+'"]').remove();var u=t.layout.shapes[e];if(u){var f={xref:u.xref,yref:u.yref},g={};"string"==typeof n&&n?g[n]=i:M.isPlainObject(n)&&(g=n);var m=Object.keys(g);for(s=0;ss;s++){var b=y[s];if(void 0===g[b]&&void 0!==u[b]){var _,w=b.charAt(0),k=A.getFromId(t,A.coerceRef(f,{},t,w)),z=A.getFromId(t,A.coerceRef(u,{},t,w)),S=u[b];void 0!==g[w+"ref"]&&(k?(_=a(k)(S),S=(_-k.range[0])/(k.range[1]-k.range[0])):S=(S-z.domain[0])/(z.domain[1]-z.domain[0]),z?(_=z.range[0]+S*(z.range[1]-z.range[0]),S=o(z)(_)):S=k.domain[0]+S*(k.domain[1]-k.domain[0])),u[b]=S}}var C=r(u,t._fullLayout);t._fullLayout.shapes[e]=C;var E;if("below"!==C.layer)E=(C.xref+C.yref).replace(/paper/g,""),l(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)E="",l(t._fullLayout._shapeLowerLayer);else{var O,P=t._fullLayout._plots||{},N=Object.keys(P);for(s=0,c=N.length;c>s;s++)O=P[N[s]],E=N[s],p(t,C,O)&&l(O.shapelayer)}}}function d(t,e,n,r){function a(t){var n=W.right-W.left,r=W.bottom-W.top,a=t.clientX-W.left,o=t.clientY-W.top,i=n>G&&r>$&&!t.shiftKey?z.getCursor(a/n,1-o/r):"move";S(e,i),X=i.split("-")[0]}function o(e){B=A.getFromId(t,n.xref),H=A.getFromId(t,n.yref),V=v(t,B),Z=v(t,H,!0),U=y(t,B),Y=y(t,H,!0);var o="shapes["+r+"]";"path"===n.type?(F=n.path,q=o+".path"):(u=V(n.x0),f=Z(n.y0),d=V(n.x1),h=Z(n.y1),p=o+".x0",g=o+".y0",_=o+".x1",w=o+".y1"),d>u?(L=u,P=o+".x0",R="x0",C=d,N=o+".x1",j="x1"):(L=d,P=o+".x1",R="x1",C=u,N=o+".x0",j="x0"),h>f?(M=f,E=o+".y0",D="y0",T=h,O=o+".y1",I="y1"):(M=h,E=o+".y1",D="y1",T=f,O=o+".y0",I="y0"),c={},a(e),Q.moveFn="move"===X?l:s}function i(n){S(e),n&&k.relayout(t,c)}function l(r,a){if("path"===n.type){var o=function(t){return U(V(t)+r)};B&&"date"===B.type&&(o=m(o));var i=function(t){return Y(Z(t)+a)};H&&"date"===H.type&&(i=m(i)),n.path=b(F,o,i),c[q]=n.path}else c[p]=n.x0=U(u+r),c[g]=n.y0=Y(f+a),c[_]=n.x1=U(d+r),c[w]=n.y1=Y(h+a);e.attr("d",x(t,n))}function s(r,a){if("path"===n.type){var o=function(t){return U(V(t)+r)};B&&"date"===B.type&&(o=m(o));var i=function(t){return Y(Z(t)+a)};H&&"date"===H.type&&(i=m(i)),n.path=b(F,o,i),c[q]=n.path}else{var l=~X.indexOf("n")?M+a:M,s=~X.indexOf("s")?T+a:T,u=~X.indexOf("w")?L+r:L,f=~X.indexOf("e")?C+r:C;s-l>$&&(c[E]=n[D]=Y(l),c[O]=n[I]=Y(s)),f-u>G&&(c[P]=n[R]=U(u),c[N]=n[j]=U(f))}e.attr("d",x(t,n))}var c,u,f,d,h,p,g,_,w,M,T,L,C,E,O,P,N,D,I,R,j,F,q,B,H,V,Z,U,Y,X,G=10,$=10,Q={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Q.element.getBoundingClientRect();z.init(Q)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):M.log("getShapeLayer: undefined shape: index",e),r}function p(t,e,n){var r=k.Axes.getFromId(t,n.id,"x")._id,a=k.Axes.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function m(t){return function(e){return t(e).replace(" ","_")}}function v(t,e,n){var r,o=t._fullLayout._size;if(e){var i=a(e);r=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(r=g(r))}else r=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return r}function y(t,e,n){var r,a=t._fullLayout._size;if(e){var i=o(e);r=function(t){return i(e.p2l(t-e._offset))}}else r=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return r}function x(t,e){var n,r,o,i,l=e.type,s=A.getFromId(t,e.xref),c=A.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=a(s),r=function(t){return s._offset+s.l2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(o=a(c),i=function(t){return c._offset+c.l2p(o(t,!0))}):i=function(t){return u.t+u.h*(1-t)},"path"===l)return s&&"date"===s.type&&(r=g(r)),c&&"date"===c.type&&(i=g(i)),C.convertPath(e.path,r,i);var f=r(e.x0),d=r(e.x1),h=i(e.y0),p=i(e.y1);if("line"===l)return"M"+f+","+h+"L"+d+","+p;if("rect"===l)return"M"+f+","+h+"H"+d+"V"+p+"H"+f+"Z";var m=(f+d)/2,v=(h+p)/2,y=Math.abs(m-f),x=Math.abs(v-h),b="A"+y+","+x,_=m+y+","+v,w=m+","+(v-x);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function b(t,e,n){return t.replace(E,function(t){var r=0,a=t.charAt(0),o=P[a],i=N[a],l=D[a],s=t.substr(1).replace(O,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}function _(t,e,n,r,a){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(n)];if(r){var i,l,s,c,u,f=1/0,d=-(1/0),h=r.match(E);for("date"===t.type&&(o=g(o)),i=0;iu&&(f=u),u>d&&(d=u)));return d>=f?[f,d]:void 0}}var w=t("fast-isnumeric"),k=t("../../plotly"),M=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),L=t("../drawing"),z=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var n=t.shapes||[],a=e.shapes=[],o=0;ol&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),M.log("Ignoring extra params in segment "+t)),a+s})},C.calcAutorange=function(t){var e,n,r,a,o,i=t._fullLayout,l=i.shapes;if(l.length&&t._fullData.length)for(e=0;ed?n=d:(u.left-=x.offsetLeft,u.right-=x.offsetLeft,u.top-=x.offsetTop,u.bottom-=x.offsetTop,x.selection.each(function(){var t=s.bBox(this);l.bBoxIntersect(u,t,c)&&(n=Math.max(n,i*(t[x.side]-u[o])+c))}),n=Math.min(d,n)),n>0||0>d){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,S=E,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var E="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",z)}},{"../../lib":103,"../../lib/svg_text_utils":114,"../../plotly":121,"../../plots/plots":144,"../color":25,"../drawing":48,d3:16,"fast-isnumeric":18}],89:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:i,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":101,"../../plots/font_attributes":142,"../color/attributes":24}],90:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],91:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(s.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),s.exit().remove(),s.exit().size()&&v(t),0!==n.length){var c=s.selectAll("g."+T.headerGroupClassName).data(n,a);c.enter().append("g").classed(T.headerGroupClassName,!0);var u=s.selectAll("g."+T.buttonGroupClassName).data([0]);u.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&u.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){y.select(this).remove(),u.call(m).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],95:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],96:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.16.2",n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=r.register,n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=r.Snapshot,n.PlotSchema=r.PlotSchema,n.Queue=r.Queue,n.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":118,"./plot_api/to_image":119,"./plot_api/validate":120,"./plotly":121,"./snapshot/download":159,d3:16}],97:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],98:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)}},"boolean":{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(i(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n?!0:"string"!=typeof t?!1:!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var s=i[0].split("-");if(s.length>3||3!==s.length&&i[1])return!1;if(4===s[0].length)n=Number(s[0]);else{if(2!==s[0].length)return!1;var c=(new Date).getFullYear();n=((Number(s[0])-c+70)%100+200)%100+c-70}return l(n)?1===s.length?new Date(n,0,1).getTime():(r=Number(s[1])-1,s[1].length>2||!(r>=0&&11>=r)?!1:2===s.length?new Date(n,r,1).getTime():(a=Number(s[2]),s[2].length>2||!(a>=1&&31>=a)?!1:(a=new Date(n,r,a).getTime(),i[1]?(s=i[1].split(":"),s.length>3?!1:(o=Number(s[0]),s[0].length>2||!(o>=0&&23>=o)?!1:(a+=36e5*o,1===s.length?a:(r=Number(s[1]),s[1].length>2||!(r>=0&&59>=r)?!1:(a+=6e4*r,2===s.length?a:(t=Number(s[2]), -t>=0&&60>t?a+1e3*t:!1)))))):a))):!1},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){if("undefined"==typeof i)return void s.error("d3 is not defined.");e||(e=0);var n=new Date(t),a=i.time.format("%Y-%m-%d")(n);return 7776e6>e?(a+=" "+r(n.getHours(),2),432e6>e&&(a+=":"+r(n.getMinutes(),2),108e5>e&&(a+=":"+r(n.getSeconds(),2),3e5>e&&(a+="."+r(n.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var c={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"]},u={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"]},f=i.time.format.utc,d={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){d[t].D.push(f(e)),["H","I","D"].forEach(function(n){c[n].forEach(function(r){var a=d[t][n];a.push(f(e+"~"+r)),a.push(f(r+"~"+e))})})})});var h=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,m=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},x=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,k=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return M[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(h,p).replace(g,"").replace(m,"~").replace(v,y).replace(k,A).trim().replace(T,"");var e,n,r=null,i=a(t),l=o(t);e=d[i][l],n=e.length;for(var s=0;n>s&&!(r=e[s].parse(t));s++);if(!(r instanceof Date))return!1;var c=r.getTimezoneOffset();return r.setTime(r.getTime()+60*c*1e3),r}},{"../lib":103,d3:16,"fast-isnumeric":18}],100:[function(t,e,n){"use strict";var r=t("events").EventEmitter,a={init:function(t){if(t._ev instanceof r)return t;var e=new r;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(n,r){"undefined"!=typeof jQuery&&jQuery(t).trigger(n,r),e.emit(n,r)},t},triggerHandler:function(t,e,n){var r,a;"undefined"!=typeof jQuery&&(r=jQuery(t).triggerHandler(e,n));var o=t._ev;if(!o)return r;var i=o._events[e];if(!i)return r;"function"==typeof i&&(i=[i]);for(var l=i.pop(),s=0;sv;v++){s=t[v];for(c in s)u=g[c],f=s[c],l&&i(f)?g[c]=f:e&&f&&(o(f)||(d=i(f)))?(d?(d=!1,h=u&&i(u)?u:[]):h=u&&o(u)?u:{},g[c]=a([h,f],e,n,l)):("undefined"!=typeof f||n)&&(g[c]=f)}return g}var o=t("./is_plain_object.js"),i=Array.isArray;n.extendFlat=function(){return a(arguments,!1,!1,!1)},n.extendDeep=function(){return a(arguments,!0,!1,!1)},n.extendDeepAll=function(){return a(arguments,!0,!0,!1)},n.extendDeepNoArrays=function(){return a(arguments,!0,!1,!0)}},{"./is_plain_object.js":104}],102:[function(t,e,n){"use strict";e.exports=function(t){for(var e=[],n=0;nn?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.randstr=function d(t,e,n){if(n||(n=16),void 0===e&&(e=24),0>=e)return"0";var r,a,o,i=Math.log(Math.pow(2,e))/Math.log(n),l="";for(r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var s=i-Math.floor(i);for(r=0;r-1||c!==1/0&&c>=Math.pow(2,e)?d(t,e,n):l},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;s>n;n++)c[n]=(1-Math.cos(Math.PI*(n+1)/e))/(2*e);for(n=0;i>n;n++){for(o=0,r=0;s>r;r++)a=n+r+1-e,-i>a?a-=l*Math.round(a/l):a>=l&&(a-=l*Math.floor(a/l)),0>a?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;ra;a++)e[a][n]=t[a]},a.minExtend=function(t,e){var n={};"object"!=typeof e&&(e={});var r,o,i,l=3,s=Object.keys(t);for(r=0;r1?r+o[1]:"";if(a&&(o.length>1||i.length>4))for(;n.test(i);)i=i.replace(n,"$1"+a+"$2");return i+l}},{"./coerce":98,"./dates":99,"./extend":101,"./is_plain_object":104,"./loggers":105,"./matrix":106,"./nested_property":107,"./notifier":108,"./search":111,"./stats":113,d3:16}],104:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],105:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;er;r++)n[r]=new Array(e);return n},n.transposeRagged=function(t){var e,n,r=0,a=t.length;for(e=0;a>e;e++)r=Math.max(r,t[e].length);var o=new Array(r);for(e=0;r>e;e++)for(o[e]=new Array(a),n=0;a>n;n++)o[e][n]=t[n][e];return o},n.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var r,a,o=t.length;if(t[0].length)for(r=new Array(o),a=0;o>a;a++)r[a]=n.dot(t[a],e);else if(e[0].length){var i=n.transposeRagged(e);for(r=new Array(i.length),a=0;aa;a++)r+=t[a]*e[a];return r},n.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},n.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},n.rotationXYMatrix=function(t,e,r){return n.dot(n.dot(n.translationMatrix(e,r),n.rotationMatrix(t)),n.translationMatrix(-e,-r))},n.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var r=1===arguments.length?e[0]:[e[0],e[1]];return n.dot(t,[r[0],r[1],1]).slice(0,2)}},n.apply2DTransform2=function(t){var e=n.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],107:[function(t,e,n){"use strict";function r(t,e){return function(){var n,a,o,i,l,s=t;for(i=0;i=0;e--){if(r=t[e],i=!1,Array.isArray(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");ln||n>o||i>r||r>l?!1:!e||!c(t)}function n(t,e){var n=t[0],s=t[1];if(a>n||n>o||i>s||s>l)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;p>c;c++)if(u=g,f=m,g=r[c][0],m=r[c][1],d=Math.min(u,g),!(d>n||n>Math.max(u,g)||s>Math.max(f,m)))if(s=s&&n!==d&&v++}return v%2===1}var r=t.slice(),a=r[0][0],o=a,i=r[0][1],l=i;r.push(r[0]);for(var s=1;so;o++)if(i=[t[o][0]-s[0],t[o][1]-s[1]],l=r(i,c),0>l||l>u||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":106}],110:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;nt}function a(t,e){return e>=t}function o(t,e){return t>e}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("../lib");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;d>f&&h++<100;)c=Math.floor((f+d)/2),u(e[c],t)?f=c+1:d=c;return h>90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;r>l;l++)e[l+1]>e[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;o>a&&i++<100;)r=c((a+o)/2),e[r]<=t?a=r+l:o=r-s;return e[a]}},{"../lib":103,"fast-isnumeric":18}],112:[function(t,e,n){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],113:[function(t,e,n){"use strict";var r=t("fast-isnumeric");n.aggNums=function(t,e,a,o){var i,l;if(o||(o=a.length),r(e)||(e=!1),Array.isArray(a[0])){for(l=new Array(o),i=0;o>i;i++)l[i]=n.aggNums(t,e,a[i]);a=l}for(i=0;o>i;i++)r(e)?r(a[i])&&(e=t(+e,+a[i])):e=a[i];return e},n.len=function(t){return n.aggNums(function(t){return t+1},0,t)},n.mean=function(t,e){return e||(e=n.len(t)),n.aggNums(function(t,e){return t+e},0,t)/e},n.variance=function(t,e,a){return e||(e=n.len(t)),r(a)||(a=n.mean(t,e)),n.aggNums(function(t,e){return t+Math.pow(e-a,2)},0,t)/e},n.stdev=function(t,e,r){return Math.sqrt(n.variance(t,e,r))},n.interp=function(t,e){if(!r(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":18}],114:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,-1===m.indexOf(u.protocol)?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({"class":p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":94,"../constants/xmlns_namespaces":95,"../lib":103,d3:16}],115:[function(t,e,n){"use strict";function r(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function a(t){Array.isArray(t._promises)&&t._promises.length>0&&N.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),P.defaultConfig.setBackground(t,e)}function i(t,e){t._context||(t._context=N.extendFlat({},P.defaultConfig));var n=t._context;e&&(Object.keys(e).forEach(function(t){t in n&&("setBackground"===t&&"opaque"===e[t]?n[t]=o:n[t]=e[t])}),e.plot3dPixelRatio&&!n.plotGlPixelRatio&&(n.plotGlPixelRatio=n.plot3dPixelRatio)),n.staticPlot&&(n.editable=!1,n.autosizable=!1,n.scrollZoom=!1,n.doubleClick=!1,n.showTips=!1,n.showLink=!1,n.displayModeBar=!1)}function l(t,e,n){var r=C.select(t).selectAll(".plot-container").data([0]);r.enter().insert("div",":first-child").classed("plot-container plotly",!0);var a=r.selectAll(".svg-container").data([0]);a.enter().append("div").classed("svg-container",!0).style("position","relative"),a.html(""),e&&(t.data=e),n&&(t.layout=n),P.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(k(t,{}),t._fullLayout.autosize=n.autosize=!0),a.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=P.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},a.node()),t.framework.setUndoPoint();var o=t.framework.svg(),i=1,l=t._fullLayout.title;""!==l&&l||(i=0);var s="Click to enter title",c=function(){this.call(P.util.convertToTspans)},u=o.select(".title-group text").call(c);if(t._context.editable){u.attr({"data-unformatted":l}),l&&l!==s||(i=.2,u.attr({"data-unformatted":s}).text(s).style({opacity:i}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(P.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(c),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(c)})};u.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),R.addLinks(t),Promise.resolve()}function s(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var r=P.Axes.list({_fullLayout:t});for(e=0;ee;e++){var i=t.annotations[e];i.ref&&("paper"===i.ref?(i.xref="paper",i.yref="paper"):"data"===i.ref&&(i.xref="x",i.yref="y"),delete i.ref),c(i,"xref"),c(i,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(N.warn("Shapes must be an array."),delete t.shapes);var l=(t.shapes||[]).length;for(e=0;l>e;e++){var s=t.shapes[e];c(s,"xref"),c(s,"yref")}var u=t.legend;u&&(u.x>3?(u.x=1.02,u.xanchor="left"):u.x<-2&&(u.x=-.02,u.xanchor="right"),u.y>3?(u.y=1.02,u.yanchor="bottom"):u.y<-2&&(u.y=-.02,u.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=R.getSubplotIds(t,"gl3d");for(e=0;en;++n)x[n]=m[e]+v*y[2+4*n];h.camera={eye:{x:x[0],y:x[1],z:x[2]},center:{x:m[0],y:m[1],z:m[2]},up:{x:y[1],y:y[5],z:y[9]}},delete h.cameraposition}}return F.clean(t),t}function c(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=P.Axes.cleanId(n,r))}function u(t,e){for(var n=[],r=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),a=0;ao&&(l=N.randstr(r),-1!==n.indexOf(l));o++);i.uid=N.randstr(r),r.push(i.uid)}if(n.push(i.uid),"histogramy"===i.type&&"xbins"in i&&!("ybins"in i)&&(i.ybins=i.xbins,delete i.xbins),i.error_y&&"opacity"in i.error_y){var s=F.defaults,c=i.error_y.color||(R.traceIs(i,"bar")?F.defaultLine:s[a%s.length]);i.error_y.color=F.addOpacity(F.rgb(c),F.opacity(c)*i.error_y.opacity),delete i.error_y.opacity}if("bardir"in i&&("h"!==i.bardir||!R.traceIs(i,"bar")&&"histogram"!==i.type.substr(0,9)||(i.orientation="h",_(i)),delete i.bardir),"histogramy"===i.type&&_(i),"histogramx"!==i.type&&"histogramy"!==i.type||(i.type="histogram"),"scl"in i&&(i.colorscale=i.scl,delete i.scl),"reversescl"in i&&(i.reversescale=i.reversescl,delete i.reversescl),i.xaxis&&(i.xaxis=P.Axes.cleanId(i.xaxis,"x")),i.yaxis&&(i.yaxis=P.Axes.cleanId(i.yaxis,"y")),R.traceIs(i,"gl3d")&&i.scene&&(i.scene=R.subplotsRegistry.gl3d.cleanId(i.scene)),R.traceIs(i,"pie")||(Array.isArray(i.textposition)?i.textposition=i.textposition.map(f):i.textposition&&(i.textposition=f(i.textposition))),R.traceIs(i,"2dMap")&&("YIGnBu"===i.colorscale&&(i.colorscale="YlGnBu"),"YIOrRd"===i.colorscale&&(i.colorscale="YlOrRd")),R.traceIs(i,"markerColorscale")&&i.marker){var u=i.marker;"YIGnBu"===u.colorscale&&(u.colorscale="YlGnBu"),"YIOrRd"===u.colorscale&&(u.colorscale="YlOrRd")}if("surface"===i.type&&N.isPlainObject(i.contours)){var h=["x","y","z"];for(o=0;or?o.push(a+r):o.push(r);return o}function g(t,e,n){var r,a;for(r=0;r=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||0>a&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function m(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&g(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function v(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&s0){var l=w(t._boundingBoxMargins),s=l.left+l.right,c=l.bottom+l.top,u=o._container.node().getBoundingClientRect(),f=1-2*i.frameMargins;a=Math.round(f*(u.width-s)),r=Math.round(f*(u.height-c))}else n=window.getComputedStyle(t),r=parseFloat(n.height)||o.height,a=parseFloat(n.width)||o.width;return Math.abs(o.width-a)>1||Math.abs(o.height-r)>1?(o.height=t.layout.height=r,o.width=t.layout.width=a):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),R.sanitizeMargins(o),e}function M(t){var e=C.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===n.autosize&&(k(t,{}),n.autosize=!0,t.layout.autosize=!0),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];C.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=N.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0);var o=P.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),n._has("cartesian")&&T(t,o),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var i=n._paper.selectAll(".layer-subplot");n._imageSubplotLayer=i.selectAll(".imagelayer"),n._shapeSubplotLayer=i.selectAll(".shapelayer");var l=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=l.append("g").classed("imagelayer",!0),n._shapeUpperLayer=l.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var s=N.syncOrAsync([L,function(){return P.Axes.doTicks(t,"redraw")},j.init],t);return s&&s.then&&t._promises.push(s),s}function A(t,e){function n(e,n){return function(){return P.Axes.getFromId(t,e,n)}}for(var r,a,o=t._fullLayout._plots={},i=0;i0,_=P.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),k=w===_;b?t.framework===M&&!x&&k||(t.framework=M,M(t)):k?x&&M(t):(t.framework=M,M(t)),x&&P.Axes.saveRangeInitial(t);var A=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&h(t);for(var z=0;zG.range[0]?[1,2]:[2,1]);else{var Q=G.range[0],W=G.range[1];"log"===j?(0>=Q&&0>=W&&o(U+".autorange",!0),0>=Q?Q=W/1e6:0>=W&&(W=Q/1e6),o(U+".range[0]",Math.log(Q)/Math.LN10),o(U+".range[1]",Math.log(W)/Math.LN10)):(o(U+".range[0]",Math.pow(10,Q)),o(U+".range[1]",Math.pow(10,W)))}else o(U+".autorange",!0)}if("reverse"===B)Y.range?Y.range.reverse():(o(U+".autorange",!0),Y.range=[1,0]),X.autorange?w=!0:_=!0;else if("annotations"===D.parts[0]||"shapes"===D.parts[0]){var J=D.parts[1],K=D.parts[0],tt=g[K]||[],et=P[N.titleCase(K)],nt=tt[J]||{};2===D.parts.length&&("add"===v[E]||N.isPlainObject(v[E])?z[E]="remove":"remove"===v[E]?-1===J?(z[K]=tt,delete z[E]):z[E]=nt:N.log("???",v)),!i(nt,"x")&&!i(nt,"y")||N.containsAny(E,["color","opacity","align","dash"])||(w=!0),et.draw(t,J,D.parts.slice(2).join("."),v[E]), -delete v[E]}else if("images"===D.parts[0]){var at=N.objectFromPath(E,j);N.extendDeepAll(t.layout,at),H.supplyLayoutDefaults(t.layout,t._fullLayout),H.draw(t)}else if("mapbox"===D.parts[0]&&"layers"===D.parts[1]){N.extendDeepAll(t.layout,N.objectFromPath(E,j));var ot=(t._fullLayout.mapbox||{}).layers||[];for(O=D.parts[2]+1-ot.length,p=0;O>p;p++)ot.push({});_=!0}else if("updatemenus"===D.parts[0]){N.extendDeepAll(t.layout,N.objectFromPath(E,j));var it=t._fullLayout.updatemenus||[];for(O=D.parts[2]+1-it.length,p=0;O>p;p++)it.push({});_=!0}else 0===D.parts[0].indexOf("scene")?_=!0:0===D.parts[0].indexOf("geo")?_=!0:0===D.parts[0].indexOf("ternary")?_=!0:!m._has("gl2d")||-1===E.indexOf("axis")&&"plot_bgcolor"!==D.parts[0]?"hiddenlabels"===E?w=!0:-1!==D.parts[0].indexOf("legend")?y=!0:-1!==E.indexOf("title")?x=!0:-1!==D.parts[0].indexOf("bgcolor")?b=!0:D.parts.length>1&&N.containsAny(D.parts[1],["tick","exponent","grid","zeroline"])?x=!0:-1!==E.indexOf(".linewidth")&&-1!==E.indexOf("axis")?x=b=!0:D.parts.length>1&&-1!==D.parts[1].indexOf("line")?b=!0:D.parts.length>1&&"mirror"===D.parts[1]?x=b=!0:"margin.pad"===E?x=b=!0:"margin"===D.parts[0]||"autorange"===D.parts[1]||"rangemode"===D.parts[1]||"type"===D.parts[1]||"domain"===D.parts[1]||E.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(E)?M=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(E)&&(_=!0):_=!0,D.set(j)}I.add(t,rt,[t,z],rt,[t,T]),v.autosize&&(v=k(t,v)),(v.height||v.width||v.autosize)&&(w=!0);var lt=Object.keys(v),st=[R.previousPromises];if(_||w)st.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),P.plot(t,"",g)});else if(lt.length&&(R.supplyDefaults(t),m=t._fullLayout,y&&st.push(function(){return V.draw(t),R.previousPromises(t)}),b&&st.push(L),x&&st.push(function(){return P.Axes.doTicks(t,"redraw"),S(t),R.previousPromises(t)}),M)){var ct;for($(t),P.Fx.supplyLayoutDefaults(t.layout,m,t._fullData),P.Fx.init(t),ct=R.getSubplotIds(m,"gl3d"),p=0;p1)};c(n.width)&&c(n.height)||l(new Error("Height and width should be pixel values."));var u=r.clone(e,{format:"png",height:n.height,width:n.width}),f=u.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var d=r.getRedrawFunc(f);o.plot(f,u.data,u.layout,u.config).then(d).then(s).then(function(e){t(e)}).catch(function(t){l(t)})});return l}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib");e.exports=r},{"../lib":103,"../plotly":121,"../snapshot":161,"fast-isnumeric":18}],120:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;m>v;v++){var y=n[v],x=["data",v];if(p(y)){var b=u[v],_=b.type,w=l.traces[_].attributes;w.type={valType:"enumerated",values:[_]},b.visible===!1&&y.visible!==!1&&s.push(i("invisible",x)),r(y,b,w,s,x);var k=y.transforms,M=b.transforms;if(k){g(k)||s.push(i("array",x,["transforms"])),x.push("transforms");for(var A=0;Ac&&u>e&&(void 0===a[n]?o[f]=T.tickText(t,e):o[f]=l(t,e,String(a[n])),f++);return f=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function i(t,e){var n=t.match(B),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(B,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o=e.x,l=t._tickround,s=new Date(o),c="";n&&t.hoverformat?a=i(t.hoverformat,o):t.tickformat?a=i(t.tickformat,o):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[l]),"y"===l?a=D(s):"m"===l?a=I(s):(o!==t._tmin||n||(c="
"+D(s)),"d"===l?a=R(s):"H"===l?a=j(s):(o!==t._tmin||n||(c="
"+R(s)+", "+D(s)),a=F(s),"M"!==l&&(a+=q(s),"S"!==l&&(a+=d(v(o/1e3,1),t,"none",n).substr(1)))))),e.text=a+c}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>i?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=0>t,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat;if(r){var u={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(u),i=(Number(u._tickround)||0)+4,s=u._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),f>t)t="0",a=!1;else{if(t+=f,s&&(t*=Math.pow(10,-s),i+=s),0===i)t=String(Math.floor(t));else if(0>i){t=String(Math.round(t)),t=t.substr(0,t.length+i);for(var d=i;0>d;d++)t+="0"}else{t=String(t);var h=t.indexOf(".")+1;h&&(t=t.substr(0,h+i).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(s&&"hide"!==l){var p;p=0>s?"\u2212"+-s:"power"!==l?"+"+s:String(s),"e"===l||("SI"===l||"B"===l)&&(s>12||-15>s)?t+="e"+p:"E"===l?t+="E"+p:"power"===l?t+="\xd710"+p+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=H[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var p=r-1,g=r+1;n="tozero"===t.rangemode?0>r?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var n=T.list(t,"",!0),r=!1,a=0;ap&&(p=g/10),c=t.c2l(p),u=t.c2l(g),y&&(c=Math.min(0,c),u=Math.max(0,u)),r(c)){for(h=!0,i=0;i=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;6>o;o++)a(o);for(o=m-1;o>5;o--)a(o)}},T.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,i]};T.autoTicks(f,l);var d,h=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;yg&&(p>.3*b||a(o)||a(i))){var w=f.dtick/2;h+=o>h+w?w:-w}var k=1+Math.floor((i-h)/f.dtick);d=h+k*f.dtick}else for(d=h;i>=d;)d=T.tickIncrement(d,f.dtick);return{start:h,end:d,size:f.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return r(t);if("auto"===t.tickmode||!t.dtick){var e,n=t.nticks;n||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/e):(e="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var a=t.range[1]=l:l>=s)&&(i.push(s),!(i.length>1e3));s=T.tickIncrement(s,t.dtick,a));t._tmax=i[i.length-1];for(var c=new Array(i.length),u=0;u157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,S)):e>12096e5?(e/=26298e5,t.dtick="M"+a(e,1,C)):e>432e5?(t.dtick=a(e,864e5,O),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=a(e,36e5,C):e>3e4?t.dtick=a(e,6e4,E):e>500?t.dtick=a(e,1e3,E):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?N:P,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]r:r>c;)c=T.tickIncrement(c,a,e);return c}if("L"===u)return Math.log(n((Math.pow(10,r)-o)/f)*f+o)/Math.LN10;if("D"===u){var d="D2"===a?N:P,h=_.roundUp(v(r,1),d,e);return Math.floor(r)+Math.log(y.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(a)};var D=y.time.format("%Y"),I=y.time.format("%b %Y"),R=y.time.format("%b %-d"),j=y.time.format("%b %-d %Hh"),F=y.time.format("%H:%M"),q=y.time.format(":%S"),B=/%(\d?)f/g;T.tickText=function(t,e,n){function r(r){var a;return void 0===r?!0:n?"none"===r:(a={first:t._tmin,last:t._tmax}[r],"all"!==r&&e!==a)}var a,o,i=l(t,e),d="array"===t.tickmode,h=n||d;if(d&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&en&&(M=90),a(u,M)}c._lastangle=M}return i(e),e+" done"}function s(){c._boundingBox=n.node().getBoundingClientRect()}var u=n.selectAll("g."+C).data(z,S);if(!c.showticklabels||!x(r))return u.remove(),void i(e);var f,d,p,v,b;"x"===m?(b="bottom"===q?1:-1,f=function(t){return t.dx+D*b},v=r+(N+P)*b,d=function(t){return t.dy+v+t.fontSize*("bottom"===q?1:-.5)},p=function(t){return x(t)&&0!==t&&180!==t?0>t*b?"end":"start":"middle"}):(b="right"===q?1:-1,d=function(t){return t.dy+t.fontSize/2-D*b},f=function(t){return t.dx+r+(N+P+(90===Math.abs(c.tickangle)?t.fontSize/2:0))*b},p=function(t){return x(t)&&90===Math.abs(t)?"middle":"right"===q?"start":"end"});var k=0,M=0,T=[];u.enter().append("g").classed(C,1).append("text").attr("text-anchor","middle").each(function(e){var n=y.select(this),r=t._promises.length;n.call(A.setPosition,f(e),d(e)).call(A.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),r=t._promises[r],r?T.push(t._promises.pop().then(function(){a(n,c.tickangle)})):a(n,c.tickangle)}),u.exit().remove(),u.each(function(t){k=Math.max(k,t.fontSize)}),a(u,c._lastangle||c.tickangle);var L=_.syncOrAsync([o,l,s]);return L&&L.then&&t._promises.push(L),L}function i(e){if(!n){var r,a,o,i,l=L.getFromId(t,e),s=y.select(t).selectAll("g."+e+"tick"),c={selection:s,side:l.side},f=e.charAt(0),d=t._fullLayout._size,h=1.5,p=l.titlefont.size;if(s.size()){var g=y.select(s.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);g&&(c.offsetLeft=+g[1],c.offsetTop=+g[2])}"x"===f?(a="free"===l.anchor?{_offset:d.t+(1-(l.position||0))*d.h,_length:0}:L.getFromId(t,l.anchor),o=l._offset+l._length/2,i=a._offset+("top"===l.side?-10-p*(h+(l.showticklabels?1:0)):a._length+10+p*(h+(l.showticklabels?1.5:.5))),l.rangeslider&&l.rangeslider.visible&&l._boundingBox&&(i+=(u.height-u.margin.b-u.margin.t)*l.rangeslider.thickness+l._boundingBox.height),c.side||(c.side="bottom")):(a="free"===l.anchor?{_offset:d.l+(l.position||0)*d.w,_length:0}:L.getFromId(t,l.anchor),i=l._offset+l._length/2,o=a._offset+("right"===l.side?a._length+10+p*(h+(l.showticklabels?1:.5)):-10-p*(h+(l.showticklabels?.5:0))),r={rotate:"-90",offset:0},c.side||(c.side="left")),k.draw(t,e+"title",{propContainer:l,propName:l._name+".title",dfltName:f.toUpperCase()+" axis",avoid:c,transform:r,attributes:{x:o,y:i,"text-anchor":"middle"}})}}function l(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:b.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[m]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===m}function s(e,n,a){var o=e.gridlayer,i=e.zerolinelayer,s=e["hidegrid"+m]?[]:H,u=c._gridpath||"M0,0"+("x"===m?"v":"h")+n._length,f=o.selectAll("path."+E).data(c.showgrid===!1?[]:s,S);if(f.enter().append("path").classed(E,1).classed("crisp",1).attr("d",u).each(function(t){c.zeroline&&("linear"===c.type||"-"===c.type)&&Math.abs(t.x)g;g++){var y=c.mirrors[i._id+d[g]];"ticks"!==y&&"labels"!==y||(f[g]=!0)}return void 0!==r[2]&&(f[2]=!0),f.forEach(function(t,e){var n=r[e],a=B[e];t&&x(n)&&(h+=p(n+P*a,a*c.ticklen))}),a(n,h),s(e,i,t),o(n,r[3])}}).filter(function(t){return t&&t.then});return Z.length?Promise.all(Z):0},T.swap=function(t,e){for(var n=h(t,e),r=0;r2*r}function u(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var f=t("fast-isnumeric"),d=t("tinycolor2").mix,h=t("../../lib"),p=t("../plots"),g=t("../../components/color/attributes").lightFraction,m=t("./layout_attributes"),v=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),x=t("./tick_label_defaults"),b=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),k=t("./clean_datum"),M=t("./axis_ids");e.exports=function(t,e,n,a){function o(n,r){return h.coerce2(t,e,m,n,r)}var i=a.letter,l=a.font||{},s="Click to enter "+(a.title||i.toUpperCase()+" axis")+" title";a.name&&(e._name=a.name,e._id=M.name2id(a.name));var c=n("type");"-"===c&&(r(e,a.data),"-"===e.type?e.type="linear":c=t.type=e.type),_(e);var u=n("color"),p=u===t.color?u:l.color;n("title",s),h.coerceFont(n,"titlefont",{family:l.family,size:Math.round(1.2*l.size),color:p});var k=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),A=n("autorange",!k);A&&n("rangemode");var T=n("range",[-1,"x"===i?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),h.noneOrAll(t.range,e.range,[0,1]),n("fixedrange"),v(t,e,n,c),x(t,e,n,c,a),y(t,e,n,a),b(t,e,n);var L=o("linecolor",u),z=o("linewidth"),S=n("showline",!!L||!!z);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&n("mirror");var C=o("gridcolor",d(u,a.bgColor,g).toRgbString()),E=o("gridwidth"),O=n("showgrid",a.showGrid||!!C||!!E);O||(delete e.gridcolor,delete e.gridwidth);var P=o("zerolinecolor",u),N=o("zerolinewidth"),D=n("zeroline",a.showGrid||!!P||!!N);return D||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===c?w(i,e.categoryorder,e.categoryarray,a.data):[],e}},{"../../components/color/attributes":24,"../../lib":103,"../plots":144,"./axis_ids":126,"./category_order_defaults":127,"./clean_datum":128,"./layout_attributes":133,"./ordered_categories":135,"./set_convert":138,"./tick_label_defaults":139,"./tick_mark_defaults":140,"./tick_value_defaults":141,"fast-isnumeric":18,tinycolor2:20}],126:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],128:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return a.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){a.error(e,t)}return t}},{"../../lib":103,"fast-isnumeric":18}],129:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],130:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?u.ms2DateTime(r,a):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/setcursor"),g=t("../../components/dragelement"),m=t("./axes"),v=t("./select"),y=t("./constants"),x=!0;e.exports=function(t,e,n,l,b,_,w,k){function M(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+gt+")").attr("d",st+"Z"),dt=ht.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+gt+")").attr("d","M0,0Z"),L();for(var o=0;oa?(ut="",it.r=it.l,it.t=it.b,dt.attr("d","M0,0Z")):(it.t=0,it.b=V,ut="x",dt.attr("d","M"+(it.l-.5)+","+(ot-U-.5)+"h-3v"+(2*U+1)+"h3ZM"+(it.r+.5)+","+(ot-U-.5)+"h3v"+(2*U+1)+"h-3Z")):!W||a.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function S(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),x=!1)))}function E(e,n){var a=1===(w+k).length;if(e)I();else if(2!==n||a){if(1===n&&a){var o=w?B[0]:q[0],i="s"===w||"w"===k?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",d="middle";if(o.fixedrange)return;w?(d="n"===w?"top":"bottom","right"===o.side&&(u="right")):"e"===k&&(u="right"),et.call(f.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:d}).on("edit",function(e){var n="category"===o.type?o.c2l(e):o.d2l(e);void 0!==n&&c.relayout(t,l,n)})}}else D()}function O(e){function n(t,e,n){if(!t.fixedrange){A(t.range);var r=t.range,a=r[0]+(r[1]-r[0])*e;t.range=[a+(r[0]-a)*n,a+(r[1]-a)*n]}}if(t._context.scrollZoom||j._enablescrollzoom){var r=t.querySelector(".plotly");if(!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(vt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void u.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=mt[0]+mt[2]*s,f=(l.bottom-e.clientY)/l.height,d=mt[1]+mt[3]*(1-f);if(k){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,n){for(var a=1-e,o=0,i=0;i0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rT;T++){var L=o[T],z=h[L];if(z)M[T]=w.getFromId(t,z.xaxis._id),A[T]=w.getFromId(t,z.yaxis._id);else{var S=i[L]._subplot;M[T]=S.xaxis,A[T]=S.yaxis}}var C=e.hovermode||i.hovermode;if(-1===["x","y","closest"].indexOf(C)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var E,O,P,N,D,I,R,j,F,q,B,H,V=[],Z=[];if(Array.isArray(e))for(C="array",P=0;PU||U>X.width||0>Y||Y>X.height)return _.unhoverRaw(t,e)}else U="xpx"in e?e.xpx:M[0]._length/2,Y="ypx"in e?e.ypx:A[0]._length/2;if(E="xval"in e?r(o,e.xval):a(M,U),O="yval"in e?r(o,e.yval):a(A,Y),!g(E[0])||!g(O[0]))return m.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var G=1/0;for(N=0;N1||-1!==I.hoverinfo.indexOf("name")?I.name:void 0,index:!1,distance:Math.min(G,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},H=V.length,"array"===j){var $=e[N];"pointNumber"in $?(B.index=$.pointNumber,j="closest"):(j="","xval"in $&&(F=$.xval,j="x"),"yval"in $&&(q=$.yval,j=j?"closest":"y"))}else F=E[R],q=O[R];if(I._module&&I._module.hoverPoints){var Q=I._module.hoverPoints(B,F,q,j);if(Q)for(var W,J=0;JH&&(V.splice(0,H),G=V[0].distance)}if(0===V.length)return _.unhoverRaw(t,e);var K="y"===C&&Z.length>1;V.sort(function(t,e){return t.distance-e.distance});var tt=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),et={hovermode:C,rotateLabels:K,bgColor:tt,container:i._hoverlayer,outerContainer:i._paperdiv},nt=c(V,et);u(V,K?"xa":"ya"),f(nt,K);var rt=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*O):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,L=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),N=L.width+E+O+m;t.ty0=_-L.top,t.bx=L.width+2*O,t.by=L.height+2*O,t.anchor="start",t.txwidth=L.width,t.tx2width=m,t.offset=0,o?(t.pos=z,v=M>=S+P/2+N,k=S-P/2-N>=0,"top"!==t.idealAlign&&v||!k?v?(S+=P/2,t.anchor="start"):t.anchor="middle":(S-=P/2,t.anchor="end")):(t.pos=S,v=w>=z+C/2+N,k=z-C/2-N>=0,"left"!==t.idealAlign&&v||!k?v?(z+=C/2,t.anchor="start"):t.anchor="middle":(z-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+S+")"+(o?"rotate("+T+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(.01>o)){if(-.01>a){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(0>=c);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=c);i++)if(s=t[i],s.pos=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(0>=c);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?z:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(E+O),l=i+o*(t.txwidth+O),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=t.offset*S),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*E+s)+","+(E+c)+"v"+(t.by/2-E)+"h"+r*t.bx+"v-"+t.by+"H"+(r*E+s)+"V"+(c-E)+"Z"), -a.call(b.setPosition,i+s,c+t.ty0-t.by/2+O).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*O+s,c+t.ty0-t.by/2+O),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,n){function r(n,r){return m.coerce(t,e,A.layoutAttributes,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},A.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indext*e||0===t?k.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":25,"../../components/dragelement":46,"../../components/drawing":48,"../../lib":103,"../../lib/events":100,"../../lib/svg_text_utils":114,"./axes":124,"./constants":129,"./dragbox":130,d3:16,"fast-isnumeric":18,tinycolor2:20}],132:[function(t,e,n){"use strict";var r=t("../plots"),a=t("./constants");n.name="cartesian",n.attr=["xaxis","yaxis"],n.idRoot=["x","y"],n.idRegex=a.idRegex,n.attrRegex=a.attrRegex,n.attributes=t("./attributes"),n.plot=function(t){function e(t,e){for(var n=[],r=0;rf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":103,"fast-isnumeric":18}],137:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.x()._offset,y=a.plotinfo.y()._offset,x=e-m.left,b=n-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var C,E,O,P,N,D=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,j=[];for(C=0;C0)return Math.log(e)/Math.LN10;if(0>=e&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*u*Math.abs(r-a))}return i.BADNUM}function n(t){return Math.pow(10,t)}function c(t){return a(t)?Number(t):i.BADNUM}var u=10;if(t.c2l="log"===t.type?e:c,t.l2c="log"===t.type?n:c,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var r=s.getFromId(t._gd,t.overlaying);t.domain=r.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)a(t.range[e])||(t.range[e]=a(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):i.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=c,t.d2c=function(t){return t=l(t),a(t)?Number(t):i.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return a(t)?o.ms2DateTime(t):i.BADNUM},t.d2c=function(t){return a(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!a(t.range[0])&&a(f[0])&&(t.range[0]=f[0]),!a(t.range[1])&&a(f[1])&&(t.range[1]=f[1])}catch(d){o.error(d,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var n=t._categories.indexOf(e);return-1===n?i.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&a(t,i),l.text(i.text()&&c.text()?" - ":"")},h.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=h.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},h.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},a=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];h.supplyLayoutGlobalDefaults(a,r),r._dataLength=s.length,h.supplyDataDefaults(s,l,r),r._has=h._hasPlotType.bind(r);var c=r._modules;for(e=0;eo&&(e=(n-1)/(a.l+a.r),a.l=Math.floor(e*a.l),a.r=Math.floor(e*a.r)),0>i&&(e=(r-1)/(a.t+a.b),a.t=Math.floor(e*a.t),a.b=Math.floor(e*a.b))}},h.autoMargin=function(t,e,n){var r=t._fullLayout;if(r._pushmargin||(r._pushmargin={}),r.margin.autoexpand!==!1){if(n){var a=void 0===n.pad?12:n.pad;n.l+n.r>.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||h.doAutoMargin(t)}},h.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;return e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,t._replotting||"{}"===r||r===JSON.stringify(e._size)?void 0:u.plot(t)},h.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null; -if(f.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?f.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&h.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)}},{"../components/color":25,"../lib":103,"../plotly":121,"./attributes":122,"./font_attributes":142,"./layout_attributes":143,d3:16,"fast-isnumeric":18}],145:[function(t,e,n){"use strict";var r=t("../../traces/scatter/attributes"),a=r.marker;e.exports={r:r.r,t:r.t,marker:{color:a.color,size:a.size,symbol:a.symbol,opacity:a.opacity}}},{"../../traces/scatter/attributes":237}],146:[function(t,e,n){"use strict";function r(t,e){var n={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,n)}var a=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,i=o({},a.domain,{});e.exports={radialaxis:r("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:i,orientation:{valType:"number"}}),angularaxis:r("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:i}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":101,"../cartesian/layout_attributes":133}],147:[function(t,e,n){var r=t("../../plotly"),a=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},i=r.Lib.extendDeepAll;o.Axis=function(){function t(t){n=t||n;var c=s.data,f=s.layout;return("string"==typeof n||n.nodeName)&&(n=a.select(n)),n.datum(c).each(function(t,n){function s(t,e){return l(t)%360+f.orientation}var c=t.slice();u={data:o.util.cloneJson(c),layout:o.util.cloneJson(f)};var d=0;c.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[d],d=(d+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:a.rgb(t.color).darker().toString()),u.data[e].color=t.color,u.data[e].strokeColor=t.strokeColor,u.data[e].strokeDash=t.strokeDash,u.data[e].strokeSize=t.strokeSize});var h=c.filter(function(t,e){var n=t.visible;return"undefined"==typeof n||n===!0}),p=!1,g=h.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var m=a.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(g),v=[],y=m.map(function(t,e){if("unstacked"===t.key)return t.values;var n=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,r){t.yStack=[n],v.push(n),n=o.util.sumArrays(t.r,n)}),t.values});h=a.merge(y)}h.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var x=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;x=Math.max(10,x);var b,_=[f.margin.left+x,f.margin.top+x];if(p){var w=a.max(o.util.sumArrays(o.util.arrayLast(h).r[0],o.util.arrayLast(v)));b=[0,w]}else b=a.extent(o.util.flattenArray(h.map(function(t,e){return t.r})));f.radialAxis.domain!=o.DATAEXTENT&&(b[0]=0),r=a.scale.linear().domain(f.radialAxis.domain!=o.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:b).range([0,x]),u.layout.radialAxis.domain=r.domain();var k,M=o.util.flattenArray(h.map(function(t,e){return t.t})),A="string"==typeof M[0];A&&(M=o.util.deduplicate(M),k=M.slice(),M=a.range(M.length),h=h.map(function(t,e){var n=t;return t.t=[M],p&&(n.yStack=t.yStack),n}));var T=h.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===h.length,L=null===f.needsEndSpacing?A||!T:f.needsEndSpacing,z=f.angularAxis.domain&&f.angularAxis.domain!=o.DATAEXTENT&&!A&&f.angularAxis.domain[0]>=0,S=z?f.angularAxis.domain:a.extent(M),C=Math.abs(M[1]-M[0]);T&&!A&&(C=0);var E=S.slice();L&&A&&(E[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(E[1]-E[0])/O);var P=f.angularAxis.ticksStep||(E[1]-E[0])/(O*(f.minorTicks+1));k&&(P=Math.max(Math.round(P),1)),E[2]||(E[2]=P);var N=a.range.apply(this,E);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=a.scale.linear().domain(E.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?C:0,e=a.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var D="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(D,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=a.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,F=e.select(".chart-group"),q={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=o.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});o.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:j,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=j.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),j.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Z=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Z[0]=Math.max(0,Z[0]),Z[1]=Math.max(0,Z[1]),e.select(".outer-group").attr("transform","translate("+Z+")"),f.title){var U=e.select("g.title-group text").style(B).text(f.title),Y=U.node().getBBox();U.attr({x:_[0]-Y.width/2,y:_[1]-x-20})}var X=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var G=X.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({"class":"grid-circle"}).style(q),G.attr("r",r),G.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(q);var $=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=a.svg.axis().scale(r).ticks(5).tickSize(5);X.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(q),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(q),J.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=W.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?270>n&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(180>=n&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=a.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=a.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return i(o[n].defaultConfig(),t)});o[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=o.tooltipPanel().config({container:ct,fontSize:8})(),ft=o.tooltipPanel().config({container:ct,fontSize:8})(),dt=o.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos($).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=o.util.convertToCartesian(x+12,n+180);ut.text(o.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos($).radius;pt.attr({r:n}).style({opacity:.5}),lt=r.invert(o.util.getMousePos($).radius);var a=o.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(o.util.round(lt)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var r=a.select(this),i=r.style("fill"),l="black",s=r.style("opacity")||1;if(r.attr({"data-opacity":s}),"none"!=i){r.attr({"data-fill":i}),l=a.hsl(i).darker().toString(),r.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-Z[0]-d.left,f.top+f.height/2-Z[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else i=r.style("stroke"),r.attr({"data-stroke":i}),l=a.hsl(i).darker().toString(),r.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=a.event.which?!1:void(a.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=a.select(this),r=n.attr("data-fill");r?n.style({fill:r,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,r,l,s={data:[],layout:{}},c={},u={},f=a.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),i(s.data[e],o.Axis.defaultConfig().data[0]),i(s.data[e],t)}),i(s.layout,o.Axis.defaultConfig().layout),i(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return r},d.angularScale=function(t){return l},d.svg=function(){return e},a.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:a.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},o.util._extend=function(t,e){for(var n in t)e[n]=t[n]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var n=e||6,r=a.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return r},o.util.dataFromEquation=function(t,e,n){var r=e||6,o=[],i=[];a.range(0,360+r,r).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return a.range(e).map(function(t,e){return n[e]||n[0]})},o.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=o.util.ensureArray(t[e],n)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},o.util.sumArrays=function(t,e){return a.zip(t,e).map(function(t,e){return a.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return-2===n},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},o.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},o.util.getMousePos=function(t){var e=a.mouse(t.node()),n=e[0],r=e[1],o={};return o.x=n,o.y=r,o.pos=e,o.angle=180*(Math.atan2(r,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+r*r),o},o.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;o>a;a++)e=t[a],e in n?(n[e]++,r[e]=n[e]):n[e]=1;return r},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,n,r){if(r){var a=n.slice();n=e,e=a}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,n,r){return"undefined"!=typeof t?(r===e.length-1&&delete t[n],t[n]):void 0},t),n.reduce(function(t,e,r){return"undefined"==typeof t[e]&&(t[e]={}),r===n.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=n[0].geometryConfig,e=t.container;"string"==typeof e&&(e=a.select(e)),e.datum(n).each(function(e,n){function r(e,n){var r=t.radialScale(e[1]),a=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:r,t:a}}function o(t){var e=t.r*Math.cos(t.t),n=t.r*Math.sin(t.t);return{x:e,y:n}}var i=!!e[0].data.yStack,s=e.map(function(t,e){return i?a.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):a.zip(t.data.t[0],t.data.r[0])}),c=t.angularScale,u=t.radialScale.domain()[0],f={};f.bar=function(n,r,o){var i=e[o].data,l=t.radialScale(n[1])-t.radialScale(0),s=t.radialScale(n[2]||0),u=i.barWidth;a.select(this).attr({"class":"mark bar",d:"M"+[[l+s,-u/2],[l+s,u/2],[s,u/2],[s,-u/2]].join("L")+"Z",transform:function(e,n){return"rotate("+(t.orientation+c(e[0]))+")"}})},f.dot=function(t,n,i){var l=t[2]?[t[0],t[1]+t[2]]:t,s=a.svg.symbol().size(e[i].data.dotSize).type(e[i].data.dotType)(t,n);a.select(this).attr({"class":"mark dot",d:s,transform:function(t,e){var n=o(r(l));return"translate("+[n.x,n.y]+")"}})};var d=a.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(n,r,o){var i=n[2]?s[o].map(function(t,e){return[t[0],t[1]+t[2]]}):s[o];if(a.select(this).each(f.dot).style({opacity:function(t,n){return+e[o].data.dotVisible},fill:m.stroke(n,r,o)}).attr({"class":"mark dot"}),!(r>0)){var l=a.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({"class":"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(n,r,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(n,r,o)},"stroke-width":function(t,e){return m["stroke-width"](n,r,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](n,r,o)},opacity:function(t,e){return m.opacity(n,r,o)},display:function(t,e){return m.display(n,r,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=a.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,r){a.select(this).attr({"class":"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=a.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({"class":"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[o.PolyChart.defaultConfig()],r=a.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),i(n[e],o.PolyChart.defaultConfig()),i(n[e],t)}),this):n},t.getColorScale=function(){return e},a.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:a.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var n=e.legendConfig,r=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=i({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),o=a.merge(r);o=o.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(o=o.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=a.select(l));var s=o.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof o[0]:n.isContinuous,f=u?n.height:c*o.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=a.range(o.length),m=a.scale[u?"linear":"ordinal"]().domain(g).range(s),v=a.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=a.svg.symbolTypes.indexOf(t)?a.svg.symbol().type(t).size(n)():a.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=a.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),n=a.dispatch("hover");return t.config=function(t){return arguments.length?(i(e,t),this):e},a.rebind(t,n,"on"),t},o.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},o.tooltipPanel=function(){var t,e,n,r={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){t=r.container.selectAll("g."+l).data([0]);var a=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=a.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=a.append("text").attr({dx:r.padding+s,dy:.3*+r.fontSize}),c};return c.text=function(o){var i=a.hsl(r.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":r.fontSize+"px"}).text(f);var d=r.padding,h=e.node().getBBox(),p={fill:r.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return n.attr({d:"M"+[[s,-m/2],[s,-m/4],[r.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c):void 0},c.hide=function(){return t?(t.style({display:"none"}),c):void 0},c.show=function(){return t?(t.style({display:"block"}),c):void 0},c.config=function(t){return i(r,t),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=i({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var r=o.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var a=r.indexOf(t.geometry);-1!=a&&(n.data[e].groupId=a)})}if(t.layout){var l=i({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};a.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../plotly":121,"./micropolar_manager":148,d3:16}],148:[function(t,e,n){"use strict";var r=t("../../plotly"),a=t("d3"),o=t("./undo_manager"),i=e.exports={},l=r.Lib.extendDeepAll;i.framework=function(t){function e(e,o){return o&&(f=o),a.select(a.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?l(n,e):e,c||(c=r.micropolar.Axis()),u=r.micropolar.adapter.plotly().convert(n),c.config(u).render(f),t.data=n.data,t.layout=n.layout,i.fillLayout(t),n}var n,s,c,u,f,d=new o;return e.isPolar=!0,e.svg=function(){return c.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return r.micropolar.adapter.plotly().convert(c.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:c.angularScale(),r:c.radialScale()}},e.setUndoPoint=function(){var t=this,e=r.micropolar.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,s),s=r.micropolar.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},i.fillLayout=function(t){var e=a.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:r.Color.background,_container:e,_paperdiv:n,_paper:o};t._fullLayout=l(i,t.layout)}},{"../../plotly":121,"./undo_manager":149,d3:16}],149:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return rg;g++){var m=h[g];l=t[m]?t[m]:t[m]={},e[m]=s={},i("domain."+d,[g/p,(g+1)/p]),i("domain."+{x:"y",y:"x"}[d]),o.id=m,f(l,s,i,o)}}},{"../lib":103,"./plots":144}],151:[function(t,e,n){"use strict";var r=t("./ternary"),a=t("../../plots/plots");n.name="ternary",n.attr="subplot", -n.idRoot="ternary",n.idRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,n.attrRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,n.attributes=t("./layout/attributes"),n.layoutAttributes=t("./layout/layout_attributes"),n.supplyLayoutDefaults=t("./layout/defaults"),n.plot=function(t){for(var e=t._fullLayout,n=t._fullData,o=a.getSubplotIds(e,"ternary"),i=0;i=i&&(h.min=0,p.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var a=t("../../../components/color"),o=t("../../subplot_defaults"),i=t("./layout_attributes"),l=t("./axis_defaults"),s=["aaxis","baxis","caxis"];e.exports=function(t,e,n){o(t,e,n,{type:"ternary",attributes:i,handleDefaults:r,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":25,"../../subplot_defaults":150,"./axis_defaults":154,"./layout_attributes":156}],156:[function(t,e,n){"use strict";var r=t("../../../components/color/attributes"),a=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:r.background},sum:{valType:"number",dflt:1,min:0},aaxis:a,baxis:a,caxis:a}},{"../../../components/color/attributes":24,"./axis_attributes":153}],157:[function(t,e,n){"use strict";function r(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function a(t){o.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var o=t("d3"),i=t("tinycolor2"),l=t("../../plotly"),s=t("../../lib"),c=t("../../components/color"),u=t("../../components/drawing"),f=t("../cartesian/set_convert"),d=t("../../lib/extend").extendFlat,h=t("../cartesian/axes"),p=t("../../lib/filter_visible"),g=t("../../components/dragelement"),m=t("../../components/titles"),v=t("../cartesian/select"),y=t("../cartesian/constants"),x=t("../cartesian/graph_interact");e.exports=r;var b=r.prototype;b.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},b.plot=function(t,e){var n,r=this,a=e[r.id],o=e._size;s.getPlotDiv(r.plotContainer.node())!==r.graphDiv&&(r.init(r.graphDiv._fullLayout),r.makeFramework()),r.adjustLayout(a,o);var i=r.traceHash,l={};for(n=0;n_*y?(o=y,a=o*_):(a=v,o=a/_),i=g*a/v,l=m*o/y,n=e.l+e.w*h-a/2,r=e.t+e.h*(1-p)-o/2,s.x0=n,s.y0=r,s.w=a,s.h=o,s.sum=x,s.xaxis={type:"linear",range:[b+2*k-x,x-b-2*w],domain:[h-i/2,h+i/2],_id:"x",_gd:s.graphDiv},f(s.xaxis),s.xaxis.setScale(),s.yaxis={type:"linear",range:[b,x-w-k],domain:[p-l/2,p+l/2],_id:"y",_gd:s.graphDiv},f(s.yaxis),s.yaxis.setScale();var M=s.yaxis.domain[0],A=s.aaxis=d({},t.aaxis,{range:[b,x-w-k],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[M,M+l*_],_axislayer:s.layers.aaxis,_gridlayer:s.layers.agrid,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l"+o+",-"+a/2});f(A);var T=s.baxis=d({},t.baxis,{range:[x-b-k,w],side:"bottom",_counterangle:30,domain:s.xaxis.domain,_axislayer:s.layers.baxis,_gridlayer:s.layers.bgrid,_counteraxis:s.aaxis,_pos:0,_gd:s.graphDiv,_id:"x",_length:a,_gridpath:"M0,0l-"+a/2+",-"+o});f(T),A._counteraxis=T;var L=s.caxis=d({},t.caxis,{range:[x-b-w,k],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[M,M+l*_],_axislayer:s.layers.caxis,_gridlayer:s.layers.cgrid,_counteraxis:s.baxis,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l-"+o+","+a/2});f(L);var z="M"+n+","+(r+o)+"h"+a+"l-"+a/2+",-"+o+"Z";s.clipDef.select("path").attr("d",z),s.layers.plotbg.select("path").attr("d",z);var S="translate("+n+","+r+")";s.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",S);var C="translate("+n+","+(r+o)+")";s.layers.baxis.attr("transform",C),s.layers.bgrid.attr("transform",C);var E="translate("+(n+a/2)+","+r+")rotate(30)";s.layers.aaxis.attr("transform",E),s.layers.agrid.attr("transform",E);var O="translate("+(n+a/2)+","+r+")rotate(-30)";s.layers.caxis.attr("transform",O),s.layers.cgrid.attr("transform",O),s.drawAxes(!0),s.plotContainer.selectAll(".crisp").classed("crisp",!1);var P=s.layers.axlines;P.select(".aline").attr("d",A.showline?"M"+n+","+(r+o)+"l"+a/2+",-"+o:"M0,0").call(c.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),P.select(".bline").attr("d",T.showline?"M"+n+","+(r+o)+"h"+a:"M0,0").call(c.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),P.select(".cline").attr("d",L.showline?"M"+(n+a/2)+","+r+"l"+a/2+","+o:"M0,0").call(c.stroke,L.linecolor||"#000").style("stroke-width",(L.linewidth||0)+"px")},b.drawAxes=function(t){var e=this,n=e.graphDiv,r=e.id.substr(7)+"title",a=e.aaxis,o=e.baxis,i=e.caxis;if(h.doTicks(n,a,!0),h.doTicks(n,o,!0),h.doTicks(n,i,!0),t){var l=Math.max(a.showticklabels?a.tickfont.size/2:0,(i.showticklabels?.75*i.tickfont.size:0)+("outside"===i.ticks?.87*i.ticklen:0));m.draw(n,"a"+r,{propContainer:a,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-a.titlefont.size/3-l,"text-anchor":"middle"}});var s=(o.showticklabels?o.tickfont.size:0)+("outside"===o.ticks?o.ticklen:0)+3;m.draw(n,"b"+r,{propContainer:o,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-s,y:e.y0+e.h+.83*o.titlefont.size+s,"text-anchor":"middle"}}),m.draw(n,"c"+r,{propContainer:i,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+s,y:e.y0+e.h+.83*i.titlefont.size+s,"text-anchor":"middle"}})}};var w=y.MINZOOM/2+.87,k="m-0.87,.5h"+w+"v3h-"+(w+5.2)+"l"+(w/2+2.6)+",-"+(.87*w+4.5)+"l2.6,1.5l-"+w/2+","+.87*w+"Z",M="m0.87,.5h-"+w+"v3h"+(w+5.2)+"l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-2.6,1.5l"+w/2+","+.87*w+"Z",A="m0,1l"+w/2+","+.87*w+"l2.6,-1.5l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-"+(w/2+2.6)+","+(.87*w+4.5)+"l2.6,1.5l"+w/2+",-"+.87*w+"Z",T="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",L=!0;b.initInteractions=function(){function t(t,e,n){var r=R.getBoundingClientRect();b=e-r.left,w=n-r.top,z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},C=z,S=I.aaxis.range[1]-z.a,E=i(I.graphDiv._fullLayout[I.id].bgcolor).getLuminance(),O="M0,"+I.h+"L"+I.w/2+", 0L"+I.w+","+I.h+"Z",P=!1,N=F.append("path").attr("class","zoombox").style({fill:E>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",O),D=F.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),p()}function e(t,e){return 1-e/I.h}function n(t,e){return 1-(t+(I.h-e)/Math.sqrt(3))/I.w}function r(t,e){return(t-(I.h-e)/Math.sqrt(3))/I.w}function o(t,a){var o=b+t,i=w+a,l=Math.max(0,Math.min(1,e(b,w),e(o,i))),s=Math.max(0,Math.min(1,n(b,w),n(o,i))),c=Math.max(0,Math.min(1,r(b,w),r(o,i))),u=(l/2+c)*I.w,f=(1-l/2-s)*I.w,d=(u+f)/2,h=f-u,p=(1-l)*I.h,g=p-h/_;h.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),D.transition().style("opacity",1).duration(200),P=!0)}function u(t,e){if(C===z)return 2===e&&m(),a(j);a(j);var n={};n[I.id+".aaxis.min"]=C.a,n[I.id+".baxis.min"]=C.b,n[I.id+".caxis.min"]=C.c,l.relayout(j,n),L&&j.data&&j._context.showTips&&(s.notifier("Double-click to
zoom back out","long"),L=!1)}function f(){z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},C=z}function d(t,e){var n=t/I.xaxis._m,r=e/I.yaxis._m;C={a:z.a-r,b:z.b+(n+r)/2,c:z.c-(n-r)/2};var a=[C.a,C.b,C.c].sort(),o={a:a.indexOf(C.a),b:a.indexOf(C.b),c:a.indexOf(C.c)};a[0]<0&&(a[1]+a[0]/2<0?(a[2]+=a[0]+a[1],a[0]=a[1]=0):(a[2]+=a[0]/2,a[1]+=a[0]/2,a[0]=0),C={a:a[o.a],b:a[o.b],c:a[o.c]},e=(z.a-C.a)*I.yaxis._m,t=(z.c-C.c-z.b+C.b)*I.xaxis._m);var i="translate("+(I.x0+t)+","+(I.y0+e)+")";I.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",i),I.aaxis.range=[C.a,I.sum-C.b-C.c],I.baxis.range=[I.sum-C.a-C.c,C.b],I.caxis.range=[I.sum-C.a-C.b,C.c],I.drawAxes(!1),I.plotContainer.selectAll(".crisp").classed("crisp",!1)}function h(t,e){if(t){var n={};n[I.id+".aaxis.min"]=C.a,n[I.id+".baxis.min"]=C.b,n[I.id+".caxis.min"]=C.c,l.relayout(j,n)}else 2===e&&m()}function p(){I.plotContainer.selectAll(".select-outline").remove()}function m(){var t={};t[I.id+".aaxis.min"]=0,t[I.id+".baxis.min"]=0,t[I.id+".caxis.min"]=0,j.emit("plotly_doubleclick",null),l.relayout(j,t)}var b,w,z,S,C,E,O,P,N,D,I=this,R=I.layers.plotbg.select("path").node(),j=I.graphDiv,F=I.layers.zoom,q={element:R,gd:j,plotinfo:{plot:F},doubleclick:m,subplot:I.id,prepFn:function(e,n,r){q.xaxes=[I.xaxis],q.yaxes=[I.yaxis];var a=j._fullLayout.dragmode;e.shiftKey&&(a="pan"===a?"zoom":"pan"),"lasso"===a?q.minDrag=1:q.minDrag=void 0,"zoom"===a?(q.moveFn=o,q.doneFn=u,t(e,n,r)):"pan"===a?(q.moveFn=d,q.doneFn=h,f(),p()):"select"!==a&&"lasso"!==a||v(e,n,r,q,a)}};R.onmousemove=function(t){x.hover(j,t,I.id),j._fullLayout._lasthover=R,j._fullLayout._hoversubplot=I.id},R.onmouseout=function(t){j._dragging||g.unhover(j,t)},R.onclick=function(t){x.click(j,t)},g.init(q)}},{"../../components/color":25,"../../components/dragelement":46,"../../components/drawing":48,"../../components/titles":88,"../../lib":103,"../../lib/extend":101,"../../lib/filter_visible":102,"../../plotly":121,"../cartesian/axes":124,"../cartesian/constants":129,"../cartesian/graph_interact":131,"../cartesian/select":137,"../cartesian/set_convert":138,d3:16,tinycolor2:20}],158:[function(t,e,n){"use strict";function r(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function a(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),i=o.Lib.extendFlat,l=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,s=t.data,c=t.layout,u=l([],s),f=l({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;ns;s++)r(n[s])&&h.push({p:n[s],s:l[s],b:0});return o(e,"marker")&&i(e,e.marker.color,"marker","c"),o(e,"marker.line")&&i(e,e.marker.line.color,"marker.line","c"),h}},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":38,"../../plots/cartesian/axes":124,"fast-isnumeric":18}],168:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("../scatter/xy_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=o(t,e,u);return f?(u("orientation",e.x&&!e.y?"h":"v"),u("text"),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),void l(t,e,a.defaultLine,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/color":25,"../../components/errorbars/defaults":53,"../../lib":103,"../bar/style_defaults":176,"../scatter/xy_defaults":258,"./attributes":166}],169:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/graph_interact"),a=t("../../components/errorbars"),o=t("../../components/color");e.exports=function(t,e,n,i){var l,s=t.cd,c=s[0].trace,u=s[0].t,f=t.xa,d=t.ya,h="closest"===i?u.barwidth/2:u.dbar*(1-f._gd._fullLayout.bargap)/2;l="closest"!==i?function(t){return t.p}:"h"===c.orientation?function(t){return t.y}:function(t){return t.x};var p,g;"h"===c.orientation?(p=function(t){return r.inbox(t.b-e,t.x-e)+(t.x-e)/(t.x-t.b)},g=function(t){var e=l(t)-n;return r.inbox(e-h,e+h)}):(g=function(t){return r.inbox(t.b-n,t.y-n)+(t.y-n)/(t.y-t.b)},p=function(t){var n=l(t)-e;return r.inbox(n-h,n+h)});var m=r.getDistanceFunction(i,p,g);if(r.getClosest(s,m,t),t.index!==!1){var v=s[t.index],y=v.mcc||c.marker.color,x=v.mlcc||c.marker.line.color,b=v.mlw||c.marker.line.width;return o.opacity(y)?t.color=y:o.opacity(x)&&b&&(t.color=x),"h"===c.orientation?(t.x0=t.x1=f.c2p(v.x,!0),t.xLabelVal=v.s,t.y0=d.c2p(l(v)-h,!0),t.y1=d.c2p(l(v)+h,!0),t.yLabelVal=v.p):(t.y0=t.y1=d.c2p(v.y,!0),t.yLabelVal=v.s,t.x0=f.c2p(l(v)-h,!0),t.x1=f.c2p(l(v)+h,!0),t.xLabelVal=v.p),v.tx&&(t.text=v.tx),a.hoverInfo(v,c,t),[t]}}},{"../../components/color":25,"../../components/errorbars":54,"../../plots/cartesian/graph_interact":131}],170:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("./layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.calc=t("./calc"),r.setPositions=t("./set_positions"),r.colorbar=t("../scatter/colorbar"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.moduleType="trace",r.name="bar",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","oriented","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../scatter/colorbar":240,"./arrays_to_calcdata":165,"./attributes":166,"./calc":167,"./defaults":168,"./hover":169,"./layout_attributes":171,"./layout_defaults":172,"./plot":173,"./set_positions":174,"./style":175}],171:[function(t,e,n){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:""},bargap:{valType:"number",min:0,max:1},bargroupgap:{valType:"number",min:0,max:1,dflt:0}}},{}],172:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,n){function l(n,r){return o.coerce(t,e,i,n,r)}for(var s=!1,c=!1,u=!1,f={},d=0;d=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var d,h,p,g;if("h"===l.orientation?(p=u.c2p(n.poffset+e.p,!0),g=u.c2p(n.poffset+e.p+n.barwidth,!0),d=c.c2p(e.b,!0),h=c.c2p(e.s+e.b,!0)):(d=c.c2p(n.poffset+e.p,!0),h=c.c2p(n.poffset+e.p+n.barwidth,!0),g=u.c2p(e.s+e.b,!0),p=u.c2p(e.b,!0)),!(a(d)&&a(h)&&a(p)&&a(g)&&d!==h&&p!==g))return void r.select(this).remove();var m=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,v=r.round(m/2%1,2);if(!t._context.staticPlot){var y=i.opacity(e.mc||l.marker.color),x=1>y||m>.01?o:s;d=x(d,h),h=x(h,d),p=x(p,g),g=x(g,p)}r.select(this).attr("d","M"+d+","+p+"V"+g+"H"+h+"V"+p+"Z")})}),d.call(l.plot,e)}},{"../../components/color":25,"../../components/errorbars":54,"../../lib":103,"./arrays_to_calcdata":165,d3:16,"fast-isnumeric":18}],174:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/plots"),o=t("../../plots/cartesian/axes"),i=t("../../lib");e.exports=function(t,e){var n,l,s=t._fullLayout,c=e.x(),u=e.y();["v","h"].forEach(function(f){function d(e){function n(t){t[p]=t.p+d}var r=[];e.forEach(function(e){t.calcdata[e].forEach(function(t){r.push(t.p)})});var a=i.distinctVals(r),l=a.vals,c=a.minDiff,u=!1,f=[];"group"===s.barmode&&e.forEach(function(e){u||(t.calcdata[e].forEach(function(t){u||f.forEach(function(e){Math.abs(t.p-e)_&&(S=!0,A=_),_>M+P&&(S=!0,M=_))}o.expand(v,[A,M],{tozero:!0,padded:S})}else{var N=function(t){return t[g]=t.s,t.s};for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=(e._input||{}).marker||{},s=o.tryColorscale(n,l,""),c=o.tryColorscale(n,l,"line.");r.select(this).selectAll("path").each(function(t){var e,o,l=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=s(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",l+"px").call(a.fill,e),l&&(o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":25,"../../components/drawing":48,"../../components/errorbars":54,d3:16}],176:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":25,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38}],177:[function(t,e,n){"use strict";var r=t("../scatter/attributes"),a=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,i=r.marker,l=i.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any" -},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},i.symbol,{arrayOk:!1}),opacity:o({},i.opacity,{arrayOk:!1,dflt:1}),size:o({},i.size,{arrayOk:!1}),color:o({},i.color,{arrayOk:!1}),line:{color:o({},l.color,{arrayOk:!1,dflt:a.defaultLine}),width:o({},l.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:r.fillcolor}},{"../../components/color/attributes":24,"../../lib/extend":101,"../scatter/attributes":237}],178:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(t,e,n,o,i){var l;return n in e?p=o.makeCalcdata(e,n):(l=n+"0"in e?e[n+"0"]:"name"in e&&("category"===o.type||r(e.name)&&-1!==["linear","log"].indexOf(o.type)||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l),p=i.map(function(){return l})),p}function i(t,e,n,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;f>l;++l)s=o[l],t[l]={pos:s},p[l]=s-i,h[l]=[];for(p.push(o[f-1]+i),l=0;d>l;++l)u=e[l],r(u)&&(c=a.findBin(n[l],p),c>=0&&d>c&&h[c].push(u));return h}function l(t,e){var n,r,o,i;for(i=0;i1,v=n.dPos*(1-d.boxgap)*(1-d.boxgroupgap)/(m?t.numboxes:1),y=m?2*n.dPos*(-.5+(n.boxnum+.5)/t.numboxes)*(1-d.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||n.emptybox?void o.select(this).remove():("h"===g.orientation?(s=p,f=h):(s=h,f=p),n.bPos=y,n.bdPos=v,r(),o.select(this).selectAll("path.box").data(i.identity).enter().append("path").attr("class","box").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=s.c2p(t.pos+y-x,!0),l=s.c2p(t.pos+y+x,!0),c=f.c2p(t.q1,!0),u=f.c2p(t.q3,!0),d=i.constrain(f.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),h=f.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=f.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+d+","+n+"V"+r+"M"+c+","+n+"V"+r+"H"+u+"V"+n+"ZM"+c+","+e+"H"+h+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+h+","+a+"V"+l+"M"+p+","+a+"V"+l)):o.select(this).attr("d","M"+n+","+d+"H"+r+"M"+n+","+c+"H"+r+"V"+u+"H"+n+"ZM"+e+","+c+"V"+h+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+a+","+h+"H"+l+"M"+a+","+p+"H"+l))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=n,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,n,r,o,l,s,f,d="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=(t.q3-t.q1)*u,p=[],m=0;if(g.jitter){for(e=0;et.lo&&(r.so=!0),r})}).enter().append("path").call(l.translatePoints,h,p),void(g.boxmean&&o.select(this).selectAll("path.mean").data(i.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=f.c2p(t.mean,!0),i=f.c2p(t.mean-t.sd,!0),l=f.c2p(t.mean+t.sd,!0);"h"===g.orientation?o.select(this).attr("d","M"+a+","+n+"V"+r+("sd"!==g.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+n+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+n+","+a+"H"+r+("sd"!==g.boxmean?"":"m0,0L"+e+","+i+"L"+n+","+a+"L"+e+","+l+"Z"))})))})}},{"../../components/drawing":48,"../../lib":103,d3:16}],185:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var n,i,l,s,c=t._fullLayout,u=e.x(),f=e.y(),d=["v","h"];for(i=0;in;n++)e=f[n],h[n]=e[0]*(t.zmax-t.zmin)+t.zmin,p[n]=e[1];var g=r.extent([t.zmin,t.zmax,o.start,o.start+s*(c-1)]),m=g[t.zminn;n++)e=f[n],h[n]=(e[0]*(c+u-1)-u/2)*s+i,p[n]=e[1];var y=r.scale.linear().interpolate(r.interpolateRgb).domain(h).range(p);return y}},{"../../components/colorscale/get_scale":37,d3:16}],194:[function(t,e,n){"use strict";function r(t,e,n){var r=n[0].trace,o=n[0].x,l=n[0].y,c=r.contours,u=r.uid,f=e.x(),d=e.y(),m=t._fullLayout,x="contour"+u,b=a(c,e,n[0]);if(r.visible!==!0)return m._paper.selectAll("."+x+",.hm"+u).remove(),void m._infolayer.selectAll(".cb"+u).remove();"heatmap"===c.coloring?(r.zauto&&r.autocontour===!1&&(r._input.zmin=r.zmin=c.start-c.size/2,r._input.zmax=r.zmax=r.zmin+b.length*c.size),k(t,e,[n])):m._paper.selectAll(".hm"+u).remove(),i(b),s(b);var _=f.c2p(o[0],!0),w=f.c2p(o[o.length-1],!0),M=d.c2p(l[0],!0),A=d.c2p(l[l.length-1],!0),T=[[_,A],[w,A],[w,M],[_,M]],L=h(e,n,x);p(L,T,c),g(L,b,T,c),v(L,b,c),y(L,e,n[0],T)}function a(t,e,n){for(var r=t.size||1,a=[],o=t.start;ot?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===n||10===n){var r=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>r?5===n?713:1114:5===n?104:208}return 15===n?0:n}function i(t){var e,n,r,a,i,l,s,c,u,f=t[0].z,d=f.length,h=f[0].length,p=2===d||2===h;for(n=0;d-1>n;n++)for(a=[],0===n&&(a=a.concat(M)),n===d-2&&(a=a.concat(A)),e=0;h-1>e;e++)for(r=a.slice(),0===e&&(r=r.concat(T)),e===h-2&&(r=r.concat(L)),i=e+","+n,l=[[f[n][e],f[n][e+1]],[f[n+1][e],f[n+1][e+1]]],u=0;ua;a++){if(l>20?(l=S[l][(s[0]||s[1])<0?0:1],t.crossings[i]=C[l]):delete t.crossings[i],s=z[l],!s){_.log("Found bad marching index:",l,e,t.level);break}if(h.push(d(t,e,s)),e[0]+=s[0],e[1]+=s[1],u(h[h.length-1],h[h.length-2])&&h.pop(),i=e.join(","),i===o&&s.join(",")===p||n&&(s[0]&&(e[0]<0||e[0]>m-2)||s[1]&&(e[1]<0||e[1]>g-2)))break;l=t.crossings[i]}1e4===a&&_.log("Infinite loop in contour?");var v,y,x,b,w,k,M,A=u(h[0],h[h.length-1]),T=0,L=.2*t.smoothing,E=[],O=0;for(a=1;a=O;a--)if(v=E[a],P>v){for(x=0,y=a-1;y>=O&&v+E[y]x&&v+E[x]e;)e++,n=Object.keys(a.crossings)[0].split(",").map(Number),l(a,n);1e4===e&&_.log("Infinite loop in contour?")}}function c(t,e,n){var r=0,a=0;return t>20&&e?208===t||1114===t?r=0===n[0]?1:-1:a=0===n[1]?1:-1:-1!==M.indexOf(t)?a=1:-1!==T.indexOf(t)?r=1:-1!==A.indexOf(t)?a=-1:r=-1,[r,a]}function u(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function f(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function d(t,e,n){var r=e[0]+Math.max(n[0],0),a=e[1]+Math.max(n[1],0),o=t.z[a][r],i=t.xaxis,l=t.yaxis;if(n[1]){var s=(t.level-o)/(t.z[a][r+1]-o);return[i.c2p((1-s)*t.x[r]+s*t.x[r+1],!0),l.c2p(t.y[a],!0)]}var c=(t.level-o)/(t.z[a+1][r]-o);return[i.c2p(t.x[r],!0),l.c2p((1-c)*t.y[a]+c*t.y[a+1],!0)]}function h(t,e,n){var r=t.plot.select(".maplayer").selectAll("g.contour."+n).data(e);return r.enter().append("g").classed("contour",!0).classed(n,!0),r.exit().remove(),r}function p(t,e,n){var r=t.selectAll("g.contourbg").data([0]);r.enter().append("g").classed("contourbg",!0);var a=r.selectAll("path").data("fill"===n.coloring?[0]:[]);a.enter().append("path"),a.exit().remove(),a.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function g(t,e,n,r){var a=t.selectAll("g.contourfill").data([0]);a.enter().append("g").classed("contourfill",!0);var o=a.selectAll("path").data("fill"===r.coloring?e:[]);o.enter().append("path"),o.exit().remove(),o.each(function(t){var e=m(t,n);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function m(t,e){function n(t){return Math.abs(t[1]-e[0][1])<.01}function r(t){return Math.abs(t[1]-e[2][1])<.01}function a(t){return Math.abs(t[0]-e[0][0])<.01}function o(t){return Math.abs(t[0]-e[2][0])<.01}for(var i,l,s,c,u,f,d=t.edgepaths.length||t.z[0][0]s;s++){if(!i){_.log("Missing end?",h,t);break}for(n(i)&&!o(i)?l=e[1]:a(i)?l=e[0]:r(i)?l=e[3]:o(i)&&(l=e[2]),u=0;u=0&&(l=m,c=u):Math.abs(i[1]-l[1])<.01?Math.abs(i[1]-m[1])<.01&&(m[0]-i[0])*(l[0]-m[0])>=0&&(l=m,c=u):_.log("endpt to newendpt is not vert. or horz.",i,l,m)}if(i=l,c>=0)break;d+="L"+l}if(c===t.edgepaths.length){_.log("unclosed perimeter path");break}h=c,g=-1===p.indexOf(h),g&&(h=p[0],d+="Z")}for(h=0;he;e++)l.push(1);for(e=0;o>e;e++)a.push(l.slice());for(e=0;ei;i++)for(r=a(s,i),u[i]=new Array(r),l=0;r>l;l++)u[i][l]=e(o(s,i,l));return u}function a(t,e,n,r,a,o){var i,l,s,c=[],u=d.traceIs(t,"contour"),f=d.traceIs(t,"histogram"),h=d.traceIs(t,"gl2d"),p=Array.isArray(e)&&e.length>1;if(p&&!f&&"category"!==o.type){e=e.map(o.d2c);var g=e.length;if(!(a>=g))return u?e.slice(0,a):e.slice(0,a+1);if(u||h)c=e.slice(0,a);else if(1===a)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],s=1;g>s;s++)c.push(.5*(e[s-1]+e[s]));c.push(1.5*e[g-1]-.5*e[g-2])}if(a>g){var m=c[c.length-1],v=m-c[c.length-2];for(s=g;a>s;s++)m+=v,c.push(m)}}else for(l=r||1,i=f||"category"===o.type?n||0:Array.isArray(e)&&1===e.length?e[0]:void 0===n?0:o.d2c(n),s=u||h?0:-.5;a>s;s++)c.push(i+l*s);return c}function o(t){return.5-.25*Math.min(1,.5*t)}function i(t,e,n){var r,a,i=1;if(Array.isArray(n))for(r=0;rr&&i>y;r++)i=s(t,e,o(i));return i>y&&u.log("interp2d didn't converge quickly",i),t}function l(t){var e,n,r,a,o,i,l,s,c=[],u={},f=[],d=t[0],h=[],p=[0,0,0],g=v(t);for(n=0;nr;r++)void 0===h[r]&&(i=(void 0!==h[r-1]?1:0)+(void 0!==h[r+1]?1:0)+(void 0!==e[r]?1:0)+(void 0!==d[r]?1:0),i?(0===n&&i++,0===r&&i++,n===t.length-1&&i++,r===h.length-1&&i++,4>i&&(u[[n,r]]=[n,r,i]),c.push([n,r,i])):f.push([n,r]));for(;f.length;){for(l={},s=!1,o=f.length-1;o>=0;o--)a=f[o],n=a[0],r=a[1],i=((u[[n-1,r]]||p)[2]+(u[[n+1,r]]||p)[2]+(u[[n,r-1]]||p)[2]+(u[[n,r+1]]||p)[2])/20,i&&(l[a]=[n,r,i],f.splice(o,1),s=!0);if(!s)throw"findEmpties iterated with no new neighbors";for(a in l)u[a]=l[a],c.push(l[a])}return c.sort(function(t,e){return e[2]-t[2]})}function s(t,e,n){var r,a,o,i,l,s,c,u,f,d,h,p,g,m=0;for(i=0;il;l++)s=x[l],c=t[a+s[0]],c&&(u=c[o+s[1]],void 0!==u&&(0===d?p=g=u:(p=Math.min(p,u),g=Math.max(g,u)),f++,d+=u));if(0===f)throw"iterateInterp2d order is wrong: no defined neighbors";t[a][o]=d/f,void 0===h?4>f&&(m=1):(t[a][o]=(1+n)*t[a][o]-n*h,g>p&&(m=Math.max(m,Math.abs(t[a][o]-h)/(g-p))))}return m}var c=t("fast-isnumeric"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../../plots/plots"),h=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),m=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function n(t){L=e._input.zsmooth=e.zsmooth=!1,u.notifier("cannot fast-zsmooth: "+t)}var o,s,c,y,x,b,_,w,k=f.getFromId(t,e.xaxis||"x"),M=f.getFromId(t,e.yaxis||"y"),A=d.traceIs(e,"contour"),T=d.traceIs(e,"histogram"),L=A?"best":e.zsmooth;if(k._minDtick=0,M._minDtick=0,T){var z=h(t,e);o=z.x,s=z.x0,c=z.dx,y=z.y,x=z.y0,b=z.dy,_=z.z}else g(e)&&m(e,k,M),o=e.x?k.makeCalcdata(e,"x"):[],y=e.y?M.makeCalcdata(e,"y"):[],s=e.x0||0,c=e.dx||1,x=e.y0||0,b=e.dy||1,_=r(e),(A||e.connectgaps)&&(e._emptypoints=l(_),e._interpz=i(_,e._emptypoints,e._interpz));if("fast"===L)if("log"===k.type||"log"===M.type)n("log axis found");else if(!T){if(o.length){var S=(o[o.length-1]-o[0])/(o.length-1),C=Math.abs(S/100);for(w=0;wC){n("x scale is not linear");break}}if(y.length&&"fast"===L){var E=(y[y.length-1]-y[0])/(y.length-1),O=Math.abs(E/100);for(w=0;wO){n("y scale is not linear");break}}}var P=v(_),N="scaled"===e.xtype?"":e.x,D=a(e,N,s,c,P,k),I="scaled"===e.ytype?"":e.y,R=a(e,I,x,b,_.length,M);f.expand(k,D),f.expand(M,R);var j={x:D,y:R,z:_};if(p(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var F="contour"===e.type?"heatmap":"histogram2d";j.xfill=a(F,N,s,c,P,k),j.yfill=a(F,I,x,b,_.length,M)}return[j]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":32,"../../lib":103,"../../plots/cartesian/axes":124,"../../plots/plots":144,"../histogram2d/calc":218,"./convert_column_xyz":200,"./has_columns":202,"./max_row_length":205,"fast-isnumeric":18}],199:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,c="cb"+n.uid,u=l(n.colorscale),f=n.zmin,d=n.zmax;if(a(f)||(f=o.aggNums(Math.min,null,n.z)),a(d)||(d=o.aggNums(Math.max,null,n.z)),t._fullLayout._infolayer.selectAll("."+c).remove(),!n.showscale)return void i.autoMargin(t,c);var h=e[0].t.cb=s(t,c);h.fillcolor(r.scale.linear().domain(u.map(function(t){return f+t[0]*(d-f)})).range(u.map(function(t){return t[1]}))).filllevels({start:f,end:d,size:(d-f)/254}).options(n.colorbar)()}},{"../../components/colorbar/draw":28,"../../components/colorscale/get_scale":37,"../../lib":103,"../../plots/plots":144,d3:16,"fast-isnumeric":18}],200:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n){var a,o=t.x.slice(),i=t.y.slice(),l=t.z,s=t.text,c=Math.min(o.length,i.length,l.length),u=void 0!==s&&!Array.isArray(s[0]);for(ca;a++)o[a]=e.d2c(o[a]),i[a]=n.d2c(i[a]);var f,d,h,p=r.distinctVals(o),g=p.vals,m=r.distinctVals(i),v=m.vals,y=r.init2dArray(v.length,g.length);for(u&&(h=r.init2dArray(v.length,g.length)),a=0;c>a;a++)f=r.findBin(o[a]+p.minDiff/2,g),d=r.findBin(i[a]+m.minDiff/2,v),y[d][f]=l[a],u&&(h[d][f]=s[a]);t.x=g,t.y=v,t.z=y,u&&(t.text=h)}},{"../../lib":103}],201:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./has_columns"),o=t("./xyz_defaults"),i=t("../../components/colorscale/defaults"),l=t("./attributes");e.exports=function(t,e,n,s){function c(n,a){return r.coerce(t,e,l,n,a)}var u=o(t,e,c);return u?(c("text"),c("zsmooth"),c("connectgaps",a(e)&&e.zsmooth!==!1),void i(t,e,s,c,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":35,"../../lib":103,"./attributes":197,"./has_columns":202,"./xyz_defaults":208}],202:[function(t,e,n){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],203:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/graph_interact"),a=t("../../lib"),o=t("../../plots/cartesian/constants").MAXDIST;e.exports=function(t,e,n,i,l){if(!(t.distanceu||u>=y[0].length||0>f||f>y.length)return}else{if(r.inbox(e-m[0],e-m[m.length-1])>o||r.inbox(n-v[0],n-v[v.length-1])>o)return;if(l){var k;for(b=[2*m[0]-m[1]],k=1;k0;)_=m.c2p(C[A]),A--;for(b>_&&(w=_,_=b,b=w,I=!0),A=0;void 0===k&&A0;)M=v.c2p(E[A]),A--;if(k>M&&(w=k,k=M,M=w,R=!0),O&&(C=n[0].xfill,E=n[0].yfill),"fast"!==P){var j="best"===P?0:.5;b=Math.max(-j*m._length,b),_=Math.min((1+j)*m._length,_),k=Math.max(-j*v._length,k),M=Math.min((1+j)*v._length,M)}var F=Math.round(_-b),q=Math.round(M-k),B=0>=F||0>=q,H=e.plot.select(".imagelayer").selectAll("g.hm."+x).data(B?[]:[0]);if(H.enter().append("g").classed("hm",!0).classed(x,!0),H.exit().remove(),!B){var V,Z;"fast"===P?(V=D,Z=N):(V=F,Z=q);var U=document.createElement("canvas");U.width=V,U.height=Z;var Y,X,G=U.getContext("2d"),$=a.scale.linear().domain(S.map(function(t){return t[0]})).range(S.map(function(t){var e=o(t[1]).toRgb();return[e.r,e.g,e.b,e.a]})).clamp(!0);"fast"===P?(Y=I?function(t){return D-1-t}:i.identity,X=R?function(t){return N-1-t}:i.identity):(Y=function(t){return i.constrain(Math.round(m.c2p(C[t])-b),0,F)},X=function(t){return i.constrain(Math.round(v.c2p(E[t])-k),0,q)});var Q,W,J,K,tt,et,nt=X(0),rt=[nt,nt],at=I?0:1,ot=R?0:1,it=0,lt=0,st=0,ct=0;if(P){var ut=0,ft=new Uint8Array(F*q*4);if("best"===P){var dt,ht,pt,gt=new Array(C.length),mt=new Array(E.length),vt=new Array(F);for(A=0;AA;A++)vt[A]=r(A,gt);for(W=0;q>W;W++)for(dt=r(W,mt),ht=T[dt.bin0],pt=T[dt.bin1],A=0;F>A;A++,ut+=4)et=h(ht,pt,vt[A],dt),d(ft,ut,et)}else for(W=0;N>W;W++)for(tt=T[W],rt=X(W),A=0;F>A;A++)et=f(tt[A],1),ut=4*(rt*F+Y(A)),d(ft,ut,et);var yt=G.createImageData(F,q);yt.data.set(ft),G.putImageData(yt,0,0)}else for(W=0;N>W;W++)if(tt=T[W],rt.reverse(),rt[ot]=X(W+1),rt[0]!==rt[1]&&void 0!==rt[0]&&void 0!==rt[1])for(J=Y(0),Q=[J,J],A=0;D>A;A++)Q.reverse(),Q[at]=Y(A+1),Q[0]!==Q[1]&&void 0!==Q[0]&&void 0!==Q[1]&&(K=tt[A],et=f(K,(Q[1]-Q[0])*(rt[1]-rt[0])),G.fillStyle="rgba("+et.join(",")+")",G.fillRect(Q[0],rt[0],Q[1]-Q[0],rt[1]-rt[0]));lt=Math.round(lt/it),st=Math.round(st/it),ct=Math.round(ct/it);var xt=o("rgb("+lt+","+st+","+ct+")");t._hmpixcount=(t._hmpixcount||0)+it,t._hmlumcount=(t._hmlumcount||0)+it*xt.getLuminance();var bt=H.selectAll("image").data(n);bt.enter().append("svg:image").attr({xmlns:c.svg,preserveAspectRatio:"none"}),bt.attr({height:q,width:F,x:b,y:k,"xlink:href":U.toDataURL("image/png")}),bt.exit().remove()}}var a=t("d3"),o=t("tinycolor2"),i=t("../../lib"),l=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),c=t("../../constants/xmlns_namespaces"),u=t("./max_row_length");e.exports=function(t,e,n){for(var a=0;a0&&(r=!0);for(var l=0;la;a++)e[a]?(t[a]/=e[a],r+=t[a]):t[a]=null;return r}},{}],211:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){return n("histnorm"),r.forEach(function(t){var e=n(t+"bins.start"),r=n(t+"bins.end"),a=n("autobin"+t,!(e&&r));n(a?"nbins"+t:t+"bins.size")}),e}},{}],212:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports={count:function(t,e,n){return n[t]++,1},sum:function(t,e,n,a){var o=a[e];return r(o)?(o=Number(o),n[t]+=o,o):0},avg:function(t,e,n,a,o){var i=a[e];return r(i)&&(i=Number(i),n[t]+=i,o[t]++),0},min:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]>o)return n[t]=o,o-n[t]}return 0},max:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]n&&c.length<5e3;)g=o.tickIncrement(n,x.size),c.push((n+g)/2),u.push(S),b&&_.push(n),L&&w.push(1/(g-n)),O&&k.push(0),n=g;var P=u.length;for(n=0;n=0&&P>v&&(M+=C(v,n,u,y,k));O&&(M=s(u,k)),E&&E(u,M,w);var N=Math.min(c.length,u.length),D=[],I=0,R=N-1;for(n=0;N>n;n++)if(u[n]){I=n;break}for(n=N-1;n>I;n--)if(u[n]){R=n;break}for(n=I;R>=n;n++)r(c[n])&&r(u[n])&&D.push({p:c[n],s:u[n],b:0});return D}}},{"../../lib":103,"../../plots/cartesian/axes":124,"./average":210,"./bin_functions":212,"./norm_functions":216,"fast-isnumeric":18}],214:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=u("x"),d=u("y");u("text");var h=u("orientation",d&&!f?"h":"v"),p=e["v"===h?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===h?"x":"y"];g&&u("histfunc");var m="h"===h?["y"]:["x"];o(t,e,u,m),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":25,"../../components/errorbars/defaults":53,"../../lib":103,"../bar/style_defaults":176,"./attributes":209,"./bin_defaults":211}],215:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("../bar/layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("../bar/layout_defaults"),r.calc=t("./calc"),r.setPositions=t("../bar/set_positions"),r.plot=t("../bar/plot"),r.style=t("../bar/style"),r.colorbar=t("../scatter/colorbar"),r.hoverPoints=t("../bar/hover"),r.moduleType="trace",r.name="histogram",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../bar/hover":169,"../bar/layout_attributes":171,"../bar/layout_defaults":172,"../bar/plot":173,"../bar/set_positions":174,"../bar/style":175,"../scatter/colorbar":240,"./attributes":209,"./calc":213,"./defaults":214}],216:[function(t,e,n){"use strict";e.exports={percent:function(t,e){for(var n=t.length,r=100/e,a=0;n>a;a++)t[a]*=r},probability:function(t,e){for(var n=t.length,r=0;n>r;r++)t[r]/=e},density:function(t,e,n,r){var a=t.length;r=r||1;for(var o=0;a>o;o++)t[o]*=n[o]*r},"probability density":function(t,e,n,r){var a=t.length;r&&(e/=r);for(var o=0;a>o;o++)t[o]*=n[o]/e}}},{}],217:[function(t,e,n){"use strict";var r=t("../histogram/attributes"),a=t("../heatmap/attributes"),o=t("../../components/colorscale/attributes"),i=t("../../lib/extend").extendFlat;e.exports=i({},{x:r.x,y:r.y,z:{valType:"data_array"},marker:{color:{valType:"data_array"}},histnorm:r.histnorm,histfunc:r.histfunc,autobinx:r.autobinx,nbinsx:r.nbinsx,xbins:r.xbins,autobiny:r.autobiny,nbinsy:r.nbinsy,ybins:r.ybins,zsmooth:a.zsmooth,_nestedModules:{colorbar:"Colorbar"}},o,{autocolorscale:i({},o.autocolorscale,{dflt:!1})})},{"../../components/colorscale/attributes":31,"../../lib/extend":101,"../heatmap/attributes":197,"../histogram/attributes":209}],218:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../histogram/bin_functions"),i=t("../histogram/norm_functions"),l=t("../histogram/average");e.exports=function(t,e){var n,s,c,u,f,d,h=a.getFromId(t,e.xaxis||"x"),p=e.x?h.makeCalcdata(e,"x"):[],g=a.getFromId(t,e.yaxis||"y"),m=e.y?g.makeCalcdata(e,"y"):[],v=Math.min(p.length,m.length);p.length>v&&p.splice(v,p.length-v),m.length>v&&m.splice(v,m.length-v),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(p,h,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(m,g,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),f=[];var y,x,b=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,M=0,A=[],T=e.histnorm,L=e.histfunc,z=-1!==T.indexOf("density"),S="max"===L||"min"===L,C=S?null:0,E=o.count,O=i[T],P=!1,N=[],D=[],I="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";I&&"count"!==L&&(P="avg"===L,E=o[L]);var R=e.xbins,j=R.end+(R.start-a.tickIncrement(R.start,R.size))/1e6;for(d=R.start;j>d;d=a.tickIncrement(d,R.size))b.push(C),Array.isArray(w)&&w.push(d),P&&_.push(0);Array.isArray(w)&&w.push(d);var F=b.length;for(n=e.xbins.start,s=(d-n)/F,n+=s/2,R=e.ybins,j=R.end+(R.start-a.tickIncrement(R.start,R.size))/1e6,d=R.start;j>d;d=a.tickIncrement(d,R.size))f.push(b.concat()),Array.isArray(k)&&k.push(d),P&&A.push(_.concat());Array.isArray(k)&&k.push(d);var q=f.length;for(c=e.ybins.start,u=(d-c)/q,c+=u/2,z&&(N=b.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/s}),D=f.map(function(t,e){return Array.isArray(k)?1/(k[e+1]-k[e]):1/u})),d=0;v>d;d++)y=r.findBin(p[d],w),x=r.findBin(m[d],k),y>=0&&F>y&&x>=0&&q>x&&(M+=E(y,d,f[x],I,A[x]));if(P)for(x=0;q>x;x++)M+=l(f[x],A[x]);if(O)for(x=0;q>x;x++)O(f[x],M,N,D[x]);return{x:p,x0:n,dx:s,y:m,y0:c,dy:u,z:f}}},{"../../lib":103,"../../plots/cartesian/axes":124,"../histogram/average":210,"../histogram/bin_functions":212,"../histogram/norm_functions":216}],219:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./sample_defaults"),o=t("../../components/colorscale/defaults"),i=t("./attributes");e.exports=function(t,e,n){function l(n,a){return r.coerce(t,e,i,n,a)}a(t,e,l),l("zsmooth"),o(t,e,n,l,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":35,"../../lib":103,"./attributes":217,"./sample_defaults":221}],220:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.calc=t("../heatmap/calc"),r.plot=t("../heatmap/plot"),r.colorbar=t("../heatmap/colorbar"),r.style=t("../heatmap/style"),r.hoverPoints=t("../heatmap/hover"),r.moduleType="trace",r.name="histogram2d",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","2dMap","histogram"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../heatmap/calc":198,"../heatmap/colorbar":199,"../heatmap/hover":203,"../heatmap/plot":206,"../heatmap/style":207,"./attributes":217,"./defaults":219}],221:[function(t,e,n){"use strict";var r=t("../histogram/bin_defaults");e.exports=function(t,e,n){var a=n("x"),o=n("y");if(!(a&&a.length&&o&&o.length))return void(e.visible=!1);var i=n("z")||n("marker.color");i&&n("histfunc");var l=["x","y"];r(t,e,n,l)}},{"../histogram/bin_defaults":211}],222:[function(t,e,n){"use strict";var r=t("../histogram2d/attributes"),a=t("../contour/attributes"),o=t("../../components/colorscale/attributes"),i=t("../../lib/extend").extendFlat;e.exports=i({},{x:r.x,y:r.y,z:r.z,marker:r.marker,histnorm:r.histnorm,histfunc:r.histfunc,autobinx:r.autobinx,nbinsx:r.nbinsx,xbins:r.xbins,autobiny:r.autobiny,nbinsy:r.nbinsy,ybins:r.ybins,autocontour:a.autocontour,ncontours:a.ncontours,contours:a.contours,line:a.line,_nestedModules:{colorbar:"Colorbar"}},o)},{"../../components/colorscale/attributes":31,"../../lib/extend":101,"../contour/attributes":187,"../histogram2d/attributes":217}],223:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../histogram2d/sample_defaults"),o=t("../contour/style_defaults"),i=t("./attributes");e.exports=function(t,e,n,l){function s(n,a){return r.coerce(t,e,i,n,a)}a(t,e,s);var c=r.coerce2(t,e,i,"contours.start"),u=r.coerce2(t,e,i,"contours.end"),f=s("autocontour",!(c&&u));s(f?"ncontours":"contours.size"),o(t,e,s,l)}},{"../../lib":103,"../contour/style_defaults":196,"../histogram2d/sample_defaults":221,"./attributes":222}],224:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.calc=t("../contour/calc"),r.plot=t("../contour/plot"),r.style=t("../contour/style"),r.colorbar=t("../contour/colorbar"),r.hoverPoints=t("../contour/hover"),r.moduleType="trace",r.name="histogram2dcontour",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","2dMap","contour","histogram"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../contour/calc":188,"../contour/colorbar":189,"../contour/hover":191,"../contour/plot":194,"../contour/style":195,"./attributes":222,"./defaults":223}],225:[function(t,e,n){"use strict";var r=t("../../components/color/attributes"),a=t("../../plots/font_attributes"),o=t("../../plots/attributes"),i=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array"},line:{color:{valType:"color",dflt:r.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:i({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:i({},a,{}),insidetextfont:i({},a,{}),outsidetextfont:i({},a,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":24,"../../lib/extend":101,"../../plots/attributes":122,"../../plots/font_attributes":142}],226:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;rs||(c=p[n],void 0!==c&&""!==c||(c=n),c=String(c),void 0===y[c]&&(y[c]=!0,u=o(e.marker.colors[n]),u.isValid()?(u=i.addOpacity(u,u.getAlpha()),v[c]||(v[c]=u)):v[c]?u=v[c]:(u=!1,x=!0),f=-1!==_.indexOf(c),f||(b+=s),g.push({v:s,label:c,color:u,i:n,hidden:f}))));if(e.sort&&g.sort(function(t,e){return e.v-t.v}),x)for(n=0;n")}return g};var s},{"../../components/color":25,"./helpers":229,"fast-isnumeric":18,tinycolor2:20}],228:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=l(i,"textfont",o.font);m&&l(i,"insidetextfont",y),v&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":103,"./attributes":225}],229:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return-1!==n.lastIndexOf(".")&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return-1!==n.lastIndexOf(".")&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":103}],230:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":225,"./base_plot":226,"./calc":227,"./defaults":228,"./layout_attributes":231,"./layout_defaults":232,"./plot":233,"./style":234,"./style_one":235}],231:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],232:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":103,"./layout_attributes":231}],233:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),m={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>d.scale?m:d;return c.scale<1&&v.scale>c.scale?v:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return 0>n&&(a*=-1),0>r&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),m=i?t.yLabelMin:t.yLabelMax,v=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-m;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-m-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,m,v;for(i=0;2>i;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;2>o;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),m=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&-1===h.indexOf(l.scalegroup)&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round","class":"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],m=c.trace,v=0,y=(m.depth||0)*c.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(v),k=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],v=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[m.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];-1!==l.indexOf("label")&&p.push(i.label),o.text&&o.text[i.i]&&-1!==l.indexOf("text")&&p.push(o.text[i.i]),-1!==l.indexOf("value")&&p.push(g.formatPieValue(i.v,h)),-1!==l.indexOf("percent")&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:-1!==l.indexOf("name")?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),m.pull){var z=+(Array.isArray(m.pull)?m.pull[i.i]:m.pull)||0;z>0&&(k+=z*i.pxmid[0],M+=z*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var S=m.hole;if(i.v===c.vTotal){var C="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";S?T.attr("d","M"+(k+S*i.px0[0])+","+(M+S*i.px0[1])+b(i.px0,i.pxmid,!1,S)+b(i.pxmid,i.px0,!1,S)+"Z"+C):T.attr("d",C)}else{var E=b(i.px0,i.px1,!0,1);if(S){var O=1-S;T.attr("d","M"+(k+S*i.px1[0])+","+(M+S*i.px1[1])+b(i.px1,i.px0,!1,S)+"l"+O*i.px0[0]+","+O*i.px0[1]+E+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+E+"Z")}var P=Array.isArray(m.textposition)?m.textposition[i.i]:m.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==P?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===P?e=o(n,i):(e=r(n,i,c),"auto"===P&&e.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,v=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),v&&i(s,m),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":25,"../../components/drawing":48,"../../lib/svg_text_utils":114,"../../plots/cartesian/graph_interact":131,"./helpers":229,d3:16}],234:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":235,d3:16}],235:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":25}],236:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"), -r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":103}],237:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:a.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":33,"../../components/drawing":48,"../../lib/extend":101,"./constants":242}],238:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;p>c;c++)b[c]=r(d[c])&&r(h[c])?{x:d[c],y:h[c]}:{x:!1,y:!1};return void 0!==typeof s&&o.mergeArray(s,b,"ms"),t.firstscatter=!1,b}},{"../../lib":103,"../../plots/cartesian/axes":124,"./colorscale_calc":241,"./subtypes":256,"fast-isnumeric":18}],239:[function(t,e,n){"use strict";e.exports=function(t){var e,n,r,a,o;for(e=0;e=0;a--)if(o=t[a],"scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}},{}],240:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,c=n.marker,u="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===c||!c.showscale)return void i.autoMargin(t,u);var f=l(c.colorscale),d=c.color,h=c.cmin,p=c.cmax;a(h)||(h=o.aggNums(Math.min,null,d)),a(p)||(p=o.aggNums(Math.max,null,d));var g=e[0].t.cb=s(t,u);g.fillcolor(r.scale.linear().domain(f.map(function(t){return h+t[0]*(p-h)})).range(f.map(function(t){return t[1]}))).filllevels({start:h,end:p,size:(p-h)/254}).options(c.colorbar)()}},{"../../components/colorbar/draw":28,"../../components/colorscale/get_scale":37,"../../lib":103,"../../plots/plots":144,d3:16,"fast-isnumeric":18}],241:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":38,"./subtypes":256}],242:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],243:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var m=l(t,e,g),v=mB!=P>=B&&(C=z[T-1][0],E=z[T][0],S=C+(E-C)*(B-O)/(P-O),R=Math.min(R,S),j=Math.max(j,S));R=Math.max(R,0),j=Math.min(j,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:j,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":25,"../../components/errorbars":54,"../../lib":103,"../../plots/cartesian/constants":129,"../../plots/cartesian/graph_interact":131,"./get_trace_color":245}],247:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"./arrays_to_calcdata":236,"./attributes":237,"./calc":238,"./clean_data":239,"./colorbar":240,"./defaults":243,"./hover":246,"./plot":253,"./select":254,"./style":255,"./subtypes":256}],248:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=(Array.isArray(l)?!1:l)||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38}],249:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=k.c2p(t[e].y);return n===z||r===z?!1:[n,r]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],z=r.BADNUM,S=.2,C=new Array(t.length),E=0;for(i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):v>y&&(v=y,u=f,h=!0)}if(h?(C[E++]=c,s!==u&&(C[E++]=u)):(u!==l&&(C[E++]=u),s!==c&&(C[E++]=c)),C[E++]=s,i>=t.length||!f)break;C[E++]=f,l=f}}else C[E++]=c}L.push(C.slice(0,E))}return L}},{"../../plots/cartesian/axes":124}],250:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],251:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t){var e=t.marker,n=e.sizeref||1,a=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/n)}:function(t){return t/n};return function(t){var e=o(t/2);return r(e)&&e>0?Math.max(e,a):0}}},{"fast-isnumeric":18}],252:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":25,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38,"./subtypes":256}],253:[function(t,e,n){"use strict";function r(t,e,n){var r=e.x(),o=e.y(),i=a.extent(r.range.map(r.l2c)),l=a.extent(o.range.map(o.l2c));n.forEach(function(t,e){var r=t[0].trace;if(c.hasMarkers(r)){var a=r.marker.maxdisplayed;if(0!==a){var o=t.filter(function(t){return t.x>=i[0]&&t.x<=i[1]&&t.y>=l[0]&&t.y<=l[1]}),s=Math.ceil(o.length/a),u=0;n.forEach(function(t,n){var r=t[0].trace;c.hasMarkers(r)&&r.marker.maxdisplayed>0&&e>n&&u++});var f=Math.round(u*s/3+Math.floor(u/3)*s/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+f)%s)&&(t.vis=!0)})}}})}var a=t("d3"),o=t("../../lib"),i=t("../../components/drawing"),l=t("../../components/errorbars"),s=t("../../lib/polygon").tester,c=t("./subtypes"),u=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,n){function d(t){return t.filter(function(t){return t.vis})}r(t,e,n);var h=e.x(),p=e.y(),g=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(n);g.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),g.call(l.plot,e);var m,v,y,x,b="",_=[];g.each(function(t){var e=t[0].trace,n=e.line,r=a.select(this);if(e.visible===!0&&(v=e.fill.charAt(e.fill.length-1),"x"!==v&&"y"!==v&&(v=""),t[0].node3=r,u(t),c.hasLines(e)||"none"!==e.fill)){var o,l,d,g,w,k="",M="";m="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!b?r.append("path").classed("js-fill",!0):null,x&&(y=x.datum(t)),x=r.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(n.shape)?(d=i.steps(n.shape),g=i.steps(n.shape.split("").reverse().join(""))):d=g="spline"===n.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?i.smoothclosed(t.slice(1),n.smoothing):i.smoothopen(t,n.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return g(t.reverse())};var A,T=f(t,{xaxis:h,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(n.width||1,3)/4,linear:"linear"===n.shape}),L=e._polygons=new Array(T.length);for(A=0;A1&&r.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}m?z&&C&&(v?("y"===v?z[1]=C[1]=p.c2p(0,!0):"x"===v&&(z[0]=C[0]=h.c2p(0,!0)),m.attr("d",k+"L"+C+"L"+z+"Z")):m.attr("d",k+"Z")):"tonext"===e.fill.substr(0,6)&&k&&b&&("tonext"===e.fill?y.attr("d",k+"Z"+b+"Z"):y.attr("d",k+"L"+b.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),b=M,_=L}}}),g.selectAll("path:not([d])").remove(),g.append("g").attr("class","points").each(function(t){var e=t[0].trace,n=a.select(this),r=c.hasMarkers(e),l=c.hasText(e);!r&&!l||e.visible!==!0?n.remove():(r&&n.selectAll("path.point").data(e.marker.maxdisplayed?d:o.identity).enter().append("path").classed("point",!0).call(i.translatePoints,h,p),l&&n.selectAll("g").data(e.marker.maxdisplayed?d:o.identity).enter().append("g").append("text").call(i.translatePoints,h,p))})}},{"../../components/drawing":48,"../../components/errorbars":54,"../../lib":103,"../../lib/polygon":109,"./arrays_to_calcdata":236,"./line_points":249,"./subtypes":256,d3:16}],254:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;nn;n++)y=e.a[n],x=e.b[n],b=e.c[n],r(y)&&r(x)&&r(b)?(y=+y,x=+x,b=+b,_=m/(y+x+b),1!==_&&(y*=_,x*=_,b*=_),k=y,w=b-x,A[n]={x:w,y:k,a:y,b:x,c:b}):A[n]={x:!1,y:!1};var T,L;if(i.hasMarkers(e)&&(T=e.marker,L=T.size,Array.isArray(L))){var z={type:"linear"};a.setConvert(z),L=z.makeCalcdata(e.marker,"size"),L.length>M&&L.splice(M,L.length-M)}return l(e),void 0!==typeof L&&o.mergeArray(L,A,"ms"),A}},{"../../lib":103,"../../plots/cartesian/axes":124,"../scatter/colorscale_calc":241,"../scatter/subtypes":256,"fast-isnumeric":18}],261:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../scatter/constants"),o=t("../scatter/subtypes"),i=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),s=t("../scatter/line_shape_defaults"),c=t("../scatter/text_defaults"),u=t("../scatter/fillcolor_defaults"),f=t("./attributes");e.exports=function(t,e,n,d){function h(n,a){return r.coerce(t,e,f,n,a)}var p,g=h("a"),m=h("b"),v=h("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),l}}},{"../../plots/cartesian/axes":124,"../scatter/hover":246}],263:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatterternary",r.basePlotModule=t("../../plots/ternary"),r.categories=["ternary","symbols","markerColorscale","showLegend"],r.meta={},e.exports=r},{"../../plots/ternary":151,"../scatter/colorbar":240,"./attributes":259,"./calc":260,"./defaults":261,"./hover":262,"./plot":264,"./select":265,"./style":266}],264:[function(t,e,n){"use strict";var r=t("../scatter/plot");e.exports=function(t,e){var n=t.plotContainer;n.select(".scatterlayer").selectAll("*").remove();for(var a={x:function(){return t.xaxis},y:function(){return t.yaxis},plot:n},o=new Array(e.length),i=t.graphDiv.calcdata,l=0;lo?o:i>4/3-l?i:l}},{}],45:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":103}],46:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":103,"../../plotly":121,"../../plots/cartesian/constants":129,"./align":44,"./cursor":45,"./unhover":47}],47:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":100}],48:[function(t,e,n){"use strict";function r(t,e,n,r){var o=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(o*o+i*i,b/2),u=Math.pow(l*l+s*s,b/2),f=(u*u*o-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[a.round(e[0]+(h&&f/h),2),a.round(e[1]+(h&&d/h),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&d/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../plots/plots"),l=t("../color"),s=t("../colorscale"),c=t("../../lib"),u=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),h=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(l.fill,r)},p.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},p.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},p.setRect=function(t,e,n,r,a){t.call(p.setPosition,e,n).call(p.setSize,r,a)},p.translatePoints=function(t,e,n){t.each(function(t){var r=t.xp||e.c2p(t.x),i=t.yp||n.c2p(t.y),l=a.select(this);o(r)&&o(i)?"text"===this.nodeName?l.attr("x",r).attr("y",i):l.attr("transform","translate("+r+","+i+")"):l.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):n||0},p.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},i=e||o.width||0,s=r||o.dash||"";a.select(this).call(l.stroke,n||o.color).call(p.dashLine,s,i)})},p.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(l.fill,e[0].trace.fillcolor)}catch(r){c.error(r,t),n.remove()}})};var g=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=p.symbolNames.length,v="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=n.line;if(i.traceIs(e,"symbols")){var o=h(e);t.attr("d",function(t){var r;r="various"===t.ms||"various"===n.size?3:d.isBubble(e)?o(t.ms):(n.size||6)/2,t.mrc=r;var a=p.symbolNumber(t.mx||n.symbol)||0,i=a%100;return t.om=a%200>=100,p.symbolFuncs[i](r)+(a>=200?v:"")}).style("opacity",function(t){return(t.mo+1||n.opacity+1)-1})}var s=(e._input||{}).marker||{},c=p.tryColorscale(n,s,""),u=p.tryColorscale(n,s,"line.");t.each(function(t){var e,o,i;t.so?(i=r.outlierwidth,o=r.outliercolor,e=n.outliercolor):(i=(t.mlw+1||r.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(r.color)?l.defaultLine:r.color,e="mc"in t?t.mcc=c(t.mc):Array.isArray(n.color)?l.defaultLine:n.color||"rgba(0,0,0,0)");var s=a.select(this);t.om?s.call(l.stroke,e).style({"stroke-width":(i||1)+"px",fill:"none"}):(s.style("stroke-width",i+"px").call(l.fill,e),i&&s.call(l.stroke,o))})}},p.tryColorscale=function(t,e,n){var r=c.nestedProperty(t,n+"color").get(),a=c.nestedProperty(t,n+"colorscale").get(),i=c.nestedProperty(t,n+"cauto").get(),l=c.nestedProperty(t,n+"cmin"),u=c.nestedProperty(t,n+"cmax"),f=l.get(),d=u.get();return a&&Array.isArray(r)?(!i&&o(f)&&o(d)||(f=1/0,d=-(1/0),r.forEach(function(t){o(t)&&(f>t&&(f=+t),t>d&&(d=+t))}),f>d&&(f=0,d=1),l.set(f),u.set(d),c.nestedProperty(e,n+"cmin").set(f),c.nestedProperty(e,n+"cmax").set(d)),s.makeScaleFunction(a,f,d)):c.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;p.textPointStyle=function(t,e){t.each(function(t){var n=a.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var i=t.tp||e.textposition,l=-1!==i.indexOf("top")?"top":-1!==i.indexOf("bottom")?"bottom":"middle",s=-1!==i.indexOf("left")?"end":-1!==i.indexOf("right")?"start":"middle",c=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;c=o(c)&&c>0?c:0,n.call(p.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(u.convertToTspans);var d=a.select(this.parentNode),h=n.selectAll("tspan.line"),g=((h[0].length||1)-1)*x+1,m=y[s]*f,v=.75*c+y[l]*f+(y[l]-1)*g*c/2;d.attr("transform","translate("+m+","+v+")"),g>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,a="M"+t[0],o=[];for(n=1;nn;n++)i.push(r(t[n-1],t[n],t[n+1],e));for(i.push(r(t[o-1],t[o],t[0],e)),n=1;o>=n;n++)a+="C"+i[n-1][1]+" "+i[n][0]+" "+t[n];return a+="C"+i[o][1]+" "+i[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+a.round(e[0],2)+"V"+a.round(e[1],2)},vh:function(t,e){return"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},hvh:function(t,e){return"H"+a.round((t[0]+e[0])/2,2)+"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},vhv:function(t,e){return"V"+a.round((t[1]+e[1])/2,2)+"H"+a.round(e[0],2)+"V"+a.round(e[1],2)}},w=function(t,e){return"L"+a.round(e[0],2)+","+a.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var n="M"+a.round(t[0][0],2)+","+a.round(t[0][1],2),r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(s),c.extendFlat({},s)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=a.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":95,"../../lib":103,"../../lib/svg_text_utils":114,"../../plots/plots":144,"../../traces/scatter/make_bubble_size_func":251,"../../traces/scatter/subtypes":256,"../color":25,"../colorscale":39,"./symbol_defs":49,d3:16,"fast-isnumeric":18}],49:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:16}],50:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],51:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&-1!==["linear","log"].indexOf(n.type),c=[];if(s){for(var u=l(o),f=0;fl;l++)i[l]={x:n[l],y:a[l]};return i[0].trace=t,r.calc({calcdata:[i],_fullLayout:e}),i},r.plot=t("./plot"),r.style=t("./style"),r.hoverInfo=function(t,e,n){(e.error_y||{}).visible&&(n.yerr=t.yh-t.y,e.error_y.symmetric||(n.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(n.xerr=t.xh-t.x,e.error_x.symmetric||(n.xerrneg=t.x-t.xs))}},{"./attributes":50,"./calc":51,"./defaults":53,"./plot":55,"./style":56}],55:[function(t,e,n){"use strict";function r(t,e,n){var r={x:e.c2p(t.x),y:n.c2p(t.y)};return void 0!==t.yh&&(r.yh=n.c2p(t.yh),r.ys=n.c2p(t.ys),o(r.ys)||(r.noYS=!0,r.ys=n.c2p(t.ys,!0))),void 0!==t.xh&&(r.xh=e.c2p(t.xh),r.xs=e.c2p(t.xs),o(r.xs)||(r.noXS=!0,r.xs=e.c2p(t.xs,!0))),r}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../lib"),l=t("../../traces/scatter/subtypes");e.exports=function(t,e){var n=e.x(),s=e.y();t.each(function(t){var e=t[0].trace,c=e.error_x||{},u=e.error_y||{},f=l.hasMarkers(e)&&e.marker.maxdisplayed>0;if(u.visible||c.visible){var d=a.select(this).selectAll("g.errorbar").data(i.identity);d.enter().append("g").classed("errorbar",!0),d.each(function(t){var e=a.select(this),i=r(t,n,s);if(!f||t.vis){var l;if(u.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var d=u.width;l="M"+(i.x-d)+","+i.yh+"h"+2*d+"m-"+d+",0V"+i.ys,i.noYS||(l+="m-"+d+",0h"+2*d),e.append("path").classed("yerror",!0).attr("d",l)}if(c.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var h=(c.copy_ystyle?u:c).width;l="M"+i.xh+","+(i.y-h)+"v"+2*h+"m0,-"+h+"H"+i.xs,i.noXS||(l+="m0,-"+h+"v"+2*h),e.append("path").classed("xerror",!0).attr("d",l)}}})}})}},{"../../lib":103,"../../traces/scatter/subtypes":256,d3:16,"fast-isnumeric":18}],56:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":25,d3:16}],57:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":129}],58:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var l=0;2>l;l++){var s={_fullLayout:n},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,a=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],62:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":101,"../../plots/font_attributes":142,"../color/attributes":24}],63:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],64:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/plots"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n){function l(t,e){return r.coerce(d,h,o,t,e)}for(var s,c,u,f,d=t.legend||{},h=e.legend={},p=0,g="normal",m=0;m1);if(y!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),r.coerceFont(l,"font",e.font),l("orientation"),"h"===h.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(s=0,u="left",c=1.1,f="bottom"):(s=0,u="left",c=-.1,f="top")}l("traceorder",g),i.isGrouped(e.legend)&&l("tracegroupgap"),l("x",s),l("xanchor",u),l("y",c),l("yanchor",f),r.noneOrAll(d,h,["x","y"])}}},{"../../lib":103,"../../plots/plots":144,"./attributes":62,"./helpers":67}],65:[function(t,e,n){"use strict";function r(t,e){function n(n){u.util.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=d.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,a.legend.font).text(c),e._context.editable&&!l?f.call(u.util.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" "),u.restyle(e,"name",t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(d.traceIs(l,"pie")){var f=o.label,h=n.indexOf(f);-1===h?n.push(f):n.splice(h,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),h=d[0].length||1;n=s*h,r=u.node()&&p.bBox(u.node()).width;var g=s*(.3+(1-h)/2);u.attr("y",g),d.attr("y",g)}n=Math.max(n,16)+3,o.attr({x:0,y:-n/2,height:n}),a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=x.isGrouped(a);if(x.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),n.selectAll(".legendtoggle").attr("width",(t._context.editable?0:a.width)+40),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height);else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;d>u;u++){var h=s[u].map(function(t){return t[0].width}),p=40+Math.max.apply(null,h);a.width+=a.tracegroupgap+p,l.push(a.width)}e.each(function(t,e){f.setTranslate(this,l[e],0)}),e.each(function(){var t=c.select(this),e=t.selectAll("g.traces"),n=0;e.each(function(t){var e=t[0],r=e.height;f.setTranslate(this,0,5+o+n+r/2),n+=r}),a.height=Math.max(a.height,n)}),a.height+=10+2*o,a.width+=2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}else{a.width=0,a.height=0;var g=0,m=0,v=0,y=0;n.each(function(t){v=Math.max(40+t[0].width,v)}),n.each(function(t){var e=t[0],n=v,i=a.tracegroupgap||5;o+y+i+n>r.width-(r.margin.r+r.margin.l)&&(y=0,g+=m,a.height=a.height+m,m=0),f.setTranslate(this,o+y,5+o+e.height/2+g),a.width+=i+n,a.height=Math.max(a.height,e.height),y+=i+n,m=Math.max(e.height,m)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}}function l(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center");var a="top";b.isBottomAnchor(n)?a="bottom":b.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../dragelement"),p=t("../drawing"),g=t("../color"),m=t("./constants"),v=t("./get_legend_data"),y=t("./style"),x=t("./helpers"),b=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(p.setRect,j,t,m.scrollBarWidth,m.scrollBarHeight),M.select("rect").attr({y:x.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var x=n.legend,_=n.showlegend&&v(t.calcdata,x),w=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({"class":"legend","pointer-events":"all"});var M=n._topdefs.selectAll("#"+o).data([0]);M.enter().append("clipPath").attr("id",o).append("rect");var A=k.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(g.stroke,x.bordercolor),A.call(g.fill,x.bgcolor),A.style("stroke-width",x.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var z=T.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var C=0!==k.enter().size();C&&(i(t,z,S),l(t));var E=0,O=n.width,P=0,N=n.height;i(t,z,S),x.height>N?s(t):l(t);var D=n._size,I=D.l+D.w*x.x,R=D.t+D.h*(1-x.y);b.isRightAnchor(x)?I-=x.width:b.isCenterAnchor(x)&&(I-=x.width/2),b.isBottomAnchor(x)?R-=x.height:b.isMiddleAnchor(x)&&(R-=x.height/2);var j=x.width,F=D.w;j>F?(I=D.l,j=F):(I+j>O&&(I=O-j),E>I&&(I=E),j=Math.min(O-I,x.width));var q=x.height,B=D.h;q>B?(R=D.t,q=B):(R+q>N&&(R=N-q),P>R&&(R=P),q=Math.min(N-R,x.height)),f.setTranslate(k,I,R);var H,V,Z=q-m.scrollBarHeight-2*m.scrollBarMargin,U=x.height-q;if(x.height<=q||t._context.staticPlot)A.attr({width:j-x.borderwidth,height:q-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),f.setTranslate(T,0,0),M.select("rect").attr({width:j-2*x.borderwidth,height:q-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth}),T.call(p.setClipUrl,o);else{H=m.scrollBarMargin,V=T.attr("data-scroll")||0,A.attr({width:j-2*x.borderwidth+m.scrollBarWidth+m.scrollBarMargin,height:q-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),M.select("rect").attr({width:j-2*x.borderwidth+m.scrollBarWidth+m.scrollBarMargin,height:q-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth-V}),T.call(p.setClipUrl,o),C&&e(H,V),k.on("wheel",null),k.on("wheel",function(){V=f.constrain(T.attr("data-scroll")-c.event.deltaY/Z*U,-U,0),H=m.scrollBarMargin-V/U*Z,e(H,V),c.event.preventDefault()}),L.on(".drag",null),T.on(".drag",null);var Y=c.behavior.drag().on("drag",function(){H=f.constrain(c.event.y-m.scrollBarHeight/2,m.scrollBarMargin,m.scrollBarMargin+Z),V=-(H-m.scrollBarMargin)/Z*U,e(H,V)});L.call(Y),T.call(Y)}if(t._context.editable){var X,G,$,Q;k.classed("cursor-move",!0),h.init({element:k.node(),prepFn:function(){var t=f.getTranslate(k);$=t.x,Q=t.y},moveFn:function(t,e){var n=$+t,r=Q+e;f.setTranslate(k,n,r),X=h.align(n,0,D.l,D.l+D.w,x.xanchor),G=h.align(r,0,D.t+D.h,D.t,x.yanchor)},doneFn:function(e){e&&void 0!==X&&void 0!==G&&u.relayout(t,{"legend.x":X,"legend.y":G})}})}}}},{"../../lib":103,"../../plotly":121,"../../plots/plots":144,"../color":25,"../dragelement":46,"../drawing":48,"./anchor_utils":61,"./constants":63,"./get_legend_data":66,"./helpers":67,"./style":69,d3:16}],66:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[n]]):l[t].push([n]);else{var r="~~i"+f;s.push(r),l[r]=[[n]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;oo;o++)v=l[s[o]],y[o]=a.isReversed(e)?v.reverse():v;else{for(y=[new Array(x)],o=0;x>o;o++)v=l[s[o]][0],y[0][a.isReversed(e)?x-o-1:o]=v;x=1}return e._lgroupsLength=x,y}},{"../../plots/plots":144,"./helpers":67}],67:[function(t,e,n){"use strict";var r=t("../../plots/plots");n.legendGetsTrace=function(t){return t.visible&&r.traceIs(t,"showLegend")},n.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},n.isVertical=function(t){return"h"!==t.orientation},n.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":144}],68:[function(t,e,n){"use strict";var r=e.exports={};r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw"),r.style=t("./style")},{"./attributes":62,"./defaults":64,"./draw":65,"./style":69}],69:[function(t,e,n){"use strict";function r(t){var e=t[0].trace,n=e.visible&&e.fill&&"none"!==e.fill,r=h.hasLines(e),a=s.select(this).select(".legendfill").selectAll("path").data(n?[t]:[]);a.enter().append("path").classed("js-fill",!0),a.exit().remove(),a.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var o=s.select(this).select(".legendlines").selectAll("path").data(r?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(f.lineGroupStyle)}function a(t){function e(t,e,n){var r=c.nestedProperty(i,t).get(),a=Array.isArray(r)&&e?e(r):r;if(n){if(an[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),u=h.hasText(i),d=h.hasLines(i);if(l||u||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(o,p)],a=c.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../lib"),u=t("../../plots/plots"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":103,"../../plots/plots":144,"../../traces/pie/style_one":235,"../../traces/scatter/subtypes":256,"../color":25,"../drawing":48,d3:16}],70:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,f=(1+u)/2,d=(1-u)/2,h=c.Axes.list(t,null,!0),p=0;py;y++){var x=l[y];d=v[x]={};for(var b=0;b1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.Axes.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":103,"../color":25,"./attributes":73,"./button_attributes":74,"./constants":75}],77:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;re){var n=e;e=t,t=n}l.setAttributes(w,{"data-min":t,"data-max":e}),l.setAttributes(P,{x:t,width:e-t}),l.setAttributes(A,{width:t}),l.setAttributes(T,{x:e,width:p-e}),l.setAttributes(L,{transform:"translate("+(t-m-1)+")"}),l.setAttributes(C,{transform:"translate("+e+")"})}var f=t._fullLayout,d=f._infolayer.selectAll("g.range-slider"),h=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*h.thickness,m=2,v=Math.floor(h.borderwidth/2),y=f.margin.l,x=f.height-g-f.margin.b,b=0,_=p,w=document.createElementNS(i,"g");l.setAttributes(w,{ +"class":"range-slider","data-min":b,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+x+")"});var k=document.createElementNS(i,"rect"),M=h.borderwidth%2===0?h.borderwidth:h.borderwidth-1;l.setAttributes(k,{fill:h.bgcolor,stroke:h.bordercolor,"stroke-width":h.borderwidth,height:g+M,width:p+M,transform:"translate(-"+v+", -"+v+")","shape-rendering":"crispEdges"});var A=document.createElementNS(i,"rect");l.setAttributes(A,{x:0,width:b,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(i,"rect");l.setAttributes(T,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var L=document.createElementNS(i,"g"),z=document.createElementNS(i,"rect"),S=document.createElementNS(i,"rect");l.setAttributes(L,{transform:"translate("+(b-m-1)+")"}),l.setAttributes(z,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),l.setAttributes(S,{width:m,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(L,[S,z]);var C=document.createElementNS(i,"g"),E=document.createElementNS(i,"rect"),O=document.createElementNS(i,"rect");l.setAttributes(C,{transform:"translate("+_+")"}),l.setAttributes(E,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),l.setAttributes(O,{width:m,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(C,[O,E]);var P=document.createElementNS(i,"rect");l.setAttributes(P,{x:b,width:_-b,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function n(t){var n,r,f=+t.clientX-o;switch(a){case P:w.style.cursor="ew-resize",n=+l+f,r=+s+f,u(n,r),c(e(n),e(r));break;case z:w.style.cursor="col-resize",n=+l+f,r=+s,u(n,r),c(e(n),e(r));break;case E:w.style.cursor="col-resize",n=+l,r=+s+f,u(n,r),c(e(n),e(r));break;default:w.style.cursor="ew-resize",n=i,r=i+f,u(n,r),c(e(n),e(r))}}function r(){window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r),w.style.cursor="auto"}var a=t.target,o=t.clientX,i=o-w.getBoundingClientRect().left,l=w.getAttribute("data-min"),s=w.getAttribute("data-max");window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)}),h.range||(h.range=a.getAutoRange(f.xaxis));var N=s(t,p,g);l.appendChildren(w,[k,N,A,T,P,L,C]),n(f.xaxis.range[0],f.xaxis.range[1]),d.data([0]).enter().append(function(){return h.setRange=n,w})}},{"../../constants/xmlns_namespaces":95,"../../lib":103,"../../plotly":121,"../../plots/cartesian/axes":124,"./helpers":83,"./range_plot":85}],82:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(t,e){return r.coerce(l,s,a,t,e)}if(t[n].rangeslider){var l=r.isPlainObject(t[n].rangeslider)?t[n].rangeslider:{},s=e[n].rangeslider={};if(i("bgcolor"),i("bordercolor"),i("borderwidth"),i("thickness"),i("visible"),i("range"),s.range&&!e[n].autorange){var c=s.range,u=e[n].range;c[0]=Math.min(c[0],u[0]),c[1]=Math.max(c[1],u[1])}else e[n]._needsExpand=!0;s.visible&&o.forEach(function(t){var n=e[t]||{};n.fixedrange=!0,e[t]=n})}}},{"../../lib":103,"./attributes":80}],83:[function(t,e,n){"use strict";n.setAttributes=function(t,e){for(var n in e)t.setAttribute(n,e[n])},n.appendChildren=function(t,e){for(var n=0;ns;s++){var c=l[s],u={_fullLayout:e},f=A.coerceRef(t,r,u,c);if("path"!==i){var d=.25,h=.75;if("paper"!==f){var p=A.getFromId(u,f),g=o(p);d=g(p.range[0]+d*(p.range[1]-p.range[0])),h=g(p.range[0]+h*(p.range[1]-p.range[0]))}n(c+"0",d),n(c+"1",h)}}return"path"===i?n("path"):M.noneOrAll(t,r,["x0","x1","y0","y1"]),r}function a(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function i(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function l(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function s(t,e,n){for(var r=0;re;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),C.draw(t,a)}function f(t,e,n,i){function l(n){var r={"data-index":e,"fill-rule":"evenodd",d:x(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",C.opacity).call(T.stroke,a).call(T.fill,C.fillcolor).call(L.dashLine,C.line.dash,C.line.width);E&&o.call(L.setClipUrl,"clip"+t._fullLayout._uid+E),t._context.editable&&d(t,o,C,e)}var s,c;h(t,e).selectAll('[data-index="'+e+'"]').remove();var u=t.layout.shapes[e];if(u){var f={xref:u.xref,yref:u.yref},g={};"string"==typeof n&&n?g[n]=i:M.isPlainObject(n)&&(g=n);var m=Object.keys(g);for(s=0;ss;s++){var b=y[s];if(void 0===g[b]&&void 0!==u[b]){var _,w=b.charAt(0),k=A.getFromId(t,A.coerceRef(f,{},t,w)),z=A.getFromId(t,A.coerceRef(u,{},t,w)),S=u[b];void 0!==g[w+"ref"]&&(k?(_=a(k)(S),S=(_-k.range[0])/(k.range[1]-k.range[0])):S=(S-z.domain[0])/(z.domain[1]-z.domain[0]),z?(_=z.range[0]+S*(z.range[1]-z.range[0]),S=o(z)(_)):S=k.domain[0]+S*(k.domain[1]-k.domain[0])),u[b]=S}}var C=r(u,t._fullLayout);t._fullLayout.shapes[e]=C;var E;if("below"!==C.layer)E=(C.xref+C.yref).replace(/paper/g,""),l(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)E="",l(t._fullLayout._shapeLowerLayer);else{var O,P=t._fullLayout._plots||{},N=Object.keys(P);for(s=0,c=N.length;c>s;s++)O=P[N[s]],E=N[s],p(t,C,O)&&l(O.shapelayer)}}}function d(t,e,n,r){function a(t){var n=W.right-W.left,r=W.bottom-W.top,a=t.clientX-W.left,o=t.clientY-W.top,i=n>G&&r>$&&!t.shiftKey?z.getCursor(a/n,1-o/r):"move";S(e,i),X=i.split("-")[0]}function o(e){B=A.getFromId(t,n.xref),H=A.getFromId(t,n.yref),V=v(t,B),Z=v(t,H,!0),U=y(t,B),Y=y(t,H,!0);var o="shapes["+r+"]";"path"===n.type?(F=n.path,q=o+".path"):(u=V(n.x0),f=Z(n.y0),d=V(n.x1),h=Z(n.y1),p=o+".x0",g=o+".y0",_=o+".x1",w=o+".y1"),d>u?(L=u,P=o+".x0",R="x0",C=d,N=o+".x1",j="x1"):(L=d,P=o+".x1",R="x1",C=u,N=o+".x0",j="x0"),h>f?(M=f,E=o+".y0",D="y0",T=h,O=o+".y1",I="y1"):(M=h,E=o+".y1",D="y1",T=f,O=o+".y0",I="y0"),c={},a(e),Q.moveFn="move"===X?l:s}function i(n){S(e),n&&k.relayout(t,c)}function l(r,a){if("path"===n.type){var o=function(t){return U(V(t)+r)};B&&"date"===B.type&&(o=m(o));var i=function(t){return Y(Z(t)+a)};H&&"date"===H.type&&(i=m(i)),n.path=b(F,o,i),c[q]=n.path}else c[p]=n.x0=U(u+r),c[g]=n.y0=Y(f+a),c[_]=n.x1=U(d+r),c[w]=n.y1=Y(h+a);e.attr("d",x(t,n))}function s(r,a){if("path"===n.type){var o=function(t){return U(V(t)+r)};B&&"date"===B.type&&(o=m(o));var i=function(t){return Y(Z(t)+a)};H&&"date"===H.type&&(i=m(i)),n.path=b(F,o,i),c[q]=n.path}else{var l=~X.indexOf("n")?M+a:M,s=~X.indexOf("s")?T+a:T,u=~X.indexOf("w")?L+r:L,f=~X.indexOf("e")?C+r:C;s-l>$&&(c[E]=n[D]=Y(l),c[O]=n[I]=Y(s)),f-u>G&&(c[P]=n[R]=U(u),c[N]=n[j]=U(f))}e.attr("d",x(t,n))}var c,u,f,d,h,p,g,_,w,M,T,L,C,E,O,P,N,D,I,R,j,F,q,B,H,V,Z,U,Y,X,G=10,$=10,Q={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Q.element.getBoundingClientRect();z.init(Q)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):M.log("getShapeLayer: undefined shape: index",e),r}function p(t,e,n){var r=k.Axes.getFromId(t,n.id,"x")._id,a=k.Axes.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function m(t){return function(e){return t(e).replace(" ","_")}}function v(t,e,n){var r,o=t._fullLayout._size;if(e){var i=a(e);r=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(r=g(r))}else r=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return r}function y(t,e,n){var r,a=t._fullLayout._size;if(e){var i=o(e);r=function(t){return i(e.p2l(t-e._offset))}}else r=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return r}function x(t,e){var n,r,o,i,l=e.type,s=A.getFromId(t,e.xref),c=A.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=a(s),r=function(t){return s._offset+s.l2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(o=a(c),i=function(t){return c._offset+c.l2p(o(t,!0))}):i=function(t){return u.t+u.h*(1-t)},"path"===l)return s&&"date"===s.type&&(r=g(r)),c&&"date"===c.type&&(i=g(i)),C.convertPath(e.path,r,i);var f=r(e.x0),d=r(e.x1),h=i(e.y0),p=i(e.y1);if("line"===l)return"M"+f+","+h+"L"+d+","+p;if("rect"===l)return"M"+f+","+h+"H"+d+"V"+p+"H"+f+"Z";var m=(f+d)/2,v=(h+p)/2,y=Math.abs(m-f),x=Math.abs(v-h),b="A"+y+","+x,_=m+y+","+v,w=m+","+(v-x);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function b(t,e,n){return t.replace(E,function(t){var r=0,a=t.charAt(0),o=P[a],i=N[a],l=D[a],s=t.substr(1).replace(O,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}function _(t,e,n,r,a){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(n)];if(r){var i,l,s,c,u,f=1/0,d=-(1/0),h=r.match(E);for("date"===t.type&&(o=g(o)),i=0;iu&&(f=u),u>d&&(d=u)));return d>=f?[f,d]:void 0}}var w=t("fast-isnumeric"),k=t("../../plotly"),M=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),L=t("../drawing"),z=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var n=t.shapes||[],a=e.shapes=[],o=0;ol&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),M.log("Ignoring extra params in segment "+t)),a+s})},C.calcAutorange=function(t){var e,n,r,a,o,i=t._fullLayout,l=i.shapes;if(l.length&&t._fullData.length)for(e=0;ed?n=d:(u.left-=x.offsetLeft,u.right-=x.offsetLeft,u.top-=x.offsetTop,u.bottom-=x.offsetTop,x.selection.each(function(){var t=s.bBox(this);l.bBoxIntersect(u,t,c)&&(n=Math.max(n,i*(t[x.side]-u[o])+c))}),n=Math.min(d,n)),n>0||0>d){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,S=E,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var E="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",z)}},{"../../lib":103,"../../lib/svg_text_utils":114,"../../plotly":121,"../../plots/plots":144,"../color":25,"../drawing":48,d3:16,"fast-isnumeric":18}],89:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:i,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":101,"../../plots/font_attributes":142,"../color/attributes":24}],90:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],91:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(s.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),s.exit().remove(),s.exit().size()&&v(t),0!==n.length){var c=s.selectAll("g."+T.headerGroupClassName).data(n,a);c.enter().append("g").classed(T.headerGroupClassName,!0);var u=s.selectAll("g."+T.buttonGroupClassName).data([0]);u.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&u.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){y.select(this).remove(),u.call(m).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],95:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],96:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.16.3",n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=r.register,n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=r.Snapshot,n.PlotSchema=r.PlotSchema,n.Queue=r.Queue,n.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":118,"./plot_api/to_image":119,"./plot_api/validate":120,"./plotly":121,"./snapshot/download":159,d3:16}],97:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],98:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)}},"boolean":{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(i(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n?!0:"string"!=typeof t?!1:!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var s=i[0].split("-");if(s.length>3||3!==s.length&&i[1])return!1;if(4===s[0].length)n=Number(s[0]);else{if(2!==s[0].length)return!1;var c=(new Date).getFullYear();n=((Number(s[0])-c+70)%100+200)%100+c-70}return l(n)?1===s.length?new Date(n,0,1).getTime():(r=Number(s[1])-1,s[1].length>2||!(r>=0&&11>=r)?!1:2===s.length?new Date(n,r,1).getTime():(a=Number(s[2]),s[2].length>2||!(a>=1&&31>=a)?!1:(a=new Date(n,r,a).getTime(), +i[1]?(s=i[1].split(":"),s.length>3?!1:(o=Number(s[0]),s[0].length>2||!(o>=0&&23>=o)?!1:(a+=36e5*o,1===s.length?a:(r=Number(s[1]),s[1].length>2||!(r>=0&&59>=r)?!1:(a+=6e4*r,2===s.length?a:(t=Number(s[2]),t>=0&&60>t?a+1e3*t:!1)))))):a))):!1},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){if("undefined"==typeof i)return void s.error("d3 is not defined.");e||(e=0);var n=new Date(t),a=i.time.format("%Y-%m-%d")(n);return 7776e6>e?(a+=" "+r(n.getHours(),2),432e6>e&&(a+=":"+r(n.getMinutes(),2),108e5>e&&(a+=":"+r(n.getSeconds(),2),3e5>e&&(a+="."+r(n.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var c={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"]},u={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"]},f=i.time.format.utc,d={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){d[t].D.push(f(e)),["H","I","D"].forEach(function(n){c[n].forEach(function(r){var a=d[t][n];a.push(f(e+"~"+r)),a.push(f(r+"~"+e))})})})});var h=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,m=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},x=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,k=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return M[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(h,p).replace(g,"").replace(m,"~").replace(v,y).replace(k,A).trim().replace(T,"");var e,n,r=null,i=a(t),l=o(t);e=d[i][l],n=e.length;for(var s=0;n>s&&!(r=e[s].parse(t));s++);if(!(r instanceof Date))return!1;var c=r.getTimezoneOffset();return r.setTime(r.getTime()+60*c*1e3),r}},{"../lib":103,d3:16,"fast-isnumeric":18}],100:[function(t,e,n){"use strict";var r=t("events").EventEmitter,a={init:function(t){if(t._ev instanceof r)return t;var e=new r;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(n,r){"undefined"!=typeof jQuery&&jQuery(t).trigger(n,r),e.emit(n,r)},t},triggerHandler:function(t,e,n){var r,a;"undefined"!=typeof jQuery&&(r=jQuery(t).triggerHandler(e,n));var o=t._ev;if(!o)return r;var i=o._events[e];if(!i)return r;"function"==typeof i&&(i=[i]);for(var l=i.pop(),s=0;sv;v++){s=t[v];for(c in s)u=g[c],f=s[c],l&&i(f)?g[c]=f:e&&f&&(o(f)||(d=i(f)))?(d?(d=!1,h=u&&i(u)?u:[]):h=u&&o(u)?u:{},g[c]=a([h,f],e,n,l)):("undefined"!=typeof f||n)&&(g[c]=f)}return g}var o=t("./is_plain_object.js"),i=Array.isArray;n.extendFlat=function(){return a(arguments,!1,!1,!1)},n.extendDeep=function(){return a(arguments,!0,!1,!1)},n.extendDeepAll=function(){return a(arguments,!0,!0,!1)},n.extendDeepNoArrays=function(){return a(arguments,!0,!1,!0)}},{"./is_plain_object.js":104}],102:[function(t,e,n){"use strict";e.exports=function(t){for(var e=[],n=0;nn?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.randstr=function d(t,e,n){if(n||(n=16),void 0===e&&(e=24),0>=e)return"0";var r,a,o,i=Math.log(Math.pow(2,e))/Math.log(n),l="";for(r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var s=i-Math.floor(i);for(r=0;r-1||c!==1/0&&c>=Math.pow(2,e)?d(t,e,n):l},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;s>n;n++)c[n]=(1-Math.cos(Math.PI*(n+1)/e))/(2*e);for(n=0;i>n;n++){for(o=0,r=0;s>r;r++)a=n+r+1-e,-i>a?a-=l*Math.round(a/l):a>=l&&(a-=l*Math.floor(a/l)),0>a?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;ra;a++)e[a][n]=t[a]},a.minExtend=function(t,e){var n={};"object"!=typeof e&&(e={});var r,o,i,l=3,s=Object.keys(t);for(r=0;r1?r+o[1]:"";if(a&&(o.length>1||i.length>4))for(;n.test(i);)i=i.replace(n,"$1"+a+"$2");return i+l}},{"./coerce":98,"./dates":99,"./extend":101,"./is_plain_object":104,"./loggers":105,"./matrix":106,"./nested_property":107,"./notifier":108,"./search":111,"./stats":113,d3:16}],104:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],105:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;er;r++)n[r]=new Array(e);return n},n.transposeRagged=function(t){var e,n,r=0,a=t.length;for(e=0;a>e;e++)r=Math.max(r,t[e].length);var o=new Array(r);for(e=0;r>e;e++)for(o[e]=new Array(a),n=0;a>n;n++)o[e][n]=t[n][e];return o},n.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var r,a,o=t.length;if(t[0].length)for(r=new Array(o),a=0;o>a;a++)r[a]=n.dot(t[a],e);else if(e[0].length){var i=n.transposeRagged(e);for(r=new Array(i.length),a=0;aa;a++)r+=t[a]*e[a];return r},n.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},n.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},n.rotationXYMatrix=function(t,e,r){return n.dot(n.dot(n.translationMatrix(e,r),n.rotationMatrix(t)),n.translationMatrix(-e,-r))},n.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var r=1===arguments.length?e[0]:[e[0],e[1]];return n.dot(t,[r[0],r[1],1]).slice(0,2)}},n.apply2DTransform2=function(t){var e=n.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],107:[function(t,e,n){"use strict";function r(t,e){return function(){var n,a,o,i,l,s=t;for(i=0;i=0;e--){if(r=t[e],i=!1,Array.isArray(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");ln||n>o||i>r||r>l?!1:!e||!c(t)}function n(t,e){var n=t[0],s=t[1];if(a>n||n>o||i>s||s>l)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;p>c;c++)if(u=g,f=m,g=r[c][0],m=r[c][1],d=Math.min(u,g),!(d>n||n>Math.max(u,g)||s>Math.max(f,m)))if(s=s&&n!==d&&v++}return v%2===1}var r=t.slice(),a=r[0][0],o=a,i=r[0][1],l=i;r.push(r[0]);for(var s=1;so;o++)if(i=[t[o][0]-s[0],t[o][1]-s[1]],l=r(i,c),0>l||l>u||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":106}],110:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;nt}function a(t,e){return e>=t}function o(t,e){return t>e}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("../lib");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;d>f&&h++<100;)c=Math.floor((f+d)/2),u(e[c],t)?f=c+1:d=c;return h>90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;r>l;l++)e[l+1]>e[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;o>a&&i++<100;)r=c((a+o)/2),e[r]<=t?a=r+l:o=r-s;return e[a]}},{"../lib":103,"fast-isnumeric":18}],112:[function(t,e,n){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],113:[function(t,e,n){"use strict";var r=t("fast-isnumeric");n.aggNums=function(t,e,a,o){var i,l;if(o||(o=a.length),r(e)||(e=!1),Array.isArray(a[0])){for(l=new Array(o),i=0;o>i;i++)l[i]=n.aggNums(t,e,a[i]);a=l}for(i=0;o>i;i++)r(e)?r(a[i])&&(e=t(+e,+a[i])):e=a[i];return e},n.len=function(t){return n.aggNums(function(t){return t+1},0,t)},n.mean=function(t,e){return e||(e=n.len(t)),n.aggNums(function(t,e){return t+e},0,t)/e},n.variance=function(t,e,a){return e||(e=n.len(t)),r(a)||(a=n.mean(t,e)),n.aggNums(function(t,e){return t+Math.pow(e-a,2)},0,t)/e},n.stdev=function(t,e,r){return Math.sqrt(n.variance(t,e,r))},n.interp=function(t,e){if(!r(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":18}],114:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,-1===m.indexOf(u.protocol)?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({"class":p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":94,"../constants/xmlns_namespaces":95,"../lib":103,d3:16}],115:[function(t,e,n){"use strict";function r(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function a(t){Array.isArray(t._promises)&&t._promises.length>0&&N.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),P.defaultConfig.setBackground(t,e)}function i(t,e){t._context||(t._context=N.extendFlat({},P.defaultConfig));var n=t._context;e&&(Object.keys(e).forEach(function(t){t in n&&("setBackground"===t&&"opaque"===e[t]?n[t]=o:n[t]=e[t])}),e.plot3dPixelRatio&&!n.plotGlPixelRatio&&(n.plotGlPixelRatio=n.plot3dPixelRatio)),n.staticPlot&&(n.editable=!1,n.autosizable=!1,n.scrollZoom=!1,n.doubleClick=!1,n.showTips=!1,n.showLink=!1,n.displayModeBar=!1)}function l(t,e,n){var r=C.select(t).selectAll(".plot-container").data([0]);r.enter().insert("div",":first-child").classed("plot-container plotly",!0);var a=r.selectAll(".svg-container").data([0]);a.enter().append("div").classed("svg-container",!0).style("position","relative"),a.html(""),e&&(t.data=e),n&&(t.layout=n),P.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(k(t,{}),t._fullLayout.autosize=n.autosize=!0),a.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=P.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},a.node()),t.framework.setUndoPoint();var o=t.framework.svg(),i=1,l=t._fullLayout.title;""!==l&&l||(i=0);var s="Click to enter title",c=function(){this.call(P.util.convertToTspans)},u=o.select(".title-group text").call(c);if(t._context.editable){u.attr({"data-unformatted":l}),l&&l!==s||(i=.2,u.attr({"data-unformatted":s}).text(s).style({opacity:i}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(P.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(c),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(c)})};u.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),R.addLinks(t),Promise.resolve()}function s(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var r=P.Axes.list({_fullLayout:t});for(e=0;ee;e++){var i=t.annotations[e];i.ref&&("paper"===i.ref?(i.xref="paper",i.yref="paper"):"data"===i.ref&&(i.xref="x",i.yref="y"),delete i.ref),c(i,"xref"),c(i,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(N.warn("Shapes must be an array."),delete t.shapes);var l=(t.shapes||[]).length;for(e=0;l>e;e++){var s=t.shapes[e];c(s,"xref"),c(s,"yref")}var u=t.legend;u&&(u.x>3?(u.x=1.02,u.xanchor="left"):u.x<-2&&(u.x=-.02,u.xanchor="right"),u.y>3?(u.y=1.02,u.yanchor="bottom"):u.y<-2&&(u.y=-.02,u.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=R.getSubplotIds(t,"gl3d");for(e=0;en;++n)x[n]=m[e]+v*y[2+4*n];h.camera={eye:{x:x[0],y:x[1],z:x[2]},center:{x:m[0],y:m[1],z:m[2]},up:{x:y[1],y:y[5],z:y[9]}},delete h.cameraposition}}return F.clean(t),t}function c(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=P.Axes.cleanId(n,r))}function u(t,e){for(var n=[],r=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),a=0;ao&&(l=N.randstr(r),-1!==n.indexOf(l));o++);i.uid=N.randstr(r),r.push(i.uid)}if(n.push(i.uid),"histogramy"===i.type&&"xbins"in i&&!("ybins"in i)&&(i.ybins=i.xbins,delete i.xbins),i.error_y&&"opacity"in i.error_y){var s=F.defaults,c=i.error_y.color||(R.traceIs(i,"bar")?F.defaultLine:s[a%s.length]);i.error_y.color=F.addOpacity(F.rgb(c),F.opacity(c)*i.error_y.opacity),delete i.error_y.opacity}if("bardir"in i&&("h"!==i.bardir||!R.traceIs(i,"bar")&&"histogram"!==i.type.substr(0,9)||(i.orientation="h",_(i)),delete i.bardir),"histogramy"===i.type&&_(i),"histogramx"!==i.type&&"histogramy"!==i.type||(i.type="histogram"),"scl"in i&&(i.colorscale=i.scl,delete i.scl),"reversescl"in i&&(i.reversescale=i.reversescl,delete i.reversescl),i.xaxis&&(i.xaxis=P.Axes.cleanId(i.xaxis,"x")),i.yaxis&&(i.yaxis=P.Axes.cleanId(i.yaxis,"y")),R.traceIs(i,"gl3d")&&i.scene&&(i.scene=R.subplotsRegistry.gl3d.cleanId(i.scene)),R.traceIs(i,"pie")||(Array.isArray(i.textposition)?i.textposition=i.textposition.map(f):i.textposition&&(i.textposition=f(i.textposition))),R.traceIs(i,"2dMap")&&("YIGnBu"===i.colorscale&&(i.colorscale="YlGnBu"),"YIOrRd"===i.colorscale&&(i.colorscale="YlOrRd")),R.traceIs(i,"markerColorscale")&&i.marker){var u=i.marker;"YIGnBu"===u.colorscale&&(u.colorscale="YlGnBu"),"YIOrRd"===u.colorscale&&(u.colorscale="YlOrRd")}if("surface"===i.type&&N.isPlainObject(i.contours)){var h=["x","y","z"];for(o=0;or?o.push(a+r):o.push(r);return o}function g(t,e,n){var r,a;for(r=0;r=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||0>a&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function m(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&g(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function v(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&s0){var l=w(t._boundingBoxMargins),s=l.left+l.right,c=l.bottom+l.top,u=o._container.node().getBoundingClientRect(),f=1-2*i.frameMargins;a=Math.round(f*(u.width-s)),r=Math.round(f*(u.height-c))}else n=window.getComputedStyle(t),r=parseFloat(n.height)||o.height,a=parseFloat(n.width)||o.width;return Math.abs(o.width-a)>1||Math.abs(o.height-r)>1?(o.height=t.layout.height=r,o.width=t.layout.width=a):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),R.sanitizeMargins(o),e}function M(t){var e=C.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===n.autosize&&(k(t,{}),n.autosize=!0,t.layout.autosize=!0),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];C.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=N.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0);var o=P.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),n._has("cartesian")&&T(t,o),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var i=n._paper.selectAll(".layer-subplot");n._imageSubplotLayer=i.selectAll(".imagelayer"),n._shapeSubplotLayer=i.selectAll(".shapelayer");var l=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=l.append("g").classed("imagelayer",!0),n._shapeUpperLayer=l.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var s=N.syncOrAsync([L,function(){return P.Axes.doTicks(t,"redraw")},j.init],t);return s&&s.then&&t._promises.push(s),s}function A(t,e){function n(e,n){return function(){return P.Axes.getFromId(t,e,n)}}for(var r,a,o=t._fullLayout._plots={},i=0;i0,_=P.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),k=w===_;b?t.framework===M&&!x&&k||(t.framework=M,M(t)):k?x&&M(t):(t.framework=M,M(t)),x&&P.Axes.saveRangeInitial(t);var A=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&h(t);for(var z=0;zG.range[0]?[1,2]:[2,1]);else{var Q=G.range[0],W=G.range[1];"log"===j?(0>=Q&&0>=W&&o(U+".autorange",!0),0>=Q?Q=W/1e6:0>=W&&(W=Q/1e6),o(U+".range[0]",Math.log(Q)/Math.LN10),o(U+".range[1]",Math.log(W)/Math.LN10)):(o(U+".range[0]",Math.pow(10,Q)),o(U+".range[1]",Math.pow(10,W)))}else o(U+".autorange",!0)}if("reverse"===B)Y.range?Y.range.reverse():(o(U+".autorange",!0),Y.range=[1,0]),X.autorange?w=!0:_=!0;else if("annotations"===D.parts[0]||"shapes"===D.parts[0]){var J=D.parts[1],K=D.parts[0],tt=g[K]||[],et=P[N.titleCase(K)],nt=tt[J]||{};2===D.parts.length&&("add"===v[E]||N.isPlainObject(v[E])?z[E]="remove":"remove"===v[E]?-1===J?(z[K]=tt, +delete z[E]):z[E]=nt:N.log("???",v)),!i(nt,"x")&&!i(nt,"y")||N.containsAny(E,["color","opacity","align","dash"])||(w=!0),et.draw(t,J,D.parts.slice(2).join("."),v[E]),delete v[E]}else if("images"===D.parts[0]){var at=N.objectFromPath(E,j);N.extendDeepAll(t.layout,at),H.supplyLayoutDefaults(t.layout,t._fullLayout),H.draw(t)}else if("mapbox"===D.parts[0]&&"layers"===D.parts[1]){N.extendDeepAll(t.layout,N.objectFromPath(E,j));var ot=(t._fullLayout.mapbox||{}).layers||[];for(O=D.parts[2]+1-ot.length,p=0;O>p;p++)ot.push({});_=!0}else if("updatemenus"===D.parts[0]){N.extendDeepAll(t.layout,N.objectFromPath(E,j));var it=t._fullLayout.updatemenus||[];for(O=D.parts[2]+1-it.length,p=0;O>p;p++)it.push({});_=!0}else 0===D.parts[0].indexOf("scene")?_=!0:0===D.parts[0].indexOf("geo")?_=!0:0===D.parts[0].indexOf("ternary")?_=!0:!m._has("gl2d")||-1===E.indexOf("axis")&&"plot_bgcolor"!==D.parts[0]?"hiddenlabels"===E?w=!0:-1!==D.parts[0].indexOf("legend")?y=!0:-1!==E.indexOf("title")?x=!0:-1!==D.parts[0].indexOf("bgcolor")?b=!0:D.parts.length>1&&N.containsAny(D.parts[1],["tick","exponent","grid","zeroline"])?x=!0:-1!==E.indexOf(".linewidth")&&-1!==E.indexOf("axis")?x=b=!0:D.parts.length>1&&-1!==D.parts[1].indexOf("line")?b=!0:D.parts.length>1&&"mirror"===D.parts[1]?x=b=!0:"margin.pad"===E?x=b=!0:"margin"===D.parts[0]||"autorange"===D.parts[1]||"rangemode"===D.parts[1]||"type"===D.parts[1]||"domain"===D.parts[1]||E.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(E)?M=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(E)&&(_=!0):_=!0,D.set(j)}I.add(t,rt,[t,z],rt,[t,T]),v.autosize&&(v=k(t,v)),(v.height||v.width||v.autosize)&&(w=!0);var lt=Object.keys(v),st=[R.previousPromises];if(_||w)st.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),P.plot(t,"",g)});else if(lt.length&&(R.supplyDefaults(t),m=t._fullLayout,y&&st.push(function(){return V.draw(t),R.previousPromises(t)}),b&&st.push(L),x&&st.push(function(){return P.Axes.doTicks(t,"redraw"),S(t),R.previousPromises(t)}),M)){var ct;for($(t),P.Fx.supplyLayoutDefaults(t.layout,m,t._fullData),P.Fx.init(t),ct=R.getSubplotIds(m,"gl3d"),p=0;p1)};c(n.width)&&c(n.height)||l(new Error("Height and width should be pixel values."));var u=r.clone(e,{format:"png",height:n.height,width:n.width}),f=u.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var d=r.getRedrawFunc(f);o.plot(f,u.data,u.layout,u.config).then(d).then(s).then(function(e){t(e)}).catch(function(t){l(t)})});return l}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib");e.exports=r},{"../lib":103,"../plotly":121,"../snapshot":161,"fast-isnumeric":18}],120:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;m>v;v++){var y=n[v],x=["data",v];if(p(y)){var b=u[v],_=b.type,w=l.traces[_].attributes;w.type={valType:"enumerated",values:[_]},b.visible===!1&&y.visible!==!1&&s.push(i("invisible",x)),r(y,b,w,s,x);var k=y.transforms,M=b.transforms;if(k){g(k)||s.push(i("array",x,["transforms"])),x.push("transforms");for(var A=0;Ac&&u>e&&(void 0===a[n]?o[f]=T.tickText(t,e):o[f]=l(t,e,String(a[n])),f++);return f=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function i(t,e){var n=t.match(B),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(B,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o=e.x,l=t._tickround,s=new Date(o),c="";n&&t.hoverformat?a=i(t.hoverformat,o):t.tickformat?a=i(t.tickformat,o):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[l]),"y"===l?a=D(s):"m"===l?a=I(s):(o!==t._tmin||n||(c="
"+D(s)),"d"===l?a=R(s):"H"===l?a=j(s):(o!==t._tmin||n||(c="
"+R(s)+", "+D(s)),a=F(s),"M"!==l&&(a+=q(s),"S"!==l&&(a+=d(v(o/1e3,1),t,"none",n).substr(1)))))),e.text=a+c}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>i?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=0>t,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat;if(r){var u={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(u),i=(Number(u._tickround)||0)+4,s=u._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),f>t)t="0",a=!1;else{if(t+=f,s&&(t*=Math.pow(10,-s),i+=s),0===i)t=String(Math.floor(t));else if(0>i){t=String(Math.round(t)),t=t.substr(0,t.length+i);for(var d=i;0>d;d++)t+="0"}else{t=String(t);var h=t.indexOf(".")+1;h&&(t=t.substr(0,h+i).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(s&&"hide"!==l){var p;p=0>s?"\u2212"+-s:"power"!==l?"+"+s:String(s),"e"===l||("SI"===l||"B"===l)&&(s>12||-15>s)?t+="e"+p:"E"===l?t+="E"+p:"power"===l?t+="\xd710"+p+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=H[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var p=r-1,g=r+1;n="tozero"===t.rangemode?0>r?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var n=T.list(t,"",!0),r=!1,a=0;ap&&(p=g/10),c=t.c2l(p),u=t.c2l(g),y&&(c=Math.min(0,c),u=Math.max(0,u)),r(c)){for(h=!0,i=0;i=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;6>o;o++)a(o);for(o=m-1;o>5;o--)a(o)}},T.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,i]};T.autoTicks(f,l);var d,h=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;yg&&(p>.3*b||a(o)||a(i))){var w=f.dtick/2;h+=o>h+w?w:-w}var k=1+Math.floor((i-h)/f.dtick);d=h+k*f.dtick}else for(d=h;i>=d;)d=T.tickIncrement(d,f.dtick);return{start:h,end:d,size:f.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return r(t);if("auto"===t.tickmode||!t.dtick){var e,n=t.nticks;n||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/e):(e="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var a=t.range[1]=l:l>=s)&&(i.push(s),!(i.length>1e3));s=T.tickIncrement(s,t.dtick,a));t._tmax=i[i.length-1];for(var c=new Array(i.length),u=0;u157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,S)):e>12096e5?(e/=26298e5,t.dtick="M"+a(e,1,C)):e>432e5?(t.dtick=a(e,864e5,O),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=a(e,36e5,C):e>3e4?t.dtick=a(e,6e4,E):e>500?t.dtick=a(e,1e3,E):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?N:P,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]r:r>c;)c=T.tickIncrement(c,a,e);return c}if("L"===u)return Math.log(n((Math.pow(10,r)-o)/f)*f+o)/Math.LN10;if("D"===u){var d="D2"===a?N:P,h=_.roundUp(v(r,1),d,e);return Math.floor(r)+Math.log(y.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(a)};var D=y.time.format("%Y"),I=y.time.format("%b %Y"),R=y.time.format("%b %-d"),j=y.time.format("%b %-d %Hh"),F=y.time.format("%H:%M"),q=y.time.format(":%S"),B=/%(\d?)f/g;T.tickText=function(t,e,n){function r(r){var a;return void 0===r?!0:n?"none"===r:(a={first:t._tmin,last:t._tmax}[r],"all"!==r&&e!==a)}var a,o,i=l(t,e),d="array"===t.tickmode,h=n||d;if(d&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&en&&(M=90),a(u,M)}c._lastangle=M}return i(e),e+" done"}function s(){c._boundingBox=n.node().getBoundingClientRect()}var u=n.selectAll("g."+C).data(z,S);if(!c.showticklabels||!x(r))return u.remove(),void i(e);var f,d,p,v,b;"x"===m?(b="bottom"===q?1:-1,f=function(t){return t.dx+D*b},v=r+(N+P)*b,d=function(t){return t.dy+v+t.fontSize*("bottom"===q?1:-.5)},p=function(t){return x(t)&&0!==t&&180!==t?0>t*b?"end":"start":"middle"}):(b="right"===q?1:-1,d=function(t){return t.dy+t.fontSize/2-D*b},f=function(t){return t.dx+r+(N+P+(90===Math.abs(c.tickangle)?t.fontSize/2:0))*b},p=function(t){return x(t)&&90===Math.abs(t)?"middle":"right"===q?"start":"end"});var k=0,M=0,T=[];u.enter().append("g").classed(C,1).append("text").attr("text-anchor","middle").each(function(e){var n=y.select(this),r=t._promises.length;n.call(A.setPosition,f(e),d(e)).call(A.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),r=t._promises[r],r?T.push(t._promises.pop().then(function(){a(n,c.tickangle)})):a(n,c.tickangle)}),u.exit().remove(),u.each(function(t){k=Math.max(k,t.fontSize)}),a(u,c._lastangle||c.tickangle);var L=_.syncOrAsync([o,l,s]);return L&&L.then&&t._promises.push(L),L}function i(e){if(!n){var r,a,o,i,l=L.getFromId(t,e),s=y.select(t).selectAll("g."+e+"tick"),c={selection:s,side:l.side},f=e.charAt(0),d=t._fullLayout._size,h=1.5,p=l.titlefont.size;if(s.size()){var g=y.select(s.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);g&&(c.offsetLeft=+g[1],c.offsetTop=+g[2])}"x"===f?(a="free"===l.anchor?{_offset:d.t+(1-(l.position||0))*d.h,_length:0}:L.getFromId(t,l.anchor),o=l._offset+l._length/2,i=a._offset+("top"===l.side?-10-p*(h+(l.showticklabels?1:0)):a._length+10+p*(h+(l.showticklabels?1.5:.5))),l.rangeslider&&l.rangeslider.visible&&l._boundingBox&&(i+=(u.height-u.margin.b-u.margin.t)*l.rangeslider.thickness+l._boundingBox.height),c.side||(c.side="bottom")):(a="free"===l.anchor?{_offset:d.l+(l.position||0)*d.w,_length:0}:L.getFromId(t,l.anchor),i=l._offset+l._length/2,o=a._offset+("right"===l.side?a._length+10+p*(h+(l.showticklabels?1:.5)):-10-p*(h+(l.showticklabels?.5:0))),r={rotate:"-90",offset:0},c.side||(c.side="left")),k.draw(t,e+"title",{propContainer:l,propName:l._name+".title",dfltName:f.toUpperCase()+" axis",avoid:c,transform:r,attributes:{x:o,y:i,"text-anchor":"middle"}})}}function l(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:b.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[m]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===m}function s(e,n,a){var o=e.gridlayer,i=e.zerolinelayer,s=e["hidegrid"+m]?[]:H,u=c._gridpath||"M0,0"+("x"===m?"v":"h")+n._length,f=o.selectAll("path."+E).data(c.showgrid===!1?[]:s,S);if(f.enter().append("path").classed(E,1).classed("crisp",1).attr("d",u).each(function(t){c.zeroline&&("linear"===c.type||"-"===c.type)&&Math.abs(t.x)g;g++){var y=c.mirrors[i._id+d[g]];"ticks"!==y&&"labels"!==y||(f[g]=!0)}return void 0!==r[2]&&(f[2]=!0),f.forEach(function(t,e){var n=r[e],a=B[e];t&&x(n)&&(h+=p(n+P*a,a*c.ticklen))}),a(n,h),s(e,i,t),o(n,r[3])}}).filter(function(t){return t&&t.then});return Z.length?Promise.all(Z):0},T.swap=function(t,e){for(var n=h(t,e),r=0;r2*r}function u(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var f=t("fast-isnumeric"),d=t("tinycolor2").mix,h=t("../../lib"),p=t("../plots"),g=t("../../components/color/attributes").lightFraction,m=t("./layout_attributes"),v=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),x=t("./tick_label_defaults"),b=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),k=t("./clean_datum"),M=t("./axis_ids");e.exports=function(t,e,n,a){function o(n,r){return h.coerce2(t,e,m,n,r)}var i=a.letter,l=a.font||{},s="Click to enter "+(a.title||i.toUpperCase()+" axis")+" title";a.name&&(e._name=a.name,e._id=M.name2id(a.name));var c=n("type");"-"===c&&(r(e,a.data),"-"===e.type?e.type="linear":c=t.type=e.type),_(e);var u=n("color"),p=u===t.color?u:l.color;n("title",s),h.coerceFont(n,"titlefont",{family:l.family,size:Math.round(1.2*l.size),color:p});var k=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),A=n("autorange",!k);A&&n("rangemode");var T=n("range",[-1,"x"===i?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),h.noneOrAll(t.range,e.range,[0,1]),n("fixedrange"),v(t,e,n,c),x(t,e,n,c,a),y(t,e,n,a),b(t,e,n);var L=o("linecolor",u),z=o("linewidth"),S=n("showline",!!L||!!z);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&n("mirror");var C=o("gridcolor",d(u,a.bgColor,g).toRgbString()),E=o("gridwidth"),O=n("showgrid",a.showGrid||!!C||!!E);O||(delete e.gridcolor,delete e.gridwidth);var P=o("zerolinecolor",u),N=o("zerolinewidth"),D=n("zeroline",a.showGrid||!!P||!!N);return D||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===c?w(i,e.categoryorder,e.categoryarray,a.data):[],e}},{"../../components/color/attributes":24,"../../lib":103,"../plots":144,"./axis_ids":126,"./category_order_defaults":127,"./clean_datum":128,"./layout_attributes":133,"./ordered_categories":135,"./set_convert":138,"./tick_label_defaults":139,"./tick_mark_defaults":140,"./tick_value_defaults":141,"fast-isnumeric":18,tinycolor2:20}],126:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],128:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return a.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){a.error(e,t)}return t}},{"../../lib":103,"fast-isnumeric":18}],129:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],130:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?u.ms2DateTime(r,a):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/setcursor"),g=t("../../components/dragelement"),m=t("./axes"),v=t("./select"),y=t("./constants"),x=!0;e.exports=function(t,e,n,l,b,_,w,k){function M(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+gt+")").attr("d",st+"Z"),dt=ht.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+gt+")").attr("d","M0,0Z"),L();for(var o=0;oa?(ut="",it.r=it.l,it.t=it.b,dt.attr("d","M0,0Z")):(it.t=0,it.b=V,ut="x",dt.attr("d","M"+(it.l-.5)+","+(ot-U-.5)+"h-3v"+(2*U+1)+"h3ZM"+(it.r+.5)+","+(ot-U-.5)+"h3v"+(2*U+1)+"h-3Z")):!W||a.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function S(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),x=!1)))}function E(e,n){var a=1===(w+k).length;if(e)I();else if(2!==n||a){if(1===n&&a){var o=w?B[0]:q[0],i="s"===w||"w"===k?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",d="middle";if(o.fixedrange)return;w?(d="n"===w?"top":"bottom","right"===o.side&&(u="right")):"e"===k&&(u="right"),et.call(f.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:d}).on("edit",function(e){var n="category"===o.type?o.c2l(e):o.d2l(e);void 0!==n&&c.relayout(t,l,n)})}}else D()}function O(e){function n(t,e,n){if(!t.fixedrange){A(t.range);var r=t.range,a=r[0]+(r[1]-r[0])*e;t.range=[a+(r[0]-a)*n,a+(r[1]-a)*n]}}if(t._context.scrollZoom||j._enablescrollzoom){var r=t.querySelector(".plotly");if(!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(vt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void u.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=mt[0]+mt[2]*s,f=(l.bottom-e.clientY)/l.height,d=mt[1]+mt[3]*(1-f);if(k){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,n){for(var a=1-e,o=0,i=0;i0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rT;T++){var L=o[T],z=h[L];if(z)M[T]=w.getFromId(t,z.xaxis._id),A[T]=w.getFromId(t,z.yaxis._id);else{var S=i[L]._subplot;M[T]=S.xaxis,A[T]=S.yaxis}}var C=e.hovermode||i.hovermode;if(-1===["x","y","closest"].indexOf(C)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var E,O,P,N,D,I,R,j,F,q,B,H,V=[],Z=[];if(Array.isArray(e))for(C="array",P=0;PU||U>X.width||0>Y||Y>X.height)return _.unhoverRaw(t,e)}else U="xpx"in e?e.xpx:M[0]._length/2,Y="ypx"in e?e.ypx:A[0]._length/2;if(E="xval"in e?r(o,e.xval):a(M,U),O="yval"in e?r(o,e.yval):a(A,Y),!g(E[0])||!g(O[0]))return m.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var G=1/0;for(N=0;N1||-1!==I.hoverinfo.indexOf("name")?I.name:void 0,index:!1,distance:Math.min(G,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},H=V.length,"array"===j){var $=e[N];"pointNumber"in $?(B.index=$.pointNumber,j="closest"):(j="","xval"in $&&(F=$.xval,j="x"),"yval"in $&&(q=$.yval,j=j?"closest":"y"))}else F=E[R],q=O[R];if(I._module&&I._module.hoverPoints){var Q=I._module.hoverPoints(B,F,q,j);if(Q)for(var W,J=0;JH&&(V.splice(0,H),G=V[0].distance)}if(0===V.length)return _.unhoverRaw(t,e);var K="y"===C&&Z.length>1;V.sort(function(t,e){return t.distance-e.distance});var tt=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),et={hovermode:C,rotateLabels:K,bgColor:tt,container:i._hoverlayer,outerContainer:i._paperdiv},nt=c(V,et);u(V,K?"xa":"ya"),f(nt,K);var rt=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*O):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,L=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),N=L.width+E+O+m;t.ty0=_-L.top,t.bx=L.width+2*O,t.by=L.height+2*O,t.anchor="start",t.txwidth=L.width,t.tx2width=m,t.offset=0,o?(t.pos=z,v=M>=S+P/2+N,k=S-P/2-N>=0,"top"!==t.idealAlign&&v||!k?v?(S+=P/2,t.anchor="start"):t.anchor="middle":(S-=P/2,t.anchor="end")):(t.pos=S,v=w>=z+C/2+N,k=z-C/2-N>=0,"left"!==t.idealAlign&&v||!k?v?(z+=C/2,t.anchor="start"):t.anchor="middle":(z-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+S+")"+(o?"rotate("+T+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(.01>o)){if(-.01>a){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(0>=c);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=c);i++)if(s=t[i],s.pos=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(0>=c);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?z:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0 +}[t.anchor],i=o*(E+O),l=i+o*(t.txwidth+O),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=t.offset*S),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*E+s)+","+(E+c)+"v"+(t.by/2-E)+"h"+r*t.bx+"v-"+t.by+"H"+(r*E+s)+"V"+(c-E)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+O).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*O+s,c+t.ty0-t.by/2+O),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,n){function r(n,r){return m.coerce(t,e,A.layoutAttributes,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},A.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indext*e||0===t?k.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":25,"../../components/dragelement":46,"../../components/drawing":48,"../../lib":103,"../../lib/events":100,"../../lib/svg_text_utils":114,"./axes":124,"./constants":129,"./dragbox":130,d3:16,"fast-isnumeric":18,tinycolor2:20}],132:[function(t,e,n){"use strict";var r=t("../plots"),a=t("./constants");n.name="cartesian",n.attr=["xaxis","yaxis"],n.idRoot=["x","y"],n.idRegex=a.idRegex,n.attrRegex=a.attrRegex,n.attributes=t("./attributes"),n.plot=function(t){function e(t,e){for(var n=[],r=0;rf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":103,"fast-isnumeric":18}],137:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.x()._offset,y=a.plotinfo.y()._offset,x=e-m.left,b=n-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var C,E,O,P,N,D=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,j=[];for(C=0;C0)return Math.log(e)/Math.LN10;if(0>=e&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*u*Math.abs(r-a))}return i.BADNUM}function n(t){return Math.pow(10,t)}function c(t){return a(t)?Number(t):i.BADNUM}var u=10;if(t.c2l="log"===t.type?e:c,t.l2c="log"===t.type?n:c,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var r=s.getFromId(t._gd,t.overlaying);t.domain=r.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)a(t.range[e])||(t.range[e]=a(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):i.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=c,t.d2c=function(t){return t=l(t),a(t)?Number(t):i.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return a(t)?o.ms2DateTime(t):i.BADNUM},t.d2c=function(t){return a(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!a(t.range[0])&&a(f[0])&&(t.range[0]=f[0]),!a(t.range[1])&&a(f[1])&&(t.range[1]=f[1])}catch(d){o.error(d,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var n=t._categories.indexOf(e);return-1===n?i.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&a(t,i),l.text(i.text()&&c.text()?" - ":"")},h.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=h.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},h.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},a=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];h.supplyLayoutGlobalDefaults(a,r),r._dataLength=s.length,h.supplyDataDefaults(s,l,r),r._has=h._hasPlotType.bind(r);var c=r._modules;for(e=0;eo&&(e=(n-1)/(a.l+a.r),a.l=Math.floor(e*a.l),a.r=Math.floor(e*a.r)),0>i&&(e=(r-1)/(a.t+a.b),a.t=Math.floor(e*a.t),a.b=Math.floor(e*a.b))}},h.autoMargin=function(t,e,n){var r=t._fullLayout;if(r._pushmargin||(r._pushmargin={}),r.margin.autoexpand!==!1){if(n){var a=void 0===n.pad?12:n.pad;n.l+n.r>.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||h.doAutoMargin(t)}},h.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;return e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x); +}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,t._replotting||"{}"===r||r===JSON.stringify(e._size)?void 0:u.plot(t)},h.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?f.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&h.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)}},{"../components/color":25,"../lib":103,"../plotly":121,"./attributes":122,"./font_attributes":142,"./layout_attributes":143,d3:16,"fast-isnumeric":18}],145:[function(t,e,n){"use strict";var r=t("../../traces/scatter/attributes"),a=r.marker;e.exports={r:r.r,t:r.t,marker:{color:a.color,size:a.size,symbol:a.symbol,opacity:a.opacity}}},{"../../traces/scatter/attributes":237}],146:[function(t,e,n){"use strict";function r(t,e){var n={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,n)}var a=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,i=o({},a.domain,{});e.exports={radialaxis:r("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:i,orientation:{valType:"number"}}),angularaxis:r("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:i}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":101,"../cartesian/layout_attributes":133}],147:[function(t,e,n){var r=t("../../plotly"),a=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},i=r.Lib.extendDeepAll;o.Axis=function(){function t(t){n=t||n;var c=s.data,f=s.layout;return("string"==typeof n||n.nodeName)&&(n=a.select(n)),n.datum(c).each(function(t,n){function s(t,e){return l(t)%360+f.orientation}var c=t.slice();u={data:o.util.cloneJson(c),layout:o.util.cloneJson(f)};var d=0;c.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[d],d=(d+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:a.rgb(t.color).darker().toString()),u.data[e].color=t.color,u.data[e].strokeColor=t.strokeColor,u.data[e].strokeDash=t.strokeDash,u.data[e].strokeSize=t.strokeSize});var h=c.filter(function(t,e){var n=t.visible;return"undefined"==typeof n||n===!0}),p=!1,g=h.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var m=a.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(g),v=[],y=m.map(function(t,e){if("unstacked"===t.key)return t.values;var n=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,r){t.yStack=[n],v.push(n),n=o.util.sumArrays(t.r,n)}),t.values});h=a.merge(y)}h.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var x=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;x=Math.max(10,x);var b,_=[f.margin.left+x,f.margin.top+x];if(p){var w=a.max(o.util.sumArrays(o.util.arrayLast(h).r[0],o.util.arrayLast(v)));b=[0,w]}else b=a.extent(o.util.flattenArray(h.map(function(t,e){return t.r})));f.radialAxis.domain!=o.DATAEXTENT&&(b[0]=0),r=a.scale.linear().domain(f.radialAxis.domain!=o.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:b).range([0,x]),u.layout.radialAxis.domain=r.domain();var k,M=o.util.flattenArray(h.map(function(t,e){return t.t})),A="string"==typeof M[0];A&&(M=o.util.deduplicate(M),k=M.slice(),M=a.range(M.length),h=h.map(function(t,e){var n=t;return t.t=[M],p&&(n.yStack=t.yStack),n}));var T=h.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===h.length,L=null===f.needsEndSpacing?A||!T:f.needsEndSpacing,z=f.angularAxis.domain&&f.angularAxis.domain!=o.DATAEXTENT&&!A&&f.angularAxis.domain[0]>=0,S=z?f.angularAxis.domain:a.extent(M),C=Math.abs(M[1]-M[0]);T&&!A&&(C=0);var E=S.slice();L&&A&&(E[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(E[1]-E[0])/O);var P=f.angularAxis.ticksStep||(E[1]-E[0])/(O*(f.minorTicks+1));k&&(P=Math.max(Math.round(P),1)),E[2]||(E[2]=P);var N=a.range.apply(this,E);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=a.scale.linear().domain(E.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?C:0,e=a.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var D="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(D,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=a.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,F=e.select(".chart-group"),q={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=o.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});o.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:j,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=j.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),j.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Z=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Z[0]=Math.max(0,Z[0]),Z[1]=Math.max(0,Z[1]),e.select(".outer-group").attr("transform","translate("+Z+")"),f.title){var U=e.select("g.title-group text").style(B).text(f.title),Y=U.node().getBBox();U.attr({x:_[0]-Y.width/2,y:_[1]-x-20})}var X=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var G=X.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({"class":"grid-circle"}).style(q),G.attr("r",r),G.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(q);var $=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=a.svg.axis().scale(r).ticks(5).tickSize(5);X.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(q),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(q),J.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=W.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?270>n&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(180>=n&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=a.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=a.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return i(o[n].defaultConfig(),t)});o[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=o.tooltipPanel().config({container:ct,fontSize:8})(),ft=o.tooltipPanel().config({container:ct,fontSize:8})(),dt=o.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos($).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=o.util.convertToCartesian(x+12,n+180);ut.text(o.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos($).radius;pt.attr({r:n}).style({opacity:.5}),lt=r.invert(o.util.getMousePos($).radius);var a=o.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(o.util.round(lt)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var r=a.select(this),i=r.style("fill"),l="black",s=r.style("opacity")||1;if(r.attr({"data-opacity":s}),"none"!=i){r.attr({"data-fill":i}),l=a.hsl(i).darker().toString(),r.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-Z[0]-d.left,f.top+f.height/2-Z[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else i=r.style("stroke"),r.attr({"data-stroke":i}),l=a.hsl(i).darker().toString(),r.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=a.event.which?!1:void(a.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=a.select(this),r=n.attr("data-fill");r?n.style({fill:r,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,r,l,s={data:[],layout:{}},c={},u={},f=a.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),i(s.data[e],o.Axis.defaultConfig().data[0]),i(s.data[e],t)}),i(s.layout,o.Axis.defaultConfig().layout),i(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return r},d.angularScale=function(t){return l},d.svg=function(){return e},a.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:a.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},o.util._extend=function(t,e){for(var n in t)e[n]=t[n]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var n=e||6,r=a.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return r},o.util.dataFromEquation=function(t,e,n){var r=e||6,o=[],i=[];a.range(0,360+r,r).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return a.range(e).map(function(t,e){return n[e]||n[0]})},o.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=o.util.ensureArray(t[e],n)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},o.util.sumArrays=function(t,e){return a.zip(t,e).map(function(t,e){return a.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return-2===n},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},o.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},o.util.getMousePos=function(t){var e=a.mouse(t.node()),n=e[0],r=e[1],o={};return o.x=n,o.y=r,o.pos=e,o.angle=180*(Math.atan2(r,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+r*r),o},o.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;o>a;a++)e=t[a],e in n?(n[e]++,r[e]=n[e]):n[e]=1;return r},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,n,r){if(r){var a=n.slice();n=e,e=a}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,n,r){return"undefined"!=typeof t?(r===e.length-1&&delete t[n],t[n]):void 0},t),n.reduce(function(t,e,r){return"undefined"==typeof t[e]&&(t[e]={}),r===n.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=n[0].geometryConfig,e=t.container;"string"==typeof e&&(e=a.select(e)),e.datum(n).each(function(e,n){function r(e,n){var r=t.radialScale(e[1]),a=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:r,t:a}}function o(t){var e=t.r*Math.cos(t.t),n=t.r*Math.sin(t.t);return{x:e,y:n}}var i=!!e[0].data.yStack,s=e.map(function(t,e){return i?a.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):a.zip(t.data.t[0],t.data.r[0])}),c=t.angularScale,u=t.radialScale.domain()[0],f={};f.bar=function(n,r,o){var i=e[o].data,l=t.radialScale(n[1])-t.radialScale(0),s=t.radialScale(n[2]||0),u=i.barWidth;a.select(this).attr({"class":"mark bar",d:"M"+[[l+s,-u/2],[l+s,u/2],[s,u/2],[s,-u/2]].join("L")+"Z",transform:function(e,n){return"rotate("+(t.orientation+c(e[0]))+")"}})},f.dot=function(t,n,i){var l=t[2]?[t[0],t[1]+t[2]]:t,s=a.svg.symbol().size(e[i].data.dotSize).type(e[i].data.dotType)(t,n);a.select(this).attr({"class":"mark dot",d:s,transform:function(t,e){var n=o(r(l));return"translate("+[n.x,n.y]+")"}})};var d=a.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(n,r,o){var i=n[2]?s[o].map(function(t,e){return[t[0],t[1]+t[2]]}):s[o];if(a.select(this).each(f.dot).style({opacity:function(t,n){return+e[o].data.dotVisible},fill:m.stroke(n,r,o)}).attr({"class":"mark dot"}),!(r>0)){var l=a.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({"class":"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(n,r,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(n,r,o)},"stroke-width":function(t,e){return m["stroke-width"](n,r,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](n,r,o)},opacity:function(t,e){return m.opacity(n,r,o)},display:function(t,e){return m.display(n,r,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=a.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,r){a.select(this).attr({"class":"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=a.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({"class":"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[o.PolyChart.defaultConfig()],r=a.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),i(n[e],o.PolyChart.defaultConfig()),i(n[e],t)}),this):n},t.getColorScale=function(){return e},a.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:a.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var n=e.legendConfig,r=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=i({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),o=a.merge(r);o=o.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(o=o.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=a.select(l));var s=o.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof o[0]:n.isContinuous,f=u?n.height:c*o.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=a.range(o.length),m=a.scale[u?"linear":"ordinal"]().domain(g).range(s),v=a.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=a.svg.symbolTypes.indexOf(t)?a.svg.symbol().type(t).size(n)():a.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=a.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),n=a.dispatch("hover");return t.config=function(t){return arguments.length?(i(e,t),this):e},a.rebind(t,n,"on"),t},o.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},o.tooltipPanel=function(){var t,e,n,r={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){t=r.container.selectAll("g."+l).data([0]);var a=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=a.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=a.append("text").attr({dx:r.padding+s,dy:.3*+r.fontSize}),c};return c.text=function(o){var i=a.hsl(r.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":r.fontSize+"px"}).text(f);var d=r.padding,h=e.node().getBBox(),p={fill:r.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return n.attr({d:"M"+[[s,-m/2],[s,-m/4],[r.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c):void 0},c.hide=function(){return t?(t.style({display:"none"}),c):void 0},c.show=function(){return t?(t.style({display:"block"}),c):void 0},c.config=function(t){return i(r,t),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=i({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var r=o.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var a=r.indexOf(t.geometry);-1!=a&&(n.data[e].groupId=a)})}if(t.layout){var l=i({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};a.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../plotly":121,"./micropolar_manager":148,d3:16}],148:[function(t,e,n){"use strict";var r=t("../../plotly"),a=t("d3"),o=t("./undo_manager"),i=e.exports={},l=r.Lib.extendDeepAll;i.framework=function(t){function e(e,o){return o&&(f=o),a.select(a.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?l(n,e):e,c||(c=r.micropolar.Axis()),u=r.micropolar.adapter.plotly().convert(n),c.config(u).render(f),t.data=n.data,t.layout=n.layout,i.fillLayout(t),n}var n,s,c,u,f,d=new o;return e.isPolar=!0,e.svg=function(){return c.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return r.micropolar.adapter.plotly().convert(c.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:c.angularScale(),r:c.radialScale()}},e.setUndoPoint=function(){var t=this,e=r.micropolar.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,s),s=r.micropolar.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},i.fillLayout=function(t){var e=a.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:r.Color.background,_container:e,_paperdiv:n,_paper:o};t._fullLayout=l(i,t.layout)}},{"../../plotly":121,"./undo_manager":149,d3:16}],149:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return rg;g++){ +var m=h[g];l=t[m]?t[m]:t[m]={},e[m]=s={},i("domain."+d,[g/p,(g+1)/p]),i("domain."+{x:"y",y:"x"}[d]),o.id=m,f(l,s,i,o)}}},{"../lib":103,"./plots":144}],151:[function(t,e,n){"use strict";var r=t("./ternary"),a=t("../../plots/plots");n.name="ternary",n.attr="subplot",n.idRoot="ternary",n.idRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,n.attrRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,n.attributes=t("./layout/attributes"),n.layoutAttributes=t("./layout/layout_attributes"),n.supplyLayoutDefaults=t("./layout/defaults"),n.plot=function(t){for(var e=t._fullLayout,n=t._fullData,o=a.getSubplotIds(e,"ternary"),i=0;i=i&&(h.min=0,p.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var a=t("../../../components/color"),o=t("../../subplot_defaults"),i=t("./layout_attributes"),l=t("./axis_defaults"),s=["aaxis","baxis","caxis"];e.exports=function(t,e,n){o(t,e,n,{type:"ternary",attributes:i,handleDefaults:r,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":25,"../../subplot_defaults":150,"./axis_defaults":154,"./layout_attributes":156}],156:[function(t,e,n){"use strict";var r=t("../../../components/color/attributes"),a=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:r.background},sum:{valType:"number",dflt:1,min:0},aaxis:a,baxis:a,caxis:a}},{"../../../components/color/attributes":24,"./axis_attributes":153}],157:[function(t,e,n){"use strict";function r(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function a(t){o.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var o=t("d3"),i=t("tinycolor2"),l=t("../../plotly"),s=t("../../lib"),c=t("../../components/color"),u=t("../../components/drawing"),f=t("../cartesian/set_convert"),d=t("../../lib/extend").extendFlat,h=t("../cartesian/axes"),p=t("../../lib/filter_visible"),g=t("../../components/dragelement"),m=t("../../components/titles"),v=t("../cartesian/select"),y=t("../cartesian/constants"),x=t("../cartesian/graph_interact");e.exports=r;var b=r.prototype;b.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},b.plot=function(t,e){var n,r=this,a=e[r.id],o=e._size;s.getPlotDiv(r.plotContainer.node())!==r.graphDiv&&(r.init(r.graphDiv._fullLayout),r.makeFramework()),r.adjustLayout(a,o);var i=r.traceHash,l={};for(n=0;n_*y?(o=y,a=o*_):(a=v,o=a/_),i=g*a/v,l=m*o/y,n=e.l+e.w*h-a/2,r=e.t+e.h*(1-p)-o/2,s.x0=n,s.y0=r,s.w=a,s.h=o,s.sum=x,s.xaxis={type:"linear",range:[b+2*k-x,x-b-2*w],domain:[h-i/2,h+i/2],_id:"x",_gd:s.graphDiv},f(s.xaxis),s.xaxis.setScale(),s.yaxis={type:"linear",range:[b,x-w-k],domain:[p-l/2,p+l/2],_id:"y",_gd:s.graphDiv},f(s.yaxis),s.yaxis.setScale();var M=s.yaxis.domain[0],A=s.aaxis=d({},t.aaxis,{range:[b,x-w-k],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[M,M+l*_],_axislayer:s.layers.aaxis,_gridlayer:s.layers.agrid,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l"+o+",-"+a/2});f(A);var T=s.baxis=d({},t.baxis,{range:[x-b-k,w],side:"bottom",_counterangle:30,domain:s.xaxis.domain,_axislayer:s.layers.baxis,_gridlayer:s.layers.bgrid,_counteraxis:s.aaxis,_pos:0,_gd:s.graphDiv,_id:"x",_length:a,_gridpath:"M0,0l-"+a/2+",-"+o});f(T),A._counteraxis=T;var L=s.caxis=d({},t.caxis,{range:[x-b-w,k],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[M,M+l*_],_axislayer:s.layers.caxis,_gridlayer:s.layers.cgrid,_counteraxis:s.baxis,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l-"+o+","+a/2});f(L);var z="M"+n+","+(r+o)+"h"+a+"l-"+a/2+",-"+o+"Z";s.clipDef.select("path").attr("d",z),s.layers.plotbg.select("path").attr("d",z);var S="translate("+n+","+r+")";s.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",S);var C="translate("+n+","+(r+o)+")";s.layers.baxis.attr("transform",C),s.layers.bgrid.attr("transform",C);var E="translate("+(n+a/2)+","+r+")rotate(30)";s.layers.aaxis.attr("transform",E),s.layers.agrid.attr("transform",E);var O="translate("+(n+a/2)+","+r+")rotate(-30)";s.layers.caxis.attr("transform",O),s.layers.cgrid.attr("transform",O),s.drawAxes(!0),s.plotContainer.selectAll(".crisp").classed("crisp",!1);var P=s.layers.axlines;P.select(".aline").attr("d",A.showline?"M"+n+","+(r+o)+"l"+a/2+",-"+o:"M0,0").call(c.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),P.select(".bline").attr("d",T.showline?"M"+n+","+(r+o)+"h"+a:"M0,0").call(c.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),P.select(".cline").attr("d",L.showline?"M"+(n+a/2)+","+r+"l"+a/2+","+o:"M0,0").call(c.stroke,L.linecolor||"#000").style("stroke-width",(L.linewidth||0)+"px")},b.drawAxes=function(t){var e=this,n=e.graphDiv,r=e.id.substr(7)+"title",a=e.aaxis,o=e.baxis,i=e.caxis;if(h.doTicks(n,a,!0),h.doTicks(n,o,!0),h.doTicks(n,i,!0),t){var l=Math.max(a.showticklabels?a.tickfont.size/2:0,(i.showticklabels?.75*i.tickfont.size:0)+("outside"===i.ticks?.87*i.ticklen:0));m.draw(n,"a"+r,{propContainer:a,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-a.titlefont.size/3-l,"text-anchor":"middle"}});var s=(o.showticklabels?o.tickfont.size:0)+("outside"===o.ticks?o.ticklen:0)+3;m.draw(n,"b"+r,{propContainer:o,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-s,y:e.y0+e.h+.83*o.titlefont.size+s,"text-anchor":"middle"}}),m.draw(n,"c"+r,{propContainer:i,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+s,y:e.y0+e.h+.83*i.titlefont.size+s,"text-anchor":"middle"}})}};var w=y.MINZOOM/2+.87,k="m-0.87,.5h"+w+"v3h-"+(w+5.2)+"l"+(w/2+2.6)+",-"+(.87*w+4.5)+"l2.6,1.5l-"+w/2+","+.87*w+"Z",M="m0.87,.5h-"+w+"v3h"+(w+5.2)+"l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-2.6,1.5l"+w/2+","+.87*w+"Z",A="m0,1l"+w/2+","+.87*w+"l2.6,-1.5l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-"+(w/2+2.6)+","+(.87*w+4.5)+"l2.6,1.5l"+w/2+",-"+.87*w+"Z",T="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",L=!0;b.initInteractions=function(){function t(t,e,n){var r=R.getBoundingClientRect();b=e-r.left,w=n-r.top,z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},C=z,S=I.aaxis.range[1]-z.a,E=i(I.graphDiv._fullLayout[I.id].bgcolor).getLuminance(),O="M0,"+I.h+"L"+I.w/2+", 0L"+I.w+","+I.h+"Z",P=!1,N=F.append("path").attr("class","zoombox").style({fill:E>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",O),D=F.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),p()}function e(t,e){return 1-e/I.h}function n(t,e){return 1-(t+(I.h-e)/Math.sqrt(3))/I.w}function r(t,e){return(t-(I.h-e)/Math.sqrt(3))/I.w}function o(t,a){var o=b+t,i=w+a,l=Math.max(0,Math.min(1,e(b,w),e(o,i))),s=Math.max(0,Math.min(1,n(b,w),n(o,i))),c=Math.max(0,Math.min(1,r(b,w),r(o,i))),u=(l/2+c)*I.w,f=(1-l/2-s)*I.w,d=(u+f)/2,h=f-u,p=(1-l)*I.h,g=p-h/_;h.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),D.transition().style("opacity",1).duration(200),P=!0)}function u(t,e){if(C===z)return 2===e&&m(),a(j);a(j);var n={};n[I.id+".aaxis.min"]=C.a,n[I.id+".baxis.min"]=C.b,n[I.id+".caxis.min"]=C.c,l.relayout(j,n),L&&j.data&&j._context.showTips&&(s.notifier("Double-click to
zoom back out","long"),L=!1)}function f(){z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},C=z}function d(t,e){var n=t/I.xaxis._m,r=e/I.yaxis._m;C={a:z.a-r,b:z.b+(n+r)/2,c:z.c-(n-r)/2};var a=[C.a,C.b,C.c].sort(),o={a:a.indexOf(C.a),b:a.indexOf(C.b),c:a.indexOf(C.c)};a[0]<0&&(a[1]+a[0]/2<0?(a[2]+=a[0]+a[1],a[0]=a[1]=0):(a[2]+=a[0]/2,a[1]+=a[0]/2,a[0]=0),C={a:a[o.a],b:a[o.b],c:a[o.c]},e=(z.a-C.a)*I.yaxis._m,t=(z.c-C.c-z.b+C.b)*I.xaxis._m);var i="translate("+(I.x0+t)+","+(I.y0+e)+")";I.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",i),I.aaxis.range=[C.a,I.sum-C.b-C.c],I.baxis.range=[I.sum-C.a-C.c,C.b],I.caxis.range=[I.sum-C.a-C.b,C.c],I.drawAxes(!1),I.plotContainer.selectAll(".crisp").classed("crisp",!1)}function h(t,e){if(t){var n={};n[I.id+".aaxis.min"]=C.a,n[I.id+".baxis.min"]=C.b,n[I.id+".caxis.min"]=C.c,l.relayout(j,n)}else 2===e&&m()}function p(){I.plotContainer.selectAll(".select-outline").remove()}function m(){var t={};t[I.id+".aaxis.min"]=0,t[I.id+".baxis.min"]=0,t[I.id+".caxis.min"]=0,j.emit("plotly_doubleclick",null),l.relayout(j,t)}var b,w,z,S,C,E,O,P,N,D,I=this,R=I.layers.plotbg.select("path").node(),j=I.graphDiv,F=I.layers.zoom,q={element:R,gd:j,plotinfo:{plot:F},doubleclick:m,subplot:I.id,prepFn:function(e,n,r){q.xaxes=[I.xaxis],q.yaxes=[I.yaxis];var a=j._fullLayout.dragmode;e.shiftKey&&(a="pan"===a?"zoom":"pan"),"lasso"===a?q.minDrag=1:q.minDrag=void 0,"zoom"===a?(q.moveFn=o,q.doneFn=u,t(e,n,r)):"pan"===a?(q.moveFn=d,q.doneFn=h,f(),p()):"select"!==a&&"lasso"!==a||v(e,n,r,q,a)}};R.onmousemove=function(t){x.hover(j,t,I.id),j._fullLayout._lasthover=R,j._fullLayout._hoversubplot=I.id},R.onmouseout=function(t){j._dragging||g.unhover(j,t)},R.onclick=function(t){x.click(j,t)},g.init(q)}},{"../../components/color":25,"../../components/dragelement":46,"../../components/drawing":48,"../../components/titles":88,"../../lib":103,"../../lib/extend":101,"../../lib/filter_visible":102,"../../plotly":121,"../cartesian/axes":124,"../cartesian/constants":129,"../cartesian/graph_interact":131,"../cartesian/select":137,"../cartesian/set_convert":138,d3:16,tinycolor2:20}],158:[function(t,e,n){"use strict";function r(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function a(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),i=o.Lib.extendFlat,l=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,s=t.data,c=t.layout,u=l([],s),f=l({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;ns;s++)r(n[s])&&h.push({p:n[s],s:l[s],b:0});return o(e,"marker")&&i(e,e.marker.color,"marker","c"),o(e,"marker.line")&&i(e,e.marker.line.color,"marker.line","c"),h}},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":38,"../../plots/cartesian/axes":124,"fast-isnumeric":18}],168:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("../scatter/xy_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=o(t,e,u);return f?(u("orientation",e.x&&!e.y?"h":"v"),u("text"),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),void l(t,e,a.defaultLine,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/color":25,"../../components/errorbars/defaults":53,"../../lib":103,"../bar/style_defaults":176,"../scatter/xy_defaults":258,"./attributes":166}],169:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/graph_interact"),a=t("../../components/errorbars"),o=t("../../components/color");e.exports=function(t,e,n,i){var l,s=t.cd,c=s[0].trace,u=s[0].t,f=t.xa,d=t.ya,h="closest"===i?u.barwidth/2:u.dbar*(1-f._gd._fullLayout.bargap)/2;l="closest"!==i?function(t){return t.p}:"h"===c.orientation?function(t){return t.y}:function(t){return t.x};var p,g;"h"===c.orientation?(p=function(t){return r.inbox(t.b-e,t.x-e)+(t.x-e)/(t.x-t.b)},g=function(t){var e=l(t)-n;return r.inbox(e-h,e+h)}):(g=function(t){return r.inbox(t.b-n,t.y-n)+(t.y-n)/(t.y-t.b)},p=function(t){var n=l(t)-e;return r.inbox(n-h,n+h)});var m=r.getDistanceFunction(i,p,g);if(r.getClosest(s,m,t),t.index!==!1){var v=s[t.index],y=v.mcc||c.marker.color,x=v.mlcc||c.marker.line.color,b=v.mlw||c.marker.line.width;return o.opacity(y)?t.color=y:o.opacity(x)&&b&&(t.color=x),"h"===c.orientation?(t.x0=t.x1=f.c2p(v.x,!0),t.xLabelVal=v.s,t.y0=d.c2p(l(v)-h,!0),t.y1=d.c2p(l(v)+h,!0),t.yLabelVal=v.p):(t.y0=t.y1=d.c2p(v.y,!0),t.yLabelVal=v.s,t.x0=f.c2p(l(v)-h,!0),t.x1=f.c2p(l(v)+h,!0),t.xLabelVal=v.p),v.tx&&(t.text=v.tx),a.hoverInfo(v,c,t),[t]}}},{"../../components/color":25,"../../components/errorbars":54,"../../plots/cartesian/graph_interact":131}],170:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("./layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.calc=t("./calc"),r.setPositions=t("./set_positions"),r.colorbar=t("../scatter/colorbar"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.moduleType="trace",r.name="bar",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","oriented","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../scatter/colorbar":240,"./arrays_to_calcdata":165,"./attributes":166,"./calc":167,"./defaults":168,"./hover":169,"./layout_attributes":171,"./layout_defaults":172,"./plot":173,"./set_positions":174,"./style":175}],171:[function(t,e,n){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:""},bargap:{valType:"number",min:0,max:1},bargroupgap:{valType:"number",min:0,max:1,dflt:0}}},{}],172:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,n){function l(n,r){return o.coerce(t,e,i,n,r)}for(var s=!1,c=!1,u=!1,f={},d=0;d=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var d,h,p,g;if("h"===l.orientation?(p=u.c2p(n.poffset+e.p,!0),g=u.c2p(n.poffset+e.p+n.barwidth,!0),d=c.c2p(e.b,!0),h=c.c2p(e.s+e.b,!0)):(d=c.c2p(n.poffset+e.p,!0),h=c.c2p(n.poffset+e.p+n.barwidth,!0),g=u.c2p(e.s+e.b,!0),p=u.c2p(e.b,!0)),!(a(d)&&a(h)&&a(p)&&a(g)&&d!==h&&p!==g))return void r.select(this).remove();var m=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,v=r.round(m/2%1,2);if(!t._context.staticPlot){var y=i.opacity(e.mc||l.marker.color),x=1>y||m>.01?o:s;d=x(d,h),h=x(h,d),p=x(p,g),g=x(g,p)}r.select(this).attr("d","M"+d+","+p+"V"+g+"H"+h+"V"+p+"Z")})}),d.call(l.plot,e)}},{"../../components/color":25,"../../components/errorbars":54,"../../lib":103,"./arrays_to_calcdata":165,d3:16,"fast-isnumeric":18}],174:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/plots"),o=t("../../plots/cartesian/axes"),i=t("../../lib");e.exports=function(t,e){var n,l,s=t._fullLayout,c=e.x(),u=e.y();["v","h"].forEach(function(f){function d(e){function n(t){t[p]=t.p+d}var r=[];e.forEach(function(e){t.calcdata[e].forEach(function(t){r.push(t.p)})});var a=i.distinctVals(r),l=a.vals,c=a.minDiff,u=!1,f=[];"group"===s.barmode&&e.forEach(function(e){u||(t.calcdata[e].forEach(function(t){u||f.forEach(function(e){Math.abs(t.p-e)_&&(S=!0,A=_),_>M+P&&(S=!0,M=_))}o.expand(v,[A,M],{tozero:!0,padded:S})}else{var N=function(t){return t[g]=t.s,t.s};for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=(e._input||{}).marker||{},s=o.tryColorscale(n,l,""),c=o.tryColorscale(n,l,"line.");r.select(this).selectAll("path").each(function(t){var e,o,l=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=s(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",l+"px").call(a.fill,e),l&&(o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":25,"../../components/drawing":48,"../../components/errorbars":54,d3:16}],176:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":25,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38 +}],177:[function(t,e,n){"use strict";var r=t("../scatter/attributes"),a=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,i=r.marker,l=i.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},i.symbol,{arrayOk:!1}),opacity:o({},i.opacity,{arrayOk:!1,dflt:1}),size:o({},i.size,{arrayOk:!1}),color:o({},i.color,{arrayOk:!1}),line:{color:o({},l.color,{arrayOk:!1,dflt:a.defaultLine}),width:o({},l.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:r.fillcolor}},{"../../components/color/attributes":24,"../../lib/extend":101,"../scatter/attributes":237}],178:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(t,e,n,o,i){var l;return n in e?p=o.makeCalcdata(e,n):(l=n+"0"in e?e[n+"0"]:"name"in e&&("category"===o.type||r(e.name)&&-1!==["linear","log"].indexOf(o.type)||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l),p=i.map(function(){return l})),p}function i(t,e,n,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;f>l;++l)s=o[l],t[l]={pos:s},p[l]=s-i,h[l]=[];for(p.push(o[f-1]+i),l=0;d>l;++l)u=e[l],r(u)&&(c=a.findBin(n[l],p),c>=0&&d>c&&h[c].push(u));return h}function l(t,e){var n,r,o,i;for(i=0;i1,v=n.dPos*(1-d.boxgap)*(1-d.boxgroupgap)/(m?t.numboxes:1),y=m?2*n.dPos*(-.5+(n.boxnum+.5)/t.numboxes)*(1-d.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||n.emptybox?void o.select(this).remove():("h"===g.orientation?(s=p,f=h):(s=h,f=p),n.bPos=y,n.bdPos=v,r(),o.select(this).selectAll("path.box").data(i.identity).enter().append("path").attr("class","box").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=s.c2p(t.pos+y-x,!0),l=s.c2p(t.pos+y+x,!0),c=f.c2p(t.q1,!0),u=f.c2p(t.q3,!0),d=i.constrain(f.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),h=f.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=f.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+d+","+n+"V"+r+"M"+c+","+n+"V"+r+"H"+u+"V"+n+"ZM"+c+","+e+"H"+h+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+h+","+a+"V"+l+"M"+p+","+a+"V"+l)):o.select(this).attr("d","M"+n+","+d+"H"+r+"M"+n+","+c+"H"+r+"V"+u+"H"+n+"ZM"+e+","+c+"V"+h+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+a+","+h+"H"+l+"M"+a+","+p+"H"+l))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=n,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,n,r,o,l,s,f,d="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=(t.q3-t.q1)*u,p=[],m=0;if(g.jitter){for(e=0;et.lo&&(r.so=!0),r})}).enter().append("path").call(l.translatePoints,h,p),void(g.boxmean&&o.select(this).selectAll("path.mean").data(i.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=f.c2p(t.mean,!0),i=f.c2p(t.mean-t.sd,!0),l=f.c2p(t.mean+t.sd,!0);"h"===g.orientation?o.select(this).attr("d","M"+a+","+n+"V"+r+("sd"!==g.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+n+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+n+","+a+"H"+r+("sd"!==g.boxmean?"":"m0,0L"+e+","+i+"L"+n+","+a+"L"+e+","+l+"Z"))})))})}},{"../../components/drawing":48,"../../lib":103,d3:16}],185:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var n,i,l,s,c=t._fullLayout,u=e.x(),f=e.y(),d=["v","h"];for(i=0;in;n++)e=f[n],h[n]=e[0]*(t.zmax-t.zmin)+t.zmin,p[n]=e[1];var g=r.extent([t.zmin,t.zmax,o.start,o.start+s*(c-1)]),m=g[t.zminn;n++)e=f[n],h[n]=(e[0]*(c+u-1)-u/2)*s+i,p[n]=e[1];var y=r.scale.linear().interpolate(r.interpolateRgb).domain(h).range(p);return y}},{"../../components/colorscale/get_scale":37,d3:16}],194:[function(t,e,n){"use strict";function r(t,e,n){var r=n[0].trace,o=n[0].x,l=n[0].y,c=r.contours,u=r.uid,f=e.x(),d=e.y(),m=t._fullLayout,x="contour"+u,b=a(c,e,n[0]);if(r.visible!==!0)return m._paper.selectAll("."+x+",.hm"+u).remove(),void m._infolayer.selectAll(".cb"+u).remove();"heatmap"===c.coloring?(r.zauto&&r.autocontour===!1&&(r._input.zmin=r.zmin=c.start-c.size/2,r._input.zmax=r.zmax=r.zmin+b.length*c.size),k(t,e,[n])):m._paper.selectAll(".hm"+u).remove(),i(b),s(b);var _=f.c2p(o[0],!0),w=f.c2p(o[o.length-1],!0),M=d.c2p(l[0],!0),A=d.c2p(l[l.length-1],!0),T=[[_,A],[w,A],[w,M],[_,M]],L=h(e,n,x);p(L,T,c),g(L,b,T,c),v(L,b,c),y(L,e,n[0],T)}function a(t,e,n){for(var r=t.size||1,a=[],o=t.start;ot?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===n||10===n){var r=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>r?5===n?713:1114:5===n?104:208}return 15===n?0:n}function i(t){var e,n,r,a,i,l,s,c,u,f=t[0].z,d=f.length,h=f[0].length,p=2===d||2===h;for(n=0;d-1>n;n++)for(a=[],0===n&&(a=a.concat(M)),n===d-2&&(a=a.concat(A)),e=0;h-1>e;e++)for(r=a.slice(),0===e&&(r=r.concat(T)),e===h-2&&(r=r.concat(L)),i=e+","+n,l=[[f[n][e],f[n][e+1]],[f[n+1][e],f[n+1][e+1]]],u=0;ua;a++){if(l>20?(l=S[l][(s[0]||s[1])<0?0:1],t.crossings[i]=C[l]):delete t.crossings[i],s=z[l],!s){_.log("Found bad marching index:",l,e,t.level);break}if(h.push(d(t,e,s)),e[0]+=s[0],e[1]+=s[1],u(h[h.length-1],h[h.length-2])&&h.pop(),i=e.join(","),i===o&&s.join(",")===p||n&&(s[0]&&(e[0]<0||e[0]>m-2)||s[1]&&(e[1]<0||e[1]>g-2)))break;l=t.crossings[i]}1e4===a&&_.log("Infinite loop in contour?");var v,y,x,b,w,k,M,A=u(h[0],h[h.length-1]),T=0,L=.2*t.smoothing,E=[],O=0;for(a=1;a=O;a--)if(v=E[a],P>v){for(x=0,y=a-1;y>=O&&v+E[y]x&&v+E[x]e;)e++,n=Object.keys(a.crossings)[0].split(",").map(Number),l(a,n);1e4===e&&_.log("Infinite loop in contour?")}}function c(t,e,n){var r=0,a=0;return t>20&&e?208===t||1114===t?r=0===n[0]?1:-1:a=0===n[1]?1:-1:-1!==M.indexOf(t)?a=1:-1!==T.indexOf(t)?r=1:-1!==A.indexOf(t)?a=-1:r=-1,[r,a]}function u(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function f(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function d(t,e,n){var r=e[0]+Math.max(n[0],0),a=e[1]+Math.max(n[1],0),o=t.z[a][r],i=t.xaxis,l=t.yaxis;if(n[1]){var s=(t.level-o)/(t.z[a][r+1]-o);return[i.c2p((1-s)*t.x[r]+s*t.x[r+1],!0),l.c2p(t.y[a],!0)]}var c=(t.level-o)/(t.z[a+1][r]-o);return[i.c2p(t.x[r],!0),l.c2p((1-c)*t.y[a]+c*t.y[a+1],!0)]}function h(t,e,n){var r=t.plot.select(".maplayer").selectAll("g.contour."+n).data(e);return r.enter().append("g").classed("contour",!0).classed(n,!0),r.exit().remove(),r}function p(t,e,n){var r=t.selectAll("g.contourbg").data([0]);r.enter().append("g").classed("contourbg",!0);var a=r.selectAll("path").data("fill"===n.coloring?[0]:[]);a.enter().append("path"),a.exit().remove(),a.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function g(t,e,n,r){var a=t.selectAll("g.contourfill").data([0]);a.enter().append("g").classed("contourfill",!0);var o=a.selectAll("path").data("fill"===r.coloring?e:[]);o.enter().append("path"),o.exit().remove(),o.each(function(t){var e=m(t,n);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function m(t,e){function n(t){return Math.abs(t[1]-e[0][1])<.01}function r(t){return Math.abs(t[1]-e[2][1])<.01}function a(t){return Math.abs(t[0]-e[0][0])<.01}function o(t){return Math.abs(t[0]-e[2][0])<.01}for(var i,l,s,c,u,f,d=t.edgepaths.length||t.z[0][0]s;s++){if(!i){_.log("Missing end?",h,t);break}for(n(i)&&!o(i)?l=e[1]:a(i)?l=e[0]:r(i)?l=e[3]:o(i)&&(l=e[2]),u=0;u=0&&(l=m,c=u):Math.abs(i[1]-l[1])<.01?Math.abs(i[1]-m[1])<.01&&(m[0]-i[0])*(l[0]-m[0])>=0&&(l=m,c=u):_.log("endpt to newendpt is not vert. or horz.",i,l,m)}if(i=l,c>=0)break;d+="L"+l}if(c===t.edgepaths.length){_.log("unclosed perimeter path");break}h=c,g=-1===p.indexOf(h),g&&(h=p[0],d+="Z")}for(h=0;he;e++)l.push(1);for(e=0;o>e;e++)a.push(l.slice());for(e=0;ei;i++)for(r=a(s,i),u[i]=new Array(r),l=0;r>l;l++)u[i][l]=e(o(s,i,l));return u}function a(t,e,n,r,a,o){var i,l,s,c=[],u=d.traceIs(t,"contour"),f=d.traceIs(t,"histogram"),h=d.traceIs(t,"gl2d"),p=Array.isArray(e)&&e.length>1;if(p&&!f&&"category"!==o.type){e=e.map(o.d2c);var g=e.length;if(!(a>=g))return u?e.slice(0,a):e.slice(0,a+1);if(u||h)c=e.slice(0,a);else if(1===a)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],s=1;g>s;s++)c.push(.5*(e[s-1]+e[s]));c.push(1.5*e[g-1]-.5*e[g-2])}if(a>g){var m=c[c.length-1],v=m-c[c.length-2];for(s=g;a>s;s++)m+=v,c.push(m)}}else for(l=r||1,i=f||"category"===o.type?n||0:Array.isArray(e)&&1===e.length?e[0]:void 0===n?0:o.d2c(n),s=u||h?0:-.5;a>s;s++)c.push(i+l*s);return c}function o(t){return.5-.25*Math.min(1,.5*t)}function i(t,e,n){var r,a,i=1;if(Array.isArray(n))for(r=0;rr&&i>y;r++)i=s(t,e,o(i));return i>y&&u.log("interp2d didn't converge quickly",i),t}function l(t){var e,n,r,a,o,i,l,s,c=[],u={},f=[],d=t[0],h=[],p=[0,0,0],g=v(t);for(n=0;nr;r++)void 0===h[r]&&(i=(void 0!==h[r-1]?1:0)+(void 0!==h[r+1]?1:0)+(void 0!==e[r]?1:0)+(void 0!==d[r]?1:0),i?(0===n&&i++,0===r&&i++,n===t.length-1&&i++,r===h.length-1&&i++,4>i&&(u[[n,r]]=[n,r,i]),c.push([n,r,i])):f.push([n,r]));for(;f.length;){for(l={},s=!1,o=f.length-1;o>=0;o--)a=f[o],n=a[0],r=a[1],i=((u[[n-1,r]]||p)[2]+(u[[n+1,r]]||p)[2]+(u[[n,r-1]]||p)[2]+(u[[n,r+1]]||p)[2])/20,i&&(l[a]=[n,r,i],f.splice(o,1),s=!0);if(!s)throw"findEmpties iterated with no new neighbors";for(a in l)u[a]=l[a],c.push(l[a])}return c.sort(function(t,e){return e[2]-t[2]})}function s(t,e,n){var r,a,o,i,l,s,c,u,f,d,h,p,g,m=0;for(i=0;il;l++)s=x[l],c=t[a+s[0]],c&&(u=c[o+s[1]],void 0!==u&&(0===d?p=g=u:(p=Math.min(p,u),g=Math.max(g,u)),f++,d+=u));if(0===f)throw"iterateInterp2d order is wrong: no defined neighbors";t[a][o]=d/f,void 0===h?4>f&&(m=1):(t[a][o]=(1+n)*t[a][o]-n*h,g>p&&(m=Math.max(m,Math.abs(t[a][o]-h)/(g-p))))}return m}var c=t("fast-isnumeric"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../../plots/plots"),h=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),m=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function n(t){z=e._input.zsmooth=e.zsmooth=!1,u.notifier("cannot fast-zsmooth: "+t)}var o,s,c,y,x,b,_,w,k=f.getFromId(t,e.xaxis||"x"),M=f.getFromId(t,e.yaxis||"y"),A=d.traceIs(e,"contour"),T=d.traceIs(e,"histogram"),L=d.traceIs(e,"gl2d"),z=A?"best":e.zsmooth;if(k._minDtick=0,M._minDtick=0,T){var S=h(t,e);o=S.x,s=S.x0,c=S.dx,y=S.y,x=S.y0,b=S.dy,_=S.z}else g(e)&&m(e,k,M),o=e.x?k.makeCalcdata(e,"x"):[],y=e.y?M.makeCalcdata(e,"y"):[],s=e.x0||0,c=e.dx||1,x=e.y0||0,b=e.dy||1,_=r(e),(A||e.connectgaps)&&(e._emptypoints=l(_),e._interpz=i(_,e._emptypoints,e._interpz));if("fast"===z)if("log"===k.type||"log"===M.type)n("log axis found");else if(!T){if(o.length){var C=(o[o.length-1]-o[0])/(o.length-1),E=Math.abs(C/100);for(w=0;wE){n("x scale is not linear");break}}if(y.length&&"fast"===z){var O=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(O/100);for(w=0;wP){n("y scale is not linear");break}}}var N=v(_),D="scaled"===e.xtype?"":e.x,I=a(e,D,s,c,N,k),R="scaled"===e.ytype?"":e.y,j=a(e,R,x,b,_.length,M);L||(f.expand(k,I),f.expand(M,j));var F={x:I,y:j,z:_};if(p(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var q="contour"===e.type?"heatmap":"histogram2d";F.xfill=a(q,D,s,c,N,k),F.yfill=a(q,R,x,b,_.length,M)}return[F]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":32,"../../lib":103,"../../plots/cartesian/axes":124,"../../plots/plots":144,"../histogram2d/calc":218,"./convert_column_xyz":200,"./has_columns":202,"./max_row_length":205,"fast-isnumeric":18}],199:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,c="cb"+n.uid,u=l(n.colorscale),f=n.zmin,d=n.zmax;if(a(f)||(f=o.aggNums(Math.min,null,n.z)),a(d)||(d=o.aggNums(Math.max,null,n.z)),t._fullLayout._infolayer.selectAll("."+c).remove(),!n.showscale)return void i.autoMargin(t,c);var h=e[0].t.cb=s(t,c);h.fillcolor(r.scale.linear().domain(u.map(function(t){return f+t[0]*(d-f)})).range(u.map(function(t){return t[1]}))).filllevels({start:f,end:d,size:(d-f)/254}).options(n.colorbar)()}},{"../../components/colorbar/draw":28,"../../components/colorscale/get_scale":37,"../../lib":103,"../../plots/plots":144,d3:16,"fast-isnumeric":18}],200:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n){var a,o=t.x.slice(),i=t.y.slice(),l=t.z,s=t.text,c=Math.min(o.length,i.length,l.length),u=void 0!==s&&!Array.isArray(s[0]);for(ca;a++)o[a]=e.d2c(o[a]),i[a]=n.d2c(i[a]);var f,d,h,p=r.distinctVals(o),g=p.vals,m=r.distinctVals(i),v=m.vals,y=r.init2dArray(v.length,g.length);for(u&&(h=r.init2dArray(v.length,g.length)),a=0;c>a;a++)f=r.findBin(o[a]+p.minDiff/2,g),d=r.findBin(i[a]+m.minDiff/2,v),y[d][f]=l[a],u&&(h[d][f]=s[a]);t.x=g,t.y=v,t.z=y,u&&(t.text=h)}},{"../../lib":103}],201:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./has_columns"),o=t("./xyz_defaults"),i=t("../../components/colorscale/defaults"),l=t("./attributes");e.exports=function(t,e,n,s){function c(n,a){return r.coerce(t,e,l,n,a)}var u=o(t,e,c);return u?(c("text"),c("zsmooth"),c("connectgaps",a(e)&&e.zsmooth!==!1),void i(t,e,s,c,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":35,"../../lib":103,"./attributes":197,"./has_columns":202,"./xyz_defaults":208}],202:[function(t,e,n){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],203:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/graph_interact"),a=t("../../lib"),o=t("../../plots/cartesian/constants").MAXDIST;e.exports=function(t,e,n,i,l){if(!(t.distanceu||u>=y[0].length||0>f||f>y.length)return}else{if(r.inbox(e-m[0],e-m[m.length-1])>o||r.inbox(n-v[0],n-v[v.length-1])>o)return;if(l){var k;for(b=[2*m[0]-m[1]],k=1;k0;)_=m.c2p(C[A]),A--;for(b>_&&(w=_,_=b,b=w,I=!0),A=0;void 0===k&&A0;)M=v.c2p(E[A]),A--;if(k>M&&(w=k,k=M,M=w,R=!0),O&&(C=n[0].xfill,E=n[0].yfill),"fast"!==P){var j="best"===P?0:.5;b=Math.max(-j*m._length,b),_=Math.min((1+j)*m._length,_),k=Math.max(-j*v._length,k),M=Math.min((1+j)*v._length,M)}var F=Math.round(_-b),q=Math.round(M-k),B=0>=F||0>=q,H=e.plot.select(".imagelayer").selectAll("g.hm."+x).data(B?[]:[0]);if(H.enter().append("g").classed("hm",!0).classed(x,!0),H.exit().remove(),!B){var V,Z;"fast"===P?(V=D,Z=N):(V=F,Z=q);var U=document.createElement("canvas");U.width=V,U.height=Z;var Y,X,G=U.getContext("2d"),$=a.scale.linear().domain(S.map(function(t){return t[0]})).range(S.map(function(t){var e=o(t[1]).toRgb();return[e.r,e.g,e.b,e.a]})).clamp(!0);"fast"===P?(Y=I?function(t){return D-1-t}:i.identity,X=R?function(t){return N-1-t}:i.identity):(Y=function(t){return i.constrain(Math.round(m.c2p(C[t])-b),0,F)},X=function(t){return i.constrain(Math.round(v.c2p(E[t])-k),0,q)});var Q,W,J,K,tt,et,nt=X(0),rt=[nt,nt],at=I?0:1,ot=R?0:1,it=0,lt=0,st=0,ct=0;if(P){var ut=0,ft=new Uint8Array(F*q*4);if("best"===P){var dt,ht,pt,gt=new Array(C.length),mt=new Array(E.length),vt=new Array(F);for(A=0;AA;A++)vt[A]=r(A,gt);for(W=0;q>W;W++)for(dt=r(W,mt),ht=T[dt.bin0],pt=T[dt.bin1],A=0;F>A;A++,ut+=4)et=h(ht,pt,vt[A],dt),d(ft,ut,et)}else for(W=0;N>W;W++)for(tt=T[W],rt=X(W),A=0;F>A;A++)et=f(tt[A],1),ut=4*(rt*F+Y(A)),d(ft,ut,et);var yt=G.createImageData(F,q);yt.data.set(ft),G.putImageData(yt,0,0)}else for(W=0;N>W;W++)if(tt=T[W],rt.reverse(),rt[ot]=X(W+1),rt[0]!==rt[1]&&void 0!==rt[0]&&void 0!==rt[1])for(J=Y(0),Q=[J,J],A=0;D>A;A++)Q.reverse(),Q[at]=Y(A+1),Q[0]!==Q[1]&&void 0!==Q[0]&&void 0!==Q[1]&&(K=tt[A],et=f(K,(Q[1]-Q[0])*(rt[1]-rt[0])),G.fillStyle="rgba("+et.join(",")+")",G.fillRect(Q[0],rt[0],Q[1]-Q[0],rt[1]-rt[0]));lt=Math.round(lt/it),st=Math.round(st/it),ct=Math.round(ct/it);var xt=o("rgb("+lt+","+st+","+ct+")");t._hmpixcount=(t._hmpixcount||0)+it,t._hmlumcount=(t._hmlumcount||0)+it*xt.getLuminance();var bt=H.selectAll("image").data(n);bt.enter().append("svg:image").attr({xmlns:c.svg,preserveAspectRatio:"none"}),bt.attr({height:q,width:F,x:b,y:k,"xlink:href":U.toDataURL("image/png")}),bt.exit().remove()}}var a=t("d3"),o=t("tinycolor2"),i=t("../../lib"),l=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),c=t("../../constants/xmlns_namespaces"),u=t("./max_row_length");e.exports=function(t,e,n){for(var a=0;a0&&(r=!0);for(var l=0;la;a++)e[a]?(t[a]/=e[a],r+=t[a]):t[a]=null;return r}},{}],211:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){return n("histnorm"),r.forEach(function(t){var e=n(t+"bins.start"),r=n(t+"bins.end"),a=n("autobin"+t,!(e&&r));n(a?"nbins"+t:t+"bins.size")}),e}},{}],212:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports={count:function(t,e,n){return n[t]++,1},sum:function(t,e,n,a){var o=a[e];return r(o)?(o=Number(o),n[t]+=o,o):0},avg:function(t,e,n,a,o){var i=a[e];return r(i)&&(i=Number(i),n[t]+=i,o[t]++),0},min:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]>o)return n[t]=o,o-n[t]}return 0},max:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]n&&c.length<5e3;)g=o.tickIncrement(n,x.size),c.push((n+g)/2),u.push(S),b&&_.push(n),L&&w.push(1/(g-n)),O&&k.push(0),n=g;var P=u.length;for(n=0;n=0&&P>v&&(M+=C(v,n,u,y,k));O&&(M=s(u,k)),E&&E(u,M,w);var N=Math.min(c.length,u.length),D=[],I=0,R=N-1;for(n=0;N>n;n++)if(u[n]){I=n;break}for(n=N-1;n>I;n--)if(u[n]){R=n;break}for(n=I;R>=n;n++)r(c[n])&&r(u[n])&&D.push({p:c[n],s:u[n],b:0});return D}}},{"../../lib":103,"../../plots/cartesian/axes":124,"./average":210,"./bin_functions":212,"./norm_functions":216,"fast-isnumeric":18}],214:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=u("x"),d=u("y");u("text");var h=u("orientation",d&&!f?"h":"v"),p=e["v"===h?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===h?"x":"y"];g&&u("histfunc");var m="h"===h?["y"]:["x"];o(t,e,u,m),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":25,"../../components/errorbars/defaults":53,"../../lib":103,"../bar/style_defaults":176,"./attributes":209,"./bin_defaults":211}],215:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("../bar/layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("../bar/layout_defaults"),r.calc=t("./calc"),r.setPositions=t("../bar/set_positions"),r.plot=t("../bar/plot"),r.style=t("../bar/style"),r.colorbar=t("../scatter/colorbar"),r.hoverPoints=t("../bar/hover"),r.moduleType="trace",r.name="histogram",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../bar/hover":169,"../bar/layout_attributes":171,"../bar/layout_defaults":172,"../bar/plot":173,"../bar/set_positions":174,"../bar/style":175,"../scatter/colorbar":240,"./attributes":209,"./calc":213,"./defaults":214}],216:[function(t,e,n){"use strict";e.exports={percent:function(t,e){for(var n=t.length,r=100/e,a=0;n>a;a++)t[a]*=r},probability:function(t,e){for(var n=t.length,r=0;n>r;r++)t[r]/=e},density:function(t,e,n,r){var a=t.length;r=r||1;for(var o=0;a>o;o++)t[o]*=n[o]*r},"probability density":function(t,e,n,r){var a=t.length;r&&(e/=r);for(var o=0;a>o;o++)t[o]*=n[o]/e}}},{}],217:[function(t,e,n){"use strict";var r=t("../histogram/attributes"),a=t("../heatmap/attributes"),o=t("../../components/colorscale/attributes"),i=t("../../lib/extend").extendFlat;e.exports=i({},{x:r.x,y:r.y,z:{valType:"data_array"},marker:{color:{valType:"data_array"}},histnorm:r.histnorm,histfunc:r.histfunc,autobinx:r.autobinx,nbinsx:r.nbinsx,xbins:r.xbins,autobiny:r.autobiny,nbinsy:r.nbinsy,ybins:r.ybins,zsmooth:a.zsmooth,_nestedModules:{colorbar:"Colorbar"}},o,{autocolorscale:i({},o.autocolorscale,{dflt:!1})})},{"../../components/colorscale/attributes":31,"../../lib/extend":101,"../heatmap/attributes":197,"../histogram/attributes":209}],218:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../histogram/bin_functions"),i=t("../histogram/norm_functions"),l=t("../histogram/average");e.exports=function(t,e){var n,s,c,u,f,d,h=a.getFromId(t,e.xaxis||"x"),p=e.x?h.makeCalcdata(e,"x"):[],g=a.getFromId(t,e.yaxis||"y"),m=e.y?g.makeCalcdata(e,"y"):[],v=Math.min(p.length,m.length);p.length>v&&p.splice(v,p.length-v),m.length>v&&m.splice(v,m.length-v),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(p,h,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(m,g,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),f=[];var y,x,b=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,M=0,A=[],T=e.histnorm,L=e.histfunc,z=-1!==T.indexOf("density"),S="max"===L||"min"===L,C=S?null:0,E=o.count,O=i[T],P=!1,N=[],D=[],I="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";I&&"count"!==L&&(P="avg"===L,E=o[L]);var R=e.xbins,j=R.end+(R.start-a.tickIncrement(R.start,R.size))/1e6;for(d=R.start;j>d;d=a.tickIncrement(d,R.size))b.push(C),Array.isArray(w)&&w.push(d),P&&_.push(0);Array.isArray(w)&&w.push(d);var F=b.length;for(n=e.xbins.start,s=(d-n)/F,n+=s/2,R=e.ybins,j=R.end+(R.start-a.tickIncrement(R.start,R.size))/1e6,d=R.start;j>d;d=a.tickIncrement(d,R.size))f.push(b.concat()),Array.isArray(k)&&k.push(d),P&&A.push(_.concat());Array.isArray(k)&&k.push(d);var q=f.length;for(c=e.ybins.start,u=(d-c)/q,c+=u/2,z&&(N=b.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/s}),D=f.map(function(t,e){return Array.isArray(k)?1/(k[e+1]-k[e]):1/u})),d=0;v>d;d++)y=r.findBin(p[d],w),x=r.findBin(m[d],k),y>=0&&F>y&&x>=0&&q>x&&(M+=E(y,d,f[x],I,A[x]));if(P)for(x=0;q>x;x++)M+=l(f[x],A[x]);if(O)for(x=0;q>x;x++)O(f[x],M,N,D[x]);return{x:p,x0:n,dx:s,y:m,y0:c,dy:u,z:f}}},{"../../lib":103,"../../plots/cartesian/axes":124,"../histogram/average":210,"../histogram/bin_functions":212,"../histogram/norm_functions":216}],219:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./sample_defaults"),o=t("../../components/colorscale/defaults"),i=t("./attributes");e.exports=function(t,e,n){function l(n,a){return r.coerce(t,e,i,n,a)}a(t,e,l),l("zsmooth"),o(t,e,n,l,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":35,"../../lib":103,"./attributes":217,"./sample_defaults":221}],220:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.calc=t("../heatmap/calc"),r.plot=t("../heatmap/plot"),r.colorbar=t("../heatmap/colorbar"),r.style=t("../heatmap/style"),r.hoverPoints=t("../heatmap/hover"),r.moduleType="trace",r.name="histogram2d",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","2dMap","histogram"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../heatmap/calc":198,"../heatmap/colorbar":199,"../heatmap/hover":203,"../heatmap/plot":206,"../heatmap/style":207,"./attributes":217,"./defaults":219}],221:[function(t,e,n){"use strict";var r=t("../histogram/bin_defaults");e.exports=function(t,e,n){var a=n("x"),o=n("y");if(!(a&&a.length&&o&&o.length))return void(e.visible=!1);var i=n("z")||n("marker.color");i&&n("histfunc");var l=["x","y"];r(t,e,n,l)}},{"../histogram/bin_defaults":211}],222:[function(t,e,n){"use strict";var r=t("../histogram2d/attributes"),a=t("../contour/attributes"),o=t("../../components/colorscale/attributes"),i=t("../../lib/extend").extendFlat;e.exports=i({},{x:r.x,y:r.y,z:r.z,marker:r.marker,histnorm:r.histnorm,histfunc:r.histfunc,autobinx:r.autobinx,nbinsx:r.nbinsx,xbins:r.xbins,autobiny:r.autobiny,nbinsy:r.nbinsy,ybins:r.ybins,autocontour:a.autocontour,ncontours:a.ncontours,contours:a.contours,line:a.line,_nestedModules:{colorbar:"Colorbar"}},o)},{"../../components/colorscale/attributes":31,"../../lib/extend":101,"../contour/attributes":187,"../histogram2d/attributes":217}],223:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../histogram2d/sample_defaults"),o=t("../contour/style_defaults"),i=t("./attributes");e.exports=function(t,e,n,l){function s(n,a){return r.coerce(t,e,i,n,a)}a(t,e,s);var c=r.coerce2(t,e,i,"contours.start"),u=r.coerce2(t,e,i,"contours.end"),f=s("autocontour",!(c&&u));s(f?"ncontours":"contours.size"),o(t,e,s,l)}},{"../../lib":103,"../contour/style_defaults":196,"../histogram2d/sample_defaults":221,"./attributes":222}],224:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.calc=t("../contour/calc"),r.plot=t("../contour/plot"),r.style=t("../contour/style"),r.colorbar=t("../contour/colorbar"),r.hoverPoints=t("../contour/hover"),r.moduleType="trace",r.name="histogram2dcontour",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","2dMap","contour","histogram"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../contour/calc":188,"../contour/colorbar":189,"../contour/hover":191,"../contour/plot":194,"../contour/style":195,"./attributes":222,"./defaults":223}],225:[function(t,e,n){"use strict";var r=t("../../components/color/attributes"),a=t("../../plots/font_attributes"),o=t("../../plots/attributes"),i=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array"},line:{color:{valType:"color",dflt:r.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:i({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:i({},a,{}),insidetextfont:i({},a,{}),outsidetextfont:i({},a,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":24,"../../lib/extend":101,"../../plots/attributes":122,"../../plots/font_attributes":142}],226:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;rs||(c=p[n],void 0!==c&&""!==c||(c=n),c=String(c),void 0===y[c]&&(y[c]=!0,u=o(e.marker.colors[n]),u.isValid()?(u=i.addOpacity(u,u.getAlpha()),v[c]||(v[c]=u)):v[c]?u=v[c]:(u=!1,x=!0),f=-1!==_.indexOf(c),f||(b+=s),g.push({v:s,label:c,color:u,i:n,hidden:f}))));if(e.sort&&g.sort(function(t,e){return e.v-t.v}),x)for(n=0;n")}return g};var s},{"../../components/color":25,"./helpers":229,"fast-isnumeric":18,tinycolor2:20}],228:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=l(i,"textfont",o.font);m&&l(i,"insidetextfont",y),v&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":103,"./attributes":225}],229:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return-1!==n.lastIndexOf(".")&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return-1!==n.lastIndexOf(".")&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":103}],230:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":225,"./base_plot":226,"./calc":227,"./defaults":228,"./layout_attributes":231,"./layout_defaults":232,"./plot":233,"./style":234,"./style_one":235}],231:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],232:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":103,"./layout_attributes":231}],233:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),m={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>d.scale?m:d;return c.scale<1&&v.scale>c.scale?v:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return 0>n&&(a*=-1),0>r&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),m=i?t.yLabelMin:t.yLabelMax,v=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-m;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-m-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,m,v;for(i=0;2>i;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;2>o;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),m=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&-1===h.indexOf(l.scalegroup)&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round","class":"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],m=c.trace,v=0,y=(m.depth||0)*c.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(v),k=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],v=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[m.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];-1!==l.indexOf("label")&&p.push(i.label),o.text&&o.text[i.i]&&-1!==l.indexOf("text")&&p.push(o.text[i.i]),-1!==l.indexOf("value")&&p.push(g.formatPieValue(i.v,h)),-1!==l.indexOf("percent")&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:-1!==l.indexOf("name")?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),m.pull){var z=+(Array.isArray(m.pull)?m.pull[i.i]:m.pull)||0;z>0&&(k+=z*i.pxmid[0],M+=z*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var S=m.hole;if(i.v===c.vTotal){var C="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";S?T.attr("d","M"+(k+S*i.px0[0])+","+(M+S*i.px0[1])+b(i.px0,i.pxmid,!1,S)+b(i.pxmid,i.px0,!1,S)+"Z"+C):T.attr("d",C)}else{var E=b(i.px0,i.px1,!0,1);if(S){var O=1-S;T.attr("d","M"+(k+S*i.px1[0])+","+(M+S*i.px1[1])+b(i.px1,i.px0,!1,S)+"l"+O*i.px0[0]+","+O*i.px0[1]+E+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+E+"Z")}var P=Array.isArray(m.textposition)?m.textposition[i.i]:m.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==P?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===P?e=o(n,i):(e=r(n,i,c),"auto"===P&&e.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,v=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),v&&i(s,m),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":25,"../../components/drawing":48,"../../lib/svg_text_utils":114,"../../plots/cartesian/graph_interact":131,"./helpers":229,d3:16}],234:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":235,d3:16}],235:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":25}],236:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){ +var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":103}],237:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:a.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":33,"../../components/drawing":48,"../../lib/extend":101,"./constants":242}],238:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;p>c;c++)b[c]=r(d[c])&&r(h[c])?{x:d[c],y:h[c]}:{x:!1,y:!1};return void 0!==typeof s&&o.mergeArray(s,b,"ms"),t.firstscatter=!1,b}},{"../../lib":103,"../../plots/cartesian/axes":124,"./colorscale_calc":241,"./subtypes":256,"fast-isnumeric":18}],239:[function(t,e,n){"use strict";e.exports=function(t){var e,n,r,a,o;for(e=0;e=0;a--)if(o=t[a],"scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}},{}],240:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,c=n.marker,u="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===c||!c.showscale)return void i.autoMargin(t,u);var f=l(c.colorscale),d=c.color,h=c.cmin,p=c.cmax;a(h)||(h=o.aggNums(Math.min,null,d)),a(p)||(p=o.aggNums(Math.max,null,d));var g=e[0].t.cb=s(t,u);g.fillcolor(r.scale.linear().domain(f.map(function(t){return h+t[0]*(p-h)})).range(f.map(function(t){return t[1]}))).filllevels({start:h,end:p,size:(p-h)/254}).options(c.colorbar)()}},{"../../components/colorbar/draw":28,"../../components/colorscale/get_scale":37,"../../lib":103,"../../plots/plots":144,d3:16,"fast-isnumeric":18}],241:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":38,"./subtypes":256}],242:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],243:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var m=l(t,e,g),v=mB!=P>=B&&(C=z[T-1][0],E=z[T][0],S=C+(E-C)*(B-O)/(P-O),R=Math.min(R,S),j=Math.max(j,S));R=Math.max(R,0),j=Math.min(j,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:j,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":25,"../../components/errorbars":54,"../../lib":103,"../../plots/cartesian/constants":129,"../../plots/cartesian/graph_interact":131,"./get_trace_color":245}],247:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"./arrays_to_calcdata":236,"./attributes":237,"./calc":238,"./clean_data":239,"./colorbar":240,"./defaults":243,"./hover":246,"./plot":253,"./select":254,"./style":255,"./subtypes":256}],248:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=(Array.isArray(l)?!1:l)||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38}],249:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=k.c2p(t[e].y);return n===z||r===z?!1:[n,r]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],z=r.BADNUM,S=.2,C=new Array(t.length),E=0;for(i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):v>y&&(v=y,u=f,h=!0)}if(h?(C[E++]=c,s!==u&&(C[E++]=u)):(u!==l&&(C[E++]=u),s!==c&&(C[E++]=c)),C[E++]=s,i>=t.length||!f)break;C[E++]=f,l=f}}else C[E++]=c}L.push(C.slice(0,E))}return L}},{"../../plots/cartesian/axes":124}],250:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],251:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t){var e=t.marker,n=e.sizeref||1,a=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/n)}:function(t){return t/n};return function(t){var e=o(t/2);return r(e)&&e>0?Math.max(e,a):0}}},{"fast-isnumeric":18}],252:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":25,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38,"./subtypes":256}],253:[function(t,e,n){"use strict";function r(t,e,n){var r=e.x(),o=e.y(),i=a.extent(r.range.map(r.l2c)),l=a.extent(o.range.map(o.l2c));n.forEach(function(t,e){var r=t[0].trace;if(c.hasMarkers(r)){var a=r.marker.maxdisplayed;if(0!==a){var o=t.filter(function(t){return t.x>=i[0]&&t.x<=i[1]&&t.y>=l[0]&&t.y<=l[1]}),s=Math.ceil(o.length/a),u=0;n.forEach(function(t,n){var r=t[0].trace;c.hasMarkers(r)&&r.marker.maxdisplayed>0&&e>n&&u++});var f=Math.round(u*s/3+Math.floor(u/3)*s/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+f)%s)&&(t.vis=!0)})}}})}var a=t("d3"),o=t("../../lib"),i=t("../../components/drawing"),l=t("../../components/errorbars"),s=t("../../lib/polygon").tester,c=t("./subtypes"),u=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,n){function d(t){return t.filter(function(t){return t.vis})}r(t,e,n);var h=e.x(),p=e.y(),g=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(n);g.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),g.call(l.plot,e);var m,v,y,x,b="",_=[];g.each(function(t){var e=t[0].trace,n=e.line,r=a.select(this);if(e.visible===!0&&(v=e.fill.charAt(e.fill.length-1),"x"!==v&&"y"!==v&&(v=""),t[0].node3=r,u(t),c.hasLines(e)||"none"!==e.fill)){var o,l,d,g,w,k="",M="";m="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!b?r.append("path").classed("js-fill",!0):null,x&&(y=x.datum(t)),x=r.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(n.shape)?(d=i.steps(n.shape),g=i.steps(n.shape.split("").reverse().join(""))):d=g="spline"===n.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?i.smoothclosed(t.slice(1),n.smoothing):i.smoothopen(t,n.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return g(t.reverse())};var A,T=f(t,{xaxis:h,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(n.width||1,3)/4,linear:"linear"===n.shape}),L=e._polygons=new Array(T.length);for(A=0;A1&&r.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}m?z&&C&&(v?("y"===v?z[1]=C[1]=p.c2p(0,!0):"x"===v&&(z[0]=C[0]=h.c2p(0,!0)),m.attr("d",k+"L"+C+"L"+z+"Z")):m.attr("d",k+"Z")):"tonext"===e.fill.substr(0,6)&&k&&b&&("tonext"===e.fill?y.attr("d",k+"Z"+b+"Z"):y.attr("d",k+"L"+b.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),b=M,_=L}}}),g.selectAll("path:not([d])").remove(),g.append("g").attr("class","points").each(function(t){var e=t[0].trace,n=a.select(this),r=c.hasMarkers(e),l=c.hasText(e);!r&&!l||e.visible!==!0?n.remove():(r&&n.selectAll("path.point").data(e.marker.maxdisplayed?d:o.identity).enter().append("path").classed("point",!0).call(i.translatePoints,h,p),l&&n.selectAll("g").data(e.marker.maxdisplayed?d:o.identity).enter().append("g").append("text").call(i.translatePoints,h,p))})}},{"../../components/drawing":48,"../../components/errorbars":54,"../../lib":103,"../../lib/polygon":109,"./arrays_to_calcdata":236,"./line_points":249,"./subtypes":256,d3:16}],254:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;nn;n++)y=e.a[n],x=e.b[n],b=e.c[n],r(y)&&r(x)&&r(b)?(y=+y,x=+x,b=+b,_=m/(y+x+b),1!==_&&(y*=_,x*=_,b*=_),k=y,w=b-x,A[n]={x:w,y:k,a:y,b:x,c:b}):A[n]={x:!1,y:!1};var T,L;if(i.hasMarkers(e)&&(T=e.marker,L=T.size,Array.isArray(L))){var z={type:"linear"};a.setConvert(z),L=z.makeCalcdata(e.marker,"size"),L.length>M&&L.splice(M,L.length-M)}return l(e),void 0!==typeof L&&o.mergeArray(L,A,"ms"),A}},{"../../lib":103,"../../plots/cartesian/axes":124,"../scatter/colorscale_calc":241,"../scatter/subtypes":256,"fast-isnumeric":18}],261:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../scatter/constants"),o=t("../scatter/subtypes"),i=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),s=t("../scatter/line_shape_defaults"),c=t("../scatter/text_defaults"),u=t("../scatter/fillcolor_defaults"),f=t("./attributes");e.exports=function(t,e,n,d){function h(n,a){return r.coerce(t,e,f,n,a)}var p,g=h("a"),m=h("b"),v=h("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),l}}},{"../../plots/cartesian/axes":124,"../scatter/hover":246}],263:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatterternary",r.basePlotModule=t("../../plots/ternary"),r.categories=["ternary","symbols","markerColorscale","showLegend"],r.meta={},e.exports=r},{"../../plots/ternary":151,"../scatter/colorbar":240,"./attributes":259,"./calc":260,"./defaults":261,"./hover":262,"./plot":264,"./select":265,"./style":266}],264:[function(t,e,n){"use strict";var r=t("../scatter/plot");e.exports=function(t,e){var n=t.plotContainer;n.select(".scatterlayer").selectAll("*").remove();for(var a={x:function(){return t.xaxis},y:function(){return t.yaxis},plot:n},o=new Array(e.length),i=t.graphDiv.calcdata,l=0;lo;o++){a.push(e=[]);for(var n=this[o],l=0,s=n.length;s>l;l++)(r=n[l])&&t.call(r,r.__data__,l,o)&&e.push(r)}return Jo(a,this.namespace,this.id)},Gs.tween=function(t,e){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(t):G(this,null==e?function(e){e[r][n].tween.remove(t)}:function(a){a[r][n].tween.set(t,e)})},Gs.attr=function(t,e){function n(){this.removeAttribute(l)}function r(){this.removeAttributeNS(l.space,l.local)}function a(t){return null==t?n:(t+="",function(){var e,n=this.getAttribute(l);return n!==t&&(e=i(n,t),function(t){this.setAttribute(l,e(t))})})}function o(t){return null==t?r:(t+="",function(){var e,n=this.getAttributeNS(l.space,l.local);return n!==t&&(e=i(n,t),function(t){this.setAttributeNS(l.space,l.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var i="transform"==t?Qr:_r,l=ui.ns.qualify(t);return Ko(this,"attr."+t,e,l.local?o:a)},Gs.attrTween=function(t,e){function n(t,n){var r=e.call(this,t,n,this.getAttribute(a));return r&&function(t){this.setAttribute(a,r(t))}}function r(t,n){var r=e.call(this,t,n,this.getAttributeNS(a.space,a.local));return r&&function(t){this.setAttributeNS(a.space,a.local,r(t))}}var a=ui.ns.qualify(t);return this.tween("attr."+t,a.local?r:n)},Gs.style=function(t,e,n){function a(){this.style.removeProperty(t)}function o(e){return null==e?a:(e+="",function(){var a,o=r(this).getComputedStyle(this,null).getPropertyValue(t);return o!==e&&(a=_r(o,e),function(e){this.style.setProperty(t,a(e),n)})})}var i=arguments.length;if(3>i){if("string"!=typeof t){2>i&&(e="");for(n in t)this.style(n,t[n],e);return this}n=""}return Ko(this,"style."+t,e,o)},Gs.styleTween=function(t,e,n){function a(a,o){var i=e.call(this,a,o,r(this).getComputedStyle(this,null).getPropertyValue(t));return i&&function(e){this.style.setProperty(t,i(e),n)}}return arguments.length<3&&(n=""),this.tween("style."+t,a)},Gs.text=function(t){return Ko(this,"text",t,ti)},Gs.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Gs.ease=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].ease:("function"!=typeof t&&(t=ui.ease.apply(ui,arguments)),G(this,function(r){r[n][e].ease=t}))},Gs.delay=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].delay:G(this,"function"==typeof t?function(r,a,o){r[n][e].delay=+t.call(r,r.__data__,a,o)}:(t=+t,function(r){r[n][e].delay=t}))},Gs.duration=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].duration:G(this,"function"==typeof t?function(r,a,o){r[n][e].duration=Math.max(1,t.call(r,r.__data__,a,o))}:(t=Math.max(1,t),function(r){r[n][e].duration=t}))},Gs.each=function(t,e){var n=this.id,r=this.namespace;if(arguments.length<2){var a=Vs,o=Hs;try{Hs=n,G(this,function(e,a,o){Vs=e[r][n],t.call(e,e.__data__,a,o)})}finally{Vs=a,Hs=o}}else G(this,function(a){var o=a[r][n];(o.event||(o.event=ui.dispatch("start","end","interrupt"))).on(t,e)});return this},Gs.transition=function(){for(var t,e,n,r,a=this.id,o=++Zs,i=this.namespace,l=[],s=0,c=this.length;c>s;s++){l.push(t=[]);for(var e=this[s],u=0,f=e.length;f>u;u++)(n=e[u])&&(r=n[i][a],ni(n,u,i,o,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),t.push(n)}return Jo(l,i,o)},ui.svg.axis=function(){function t(t){t.each(function(){var t,c=ui.select(this),u=this.__chart__||n,f=this.__chart__=n.copy(),d=null==s?f.ticks?f.ticks.apply(f,l):f.domain():s,h=null==e?f.tickFormat?f.tickFormat.apply(f,l):b:e,p=c.selectAll(".tick").data(d,f),g=p.enter().insert("g",".domain").attr("class","tick").style("opacity",qi),v=ui.transition(p.exit()).style("opacity",qi).remove(),m=ui.transition(p.order()).style("opacity",1),y=Math.max(a,0)+i,x=Za(f),_=c.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),ui.transition(_));g.append("line"),g.append("text");var k,M,A,T,L=g.select("line"),z=m.select("line"),S=p.select("text").text(h),C=g.select("text"),E=m.select("text"),O="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(t=ri,k="x",A="y",M="x2",T="y2",S.attr("dy",0>O?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+O*o+"V0H"+x[1]+"V"+O*o)):(t=ai,k="y",A="x",M="y2",T="x2",S.attr("dy",".32em").style("text-anchor",0>O?"end":"start"),w.attr("d","M"+O*o+","+x[0]+"H0V"+x[1]+"H"+O*o)),L.attr(T,O*a),C.attr(A,O*y),z.attr(M,0).attr(T,O*a),E.attr(k,0).attr(A,O*y),f.rangeBand){var N=f,P=N.rangeBand()/2;u=f=function(t){return N(t)+P}}else u.rangeBand?u=f:v.call(t,f,u);g.call(t,u,f),m.call(t,f,f)})}var e,n=ui.scale.linear(),r=Ys,a=6,o=6,i=3,l=[10],s=null;return t.scale=function(e){return arguments.length?(n=e,t):n},t.orient=function(e){return arguments.length?(r=e in Xs?e+"":Ys,t):r},t.ticks=function(){return arguments.length?(l=di(arguments),t):l},t.tickValues=function(e){return arguments.length?(s=e,t):s},t.tickFormat=function(n){return arguments.length?(e=n,t):e},t.tickSize=function(e){var n=arguments.length;return n?(a=+e,o=+arguments[n-1],t):a},t.innerTickSize=function(e){return arguments.length?(a=+e,t):a},t.outerTickSize=function(e){return arguments.length?(o=+e,t):o},t.tickPadding=function(e){return arguments.length?(i=+e,t):i},t.tickSubdivide=function(){return arguments.length&&t},t};var Ys="bottom",Xs={top:1,right:1,bottom:1,left:1};ui.svg.brush=function(){function t(r){r.each(function(){var r=ui.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),i=r.selectAll(".background").data([0]);i.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),r.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var l=r.selectAll(".resize").data(g,b);l.exit().remove(),l.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Qs[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"),l.style("display",t.empty()?"none":null);var s,f=ui.transition(r),d=ui.transition(i);c&&(s=Za(c),d.attr("x",s[0]).attr("width",s[1]-s[0]),n(f)),u&&(s=Za(u),d.attr("y",s[0]).attr("height",s[1]-s[0]),a(f)),e(f)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+f[+/e$/.test(t)]+","+d[+/^s/.test(t)]+")"})}function n(t){t.select(".extent").attr("x",f[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(S||(x=null,E[0]-=f[1],E[1]-=d[1],S=2),T())}function g(){32==ui.event.keyCode&&2==S&&(E[0]+=f[1],E[1]+=d[1],S=0,T())}function v(){var t=ui.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),S||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),E[0]=f[+(t[0]u?(a=r,r=u):a=u),g[0]!=r||g[1]!=a?(n?l=null:i=null,g[0]=r,g[1]=a,!0):void 0}function y(){v(),M.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),ui.select("body").style("cursor",null),O.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),C(),k({type:"brushend"})}var x,b,_=this,w=ui.select(ui.event.target),k=s.of(_,arguments),M=ui.select(_),A=w.datum(),L=!/^(n|s)$/.test(A)&&c,z=!/^(e|w)$/.test(A)&&u,S=w.classed("extent"),C=W(_),E=ui.mouse(_),O=ui.select(r(_)).on("keydown.brush",o).on("keyup.brush",g);if(ui.event.changedTouches?O.on("touchmove.brush",v).on("touchend.brush",y):O.on("mousemove.brush",v).on("mouseup.brush",y),M.interrupt().selectAll("*").interrupt(),S)E[0]=f[0]-E[0],E[1]=d[0]-E[1];else if(A){var N=+/w$/.test(A),P=+/^n/.test(A);b=[f[1-N]-E[0],d[1-P]-E[1]],E[0]=f[N],E[1]=d[P]}else ui.event.altKey&&(x=E.slice());M.style("pointer-events","none").selectAll(".resize").style("display",null),ui.select("body").style("cursor",w.style("cursor")),k({type:"brushstart"}),v()}var i,l,s=z(t,"brushstart","brush","brushend"),c=null,u=null,f=[0,0],d=[0,0],h=!0,p=!0,g=$s[0];return t.event=function(t){t.each(function(){var t=s.of(this,arguments),e={x:f,y:d,i:i,j:l},n=this.__chart__||e;this.__chart__=e,Hs?ui.select(this).transition().each("start.brush",function(){i=n.i,l=n.j,f=n.x,d=n.y,t({type:"brushstart"})}).tween("brush:brush",function(){var n=wr(f,e.x),r=wr(d,e.y);return i=l=null,function(a){f=e.x=n(a),d=e.y=r(a),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=e.i,l=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(c=e,g=$s[!c<<1|!u],t):c},t.y=function(e){return arguments.length?(u=e,g=$s[!c<<1|!u],t):u},t.clamp=function(e){return arguments.length?(c&&u?(h=!!e[0],p=!!e[1]):c?h=!!e:u&&(p=!!e),t):c&&u?[h,p]:c?h:u?p:null},t.extent=function(e){var n,r,a,o,s;return arguments.length?(c&&(n=e[0],r=e[1],u&&(n=n[0],r=r[0]),i=[n,r],c.invert&&(n=c(n),r=c(r)),n>r&&(s=n,n=r,r=s),n==f[0]&&r==f[1]||(f=[n,r])),u&&(a=e[0],o=e[1],c&&(a=a[1],o=o[1]),l=[a,o],u.invert&&(a=u(a),o=u(o)),a>o&&(s=a,a=o,o=s),a==d[0]&&o==d[1]||(d=[a,o])),t):(c&&(i?(n=i[0],r=i[1]):(n=f[0],r=f[1],c.invert&&(n=c.invert(n),r=c.invert(r)),n>r&&(s=n,n=r,r=s))),u&&(l?(a=l[0],o=l[1]):(a=d[0],o=d[1],u.invert&&(a=u.invert(a),o=u.invert(o)),a>o&&(s=a,a=o,o=s))),c&&u?[[n,a],[r,o]]:c?[n,r]:u&&[a,o])},t.clear=function(){return t.empty()||(f=[0,0],d=[0,0],i=l=null),t},t.empty=function(){return!!c&&f[0]==f[1]||!!u&&d[0]==d[1]},ui.rebind(t,s,"on")};var Qs={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},$s=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ws=vl.format=wl.timeFormat,Js=Ws.utc,Ks=Js("%Y-%m-%dT%H:%M:%S.%LZ");Ws.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?oi:Ks,oi.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},oi.toString=Ks.toString,vl.second=Ht(function(t){return new ml(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),vl.seconds=vl.second.range,vl.seconds.utc=vl.second.utc.range,vl.minute=Ht(function(t){return new ml(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),vl.minutes=vl.minute.range,vl.minutes.utc=vl.minute.utc.range,vl.hour=Ht(function(t){var e=t.getTimezoneOffset()/60;return new ml(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),vl.hours=vl.hour.range,vl.hours.utc=vl.hour.utc.range,vl.month=Ht(function(t){return t=vl.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),vl.months=vl.month.range,vl.months.utc=vl.month.utc.range;var tc=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],ec=[[vl.second,1],[vl.second,5],[vl.second,15],[vl.second,30],[vl.minute,1],[vl.minute,5],[vl.minute,15],[vl.minute,30],[vl.hour,1],[vl.hour,3],[vl.hour,6],[vl.hour,12],[vl.day,1],[vl.day,2],[vl.week,1],[vl.month,1],[vl.month,3],[vl.year,1]],nc=Ws.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",Ee]]),rc={range:function(t,e,n){return ui.range(Math.ceil(t/n)*n,+e,n).map(li)},floor:b,ceil:b};ec.year=vl.year,vl.scale=function(){return ii(ui.scale.linear(),ec,nc)};var ac=ec.map(function(t){return[t[0].utc,t[1]]}),oc=Js.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",Ee]]);ac.year=vl.year.utc,vl.scale.utc=function(){return ii(ui.scale.linear(),ac,oc)},ui.text=St(function(t){return t.responseText}),ui.json=function(t,e){return Ct(t,"application/json",si,e)},ui.html=function(t,e){return Ct(t,"text/html",ci,e)},ui.xml=St(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=ui,t(ui)):"object"==typeof n&&n.exports?n.exports=ui:this.d3=ui}()},{}],11:[function(e,n,r){(function(r,a){(function(){"use strict";function o(t){return"function"==typeof t||"object"==typeof t&&null!==t}function i(t){return"function"==typeof t}function l(t){Z=t}function s(t){$=t}function c(){return function(){r.nextTick(p)}}function u(){return function(){G(p)}}function f(){var t=0,e=new K(p),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function d(){var t=new MessageChannel;return t.port1.onmessage=p,function(){t.port2.postMessage(0)}}function h(){return function(){setTimeout(p,1)}}function p(){for(var t=0;Q>t;t+=2){var e=nt[t],n=nt[t+1];e(n),nt[t]=void 0,nt[t+1]=void 0}Q=0}function g(){try{var t=e,n=t("vertx");return G=n.runOnLoop||n.runOnContext,u()}catch(r){return h()}}function v(t,e){var n=this,r=n._state;if(r===it&&!t||r===lt&&!e)return this;var a=new this.constructor(y),o=n._result;if(r){var i=arguments[r-1];$(function(){P(r,a,i,o)})}else C(n,a,t,e);return a}function m(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(y);return T(n,t),n}function y(){}function x(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return st.error=e,st}}function w(t,e,n,r){try{t.call(e,n,r)}catch(a){return a}}function k(t,e,n){$(function(t){var r=!1,a=w(n,e,function(n){r||(r=!0,e!==n?T(t,n):z(t,n))},function(e){r||(r=!0,S(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&a&&(r=!0,S(t,a))},t)}function M(t,e){e._state===it?z(t,e._result):e._state===lt?S(t,e._result):C(e,void 0,function(e){T(t,e)},function(e){S(t,e)})}function A(t,e,n){e.constructor===t.constructor&&n===rt&&constructor.resolve===at?M(t,e):n===st?S(t,st.error):void 0===n?z(t,e):i(n)?k(t,e,n):z(t,e)}function T(t,e){t===e?S(t,x()):o(e)?A(t,e,_(e)):z(t,e)}function L(t){t._onerror&&t._onerror(t._result),E(t)}function z(t,e){t._state===ot&&(t._result=e,t._state=it,0!==t._subscribers.length&&$(E,t))}function S(t,e){t._state===ot&&(t._state=lt,t._result=e,$(L,t))}function C(t,e,n,r){var a=t._subscribers,o=a.length;t._onerror=null,a[o]=e,a[o+it]=n,a[o+lt]=r,0===o&&t._state&&$(E,t)}function E(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,a,o=t._result,i=0;ii;i++)C(r.resolve(t[i]),void 0,e,n);return a}function I(t){var e=this,n=new e(y);return S(n,t),n}function q(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function F(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function B(t){this._id=ht++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==t&&("function"!=typeof t&&q(),this instanceof B?j(this,t):F())}function H(t,e){this._instanceConstructor=t,this.promise=new t(y),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?z(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&z(this.promise,this._result))):S(this.promise,this._validationError())}function V(){var t;if("undefined"!=typeof a)t=a;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;n&&"[object Promise]"===Object.prototype.toString.call(n.resolve())&&!n.cast||(t.Promise=pt)}var U;U=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var G,Z,Y,X=U,Q=0,$=function(t,e){nt[Q]=t,nt[Q+1]=e,Q+=2,2===Q&&(Z?Z(p):Y())},W="undefined"!=typeof window?window:void 0,J=W||{},K=J.MutationObserver||J.WebKitMutationObserver,tt="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);Y=tt?c():K?f():et?d():void 0===W&&"function"==typeof e?g():h();var rt=v,at=m,ot=void 0,it=1,lt=2,st=new O,ct=new O,ut=D,ft=R,dt=I,ht=0,pt=B;B.all=ut,B.race=ft,B.resolve=at,B.reject=dt,B._setScheduler=l,B._setAsap=s,B._asap=$,B.prototype={constructor:B,then:rt,"catch":function(t){return this.then(null,t)}};var gt=H;H.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},H.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ot&&t>n;n++)this._eachEntry(e[n],n)},H.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===at){var a=_(t);if(a===rt&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof a)this._remaining--,this._result[e]=t;else if(n===pt){var o=new n(y);A(o,t,a),this._willSettleAt(o,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},H.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ot&&(this._remaining--,t===lt?S(r,n):this._result[e]=n),0===this._remaining&&z(r,this._result)},H.prototype._willSettleAt=function(t,e){var n=this;C(t,void 0,function(t){n._settledAt(it,e,t)},function(t){n._settledAt(lt,e,t)})};var vt=V,mt={Promise:pt,polyfill:vt};"function"==typeof t&&t.amd?t(function(){return mt}):"undefined"!=typeof n&&n.exports?n.exports=mt:"undefined"!=typeof this&&(this.ES6Promise=mt),vt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:8}],12:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;n>r;r++)if(e=t.charCodeAt(r),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],13:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,v=o*l,m=o*s;return t[0]=1-f-p,t[1]=u+m,t[2]=d-v,t[3]=0,t[4]=u-m,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+v,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],14:[function(e,n,r){!function(){function e(t,n){if(t=t?t:"",n=n||{},t instanceof e)return t;if(!(this instanceof e))return new e(t,n);var a=r(t);this._originalInput=t,this._r=a.r,this._g=a.g,this._b=a.b,this._a=a.a,this._roundA=B(100*this._a)/100,this._format=n.format||a.format,this._gradientType=n.gradientType,this._r<1&&(this._r=B(this._r)),this._g<1&&(this._g=B(this._g)),this._b<1&&(this._b=B(this._b)),this._ok=a.ok,this._tc_id=q++}function r(t){var e={r:0,g:0,b:0},n=1,r=!1,o=!1;return"string"==typeof t&&(t=j(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(e=a(t.r,t.g,t.b),r=!0,o="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=O(t.s),t.v=O(t.v),e=s(t.h,t.s,t.v),r=!0,o="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=O(t.s),t.l=O(t.l),e=i(t.h,t.s,t.l),r=!0,o="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=A(n),{ok:r,format:t.format||o,r:H(255,V(e.r,0)),g:H(255,V(e.g,0)),b:H(255,V(e.b,0)),a:n}}function a(t,e,n){return{r:255*T(t,255),g:255*T(e,255),b:255*T(n,255)}}function o(t,e,n){t=T(t,255),e=T(e,255),n=T(n,255);var r,a,o=V(t,e,n),i=H(t,e,n),l=(o+i)/2;if(o==i)r=a=0;else{var s=o-i;switch(a=l>.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(n>e?6:0);break;case e:r=(n-t)/s+2;break;case n:r=(t-e)/s+4}r/=6}return{h:r,s:a,l:l}}function i(t,e,n){function r(t,e,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?t+6*(e-t)*n:.5>n?e:2/3>n?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=T(t,360),e=T(e,100),n=T(n,100),0===e)a=o=i=n;else{var l=.5>n?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function l(t,e,n){t=T(t,255),e=T(e,255),n=T(n,255);var r,a,o=V(t,e,n),i=H(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(n>e?6:0);break;case e:r=(n-t)/s+2;break;case n:r=(t-e)/s+4}r/=6}return{h:r,s:a,v:l}}function s(t,e,n){t=6*T(t,360),e=T(e,100),n=T(n,100);var r=F.floor(t),a=t-r,o=n*(1-e),i=n*(1-a*e),l=n*(1-(1-a)*e),s=r%6,c=[n,i,o,o,l,n][s],u=[l,n,n,i,o,o][s],f=[o,o,l,n,n,i][s];return{r:255*c,g:255*u,b:255*f}}function c(t,e,n,r){var a=[E(B(t).toString(16)),E(B(e).toString(16)),E(B(n).toString(16))];return r&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function u(t,e,n,r){var a=[E(N(r)),E(B(t).toString(16)),E(B(e).toString(16)),E(B(n).toString(16))];return a.join("")}function f(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.s-=n/100,r.s=L(r.s),e(r)}function d(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.s+=n/100,r.s=L(r.s),e(r)}function h(t){return e(t).desaturate(100)}function p(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.l+=n/100,r.l=L(r.l),e(r)}function g(t,n){n=0===n?0:n||10;var r=e(t).toRgb();return r.r=V(0,H(255,r.r-B(255*-(n/100)))),r.g=V(0,H(255,r.g-B(255*-(n/100)))),r.b=V(0,H(255,r.b-B(255*-(n/100)))),e(r)}function v(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.l-=n/100,r.l=L(r.l),e(r)}function m(t,n){var r=e(t).toHsl(),a=(B(r.h)+n)%360;return r.h=0>a?360+a:a,e(r)}function y(t){var n=e(t).toHsl();return n.h=(n.h+180)%360,e(n)}function x(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+120)%360,s:n.s,l:n.l}),e({h:(r+240)%360,s:n.s,l:n.l})]}function b(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+90)%360,s:n.s,l:n.l}),e({h:(r+180)%360,s:n.s,l:n.l}),e({h:(r+270)%360,s:n.s,l:n.l})]}function _(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+72)%360,s:n.s,l:n.l}),e({h:(r+216)%360,s:n.s,l:n.l})]}function w(t,n,r){n=n||6,r=r||30;var a=e(t).toHsl(),o=360/r,i=[e(t)];for(a.h=(a.h-(o*n>>1)+720)%360;--n;)a.h=(a.h+o)%360,i.push(e(a));return i}function k(t,n){n=n||6;for(var r=e(t).toHsv(),a=r.h,o=r.s,i=r.v,l=[],s=1/n;n--;)l.push(e({h:a,s:o,v:i})),i=(i+s)%1;return l}function M(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function A(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function T(t,e){S(t)&&(t="100%");var n=C(t);return t=H(e,V(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),F.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function L(t){return H(1,V(0,t))}function z(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function C(t){return"string"==typeof t&&-1!=t.indexOf("%")}function E(t){return 1==t.length?"0"+t:""+t}function O(t){return 1>=t&&(t=100*t+"%"),t}function N(t){return Math.round(255*parseFloat(t)).toString(16)}function P(t){return z(t)/255}function j(t){t=t.replace(R,"").replace(I,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=Y.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=Y.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Y.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=Y.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Y.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=Y.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Y.hex8.exec(t))?{a:P(n[1]),r:z(n[2]),g:z(n[3]),b:z(n[4]),format:e?"name":"hex8"}:(n=Y.hex6.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),format:e?"name":"hex"}:(n=Y.hex3.exec(t))?{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function D(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var R=/^\s+/,I=/\s+$/,q=0,F=Math,B=F.round,H=F.min,V=F.max,U=F.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,n,r,a,o,i=this.toRgb();return t=i.r/255,e=i.g/255,n=i.b/255,r=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),a=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),o=.03928>=n?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o},setAlpha:function(t){return this._a=A(t),this._roundA=B(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=B(360*t.h),n=B(100*t.s),r=B(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=B(360*t.h),n=B(100*t.s),r=B(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return u(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:B(this._r),g:B(this._g),b:B(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+B(this._r)+", "+B(this._g)+", "+B(this._b)+")":"rgba("+B(this._r)+", "+B(this._g)+", "+B(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:B(100*T(this._r,255))+"%",g:B(100*T(this._g,255))+"%",b:B(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+B(100*T(this._r,255))+"%, "+B(100*T(this._g,255))+"%, "+B(100*T(this._b,255))+"%)":"rgba("+B(100*T(this._r,255))+"%, "+B(100*T(this._g,255))+"%, "+B(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:Z[c(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+u(this._r,this._g,this._b,this._a),r=n,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=e(t);r=o.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(g,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(d,arguments)},greyscale:function(){return this._applyModification(h,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(x,arguments)},tetrad:function(){return this._applyCombination(b,arguments)}},e.fromRatio=function(t,n){if("object"==typeof t){var r={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?r[a]=t[a]:r[a]=O(t[a]));t=r}return e(t,n)},e.equals=function(t,n){return t&&n?e(t).toRgbString()==e(n).toRgbString():!1},e.random=function(){return e.fromRatio({r:U(),g:U(),b:U()})},e.mix=function(t,n,r){r=0===r?0:r||50;var a,o=e(t).toRgb(),i=e(n).toRgb(),l=r/100,s=2*l-1,c=i.a-o.a;a=s*c==-1?s:(s+c)/(1+s*c),a=(a+1)/2;var u=1-a,f={r:i.r*a+o.r*u,g:i.g*a+o.g*u,b:i.b*a+o.b*u,a:i.a*l+o.a*(1-l)};return e(f)},e.readability=function(t,n){var r=e(t),a=e(n);return(Math.max(r.getLuminance(),a.getLuminance())+.05)/(Math.min(r.getLuminance(),a.getLuminance())+.05)},e.isReadable=function(t,n,r){var a,o,i=e.readability(t,n);switch(o=!1,a=D(r),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},e.mostReadable=function(t,n,r){var a,o,i,l,s=null,c=0;r=r||{},o=r.includeFallbackColors,i=r.level,l=r.size;for(var u=0;uc&&(c=a,s=e(n[u]));return e.isReadable(t,s,{level:i,size:l})||!o?s:(r.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],r))};var G=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Z=e.hexNames=M(G),Y=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+a),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof n&&n.exports?n.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],15:[function(e,n,r){!function(e,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof t&&t.amd?t(["exports"],a):a(e.topojson={})}(this,function(t){"use strict";function e(){}function n(t){if(!t)return e;var n,r,a=t.scale[0],o=t.scale[1],i=t.translate[0],l=t.translate[1];return function(t,e){e||(n=r=0),t[0]=(n+=t[0])*a+i,t[1]=(r+=t[1])*o+l}}function r(t){if(!t)return e;var n,r,a=t.scale[0],o=t.scale[1],i=t.translate[0],l=t.translate[1];return function(t,e){e||(n=r=0);var s=(t[0]-i)/a|0,c=(t[1]-l)/o|0;t[0]=s-n,t[1]=c-r,n=s,r=c}}function a(t,e){for(var n,r=t.length,a=r-e;a<--r;)n=t[a],t[a++]=t[r],t[r]=n}function o(t,e){for(var n=0,r=t.length;r>n;){var a=n+r>>>1;t[a]t?~t:t],o=0,i=r.length;i>o;++o)e.push(n=r[o].slice()),u(n,o);0>t&&a(e,i)}function o(t){return t=t.slice(),u(t,0),t}function i(t){for(var e=[],n=0,a=t.length;a>n;++n)r(t[n],e);return e.length<2&&e.push(e[0].slice()),e}function l(t){for(var e=i(t);e.length<4;)e.push(e[0].slice());return e}function s(t){return t.map(l)}function c(t){var e=t.type;return"GeometryCollection"===e?{type:e,geometries:t.geometries.map(c)}:e in d?{type:e,coordinates:d[e](t)}:null}var u=n(t.transform),f=t.arcs,d={Point:function(t){return o(t.coordinates)},MultiPoint:function(t){return t.coordinates.map(o)},LineString:function(t){return i(t.arcs)},MultiLineString:function(t){return t.arcs.map(i)},Polygon:function(t){return s(t.arcs)},MultiPolygon:function(t){return t.arcs.map(s)}};return c(e)}function c(t,e){function n(e){var n,r=t.arcs[0>e?~e:e],a=r[0];return t.transform?(n=[0,0],r.forEach(function(t){n[0]+=t[0],n[1]+=t[1]})):n=r[r.length-1],0>e?[n,a]:[a,n]}function r(t,e){for(var n in t){var r=t[n];delete e[r.start],delete r.start,delete r.end,r.forEach(function(t){a[0>t?~t:t]=1}),l.push(r)}}var a={},o={},i={},l=[],s=-1;return e.forEach(function(n,r){var a,o=t.arcs[0>n?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(a=e[++s],e[s]=n,e[r]=a)}),e.forEach(function(t){var e,r,a=n(t),l=a[0],s=a[1];if(e=i[l])if(delete i[e.end],e.push(t),e.end=s,r=o[s]){delete o[r.start];var c=r===e?e:e.concat(r);o[c.start=e.start]=i[c.end=r.end]=c}else o[e.start]=i[e.end]=e;else if(e=o[s])if(delete o[e.start],e.unshift(t),e.start=l,r=i[l]){delete i[r.end];var u=r===e?e:r.concat(e);o[u.start=r.start]=i[u.end=e.end]=u}else o[e.start]=i[e.end]=e;else e=[t],o[e.start=l]=i[e.end=s]=e}),r(i,o),r(o,i),e.forEach(function(t){a[0>t?~t:t]||l.push([t])}),l}function u(t){return s(t,f.apply(this,arguments))}function f(t,e,n){function r(t){var e=0>t?~t:t;(u[e]||(u[e]=[])).push({i:t,g:s})}function a(t){t.forEach(r)}function o(t){t.forEach(a)}function i(t){"GeometryCollection"===t.type?t.geometries.forEach(i):t.type in f&&(s=t,f[t.type](t.arcs))}var l=[];if(arguments.length>1){var s,u=[],f={LineString:a,MultiLineString:o,Polygon:o,MultiPolygon:function(t){t.forEach(o)}};i(e),u.forEach(arguments.length<3?function(t){l.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&l.push(t[0].i)})}else for(var d=0,h=t.arcs.length;h>d;++d)l.push(d);return{type:"MultiLineString",arcs:c(t,l)}}function d(t){var e=t[0],n=t[1],r=t[2];return Math.abs((e[0]-r[0])*(n[1]-e[1])-(e[0]-n[0])*(r[1]-e[1]))}function h(t){for(var e,n=-1,r=t.length,a=t[r-1],o=0;++ne?~e:e]||(a[e]=[])).push(t)})}),o.push(t)}function r(e){return h(s(t,{type:"Polygon",arcs:[e]}).coordinates[0])>0}var a={},o=[],i=[];return e.forEach(function(t){"Polygon"===t.type?n(t.arcs):"MultiPolygon"===t.type&&t.arcs.forEach(n)}),o.forEach(function(t){if(!t._){var e=[],n=[t];for(t._=1,i.push(e);t=n.pop();)e.push(t),t.forEach(function(t){t.forEach(function(t){a[0>t?~t:t].forEach(function(t){t._||(t._=1,n.push(t))})})})}}),o.forEach(function(t){delete t._}),{type:"MultiPolygon",arcs:i.map(function(e){var n,o=[];if(e.forEach(function(t){t.forEach(function(t){t.forEach(function(t){a[0>t?~t:t].length<2&&o.push(t)})})}),o=c(t,o),(n=o.length)>1)for(var i,l=r(e[0][0]),s=0;n>s;++s)if(l===r(o[s])){i=o[0],o[0]=o[s],o[s]=i;break}return o})}}function v(t){function e(t,e){t.forEach(function(t){0>t&&(t=~t);var n=a[t];n?n.push(e):a[t]=[e]})}function n(t,n){t.forEach(function(t){e(t,n)})}function r(t,e){"GeometryCollection"===t.type?t.geometries.forEach(function(t){r(t,e)}):t.type in l&&l[t.type](t.arcs,e)}var a={},i=t.map(function(){return[]}),l={LineString:e,MultiLineString:n,Polygon:n,MultiPolygon:function(t,e){t.forEach(function(t){n(t,e)})}};t.forEach(r);for(var s in a)for(var c=a[s],u=c.length,f=0;u>f;++f)for(var d=f+1;u>d;++d){var h,p=c[f],g=c[d];(h=i[p])[s=o(h,g)]!==g&&h.splice(s,0,g),(h=i[g])[s=o(h,p)]!==p&&h.splice(s,0,p)}return i}function m(t,e){return t[1][2]-e[1][2]}function y(){function t(t,e){for(;e>0;){var n=(e+1>>1)-1,a=r[n];if(m(t,a)>=0)break;r[a._=e]=a,r[t._=e=n]=t}}function e(t,e){for(;;){var n=e+1<<1,o=n-1,i=e,l=r[i];if(a>o&&m(r[o],l)<0&&(l=r[i=o]),a>n&&m(r[n],l)<0&&(l=r[i=n]),i===e)break;r[l._=e]=l,r[t._=e=i]=t}}var n={},r=[],a=0;return n.push=function(e){return t(r[e._=a]=e,a++),a},n.pop=function(){if(!(0>=a)){var t,n=r[0];return--a>0&&(t=r[a],e(r[t._=0]=t,0)),n}},n.remove=function(n){var o,i=n._;if(r[i]===n)return i!==--a&&(o=r[a],(m(o,n)<0?t:e)(r[o._=i]=o,i)),i},n}function x(t,e){function a(t){l.remove(t),t[1][2]=e(t),l.push(t)}var o=n(t.transform),i=r(t.transform),l=y();return e||(e=d),t.arcs.forEach(function(t){var n,r,s,c,u=[],f=0;for(r=0,s=t.length;s>r;++r)c=t[r],o(t[r]=[c[0],c[1],1/0],r);for(r=1,s=t.length-1;s>r;++r)n=t.slice(r-1,r+2),n[1][2]=e(n),u.push(n),l.push(n);for(r=0,s=u.length;s>r;++r)n=u[r],n.previous=u[r-1],n.next=u[r+1];for(;n=l.pop();){var d=n.previous,h=n.next;n[1][2]d;d++){var h=s[d],p={_fullLayout:e},g=u.coerceRef(t,r,p,h),m=u.coerceARef(t,r,p,h),y=.5;if("paper"!==g){var x=u.getFromId(p,g);if(y=x.range[0]+y*(x.range[1]-x.range[0]),-1!==["date","category"].indexOf(x.type)&&"string"==typeof t[h]){var b;if("date"===x.type){if(b=c.dateTime2ms(t[h]),b!==!1&&(t[h]=b),m===g){var _=c.dateTime2ms(t["a"+h]);_!==!1&&(t["a"+h]=_)}}else(x._categories||[]).length&&(b=x._categories.indexOf(t[h]),-1!==b&&(t[h]=b))}}n(h,y),l||n(h+"anchor")}return c.noneOrAll(t,r,["x","y"]),r}function a(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=u.getFromId(t,e.xref),r=u.getFromId(t,e.yref);if(n||r){var a=(e._xsize||0)/2,o=e._xshift||0,i=(e._ysize||0)/2,l=e._yshift||0,s=a-o,c=a+o,f=i-l,d=i+l;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;s=Math.max(s,h),c=Math.max(c,h),f=Math.max(f,h),d=Math.max(d,h)}n&&n.autorange&&u.expand(n,[n.l2c(e.x)],{ppadplus:c,ppadminus:s}),r&&r.autorange&&u.expand(r,[r.l2c(e.y)],{ppadplus:d,ppadminus:f})}})}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,v=(c*f-s*d)/p;return 0>v||v>1||0>g||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../lib"),u=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),h=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),g=t("../dragelement"),v=e.exports={};v.ARROWPATHS=t("./arrow_paths"),v.layoutAttributes=t("./attributes"),v.supplyLayoutDefaults=function(t,e){for(var n=t.annotations||[],a=e.annotations=[],o=0;ot?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var r=X.select(".annotation-math-group"),a=!r.empty(),l=d.bBox((a?r:tt).node()),h=l.width,m=l.height,y=Math.round(h+2*W),x=Math.round(m+2*W);B._w=h,B._h=m;var b=!1;if(["x","y"].forEach(function(e){var r,a=B[e+"ref"]||e,o=u.getFromId(t,a),i=(G+("x"===e?0:90))*Math.PI/180,l=y*Math.abs(Math.cos(i))+x*Math.abs(Math.sin(i)),s=B[e+"anchor"];if(o){if(!o.autorange&&(B[e]-o.range[0])*(B[e]-o.range[1])>0&&(B["a"+e+"ref"]===a?(B["a"+e]-o.range[0])*(B["a"+e]-o.range[1])>0&&(b=!0):b=!0,b))return;U[e]=o._offset+o.l2p(B[e]),r=.5}else r=B[e],"y"===e&&(r=1-r),U[e]="x"===e?S.l+S.w*r:S.t+S.h*r;var c=0;B["a"+e+"ref"]===a?U["aa"+e]=o._offset+o.l2p(B["a"+e]):(c=B.showarrow?B["a"+e]:l*n(r,s),U[e]+=c),B["_"+e+"type"]=o&&o.type,B["_"+e+"size"]=l,B["_"+e+"shift"]=c}),b)return void X.remove();var w,k;B.showarrow&&(w=B.axref===B.xref?U.x:c.constrain(U.x-B.ax,1,_.width-1),k=B.ayref===B.yref?U.y:c.constrain(U.y-B.ay,1,_.height-1)),U.x=c.constrain(U.x,1,_.width-1),U.y=c.constrain(U.y,1,_.height-1);var M=W-l.top,A=W-l.left;a?r.select("svg").attr({x:W-1,y:W}):(tt.attr({x:A,y:M}),tt.selectAll("tspan.line").attr({y:M,x:A})),J.call(d.setRect,Q/2,Q/2,y-Q,x-Q);var T=0,L=0;T=B.axref===B.xref?Math.round(U.aax-y/2):Math.round(U.x-y/2),L=B.ayref===B.yref?Math.round(U.aay-x/2):Math.round(U.y-x/2),X.call(c.setTranslate,T,L);var z="annotations["+e+"]",C=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=B.axref===B.xref?U.aax+n:U.x+n,l=B.ayref===B.yref?U.aay+r:U.y+r;var u=c.rotationXYMatrix(G,a,l),d=c.apply2DTransform(u),h=c.apply2DTransform2(u),p=J.attr("width")/2,m=J.attr("height")/2,y=[[a-p,l-m,a-p,l+m],[a-p,l+m,a+p,l+m],[a+p,l+m,a+p,l-m],[a+p,l-m,a-p,l-m]].map(h);if(!y.reduce(function(t,e){return t^!!o(w,k,w+1e6,k+1e6,e[0],e[1],e[2],e[3])},!1)){y.forEach(function(t){var e=o(a,l,w,k,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var x=B.arrowwidth,b=B.arrowcolor,_=Z.append("g").style({opacity:f.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=_.append("path").attr("d","M"+a+","+l+"L"+w+","+k).style("stroke-width",x+"px").call(f.stroke,f.rgb(b));v.arrowhead(M,B.arrowhead,"end",B.arrowsize);var A=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-w)+","+(l-k),transform:"translate("+w+","+k+")"}).style("stroke-width",x+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,C;g.init({element:A.node(),prepFn:function(){var t=c.getTranslate(X);L=t.x,C=t.y,T={},H&&H.autorange&&(T[H._name+".autorange"]=!0),V&&V.autorange&&(T[V._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var n=d(L,C),r=n[0]+t,a=n[1]+e;X.call(c.setTranslate,r,a),T[z+".x"]=H?B.x+t/H._m:(w+t-S.l)/S.w,T[z+".y"]=V?B.y+e/V._m:1-(k+e-S.t)/S.h,B.axref===B.xref&&(T[z+".ax"]=H?B.ax+t/H._m:(w+t-S.l)/S.w),B.ayref===B.yref&&(T[z+".ay"]=V?B.ay+e/V._m:1-(k+e-S.t)/S.h),Y.attr({transform:"rotate("+G+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};B.showarrow&&C(0,0);var E=c.rotationXYMatrix(G,U.x,U.y),O=c.apply2DTransform(E);if(t._context.editable){var N,P,j;g.init({element:X.node(),prepFn:function(){var t=c.getTranslate(X);N=t.x,P=t.y,j={}},moveFn:function(t,e){X.call(c.setTranslate,N+t,P+e);var n="pointer";if(B.showarrow)B.axref===B.xref?j[z+".ax"]=H.p2l(H.l2p(B.ax)+t):j[z+".ax"]=B.ax+t,B.ayref===B.yref?j[z+".ay"]=V.p2l(V.l2p(B.ay)+e):j[z+".ay"]=B.ay+e,C(t,e);else{if(H)j[z+".x"]=B.x+t/H._m;else{var r=B._xsize/S.w,a=B.x+B._xshift/S.w-r/2;j[z+".x"]=g.align(a+t/S.w,r,0,1,B.xanchor)}if(V)j[z+".y"]=B.y+e/V._m;else{var o=B._ysize/S.h,i=B.y-B._yshift/S.h-o/2;j[z+".y"]=g.align(i-e/S.h,o,0,1,B.yanchor)}H&&V||(n=g.getCursor(H?.5:j[z+".x"],V?.5:j[z+".y"],B.xanchor,B.yanchor))}var l=O(N,P),s=l[0]+t,u=l[1]+e;X.call(c.setTranslate,N+t,P+e),Y.attr({transform:"rotate("+G+","+s+","+u+")"}),p(X,n)},doneFn:function(e){if(p(X),e){s.relayout(t,j);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var x,b=t.layout,_=t._fullLayout;if(!l(e)||-1===e){if(!e&&Array.isArray(a))return b.annotations=a,v.supplyLayoutDefaults(b,_),void v.drawAll(t);if("remove"===a)return delete b.annotations,_.annotations=[],void v.drawAll(t);if(n&&"add"!==a){for(x=0;x<_.annotations.length;x++)v.draw(t,x,n,a);return}e=_.annotations.length,_.annotations.push({})}if(!n&&a){if("remove"===a){for(_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),_.annotations.splice(e,1),b.annotations.splice(e,1),x=e;x<_.annotations.length;x++)_._infolayer.selectAll('.annotation[data-index="'+(x+1)+'"]').attr("data-index",String(x)),v.draw(t,x);return}if("add"===a||c.isPlainObject(a)){_.annotations.splice(e,0,{});var w=c.isPlainObject(a)?c.extendFlat({},a):{text:"New text"};for(b.annotations?b.annotations.splice(e,0,w):b.annotations=[w],x=_.annotations.length-1;x>e;x--)_._infolayer.selectAll('.annotation[data-index="'+(x-1)+'"]').attr("data-index",String(x)),v.draw(t,x)}}_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var k=b.annotations[e],M=_.annotations[e];if(k){var A={xref:k.xref,yref:k.yref},T={};"string"==typeof n&&n?T[n]=a:c.isPlainObject(n)&&(T=n);var L=Object.keys(T);for(x=0;xx;x++){var E=C[x];if(void 0===T[E]&&void 0!==k[E]){var O=u.getFromId(t,u.coerceRef(A,{},t,E)),N=u.getFromId(t,u.coerceRef(k,{},t,E)),P=k[E],j=M["_"+E+"type"];if(void 0!==T[E+"ref"]){var D="auto"===k[E+"anchor"],R="x"===E?S.w:S.h,I=(M["_"+E+"size"]||0)/(2*R);if(O&&N)P=(P-O.range[0])/(O.range[1]-O.range[0]),P=N.range[0]+P*(N.range[1]-N.range[0]);else if(O){if(P=(P-O.range[0])/(O.range[1]-O.range[0]),P=O.domain[0]+P*(O.domain[1]-O.domain[0]),D){var q=P+I,F=P-I;2/3>P+F?P=F:P+q>4/3&&(P=q)}}else N&&(D&&(1/3>P?P+=I:P>2/3&&(P-=I)),P=(P-N.domain[0])/(N.domain[1]-N.domain[0]),P=N.range[0]+P*(N.range[1]-N.range[0]))}N&&N===O&&j&&("log"===j&&"log"!==N.type?P=Math.pow(10,P):"log"!==j&&"log"===N.type&&(P=P>0?Math.log(P)/Math.LN10:void 0)),k[E]=P}}var B=r(k,_);_.annotations[e]=B;var H=u.getFromId(t,B.xref),V=u.getFromId(t,B.yref),U={x:0,y:0},G=+B.textangle||0,Z=_._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",B.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:k,fullAnnotation:B})}),Y=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),X=Y.append("g"),Q=B.borderwidth,$=B.borderpad,W=Q+$,J=X.append("rect").attr("class","bg").style("stroke-width",Q+"px").call(f.stroke,B.bordercolor).call(f.fill,B.bgcolor),K=B.font,tt=X.append("text").classed("annotation",!0).attr("data-unformatted",B.text).text(B.text);t._context.editable?tt.call(h.makeEditable,X).call(m).on("edit",function(n){B.text=n,this.attr({"data-unformatted":B.text}),this.call(m);var r={};r["annotations["+e+"].text"]=B.text,H&&H.autorange&&(r[H._name+".autorange"]=!0),V&&V.autorange&&(r[V._name+".autorange"]=!0),s.relayout(t,r)}):tt.call(m),Y.attr({transform:"rotate("+G+","+U.x+","+U.y+")"}).call(d.setPosition,U.x,U.y)}},v.arrowhead=function(t,e,n,r){l(r)||(r=1);var a=t.node(),o=v.ARROWPATHS[e||0];if(o){"string"==typeof n&&n||(n="end");var s,c,u,h,p=(d.getPx(t,"stroke-width")||1)*r,g=t.style("stroke")||f.defaultLine,m=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=o.backoff*p;if("line"===a.nodeName){if(s={x:+t.attr("x1"),y:+t.attr("y1")},c={x:+t.attr("x2"),y:+t.attr("y2")},u=Math.atan2(s.y-c.y,s.x-c.x),h=u+Math.PI,b){var _=b*Math.cos(u),w=b*Math.sin(u);y&&(s.x-=_,s.y-=w,t.attr({x1:s.x,y1:s.y})),x&&(c.x+=_,c.y+=w,t.attr({x2:c.x,y2:c.y}))}}else if("path"===a.nodeName){var k=a.getTotalLength(),M="";if(y){var A=a.getPointAtLength(0),T=a.getPointAtLength(.1);u=Math.atan2(A.y-T.y,A.x-T.x),s=a.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=a.getPointAtLength(k),z=a.getPointAtLength(k-.1);if(h=Math.atan2(L.y-z.y,L.x-z.x),c=a.getPointAtLength(Math.max(0,k-b)),b){var S=M?2*b:b;M+=k-S+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var C=function(n,r){e>5&&(r=0),i.select(a.parentElement).append("path").attr({"class":t.attr("class"),d:o.path,transform:"translate("+n.x+","+n.y+")rotate("+180*r/Math.PI+")scale("+p+")"}).style({fill:g,opacity:m,"stroke-width":0})};y&&C(s,u),x&&C(c,h)}},v.calcAutorange=function(t){var e=t._fullLayout,n=e.annotations;if(n.length&&t._fullData.length){var r={};n.forEach(function(t){r[t.xref]=!0,r[t.yref]=!0});var o=u.list(t).filter(function(t){return t.autorange&&r[t._id]});if(o.length)return c.syncOrAsync([v.drawAll,a],t)}}},{"../../lib":100,"../../lib/setcursor":109,"../../lib/svg_text_utils":111,"../../plotly":119,"../../plots/cartesian/axes":122,"../color":20,"../dragelement":41,"../drawing":43,"./arrow_paths":16,"./attributes":17,d3:10,"fast-isnumeric":12}],19:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],20:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;es&&(o[1]-=(it-s)/2)):n.node()&&!n.classed("js-placeholder")&&(it=d.bBox(e.node()).height),it){if(it+=5,"top"===b.titleside)J.domain[1]-=it/A.h,o[1]*=-1;else{J.domain[0]+=it/A.h;var u=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-u)*s}e.attr("transform","translate("+o+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(A.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?L[0]:(S[e]+S[e-1])/2,e===S.length-1?L[1]:(S[e]+S[e+1])/2].map(J.c2p).map(Math.round);e!==S.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=E(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:Z,width:Math.max(q,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var h=at.select(".cblines").selectAll("path.cbline").data(b.line.color&&b.line.width?z:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){r.select(this).attr("d","M"+Z+","+(Math.round(J.c2p(t))+b.line.width/2%1)+"h"+q).call(d.lineGroupStyle,b.line.width,C(t),b.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Z+q+(b.outlinewidth||0)/2-("outside"===b.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(-1===["top","bottom"].indexOf(b.titleside)){var e=J.titlefont.size,n=J._offset+J._length/2,a=A.l+(J.position||0)*A.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));w("h"+J._id+"title",{avoid:{selection:r.select(t).selectAll("g."+J._id+"tick"),side:b.titleside,offsetLeft:A.l,offsetTop:A.t,maxShift:M.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,n){var r,a=x();r=i.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:J,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},l="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+l+",."+l+"-math-group").remove(),p.draw(t,e,u(o,n||{}))}function k(){var n=q+b.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(D=ot.select("text"),D.node()&&!D.classed("js-placeholder")){var r,a=ot.select(".h"+J._id+"title-math-group").node();r=a&&-1!==["top","bottom"].indexOf(b.titleside)?d.bBox(a).width:d.bBox(ot.node()).right-Z-A.l,n=Math.max(n,r)}var o=2*b.xpad+n+b.borderwidth+b.outlinewidth/2,l=Q-$;at.select(".cbbg").attr({ x:Z-b.xpad-(b.borderwidth+b.outlinewidth)/2,y:$-U,width:Math.max(o,2),height:Math.max(l+2*U,2)}).call(h.fill,b.bgcolor).call(h.stroke,b.bordercolor).style({"stroke-width":b.borderwidth}),at.selectAll(".cboutline").attr({x:Z,y:$+b.ypad+("top"===b.titleside?it:0),width:Math.max(q,2),height:Math.max(l-2*b.ypad-it,2)}).call(h.stroke,b.outlinecolor).style({fill:"None","stroke-width":b.outlinewidth});var s=({center:.5,right:1}[b.xanchor]||0)*o;at.attr("transform","translate("+(A.l-s)+","+A.t+")"),i.autoMargin(t,e,{x:b.x,y:b.y,l:o*({right:1,center:.5}[b.xanchor]||0),r:o*({left:1,center:.5}[b.xanchor]||0),t:l*({bottom:1,middle:.5}[b.yanchor]||0),b:l*({top:1,middle:.5}[b.yanchor]||0)})}var M=t._fullLayout,A=M._size;if("function"!=typeof b.fillcolor&&"function"!=typeof b.line.color)return void M._infolayer.selectAll("g."+e).remove();var T,L=r.extent(("function"==typeof b.fillcolor?b.fillcolor:b.line.color).domain()),z=[],S=[],C="function"==typeof b.line.color?b.line.color:function(){return b.line.color},E="function"==typeof b.fillcolor?b.fillcolor:function(){return b.fillcolor},O=b.levels.end+b.levels.size/100,N=b.levels.size,P=1.001*L[0]-.001*L[1],j=1.001*L[1]-.001*L[0];for(T=b.levels.start;0>(T-O)*N;T+=N)T>P&&j>T&&z.push(T);if("function"==typeof b.fillcolor)if(b.filllevels)for(O=b.filllevels.end+b.filllevels.size/100,N=b.filllevels.size,T=b.filllevels.start;0>(T-O)*N;T+=N)T>L[0]&&T1){var rt=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));tt*=rt*c.roundUp(nt/rt,[2,5,10]),(Math.abs(b.levels.start)/b.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=tt}J.domain=[X+G,X+H-G],J.setScale();var at=M._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(A.l)+","+Math.round(A.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(A.l)+",-"+Math.round(A.t)+")");J._axislayer=at.select(".cbaxis");var it=0;if(-1!==["top","bottom"].indexOf(b.titleside)){var lt,st=A.l+(b.x+V)*A.w,ct=J.titlefont.size;lt="top"===b.titleside?(1-(X+H-G))*A.h+A.t+3+.75*ct:(1-(X+G))*A.h+A.t-3-.25*ct,w(J._id+"title",{attributes:{x:st,y:lt,"text-anchor":"start"}})}var ut=c.syncOrAsync([i.previousPromises,_,i.previousPromises,k],t);if(ut&&ut.then&&(t._promises||[]).push(ut),t._context.editable){var ft,dt,ht;s.init({element:at.node(),prepFn:function(){ft=at.attr("transform"),f(at)},moveFn:function(t,e){at.attr("transform",ft+" translate("+t+","+e+")"),dt=s.align(Y+t/A.w,F,0,1,b.xanchor),ht=s.align(X-e/A.h,H,0,1,b.yanchor);var n=s.getCursor(dt,ht,b.xanchor,b.yanchor);f(at,n)},doneFn:function(e){f(at),e&&void 0!==dt&&void 0!==ht&&o.restyle(t,{"colorbar.x":dt,"colorbar.y":ht},x().index)}})}return ut}function x(){var n,r,a=e.substr(2);for(n=0;nu*f?a.RdBu:u>=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":100,"./flip_scale":31,"./scales":38}],28:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":97,"./attributes":26,"./scales.js":38}],29:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":38}],30:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,v=p[d+"min"],m=p[d+"max"],y=p.colorscale,x=r(v)&&r(m)&&m>v;c(f+d+"auto",!x),c(f+d+"min"),c(f+d+"max");var b;void 0!==y&&(b=!l(y)),c(f+"autocolorscale",b);var _=c(f+"colorscale"),w=c(f+"reversescale");if(w&&(g.colorscale=s(_)),"marker.line."!==f){var k;f&&(k=o(p));var M=c(f+"showscale",k);M&&i(p,g,n)}}},{"../../lib":100,"../colorbar/defaults":22,"../colorbar/has_colorbar":24,"./flip_scale":31,"./is_valid_scale":35,"fast-isnumeric":12}],31:[function(t,e,n){"use strict";e.exports=function(t){for(var e,n=t.length,r=new Array(n),a=n-1,o=0;a>=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],32:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":29,"./is_valid_scale_array":36,"./scales":38}],33:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;sd;d++)s=t[d],u[d]=e+s[0]*(n-e),f[d]=a(s[1]).toRgb();var h=r.scale.linear().domain(u).interpolate(r.interpolateObject).range(f);return function(t){if(o(t)){var r=i.constrain(t,e,n),s=h(r);return a(s).toRgbString()}return a(t).isValid()?t:l.defaultLine}}},{"../../lib":100,"../color":20,d3:10,"fast-isnumeric":12,tinycolor2:14}],38:[function(t,e,n){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],39:[function(t,e,n){"use strict";e.exports=function(t,e,n,r,a){var o=(t-n)/(r-n),i=o+e/(r-n),l=(o+i)/2;return"left"===a||"bottom"===a?o:"center"===a||"middle"===a?l:"right"===a||"top"===a?i:2/3-l>o?o:i>4/3-l?i:l}},{}],40:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":100}],41:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},v=1,m=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":100,"../../plotly":119,"../../plots/cartesian/constants":127,"./align":39,"./cursor":40,"./unhover":42}],42:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":96}],43:[function(t,e,n){"use strict";function r(t,e,n,r){var o=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(o*o+i*i,b/2),u=Math.pow(l*l+s*s,b/2),f=(u*u*o-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[a.round(e[0]+(h&&f/h),2),a.round(e[1]+(h&&d/h),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&d/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../plots/plots"),l=t("../color"),s=t("../colorscale"),c=t("../../lib"),u=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),h=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(l.fill,r)},p.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},p.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},p.setRect=function(t,e,n,r,a){t.call(p.setPosition,e,n).call(p.setSize,r,a)},p.translatePoints=function(t,e,n){t.each(function(t){var r=t.xp||e.c2p(t.x),i=t.yp||n.c2p(t.y),l=a.select(this);o(r)&&o(i)?"text"===this.nodeName?l.attr("x",r).attr("y",i):l.attr("transform","translate("+r+","+i+")"):l.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):n||0},p.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},i=e||o.width||0,s=r||o.dash||"";a.select(this).call(l.stroke,n||o.color).call(p.dashLine,s,i)})},p.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(l.fill,e[0].trace.fillcolor)}catch(r){c.error(r,t),n.remove()}})};var g=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=p.symbolNames.length,m="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=n.line;if(i.traceIs(e,"symbols")){var o=h(e);t.attr("d",function(t){var r;r="various"===t.ms||"various"===n.size?3:d.isBubble(e)?o(t.ms):(n.size||6)/2,t.mrc=r;var a=p.symbolNumber(t.mx||n.symbol)||0,i=a%100;return t.om=a%200>=100,p.symbolFuncs[i](r)+(a>=200?m:"")}).style("opacity",function(t){return(t.mo+1||n.opacity+1)-1})}var s=(e._input||{}).marker||{},c=p.tryColorscale(n,s,""),u=p.tryColorscale(n,s,"line.");t.each(function(t){var e,o,i;t.so?(i=r.outlierwidth,o=r.outliercolor,e=n.outliercolor):(i=(t.mlw+1||r.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(r.color)?l.defaultLine:r.color,e="mc"in t?t.mcc=c(t.mc):Array.isArray(n.color)?l.defaultLine:n.color||"rgba(0,0,0,0)");var s=a.select(this);t.om?s.call(l.stroke,e).style({"stroke-width":(i||1)+"px",fill:"none"}):(s.style("stroke-width",i+"px").call(l.fill,e),i&&s.call(l.stroke,o))})}},p.tryColorscale=function(t,e,n){var r=c.nestedProperty(t,n+"color").get(),a=c.nestedProperty(t,n+"colorscale").get(),i=c.nestedProperty(t,n+"cauto").get(),l=c.nestedProperty(t,n+"cmin"),u=c.nestedProperty(t,n+"cmax"),f=l.get(),d=u.get();return a&&Array.isArray(r)?(!i&&o(f)&&o(d)||(f=1/0,d=-(1/0),r.forEach(function(t){o(t)&&(f>t&&(f=+t),t>d&&(d=+t))}),f>d&&(f=0,d=1),l.set(f),u.set(d),c.nestedProperty(e,n+"cmin").set(f),c.nestedProperty(e,n+"cmax").set(d)),s.makeScaleFunction(a,f,d)):c.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;p.textPointStyle=function(t,e){t.each(function(t){var n=a.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var i=t.tp||e.textposition,l=-1!==i.indexOf("top")?"top":-1!==i.indexOf("bottom")?"bottom":"middle",s=-1!==i.indexOf("left")?"end":-1!==i.indexOf("right")?"start":"middle",c=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;c=o(c)&&c>0?c:0,n.call(p.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(u.convertToTspans);var d=a.select(this.parentNode),h=n.selectAll("tspan.line"),g=((h[0].length||1)-1)*x+1,v=y[s]*f,m=.75*c+y[l]*f+(y[l]-1)*g*c/2;d.attr("transform","translate("+v+","+m+")"),g>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,a="M"+t[0],o=[];for(n=1;nn;n++)i.push(r(t[n-1],t[n],t[n+1],e));for(i.push(r(t[o-1],t[o],t[0],e)),n=1;o>=n;n++)a+="C"+i[n-1][1]+" "+i[n][0]+" "+t[n];return a+="C"+i[o][1]+" "+i[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+a.round(e[0],2)+"V"+a.round(e[1],2)},vh:function(t,e){return"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},hvh:function(t,e){return"H"+a.round((t[0]+e[0])/2,2)+"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},vhv:function(t,e){return"V"+a.round((t[1]+e[1])/2,2)+"H"+a.round(e[0],2)+"V"+a.round(e[1],2)}},w=function(t,e){return"L"+a.round(e[0],2)+","+a.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var n="M"+a.round(t[0][0],2)+","+a.round(t[0][1],2),r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(s),c.extendFlat({},s)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=a.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":90,"../../lib":100,"../../lib/svg_text_utils":111,"../../plots/plots":154,"../../traces/scatter/make_bubble_size_func":190,"../../traces/scatter/subtypes":195,"../color":20,"../colorscale":34,"./symbol_defs":44,d3:10,"fast-isnumeric":12}],44:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:10}],45:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],46:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&-1!==["linear","log"].indexOf(n.type),c=[];if(s){for(var u=l(o),f=0;fl;l++)i[l]={x:n[l],y:a[l]};return i[0].trace=t,r.calc({calcdata:[i],_fullLayout:e}),i},r.plot=t("./plot"),r.style=t("./style"),r.hoverInfo=function(t,e,n){(e.error_y||{}).visible&&(n.yerr=t.yh-t.y,e.error_y.symmetric||(n.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(n.xerr=t.xh-t.x,e.error_x.symmetric||(n.xerrneg=t.x-t.xs))}},{"./attributes":45,"./calc":46,"./defaults":48,"./plot":50,"./style":51}],50:[function(t,e,n){"use strict";function r(t,e,n){var r={x:e.c2p(t.x),y:n.c2p(t.y)};return void 0!==t.yh&&(r.yh=n.c2p(t.yh),r.ys=n.c2p(t.ys),o(r.ys)||(r.noYS=!0,r.ys=n.c2p(t.ys,!0))),void 0!==t.xh&&(r.xh=e.c2p(t.xh),r.xs=e.c2p(t.xs),o(r.xs)||(r.noXS=!0,r.xs=e.c2p(t.xs,!0))),r}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../lib"),l=t("../../traces/scatter/subtypes");e.exports=function(t,e){var n=e.x(),s=e.y();t.each(function(t){var e=t[0].trace,c=e.error_x||{},u=e.error_y||{},f=l.hasMarkers(e)&&e.marker.maxdisplayed>0;if(u.visible||c.visible){var d=a.select(this).selectAll("g.errorbar").data(i.identity);d.enter().append("g").classed("errorbar",!0),d.each(function(t){var e=a.select(this),i=r(t,n,s);if(!f||t.vis){var l;if(u.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var d=u.width;l="M"+(i.x-d)+","+i.yh+"h"+2*d+"m-"+d+",0V"+i.ys,i.noYS||(l+="m-"+d+",0h"+2*d),e.append("path").classed("yerror",!0).attr("d",l)}if(c.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var h=(c.copy_ystyle?u:c).width;l="M"+i.xh+","+(i.y-h)+"v"+2*h+"m0,-"+h+"H"+i.xs,i.noXS||(l+="m0,-"+h+"v"+2*h),e.append("path").classed("xerror",!0).attr("d",l)}}})}})}},{"../../lib":100,"../../traces/scatter/subtypes":195,d3:10,"fast-isnumeric":12}],51:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":20,d3:10}],52:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":127}],53:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var l=0;2>l;l++){var s={_fullLayout:n},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,a=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],57:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":97,"../../plots/font_attributes":140,"../color/attributes":19}],58:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],59:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/plots"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n){function l(t,e){return r.coerce(d,h,o,t,e)}for(var s,c,u,f,d=t.legend||{},h=e.legend={},p=0,g="normal",v=0;v1);if(y!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),r.coerceFont(l,"font",e.font),l("orientation"),"h"===h.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(s=0,u="left",c=1.1,f="bottom"):(s=0,u="left",c=-.1,f="top")}l("traceorder",g),i.isGrouped(e.legend)&&l("tracegroupgap"),l("x",s),l("xanchor",u),l("y",c),l("yanchor",f),r.noneOrAll(d,h,["x","y"])}}},{"../../lib":100,"../../plots/plots":154,"./attributes":57,"./helpers":62}],60:[function(t,e,n){"use strict";function r(t,e){function n(n){u.util.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=d.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,a.legend.font).text(c),e._context.editable&&!l?f.call(u.util.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" "),u.restyle(e,"name",t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(d.traceIs(l,"pie")){var f=o.label,h=n.indexOf(f);-1===h?n.push(f):n.splice(h,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),h=d[0].length||1;n=s*h,r=u.node()&&p.bBox(u.node()).width;var g=s*(.3+(1-h)/2);u.attr("y",g),d.attr("y",g)}n=Math.max(n,16)+3,o.attr({x:0,y:-n/2,height:n}),a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=x.isGrouped(a);if(x.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),n.selectAll(".legendtoggle").attr("width",(t._context.editable?0:a.width)+40),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height);else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;d>u;u++){var h=s[u].map(function(t){return t[0].width}),p=40+Math.max.apply(null,h);a.width+=a.tracegroupgap+p,l.push(a.width)}e.each(function(t,e){f.setTranslate(this,l[e],0)}),e.each(function(){var t=c.select(this),e=t.selectAll("g.traces"),n=0;e.each(function(t){var e=t[0],r=e.height;f.setTranslate(this,0,5+o+n+r/2),n+=r}),a.height=Math.max(a.height,n)}),a.height+=10+2*o,a.width+=2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}else{a.width=0,a.height=0;var g=0,v=0,m=0,y=0;n.each(function(t){m=Math.max(40+t[0].width,m)}),n.each(function(t){var e=t[0],n=m,i=a.tracegroupgap||5;o+y+i+n>r.width-(r.margin.r+r.margin.l)&&(y=0,g+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+y,5+o+e.height/2+g),a.width+=i+n,a.height=Math.max(a.height,e.height),y+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}}function l(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center");var a="top";b.isBottomAnchor(n)?a="bottom":b.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../dragelement"),p=t("../drawing"),g=t("../color"),v=t("./constants"),m=t("./get_legend_data"),y=t("./style"),x=t("./helpers"),b=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(p.setRect,I,t,v.scrollBarWidth,v.scrollBarHeight),M.select("rect").attr({y:x.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var x=n.legend,_=n.showlegend&&m(t.calcdata,x),w=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({"class":"legend","pointer-events":"all"});var M=n._topdefs.selectAll("#"+o).data([0]);M.enter().append("clipPath").attr("id",o).append("rect");var A=k.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(g.stroke,x.bordercolor),A.call(g.fill,x.bgcolor),A.style("stroke-width",x.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var z=T.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var C=0!==k.enter().size();C&&(i(t,z,S),l(t));var E=0,O=n.width,N=0,P=n.height;i(t,z,S),x.height>P?s(t):l(t);var j=n._size,D=j.l+j.w*x.x,R=j.t+j.h*(1-x.y);b.isRightAnchor(x)?D-=x.width:b.isCenterAnchor(x)&&(D-=x.width/2),b.isBottomAnchor(x)?R-=x.height:b.isMiddleAnchor(x)&&(R-=x.height/2);var I=x.width,q=j.w;I>q?(D=j.l,I=q):(D+I>O&&(D=O-I),E>D&&(D=E),I=Math.min(O-D,x.width));var F=x.height,B=j.h;F>B?(R=j.t,F=B):(R+F>P&&(R=P-F),N>R&&(R=N),F=Math.min(P-R,x.height)),f.setTranslate(k,D,R);var H,V,U=F-v.scrollBarHeight-2*v.scrollBarMargin,G=x.height-F;if(x.height<=F||t._context.staticPlot)A.attr({width:I-x.borderwidth,height:F-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),f.setTranslate(T,0,0),M.select("rect").attr({width:I-2*x.borderwidth,height:F-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth}),T.call(p.setClipUrl,o);else{H=v.scrollBarMargin,V=T.attr("data-scroll")||0,A.attr({width:I-2*x.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:F-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),M.select("rect").attr({width:I-2*x.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:F-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth-V}),T.call(p.setClipUrl,o),C&&e(H,V),k.on("wheel",null),k.on("wheel",function(){V=f.constrain(T.attr("data-scroll")-c.event.deltaY/U*G,-G,0),H=v.scrollBarMargin-V/G*U,e(H,V),c.event.preventDefault()}),L.on(".drag",null),T.on(".drag",null);var Z=c.behavior.drag().on("drag",function(){H=f.constrain(c.event.y-v.scrollBarHeight/2,v.scrollBarMargin,v.scrollBarMargin+U),V=-(H-v.scrollBarMargin)/U*G,e(H,V)});L.call(Z),T.call(Z)}if(t._context.editable){var Y,X,Q,$;k.classed("cursor-move",!0),h.init({element:k.node(),prepFn:function(){var t=f.getTranslate(k);Q=t.x,$=t.y},moveFn:function(t,e){var n=Q+t,r=$+e;f.setTranslate(k,n,r),Y=h.align(n,0,j.l,j.l+j.w,x.xanchor),X=h.align(r,0,j.t+j.h,j.t,x.yanchor)},doneFn:function(e){e&&void 0!==Y&&void 0!==X&&u.relayout(t,{"legend.x":Y,"legend.y":X})}})}}}},{"../../lib":100,"../../plotly":119,"../../plots/plots":154,"../color":20,"../dragelement":41,"../drawing":43,"./anchor_utils":56,"./constants":58,"./get_legend_data":61,"./helpers":62,"./style":64,d3:10}],61:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[n]]):l[t].push([n]);else{var r="~~i"+f;s.push(r),l[r]=[[n]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;oo;o++)m=l[s[o]],y[o]=a.isReversed(e)?m.reverse():m;else{for(y=[new Array(x)],o=0;x>o;o++)m=l[s[o]][0],y[0][a.isReversed(e)?x-o-1:o]=m;x=1}return e._lgroupsLength=x,y}},{"../../plots/plots":154,"./helpers":62}],62:[function(t,e,n){"use strict";var r=t("../../plots/plots");n.legendGetsTrace=function(t){return t.visible&&r.traceIs(t,"showLegend")},n.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},n.isVertical=function(t){return"h"!==t.orientation},n.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":154}],63:[function(t,e,n){"use strict";var r=e.exports={};r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw"),r.style=t("./style")},{"./attributes":57,"./defaults":59,"./draw":60,"./style":64}],64:[function(t,e,n){"use strict";function r(t){var e=t[0].trace,n=e.visible&&e.fill&&"none"!==e.fill,r=h.hasLines(e),a=s.select(this).select(".legendfill").selectAll("path").data(n?[t]:[]);a.enter().append("path").classed("js-fill",!0),a.exit().remove(),a.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var o=s.select(this).select(".legendlines").selectAll("path").data(r?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(f.lineGroupStyle)}function a(t){function e(t,e,n){var r=c.nestedProperty(i,t).get(),a=Array.isArray(r)&&e?e(r):r;if(n){if(an[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),u=h.hasText(i),d=h.hasLines(i);if(l||u||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(o,p)],a=c.minExtend(i,g)}var v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?r:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../lib"),u=t("../../plots/plots"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":100,"../../plots/plots":154,"../../traces/pie/style_one":174,"../../traces/scatter/subtypes":195,"../color":20,"../drawing":43,d3:10}],65:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,f=(1+u)/2,d=(1-u)/2,h=c.Axes.list(t,null,!0),p=0;py;y++){var x=l[y];d=m[x]={};for(var b=0;b1)return r(["resetViews","toggleHover"]),i(v,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||m||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(v,n)}function a(t){for(var e=s.Axes.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var v=u("bgcolor");u("activecolor",i.contrast(v,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":100,"../color":20,"./attributes":68,"./button_attributes":69,"./constants":70}],72:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;re){var n=e;e=t,t=n}l.setAttributes(w,{"data-min":t,"data-max":e}),l.setAttributes(N,{x:t,width:e-t}),l.setAttributes(A,{width:t}),l.setAttributes(T,{x:e,width:p-e}),l.setAttributes(L,{transform:"translate("+(t-v-1)+")"}),l.setAttributes(C,{transform:"translate("+e+")"})}var f=t._fullLayout,d=f._infolayer.selectAll("g.range-slider"),h=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*h.thickness,v=2,m=Math.floor(h.borderwidth/2),y=f.margin.l,x=f.height-g-f.margin.b,b=0,_=p,w=document.createElementNS(i,"g");l.setAttributes(w,{"class":"range-slider","data-min":b,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+x+")"});var k=document.createElementNS(i,"rect"),M=h.borderwidth%2===0?h.borderwidth:h.borderwidth-1;l.setAttributes(k,{fill:h.bgcolor,stroke:h.bordercolor,"stroke-width":h.borderwidth,height:g+M,width:p+M,transform:"translate(-"+m+", -"+m+")","shape-rendering":"crispEdges"});var A=document.createElementNS(i,"rect");l.setAttributes(A,{x:0,width:b,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(i,"rect");l.setAttributes(T,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var L=document.createElementNS(i,"g"),z=document.createElementNS(i,"rect"),S=document.createElementNS(i,"rect");l.setAttributes(L,{transform:"translate("+(b-v-1)+")"}),l.setAttributes(z,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),l.setAttributes(S,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(L,[S,z]);var C=document.createElementNS(i,"g"),E=document.createElementNS(i,"rect"),O=document.createElementNS(i,"rect");l.setAttributes(C,{transform:"translate("+_+")"}),l.setAttributes(E,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),l.setAttributes(O,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(C,[O,E]);var N=document.createElementNS(i,"rect");l.setAttributes(N,{x:b,width:_-b,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function n(t){var n,r,f=+t.clientX-o;switch(a){case N:w.style.cursor="ew-resize",n=+l+f,r=+s+f,u(n,r),c(e(n),e(r));break;case z:w.style.cursor="col-resize",n=+l+f,r=+s,u(n,r),c(e(n),e(r));break;case E:w.style.cursor="col-resize",n=+l,r=+s+f,u(n,r),c(e(n),e(r));break;default:w.style.cursor="ew-resize",n=i,r=i+f,u(n,r),c(e(n),e(r))}}function r(){window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r),w.style.cursor="auto"}var a=t.target,o=t.clientX,i=o-w.getBoundingClientRect().left,l=w.getAttribute("data-min"),s=w.getAttribute("data-max");window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)}),h.range||(h.range=a.getAutoRange(f.xaxis));var P=s(t,p,g);l.appendChildren(w,[k,P,A,T,N,L,C]),n(f.xaxis.range[0],f.xaxis.range[1]),d.data([0]).enter().append(function(){return h.setRange=n,w})}},{"../../constants/xmlns_namespaces":90,"../../lib":100,"../../plotly":119,"../../plots/cartesian/axes":122,"./helpers":78,"./range_plot":80}],77:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(t,e){return r.coerce(l,s,a,t,e)}if(t[n].rangeslider){var l=r.isPlainObject(t[n].rangeslider)?t[n].rangeslider:{},s=e[n].rangeslider={};if(i("bgcolor"),i("bordercolor"),i("borderwidth"),i("thickness"),i("visible"),i("range"),s.range&&!e[n].autorange){var c=s.range,u=e[n].range;c[0]=Math.min(c[0],u[0]),c[1]=Math.max(c[1],u[1])}else e[n]._needsExpand=!0;s.visible&&o.forEach(function(t){var n=e[t]||{};n.fixedrange=!0,e[t]=n})}}},{"../../lib":100,"./attributes":75}],78:[function(t,e,n){"use strict";n.setAttributes=function(t,e){for(var n in e)t.setAttribute(n,e[n])},n.appendChildren=function(t,e){for(var n=0;ns;s++){var c=l[s],u={_fullLayout:e},f=A.coerceRef(t,r,u,c);if("path"!==i){var d=.25,h=.75;if("paper"!==f){var p=A.getFromId(u,f),g=o(p);d=g(p.range[0]+d*(p.range[1]-p.range[0])),h=g(p.range[0]+h*(p.range[1]-p.range[0]))}n(c+"0",d),n(c+"1",h)}}return"path"===i?n("path"):M.noneOrAll(t,r,["x0","x1","y0","y1"]),r}function a(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function i(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function l(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function s(t,e,n){for(var r=0;re;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),C.draw(t,a)}function f(t,e,n,i){function l(n){var r={"data-index":e,"fill-rule":"evenodd",d:x(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",C.opacity).call(T.stroke,a).call(T.fill,C.fillcolor).call(L.dashLine,C.line.dash,C.line.width);E&&o.call(L.setClipUrl,"clip"+t._fullLayout._uid+E),t._context.editable&&d(t,o,C,e)}var s,c;h(t,e).selectAll('[data-index="'+e+'"]').remove();var u=t.layout.shapes[e];if(u){var f={xref:u.xref,yref:u.yref},g={};"string"==typeof n&&n?g[n]=i:M.isPlainObject(n)&&(g=n);var v=Object.keys(g);for(s=0;ss;s++){var b=y[s];if(void 0===g[b]&&void 0!==u[b]){var _,w=b.charAt(0),k=A.getFromId(t,A.coerceRef(f,{},t,w)),z=A.getFromId(t,A.coerceRef(u,{},t,w)),S=u[b];void 0!==g[w+"ref"]&&(k?(_=a(k)(S),S=(_-k.range[0])/(k.range[1]-k.range[0])):S=(S-z.domain[0])/(z.domain[1]-z.domain[0]),z?(_=z.range[0]+S*(z.range[1]-z.range[0]),S=o(z)(_)):S=k.domain[0]+S*(k.domain[1]-k.domain[0])),u[b]=S}}var C=r(u,t._fullLayout);t._fullLayout.shapes[e]=C;var E;if("below"!==C.layer)E=(C.xref+C.yref).replace(/paper/g,""),l(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)E="",l(t._fullLayout._shapeLowerLayer);else{var O,N=t._fullLayout._plots||{},P=Object.keys(N);for(s=0,c=P.length;c>s;s++)O=N[P[s]],E=P[s],p(t,C,O)&&l(O.shapelayer)}}}function d(t,e,n,r){function a(t){var n=W.right-W.left,r=W.bottom-W.top,a=t.clientX-W.left,o=t.clientY-W.top,i=n>X&&r>Q&&!t.shiftKey?z.getCursor(a/n,1-o/r):"move";S(e,i),Y=i.split("-")[0]}function o(e){B=A.getFromId(t,n.xref),H=A.getFromId(t,n.yref),V=m(t,B),U=m(t,H,!0),G=y(t,B),Z=y(t,H,!0);var o="shapes["+r+"]";"path"===n.type?(q=n.path,F=o+".path"):(u=V(n.x0),f=U(n.y0),d=V(n.x1),h=U(n.y1),p=o+".x0",g=o+".y0",_=o+".x1",w=o+".y1"),d>u?(L=u,N=o+".x0",R="x0",C=d,P=o+".x1",I="x1"):(L=d,N=o+".x1",R="x1",C=u,P=o+".x0",I="x0"),h>f?(M=f,E=o+".y0",j="y0",T=h,O=o+".y1",D="y1"):(M=h,E=o+".y1",j="y1",T=f,O=o+".y0",D="y0"),c={},a(e),$.moveFn="move"===Y?l:s}function i(n){S(e),n&&k.relayout(t,c)}function l(r,a){if("path"===n.type){var o=function(t){return G(V(t)+r)};B&&"date"===B.type&&(o=v(o));var i=function(t){return Z(U(t)+a)};H&&"date"===H.type&&(i=v(i)),n.path=b(q,o,i),c[F]=n.path}else c[p]=n.x0=G(u+r),c[g]=n.y0=Z(f+a),c[_]=n.x1=G(d+r),c[w]=n.y1=Z(h+a);e.attr("d",x(t,n))}function s(r,a){if("path"===n.type){var o=function(t){return G(V(t)+r)};B&&"date"===B.type&&(o=v(o));var i=function(t){return Z(U(t)+a)};H&&"date"===H.type&&(i=v(i)),n.path=b(q,o,i),c[F]=n.path}else{var l=~Y.indexOf("n")?M+a:M,s=~Y.indexOf("s")?T+a:T,u=~Y.indexOf("w")?L+r:L,f=~Y.indexOf("e")?C+r:C;s-l>Q&&(c[E]=n[j]=Z(l),c[O]=n[D]=Z(s)),f-u>X&&(c[N]=n[R]=G(u),c[P]=n[I]=G(f))}e.attr("d",x(t,n))}var c,u,f,d,h,p,g,_,w,M,T,L,C,E,O,N,P,j,D,R,I,q,F,B,H,V,U,G,Z,Y,X=10,Q=10,$={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=$.element.getBoundingClientRect();z.init($)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):M.log("getShapeLayer: undefined shape: index",e),r}function p(t,e,n){var r=k.Axes.getFromId(t,n.id,"x")._id,a=k.Axes.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function v(t){return function(e){return t(e).replace(" ","_")}}function m(t,e,n){var r,o=t._fullLayout._size;if(e){var i=a(e);r=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(r=g(r))}else r=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return r}function y(t,e,n){var r,a=t._fullLayout._size;if(e){var i=o(e);r=function(t){return i(e.p2l(t-e._offset))}}else r=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return r}function x(t,e){var n,r,o,i,l=e.type,s=A.getFromId(t,e.xref),c=A.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=a(s),r=function(t){return s._offset+s.l2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(o=a(c),i=function(t){return c._offset+c.l2p(o(t,!0))}):i=function(t){return u.t+u.h*(1-t)},"path"===l)return s&&"date"===s.type&&(r=g(r)),c&&"date"===c.type&&(i=g(i)),C.convertPath(e.path,r,i);var f=r(e.x0),d=r(e.x1),h=i(e.y0),p=i(e.y1);if("line"===l)return"M"+f+","+h+"L"+d+","+p;if("rect"===l)return"M"+f+","+h+"H"+d+"V"+p+"H"+f+"Z";var v=(f+d)/2,m=(h+p)/2,y=Math.abs(v-f),x=Math.abs(m-h),b="A"+y+","+x,_=v+y+","+m,w=v+","+(m-x);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function b(t,e,n){return t.replace(E,function(t){var r=0,a=t.charAt(0),o=N[a],i=P[a],l=j[a],s=t.substr(1).replace(O,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}function _(t,e,n,r,a){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(n)];if(r){var i,l,s,c,u,f=1/0,d=-(1/0),h=r.match(E);for("date"===t.type&&(o=g(o)),i=0;iu&&(f=u),u>d&&(d=u)));return d>=f?[f,d]:void 0}}var w=t("fast-isnumeric"),k=t("../../plotly"),M=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),L=t("../drawing"),z=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var n=t.shapes||[],a=e.shapes=[],o=0;ol&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),M.log("Ignoring extra params in segment "+t)),a+s})},C.calcAutorange=function(t){var e,n,r,a,o,i=t._fullLayout,l=i.shapes;if(l.length&&t._fullData.length)for(e=0;ed?n=d:(u.left-=x.offsetLeft,u.right-=x.offsetLeft,u.top-=x.offsetTop,u.bottom-=x.offsetTop,x.selection.each(function(){var t=s.bBox(this);l.bBoxIntersect(u,t,c)&&(n=Math.max(n,i*(t[x.side]-u[o])+c))}),n=Math.min(d,n)),n>0||0>d){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,S=E,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,v=n.propName,m=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var E="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(u.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",z)}},{"../../lib":100,"../../lib/svg_text_utils":111,"../../plotly":119,"../../plots/plots":154,"../color":20,"../drawing":43,d3:10,"fast-isnumeric":12}],84:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:i,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":97,"../../plots/font_attributes":140,"../color/attributes":19}],85:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],86:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){ -function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(s.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),s.exit().remove(),s.exit().size()&&m(t),0!==n.length){var c=s.selectAll("g."+T.headerGroupClassName).data(n,a);c.enter().append("g").classed(T.headerGroupClassName,!0);var u=s.selectAll("g."+T.buttonGroupClassName).data([0]);u.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&u.call(v).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){y.select(this).remove(),u.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],90:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],91:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.16.2",n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=r.register,n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=r.Snapshot,n.PlotSchema=r.PlotSchema,n.Queue=r.Queue,n.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":116,"./plot_api/to_image":117,"./plot_api/validate":118,"./plotly":119,"./snapshot/download":162,d3:10}],92:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],93:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],94:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)}},"boolean":{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(i(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n?!0:"string"!=typeof t?!1:!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var s=i[0].split("-");if(s.length>3||3!==s.length&&i[1])return!1;if(4===s[0].length)n=Number(s[0]);else{if(2!==s[0].length)return!1;var c=(new Date).getFullYear();n=((Number(s[0])-c+70)%100+200)%100+c-70}return l(n)?1===s.length?new Date(n,0,1).getTime():(r=Number(s[1])-1,s[1].length>2||!(r>=0&&11>=r)?!1:2===s.length?new Date(n,r,1).getTime():(a=Number(s[2]),s[2].length>2||!(a>=1&&31>=a)?!1:(a=new Date(n,r,a).getTime(),i[1]?(s=i[1].split(":"),s.length>3?!1:(o=Number(s[0]),s[0].length>2||!(o>=0&&23>=o)?!1:(a+=36e5*o,1===s.length?a:(r=Number(s[1]),s[1].length>2||!(r>=0&&59>=r)?!1:(a+=6e4*r,2===s.length?a:(t=Number(s[2]),t>=0&&60>t?a+1e3*t:!1)))))):a))):!1},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){if("undefined"==typeof i)return void s.error("d3 is not defined.");e||(e=0);var n=new Date(t),a=i.time.format("%Y-%m-%d")(n);return 7776e6>e?(a+=" "+r(n.getHours(),2),432e6>e&&(a+=":"+r(n.getMinutes(),2),108e5>e&&(a+=":"+r(n.getSeconds(),2),3e5>e&&(a+="."+r(n.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var c={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"]},u={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"]},f=i.time.format.utc,d={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){d[t].D.push(f(e)),["H","I","D"].forEach(function(n){c[n].forEach(function(r){var a=d[t][n];a.push(f(e+"~"+r)),a.push(f(r+"~"+e))})})})});var h=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,v=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},x=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,k=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return M[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(h,p).replace(g,"").replace(v,"~").replace(m,y).replace(k,A).trim().replace(T,"");var e,n,r=null,i=a(t),l=o(t);e=d[i][l],n=e.length;for(var s=0;n>s&&!(r=e[s].parse(t));s++);if(!(r instanceof Date))return!1;var c=r.getTimezoneOffset();return r.setTime(r.getTime()+60*c*1e3),r}},{"../lib":100,d3:10,"fast-isnumeric":12}],96:[function(t,e,n){"use strict";var r=t("events").EventEmitter,a={init:function(t){if(t._ev instanceof r)return t;var e=new r;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(n,r){"undefined"!=typeof jQuery&&jQuery(t).trigger(n,r),e.emit(n,r)},t},triggerHandler:function(t,e,n){var r,a;"undefined"!=typeof jQuery&&(r=jQuery(t).triggerHandler(e,n));var o=t._ev;if(!o)return r;var i=o._events[e];if(!i)return r;"function"==typeof i&&(i=[i]);for(var l=i.pop(),s=0;sm;m++){s=t[m];for(c in s)u=g[c],f=s[c],l&&i(f)?g[c]=f:e&&f&&(o(f)||(d=i(f)))?(d?(d=!1,h=u&&i(u)?u:[]):h=u&&o(u)?u:{},g[c]=a([h,f],e,n,l)):("undefined"!=typeof f||n)&&(g[c]=f)}return g}var o=t("./is_plain_object.js"),i=Array.isArray;n.extendFlat=function(){return a(arguments,!1,!1,!1)},n.extendDeep=function(){return a(arguments,!0,!1,!1)},n.extendDeepAll=function(){return a(arguments,!0,!0,!1)},n.extendDeepNoArrays=function(){return a(arguments,!0,!1,!0)}},{"./is_plain_object.js":101}],98:[function(t,e,n){"use strict";e.exports=function(t){for(var e=[],n=0;nn?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.randstr=function d(t,e,n){if(n||(n=16),void 0===e&&(e=24),0>=e)return"0";var r,a,o,i=Math.log(Math.pow(2,e))/Math.log(n),l="";for(r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var s=i-Math.floor(i);for(r=0;r-1||c!==1/0&&c>=Math.pow(2,e)?d(t,e,n):l},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;s>n;n++)c[n]=(1-Math.cos(Math.PI*(n+1)/e))/(2*e);for(n=0;i>n;n++){for(o=0,r=0;s>r;r++)a=n+r+1-e,-i>a?a-=l*Math.round(a/l):a>=l&&(a-=l*Math.floor(a/l)),0>a?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;ra;a++)e[a][n]=t[a]},a.minExtend=function(t,e){var n={};"object"!=typeof e&&(e={});var r,o,i,l=3,s=Object.keys(t);for(r=0;r1?r+o[1]:"";if(a&&(o.length>1||i.length>4))for(;n.test(i);)i=i.replace(n,"$1"+a+"$2");return i+l}},{"./coerce":94,"./dates":95,"./extend":97,"./is_plain_object":101,"./loggers":102,"./matrix":103,"./nested_property":104,"./notifier":105,"./search":108,"./stats":110,d3:10}],101:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],102:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;er;r++)n[r]=new Array(e);return n},n.transposeRagged=function(t){var e,n,r=0,a=t.length;for(e=0;a>e;e++)r=Math.max(r,t[e].length);var o=new Array(r);for(e=0;r>e;e++)for(o[e]=new Array(a),n=0;a>n;n++)o[e][n]=t[n][e];return o},n.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var r,a,o=t.length;if(t[0].length)for(r=new Array(o),a=0;o>a;a++)r[a]=n.dot(t[a],e);else if(e[0].length){var i=n.transposeRagged(e);for(r=new Array(i.length),a=0;aa;a++)r+=t[a]*e[a];return r},n.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},n.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},n.rotationXYMatrix=function(t,e,r){return n.dot(n.dot(n.translationMatrix(e,r),n.rotationMatrix(t)),n.translationMatrix(-e,-r))},n.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var r=1===arguments.length?e[0]:[e[0],e[1]];return n.dot(t,[r[0],r[1],1]).slice(0,2)}},n.apply2DTransform2=function(t){var e=n.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],104:[function(t,e,n){"use strict";function r(t,e){return function(){var n,a,o,i,l,s=t;for(i=0;i=0;e--){if(r=t[e],i=!1,Array.isArray(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");ln||n>o||i>r||r>l?!1:!e||!c(t)}function n(t,e){var n=t[0],s=t[1];if(a>n||n>o||i>s||s>l)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],v=r[0][1],m=0;for(c=1;p>c;c++)if(u=g,f=v,g=r[c][0],v=r[c][1],d=Math.min(u,g),!(d>n||n>Math.max(u,g)||s>Math.max(f,v)))if(s=s&&n!==d&&m++}return m%2===1}var r=t.slice(),a=r[0][0],o=a,i=r[0][1],l=i;r.push(r[0]);for(var s=1;so;o++)if(i=[t[o][0]-s[0],t[o][1]-s[1]],l=r(i,c),0>l||l>u||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":103}],107:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;nt}function a(t,e){return e>=t}function o(t,e){return t>e}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("../lib");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;d>f&&h++<100;)c=Math.floor((f+d)/2),u(e[c],t)?f=c+1:d=c;return h>90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;r>l;l++)e[l+1]>e[l]+o&&(a=Math.min(a,e[l+1]-e[l]), -i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;o>a&&i++<100;)r=c((a+o)/2),e[r]<=t?a=r+l:o=r-s;return e[a]}},{"../lib":100,"fast-isnumeric":12}],109:[function(t,e,n){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],110:[function(t,e,n){"use strict";var r=t("fast-isnumeric");n.aggNums=function(t,e,a,o){var i,l;if(o||(o=a.length),r(e)||(e=!1),Array.isArray(a[0])){for(l=new Array(o),i=0;o>i;i++)l[i]=n.aggNums(t,e,a[i]);a=l}for(i=0;o>i;i++)r(e)?r(a[i])&&(e=t(+e,+a[i])):e=a[i];return e},n.len=function(t){return n.aggNums(function(t){return t+1},0,t)},n.mean=function(t,e){return e||(e=n.len(t)),n.aggNums(function(t,e){return t+e},0,t)/e},n.variance=function(t,e,a){return e||(e=n.len(t)),r(a)||(a=n.mean(t,e)),n.aggNums(function(t,e){return t+Math.pow(e-a,2)},0,t)/e},n.stdev=function(t,e,r){return Math.sqrt(n.variance(t,e,r))},n.interp=function(t,e){if(!r(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":12}],111:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,-1===v.indexOf(u.protocol)?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var v=d.getPlotDiv(l.node());(v&&v._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({"class":p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],v=parseInt(l.style("font-size"),10)||r(l,"height"),m=-v/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,m-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-d/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(m," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":89,"../constants/xmlns_namespaces":90,"../lib":100,d3:10}],112:[function(t,e,n){"use strict";var r=e.exports={},a=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson").feature;r.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},r.getTopojsonPath=function(t,e){return t+e+".json"},r.getTopojsonFeatures=function(t,e){var n=a[t.locationmode],r=e.objects[n];return o(e,r).features}},{"../plots/geo/constants":141,topojson:15}],113:[function(t,e,n){"use strict";function r(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function a(t){Array.isArray(t._promises)&&t._promises.length>0&&P.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),N.defaultConfig.setBackground(t,e)}function i(t,e){t._context||(t._context=P.extendFlat({},N.defaultConfig));var n=t._context;e&&(Object.keys(e).forEach(function(t){t in n&&("setBackground"===t&&"opaque"===e[t]?n[t]=o:n[t]=e[t])}),e.plot3dPixelRatio&&!n.plotGlPixelRatio&&(n.plotGlPixelRatio=n.plot3dPixelRatio)),n.staticPlot&&(n.editable=!1,n.autosizable=!1,n.scrollZoom=!1,n.doubleClick=!1,n.showTips=!1,n.showLink=!1,n.displayModeBar=!1)}function l(t,e,n){var r=C.select(t).selectAll(".plot-container").data([0]);r.enter().insert("div",":first-child").classed("plot-container plotly",!0);var a=r.selectAll(".svg-container").data([0]);a.enter().append("div").classed("svg-container",!0).style("position","relative"),a.html(""),e&&(t.data=e),n&&(t.layout=n),N.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(k(t,{}),t._fullLayout.autosize=n.autosize=!0),a.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=N.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},a.node()),t.framework.setUndoPoint();var o=t.framework.svg(),i=1,l=t._fullLayout.title;""!==l&&l||(i=0);var s="Click to enter title",c=function(){this.call(N.util.convertToTspans)},u=o.select(".title-group text").call(c);if(t._context.editable){u.attr({"data-unformatted":l}),l&&l!==s||(i=.2,u.attr({"data-unformatted":s}).text(s).style({opacity:i}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(N.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(c),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(c)})};u.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),R.addLinks(t),Promise.resolve()}function s(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var r=N.Axes.list({_fullLayout:t});for(e=0;ee;e++){var i=t.annotations[e];i.ref&&("paper"===i.ref?(i.xref="paper",i.yref="paper"):"data"===i.ref&&(i.xref="x",i.yref="y"),delete i.ref),c(i,"xref"),c(i,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(P.warn("Shapes must be an array."),delete t.shapes);var l=(t.shapes||[]).length;for(e=0;l>e;e++){var s=t.shapes[e];c(s,"xref"),c(s,"yref")}var u=t.legend;u&&(u.x>3?(u.x=1.02,u.xanchor="left"):u.x<-2&&(u.x=-.02,u.xanchor="right"),u.y>3?(u.y=1.02,u.yanchor="bottom"):u.y<-2&&(u.y=-.02,u.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=R.getSubplotIds(t,"gl3d");for(e=0;en;++n)x[n]=v[e]+m*y[2+4*n];h.camera={eye:{x:x[0],y:x[1],z:x[2]},center:{x:v[0],y:v[1],z:v[2]},up:{x:y[1],y:y[5],z:y[9]}},delete h.cameraposition}}return q.clean(t),t}function c(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=N.Axes.cleanId(n,r))}function u(t,e){for(var n=[],r=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),a=0;ao&&(l=P.randstr(r),-1!==n.indexOf(l));o++);i.uid=P.randstr(r),r.push(i.uid)}if(n.push(i.uid),"histogramy"===i.type&&"xbins"in i&&!("ybins"in i)&&(i.ybins=i.xbins,delete i.xbins),i.error_y&&"opacity"in i.error_y){var s=q.defaults,c=i.error_y.color||(R.traceIs(i,"bar")?q.defaultLine:s[a%s.length]);i.error_y.color=q.addOpacity(q.rgb(c),q.opacity(c)*i.error_y.opacity),delete i.error_y.opacity}if("bardir"in i&&("h"!==i.bardir||!R.traceIs(i,"bar")&&"histogram"!==i.type.substr(0,9)||(i.orientation="h",_(i)),delete i.bardir),"histogramy"===i.type&&_(i),"histogramx"!==i.type&&"histogramy"!==i.type||(i.type="histogram"),"scl"in i&&(i.colorscale=i.scl,delete i.scl),"reversescl"in i&&(i.reversescale=i.reversescl,delete i.reversescl),i.xaxis&&(i.xaxis=N.Axes.cleanId(i.xaxis,"x")),i.yaxis&&(i.yaxis=N.Axes.cleanId(i.yaxis,"y")),R.traceIs(i,"gl3d")&&i.scene&&(i.scene=R.subplotsRegistry.gl3d.cleanId(i.scene)),R.traceIs(i,"pie")||(Array.isArray(i.textposition)?i.textposition=i.textposition.map(f):i.textposition&&(i.textposition=f(i.textposition))),R.traceIs(i,"2dMap")&&("YIGnBu"===i.colorscale&&(i.colorscale="YlGnBu"),"YIOrRd"===i.colorscale&&(i.colorscale="YlOrRd")),R.traceIs(i,"markerColorscale")&&i.marker){var u=i.marker;"YIGnBu"===u.colorscale&&(u.colorscale="YlGnBu"),"YIOrRd"===u.colorscale&&(u.colorscale="YlOrRd")}if("surface"===i.type&&P.isPlainObject(i.contours)){var h=["x","y","z"];for(o=0;or?o.push(a+r):o.push(r);return o}function g(t,e,n){var r,a;for(r=0;r=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||0>a&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function v(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&g(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function m(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&s0){var l=w(t._boundingBoxMargins),s=l.left+l.right,c=l.bottom+l.top,u=o._container.node().getBoundingClientRect(),f=1-2*i.frameMargins;a=Math.round(f*(u.width-s)),r=Math.round(f*(u.height-c))}else n=window.getComputedStyle(t),r=parseFloat(n.height)||o.height,a=parseFloat(n.width)||o.width;return Math.abs(o.width-a)>1||Math.abs(o.height-r)>1?(o.height=t.layout.height=r,o.width=t.layout.width=a):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),R.sanitizeMargins(o),e}function M(t){var e=C.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===n.autosize&&(k(t,{}),n.autosize=!0,t.layout.autosize=!0),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];C.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=P.randstr(r)}n._paperdiv.selectAll(".main-svg").attr($.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0);var o=N.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),n._has("cartesian")&&T(t,o),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var i=n._paper.selectAll(".layer-subplot");n._imageSubplotLayer=i.selectAll(".imagelayer"),n._shapeSubplotLayer=i.selectAll(".shapelayer");var l=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=l.append("g").classed("imagelayer",!0),n._shapeUpperLayer=l.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var s=P.syncOrAsync([L,function(){return N.Axes.doTicks(t,"redraw")},I.init],t);return s&&s.then&&t._promises.push(s),s}function A(t,e){function n(e,n){return function(){return N.Axes.getFromId(t,e,n)}}for(var r,a,o=t._fullLayout._plots={},i=0;i0,_=N.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),k=w===_;b?t.framework===M&&!x&&k||(t.framework=M,M(t)):k?x&&M(t):(t.framework=M,M(t)),x&&N.Axes.saveRangeInitial(t);var A=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&h(t);for(var z=0;zX.range[0]?[1,2]:[2,1]);else{var $=X.range[0],W=X.range[1];"log"===I?(0>=$&&0>=W&&o(G+".autorange",!0),0>=$?$=W/1e6:0>=W&&(W=$/1e6),o(G+".range[0]",Math.log($)/Math.LN10),o(G+".range[1]",Math.log(W)/Math.LN10)):(o(G+".range[0]",Math.pow(10,$)),o(G+".range[1]",Math.pow(10,W)))}else o(G+".autorange",!0)}if("reverse"===B)Z.range?Z.range.reverse():(o(G+".autorange",!0),Z.range=[1,0]),Y.autorange?w=!0:_=!0;else if("annotations"===j.parts[0]||"shapes"===j.parts[0]){var J=j.parts[1],K=j.parts[0],tt=g[K]||[],et=N[P.titleCase(K)],nt=tt[J]||{};2===j.parts.length&&("add"===m[E]||P.isPlainObject(m[E])?z[E]="remove":"remove"===m[E]?-1===J?(z[K]=tt,delete z[E]):z[E]=nt:P.log("???",m)),!i(nt,"x")&&!i(nt,"y")||P.containsAny(E,["color","opacity","align","dash"])||(w=!0),et.draw(t,J,j.parts.slice(2).join("."),m[E]),delete m[E]}else if("images"===j.parts[0]){var at=P.objectFromPath(E,I);P.extendDeepAll(t.layout,at),H.supplyLayoutDefaults(t.layout,t._fullLayout),H.draw(t)}else if("mapbox"===j.parts[0]&&"layers"===j.parts[1]){P.extendDeepAll(t.layout,P.objectFromPath(E,I));var ot=(t._fullLayout.mapbox||{}).layers||[];for(O=j.parts[2]+1-ot.length,p=0;O>p;p++)ot.push({});_=!0}else if("updatemenus"===j.parts[0]){P.extendDeepAll(t.layout,P.objectFromPath(E,I));var it=t._fullLayout.updatemenus||[];for(O=j.parts[2]+1-it.length,p=0;O>p;p++)it.push({});_=!0}else 0===j.parts[0].indexOf("scene")?_=!0:0===j.parts[0].indexOf("geo")?_=!0:0===j.parts[0].indexOf("ternary")?_=!0:!v._has("gl2d")||-1===E.indexOf("axis")&&"plot_bgcolor"!==j.parts[0]?"hiddenlabels"===E?w=!0:-1!==j.parts[0].indexOf("legend")?y=!0:-1!==E.indexOf("title")?x=!0:-1!==j.parts[0].indexOf("bgcolor")?b=!0:j.parts.length>1&&P.containsAny(j.parts[1],["tick","exponent","grid","zeroline"])?x=!0:-1!==E.indexOf(".linewidth")&&-1!==E.indexOf("axis")?x=b=!0:j.parts.length>1&&-1!==j.parts[1].indexOf("line")?b=!0:j.parts.length>1&&"mirror"===j.parts[1]?x=b=!0:"margin.pad"===E?x=b=!0:"margin"===j.parts[0]||"autorange"===j.parts[1]||"rangemode"===j.parts[1]||"type"===j.parts[1]||"domain"===j.parts[1]||E.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(E)?M=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(E)&&(_=!0):_=!0,j.set(I)}D.add(t,rt,[t,z],rt,[t,T]),m.autosize&&(m=k(t,m)),(m.height||m.width||m.autosize)&&(w=!0);var lt=Object.keys(m),st=[R.previousPromises];if(_||w)st.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),N.plot(t,"",g)});else if(lt.length&&(R.supplyDefaults(t),v=t._fullLayout,y&&st.push(function(){return V.draw(t),R.previousPromises(t)}),b&&st.push(L),x&&st.push(function(){return N.Axes.doTicks(t,"redraw"),S(t),R.previousPromises(t)}),M)){var ct;for(Q(t),N.Fx.supplyLayoutDefaults(t.layout,v,t._fullData),N.Fx.init(t),ct=R.getSubplotIds(v,"gl3d"),p=0;p1)};c(n.width)&&c(n.height)||l(new Error("Height and width should be pixel values."));var u=r.clone(e,{format:"png",height:n.height,width:n.width}),f=u.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var d=r.getRedrawFunc(f);o.plot(f,u.data,u.layout,u.config).then(d).then(s).then(function(e){t(e)}).catch(function(t){l(t)})});return l}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib");e.exports=r},{"../lib":100,"../plotly":119,"../snapshot":164,"fast-isnumeric":12}],118:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,v=n.length,m=0;v>m;m++){var y=n[m],x=["data",m];if(p(y)){var b=u[m],_=b.type,w=l.traces[_].attributes;w.type={valType:"enumerated",values:[_]},b.visible===!1&&y.visible!==!1&&s.push(i("invisible",x)),r(y,b,w,s,x);var k=y.transforms,M=b.transforms;if(k){g(k)||s.push(i("array",x,["transforms"])),x.push("transforms");for(var A=0;Ac&&u>e&&(void 0===a[n]?o[f]=T.tickText(t,e):o[f]=l(t,e,String(a[n])),f++);return f=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function i(t,e){var n=t.match(B),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(B,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o=e.x,l=t._tickround,s=new Date(o),c="";n&&t.hoverformat?a=i(t.hoverformat,o):t.tickformat?a=i(t.tickformat,o):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[l]),"y"===l?a=j(s):"m"===l?a=D(s):(o!==t._tmin||n||(c="
"+j(s)),"d"===l?a=R(s):"H"===l?a=I(s):(o!==t._tmin||n||(c="
"+R(s)+", "+j(s)),a=q(s),"M"!==l&&(a+=F(s),"S"!==l&&(a+=d(m(o/1e3,1),t,"none",n).substr(1)))))),e.text=a+c}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&m(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,m(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>i?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=0>t,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat;if(r){var u={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(u),i=(Number(u._tickround)||0)+4,s=u._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),f>t)t="0",a=!1;else{if(t+=f,s&&(t*=Math.pow(10,-s),i+=s),0===i)t=String(Math.floor(t));else if(0>i){t=String(Math.round(t)),t=t.substr(0,t.length+i);for(var d=i;0>d;d++)t+="0"}else{t=String(t);var h=t.indexOf(".")+1;h&&(t=t.substr(0,h+i).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(s&&"hide"!==l){var p;p=0>s?"\u2212"+-s:"power"!==l?"+"+s:String(s),"e"===l||("SI"===l||"B"===l)&&(s>12||-15>s)?t+="e"+p:"E"===l?t+="E"+p:"power"===l?t+="\xd710"+p+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=H[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var p=r-1,g=r+1;n="tozero"===t.rangemode?0>r?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var n=T.list(t,"",!0),r=!1,a=0;ap&&(p=g/10),c=t.c2l(p),u=t.c2l(g),y&&(c=Math.min(0,c),u=Math.max(0,u)),r(c)){for(h=!0,i=0;i=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,v=e.length,m=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;6>o;o++)a(o);for(o=v-1;o>5;o--)a(o)}},T.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,i]};T.autoTicks(f,l);var d,h=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;yg&&(p>.3*b||a(o)||a(i))){var w=f.dtick/2;h+=o>h+w?w:-w}var k=1+Math.floor((i-h)/f.dtick);d=h+k*f.dtick}else for(d=h;i>=d;)d=T.tickIncrement(d,f.dtick);return{start:h,end:d,size:f.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return r(t);if("auto"===t.tickmode||!t.dtick){var e,n=t.nticks;n||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/e):(e="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var a=t.range[1]=l:l>=s)&&(i.push(s),!(i.length>1e3));s=T.tickIncrement(s,t.dtick,a));t._tmax=i[i.length-1];for(var c=new Array(i.length),u=0;u157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,S)):e>12096e5?(e/=26298e5,t.dtick="M"+a(e,1,C)):e>432e5?(t.dtick=a(e,864e5,O),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=a(e,36e5,C):e>3e4?t.dtick=a(e,6e4,E):e>500?t.dtick=a(e,1e3,E):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?P:N,s=t+.01*r,c=_.roundUp(m(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]r:r>c;)c=T.tickIncrement(c,a,e);return c}if("L"===u)return Math.log(n((Math.pow(10,r)-o)/f)*f+o)/Math.LN10;if("D"===u){var d="D2"===a?P:N,h=_.roundUp(m(r,1),d,e);return Math.floor(r)+Math.log(y.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(a)};var j=y.time.format("%Y"),D=y.time.format("%b %Y"),R=y.time.format("%b %-d"),I=y.time.format("%b %-d %Hh"),q=y.time.format("%H:%M"),F=y.time.format(":%S"),B=/%(\d?)f/g;T.tickText=function(t,e,n){function r(r){var a;return void 0===r?!0:n?"none"===r:(a={first:t._tmin,last:t._tmax}[r],"all"!==r&&e!==a)}var a,o,i=l(t,e),d="array"===t.tickmode,h=n||d;if(d&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&en&&(M=90),a(u,M)}c._lastangle=M}return i(e),e+" done"}function s(){c._boundingBox=n.node().getBoundingClientRect()}var u=n.selectAll("g."+C).data(z,S);if(!c.showticklabels||!x(r))return u.remove(),void i(e);var f,d,p,m,b;"x"===v?(b="bottom"===F?1:-1,f=function(t){return t.dx+j*b},m=r+(P+N)*b,d=function(t){return t.dy+m+t.fontSize*("bottom"===F?1:-.5)},p=function(t){return x(t)&&0!==t&&180!==t?0>t*b?"end":"start":"middle"}):(b="right"===F?1:-1,d=function(t){return t.dy+t.fontSize/2-j*b},f=function(t){return t.dx+r+(P+N+(90===Math.abs(c.tickangle)?t.fontSize/2:0))*b},p=function(t){return x(t)&&90===Math.abs(t)?"middle":"right"===F?"start":"end"});var k=0,M=0,T=[];u.enter().append("g").classed(C,1).append("text").attr("text-anchor","middle").each(function(e){var n=y.select(this),r=t._promises.length;n.call(A.setPosition,f(e),d(e)).call(A.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),r=t._promises[r],r?T.push(t._promises.pop().then(function(){a(n,c.tickangle)})):a(n,c.tickangle)}),u.exit().remove(),u.each(function(t){k=Math.max(k,t.fontSize)}),a(u,c._lastangle||c.tickangle);var L=_.syncOrAsync([o,l,s]);return L&&L.then&&t._promises.push(L),L}function i(e){if(!n){var r,a,o,i,l=L.getFromId(t,e),s=y.select(t).selectAll("g."+e+"tick"),c={selection:s,side:l.side},f=e.charAt(0),d=t._fullLayout._size,h=1.5,p=l.titlefont.size;if(s.size()){var g=y.select(s.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);g&&(c.offsetLeft=+g[1],c.offsetTop=+g[2])}"x"===f?(a="free"===l.anchor?{_offset:d.t+(1-(l.position||0))*d.h,_length:0}:L.getFromId(t,l.anchor),o=l._offset+l._length/2,i=a._offset+("top"===l.side?-10-p*(h+(l.showticklabels?1:0)):a._length+10+p*(h+(l.showticklabels?1.5:.5))),l.rangeslider&&l.rangeslider.visible&&l._boundingBox&&(i+=(u.height-u.margin.b-u.margin.t)*l.rangeslider.thickness+l._boundingBox.height),c.side||(c.side="bottom")):(a="free"===l.anchor?{_offset:d.l+(l.position||0)*d.w,_length:0}:L.getFromId(t,l.anchor),i=l._offset+l._length/2,o=a._offset+("right"===l.side?a._length+10+p*(h+(l.showticklabels?1:.5)):-10-p*(h+(l.showticklabels?.5:0))),r={rotate:"-90",offset:0},c.side||(c.side="left")),k.draw(t,e+"title",{propContainer:l,propName:l._name+".title",dfltName:f.toUpperCase()+" axis",avoid:c,transform:r,attributes:{x:o,y:i,"text-anchor":"middle"}})}}function l(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:b.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[v]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===v}function s(e,n,a){var o=e.gridlayer,i=e.zerolinelayer,s=e["hidegrid"+v]?[]:H,u=c._gridpath||"M0,0"+("x"===v?"v":"h")+n._length,f=o.selectAll("path."+E).data(c.showgrid===!1?[]:s,S);if(f.enter().append("path").classed(E,1).classed("crisp",1).attr("d",u).each(function(t){c.zeroline&&("linear"===c.type||"-"===c.type)&&Math.abs(t.x)g;g++){var y=c.mirrors[i._id+d[g]];"ticks"!==y&&"labels"!==y||(f[g]=!0)}return void 0!==r[2]&&(f[2]=!0),f.forEach(function(t,e){var n=r[e],a=B[e];t&&x(n)&&(h+=p(n+N*a,a*c.ticklen))}),a(n,h),s(e,i,t),o(n,r[3])}}).filter(function(t){return t&&t.then});return U.length?Promise.all(U):0},T.swap=function(t,e){for(var n=h(t,e),r=0;r2*r}function u(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var f=t("fast-isnumeric"),d=t("tinycolor2").mix,h=t("../../lib"),p=t("../plots"),g=t("../../components/color/attributes").lightFraction,v=t("./layout_attributes"),m=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),x=t("./tick_label_defaults"),b=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),k=t("./clean_datum"),M=t("./axis_ids");e.exports=function(t,e,n,a){function o(n,r){return h.coerce2(t,e,v,n,r)}var i=a.letter,l=a.font||{},s="Click to enter "+(a.title||i.toUpperCase()+" axis")+" title";a.name&&(e._name=a.name,e._id=M.name2id(a.name));var c=n("type");"-"===c&&(r(e,a.data),"-"===e.type?e.type="linear":c=t.type=e.type),_(e);var u=n("color"),p=u===t.color?u:l.color;n("title",s),h.coerceFont(n,"titlefont",{family:l.family,size:Math.round(1.2*l.size),color:p});var k=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),A=n("autorange",!k);A&&n("rangemode");var T=n("range",[-1,"x"===i?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),h.noneOrAll(t.range,e.range,[0,1]),n("fixedrange"),m(t,e,n,c),x(t,e,n,c,a),y(t,e,n,a),b(t,e,n);var L=o("linecolor",u),z=o("linewidth"),S=n("showline",!!L||!!z);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&n("mirror");var C=o("gridcolor",d(u,a.bgColor,g).toRgbString()),E=o("gridwidth"),O=n("showgrid",a.showGrid||!!C||!!E);O||(delete e.gridcolor,delete e.gridwidth);var N=o("zerolinecolor",u),P=o("zerolinewidth"),j=n("zeroline",a.showGrid||!!N||!!P);return j||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===c?w(i,e.categoryorder,e.categoryarray,a.data):[],e}},{"../../components/color/attributes":19,"../../lib":100,"../plots":154,"./axis_ids":124,"./category_order_defaults":125,"./clean_datum":126,"./layout_attributes":131,"./ordered_categories":133,"./set_convert":136,"./tick_label_defaults":137,"./tick_mark_defaults":138,"./tick_value_defaults":139,"fast-isnumeric":12,tinycolor2:14}],124:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],126:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return a.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){a.error(e,t)}return t}},{"../../lib":100,"fast-isnumeric":12}],127:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],128:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?u.ms2DateTime(r,a):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/setcursor"),g=t("../../components/dragelement"),v=t("./axes"),m=t("./select"),y=t("./constants"),x=!0;e.exports=function(t,e,n,l,b,_,w,k){function M(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+gt+")").attr("d",st+"Z"),dt=ht.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+gt+")").attr("d","M0,0Z"),L();for(var o=0;o<$.length;o++)A($[o].range)}function L(){ht.selectAll(".select-outline").remove()}function z(t,e){var n=Math.max(0,Math.min(H,t+at)),r=Math.max(0,Math.min(V,e+ot)),a=Math.abs(n-at),o=Math.abs(r-ot),i=Math.floor(Math.min(o,a,G)/2);it.l=Math.min(at,n),it.r=Math.max(at,n),it.t=Math.min(ot,r),it.b=Math.max(ot,r),!J||oa?(ut="",it.r=it.l,it.t=it.b,dt.attr("d","M0,0Z")):(it.t=0,it.b=V,ut="x",dt.attr("d","M"+(it.l-.5)+","+(ot-G-.5)+"h-3v"+(2*G+1)+"h3ZM"+(it.r+.5)+","+(ot-G-.5)+"h3v"+(2*G+1)+"h-3Z")):!W||a.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function S(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),x=!1)))}function E(e,n){var a=1===(w+k).length;if(e)D();else if(2!==n||a){if(1===n&&a){var o=w?B[0]:F[0],i="s"===w||"w"===k?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",d="middle";if(o.fixedrange)return;w?(d="n"===w?"top":"bottom","right"===o.side&&(u="right")):"e"===k&&(u="right"),et.call(f.makeEditable,null,{immediate:!0,background:I.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:d}).on("edit",function(e){var n="category"===o.type?o.c2l(e):o.d2l(e);void 0!==n&&c.relayout(t,l,n)})}}else j()}function O(e){function n(t,e,n){if(!t.fixedrange){A(t.range);var r=t.range,a=r[0]+(r[1]-r[0])*e;t.range=[a+(r[0]-a)*n,a+(r[1]-a)*n]}}if(t._context.scrollZoom||I._enablescrollzoom){var r=t.querySelector(".plotly");if(!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(mt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void u.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,f=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-f);if(k){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,n){for(var a=1-e,o=0,i=0;i0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rT;T++){var L=o[T],z=h[L];if(z)M[T]=w.getFromId(t,z.xaxis._id),A[T]=w.getFromId(t,z.yaxis._id);else{var S=i[L]._subplot;M[T]=S.xaxis,A[T]=S.yaxis}}var C=e.hovermode||i.hovermode;if(-1===["x","y","closest"].indexOf(C)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var E,O,N,P,j,D,R,I,q,F,B,H,V=[],U=[];if(Array.isArray(e))for(C="array",N=0;NG||G>Y.width||0>Z||Z>Y.height)return _.unhoverRaw(t,e)}else G="xpx"in e?e.xpx:M[0]._length/2,Z="ypx"in e?e.ypx:A[0]._length/2;if(E="xval"in e?r(o,e.xval):a(M,G),O="yval"in e?r(o,e.yval):a(A,Z),!g(E[0])||!g(O[0]))return v.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var X=1/0;for(P=0;P1||-1!==D.hoverinfo.indexOf("name")?D.name:void 0,index:!1,distance:Math.min(X,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},H=V.length,"array"===I){var Q=e[P];"pointNumber"in Q?(B.index=Q.pointNumber,I="closest"):(I="","xval"in Q&&(q=Q.xval,I="x"),"yval"in Q&&(F=Q.yval,I=I?"closest":"y"))}else q=E[R],F=O[R];if(D._module&&D._module.hoverPoints){var $=D._module.hoverPoints(B,q,F,I);if($)for(var W,J=0;J<$.length;J++)W=$[J],g(W.x0)&&g(W.y0)&&V.push(s(W,C))}else v.log("Unrecognized trace type in hover:",D);"closest"===C&&V.length>H&&(V.splice(0,H),X=V[0].distance)}if(0===V.length)return _.unhoverRaw(t,e);var K="y"===C&&U.length>1;V.sort(function(t,e){return t.distance-e.distance});var tt=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),et={hovermode:C,rotateLabels:K,bgColor:tt,container:i._hoverlayer,outerContainer:i._paperdiv},nt=c(V,et);u(V,K?"xa":"ya"),f(nt,K);var rt=t._hoverdata,at=[];for(N=0;N128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),v=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),v=d.node().getBoundingClientRect().width+2*O):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var m,k,L=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),N=Math.abs(t.y1-t.y0),P=L.width+E+O+v;t.ty0=_-L.top,t.bx=L.width+2*O,t.by=L.height+2*O,t.anchor="start",t.txwidth=L.width,t.tx2width=v,t.offset=0,o?(t.pos=z,m=M>=S+N/2+P,k=S-N/2-P>=0,"top"!==t.idealAlign&&m||!k?m?(S+=N/2,t.anchor="start"):t.anchor="middle":(S-=N/2,t.anchor="end")):(t.pos=S,m=w>=z+C/2+P,k=z-C/2-P>=0,"left"!==t.idealAlign&&m||!k?m?(z+=C/2,t.anchor="start"):t.anchor="middle":(z-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+S+")"+(o?"rotate("+T+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(.01>o)){if(-.01>a){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(0>=c);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=c);i++)if(s=t[i],s.pos=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(0>=c);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?z:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var v=f[i];for(l=v.length-1;l>=0;l--){var m=v[l],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(E+O),l=i+o*(t.txwidth+O),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=t.offset*S),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*E+s)+","+(E+c)+"v"+(t.by/2-E)+"h"+r*t.bx+"v-"+t.by+"H"+(r*E+s)+"V"+(c-E)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+O).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*O+s,c+t.ty0-t.by/2+O),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,n){function r(n,r){return v.coerce(t,e,A.layoutAttributes,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},A.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indext*e||0===t?k.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":20,"../../components/dragelement":41,"../../components/drawing":43,"../../lib":100,"../../lib/events":96,"../../lib/svg_text_utils":111,"./axes":122,"./constants":127,"./dragbox":128,d3:10,"fast-isnumeric":12,tinycolor2:14}],130:[function(t,e,n){"use strict";var r=t("../plots"),a=t("./constants");n.name="cartesian",n.attr=["xaxis","yaxis"],n.idRoot=["x","y"],n.idRegex=a.idRegex,n.attrRegex=a.attrRegex,n.attributes=t("./attributes"),n.plot=function(t){function e(t,e){for(var n=[],r=0;rf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":100,"fast-isnumeric":12}],135:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,v=a.element.getBoundingClientRect(),m=a.plotinfo.x()._offset,y=a.plotinfo.y()._offset,x=e-v.left,b=n-v.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",k+"Z");var C,E,O,N,P,j=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),D=[],R=a.gd,I=[];for(C=0;C0)return Math.log(e)/Math.LN10;if(0>=e&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*u*Math.abs(r-a))}return i.BADNUM}function n(t){return Math.pow(10,t)}function c(t){return a(t)?Number(t):i.BADNUM}var u=10;if(t.c2l="log"===t.type?e:c,t.l2c="log"===t.type?n:c,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var r=s.getFromId(t._gd,t.overlaying);t.domain=r.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)a(t.range[e])||(t.range[e]=a(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):i.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=c,t.d2c=function(t){return t=l(t),a(t)?Number(t):i.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return a(t)?o.ms2DateTime(t):i.BADNUM},t.d2c=function(t){return a(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!a(t.range[0])&&a(f[0])&&(t.range[0]=f[0]),!a(t.range[1])&&a(f[1])&&(t.range[1]=f[1])}catch(d){o.error(d,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var n=t._categories.indexOf(e);return-1===n?i.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;or?"0":"1.0"}var n=this.framework,r=n.select("g.choroplethlayer"),a=n.select("g.scattergeolayer"),o=this.projection,i=this.path,l=this.clipAngle;n.selectAll("path.basepath").attr("d",i),n.selectAll("path.graticulepath").attr("d",i),r.selectAll("path.choroplethlocation").attr("d",i),r.selectAll("path.basepath").attr("d",i),a.selectAll("path.js-line").attr("d",i),null!==l?(a.selectAll("path.point").style("opacity",e).attr("transform",t),a.selectAll("text").style("opacity",e).attr("transform",t)):(a.selectAll("path.point").attr("transform",t),a.selectAll("text").attr("transform",t))}},{"../../components/color":20,"../../components/drawing":43,"../../constants/xmlns_namespaces":90,"../../lib/filter_visible":98,"../../lib/topojson_utils":112,"../../plots/cartesian/axes":122,"./constants":141,"./projections":149,"./set_scale":150,"./zoom":151,"./zoom_reset":152,d3:10,topojson:15}],143:[function(t,e,n){"use strict";var r=t("./geo"),a=t("../../plots/plots");n.name="geo",n.attr="geo",n.idRoot="geo",n.idRegex=/^geo([2-9]|[1-9][0-9]+)?$/,n.attrRegex=/^geo([2-9]|[1-9][0-9]+)?$/,n.attributes=t("./layout/attributes"),n.layoutAttributes=t("./layout/layout_attributes"),n.supplyLayoutDefaults=t("./layout/defaults"),n.plot=function(t){var e=t._fullLayout,n=t._fullData,o=a.getSubplotIds(e,"geo");void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var i=0;i=r}function o(t,e){for(var n=e[0],r=e[1],a=!1,o=0,i=t.length,l=i-1;i>o;l=o++){var s=t[o],c=s[0],u=s[1],f=t[l],d=f[0],h=f[1];u>r^h>r&&(d-c)*(r-u)/(h-u)+c>n&&(a=!a)}return a}function i(t){return t?t/Math.sin(t):1}function l(t){return t>1?O:-1>t?-O:Math.asin(t)}function s(t){return t>1?0:-1>t?E:Math.acos(t)}function c(t,e){var n=(2+O)*Math.sin(e);e/=2;for(var r=0,a=1/0;10>r&&Math.abs(a)>S;r++){var o=Math.cos(e);e-=a=(e+Math.sin(e)*(o+2)-n)/(2*o*(1+o))}return[2/Math.sqrt(E*(4+E))*t*(1+Math.cos(e)),2*Math.sqrt(E/(4+E))*Math.sin(e)]}function u(t,e){function n(n,r){var a=R(n/e,r);return a[0]*=t,a}return arguments.length<2&&(e=t),1===e?R:e===1/0?d:(n.invert=function(n,r){var a=R.invert(n/t,r);return a[0]*=e,a},n)}function f(){var t=2,e=D(u),n=e(t);return n.coefficient=function(n){return arguments.length?e(t=+n):t},n}function d(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function h(t,e){return[3*t/(2*E)*Math.sqrt(E*E/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(E/4+.4*e))]}function g(t){return function(e){var n,r=t*Math.sin(e),a=30;do e-=n=(e+Math.sin(e)-r)/(1+Math.cos(e));while(Math.abs(n)>S&&--a>0);return e/2}}function v(t,e,n){function r(n,r){return[t*n*Math.cos(r=a(r)),e*Math.sin(r)]}var a=g(n);return r.invert=function(r,a){var o=l(a/e);return[r/(t*Math.cos(o)),l((2*o+Math.sin(2*o))/n)]},r}function m(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),e*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function y(t,e){var n,r=Math.min(18,36*Math.abs(e)/E),a=Math.floor(r),o=r-a,i=(n=q[a])[0],l=n[1],s=(n=q[++a])[0],c=n[1],u=(n=q[Math.min(19,++a)])[0],f=n[1];return[t*(s+o*(u-i)/2+o*o*(u-2*s+i)/2),(e>0?O:-O)*(c+o*(f-l)/2+o*o*(f-2*c+l)/2)]}function x(t,e){return[t*Math.cos(e),e]}function b(t,e){var n=Math.cos(e),r=i(s(n*Math.cos(t/=2)));return[2*n*Math.sin(t)*r,Math.sin(e)*r]}function _(t,e){var n=b(t,e);return[(n[0]+t/O)/2,(n[1]+e)/2]}t.geo.project=function(t,e){var r=e.stream;if(!r)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:n)(t,r)};var w={Feature:e,FeatureCollection:function(t,n){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,n)})}}},k=[],M=[],A={point:function(t,e){k.push([t,e])},result:function(){var t=k.length?k.length<2?{type:"Point",coordinates:k[0]}:{type:"MultiPoint",coordinates:k}:null;return k=[],t}},T={lineStart:r,point:function(t,e){k.push([t,e])},lineEnd:function(){k.length&&(M.push(k),k=[])},result:function(){var t=M.length?M.length<2?{type:"LineString",coordinates:M[0]}:{type:"MultiLineString",coordinates:M}:null;return M=[],t}},L={polygonStart:r,lineStart:r,point:function(t,e){k.push([t,e])},lineEnd:function(){var t=k.length;if(t){do k.push(k[0].slice());while(++t<4);M.push(k),k=[]}},polygonEnd:r,result:function(){if(!M.length)return null;var t=[],e=[];return M.forEach(function(n){a(n)?t.push([n]):e.push(n)}),e.forEach(function(e){var n=e[0];t.some(function(t){return o(t[0],n)?(t.push(e),!0):void 0})||t.push([e])}),M=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},z={Point:A,MultiPoint:A,LineString:T,MultiLineString:T,Polygon:L,MultiPolygon:L,Sphere:L},S=1e-6,C=S*S,E=Math.PI,O=E/2,N=(Math.sqrt(E),E/180),P=180/E,j=t.geo.projection,D=t.geo.projectionMutator;t.geo.interrupt=function(e){function n(t,n){for(var r=0>n?-1:1,a=s[+(0>n)],o=0,i=a.length-1;i>o&&t>a[o][2][0];++o);var l=e(t-a[o][1][0],n);return l[0]+=e(a[o][1][0],r*n>r*a[o][0][1]?a[o][0][1]:n)[0],l}function r(){l=s.map(function(t){return t.map(function(t){var n,r=e(t[0][0],t[0][1])[0],a=e(t[2][0],t[2][1])[0],o=e(t[1][0],t[0][1])[1],i=e(t[1][0],t[1][1])[1];return o>i&&(n=o,o=i,i=n),[[r,o],[a,i]]})})}function a(){for(var e=1e-6,n=[],r=0,a=s[0].length;a>r;++r){var i=s[0][r],l=180*i[0][0]/E,c=180*i[0][1]/E,u=180*i[1][1]/E,f=180*i[2][0]/E,d=180*i[2][1]/E;n.push(o([[l+e,c+e],[l+e,u-e],[f-e,u-e],[f-e,d+e]],30))}for(var r=s[1].length-1;r>=0;--r){var i=s[1][r],l=180*i[0][0]/E,c=180*i[0][1]/E,u=180*i[1][1]/E,f=180*i[2][0]/E,d=180*i[2][1]/E;n.push(o([[f-e,d-e],[f-e,u+e],[l+e,u+e],[l+e,c-e]],30))}return{type:"Polygon",coordinates:[t.merge(n)]}}function o(t,e){for(var n,r,a,o=-1,i=t.length,l=t[0],s=[];++oc;++c)s.push([l[0]+c*r,l[1]+c*a]);l=n}return s.push(n),s}function i(t,e){return Math.abs(t[0]-e[0])r)],o=s[+(0>r)],c=0,u=a.length;u>c;++c){var f=a[c];if(f[0][0]<=t&&tS&&--a>0);return[t/(.8707+(o=r*r)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),r]},(t.geo.naturalEarth=function(){return j(m)}).raw=m;var q=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];q.forEach(function(t){t[1]*=1.0144}),y.invert=function(t,e){var n=e/O,r=90*n,a=Math.min(18,Math.abs(r/5)),o=Math.max(0,Math.floor(a));do{var i=q[o][1],l=q[o+1][1],s=q[Math.min(19,o+2)][1],c=s-i,u=s-2*l+i,f=2*(Math.abs(n)-l)/c,d=u/c,h=f*(1-d*f*(1-2*d*f));if(h>=0||1===o){r=(e>=0?5:-5)*(h+a);var p,g=50;do a=Math.min(18,Math.abs(r)/5),o=Math.floor(a),h=a-o,i=q[o][1],l=q[o+1][1],s=q[Math.min(19,o+2)][1],r-=(p=(e>=0?O:-O)*(l+h*(s-i)/2+h*h*(s-2*l+i)/2)-e)*P;while(Math.abs(p)>C&&--g>0);break}}while(--o>=0);var v=q[o][0],m=q[o+1][0],y=q[Math.min(19,o+2)][0];return[t/(m+h*(y-v)/2+h*h*(y-2*m+v)/2),r*N]},(t.geo.robinson=function(){return j(y)}).raw=y,x.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return j(x)}).raw=x,b.invert=function(t,e){if(!(t*t+4*e*e>E*E+S)){var n=t,r=e,a=25;do{var o,i=Math.sin(n),l=Math.sin(n/2),c=Math.cos(n/2),u=Math.sin(r),f=Math.cos(r),d=Math.sin(2*r),h=u*u,p=f*f,g=l*l,v=1-p*c*c,m=v?s(f*c)*Math.sqrt(o=1/v):o=0,y=2*m*f*l-t,x=m*u-e,b=o*(p*g+m*f*c*h),_=o*(.5*i*d-2*m*u*l),w=.25*o*(d*l-m*u*p*i),k=o*(h*c+m*g*f),M=_*w-k*b;if(!M)break;var A=(x*_-y*k)/M,T=(y*w-x*b)/M;n-=A,r-=T}while((Math.abs(A)>S||Math.abs(T)>S)&&--a>0);return[n,r]}},(t.geo.aitoff=function(){return j(b)}).raw=b,_.invert=function(t,e){var n=t,r=e,a=25;do{var o,i=Math.cos(r),l=Math.sin(r),c=Math.sin(2*r),u=l*l,f=i*i,d=Math.sin(n),h=Math.cos(n/2),p=Math.sin(n/2),g=p*p,v=1-f*h*h,m=v?s(i*h)*Math.sqrt(o=1/v):o=0,y=.5*(2*m*i*p+n/O)-t,x=.5*(m*l+r)-e,b=.5*o*(f*g+m*i*h*u)+.5/O,_=o*(d*c/4-m*l*p),w=.125*o*(c*p-m*l*f*d),k=.5*o*(u*h+m*g*i)+.5,M=_*w-k*b,A=(x*_-y*k)/M,T=(y*w-x*b)/M;n-=A,r-=T}while((Math.abs(A)>S||Math.abs(T)>S)&&--a>0);return[n,r]},(t.geo.winkel3=function(){return j(_)}).raw=_}e.exports=r},{}],150:[function(t,e,n){"use strict";function r(t,e){var n=t.projection,r=t.lonaxis,i=t.lataxis,s=t.domain,c=t.framewidth||0,u=e.w*(s.x[1]-s.x[0]),f=e.h*(s.y[1]-s.y[0]),d=r.range[0]+l,h=r.range[1]-l,p=i.range[0]+l,g=i.range[1]-l,v=r._fullRange[0]+l,m=r._fullRange[1]-l,y=i._fullRange[0]+l,x=i._fullRange[1]-l;n._translate0=[e.l+u/2,e.t+f/2];var b=h-d,_=g-p,w=[d+b/2,p+_/2],k=n._rotate;n._center=[w[0]+k[0],w[1]+k[1]];var M=function(e){function r(t){return Math.min(_*u/(t[1][0]-t[0][0]),_*f/(t[1][1]-t[0][1]))}var i,l,s,b,_=e.scale(),w=n._translate0,k=a(d,p,h,g),M=a(v,y,m,x);s=o(e,k),i=r(s),b=o(e,M),n._fullScale=r(b),e.scale(i),s=o(e,k),l=[w[0]-s[0][0]+c,w[1]-s[0][1]+c],n._translate=l,e.translate(l),s=o(e,k),t._isAlbersUsa||e.clipExtent(s),i=n.scale*i,n._scale=i,t._width=Math.round(s[1][0])+c,t._height=Math.round(s[1][1])+c,t._marginX=(u-Math.round(s[1][0]))/2,t._marginY=(f-Math.round(s[1][1]))/2};return M}function a(t,e,n,r){var a=(n-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,r],[t+a,r],[t+2*a,r],[t+3*a,r],[n,r],[n,e],[n-a,e],[n-2*a,e],[n-3*a,e],[t,e]]]}}function o(t,e){return i.geo.path().projection(t).bounds(e)}var i=t("d3"),l=t("./constants").clipPad;e.exports=r},{"./constants":141,d3:10}],151:[function(t,e,n){"use strict";function r(t,e){var n;return(n=e._isScoped?o:e._clipAngle?l:i)(t,e.projection)}function a(t,e){var n=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*n,100*n])}function o(t,e){function n(){_.select(this).style(M)}function r(){i.scale(_.event.scale).translate(_.event.translate),t.render()}function o(){_.select(this).style(A)}var i=t.projection,l=a(i,e);return l.on("zoomstart",n).on("zoom",r).on("zoomend",o),l}function i(t,e){function n(t){return v.invert(t)}function r(t){var e=v(n(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(M),s=_.mouse(this),c=v.rotate(),u=v.translate(),f=c,d=n(s)}function i(){return h=_.mouse(this),r(s)?(m.scale(v.scale()),void m.translate(v.translate())):(v.scale(_.event.scale),v.translate([u[0],_.event.translate[1]]),d?n(h)&&(g=n(h),p=[f[0]+(g[0]-d[0]),c[1],c[2]],v.rotate(p),f=p):(s=h,d=n(s)),void t.render())}function l(){_.select(this).style(A)}var s,c,u,f,d,h,p,g,v=t.projection,m=a(v,e),y=2;return m.on("zoomstart",o).on("zoom",i).on("zoomend",l),m}function l(t,e){function n(t){m++||t({type:"zoomstart"})}function r(t){t({type:"zoom"})}function o(t){--m||t({type:"zoomend"})}var i,l=t.projection,h={r:l.rotate(),k:l.scale()},p=a(l,e),g=b(p,"zoomstart","zoom","zoomend"),m=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(M);var t=_.mouse(this),e=l.rotate(),a=e,o=l.translate(),m=c(e);i=s(l,t),y.call(p,"zoom",function(){var n=_.mouse(this);if(l.scale(h.k=_.event.scale),i){if(s(l,n)){l.rotate(e).translate(o);var c=s(l,n),p=f(i,c),y=v(u(m,p)),x=h.r=d(y,i,a);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=a),l.rotate(x),a=x}}else t=n,i=s(l,t);r(g.of(this,arguments))}),n(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(A),y.call(p,"zoom",null),o(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function s(t,e){var n=t.invert(e);return n&&isFinite(n[0])&&isFinite(n[1])&&m(n)}function c(t){var e=.5*t[0]*w,n=.5*t[1]*w,r=.5*t[2]*w,a=Math.sin(e),o=Math.cos(e),i=Math.sin(n),l=Math.cos(n),s=Math.sin(r),c=Math.cos(r);return[o*l*c+a*i*s,a*l*c-o*i*s,o*i*c+a*l*s,o*l*s-a*i*c]}function u(t,e){var n=t[0],r=t[1],a=t[2],o=t[3],i=e[0],l=e[1],s=e[2],c=e[3];return[n*i-r*l-a*s-o*c,n*l+r*i+a*c-o*s,n*s-r*c+a*i+o*l,n*c+r*s-a*l+o*i]}function f(t,e){if(t&&e){var n=x(t,e),r=Math.sqrt(y(n,n)),a=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),o=Math.sin(a)/r;return r&&[Math.cos(a),n[2]*o,-n[1]*o,n[0]*o]}}function d(t,e,n){var r=g(e,2,t[0]);r=g(r,1,t[1]),r=g(r,0,t[2]-n[2]);var a,o,i=e[0],l=e[1],s=e[2],c=r[0],u=r[1],f=r[2],d=Math.atan2(l,i)*k,p=Math.sqrt(i*i+l*l);Math.abs(u)>p?(o=(u>0?90:-90)-d,a=0):(o=Math.asin(u/p)*k-d,a=Math.sqrt(p*p-u*u));var v=180-o-2*d,m=(Math.atan2(f,c)-Math.atan2(s,a))*k,y=(Math.atan2(f,c)-Math.atan2(s,-a))*k,x=h(n[0],n[1],o,m),b=h(n[0],n[1],v,y);return b>=x?[o,m,n[2]]:[v,y,n[2]]}function h(t,e,n,r){var a=p(n-t),o=p(r-e);return Math.sqrt(a*a+o*o)}function p(t){return(t%360+540)%360-180}function g(t,e,n){var r=n*w,a=t.slice(),o=0===e?1:0,i=2===e?1:2,l=Math.cos(r),s=Math.sin(r);return a[o]=t[o]*l-t[i]*s,a[i]=t[i]*l+t[o]*s,a}function v(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*k,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*k,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*k]}function m(t){var e=t[0]*w,n=t[1]*w,r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function y(t,e){for(var n=0,r=0,a=t.length;a>r;++r)n+=t[r]*e[r];return n}function x(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 b(t){for(var e=0,n=arguments.length,r=[];++e=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&a(t,i),l.text(i.text()&&c.text()?" - ":"")},h.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=h.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},h.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},a=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];h.supplyLayoutGlobalDefaults(a,r),r._dataLength=s.length,h.supplyDataDefaults(s,l,r),r._has=h._hasPlotType.bind(r);var c=r._modules;for(e=0;eo&&(e=(n-1)/(a.l+a.r),a.l=Math.floor(e*a.l),a.r=Math.floor(e*a.r)),0>i&&(e=(r-1)/(a.t+a.b),a.t=Math.floor(e*a.t),a.b=Math.floor(e*a.b))}},h.autoMargin=function(t,e,n){var r=t._fullLayout;if(r._pushmargin||(r._pushmargin={}),r.margin.autoexpand!==!1){if(n){var a=void 0===n.pad?12:n.pad;n.l+n.r>.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||h.doAutoMargin(t)}},h.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;return e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var v=s[t].t.val,m=s[t].t.size;if(v>d){var y=(h*v+(m-e.height)*d)/(v-d),x=(m*(1-d)+(h-e.height)*(1-v))/(v-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,t._replotting||"{}"===r||r===JSON.stringify(e._size)?void 0:u.plot(t)},h.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?f.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&h.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)}},{"../components/color":20,"../lib":100,"../plotly":119,"./attributes":120,"./font_attributes":140,"./layout_attributes":153,d3:10,"fast-isnumeric":12}],155:[function(t,e,n){"use strict";var r=t("../../traces/scatter/attributes"),a=r.marker;e.exports={r:r.r,t:r.t,marker:{color:a.color,size:a.size,symbol:a.symbol,opacity:a.opacity}}},{"../../traces/scatter/attributes":176}],156:[function(t,e,n){"use strict";function r(t,e){var n={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,n)}var a=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,i=o({},a.domain,{});e.exports={radialaxis:r("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:i,orientation:{valType:"number"}}),angularaxis:r("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:i}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":97,"../cartesian/layout_attributes":131}],157:[function(t,e,n){var r=t("../../plotly"),a=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},i=r.Lib.extendDeepAll;o.Axis=function(){function t(t){n=t||n;var c=s.data,f=s.layout;return("string"==typeof n||n.nodeName)&&(n=a.select(n)),n.datum(c).each(function(t,n){function s(t,e){return l(t)%360+f.orientation}var c=t.slice();u={data:o.util.cloneJson(c),layout:o.util.cloneJson(f)};var d=0;c.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[d],d=(d+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:a.rgb(t.color).darker().toString()),u.data[e].color=t.color,u.data[e].strokeColor=t.strokeColor,u.data[e].strokeDash=t.strokeDash,u.data[e].strokeSize=t.strokeSize});var h=c.filter(function(t,e){var n=t.visible;return"undefined"==typeof n||n===!0}),p=!1,g=h.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var v=a.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(g),m=[],y=v.map(function(t,e){if("unstacked"===t.key)return t.values;var n=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,r){t.yStack=[n],m.push(n),n=o.util.sumArrays(t.r,n)}),t.values});h=a.merge(y)}h.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var x=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;x=Math.max(10,x);var b,_=[f.margin.left+x,f.margin.top+x];if(p){var w=a.max(o.util.sumArrays(o.util.arrayLast(h).r[0],o.util.arrayLast(m)));b=[0,w]}else b=a.extent(o.util.flattenArray(h.map(function(t,e){return t.r})));f.radialAxis.domain!=o.DATAEXTENT&&(b[0]=0),r=a.scale.linear().domain(f.radialAxis.domain!=o.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:b).range([0,x]),u.layout.radialAxis.domain=r.domain();var k,M=o.util.flattenArray(h.map(function(t,e){return t.t})),A="string"==typeof M[0];A&&(M=o.util.deduplicate(M),k=M.slice(),M=a.range(M.length),h=h.map(function(t,e){var n=t;return t.t=[M],p&&(n.yStack=t.yStack),n}));var T=h.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===h.length,L=null===f.needsEndSpacing?A||!T:f.needsEndSpacing,z=f.angularAxis.domain&&f.angularAxis.domain!=o.DATAEXTENT&&!A&&f.angularAxis.domain[0]>=0,S=z?f.angularAxis.domain:a.extent(M),C=Math.abs(M[1]-M[0]);T&&!A&&(C=0);var E=S.slice();L&&A&&(E[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(E[1]-E[0])/O);var N=f.angularAxis.ticksStep||(E[1]-E[0])/(O*(f.minorTicks+1));k&&(N=Math.max(Math.round(N),1)),E[2]||(E[2]=N);var P=a.range.apply(this,E);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=a.scale.linear().domain(E.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?C:0,e=a.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var j="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",D=(new DOMParser).parseFromString(j,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=a.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,q=e.select(".chart-group"),F={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){I=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=o.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});o.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:I,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=I.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),I.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else I=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),q.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(U[0]=Math.max(0,U[0]),U[1]=Math.max(0,U[1]),e.select(".outer-group").attr("transform","translate("+U+")"),f.title){var G=e.select("g.title-group text").style(B).text(f.title),Z=G.node().getBBox();G.attr({x:_[0]-Z.width/2,y:_[1]-x-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var X=Y.selectAll("circle.grid-circle").data(r.ticks(5));X.enter().append("circle").attr({"class":"grid-circle"}).style(F),X.attr("r",r),X.exit().remove()}Y.select("circle.outside-circle").attr({r:x}).style(F);var Q=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var $=a.svg.axis().scale(r).ticks(5).tickSize(5);Y.call($).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(F),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),J=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(F),J.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=W.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?270>n&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(180>=n&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=a.max(q.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));I.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=a.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return i(o[n].defaultConfig(),t)});o[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=o.tooltipPanel().config({container:ct,fontSize:8})(),ft=o.tooltipPanel().config({container:ct,fontSize:8})(),dt=o.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});q.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos(Q).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=o.util.convertToCartesian(x+12,n+180);ut.text(o.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});q.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(Q).radius;pt.attr({r:n}).style({opacity:.5}),lt=r.invert(o.util.getMousePos(Q).radius);var a=o.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(o.util.round(lt)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var r=a.select(this),i=r.style("fill"),l="black",s=r.style("opacity")||1;if(r.attr({"data-opacity":s}),"none"!=i){r.attr({"data-fill":i}),l=a.hsl(i).darker().toString(),r.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-U[0]-d.left,f.top+f.height/2-U[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else i=r.style("stroke"),r.attr({"data-stroke":i}),l=a.hsl(i).darker().toString(),r.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=a.event.which?!1:void(a.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=a.select(this),r=n.attr("data-fill");r?n.style({fill:r,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,r,l,s={data:[],layout:{}},c={},u={},f=a.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),i(s.data[e],o.Axis.defaultConfig().data[0]),i(s.data[e],t)}),i(s.layout,o.Axis.defaultConfig().layout),i(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return r},d.angularScale=function(t){return l},d.svg=function(){return e},a.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:a.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},o.util._extend=function(t,e){for(var n in t)e[n]=t[n]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var n=e||6,r=a.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return r},o.util.dataFromEquation=function(t,e,n){var r=e||6,o=[],i=[];a.range(0,360+r,r).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return a.range(e).map(function(t,e){return n[e]||n[0]})},o.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=o.util.ensureArray(t[e],n)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},o.util.sumArrays=function(t,e){return a.zip(t,e).map(function(t,e){return a.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return-2===n},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},o.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},o.util.getMousePos=function(t){var e=a.mouse(t.node()),n=e[0],r=e[1],o={};return o.x=n,o.y=r,o.pos=e,o.angle=180*(Math.atan2(r,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+r*r),o},o.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;o>a;a++)e=t[a],e in n?(n[e]++,r[e]=n[e]):n[e]=1;return r},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,n,r){if(r){var a=n.slice();n=e,e=a}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,n,r){return"undefined"!=typeof t?(r===e.length-1&&delete t[n],t[n]):void 0},t),n.reduce(function(t,e,r){return"undefined"==typeof t[e]&&(t[e]={}),r===n.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=n[0].geometryConfig,e=t.container;"string"==typeof e&&(e=a.select(e)),e.datum(n).each(function(e,n){function r(e,n){var r=t.radialScale(e[1]),a=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:r,t:a}}function o(t){var e=t.r*Math.cos(t.t),n=t.r*Math.sin(t.t);return{x:e,y:n}}var i=!!e[0].data.yStack,s=e.map(function(t,e){return i?a.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):a.zip(t.data.t[0],t.data.r[0])}),c=t.angularScale,u=t.radialScale.domain()[0],f={};f.bar=function(n,r,o){var i=e[o].data,l=t.radialScale(n[1])-t.radialScale(0),s=t.radialScale(n[2]||0),u=i.barWidth;a.select(this).attr({"class":"mark bar",d:"M"+[[l+s,-u/2],[l+s,u/2],[s,u/2],[s,-u/2]].join("L")+"Z",transform:function(e,n){return"rotate("+(t.orientation+c(e[0]))+")"}})},f.dot=function(t,n,i){var l=t[2]?[t[0],t[1]+t[2]]:t,s=a.svg.symbol().size(e[i].data.dotSize).type(e[i].data.dotType)(t,n);a.select(this).attr({"class":"mark dot",d:s,transform:function(t,e){var n=o(r(l));return"translate("+[n.x,n.y]+")"}})};var d=a.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(n,r,o){var i=n[2]?s[o].map(function(t,e){return[t[0],t[1]+t[2]]}):s[o];if(a.select(this).each(f.dot).style({opacity:function(t,n){return+e[o].data.dotVisible},fill:v.stroke(n,r,o)}).attr({"class":"mark dot"}),!(r>0)){var l=a.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({"class":"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(n,r,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(n,r,o)},"stroke-width":function(t,e){return v["stroke-width"](n,r,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](n,r,o)},opacity:function(t,e){return v.opacity(n,r,o)},display:function(t,e){return v.display(n,r,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=a.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,r){a.select(this).attr({"class":"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var v={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},m=a.select(this).selectAll("g.layer").data(s);m.enter().append("g").attr({"class":"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,n=[o.PolyChart.defaultConfig()],r=a.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),i(n[e],o.PolyChart.defaultConfig()),i(n[e],t)}),this):n},t.getColorScale=function(){return e},a.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:a.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var n=e.legendConfig,r=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=i({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),o=a.merge(r);o=o.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(o=o.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=a.select(l));var s=o.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof o[0]:n.isContinuous,f=u?n.height:c*o.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink", -version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=a.range(o.length),v=a.scale[u?"linear":"ordinal"]().domain(g).range(s),m=a.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=a.svg.symbolTypes.indexOf(t)?a.svg.symbol().type(t).size(n)():a.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,m(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=a.svg.axis().scale(m).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),n=a.dispatch("hover");return t.config=function(t){return arguments.length?(i(e,t),this):e},a.rebind(t,n,"on"),t},o.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},o.tooltipPanel=function(){var t,e,n,r={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){t=r.container.selectAll("g."+l).data([0]);var a=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=a.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=a.append("text").attr({dx:r.padding+s,dy:.3*+r.fontSize}),c};return c.text=function(o){var i=a.hsl(r.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":r.fontSize+"px"}).text(f);var d=r.padding,h=e.node().getBBox(),p={fill:r.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,v=h.height+2*d;return n.attr({d:"M"+[[s,-v/2],[s,-v/4],[r.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-v/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c):void 0},c.hide=function(){return t?(t.style({display:"none"}),c):void 0},c.show=function(){return t?(t.style({display:"block"}),c):void 0},c.config=function(t){return i(r,t),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=i({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var r=o.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var a=r.indexOf(t.geometry);-1!=a&&(n.data[e].groupId=a)})}if(t.layout){var l=i({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};a.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../plotly":119,"./micropolar_manager":158,d3:10}],158:[function(t,e,n){"use strict";var r=t("../../plotly"),a=t("d3"),o=t("./undo_manager"),i=e.exports={},l=r.Lib.extendDeepAll;i.framework=function(t){function e(e,o){return o&&(f=o),a.select(a.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?l(n,e):e,c||(c=r.micropolar.Axis()),u=r.micropolar.adapter.plotly().convert(n),c.config(u).render(f),t.data=n.data,t.layout=n.layout,i.fillLayout(t),n}var n,s,c,u,f,d=new o;return e.isPolar=!0,e.svg=function(){return c.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return r.micropolar.adapter.plotly().convert(c.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:c.angularScale(),r:c.radialScale()}},e.setUndoPoint=function(){var t=this,e=r.micropolar.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,s),s=r.micropolar.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},i.fillLayout=function(t){var e=a.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:r.Color.background,_container:e,_paperdiv:n,_paper:o};t._fullLayout=l(i,t.layout)}},{"../../plotly":119,"./undo_manager":159,d3:10}],159:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return rg;g++){var v=h[g];l=t[v]?t[v]:t[v]={},e[v]=s={},i("domain."+d,[g/p,(g+1)/p]),i("domain."+{x:"y",y:"x"}[d]),o.id=v,f(l,s,i,o)}}},{"../lib":100,"./plots":154}],161:[function(t,e,n){"use strict";function r(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function a(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),i=o.Lib.extendFlat,l=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,s=t.data,c=t.layout,u=l([],s),f=l({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;ns&&(e.z=u.slice(0,s)),l("locationmode"),l("text"),l("marker.line.color"),l("marker.line.width"),a(t,e,i,l,{prefix:"",cLetter:"z"}),void l("hoverinfo",1===i._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":30,"../../lib":100,"./attributes":168}],171:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../heatmap/colorbar"),r.calc=t("./calc"),r.plot=t("./plot").plot,r.moduleType="trace",r.name="choropleth",r.basePlotModule=t("../../plots/geo"),r.categories=["geo","noOpacity"],r.meta={},e.exports=r},{"../../plots/geo":143,"../heatmap/colorbar":173,"./attributes":168,"./calc":169,"./defaults":170,"./plot":172}],172:[function(t,e,n){"use strict";function r(t,e){function n(e){var n=t.mockAxis;return i.tickText(n,n.c2l(e),"hover").text}var r=e.hoverinfo;if("none"===r)return function(t){delete t.nameLabel,delete t.textLabel};var a="all"===r?v.hoverinfo.flags:r.split("+"),o=-1!==a.indexOf("name"),l=-1!==a.indexOf("location"),s=-1!==a.indexOf("z"),c=-1!==a.indexOf("text"),u=!o&&l;return function(t){var r=[];u?t.nameLabel=t.id:(o&&(t.nameLabel=e.name),l&&r.push(t.id)),s&&r.push(n(t.z)),c&&r.push(t.tx),t.textLabel=r.join("
")}}function a(t){return function(e,n){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:n,location:e.id,z:e.z}]}}}var o=t("d3"),i=t("../../plots/cartesian/axes"),l=t("../../plots/cartesian/graph_interact"),s=t("../../components/color"),c=t("../../components/drawing"),u=t("../../components/colorscale/get_scale"),f=t("../../components/colorscale/make_scale_function"),d=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,p=t("../../lib/array_to_calc_item"),g=t("../../plots/geo/constants"),v=t("./attributes"),m=e.exports={};m.calcGeoJSON=function(t,e){for(var n,r=[],a=t.locations,o=a.length,i=d(t,e),l=(t.marker||{}).line||{},s=0;o>s;s++)n=h(t.locationmode,a[s],i),void 0!==n&&(n.z=t.z[s],void 0!==t.text&&(n.tx=t.text[s]),p(l.color,n,"mlc",s),p(l.width,n,"mlw",s),r.push(n));return r.length>0&&(r[0].trace=t),r},m.plot=function(t,e,n){var i,s=t.framework,c=s.select("g.choroplethlayer"),u=s.select("g.baselayer"),f=s.select("g.baselayeroverchoropleth"),d=g.baseLayersOverChoropleth,h=c.selectAll("g.trace.choropleth").data(e,function(t){return t.uid});h.enter().append("g").attr("class","trace choropleth"),h.exit().remove(),h.each(function(e){function n(e,n){if(t.showHover){var r=t.projection(e.properties.ct);c(e),l.loneHover({x:r[0],y:r[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),f=u(e,n),t.graphDiv.emit("plotly_hover",f)}}function i(e,n){t.graphDiv.emit("plotly_click",u(e,n))}var s=m.calcGeoJSON(e,t.topojson),c=r(t,e),u=a(e),f=null,d=o.select(this).selectAll("path.choroplethlocation").data(s);d.enter().append("path").classed("choroplethlocation",!0).on("mouseover",n).on("click",i).on("mouseout",function(){l.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",f)}).on("mousedown",function(){l.loneUnhover(t.hoverContainer)}).on("mouseup",n),d.exit().remove()}),f.selectAll("*").remove();for(var p=0;pp&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},v={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var m={type:"linear"};a.setConvert(m),s=m.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=v.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,a.expand(u,d,g),a.expand(f,h,v);var b=new Array(p);for(c=0;p>c;c++)b[c]=r(d[c])&&r(h[c])?{x:d[c],y:h[c]}:{x:!1,y:!1};return void 0!==typeof s&&o.mergeArray(s,b,"ms"),t.firstscatter=!1,b}},{"../../lib":100,"../../plots/cartesian/axes":122,"./colorscale_calc":180,"./subtypes":195,"fast-isnumeric":12}],178:[function(t,e,n){"use strict";e.exports=function(t){var e,n,r,a,o;for(e=0;e=0;a--)if(o=t[a],"scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}},{}],179:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,c=n.marker,u="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===c||!c.showscale)return void i.autoMargin(t,u);var f=l(c.colorscale),d=c.color,h=c.cmin,p=c.cmax;a(h)||(h=o.aggNums(Math.min,null,d)),a(p)||(p=o.aggNums(Math.max,null,d));var g=e[0].t.cb=s(t,u);g.fillcolor(r.scale.linear().domain(f.map(function(t){return h+t[0]*(p-h)})).range(f.map(function(t){return t[1]}))).filllevels({start:h,end:p,size:(p-h)/254}).options(c.colorbar)()}},{"../../components/colorbar/draw":23,"../../components/colorscale/get_scale":32,"../../lib":100,"../../plots/plots":154,d3:10,"fast-isnumeric":12}],180:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":27,"../../components/colorscale/has_colorscale":33,"./subtypes":195}],181:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],182:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var v=l(t,e,g),m=vB!=N>=B&&(C=z[T-1][0],E=z[T][0],S=C+(E-C)*(B-O)/(N-O),R=Math.min(R,S), -I=Math.max(I,S));R=Math.max(R,0),I=Math.min(I,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:I,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":20,"../../components/errorbars":49,"../../lib":100,"../../plots/cartesian/constants":127,"../../plots/cartesian/graph_interact":129,"./get_trace_color":184}],186:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":130,"./arrays_to_calcdata":175,"./attributes":176,"./calc":177,"./clean_data":178,"./colorbar":179,"./defaults":182,"./hover":185,"./plot":192,"./select":193,"./style":194,"./subtypes":195}],187:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=(Array.isArray(l)?!1:l)||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":30,"../../components/colorscale/has_colorscale":33}],188:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=k.c2p(t[e].y);return n===z||r===z?!1:[n,r]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],z=r.BADNUM,S=.2,C=new Array(t.length),E=0;for(i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,c=f,h=!1):m>y&&(m=y,u=f,h=!0)}if(h?(C[E++]=c,s!==u&&(C[E++]=u)):(u!==l&&(C[E++]=u),s!==c&&(C[E++]=c)),C[E++]=s,i>=t.length||!f)break;C[E++]=f,l=f}}else C[E++]=c}L.push(C.slice(0,E))}return L}},{"../../plots/cartesian/axes":122}],189:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],190:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t){var e=t.marker,n=e.sizeref||1,a=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/n)}:function(t){return t/n};return function(t){var e=o(t/2);return r(e)&&e>0?Math.max(e,a):0}}},{"fast-isnumeric":12}],191:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":20,"../../components/colorscale/defaults":30,"../../components/colorscale/has_colorscale":33,"./subtypes":195}],192:[function(t,e,n){"use strict";function r(t,e,n){var r=e.x(),o=e.y(),i=a.extent(r.range.map(r.l2c)),l=a.extent(o.range.map(o.l2c));n.forEach(function(t,e){var r=t[0].trace;if(c.hasMarkers(r)){var a=r.marker.maxdisplayed;if(0!==a){var o=t.filter(function(t){return t.x>=i[0]&&t.x<=i[1]&&t.y>=l[0]&&t.y<=l[1]}),s=Math.ceil(o.length/a),u=0;n.forEach(function(t,n){var r=t[0].trace;c.hasMarkers(r)&&r.marker.maxdisplayed>0&&e>n&&u++});var f=Math.round(u*s/3+Math.floor(u/3)*s/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+f)%s)&&(t.vis=!0)})}}})}var a=t("d3"),o=t("../../lib"),i=t("../../components/drawing"),l=t("../../components/errorbars"),s=t("../../lib/polygon").tester,c=t("./subtypes"),u=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,n){function d(t){return t.filter(function(t){return t.vis})}r(t,e,n);var h=e.x(),p=e.y(),g=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(n);g.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),g.call(l.plot,e);var v,m,y,x,b="",_=[];g.each(function(t){var e=t[0].trace,n=e.line,r=a.select(this);if(e.visible===!0&&(m=e.fill.charAt(e.fill.length-1),"x"!==m&&"y"!==m&&(m=""),t[0].node3=r,u(t),c.hasLines(e)||"none"!==e.fill)){var o,l,d,g,w,k="",M="";v="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!b?r.append("path").classed("js-fill",!0):null,x&&(y=x.datum(t)),x=r.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(n.shape)?(d=i.steps(n.shape),g=i.steps(n.shape.split("").reverse().join(""))):d=g="spline"===n.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?i.smoothclosed(t.slice(1),n.smoothing):i.smoothopen(t,n.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return g(t.reverse())};var A,T=f(t,{xaxis:h,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(n.width||1,3)/4,linear:"linear"===n.shape}),L=e._polygons=new Array(T.length);for(A=0;A1&&r.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}v?z&&C&&(m?("y"===m?z[1]=C[1]=p.c2p(0,!0):"x"===m&&(z[0]=C[0]=h.c2p(0,!0)),v.attr("d",k+"L"+C+"L"+z+"Z")):v.attr("d",k+"Z")):"tonext"===e.fill.substr(0,6)&&k&&b&&("tonext"===e.fill?y.attr("d",k+"Z"+b+"Z"):y.attr("d",k+"L"+b.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),b=M,_=L}}}),g.selectAll("path:not([d])").remove(),g.append("g").attr("class","points").each(function(t){var e=t[0].trace,n=a.select(this),r=c.hasMarkers(e),l=c.hasText(e);!r&&!l||e.visible!==!0?n.remove():(r&&n.selectAll("path.point").data(e.marker.maxdisplayed?d:o.identity).enter().append("path").classed("point",!0).call(i.translatePoints,h,p),l&&n.selectAll("g").data(e.marker.maxdisplayed?d:o.identity).enter().append("g").append("text").call(i.translatePoints,h,p))})}},{"../../components/drawing":43,"../../components/errorbars":49,"../../lib":100,"../../lib/polygon":106,"./arrays_to_calcdata":175,"./line_points":188,"./subtypes":195,d3:10}],193:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;nr;r++)n[r]=[t.lon[r],t.lat[r]];return{type:"LineString",coordinates:n,trace:t}}function o(t,e){function n(e){var n=t.mockAxis;return c.tickText(n,n.c2l(e),"hover").text+"\xb0"}var r=e.hoverinfo;if("none"===r)return function(t){delete t.textLabel};var a="all"===r?v.hoverinfo.flags:r.split("+"),o=-1!==a.indexOf("location")&&Array.isArray(e.locations),i=-1!==a.indexOf("lon"),l=-1!==a.indexOf("lat"),s=-1!==a.indexOf("text");return function(t){var r=[];o?r.push(t.location):i&&l?r.push("("+n(t.lon)+", "+n(t.lat)+")"):i?r.push("lon: "+n(t.lon)):l&&r.push("lat: "+n(t.lat)),s&&r.push(t.tx||e.text),t.textLabel=r.join("
")}}function i(t){var e=Array.isArray(t.locations);return function(n,r){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:r,lon:n.lon,lat:n.lat,location:e?n.location:null}]}}}var l=t("d3"),s=t("../../plots/cartesian/graph_interact"),c=t("../../plots/cartesian/axes"),u=t("../../lib/topojson_utils").getTopojsonFeatures,f=t("../../lib/geo_location_utils").locationToFeature,d=t("../../lib/array_to_calc_item"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../scatter/subtypes"),v=t("./attributes"),m=e.exports={};m.calcGeoJSON=function(t,e){var n,a,o,i,l=[],s=Array.isArray(t.locations);s?(i=t.locations,n=i.length,a=u(t,e),o=function(t,e){var n=f(t.locationmode,i[e],a);return void 0!==n?n.properties.ct:void 0}):(n=t.lon.length,o=function(t,e){return[t.lon[e],t.lat[e]]});for(var c=0;n>c;c++){var d=o(t,c);if(d){var h={lon:d[0],lat:d[1],location:s?t.locations[c]:null};r(t,h,c),l.push(h)}}return l.length>0&&(l[0].trace=t),l},m.plot=function(t,e){var n=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,function(t){return t.uid});n.enter().append("g").attr("class","trace scattergeo"),n.exit().remove(),n.selectAll("*").remove(),n.each(function(t){var e=l.select(this);g.hasLines(t)&&e.selectAll("path.js-line").data([a(t)]).enter().append("path").classed("js-line",!0)}),n.each(function(e){function n(n,r){if(t.showHover){var a=t.projection([n.lon,n.lat]);d(n),s.loneHover({x:a[0],y:a[1],name:v?e.name:void 0,text:n.textLabel,color:n.mc||(e.marker||{}).color},{container:t.hoverContainer.node()}),y=h(n,r),t.graphDiv.emit("plotly_hover",y)}}function r(e,n){t.graphDiv.emit("plotly_click",h(e,n))}var a=l.select(this),c=g.hasMarkers(e),u=g.hasText(e);if(c||u){var f=m.calcGeoJSON(e,t.topojson),d=o(t,e),h=i(e),p=e.hoverinfo,v="all"===p||-1!==p.indexOf("name"),y=null;c&&a.selectAll("path.point").data(f).enter().append("path").classed("point",!0).on("mouseover",n).on("click",r).on("mouseout",function(){s.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",y)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",n),u&&a.selectAll("g").data(f).enter().append("g").append("text")}}),m.style(t)},m.style=function(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t.opacity}),e.each(function(t){l.select(this).selectAll("path.point").call(p.pointStyle,t),l.select(this).selectAll("text").call(p.textPointStyle,t)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=t.trace,n=e.line||{};l.select(this).call(h.stroke,n.color).call(p.dashLine,n.dash||"",n.width||0)})}},{"../../components/color":20,"../../components/drawing":43,"../../lib/array_to_calc_item":93,"../../lib/geo_location_utils":99,"../../lib/topojson_utils":112,"../../plots/cartesian/axes":122,"../../plots/cartesian/graph_interact":129,"../scatter/subtypes":195,"./attributes":198,d3:10}]},{},[5])(5)}); \ No newline at end of file +var a=t("fast-isnumeric"),o=t("../../plots/plots"),i=t("../../plots/cartesian/axes"),l=t("./compute_error");e.exports=function(t){for(var e=t.calcdata,n=0;nl;l++)i[l]={x:n[l],y:a[l]};return i[0].trace=t,r.calc({calcdata:[i],_fullLayout:e}),i},r.plot=t("./plot"),r.style=t("./style"),r.hoverInfo=function(t,e,n){(e.error_y||{}).visible&&(n.yerr=t.yh-t.y,e.error_y.symmetric||(n.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(n.xerr=t.xh-t.x,e.error_x.symmetric||(n.xerrneg=t.x-t.xs))}},{"./attributes":45,"./calc":46,"./defaults":48,"./plot":50,"./style":51}],50:[function(t,e,n){"use strict";function r(t,e,n){var r={x:e.c2p(t.x),y:n.c2p(t.y)};return void 0!==t.yh&&(r.yh=n.c2p(t.yh),r.ys=n.c2p(t.ys),o(r.ys)||(r.noYS=!0,r.ys=n.c2p(t.ys,!0))),void 0!==t.xh&&(r.xh=e.c2p(t.xh),r.xs=e.c2p(t.xs),o(r.xs)||(r.noXS=!0,r.xs=e.c2p(t.xs,!0))),r}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../lib"),l=t("../../traces/scatter/subtypes");e.exports=function(t,e){var n=e.x(),s=e.y();t.each(function(t){var e=t[0].trace,c=e.error_x||{},u=e.error_y||{},f=l.hasMarkers(e)&&e.marker.maxdisplayed>0;if(u.visible||c.visible){var d=a.select(this).selectAll("g.errorbar").data(i.identity);d.enter().append("g").classed("errorbar",!0),d.each(function(t){var e=a.select(this),i=r(t,n,s);if(!f||t.vis){var l;if(u.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var d=u.width;l="M"+(i.x-d)+","+i.yh+"h"+2*d+"m-"+d+",0V"+i.ys,i.noYS||(l+="m-"+d+",0h"+2*d),e.append("path").classed("yerror",!0).attr("d",l)}if(c.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var h=(c.copy_ystyle?u:c).width;l="M"+i.xh+","+(i.y-h)+"v"+2*h+"m0,-"+h+"H"+i.xs,i.noXS||(l+="m0,-"+h+"v"+2*h),e.append("path").classed("xerror",!0).attr("d",l)}}})}})}},{"../../lib":100,"../../traces/scatter/subtypes":195,d3:10,"fast-isnumeric":12}],51:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":20,d3:10}],52:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":127}],53:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var l=0;2>l;l++){var s={_fullLayout:n},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,a=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],57:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":97,"../../plots/font_attributes":140,"../color/attributes":19}],58:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],59:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/plots"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n){function l(t,e){return r.coerce(d,h,o,t,e)}for(var s,c,u,f,d=t.legend||{},h=e.legend={},p=0,g="normal",v=0;v1);if(y!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),r.coerceFont(l,"font",e.font),l("orientation"),"h"===h.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(s=0,u="left",c=1.1,f="bottom"):(s=0,u="left",c=-.1,f="top")}l("traceorder",g),i.isGrouped(e.legend)&&l("tracegroupgap"),l("x",s),l("xanchor",u),l("y",c),l("yanchor",f),r.noneOrAll(d,h,["x","y"])}}},{"../../lib":100,"../../plots/plots":154,"./attributes":57,"./helpers":62}],60:[function(t,e,n){"use strict";function r(t,e){function n(n){u.util.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=d.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,a.legend.font).text(c),e._context.editable&&!l?f.call(u.util.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" "),u.restyle(e,"name",t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(d.traceIs(l,"pie")){var f=o.label,h=n.indexOf(f);-1===h?n.push(f):n.splice(h,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),h=d[0].length||1;n=s*h,r=u.node()&&p.bBox(u.node()).width;var g=s*(.3+(1-h)/2);u.attr("y",g),d.attr("y",g)}n=Math.max(n,16)+3,o.attr({x:0,y:-n/2,height:n}),a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=x.isGrouped(a);if(x.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),n.selectAll(".legendtoggle").attr("width",(t._context.editable?0:a.width)+40),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height);else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;d>u;u++){var h=s[u].map(function(t){return t[0].width}),p=40+Math.max.apply(null,h);a.width+=a.tracegroupgap+p,l.push(a.width)}e.each(function(t,e){f.setTranslate(this,l[e],0)}),e.each(function(){var t=c.select(this),e=t.selectAll("g.traces"),n=0;e.each(function(t){var e=t[0],r=e.height;f.setTranslate(this,0,5+o+n+r/2),n+=r}),a.height=Math.max(a.height,n)}),a.height+=10+2*o,a.width+=2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}else{a.width=0,a.height=0;var g=0,v=0,m=0,y=0;n.each(function(t){m=Math.max(40+t[0].width,m)}),n.each(function(t){var e=t[0],n=m,i=a.tracegroupgap||5;o+y+i+n>r.width-(r.margin.r+r.margin.l)&&(y=0,g+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+y,5+o+e.height/2+g),a.width+=i+n,a.height=Math.max(a.height,e.height),y+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}}function l(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center");var a="top";b.isBottomAnchor(n)?a="bottom":b.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../dragelement"),p=t("../drawing"),g=t("../color"),v=t("./constants"),m=t("./get_legend_data"),y=t("./style"),x=t("./helpers"),b=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(p.setRect,I,t,v.scrollBarWidth,v.scrollBarHeight),M.select("rect").attr({y:x.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var x=n.legend,_=n.showlegend&&m(t.calcdata,x),w=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({"class":"legend","pointer-events":"all"});var M=n._topdefs.selectAll("#"+o).data([0]);M.enter().append("clipPath").attr("id",o).append("rect");var A=k.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(g.stroke,x.bordercolor),A.call(g.fill,x.bgcolor),A.style("stroke-width",x.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var z=T.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var C=0!==k.enter().size();C&&(i(t,z,S),l(t));var E=0,O=n.width,N=0,P=n.height;i(t,z,S),x.height>P?s(t):l(t);var j=n._size,D=j.l+j.w*x.x,R=j.t+j.h*(1-x.y);b.isRightAnchor(x)?D-=x.width:b.isCenterAnchor(x)&&(D-=x.width/2),b.isBottomAnchor(x)?R-=x.height:b.isMiddleAnchor(x)&&(R-=x.height/2);var I=x.width,q=j.w;I>q?(D=j.l,I=q):(D+I>O&&(D=O-I),E>D&&(D=E),I=Math.min(O-D,x.width));var F=x.height,B=j.h;F>B?(R=j.t,F=B):(R+F>P&&(R=P-F),N>R&&(R=N),F=Math.min(P-R,x.height)),f.setTranslate(k,D,R);var H,V,U=F-v.scrollBarHeight-2*v.scrollBarMargin,G=x.height-F;if(x.height<=F||t._context.staticPlot)A.attr({width:I-x.borderwidth,height:F-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),f.setTranslate(T,0,0),M.select("rect").attr({width:I-2*x.borderwidth,height:F-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth}),T.call(p.setClipUrl,o);else{H=v.scrollBarMargin,V=T.attr("data-scroll")||0,A.attr({width:I-2*x.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:F-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),M.select("rect").attr({width:I-2*x.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:F-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth-V}),T.call(p.setClipUrl,o),C&&e(H,V),k.on("wheel",null),k.on("wheel",function(){V=f.constrain(T.attr("data-scroll")-c.event.deltaY/U*G,-G,0),H=v.scrollBarMargin-V/G*U,e(H,V),c.event.preventDefault()}),L.on(".drag",null),T.on(".drag",null);var Z=c.behavior.drag().on("drag",function(){H=f.constrain(c.event.y-v.scrollBarHeight/2,v.scrollBarMargin,v.scrollBarMargin+U),V=-(H-v.scrollBarMargin)/U*G,e(H,V)});L.call(Z),T.call(Z)}if(t._context.editable){var Y,X,Q,$;k.classed("cursor-move",!0),h.init({element:k.node(),prepFn:function(){var t=f.getTranslate(k);Q=t.x,$=t.y},moveFn:function(t,e){var n=Q+t,r=$+e;f.setTranslate(k,n,r),Y=h.align(n,0,j.l,j.l+j.w,x.xanchor),X=h.align(r,0,j.t+j.h,j.t,x.yanchor)},doneFn:function(e){e&&void 0!==Y&&void 0!==X&&u.relayout(t,{"legend.x":Y,"legend.y":X})}})}}}},{"../../lib":100,"../../plotly":119,"../../plots/plots":154,"../color":20,"../dragelement":41,"../drawing":43,"./anchor_utils":56,"./constants":58,"./get_legend_data":61,"./helpers":62,"./style":64,d3:10}],61:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[n]]):l[t].push([n]);else{var r="~~i"+f;s.push(r),l[r]=[[n]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;oo;o++)m=l[s[o]],y[o]=a.isReversed(e)?m.reverse():m;else{for(y=[new Array(x)],o=0;x>o;o++)m=l[s[o]][0],y[0][a.isReversed(e)?x-o-1:o]=m;x=1}return e._lgroupsLength=x,y}},{"../../plots/plots":154,"./helpers":62}],62:[function(t,e,n){"use strict";var r=t("../../plots/plots");n.legendGetsTrace=function(t){return t.visible&&r.traceIs(t,"showLegend")},n.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},n.isVertical=function(t){return"h"!==t.orientation},n.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":154}],63:[function(t,e,n){"use strict";var r=e.exports={};r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw"),r.style=t("./style")},{"./attributes":57,"./defaults":59,"./draw":60,"./style":64}],64:[function(t,e,n){"use strict";function r(t){var e=t[0].trace,n=e.visible&&e.fill&&"none"!==e.fill,r=h.hasLines(e),a=s.select(this).select(".legendfill").selectAll("path").data(n?[t]:[]);a.enter().append("path").classed("js-fill",!0),a.exit().remove(),a.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var o=s.select(this).select(".legendlines").selectAll("path").data(r?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(f.lineGroupStyle)}function a(t){function e(t,e,n){var r=c.nestedProperty(i,t).get(),a=Array.isArray(r)&&e?e(r):r;if(n){if(an[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),u=h.hasText(i),d=h.hasLines(i);if(l||u||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(o,p)],a=c.minExtend(i,g)}var v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?r:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../lib"),u=t("../../plots/plots"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":100,"../../plots/plots":154,"../../traces/pie/style_one":174,"../../traces/scatter/subtypes":195,"../color":20,"../drawing":43,d3:10}],65:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,f=(1+u)/2,d=(1-u)/2,h=c.Axes.list(t,null,!0),p=0;py;y++){var x=l[y];d=m[x]={};for(var b=0;b1)return r(["resetViews","toggleHover"]),i(v,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||m||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(v,n)}function a(t){for(var e=s.Axes.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var v=u("bgcolor");u("activecolor",i.contrast(v,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":100,"../color":20,"./attributes":68,"./button_attributes":69,"./constants":70}],72:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;re){var n=e;e=t,t=n}l.setAttributes(w,{"data-min":t,"data-max":e}),l.setAttributes(N,{x:t,width:e-t}),l.setAttributes(A,{width:t}),l.setAttributes(T,{x:e,width:p-e}),l.setAttributes(L,{transform:"translate("+(t-v-1)+")"}),l.setAttributes(C,{transform:"translate("+e+")"})}var f=t._fullLayout,d=f._infolayer.selectAll("g.range-slider"),h=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*h.thickness,v=2,m=Math.floor(h.borderwidth/2),y=f.margin.l,x=f.height-g-f.margin.b,b=0,_=p,w=document.createElementNS(i,"g");l.setAttributes(w,{"class":"range-slider","data-min":b,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+x+")"});var k=document.createElementNS(i,"rect"),M=h.borderwidth%2===0?h.borderwidth:h.borderwidth-1;l.setAttributes(k,{fill:h.bgcolor,stroke:h.bordercolor,"stroke-width":h.borderwidth,height:g+M,width:p+M,transform:"translate(-"+m+", -"+m+")","shape-rendering":"crispEdges"});var A=document.createElementNS(i,"rect");l.setAttributes(A,{x:0,width:b,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(i,"rect");l.setAttributes(T,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var L=document.createElementNS(i,"g"),z=document.createElementNS(i,"rect"),S=document.createElementNS(i,"rect");l.setAttributes(L,{transform:"translate("+(b-v-1)+")"}),l.setAttributes(z,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),l.setAttributes(S,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(L,[S,z]);var C=document.createElementNS(i,"g"),E=document.createElementNS(i,"rect"),O=document.createElementNS(i,"rect");l.setAttributes(C,{transform:"translate("+_+")"}),l.setAttributes(E,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),l.setAttributes(O,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(C,[O,E]);var N=document.createElementNS(i,"rect");l.setAttributes(N,{x:b,width:_-b,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function n(t){var n,r,f=+t.clientX-o;switch(a){case N:w.style.cursor="ew-resize",n=+l+f,r=+s+f,u(n,r),c(e(n),e(r));break;case z:w.style.cursor="col-resize",n=+l+f,r=+s,u(n,r),c(e(n),e(r));break;case E:w.style.cursor="col-resize",n=+l,r=+s+f,u(n,r),c(e(n),e(r));break;default:w.style.cursor="ew-resize",n=i,r=i+f,u(n,r),c(e(n),e(r))}}function r(){window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r),w.style.cursor="auto"}var a=t.target,o=t.clientX,i=o-w.getBoundingClientRect().left,l=w.getAttribute("data-min"),s=w.getAttribute("data-max");window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)}),h.range||(h.range=a.getAutoRange(f.xaxis));var P=s(t,p,g);l.appendChildren(w,[k,P,A,T,N,L,C]),n(f.xaxis.range[0],f.xaxis.range[1]),d.data([0]).enter().append(function(){return h.setRange=n,w})}},{"../../constants/xmlns_namespaces":90,"../../lib":100,"../../plotly":119,"../../plots/cartesian/axes":122,"./helpers":78,"./range_plot":80}],77:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(t,e){return r.coerce(l,s,a,t,e)}if(t[n].rangeslider){var l=r.isPlainObject(t[n].rangeslider)?t[n].rangeslider:{},s=e[n].rangeslider={};if(i("bgcolor"),i("bordercolor"),i("borderwidth"),i("thickness"),i("visible"),i("range"),s.range&&!e[n].autorange){var c=s.range,u=e[n].range;c[0]=Math.min(c[0],u[0]),c[1]=Math.max(c[1],u[1])}else e[n]._needsExpand=!0;s.visible&&o.forEach(function(t){var n=e[t]||{};n.fixedrange=!0,e[t]=n})}}},{"../../lib":100,"./attributes":75}],78:[function(t,e,n){"use strict";n.setAttributes=function(t,e){for(var n in e)t.setAttribute(n,e[n])},n.appendChildren=function(t,e){for(var n=0;ns;s++){var c=l[s],u={_fullLayout:e},f=A.coerceRef(t,r,u,c);if("path"!==i){var d=.25,h=.75;if("paper"!==f){var p=A.getFromId(u,f),g=o(p);d=g(p.range[0]+d*(p.range[1]-p.range[0])),h=g(p.range[0]+h*(p.range[1]-p.range[0]))}n(c+"0",d),n(c+"1",h)}}return"path"===i?n("path"):M.noneOrAll(t,r,["x0","x1","y0","y1"]),r}function a(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function i(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function l(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function s(t,e,n){for(var r=0;re;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),C.draw(t,a)}function f(t,e,n,i){function l(n){var r={"data-index":e,"fill-rule":"evenodd",d:x(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",C.opacity).call(T.stroke,a).call(T.fill,C.fillcolor).call(L.dashLine,C.line.dash,C.line.width);E&&o.call(L.setClipUrl,"clip"+t._fullLayout._uid+E),t._context.editable&&d(t,o,C,e)}var s,c;h(t,e).selectAll('[data-index="'+e+'"]').remove();var u=t.layout.shapes[e];if(u){var f={xref:u.xref,yref:u.yref},g={};"string"==typeof n&&n?g[n]=i:M.isPlainObject(n)&&(g=n);var v=Object.keys(g);for(s=0;ss;s++){var b=y[s];if(void 0===g[b]&&void 0!==u[b]){var _,w=b.charAt(0),k=A.getFromId(t,A.coerceRef(f,{},t,w)),z=A.getFromId(t,A.coerceRef(u,{},t,w)),S=u[b];void 0!==g[w+"ref"]&&(k?(_=a(k)(S),S=(_-k.range[0])/(k.range[1]-k.range[0])):S=(S-z.domain[0])/(z.domain[1]-z.domain[0]),z?(_=z.range[0]+S*(z.range[1]-z.range[0]),S=o(z)(_)):S=k.domain[0]+S*(k.domain[1]-k.domain[0])),u[b]=S}}var C=r(u,t._fullLayout);t._fullLayout.shapes[e]=C;var E;if("below"!==C.layer)E=(C.xref+C.yref).replace(/paper/g,""),l(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)E="",l(t._fullLayout._shapeLowerLayer);else{var O,N=t._fullLayout._plots||{},P=Object.keys(N);for(s=0,c=P.length;c>s;s++)O=N[P[s]],E=P[s],p(t,C,O)&&l(O.shapelayer)}}}function d(t,e,n,r){function a(t){var n=W.right-W.left,r=W.bottom-W.top,a=t.clientX-W.left,o=t.clientY-W.top,i=n>X&&r>Q&&!t.shiftKey?z.getCursor(a/n,1-o/r):"move";S(e,i),Y=i.split("-")[0]}function o(e){B=A.getFromId(t,n.xref),H=A.getFromId(t,n.yref),V=m(t,B),U=m(t,H,!0),G=y(t,B),Z=y(t,H,!0);var o="shapes["+r+"]";"path"===n.type?(q=n.path,F=o+".path"):(u=V(n.x0),f=U(n.y0),d=V(n.x1),h=U(n.y1),p=o+".x0",g=o+".y0",_=o+".x1",w=o+".y1"),d>u?(L=u,N=o+".x0",R="x0",C=d,P=o+".x1",I="x1"):(L=d,N=o+".x1",R="x1",C=u,P=o+".x0",I="x0"),h>f?(M=f,E=o+".y0",j="y0",T=h,O=o+".y1",D="y1"):(M=h,E=o+".y1",j="y1",T=f,O=o+".y0",D="y0"),c={},a(e),$.moveFn="move"===Y?l:s}function i(n){S(e),n&&k.relayout(t,c)}function l(r,a){if("path"===n.type){var o=function(t){return G(V(t)+r)};B&&"date"===B.type&&(o=v(o));var i=function(t){return Z(U(t)+a)};H&&"date"===H.type&&(i=v(i)),n.path=b(q,o,i),c[F]=n.path}else c[p]=n.x0=G(u+r),c[g]=n.y0=Z(f+a),c[_]=n.x1=G(d+r),c[w]=n.y1=Z(h+a);e.attr("d",x(t,n))}function s(r,a){if("path"===n.type){var o=function(t){return G(V(t)+r)};B&&"date"===B.type&&(o=v(o));var i=function(t){return Z(U(t)+a)};H&&"date"===H.type&&(i=v(i)),n.path=b(q,o,i),c[F]=n.path}else{var l=~Y.indexOf("n")?M+a:M,s=~Y.indexOf("s")?T+a:T,u=~Y.indexOf("w")?L+r:L,f=~Y.indexOf("e")?C+r:C;s-l>Q&&(c[E]=n[j]=Z(l),c[O]=n[D]=Z(s)),f-u>X&&(c[N]=n[R]=G(u),c[P]=n[I]=G(f))}e.attr("d",x(t,n))}var c,u,f,d,h,p,g,_,w,M,T,L,C,E,O,N,P,j,D,R,I,q,F,B,H,V,U,G,Z,Y,X=10,Q=10,$={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=$.element.getBoundingClientRect();z.init($)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):M.log("getShapeLayer: undefined shape: index",e),r}function p(t,e,n){var r=k.Axes.getFromId(t,n.id,"x")._id,a=k.Axes.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function v(t){return function(e){return t(e).replace(" ","_")}}function m(t,e,n){var r,o=t._fullLayout._size;if(e){var i=a(e);r=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(r=g(r))}else r=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return r}function y(t,e,n){var r,a=t._fullLayout._size;if(e){var i=o(e);r=function(t){return i(e.p2l(t-e._offset))}}else r=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return r}function x(t,e){var n,r,o,i,l=e.type,s=A.getFromId(t,e.xref),c=A.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=a(s),r=function(t){return s._offset+s.l2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(o=a(c),i=function(t){return c._offset+c.l2p(o(t,!0))}):i=function(t){return u.t+u.h*(1-t)},"path"===l)return s&&"date"===s.type&&(r=g(r)),c&&"date"===c.type&&(i=g(i)),C.convertPath(e.path,r,i);var f=r(e.x0),d=r(e.x1),h=i(e.y0),p=i(e.y1);if("line"===l)return"M"+f+","+h+"L"+d+","+p;if("rect"===l)return"M"+f+","+h+"H"+d+"V"+p+"H"+f+"Z";var v=(f+d)/2,m=(h+p)/2,y=Math.abs(v-f),x=Math.abs(m-h),b="A"+y+","+x,_=v+y+","+m,w=v+","+(m-x);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function b(t,e,n){return t.replace(E,function(t){var r=0,a=t.charAt(0),o=N[a],i=P[a],l=j[a],s=t.substr(1).replace(O,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}function _(t,e,n,r,a){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(n)];if(r){var i,l,s,c,u,f=1/0,d=-(1/0),h=r.match(E);for("date"===t.type&&(o=g(o)),i=0;iu&&(f=u),u>d&&(d=u)));return d>=f?[f,d]:void 0}}var w=t("fast-isnumeric"),k=t("../../plotly"),M=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),L=t("../drawing"),z=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var n=t.shapes||[],a=e.shapes=[],o=0;ol&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),M.log("Ignoring extra params in segment "+t)),a+s})},C.calcAutorange=function(t){var e,n,r,a,o,i=t._fullLayout,l=i.shapes;if(l.length&&t._fullData.length)for(e=0;ed?n=d:(u.left-=x.offsetLeft,u.right-=x.offsetLeft,u.top-=x.offsetTop,u.bottom-=x.offsetTop,x.selection.each(function(){var t=s.bBox(this);l.bBoxIntersect(u,t,c)&&(n=Math.max(n,i*(t[x.side]-u[o])+c))}),n=Math.min(d,n)),n>0||0>d){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,S=E,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,v=n.propName,m=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var E="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(u.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",z)}},{"../../lib":100,"../../lib/svg_text_utils":111,"../../plotly":119,"../../plots/plots":154,"../color":20,"../drawing":43,d3:10,"fast-isnumeric":12}],84:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:i,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":97,"../../plots/font_attributes":140,"../color/attributes":19}],85:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],86:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("x"), +r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(s.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),s.exit().remove(),s.exit().size()&&m(t),0!==n.length){var c=s.selectAll("g."+T.headerGroupClassName).data(n,a);c.enter().append("g").classed(T.headerGroupClassName,!0);var u=s.selectAll("g."+T.buttonGroupClassName).data([0]);u.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&u.call(v).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){y.select(this).remove(),u.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],90:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],91:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.16.3",n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=r.register,n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=r.Snapshot,n.PlotSchema=r.PlotSchema,n.Queue=r.Queue,n.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":116,"./plot_api/to_image":117,"./plot_api/validate":118,"./plotly":119,"./snapshot/download":162,d3:10}],92:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],93:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],94:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)}},"boolean":{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(i(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n?!0:"string"!=typeof t?!1:!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var s=i[0].split("-");if(s.length>3||3!==s.length&&i[1])return!1;if(4===s[0].length)n=Number(s[0]);else{if(2!==s[0].length)return!1;var c=(new Date).getFullYear();n=((Number(s[0])-c+70)%100+200)%100+c-70}return l(n)?1===s.length?new Date(n,0,1).getTime():(r=Number(s[1])-1,s[1].length>2||!(r>=0&&11>=r)?!1:2===s.length?new Date(n,r,1).getTime():(a=Number(s[2]),s[2].length>2||!(a>=1&&31>=a)?!1:(a=new Date(n,r,a).getTime(),i[1]?(s=i[1].split(":"),s.length>3?!1:(o=Number(s[0]),s[0].length>2||!(o>=0&&23>=o)?!1:(a+=36e5*o,1===s.length?a:(r=Number(s[1]),s[1].length>2||!(r>=0&&59>=r)?!1:(a+=6e4*r,2===s.length?a:(t=Number(s[2]),t>=0&&60>t?a+1e3*t:!1)))))):a))):!1},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){if("undefined"==typeof i)return void s.error("d3 is not defined.");e||(e=0);var n=new Date(t),a=i.time.format("%Y-%m-%d")(n);return 7776e6>e?(a+=" "+r(n.getHours(),2),432e6>e&&(a+=":"+r(n.getMinutes(),2),108e5>e&&(a+=":"+r(n.getSeconds(),2),3e5>e&&(a+="."+r(n.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var c={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"]},u={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"]},f=i.time.format.utc,d={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){d[t].D.push(f(e)),["H","I","D"].forEach(function(n){c[n].forEach(function(r){var a=d[t][n];a.push(f(e+"~"+r)),a.push(f(r+"~"+e))})})})});var h=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,v=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},x=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,k=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return M[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(h,p).replace(g,"").replace(v,"~").replace(m,y).replace(k,A).trim().replace(T,"");var e,n,r=null,i=a(t),l=o(t);e=d[i][l],n=e.length;for(var s=0;n>s&&!(r=e[s].parse(t));s++);if(!(r instanceof Date))return!1;var c=r.getTimezoneOffset();return r.setTime(r.getTime()+60*c*1e3),r}},{"../lib":100,d3:10,"fast-isnumeric":12}],96:[function(t,e,n){"use strict";var r=t("events").EventEmitter,a={init:function(t){if(t._ev instanceof r)return t;var e=new r;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(n,r){"undefined"!=typeof jQuery&&jQuery(t).trigger(n,r),e.emit(n,r)},t},triggerHandler:function(t,e,n){var r,a;"undefined"!=typeof jQuery&&(r=jQuery(t).triggerHandler(e,n));var o=t._ev;if(!o)return r;var i=o._events[e];if(!i)return r;"function"==typeof i&&(i=[i]);for(var l=i.pop(),s=0;sm;m++){s=t[m];for(c in s)u=g[c],f=s[c],l&&i(f)?g[c]=f:e&&f&&(o(f)||(d=i(f)))?(d?(d=!1,h=u&&i(u)?u:[]):h=u&&o(u)?u:{},g[c]=a([h,f],e,n,l)):("undefined"!=typeof f||n)&&(g[c]=f)}return g}var o=t("./is_plain_object.js"),i=Array.isArray;n.extendFlat=function(){return a(arguments,!1,!1,!1)},n.extendDeep=function(){return a(arguments,!0,!1,!1)},n.extendDeepAll=function(){return a(arguments,!0,!0,!1)},n.extendDeepNoArrays=function(){return a(arguments,!0,!1,!0)}},{"./is_plain_object.js":101}],98:[function(t,e,n){"use strict";e.exports=function(t){for(var e=[],n=0;nn?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.randstr=function d(t,e,n){if(n||(n=16),void 0===e&&(e=24),0>=e)return"0";var r,a,o,i=Math.log(Math.pow(2,e))/Math.log(n),l="";for(r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var s=i-Math.floor(i);for(r=0;r-1||c!==1/0&&c>=Math.pow(2,e)?d(t,e,n):l},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;s>n;n++)c[n]=(1-Math.cos(Math.PI*(n+1)/e))/(2*e);for(n=0;i>n;n++){for(o=0,r=0;s>r;r++)a=n+r+1-e,-i>a?a-=l*Math.round(a/l):a>=l&&(a-=l*Math.floor(a/l)),0>a?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;ra;a++)e[a][n]=t[a]},a.minExtend=function(t,e){var n={};"object"!=typeof e&&(e={});var r,o,i,l=3,s=Object.keys(t);for(r=0;r1?r+o[1]:"";if(a&&(o.length>1||i.length>4))for(;n.test(i);)i=i.replace(n,"$1"+a+"$2");return i+l}},{"./coerce":94,"./dates":95,"./extend":97,"./is_plain_object":101,"./loggers":102,"./matrix":103,"./nested_property":104,"./notifier":105,"./search":108,"./stats":110,d3:10}],101:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],102:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;er;r++)n[r]=new Array(e);return n},n.transposeRagged=function(t){var e,n,r=0,a=t.length;for(e=0;a>e;e++)r=Math.max(r,t[e].length);var o=new Array(r);for(e=0;r>e;e++)for(o[e]=new Array(a),n=0;a>n;n++)o[e][n]=t[n][e];return o},n.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var r,a,o=t.length;if(t[0].length)for(r=new Array(o),a=0;o>a;a++)r[a]=n.dot(t[a],e);else if(e[0].length){var i=n.transposeRagged(e);for(r=new Array(i.length),a=0;aa;a++)r+=t[a]*e[a];return r},n.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},n.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},n.rotationXYMatrix=function(t,e,r){return n.dot(n.dot(n.translationMatrix(e,r),n.rotationMatrix(t)),n.translationMatrix(-e,-r))},n.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var r=1===arguments.length?e[0]:[e[0],e[1]];return n.dot(t,[r[0],r[1],1]).slice(0,2)}},n.apply2DTransform2=function(t){var e=n.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],104:[function(t,e,n){"use strict";function r(t,e){return function(){var n,a,o,i,l,s=t;for(i=0;i=0;e--){if(r=t[e],i=!1,Array.isArray(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");ln||n>o||i>r||r>l?!1:!e||!c(t)}function n(t,e){var n=t[0],s=t[1];if(a>n||n>o||i>s||s>l)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],v=r[0][1],m=0;for(c=1;p>c;c++)if(u=g,f=v,g=r[c][0],v=r[c][1],d=Math.min(u,g),!(d>n||n>Math.max(u,g)||s>Math.max(f,v)))if(s=s&&n!==d&&m++}return m%2===1}var r=t.slice(),a=r[0][0],o=a,i=r[0][1],l=i;r.push(r[0]);for(var s=1;so;o++)if(i=[t[o][0]-s[0],t[o][1]-s[1]],l=r(i,c),0>l||l>u||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":103}],107:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;nt}function a(t,e){return e>=t}function o(t,e){return t>e}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("../lib");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;d>f&&h++<100;)c=Math.floor((f+d)/2),u(e[c],t)?f=c+1:d=c;return h>90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t; +},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;r>l;l++)e[l+1]>e[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;o>a&&i++<100;)r=c((a+o)/2),e[r]<=t?a=r+l:o=r-s;return e[a]}},{"../lib":100,"fast-isnumeric":12}],109:[function(t,e,n){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],110:[function(t,e,n){"use strict";var r=t("fast-isnumeric");n.aggNums=function(t,e,a,o){var i,l;if(o||(o=a.length),r(e)||(e=!1),Array.isArray(a[0])){for(l=new Array(o),i=0;o>i;i++)l[i]=n.aggNums(t,e,a[i]);a=l}for(i=0;o>i;i++)r(e)?r(a[i])&&(e=t(+e,+a[i])):e=a[i];return e},n.len=function(t){return n.aggNums(function(t){return t+1},0,t)},n.mean=function(t,e){return e||(e=n.len(t)),n.aggNums(function(t,e){return t+e},0,t)/e},n.variance=function(t,e,a){return e||(e=n.len(t)),r(a)||(a=n.mean(t,e)),n.aggNums(function(t,e){return t+Math.pow(e-a,2)},0,t)/e},n.stdev=function(t,e,r){return Math.sqrt(n.variance(t,e,r))},n.interp=function(t,e){if(!r(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":12}],111:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,-1===v.indexOf(u.protocol)?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var v=d.getPlotDiv(l.node());(v&&v._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({"class":p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],v=parseInt(l.style("font-size"),10)||r(l,"height"),m=-v/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,m-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-d/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(m," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":89,"../constants/xmlns_namespaces":90,"../lib":100,d3:10}],112:[function(t,e,n){"use strict";var r=e.exports={},a=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson").feature;r.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},r.getTopojsonPath=function(t,e){return t+e+".json"},r.getTopojsonFeatures=function(t,e){var n=a[t.locationmode],r=e.objects[n];return o(e,r).features}},{"../plots/geo/constants":141,topojson:15}],113:[function(t,e,n){"use strict";function r(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function a(t){Array.isArray(t._promises)&&t._promises.length>0&&P.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),N.defaultConfig.setBackground(t,e)}function i(t,e){t._context||(t._context=P.extendFlat({},N.defaultConfig));var n=t._context;e&&(Object.keys(e).forEach(function(t){t in n&&("setBackground"===t&&"opaque"===e[t]?n[t]=o:n[t]=e[t])}),e.plot3dPixelRatio&&!n.plotGlPixelRatio&&(n.plotGlPixelRatio=n.plot3dPixelRatio)),n.staticPlot&&(n.editable=!1,n.autosizable=!1,n.scrollZoom=!1,n.doubleClick=!1,n.showTips=!1,n.showLink=!1,n.displayModeBar=!1)}function l(t,e,n){var r=C.select(t).selectAll(".plot-container").data([0]);r.enter().insert("div",":first-child").classed("plot-container plotly",!0);var a=r.selectAll(".svg-container").data([0]);a.enter().append("div").classed("svg-container",!0).style("position","relative"),a.html(""),e&&(t.data=e),n&&(t.layout=n),N.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(k(t,{}),t._fullLayout.autosize=n.autosize=!0),a.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=N.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},a.node()),t.framework.setUndoPoint();var o=t.framework.svg(),i=1,l=t._fullLayout.title;""!==l&&l||(i=0);var s="Click to enter title",c=function(){this.call(N.util.convertToTspans)},u=o.select(".title-group text").call(c);if(t._context.editable){u.attr({"data-unformatted":l}),l&&l!==s||(i=.2,u.attr({"data-unformatted":s}).text(s).style({opacity:i}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(N.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(c),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(c)})};u.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),R.addLinks(t),Promise.resolve()}function s(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var r=N.Axes.list({_fullLayout:t});for(e=0;ee;e++){var i=t.annotations[e];i.ref&&("paper"===i.ref?(i.xref="paper",i.yref="paper"):"data"===i.ref&&(i.xref="x",i.yref="y"),delete i.ref),c(i,"xref"),c(i,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(P.warn("Shapes must be an array."),delete t.shapes);var l=(t.shapes||[]).length;for(e=0;l>e;e++){var s=t.shapes[e];c(s,"xref"),c(s,"yref")}var u=t.legend;u&&(u.x>3?(u.x=1.02,u.xanchor="left"):u.x<-2&&(u.x=-.02,u.xanchor="right"),u.y>3?(u.y=1.02,u.yanchor="bottom"):u.y<-2&&(u.y=-.02,u.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=R.getSubplotIds(t,"gl3d");for(e=0;en;++n)x[n]=v[e]+m*y[2+4*n];h.camera={eye:{x:x[0],y:x[1],z:x[2]},center:{x:v[0],y:v[1],z:v[2]},up:{x:y[1],y:y[5],z:y[9]}},delete h.cameraposition}}return q.clean(t),t}function c(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=N.Axes.cleanId(n,r))}function u(t,e){for(var n=[],r=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),a=0;ao&&(l=P.randstr(r),-1!==n.indexOf(l));o++);i.uid=P.randstr(r),r.push(i.uid)}if(n.push(i.uid),"histogramy"===i.type&&"xbins"in i&&!("ybins"in i)&&(i.ybins=i.xbins,delete i.xbins),i.error_y&&"opacity"in i.error_y){var s=q.defaults,c=i.error_y.color||(R.traceIs(i,"bar")?q.defaultLine:s[a%s.length]);i.error_y.color=q.addOpacity(q.rgb(c),q.opacity(c)*i.error_y.opacity),delete i.error_y.opacity}if("bardir"in i&&("h"!==i.bardir||!R.traceIs(i,"bar")&&"histogram"!==i.type.substr(0,9)||(i.orientation="h",_(i)),delete i.bardir),"histogramy"===i.type&&_(i),"histogramx"!==i.type&&"histogramy"!==i.type||(i.type="histogram"),"scl"in i&&(i.colorscale=i.scl,delete i.scl),"reversescl"in i&&(i.reversescale=i.reversescl,delete i.reversescl),i.xaxis&&(i.xaxis=N.Axes.cleanId(i.xaxis,"x")),i.yaxis&&(i.yaxis=N.Axes.cleanId(i.yaxis,"y")),R.traceIs(i,"gl3d")&&i.scene&&(i.scene=R.subplotsRegistry.gl3d.cleanId(i.scene)),R.traceIs(i,"pie")||(Array.isArray(i.textposition)?i.textposition=i.textposition.map(f):i.textposition&&(i.textposition=f(i.textposition))),R.traceIs(i,"2dMap")&&("YIGnBu"===i.colorscale&&(i.colorscale="YlGnBu"),"YIOrRd"===i.colorscale&&(i.colorscale="YlOrRd")),R.traceIs(i,"markerColorscale")&&i.marker){var u=i.marker;"YIGnBu"===u.colorscale&&(u.colorscale="YlGnBu"),"YIOrRd"===u.colorscale&&(u.colorscale="YlOrRd")}if("surface"===i.type&&P.isPlainObject(i.contours)){var h=["x","y","z"];for(o=0;or?o.push(a+r):o.push(r);return o}function g(t,e,n){var r,a;for(r=0;r=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||0>a&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function v(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&g(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function m(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&s0){var l=w(t._boundingBoxMargins),s=l.left+l.right,c=l.bottom+l.top,u=o._container.node().getBoundingClientRect(),f=1-2*i.frameMargins;a=Math.round(f*(u.width-s)),r=Math.round(f*(u.height-c))}else n=window.getComputedStyle(t),r=parseFloat(n.height)||o.height,a=parseFloat(n.width)||o.width;return Math.abs(o.width-a)>1||Math.abs(o.height-r)>1?(o.height=t.layout.height=r,o.width=t.layout.width=a):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),R.sanitizeMargins(o),e}function M(t){var e=C.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===n.autosize&&(k(t,{}),n.autosize=!0,t.layout.autosize=!0),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];C.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=P.randstr(r)}n._paperdiv.selectAll(".main-svg").attr($.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0);var o=N.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),n._has("cartesian")&&T(t,o),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var i=n._paper.selectAll(".layer-subplot");n._imageSubplotLayer=i.selectAll(".imagelayer"),n._shapeSubplotLayer=i.selectAll(".shapelayer");var l=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=l.append("g").classed("imagelayer",!0),n._shapeUpperLayer=l.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var s=P.syncOrAsync([L,function(){return N.Axes.doTicks(t,"redraw")},I.init],t);return s&&s.then&&t._promises.push(s),s}function A(t,e){function n(e,n){return function(){return N.Axes.getFromId(t,e,n)}}for(var r,a,o=t._fullLayout._plots={},i=0;i0,_=N.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),k=w===_;b?t.framework===M&&!x&&k||(t.framework=M,M(t)):k?x&&M(t):(t.framework=M,M(t)),x&&N.Axes.saveRangeInitial(t);var A=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&h(t);for(var z=0;zX.range[0]?[1,2]:[2,1]);else{var $=X.range[0],W=X.range[1];"log"===I?(0>=$&&0>=W&&o(G+".autorange",!0),0>=$?$=W/1e6:0>=W&&(W=$/1e6),o(G+".range[0]",Math.log($)/Math.LN10),o(G+".range[1]",Math.log(W)/Math.LN10)):(o(G+".range[0]",Math.pow(10,$)),o(G+".range[1]",Math.pow(10,W)))}else o(G+".autorange",!0)}if("reverse"===B)Z.range?Z.range.reverse():(o(G+".autorange",!0),Z.range=[1,0]),Y.autorange?w=!0:_=!0;else if("annotations"===j.parts[0]||"shapes"===j.parts[0]){var J=j.parts[1],K=j.parts[0],tt=g[K]||[],et=N[P.titleCase(K)],nt=tt[J]||{};2===j.parts.length&&("add"===m[E]||P.isPlainObject(m[E])?z[E]="remove":"remove"===m[E]?-1===J?(z[K]=tt,delete z[E]):z[E]=nt:P.log("???",m)),!i(nt,"x")&&!i(nt,"y")||P.containsAny(E,["color","opacity","align","dash"])||(w=!0),et.draw(t,J,j.parts.slice(2).join("."),m[E]),delete m[E]}else if("images"===j.parts[0]){var at=P.objectFromPath(E,I);P.extendDeepAll(t.layout,at),H.supplyLayoutDefaults(t.layout,t._fullLayout),H.draw(t)}else if("mapbox"===j.parts[0]&&"layers"===j.parts[1]){P.extendDeepAll(t.layout,P.objectFromPath(E,I));var ot=(t._fullLayout.mapbox||{}).layers||[];for(O=j.parts[2]+1-ot.length,p=0;O>p;p++)ot.push({});_=!0}else if("updatemenus"===j.parts[0]){P.extendDeepAll(t.layout,P.objectFromPath(E,I));var it=t._fullLayout.updatemenus||[];for(O=j.parts[2]+1-it.length,p=0;O>p;p++)it.push({});_=!0}else 0===j.parts[0].indexOf("scene")?_=!0:0===j.parts[0].indexOf("geo")?_=!0:0===j.parts[0].indexOf("ternary")?_=!0:!v._has("gl2d")||-1===E.indexOf("axis")&&"plot_bgcolor"!==j.parts[0]?"hiddenlabels"===E?w=!0:-1!==j.parts[0].indexOf("legend")?y=!0:-1!==E.indexOf("title")?x=!0:-1!==j.parts[0].indexOf("bgcolor")?b=!0:j.parts.length>1&&P.containsAny(j.parts[1],["tick","exponent","grid","zeroline"])?x=!0:-1!==E.indexOf(".linewidth")&&-1!==E.indexOf("axis")?x=b=!0:j.parts.length>1&&-1!==j.parts[1].indexOf("line")?b=!0:j.parts.length>1&&"mirror"===j.parts[1]?x=b=!0:"margin.pad"===E?x=b=!0:"margin"===j.parts[0]||"autorange"===j.parts[1]||"rangemode"===j.parts[1]||"type"===j.parts[1]||"domain"===j.parts[1]||E.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(E)?M=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(E)&&(_=!0):_=!0,j.set(I)}D.add(t,rt,[t,z],rt,[t,T]),m.autosize&&(m=k(t,m)),(m.height||m.width||m.autosize)&&(w=!0);var lt=Object.keys(m),st=[R.previousPromises];if(_||w)st.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),N.plot(t,"",g)});else if(lt.length&&(R.supplyDefaults(t),v=t._fullLayout,y&&st.push(function(){return V.draw(t),R.previousPromises(t)}),b&&st.push(L),x&&st.push(function(){return N.Axes.doTicks(t,"redraw"),S(t),R.previousPromises(t)}),M)){var ct;for(Q(t),N.Fx.supplyLayoutDefaults(t.layout,v,t._fullData),N.Fx.init(t),ct=R.getSubplotIds(v,"gl3d"),p=0;p1)};c(n.width)&&c(n.height)||l(new Error("Height and width should be pixel values."));var u=r.clone(e,{format:"png",height:n.height,width:n.width}),f=u.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var d=r.getRedrawFunc(f);o.plot(f,u.data,u.layout,u.config).then(d).then(s).then(function(e){t(e)}).catch(function(t){l(t)})});return l}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib");e.exports=r},{"../lib":100,"../plotly":119,"../snapshot":164,"fast-isnumeric":12}],118:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,v=n.length,m=0;v>m;m++){var y=n[m],x=["data",m];if(p(y)){var b=u[m],_=b.type,w=l.traces[_].attributes;w.type={valType:"enumerated",values:[_]},b.visible===!1&&y.visible!==!1&&s.push(i("invisible",x)),r(y,b,w,s,x);var k=y.transforms,M=b.transforms;if(k){g(k)||s.push(i("array",x,["transforms"])),x.push("transforms");for(var A=0;Ac&&u>e&&(void 0===a[n]?o[f]=T.tickText(t,e):o[f]=l(t,e,String(a[n])),f++);return f=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function i(t,e){var n=t.match(B),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(B,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o=e.x,l=t._tickround,s=new Date(o),c="";n&&t.hoverformat?a=i(t.hoverformat,o):t.tickformat?a=i(t.tickformat,o):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[l]),"y"===l?a=j(s):"m"===l?a=D(s):(o!==t._tmin||n||(c="
"+j(s)),"d"===l?a=R(s):"H"===l?a=I(s):(o!==t._tmin||n||(c="
"+R(s)+", "+j(s)),a=q(s),"M"!==l&&(a+=F(s),"S"!==l&&(a+=d(m(o/1e3,1),t,"none",n).substr(1)))))),e.text=a+c}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&m(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,m(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>i?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=0>t,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat;if(r){var u={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(u),i=(Number(u._tickround)||0)+4,s=u._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),f>t)t="0",a=!1;else{if(t+=f,s&&(t*=Math.pow(10,-s),i+=s),0===i)t=String(Math.floor(t));else if(0>i){t=String(Math.round(t)),t=t.substr(0,t.length+i);for(var d=i;0>d;d++)t+="0"}else{t=String(t);var h=t.indexOf(".")+1;h&&(t=t.substr(0,h+i).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(s&&"hide"!==l){var p;p=0>s?"\u2212"+-s:"power"!==l?"+"+s:String(s),"e"===l||("SI"===l||"B"===l)&&(s>12||-15>s)?t+="e"+p:"E"===l?t+="E"+p:"power"===l?t+="\xd710"+p+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=H[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var p=r-1,g=r+1;n="tozero"===t.rangemode?0>r?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var n=T.list(t,"",!0),r=!1,a=0;ap&&(p=g/10),c=t.c2l(p),u=t.c2l(g),y&&(c=Math.min(0,c),u=Math.max(0,u)),r(c)){for(h=!0,i=0;i=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,v=e.length,m=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;6>o;o++)a(o);for(o=v-1;o>5;o--)a(o)}},T.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,i]};T.autoTicks(f,l);var d,h=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;yg&&(p>.3*b||a(o)||a(i))){var w=f.dtick/2;h+=o>h+w?w:-w}var k=1+Math.floor((i-h)/f.dtick);d=h+k*f.dtick}else for(d=h;i>=d;)d=T.tickIncrement(d,f.dtick);return{start:h,end:d,size:f.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return r(t);if("auto"===t.tickmode||!t.dtick){var e,n=t.nticks;n||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/e):(e="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var a=t.range[1]=l:l>=s)&&(i.push(s),!(i.length>1e3));s=T.tickIncrement(s,t.dtick,a));t._tmax=i[i.length-1];for(var c=new Array(i.length),u=0;u157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,S)):e>12096e5?(e/=26298e5,t.dtick="M"+a(e,1,C)):e>432e5?(t.dtick=a(e,864e5,O),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=a(e,36e5,C):e>3e4?t.dtick=a(e,6e4,E):e>500?t.dtick=a(e,1e3,E):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?P:N,s=t+.01*r,c=_.roundUp(m(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]r:r>c;)c=T.tickIncrement(c,a,e);return c}if("L"===u)return Math.log(n((Math.pow(10,r)-o)/f)*f+o)/Math.LN10;if("D"===u){var d="D2"===a?P:N,h=_.roundUp(m(r,1),d,e);return Math.floor(r)+Math.log(y.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(a)};var j=y.time.format("%Y"),D=y.time.format("%b %Y"),R=y.time.format("%b %-d"),I=y.time.format("%b %-d %Hh"),q=y.time.format("%H:%M"),F=y.time.format(":%S"),B=/%(\d?)f/g;T.tickText=function(t,e,n){function r(r){var a;return void 0===r?!0:n?"none"===r:(a={first:t._tmin,last:t._tmax}[r],"all"!==r&&e!==a)}var a,o,i=l(t,e),d="array"===t.tickmode,h=n||d;if(d&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&en&&(M=90),a(u,M)}c._lastangle=M}return i(e),e+" done"}function s(){c._boundingBox=n.node().getBoundingClientRect()}var u=n.selectAll("g."+C).data(z,S);if(!c.showticklabels||!x(r))return u.remove(),void i(e);var f,d,p,m,b;"x"===v?(b="bottom"===F?1:-1,f=function(t){return t.dx+j*b},m=r+(P+N)*b,d=function(t){return t.dy+m+t.fontSize*("bottom"===F?1:-.5)},p=function(t){return x(t)&&0!==t&&180!==t?0>t*b?"end":"start":"middle"}):(b="right"===F?1:-1,d=function(t){return t.dy+t.fontSize/2-j*b},f=function(t){return t.dx+r+(P+N+(90===Math.abs(c.tickangle)?t.fontSize/2:0))*b},p=function(t){return x(t)&&90===Math.abs(t)?"middle":"right"===F?"start":"end"});var k=0,M=0,T=[];u.enter().append("g").classed(C,1).append("text").attr("text-anchor","middle").each(function(e){var n=y.select(this),r=t._promises.length;n.call(A.setPosition,f(e),d(e)).call(A.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),r=t._promises[r],r?T.push(t._promises.pop().then(function(){a(n,c.tickangle)})):a(n,c.tickangle)}),u.exit().remove(),u.each(function(t){k=Math.max(k,t.fontSize)}),a(u,c._lastangle||c.tickangle);var L=_.syncOrAsync([o,l,s]);return L&&L.then&&t._promises.push(L),L}function i(e){if(!n){var r,a,o,i,l=L.getFromId(t,e),s=y.select(t).selectAll("g."+e+"tick"),c={selection:s,side:l.side},f=e.charAt(0),d=t._fullLayout._size,h=1.5,p=l.titlefont.size;if(s.size()){var g=y.select(s.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);g&&(c.offsetLeft=+g[1],c.offsetTop=+g[2])}"x"===f?(a="free"===l.anchor?{_offset:d.t+(1-(l.position||0))*d.h,_length:0}:L.getFromId(t,l.anchor),o=l._offset+l._length/2,i=a._offset+("top"===l.side?-10-p*(h+(l.showticklabels?1:0)):a._length+10+p*(h+(l.showticklabels?1.5:.5))),l.rangeslider&&l.rangeslider.visible&&l._boundingBox&&(i+=(u.height-u.margin.b-u.margin.t)*l.rangeslider.thickness+l._boundingBox.height),c.side||(c.side="bottom")):(a="free"===l.anchor?{_offset:d.l+(l.position||0)*d.w,_length:0}:L.getFromId(t,l.anchor),i=l._offset+l._length/2,o=a._offset+("right"===l.side?a._length+10+p*(h+(l.showticklabels?1:.5)):-10-p*(h+(l.showticklabels?.5:0))),r={rotate:"-90",offset:0},c.side||(c.side="left")),k.draw(t,e+"title",{propContainer:l,propName:l._name+".title",dfltName:f.toUpperCase()+" axis",avoid:c,transform:r,attributes:{x:o,y:i,"text-anchor":"middle"}})}}function l(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:b.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[v]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===v}function s(e,n,a){var o=e.gridlayer,i=e.zerolinelayer,s=e["hidegrid"+v]?[]:H,u=c._gridpath||"M0,0"+("x"===v?"v":"h")+n._length,f=o.selectAll("path."+E).data(c.showgrid===!1?[]:s,S);if(f.enter().append("path").classed(E,1).classed("crisp",1).attr("d",u).each(function(t){c.zeroline&&("linear"===c.type||"-"===c.type)&&Math.abs(t.x)g;g++){var y=c.mirrors[i._id+d[g]];"ticks"!==y&&"labels"!==y||(f[g]=!0)}return void 0!==r[2]&&(f[2]=!0),f.forEach(function(t,e){var n=r[e],a=B[e];t&&x(n)&&(h+=p(n+N*a,a*c.ticklen))}),a(n,h),s(e,i,t),o(n,r[3])}}).filter(function(t){return t&&t.then});return U.length?Promise.all(U):0},T.swap=function(t,e){for(var n=h(t,e),r=0;r2*r}function u(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var f=t("fast-isnumeric"),d=t("tinycolor2").mix,h=t("../../lib"),p=t("../plots"),g=t("../../components/color/attributes").lightFraction,v=t("./layout_attributes"),m=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),x=t("./tick_label_defaults"),b=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),k=t("./clean_datum"),M=t("./axis_ids");e.exports=function(t,e,n,a){function o(n,r){return h.coerce2(t,e,v,n,r)}var i=a.letter,l=a.font||{},s="Click to enter "+(a.title||i.toUpperCase()+" axis")+" title";a.name&&(e._name=a.name,e._id=M.name2id(a.name));var c=n("type");"-"===c&&(r(e,a.data),"-"===e.type?e.type="linear":c=t.type=e.type),_(e);var u=n("color"),p=u===t.color?u:l.color;n("title",s),h.coerceFont(n,"titlefont",{family:l.family,size:Math.round(1.2*l.size),color:p});var k=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),A=n("autorange",!k);A&&n("rangemode");var T=n("range",[-1,"x"===i?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),h.noneOrAll(t.range,e.range,[0,1]),n("fixedrange"),m(t,e,n,c),x(t,e,n,c,a),y(t,e,n,a),b(t,e,n);var L=o("linecolor",u),z=o("linewidth"),S=n("showline",!!L||!!z);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&n("mirror");var C=o("gridcolor",d(u,a.bgColor,g).toRgbString()),E=o("gridwidth"),O=n("showgrid",a.showGrid||!!C||!!E);O||(delete e.gridcolor,delete e.gridwidth);var N=o("zerolinecolor",u),P=o("zerolinewidth"),j=n("zeroline",a.showGrid||!!N||!!P);return j||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===c?w(i,e.categoryorder,e.categoryarray,a.data):[],e}},{"../../components/color/attributes":19,"../../lib":100,"../plots":154,"./axis_ids":124,"./category_order_defaults":125,"./clean_datum":126,"./layout_attributes":131,"./ordered_categories":133,"./set_convert":136,"./tick_label_defaults":137,"./tick_mark_defaults":138,"./tick_value_defaults":139,"fast-isnumeric":12,tinycolor2:14}],124:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],126:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return a.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){a.error(e,t)}return t}},{"../../lib":100,"fast-isnumeric":12}],127:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],128:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?u.ms2DateTime(r,a):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/setcursor"),g=t("../../components/dragelement"),v=t("./axes"),m=t("./select"),y=t("./constants"),x=!0;e.exports=function(t,e,n,l,b,_,w,k){function M(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+gt+")").attr("d",st+"Z"),dt=ht.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+gt+")").attr("d","M0,0Z"),L();for(var o=0;o<$.length;o++)A($[o].range)}function L(){ht.selectAll(".select-outline").remove()}function z(t,e){var n=Math.max(0,Math.min(H,t+at)),r=Math.max(0,Math.min(V,e+ot)),a=Math.abs(n-at),o=Math.abs(r-ot),i=Math.floor(Math.min(o,a,G)/2);it.l=Math.min(at,n),it.r=Math.max(at,n),it.t=Math.min(ot,r),it.b=Math.max(ot,r),!J||oa?(ut="",it.r=it.l,it.t=it.b,dt.attr("d","M0,0Z")):(it.t=0,it.b=V,ut="x",dt.attr("d","M"+(it.l-.5)+","+(ot-G-.5)+"h-3v"+(2*G+1)+"h3ZM"+(it.r+.5)+","+(ot-G-.5)+"h3v"+(2*G+1)+"h-3Z")):!W||a.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function S(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),x=!1)))}function E(e,n){var a=1===(w+k).length;if(e)D();else if(2!==n||a){if(1===n&&a){var o=w?B[0]:F[0],i="s"===w||"w"===k?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",d="middle";if(o.fixedrange)return;w?(d="n"===w?"top":"bottom","right"===o.side&&(u="right")):"e"===k&&(u="right"),et.call(f.makeEditable,null,{immediate:!0,background:I.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:d}).on("edit",function(e){var n="category"===o.type?o.c2l(e):o.d2l(e);void 0!==n&&c.relayout(t,l,n)})}}else j()}function O(e){function n(t,e,n){if(!t.fixedrange){A(t.range);var r=t.range,a=r[0]+(r[1]-r[0])*e;t.range=[a+(r[0]-a)*n,a+(r[1]-a)*n]}}if(t._context.scrollZoom||I._enablescrollzoom){var r=t.querySelector(".plotly");if(!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(mt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void u.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,f=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-f);if(k){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,n){for(var a=1-e,o=0,i=0;i0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rT;T++){var L=o[T],z=h[L];if(z)M[T]=w.getFromId(t,z.xaxis._id),A[T]=w.getFromId(t,z.yaxis._id);else{var S=i[L]._subplot;M[T]=S.xaxis,A[T]=S.yaxis}}var C=e.hovermode||i.hovermode;if(-1===["x","y","closest"].indexOf(C)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var E,O,N,P,j,D,R,I,q,F,B,H,V=[],U=[];if(Array.isArray(e))for(C="array",N=0;NG||G>Y.width||0>Z||Z>Y.height)return _.unhoverRaw(t,e)}else G="xpx"in e?e.xpx:M[0]._length/2,Z="ypx"in e?e.ypx:A[0]._length/2;if(E="xval"in e?r(o,e.xval):a(M,G),O="yval"in e?r(o,e.yval):a(A,Z),!g(E[0])||!g(O[0]))return v.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var X=1/0;for(P=0;P1||-1!==D.hoverinfo.indexOf("name")?D.name:void 0,index:!1,distance:Math.min(X,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},H=V.length,"array"===I){var Q=e[P];"pointNumber"in Q?(B.index=Q.pointNumber,I="closest"):(I="","xval"in Q&&(q=Q.xval,I="x"),"yval"in Q&&(F=Q.yval,I=I?"closest":"y"))}else q=E[R],F=O[R];if(D._module&&D._module.hoverPoints){var $=D._module.hoverPoints(B,q,F,I);if($)for(var W,J=0;J<$.length;J++)W=$[J],g(W.x0)&&g(W.y0)&&V.push(s(W,C))}else v.log("Unrecognized trace type in hover:",D);"closest"===C&&V.length>H&&(V.splice(0,H),X=V[0].distance)}if(0===V.length)return _.unhoverRaw(t,e);var K="y"===C&&U.length>1;V.sort(function(t,e){return t.distance-e.distance});var tt=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),et={hovermode:C,rotateLabels:K,bgColor:tt,container:i._hoverlayer,outerContainer:i._paperdiv},nt=c(V,et);u(V,K?"xa":"ya"),f(nt,K);var rt=t._hoverdata,at=[];for(N=0;N128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),v=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),v=d.node().getBoundingClientRect().width+2*O):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var m,k,L=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),N=Math.abs(t.y1-t.y0),P=L.width+E+O+v;t.ty0=_-L.top,t.bx=L.width+2*O,t.by=L.height+2*O,t.anchor="start",t.txwidth=L.width,t.tx2width=v,t.offset=0,o?(t.pos=z,m=M>=S+N/2+P,k=S-N/2-P>=0,"top"!==t.idealAlign&&m||!k?m?(S+=N/2,t.anchor="start"):t.anchor="middle":(S-=N/2,t.anchor="end")):(t.pos=S,m=w>=z+C/2+P,k=z-C/2-P>=0,"left"!==t.idealAlign&&m||!k?m?(z+=C/2,t.anchor="start"):t.anchor="middle":(z-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+S+")"+(o?"rotate("+T+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(.01>o)){if(-.01>a){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(0>=c);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=c);i++)if(s=t[i],s.pos=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(0>=c);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?z:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var v=f[i];for(l=v.length-1;l>=0;l--){var m=v[l],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(E+O),l=i+o*(t.txwidth+O),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=t.offset*S),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*E+s)+","+(E+c)+"v"+(t.by/2-E)+"h"+r*t.bx+"v-"+t.by+"H"+(r*E+s)+"V"+(c-E)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+O).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*O+s,c+t.ty0-t.by/2+O),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,n){function r(n,r){return v.coerce(t,e,A.layoutAttributes,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},A.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indext*e||0===t?k.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":20,"../../components/dragelement":41,"../../components/drawing":43,"../../lib":100,"../../lib/events":96,"../../lib/svg_text_utils":111,"./axes":122,"./constants":127,"./dragbox":128,d3:10,"fast-isnumeric":12,tinycolor2:14}],130:[function(t,e,n){"use strict";var r=t("../plots"),a=t("./constants");n.name="cartesian",n.attr=["xaxis","yaxis"],n.idRoot=["x","y"],n.idRegex=a.idRegex,n.attrRegex=a.attrRegex,n.attributes=t("./attributes"),n.plot=function(t){function e(t,e){for(var n=[],r=0;rf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":100,"fast-isnumeric":12}],135:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,v=a.element.getBoundingClientRect(),m=a.plotinfo.x()._offset,y=a.plotinfo.y()._offset,x=e-v.left,b=n-v.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",k+"Z");var C,E,O,N,P,j=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),D=[],R=a.gd,I=[];for(C=0;C0)return Math.log(e)/Math.LN10;if(0>=e&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*u*Math.abs(r-a))}return i.BADNUM}function n(t){return Math.pow(10,t)}function c(t){return a(t)?Number(t):i.BADNUM}var u=10;if(t.c2l="log"===t.type?e:c,t.l2c="log"===t.type?n:c,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var r=s.getFromId(t._gd,t.overlaying);t.domain=r.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)a(t.range[e])||(t.range[e]=a(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):i.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=c,t.d2c=function(t){return t=l(t),a(t)?Number(t):i.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return a(t)?o.ms2DateTime(t):i.BADNUM},t.d2c=function(t){return a(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!a(t.range[0])&&a(f[0])&&(t.range[0]=f[0]),!a(t.range[1])&&a(f[1])&&(t.range[1]=f[1])}catch(d){o.error(d,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var n=t._categories.indexOf(e);return-1===n?i.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;or?"0":"1.0"}var n=this.framework,r=n.select("g.choroplethlayer"),a=n.select("g.scattergeolayer"),o=this.projection,i=this.path,l=this.clipAngle;n.selectAll("path.basepath").attr("d",i),n.selectAll("path.graticulepath").attr("d",i),r.selectAll("path.choroplethlocation").attr("d",i),r.selectAll("path.basepath").attr("d",i),a.selectAll("path.js-line").attr("d",i),null!==l?(a.selectAll("path.point").style("opacity",e).attr("transform",t),a.selectAll("text").style("opacity",e).attr("transform",t)):(a.selectAll("path.point").attr("transform",t),a.selectAll("text").attr("transform",t))}},{"../../components/color":20,"../../components/drawing":43,"../../constants/xmlns_namespaces":90,"../../lib/filter_visible":98,"../../lib/topojson_utils":112,"../../plots/cartesian/axes":122,"./constants":141,"./projections":149,"./set_scale":150,"./zoom":151,"./zoom_reset":152,d3:10,topojson:15}],143:[function(t,e,n){"use strict";var r=t("./geo"),a=t("../../plots/plots");n.name="geo",n.attr="geo",n.idRoot="geo",n.idRegex=/^geo([2-9]|[1-9][0-9]+)?$/,n.attrRegex=/^geo([2-9]|[1-9][0-9]+)?$/,n.attributes=t("./layout/attributes"),n.layoutAttributes=t("./layout/layout_attributes"),n.supplyLayoutDefaults=t("./layout/defaults"),n.plot=function(t){var e=t._fullLayout,n=t._fullData,o=a.getSubplotIds(e,"geo");void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var i=0;i=r}function o(t,e){for(var n=e[0],r=e[1],a=!1,o=0,i=t.length,l=i-1;i>o;l=o++){var s=t[o],c=s[0],u=s[1],f=t[l],d=f[0],h=f[1];u>r^h>r&&(d-c)*(r-u)/(h-u)+c>n&&(a=!a)}return a}function i(t){return t?t/Math.sin(t):1}function l(t){return t>1?O:-1>t?-O:Math.asin(t)}function s(t){return t>1?0:-1>t?E:Math.acos(t)}function c(t,e){var n=(2+O)*Math.sin(e);e/=2;for(var r=0,a=1/0;10>r&&Math.abs(a)>S;r++){var o=Math.cos(e);e-=a=(e+Math.sin(e)*(o+2)-n)/(2*o*(1+o))}return[2/Math.sqrt(E*(4+E))*t*(1+Math.cos(e)),2*Math.sqrt(E/(4+E))*Math.sin(e)]}function u(t,e){function n(n,r){var a=R(n/e,r);return a[0]*=t,a}return arguments.length<2&&(e=t),1===e?R:e===1/0?d:(n.invert=function(n,r){var a=R.invert(n/t,r);return a[0]*=e,a},n)}function f(){var t=2,e=D(u),n=e(t);return n.coefficient=function(n){return arguments.length?e(t=+n):t},n}function d(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function h(t,e){return[3*t/(2*E)*Math.sqrt(E*E/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(E/4+.4*e))]}function g(t){return function(e){var n,r=t*Math.sin(e),a=30;do e-=n=(e+Math.sin(e)-r)/(1+Math.cos(e));while(Math.abs(n)>S&&--a>0);return e/2}}function v(t,e,n){function r(n,r){return[t*n*Math.cos(r=a(r)),e*Math.sin(r)]}var a=g(n);return r.invert=function(r,a){var o=l(a/e);return[r/(t*Math.cos(o)),l((2*o+Math.sin(2*o))/n)]},r}function m(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),e*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function y(t,e){var n,r=Math.min(18,36*Math.abs(e)/E),a=Math.floor(r),o=r-a,i=(n=q[a])[0],l=n[1],s=(n=q[++a])[0],c=n[1],u=(n=q[Math.min(19,++a)])[0],f=n[1];return[t*(s+o*(u-i)/2+o*o*(u-2*s+i)/2),(e>0?O:-O)*(c+o*(f-l)/2+o*o*(f-2*c+l)/2)]}function x(t,e){return[t*Math.cos(e),e]}function b(t,e){var n=Math.cos(e),r=i(s(n*Math.cos(t/=2)));return[2*n*Math.sin(t)*r,Math.sin(e)*r]}function _(t,e){var n=b(t,e);return[(n[0]+t/O)/2,(n[1]+e)/2]}t.geo.project=function(t,e){var r=e.stream;if(!r)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:n)(t,r)};var w={Feature:e,FeatureCollection:function(t,n){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,n)})}}},k=[],M=[],A={point:function(t,e){k.push([t,e])},result:function(){var t=k.length?k.length<2?{type:"Point",coordinates:k[0]}:{type:"MultiPoint",coordinates:k}:null;return k=[],t}},T={lineStart:r,point:function(t,e){k.push([t,e])},lineEnd:function(){k.length&&(M.push(k),k=[])},result:function(){var t=M.length?M.length<2?{type:"LineString",coordinates:M[0]}:{type:"MultiLineString",coordinates:M}:null;return M=[],t}},L={polygonStart:r,lineStart:r,point:function(t,e){k.push([t,e])},lineEnd:function(){var t=k.length;if(t){do k.push(k[0].slice());while(++t<4);M.push(k),k=[]}},polygonEnd:r,result:function(){if(!M.length)return null;var t=[],e=[];return M.forEach(function(n){a(n)?t.push([n]):e.push(n)}),e.forEach(function(e){var n=e[0];t.some(function(t){return o(t[0],n)?(t.push(e),!0):void 0})||t.push([e])}),M=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},z={Point:A,MultiPoint:A,LineString:T,MultiLineString:T,Polygon:L,MultiPolygon:L,Sphere:L},S=1e-6,C=S*S,E=Math.PI,O=E/2,N=(Math.sqrt(E),E/180),P=180/E,j=t.geo.projection,D=t.geo.projectionMutator;t.geo.interrupt=function(e){function n(t,n){for(var r=0>n?-1:1,a=s[+(0>n)],o=0,i=a.length-1;i>o&&t>a[o][2][0];++o);var l=e(t-a[o][1][0],n);return l[0]+=e(a[o][1][0],r*n>r*a[o][0][1]?a[o][0][1]:n)[0],l}function r(){l=s.map(function(t){return t.map(function(t){var n,r=e(t[0][0],t[0][1])[0],a=e(t[2][0],t[2][1])[0],o=e(t[1][0],t[0][1])[1],i=e(t[1][0],t[1][1])[1];return o>i&&(n=o,o=i,i=n),[[r,o],[a,i]]})})}function a(){for(var e=1e-6,n=[],r=0,a=s[0].length;a>r;++r){var i=s[0][r],l=180*i[0][0]/E,c=180*i[0][1]/E,u=180*i[1][1]/E,f=180*i[2][0]/E,d=180*i[2][1]/E;n.push(o([[l+e,c+e],[l+e,u-e],[f-e,u-e],[f-e,d+e]],30))}for(var r=s[1].length-1;r>=0;--r){var i=s[1][r],l=180*i[0][0]/E,c=180*i[0][1]/E,u=180*i[1][1]/E,f=180*i[2][0]/E,d=180*i[2][1]/E;n.push(o([[f-e,d-e],[f-e,u+e],[l+e,u+e],[l+e,c-e]],30))}return{type:"Polygon",coordinates:[t.merge(n)]}}function o(t,e){for(var n,r,a,o=-1,i=t.length,l=t[0],s=[];++oc;++c)s.push([l[0]+c*r,l[1]+c*a]);l=n}return s.push(n),s}function i(t,e){return Math.abs(t[0]-e[0])r)],o=s[+(0>r)],c=0,u=a.length;u>c;++c){var f=a[c];if(f[0][0]<=t&&tS&&--a>0);return[t/(.8707+(o=r*r)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),r]},(t.geo.naturalEarth=function(){return j(m)}).raw=m;var q=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];q.forEach(function(t){t[1]*=1.0144}),y.invert=function(t,e){var n=e/O,r=90*n,a=Math.min(18,Math.abs(r/5)),o=Math.max(0,Math.floor(a));do{var i=q[o][1],l=q[o+1][1],s=q[Math.min(19,o+2)][1],c=s-i,u=s-2*l+i,f=2*(Math.abs(n)-l)/c,d=u/c,h=f*(1-d*f*(1-2*d*f));if(h>=0||1===o){r=(e>=0?5:-5)*(h+a);var p,g=50;do a=Math.min(18,Math.abs(r)/5),o=Math.floor(a),h=a-o,i=q[o][1],l=q[o+1][1],s=q[Math.min(19,o+2)][1],r-=(p=(e>=0?O:-O)*(l+h*(s-i)/2+h*h*(s-2*l+i)/2)-e)*P;while(Math.abs(p)>C&&--g>0);break}}while(--o>=0);var v=q[o][0],m=q[o+1][0],y=q[Math.min(19,o+2)][0];return[t/(m+h*(y-v)/2+h*h*(y-2*m+v)/2),r*N]},(t.geo.robinson=function(){return j(y)}).raw=y,x.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return j(x)}).raw=x,b.invert=function(t,e){if(!(t*t+4*e*e>E*E+S)){var n=t,r=e,a=25;do{var o,i=Math.sin(n),l=Math.sin(n/2),c=Math.cos(n/2),u=Math.sin(r),f=Math.cos(r),d=Math.sin(2*r),h=u*u,p=f*f,g=l*l,v=1-p*c*c,m=v?s(f*c)*Math.sqrt(o=1/v):o=0,y=2*m*f*l-t,x=m*u-e,b=o*(p*g+m*f*c*h),_=o*(.5*i*d-2*m*u*l),w=.25*o*(d*l-m*u*p*i),k=o*(h*c+m*g*f),M=_*w-k*b;if(!M)break;var A=(x*_-y*k)/M,T=(y*w-x*b)/M;n-=A,r-=T}while((Math.abs(A)>S||Math.abs(T)>S)&&--a>0);return[n,r]}},(t.geo.aitoff=function(){return j(b)}).raw=b,_.invert=function(t,e){var n=t,r=e,a=25;do{var o,i=Math.cos(r),l=Math.sin(r),c=Math.sin(2*r),u=l*l,f=i*i,d=Math.sin(n),h=Math.cos(n/2),p=Math.sin(n/2),g=p*p,v=1-f*h*h,m=v?s(i*h)*Math.sqrt(o=1/v):o=0,y=.5*(2*m*i*p+n/O)-t,x=.5*(m*l+r)-e,b=.5*o*(f*g+m*i*h*u)+.5/O,_=o*(d*c/4-m*l*p),w=.125*o*(c*p-m*l*f*d),k=.5*o*(u*h+m*g*i)+.5,M=_*w-k*b,A=(x*_-y*k)/M,T=(y*w-x*b)/M;n-=A,r-=T}while((Math.abs(A)>S||Math.abs(T)>S)&&--a>0);return[n,r]},(t.geo.winkel3=function(){return j(_)}).raw=_}e.exports=r},{}],150:[function(t,e,n){"use strict";function r(t,e){var n=t.projection,r=t.lonaxis,i=t.lataxis,s=t.domain,c=t.framewidth||0,u=e.w*(s.x[1]-s.x[0]),f=e.h*(s.y[1]-s.y[0]),d=r.range[0]+l,h=r.range[1]-l,p=i.range[0]+l,g=i.range[1]-l,v=r._fullRange[0]+l,m=r._fullRange[1]-l,y=i._fullRange[0]+l,x=i._fullRange[1]-l;n._translate0=[e.l+u/2,e.t+f/2];var b=h-d,_=g-p,w=[d+b/2,p+_/2],k=n._rotate;n._center=[w[0]+k[0],w[1]+k[1]];var M=function(e){function r(t){return Math.min(_*u/(t[1][0]-t[0][0]),_*f/(t[1][1]-t[0][1]))}var i,l,s,b,_=e.scale(),w=n._translate0,k=a(d,p,h,g),M=a(v,y,m,x);s=o(e,k),i=r(s),b=o(e,M),n._fullScale=r(b),e.scale(i),s=o(e,k),l=[w[0]-s[0][0]+c,w[1]-s[0][1]+c],n._translate=l,e.translate(l),s=o(e,k),t._isAlbersUsa||e.clipExtent(s),i=n.scale*i,n._scale=i,t._width=Math.round(s[1][0])+c,t._height=Math.round(s[1][1])+c,t._marginX=(u-Math.round(s[1][0]))/2,t._marginY=(f-Math.round(s[1][1]))/2};return M}function a(t,e,n,r){var a=(n-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,r],[t+a,r],[t+2*a,r],[t+3*a,r],[n,r],[n,e],[n-a,e],[n-2*a,e],[n-3*a,e],[t,e]]]}}function o(t,e){return i.geo.path().projection(t).bounds(e)}var i=t("d3"),l=t("./constants").clipPad;e.exports=r},{"./constants":141,d3:10}],151:[function(t,e,n){"use strict";function r(t,e){var n;return(n=e._isScoped?o:e._clipAngle?l:i)(t,e.projection)}function a(t,e){var n=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*n,100*n])}function o(t,e){function n(){_.select(this).style(M)}function r(){i.scale(_.event.scale).translate(_.event.translate),t.render()}function o(){_.select(this).style(A)}var i=t.projection,l=a(i,e);return l.on("zoomstart",n).on("zoom",r).on("zoomend",o),l}function i(t,e){function n(t){return v.invert(t)}function r(t){var e=v(n(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(M),s=_.mouse(this),c=v.rotate(),u=v.translate(),f=c,d=n(s)}function i(){return h=_.mouse(this),r(s)?(m.scale(v.scale()),void m.translate(v.translate())):(v.scale(_.event.scale),v.translate([u[0],_.event.translate[1]]),d?n(h)&&(g=n(h),p=[f[0]+(g[0]-d[0]),c[1],c[2]],v.rotate(p),f=p):(s=h,d=n(s)),void t.render())}function l(){_.select(this).style(A)}var s,c,u,f,d,h,p,g,v=t.projection,m=a(v,e),y=2;return m.on("zoomstart",o).on("zoom",i).on("zoomend",l),m}function l(t,e){function n(t){m++||t({type:"zoomstart"})}function r(t){t({type:"zoom"})}function o(t){--m||t({type:"zoomend"})}var i,l=t.projection,h={r:l.rotate(),k:l.scale()},p=a(l,e),g=b(p,"zoomstart","zoom","zoomend"),m=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(M);var t=_.mouse(this),e=l.rotate(),a=e,o=l.translate(),m=c(e);i=s(l,t),y.call(p,"zoom",function(){var n=_.mouse(this);if(l.scale(h.k=_.event.scale),i){if(s(l,n)){l.rotate(e).translate(o);var c=s(l,n),p=f(i,c),y=v(u(m,p)),x=h.r=d(y,i,a);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=a),l.rotate(x),a=x}}else t=n,i=s(l,t);r(g.of(this,arguments))}),n(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(A),y.call(p,"zoom",null),o(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function s(t,e){var n=t.invert(e);return n&&isFinite(n[0])&&isFinite(n[1])&&m(n)}function c(t){var e=.5*t[0]*w,n=.5*t[1]*w,r=.5*t[2]*w,a=Math.sin(e),o=Math.cos(e),i=Math.sin(n),l=Math.cos(n),s=Math.sin(r),c=Math.cos(r);return[o*l*c+a*i*s,a*l*c-o*i*s,o*i*c+a*l*s,o*l*s-a*i*c]}function u(t,e){var n=t[0],r=t[1],a=t[2],o=t[3],i=e[0],l=e[1],s=e[2],c=e[3];return[n*i-r*l-a*s-o*c,n*l+r*i+a*c-o*s,n*s-r*c+a*i+o*l,n*c+r*s-a*l+o*i]}function f(t,e){if(t&&e){var n=x(t,e),r=Math.sqrt(y(n,n)),a=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),o=Math.sin(a)/r;return r&&[Math.cos(a),n[2]*o,-n[1]*o,n[0]*o]}}function d(t,e,n){var r=g(e,2,t[0]);r=g(r,1,t[1]),r=g(r,0,t[2]-n[2]);var a,o,i=e[0],l=e[1],s=e[2],c=r[0],u=r[1],f=r[2],d=Math.atan2(l,i)*k,p=Math.sqrt(i*i+l*l);Math.abs(u)>p?(o=(u>0?90:-90)-d,a=0):(o=Math.asin(u/p)*k-d,a=Math.sqrt(p*p-u*u));var v=180-o-2*d,m=(Math.atan2(f,c)-Math.atan2(s,a))*k,y=(Math.atan2(f,c)-Math.atan2(s,-a))*k,x=h(n[0],n[1],o,m),b=h(n[0],n[1],v,y);return b>=x?[o,m,n[2]]:[v,y,n[2]]}function h(t,e,n,r){var a=p(n-t),o=p(r-e);return Math.sqrt(a*a+o*o)}function p(t){return(t%360+540)%360-180}function g(t,e,n){var r=n*w,a=t.slice(),o=0===e?1:0,i=2===e?1:2,l=Math.cos(r),s=Math.sin(r);return a[o]=t[o]*l-t[i]*s,a[i]=t[i]*l+t[o]*s,a}function v(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*k,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*k,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*k]}function m(t){var e=t[0]*w,n=t[1]*w,r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function y(t,e){for(var n=0,r=0,a=t.length;a>r;++r)n+=t[r]*e[r];return n}function x(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 b(t){for(var e=0,n=arguments.length,r=[];++e=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&a(t,i),l.text(i.text()&&c.text()?" - ":"")},h.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=h.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},h.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},a=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];h.supplyLayoutGlobalDefaults(a,r),r._dataLength=s.length,h.supplyDataDefaults(s,l,r),r._has=h._hasPlotType.bind(r);var c=r._modules;for(e=0;eo&&(e=(n-1)/(a.l+a.r),a.l=Math.floor(e*a.l),a.r=Math.floor(e*a.r)),0>i&&(e=(r-1)/(a.t+a.b),a.t=Math.floor(e*a.t),a.b=Math.floor(e*a.b))}},h.autoMargin=function(t,e,n){var r=t._fullLayout;if(r._pushmargin||(r._pushmargin={}),r.margin.autoexpand!==!1){if(n){var a=void 0===n.pad?12:n.pad;n.l+n.r>.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||h.doAutoMargin(t)}},h.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;return e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var v=s[t].t.val,m=s[t].t.size;if(v>d){var y=(h*v+(m-e.height)*d)/(v-d),x=(m*(1-d)+(h-e.height)*(1-v))/(v-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,t._replotting||"{}"===r||r===JSON.stringify(e._size)?void 0:u.plot(t)},h.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?f.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&h.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)}},{"../components/color":20,"../lib":100,"../plotly":119,"./attributes":120,"./font_attributes":140,"./layout_attributes":153,d3:10,"fast-isnumeric":12}],155:[function(t,e,n){"use strict";var r=t("../../traces/scatter/attributes"),a=r.marker;e.exports={r:r.r,t:r.t,marker:{color:a.color,size:a.size,symbol:a.symbol,opacity:a.opacity}}},{"../../traces/scatter/attributes":176}],156:[function(t,e,n){"use strict";function r(t,e){var n={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,n)}var a=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,i=o({},a.domain,{});e.exports={radialaxis:r("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:i,orientation:{valType:"number"}}),angularaxis:r("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:i}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":97,"../cartesian/layout_attributes":131}],157:[function(t,e,n){var r=t("../../plotly"),a=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},i=r.Lib.extendDeepAll;o.Axis=function(){function t(t){n=t||n;var c=s.data,f=s.layout;return("string"==typeof n||n.nodeName)&&(n=a.select(n)),n.datum(c).each(function(t,n){function s(t,e){return l(t)%360+f.orientation}var c=t.slice();u={data:o.util.cloneJson(c),layout:o.util.cloneJson(f)};var d=0;c.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[d],d=(d+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:a.rgb(t.color).darker().toString()),u.data[e].color=t.color,u.data[e].strokeColor=t.strokeColor,u.data[e].strokeDash=t.strokeDash,u.data[e].strokeSize=t.strokeSize});var h=c.filter(function(t,e){var n=t.visible;return"undefined"==typeof n||n===!0}),p=!1,g=h.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var v=a.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(g),m=[],y=v.map(function(t,e){if("unstacked"===t.key)return t.values;var n=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,r){t.yStack=[n],m.push(n),n=o.util.sumArrays(t.r,n)}),t.values});h=a.merge(y)}h.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var x=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;x=Math.max(10,x);var b,_=[f.margin.left+x,f.margin.top+x];if(p){var w=a.max(o.util.sumArrays(o.util.arrayLast(h).r[0],o.util.arrayLast(m)));b=[0,w]}else b=a.extent(o.util.flattenArray(h.map(function(t,e){return t.r})));f.radialAxis.domain!=o.DATAEXTENT&&(b[0]=0),r=a.scale.linear().domain(f.radialAxis.domain!=o.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:b).range([0,x]),u.layout.radialAxis.domain=r.domain();var k,M=o.util.flattenArray(h.map(function(t,e){return t.t})),A="string"==typeof M[0];A&&(M=o.util.deduplicate(M),k=M.slice(),M=a.range(M.length),h=h.map(function(t,e){var n=t;return t.t=[M],p&&(n.yStack=t.yStack),n}));var T=h.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===h.length,L=null===f.needsEndSpacing?A||!T:f.needsEndSpacing,z=f.angularAxis.domain&&f.angularAxis.domain!=o.DATAEXTENT&&!A&&f.angularAxis.domain[0]>=0,S=z?f.angularAxis.domain:a.extent(M),C=Math.abs(M[1]-M[0]);T&&!A&&(C=0);var E=S.slice();L&&A&&(E[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(E[1]-E[0])/O);var N=f.angularAxis.ticksStep||(E[1]-E[0])/(O*(f.minorTicks+1));k&&(N=Math.max(Math.round(N),1)),E[2]||(E[2]=N);var P=a.range.apply(this,E);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=a.scale.linear().domain(E.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?C:0,e=a.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var j="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",D=(new DOMParser).parseFromString(j,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=a.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,q=e.select(".chart-group"),F={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){I=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=o.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});o.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:I,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=I.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),I.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else I=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),q.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(U[0]=Math.max(0,U[0]),U[1]=Math.max(0,U[1]),e.select(".outer-group").attr("transform","translate("+U+")"),f.title){var G=e.select("g.title-group text").style(B).text(f.title),Z=G.node().getBBox();G.attr({x:_[0]-Z.width/2,y:_[1]-x-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var X=Y.selectAll("circle.grid-circle").data(r.ticks(5));X.enter().append("circle").attr({"class":"grid-circle"}).style(F),X.attr("r",r),X.exit().remove()}Y.select("circle.outside-circle").attr({r:x}).style(F);var Q=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var $=a.svg.axis().scale(r).ticks(5).tickSize(5);Y.call($).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(F),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),J=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(F),J.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=W.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?270>n&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(180>=n&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=a.max(q.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));I.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=a.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return i(o[n].defaultConfig(),t)});o[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=o.tooltipPanel().config({container:ct,fontSize:8})(),ft=o.tooltipPanel().config({container:ct,fontSize:8})(),dt=o.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});q.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos(Q).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=o.util.convertToCartesian(x+12,n+180);ut.text(o.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});q.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(Q).radius;pt.attr({r:n}).style({opacity:.5}),lt=r.invert(o.util.getMousePos(Q).radius);var a=o.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(o.util.round(lt)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var r=a.select(this),i=r.style("fill"),l="black",s=r.style("opacity")||1;if(r.attr({"data-opacity":s}),"none"!=i){r.attr({"data-fill":i}),l=a.hsl(i).darker().toString(),r.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-U[0]-d.left,f.top+f.height/2-U[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else i=r.style("stroke"),r.attr({"data-stroke":i}),l=a.hsl(i).darker().toString(),r.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=a.event.which?!1:void(a.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=a.select(this),r=n.attr("data-fill");r?n.style({fill:r,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,r,l,s={data:[],layout:{}},c={},u={},f=a.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),i(s.data[e],o.Axis.defaultConfig().data[0]),i(s.data[e],t)}),i(s.layout,o.Axis.defaultConfig().layout),i(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return r},d.angularScale=function(t){return l},d.svg=function(){return e},a.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:a.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},o.util._extend=function(t,e){for(var n in t)e[n]=t[n]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var n=e||6,r=a.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return r},o.util.dataFromEquation=function(t,e,n){var r=e||6,o=[],i=[];a.range(0,360+r,r).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return a.range(e).map(function(t,e){return n[e]||n[0]})},o.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=o.util.ensureArray(t[e],n)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},o.util.sumArrays=function(t,e){return a.zip(t,e).map(function(t,e){return a.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return-2===n},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},o.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},o.util.getMousePos=function(t){var e=a.mouse(t.node()),n=e[0],r=e[1],o={};return o.x=n,o.y=r,o.pos=e,o.angle=180*(Math.atan2(r,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+r*r),o},o.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;o>a;a++)e=t[a],e in n?(n[e]++,r[e]=n[e]):n[e]=1;return r},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,n,r){if(r){var a=n.slice();n=e,e=a}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,n,r){return"undefined"!=typeof t?(r===e.length-1&&delete t[n],t[n]):void 0},t),n.reduce(function(t,e,r){return"undefined"==typeof t[e]&&(t[e]={}),r===n.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=n[0].geometryConfig,e=t.container;"string"==typeof e&&(e=a.select(e)),e.datum(n).each(function(e,n){function r(e,n){var r=t.radialScale(e[1]),a=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:r,t:a}}function o(t){var e=t.r*Math.cos(t.t),n=t.r*Math.sin(t.t);return{x:e,y:n}}var i=!!e[0].data.yStack,s=e.map(function(t,e){return i?a.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):a.zip(t.data.t[0],t.data.r[0])}),c=t.angularScale,u=t.radialScale.domain()[0],f={};f.bar=function(n,r,o){var i=e[o].data,l=t.radialScale(n[1])-t.radialScale(0),s=t.radialScale(n[2]||0),u=i.barWidth;a.select(this).attr({"class":"mark bar",d:"M"+[[l+s,-u/2],[l+s,u/2],[s,u/2],[s,-u/2]].join("L")+"Z",transform:function(e,n){return"rotate("+(t.orientation+c(e[0]))+")"}})},f.dot=function(t,n,i){var l=t[2]?[t[0],t[1]+t[2]]:t,s=a.svg.symbol().size(e[i].data.dotSize).type(e[i].data.dotType)(t,n);a.select(this).attr({"class":"mark dot",d:s,transform:function(t,e){var n=o(r(l));return"translate("+[n.x,n.y]+")"}})};var d=a.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(n,r,o){var i=n[2]?s[o].map(function(t,e){return[t[0],t[1]+t[2]]}):s[o];if(a.select(this).each(f.dot).style({opacity:function(t,n){return+e[o].data.dotVisible},fill:v.stroke(n,r,o)}).attr({"class":"mark dot"}),!(r>0)){var l=a.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({"class":"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(n,r,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(n,r,o)},"stroke-width":function(t,e){return v["stroke-width"](n,r,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](n,r,o)},opacity:function(t,e){return v.opacity(n,r,o)},display:function(t,e){return v.display(n,r,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=a.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,r){a.select(this).attr({"class":"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var v={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},m=a.select(this).selectAll("g.layer").data(s);m.enter().append("g").attr({"class":"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,n=[o.PolyChart.defaultConfig()],r=a.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),i(n[e],o.PolyChart.defaultConfig()),i(n[e],t)}),this):n},t.getColorScale=function(){return e},a.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:a.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var n=e.legendConfig,r=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=i({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),o=a.merge(r);o=o.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(o=o.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=a.select(l));var s=o.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof o[0]:n.isContinuous,f=u?n.height:c*o.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({ +width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=a.range(o.length),v=a.scale[u?"linear":"ordinal"]().domain(g).range(s),m=a.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=a.svg.symbolTypes.indexOf(t)?a.svg.symbol().type(t).size(n)():a.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,m(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=a.svg.axis().scale(m).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),n=a.dispatch("hover");return t.config=function(t){return arguments.length?(i(e,t),this):e},a.rebind(t,n,"on"),t},o.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},o.tooltipPanel=function(){var t,e,n,r={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){t=r.container.selectAll("g."+l).data([0]);var a=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=a.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=a.append("text").attr({dx:r.padding+s,dy:.3*+r.fontSize}),c};return c.text=function(o){var i=a.hsl(r.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":r.fontSize+"px"}).text(f);var d=r.padding,h=e.node().getBBox(),p={fill:r.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,v=h.height+2*d;return n.attr({d:"M"+[[s,-v/2],[s,-v/4],[r.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-v/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c):void 0},c.hide=function(){return t?(t.style({display:"none"}),c):void 0},c.show=function(){return t?(t.style({display:"block"}),c):void 0},c.config=function(t){return i(r,t),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=i({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var r=o.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var a=r.indexOf(t.geometry);-1!=a&&(n.data[e].groupId=a)})}if(t.layout){var l=i({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};a.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../plotly":119,"./micropolar_manager":158,d3:10}],158:[function(t,e,n){"use strict";var r=t("../../plotly"),a=t("d3"),o=t("./undo_manager"),i=e.exports={},l=r.Lib.extendDeepAll;i.framework=function(t){function e(e,o){return o&&(f=o),a.select(a.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?l(n,e):e,c||(c=r.micropolar.Axis()),u=r.micropolar.adapter.plotly().convert(n),c.config(u).render(f),t.data=n.data,t.layout=n.layout,i.fillLayout(t),n}var n,s,c,u,f,d=new o;return e.isPolar=!0,e.svg=function(){return c.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return r.micropolar.adapter.plotly().convert(c.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:c.angularScale(),r:c.radialScale()}},e.setUndoPoint=function(){var t=this,e=r.micropolar.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,s),s=r.micropolar.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},i.fillLayout=function(t){var e=a.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:r.Color.background,_container:e,_paperdiv:n,_paper:o};t._fullLayout=l(i,t.layout)}},{"../../plotly":119,"./undo_manager":159,d3:10}],159:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return rg;g++){var v=h[g];l=t[v]?t[v]:t[v]={},e[v]=s={},i("domain."+d,[g/p,(g+1)/p]),i("domain."+{x:"y",y:"x"}[d]),o.id=v,f(l,s,i,o)}}},{"../lib":100,"./plots":154}],161:[function(t,e,n){"use strict";function r(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function a(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),i=o.Lib.extendFlat,l=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,s=t.data,c=t.layout,u=l([],s),f=l({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;ns&&(e.z=u.slice(0,s)),l("locationmode"),l("text"),l("marker.line.color"),l("marker.line.width"),a(t,e,i,l,{prefix:"",cLetter:"z"}),void l("hoverinfo",1===i._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":30,"../../lib":100,"./attributes":168}],171:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../heatmap/colorbar"),r.calc=t("./calc"),r.plot=t("./plot").plot,r.moduleType="trace",r.name="choropleth",r.basePlotModule=t("../../plots/geo"),r.categories=["geo","noOpacity"],r.meta={},e.exports=r},{"../../plots/geo":143,"../heatmap/colorbar":173,"./attributes":168,"./calc":169,"./defaults":170,"./plot":172}],172:[function(t,e,n){"use strict";function r(t,e){function n(e){var n=t.mockAxis;return i.tickText(n,n.c2l(e),"hover").text}var r=e.hoverinfo;if("none"===r)return function(t){delete t.nameLabel,delete t.textLabel};var a="all"===r?v.hoverinfo.flags:r.split("+"),o=-1!==a.indexOf("name"),l=-1!==a.indexOf("location"),s=-1!==a.indexOf("z"),c=-1!==a.indexOf("text"),u=!o&&l;return function(t){var r=[];u?t.nameLabel=t.id:(o&&(t.nameLabel=e.name),l&&r.push(t.id)),s&&r.push(n(t.z)),c&&r.push(t.tx),t.textLabel=r.join("
")}}function a(t){return function(e,n){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:n,location:e.id,z:e.z}]}}}var o=t("d3"),i=t("../../plots/cartesian/axes"),l=t("../../plots/cartesian/graph_interact"),s=t("../../components/color"),c=t("../../components/drawing"),u=t("../../components/colorscale/get_scale"),f=t("../../components/colorscale/make_scale_function"),d=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,p=t("../../lib/array_to_calc_item"),g=t("../../plots/geo/constants"),v=t("./attributes"),m=e.exports={};m.calcGeoJSON=function(t,e){for(var n,r=[],a=t.locations,o=a.length,i=d(t,e),l=(t.marker||{}).line||{},s=0;o>s;s++)n=h(t.locationmode,a[s],i),void 0!==n&&(n.z=t.z[s],void 0!==t.text&&(n.tx=t.text[s]),p(l.color,n,"mlc",s),p(l.width,n,"mlw",s),r.push(n));return r.length>0&&(r[0].trace=t),r},m.plot=function(t,e,n){var i,s=t.framework,c=s.select("g.choroplethlayer"),u=s.select("g.baselayer"),f=s.select("g.baselayeroverchoropleth"),d=g.baseLayersOverChoropleth,h=c.selectAll("g.trace.choropleth").data(e,function(t){return t.uid});h.enter().append("g").attr("class","trace choropleth"),h.exit().remove(),h.each(function(e){function n(e,n){if(t.showHover){var r=t.projection(e.properties.ct);c(e),l.loneHover({x:r[0],y:r[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),f=u(e,n),t.graphDiv.emit("plotly_hover",f)}}function i(e,n){t.graphDiv.emit("plotly_click",u(e,n))}var s=m.calcGeoJSON(e,t.topojson),c=r(t,e),u=a(e),f=null,d=o.select(this).selectAll("path.choroplethlocation").data(s);d.enter().append("path").classed("choroplethlocation",!0).on("mouseover",n).on("click",i).on("mouseout",function(){l.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",f)}).on("mousedown",function(){l.loneUnhover(t.hoverContainer)}).on("mouseup",n),d.exit().remove()}),f.selectAll("*").remove();for(var p=0;pp&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},v={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var m={type:"linear"};a.setConvert(m),s=m.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=v.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,a.expand(u,d,g),a.expand(f,h,v);var b=new Array(p);for(c=0;p>c;c++)b[c]=r(d[c])&&r(h[c])?{x:d[c],y:h[c]}:{x:!1,y:!1};return void 0!==typeof s&&o.mergeArray(s,b,"ms"),t.firstscatter=!1,b}},{"../../lib":100,"../../plots/cartesian/axes":122,"./colorscale_calc":180,"./subtypes":195,"fast-isnumeric":12}],178:[function(t,e,n){"use strict";e.exports=function(t){var e,n,r,a,o;for(e=0;e=0;a--)if(o=t[a],"scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}},{}],179:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,c=n.marker,u="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===c||!c.showscale)return void i.autoMargin(t,u);var f=l(c.colorscale),d=c.color,h=c.cmin,p=c.cmax;a(h)||(h=o.aggNums(Math.min,null,d)),a(p)||(p=o.aggNums(Math.max,null,d));var g=e[0].t.cb=s(t,u);g.fillcolor(r.scale.linear().domain(f.map(function(t){return h+t[0]*(p-h)})).range(f.map(function(t){return t[1]}))).filllevels({start:h,end:p,size:(p-h)/254}).options(c.colorbar)()}},{"../../components/colorbar/draw":23,"../../components/colorscale/get_scale":32,"../../lib":100,"../../plots/plots":154,d3:10,"fast-isnumeric":12}],180:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":27,"../../components/colorscale/has_colorscale":33,"./subtypes":195}],181:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],182:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var v=l(t,e,g),m=vB!=N>=B&&(C=z[T-1][0],E=z[T][0],S=C+(E-C)*(B-O)/(N-O),R=Math.min(R,S),I=Math.max(I,S));R=Math.max(R,0),I=Math.min(I,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:I,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":20,"../../components/errorbars":49,"../../lib":100,"../../plots/cartesian/constants":127,"../../plots/cartesian/graph_interact":129,"./get_trace_color":184}],186:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":130,"./arrays_to_calcdata":175,"./attributes":176,"./calc":177,"./clean_data":178,"./colorbar":179,"./defaults":182,"./hover":185,"./plot":192,"./select":193,"./style":194,"./subtypes":195}],187:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=(Array.isArray(l)?!1:l)||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":30,"../../components/colorscale/has_colorscale":33}],188:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=k.c2p(t[e].y);return n===z||r===z?!1:[n,r]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],z=r.BADNUM,S=.2,C=new Array(t.length),E=0;for(i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,c=f,h=!1):m>y&&(m=y,u=f,h=!0)}if(h?(C[E++]=c,s!==u&&(C[E++]=u)):(u!==l&&(C[E++]=u),s!==c&&(C[E++]=c)),C[E++]=s,i>=t.length||!f)break;C[E++]=f,l=f}}else C[E++]=c}L.push(C.slice(0,E))}return L}},{"../../plots/cartesian/axes":122}],189:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],190:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t){var e=t.marker,n=e.sizeref||1,a=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/n)}:function(t){return t/n};return function(t){var e=o(t/2);return r(e)&&e>0?Math.max(e,a):0}}},{"fast-isnumeric":12}],191:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":20,"../../components/colorscale/defaults":30,"../../components/colorscale/has_colorscale":33,"./subtypes":195}],192:[function(t,e,n){"use strict";function r(t,e,n){var r=e.x(),o=e.y(),i=a.extent(r.range.map(r.l2c)),l=a.extent(o.range.map(o.l2c));n.forEach(function(t,e){var r=t[0].trace;if(c.hasMarkers(r)){var a=r.marker.maxdisplayed;if(0!==a){var o=t.filter(function(t){return t.x>=i[0]&&t.x<=i[1]&&t.y>=l[0]&&t.y<=l[1]}),s=Math.ceil(o.length/a),u=0;n.forEach(function(t,n){var r=t[0].trace;c.hasMarkers(r)&&r.marker.maxdisplayed>0&&e>n&&u++});var f=Math.round(u*s/3+Math.floor(u/3)*s/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+f)%s)&&(t.vis=!0)})}}})}var a=t("d3"),o=t("../../lib"),i=t("../../components/drawing"),l=t("../../components/errorbars"),s=t("../../lib/polygon").tester,c=t("./subtypes"),u=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,n){function d(t){return t.filter(function(t){return t.vis})}r(t,e,n);var h=e.x(),p=e.y(),g=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(n);g.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),g.call(l.plot,e);var v,m,y,x,b="",_=[];g.each(function(t){var e=t[0].trace,n=e.line,r=a.select(this);if(e.visible===!0&&(m=e.fill.charAt(e.fill.length-1),"x"!==m&&"y"!==m&&(m=""),t[0].node3=r,u(t),c.hasLines(e)||"none"!==e.fill)){var o,l,d,g,w,k="",M="";v="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!b?r.append("path").classed("js-fill",!0):null,x&&(y=x.datum(t)),x=r.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(n.shape)?(d=i.steps(n.shape),g=i.steps(n.shape.split("").reverse().join(""))):d=g="spline"===n.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?i.smoothclosed(t.slice(1),n.smoothing):i.smoothopen(t,n.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return g(t.reverse())};var A,T=f(t,{xaxis:h,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(n.width||1,3)/4,linear:"linear"===n.shape}),L=e._polygons=new Array(T.length);for(A=0;A1&&r.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}v?z&&C&&(m?("y"===m?z[1]=C[1]=p.c2p(0,!0):"x"===m&&(z[0]=C[0]=h.c2p(0,!0)),v.attr("d",k+"L"+C+"L"+z+"Z")):v.attr("d",k+"Z")):"tonext"===e.fill.substr(0,6)&&k&&b&&("tonext"===e.fill?y.attr("d",k+"Z"+b+"Z"):y.attr("d",k+"L"+b.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),b=M,_=L}}}),g.selectAll("path:not([d])").remove(),g.append("g").attr("class","points").each(function(t){var e=t[0].trace,n=a.select(this),r=c.hasMarkers(e),l=c.hasText(e);!r&&!l||e.visible!==!0?n.remove():(r&&n.selectAll("path.point").data(e.marker.maxdisplayed?d:o.identity).enter().append("path").classed("point",!0).call(i.translatePoints,h,p),l&&n.selectAll("g").data(e.marker.maxdisplayed?d:o.identity).enter().append("g").append("text").call(i.translatePoints,h,p))})}},{"../../components/drawing":43,"../../components/errorbars":49,"../../lib":100,"../../lib/polygon":106,"./arrays_to_calcdata":175,"./line_points":188,"./subtypes":195,d3:10}],193:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;nr;r++)n[r]=[t.lon[r],t.lat[r]];return{type:"LineString",coordinates:n,trace:t}}function o(t,e){function n(e){var n=t.mockAxis;return c.tickText(n,n.c2l(e),"hover").text+"\xb0"}var r=e.hoverinfo;if("none"===r)return function(t){delete t.textLabel};var a="all"===r?v.hoverinfo.flags:r.split("+"),o=-1!==a.indexOf("location")&&Array.isArray(e.locations),i=-1!==a.indexOf("lon"),l=-1!==a.indexOf("lat"),s=-1!==a.indexOf("text");return function(t){var r=[];o?r.push(t.location):i&&l?r.push("("+n(t.lon)+", "+n(t.lat)+")"):i?r.push("lon: "+n(t.lon)):l&&r.push("lat: "+n(t.lat)),s&&r.push(t.tx||e.text),t.textLabel=r.join("
")}}function i(t){var e=Array.isArray(t.locations);return function(n,r){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:r,lon:n.lon,lat:n.lat,location:e?n.location:null}]}}}var l=t("d3"),s=t("../../plots/cartesian/graph_interact"),c=t("../../plots/cartesian/axes"),u=t("../../lib/topojson_utils").getTopojsonFeatures,f=t("../../lib/geo_location_utils").locationToFeature,d=t("../../lib/array_to_calc_item"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../scatter/subtypes"),v=t("./attributes"),m=e.exports={};m.calcGeoJSON=function(t,e){var n,a,o,i,l=[],s=Array.isArray(t.locations);s?(i=t.locations,n=i.length,a=u(t,e),o=function(t,e){var n=f(t.locationmode,i[e],a);return void 0!==n?n.properties.ct:void 0}):(n=t.lon.length,o=function(t,e){return[t.lon[e],t.lat[e]]});for(var c=0;n>c;c++){var d=o(t,c);if(d){var h={lon:d[0],lat:d[1],location:s?t.locations[c]:null};r(t,h,c),l.push(h)}}return l.length>0&&(l[0].trace=t),l},m.plot=function(t,e){var n=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,function(t){return t.uid});n.enter().append("g").attr("class","trace scattergeo"),n.exit().remove(),n.selectAll("*").remove(),n.each(function(t){var e=l.select(this);g.hasLines(t)&&e.selectAll("path.js-line").data([a(t)]).enter().append("path").classed("js-line",!0)}),n.each(function(e){function n(n,r){if(t.showHover){var a=t.projection([n.lon,n.lat]);d(n),s.loneHover({x:a[0],y:a[1],name:v?e.name:void 0,text:n.textLabel,color:n.mc||(e.marker||{}).color},{container:t.hoverContainer.node()}),y=h(n,r),t.graphDiv.emit("plotly_hover",y)}}function r(e,n){t.graphDiv.emit("plotly_click",h(e,n))}var a=l.select(this),c=g.hasMarkers(e),u=g.hasText(e);if(c||u){var f=m.calcGeoJSON(e,t.topojson),d=o(t,e),h=i(e),p=e.hoverinfo,v="all"===p||-1!==p.indexOf("name"),y=null;c&&a.selectAll("path.point").data(f).enter().append("path").classed("point",!0).on("mouseover",n).on("click",r).on("mouseout",function(){s.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",y)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",n),u&&a.selectAll("g").data(f).enter().append("g").append("text")}}),m.style(t)},m.style=function(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t.opacity}),e.each(function(t){l.select(this).selectAll("path.point").call(p.pointStyle,t),l.select(this).selectAll("text").call(p.textPointStyle,t)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=t.trace,n=e.line||{};l.select(this).call(h.stroke,n.color).call(p.dashLine,n.dash||"",n.width||0)})}},{"../../components/color":20,"../../components/drawing":43,"../../lib/array_to_calc_item":93,"../../lib/geo_location_utils":99,"../../lib/topojson_utils":112,"../../plots/cartesian/axes":122,"../../plots/cartesian/graph_interact":129,"../scatter/subtypes":195,"./attributes":198,d3:10}]},{},[5])(5)}); \ No newline at end of file diff --git a/dist/plotly-gl2d.js b/dist/plotly-gl2d.js index 17740340ecb..4a0505de169 100644 --- a/dist/plotly-gl2d.js +++ b/dist/plotly-gl2d.js @@ -1,5 +1,5 @@ /** -* plotly.js (gl2d) v1.16.2 +* plotly.js (gl2d) v1.16.3 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -24519,7 +24519,7 @@ var ndarray = require('ndarray') var nextPow2 = require('bit-twiddle').nextPow2 -var selectRange = require('cwise/lib/wrapper')({"args":["array",{"offset":[0,0,1],"array":0},{"offset":[0,0,2],"array":0},{"offset":[0,0,3],"array":0},"scalar","scalar","index"],"pre":{"body":"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}","args":[],"thisVars":["this_closestD2","this_closestX","this_closestY"],"localVars":[]},"body":{"body":"{if(255>_inline_55_arg0_||255>_inline_55_arg1_||255>_inline_55_arg2_||255>_inline_55_arg3_){var _inline_55_l=_inline_55_arg4_-_inline_55_arg6_[0],_inline_55_a=_inline_55_arg5_-_inline_55_arg6_[1],_inline_55_f=_inline_55_l*_inline_55_l+_inline_55_a*_inline_55_a;_inline_55_f_inline_52_arg0_||255>_inline_52_arg1_||255>_inline_52_arg2_||255>_inline_52_arg3_){var _inline_52_l=_inline_52_arg4_-_inline_52_arg6_[0],_inline_52_a=_inline_52_arg5_-_inline_52_arg6_[1],_inline_52_f=_inline_52_l*_inline_52_l+_inline_52_a*_inline_52_a;_inline_52_f bounds[i + 2]) { bounds[i] = -1; @@ -61281,6 +61265,43 @@ proto.plot = function(fullData, calcData, fullLayout) { this.glplot.draw(); }; +proto.updateTraces = function(fullData, calcData) { + var traceIds = Object.keys(this.traces); + var i, j, fullTrace; + + // remove empty traces + trace_id_loop: + for(i = 0; i < traceIds.length; i++) { + var oldUid = traceIds[i], + oldTrace = this.traces[oldUid]; + + for(j = 0; j < fullData.length; j++) { + fullTrace = fullData[j]; + + if(fullTrace.uid === oldUid && fullTrace.type === oldTrace.type) { + continue trace_id_loop; + } + } + + oldTrace.dispose(); + delete this.traces[oldUid]; + } + + // update / create trace objects + for(i = 0; i < fullData.length; i++) { + fullTrace = fullData[i]; + + var calcTrace = calcData[i], + traceObj = this.traces[fullTrace.uid]; + + if(traceObj) traceObj.update(fullTrace, calcTrace); + else { + traceObj = fullTrace._module.plot(this, fullTrace, calcTrace); + this.traces[fullTrace.uid] = traceObj; + } + } +}; + proto.draw = function() { if(this.stopped) return; @@ -65502,6 +65523,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout) var createContour2D = require('gl-contour2d'); var createHeatmap2D = require('gl-heatmap2d'); +var Axes = require('../../plots/cartesian/axes'); var makeColorMap = require('../contour/make_color_map'); var str2RGBArray = require('../../lib/str2rgbarray'); @@ -65509,6 +65531,7 @@ var str2RGBArray = require('../../lib/str2rgbarray'); function Contour(scene, uid) { this.scene = scene; this.uid = uid; + this.type = 'contourgl'; this.name = ''; this.hoverinfo = 'all'; @@ -65586,7 +65609,6 @@ proto.update = function(fullTrace, calcTrace) { this.contourOptions.x = this.heatmapOptions.x = calcPt.x; this.contourOptions.y = this.heatmapOptions.y = calcPt.y; - // pass on fill information if(fullTrace.contours.coloring === 'fill') { colorOptions = convertColorScale(fullTrace, {fill: true}); @@ -65608,6 +65630,10 @@ proto.update = function(fullTrace, calcTrace) { this.contour.update(this.contourOptions); this.heatmap.update(this.heatmapOptions); + + // expand axes + Axes.expand(this.scene.xaxis, calcPt.x); + Axes.expand(this.scene.yaxis, calcPt.y); }; proto.dispose = function() { @@ -65665,7 +65691,7 @@ function createContour(scene, fullTrace, calcTrace) { module.exports = createContour; -},{"../../lib/str2rgbarray":269,"../contour/make_color_map":321,"gl-contour2d":67,"gl-heatmap2d":73}],324:[function(require,module,exports){ +},{"../../lib/str2rgbarray":269,"../../plots/cartesian/axes":280,"../contour/make_color_map":321,"gl-contour2d":67,"gl-heatmap2d":73}],324:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -65800,6 +65826,7 @@ module.exports = function calc(gd, trace) { ya = Axes.getFromId(gd, trace.yaxis || 'y'), isContour = Plots.traceIs(trace, 'contour'), isHist = Plots.traceIs(trace, 'histogram'), + isGL2D = Plots.traceIs(trace, 'gl2d'), zsmooth = isContour ? 'best' : trace.zsmooth, x, x0, @@ -65883,8 +65910,11 @@ module.exports = function calc(gd, trace) { yIn = trace.ytype === 'scaled' ? '' : trace.y, yArray = makeBoundArray(trace, yIn, y0, dy, z.length, ya); - Axes.expand(xa, xArray); - Axes.expand(ya, yArray); + // handled in gl2d convert step + if(!isGL2D) { + Axes.expand(xa, xArray); + Axes.expand(ya, yArray); + } var cd0 = {x: xArray, y: yArray, z: z}; @@ -66511,13 +66541,14 @@ module.exports = heatmapAttrs; 'use strict'; var createHeatmap2D = require('gl-heatmap2d'); - +var Axes = require('../../plots/cartesian/axes'); var str2RGBArray = require('../../lib/str2rgbarray'); function Heatmap(scene, uid) { this.scene = scene; this.uid = uid; + this.type = 'heatmapgl'; this.name = ''; this.hoverinfo = 'all'; @@ -66588,6 +66619,9 @@ proto.update = function(fullTrace, calcTrace) { this.textLabels = [].concat.apply([], fullTrace.text); this.heatmap.update(this.options); + + Axes.expand(this.scene.xaxis, calcPt.x); + Axes.expand(this.scene.yaxis, calcPt.y); }; proto.dispose = function() { @@ -66628,7 +66662,7 @@ function createHeatmap(scene, fullTrace, calcTrace) { module.exports = createHeatmap; -},{"../../lib/str2rgbarray":269,"gl-heatmap2d":73}],335:[function(require,module,exports){ +},{"../../lib/str2rgbarray":269,"../../plots/cartesian/axes":280,"gl-heatmap2d":73}],335:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68904,6 +68938,7 @@ var AXES = ['xaxis', 'yaxis']; function LineWithMarkers(scene, uid) { this.scene = scene; this.uid = uid; + this.type = 'scattergl'; this.pickXData = []; this.pickYData = []; diff --git a/dist/plotly-gl2d.min.js b/dist/plotly-gl2d.min.js index 9d87b961201..f6f6fd032ab 100644 --- a/dist/plotly-gl2d.min.js +++ b/dist/plotly-gl2d.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (gl2d - minified) v1.16.2 +* plotly.js (gl2d - minified) v1.16.3 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -14,21 +14,21 @@ k.y+=t[1]-e[1]}function o(e,r,n,o){e.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2, }return new jn(r?r.matrix:bl)})(t)},jn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var bl={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Zn,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++rs*s/m){if(g>l){var u=e.charge/l;t.px-=a*u,t.py-=o*u}return!0}if(e.point&&l&&g>l){var u=e.pointCharge/l;t.px-=a*u,t.py-=o*u}}return!e.charge}}function e(t){t.px=uo.event.x,t.py=uo.event.y,l.resume()}var r,n,i,a,o,s,l={},u=uo.dispatch("start","tick","end"),c=[1,1],f=.9,h=xl,d=_l,p=-30,g=wl,v=.1,m=.64,y=[],b=[];return l.tick=function(){if((i*=.99)<.005)return r=null,u.end({type:"end",alpha:i=0}),!0;var e,n,l,h,d,g,m,x,_,w=y.length,A=b.length;for(n=0;A>n;++n)l=b[n],h=l.source,d=l.target,x=d.x-h.x,_=d.y-h.y,(g=x*x+_*_)&&(g=i*o[n]*((g=Math.sqrt(g))-a[n])/g,x*=g,_*=g,d.x-=x*(m=h.weight+d.weight?h.weight/(h.weight+d.weight):.5),d.y-=_*m,h.x+=x*(m=1-m),h.y+=_*m);if((m=i*v)&&(x=c[0]/2,_=c[1]/2,n=-1,m))for(;++n0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=Pt(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;i>l;++l)r[l]=[];for(l=0;u>l;++l){var a=b[l];r[a.source.index].push(a.target),r[a.target.index].push(a.source)}}for(var o,s=r[e],l=-1,c=s.length;++le;++e)(n=y[e]).index=e,n.weight=0;for(e=0;u>e;++e)n=b[e],"number"==typeof n.source&&(n.source=y[n.source]),"number"==typeof n.target&&(n.target=y[n.target]),++n.source.weight,++n.target.weight;for(e=0;i>e;++e)n=y[e],isNaN(n.x)&&(n.x=t("x",f)),isNaN(n.y)&&(n.y=t("y",g)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(a=[],"function"==typeof h)for(e=0;u>e;++e)a[e]=+h.call(this,b[e],e);else for(e=0;u>e;++e)a[e]=h;if(o=[],"function"==typeof d)for(e=0;u>e;++e)o[e]=+d.call(this,b[e],e);else for(e=0;u>e;++e)o[e]=d;if(s=[],"function"==typeof p)for(e=0;i>e;++e)s[e]=+p.call(this,y[e],e);else for(e=0;i>e;++e)s[e]=p;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return n||(n=uo.behavior.drag().origin(x).on("dragstart.force",ei).on("drag.force",e).on("dragend.force",ri)),arguments.length?void this.on("mouseover.force",ni).on("mouseout.force",ii).call(n):n},uo.rebind(l,u,"on")};var xl=20,_l=1,wl=1/0;uo.layout.hierarchy=function(){function t(i){var a,o=[i],s=[];for(i.depth=0;null!=(a=o.pop());)if(s.push(a),(u=r.call(t,a,a.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=u}else n&&(a.value=+n.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=fi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value)})),e},t},uo.layout.partition=function(){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,u=-1;for(n=e.value?n/e.value:0;++uf?-1:1),p=uo.sum(u),g=p?(f-l*d)/p:0,v=uo.range(l),m=[];return null!=r&&v.sort(r===Al?function(t,e){return u[e]-u[t]}:function(t,e){return r(o[t],o[e])}),v.forEach(function(t){m[t]={data:o[t],value:s=u[t],startAngle:c,endAngle:c+=s*g+d,padAngle:h}}),m}var e=Number,r=Al,n=0,i=Vo,a=0;return t.value=function(r){return arguments.length?(e=r,t):e},t.sort=function(e){return arguments.length?(r=e,t):r},t.startAngle=function(e){return arguments.length?(n=e,t):n},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(a=e,t):a},t};var Al={};uo.layout.stack=function(){function t(s,l){if(!(h=s.length))return s;var u=s.map(function(r,n){return e.call(t,r,n)}),c=u.map(function(e){return e.map(function(e,r){return[a.call(t,e,r),o.call(t,e,r)]})}),f=r.call(t,c,l);u=uo.permute(u,f),c=uo.permute(c,f);var h,d,p,g,v=n.call(t,c,l),m=u[0].length;for(p=0;m>p;++p)for(i.call(t,u[0][p],g=v[p],c[0][p][1]),d=1;h>d;++d)i.call(t,u[d][p],g+=c[d-1][p][1],c[d][p][1]);return s}var e=x,r=vi,n=mi,i=gi,a=di,o=pi;return t.values=function(r){return arguments.length?(e=r,t):e},t.order=function(e){return arguments.length?(r="function"==typeof e?e:kl.get(e)||vi,t):r},t.offset=function(e){return arguments.length?(n="function"==typeof e?e:Ml.get(e)||mi,t):n},t.x=function(e){return arguments.length?(a=e,t):a},t.y=function(e){return arguments.length?(o=e,t):o},t.out=function(e){return arguments.length?(i=e,t):i},t};var kl=uo.map({"inside-out":function(t){var e,r,n=t.length,i=t.map(yi),a=t.map(bi),o=uo.range(n).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,u=[],c=[];for(e=0;n>e;++e)r=o[e],l>s?(s+=a[r],u.push(r)):(l+=a[r],c.push(r));return c.reverse().concat(u)},reverse:function(t){return uo.range(t.length).reverse()},"default":vi}),Ml=uo.map({silhouette:function(t){var e,r,n,i=t.length,a=t[0].length,o=[],s=0,l=[];for(r=0;a>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];n>s&&(s=n),o.push(n)}for(r=0;a>r;++r)l[r]=(s-o[r])/2;return l},wiggle:function(t){var e,r,n,i,a,o,s,l,u,c=t.length,f=t[0],h=f.length,d=[];for(d[0]=l=u=0,r=1;h>r;++r){for(e=0,i=0;c>e;++e)i+=t[e][r][1];for(e=0,a=0,s=f[r][0]-f[r-1][0];c>e;++e){for(n=0,o=(t[e][r][1]-t[e][r-1][1])/(2*s);e>n;++n)o+=(t[n][r][1]-t[n][r-1][1])/s;a+=o*t[e][r][1]}d[r]=l-=i?a/i*s:0,u>l&&(u=l)}for(r=0;h>r;++r)d[r]-=u;return d},expand:function(t){var e,r,n,i=t.length,a=t[0].length,o=1/i,s=[];for(r=0;a>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];if(n)for(e=0;i>e;e++)t[e][r][1]/=n;else for(e=0;i>e;e++)t[e][r][1]=o}for(r=0;a>r;++r)s[r]=0;return s},zero:mi});uo.layout.histogram=function(){function t(t,a){for(var o,s,l=[],u=t.map(r,this),c=n.call(this,u,a),f=i.call(this,c,u,a),a=-1,h=u.length,d=f.length-1,p=e?1:1/h;++a0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Ai,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=Lt(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Lt(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Li),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=f}),li(s,Li),li(s,function(t){t.r-=f})}return Ri(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,r=uo.layout.hierarchy().sort(ki),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},oi(t,r)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),f=c[0],h=e(f);if(li(h,r),h.parent.m=-h.z,si(h,n),u)si(f,a);else{var d=f,p=f,g=f;si(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var v=s(d,p)/2-d.x,m=l[0]/(p.x+s(p,d)/2+v),y=l[1]/(g.depth||1);si(f,function(t){t.x=(t.x+v)*m,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;s>o;++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]}function r(t){var e=t.children,r=t.parent.children,n=t.i?r[t.i-1]:null;if(e.length){Di(t);var a=(e[0].z+e[e.length-1].z)/2;n?(t.z=n.z+s(t._,n._),t.m=t.z-a):t.z=a}else n&&(t.z=n.z+s(t._,n._));t.parent.A=i(t,n,t.parent.A||r[0])}function n(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t,e,r){if(e){for(var n,i=t,a=t,o=e,l=i.parent.children[0],u=i.m,c=a.m,f=o.m,h=l.m;o=Ni(o),i=Oi(i),o&&i;)l=Oi(l),a=Ni(a),a.a=t,n=o.z+f-i.z-u+s(o._,i._),n>0&&(zi(Fi(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Ni(a)&&(a.t=o,a.m+=f-c),i&&!Oi(l)&&(l.t=i,l.m+=u-h,r=t)}return r}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Pi,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=ji(e),t.y=Bi(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ui(l),f=Vi(l),h=c.x-r(c,f)/2,d=f.x+r(f,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-h)/(d-h)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),r=Pi,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++ie?0:e),r.area=isNaN(n)||0>=n?0:n}function e(r){var a=r.children;if(a&&a.length){var o,s,l,u=f(r),c=[],h=a.slice(),p=1/0,g="slice"===d?u.dx:"dice"===d?u.dy:"slice-dice"===d?1&r.depth?u.dy:u.dx:Math.min(u.dx,u.dy);for(t(h,u.dx*u.dy/r.value),c.area=0;(l=h.length)>0;)c.push(o=h[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,g))<=p?(h.pop(),p=s):(c.area-=c.pop().area,i(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,g,u,!0),c.length=c.area=0),a.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var a,o=f(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++or&&(a=r),r>i&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*a*p)):1/0}function i(t,e,r,n){var i,a=-1,o=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++ar.dx)&&(c=r.dx);++ar&&(e=1),1>r&&(t=0),function(){var r,n,i;do r=2*Math.random()-1,n=2*Math.random()-1,i=r*r+n*n;while(!i||i>1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;t>r;r++)e+=Math.random();return e}}},uo.scale={};var El={floor:x,ceil:x};uo.scale.linear=function(){return $i([0,1],[0,1],_n,!1)};var Tl={s:1,g:1,p:1,r:1,e:1};uo.scale.log=function(){return aa(uo.scale.linear().domain([0,1]),10,!0,[1,10])};var Ll=uo.format(".0e"),Sl={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};uo.scale.pow=function(){return oa(uo.scale.linear(),1,[0,1])},uo.scale.sqrt=function(){return uo.scale.pow().exponent(.5)},uo.scale.ordinal=function(){return la([],{t:"range",a:[[]]})},uo.scale.category10=function(){return uo.scale.ordinal().range(Cl)},uo.scale.category20=function(){return uo.scale.ordinal().range(Rl)},uo.scale.category20b=function(){return uo.scale.ordinal().range(Il)},uo.scale.category20c=function(){return uo.scale.ordinal().range(Pl)};var Cl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(_t),Rl=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(_t),Il=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(_t),Pl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(_t);uo.scale.quantile=function(){return ua([],[])},uo.scale.quantize=function(){return ca(0,1,[0,1])},uo.scale.threshold=function(){return fa([.5],[0,1])},uo.scale.identity=function(){return ha([0,1])},uo.svg={},uo.svg.arc=function(){function t(){var t=Math.max(0,+r.apply(this,arguments)),u=Math.max(0,+n.apply(this,arguments)),c=o.apply(this,arguments)-Ho,f=s.apply(this,arguments)-Ho,h=Math.abs(f-c),d=c>f?0:1;if(t>u&&(p=u,u=t,t=p),h>=qo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,A,k,M,E=0,T=0,L=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=a===Ol?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(T*=-1),u&&(T=nt(v/u*Math.sin(m))),t&&(E=nt(v/t*Math.sin(m)))),u){y=u*Math.cos(c+T),b=u*Math.sin(c+T),x=u*Math.cos(f-T),_=u*Math.sin(f-T);var S=Math.abs(f-c-2*T)<=Uo?0:1;if(T&&ba(y,b,x,_)===d^S){var C=(c+f)/2;y=u*Math.cos(C),b=u*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(f-E),A=t*Math.sin(f-E),k=t*Math.cos(c+E),M=t*Math.sin(c+E);var R=Math.abs(c-f+2*E)<=Uo?0:1;if(E&&ba(w,A,k,M)===1-d^R){var I=(c+f)/2;w=t*Math.cos(I),A=t*Math.sin(I),k=M=null}}else w=A=0;if(h>Bo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=u>t^d?0:1;var P=p,O=p;if(Uo>h){var N=null==k?[w,A]:null==x?[y,b]:Nr([y,b],[k,M],[x,_],[w,A]),z=y-N[0],D=b-N[1],F=x-N[0],B=_-N[1],j=1/Math.sin(Math.acos((z*F+D*B)/(Math.sqrt(z*z+D*D)*Math.sqrt(F*F+B*B)))/2),U=Math.sqrt(N[0]*N[0]+N[1]*N[1]);O=Math.min(p,(t-U)/(j-1)),P=Math.min(p,(u-U)/(j+1))}if(null!=x){var V=xa(null==k?[w,A]:[k,M],[y,b],u,P,d),q=xa([x,_],[w,A],u,P,d);p===P?L.push("M",V[0],"A",P,",",P," 0 0,",g," ",V[1],"A",u,",",u," 0 ",1-d^ba(V[1][0],V[1][1],q[1][0],q[1][1]),",",d," ",q[1],"A",P,",",P," 0 0,",g," ",q[0]):L.push("M",V[0],"A",P,",",P," 0 1,",g," ",q[0])}else L.push("M",y,",",b);if(null!=k){var H=xa([y,b],[k,M],t,-O,d),G=xa([w,A],null==x?[y,b]:[x,_],t,-O,d);p===O?L.push("L",G[0],"A",O,",",O," 0 0,",g," ",G[1],"A",t,",",t," 0 ",d^ba(G[1][0],G[1][1],H[1][0],H[1][1]),",",1-d," ",H[1],"A",O,",",O," 0 0,",g," ",H[0]):L.push("L",G[0],"A",O,",",O," 0 0,",g," ",H[0])}else L.push("L",w,",",A)}else L.push("M",y,",",b),null!=x&&L.push("A",u,",",u," 0 ",S,",",d," ",x,",",_),L.push("L",w,",",A),null!=k&&L.push("A",t,",",t," 0 ",R,",",1-d," ",k,",",M);return L.push("Z"),L.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var r=pa,n=ga,i=da,a=Ol,o=va,s=ma,l=ya;return t.innerRadius=function(e){return arguments.length?(r=Lt(e),t):r},t.outerRadius=function(e){return arguments.length?(n=Lt(e),t):n},t.cornerRadius=function(e){return arguments.length?(i=Lt(e),t):i},t.padRadius=function(e){return arguments.length?(a=e==Ol?Ol:Lt(e),t):a},t.startAngle=function(e){return arguments.length?(o=Lt(e),t):o},t.endAngle=function(e){return arguments.length?(s=Lt(e),t):s},t.padAngle=function(e){return arguments.length?(l=Lt(e),t):l},t.centroid=function(){var t=(+r.apply(this,arguments)+ +n.apply(this,arguments))/2,e=(+o.apply(this,arguments)+ +s.apply(this,arguments))/2-Ho;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Ol="auto";uo.svg.line=function(){return _a(x)};var Nl=uo.map({linear:wa,"linear-closed":Aa,step:ka,"step-before":Ma,"step-after":Ea,basis:Ia,"basis-open":Pa,"basis-closed":Oa,bundle:Na,cardinal:Sa,"cardinal-open":Ta,"cardinal-closed":La,monotone:Ua});Nl.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var zl=[0,2/3,1/3,0],Dl=[0,1/3,2/3,0],Fl=[0,1/6,2/3,1/6];uo.svg.line.radial=function(){var t=_a(Va);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},Ma.reverse=Ea,Ea.reverse=Ma,uo.svg.area=function(){return qa(x)},uo.svg.area.radial=function(){var t=qa(Va);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},uo.svg.chord=function(){function t(t,s){var l=e(this,a,t,s),u=e(this,o,t,s);return"M"+l.p0+n(l.r,l.p1,l.a1-l.a0)+(r(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+n(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function e(t,e,r,n){var i=e.call(t,r,n),a=s.call(t,i,n),o=l.call(t,i,n)-Ho,c=u.call(t,i,n)-Ho;return{r:a,a0:o,a1:c,p0:[a*Math.cos(o),a*Math.sin(o)],p1:[a*Math.cos(c),a*Math.sin(c)]}}function r(t,e){return t.a0==e.a0&&t.a1==e.a1}function n(t,e,r){return"A"+t+","+t+" 0 "+ +(r>Uo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=Ha,l=va,u=ma;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(a=Lt(e),t):a},t.target=function(e){return arguments.length?(o=Lt(e),t):o},t.startAngle=function(e){return arguments.length?(l=Lt(e),t):l},t.endAngle=function(e){return arguments.length?(u=Lt(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=r.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Ga;return t.source=function(r){return arguments.length?(e=Lt(r),t):e},t.target=function(e){return arguments.length?(r=Lt(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ga,r=t.projection;return t.projection=function(t){return arguments.length?r(Xa(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Bl.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Ya;return t.type=function(r){return arguments.length?(e=Lt(r),t):e},t.size=function(e){return arguments.length?(r=Lt(e),t):r},t};var Bl=uo.map({circle:Za,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Ul)),r=e*Ul;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/jl),r=e*jl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/jl),r=e*jl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Bl.keys();var jl=Math.sqrt(3),Ul=Math.tan(30*Go);Ro.transition=function(t){for(var e,r,n=Vl||++Xl,i=to(t),a=[],o=ql||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++sa;a++){i.push(e=[]);for(var r=this[a],s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,a)&&e.push(n)}return $a(i,this.namespace,this.id)},Gl.tween=function(t,e){var r=this.id,n=this.namespace;return arguments.length<2?this.node()[n][r].tween.get(t):G(this,null==e?function(e){e[n][r].tween.remove(t)}:function(i){i[n][r].tween.set(t,e)})},Gl.attr=function(t,e){function r(){this.removeAttribute(s)}function n(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?r:(t+="",function(){var e,r=this.getAttribute(s);return r!==t&&(e=o(r,t),function(t){this.setAttribute(s,e(t))})})}function a(t){return null==t?n:(t+="",function(){var e,r=this.getAttributeNS(s.space,s.local);return r!==t&&(e=o(r,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var o="transform"==t?Zn:_n,s=uo.ns.qualify(t);return Ka(this,"attr."+t,e,s.local?a:i)},Gl.attrTween=function(t,e){function r(t,r){var n=e.call(this,t,r,this.getAttribute(i));return n&&function(t){this.setAttribute(i,n(t))}}function n(t,r){var n=e.call(this,t,r,this.getAttributeNS(i.space,i.local));return n&&function(t){this.setAttributeNS(i.space,i.local,n(t))}}var i=uo.ns.qualify(t);return this.tween("attr."+t,i.local?n:r)},Gl.style=function(t,e,r){function i(){this.style.removeProperty(t)}function a(e){return null==e?i:(e+="",function(){var i,a=n(this).getComputedStyle(this,null).getPropertyValue(t);return a!==e&&(i=_n(a,e),function(e){this.style.setProperty(t,i(e),r)})})}var o=arguments.length;if(3>o){if("string"!=typeof t){2>o&&(e="");for(r in t)this.style(r,t[r],e);return this}r=""}return Ka(this,"style."+t,e,a)},Gl.styleTween=function(t,e,r){function i(i,a){var o=e.call(this,i,a,n(this).getComputedStyle(this,null).getPropertyValue(t));return o&&function(e){this.style.setProperty(t,o(e),r)}}return arguments.length<3&&(r=""),this.tween("style."+t,i)},Gl.text=function(t){return Ka(this,"text",t,Ja)},Gl.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Gl.ease=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].ease:("function"!=typeof t&&(t=uo.ease.apply(uo,arguments)),G(this,function(n){n[r][e].ease=t}))},Gl.delay=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].delay:G(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}))},Gl.duration=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].duration:G(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}))},Gl.each=function(t,e){var r=this.id,n=this.namespace;if(arguments.length<2){var i=ql,a=Vl;try{Vl=r,G(this,function(e,i,a){ql=e[n][r],t.call(e,e.__data__,i,a)})}finally{ql=i,Vl=a}}else G(this,function(i){var a=i[n][r];(a.event||(a.event=uo.dispatch("start","end","interrupt"))).on(t,e)});return this},Gl.transition=function(){for(var t,e,r,n,i=this.id,a=++Xl,o=this.namespace,s=[],l=0,u=this.length;u>l;l++){s.push(t=[]);for(var e=this[l],c=0,f=e.length;f>c;c++)(r=e[c])&&(n=r[o][i],eo(r,c,o,a,{time:n.time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration})),t.push(r)}return $a(s,o,a)},uo.svg.axis=function(){function t(t){t.each(function(){var t,u=uo.select(this),c=this.__chart__||r,f=this.__chart__=r.copy(),h=null==l?f.ticks?f.ticks.apply(f,s):f.domain():l,d=null==e?f.tickFormat?f.tickFormat.apply(f,s):x:e,p=u.selectAll(".tick").data(h,f),g=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Bo),v=uo.transition(p.exit()).style("opacity",Bo).remove(),m=uo.transition(p.order()).style("opacity",1),y=Math.max(i,0)+o,b=Xi(f),_=u.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),uo.transition(_));g.append("line"),g.append("text");var A,k,M,E,T=g.select("line"),L=m.select("line"),S=p.select("text").text(d),C=g.select("text"),R=m.select("text"),I="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(t=ro,A="x",M="y",k="x2",E="y2",S.attr("dy",0>I?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+b[0]+","+I*a+"V0H"+b[1]+"V"+I*a)):(t=no,A="y",M="x",k="y2",E="x2",S.attr("dy",".32em").style("text-anchor",0>I?"end":"start"),w.attr("d","M"+I*a+","+b[0]+"H0V"+b[1]+"H"+I*a)),T.attr(E,I*i),C.attr(M,I*y),L.attr(k,0).attr(E,I*i),R.attr(A,0).attr(M,I*y),f.rangeBand){var P=f,O=P.rangeBand()/2;c=f=function(t){return P(t)+O}}else c.rangeBand?c=f:v.call(t,f,c);g.call(t,c,f),m.call(t,f,f)})}var e,r=uo.scale.linear(),n=Yl,i=6,a=6,o=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(r=e,t):r},t.orient=function(e){return arguments.length?(n=e in Wl?e+"":Yl,t):n},t.ticks=function(){return arguments.length?(s=fo(arguments),t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(r){return arguments.length?(e=r,t):e},t.tickSize=function(e){var r=arguments.length;return r?(i=+e,a=+arguments[r-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(a=+e,t):a},t.tickPadding=function(e){return arguments.length?(o=+e,t):o},t.tickSubdivide=function(){return arguments.length&&t},t};var Yl="bottom",Wl={top:1,right:1,bottom:1,left:1};uo.svg.brush=function(){function t(n){n.each(function(){var n=uo.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",a).on("touchstart.brush",a),o=n.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),n.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=n.selectAll(".resize").data(g,x);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Zl[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var l,f=uo.transition(n),h=uo.transition(o);u&&(l=Xi(u),h.attr("x",l[0]).attr("width",l[1]-l[0]),r(f)),c&&(l=Xi(c),h.attr("y",l[0]).attr("height",l[1]-l[0]),i(f)),e(f)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+f[+/e$/.test(t)]+","+h[+/^s/.test(t)]+")"})}function r(t){t.select(".extent").attr("x",f[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function a(){function a(){32==uo.event.keyCode&&(S||(b=null,R[0]-=f[1],R[1]-=h[1],S=2),E())}function g(){32==uo.event.keyCode&&2==S&&(R[0]+=f[1],R[1]+=h[1],S=0,E())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),S||(uo.event.altKey?(b||(b=[(f[0]+f[1])/2,(h[0]+h[1])/2]),R[0]=f[+(t[0]c?(i=n,n=c):i=c),g[0]!=n||g[1]!=i?(r?s=null:o=null,g[0]=n,g[1]=i,!0):void 0}function y(){v(),k.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),uo.select("body").style("cursor",null),I.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),C(),A({type:"brushend"})}var b,x,_=this,w=uo.select(uo.event.target),A=l.of(_,arguments),k=uo.select(_),M=w.datum(),T=!/^(n|s)$/.test(M)&&u,L=!/^(e|w)$/.test(M)&&c,S=w.classed("extent"),C=$(_),R=uo.mouse(_),I=uo.select(n(_)).on("keydown.brush",a).on("keyup.brush",g);if(uo.event.changedTouches?I.on("touchmove.brush",v).on("touchend.brush",y):I.on("mousemove.brush",v).on("mouseup.brush",y), k.interrupt().selectAll("*").interrupt(),S)R[0]=f[0]-R[0],R[1]=h[0]-R[1];else if(M){var P=+/w$/.test(M),O=+/^n/.test(M);x=[f[1-P]-R[0],h[1-O]-R[1]],R[0]=f[P],R[1]=h[O]}else uo.event.altKey&&(b=R.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),uo.select("body").style("cursor",w.style("cursor")),A({type:"brushstart"}),v()}var o,s,l=L(t,"brushstart","brush","brushend"),u=null,c=null,f=[0,0],h=[0,0],d=!0,p=!0,g=Ql[0];return t.event=function(t){t.each(function(){var t=l.of(this,arguments),e={x:f,y:h,i:o,j:s},r=this.__chart__||e;this.__chart__=e,Vl?uo.select(this).transition().each("start.brush",function(){o=r.i,s=r.j,f=r.x,h=r.y,t({type:"brushstart"})}).tween("brush:brush",function(){var r=wn(f,e.x),n=wn(h,e.y);return o=s=null,function(i){f=e.x=r(i),h=e.y=n(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(u=e,g=Ql[!u<<1|!c],t):u},t.y=function(e){return arguments.length?(c=e,g=Ql[!u<<1|!c],t):c},t.clamp=function(e){return arguments.length?(u&&c?(d=!!e[0],p=!!e[1]):u?d=!!e:c&&(p=!!e),t):u&&c?[d,p]:u?d:c?p:null},t.extent=function(e){var r,n,i,a,l;return arguments.length?(u&&(r=e[0],n=e[1],c&&(r=r[0],n=n[0]),o=[r,n],u.invert&&(r=u(r),n=u(n)),r>n&&(l=r,r=n,n=l),r==f[0]&&n==f[1]||(f=[r,n])),c&&(i=e[0],a=e[1],u&&(i=i[1],a=a[1]),s=[i,a],c.invert&&(i=c(i),a=c(a)),i>a&&(l=i,i=a,a=l),i==h[0]&&a==h[1]||(h=[i,a])),t):(u&&(o?(r=o[0],n=o[1]):(r=f[0],n=f[1],u.invert&&(r=u.invert(r),n=u.invert(n)),r>n&&(l=r,r=n,n=l))),c&&(s?(i=s[0],a=s[1]):(i=h[0],a=h[1],c.invert&&(i=c.invert(i),a=c.invert(a)),i>a&&(l=i,i=a,a=l))),u&&c?[[r,i],[n,a]]:u?[r,n]:c&&[i,a])},t.clear=function(){return t.empty()||(f=[0,0],h=[0,0],o=s=null),t},t.empty=function(){return!!u&&f[0]==f[1]||!!c&&h[0]==h[1]},uo.rebind(t,l,"on")};var Zl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ql=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],$l=vs.format=ws.timeFormat,Kl=$l.utc,Jl=Kl("%Y-%m-%dT%H:%M:%S.%LZ");$l.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?io:Jl,io.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},io.toString=Jl.toString,vs.second=Vt(function(t){return new ms(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),vs.seconds=vs.second.range,vs.seconds.utc=vs.second.utc.range,vs.minute=Vt(function(t){return new ms(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),vs.minutes=vs.minute.range,vs.minutes.utc=vs.minute.utc.range,vs.hour=Vt(function(t){var e=t.getTimezoneOffset()/60;return new ms(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),vs.hours=vs.hour.range,vs.hours.utc=vs.hour.utc.range,vs.month=Vt(function(t){return t=vs.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),vs.months=vs.month.range,vs.months.utc=vs.month.utc.range;var tu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],eu=[[vs.second,1],[vs.second,5],[vs.second,15],[vs.second,30],[vs.minute,1],[vs.minute,5],[vs.minute,15],[vs.minute,30],[vs.hour,1],[vs.hour,3],[vs.hour,6],[vs.hour,12],[vs.day,1],[vs.day,2],[vs.week,1],[vs.month,1],[vs.month,3],[vs.year,1]],ru=$l.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",Re]]),nu={range:function(t,e,r){return uo.range(Math.ceil(t/r)*r,+e,r).map(oo)},floor:x,ceil:x};eu.year=vs.year,vs.scale=function(){return ao(uo.scale.linear(),eu,ru)};var iu=eu.map(function(t){return[t[0].utc,t[1]]}),au=Kl.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",Re]]);iu.year=vs.year.utc,vs.scale.utc=function(){return ao(uo.scale.linear(),iu,au)},uo.text=St(function(t){return t.responseText}),uo.json=function(t,e){return Ct(t,"application/json",so,e)},uo.html=function(t,e){return Ct(t,"text/html",lo,e)},uo.xml=St(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=uo,t(uo)):"object"==typeof r&&r.exports?r.exports=uo:this.d3=uo}()},{}],63:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(0>=i)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;i>a;++a)o[a]=e;else for(a=0;i>a;++a)o[a]=n(t,e,r+1);return o}function i(t,e){var r,n;for(r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function a(t,e){switch("undefined"==typeof e&&(e=0),typeof t){case"number":if(t>0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],64:[function(e,r,n){(function(n,i){(function(){"use strict";function a(t){return"function"==typeof t||"object"==typeof t&&null!==t}function o(t){return"function"==typeof t}function s(t){X=t}function l(t){Q=t}function u(){return function(){n.nextTick(p)}}function c(){return function(){G(p)}}function f(){var t=0,e=new J(p),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}function h(){var t=new MessageChannel;return t.port1.onmessage=p,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(p,1)}}function p(){for(var t=0;Z>t;t+=2){var e=rt[t],r=rt[t+1];e(r),rt[t]=void 0,rt[t+1]=void 0}Z=0}function g(){try{var t=e,r=t("vertx");return G=r.runOnLoop||r.runOnContext,c()}catch(n){return d()}}function v(t,e){var r=this,n=r._state;if(n===ot&&!t||n===st&&!e)return this;var i=new this.constructor(y),a=r._result;if(n){var o=arguments[n-1];Q(function(){O(n,i,o,a)})}else C(r,i,t,e);return i}function m(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var r=new e(y);return E(r,t),r}function y(){}function b(){return new TypeError("You cannot resolve a promise with itself")}function x(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return lt.error=e,lt}}function w(t,e,r,n){try{t.call(e,r,n)}catch(i){return i}}function A(t,e,r){Q(function(t){var n=!1,i=w(r,e,function(r){n||(n=!0,e!==r?E(t,r):L(t,r))},function(e){n||(n=!0,S(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&i&&(n=!0,S(t,i))},t)}function k(t,e){e._state===ot?L(t,e._result):e._state===st?S(t,e._result):C(e,void 0,function(e){E(t,e)},function(e){S(t,e)})}function M(t,e,r){e.constructor===t.constructor&&r===nt&&constructor.resolve===it?k(t,e):r===lt?S(t,lt.error):void 0===r?L(t,e):o(r)?A(t,e,r):L(t,e)}function E(t,e){t===e?S(t,b()):a(e)?M(t,e,_(e)):L(t,e)}function T(t){t._onerror&&t._onerror(t._result),R(t)}function L(t,e){t._state===at&&(t._result=e,t._state=ot,0!==t._subscribers.length&&Q(R,t))}function S(t,e){t._state===at&&(t._state=st,t._result=e,Q(T,t))}function C(t,e,r,n){var i=t._subscribers,a=i.length;t._onerror=null,i[a]=e,i[a+ot]=r,i[a+st]=n,0===a&&t._state&&Q(R,t)}function R(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n,i,a=t._result,o=0;oo;o++)C(n.resolve(t[o]),void 0,e,r);return i}function F(t){var e=this,r=new e(y);return S(r,t),r}function B(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function j(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this._id=dt++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==t&&("function"!=typeof t&&B(),this instanceof U?N(this,t):j())}function V(t,e){this._instanceConstructor=t,this.promise=new t(y),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?L(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&L(this.promise,this._result))):S(this.promise,this._validationError())}function q(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=t.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(t.Promise=pt)}var H;H=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var G,X,Y,W=H,Z=0,Q=function(t,e){rt[Z]=t,rt[Z+1]=e,Z+=2,2===Z&&(X?X(p):Y())},$="undefined"!=typeof window?window:void 0,K=$||{},J=K.MutationObserver||K.WebKitMutationObserver,tt="undefined"!=typeof n&&"[object process]"==={}.toString.call(n),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);Y=tt?u():J?f():et?h():void 0===$&&"function"==typeof e?g():d();var nt=v,it=m,at=void 0,ot=1,st=2,lt=new I,ut=new I,ct=z,ft=D,ht=F,dt=0,pt=U;U.all=ct,U.race=ft,U.resolve=it,U.reject=ht,U._setScheduler=s,U._setAsap=l,U._asap=Q,U.prototype={constructor:U,then:nt,"catch":function(t){return this.then(null,t)}};var gt=V;V.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},V.prototype._enumerate=function(){for(var t=this.length,e=this._input,r=0;this._state===at&&t>r;r++)this._eachEntry(e[r],r)},V.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===it){var i=_(t);if(i===nt&&t._state!==at)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(r===pt){var a=new r(y);M(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new r(function(e){e(t)}),e)}else this._willSettleAt(n(t),e)},V.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===at&&(this._remaining--,t===st?S(n,r):this._result[e]=r),0===this._remaining&&L(n,this._result)},V.prototype._willSettleAt=function(t,e){var r=this;C(t,void 0,function(t){r._settledAt(ot,e,t)},function(t){r._settledAt(st,e,t)})};var vt=q,mt={Promise:pt,polyfill:vt};"function"==typeof t&&t.amd?t(function(){return mt}):"undefined"!=typeof r&&r.exports?r.exports=mt:"undefined"!=typeof this&&(this.ES6Promise=mt),vt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:15}],65:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;r>n;n++)if(e=t.charCodeAt(n),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],66:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.gl=t,this.type=e,this.handle=r,this.length=n,this.usage=i}function i(t,e,r,n,i,a){var o=i.length*i.BYTES_PER_ELEMENT;if(0>a)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 a(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;n>i;++i)r[i]=t[i];return r}function o(t,e){for(var r=1,n=e.length-1;n>=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var a=t.createBuffer(),o=new n(t,r,a,0,i);return o.update(e),o}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),f=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],h=n.prototype;h.bind=function(){this.gl.bindBuffer(this.type,this.handle)},h.unbind=function(){this.gl.bindBuffer(this.type,null)},h.dispose=function(){this.gl.deleteBuffer(this.handle)},h.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),h=c(s,t.shape);u.assign(h,t),0>e?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),0>e?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t=0|t,0>=t&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:131,"ndarray-ops":130,"typedarray-pool":151}],67:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l){this.plot=t,this.shader=e,this.fillShader=r,this.pickShader=n,this.positionBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.fillPositionBuffer=s,this.fillColorBuffer=l,this.fillVerts=0,this.xData=[],this.yData=[],this.shape=[0,0],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.numVertices=0,this.lineWidth=1}function i(t,e){var r=Math.floor(e);if(0>r)return t[0];if(r>=t.length-1)return t[t.length-1];var n=e-r;return(1-n)*t[r]+n*t[r+1]}function a(t,e){var r=t.gl,i=s(r,p.vertex,p.fragment),a=s(r,p.pickVertex,p.pickFragment),o=s(r,p.fillVertex,p.fragment),u=l(r),c=l(r),f=l(r),h=l(r),d=l(r),g=new n(t,i,o,a,u,c,f,h,d);return g.update(e),t.addObject(g),g}e.exports=a;var o=t("iota-array"),s=t("gl-shader"),l=t("gl-buffer"),u=t("ndarray"),c=t("surface-nets"),f=t("cdt2d"),h=t("clean-pslg"),d=t("binary-search-bounds"),p=t("./lib/shaders"),g=n.prototype,v=[1,0,0,0,0,1,1,0,1,1,0,1];g.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0];return function(){var r,n,i=this.plot,a=this.shader,o=this.fillShader,s=this.bounds,l=this.numVertices,u=this.fillVerts,c=i.gl,f=i.viewBox,h=i.dataBox,d=s[2]-s[0],p=s[3]-s[1],g=h[2]-h[0],v=h[3]-h[1];if(t[0]=2*d/g,t[4]=2*p/v,t[6]=2*(s[0]-h[0])/g-1,t[7]=2*(s[1]-h[1])/v-1,e[0]=f[2]-f[0],e[1]=f[3]-f[1],u>0&&(o.bind(),r=o.uniforms,r.viewTransform=t,r.screenShape=e,n=a.attributes,this.fillPositionBuffer.bind(),n.position.pointer(),this.fillColorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,u)),l>0){a.bind();var m=this.lineWidth*i.pixelRatio;r=a.uniforms,r.viewTransform=t,r.screenShape=e,r.lineWidth=m,r.pointSize=1e3,n=a.attributes,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,16,0),n.tangent.pointer(c.FLOAT,!1,16,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,l),r.lineWidth=0,r.pointSize=m,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,48,0),n.tangent.pointer(c.FLOAT,!1,48,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0,12,0),c.drawArrays(c.POINTS,0,l/3)}}}(),g.drawPick=function(){return function(t){return t}}(),g.pick=function(t,e,r){return null},g.update=function(t){function e(t,e,r,n){var i=n-r;return Math.abs(i)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/i))}t=t||{};var r=t.shape||[0,0],n=t.x||o(r[0]),a=t.y||o(r[1]),s=t.z||new Float32Array(r[0]*r[1]),l=t.levels||[],p=t.levelColors||[],g=this.bounds,m=g[0]=n[0],y=g[1]=a[0],b=g[2]=n[n.length-1],x=g[3]=a[a.length-1];m===b&&(g[2]+=1,b+=1),y===x&&(g[3]+=1,x+=1);var _=1/(b-m),w=1/(x-y);this.xData=n,this.yData=a,this.lineWidth=t.lineWidth||1;for(var A=u(s,r),k=[],M=[],E=[],T=[],L=[[0,0],[r[0]-1,0],[0,r[1]-1],[r[0]-1,r[1]-1]],S=0;S0&&C===l[S-1])){for(var R=c(A,C),I=255*p[4*S]|0,P=255*p[4*S+1]|0,O=255*p[4*S+2]|0,N=255*p[4*S+3]|0,z=R.cells,D=R.positions,F=Array(D.length),B=0;B1)){var q,H=V[0],G=V[1],X=A.get(Math.floor(H),Math.floor(G)),Y=A.get(Math.floor(H),Math.ceil(G)),W=A.get(Math.ceil(H),Math.floor(G)),Z=A.get(Math.ceil(H),Math.ceil(G));0===Math.floor(V[0])&&C>=X!=C>Y?q=[0,e(C,V[1],X,Y)]:Math.ceil(V[0])===r[0]-1&&C>=W!=C>Z?q=[r[0]-1,e(C,V[1],W,Z)]:0===Math.floor(V[1])&&C>=X!=C>W?q=[e(C,V[0],X,W),0]:Math.ceil(V[1])===r[1]-1&&C>=Y!=C>Z&&(q=[e(C,V[0],Y,Z),r[1]-1]),q&&(z.push([B,D.length]),F.push(L.length),D.push(q))}}}for(B=0;BB;++B){var yt=L[gt[B]],bt=i(n,yt[0]),xt=i(a,yt[1]);vt+=yt[0],mt+=yt[1],ht.push(_*(bt-m),w*(xt-y))}vt/=3,mt/=3;var _t=Math.floor(vt),wt=Math.floor(mt),At=vt-_t,kt=mt-wt,Mt=A.get(_t,wt),Et=A.get(_t,wt+1),Tt=A.get(_t+1,wt),Lt=A.get(_t+1,wt+1),St=(1-kt)*((1-At)*Mt+At*Tt)+kt*((1-At)*Et+At*Lt),Ct=d.le(l,St)+1,Rt=255*ct[4*Ct+0]|0,It=255*ct[4*Ct+1]|0,Pt=255*ct[4*Ct+2]|0,Ot=255*ct[4*Ct+3]|0;ft.push(Rt,It,Pt,Ot,Rt,It,Pt,Ot,Rt,It,Pt,Ot),dt+=3}this.fillPositionBuffer.update(new Float32Array(ht)),this.fillColorBuffer.update(new Uint8Array(ft)),this.fillVerts=dt}},g.dispose=function(){this.plot.removeObject(this)}},{"./lib/shaders":68,"binary-search-bounds":69,cdt2d:16,"clean-pslg":23,"gl-buffer":66,"gl-shader":96,"iota-array":123,ndarray:131,"surface-nets":146}],68:[function(t,e,r){"use strict";e.exports={fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 tangent;\nattribute vec4 color;\n\nuniform mat3 viewTransform;\nuniform vec2 screenShape;\nuniform float lineWidth;\nuniform float pointSize;\n\nvarying vec4 fragColor;\n\nvoid main() {\n fragColor = color;\n\n vec3 vPosition = viewTransform * vec3(position, 1.0);\n vec2 vTangent = normalize(viewTransform * vec3(tangent, 0)).xy;\n vec2 offset = vec2(vTangent.y, -vTangent.x) / screenShape;\n\n gl_Position = vec4(\n vPosition.xy + offset * lineWidth * vPosition.z,\n 0,\n vPosition.z);\n\n gl_PointSize = pointSize;\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragId;\nvoid main() {\n gl_FragColor = fragId;\n}\n",pickVertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 viewTransform;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\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 / 255.0;\n\n vec3 vPosition = viewTransform * vec3(position, 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n",fillVertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 color;\n\nuniform mat3 viewTransform;\n\nvarying vec4 fragColor;\n\nvoid main() {\n fragColor = color;\n vec3 vPosition = viewTransform * vec3(position, 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"}},{}],69:[function(t,e,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],70:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.shader=e,this.buffer=r,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.color=[0,0,0,1]}function i(t,e){var r=a(t.gl,l.vertex,l.fragment),i=o(t.gl),s=new n(t,r,i);return s.update(e),t.addObject(s),s}var a=t("gl-shader"),o=t("gl-buffer"),s=t("typedarray-pool"),l=t("./lib/shaders");e.exports=i;var u=[[1,0,0,1,0,0],[1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,1,0,0],[1,0,0,1,0,0],[1,0,-1,0,0,1],[1,0,-1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,1],[1,0,-1,0,0,1],[-1,0,-1,0,0,1],[-1,0,-1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,1],[-1,0,-1,0,0,1],[0,1,1,0,0,0],[0,1,-1,0,0,0],[0,-1,-1,0,0,0],[0,-1,-1,0,0,0],[0,1,1,0,0,0],[0,-1,1,0,0,0],[0,1,0,-1,1,0],[0,1,0,-1,-1,0],[0,1,0,1,-1,0],[0,1,0,1,1,0],[0,1,0,-1,1,0],[0,1,0,1,-1,0],[0,-1,0,-1,1,0],[0,-1,0,-1,-1,0],[0,-1,0,1,-1,0],[0,-1,0,1,1,0],[0,-1,0,-1,1,0],[0,-1,0,1,-1,0]],c=n.prototype;c.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[1,1];return function(){var r=this.plot,n=this.shader,i=this.buffer,a=this.bounds,o=this.numPoints;if(o){var s=r.gl,l=r.dataBox,c=r.viewBox,f=r.pixelRatio,h=a[2]-a[0],d=a[3]-a[1],p=l[2]-l[0],g=l[3]-l[1];t[0]=2*h/p,t[4]=2*d/g,t[6]=2*(a[0]-l[0])/p-1,t[7]=2*(a[1]-l[1])/g-1;var v=c[2]-c[0],m=c[3]-c[1];e[0]=2*f/v,e[1]=2*f/m,i.bind(),n.bind(),n.uniforms.viewTransform=t,n.uniforms.pixelScale=e,n.uniforms.color=this.color,n.attributes.position.pointer(s.FLOAT,!1,16,0),n.attributes.pixelOffset.pointer(s.FLOAT,!1,16,8),s.drawArrays(s.TRIANGLES,0,o*u.length)}}}(),c.drawPick=function(t){return t},c.pick=function(t,e){return null},c.update=function(t){t=t||{};var e,r,n,i=t.positions||[],a=t.errors||[],o=1;"lineWidth"in t&&(o=+t.lineWidth);var l=5;"capSize"in t&&(l=+t.capSize),this.color=(t.color||[0,0,0,1]).slice();var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],f=this.numPoints=i.length>>1;for(e=0;f>e;++e)r=i[2*e],n=i[2*e+1],c[0]=Math.min(r,c[0]),c[1]=Math.min(n,c[1]),c[2]=Math.max(r,c[2]),c[3]=Math.max(n,c[3]);c[2]===c[0]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);var h=1/(c[2]-c[0]),d=1/(c[3]-c[1]),p=c[0],g=c[1],v=s.mallocFloat32(f*u.length*4),m=0;for(e=0;f>e;++e){r=i[2*e],n=i[2*e+1];for(var y=a[4*e],b=a[4*e+1],x=a[4*e+2],_=a[4*e+3],w=0;wk?k*=y:k>0&&(k*=b),0>M?M*=x:M>0&&(M*=_),v[m++]=h*(r-p+k),v[m++]=d*(n-g+M),v[m++]=o*A[2]+(l+o)*A[4],v[m++]=o*A[3]+(l+o)*A[5]}}this.buffer.update(v),s.free(v)},c.dispose=function(){this.plot.removeObject(this),this.shader.dispose(),this.buffer.dispose()}},{"./lib/shaders":71,"gl-buffer":66,"gl-shader":96,"typedarray-pool":151}],71:[function(t,e,r){e.exports={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 pixelOffset;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvoid main() {\n vec3 scrPosition = viewTransform * vec3(position, 1);\n gl_Position = vec4(\n scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n 0,\n scrPosition.z);\n}\n",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"}},{}],72:[function(t,e,r){"use strict";function n(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING),r=t.getParameter(t.RENDERBUFFER_BINDING),n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function a(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);y=new Array(r+1);for(var n=0;r>=n;++n){for(var i=new Array(r),a=0;n>a;++a)i[a]=t.COLOR_ATTACHMENT0+a;for(var a=n;r>a;++a)i[a]=t.NONE;y[n]=i}}function o(t){switch(t){case p:throw new Error("gl-fbo: Framebuffer unsupported");case g:throw new Error("gl-fbo: Framebuffer incomplete attachment");case v:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case m:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function s(t,e,r,n,i,a){if(!n)return null;var o=d(t,e,r,i,n);return o.magFilter=t.NEAREST,o.minFilter=t.NEAREST,o.mipSamples=1,o.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,a,t.TEXTURE_2D,o.handle,0),o}function l(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 u(t){var e=n(t.gl),r=t.gl,a=t.handle=r.createFramebuffer(),u=t._shape[0],c=t._shape[1],f=t.color.length,h=t._ext,d=t._useStencil,p=t._useDepth,g=t._colorType;r.bindFramebuffer(r.FRAMEBUFFER,a);for(var v=0;f>v;++v)t.color[v]=s(r,u,c,g,r.RGBA,r.COLOR_ATTACHMENT0+v);0===f?(t._color_rb=l(r,u,c,r.RGBA4,r.COLOR_ATTACHMENT0),h&&h.drawBuffersWEBGL(y[0])):f>1&&h.drawBuffersWEBGL(y[f]);var m=r.getExtension("WEBGL_depth_texture");m?d?t.depth=s(r,u,c,m.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var v=0;vl;++l)this.color[l]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=n,this._useDepth=a,this._useStencil=o;var c=this,f=[0|e,0|r];Object.defineProperties(f,{0:{get:function(){return c._shape[0]},set:function(t){return c.width=t}},1:{get:function(){return c._shape[1]},set:function(t){return c.height=t}}}),this._shapeVector=f,u(this)}function f(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 a=t.gl,s=a.getParameter(a.MAX_RENDERBUFFER_SIZE);if(0>e||e>s||0>r||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(a),u=0;ue||e>o||0>r||r>o)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),0>s)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var f=!0;"depth"in n&&(f=!!n.depth);var h=!1;return"stencil"in n&&(h=!!n.stencil),new c(t,e,r,l,s,f,h,i)}var d=t("gl-texture2d");e.exports=h;var p,g,v,m,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t=0|t,f(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t=0|t,f(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;eh;++h)e[h]=r>>8*h&255;this.pickOffset=r,i.bind();var d=i.uniforms;d.viewTransform=t,d.pickOffset=e;var p=i.attributes;return this.positionBuffer.bind(),p.position.pointer(),this.idBuffer.bind(),p.pickId.pointer(o.UNSIGNED_BYTE,!1),o.drawArrays(o.TRIANGLES,0,this.numVertices),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(n>r||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){t=t||{};var e=t.shape||[0,0],r=t.x||o(e[0]),n=t.y||o(e[1]),i=t.z||new Float32Array(e[0]*e[1]);this.xData=r,this.yData=n;var l=t.colorLevels||[0],u=t.colorValues||[0,0,0,1],c=l.length,f=this.bounds,d=f[0]=r[0],p=f[1]=n[0],g=f[2]=r[r.length-1],v=f[3]=n[n.length-1],m=1/(g-d),y=1/(v-p),b=e[0]*e[1]*(h.length>>>1);this.numVertices=b;var x=s.mallocUint8(4*b),_=s.mallocFloat32(2*b),w=s.mallocUint32(b),A=e[0],k=e[1];this.shape=[A,k];for(var M=0,E=0;k-1>E;++E)for(var T=y*(n[E]-p),L=y*(n[E+1]-p),S=0;A-1>S;++S)for(var C=m*(r[S]-d),R=m*(r[S+1]-d),I=0;IU)P=u[0],O=u[1],N=u[2],z=u[3];else if(U===c-1)P=u[4*c-4],O=u[4*c-3],N=u[4*c-2],z=u[4*c-1];else{var V=(j-l[U])/(l[U+1]-l[U]),q=1-V,H=4*U,G=4*(U+1);P=q*u[H]+V*u[G],O=q*u[H+1]+V*u[G+1],N=q*u[H+2]+V*u[G+2],z=q*u[H+3]+V*u[G+3]}x[4*M]=255*P,x[4*M+1]=255*O,x[4*M+2]=255*N,x[4*M+3]=255*z,_[2*M]=(1-D)*C+D*R,_[2*M+1]=(1-F)*T+F*L,w[M]=E*A+S,M+=1}this.positionBuffer.update(_),this.colorBuffer.update(x),this.idBuffer.update(w),s.free(_),s.free(x),s.free(w)},f.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBuffer.dispose(),this.colorBuffer.dispose(),this.idBuffer.dispose(),this.plot.removeObject(this)}},{"./lib/shaders":74,"binary-search-bounds":75,"gl-buffer":66,"gl-shader":96,"iota-array":123,"typedarray-pool":151}],74:[function(t,e,r){"use strict";e.exports={fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 color;\n\nuniform mat3 viewTransform;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vPosition = viewTransform * vec3(position, 1.0);\n fragColor = color;\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragId;\nvoid main() {\n gl_FragColor = fragId;\n}\n",pickVertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 viewTransform;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\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 / 255.0;\n\n vec3 vPosition = viewTransform * vec3(position, 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"}},{}],75:[function(t,e,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],76:[function(t,e,r){r.lineVertex="precision mediump float;\n#define GLSLIFY 1\n\nfloat inverse_1_0(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse_1_0(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse_1_0(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse_1_0(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\nvoid main() {\n vec2 dir = (matrix * vec3(d, 0)).xy;\n vec3 base = matrix * vec3(a, 1);\n vec2 n = 0.5 * width *\n normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(base.xy/base.z + n, 0, 1);\n}\n",r.lineFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\nuniform vec2 screenShape;\nuniform sampler2D dashPattern;\nuniform float dashLength;\n\nvarying vec2 direction;\n\nvoid main() {\n float t = fract(dot(direction, gl_FragCoord.xy) / dashLength);\n vec4 pcolor = color * texture2D(dashPattern, vec2(t, 0.0)).r;\n gl_FragColor = vec4(pcolor.rgb * pcolor.a, pcolor.a);\n}\n",r.mitreVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 p;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float radius;\n\nvoid main() {\n vec3 pp = matrix * vec3(p, 1);\n gl_Position = vec4(pp.xy, 0, pp.z);\n gl_PointSize = radius;\n}\n",r.mitreFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n if(length(gl_PointCoord.xy - 0.5) > 0.25) {\n discard;\n }\n gl_FragColor = vec4(color.rgb, color.a);\n}\n",r.pickVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 a, d;\nattribute vec4 pick0, pick1;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float width;\n\nvarying vec4 pickA, pickB;\n\nfloat inverse_1_0(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse_1_0(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse_1_0(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse_1_0(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\n\nvoid main() {\n vec3 base = matrix * vec3(a, 1);\n vec2 n = width *\n normalize(screenShape.yx * vec2(d.y, -d.x)) / screenShape.xy;\n gl_Position = vec4(base.xy/base.z + n, 0, 1);\n pickA = pick0;\n pickB = pick1;\n}\n",r.pickFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 pickOffset;\n\nvarying vec4 pickA, pickB;\n\nvoid main() {\n vec4 fragId = vec4(pickA.xyz, 0.0);\n if(pickB.w > pickA.w) {\n fragId.xyz = pickB.xyz;\n }\n\n fragId += pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n gl_FragColor = fragId / 255.0;\n}\n",r.fillVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 projectAxis;\nuniform float projectValue;\nuniform float depth;\n\nvoid main() {\n vec3 base = matrix * vec3(a, 1);\n vec2 p = base.xy / base.z;\n if(d.y < 0.0 || (d.y == 0.0 && d.x < 0.0)) {\n if(dot(p, projectAxis) < projectValue) {\n p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n }\n }\n gl_Position = vec4(p, depth, 1);\n}\n",r.fillFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"},{}],77:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.dashPattern=e,this.lineBuffer=r,this.pickBuffer=n,this.lineShader=i,this.mitreShader=a,this.fillShader=o,this.pickShader=s,this.usingDashes=!1,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.width=1,this.color=[0,0,1,1],this.fill=[!1,!1,!1,!1],this.fillColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.data=null,this.numPoints=0,this.vertCount=0,this.pickOffset=0,this.lodBuffer=[]}function i(t){return t.map(function(t){return t.slice()})}function a(t,e){var r=t.gl,i=s(r),a=s(r),u=l(r,[1,1]),c=o(r,f.lineVertex,f.lineFragment),h=o(r,f.mitreVertex,f.mitreFragment),d=o(r,f.fillVertex,f.fillFragment),p=o(r,f.pickVertex,f.pickFragment),g=new n(t,u,i,a,c,h,d,p);return t.addObject(g),g.update(e),g}e.exports=a;var o=t("gl-shader"),s=t("gl-buffer"),l=t("gl-texture2d"),u=t("ndarray"),c=t("typedarray-pool"),f=t("./lib/shaders"),h=n.prototype;h.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0],r=[1,0],n=[-1,0],i=[0,1],a=[0,-1];return function(){var o=this.plot,s=this.color,l=this.width,u=(this.numPoints,this.bounds),c=this.vertCount;if(c){var f=o.gl,h=o.viewBox,d=o.dataBox,p=o.pixelRatio,g=u[2]-u[0],v=u[3]-u[1],m=d[2]-d[0],y=d[3]-d[1],b=h[2]-h[0],x=h[3]-h[1];t[0]=2*g/m,t[4]=2*v/y,t[6]=2*(u[0]-d[0])/m-1,t[7]=2*(u[1]-d[1])/y-1,e[0]=b,e[1]=x;var _=this.lineBuffer;_.bind();var w=this.fill;if(w[0]||w[1]||w[2]||w[3]){var A=this.fillShader;A.bind();var k=A.uniforms;k.matrix=t,k.depth=o.nextDepthValue();var M=A.attributes;M.a.pointer(f.FLOAT,!1,16,0),M.d.pointer(f.FLOAT,!1,16,8),f.depthMask(!0),f.enable(f.DEPTH_TEST);var E=this.fillColor;w[0]&&(k.color=E[0],k.projectAxis=n,k.projectValue=1,f.drawArrays(f.TRIANGLES,0,c)),w[1]&&(k.color=E[1],k.projectAxis=a,k.projectValue=1,f.drawArrays(f.TRIANGLES,0,c)),w[2]&&(k.color=E[2],k.projectAxis=r,k.projectValue=1,f.drawArrays(f.TRIANGLES,0,c)),w[3]&&(k.color=E[3],k.projectAxis=i,k.projectValue=1,f.drawArrays(f.TRIANGLES,0,c)),f.depthMask(!1),f.disable(f.DEPTH_TEST)}var T=this.lineShader;T.bind();var L=T.uniforms;L.matrix=t,L.color=s,L.width=l*p,L.screenShape=e,L.dashPattern=this.dashPattern.bind(),L.dashLength=this.dashLength*p;var S=T.attributes;if(S.a.pointer(f.FLOAT,!1,16,0),S.d.pointer(f.FLOAT,!1,16,8),f.drawArrays(f.TRIANGLES,0,c),l>2&&!this.usingDashes){var C=this.mitreShader;C.bind();var R=C.uniforms;R.matrix=t,R.color=s,R.screenShape=e,R.radius=l*p,C.attributes.p.pointer(f.FLOAT,!1,48,0),f.drawArrays(f.POINTS,0,c/3|0)}}}}(),h.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0],r=[0,0,0,0];return function(n){var i=this.plot,a=this.pickShader,o=this.lineBuffer,s=this.pickBuffer,l=this.width,u=this.numPoints,c=this.bounds,f=this.vertCount,h=i.gl,d=i.viewBox,p=i.dataBox,g=i.pickPixelRatio,v=c[2]-c[0],m=c[3]-c[1],y=p[2]-p[0],b=p[3]-p[1],x=d[2]-d[0],_=d[3]-d[1];if(this.pickOffset=n,!f)return n+u;t[0]=2*v/y,t[4]=2*m/b,t[6]=2*(c[0]-p[0])/y-1,t[7]=2*(c[1]-p[1])/b-1,e[0]=x,e[1]=_,r[0]=255&n,r[1]=n>>>8&255,r[2]=n>>>16&255,r[3]=n>>>24,a.bind();var w=a.uniforms;w.matrix=t,w.width=l*g,w.pickOffset=r,w.screenShape=e;var A=a.attributes;return o.bind(),A.a.pointer(h.FLOAT,!1,16,0),A.d.pointer(h.FLOAT,!1,16,8),s.bind(),A.pick0.pointer(h.UNSIGNED_BYTE,!1,8,0),A.pick1.pointer(h.UNSIGNED_BYTE,!1,8,4),h.drawArrays(h.TRIANGLES,0,f),n+u}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var a=r-n,o=this.data;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},h.update=function(t){t=t||{};var e=this.plot.gl;!!t.connectGaps;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);for(var r=t.dashes||[1],n=0,a=0;a1,this.dashPattern=l(e,u(o,[n,1,4],[1,0,0])),this.dashPattern.minFilter=e.NEAREST,this.dashPattern.magFilter=e.NEAREST,this.dashLength=n,c.free(o);var d=t.positions;this.data=d;var p=this.bounds;p[0]=p[1]=1/0,p[2]=p[3]=-(1/0);var g=this.numPoints=d.length>>>1;if(0!==g){for(var a=0;g>a;++a){var v=d[2*a],m=d[2*a+1];isNaN(v)||isNaN(m)||(p[0]=Math.min(p[0],v),p[1]=Math.min(p[1],m),p[2]=Math.max(p[2],v),p[3]=Math.max(p[3],m))}p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);for(var y=c.mallocFloat32(24*(g-1)),b=c.mallocUint32(12*(g-1)),x=y.length,_=b.length,s=g,w=0;s>1;){var A=--s,v=d[2*s],m=d[2*s+1],k=A-1,M=d[2*k],E=d[2*k+1];if(!(isNaN(v)||isNaN(m)||isNaN(M)||isNaN(E))){w+=1,v=(v-p[0])/(p[2]-p[0]),m=(m-p[1])/(p[3]-p[1]),M=(M-p[0])/(p[2]-p[0]),E=(E-p[1])/(p[3]-p[1]);var T=M-v,L=E-m,S=A|1<<24,C=A-1,R=A,I=A-1|1<<24;y[--x]=-L,y[--x]=-T,y[--x]=m,y[--x]=v,b[--_]=S,b[--_]=C,y[--x]=L,y[--x]=T,y[--x]=E,y[--x]=M,b[--_]=R,b[--_]=I,y[--x]=-L,y[--x]=-T,y[--x]=E,y[--x]=M,b[--_]=R,b[--_]=I,y[--x]=L,y[--x]=T,y[--x]=E,y[--x]=M,b[--_]=R,b[--_]=I,y[--x]=-L,y[--x]=-T,y[--x]=m,y[--x]=v,b[--_]=S,b[--_]=C,y[--x]=L,y[--x]=T,y[--x]=m,y[--x]=v,b[--_]=S,b[--_]=C}}this.vertCount=6*w,this.lineBuffer.update(y.subarray(x)),this.pickBuffer.update(b.subarray(_)),c.free(y),c.free(b)}},h.dispose=function(){this.plot.removeObject(this),this.lineBuffer.dispose(),this.pickBuffer.dispose(),this.lineShader.dispose(),this.mitreShader.dispose(),this.fillShader.dispose(),this.pickShader.dispose(),this.dashPattern.dispose()}},{"./lib/shaders":76,"gl-buffer":66,"gl-shader":96,"gl-texture2d":115,ndarray:131,"typedarray-pool":151}],78:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r+r,s=n+n,l=i+i,u=r*o,c=n*o,f=n*s,h=i*o,d=i*s,p=i*l,g=a*o,v=a*s,m=a*l;return t[0]=1-f-p,t[1]=c+m,t[2]=h-v,t[3]=0,t[4]=c-m,t[5]=1-u-p,t[6]=d+g,t[7]=0,t[8]=h+v,t[9]=d-g,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],79:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=a(e,[0,0,0,1,1,0,1,1]),i=o(e,s.boxVert,s.lineFrag);return new n(t,r,i)}e.exports=i;var a=t("gl-buffer"),o=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawBox=function(){var t=[0,0],e=[0,0];return function(r,n,i,a,o){var s=this.plot,l=this.shader,u=s.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=a,l.uniforms.lo=t,l.uniforms.hi=e,l.uniforms.color=o,u.drawArrays(u.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":82,"gl-buffer":66,"gl-shader":96}],80:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.vbo=e,this.shader=r,this.tickShader=n,this.ticks=[[],[]]}function i(t,e){return t-e}function a(t){var e=t.gl,r=o(e),i=s(e,u.gridVert,u.gridFrag),a=s(e,u.tickVert,u.gridFrag),l=new n(t,r,i,a);return l}e.exports=a;var o=t("gl-buffer"),s=t("gl-shader"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.draw=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){for(var n=this.plot,i=this.vbo,a=this.shader,o=this.ticks,s=n.gl,l=n._tickBounds,u=n.dataBox,c=n.viewBox,f=n.gridLineWidth,h=n.gridLineColor,d=n.gridLineEnable,p=n.pixelRatio,g=0;2>g;++g){var v=l[g],m=l[g+2],y=m-v,b=.5*(u[g+2]+u[g]),x=u[g+2]-u[g];e[g]=2*y/x,t[g]=2*(v-b)/x}a.bind(),i.bind(),a.attributes.dataCoord.pointer(),a.uniforms.dataShift=t,a.uniforms.dataScale=e;for(var _=0,g=0;2>g;++g){r[0]=r[1]=0,r[g]=1,a.uniforms.dataAxis=r,a.uniforms.lineWidth=f[g]/(c[g+2]-c[g])*p,a.uniforms.color=h[g];var w=6*o[g].length;d[g]&&w&&s.drawArrays(s.TRIANGLES,_,w),_+=w}}}(),c.drawTickMarks=function(){var t=[0,0],e=[0,0],r=[1,0],n=[0,1],a=[0,0],o=[0,0];return function(){for(var s=this.plot,u=this.vbo,c=this.tickShader,f=this.ticks,h=s.gl,d=s._tickBounds,p=s.dataBox,g=s.viewBox,v=s.pixelRatio,m=s.screenBox,y=m[2]-m[0],b=m[3]-m[1],x=g[2]-g[0],_=g[3]-g[1],w=0;2>w;++w){var A=d[w],k=d[w+2],M=k-A,E=.5*(p[w+2]+p[w]),T=p[w+2]-p[w];e[w]=2*M/T,t[w]=2*(A-E)/T}e[0]*=x/y,t[0]*=x/y,e[1]*=_/b,t[1]*=_/b,c.bind(),u.bind(),c.attributes.dataCoord.pointer();var L=c.uniforms;L.dataShift=t,L.dataScale=e;var S=s.tickMarkLength,C=s.tickMarkWidth,R=s.tickMarkColor,I=0,P=6*f[0].length,O=Math.min(l.ge(f[0],(p[0]-d[0])/(d[2]-d[0]),i),f[0].length),N=Math.min(l.gt(f[0],(p[2]-d[0])/(d[2]-d[0]),i),f[0].length),z=I+6*O,D=6*Math.max(0,N-O),F=Math.min(l.ge(f[1],(p[1]-d[1])/(d[3]-d[1]),i),f[1].length),B=Math.min(l.gt(f[1],(p[3]-d[1])/(d[3]-d[1]),i),f[1].length),j=P+6*F,U=6*Math.max(0,B-F);a[0]=2*(g[0]-S[1])/y-1,a[1]=(g[3]+g[1])/b-1,o[0]=S[1]*v/y,o[1]=C[1]*v/b,U&&(L.color=R[1],L.tickScale=o,L.dataAxis=n,L.screenOffset=a,h.drawArrays(h.TRIANGLES,j,U)),a[0]=(g[2]+g[0])/y-1,a[1]=2*(g[1]-S[0])/b-1,o[0]=C[0]*v/y,o[1]=S[0]*v/b,D&&(L.color=R[0],L.tickScale=o,L.dataAxis=r,L.screenOffset=a,h.drawArrays(h.TRIANGLES,z,D)),a[0]=2*(g[2]+S[3])/y-1,a[1]=(g[3]+g[1])/b-1,o[0]=S[3]*v/y,o[1]=C[3]*v/b,U&&(L.color=R[3],L.tickScale=o,L.dataAxis=n,L.screenOffset=a,h.drawArrays(h.TRIANGLES,j,U)),a[0]=(g[2]+g[0])/y-1,a[1]=2*(g[3]+S[2])/b-1,o[0]=C[2]*v/y,o[1]=S[2]*v/b,D&&(L.color=R[2],L.tickScale=o,L.dataAxis=r,L.screenOffset=a,h.drawArrays(h.TRIANGLES,z,D))}}(),c.update=function(){var t=[1,1,-1,-1,1,-1],e=[1,-1,1,1,-1,-1];return function(r){for(var n=r.ticks,i=r.bounds,a=new Float32Array(18*(n[0].length+n[1].length)),o=(this.plot.zeroLineEnable,0),s=[[],[]],l=0;2>l;++l)for(var u=s[l],c=n[l],f=i[l],h=i[l+2],d=0;dg;++g)a[o++]=p,a[o++]=t[g],a[o++]=e[g]}this.ticks=s,this.vbo.update(a)}}(),c.dispose=function(){this.vbo.dispose(),this.shader.dispose(),this.tickShader.dispose()}},{"./shaders":82,"binary-search-bounds":84,"gl-buffer":66,"gl-shader":96}],81:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=a(e,[-1,-1,-1,1,1,-1,1,1]),i=o(e,s.lineVert,s.lineFrag),l=new n(t,r,i);return l}e.exports=i;var a=t("gl-buffer"),o=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawLine=function(){var t=[0,0],e=[0,0];return function(r,n,i,a,o,s){var l=this.plot,u=this.shader,c=l.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=a,u.uniforms.start=t,u.uniforms.end=e,u.uniforms.width=o*l.pixelRatio,u.uniforms.color=s,c.drawArrays(c.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":82,"gl-buffer":66,"gl-shader":96}],82:[function(t,e,r){"use strict";var n="precision lowp float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = vec4(color.xyz * color.w, color.w);\n}\n";e.exports={lineVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 start, end;\nuniform float width;\n\nvec2 perp(vec2 v) {\n return vec2(v.y, -v.x);\n}\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n vec2 delta = normalize(perp(start - end));\n vec2 offset = mix(start, end, 0.5 * (coord.y+1.0));\n gl_Position = vec4(screen(offset + 0.5 * width * delta * coord.x), 0, 1);\n}\n",lineFrag:n,textVert:"#define GLSLIFY 1\nattribute vec3 textCoordinate;\n\nuniform vec2 dataScale, dataShift, dataAxis, screenOffset, textScale;\nuniform float angle;\n\nvoid main() {\n float dataOffset = textCoordinate.z;\n vec2 glyphOffset = textCoordinate.xy;\n mat2 glyphMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n vec2 screenCoordinate = dataAxis * (dataScale * dataOffset + dataShift) +\n glyphMatrix * glyphOffset * textScale + screenOffset;\n gl_Position = vec4(screenCoordinate, 0, 1);\n}\n",textFrag:n,gridVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale;\nuniform float lineWidth;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n pos += 10.0 * dataCoord.y * vec2(dataAxis.y, -dataAxis.x) + dataCoord.z * lineWidth;\n gl_Position = vec4(pos, 0, 1);\n}\n",gridFrag:n,boxVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 lo, hi;\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n gl_Position = vec4(screen(mix(lo, hi, coord)), 0, 1);\n}\n",tickVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n"}},{}],83:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r,this.tickOffset=[[],[]],this.tickX=[[],[]],this.labelOffset=[0,0],this.labelCount=[0,0]}function i(t){var e=t.gl,r=a(e),i=o(e,u.textVert,u.textFrag),s=new n(t,r,i);return s}e.exports=i;var a=t("gl-buffer"),o=t("gl-shader"),s=t("text-cache"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.drawTicks=function(){var t=[0,0],e=[0,0],r=[0,0];return function(n){var i=this.plot,a=this.shader,o=this.tickX[n],s=this.tickOffset[n],u=i.gl,c=i.viewBox,f=i.dataBox,h=i.screenBox,d=i.pixelRatio,p=i.tickEnable,g=i.tickPad,v=i.tickColor,m=i.tickAngle,y=(i.tickMarkLength,i.labelEnable),b=i.labelPad,x=i.labelColor,_=i.labelAngle,w=this.labelOffset[n],A=this.labelCount[n],k=l.lt(o,f[n]),M=l.le(o,f[n+2]);t[0]=t[1]=0,t[n]=1,e[n]=(c[2+n]+c[n])/(h[2+n]-h[n])-1;var E=2/h[2+(1^n)]-h[1^n];e[1^n]=E*c[1^n]-1,p[n]&&(e[1^n]-=E*d*g[n],M>k&&s[M]>s[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n],a.uniforms.angle=m[n],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n]&&A&&(e[1^n]-=E*d*b[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n],a.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,A)),e[1^n]=E*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=E*d*g[n+2],M>k&&s[M]>s[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n+2],a.uniforms.angle=m[n+2],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n+2]&&A&&(e[1^n]+=E*d*b[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n+2],a.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,A))}}(),c.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,o=r.titleCenter,u=r.pixelRatio;if(this.titleCount){for(var c=0;2>c;++c)e[c]=2*(o[c]*u-a[c])/(a[2+c]-a[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,a=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;2>u;++u){var c=a[u],f=a[u+2],h=f-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],g=l[u],v=l[u+2],m=v-g,y=s[u],b=s[u+2],x=b-y;e[u]=2*h/p*m/x,t[u]=2*(c-d)/p*m/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){for(var e=[],r=t.ticks,n=t.bounds,i=0;2>i;++i){for(var a=[Math.floor(e.length/3)],o=[-(1/0)],l=r[i],u=0;ui;++i){this.labelOffset[i]=Math.floor(e.length/3);for(var g=s(t.labelFont[i],t.labels[i]).data,p=t.labelSize[i],u=0;up;++p)if(f[p]&&n[p]<=0&&n[p+2]>=0){var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(g,e[1],g,e[3],d[p],h[p]):o.drawLine(e[0],g,e[2],g,d[p],h[p])}}for(var p=0;pp;++p)s.drawTicks(p);this.titleEnable&&s.drawTitle();for(var b=this.overlays,p=0;pu;++u){var c=s[u].slice(0);0!==c.length&&(c.sort(a),l[u]=Math.min(l[u],c[0].x),l[u+2]=Math.max(l[u+2],c[c.length-1].x))}this.grid.update({bounds:l,ticks:s}),this.text.update({bounds:l,ticks:s,labels:t.labels||["x","y"],labelSize:t.labelSize||[12,12],labelFont:t.labelFont||["sans-serif","sans-serif"],title:t.title||"",titleSize:t.titleSize||18,titleFont:t.titleFont||"sans-serif"}),this.setDirty()},h.dispose=function(){this.box.dispose(),this.grid.dispose(),this.text.dispose(),this.line.dispose();for(var t=this.objects.length-1;t>=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},h.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},h.removeObject=function(t){for(var e=this.objects,r=0;ro;++o)i[o]=Math.min(i[o],r[a+o]),i[2+o]=Math.max(i[2+o],r[a+o]);return h[t]={coords:r,normals:n,bounds:i}}function i(t,e,r,n,i,a,o){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.offsetBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.numVertices=0,this.pickOffset=0,this.points=null}function a(t,e){var r=t.gl,n=o(r,f.vertex,f.fragment),a=o(r,f.pickVertex,f.pickFragment),l=s(r),u=s(r),c=s(r),h=s(r),d=new i(t,n,a,l,u,c,h);return d.update(e),t.addObject(d),d}e.exports=a;var o=t("gl-shader"),s=t("gl-buffer"),l=t("text-cache"),u=t("typedarray-pool"),c=t("vectorize-text"),f=t("./lib/shaders"),h={},d=i.prototype;!function(){function t(){var t=this.plot,n=this.bounds,i=t.viewBox,a=t.dataBox,o=t.pixelRatio,s=n[2]-n[0],l=n[3]-n[1],u=a[2]-a[0],c=a[3]-a[1];e[0]=2*s/u,e[4]=2*l/c,e[6]=2*(n[0]-a[0])/u-1,e[7]=2*(n[1]-a[1])/c-1;var f=i[2]-i[0],h=i[3]-i[1];r[0]=2*o/f,r[1]=2*o/h}var e=[1,0,0,0,1,0,0,0,1],r=[1,1];d.draw=function(){var n=this.plot,i=this.shader,a=this.numVertices;if(a){var o=n.gl;t.call(this),i.bind(),i.uniforms.pixelScale=r,i.uniforms.viewTransform=e,this.positionBuffer.bind(),i.attributes.position.pointer(),this.offsetBuffer.bind(),i.attributes.offset.pointer(),this.colorBuffer.bind(),i.attributes.color.pointer(o.UNSIGNED_BYTE,!0),o.drawArrays(o.TRIANGLES,0,a)}};var n=[0,0,0,0];d.drawPick=function(i){var a=this.plot,o=this.pickShader,s=this.numVertices,l=a.gl;if(this.pickOffset=i,!s)return i;for(var u=0;4>u;++u)n[u]=i>>8*u&255;return t.call(this),o.bind(),o.uniforms.pixelScale=r,o.uniforms.viewTransform=e,o.uniforms.pickOffset=n,this.positionBuffer.bind(),o.attributes.position.pointer(),this.offsetBuffer.bind(),o.attributes.offset.pointer(),this.idBuffer.bind(),o.attributes.id.pointer(l.UNSIGNED_BYTE,!1),l.drawArrays(l.TRIANGLES,0,s),i+this.numPoints}}(),d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var a=r-n,o=this.points;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},d.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],i=t.glyphs||[],a=t.sizes||[],o=t.borderWidths||[],s=t.borderColors||[];this.points=e;for(var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],f=0,h=0;h>1;for(var d=0;2>d;++d)c[d]=Math.min(c[d],e[2*h+d]),c[2+d]=Math.max(c[2+d],e[2*h+d])}c[0]===c[2]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);for(var p=1/(c[2]-c[0]),g=1/(c[3]-c[1]),v=c[0],m=c[1],y=u.mallocFloat32(2*f),b=u.mallocFloat32(2*f),x=u.mallocUint8(4*f),_=u.mallocUint32(f),w=0,h=0;h=a?i(0,a-1,t,e,r,n):f(0,a-1,t,e,r,n)}function i(t,e,r,n,i,a){for(var o=t+1;e>=o;++o){for(var s=r[o],l=n[2*o],u=n[2*o+1],c=i[o],f=a[o],h=o;h>t;){var d=r[h-1],p=n[2*(h-1)];if((d-s||l-p)>=0)break;r[h]=d,n[2*h]=p,n[2*h+1]=n[2*h-1],i[h]=i[h-1],a[h]=a[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=u,i[h]=c,a[h]=f}}function a(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=u,a[e]=c}function o(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function s(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],u=i[2*t+1],c=a[t],f=o[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,a[r]=c,o[r]=f}function l(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function f(t,e,r,n,d,p){var g=(e-t+1)/6|0,v=t+g,m=e-g,y=t+e>>1,b=y-g,x=y+g,_=v,w=b,A=y,k=x,M=m,E=t+1,T=e-1,L=0;u(_,w,r,n,d,p)&&(L=_,_=w,w=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L),u(_,A,r,n,d,p)&&(L=_,_=A,A=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(_,k,r,n,d,p)&&(L=_,_=k,k=L),u(A,k,r,n,d,p)&&(L=A,A=k,k=L),u(w,M,r,n,d,p)&&(L=w,w=M,M=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L);var S=r[w],C=n[2*w],R=n[2*w+1],I=d[w],P=p[w],O=r[k],N=n[2*k],z=n[2*k+1],D=d[k],F=p[k],B=_,j=A,U=M,V=v,q=y,H=m,G=r[B],X=r[j],Y=r[U];r[V]=G,r[q]=X,r[H]=Y;for(var W=0;2>W;++W){var Z=n[2*B+W],Q=n[2*j+W],$=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=Q,n[2*H+W]=$}var K=d[B],J=d[j],tt=d[U];d[V]=K,d[q]=J,d[H]=tt;var et=p[B],rt=p[j],nt=p[U];p[V]=et,p[q]=rt,p[H]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var it=E;T>=it;++it)if(c(it,S,C,R,I,r,n,d))it!==E&&a(it,E,r,n,d,p),++E;else if(!c(it,O,N,z,D,r,n,d))for(;;){if(c(T,O,N,z,D,r,n,d)){c(T,S,C,R,I,r,n,d)?(s(it,E,T,r,n,d,p),++E,--T):(a(it,T,r,n,d,p),--T);break}if(--T=E-2-t?i(t,E-2,r,n,d,p):f(t,E-2,r,n,d,p),h>=e-(T+2)?i(T+2,e,r,n,d,p):f(T+2,e,r,n,d,p),h>=T-E?i(E,T,r,n,d,p):f(E,T,r,n,d,p)}e.exports=n;var h=32},{}],91:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){for(var l=r,u=r;n>u;++u){var c=t[2*u],f=t[2*u+1],h=e[u];c>=i&&o>=c&&f>=a&&s>=f&&(u===l?l+=1:(t[2*u]=t[2*l],t[2*u+1]=t[2*l+1],e[u]=e[l],t[2*l]=c,t[2*l+1]=f,e[l]=h,l+=1))}return l}function i(t,e,r){this.pixelSize=t,this.offset=e,this.count=r}function a(t,e,r,a){function l(i,a,o,s,u,c){var f=.5*o,h=s+1,d=u-s;r[_]=d,x[_++]=c;for(var p=0;2>p;++p)for(var g=0;2>g;++g){var v=i+p*f,m=a+g*f,y=n(t,e,h,u,v,m,v+f,m+f);if(y!==h){if(y-h>=Math.max(.9*d,32)){var b=u+s>>>1;l(v,m,f,h,b,c+1),h=b}l(v,m,f,h,y,c+1),h=y}}}var u=t.length>>>1;if(1>u)return[];for(var c=1/0,f=1/0,h=-(1/0),d=-(1/0),p=0;u>p;++p){var g=t[2*p],v=t[2*p+1];c=Math.min(c,g),h=Math.max(h,g),f=Math.min(f,v),d=Math.max(d,v),e[p]=p}c===h&&(h+=1+Math.abs(h)),f===d&&(d+=1+Math.abs(h));var m=1/(h-c),y=1/(d-f),b=Math.max(h-c,d-f);a=a||[0,0,0,0],a[0]=c,a[1]=f,a[2]=h,a[3]=d;var x=o.mallocInt32(u),_=0;l(c,f,b,0,u,0),s(x,t,e,r,u);for(var w=[],A=0,k=u,_=u-1;_>=0;--_){t[2*_]=(t[2*_]-c)*m,t[2*_+1]=(t[2*_+1]-f)*y;var M=x[_];M!==A&&(w.push(new i(b*Math.pow(.5,M),_+1,k-(_+1))),k=_+1,A=M)}return w.push(new i(b*Math.pow(.5,M+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":90,"typedarray-pool":151}],92:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.weightBuffer=n,this.shader=i,this.pickShader=a,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=o(r),s=o(r),l=o(r),u=a(r,c.pointVertex,c.pointFragment),f=a(r,c.pickVertex,c.pickFragment),h=new n(t,i,s,l,u,f);return h.update(e),t.addObject(h),h}var a=t("gl-shader"),o=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var f=n.prototype;f.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},f.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords);var r=t.positions,n=u.mallocFloat32(r.length),i=u.mallocInt32(r.length>>>1);n.set(r);var a=u.mallocFloat32(r.length);this.points=r,this.scales=l(n,i,a,this.bounds),this.offsetBuffer.update(n),this.pickBuffer.update(i),this.weightBuffer.update(a);for(var o=u.mallocFloat32(r.length>>>1),s=0,c=0;s>>1,this.pickOffset=0},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.scales,o=this.offsetBuffer,l=this.pickBuffer,u=this.bounds,c=this.size,f=this.borderSize,h=n.gl,d=n.pickPixelRatio,p=n.viewBox,g=n.dataBox;if(0===this.pointCount)return r;var v=u[2]-u[0],m=u[3]-u[1],y=g[2]-g[0],b=g[3]-g[1],x=(p[2]-p[0])*d/n.pixelRatio,_=(p[3]-p[1])*d/n.pixelRatio,w=Math.min(y/x,b/_);t[0]=2*v/y,t[4]=2*m/b,t[6]=2*(u[0]-g[0])/y-1,t[7]=2*(u[1]-g[1])/b-1,this.pickOffset=r,e[0]=255&r,e[1]=r>>8&255,e[2]=r>>16&255,e[3]=r>>24&255,i.bind(),i.uniforms.matrix=t,i.uniforms.color=this.color,i.uniforms.borderColor=this.borderColor,i.uniforms.pointSize=d*(c+f),i.uniforms.pickOffset=e,0===this.borderSize?i.uniforms.centerFraction=2:i.uniforms.centerFraction=c/(c+f+1.25),o.bind(),i.attributes.position.pointer(),l.bind(),i.attributes.pickId.pointer(h.UNSIGNED_BYTE);for(var A=this.xCoords,k=(g[0]-u[0]-w*c*d)/v,M=(g[2]-u[0]+w*c*d)/v,E=a.length-1;E>=0;--E){var T=a[E];if(!(T.pixelSize1)){var L=T.offset,S=T.count+L,C=s.ge(A,k,L,S-1),R=s.lt(A,M,C,S-1)+1;R>C&&h.drawArrays(h.POINTS,C,R-C)}}return r+this.pointCount}}(),f.draw=function(){var t=[1,0,0,0,1,0,0,0,1];return function(){var e=this.plot,r=this.shader,n=this.scales,i=this.offsetBuffer,a=this.bounds,o=this.size,l=this.borderSize,u=e.gl,c=e.pixelRatio,f=e.viewBox,h=e.dataBox;if(0!==this.pointCount){var d=a[2]-a[0],p=a[3]-a[1],g=h[2]-h[0],v=h[3]-h[1],m=f[2]-f[0],y=f[3]-f[1],b=Math.min(g/m,v/y);t[0]=2*d/g,t[4]=2*p/v,t[6]=2*(a[0]-h[0])/g-1,t[7]=2*(a[1]-h[1])/v-1,r.bind(),r.uniforms.matrix=t,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointSize=c*(o+l),r.uniforms.useWeight=1,0===this.borderSize?r.uniforms.centerFraction=2:r.uniforms.centerFraction=o/(o+l+1.25),i.bind(),r.attributes.position.pointer(),this.weightBuffer.bind(),r.attributes.weight.pointer();for(var x=this.xCoords,_=(h[0]-a[0]-b*o*c)/d,w=(h[2]-a[0]+b*o*c)/d,A=!0,k=n.length-1;k>=0;--k){var M=n[k];if(!(M.pixelSize1)){var E=M.offset,T=M.count+E,L=s.ge(x,_,E,T-1),S=s.lt(x,w,L,T-1)+1;S>L&&u.drawArrays(u.POINTS,L,S-L),A&&(A=!1,r.uniforms.useWeight=0)}}}}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(n>r||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":88,"binary-search-bounds":89,"gl-buffer":66,"gl-shader":96,"snap-points-2d":91,"typedarray-pool":151}],93:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],94:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=o(r,[0,0,0,1,1,0,1,1]),l=a(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var a=t("gl-shader"),o=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),a=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,f=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],h=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],d=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(f=Math.max(f,u[0]),h=Math.max(h,u[1]),d=Math.min(d,u[2]),p=Math.min(p,u[3]),!(f>d||h>p)){o.bind();var g=s[2]-s[0],v=s[3]-s[1];if(this.outerFill&&(o.drawBox(0,0,g,h,i),o.drawBox(0,h,f,p,i),o.drawBox(0,p,g,v,i),o.drawBox(d,h,g,p,i)),this.innerFill&&o.drawBox(f,h,d,p,n),r>0){var m=r*c;o.drawBox(f-m,h-m,d+m,h+m,a),o.drawBox(f-m,p-m,d+m,p+m,a),o.drawBox(f-m,h-m,f+m,p+m,a),o.drawBox(d-m,h-m,d+m,p+m,a)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":93,"gl-buffer":66,"gl-shader":96}],95:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function a(t,e){var r=o(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=a;var o=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(255>_inline_55_arg0_||255>_inline_55_arg1_||255>_inline_55_arg2_||255>_inline_55_arg3_){var _inline_55_l=_inline_55_arg4_-_inline_55_arg6_[0],_inline_55_a=_inline_55_arg5_-_inline_55_arg6_[1],_inline_55_f=_inline_55_l*_inline_55_l+_inline_55_a*_inline_55_a;_inline_55_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;r*e*4>i;++i)n[i]=255}return t}}}),f.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))},f.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},f.query=function(t,e,r){if(!this.gl)return null;var i=this.fbo.shape.slice();t=0|t,e=0|e,"number"!=typeof r&&(r=1);var a=0|Math.min(Math.max(t-r,0),i[0]),o=0|Math.min(Math.max(t+r,0),i[0]),s=0|Math.min(Math.max(e-r,0),i[1]),u=0|Math.min(Math.max(e+r,0),i[1]);if(a>=o||s>=u)return null;var f=[o-a,u-s],h=l(this.buffer,[f[0],f[1],4],[4,4*i[0],1],4*(a+i[0]*s)),d=c(h.hi(f[0],f[1],1),r,r),p=d[0],g=d[1];if(0>p||Math.pow(this.radius,2)=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),E=0;k>E;++E)M[E]=_.length,x.push(A.name+"["+E+"]"),"number"==typeof A.location?_.push(A.location+E):Array.isArray(A.location)&&A.location.length===k&&"number"==typeof A.location[E]?_.push(0|A.location[E]):_.push(-1);b.push({name:A.name,type:A.type,locations:M})}else b.push({name:A.name,type:A.type,locations:[_.length]}),x.push(A.name),"number"==typeof A.location?_.push(0|A.location):_.push(-1)}for(var T=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(T)>=0;)T+=1;_[w]=T}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":97,"./lib/create-attributes":98,"./lib/create-uniforms":99,"./lib/reflect":100,"./lib/runtime-reflect":101,"./lib/shader-cache":102}],97:[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},{}],98:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;a>c;++c)l.push("x"+c),u.push("x"+c);l.push("if(x0.length===void 0){return gl.vertexAttrib"+a+"f(v,"+u.join()+")}else{return gl.vertexAttrib"+a+"fv(v,x0)}");var f=Function.apply(null,l),h=new n(t,e,r,i,a,f);Object.defineProperty(o,s,{set:function(e){return t.disableVertexAttribArray(i[r]),f(t,i[r],e),e},get:function(){return h},enumerable:!0})}function a(t,e,r,n,a,o,s){for(var l=new Array(a),u=new Array(a),c=0;a>c;++c)i(t,e,r[c],n,a,l,c),u[c]=l[c];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;a>e;++e)u[e].location=t[e];else for(var e=0;a>e;++e)u[e].location=t+e;return t},get:function(){for(var t=new Array(a),e=0;a>e;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,o,s){e=e||t.FLOAT,i=!!i,o=o||a*a,s=s||0;for(var l=0;a>l;++l){var u=n[r[l]];t.vertexAttribPointer(u,a,e,i,o,s+l*a),t.enableVertexAttribArray(u)}};var f=new Array(a),h=t["vertexAttrib"+a+"fv"];Object.defineProperty(o,s,{set:function(e){for(var i=0;a>i;++i){var o=n[r[i]];if(t.disableVertexAttribArray(o),Array.isArray(e[0]))h.call(t,o,e[i]);else{for(var s=0;a>s;++s)f[s]=e[a*i+s];h.call(t,o,f)}}return e},get:function(){return l},enumerable:!0})}function o(t,e,r,n){for(var o={},l=0,u=r.length;u>l;++l){var c=r[l],f=c.name,h=c.type,d=c.locations;switch(h){case"bool":case"int":case"float":i(t,e,d[0],n,1,o,f);break;default:if(h.indexOf("vec")>=0){var p=h.charCodeAt(h.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,o,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(t,e,d,n,p,o,f)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":97}],99:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function a(t,e,r,a){function l(r){var n=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}");return n(t,e,a)}function u(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(n>=0&&1>=n&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48; +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),u=this.objects,c=0;cu;++u){var c=s[u].slice(0);0!==c.length&&(c.sort(a),l[u]=Math.min(l[u],c[0].x),l[u+2]=Math.max(l[u+2],c[c.length-1].x))}this.grid.update({bounds:l,ticks:s}),this.text.update({bounds:l,ticks:s,labels:t.labels||["x","y"],labelSize:t.labelSize||[12,12],labelFont:t.labelFont||["sans-serif","sans-serif"],title:t.title||"",titleSize:t.titleSize||18,titleFont:t.titleFont||"sans-serif"}),this.setDirty()},h.dispose=function(){this.box.dispose(),this.grid.dispose(),this.text.dispose(),this.line.dispose();for(var t=this.objects.length-1;t>=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},h.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},h.removeObject=function(t){for(var e=this.objects,r=0;ro;++o)i[o]=Math.min(i[o],r[a+o]),i[2+o]=Math.max(i[2+o],r[a+o]);return h[t]={coords:r,normals:n,bounds:i}}function i(t,e,r,n,i,a,o){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.offsetBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.numVertices=0,this.pickOffset=0,this.points=null}function a(t,e){var r=t.gl,n=o(r,f.vertex,f.fragment),a=o(r,f.pickVertex,f.pickFragment),l=s(r),u=s(r),c=s(r),h=s(r),d=new i(t,n,a,l,u,c,h);return d.update(e),t.addObject(d),d}e.exports=a;var o=t("gl-shader"),s=t("gl-buffer"),l=t("text-cache"),u=t("typedarray-pool"),c=t("vectorize-text"),f=t("./lib/shaders"),h={},d=i.prototype;!function(){function t(){var t=this.plot,n=this.bounds,i=t.viewBox,a=t.dataBox,o=t.pixelRatio,s=n[2]-n[0],l=n[3]-n[1],u=a[2]-a[0],c=a[3]-a[1];e[0]=2*s/u,e[4]=2*l/c,e[6]=2*(n[0]-a[0])/u-1,e[7]=2*(n[1]-a[1])/c-1;var f=i[2]-i[0],h=i[3]-i[1];r[0]=2*o/f,r[1]=2*o/h}var e=[1,0,0,0,1,0,0,0,1],r=[1,1];d.draw=function(){var n=this.plot,i=this.shader,a=this.numVertices;if(a){var o=n.gl;t.call(this),i.bind(),i.uniforms.pixelScale=r,i.uniforms.viewTransform=e,this.positionBuffer.bind(),i.attributes.position.pointer(),this.offsetBuffer.bind(),i.attributes.offset.pointer(),this.colorBuffer.bind(),i.attributes.color.pointer(o.UNSIGNED_BYTE,!0),o.drawArrays(o.TRIANGLES,0,a)}};var n=[0,0,0,0];d.drawPick=function(i){var a=this.plot,o=this.pickShader,s=this.numVertices,l=a.gl;if(this.pickOffset=i,!s)return i;for(var u=0;4>u;++u)n[u]=i>>8*u&255;return t.call(this),o.bind(),o.uniforms.pixelScale=r,o.uniforms.viewTransform=e,o.uniforms.pickOffset=n,this.positionBuffer.bind(),o.attributes.position.pointer(),this.offsetBuffer.bind(),o.attributes.offset.pointer(),this.idBuffer.bind(),o.attributes.id.pointer(l.UNSIGNED_BYTE,!1),l.drawArrays(l.TRIANGLES,0,s),i+this.numPoints}}(),d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var a=r-n,o=this.points;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},d.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],i=t.glyphs||[],a=t.sizes||[],o=t.borderWidths||[],s=t.borderColors||[];this.points=e;for(var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],f=0,h=0;h>1;for(var d=0;2>d;++d)c[d]=Math.min(c[d],e[2*h+d]),c[2+d]=Math.max(c[2+d],e[2*h+d])}c[0]===c[2]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);for(var p=1/(c[2]-c[0]),g=1/(c[3]-c[1]),v=c[0],m=c[1],y=u.mallocFloat32(2*f),b=u.mallocFloat32(2*f),x=u.mallocUint8(4*f),_=u.mallocUint32(f),w=0,h=0;h=a?i(0,a-1,t,e,r,n):f(0,a-1,t,e,r,n)}function i(t,e,r,n,i,a){for(var o=t+1;e>=o;++o){for(var s=r[o],l=n[2*o],u=n[2*o+1],c=i[o],f=a[o],h=o;h>t;){var d=r[h-1],p=n[2*(h-1)];if((d-s||l-p)>=0)break;r[h]=d,n[2*h]=p,n[2*h+1]=n[2*h-1],i[h]=i[h-1],a[h]=a[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=u,i[h]=c,a[h]=f}}function a(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=u,a[e]=c}function o(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function s(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],u=i[2*t+1],c=a[t],f=o[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,a[r]=c,o[r]=f}function l(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function f(t,e,r,n,d,p){var g=(e-t+1)/6|0,v=t+g,m=e-g,y=t+e>>1,b=y-g,x=y+g,_=v,w=b,A=y,k=x,M=m,E=t+1,T=e-1,L=0;u(_,w,r,n,d,p)&&(L=_,_=w,w=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L),u(_,A,r,n,d,p)&&(L=_,_=A,A=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(_,k,r,n,d,p)&&(L=_,_=k,k=L),u(A,k,r,n,d,p)&&(L=A,A=k,k=L),u(w,M,r,n,d,p)&&(L=w,w=M,M=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L);var S=r[w],C=n[2*w],R=n[2*w+1],I=d[w],P=p[w],O=r[k],N=n[2*k],z=n[2*k+1],D=d[k],F=p[k],B=_,j=A,U=M,V=v,q=y,H=m,G=r[B],X=r[j],Y=r[U];r[V]=G,r[q]=X,r[H]=Y;for(var W=0;2>W;++W){var Z=n[2*B+W],Q=n[2*j+W],$=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=Q,n[2*H+W]=$}var K=d[B],J=d[j],tt=d[U];d[V]=K,d[q]=J,d[H]=tt;var et=p[B],rt=p[j],nt=p[U];p[V]=et,p[q]=rt,p[H]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var it=E;T>=it;++it)if(c(it,S,C,R,I,r,n,d))it!==E&&a(it,E,r,n,d,p),++E;else if(!c(it,O,N,z,D,r,n,d))for(;;){if(c(T,O,N,z,D,r,n,d)){c(T,S,C,R,I,r,n,d)?(s(it,E,T,r,n,d,p),++E,--T):(a(it,T,r,n,d,p),--T);break}if(--T=E-2-t?i(t,E-2,r,n,d,p):f(t,E-2,r,n,d,p),h>=e-(T+2)?i(T+2,e,r,n,d,p):f(T+2,e,r,n,d,p),h>=T-E?i(E,T,r,n,d,p):f(E,T,r,n,d,p)}e.exports=n;var h=32},{}],91:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){for(var l=r,u=r;n>u;++u){var c=t[2*u],f=t[2*u+1],h=e[u];c>=i&&o>=c&&f>=a&&s>=f&&(u===l?l+=1:(t[2*u]=t[2*l],t[2*u+1]=t[2*l+1],e[u]=e[l],t[2*l]=c,t[2*l+1]=f,e[l]=h,l+=1))}return l}function i(t,e,r){this.pixelSize=t,this.offset=e,this.count=r}function a(t,e,r,a){function l(i,a,o,s,u,c){var f=.5*o,h=s+1,d=u-s;r[_]=d,x[_++]=c;for(var p=0;2>p;++p)for(var g=0;2>g;++g){var v=i+p*f,m=a+g*f,y=n(t,e,h,u,v,m,v+f,m+f);if(y!==h){if(y-h>=Math.max(.9*d,32)){var b=u+s>>>1;l(v,m,f,h,b,c+1),h=b}l(v,m,f,h,y,c+1),h=y}}}var u=t.length>>>1;if(1>u)return[];for(var c=1/0,f=1/0,h=-(1/0),d=-(1/0),p=0;u>p;++p){var g=t[2*p],v=t[2*p+1];c=Math.min(c,g),h=Math.max(h,g),f=Math.min(f,v),d=Math.max(d,v),e[p]=p}c===h&&(h+=1+Math.abs(h)),f===d&&(d+=1+Math.abs(h));var m=1/(h-c),y=1/(d-f),b=Math.max(h-c,d-f);a=a||[0,0,0,0],a[0]=c,a[1]=f,a[2]=h,a[3]=d;var x=o.mallocInt32(u),_=0;l(c,f,b,0,u,0),s(x,t,e,r,u);for(var w=[],A=0,k=u,_=u-1;_>=0;--_){t[2*_]=(t[2*_]-c)*m,t[2*_+1]=(t[2*_+1]-f)*y;var M=x[_];M!==A&&(w.push(new i(b*Math.pow(.5,M),_+1,k-(_+1))),k=_+1,A=M)}return w.push(new i(b*Math.pow(.5,M+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":90,"typedarray-pool":151}],92:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.weightBuffer=n,this.shader=i,this.pickShader=a,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=o(r),s=o(r),l=o(r),u=a(r,c.pointVertex,c.pointFragment),f=a(r,c.pickVertex,c.pickFragment),h=new n(t,i,s,l,u,f);return h.update(e),t.addObject(h),h}var a=t("gl-shader"),o=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var f=n.prototype;f.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},f.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords);var r=t.positions,n=u.mallocFloat32(r.length),i=u.mallocInt32(r.length>>>1);n.set(r);var a=u.mallocFloat32(r.length);this.points=r,this.scales=l(n,i,a,this.bounds),this.offsetBuffer.update(n),this.pickBuffer.update(i),this.weightBuffer.update(a);for(var o=u.mallocFloat32(r.length>>>1),s=0,c=0;s>>1,this.pickOffset=0},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.scales,o=this.offsetBuffer,l=this.pickBuffer,u=this.bounds,c=this.size,f=this.borderSize,h=n.gl,d=n.pickPixelRatio,p=n.viewBox,g=n.dataBox;if(0===this.pointCount)return r;var v=u[2]-u[0],m=u[3]-u[1],y=g[2]-g[0],b=g[3]-g[1],x=(p[2]-p[0])*d/n.pixelRatio,_=(p[3]-p[1])*d/n.pixelRatio,w=Math.min(y/x,b/_);t[0]=2*v/y,t[4]=2*m/b,t[6]=2*(u[0]-g[0])/y-1,t[7]=2*(u[1]-g[1])/b-1,this.pickOffset=r,e[0]=255&r,e[1]=r>>8&255,e[2]=r>>16&255,e[3]=r>>24&255,i.bind(),i.uniforms.matrix=t,i.uniforms.color=this.color,i.uniforms.borderColor=this.borderColor,i.uniforms.pointSize=d*(c+f),i.uniforms.pickOffset=e,0===this.borderSize?i.uniforms.centerFraction=2:i.uniforms.centerFraction=c/(c+f+1.25),o.bind(),i.attributes.position.pointer(),l.bind(),i.attributes.pickId.pointer(h.UNSIGNED_BYTE);for(var A=this.xCoords,k=(g[0]-u[0]-w*c*d)/v,M=(g[2]-u[0]+w*c*d)/v,E=a.length-1;E>=0;--E){var T=a[E];if(!(T.pixelSize1)){var L=T.offset,S=T.count+L,C=s.ge(A,k,L,S-1),R=s.lt(A,M,C,S-1)+1;R>C&&h.drawArrays(h.POINTS,C,R-C)}}return r+this.pointCount}}(),f.draw=function(){var t=[1,0,0,0,1,0,0,0,1];return function(){var e=this.plot,r=this.shader,n=this.scales,i=this.offsetBuffer,a=this.bounds,o=this.size,l=this.borderSize,u=e.gl,c=e.pixelRatio,f=e.viewBox,h=e.dataBox;if(0!==this.pointCount){var d=a[2]-a[0],p=a[3]-a[1],g=h[2]-h[0],v=h[3]-h[1],m=f[2]-f[0],y=f[3]-f[1],b=Math.min(g/m,v/y);t[0]=2*d/g,t[4]=2*p/v,t[6]=2*(a[0]-h[0])/g-1,t[7]=2*(a[1]-h[1])/v-1,r.bind(),r.uniforms.matrix=t,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointSize=c*(o+l),r.uniforms.useWeight=1,0===this.borderSize?r.uniforms.centerFraction=2:r.uniforms.centerFraction=o/(o+l+1.25),i.bind(),r.attributes.position.pointer(),this.weightBuffer.bind(),r.attributes.weight.pointer();for(var x=this.xCoords,_=(h[0]-a[0]-b*o*c)/d,w=(h[2]-a[0]+b*o*c)/d,A=!0,k=n.length-1;k>=0;--k){var M=n[k];if(!(M.pixelSize1)){var E=M.offset,T=M.count+E,L=s.ge(x,_,E,T-1),S=s.lt(x,w,L,T-1)+1;S>L&&u.drawArrays(u.POINTS,L,S-L),A&&(A=!1,r.uniforms.useWeight=0)}}}}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(n>r||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":88,"binary-search-bounds":89,"gl-buffer":66,"gl-shader":96,"snap-points-2d":91,"typedarray-pool":151}],93:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],94:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=o(r,[0,0,0,1,1,0,1,1]),l=a(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var a=t("gl-shader"),o=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),a=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,f=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],h=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],d=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(f=Math.max(f,u[0]),h=Math.max(h,u[1]),d=Math.min(d,u[2]),p=Math.min(p,u[3]),!(f>d||h>p)){o.bind();var g=s[2]-s[0],v=s[3]-s[1];if(this.outerFill&&(o.drawBox(0,0,g,h,i),o.drawBox(0,h,f,p,i),o.drawBox(0,p,g,v,i),o.drawBox(d,h,g,p,i)),this.innerFill&&o.drawBox(f,h,d,p,n),r>0){var m=r*c;o.drawBox(f-m,h-m,d+m,h+m,a),o.drawBox(f-m,p-m,d+m,p+m,a),o.drawBox(f-m,h-m,f+m,p+m,a),o.drawBox(d-m,h-m,d+m,p+m,a)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":93,"gl-buffer":66,"gl-shader":96}],95:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function a(t,e){var r=o(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=a;var o=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(255>_inline_52_arg0_||255>_inline_52_arg1_||255>_inline_52_arg2_||255>_inline_52_arg3_){var _inline_52_l=_inline_52_arg4_-_inline_52_arg6_[0],_inline_52_a=_inline_52_arg5_-_inline_52_arg6_[1],_inline_52_f=_inline_52_l*_inline_52_l+_inline_52_a*_inline_52_a;_inline_52_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;r*e*4>i;++i)n[i]=255}return t}}}),f.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))},f.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},f.query=function(t,e,r){if(!this.gl)return null;var i=this.fbo.shape.slice();t=0|t,e=0|e,"number"!=typeof r&&(r=1);var a=0|Math.min(Math.max(t-r,0),i[0]),o=0|Math.min(Math.max(t+r,0),i[0]),s=0|Math.min(Math.max(e-r,0),i[1]),u=0|Math.min(Math.max(e+r,0),i[1]);if(a>=o||s>=u)return null;var f=[o-a,u-s],h=l(this.buffer,[f[0],f[1],4],[4,4*i[0],1],4*(a+i[0]*s)),d=c(h.hi(f[0],f[1],1),r,r),p=d[0],g=d[1];if(0>p||Math.pow(this.radius,2)=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),E=0;k>E;++E)M[E]=_.length,x.push(A.name+"["+E+"]"),"number"==typeof A.location?_.push(A.location+E):Array.isArray(A.location)&&A.location.length===k&&"number"==typeof A.location[E]?_.push(0|A.location[E]):_.push(-1);b.push({name:A.name,type:A.type,locations:M})}else b.push({name:A.name,type:A.type,locations:[_.length]}),x.push(A.name),"number"==typeof A.location?_.push(0|A.location):_.push(-1)}for(var T=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(T)>=0;)T+=1;_[w]=T}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":97,"./lib/create-attributes":98,"./lib/create-uniforms":99,"./lib/reflect":100,"./lib/runtime-reflect":101,"./lib/shader-cache":102}],97:[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},{}],98:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;a>c;++c)l.push("x"+c),u.push("x"+c);l.push("if(x0.length===void 0){return gl.vertexAttrib"+a+"f(v,"+u.join()+")}else{return gl.vertexAttrib"+a+"fv(v,x0)}");var f=Function.apply(null,l),h=new n(t,e,r,i,a,f);Object.defineProperty(o,s,{set:function(e){return t.disableVertexAttribArray(i[r]),f(t,i[r],e),e},get:function(){return h},enumerable:!0})}function a(t,e,r,n,a,o,s){for(var l=new Array(a),u=new Array(a),c=0;a>c;++c)i(t,e,r[c],n,a,l,c),u[c]=l[c];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;a>e;++e)u[e].location=t[e];else for(var e=0;a>e;++e)u[e].location=t+e;return t},get:function(){for(var t=new Array(a),e=0;a>e;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,o,s){e=e||t.FLOAT,i=!!i,o=o||a*a,s=s||0;for(var l=0;a>l;++l){var u=n[r[l]];t.vertexAttribPointer(u,a,e,i,o,s+l*a),t.enableVertexAttribArray(u)}};var f=new Array(a),h=t["vertexAttrib"+a+"fv"];Object.defineProperty(o,s,{set:function(e){for(var i=0;a>i;++i){var o=n[r[i]];if(t.disableVertexAttribArray(o),Array.isArray(e[0]))h.call(t,o,e[i]);else{for(var s=0;a>s;++s)f[s]=e[a*i+s];h.call(t,o,f)}}return e},get:function(){return l},enumerable:!0})}function o(t,e,r,n){for(var o={},l=0,u=r.length;u>l;++l){var c=r[l],f=c.name,h=c.type,d=c.locations;switch(h){case"bool":case"int":case"float":i(t,e,d[0],n,1,o,f);break;default:if(h.indexOf("vec")>=0){var p=h.charCodeAt(h.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,o,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(t,e,d,n,p,o,f)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":97}],99:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function a(t,e,r,a){function l(r){var n=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}");return n(t,e,a)}function u(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(n>=0&&1>=n&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48; if(2>i||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o=0&&1>=e&&t.length===4+e){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:f(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=h(r[i].type)}function p(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var u=1;ua;++a){var o=t.getActiveUniform(e,a);if(o){var s=n(t,o.type);if(o.size>1)for(var l=0;la;++a){var o=t.getActiveAttrib(e,a);o&&i.push({name:o.name,type:n(t,o.type)})}return i}r.uniforms=i,r.attributes=a;var o={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},s=null},{}],102:[function(t,e,r){"use strict";function n(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 i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function a(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);try{var a=f(i,r,e)}catch(o){throw console.warn("Failed to format compiler error: "+o),new c(i,"Error compiling shader:\n"+i)}throw new c(i,a.short,a.long)}return n}function o(t,e,r,n,i){var a=t.createProgram();t.attachShader(a,e),t.attachShader(a,r);for(var o=0;on;++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 g=i.prototype;g.getShaderReference=function(t,e){var r=this.gl,i=this.shaders[t===r.FRAGMENT_SHADER|0],o=i[e];if(o&&r.isShader(o.shader))o.count+=1;else{var s=a(r,t,e);o=i[e]=new n(p++,e,t,s,[],1,this)}return o},g.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),a=this.programs[i];return a&&this.gl.isProgram(a)||(this.programs[i]=a=o(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),a}},{"./GLError":97,"gl-format-compiler-error":103,"weakmap-shim":113}],103:[function(t,e,r){function n(t,e,r){"use strict";var n=o(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===a.FRAGMENT_SHADER?"fragment":"vertex");for(var u=i("Error compiling %s shader %s:\n",l,n),c=i("%s%s",u,t),f=t.split("\n"),h={},d=0;ds;s++)if(g=i(t[s]),"string"===g)v[v.length]=t[s];else if("array"===g){if(u=t[s],u[2])for(n=e[d],l=0;l=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],111:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":112}],112:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],113:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},"delete":function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":111}],114:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var a=n.prototype;a.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()},a.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]),u=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&a.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&a.drawLine(l,u,l,s[3],e[3],r[3])}},a.dispose=function(){this.plot.removeOverlay(this)}},{}],115:[function(t,e,r){"use strict";function n(t){v=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],m=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(0>e||e>i||0>r||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function a(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}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,a,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,v=o(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,v=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,v=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),f===a&&v)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(0>e||e>o||0>r||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new a(t,i,0|e.width,0|e.height,r,n)}function f(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=o(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var f,h,v=e.size;if(s)f=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var m=[n[2],n[2]*n[0],1];h=g.malloc(v,r);var y=d(h,n,m,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),f=h.subarray(0,v)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,f),s||g.free(h),new a(t,x,n[0],n[1],c,u)}function h(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=h;var v=null,m=null,y=null,b=function(t,e){p.muls(t,e,255)},x=a.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.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&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;2>e;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var a=this._mipLevels.indexOf(n)<0;a?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||0>e||0>r)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:131,"ndarray-ops":130,"typedarray-pool":151}],116:[function(t,e,r){function n(t){function e(t){t.length&&V.push({type:A[j],data:t,position:G,line:q,column:H})}function r(t){F=0,W+=t,D=W.length;for(var e;N=W[F],D>F;){switch(e=F,j){case f:F=L();break;case h:F=T();break;case d:F=E();break;case p:F=S();break;case g:F=I();break;case w:F=R();break;case v:F=P();break;case c:F=O();break;case x:F=M();break;case u:F=k()}if(e!==F)switch(W[e]){case"\n":H=0,++q;break;default:++H}}return B+=F,W=W.slice(F),V}function n(t){return U.length&&e(U.join("")),j=_,e("(eof)"),V}function k(){return U=U.length?[]:U,"/"===z&&"*"===N?(G=B+F-1,j=f,z=N,F+1):"/"===z&&"/"===N?(G=B+F-1,j=h,z=N,F+1):"#"===N?(j=d,G=B+F,F):/\s/.test(N)?(j=x,G=B+F,F):(X=/\d/.test(N),Y=/[^\w_]/.test(N),G=B+F,j=X?g:Y?p:c,F)}function M(){return/[^\s]/g.test(N)?(e(U.join("")),j=u,F):(U.push(N),z=N,F+1)}function E(){return"\n"===N&&"\\"!==z?(e(U.join("")),j=u,F):(U.push(N),z=N,F+1)}function T(){return E()}function L(){return"/"===N&&"*"===z?(U.push(N),e(U.join("")),j=u,F+1):(U.push(N),z=N,F+1)}function S(){if("."===z&&/\d/.test(N))return j=v,F;if("/"===z&&"*"===N)return j=f,F;if("/"===z&&"/"===N)return j=h,F;if("."===N&&U.length){for(;C(U););return j=v,F}if(";"===N||")"===N||"("===N){if(U.length)for(;C(U););return e(N),j=u,F+1}var t=2===U.length&&"="!==N;if(/[\w_\d\s]/.test(N)||t){for(;C(U););return j=u,F}return U.push(N),z=N,F+1}function C(t){for(var r,n,i=0;;){if(r=a.indexOf(t.slice(0,t.length+i).join("")),n=a[r],-1===r){if(i--+t.length>0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function R(){return/[^a-fA-F0-9]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),z=N,F+1)}function I(){return"."===N?(U.push(N),j=v,z=N,F+1):/[eE]/.test(N)?(U.push(N),j=v,z=N,F+1):"x"===N&&1===U.length&&"0"===U[0]?(j=w,U.push(N),z=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),z=N,F+1)}function P(){return"f"===N&&(U.push(N),z=N,F+=1),/[eE]/.test(N)?(U.push(N),z=N,F+1):"-"===N&&/[eE]/.test(z)?(U.push(N),z=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),z=N,F+1)}function O(){if(/[^\d\w_]/.test(N)){var t=U.join("");return j=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),j=u,F}return U.push(N),z=N,F+1}var N,z,D,F=0,B=0,j=u,U=[],V=[],q=1,H=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":118,"./lib/builtins-300es":117,"./lib/literals":120,"./lib/literals-300es":119,"./lib/operators":121}],117:[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":118 }],118:[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"]},{}],119:[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","uint","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":120}],120:[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","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"]},{}],121:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],122:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":116}],123:[function(t,e,r){"use strict";function n(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=r;return e}e.exports=n},{}],124:[function(t,e,r){e.exports=function(t){return!(null==t||!(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)))}},{}],125:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==g.alt,g.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==g.shift,g.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==g.control,g.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==h||a!==d||o!==p||r(n))&&(h=0|t,d=a||0,p=o||0,e(h,d,p,g))}function a(t){n(0,t)}function o(){(h||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,h=0,g.shift=g.alt=g.control=g.meta=!1,e(0,0,0,g))}function s(t){r(t)&&e(h,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(h,t)}function u(t){n(h|i.buttons(t),t)}function c(t){n(h&~i.buttons(t),t)}function f(){v||(v=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",a),t.addEventListener("mouseout",a),t.addEventListener("mouseover",a),t.addEventListener("blur",o),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",o),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var h=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},v=!1;f();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return v},set:function(t){t&&f()},enumerable:!0},buttons:{get:function(){return h},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),m}e.exports=n;var i=t("mouse-event")},{"mouse-event":126}],126:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var f=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=o({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=o({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=o({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=a({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":58}],131:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;te&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var a="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}",o=new Function(a);return o()}if(0===e){var a="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}",o=new Function("TrivialArray",a);return o(f[t][0])}var a=["'use strict'"],s=l(e),u=s.map(function(t){return"i"+t}),c="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),h=s.map(function(t){return"b"+t}).join(","),d=s.map(function(t){return"c"+t}).join(",");a.push("function "+r+"(a,"+h+","+d+",d){this.data=a","this.shape=["+h+"]","this.stride=["+d+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),a.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?a.push("proto.order=[0]"):(a.push("Object.defineProperty(proto,'order',{get:"),4>e?(a.push("function "+r+"_order(){"),2===e?a.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;e>v;++v)a.push("if(typeof i"+v+"==='number'&&i"+v+">=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;e>v;++v)a.push("if(typeof i"+v+"==='number'){d=i"+v+"|0;if(d<0){c+=b"+v+"*(a"+v+"-1);a"+v+"=ceil(-a"+v+"/d)}else{a"+v+"=ceil(a"+v+"/d)}b"+v+"*=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");for(var m=new Array(e),y=new Array(e),v=0;e>v;++v)m[v]="a[i"+v+"]",y[v]="b[i"+v+"]";a.push("proto.transpose=function "+r+"_transpose("+u+"){"+u.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+m.join(",")+","+y.join(",")+",this.offset)}"),a.push("proto.pick=function "+r+"_pick("+u+"){var a=[],b=[],c=this.offset");for(var v=0;e>v;++v)a.push("if(typeof i"+v+"==='number'&&i"+v+">=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(f[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;s>l;++l)r[l]<0&&(n-=(e[l]-1)*r[l])}for(var c=o(t),h=f[c];h.length<=s+1;)h.push(a(c,h.length-1));var i=h[s+1];return i(t,e,r,n)}var l=t("iota-array"),u=t("is-buffer"),c="undefined"!=typeof Float64Array,f={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s},{"iota-array":123,"is-buffer":124}],132:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,a="");r>a.length&&e>0&&(1&e&&(a+=t),e>>=1);)t+=t;return a.substr(0,r)}var i,a="";e.exports=n},{}],133:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join("")}return e}function a(t){return 1&t?"-":""}function o(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;ru;++u)0===(1&u)?e.push.apply(e,s(n(a,u))):r.push.apply(r,s(n(a,u))),l.push("m"+u);var c=o(e),g=o(r),v="orientation"+t+"Exact",m=["function ",v,"(",l.join(),"){var p=",c,",n=",g,",d=sub(p,n);return d[d.length-1];};return ",v].join(""),y=new Function("sum","prod","scale","sub",m);return y(h,f,d,p)}function u(t){var e=_[t.length];return e||(e=_[t.length]=l(t.length)),e.apply(void 0,t)}function c(){for(;_.length<=g;)_.push(l(_.length));for(var t=[],r=["slow"],n=0;g>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;g>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i=n;++n)e.exports[n]=_[n]}var f=t("two-product"),h=t("robust-sum"),d=t("robust-scale"),p=t("robust-subtract"),g=5,v=1.1102230246251565e-16,m=(3+16*v)*v,y=(7+56*v)*v,b=l(3),x=l(4),_=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,r){var n,i=(t[1]-r[1])*(e[0]-r[0]),a=(t[0]-r[0])*(e[1]-r[1]),o=i-a;if(i>0){if(0>=a)return o;n=i+a}else{if(!(0>i))return o;if(a>=0)return o;n=-(i+a)}var s=m*n;return o>=s||-s>=o?o:b(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],a=e[0]-n[0],o=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=a*u,p=o*l,g=o*s,v=i*u,m=i*l,b=a*s,_=c*(d-p)+f*(g-v)+h*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(m)+Math.abs(b))*Math.abs(h),A=y*w;return _>A||-_>A?_:x(t,e,r,n)}];c()},{"robust-scale":134,"robust-subtract":135,"robust-sum":136,"two-product":149}],134:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if(1===r){var n=i(t[0],e);return n[0]?n:[n[1]]}var o=new Array(2*r),s=[.1,.1],l=[.1,.1],u=0;i(t[0],e,s),s[0]&&(o[u++]=s[0]);for(var c=1;r>c;++c){i(t[c],e,l);var f=s[1];a(f,l[0],s),s[0]&&(o[u++]=s[0]);var h=l[1],d=s[1],p=h+d,g=p-h,v=d-g;s[1]=p,v&&(o[u++]=v)}return s[1]&&(o[u++]=s[1]),0===u&&(o[u++]=0),o.length=u,o}var i=t("two-product"),a=t("two-sum");e.exports=n},{"two-product":149,"two-sum":150}],135:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);v>p?(o=d,c+=1,r>c&&(d=t[c],p=h(d))):(o=g,f+=1,i>f&&(g=-e[f],v=h(g))),r>c&&v>p||f>=i?(a=d,c+=1,r>c&&(d=t[c],p=h(d))):(a=g,f+=1,i>f&&(g=-e[f],v=h(g)));for(var m,y,b,x,_,w=a+o,A=w-a,k=o-A,M=k,E=w;r>c&&i>f;)v>p?(a=d,c+=1,r>c&&(d=t[c],p=h(d))):(a=g,f+=1,i>f&&(g=-e[f],v=h(g))),o=M,w=a+o,A=w-a,k=o-A,k&&(l[u++]=k),m=E+w,y=m-E,b=m-y,x=w-y,_=E-b,M=_+x,E=m;for(;r>c;)a=d,o=M,w=a+o,A=w-a,k=o-A,k&&(l[u++]=k),m=E+w,y=m-E,b=m-y,x=w-y,_=E-b,M=_+x,E=m,c+=1,r>c&&(d=t[c]);for(;i>f;)a=g,o=M,w=a+o,A=w-a,k=o-A,k&&(l[u++]=k),m=E+w,y=m-E,b=m-y,x=w-y,_=E-b,M=_+x,E=m,f+=1,i>f&&(g=-e[f]);return M&&(l[u++]=M),E&&(l[u++]=E),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],136:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=e[f],v=h(g);v>p?(o=d,c+=1,r>c&&(d=t[c],p=h(d))):(o=g,f+=1,i>f&&(g=e[f],v=h(g))),r>c&&v>p||f>=i?(a=d,c+=1,r>c&&(d=t[c],p=h(d))):(a=g,f+=1,i>f&&(g=e[f],v=h(g)));for(var m,y,b,x,_,w=a+o,A=w-a,k=o-A,M=k,E=w;r>c&&i>f;)v>p?(a=d,c+=1,r>c&&(d=t[c],p=h(d))):(a=g,f+=1,i>f&&(g=e[f],v=h(g))),o=M,w=a+o,A=w-a,k=o-A,k&&(l[u++]=k),m=E+w,y=m-E,b=m-y,x=w-y,_=E-b,M=_+x,E=m;for(;r>c;)a=d,o=M,w=a+o,A=w-a,k=o-A,k&&(l[u++]=k),m=E+w,y=m-E,b=m-y,x=w-y,_=E-b,M=_+x,E=m,c+=1,r>c&&(d=t[c]);for(;i>f;)a=g,o=M,w=a+o,A=w-a,k=o-A,k&&(l[u++]=k),m=E+w,y=m-E,b=m-y,x=w-y,_=E-b,M=_+x,E=m,f+=1,i>f&&(g=e[f]);return M&&(l[u++]=M),E&&(l[u++]=E),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],137:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],138:[function(t,e,r){"use strict";function n(t){return"a"+t}function i(t){return"d"+t}function a(t,e){return"c"+t+"_"+e}function o(t){return"s"+t}function s(t,e){return"t"+t+"_"+e}function l(t){return"o"+t}function u(t){return"x"+t}function c(t){return"p"+t}function f(t,e){return"d"+t+"_"+e}function h(t){return"i"+t}function d(t,e){return"u"+t+"_"+e}function p(t){return"b"+t}function g(t){return"y"+t}function v(t){return"e"+t}function m(t){return"v"+t}function y(t,e,r){for(var n=0,i=0;t>i;++i)e&1<e;++e)F.push(c(e),"+=",d(e,x[t]),";");F.push("}")}function R(t){for(var e=t-1;e>=0;--e)S(e,0);for(var r=[],e=0;N>e;++e)L[e]?r.push(i(e)+".get("+c(e)+")"):r.push(i(e)+"["+c(e)+"]");for(var e=0;b>e;++e)r.push(u(e));F.push(A,"[",E,"++]=phase(",r.join(),");");for(var e=0;t>e;++e)C(e);for(var n=0;N>n;++n)F.push(c(n),"+=",d(n,x[t]),";")}function I(t){for(var e=0;N>e;++e)L[e]?F.push(a(e,0),"=",i(e),".get(",c(e),");"):F.push(a(e,0),"=",i(e),"[",c(e),"];");for(var r=[],e=0;N>e;++e)r.push(a(e,0));for(var e=0;b>e;++e)r.push(u(e));F.push(p(0),"=",A,"[",E,"]=phase(",r.join(),");");for(var n=1;1<n;++n)F.push(p(n),"=",A,"[",E,"+",v(n),"];");for(var o=[],n=1;1<n;++n)o.push("("+p(0)+"!=="+p(n)+")");F.push("if(",o.join("||"),"){");for(var s=[],e=0;z>e;++e)s.push(h(e));for(var e=0;N>e;++e){s.push(a(e,0));for(var n=1;1<n;++n)L[e]?F.push(a(e,n),"=",i(e),".get(",c(e),"+",f(e,n),");"):F.push(a(e,n),"=",i(e),"[",c(e),"+",f(e,n),"];"),s.push(a(e,n))}for(var e=0;1<e;++e)s.push(p(e));for(var e=0;b>e;++e)s.push(u(e)); F.push("vertex(",s.join(),");",m(0),"=",w,"[",E,"]=",k,"++;");for(var l=(1<n;++n)if(0===(t&~(1<0;_=_-1&g)x.push(w+"["+E+"+"+v(_)+"]");x.push(m(0));for(var _=0;N>_;++_)1&n?x.push(a(_,l),a(_,g)):x.push(a(_,g),a(_,l));1&n?x.push(d,y):x.push(y,d);for(var _=0;b>_;++_)x.push(u(_));F.push("if(",d,"!==",y,"){","face(",x.join(),")}")}F.push("}",E,"+=1;")}function P(){for(var t=1;1<t;++t)F.push(T,"=",v(t),";",v(t),"=",g(t),";",g(t),"=",T,";")}function O(t,e){if(0>t)return void I(e);R(t),F.push("if(",o(x[t]),">0){",h(x[t]),"=1;"),O(t-1,e|1<r;++r)F.push(c(r),"+=",d(r,x[t]),";");t===z-1&&(F.push(E,"=0;"),P()),S(t,2),O(t-1,e),t===z-1&&(F.push("if(",h(x[z-1]),"&1){",E,"=0;}"),P()),C(t),F.push("}")}var N=L.length,z=x.length;if(2>z)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var D="extractContour"+x.join("_"),F=[],B=[],j=[],U=0;N>U;++U)j.push(n(U));for(var U=0;b>U;++U)j.push(u(U));for(var U=0;z>U;++U)B.push(o(U)+"="+n(0)+".shape["+U+"]|0");for(var U=0;N>U;++U){B.push(i(U)+"="+n(U)+".data",l(U)+"="+n(U)+".offset|0");for(var V=0;z>V;++V)B.push(s(U,V)+"="+n(U)+".stride["+V+"]|0")}for(var U=0;N>U;++U){B.push(c(U)+"="+l(U)),B.push(a(U,0));for(var V=1;1<V;++V){for(var q=[],H=0;z>H;++H)V&1<U;++U)for(var V=0;z>V;++V){var G=[s(U,x[V])];V>0&&G.push(s(U,x[V-1])+"*"+o(x[V-1])),B.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;z>U;++U)B.push(h(U)+"=0");B.push(k+"=0");for(var X=["2"],U=z-2;U>=0;--U)X.push(o(x[U]));B.push(M+"=("+X.join("*")+")|0",A+"=mallocUint32("+M+")",w+"=mallocUint32("+M+")",E+"=0"),B.push(p(0)+"=0");for(var V=1;1<V;++V){for(var Y=[],W=[],H=0;z>H;++H)V&1<n&&e("Must have at least one array argument");var i=t.scalarArguments||0;0>i&&e("Scalar arg count must be > 0"),"function"!=typeof t.vertex&&e("Must specify vertex creation function"),"function"!=typeof t.cell&&e("Must specify cell creation function"),"function"!=typeof t.phase&&e("Must specify phase function");for(var a=t.getters||[],o=new Array(n),s=0;n>s;++s)a.indexOf(s)>=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",k="N",M="Q",E="X",T="T"},{"typedarray-pool":151}],139:[function(t,e,r){function n(t){if(0>t)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+o+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],o=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function l(t){if(.5>t)return Math.PI/(Math.sin(Math.PI*t)*l(1-t));if(t>100)return Math.exp(n(t));t-=1;for(var e=a[0],r=1;i+2>r;r++)e+=a[r]/(t+r);var o=t+i+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,t+.5)*Math.exp(-o)*e},e.exports.log=n},{}],140:[function(t,e,r){"use strict";function n(t){var e=t.length;if(i>e){for(var r=1,n=0;e>n;++n)for(var o=0;n>o;++o)if(t[n]n;++n)s[n]=0;for(var r=1,n=0;e>n;++n)if(!s[n]){var l=1;s[n]=1;for(var o=t[n];o!==n;o=t[o]){if(s[o])return a.freeUint8(s),0;l+=1,s[o]=1}1&l||(r=-r)}return a.freeUint8(s),r}e.exports=n;var i=32,a=t("typedarray-pool")},{"typedarray-pool":151}],141:[function(t,e,r){"use strict";function n(t){var e=t.length;switch(e){case 0:case 1:return 0;case 2:return t[1]}var r,n,i,s=a.mallocUint32(e),l=a.mallocUint32(e),u=0;for(o(t,l),i=0;e>i;++i)s[i]=t[i];for(i=e-1;i>0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;t>a;++a)r[a]=a,o=o*a|0;for(a=t-1;a>0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":142,"typedarray-pool":151}],142:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;rt)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;e>n;++n){for(var s=i.unrank(t,n),l=[0],u=0,c=0;c= 0) !== (_inline_1_db >= 0)) {\n _inline_1_arg2_.push(_inline_1_arg4_[0] + 0.5 + 0.5 * (_inline_1_da + _inline_1_db) / (_inline_1_da - _inline_1_db))\n }\n }",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg3_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:["_inline_1_da","_inline_1_db"]},funcName:"zeroCrossings"})},{"cwise-compiler":58}],145:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":144}],146:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;r>u;++u)a.push("d"+u),l.push("d"+u);for(var u=0;1<u;++u)a.push("v"+u),l.push("v"+u);for(var u=0;1<u;++u)a.push("p"+u),l.push("p"+u);a.push("a","b","c"),l.push("a","c"),n.push("vertex:function vertexFunc(",a.join(),"){");for(var c=[],u=0;1<u;++u)c.push("(p"+u+"<<"+u+")");n.push("var m=(",c.join("+"),")|0;if(m===0||m===",(1<<(1<=1<<(1<>>7){");for(var u=0;1<<(1<u;++u){if(1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;r>b;++b)p[b]=[],g[b]=[],v[b]=0,m[b]=0;for(var b=0;1<b;++b)for(var x=0;r>x;++x){var _=b^1<b)&&!(u&1<<_)!=!(u&1<w?(p[x].push("-v"+b+"-v"+_),v[x]+=2):(p[x].push("v"+b+"+v"+_),v[x]-=2),y+=1;for(var A=0;r>A;++A)A!==x&&(_&1<x;++x)if(0===p[x].length)k.push("d"+x+"-0.5");else{var M="";v[x]<0?M=v[x]+"*c":v[x]>0&&(M="+"+v[x]+"*c");var E=.5*(p[x].length/y),T=.5+.5*(m[x]/y);k.push("d"+x+"-"+T+"-"+E+"*("+p[x].join("+")+M+")/("+g[x].join("+")+")")}h.push("a.push([",k.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;1<u;++u)L.push("v"+u);L.push("c0","c1","p0","p1","a","b","c"),n.push("cell:function cellFunc(",L.join(),"){");var S=s(r-1);n.push("if(p0){b.push(",S.map(function(t){return"["+t.map(function(t){return"v"+t})+"]"}).join(),")}else{b.push(",S.map(function(t){var e=t.slice();return e.reverse(),"["+e.map(function(t){return"v"+t})+"]"}).join(),")}}});function ",i,"(array,level){var verts=[],cells=[];contour(array,verts,cells,level);return {positions:verts,cells:cells};} return ",i,";");for(var u=0;uo;++o)i[o]=[r[o]],a[o]=[o];return{positions:i,cells:a}}function a(t,e){if(t.dimension<=0)return{positions:[],cells:[]};if(1===t.dimension)return i(t,e);var r=t.order.join()+"-"+t.dtype,a=u[r],e=+e||0;return a||(a=u[r]=n(t.order,t.dtype)),a(t,e)}e.exports=a;var o=t("ndarray-extract-contour"),s=t("triangulate-hypercube"),l=t("zero-crossings"),u={}},{"ndarray-extract-contour":138,"triangulate-hypercube":143,"zero-crossings":145}],147:[function(t,e,r){(function(r){"use strict";function n(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),i=0,a=0,o=0;ol;++l){var u=r[s[l]];n[i++]=u[0],n[i++]=u[1]+1.4,a=Math.max(u[0],a)}return{data:n,shape:a}}function i(t,e){var r=s[t];r||(r=s[t]={" ":{data:new Float32Array(0),shape:.2}});var o=r[e];if(!o)if(e.length<=1||!/\d/.test(e))o=r[e]=n(a(e,{triangles:!0,font:t,textAlign:"left",textBaseline:"alphabetic"}));else{for(var l=e.split(/(\d|\s)/),u=new Array(l.length),c=0,f=0,h=0;h0&&(f+=.02);for(var d=new Float32Array(c),p=0,g=-.5*f,h=0;h.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,l:s}}function o(t,e,r){function n(t,e,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?t+6*(e-t)*r:.5>r?e:2/3>r?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=E(t,360),e=E(e,100),r=E(r,100),0===e)i=a=o=r;else{var s=.5>r?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function s(t,e,r){t=E(t,255),e=E(e,255),r=E(r,255);var n,i,a=q(t,e,r),o=V(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,v:s}}function l(t,e,r){t=6*E(t,360),e=E(e,100),r=E(r,100);var n=j.floor(t),i=t-n,a=r*(1-e),o=r*(1-i*e),s=r*(1-(1-i)*e),l=n%6,u=[r,o,a,a,s,r][l],c=[s,r,r,o,a,a][l],f=[a,a,s,r,r,o][l];return{r:255*u,g:255*c,b:255*f}}function u(t,e,r,n){var i=[R(U(t).toString(16)),R(U(e).toString(16)),R(U(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function c(t,e,r,n){var i=[R(P(n)),R(U(t).toString(16)),R(U(e).toString(16)),R(U(r).toString(16))];return i.join("")}function f(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s-=r/100,n.s=T(n.s),e(n)}function h(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s+=r/100,n.s=T(n.s),e(n)}function d(t){return e(t).desaturate(100)}function p(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l+=r/100,n.l=T(n.l),e(n)}function g(t,r){r=0===r?0:r||10;var n=e(t).toRgb();return n.r=q(0,V(255,n.r-U(255*-(r/100)))),n.g=q(0,V(255,n.g-U(255*-(r/100)))),n.b=q(0,V(255,n.b-U(255*-(r/100)))),e(n)}function v(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l-=r/100,n.l=T(n.l),e(n)}function m(t,r){var n=e(t).toHsl(),i=(U(n.h)+r)%360;return n.h=0>i?360+i:i,e(n)}function y(t){var r=e(t).toHsl();return r.h=(r.h+180)%360,e(r)}function b(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+120)%360,s:r.s,l:r.l}),e({h:(n+240)%360,s:r.s,l:r.l})]}function x(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+90)%360,s:r.s,l:r.l}),e({h:(n+180)%360,s:r.s,l:r.l}),e({h:(n+270)%360,s:r.s,l:r.l})]}function _(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+72)%360,s:r.s,l:r.l}),e({h:(n+216)%360,s:r.s,l:r.l})]}function w(t,r,n){r=r||6,n=n||30;var i=e(t).toHsl(),a=360/n,o=[e(t)];for(i.h=(i.h-(a*r>>1)+720)%360;--r;)i.h=(i.h+a)%360,o.push(e(i));return o}function A(t,r){r=r||6;for(var n=e(t).toHsv(),i=n.h,a=n.s,o=n.v,s=[],l=1/r;r--;)s.push(e({h:i,s:a,v:o})),o=(o+l)%1;return s}function k(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function M(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function E(t,e){S(t)&&(t="100%");var r=C(t);return t=V(e,q(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),j.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function T(t){return V(1,q(0,t))}function L(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function C(t){return"string"==typeof t&&-1!=t.indexOf("%")}function R(t){return 1==t.length?"0"+t:""+t}function I(t){return 1>=t&&(t=100*t+"%"),t}function P(t){return Math.round(255*parseFloat(t)).toString(16)}function O(t){return L(t)/255}function N(t){t=t.replace(D,"").replace(F,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Y.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Y.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Y.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Y.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Y.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Y.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Y.hex8.exec(t))?{a:O(r[1]),r:L(r[2]),g:L(r[3]),b:L(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:L(r[1]),g:L(r[2]),b:L(r[3]),format:e?"name":"hex"}:(r=Y.hex3.exec(t))?{r:L(r[1]+""+r[1]),g:L(r[2]+""+r[2]),b:L(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function z(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var D=/^\s+/,F=/\s+$/,B=0,j=Math,U=j.round,V=j.min,q=j.max,H=j.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,n,i,a,o=this.toRgb();return t=o.r/255,e=o.g/255,r=o.b/255,n=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),i=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),a=.03928>=r?r/12.92:Math.pow((r+.055)/1.055,2.4),.2126*n+.7152*i+.0722*a},setAlpha:function(t){return this._a=M(t),this._roundA=U(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=a(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=a(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return c(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:U(this._r),g:U(this._g),b:U(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+U(this._r)+", "+U(this._g)+", "+U(this._b)+")":"rgba("+U(this._r)+", "+U(this._g)+", "+U(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:U(100*E(this._r,255))+"%",g:U(100*E(this._g,255))+"%",b:U(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+U(100*E(this._r,255))+"%, "+U(100*E(this._g,255))+"%, "+U(100*E(this._b,255))+"%)":"rgba("+U(100*E(this._r,255))+"%, "+U(100*E(this._g,255))+"%, "+U(100*E(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:X[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+c(this._r,this._g,this._b,this._a),n=r,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=e(t);n=a.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(g,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(h,arguments)},greyscale:function(){return this._applyModification(d,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(x,arguments)}},e.fromRatio=function(t,r){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?n[i]=t[i]:n[i]=I(t[i]));t=n}return e(t,r)},e.equals=function(t,r){return t&&r?e(t).toRgbString()==e(r).toRgbString():!1},e.random=function(){return e.fromRatio({r:H(),g:H(),b:H()})},e.mix=function(t,r,n){n=0===n?0:n||50;var i,a=e(t).toRgb(),o=e(r).toRgb(),s=n/100,l=2*s-1,u=o.a-a.a;i=l*u==-1?l:(l+u)/(1+l*u),i=(i+1)/2;var c=1-i,f={r:o.r*i+a.r*c,g:o.g*i+a.g*c,b:o.b*i+a.b*c,a:o.a*s+a.a*(1-s)};return e(f)},e.readability=function(t,r){var n=e(t),i=e(r);return(Math.max(n.getLuminance(),i.getLuminance())+.05)/(Math.min(n.getLuminance(),i.getLuminance())+.05)},e.isReadable=function(t,r,n){var i,a,o=e.readability(t,r);switch(a=!1,i=z(n),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},e.mostReadable=function(t,r,n){var i,a,o,s,l=null,u=0;n=n||{},a=n.includeFallbackColors,o=n.level,s=n.size;for(var c=0;cu&&(u=i,l=e(r[c]));return e.isReadable(t,l,{level:o,size:s})||!a?l:(n.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],n))};var G=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},X=e.hexNames=k(G),Y=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof r&&r.exports?r.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],149:[function(t,e,r){"use strict";function n(t,e,r){var n=t*e,a=i*t,o=a-t,s=a-o,l=t-s,u=i*e,c=u-e,f=u-c,h=e-f,d=n-s*f,p=d-l*f,g=p-s*h,v=l*h-g;return r?(r[0]=v,r[1]=n,r):[v,n]}e.exports=n;var i=+(Math.pow(2,27)+1)},{}],150:[function(t,e,r){"use strict";function n(t,e,r){var n=t+e,i=n-t,a=n-i,o=e-i,s=t-a;return r?(r[0]=s+o,r[1]=n,r):[s+o,n]}e.exports=n},{}],151:[function(t,e,r){(function(e,n){"use strict";function i(t){if(t){var e=t.length||t.byteLength,r=y.log2(e);w[r].push(t)}}function a(t){i(t.buffer)}function o(t){var t=y.nextPow2(t),e=y.log2(t),r=w[e];return r.length>0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;32>t;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":9,buffer:10,dup:63}],152:[function(t,e,r){"use strict";function n(t,e){for(var r=1,n=t.length,i=t[0],a=t[0],o=1;n>o;++o)if(a=i,i=t[o],e(i,a)){if(o===r){r++;continue}t[r++]=i}return t.length=r,t}function i(t){for(var e=1,r=t.length,n=t[0],i=t[0],a=1;r>a;++a,i=n)if(i=n,n=t[a],n!==i){if(a===e){e++;continue}t[e++]=n}return t.length=e,t}function a(t,e,r){return 0===t.length?t:e?(r||t.sort(e),n(t,e)):(r||t.sort(),i(t))}e.exports=a},{}],153:[function(t,e,r){"use strict";function n(t,e){return"object"==typeof e&&null!==e||(e={}),i(t,e.canvas||a,e.context||o,e)}e.exports=n;var i=t("./lib/vtext"),a=null,o=null;"undefined"!=typeof document&&(a=document.createElement("canvas"),a.width=8192,a.height=1024,o=a.getContext("2d"))},{"./lib/vtext":154}],154:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",a=[1<<30,1<<30],o=[0,0],s=t.length,l=0;s>l;++l)for(var u=t[l],c=0;2>c;++c)a[c]=0|Math.min(a[c],u[c]),o[c]=0|Math.max(o[c],u[c]);var f=0;switch(n){case"center":f=-.5*(a[0]+o[0]);break;case"right":case"end":f=-o[0];break;case"left":case"start":f=-a[0];break;default:throw new Error("vectorize-text: Unrecognized textAlign: '"+n+"'")}var h=0;switch(i){case"hanging":case"top":h=-a[1];break;case"middle":h=-.5*(a[1]+o[1]);break;case"alphabetic":case"ideographic":h=-3*r;break;case"bottom":h=-o[1];break;default:throw new Error("vectorize-text: Unrecoginized textBaseline: '"+i+"'")}var d=1/r;return"lineHeight"in e?d*=+e.lineHeight:"width"in e?d=e.width/(o[0]-a[0]):"height"in e&&(d=e.height/(o[1]-a[1])),t.map(function(t){return[d*(t[0]+f),d*(t[1]+h)]})}function i(t,e,r,n){var i=0|Math.ceil(e.measureText(r).width+2*n);if(i>8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height=l&&o.push(s)}for(;o.length>0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;sn;++n){var a=t[n];e=Math.max(e,a[0],a[1]); }e=(0|e)+1}e=0|e;for(var o=new Array(e),n=0;e>n;++n)o[n]=[];for(var n=0;r>n;++n){var a=t[n];o[a[0]].push(a[1]),o[a[1]].push(a[0])}for(var s=0;e>s;++s)i(o[s],function(t,e){return t-e});return o}e.exports=n;var i=t("uniq")},{uniq:152}],157:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;2>c;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var f=0;2>f;++f)for(var h=u[f][n],d=0;d0&&(o=p,s=g,l=f)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],f=t,h=s[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;s.push(t),l=n(c,f)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;s>c;++c)u[0][c]=[],u[1][c]=[];for(var c=0;l>c;++c){var f=t[c];u[0][f[0]].push(f),u[1][f[1]].push(f)}for(var h=[],c=0;s>c;++c)u[0][c].length+u[1][c].length===0&&h.push([c]);for(var c=0;s>c;++c)for(var d=0;2>d;++d){for(var p=[];u[d][c].length>0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&h.push(p),p=g)}p.length>0&&h.push(p)}return h}e.exports=n;var i=t("compare-angle")},{"compare-angle":158}],158:[function(t,e,r){"use strict";function n(t,e,r){var n=s(t[0],-e[0]),i=s(t[1],-e[1]),a=s(r[0],-e[0]),o=s(r[1],-e[1]),c=u(l(n,a),l(i,o));return c[c.length-1]>=0}function i(t,e,r,i){var s=a(e,r,i);if(0===s){var l=o(a(t,e,r)),u=o(a(t,e,i));if(l===u){if(0===l){var c=n(t,e,r),f=n(t,e,i);return c===f?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,i)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:o(u-l)}var h=a(t,e,r);if(h>0)return s>0&&a(t,e,i)>0?1:-1;if(0>h)return s>0||a(t,e,i)>0?1:-1;var d=a(t,e,i);return d>0?1:n(t,e,r)?1:-1}e.exports=i;var a=t("robust-orientation"),o=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":133,"robust-product":159,"robust-sum":136,signum:160,"two-sum":150}],159:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.lengtht?-1:t>0?1:0}},{}],161:[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){var a=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(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],162:[function(t,e,r){"use strict";function n(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}function i(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 a(t,e){var r=p(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 o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return 0>n?y:(r.splice(n,1),a(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){return this.root?this.root.queryPoint(t,e):void 0},w.queryInterval=function(t,e,r){return e>=t&&this.root?this.root.queryInterval(t,e,r):void 0},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":161}],163:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return s>o?o-s:i>l?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(r,i,o);if(0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;if(l=a(s,o,i),u=a(s,o,r),0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;return i[0]-s[0]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":133}],164:[function(t,e,r){"use strict";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}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(0>=i){if(n.left){var a=u(t,e,r,n.left);if(a)return a}var a=r(n.key,n.value);if(a)return a}return n.right?u(t,e,r,n.right):void 0}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(0>=o){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}return s>0&&i.right?c(t,e,r,n,i.right):void 0}function f(t,e){this.tree=t,this._stack=e}function h(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 d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=m);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===v){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=m,r._color=m,s._color=m,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===v){if(n=r.right=i(n),s=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=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.right=a(v,n));r.right=a(v,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===v){if(n=r.left=i(n),s=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=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.left=a(v,n));r.left=a(v,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1t?-1:t>e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var v=0,m=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=0>=c?i.left:i.right}l.push(new n(v,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var i=l[f];u[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(var f=l.length-1;f>1;--f){var h=l[f-1],i=l[f];if(h._color===m||i._color===m)break;var d=l[f-2];if(d.left===h)if(h.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=h.right,h._color=m,h.right=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else{var p=d.right;if(!p||p._color!==v){if(h.right=i.left,d._color=v,d.left=i.right,i._color=m,i.left=h,i.right=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.left===d?g.left=i:g.right=i}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else if(h.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=h.left,h._color=m,h.left=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}else{var p=d.left;if(!p||p._color!==v){if(h.left=i.right,d._color=v,d.right=i.left,i._color=m,i.right=h,i.left=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.right===d?g.right=i:g.left=i}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}}return l[0]._color=m,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),y.at=function(t){if(0>t)return new f(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new f(this,[])},y.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),0>=a&&(i=n.length),r=0>=a?r.left:r.right}return n.length=i,new f(this,n)},y.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),0>a&&(i=n.length),r=0>a?r.left:r.right}return n.length=i,new f(this,n)},y.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=0>=a?r.left:r.right}return n.length=i,new f(this,n)},y.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=0>a?r.left:r.right}return n.length=i,new f(this,n)},y.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 f(this,n);r=0>=i?r.left:r.right}return new f(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.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=0>=n?r.left:r.right}};var b=f.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new f(this.tree,this._stack.slice())},b.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 i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var a=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[a-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[a-1].key=r.key,e[a-1].value=r.value;for(var i=e.length-2;i>=a;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[a-1].left=e[a]}if(r=e[e.length-1],r._color===v){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0?this._stack[this._stack.length-1].key:void 0},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1].value:void 0},enumerable:!0}),Object.defineProperty(b,"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}),b.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(b,"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}}),b.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],i.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])},b.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(b,"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}})},{}],165:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]s)t=t.left;else if(s>0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;e>a;++a){var l=t[a],u=l[0][0]a;){for(var v=i[a].x,m=[];r>a;){var y=i[a];if(y.x!==v)break;a+=1,y.segment[0][0]===y.x&&y.segment[1][0]===y.x?y.create&&(y.segment[0][1]e)return-1;var r=(this.slabs[e],a(this.slabs[e],t)),n=-1;if(r&&(n=r.value),this.coordinates[e]===t[0]){var o=null;if(r&&(o=r.key),e>0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=f(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":163,"binary-search-bounds":161,"functional-red-black-tree":164,"robust-orientation":133}],166:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return i?!!i.queryPoint(r,n):!1}}function a(t){for(var e={},r=0;rn)return 1;var i=t[n];if(!i){if(!(n>0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=f(r,o[0],o[1]);if(o[0][0]s)i=i.left;else{if(!(s>0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(0>s))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;e>i;++i)for(var c=t[i],f=c.length,d=f-1,p=0;f>p;d=p++){var g=c[d],v=c[p];g[0]===v[0]?n.push([g,v]):r.push([g,v])}if(0===r.length)return 0===n.length?s:l(a(n));var m=h(r),y=o(m.slabs,m.coordinates);return 0===n.length?y:u(a(n),y)}e.exports=c;var f=t("robust-orientation")[3],h=t("slab-decomposition"),d=t("interval-tree-1d"),p=t("binary-search-bounds")},{"binary-search-bounds":161,"interval-tree-1d":162,"robust-orientation":133,"slab-decomposition":165}],167:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function i(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=[];return e}function a(t,e){function r(t){for(var r=t.length,n=[0],i=0;r>i;++i){var a=e[t[i]],o=e[t[(i+1)%r]],s=u(-a[0],a[1]),l=u(-a[0],o[1]),f=u(o[0],a[1]),h=u(o[0],o[1]);n=c(n,c(c(s,l),c(f,h)))}return n[n.length-1]>0}function a(t){for(var e=t.length,r=0;e>r;++r)if(!O[t[r]])return!1;return!0}var d=h(t,e);t=d[0],e=d[1];for(var p=e.length,g=(t.length,o(t,e.length)),v=0;p>v;++v)if(g[v].length%2===1)throw new Error("planar-graph-to-polyline: graph must be manifold");var m=s(t,e);m=m.filter(r);for(var y=m.length,b=new Array(y),x=new Array(y),v=0;y>v;++v){b[v]=v;var _=new Array(y),w=m[v].map(function(t){return e[t]}),A=l([w]),k=0;t:for(var M=0;y>M;++M)if(_[M]=0,v!==M){for(var E=m[M],T=E.length,L=0;T>L;++L){var S=A(e[E[L]]);if(0!==S){0>S&&(_[M]=1,k+=1);continue t}}_[M]=1,k+=1}x[v]=[k,v,_]}x.sort(function(t,e){return e[0]-t[0]});for(var v=0;y>v;++v)for(var _=x[v],C=_[1],R=_[2],M=0;y>M;++M)R[M]&&(b[M]=C);for(var I=i(y),v=0;y>v;++v)I[v].push(b[v]),I[b[v]].push(v);for(var P={},O=n(p,!1),v=0;y>v;++v)for(var E=m[v],T=E.length,M=0;T>M;++M){var N=E[M],z=E[(M+1)%T],D=Math.min(N,z)+":"+Math.max(N,z);if(D in P){var F=P[D];I[F].push(v),I[v].push(F),O[N]=O[z]=!0}else P[D]=v}for(var B=[],j=n(y,-1),v=0;y>v;++v)b[v]!==v||a(m[v])?j[v]=-1:(B.push(v),j[v]=0);for(var d=[];B.length>0;){var U=B.pop(),V=I[U];f(V,function(t,e){return t-e});var q,H=V.length,G=j[U];if(0===G){var E=m[U];q=[E]}for(var v=0;H>v;++v){var X=V[v];if(!(j[X]>=0)&&(j[X]=1^G,B.push(X),0===G)){var E=m[X];a(E)||(E.reverse(),q.push(E))}}0===G&&d.push(q)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),f=t("uniq"),h=t("./lib/trim-leaves")},{"./lib/trim-leaves":155,"edges-to-adjacency-list":156,"planar-dual":157,"point-in-big-polygon":166,"robust-sum":136,"two-product":149,uniq:152}],168:[function(t,e,r){arguments[4][9][0].apply(r,arguments)},{dup:9}],169:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n,n.prototype.length=function(){return this.roots.length},n.prototype.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},n.prototype.find=function(t){for(var e=this.roots;e[t]!==t;){var r=e[t];e[t]=e[r],t=r}return t},n.prototype.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,a=this.roots,o=i[r],s=i[n];s>o?a[r]=n:o>s?a[n]=r:(a[n]=r,++i[r])}}},{}],170:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;i>n;++n)e=r(e,t[n].length);return e-1}function i(t){for(var e=-1,r=Math.max,n=0,i=t.length;i>n;++n)for(var a=t[n],o=0,s=a.length;s>o;++o)e=r(e,a[o]);return e+1}function a(t){for(var e=new Array(t.length),r=0,n=t.length;n>r;++r)e[r]=t[r].slice(0);return e}function o(t,e){var r=t.length,n=t.length-e.length,i=Math.min;if(n)return n;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:var a=t[0]+t[1]-e[0]-e[1];return a?a:i(t[0],t[1])-i(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=i(t[0],t[1]),u=i(e[0],e[1]),a=i(l,t[2])-i(u,e[2]);return a?a:i(l+t[2],o)-i(u+e[2],s);default:var c=t.slice(0);c.sort();var f=e.slice(0);f.sort();for(var h=0;r>h;++h)if(n=c[h]-f[h])return n;return 0}}function s(t,e){return o(t[0],e[0])}function l(t,e){if(e){for(var r=t.length,n=new Array(r),i=0;r>i;++i)n[i]=[t[i],e[i]];n.sort(s);for(var i=0;r>i;++i)t[i]=n[i][0],e[i]=n[i][1];return t}return t.sort(o),t}function u(t){if(0===t.length)return[];for(var e=1,r=t.length,n=1;r>n;++n){var i=t[n];if(o(i,t[n-1])){if(n===e){e++;continue}t[e++]=i}}return t.length=e,t}function c(t,e){for(var r=0,n=t.length-1,i=-1;n>=r;){var a=r+n>>1,s=o(t[a],e);0>=s?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;i>n;++n)r[n]=[];for(var a=[],n=0,s=e.length;s>n;++n)for(var l=e[n],u=l.length,f=1,h=1<f;++f){a.length=b.popCount(f);for(var d=0,p=0;u>p;++p)f&1<g))for(;;)if(r[g++].push(n),g>=t.length||0!==o(t[g],a))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;e>n;++n)r[n]=[];for(var n=0,i=t.length;i>n;++n)for(var a=t[n],o=0,s=a.length;s>o;++o)r[a[o]].push(n);return r}function d(t){for(var e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],a=0|i.length,o=1,s=1<o;++o){for(var u=[],c=0;a>c;++c)o>>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(0>e)return[];for(var r=[],n=(1<r;++r)for(var i=t[r],a=0,o=i.length;o>a;++a){for(var s=new Array(i.length-1),u=0,c=0;o>u;++u)u!==a&&(s[c++]=i[u]);e.push(s)}return l(e)}function v(t,e){for(var r=new x(e),n=0;nr||0>i?1/0:n(e[t],e[r],e[i])}function a(t,e){var r=M[t],n=M[e];M[t]=n,M[e]=r,E[r]=e,E[n]=t}function s(t){return b[M[t]]}function l(t){return 1&t?t-1>>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(L>n){var l=s(n);r>l&&(o=n,r=l)}if(L>i){var u=s(i);r>u&&(o=i)}if(o===t)return t;a(t,o),t=o}}function c(t){for(var e=s(t);t>0;){var r=l(t);if(r>=0){var n=s(r);if(n>e){a(t,r),t=r;continue}}return t}}function f(){if(L>0){var t=M[0];return a(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=M[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),E[e]>=0&&h(E[e],i(e)),E[r]>=0&&h(E[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||0>i||i===n)break;if(n=i,i=t[n],!x[n]||0>i||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;g>_;++_)m[_]=y[_]=-1,b[_]=1/0,x[_]=!1;for(var _=0;v>_;++_){var w=t[_];if(2!==w.length)throw new Error("Input must be a graph");var A=w[1],k=w[0];-1!==y[k]?y[k]=-2:y[k]=A,-1!==m[A]?m[A]=-2:m[A]=k}for(var M=[],E=new Array(g),_=0;g>_;++_){var T=b[_]=i(_);1/0>T?(E[_]=M.length,M.push(_)):E[_]=-1}for(var L=M.length,_=L>>1;_>=0;--_)u(_);for(;;){var S=f();if(0>S||b[S]>r)break;d(S)}for(var C=[],_=0;g>_;++_)x[_]||(E[_]=C.length,C.push(e[_].slice()));var R=(C.length,[]);return t.forEach(function(t){var e=p(m,t[0]),r=p(y,t[1]);if(e>=0&&r>=0&&e!==r){var n=E[e],i=E[r];n!==i&&R.push([n,i])}}),o.unique(o.normalize(R)),{positions:C,edges:R}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":133,"simplicial-complex":170}],172:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],173:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"], dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":254,"../../plots/cartesian/constants":285,"../../plots/font_attributes":298,"./arrow_paths":172}],174:[function(t,e,r){"use strict";function n(t,e){function r(e,r){return u.coerce(t,n,v.layoutAttributes,e,r)}var n={};r("opacity"),r("align"),r("bgcolor");var i=r("bordercolor"),a=f.opacity(i);r("borderpad");var o=r("borderwidth"),s=r("showarrow");s&&(r("arrowcolor",a?n.bordercolor:f.defaultLine),r("arrowhead"),r("arrowsize"),r("arrowwidth",2*(a&&o||1)),r("ax"),r("ay"),r("axref"),r("ayref"),u.noneOrAll(t,n,["ax","ay"])),r("text",s?" ":"new text"),r("textangle"),u.coerceFont(r,"font",e.font);for(var l=["x","y"],h=0;2>h;h++){var d=l[h],p={_fullLayout:e},g=c.coerceRef(t,n,p,d),m=c.coerceARef(t,n,p,d),y=.5;if("paper"!==g){var b=c.getFromId(p,g);if(y=b.range[0]+y*(b.range[1]-b.range[0]),-1!==["date","category"].indexOf(b.type)&&"string"==typeof t[d]){var x;if("date"===b.type){if(x=u.dateTime2ms(t[d]),x!==!1&&(t[d]=x),m===g){var _=u.dateTime2ms(t["a"+d]);_!==!1&&(t["a"+d]=_)}}else(b._categories||[]).length&&(x=b._categories.indexOf(t[d]),-1!==x&&(t[d]=x))}}r(d,y),s||r(d+"anchor")}return u.noneOrAll(t,n,["x","y"]),n}function i(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=c.getFromId(t,e.xref),n=c.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,a=e._xshift||0,o=(e._ysize||0)/2,s=e._yshift||0,l=i-a,u=i+a,f=o-s,h=o+s;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;l=Math.max(l,d),u=Math.max(u,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&c.expand(r,[r.l2c(e.x)],{ppadplus:u,ppadminus:l}),n&&n.autorange&&c.expand(n,[n.l2c(e.y)],{ppadplus:h,ppadminus:f})}})}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return 0>v||v>1||0>g||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),f=t("../color"),h=t("../drawing"),d=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),g=t("../dragelement"),v=e.exports={};v.ARROWPATHS=t("./arrow_paths"),v.layoutAttributes=t("./attributes"),v.supplyLayoutDefaults=function(t,e){for(var r=t.annotations||[],i=e.annotations=[],a=0;at?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var n=W.select(".annotation-math-group"),i=!n.empty(),s=h.bBox((i?n:tt).node()),d=s.width,m=s.height,y=Math.round(d+2*$),b=Math.round(m+2*$);U._w=d,U._h=m;var x=!1;if(["x","y"].forEach(function(e){var n,i=U[e+"ref"]||e,a=c.getFromId(t,i),o=(G+("x"===e?0:90))*Math.PI/180,s=y*Math.abs(Math.cos(o))+b*Math.abs(Math.sin(o)),l=U[e+"anchor"];if(a){if(!a.autorange&&(U[e]-a.range[0])*(U[e]-a.range[1])>0&&(U["a"+e+"ref"]===i?(U["a"+e]-a.range[0])*(U["a"+e]-a.range[1])>0&&(x=!0):x=!0,x))return;H[e]=a._offset+a.l2p(U[e]),n=.5}else n=U[e],"y"===e&&(n=1-n),H[e]="x"===e?S.l+S.w*n:S.t+S.h*n;var u=0;U["a"+e+"ref"]===i?H["aa"+e]=a._offset+a.l2p(U["a"+e]):(u=U.showarrow?U["a"+e]:s*r(n,l),H[e]+=u),U["_"+e+"type"]=a&&a.type,U["_"+e+"size"]=s,U["_"+e+"shift"]=u}),x)return void W.remove();var w,A;U.showarrow&&(w=U.axref===U.xref?H.x:u.constrain(H.x-U.ax,1,_.width-1),A=U.ayref===U.yref?H.y:u.constrain(H.y-U.ay,1,_.height-1)),H.x=u.constrain(H.x,1,_.width-1),H.y=u.constrain(H.y,1,_.height-1);var k=$-s.top,M=$-s.left;i?n.select("svg").attr({x:$-1,y:$}):(tt.attr({x:M,y:k}),tt.selectAll("tspan.line").attr({y:k,x:M})),K.call(h.setRect,Z/2,Z/2,y-Z,b-Z);var E=0,T=0;E=U.axref===U.xref?Math.round(H.aax-y/2):Math.round(H.x-y/2),T=U.ayref===U.yref?Math.round(H.aay-b/2):Math.round(H.y-b/2),W.call(u.setTranslate,E,T);var L="annotations["+e+"]",C=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=U.axref===U.xref?H.aax+r:H.x+r,s=U.ayref===U.yref?H.aay+n:H.y+n;var c=u.rotationXYMatrix(G,i,s),h=u.apply2DTransform(c),d=u.apply2DTransform2(c),p=K.attr("width")/2,m=K.attr("height")/2,y=[[i-p,s-m,i-p,s+m],[i-p,s+m,i+p,s+m],[i+p,s+m,i+p,s-m],[i+p,s-m,i-p,s-m]].map(d);if(!y.reduce(function(t,e){return t^!!a(w,A,w+1e6,A+1e6,e[0],e[1],e[2],e[3])},!1)){y.forEach(function(t){var e=a(i,s,w,A,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var b=U.arrowwidth,x=U.arrowcolor,_=X.append("g").style({opacity:f.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=_.append("path").attr("d","M"+i+","+s+"L"+w+","+A).style("stroke-width",b+"px").call(f.stroke,f.rgb(x));v.arrowhead(k,U.arrowhead,"end",U.arrowsize);var M=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-w)+","+(s-A),transform:"translate("+w+","+A+")"}).style("stroke-width",b+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var E,T,C;g.init({element:M.node(),prepFn:function(){var t=u.getTranslate(W);T=t.x,C=t.y,E={},V&&V.autorange&&(E[V._name+".autorange"]=!0),q&&q.autorange&&(E[q._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var r=h(T,C),n=r[0]+t,i=r[1]+e;W.call(u.setTranslate,n,i),E[L+".x"]=V?U.x+t/V._m:(w+t-S.l)/S.w,E[L+".y"]=q?U.y+e/q._m:1-(A+e-S.t)/S.h,U.axref===U.xref&&(E[L+".ax"]=V?U.ax+t/V._m:(w+t-S.l)/S.w),U.ayref===U.yref&&(E[L+".ay"]=q?U.ay+e/q._m:1-(A+e-S.t)/S.h),Y.attr({transform:"rotate("+G+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,E);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};U.showarrow&&C(0,0);var R=u.rotationXYMatrix(G,H.x,H.y),I=u.apply2DTransform(R);if(t._context.editable){var P,O,N;g.init({element:W.node(),prepFn:function(){var t=u.getTranslate(W);P=t.x,O=t.y,N={}},moveFn:function(t,e){W.call(u.setTranslate,P+t,O+e);var r="pointer";if(U.showarrow)U.axref===U.xref?N[L+".ax"]=V.p2l(V.l2p(U.ax)+t):N[L+".ax"]=U.ax+t,U.ayref===U.yref?N[L+".ay"]=q.p2l(q.l2p(U.ay)+e):N[L+".ay"]=U.ay+e,C(t,e);else{if(V)N[L+".x"]=U.x+t/V._m;else{var n=U._xsize/S.w,i=U.x+U._xshift/S.w-n/2;N[L+".x"]=g.align(i+t/S.w,n,0,1,U.xanchor)}if(q)N[L+".y"]=U.y+e/q._m;else{var a=U._ysize/S.h,o=U.y-U._yshift/S.h-a/2;N[L+".y"]=g.align(o-e/S.h,a,0,1,U.yanchor)}V&&q||(r=g.getCursor(V?.5:N[L+".x"],q?.5:N[L+".y"],U.xanchor,U.yanchor))}var s=I(P,O),l=s[0]+t,c=s[1]+e;W.call(u.setTranslate,P+t,O+e),Y.attr({transform:"rotate("+G+","+l+","+c+")"}),p(W,r)},doneFn:function(e){if(p(W),e){l.relayout(t,N);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var b,x=t.layout,_=t._fullLayout;if(!s(e)||-1===e){if(!e&&Array.isArray(i))return x.annotations=i,v.supplyLayoutDefaults(x,_),void v.drawAll(t);if("remove"===i)return delete x.annotations,_.annotations=[],void v.drawAll(t);if(r&&"add"!==i){for(b=0;b<_.annotations.length;b++)v.draw(t,b,r,i);return}e=_.annotations.length,_.annotations.push({})}if(!r&&i){if("remove"===i){for(_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),_.annotations.splice(e,1),x.annotations.splice(e,1),b=e;b<_.annotations.length;b++)_._infolayer.selectAll('.annotation[data-index="'+(b+1)+'"]').attr("data-index",String(b)),v.draw(t,b);return}if("add"===i||u.isPlainObject(i)){_.annotations.splice(e,0,{});var w=u.isPlainObject(i)?u.extendFlat({},i):{text:"New text"};for(x.annotations?x.annotations.splice(e,0,w):x.annotations=[w],b=_.annotations.length-1;b>e;b--)_._infolayer.selectAll('.annotation[data-index="'+(b-1)+'"]').attr("data-index",String(b)),v.draw(t,b)}}_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var A=x.annotations[e],k=_.annotations[e];if(A){var M={xref:A.xref,yref:A.yref},E={};"string"==typeof r&&r?E[r]=i:u.isPlainObject(r)&&(E=r);var T=Object.keys(E);for(b=0;bb;b++){var R=C[b];if(void 0===E[R]&&void 0!==A[R]){var I=c.getFromId(t,c.coerceRef(M,{},t,R)),P=c.getFromId(t,c.coerceRef(A,{},t,R)),O=A[R],N=k["_"+R+"type"];if(void 0!==E[R+"ref"]){var z="auto"===A[R+"anchor"],D="x"===R?S.w:S.h,F=(k["_"+R+"size"]||0)/(2*D);if(I&&P)O=(O-I.range[0])/(I.range[1]-I.range[0]),O=P.range[0]+O*(P.range[1]-P.range[0]);else if(I){if(O=(O-I.range[0])/(I.range[1]-I.range[0]),O=I.domain[0]+O*(I.domain[1]-I.domain[0]),z){var B=O+F,j=O-F;2/3>O+j?O=j:O+B>4/3&&(O=B)}}else P&&(z&&(1/3>O?O+=F:O>2/3&&(O-=F)),O=(O-P.domain[0])/(P.domain[1]-P.domain[0]),O=P.range[0]+O*(P.range[1]-P.range[0]))}P&&P===I&&N&&("log"===N&&"log"!==P.type?O=Math.pow(10,O):"log"!==N&&"log"===P.type&&(O=O>0?Math.log(O)/Math.LN10:void 0)),A[R]=O}}var U=n(A,_);_.annotations[e]=U;var V=c.getFromId(t,U.xref),q=c.getFromId(t,U.yref),H={x:0,y:0},G=+U.textangle||0,X=_._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",U.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:A,fullAnnotation:U})}),Y=X.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),W=Y.append("g"),Z=U.borderwidth,Q=U.borderpad,$=Z+Q,K=W.append("rect").attr("class","bg").style("stroke-width",Z+"px").call(f.stroke,U.bordercolor).call(f.fill,U.bgcolor),J=U.font,tt=W.append("text").classed("annotation",!0).attr("data-unformatted",U.text).text(U.text);t._context.editable?tt.call(d.makeEditable,W).call(m).on("edit",function(r){U.text=r,this.attr({"data-unformatted":U.text}),this.call(m);var n={};n["annotations["+e+"].text"]=U.text,V&&V.autorange&&(n[V._name+".autorange"]=!0),q&&q.autorange&&(n[q._name+".autorange"]=!0),l.relayout(t,n)}):tt.call(m),Y.attr({transform:"rotate("+G+","+H.x+","+H.y+")"}).call(h.setPosition,H.x,H.y)}},v.arrowhead=function(t,e,r,n){s(n)||(n=1);var i=t.node(),a=v.ARROWPATHS[e||0];if(a){"string"==typeof r&&r||(r="end");var l,u,c,d,p=(h.getPx(t,"stroke-width")||1)*n,g=t.style("stroke")||f.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=a.backoff*p;if("line"===i.nodeName){if(l={x:+t.attr("x1"),y:+t.attr("y1")},u={x:+t.attr("x2"),y:+t.attr("y2")},c=Math.atan2(l.y-u.y,l.x-u.x),d=c+Math.PI,x){var _=x*Math.cos(c),w=x*Math.sin(c);y&&(l.x-=_,l.y-=w,t.attr({x1:l.x,y1:l.y})),b&&(u.x+=_,u.y+=w,t.attr({x2:u.x,y2:u.y}))}}else if("path"===i.nodeName){var A=i.getTotalLength(),k="";if(y){var M=i.getPointAtLength(0),E=i.getPointAtLength(.1);c=Math.atan2(M.y-E.y,M.x-E.x),l=i.getPointAtLength(Math.min(x,A)),x&&(k="0px,"+x+"px,")}if(b){var T=i.getPointAtLength(A),L=i.getPointAtLength(A-.1);if(d=Math.atan2(T.y-L.y,T.x-L.x),u=i.getPointAtLength(Math.max(0,A-x)),x){var S=k?2*x:x;k+=A-S+"px,"+A+"px"}}else k&&(k+=A+"px");k&&t.style("stroke-dasharray",k)}var C=function(r,n){e>5&&(n=0),o.select(i.parentElement).append("path").attr({"class":t.attr("class"),d:a.path,transform:"translate("+r.x+","+r.y+")rotate("+180*n/Math.PI+")scale("+p+")"}).style({fill:g,opacity:m,"stroke-width":0})};y&&C(l,c),b&&C(u,d)}},v.calcAutorange=function(t){var e=t._fullLayout,r=e.annotations;if(r.length&&t._fullData.length){var n={};r.forEach(function(t){n[t.xref]=!0,n[t.yref]=!0});var a=c.list(t).filter(function(t){return t.autorange&&n[t._id]});if(a.length)return u.syncOrAsync([v.drawAll,i],t)}}},{"../../lib":257,"../../lib/setcursor":266,"../../lib/svg_text_utils":270,"../../plotly":277,"../../plots/cartesian/axes":280,"../color":176,"../dragelement":197,"../drawing":199,"./arrow_paths":172,"./attributes":173,d3:62,"fast-isnumeric":65}],175:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],176:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=0))return t;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return t}var s=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r:a.r*(1-r.a)+r.r*r.a,g:a.g*(1-r.a)+r.g*r.a,b:a.b*(1-r.a)+r.b*r.a};return i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;el&&(a[1]-=(ot-l)/2)):r.node()&&!r.classed("js-placeholder")&&(ot=h.bBox(e.node()).height),ot){if(ot+=5,"top"===x.titleside)K.domain[1]-=ot/M.h,a[1]*=-1;else{K.domain[0]+=ot/M.h;var c=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-c)*l}e.attr("transform","translate("+a+")"),K.setScale()}}it.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(M.h*(1-K.domain[1]))+")");var f=it.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?T[0]:(S[e]+S[e-1])/2,e===S.length-1?T[1]:(S[e]+S[e+1])/2].map(K.c2p).map(Math.round);e!==S.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=R(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:X,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var d=it.select(".cblines").selectAll("path.cbline").data(x.line.color&&x.line.width?L:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+X+","+(Math.round(K.c2p(t))+x.line.width/2%1)+"h"+B).call(h.lineGroupStyle,x.line.width,C(t),x.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=X+B+(x.outlinewidth||0)/2-("outside"===x.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(-1===["top","bottom"].indexOf(x.titleside)){var e=K.titlefont.size,r=K._offset+K._length/2,i=M.l+(K.position||0)*M.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));w("h"+K._id+"title",{avoid:{selection:n.select(t).selectAll("g."+K._id+"tick"),side:x.titleside,offsetLeft:M.l,offsetTop:M.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,r){var n,i=b();n=o.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:K,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:it.select(".cbtitle")},s="h"===e.charAt(0)?e.substr(1):"h"+e;it.selectAll("."+s+",."+s+"-math-group").remove(),p.draw(t,e,c(a,r||{}))}function A(){var r=B+x.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(z=at.select("text"),z.node()&&!z.classed("js-placeholder")){var n,i=at.select(".h"+K._id+"title-math-group").node();n=i&&-1!==["top","bottom"].indexOf(x.titleside)?h.bBox(i).width:h.bBox(at.node()).right-X-M.l,r=Math.max(r,n)}var a=2*x.xpad+r+x.borderwidth+x.outlinewidth/2,s=Z-Q;it.select(".cbbg").attr({x:X-x.xpad-(x.borderwidth+x.outlinewidth)/2,y:Q-H,width:Math.max(a,2),height:Math.max(s+2*H,2)}).call(d.fill,x.bgcolor).call(d.stroke,x.bordercolor).style({"stroke-width":x.borderwidth}),it.selectAll(".cboutline").attr({x:X,y:Q+x.ypad+("top"===x.titleside?ot:0),width:Math.max(B,2),height:Math.max(s-2*x.ypad-ot,2)}).call(d.stroke,x.outlinecolor).style({fill:"None","stroke-width":x.outlinewidth});var l=({center:.5,right:1}[x.xanchor]||0)*a;it.attr("transform","translate("+(M.l-l)+","+M.t+")"),o.autoMargin(t,e,{x:x.x,y:x.y,l:a*({right:1,center:.5}[x.xanchor]||0),r:a*({left:1,center:.5}[x.xanchor]||0),t:s*({bottom:1,middle:.5}[x.yanchor]||0),b:s*({top:1,middle:.5}[x.yanchor]||0)})}var k=t._fullLayout,M=k._size;if("function"!=typeof x.fillcolor&&"function"!=typeof x.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,T=n.extent(("function"==typeof x.fillcolor?x.fillcolor:x.line.color).domain()),L=[],S=[],C="function"==typeof x.line.color?x.line.color:function(){return x.line.color},R="function"==typeof x.fillcolor?x.fillcolor:function(){return x.fillcolor},I=x.levels.end+x.levels.size/100,P=x.levels.size,O=1.001*T[0]-.001*T[1],N=1.001*T[1]-.001*T[0];for(E=x.levels.start;0>(E-I)*P;E+=P)E>O&&N>E&&L.push(E);if("function"==typeof x.fillcolor)if(x.filllevels)for(I=x.filllevels.end+x.filllevels.size/100,P=x.filllevels.size,E=x.filllevels.start;0>(E-I)*P;E+=P)E>T[0]&&E1){var nt=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));tt*=nt*u.roundUp(rt/nt,[2,5,10]),(Math.abs(x.levels.start)/x.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=tt}K.domain=[W+G,W+V-G],K.setScale();var it=k._infolayer.selectAll("g."+e).data([0]);it.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),it.attr("transform","translate("+Math.round(M.l)+","+Math.round(M.t)+")");var at=it.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(M.l)+",-"+Math.round(M.t)+")");K._axislayer=it.select(".cbaxis");var ot=0;if(-1!==["top","bottom"].indexOf(x.titleside)){var st,lt=M.l+(x.x+q)*M.w,ut=K.titlefont.size;st="top"===x.titleside?(1-(W+V-G))*M.h+M.t+3+.75*ut:(1-(W+G))*M.h+M.t-3-.25*ut,w(K._id+"title",{attributes:{x:lt,y:st,"text-anchor":"start"}})}var ct=u.syncOrAsync([o.previousPromises,_,o.previousPromises,A],t);if(ct&&ct.then&&(t._promises||[]).push(ct),t._context.editable){var ft,ht,dt;l.init({element:it.node(),prepFn:function(){ft=it.attr("transform"),f(it)},moveFn:function(t,e){it.attr("transform",ft+" translate("+t+","+e+")"),ht=l.align(Y+t/M.w,j,0,1,x.xanchor),dt=l.align(W-e/M.h,V,0,1,x.yanchor);var r=l.getCursor(ht,dt,x.xanchor,x.yanchor);f(it,r)},doneFn:function(e){f(it),e&&void 0!==ht&&void 0!==dt&&a.restyle(t,{"colorbar.x":ht,"colorbar.y":dt},b().index)}})}return ct}function b(){var r,n,i=e.substr(2);for(r=0;rc*f?i.RdBu:c>=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":257,"./flip_scale":187,"./scales":194}],184:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":254,"./attributes":182,"./scales.js":194}],185:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":194}],186:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../colorbar/has_colorbar"),o=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,r,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&m>v;u(f+h+"auto",!b),u(f+h+"min"),u(f+h+"max");var x;void 0!==y&&(x=!s(y)),u(f+"autocolorscale",x);var _=u(f+"colorscale"),w=u(f+"reversescale");if(w&&(g.colorscale=l(_)),"marker.line."!==f){var A;f&&(A=a(p));var k=u(f+"showscale",A);k&&o(p,g,r)}}},{"../../lib":257,"../colorbar/defaults":178,"../colorbar/has_colorbar":180,"./flip_scale":187,"./is_valid_scale":191,"fast-isnumeric":65}],187:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=t.length,n=new Array(r),i=r-1,a=0;i>=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],188:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./default_scale"),a=t("./is_valid_scale_array");e.exports=function(t,e){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":185,"./is_valid_scale_array":192,"./scales":194}],189:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("./is_valid_scale");e.exports=function(t,e){var r=e?i.nestedProperty(t,e).get()||{}:t,o=r.color,s=!1;if(Array.isArray(o))for(var l=0;lh;h++)l=t[h],c[h]=e+l[0]*(r-e),f[h]=i(l[1]).toRgb();var d=n.scale.linear().domain(c).interpolate(n.interpolateObject).range(f);return function(t){if(a(t)){var n=o.constrain(t,e,r),l=d(n);return i(l).toRgbString()}return i(t).isValid()?t:s.defaultLine}}},{"../../lib":257,"../color":176,d3:62,"fast-isnumeric":65,tinycolor2:148}],194:[function(t,e,r){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]], -Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],195:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){var a=(t-r)/(n-r),o=a+e/(n-r),s=(a+o)/2;return"left"===i||"bottom"===i?a:"center"===i||"middle"===i?s:"right"===i||"top"===i?o:2/3-s>a?a:o>4/3-s?o:s}},{}],196:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,a){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===a?0:"middle"===a?1:"top"===a?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":257}],197:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":257,"../../plotly":277,"../../plots/cartesian/constants":285,"./align":195,"./cursor":196,"./unhover":198}],198:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":253}],199:[function(t,e,r){"use strict";function n(t,e,r,n){var a=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(a*a+o*o,x/2),c=Math.pow(s*s+l*l,x/2),f=(c*c*a-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[i.round(e[0]+(d&&f/d),2),i.round(e[1]+(d&&h/d),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&h/p),2)]]}var i=t("d3"),a=t("fast-isnumeric"),o=t("../../plots/plots"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),d=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},p.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},p.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},p.setRect=function(t,e,r,n,i){t.call(p.setPosition,e,r).call(p.setSize,n,i)},p.translatePoints=function(t,e,r){t.each(function(t){var n=t.xp||e.c2p(t.x),o=t.yp||r.c2p(t.y),s=i.select(this);a(n)&&a(o)?"text"===this.nodeName?s.attr("x",n).attr("y",o):s.attr("transform","translate("+n+","+o+")"):s.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,r){return e&&a(e)?t._context.staticPlot?e:1>e?1:Math.round(e):r||0},p.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,l=n||a.dash||"";i.select(this).call(s.stroke,r||a.color).call(p.dashLine,l,o)})},p.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(n){u.error(n,t),r.remove()}})};var g=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=p.symbolNames.length,m="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=r.line;if(o.traceIs(e,"symbols")){var a=d(e);t.attr("d",function(t){var n;n="various"===t.ms||"various"===r.size?3:h.isBubble(e)?a(t.ms):(r.size||6)/2,t.mrc=n;var i=p.symbolNumber(t.mx||r.symbol)||0,o=i%100;return t.om=i%200>=100,p.symbolFuncs[o](n)+(i>=200?m:"")}).style("opacity",function(t){return(t.mo+1||r.opacity+1)-1})}var l=(e._input||{}).marker||{},u=p.tryColorscale(r,l,""),c=p.tryColorscale(r,l,"line.");t.each(function(t){var e,a,o;t.so?(o=n.outlierwidth,a=n.outliercolor,e=r.outliercolor):(o=(t.mlw+1||n.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,a="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(n.color)?s.defaultLine:n.color,e="mc"in t?t.mcc=u(t.mc):Array.isArray(r.color)?s.defaultLine:r.color||"rgba(0,0,0,0)");var l=i.select(this);t.om?l.call(s.stroke,e).style({"stroke-width":(o||1)+"px",fill:"none"}):(l.style("stroke-width",o+"px").call(s.fill,e),o&&l.call(s.stroke,a))})}},p.tryColorscale=function(t,e,r){var n=u.nestedProperty(t,r+"color").get(),i=u.nestedProperty(t,r+"colorscale").get(),o=u.nestedProperty(t,r+"cauto").get(),s=u.nestedProperty(t,r+"cmin"),c=u.nestedProperty(t,r+"cmax"),f=s.get(),h=c.get();return i&&Array.isArray(n)?(!o&&a(f)&&a(h)||(f=1/0,h=-(1/0),n.forEach(function(t){a(t)&&(f>t&&(f=+t),t>h&&(h=+t))}),f>h&&(f=0,h=1),s.set(f),c.set(h),u.nestedProperty(e,r+"cmin").set(f),u.nestedProperty(e,r+"cmax").set(h)),l.makeScaleFunction(i,f,h)):u.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;p.textPointStyle=function(t,e){t.each(function(t){var r=i.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var o=t.tp||e.textposition,s=-1!==o.indexOf("top")?"top":-1!==o.indexOf("bottom")?"bottom":"middle",l=-1!==o.indexOf("left")?"end":-1!==o.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;u=a(u)&&u>0?u:0,r.call(p.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(c.convertToTspans);var h=i.select(this.parentNode),d=r.selectAll("tspan.line"),g=((d[0].length||1)-1)*b+1,v=y[l]*f,m=.75*u+y[s]*f+(y[s]-1)*g*u/2;h.attr("transform","translate("+v+","+m+")"),g>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var x=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,i="M"+t[0],a=[];for(r=1;rr;r++)o.push(n(t[r-1],t[r],t[r+1],e));for(o.push(n(t[a-1],t[a],t[0],e)),r=1;a>=r;r++)i+="C"+o[r-1][1]+" "+o[r][0]+" "+t[r];return i+="C"+o[a][1]+" "+o[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+i.round(e[0],2)+"V"+i.round(e[1],2)},vh:function(t,e){return"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},hvh:function(t,e){return"H"+i.round((t[0]+e[0])/2,2)+"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},vhv:function(t,e){return"V"+i.round((t[1]+e[1])/2,2)+"H"+i.round(e[0],2)+"V"+i.round(e[1],2)}},w=function(t,e){return"L"+i.round(e[0],2)+","+i.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var r="M"+i.round(t[0][0],2)+","+i.round(t[0][1],2),n=1;n=k&&(i.selectAll("[data-bb]").attr("data-bb",null),A=[]),t.setAttribute("data-bb",A.length),A.push(l),u.extendFlat({},l)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":248,"../../lib":257,"../../lib/svg_text_utils":270,"../../plots/plots":304,"../../traces/scatter/make_bubble_size_func":356,"../../traces/scatter/subtypes":361,"../color":176,"../colorscale":190,"./symbol_defs":200,d3:62,"fast-isnumeric":65}],200:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+i+a+i+a+o+a+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"H-"+r+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),a=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+i+o+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+i+o+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:62}],201:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],202:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(a),f=0;fs;s++)o[s]={x:r[s],y:i[s]};return o[0].trace=t,n.calc({calcdata:[o],_fullLayout:e}),o},n.plot=t("./plot"),n.style=t("./style"),n.hoverInfo=function(t,e,r){(e.error_y||{}).visible&&(r.yerr=t.yh-t.y,e.error_y.symmetric||(r.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(r.xerr=t.xh-t.x,e.error_x.symmetric||(r.xerrneg=t.x-t.xs))}},{"./attributes":201,"./calc":202,"./defaults":204,"./plot":206,"./style":207}],206:[function(t,e,r){"use strict";function n(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};return void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),a(n.ys)||(n.noYS=!0,n.ys=r.c2p(t.ys,!0))),void 0!==t.xh&&(n.xh=e.c2p(t.xh),n.xs=e.c2p(t.xs),a(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0))),n}var i=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),s=t("../../traces/scatter/subtypes");e.exports=function(t,e){var r=e.x(),l=e.y();t.each(function(t){var e=t[0].trace,u=e.error_x||{},c=e.error_y||{},f=s.hasMarkers(e)&&e.marker.maxdisplayed>0;if(c.visible||u.visible){var h=i.select(this).selectAll("g.errorbar").data(o.identity);h.enter().append("g").classed("errorbar",!0),h.each(function(t){var e=i.select(this),o=n(t,r,l);if(!f||t.vis){var s;if(c.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var h=c.width;s="M"+(o.x-h)+","+o.yh+"h"+2*h+"m-"+h+",0V"+o.ys,o.noYS||(s+="m-"+h+",0h"+2*h),e.append("path").classed("yerror",!0).attr("d",s)}if(u.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var d=(u.copy_ystyle?c:u).width;s="M"+o.xh+","+(o.y-d)+"v"+2*d+"m0,-"+d+"H"+o.xs,o.noXS||(s+="m0,-"+d+"v"+2*d),e.append("path").classed("xerror",!0).attr("d",s)}}})}})}},{"../../lib":257,"../../traces/scatter/subtypes":361,d3:62,"fast-isnumeric":65}],207:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},a=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),a.copy_ystyle&&(a=r),o.selectAll("path.xerror").style("stroke-width",a.thickness+"px").call(i.stroke,a.color)})}},{"../color":176,d3:62}],208:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":285}],209:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;2>s;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],a=0;a=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],213:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":254,"../../plots/font_attributes":298,"../color/attributes":175}],214:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],215:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/plots"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r){function s(t,e){return n.coerce(h,d,a,t,e)}for(var l,u,c,f,h=t.legend||{},d=e.legend={},p=0,g="normal",v=0;v1);if(y!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),n.coerceFont(s,"font",e.font),s("orientation"),"h"===d.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(l=0,c="left",u=1.1,f="bottom"):(l=0,c="left",u=-.1,f="top")}s("traceorder",g),o.isGrouped(e.legend)&&s("tracegroupgap"),s("x",l),s("xanchor",c),s("y",u),s("yanchor",f),n.noneOrAll(h,d,["x","y"])}}},{"../../lib":257,"../../plots/plots":304,"./attributes":213,"./helpers":218}],216:[function(t,e,r){"use strict";function n(t,e){function r(r){c.util.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=h.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,i.legend.font).text(u),e._context.editable&&!s?f.call(c.util.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" "),c.restyle(e,"name",t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(h.traceIs(s,"pie")){var f=a.label,d=r.indexOf(f);-1===d?r.push(f):r.splice(d,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),d=h[0].length||1;r=l*d,n=c.node()&&p.bBox(c.node()).width;var g=l*(.3+(1-d)/2);c.attr("y",g),h.attr("y",g)}r=Math.max(r,16)+3,a.attr({x:0,y:-r/2,height:r}),i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=b.isGrouped(i);if(b.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),r.selectAll(".legendtoggle").attr("width",(t._context.editable?0:i.width)+40),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height);else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;h>c;c++){var d=l[c].map(function(t){return t[0].width}),p=40+Math.max.apply(null,d);i.width+=i.tracegroupgap+p,s.push(i.width)}e.each(function(t,e){f.setTranslate(this,s[e],0)}),e.each(function(){var t=u.select(this),e=t.selectAll("g.traces"),r=0;e.each(function(t){var e=t[0],n=e.height;f.setTranslate(this,0,5+a+r+n/2),r+=n}),i.height=Math.max(i.height,r)}),i.height+=10+2*a,i.width+=2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}else{i.width=0,i.height=0;var g=0,v=0,m=0,y=0;r.each(function(t){m=Math.max(40+t[0].width,m)}),r.each(function(t){var e=t[0],r=m,o=i.tracegroupgap||5;a+y+o+r>n.width-(n.margin.r+n.margin.l)&&(y=0,g+=v,i.height=i.height+v,v=0),f.setTranslate(this,a+y,5+a+e.height/2+g),i.width+=o+r,i.height=Math.max(i.height,e.height),y+=o+r,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}}function s(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center");var i="top";x.isBottomAnchor(r)?i="bottom":x.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../dragelement"),p=t("../drawing"),g=t("../color"),v=t("./constants"),m=t("./get_legend_data"),y=t("./style"),b=t("./helpers"),x=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),T.call(p.setRect,F,t,v.scrollBarWidth,v.scrollBarHeight),k.select("rect").attr({y:b.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var b=r.legend,_=r.showlegend&&m(t.calcdata,b),w=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({"class":"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var M=A.selectAll("rect.bg").data([0]);M.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),M.call(g.stroke,b.bordercolor),M.call(g.fill,b.bgcolor),M.style("stroke-width",b.borderwidth+"px");var E=A.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var T=A.selectAll("rect.scrollbar").data([0]);T.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var L=E.selectAll("g.groups").data(_);L.enter().append("g").attr("class","groups"),L.exit().remove();var S=L.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var C=0!==A.enter().size();C&&(o(t,L,S),s(t));var R=0,I=r.width,P=0,O=r.height;o(t,L,S),b.height>O?l(t):s(t);var N=r._size,z=N.l+N.w*b.x,D=N.t+N.h*(1-b.y);x.isRightAnchor(b)?z-=b.width:x.isCenterAnchor(b)&&(z-=b.width/2),x.isBottomAnchor(b)?D-=b.height:x.isMiddleAnchor(b)&&(D-=b.height/2);var F=b.width,B=N.w;F>B?(z=N.l,F=B):(z+F>I&&(z=I-F),R>z&&(z=R),F=Math.min(I-z,b.width));var j=b.height,U=N.h;j>U?(D=N.t,j=U):(D+j>O&&(D=O-j),P>D&&(D=P),j=Math.min(O-D,b.height)),f.setTranslate(A,z,D);var V,q,H=j-v.scrollBarHeight-2*v.scrollBarMargin,G=b.height-j;if(b.height<=j||t._context.staticPlot)M.attr({width:F-b.borderwidth,height:j-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),f.setTranslate(E,0,0),k.select("rect").attr({width:F-2*b.borderwidth,height:j-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth}),E.call(p.setClipUrl,a);else{V=v.scrollBarMargin,q=E.attr("data-scroll")||0,M.attr({width:F-2*b.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:j-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),k.select("rect").attr({width:F-2*b.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:j-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth-q}),E.call(p.setClipUrl,a),C&&e(V,q),A.on("wheel",null),A.on("wheel",function(){q=f.constrain(E.attr("data-scroll")-u.event.deltaY/H*G,-G,0),V=v.scrollBarMargin-q/G*H,e(V,q),u.event.preventDefault()}),T.on(".drag",null),E.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=f.constrain(u.event.y-v.scrollBarHeight/2,v.scrollBarMargin,v.scrollBarMargin+H),q=-(V-v.scrollBarMargin)/H*G,e(V,q)});T.call(X),E.call(X)}if(t._context.editable){var Y,W,Z,Q;A.classed("cursor-move",!0),d.init({element:A.node(),prepFn:function(){var t=f.getTranslate(A);Z=t.x,Q=t.y},moveFn:function(t,e){var r=Z+t,n=Q+e;f.setTranslate(A,r,n),Y=d.align(r,0,N.l,N.l+N.w,b.xanchor),W=d.align(n,0,N.t+N.h,N.t,b.yanchor)},doneFn:function(e){e&&void 0!==Y&&void 0!==W&&c.relayout(t,{"legend.x":Y,"legend.y":W})}})}}}},{"../../lib":257,"../../plotly":277,"../../plots/plots":304,"../color":176,"../dragelement":197,"../drawing":199,"./anchor_utils":212,"./constants":214,"./get_legend_data":217,"./helpers":218,"./style":220,d3:62}],217:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+f;l.push(n),s[n]=[[r]],f++}}var a,o,s={},l=[],u=!1,c={},f=0;for(a=0;aa;a++)m=s[l[a]],y[a]=i.isReversed(e)?m.reverse():m;else{for(y=[new Array(b)],a=0;b>a;a++)m=s[l[a]][0],y[0][i.isReversed(e)?b-a-1:a]=m;b=1}return e._lgroupsLength=b,y}},{"../../plots/plots":304,"./helpers":218}],218:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.legendGetsTrace=function(t){return t.visible&&n.traceIs(t,"showLegend")},r.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},r.isVertical=function(t){return"h"!==t.orientation},r.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":304}],219:[function(t,e,r){"use strict";var n=e.exports={};n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.draw=t("./draw"),n.style=t("./style")},{"./attributes":213,"./defaults":215,"./draw":216,"./style":220}],220:[function(t,e,r){"use strict";function n(t){var e=t[0].trace,r=e.visible&&e.fill&&"none"!==e.fill,n=d.hasLines(e),i=l.select(this).select(".legendfill").selectAll("path").data(r?[t]:[]);i.enter().append("path").classed("js-fill",!0),i.exit().remove(),i.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var a=l.select(this).select(".legendlines").selectAll("path").data(n?[t]:[]);a.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),a.exit().remove(),a.call(f.lineGroupStyle)}function i(t){function e(t,e,r){var n=u.nestedProperty(o,t).get(),i=Array.isArray(n)&&e?e(n):n;if(r){if(ir[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),c=d.hasText(o),h=d.hasLines(o);if(s||c||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(a,p)],i=u.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../lib"),c=t("../../plots/plots"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":257,"../../plots/plots":304,"../../traces/pie/style_one":340,"../../traces/scatter/subtypes":361,"../color":176,"../drawing":199,d3:62}],221:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,h=(1-c)/2,d=u.Axes.list(t,null,!0),p=0;py;y++){var b=s[y];h=m[b]={};for(var x=0;x1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.Axes.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":257,"../color":176,"./attributes":224,"./button_attributes":225,"./constants":226}],228:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;ne){var r=e;e=t,t=r}s.setAttributes(w,{"data-min":t,"data-max":e}),s.setAttributes(P,{x:t,width:e-t}),s.setAttributes(M,{width:t}),s.setAttributes(E,{x:e,width:p-e}),s.setAttributes(T,{transform:"translate("+(t-v-1)+")"}),s.setAttributes(C,{transform:"translate("+e+")"})}var f=t._fullLayout,h=f._infolayer.selectAll("g.range-slider"),d=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*d.thickness,v=2,m=Math.floor(d.borderwidth/2),y=f.margin.l,b=f.height-g-f.margin.b,x=0,_=p,w=document.createElementNS(o,"g");s.setAttributes(w,{"class":"range-slider","data-min":x,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+b+")"});var A=document.createElementNS(o,"rect"),k=d.borderwidth%2===0?d.borderwidth:d.borderwidth-1; -s.setAttributes(A,{fill:d.bgcolor,stroke:d.bordercolor,"stroke-width":d.borderwidth,height:g+k,width:p+k,transform:"translate(-"+m+", -"+m+")","shape-rendering":"crispEdges"});var M=document.createElementNS(o,"rect");s.setAttributes(M,{x:0,width:x,height:g,fill:"rgba(0,0,0,0.4)"});var E=document.createElementNS(o,"rect");s.setAttributes(E,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(o,"g"),L=document.createElementNS(o,"rect"),S=document.createElementNS(o,"rect");s.setAttributes(T,{transform:"translate("+(x-v-1)+")"}),s.setAttributes(L,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),s.setAttributes(S,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(T,[S,L]);var C=document.createElementNS(o,"g"),R=document.createElementNS(o,"rect"),I=document.createElementNS(o,"rect");s.setAttributes(C,{transform:"translate("+_+")"}),s.setAttributes(R,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),s.setAttributes(I,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(C,[I,R]);var P=document.createElementNS(o,"rect");s.setAttributes(P,{x:x,width:_-x,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function r(t){var r,n,f=+t.clientX-a;switch(i){case P:w.style.cursor="ew-resize",r=+s+f,n=+l+f,c(r,n),u(e(r),e(n));break;case L:w.style.cursor="col-resize",r=+s+f,n=+l,c(r,n),u(e(r),e(n));break;case R:w.style.cursor="col-resize",r=+s,n=+l+f,c(r,n),u(e(r),e(n));break;default:w.style.cursor="ew-resize",r=o,n=o+f,c(r,n),u(e(r),e(n))}}function n(){window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n),w.style.cursor="auto"}var i=t.target,a=t.clientX,o=a-w.getBoundingClientRect().left,s=w.getAttribute("data-min"),l=w.getAttribute("data-max");window.addEventListener("mousemove",r),window.addEventListener("mouseup",n)}),d.range||(d.range=i.getAutoRange(f.xaxis));var O=l(t,p,g);s.appendChildren(w,[A,O,M,E,P,T,C]),r(f.xaxis.range[0],f.xaxis.range[1]),h.data([0]).enter().append(function(){return d.setRange=r,w})}},{"../../constants/xmlns_namespaces":248,"../../lib":257,"../../plotly":277,"../../plots/cartesian/axes":280,"./helpers":234,"./range_plot":236}],233:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,a){function o(t,e){return n.coerce(s,l,i,t,e)}if(t[r].rangeslider){var s=n.isPlainObject(t[r].rangeslider)?t[r].rangeslider:{},l=e[r].rangeslider={};if(o("bgcolor"),o("bordercolor"),o("borderwidth"),o("thickness"),o("visible"),o("range"),l.range&&!e[r].autorange){var u=l.range,c=e[r].range;u[0]=Math.min(u[0],c[0]),u[1]=Math.max(u[1],c[1])}else e[r]._needsExpand=!0;l.visible&&a.forEach(function(t){var r=e[t]||{};r.fixedrange=!0,e[t]=r})}}},{"../../lib":257,"./attributes":231}],234:[function(t,e,r){"use strict";r.setAttributes=function(t,e){for(var r in e)t.setAttribute(r,e[r])},r.appendChildren=function(t,e){for(var r=0;rl;l++){var u=s[l],c={_fullLayout:e},f=M.coerceRef(t,n,c,u);if("path"!==o){var h=.25,d=.75;if("paper"!==f){var p=M.getFromId(c,f),g=a(p);h=g(p.range[0]+h*(p.range[1]-p.range[0])),d=g(p.range[0]+d*(p.range[1]-p.range[0]))}r(u+"0",h),r(u+"1",d)}}return"path"===o?r("path"):k.noneOrAll(t,n,["x0","x1","y0","y1"]),n}function i(t){return"category"===t.type?t.c2l:t.d2l}function a(t){return"category"===t.type?t.l2c:t.l2d}function o(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function s(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function l(t,e,r){for(var n=0;ne;i--)d(t,i).selectAll('[data-index="'+(i-1)+'"]').attr("data-index",i),C.draw(t,i)}function f(t,e,r,o){function s(r){var n={"data-index":e,"fill-rule":"evenodd",d:b(t,C)},i=C.line.width?C.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",C.opacity).call(E.stroke,i).call(E.fill,C.fillcolor).call(T.dashLine,C.line.dash,C.line.width);R&&a.call(T.setClipUrl,"clip"+t._fullLayout._uid+R),t._context.editable&&h(t,a,C,e)}var l,u;d(t,e).selectAll('[data-index="'+e+'"]').remove();var c=t.layout.shapes[e];if(c){var f={xref:c.xref,yref:c.yref},g={};"string"==typeof r&&r?g[r]=o:k.isPlainObject(r)&&(g=r);var v=Object.keys(g);for(l=0;ll;l++){var x=y[l];if(void 0===g[x]&&void 0!==c[x]){var _,w=x.charAt(0),A=M.getFromId(t,M.coerceRef(f,{},t,w)),L=M.getFromId(t,M.coerceRef(c,{},t,w)),S=c[x];void 0!==g[w+"ref"]&&(A?(_=i(A)(S),S=(_-A.range[0])/(A.range[1]-A.range[0])):S=(S-L.domain[0])/(L.domain[1]-L.domain[0]),L?(_=L.range[0]+S*(L.range[1]-L.range[0]),S=a(L)(_)):S=A.domain[0]+S*(A.domain[1]-A.domain[0])),c[x]=S}}var C=n(c,t._fullLayout);t._fullLayout.shapes[e]=C;var R;if("below"!==C.layer)R=(C.xref+C.yref).replace(/paper/g,""),s(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)R="",s(t._fullLayout._shapeLowerLayer);else{var I,P=t._fullLayout._plots||{},O=Object.keys(P);for(l=0,u=O.length;u>l;l++)I=P[O[l]],R=O[l],p(t,C,I)&&s(I.shapelayer)}}}function h(t,e,r,n){function i(t){var r=$.right-$.left,n=$.bottom-$.top,i=t.clientX-$.left,a=t.clientY-$.top,o=r>W&&n>Z&&!t.shiftKey?L.getCursor(i/r,1-a/n):"move";S(e,o),Y=o.split("-")[0]}function a(e){U=M.getFromId(t,r.xref),V=M.getFromId(t,r.yref),q=m(t,U),H=m(t,V,!0),G=y(t,U),X=y(t,V,!0);var a="shapes["+n+"]";"path"===r.type?(B=r.path,j=a+".path"):(c=q(r.x0),f=H(r.y0),h=q(r.x1),d=H(r.y1),p=a+".x0",g=a+".y0",_=a+".x1",w=a+".y1"),h>c?(T=c,P=a+".x0",D="x0",C=h,O=a+".x1",F="x1"):(T=h,P=a+".x1",D="x1",C=c,O=a+".x0",F="x0"),d>f?(k=f,R=a+".y0",N="y0",E=d,I=a+".y1",z="y1"):(k=d,R=a+".y1",N="y1",E=f,I=a+".y0",z="y0"),u={},i(e),Q.moveFn="move"===Y?s:l}function o(r){S(e),r&&A.relayout(t,u)}function s(n,i){if("path"===r.type){var a=function(t){return G(q(t)+n)};U&&"date"===U.type&&(a=v(a));var o=function(t){return X(H(t)+i)};V&&"date"===V.type&&(o=v(o)),r.path=x(B,a,o),u[j]=r.path}else u[p]=r.x0=G(c+n),u[g]=r.y0=X(f+i),u[_]=r.x1=G(h+n),u[w]=r.y1=X(d+i);e.attr("d",b(t,r))}function l(n,i){if("path"===r.type){var a=function(t){return G(q(t)+n)};U&&"date"===U.type&&(a=v(a));var o=function(t){return X(H(t)+i)};V&&"date"===V.type&&(o=v(o)),r.path=x(B,a,o),u[j]=r.path}else{var s=~Y.indexOf("n")?k+i:k,l=~Y.indexOf("s")?E+i:E,c=~Y.indexOf("w")?T+n:T,f=~Y.indexOf("e")?C+n:C;l-s>Z&&(u[R]=r[N]=X(s),u[I]=r[z]=X(l)),f-c>W&&(u[P]=r[D]=G(c),u[O]=r[F]=G(f))}e.attr("d",b(t,r))}var u,c,f,h,d,p,g,_,w,k,E,T,C,R,I,P,O,N,z,D,F,B,j,U,V,q,H,G,X,Y,W=10,Z=10,Q={setCursor:i,element:e.node(),prepFn:a,doneFn:o},$=Q.element.getBoundingClientRect();L.init(Q)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):k.log("getShapeLayer: undefined shape: index",e),n}function p(t,e,r){var n=A.Axes.getFromId(t,r.id,"x")._id,i=A.Axes.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function v(t){return function(e){return t(e).replace(" ","_")}}function m(t,e,r){var n,a=t._fullLayout._size;if(e){var o=i(e);n=function(t){return e._offset+e.l2p(o(t,!0))},"date"===e.type&&(n=g(n))}else n=r?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return n}function y(t,e,r){var n,i=t._fullLayout._size;if(e){var o=a(e);n=function(t){return o(e.p2l(t-e._offset))}}else n=r?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return n}function b(t,e){var r,n,a,o,s=e.type,l=M.getFromId(t,e.xref),u=M.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=i(l),n=function(t){return l._offset+l.l2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(a=i(u),o=function(t){return u._offset+u.l2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===s)return l&&"date"===l.type&&(n=g(n)),u&&"date"===u.type&&(o=g(o)),C.convertPath(e.path,n,o);var f=n(e.x0),h=n(e.x1),d=o(e.y0),p=o(e.y1);if("line"===s)return"M"+f+","+d+"L"+h+","+p;if("rect"===s)return"M"+f+","+d+"H"+h+"V"+p+"H"+f+"Z";var v=(f+h)/2,m=(d+p)/2,y=Math.abs(v-f),b=Math.abs(m-d),x="A"+y+","+b,_=v+y+","+m,w=v+","+(m-b);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function x(t,e,r){return t.replace(R,function(t){var n=0,i=t.charAt(0),a=P[i],o=O[i],s=N[i],l=t.substr(1).replace(I,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}function _(t,e,r,n,i){var a="category"===t.type?Number:t.d2c;if(void 0!==e)return[a(e),a(r)];if(n){var o,s,l,u,c,f=1/0,h=-(1/0),d=n.match(R);for("date"===t.type&&(a=g(a)),o=0;oc&&(f=c),c>h&&(h=c)));return h>=f?[f,h]:void 0}}var w=t("fast-isnumeric"),A=t("../../plotly"),k=t("../../lib"),M=t("../../plots/cartesian/axes"),E=t("../color"),T=t("../drawing"),L=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var r=t.shapes||[],i=e.shapes=[],a=0;as&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),k.log("Ignoring extra params in segment "+t)),i+l})},C.calcAutorange=function(t){var e,r,n,i,a,o=t._fullLayout,s=o.shapes;if(s.length&&t._fullData.length)for(e=0;eh?r=h:(c.left-=b.offsetLeft,c.right-=b.offsetLeft,c.top-=b.offsetTop,c.bottom-=b.offsetTop,b.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(r=Math.max(r,o*(t[b.side]-c[a])+u))}),r=Math.min(h,r)),r>0||0>h){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){T=0,L=!0,S=R,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,k=g.titlefont.family,M=g.titlefont.size,E=g.titlefont.color,T=1,L=!1,S=g.title.trim();""===S&&(T=0),S.match(/Click to enter .+ title/)&&(T=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var R="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":257,"../../lib/svg_text_utils":270,"../../plotly":277,"../../plots/plots":304,"../color":176,"../drawing":199,d3:62,"fast-isnumeric":65}],240:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:o,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":254,"../../plots/font_attributes":298,"../color/attributes":175}],241:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],242:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,u,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(l.enter().append("g").classed(E.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&m(t),0!==r.length){var u=l.selectAll("g."+E.headerGroupClassName).data(r,i);u.enter().append("g").classed(E.headerGroupClassName,!0);var c=l.selectAll("g."+E.buttonGroupClassName).data([0]);c.enter().append("g").classed(E.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(v).attr(E.menuIndexAttrName,"-1"),u.exit().each(function(e){y.select(this).remove(),c.call(v).attr(E.menuIndexAttrName,"-1"),x.autoMargin(t,E.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],248:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],249:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.16.2",r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=n.register,r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=n.Snapshot,r.PlotSchema=n.PlotSchema,r.Queue=n.Queue,r.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":274,"./plot_api/to_image":275,"./plot_api/validate":276,"./plotly":277,"./snapshot/download":311,d3:62}],250:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],251:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("./nested_property"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)}},"boolean":{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(o(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r?!0:"string"!=typeof t?!1:!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),a=0;a2)return!1;var l=o[0].split("-");if(l.length>3||3!==l.length&&o[1])return!1;if(4===l[0].length)r=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();r=((Number(l[0])-u+70)%100+200)%100+u-70}return s(r)?1===l.length?new Date(r,0,1).getTime():(n=Number(l[1])-1, -l[1].length>2||!(n>=0&&11>=n)?!1:2===l.length?new Date(r,n,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(r,n,i).getTime(),o[1]?(l=o[1].split(":"),l.length>3?!1:(a=Number(l[0]),l[0].length>2||!(a>=0&&23>=a)?!1:(i+=36e5*a,1===l.length?i:(n=Number(l[1]),l[1].length>2||!(n>=0&&59>=n)?!1:(i+=6e4*n,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){if("undefined"==typeof o)return void l.error("d3 is not defined.");e||(e=0);var r=new Date(t),i=o.time.format("%Y-%m-%d")(r);return 7776e6>e?(i+=" "+n(r.getHours(),2),432e6>e&&(i+=":"+n(r.getMinutes(),2),108e5>e&&(i+=":"+n(r.getSeconds(),2),3e5>e&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={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"]},c={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"]},f=o.time.format.utc,h={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){h[t].D.push(f(e)),["H","I","D"].forEach(function(r){u[r].forEach(function(n){var i=h[t][r];i.push(f(e+"~"+n)),i.push(f(n+"~"+e))})})})});var d=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,v=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},b=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,A=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],M=function(t,e){return k[e-1]},E=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,p).replace(g,"").replace(v,"~").replace(m,y).replace(A,M).trim().replace(E,"");var e,r,n=null,o=i(t),s=a(t);e=h[o][s],r=e.length;for(var l=0;r>l&&!(n=e[l].parse(t));l++);if(!(n instanceof Date))return!1;var u=n.getTimezoneOffset();return n.setTime(n.getTime()+60*u*1e3),n}},{"../lib":257,d3:62,"fast-isnumeric":65}],253:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof n)return t;var e=new n;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(r,n){"undefined"!=typeof jQuery&&jQuery(t).trigger(r,n),e.emit(r,n)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof jQuery&&(n=jQuery(t).triggerHandler(e,r));var a=t._ev;if(!a)return n;var o=a._events[e];if(!o)return n;"function"==typeof o&&(o=[o]);for(var s=o.pop(),l=0;lm;m++){l=t[m];for(u in l)c=g[u],f=l[u],s&&o(f)?g[u]=f:e&&f&&(a(f)||(h=o(f)))?(h?(h=!1,d=c&&o(c)?c:[]):d=c&&a(c)?c:{},g[u]=i([d,f],e,r,s)):("undefined"!=typeof f||r)&&(g[u]=f)}return g}var a=t("./is_plain_object.js"),o=Array.isArray;r.extendFlat=function(){return i(arguments,!1,!1,!1)},r.extendDeep=function(){return i(arguments,!0,!1,!1)},r.extendDeepAll=function(){return i(arguments,!0,!0,!1)},r.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":258}],255:[function(t,e,r){"use strict";function n(t,e){var r=f(t);return r[3]*=e,r}function i(t){return s(t).isValid()?t:c}function a(t){return l(t)?t:h}function o(t,e,r){var o,s,l,f,d,p=t.color,g=Array.isArray(p),v=Array.isArray(e),m=[];if(o=void 0!==t.colorscale?u(t.colorscale,t.cmin,t.cmax):i,s=g?function(t,e){return void 0===t[e]?c:o(t[e])}:i,l=v?function(t,e){return void 0===t[e]?h:a(t[e])}:a,g||v)for(var y=0;r>y;y++)f=s(p,y),d=l(e,y),m[y]=n(f,d);else m=n(p,e);return m}var s=t("tinycolor2"),l=t("fast-isnumeric"),u=t("../components/colorscale/make_scale_function"),c=t("../components/color/attributes").defaultLine,f=t("./str2rgbarray"),h=1;e.exports=o},{"../components/color/attributes":175,"../components/colorscale/make_scale_function":193,"./str2rgbarray":269,"fast-isnumeric":65,tinycolor2:148}],256:[function(t,e,r){"use strict";function n(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(e>r)break;t=t.slice(0,e)+l(t.slice(e+5,r))+t.slice(r+6)}return t}function i(t){return t.replace(/\/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(r>n)r+=1;else{var i=e[t.slice(r+1,n)];t=i?t.slice(0,r)+i+t.slice(n+1):t.slice(0,r)+t.slice(n+1)}}return t}function s(t){return""+o(a(n(i(t))))}var l=t("superscript-text"),u=t("../constants/string_mappings");e.exports=s},{"../constants/string_mappings":247,"superscript-text":137}],257:[function(t,e,r){"use strict";var n=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var a=t("./coerce");i.valObjects=a.valObjects,i.coerce=a.coerce,i.coerce2=a.coerce2,i.coerceFont=a.coerceFont,i.validate=a.validate;var o=t("./dates");i.dateTime2ms=o.dateTime2ms,i.isDateTime=o.isDateTime,i.ms2DateTime=o.ms2DateTime,i.parseDate=o.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var f=t("./loggers");i.log=f.log,i.warn=f.warn,i.error=f.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var a=0;ar?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.randstr=function h(t,e,r){if(r||(r=16),void 0===e&&(e=24),0>=e)return"0";var n,i,a,o=Math.log(Math.pow(2,e))/Math.log(r),s="";for(n=2;o===1/0;n*=2)o=Math.log(Math.pow(2,e/n))/Math.log(r)*n;var l=o-Math.floor(o);for(n=0;n-1||u!==1/0&&u>=Math.pow(2,e)?h(t,e,r):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;l>r;r++)u[r]=(1-Math.cos(Math.PI*(r+1)/e))/(2*e);for(r=0;o>r;r++){for(a=0,n=0;l>n;n++)i=r+n+1-e,-o>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,a=!1,o=!0;for(n=0;ni;i++)e[i][r]=t[i]},i.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,a,o,s=3,l=Object.keys(t);for(n=0;n1?n+a[1]:"";if(i&&(a.length>1||o.length>4))for(;r.test(o);)o=o.replace(r,"$1"+i+"$2");return o+s}},{"./coerce":251,"./dates":252,"./extend":254,"./is_plain_object":258,"./loggers":259,"./matrix":260,"./nested_property":261,"./notifier":262,"./search":265,"./stats":268,d3:62}],258:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],259:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;en;n++)r[n]=new Array(e);return r},r.transposeRagged=function(t){var e,r,n=0,i=t.length;for(e=0;i>e;e++)n=Math.max(n,t[e].length);var a=new Array(n);for(e=0;n>e;e++)for(a[e]=new Array(i),r=0;i>r;r++)a[e][r]=t[r][e];return a},r.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var n,i,a=t.length;if(t[0].length)for(n=new Array(a),i=0;a>i;i++)n[i]=r.dot(t[i],e);else if(e[0].length){var o=r.transposeRagged(e);for(n=new Array(o.length),i=0;ii;i++)n+=t[i]*e[i];return n},r.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},r.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},r.rotationXYMatrix=function(t,e,n){return r.dot(r.dot(r.translationMatrix(e,n),r.rotationMatrix(t)),r.translationMatrix(-e,-n))},r.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var n=1===arguments.length?e[0]:[e[0],e[1]];return r.dot(t,[n[0],n[1],1]).slice(0,2)}},r.apply2DTransform2=function(t){var e=r.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],261:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,a,o,s,l=t;for(o=0;o=0;e--){if(n=t[e],o=!1,Array.isArray(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sr||r>a||o>n||n>s?!1:!e||!u(t)}function r(t,e){var r=t[0],l=t[1];if(i>r||r>a||o>l||l>s)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;p>u;u++)if(c=g,f=v,g=n[u][0],v=n[u][1],h=Math.min(c,g),!(h>r||r>Math.max(c,g)||l>Math.max(f,v)))if(l=l&&r!==h&&m++}return m%2===1}var n=t.slice(),i=n[0][0],a=i,o=n[0][1],s=o;n.push(n[0]);for(var l=1;la;a++)if(o=[t[a][0]-l[0],t[a][1]-l[1]],s=n(o,u),0>s||s>c||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":260}],264:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;rt}function i(t,e){return e>=t}function a(t,e){return t>e}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;h>f&&d++<100;)u=Math.floor((f+h)/2),c(e[u],t)?f=u+1:h=u;return d>90&&l.log("Long binary search..."),f-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,a=i/(n||1)/1e4,o=[e[0]],s=0;n>s;s++)e[s+1]>e[s]+a&&(i=Math.min(i,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,a=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;a>i&&o++<100;)n=u((i+a)/2),e[n]<=t?i=n+s:a=n-l;return e[i]}},{"../lib":257,"fast-isnumeric":65}],266:[function(t,e,r){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],267:[function(t,e,r){"use strict";var n=t("../components/color"),i=function(){};e.exports=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=i);t.destroy=function(){t.container.parentNode.removeChild(t.container)};var r=document.createElement("div");return r.textContent="Webgl is not supported by your browser - visit http://get.webgl.org for more info",r.style.cursor="pointer",r.style.fontSize="24px",r.style.color=n.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../components/color":176}],268:[function(t,e,r){"use strict";var n=t("fast-isnumeric");r.aggNums=function(t,e,i,a){var o,s;if(a||(a=i.length),n(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(a),o=0;a>o;o++)s[o]=r.aggNums(t,e,i[o]);i=s}for(o=0;a>o;o++)n(e)?n(i[o])&&(e=t(+e,+i[o])):e=i[o];return e},r.len=function(t){return r.aggNums(function(t){return t+1},0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums(function(t,e){return t+e},0,t)/e},r.variance=function(t,e,i){return e||(e=r.len(t)),n(i)||(i=r.mean(t,e)),r.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":65}],269:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:8,tinycolor2:148}],270:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,-1===v.indexOf(c.protocol)?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},a="right"===o?function(){return l.right-n.width}:"center"===o?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({"class":p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":247,"../constants/xmlns_namespaces":248,"../lib":257,d3:62}],271:[function(t,e,r){"use strict";function n(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function i(t){Array.isArray(t._promises)&&t._promises.length>0&&O.log("Clearing previous rejected promises from queue."),t._promises=[]}function a(t,e){t._fullLayout._paperdiv.style("background","white"),P.defaultConfig.setBackground(t,e)}function o(t,e){t._context||(t._context=O.extendFlat({},P.defaultConfig)); -var r=t._context;e&&(Object.keys(e).forEach(function(t){t in r&&("setBackground"===t&&"opaque"===e[t]?r[t]=a:r[t]=e[t])}),e.plot3dPixelRatio&&!r.plotGlPixelRatio&&(r.plotGlPixelRatio=r.plot3dPixelRatio)),r.staticPlot&&(r.editable=!1,r.autosizable=!1,r.scrollZoom=!1,r.doubleClick=!1,r.showTips=!1,r.showLink=!1,r.displayModeBar=!1)}function s(t,e,r){var n=C.select(t).selectAll(".plot-container").data([0]);n.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=n.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),r&&(t.layout=r),P.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(A(t,{}),t._fullLayout.autosize=r.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=P.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var a=t.framework.svg(),o=1,s=t._fullLayout.title;""!==s&&s||(o=0);var l="Click to enter title",u=function(){this.call(P.util.convertToTspans)},c=a.select(".title-group text").call(u);if(t._context.editable){c.attr({"data-unformatted":s}),s&&s!==l||(o=.2,c.attr({"data-unformatted":l}).text(l).style({opacity:o}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(P.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(u),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(u)})};c.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),D.addLinks(t),Promise.resolve()}function l(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var n=P.Axes.list({_fullLayout:t});for(e=0;ee;e++){var o=t.annotations[e];o.ref&&("paper"===o.ref?(o.xref="paper",o.yref="paper"):"data"===o.ref&&(o.xref="x",o.yref="y"),delete o.ref),u(o,"xref"),u(o,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(O.warn("Shapes must be an array."),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var l=t.shapes[e];u(l,"xref"),u(l,"yref")}var c=t.legend;c&&(c.x>3?(c.x=1.02,c.xanchor="left"):c.x<-2&&(c.x=-.02,c.xanchor="right"),c.y>3?(c.y=1.02,c.yanchor="bottom"):c.y<-2&&(c.y=-.02,c.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=D.getSubplotIds(t,"gl3d");for(e=0;er;++r)b[r]=v[e]+m*y[2+4*r];d.camera={eye:{x:b[0],y:b[1],z:b[2]},center:{x:v[0],y:v[1],z:v[2]},up:{x:y[1],y:y[5],z:y[9]}},delete d.cameraposition}}return B.clean(t),t}function u(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=P.Axes.cleanId(r,n))}function c(t,e){for(var r=[],n=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),i=0;ia&&(s=O.randstr(n),-1!==r.indexOf(s));a++);o.uid=O.randstr(n),n.push(o.uid)}if(r.push(o.uid),"histogramy"===o.type&&"xbins"in o&&!("ybins"in o)&&(o.ybins=o.xbins,delete o.xbins),o.error_y&&"opacity"in o.error_y){var l=B.defaults,u=o.error_y.color||(D.traceIs(o,"bar")?B.defaultLine:l[i%l.length]);o.error_y.color=B.addOpacity(B.rgb(u),B.opacity(u)*o.error_y.opacity),delete o.error_y.opacity}if("bardir"in o&&("h"!==o.bardir||!D.traceIs(o,"bar")&&"histogram"!==o.type.substr(0,9)||(o.orientation="h",_(o)),delete o.bardir),"histogramy"===o.type&&_(o),"histogramx"!==o.type&&"histogramy"!==o.type||(o.type="histogram"),"scl"in o&&(o.colorscale=o.scl,delete o.scl),"reversescl"in o&&(o.reversescale=o.reversescl,delete o.reversescl),o.xaxis&&(o.xaxis=P.Axes.cleanId(o.xaxis,"x")),o.yaxis&&(o.yaxis=P.Axes.cleanId(o.yaxis,"y")),D.traceIs(o,"gl3d")&&o.scene&&(o.scene=D.subplotsRegistry.gl3d.cleanId(o.scene)),D.traceIs(o,"pie")||(Array.isArray(o.textposition)?o.textposition=o.textposition.map(f):o.textposition&&(o.textposition=f(o.textposition))),D.traceIs(o,"2dMap")&&("YIGnBu"===o.colorscale&&(o.colorscale="YlGnBu"),"YIOrRd"===o.colorscale&&(o.colorscale="YlOrRd")),D.traceIs(o,"markerColorscale")&&o.marker){var c=o.marker;"YIGnBu"===c.colorscale&&(c.colorscale="YlGnBu"),"YIOrRd"===c.colorscale&&(c.colorscale="YlOrRd")}if("surface"===o.type&&O.isPlainObject(o.contours)){var d=["x","y","z"];for(a=0;an?a.push(i+n):a.push(n);return a}function g(t,e,r){var n,i;for(n=0;n=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||0>i&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function v(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&g(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function m(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&l0){var s=w(t._boundingBoxMargins),l=s.left+s.right,u=s.bottom+s.top,c=a._container.node().getBoundingClientRect(),f=1-2*o.frameMargins;i=Math.round(f*(c.width-l)),n=Math.round(f*(c.height-u))}else r=window.getComputedStyle(t),n=parseFloat(r.height)||a.height,i=parseFloat(r.width)||a.width;return Math.abs(a.width-i)>1||Math.abs(a.height-n)>1?(a.height=t.layout.height=n,a.width=t.layout.width=i):"initial"!==a.autosize&&(delete e.autosize,a.autosize=t.layout.autosize=!0),D.sanitizeMargins(a),e}function k(t){var e=C.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===r.autosize&&(A(t,{}),r.autosize=!0,t.layout.autosize=!0),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];C.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=O.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0);var a=P.Axes.getSubplots(t);a.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&M(t,a),r._has("cartesian")&&E(t,a),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var o=r._paper.selectAll(".layer-subplot");r._imageSubplotLayer=o.selectAll(".imagelayer"),r._shapeSubplotLayer=o.selectAll(".shapelayer");var s=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=s.append("g").classed("imagelayer",!0),r._shapeUpperLayer=s.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var l=O.syncOrAsync([T,function(){return P.Axes.doTicks(t,"redraw")},F.init],t);return l&&l.then&&t._promises.push(l),l}function M(t,e){function r(e,r){return function(){return P.Axes.getFromId(t,e,r)}}for(var n,i,a=t._fullLayout._plots={},o=0;o0,_=P.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),A=w===_;x?t.framework===k&&!b&&A||(t.framework=k,k(t)):A?b&&k(t):(t.framework=k,k(t)),b&&P.Axes.saveRangeInitial(t);var M=t._fullLayout,E=!t.calcdata||t.calcdata.length!==(t.data||[]).length;E&&d(t);for(var L=0;LW.range[0]?[1,2]:[2,1]);else{var Q=W.range[0],$=W.range[1];"log"===F?(0>=Q&&0>=$&&a(G+".autorange",!0),0>=Q?Q=$/1e6:0>=$&&($=Q/1e6),a(G+".range[0]",Math.log(Q)/Math.LN10),a(G+".range[1]",Math.log($)/Math.LN10)):(a(G+".range[0]",Math.pow(10,Q)),a(G+".range[1]",Math.pow(10,$)))}else a(G+".autorange",!0)}if("reverse"===U)X.range?X.range.reverse():(a(G+".autorange",!0),X.range=[1,0]),Y.autorange?w=!0:_=!0;else if("annotations"===N.parts[0]||"shapes"===N.parts[0]){var K=N.parts[1],J=N.parts[0],tt=g[J]||[],et=P[O.titleCase(J)],rt=tt[K]||{};2===N.parts.length&&("add"===m[R]||O.isPlainObject(m[R])?L[R]="remove":"remove"===m[R]?-1===K?(L[J]=tt,delete L[R]):L[R]=rt:O.log("???",m)),!o(rt,"x")&&!o(rt,"y")||O.containsAny(R,["color","opacity","align","dash"])||(w=!0),et.draw(t,K,N.parts.slice(2).join("."),m[R]),delete m[R]}else if("images"===N.parts[0]){var it=O.objectFromPath(R,F);O.extendDeepAll(t.layout,it),V.supplyLayoutDefaults(t.layout,t._fullLayout),V.draw(t)}else if("mapbox"===N.parts[0]&&"layers"===N.parts[1]){O.extendDeepAll(t.layout,O.objectFromPath(R,F));var at=(t._fullLayout.mapbox||{}).layers||[];for(I=N.parts[2]+1-at.length,p=0;I>p;p++)at.push({});_=!0}else if("updatemenus"===N.parts[0]){O.extendDeepAll(t.layout,O.objectFromPath(R,F));var ot=t._fullLayout.updatemenus||[];for(I=N.parts[2]+1-ot.length,p=0;I>p;p++)ot.push({});_=!0}else 0===N.parts[0].indexOf("scene")?_=!0:0===N.parts[0].indexOf("geo")?_=!0:0===N.parts[0].indexOf("ternary")?_=!0:!v._has("gl2d")||-1===R.indexOf("axis")&&"plot_bgcolor"!==N.parts[0]?"hiddenlabels"===R?w=!0:-1!==N.parts[0].indexOf("legend")?y=!0:-1!==R.indexOf("title")?b=!0:-1!==N.parts[0].indexOf("bgcolor")?x=!0:N.parts.length>1&&O.containsAny(N.parts[1],["tick","exponent","grid","zeroline"])?b=!0:-1!==R.indexOf(".linewidth")&&-1!==R.indexOf("axis")?b=x=!0:N.parts.length>1&&-1!==N.parts[1].indexOf("line")?x=!0:N.parts.length>1&&"mirror"===N.parts[1]?b=x=!0:"margin.pad"===R?b=x=!0:"margin"===N.parts[0]||"autorange"===N.parts[1]||"rangemode"===N.parts[1]||"type"===N.parts[1]||"domain"===N.parts[1]||R.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(R)?k=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(R)&&(_=!0):_=!0,N.set(F)}z.add(t,nt,[t,L],nt,[t,E]),m.autosize&&(m=A(t,m)),(m.height||m.width||m.autosize)&&(w=!0);var st=Object.keys(m),lt=[D.previousPromises];if(_||w)lt.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),P.plot(t,"",g)});else if(st.length&&(D.supplyDefaults(t),v=t._fullLayout,y&<.push(function(){return q.draw(t),D.previousPromises(t)}),x&<.push(T),b&<.push(function(){return P.Axes.doTicks(t,"redraw"),S(t),D.previousPromises(t)}),k)){var ut;for(Z(t),P.Fx.supplyLayoutDefaults(t.layout,v,t._fullData),P.Fx.init(t),ut=D.getSubplotIds(v,"gl3d"),p=0;p1)};u(r.width)&&u(r.height)||s(new Error("Height and width should be pixel values."));var c=n.clone(e,{format:"png",height:r.height,width:r.width}),f=c.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var h=n.getRedrawFunc(f);a.plot(f,c.data,c.layout,c.config).then(h).then(l).then(function(e){t(e)}).catch(function(t){s(t)})});return s}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib");e.exports=n},{"../lib":257,"../plotly":277,"../snapshot":313,"fast-isnumeric":65}],276:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;v>m;m++){var y=r[m],b=["data",m];if(p(y)){var x=c[m],_=x.type,w=s.traces[_].attributes;w.type={valType:"enumerated",values:[_]},x.visible===!1&&y.visible!==!1&&l.push(o("invisible",b)),n(y,x,w,l,b);var A=y.transforms,k=x.transforms;if(A){g(A)||l.push(o("array",b,["transforms"])),b.push("transforms");for(var M=0;Mu&&c>e&&(void 0===i[r]?a[f]=E.tickText(t,e):a[f]=s(t,e,String(i[r])),f++);return f=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{b(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function o(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a=e.x,s=t._tickround,l=new Date(a),u="";r&&t.hoverformat?i=o(t.hoverformat,a):t.tickformat?i=o(t.tickformat,a):(n&&(b(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=N(l):"m"===s?i=z(l):(a!==t._tmin||r||(u="
"+N(l)),"d"===s?i=D(l):"H"===s?i=F(l):(a!==t._tmin||r||(u="
"+D(l)+", "+N(l)),i=B(l),"M"!==s&&(i+=j(l),"S"!==s&&(i+=h(m(a/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>o?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=0>t,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat;if(n){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};a(c),o=(Number(c._tickround)||0)+4,l=c._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),f>t)t="0",i=!1;else{if(t+=f,l&&(t*=Math.pow(10,-l),o+=l),0===o)t=String(Math.floor(t));else if(0>o){t=String(Math.round(t)),t=t.substr(0,t.length+o);for(var h=o;0>h;h++)t+="0"}else{t=String(t);var d=t.indexOf(".")+1;d&&(t=t.substr(0,d+o).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(l&&"hide"!==s){var p;p=0>l?"\u2212"+-l:"power"!==s?"+"+l:String(l),"e"===s||("SI"===s||"B"===s)&&(l>12||-15>l)?t+="e"+p:"E"===s?t+="E"+p:"power"===s?t+="\xd710"+p+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},E.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var p=n-1,g=n+1;r="tozero"===t.rangemode?0>n?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r},E.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=E.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},E.saveRangeInitial=function(t,e){for(var r=E.list(t,"",!0),n=!1,i=0;ip&&(p=g/10),u=t.c2l(p),c=t.c2l(g),y&&(u=Math.min(0,u),c=Math.max(0,c)),n(u)){for(d=!0,o=0;o=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;6>a;a++)i(a);for(a=v-1;a>5;a--)i(a)}},E.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[a,o]};E.autoTicks(f,s);var h,d=E.tickIncrement(E.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;yg&&(p>.3*x||i(a)||i(o))){var w=f.dtick/2;d+=a>d+w?w:-w}var A=1+Math.floor((o-d)/f.dtick);h=d+A*f.dtick}else for(h=d;o>=h;)h=E.tickIncrement(h,f.dtick);return{start:d,end:h,size:f.dtick}},E.calcTicks=function(t){if("array"===t.tickmode)return n(t);if("auto"===t.tickmode||!t.dtick){var e,r=t.nticks;r||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/e):(e="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/e,4,9)+1)),E.autoTicks(t,Math.abs(t.range[1]-t.range[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),a(t),t._tmin=E.tickFirst(t);var i=t.range[1]=s:s>=l)&&(o.push(l),!(o.length>1e3));l=E.tickIncrement(l,t.dtick,i));t._tmax=o[o.length-1];for(var u=new Array(o.length),c=0;c157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,S)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,C)):e>432e5?(t.dtick=i(e,864e5,I),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,C):e>3e4?t.dtick=i(e,6e4,R):e>500?t.dtick=i(e,1e3,R):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var a=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(a)}},E.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?O:P,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},E.tickFirst=function(t){var e=t.range[1]n:n>u;)u=E.tickIncrement(u,i,e);return u}if("L"===c)return Math.log(r((Math.pow(10,n)-a)/f)*f+a)/Math.LN10;if("D"===c){var h="D2"===i?O:P,d=_.roundUp(m(n,1),h,e);return Math.floor(n)+Math.log(y.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var N=y.time.format("%Y"),z=y.time.format("%b %Y"),D=y.time.format("%b %-d"),F=y.time.format("%b %-d %Hh"),B=y.time.format("%H:%M"),j=y.time.format(":%S"),U=/%(\d?)f/g;E.tickText=function(t,e,r){function n(n){var i;return void 0===n?!0:r?"none"===n:(i={first:t._tmin,last:t._tmax}[n],"all"!==n&&e!==i)}var i,a,o=s(t,e),h="array"===t.tickmode,d=r||h;if(h&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(a=0;a1&&er&&(k=90),i(c,k)}u._lastangle=k}return o(e),e+" done"}function l(){u._boundingBox=r.node().getBoundingClientRect()}var c=r.selectAll("g."+C).data(L,S);if(!u.showticklabels||!b(n))return c.remove(),void o(e);var f,h,p,m,x;"x"===v?(x="bottom"===j?1:-1,f=function(t){return t.dx+N*x},m=n+(O+P)*x,h=function(t){return t.dy+m+t.fontSize*("bottom"===j?1:-.5)},p=function(t){return b(t)&&0!==t&&180!==t?0>t*x?"end":"start":"middle"}):(x="right"===j?1:-1,h=function(t){return t.dy+t.fontSize/2-N*x},f=function(t){return t.dx+n+(O+P+(90===Math.abs(u.tickangle)?t.fontSize/2:0))*x},p=function(t){return b(t)&&90===Math.abs(t)?"middle":"right"===j?"start":"end"});var A=0,k=0,E=[];c.enter().append("g").classed(C,1).append("text").attr("text-anchor","middle").each(function(e){var r=y.select(this),n=t._promises.length;r.call(M.setPosition,f(e),h(e)).call(M.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),n=t._promises[n],n?E.push(t._promises.pop().then(function(){i(r,u.tickangle)})):i(r,u.tickangle)}),c.exit().remove(),c.each(function(t){A=Math.max(A,t.fontSize)}),i(c,u._lastangle||u.tickangle);var T=_.syncOrAsync([a,s,l]);return T&&T.then&&t._promises.push(T),T}function o(e){if(!r){var n,i,a,o,s=T.getFromId(t,e),l=y.select(t).selectAll("g."+e+"tick"),u={selection:l,side:s.side},f=e.charAt(0),h=t._fullLayout._size,d=1.5,p=s.titlefont.size;if(l.size()){var g=y.select(l.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);g&&(u.offsetLeft=+g[1],u.offsetTop=+g[2])}"x"===f?(i="free"===s.anchor?{_offset:h.t+(1-(s.position||0))*h.h,_length:0}:T.getFromId(t,s.anchor),a=s._offset+s._length/2,o=i._offset+("top"===s.side?-10-p*(d+(s.showticklabels?1:0)):i._length+10+p*(d+(s.showticklabels?1.5:.5))),s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(o+=(c.height-c.margin.b-c.margin.t)*s.rangeslider.thickness+s._boundingBox.height),u.side||(u.side="bottom")):(i="free"===s.anchor?{_offset:h.l+(s.position||0)*h.w,_length:0}:T.getFromId(t,s.anchor),o=s._offset+s._length/2,a=i._offset+("right"===s.side?i._length+10+p*(d+(s.showticklabels?1:.5)):-10-p*(d+(s.showticklabels?.5:0))),n={rotate:"-90",offset:0},u.side||(u.side="left")),A.draw(t,e+"title",{propContainer:s,propName:s._name+".title",dfltName:f.toUpperCase()+" axis",avoid:u,transform:n,attributes:{x:a,y:o,"text-anchor":"middle"}})}}function s(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:x.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[v]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===v}function l(e,r,i){var a=e.gridlayer,o=e.zerolinelayer,l=e["hidegrid"+v]?[]:V,c=u._gridpath||"M0,0"+("x"===v?"v":"h")+r._length,f=a.selectAll("path."+R).data(u.showgrid===!1?[]:l,S);if(f.enter().append("path").classed(R,1).classed("crisp",1).attr("d",c).each(function(t){u.zeroline&&("linear"===u.type||"-"===u.type)&&Math.abs(t.x)g;g++){var y=u.mirrors[o._id+h[g]];"ticks"!==y&&"labels"!==y||(f[g]=!0)}return void 0!==n[2]&&(f[2]=!0),f.forEach(function(t,e){var r=n[e],i=U[e];t&&b(r)&&(d+=p(r+P*i,i*u.ticklen))}),i(r,d),l(e,o,t),a(r,n[3])}}).filter(function(t){return t&&t.then});return H.length?Promise.all(H):0},E.swap=function(t,e){for(var r=d(t,e),n=0;n2*n}function c(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var f=t("fast-isnumeric"),h=t("tinycolor2").mix,d=t("../../lib"),p=t("../plots"),g=t("../../components/color/attributes").lightFraction,v=t("./layout_attributes"),m=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),b=t("./tick_label_defaults"),x=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),A=t("./clean_datum"),k=t("./axis_ids");e.exports=function(t,e,r,i){function a(r,n){return d.coerce2(t,e,v,r,n)}var o=i.letter,s=i.font||{},l="Click to enter "+(i.title||o.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=k.name2id(i.name));var u=r("type");"-"===u&&(n(e,i.data),"-"===e.type?e.type="linear":u=t.type=e.type),_(e);var c=r("color"),p=c===t.color?c:s.color;r("title",l),d.coerceFont(r,"titlefont",{family:s.family,size:Math.round(1.2*s.size),color:p});var A=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),M=r("autorange",!A);M&&r("rangemode");var E=r("range",[-1,"x"===o?6:4]);E[0]===E[1]&&(e.range=[E[0]-1,E[0]+1]),d.noneOrAll(t.range,e.range,[0,1]),r("fixedrange"),m(t,e,r,u),b(t,e,r,u,i),y(t,e,r,i),x(t,e,r);var T=a("linecolor",c),L=a("linewidth"),S=r("showline",!!T||!!L);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&r("mirror");var C=a("gridcolor",h(c,i.bgColor,g).toRgbString()),R=a("gridwidth"),I=r("showgrid",i.showGrid||!!C||!!R);I||(delete e.gridcolor,delete e.gridwidth);var P=a("zerolinecolor",c),O=a("zerolinewidth"),N=r("zeroline",i.showGrid||!!P||!!O);return N||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===u?w(o,e.categoryorder,e.categoryarray,i.data):[],e}},{"../../components/color/attributes":175,"../../lib":257,"../plots":304,"./axis_ids":282,"./category_order_defaults":283,"./clean_datum":284,"./layout_attributes":289,"./ordered_categories":291,"./set_convert":294,"./tick_label_defaults":295,"./tick_mark_defaults":296,"./tick_value_defaults":297,"fast-isnumeric":65,tinycolor2:148}],282:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,a=[],o=0;o0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],284:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":257,"fast-isnumeric":65}],285:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],286:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?c.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/setcursor"),g=t("../../components/dragelement"),v=t("./axes"),m=t("./select"),y=t("./constants"),b=!0;e.exports=function(t,e,r,s,x,_,w,A){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+gt+")").attr("d",lt+"Z"),ht=dt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+gt+")").attr("d","M0,0Z"),T();for(var a=0;ai?(ct="",ot.r=ot.l,ot.t=ot.b,ht.attr("d","M0,0Z")):(ot.t=0,ot.b=q,ct="x",ht.attr("d","M"+(ot.l-.5)+","+(at-G-.5)+"h-3v"+(2*G+1)+"h3ZM"+(ot.r+.5)+","+(at-G-.5)+"h3v"+(2*G+1)+"h-3Z")):!$||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),b=!1)))}function R(e,r){var i=1===(w+A).length;if(e)z();else if(2!==r||i){if(1===r&&i){var a=w?U[0]:j[0],o="s"===w||"w"===A?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",h="middle";if(a.fixedrange)return;w?(h="n"===w?"top":"bottom","right"===a.side&&(c="right")):"e"===A&&(c="right"),et.call(f.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var r="category"===a.type?a.c2l(e):a.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else N()}function I(e){function r(t,e,r){if(!t.fixedrange){M(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||F._enablescrollzoom){var n=t.querySelector(".plotly");if(!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(mt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void c.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=vt[0]+vt[2]*l,f=(s.bottom-e.clientY)/s.height,h=vt[1]+vt[3]*(1-f);if(A){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function i(t,e,r){for(var i=1-e,a=0,o=0;o0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nE;E++){var T=a[E],L=d[T];if(L)k[E]=w.getFromId(t,L.xaxis._id),M[E]=w.getFromId(t,L.yaxis._id);else{var S=o[T]._subplot;k[E]=S.xaxis,M[E]=S.yaxis}}var C=e.hovermode||o.hovermode;if(-1===["x","y","closest"].indexOf(C)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var R,I,P,O,N,z,D,F,B,j,U,V,q=[],H=[];if(Array.isArray(e))for(C="array",P=0;PG||G>Y.width||0>X||X>Y.height)return _.unhoverRaw(t,e)}else G="xpx"in e?e.xpx:k[0]._length/2,X="ypx"in e?e.ypx:M[0]._length/2;if(R="xval"in e?n(a,e.xval):i(k,G),I="yval"in e?n(a,e.yval):i(M,X),!g(R[0])||!g(I[0]))return v.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(O=0;O1||-1!==z.hoverinfo.indexOf("name")?z.name:void 0,index:!1,distance:Math.min(W,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},V=q.length,"array"===F){var Z=e[O];"pointNumber"in Z?(U.index=Z.pointNumber,F="closest"):(F="","xval"in Z&&(B=Z.xval,F="x"),"yval"in Z&&(j=Z.yval,F=F?"closest":"y"))}else B=R[D],j=I[D];if(z._module&&z._module.hoverPoints){var Q=z._module.hoverPoints(U,B,j,F);if(Q)for(var $,K=0;KV&&(q.splice(0,V),W=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var J="y"===C&&H.length>1;q.sort(function(t,e){return t.distance-e.distance});var tt=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),et={hovermode:C,rotateLabels:J,bgColor:tt,container:o._hoverlayer,outerContainer:o._paperdiv},rt=u(q,et);c(q,J?"xa":"ya"),f(rt,J);var nt=t._hoverdata,it=[];for(P=0;P128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):M&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0), -v=h.node().getBoundingClientRect().width+2*I):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),O=T.width+R+I+v;t.ty0=_-T.top,t.bx=T.width+2*I,t.by=T.height+2*I,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=k>=S+P/2+O,A=S-P/2-O>=0,"top"!==t.idealAlign&&m||!A?m?(S+=P/2,t.anchor="start"):t.anchor="middle":(S-=P/2,t.anchor="end")):(t.pos=S,m=w>=L+C/2+O,A=L-C/2-O>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,a=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(.01>a)){if(-.01>i){for(s=t.length-1;s>=0;s--)t[s].dp-=a;n=!1}if(n){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(0>=u);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=u);o++)if(l=t[o],l.pos=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(0>=u);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?L:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(R+I),s=o+a*(t.txwidth+I),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*S),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*R+l)+","+(R+u)+"v"+(t.by/2-R)+"h"+n*t.bx+"v-"+t.by+"H"+(n*R+l)+"V"+(u-R)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+I).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*I+l,u+t.ty0-t.by/2+I),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),k=t("./dragbox"),M=e.exports={};M.unhover=_.unhover,M.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},M.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,M.layoutAttributes,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=M.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},M.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},M.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},M.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indext*e||0===t?A.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":176,"../../components/dragelement":197,"../../components/drawing":199,"../../lib":257,"../../lib/events":253,"../../lib/svg_text_utils":270,"./axes":280,"./constants":285,"./dragbox":286,d3:62,"fast-isnumeric":65,tinycolor2:148}],288:[function(t,e,r){"use strict";var n=t("../plots"),i=t("./constants");r.name="cartesian",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex=i.idRegex,r.attrRegex=i.attrRegex,r.attributes=t("./attributes"),r.plot=function(t){function e(t,e){for(var r=[],n=0;nf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":257,"fast-isnumeric":65}],293:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.x()._offset,y=i.plotinfo.y()._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,k=i.xaxes[0]._length,M=i.yaxes[0]._length,E=i.xaxes.map(n),T=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,R,I,P,O,N=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),z=[],D=i.gd,F=[];for(C=0;C0)return Math.log(e)/Math.LN10;if(0>=e&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*c*Math.abs(n-i))}return o.BADNUM}function r(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):o.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?r:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var n=l.getFromId(t._gd,t.overlaying);t.domain=n.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)i(t.range[e])||(t.range[e]=i(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):o.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):o.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?a.ms2DateTime(t):o.BADNUM},t.d2c=function(t){return i(t)?Number(t):a.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(a.dateTime2ms);!i(t.range[0])&&i(f[0])&&(t.range[0]=f[0]),!i(t.range[1])&&i(f[1])&&(t.range[1]=f[1])}catch(h){a.error(h,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var r=t._categories.indexOf(e);return-1===r?o.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;ad;++d){for(e=u[d],r=t[this.scene[e]._name],n=/Click to enter .+ title/.test(r.title)?"":r.title,p=0;2>=p;p+=2)this.labelEnable[d+p]=!1,this.labels[d+p]=o(n),this.labelColor[d+p]=s(r.titlefont.color),this.labelFont[d+p]=r.titlefont.family,this.labelSize[d+p]=r.titlefont.size,this.labelPad[d+p]=this.getLabelPad(e,r),this.tickEnable[d+p]=!1,this.tickColor[d+p]=s((r.tickfont||{}).color),this.tickAngle[d+p]="auto"===r.tickangle?0:Math.PI*-r.tickangle/180,this.tickPad[d+p]=this.getTickPad(r),this.tickMarkLength[d+p]=0,this.tickMarkWidth[d+p]=r.tickwidth||0,this.tickMarkColor[d+p]=s(r.tickcolor),this.borderLineEnable[d+p]=!1,this.borderLineColor[d+p]=s(r.linecolor),this.borderLineWidth[d+p]=r.linewidth||0;c=this.hasSharedAxis(r),a=this.hasAxisInDfltPos(e,r)&&!c,l=this.hasAxisInAltrPos(e,r)&&!c,i=r.mirror||!1,f=c?-1!==String(i).indexOf("all"):!!i,h=c?"allticks"===i:-1!==String(i).indexOf("ticks"),a?this.labelEnable[d]=!0:l&&(this.labelEnable[d+2]=!0),a?this.tickEnable[d]=r.showticklabels:l&&(this.tickEnable[d+2]=r.showticklabels),(a||f)&&(this.borderLineEnable[d]=r.showline),(l||f)&&(this.borderLineEnable[d+2]=r.showline),(a||h)&&(this.tickMarkLength[d]=this.getTickMarkLength(r)),(l||h)&&(this.tickMarkLength[d+2]=this.getTickMarkLength(r)),this.gridLineEnable[d]=r.showgrid,this.gridLineColor[d]=s(r.gridcolor),this.gridLineWidth[d]=r.gridwidth,this.zeroLineEnable[d]=r.zeroline,this.zeroLineColor[d]=s(r.zerolinecolor),this.zeroLineWidth[d]=r.zerolinewidth}},l.hasSharedAxis=function(t){var e=this.scene,r=a.Plots.getSubplotIds(e.fullLayout,"gl2d"),n=a.Axes.findSubplotsWithAxis(r,t);return 0!==n.indexOf(e.id)},l.hasAxisInDfltPos=function(t,e){var r=e.side;return"xaxis"===t?"bottom"===r:"yaxis"===t?"left"===r:void 0},l.hasAxisInAltrPos=function(t,e){var r=e.side;return"xaxis"===t?"top"===r:"yaxis"===t?"right"===r:void 0},l.getLabelPad=function(t,e){var r=1.5,n=e.titlefont.size,i=e.showticklabels;return"xaxis"===t?"top"===e.side?-10+n*(r+(i?1:0)):-10+n*(r+(i?.5:0)):"yaxis"===t?"right"===e.side?10+n*(r+(i?1:.5)):10+n*(r+(i?.5:0)):void 0},l.getTickPad=function(t){return"outside"===t.ticks?10+t.ticklen:15},l.getTickMarkLength=function(t){if(!t.ticks)return 0;var e=t.ticklen;return"inside"===t.ticks?-e:e},e.exports=i},{"../../lib/html2unicode":256,"../../lib/str2rgbarray":269,"../../plotly":277}],301:[function(t,e,r){"use strict";var n=t("./scene2d"),i=t("../plots"),a=t("../../constants/xmlns_namespaces");r.name="gl2d",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex={x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},r.attrRegex={x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},r.attributes=t("../cartesian/attributes"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,a=i.getSubplotIds(e,"gl2d"),o=0;or;++r){var n=t[r],i=e[r];if(n.length!==i.length)return!0;for(var a=0;ao;++o,--s)for(var l=0;r>l;++l)for(var u=0;4>u;++u){var c=i[4*(r*o+l)+u];i[4*(r*o+l)+u]=i[4*(r*s+l)+u],i[4*(r*s+l)+u]=c}var f=document.createElement("canvas");f.width=r,f.height=n;var h=f.getContext("2d"),d=h.createImageData(r,n);d.data.set(i),h.putImageData(d,0,0);var p;switch(t){case"jpeg":p=f.toDataURL("image/jpeg");break;case"webp":p=f.toDataURL("image/webp");break;default:p=f.toDataURL("image/png")}return this.staticPlot&&this.container.removeChild(a),p},m.computeTickMarks=function(){this.xaxis._length=this.glplot.viewBox[2]-this.glplot.viewBox[0],this.yaxis._length=this.glplot.viewBox[3]-this.glplot.viewBox[1];for(var t=[s.calcTicks(this.xaxis),s.calcTicks(this.yaxis)],e=0;2>e;++e)for(var r=0;rA;++A)w[A]=Math.min(w[A],a.bounds[A]),w[A+2]=Math.max(w[A+2],a.bounds[A+2])}var k;for(n=0;2>n;++n)w[n]>w[n+2]&&(w[n]=-1,w[n+2]=1),k=this[v[n]],k._length=y.viewBox[n+2]-y.viewBox[n],s.doAutoRange(k);y.ticks=this.computeTickMarks();var M=this.xaxis.range,E=this.yaxis.range;y.dataBox=[M[0],E[0],M[1],E[1]],y.merge(r),o.update(y),this.glplot.draw()},m.draw=function(){if(!this.stopped){requestAnimationFrame(this.redraw);var t=this.glplot,e=this.camera,r=e.mouseListener,n=this.fullLayout;this.cameraChanged();var i=r.x*t.pixelRatio,a=this.canvas.height-t.pixelRatio*r.y;if(e.boxEnabled&&"zoom"===n.dragmode)this.selectBox.enabled=!0,this.selectBox.selectBox=[Math.min(e.boxStart[0],e.boxEnd[0]),Math.min(e.boxStart[1],e.boxEnd[1]),Math.max(e.boxStart[0],e.boxEnd[0]),Math.max(e.boxStart[1],e.boxEnd[1])],t.setDirty();else{this.selectBox.enabled=!1;var o=n._size,s=this.xaxis.domain,u=this.yaxis.domain,c=t.pick(i/t.pixelRatio+o.l+s[0]*o.w,a/t.pixelRatio-(o.t+(1-u[1])*o.h));if(c&&n.hovermode){var f=c.object._trace.handlePick(c);if(f&&(!this.lastPickResult||this.lastPickResult.traceUid!==f.trace.uid||this.lastPickResult.dataCoord[0]!==f.dataCoord[0]||this.lastPickResult.dataCoord[1]!==f.dataCoord[1])){var h=f;this.lastPickResult={traceUid:f.trace?f.trace.uid:null,dataCoord:f.dataCoord.slice()},this.spikes.update({center:c.dataCoord}),h.screenCoord=[((t.viewBox[2]-t.viewBox[0])*(c.dataCoord[0]-t.dataBox[0])/(t.dataBox[2]-t.dataBox[0])+t.viewBox[0])/t.pixelRatio,(this.canvas.height-(t.viewBox[3]-t.viewBox[1])*(c.dataCoord[1]-t.dataBox[1])/(t.dataBox[3]-t.dataBox[1])-t.viewBox[1])/t.pixelRatio];var d=h.hoverinfo;if("all"!==d){var p=d.split("+");-1===p.indexOf("x")&&(h.traceCoord[0]=void 0),-1===p.indexOf("y")&&(h.traceCoord[1]=void 0),-1===p.indexOf("z")&&(h.traceCoord[2]=void 0),-1===p.indexOf("text")&&(h.textLabel=void 0),-1===p.indexOf("name")&&(h.name=void 0)}l.loneHover({x:h.screenCoord[0],y:h.screenCoord[1],xLabel:this.hoverFormatter("xaxis",h.traceCoord[0]),yLabel:this.hoverFormatter("yaxis",h.traceCoord[1]),zLabel:h.traceCoord[2],text:h.textLabel,name:h.name,color:h.color},{container:this.svgContainer})}}else!c&&this.lastPickResult&&(this.spikes.update({}),this.lastPickResult=null,l.loneUnhover(this.svgContainer))}t.draw()}},m.hoverFormatter=function(t,e){if(void 0!==e){var r=this[t];return s.tickText(r,r.c2l(e),"hover").text}}},{"../../lib/html2unicode":256,"../../lib/show_no_webgl_msg":267,"../../plots/cartesian/axes":280,"../../plots/cartesian/graph_interact":287,"./camera":299,"./convert":300,"gl-plot2d":85,"gl-select-box":94,"gl-spikes2d":114}],303:[function(t,e,r){"use strict";var n=t("../plotly"),i=t("./font_attributes"),a=t("../components/color/attributes"),o=n.Lib.extendFlat;e.exports={font:{family:o({},i.family,{dflt:'"Open Sans", verdana, arial, sans-serif'}),size:o({},i.size,{dflt:12}),color:o({},i.color,{dflt:a.defaultLine})},title:{valType:"string",dflt:"Click to enter Plot title"},titlefont:o({},i,{}),autosize:{valType:"enumerated",values:[!0,!1,"initial"]},width:{valType:"number",min:10,dflt:700},height:{valType:"number",min:10,dflt:450},margin:{l:{valType:"number",min:0,dflt:80},r:{valType:"number",min:0,dflt:80},t:{valType:"number",min:0,dflt:100},b:{valType:"number",min:0,dflt:80},pad:{valType:"number",min:0,dflt:0},autoexpand:{valType:"boolean",dflt:!0}},paper_bgcolor:{valType:"color",dflt:a.background},plot_bgcolor:{valType:"color",dflt:a.background},separators:{valType:"string",dflt:".,"},hidesources:{valType:"boolean",dflt:!1},smith:{valType:"enumerated",values:[!1],dflt:!1},showlegend:{valType:"boolean"},_composedModules:{"*":"Fx"},_nestedModules:{xaxis:"Axes",yaxis:"Axes",scene:"gl3d",geo:"geo",legend:"Legend",annotations:"Annotations",shapes:"Shapes",images:"Images",updatemenus:"UpdateMenus",ternary:"ternary",mapbox:"mapbox"}}},{"../components/color/attributes":175,"../plotly":277,"./font_attributes":298}],304:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}function i(t,e){e.text("");var r=e.append("a").attr({"xlink:xlink:href":"#","class":"link--impt link--embedview","font-weight":"bold"}).text(t._context.linkText+" "+String.fromCharCode(187));if(t._context.sendData)r.on("click",function(){d.sendDataToCloud(t)});else{var n=window.location.pathname.split("/"),i=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+i})}}function a(t,e){for(var r=f.isPlainObject,n=Array.isArray,i=Object.keys(e),o=0;o=e.width-20?(a["text-anchor"]="start",a.x=5):(a["text-anchor"]="end",a.x=e._paper.attr("width")-7),r.attr(a);var o=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&i(t,o),s.text(o.text()&&u.text()?" - ":"")},d.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=d.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},d.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},i=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];d.supplyLayoutGlobalDefaults(i,n),n._dataLength=l.length,d.supplyDataDefaults(l,s,n),n._has=d._hasPlotType.bind(n);var u=n._modules;for(e=0;ea&&(e=(r-1)/(i.l+i.r),i.l=Math.floor(e*i.l),i.r=Math.floor(e*i.r)),0>o&&(e=(n-1)/(i.t+i.b),i.t=Math.floor(e*i.t),i.b=Math.floor(e*i.b))}},d.autoMargin=function(t,e,r){var n=t._fullLayout;if(n._pushmargin||(n._pushmargin={}),n.margin.autoexpand!==!1){if(r){var i=void 0===r.pad?12:r.pad;r.l+r.r>.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||d.doAutoMargin(t)}},d.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;return e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,t._replotting||"{}"===n||n===JSON.stringify(e._size)?void 0:c.plot(t)},d.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):t&&t.getTime?f.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&d.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)}},{"../components/color":176,"../lib":257,"../plotly":277,"./attributes":278,"./font_attributes":298,"./layout_attributes":303,d3:62,"fast-isnumeric":65}],305:[function(t,e,r){"use strict";var n=t("../../traces/scatter/attributes"),i=n.marker;e.exports={r:n.r,t:n.t,marker:{color:i.color,size:i.size,symbol:i.symbol,opacity:i.opacity}}},{"../../traces/scatter/attributes":342}],306:[function(t,e,r){"use strict";function n(t,e){var r={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return a({},e,r)}var i=t("../cartesian/layout_attributes"),a=t("../../lib/extend").extendFlat,o=a({},i.domain,{});e.exports={radialaxis:n("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:o,orientation:{valType:"number"}}),angularaxis:n("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:o}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":254,"../cartesian/layout_attributes":289}],307:[function(t,e,r){var n=t("../../plotly"),i=t("d3"),a=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},o=n.Lib.extendDeepAll;a.Axis=function(){function t(t){r=t||r;var u=l.data,f=l.layout;return("string"==typeof r||r.nodeName)&&(r=i.select(r)),r.datum(u).each(function(t,r){function l(t,e){return s(t)%360+f.orientation}var u=t.slice();c={data:a.util.cloneJson(u),layout:a.util.cloneJson(f)};var h=0;u.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[h],h=(h+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:i.rgb(t.color).darker().toString()),c.data[e].color=t.color,c.data[e].strokeColor=t.strokeColor,c.data[e].strokeDash=t.strokeDash,c.data[e].strokeSize=t.strokeSize});var d=u.filter(function(t,e){var r=t.visible;return"undefined"==typeof r||r===!0}),p=!1,g=d.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var v=i.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(g),m=[],y=v.map(function(t,e){if("unstacked"===t.key)return t.values;var r=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,n){t.yStack=[r],m.push(r),r=a.util.sumArrays(t.r,r)}),t.values});d=i.merge(y)}d.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var b=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;b=Math.max(10,b);var x,_=[f.margin.left+b,f.margin.top+b];if(p){var w=i.max(a.util.sumArrays(a.util.arrayLast(d).r[0],a.util.arrayLast(m)));x=[0,w]}else x=i.extent(a.util.flattenArray(d.map(function(t,e){return t.r})));f.radialAxis.domain!=a.DATAEXTENT&&(x[0]=0),n=i.scale.linear().domain(f.radialAxis.domain!=a.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:x).range([0,b]),c.layout.radialAxis.domain=n.domain();var A,k=a.util.flattenArray(d.map(function(t,e){return t.t})),M="string"==typeof k[0];M&&(k=a.util.deduplicate(k),A=k.slice(),k=i.range(k.length),d=d.map(function(t,e){var r=t;return t.t=[k],p&&(r.yStack=t.yStack),r}));var E=d.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===d.length,T=null===f.needsEndSpacing?M||!E:f.needsEndSpacing,L=f.angularAxis.domain&&f.angularAxis.domain!=a.DATAEXTENT&&!M&&f.angularAxis.domain[0]>=0,S=L?f.angularAxis.domain:i.extent(k),C=Math.abs(k[1]-k[0]);E&&!M&&(C=0);var R=S.slice();T&&M&&(R[1]+=C);var I=f.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),f.angularAxis.ticksStep&&(I=(R[1]-R[0])/I);var P=f.angularAxis.ticksStep||(R[1]-R[0])/(I*(f.minorTicks+1));A&&(P=Math.max(Math.round(P),1)),R[2]||(R[2]=P);var O=i.range.apply(this,R);if(O=O.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=i.scale.linear().domain(R.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=T?C:0,e=i.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",z=(new DOMParser).parseFromString(N,"application/xml"),D=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));e=i.select(D)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,B=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=a.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});a.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},a.Legend.defaultConfig().legendConfig,{container:F,elements:V,reverseOrder:f.legend.reverseOrder})})();var q=F.node().getBBox();b=Math.min(f.width-q.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],n.range([0,b]),c.layout.radialAxis.domain=n.domain(),F.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),B.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(f.width-(f.margin.left+f.margin.right+2*b+(q?q.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(H[0]=Math.max(0,H[0]),H[1]=Math.max(0,H[1]),e.select(".outer-group").attr("transform","translate("+H+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(n.ticks(5));W.enter().append("circle").attr({"class":"grid-circle"}).style(j),W.attr("r",n),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(j);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=i.svg.axis().scale(n).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(j),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(O),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(j),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?270>r&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(180>=r&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=i.max(B.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=n,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=i.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return o(a[r].defaultConfig(),t)});a[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=a.tooltipPanel().config({container:ut,fontSize:8})(),ft=a.tooltipPanel().config({container:ut,fontSize:8})(),ht=a.tooltipPanel().config({container:ut,hasTick:!0})();if(!M){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});B.on("mousemove.angular-guide",function(t,e){var r=a.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=a.util.convertToCartesian(b+12,r+180);ct.text(a.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});B.on("mousemove.radial-guide",function(t,e){var r=a.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=n.invert(a.util.getMousePos(Z).radius);var i=a.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(a.util.round(st)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var n=i.select(this),o=n.style("fill"),s="black",l=n.style("opacity")||1;if(n.attr({"data-opacity":l}),"none"!=o){n.attr({"data-fill":o}),s=i.hsl(o).darker().toString(),n.style({fill:s,opacity:1});var u={t:a.util.round(t[0]),r:a.util.round(t[1])};M&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-H[0]-h.left,f.top+f.height/2-H[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else o=n.style("stroke"),n.attr({"data-stroke":o}),s=i.hsl(o).darker().toString(),n.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=i.event.which?!1:void(i.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.hide();var r=i.select(this),n=r.attr("data-fill");n?r.style({fill:n,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),h}var e,r,n,s,l={data:[],layout:{}},u={},c={},f=i.dispatch("hover"),h={};return h.render=function(e){return t(e),this},h.config=function(t){if(!arguments.length)return l;var e=a.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),o(l.data[e],a.Axis.defaultConfig().data[0]),o(l.data[e],t)}),o(l.layout,a.Axis.defaultConfig().layout),o(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return n},h.angularScale=function(t){return s},h.svg=function(){return e},i.rebind(h,f,"on"),h},a.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:i.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none", -needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return r},a.util={},a.DATAEXTENT="dataExtent",a.AREA="AreaChart",a.LINE="LinePlot",a.DOT="DotPlot",a.BAR="BarChart",a.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},a.util._extend=function(t,e){for(var r in t)e[r]=t[r]},a.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},a.util.dataFromEquation2=function(t,e){var r=e||6,n=i.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return n},a.util.dataFromEquation=function(t,e,r){var n=e||6,a=[],o=[];i.range(0,360+n,n).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},a.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return i.range(e).map(function(t,e){return r[e]||r[0]})},a.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=a.util.ensureArray(t[e],r)}),t},a.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},a.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},a.util.sumArrays=function(t,e){return i.zip(t,e).map(function(t,e){return i.sum(t)})},a.util.arrayLast=function(t){return t[t.length-1]},a.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},a.util.flattenArray=function(t){for(var e=[];!a.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},a.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},a.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},a.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},a.util.getMousePos=function(t){var e=i.mouse(t.node()),r=e[0],n=e[1],a={};return a.x=r,a.y=n,a.pos=e,a.angle=180*(Math.atan2(n,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+n*n),a},a.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;a>i;i++)e=t[i],e in r?(r[e]++,n[e]=r[e]):r[e]=1;return n},a.util.duplicates=function(t){return Object.keys(a.util.duplicatesCount(t))},a.util.translator=function(t,e,r,n){if(n){var i=r.slice();r=e,e=i}var a=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof a&&(e.reduce(function(t,r,n){return"undefined"!=typeof t?(n===e.length-1&&delete t[r],t[r]):void 0},t),r.reduce(function(t,e,n){return"undefined"==typeof t[e]&&(t[e]={}),n===r.length-1&&(t[e]=a),t[e]},t))},a.PolyChart=function(){function t(){var t=r[0].geometryConfig,e=t.container;"string"==typeof e&&(e=i.select(e)),e.datum(r).each(function(e,r){function n(e,r){var n=t.radialScale(e[1]),i=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:n,t:i}}function a(t){var e=t.r*Math.cos(t.t),r=t.r*Math.sin(t.t);return{x:e,y:r}}var o=!!e[0].data.yStack,l=e.map(function(t,e){return o?i.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):i.zip(t.data.t[0],t.data.r[0])}),u=t.angularScale,c=t.radialScale.domain()[0],f={};f.bar=function(r,n,a){var o=e[a].data,s=t.radialScale(r[1])-t.radialScale(0),l=t.radialScale(r[2]||0),c=o.barWidth;i.select(this).attr({"class":"mark bar",d:"M"+[[s+l,-c/2],[s+l,c/2],[l,c/2],[l,-c/2]].join("L")+"Z",transform:function(e,r){return"rotate("+(t.orientation+u(e[0]))+")"}})},f.dot=function(t,r,o){var s=t[2]?[t[0],t[1]+t[2]]:t,l=i.svg.symbol().size(e[o].data.dotSize).type(e[o].data.dotType)(t,r);i.select(this).attr({"class":"mark dot",d:l,transform:function(t,e){var r=a(n(s));return"translate("+[r.x,r.y]+")"}})};var h=i.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(r,n,a){var o=r[2]?l[a].map(function(t,e){return[t[0],t[1]+t[2]]}):l[a];if(i.select(this).each(f.dot).style({opacity:function(t,r){return+e[a].data.dotVisible},fill:v.stroke(r,n,a)}).attr({"class":"mark dot"}),!(n>0)){var s=i.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({"class":"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,n,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,n,a)},"stroke-width":function(t,e){return v["stroke-width"](r,n,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,n,a)},opacity:function(t,e){return v.opacity(r,n,a)},display:function(t,e){return v.display(r,n,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=i.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,n){i.select(this).attr({"class":"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=i.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({"class":"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[a.PolyChart.defaultConfig()],n=i.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),o(r[e],a.PolyChart.defaultConfig()),o(r[e],t)}),this):r},t.getColorScale=function(){return e},i.rebind(t,n,"on"),t},a.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:i.scale.category20()}};return t},a.BarChart=function(){return a.PolyChart()},a.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},a.AreaChart=function(){return a.PolyChart()},a.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},a.DotPlot=function(){return a.PolyChart()},a.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},a.LinePlot=function(){return a.PolyChart()},a.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},a.Legend=function(){function t(){var r=e.legendConfig,n=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=o({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),a=i.merge(n);a=a.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(a=a.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=i.select(s));var l=a.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof a[0]:r.isContinuous,f=c?r.height:u*a.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=i.range(a.length),v=i.scale[c?"linear":"ordinal"]().domain(g).range(l),m=i.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=i.svg.symbolTypes.indexOf(t)?i.svg.symbol().type(t).size(r)():i.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(a);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=i.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return a[e].name}),t}var e=a.Legend.defaultConfig(),r=i.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},i.rebind(t,r,"on"),t},a.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},a.tooltipPanel=function(){var t,e,r,n={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+a.tooltipPanel.uid++,l=10,u=function(){t=n.container.selectAll("g."+s).data([0]);var i=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return r=i.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=i.append("text").attr({dx:n.padding+l,dy:.3*+n.fontSize}),u};return u.text=function(a){var o=i.hsl(n.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":n.fontSize+"px"}).text(f);var h=n.padding,d=e.node().getBBox(),p={fill:n.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[n.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u):void 0},u.hide=function(){return t?(t.style({display:"none"}),u):void 0},u.show=function(){return t?(t.style({display:"block"}),u):void 0},u.config=function(t){return o(n,t),u},u},a.tooltipPanel.uid=1,a.adapter={},a.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=o({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){a.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var n=a.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var i=n.indexOf(t.geometry);-1!=i&&(r.data[e].groupId=i)})}if(t.layout){var s=o({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){a.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};i.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../plotly":277,"./micropolar_manager":308,d3:62}],308:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("d3"),a=t("./undo_manager"),o=e.exports={},s=n.Lib.extendDeepAll;o.framework=function(t){function e(e,a){return a&&(f=a),i.select(i.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?s(r,e):e,u||(u=n.micropolar.Axis()),c=n.micropolar.adapter.plotly().convert(r),u.config(c).render(f),t.data=r.data,t.layout=r.layout,o.fillLayout(t),r}var r,l,u,c,f,h=new a;return e.isPolar=!0,e.svg=function(){return u.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return n.micropolar.adapter.plotly().convert(u.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:u.angularScale(),r:u.radialScale()}},e.setUndoPoint=function(){var t=this,e=n.micropolar.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,l),l=n.micropolar.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},o.fillLayout=function(t){var e=i.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:n.Color.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=s(o,t.layout)}},{"../../plotly":277,"./undo_manager":309,d3:62}],309:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return n-1}var a=t("../plotly"),o=a.Lib.extendFlat,s=a.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,l=t.data,u=t.layout,c=s([],l),f=s({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;rr;r++)e=f[r],d[r]=e[0]*(t.zmax-t.zmin)+t.zmin,p[r]=e[1];var g=n.extent([t.zmin,t.zmax,a.start,a.start+l*(u-1)]),v=g[t.zminr;r++)e=f[r],d[r]=(e[0]*(u+c-1)-c/2)*l+o,p[r]=e[1];var y=n.scale.linear().interpolate(n.interpolateRgb).domain(d).range(p);return y}},{"../../components/colorscale/get_scale":188,d3:62}],322:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i){var a,o=r("contours.coloring");"fill"===o&&(a=r("contours.showlines")),a!==!1&&("lines"!==o&&r("line.color","#000"),r("line.width",.5),r("line.dash")),r("line.smoothing"),"none"!==(e.contours||{}).coloring&&n(t,e,i,r,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":186}],323:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.name="",this.hoverinfo="all",this.xData=[],this.yData=[],this.zData=[],this.textLabels=[],this.idToIndex=[],this.bounds=[0,0,0,0],this.contourOptions={z:new Float32Array(0),x:[],y:[],shape:[0,0],levels:[0],levelColors:[0,0,0,1],lineWidth:1},this.contour=s(t.glplot,this.contourOptions),this.contour._trace=this,this.heatmapOptions={z:new Float32Array(0),x:[],y:[],shape:[0,0],colorLevels:[0],colorValues:[0,0,0,0]},this.heatmap=l(t.glplot,this.heatmapOptions),this.heatmap._trace=this}function i(t,e,r){for(var n=new Float32Array(e*r),i=0,a=0;e>a;a++)for(var o=0;r>o;o++)n[i++]=t[o][a];return n}function a(t,e){for(var r=t.contours,n=r.start,i=r.end,a=r.size||1,o=e.fill,s=u(t),l=Math.floor((i-n)/a)+(o?2:1),f=new Array(l),h=new Array(4*l),d=0;l>d;d++)for(var p=f[d]=n+a*d-(o?a/2:0),g=c(s(p)),v=0;4>v;v++)h[4*d+v]=g[v];return{levels:f,levelColors:h}}function o(t,e,r){var i=new n(t,e.uid);return i.update(e,r),i}var s=t("gl-contour2d"),l=t("gl-heatmap2d"),u=t("../contour/make_color_map"),c=t("../../lib/str2rgbarray"),f=n.prototype;f.handlePick=function(t){var e=t.pointId,r=this.heatmapOptions,n=r.shape;return{trace:this,dataCoord:t.dataCoord,traceCoord:[r.x[e%n[0]],r.y[Math.floor(e/n[0])],r.z[e]],textLabel:this.textLabels[e],name:this.name,hoverinfo:this.hoverinfo}},f.update=function(t,e){var r=e[0];this.name=t.name,this.hoverinfo=t.hoverinfo;var n,o=r.z,s=o[0].length,l=o.length;this.contourOptions.z=i(o,s,l),this.heatmapOptions.z=[].concat.apply([],o),this.contourOptions.shape=this.heatmapOptions.shape=[s,l],this.contourOptions.x=this.heatmapOptions.x=r.x,this.contourOptions.y=this.heatmapOptions.y=r.y,"fill"===t.contours.coloring?(n=a(t,{fill:!0}),this.contourOptions.levels=n.levels.slice(1),this.contourOptions.fillColors=n.levelColors,this.contourOptions.levelColors=[].concat.apply([],this.contourOptions.levels.map(function(){return[.25,.25,.25,1]}))):(n=a(t,{fill:!1}),this.contourOptions.levels=n.levels,this.contourOptions.levelColors=n.levelColors),this.textLabels=[].concat.apply([],t.text),this.contour.update(this.contourOptions),this.heatmap.update(this.heatmapOptions)},f.dispose=function(){this.contour.dispose(),this.heatmap.dispose()},e.exports=o},{"../../lib/str2rgbarray":269,"../contour/make_color_map":321,"gl-contour2d":67,"gl-heatmap2d":73}],324:[function(t,e,r){"use strict";var n={};n.attributes=t("../contour/attributes"),n.supplyDefaults=t("../contour/defaults"),n.colorbar=t("../contour/colorbar"),n.calc=t("../contour/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="contourgl",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","2dMap"],n.meta={},e.exports=n},{"../../plots/gl2d":301,"../contour/attributes":317,"../contour/calc":318,"../contour/colorbar":319,"../contour/defaults":320,"./convert":323}],325:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat;e.exports=a({},{z:{valType:"data_array"},x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:{valType:"data_array"},transpose:{valType:"boolean",dflt:!1},xtype:{valType:"enumerated",values:["array","scaled"]},ytype:{valType:"enumerated",values:["array","scaled"]},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1},connectgaps:{valType:"boolean",dflt:!1},_nestedModules:{colorbar:"Colorbar"}},i,{autocolorscale:a({},i.autocolorscale,{dflt:!1})})},{"../../components/colorscale/attributes":182,"../../lib/extend":254,"../scatter/attributes":342}],326:[function(t,e,r){"use strict";function n(t){function e(t){return u(t)?+t:void 0}var r,n,i,a,o,s,l=t.z;if(t.transpose){for(r=0,o=0;oo;o++)for(n=i(l,o),c[o]=new Array(n),s=0;n>s;s++)c[o][s]=e(a(l,o,s));return c}function i(t,e,r,n,i,a){var o,s,l,u=[],c=h.traceIs(t,"contour"),f=h.traceIs(t,"histogram"),d=h.traceIs(t,"gl2d"),p=Array.isArray(e)&&e.length>1; -if(p&&!f&&"category"!==a.type){e=e.map(a.d2c);var g=e.length;if(!(i>=g))return c?e.slice(0,i):e.slice(0,i+1);if(c||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;g>l;l++)u.push(.5*(e[l-1]+e[l]));u.push(1.5*e[g-1]-.5*e[g-2])}if(i>g){var v=u[u.length-1],m=v-u[u.length-2];for(l=g;i>l;l++)v+=m,u.push(v)}}else for(s=n||1,o=f||"category"===a.type?r||0:Array.isArray(e)&&1===e.length?e[0]:void 0===r?0:a.d2c(r),l=c||d?0:-.5;i>l;l++)u.push(o+s*l);return u}function a(t){return.5-.25*Math.min(1,.5*t)}function o(t,e,r){var n,i,o=1;if(Array.isArray(r))for(n=0;nn&&o>y;n++)o=l(t,e,a(o));return o>y&&c.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},f=[],h=t[0],d=[],p=[0,0,0],g=m(t);for(r=0;rn;n++)void 0===d[n]&&(o=(void 0!==d[n-1]?1:0)+(void 0!==d[n+1]?1:0)+(void 0!==e[n]?1:0)+(void 0!==h[n]?1:0),o?(0===r&&o++,0===n&&o++,r===t.length-1&&o++,n===d.length-1&&o++,4>o&&(c[[r,n]]=[r,n,o]),u.push([r,n,o])):f.push([r,n]));for(;f.length;){for(s={},l=!1,a=f.length-1;a>=0;a--)i=f[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],f.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,f,h,d,p,g,v=0;for(o=0;os;s++)l=b[s],u=t[i+l[0]],u&&(c=u[a+l[1]],void 0!==c&&(0===h?p=g=c:(p=Math.min(p,c),g=Math.max(g,c)),f++,h+=c));if(0===f)throw"iterateInterp2d order is wrong: no defined neighbors";t[i][a]=h/f,void 0===d?4>f&&(v=1):(t[i][a]=(1+r)*t[i][a]-r*d,g>p&&(v=Math.max(v,Math.abs(t[i][a]-d)/(g-p))))}return v}var u=t("fast-isnumeric"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../../plots/plots"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),v=t("./convert_column_xyz"),m=t("./max_row_length");e.exports=function(t,e){function r(t){T=e._input.zsmooth=e.zsmooth=!1,c.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,b,x,_,w,A=f.getFromId(t,e.xaxis||"x"),k=f.getFromId(t,e.yaxis||"y"),M=h.traceIs(e,"contour"),E=h.traceIs(e,"histogram"),T=M?"best":e.zsmooth;if(A._minDtick=0,k._minDtick=0,E){var L=d(t,e);a=L.x,l=L.x0,u=L.dx,y=L.y,b=L.y0,x=L.dy,_=L.z}else g(e)&&v(e,A,k),a=e.x?A.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(M||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===T)if("log"===A.type||"log"===k.type)r("log axis found");else if(!E){if(a.length){var S=(a[a.length-1]-a[0])/(a.length-1),C=Math.abs(S/100);for(w=0;wC){r("x scale is not linear");break}}if(y.length&&"fast"===T){var R=(y[y.length-1]-y[0])/(y.length-1),I=Math.abs(R/100);for(w=0;wI){r("y scale is not linear");break}}}var P=m(_),O="scaled"===e.xtype?"":e.x,N=i(e,O,l,u,P,A),z="scaled"===e.ytype?"":e.y,D=i(e,z,b,x,_.length,k);f.expand(A,N),f.expand(k,D);var F={x:N,y:D,z:_};if(p(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var B="contour"===e.type?"heatmap":"histogram2d";F.xfill=i(B,O,l,u,P,A),F.yfill=i(B,z,b,x,_.length,k)}return[F]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":183,"../../lib":257,"../../plots/cartesian/axes":280,"../../plots/plots":304,"../histogram2d/calc":339,"./convert_column_xyz":328,"./has_columns":330,"./max_row_length":331,"fast-isnumeric":65}],327:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u="cb"+r.uid,c=s(r.colorscale),f=r.zmin,h=r.zmax;if(i(f)||(f=a.aggNums(Math.min,null,r.z)),i(h)||(h=a.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+u).remove(),!r.showscale)return void o.autoMargin(t,u);var d=e[0].t.cb=l(t,u);d.fillcolor(n.scale.linear().domain(c.map(function(t){return f+t[0]*(h-f)})).range(c.map(function(t){return t[1]}))).filllevels({start:f,end:h,size:(h-f)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":179,"../../components/colorscale/get_scale":188,"../../lib":257,"../../plots/plots":304,d3:62,"fast-isnumeric":65}],328:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(ui;i++)a[i]=e.d2c(a[i]),o[i]=r.d2c(o[i]);var f,h,d,p=n.distinctVals(a),g=p.vals,v=n.distinctVals(o),m=v.vals,y=n.init2dArray(m.length,g.length);for(c&&(d=n.init2dArray(m.length,g.length)),i=0;u>i;i++)f=n.findBin(a[i]+p.minDiff/2,g),h=n.findBin(o[i]+v.minDiff/2,m),y[h][f]=s[i],c&&(d[h][f]=l[i]);t.x=g,t.y=m,t.z=y,c&&(t.text=d)}},{"../../lib":257}],329:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./has_columns"),a=t("./xyz_defaults"),o=t("../../components/colorscale/defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function u(r,i){return n.coerce(t,e,s,r,i)}var c=a(t,e,u);return c?(u("text"),u("zsmooth"),u("connectgaps",i(e)&&e.zsmooth!==!1),void o(t,e,l,u,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":186,"../../lib":257,"./attributes":325,"./has_columns":330,"./xyz_defaults":332}],330:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],331:[function(t,e,r){"use strict";e.exports=function(t){for(var e=0,r=0;r0&&(n=!0);for(var s=0;sl;l++){var u=e[l],c=s(u[1]);a[l]=r+u[0]*(n-r);for(var f=0;4>f;f++)o[4*l+f]=c[f]}return{colorLevels:a,colorValues:o}}function a(t,e,r){var i=new n(t,e.uid);return i.update(e,r),i}var o=t("gl-heatmap2d"),s=t("../../lib/str2rgbarray"),l=n.prototype;l.handlePick=function(t){var e=t.pointId,r=this.options.shape;return{trace:this,dataCoord:t.dataCoord,traceCoord:[this.options.x[e%r[0]],this.options.y[Math.floor(e/r[0])],this.options.z[e]],textLabel:this.textLabels[e],name:this.name,hoverinfo:this.hoverinfo}},l.update=function(t,e){var r=e[0];this.name=t.name,this.hoverinfo=t.hoverinfo;var n=r.z;this.options.z=[].concat.apply([],n);var a=n[0].length,o=n.length;this.options.shape=[a,o],this.options.x=r.x,this.options.y=r.y;var s=i(t);this.options.colorLevels=s.colorLevels,this.options.colorValues=s.colorValues,this.textLabels=[].concat.apply([],t.text),this.heatmap.update(this.options)},l.dispose=function(){this.heatmap.dispose()},e.exports=a},{"../../lib/str2rgbarray":269,"gl-heatmap2d":73}],335:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("../heatmap/defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("../heatmap/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="heatmapgl",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","2dMap"],n.meta={},e.exports=n},{"../../plots/gl2d":301,"../heatmap/calc":326,"../heatmap/colorbar":327,"../heatmap/defaults":329,"./attributes":333,"./convert":334}],336:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=t.length,n=0,i=0;r>i;i++)e[i]?(t[i]/=e[i],n+=t[i]):t[i]=null;return n}},{}],337:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports={count:function(t,e,r){return r[t]++,1},sum:function(t,e,r,i){var a=i[e];return n(a)?(a=Number(a),r[t]+=a,a):0},avg:function(t,e,r,i,a){var o=i[e];return n(o)&&(o=Number(o),r[t]+=o,a[t]++),0},min:function(t,e,r,i){var a=i[e];if(n(a)){if(a=Number(a),!n(r[t]))return r[t]=a,a;if(r[t]>a)return r[t]=a,a-r[t]}return 0},max:function(t,e,r,i){var a=i[e];if(n(a)){if(a=Number(a),!n(r[t]))return r[t]=a,a;if(r[t]i;i++)t[i]*=n},probability:function(t,e){for(var r=t.length,n=0;r>n;n++)t[n]/=e},density:function(t,e,r,n){var i=t.length;n=n||1;for(var a=0;i>a;a++)t[a]*=r[a]*n},"probability density":function(t,e,r,n){var i=t.length;n&&(e/=n);for(var a=0;i>a;a++)t[a]*=r[a]/e}}},{}],339:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("../histogram/bin_functions"),o=t("../histogram/norm_functions"),s=t("../histogram/average");e.exports=function(t,e){var r,l,u,c,f,h,d=i.getFromId(t,e.xaxis||"x"),p=e.x?d.makeCalcdata(e,"x"):[],g=i.getFromId(t,e.yaxis||"y"),v=e.y?g.makeCalcdata(e,"y"):[],m=Math.min(p.length,v.length);p.length>m&&p.splice(m,p.length-m),v.length>m&&v.splice(m,v.length-m),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(p,d,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(v,g,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),f=[];var y,b,x=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,A="string"==typeof e.xbins.size?[]:e.ybins,k=0,M=[],E=e.histnorm,T=e.histfunc,L=-1!==E.indexOf("density"),S="max"===T||"min"===T,C=S?null:0,R=a.count,I=o[E],P=!1,O=[],N=[],z="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";z&&"count"!==T&&(P="avg"===T,R=a[T]);var D=e.xbins,F=D.end+(D.start-i.tickIncrement(D.start,D.size))/1e6;for(h=D.start;F>h;h=i.tickIncrement(h,D.size))x.push(C),Array.isArray(w)&&w.push(h),P&&_.push(0);Array.isArray(w)&&w.push(h);var B=x.length;for(r=e.xbins.start,l=(h-r)/B,r+=l/2,D=e.ybins,F=D.end+(D.start-i.tickIncrement(D.start,D.size))/1e6,h=D.start;F>h;h=i.tickIncrement(h,D.size))f.push(x.concat()),Array.isArray(A)&&A.push(h),P&&M.push(_.concat());Array.isArray(A)&&A.push(h);var j=f.length;for(u=e.ybins.start,c=(h-u)/j,u+=c/2,L&&(O=x.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/l}),N=f.map(function(t,e){return Array.isArray(A)?1/(A[e+1]-A[e]):1/c})),h=0;m>h;h++)y=n.findBin(p[h],w),b=n.findBin(v[h],A),y>=0&&B>y&&b>=0&&j>b&&(k+=R(y,h,f[b],z,M[b]));if(P)for(b=0;j>b;b++)k+=s(f[b],M[b]);if(I)for(b=0;j>b;b++)I(f[b],k,O,N[b]);return{x:p,x0:r,dx:l,y:v,y0:u,dy:c,z:f}}},{"../../lib":257,"../../plots/cartesian/axes":280,"../histogram/average":336,"../histogram/bin_functions":337,"../histogram/norm_functions":338}],340:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var a=r.marker.line.width||0;Array.isArray(a)&&(a=a[e.i]||0),t.style({"stroke-width":a,fill:e.color}).call(n.stroke,i)}},{"../../components/color":176}],341:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var i=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(i.color,t,"mlc"),n.mergeArray(i.width,t,"mlw")}}},{"../../lib":257}],342:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/drawing"),a=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:a({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:a({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":184,"../../components/drawing":199,"../../lib/extend":254,"./constants":347}],343:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("./subtypes"),s=t("./colorscale_calc");e.exports=function(t,e){var r,l,u,c=i.getFromId(t,e.xaxis||"x"),f=i.getFromId(t,e.yaxis||"y"),h=c.makeCalcdata(e,"x"),d=f.makeCalcdata(e,"y"),p=Math.min(h.length,d.length);c._minDtick=0,f._minDtick=0,h.length>p&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;p>u;u++)x[u]=n(h[u])&&n(d[u])?{x:h[u],y:d[u]}:{x:!1,y:!1};return void 0!==typeof l&&a.mergeArray(l,x,"ms"),t.firstscatter=!1,x}},{"../../lib":257,"../../plots/cartesian/axes":280,"./colorscale_calc":346,"./subtypes":361,"fast-isnumeric":65}],344:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i,a;for(e=0;e=0;i--)if(a=t[i],"scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}},{}],345:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void o.autoMargin(t,c);var f=s(u.colorscale),h=u.color,d=u.cmin,p=u.cmax;i(d)||(d=a.aggNums(Math.min,null,h)),i(p)||(p=a.aggNums(Math.max,null,h));var g=e[0].t.cb=l(t,c);g.fillcolor(n.scale.linear().domain(f.map(function(t){return d+t[0]*(p-d)})).range(f.map(function(t){return t[1]}))).filllevels({start:d,end:p,size:(p-d)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":179,"../../components/colorscale/get_scale":188,"../../lib":257,"../../plots/plots":304,d3:62,"fast-isnumeric":65}],346:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("./subtypes");e.exports=function(t){a.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),a.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":183,"../../components/colorscale/has_colorscale":189,"./subtypes":361}],347:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],348:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=P>=U&&(C=L[E-1][0],R=L[E][0],S=C+(R-C)*(U-I)/(P-I),D=Math.min(D,S),F=Math.max(F,S));D=Math.max(D,0),F=Math.min(F,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:D,x1:F,y0:U,y1:U,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":176,"../../components/errorbars":205,"../../lib":257,"../../plots/cartesian/constants":285,"../../plots/cartesian/graph_interact":287,"./get_trace_color":350}],352:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":288,"./arrays_to_calcdata":341,"./attributes":342,"./calc":343,"./clean_data":344,"./colorbar":345,"./defaults":348,"./hover":351,"./plot":358,"./select":359,"./style":360,"./subtypes":361}],353:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":186,"../../components/colorscale/has_colorscale":189}],354:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=A.c2p(t[e].y);return r===L||n===L?!1:[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*M}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,k=e.connectGaps,M=e.baseTolerance,E=e.linear,T=[],L=n.BADNUM,S=.2,C=new Array(t.length),R=0;for(o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):m>y&&(m=y,c=f,d=!0)}if(d?(C[R++]=u,l!==c&&(C[R++]=c)):(c!==s&&(C[R++]=c),l!==u&&(C[R++]=u)),C[R++]=l,o>=t.length||!f)break;C[R++]=f,s=f}}else C[R++]=u}T.push(C.slice(0,R))}return T}},{"../../plots/cartesian/axes":280}],355:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],356:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t){var e=t.marker,r=e.sizeref||1,i=e.sizemin||0,a="area"===e.sizemode?function(t){return Math.sqrt(t/r)}:function(t){return t/r};return function(t){var e=a(t/2);return n(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":65}],357:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":176,"../../components/colorscale/defaults":186,"../../components/colorscale/has_colorscale":189,"./subtypes":361}],358:[function(t,e,r){"use strict";function n(t,e,r){var n=e.x(),a=e.y(),o=i.extent(n.range.map(n.l2c)),s=i.extent(a.range.map(a.l2c));r.forEach(function(t,e){var n=t[0].trace;if(u.hasMarkers(n)){var i=n.marker.maxdisplayed;if(0!==i){var a=t.filter(function(t){return t.x>=o[0]&&t.x<=o[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(a.length/i),c=0;r.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&e>r&&c++});var f=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),a.forEach(function(t,e){0===Math.round((e+f)%l)&&(t.vis=!0)})}}})}var i=t("d3"),a=t("../../lib"),o=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,r){function h(t){return t.filter(function(t){return t.vis})}n(t,e,r);var d=e.x(),p=e.y(),g=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(r);g.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),g.call(s.plot,e);var v,m,y,b,x="",_=[];g.each(function(t){var e=t[0].trace,r=e.line,n=i.select(this);if(e.visible===!0&&(m=e.fill.charAt(e.fill.length-1),"x"!==m&&"y"!==m&&(m=""),t[0].node3=n,c(t),u.hasLines(e)||"none"!==e.fill)){var a,s,h,g,w,A="",k="";v="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!x?n.append("path").classed("js-fill",!0):null,b&&(y=b.datum(t)),b=n.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(r.shape)?(h=o.steps(r.shape),g=o.steps(r.shape.split("").reverse().join(""))):h=g="spline"===r.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?o.smoothclosed(t.slice(1),r.smoothing):o.smoothopen(t,r.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return g(t.reverse())};var M,E=f(t,{xaxis:d,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(r.width||1,3)/4,linear:"linear"===r.shape}),T=e._polygons=new Array(E.length);for(M=0;M1&&n.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",a)}v?L&&C&&(m?("y"===m?L[1]=C[1]=p.c2p(0,!0):"x"===m&&(L[0]=C[0]=d.c2p(0,!0)),v.attr("d",A+"L"+C+"L"+L+"Z")):v.attr("d",A+"Z")):"tonext"===e.fill.substr(0,6)&&A&&x&&("tonext"===e.fill?y.attr("d",A+"Z"+x+"Z"):y.attr("d",A+"L"+x.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),x=k,_=T}}}),g.selectAll("path:not([d])").remove(),g.append("g").attr("class","points").each(function(t){var e=t[0].trace,r=i.select(this),n=u.hasMarkers(e),s=u.hasText(e);!n&&!s||e.visible!==!0?r.remove():(n&&r.selectAll("path.point").data(e.marker.maxdisplayed?h:a.identity).enter().append("path").classed("point",!0).call(o.translatePoints,d,p),s&&r.selectAll("g").data(e.marker.maxdisplayed?h:a.identity).enter().append("g").append("text").call(o.translatePoints,d,p))})}},{"../../components/drawing":199,"../../components/errorbars":205,"../../lib":257,"../../lib/polygon":263,"./arrays_to_calcdata":341,"./line_points":354,"./subtypes":361,d3:62}],359:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;ra;++a)n[a]=t(a>=e.length?i:e[a]);return n}function o(t,e,r){return l(S(t,r),L(e,r),r)}function s(t,e,r,n){var i=x(t,e,n);return i=Array.isArray(i[0])?i:a(v.identity,[i],n),l(i,L(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;r>i;++i){for(var a=0;3>a;++a)n[4*i+a]=t[i][a];n[4*i+3]=t[i][3]*e[i]}return n}function u(t,e){if(void 0===Float32Array.slice){for(var r=new Float32Array(e),n=0;e>n;n++)r[n]=t[n];return r}return t.slice(0,e)}function c(t,e){var r=new n(t,e.uid);return r.update(e),r}var f=t("gl-scatter2d"),h=t("gl-scatter2d-fancy"),d=t("gl-line2d"),p=t("gl-error2d"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../plots/cartesian/axes"),y=t("../../components/errorbars"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/subtypes"),w=t("../scatter/make_bubble_size_func"),A=t("../scatter/get_trace_color"),k=t("../../constants/gl_markers"),M=t("../../constants/gl2d_dashes"),E=["xaxis","yaxis"],T=n.prototype;T.handlePick=function(t){var e=t.pointId;return(t.object!==this.line||this.connectgaps)&&(e=this.idToIndex[t.pointId]),{trace:this,dataCoord:t.dataCoord,traceCoord:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:Array.isArray(this.color)?this.color[e]:this.color,name:this.name,hoverinfo:this.hoverinfo}},T.isFancy=function(t){if("linear"!==this.scene.xaxis.type)return!0;if("linear"!==this.scene.yaxis.type)return!0;if(!t.x||!t.y)return!0;if(this.hasMarkers){var e=t.marker||{};if(Array.isArray(e.symbol)||"circle"!==e.symbol||Array.isArray(e.size)||Array.isArray(e.color)||Array.isArray(e.line.width)||Array.isArray(e.line.color)||Array.isArray(e.opacity))return!0}return this.hasLines&&!this.connectgaps?!0:this.hasErrorX?!0:!!this.hasErrorY};var L=i.bind(null,function(t){return+t}),S=i.bind(null,b),C=i.bind(null,function(t){return k[t]||"\u25cf"});T.update=function(t){t.visible!==!0?(this.hasLines=!1,this.hasErrorX=!1,this.hasErrorY=!1,this.hasMarkers=!1):(this.hasLines=_.hasLines(t),this.hasErrorX=t.error_x.visible===!0,this.hasErrorY=t.error_y.visible===!0,this.hasMarkers=_.hasMarkers(t)),this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.connectgaps=!!t.connectgaps,this.isFancy(t)?this.updateFancy(t):this.updateFast(t),this.color=A(t,{})},T.updateFast=function(t){for(var e,r,n=this.xData=this.pickXData=t.x,i=this.yData=this.pickYData=t.y,a=n.length,o=new Array(a),s=new Float32Array(2*a),l=this.bounds,c=0,f=0,h=0;a>h;++h)e=n[h],r=i[h],g(e)&&g(r)&&(o[c++]=h,s[f++]=e,s[f++]=r,l[0]=Math.min(l[0],e),l[1]=Math.min(l[1],r),l[2]=Math.max(l[2],e),l[3]=Math.max(l[3],r));s=u(s,f),this.idToIndex=o,this.updateLines(t,s),this.updateError("X",t),this.updateError("Y",t);var d;if(this.hasMarkers){this.scatterOptions.positions=s;var p=b(t.marker.color),v=b(t.marker.line.color),m=t.opacity*t.marker.opacity;p[3]*=m,this.scatterOptions.color=p,v[3]*=m,this.scatterOptions.borderColor=v,d=t.marker.size,this.scatterOptions.size=d,this.scatterOptions.borderSize=t.marker.line.width,this.scatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions),this.expandAxesFast(l,d)},T.updateFancy=function(t){var e=this.scene,r=e.xaxis,n=e.yaxis,a=this.bounds,o=this.pickXData=r.makeCalcdata(t,"x").slice(),l=this.pickYData=n.makeCalcdata(t,"y").slice();this.xData=o.slice(),this.yData=l.slice();var c,f,h,d,p,g,v,m,b=y.calcFromTrace(t,e.fullLayout),x=o.length,_=new Array(x),A=new Float32Array(2*x),k=new Float32Array(4*x),M=new Float32Array(4*x),E=0,T=0,S=0,R=0,I="log"===r.type?function(t){return r.d2l(t)}:function(t){return t},P="log"===n.type?function(t){return n.d2l(t)}:function(t){return t};for(c=0;x>c;++c)this.xData[c]=h=I(o[c]),this.yData[c]=d=P(l[c]),isNaN(h)||isNaN(d)||(_[E++]=c,A[T++]=h,A[T++]=d,p=k[S++]=h-b[c].xs||0,g=k[S++]=b[c].xh-h||0,k[S++]=0,k[S++]=0,M[R++]=0,M[R++]=0,v=M[R++]=d-b[c].ys||0,m=M[R++]=b[c].yh-d||0,a[0]=Math.min(a[0],h-p),a[1]=Math.min(a[1],d-v),a[2]=Math.max(a[2],h+g),a[3]=Math.max(a[3],d+m));A=u(A,T),this.idToIndex=_,this.updateLines(t,A),this.updateError("X",t,A,k),this.updateError("Y",t,A,M);var O;if(this.hasMarkers){this.scatterOptions.positions=A,this.scatterOptions.sizes=new Array(E),this.scatterOptions.glyphs=new Array(E),this.scatterOptions.borderWidths=new Array(E),this.scatterOptions.colors=new Array(4*E),this.scatterOptions.borderColors=new Array(4*E);var N,z=w(t),D=t.marker,F=D.opacity,B=t.opacity,j=s(D,F,B,x),U=C(D.symbol,x),V=L(D.line.width,x),q=s(D.line,F,B,x);for(O=i(z,D.size,x),c=0;E>c;++c)for(N=_[c],this.scatterOptions.sizes[c]=4*O[N],this.scatterOptions.glyphs[c]=U[N],this.scatterOptions.borderWidths[c]=.5*V[N],f=0;4>f;++f)this.scatterOptions.colors[4*c+f]=j[4*N+f],this.scatterOptions.borderColors[4*c+f]=q[4*N+f];this.fancyScatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions),this.expandAxesFancy(o,l,O)},T.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var i=0,a=this.xData,s=this.yData;for(n=new Float32Array(2*a.length),r=0;ro;o++)r=this.scene[E[o]],n=r._min,n||(n=[]),n.push({val:t[o],pad:a}),i=r._max,i||(i=[]),i.push({val:t[o+2],pad:a})},T.expandAxesFancy=function(t,e,r){var n=this.scene,i={padded:!0,ppad:r};m.expand(n.xaxis,t,i),m.expand(n.yaxis,e,i)},T.dispose=function(){this.line.dispose(),this.errorX.dispose(),this.errorY.dispose(),this.scatter.dispose(),this.fancyScatter.dispose()},e.exports=c},{"../../components/errorbars":205,"../../constants/gl2d_dashes":245,"../../constants/gl_markers":246,"../../lib":257,"../../lib/gl_format_color":255,"../../lib/str2rgbarray":269,"../../plots/cartesian/axes":280,"../scatter/get_trace_color":350,"../scatter/make_bubble_size_func":356,"../scatter/subtypes":361,"fast-isnumeric":65,"gl-error2d":70,"gl-line2d":77,"gl-scatter2d":92,"gl-scatter2d-fancy":87}],367:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),a=t("../scatter/subtypes"),o=t("../scatter/xy_defaults"),s=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),u=t("../scatter/fillcolor_defaults"),c=t("../../components/errorbars/defaults"),f=t("./attributes");e.exports=function(t,e,r,h){function d(r,i){return n.coerce(t,e,f,r,i)}var p=o(t,e,d);return p?(d("text"),d("mode",pa?a:o>4/3-s?o:s}},{}],196:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,a){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===a?0:"middle"===a?1:"top"===a?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":257}],197:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":257,"../../plotly":277,"../../plots/cartesian/constants":285,"./align":195,"./cursor":196,"./unhover":198}],198:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":253}],199:[function(t,e,r){"use strict";function n(t,e,r,n){var a=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(a*a+o*o,x/2),c=Math.pow(s*s+l*l,x/2),f=(c*c*a-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[i.round(e[0]+(d&&f/d),2),i.round(e[1]+(d&&h/d),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&h/p),2)]]}var i=t("d3"),a=t("fast-isnumeric"),o=t("../../plots/plots"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),d=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},p.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},p.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},p.setRect=function(t,e,r,n,i){t.call(p.setPosition,e,r).call(p.setSize,n,i)},p.translatePoints=function(t,e,r){t.each(function(t){var n=t.xp||e.c2p(t.x),o=t.yp||r.c2p(t.y),s=i.select(this);a(n)&&a(o)?"text"===this.nodeName?s.attr("x",n).attr("y",o):s.attr("transform","translate("+n+","+o+")"):s.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,r){return e&&a(e)?t._context.staticPlot?e:1>e?1:Math.round(e):r||0},p.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,l=n||a.dash||"";i.select(this).call(s.stroke,r||a.color).call(p.dashLine,l,o)})},p.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(n){u.error(n,t),r.remove()}})};var g=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=p.symbolNames.length,m="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=r.line;if(o.traceIs(e,"symbols")){var a=d(e);t.attr("d",function(t){var n;n="various"===t.ms||"various"===r.size?3:h.isBubble(e)?a(t.ms):(r.size||6)/2,t.mrc=n;var i=p.symbolNumber(t.mx||r.symbol)||0,o=i%100;return t.om=i%200>=100,p.symbolFuncs[o](n)+(i>=200?m:"")}).style("opacity",function(t){return(t.mo+1||r.opacity+1)-1})}var l=(e._input||{}).marker||{},u=p.tryColorscale(r,l,""),c=p.tryColorscale(r,l,"line.");t.each(function(t){var e,a,o;t.so?(o=n.outlierwidth,a=n.outliercolor,e=r.outliercolor):(o=(t.mlw+1||n.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,a="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(n.color)?s.defaultLine:n.color,e="mc"in t?t.mcc=u(t.mc):Array.isArray(r.color)?s.defaultLine:r.color||"rgba(0,0,0,0)");var l=i.select(this);t.om?l.call(s.stroke,e).style({"stroke-width":(o||1)+"px",fill:"none"}):(l.style("stroke-width",o+"px").call(s.fill,e),o&&l.call(s.stroke,a))})}},p.tryColorscale=function(t,e,r){var n=u.nestedProperty(t,r+"color").get(),i=u.nestedProperty(t,r+"colorscale").get(),o=u.nestedProperty(t,r+"cauto").get(),s=u.nestedProperty(t,r+"cmin"),c=u.nestedProperty(t,r+"cmax"),f=s.get(),h=c.get();return i&&Array.isArray(n)?(!o&&a(f)&&a(h)||(f=1/0,h=-(1/0),n.forEach(function(t){a(t)&&(f>t&&(f=+t),t>h&&(h=+t))}),f>h&&(f=0,h=1),s.set(f),c.set(h),u.nestedProperty(e,r+"cmin").set(f),u.nestedProperty(e,r+"cmax").set(h)),l.makeScaleFunction(i,f,h)):u.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;p.textPointStyle=function(t,e){t.each(function(t){var r=i.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var o=t.tp||e.textposition,s=-1!==o.indexOf("top")?"top":-1!==o.indexOf("bottom")?"bottom":"middle",l=-1!==o.indexOf("left")?"end":-1!==o.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;u=a(u)&&u>0?u:0,r.call(p.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(c.convertToTspans);var h=i.select(this.parentNode),d=r.selectAll("tspan.line"),g=((d[0].length||1)-1)*b+1,v=y[l]*f,m=.75*u+y[s]*f+(y[s]-1)*g*u/2;h.attr("transform","translate("+v+","+m+")"),g>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var x=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,i="M"+t[0],a=[];for(r=1;rr;r++)o.push(n(t[r-1],t[r],t[r+1],e));for(o.push(n(t[a-1],t[a],t[0],e)),r=1;a>=r;r++)i+="C"+o[r-1][1]+" "+o[r][0]+" "+t[r];return i+="C"+o[a][1]+" "+o[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+i.round(e[0],2)+"V"+i.round(e[1],2)},vh:function(t,e){return"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},hvh:function(t,e){return"H"+i.round((t[0]+e[0])/2,2)+"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},vhv:function(t,e){return"V"+i.round((t[1]+e[1])/2,2)+"H"+i.round(e[0],2)+"V"+i.round(e[1],2)}},w=function(t,e){return"L"+i.round(e[0],2)+","+i.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var r="M"+i.round(t[0][0],2)+","+i.round(t[0][1],2),n=1;n=k&&(i.selectAll("[data-bb]").attr("data-bb",null),A=[]),t.setAttribute("data-bb",A.length),A.push(l),u.extendFlat({},l)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":248,"../../lib":257,"../../lib/svg_text_utils":270,"../../plots/plots":304,"../../traces/scatter/make_bubble_size_func":356,"../../traces/scatter/subtypes":361,"../color":176,"../colorscale":190,"./symbol_defs":200,d3:62,"fast-isnumeric":65}],200:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+i+a+i+a+o+a+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"H-"+r+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),a=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+i+o+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+i+o+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:62}],201:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],202:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(a),f=0;fs;s++)o[s]={x:r[s],y:i[s]};return o[0].trace=t,n.calc({calcdata:[o],_fullLayout:e}),o},n.plot=t("./plot"),n.style=t("./style"),n.hoverInfo=function(t,e,r){(e.error_y||{}).visible&&(r.yerr=t.yh-t.y,e.error_y.symmetric||(r.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(r.xerr=t.xh-t.x,e.error_x.symmetric||(r.xerrneg=t.x-t.xs))}},{"./attributes":201,"./calc":202,"./defaults":204,"./plot":206,"./style":207}],206:[function(t,e,r){"use strict";function n(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};return void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),a(n.ys)||(n.noYS=!0,n.ys=r.c2p(t.ys,!0))),void 0!==t.xh&&(n.xh=e.c2p(t.xh),n.xs=e.c2p(t.xs),a(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0))),n}var i=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),s=t("../../traces/scatter/subtypes");e.exports=function(t,e){var r=e.x(),l=e.y();t.each(function(t){var e=t[0].trace,u=e.error_x||{},c=e.error_y||{},f=s.hasMarkers(e)&&e.marker.maxdisplayed>0;if(c.visible||u.visible){var h=i.select(this).selectAll("g.errorbar").data(o.identity);h.enter().append("g").classed("errorbar",!0),h.each(function(t){var e=i.select(this),o=n(t,r,l);if(!f||t.vis){var s;if(c.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var h=c.width;s="M"+(o.x-h)+","+o.yh+"h"+2*h+"m-"+h+",0V"+o.ys,o.noYS||(s+="m-"+h+",0h"+2*h),e.append("path").classed("yerror",!0).attr("d",s)}if(u.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var d=(u.copy_ystyle?c:u).width;s="M"+o.xh+","+(o.y-d)+"v"+2*d+"m0,-"+d+"H"+o.xs,o.noXS||(s+="m0,-"+d+"v"+2*d),e.append("path").classed("xerror",!0).attr("d",s)}}})}})}},{"../../lib":257,"../../traces/scatter/subtypes":361,d3:62,"fast-isnumeric":65}],207:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},a=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),a.copy_ystyle&&(a=r),o.selectAll("path.xerror").style("stroke-width",a.thickness+"px").call(i.stroke,a.color)})}},{"../color":176,d3:62}],208:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":285}],209:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;2>s;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],a=0;a=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],213:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":254,"../../plots/font_attributes":298,"../color/attributes":175}],214:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],215:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/plots"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r){function s(t,e){return n.coerce(h,d,a,t,e)}for(var l,u,c,f,h=t.legend||{},d=e.legend={},p=0,g="normal",v=0;v1);if(y!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),n.coerceFont(s,"font",e.font),s("orientation"),"h"===d.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(l=0,c="left",u=1.1,f="bottom"):(l=0,c="left",u=-.1,f="top")}s("traceorder",g),o.isGrouped(e.legend)&&s("tracegroupgap"),s("x",l),s("xanchor",c),s("y",u),s("yanchor",f),n.noneOrAll(h,d,["x","y"])}}},{"../../lib":257,"../../plots/plots":304,"./attributes":213,"./helpers":218}],216:[function(t,e,r){"use strict";function n(t,e){function r(r){c.util.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=h.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,i.legend.font).text(u),e._context.editable&&!s?f.call(c.util.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" "),c.restyle(e,"name",t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(h.traceIs(s,"pie")){var f=a.label,d=r.indexOf(f);-1===d?r.push(f):r.splice(d,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),d=h[0].length||1;r=l*d,n=c.node()&&p.bBox(c.node()).width;var g=l*(.3+(1-d)/2);c.attr("y",g),h.attr("y",g)}r=Math.max(r,16)+3,a.attr({x:0,y:-r/2,height:r}),i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=b.isGrouped(i);if(b.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),r.selectAll(".legendtoggle").attr("width",(t._context.editable?0:i.width)+40),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height);else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;h>c;c++){var d=l[c].map(function(t){return t[0].width}),p=40+Math.max.apply(null,d);i.width+=i.tracegroupgap+p,s.push(i.width)}e.each(function(t,e){f.setTranslate(this,s[e],0)}),e.each(function(){var t=u.select(this),e=t.selectAll("g.traces"),r=0;e.each(function(t){var e=t[0],n=e.height;f.setTranslate(this,0,5+a+r+n/2),r+=n}),i.height=Math.max(i.height,r)}),i.height+=10+2*a,i.width+=2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}else{i.width=0,i.height=0;var g=0,v=0,m=0,y=0;r.each(function(t){m=Math.max(40+t[0].width,m)}),r.each(function(t){var e=t[0],r=m,o=i.tracegroupgap||5;a+y+o+r>n.width-(n.margin.r+n.margin.l)&&(y=0,g+=v,i.height=i.height+v,v=0),f.setTranslate(this,a+y,5+a+e.height/2+g),i.width+=o+r,i.height=Math.max(i.height,e.height),y+=o+r,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}}function s(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center");var i="top";x.isBottomAnchor(r)?i="bottom":x.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../dragelement"),p=t("../drawing"),g=t("../color"),v=t("./constants"),m=t("./get_legend_data"),y=t("./style"),b=t("./helpers"),x=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),T.call(p.setRect,F,t,v.scrollBarWidth,v.scrollBarHeight),k.select("rect").attr({y:b.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var b=r.legend,_=r.showlegend&&m(t.calcdata,b),w=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({"class":"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var M=A.selectAll("rect.bg").data([0]);M.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),M.call(g.stroke,b.bordercolor),M.call(g.fill,b.bgcolor),M.style("stroke-width",b.borderwidth+"px");var E=A.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var T=A.selectAll("rect.scrollbar").data([0]);T.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var L=E.selectAll("g.groups").data(_);L.enter().append("g").attr("class","groups"),L.exit().remove();var S=L.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var C=0!==A.enter().size();C&&(o(t,L,S),s(t));var R=0,I=r.width,P=0,O=r.height;o(t,L,S),b.height>O?l(t):s(t);var N=r._size,z=N.l+N.w*b.x,D=N.t+N.h*(1-b.y);x.isRightAnchor(b)?z-=b.width:x.isCenterAnchor(b)&&(z-=b.width/2),x.isBottomAnchor(b)?D-=b.height:x.isMiddleAnchor(b)&&(D-=b.height/2);var F=b.width,B=N.w;F>B?(z=N.l,F=B):(z+F>I&&(z=I-F),R>z&&(z=R),F=Math.min(I-z,b.width));var j=b.height,U=N.h;j>U?(D=N.t,j=U):(D+j>O&&(D=O-j),P>D&&(D=P),j=Math.min(O-D,b.height)),f.setTranslate(A,z,D);var V,q,H=j-v.scrollBarHeight-2*v.scrollBarMargin,G=b.height-j;if(b.height<=j||t._context.staticPlot)M.attr({width:F-b.borderwidth,height:j-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),f.setTranslate(E,0,0),k.select("rect").attr({width:F-2*b.borderwidth,height:j-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth}),E.call(p.setClipUrl,a);else{V=v.scrollBarMargin,q=E.attr("data-scroll")||0,M.attr({width:F-2*b.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:j-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),k.select("rect").attr({width:F-2*b.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:j-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth-q}),E.call(p.setClipUrl,a),C&&e(V,q),A.on("wheel",null),A.on("wheel",function(){q=f.constrain(E.attr("data-scroll")-u.event.deltaY/H*G,-G,0),V=v.scrollBarMargin-q/G*H,e(V,q),u.event.preventDefault()}),T.on(".drag",null),E.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=f.constrain(u.event.y-v.scrollBarHeight/2,v.scrollBarMargin,v.scrollBarMargin+H),q=-(V-v.scrollBarMargin)/H*G,e(V,q)});T.call(X),E.call(X)}if(t._context.editable){var Y,W,Z,Q;A.classed("cursor-move",!0),d.init({element:A.node(),prepFn:function(){var t=f.getTranslate(A);Z=t.x,Q=t.y},moveFn:function(t,e){var r=Z+t,n=Q+e;f.setTranslate(A,r,n),Y=d.align(r,0,N.l,N.l+N.w,b.xanchor),W=d.align(n,0,N.t+N.h,N.t,b.yanchor)},doneFn:function(e){e&&void 0!==Y&&void 0!==W&&c.relayout(t,{"legend.x":Y,"legend.y":W})}})}}}},{"../../lib":257,"../../plotly":277,"../../plots/plots":304,"../color":176,"../dragelement":197,"../drawing":199,"./anchor_utils":212,"./constants":214,"./get_legend_data":217,"./helpers":218,"./style":220,d3:62}],217:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+f;l.push(n),s[n]=[[r]],f++}}var a,o,s={},l=[],u=!1,c={},f=0;for(a=0;aa;a++)m=s[l[a]],y[a]=i.isReversed(e)?m.reverse():m;else{for(y=[new Array(b)],a=0;b>a;a++)m=s[l[a]][0],y[0][i.isReversed(e)?b-a-1:a]=m;b=1}return e._lgroupsLength=b,y}},{"../../plots/plots":304,"./helpers":218}],218:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.legendGetsTrace=function(t){return t.visible&&n.traceIs(t,"showLegend")},r.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},r.isVertical=function(t){return"h"!==t.orientation},r.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":304}],219:[function(t,e,r){"use strict";var n=e.exports={};n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.draw=t("./draw"),n.style=t("./style")},{"./attributes":213,"./defaults":215,"./draw":216,"./style":220}],220:[function(t,e,r){"use strict";function n(t){var e=t[0].trace,r=e.visible&&e.fill&&"none"!==e.fill,n=d.hasLines(e),i=l.select(this).select(".legendfill").selectAll("path").data(r?[t]:[]);i.enter().append("path").classed("js-fill",!0),i.exit().remove(),i.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var a=l.select(this).select(".legendlines").selectAll("path").data(n?[t]:[]);a.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),a.exit().remove(),a.call(f.lineGroupStyle)}function i(t){function e(t,e,r){var n=u.nestedProperty(o,t).get(),i=Array.isArray(n)&&e?e(n):n;if(r){if(ir[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),c=d.hasText(o),h=d.hasLines(o);if(s||c||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(a,p)],i=u.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../lib"),c=t("../../plots/plots"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":257,"../../plots/plots":304,"../../traces/pie/style_one":340,"../../traces/scatter/subtypes":361,"../color":176,"../drawing":199,d3:62}],221:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,h=(1-c)/2,d=u.Axes.list(t,null,!0),p=0;py;y++){var b=s[y];h=m[b]={};for(var x=0;x1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.Axes.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":257,"../color":176,"./attributes":224,"./button_attributes":225,"./constants":226}],228:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;ne){var r=e;e=t,t=r}s.setAttributes(w,{"data-min":t,"data-max":e}),s.setAttributes(P,{x:t,width:e-t}),s.setAttributes(M,{width:t}),s.setAttributes(E,{x:e,width:p-e}),s.setAttributes(T,{transform:"translate("+(t-v-1)+")"}),s.setAttributes(C,{transform:"translate("+e+")"})}var f=t._fullLayout,h=f._infolayer.selectAll("g.range-slider"),d=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*d.thickness,v=2,m=Math.floor(d.borderwidth/2),y=f.margin.l,b=f.height-g-f.margin.b,x=0,_=p,w=document.createElementNS(o,"g"); +s.setAttributes(w,{"class":"range-slider","data-min":x,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+b+")"});var A=document.createElementNS(o,"rect"),k=d.borderwidth%2===0?d.borderwidth:d.borderwidth-1;s.setAttributes(A,{fill:d.bgcolor,stroke:d.bordercolor,"stroke-width":d.borderwidth,height:g+k,width:p+k,transform:"translate(-"+m+", -"+m+")","shape-rendering":"crispEdges"});var M=document.createElementNS(o,"rect");s.setAttributes(M,{x:0,width:x,height:g,fill:"rgba(0,0,0,0.4)"});var E=document.createElementNS(o,"rect");s.setAttributes(E,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(o,"g"),L=document.createElementNS(o,"rect"),S=document.createElementNS(o,"rect");s.setAttributes(T,{transform:"translate("+(x-v-1)+")"}),s.setAttributes(L,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),s.setAttributes(S,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(T,[S,L]);var C=document.createElementNS(o,"g"),R=document.createElementNS(o,"rect"),I=document.createElementNS(o,"rect");s.setAttributes(C,{transform:"translate("+_+")"}),s.setAttributes(R,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),s.setAttributes(I,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(C,[I,R]);var P=document.createElementNS(o,"rect");s.setAttributes(P,{x:x,width:_-x,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function r(t){var r,n,f=+t.clientX-a;switch(i){case P:w.style.cursor="ew-resize",r=+s+f,n=+l+f,c(r,n),u(e(r),e(n));break;case L:w.style.cursor="col-resize",r=+s+f,n=+l,c(r,n),u(e(r),e(n));break;case R:w.style.cursor="col-resize",r=+s,n=+l+f,c(r,n),u(e(r),e(n));break;default:w.style.cursor="ew-resize",r=o,n=o+f,c(r,n),u(e(r),e(n))}}function n(){window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n),w.style.cursor="auto"}var i=t.target,a=t.clientX,o=a-w.getBoundingClientRect().left,s=w.getAttribute("data-min"),l=w.getAttribute("data-max");window.addEventListener("mousemove",r),window.addEventListener("mouseup",n)}),d.range||(d.range=i.getAutoRange(f.xaxis));var O=l(t,p,g);s.appendChildren(w,[A,O,M,E,P,T,C]),r(f.xaxis.range[0],f.xaxis.range[1]),h.data([0]).enter().append(function(){return d.setRange=r,w})}},{"../../constants/xmlns_namespaces":248,"../../lib":257,"../../plotly":277,"../../plots/cartesian/axes":280,"./helpers":234,"./range_plot":236}],233:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,a){function o(t,e){return n.coerce(s,l,i,t,e)}if(t[r].rangeslider){var s=n.isPlainObject(t[r].rangeslider)?t[r].rangeslider:{},l=e[r].rangeslider={};if(o("bgcolor"),o("bordercolor"),o("borderwidth"),o("thickness"),o("visible"),o("range"),l.range&&!e[r].autorange){var u=l.range,c=e[r].range;u[0]=Math.min(u[0],c[0]),u[1]=Math.max(u[1],c[1])}else e[r]._needsExpand=!0;l.visible&&a.forEach(function(t){var r=e[t]||{};r.fixedrange=!0,e[t]=r})}}},{"../../lib":257,"./attributes":231}],234:[function(t,e,r){"use strict";r.setAttributes=function(t,e){for(var r in e)t.setAttribute(r,e[r])},r.appendChildren=function(t,e){for(var r=0;rl;l++){var u=s[l],c={_fullLayout:e},f=M.coerceRef(t,n,c,u);if("path"!==o){var h=.25,d=.75;if("paper"!==f){var p=M.getFromId(c,f),g=a(p);h=g(p.range[0]+h*(p.range[1]-p.range[0])),d=g(p.range[0]+d*(p.range[1]-p.range[0]))}r(u+"0",h),r(u+"1",d)}}return"path"===o?r("path"):k.noneOrAll(t,n,["x0","x1","y0","y1"]),n}function i(t){return"category"===t.type?t.c2l:t.d2l}function a(t){return"category"===t.type?t.l2c:t.l2d}function o(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function s(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function l(t,e,r){for(var n=0;ne;i--)d(t,i).selectAll('[data-index="'+(i-1)+'"]').attr("data-index",i),C.draw(t,i)}function f(t,e,r,o){function s(r){var n={"data-index":e,"fill-rule":"evenodd",d:b(t,C)},i=C.line.width?C.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",C.opacity).call(E.stroke,i).call(E.fill,C.fillcolor).call(T.dashLine,C.line.dash,C.line.width);R&&a.call(T.setClipUrl,"clip"+t._fullLayout._uid+R),t._context.editable&&h(t,a,C,e)}var l,u;d(t,e).selectAll('[data-index="'+e+'"]').remove();var c=t.layout.shapes[e];if(c){var f={xref:c.xref,yref:c.yref},g={};"string"==typeof r&&r?g[r]=o:k.isPlainObject(r)&&(g=r);var v=Object.keys(g);for(l=0;ll;l++){var x=y[l];if(void 0===g[x]&&void 0!==c[x]){var _,w=x.charAt(0),A=M.getFromId(t,M.coerceRef(f,{},t,w)),L=M.getFromId(t,M.coerceRef(c,{},t,w)),S=c[x];void 0!==g[w+"ref"]&&(A?(_=i(A)(S),S=(_-A.range[0])/(A.range[1]-A.range[0])):S=(S-L.domain[0])/(L.domain[1]-L.domain[0]),L?(_=L.range[0]+S*(L.range[1]-L.range[0]),S=a(L)(_)):S=A.domain[0]+S*(A.domain[1]-A.domain[0])),c[x]=S}}var C=n(c,t._fullLayout);t._fullLayout.shapes[e]=C;var R;if("below"!==C.layer)R=(C.xref+C.yref).replace(/paper/g,""),s(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)R="",s(t._fullLayout._shapeLowerLayer);else{var I,P=t._fullLayout._plots||{},O=Object.keys(P);for(l=0,u=O.length;u>l;l++)I=P[O[l]],R=O[l],p(t,C,I)&&s(I.shapelayer)}}}function h(t,e,r,n){function i(t){var r=$.right-$.left,n=$.bottom-$.top,i=t.clientX-$.left,a=t.clientY-$.top,o=r>W&&n>Z&&!t.shiftKey?L.getCursor(i/r,1-a/n):"move";S(e,o),Y=o.split("-")[0]}function a(e){U=M.getFromId(t,r.xref),V=M.getFromId(t,r.yref),q=m(t,U),H=m(t,V,!0),G=y(t,U),X=y(t,V,!0);var a="shapes["+n+"]";"path"===r.type?(B=r.path,j=a+".path"):(c=q(r.x0),f=H(r.y0),h=q(r.x1),d=H(r.y1),p=a+".x0",g=a+".y0",_=a+".x1",w=a+".y1"),h>c?(T=c,P=a+".x0",D="x0",C=h,O=a+".x1",F="x1"):(T=h,P=a+".x1",D="x1",C=c,O=a+".x0",F="x0"),d>f?(k=f,R=a+".y0",N="y0",E=d,I=a+".y1",z="y1"):(k=d,R=a+".y1",N="y1",E=f,I=a+".y0",z="y0"),u={},i(e),Q.moveFn="move"===Y?s:l}function o(r){S(e),r&&A.relayout(t,u)}function s(n,i){if("path"===r.type){var a=function(t){return G(q(t)+n)};U&&"date"===U.type&&(a=v(a));var o=function(t){return X(H(t)+i)};V&&"date"===V.type&&(o=v(o)),r.path=x(B,a,o),u[j]=r.path}else u[p]=r.x0=G(c+n),u[g]=r.y0=X(f+i),u[_]=r.x1=G(h+n),u[w]=r.y1=X(d+i);e.attr("d",b(t,r))}function l(n,i){if("path"===r.type){var a=function(t){return G(q(t)+n)};U&&"date"===U.type&&(a=v(a));var o=function(t){return X(H(t)+i)};V&&"date"===V.type&&(o=v(o)),r.path=x(B,a,o),u[j]=r.path}else{var s=~Y.indexOf("n")?k+i:k,l=~Y.indexOf("s")?E+i:E,c=~Y.indexOf("w")?T+n:T,f=~Y.indexOf("e")?C+n:C;l-s>Z&&(u[R]=r[N]=X(s),u[I]=r[z]=X(l)),f-c>W&&(u[P]=r[D]=G(c),u[O]=r[F]=G(f))}e.attr("d",b(t,r))}var u,c,f,h,d,p,g,_,w,k,E,T,C,R,I,P,O,N,z,D,F,B,j,U,V,q,H,G,X,Y,W=10,Z=10,Q={setCursor:i,element:e.node(),prepFn:a,doneFn:o},$=Q.element.getBoundingClientRect();L.init(Q)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):k.log("getShapeLayer: undefined shape: index",e),n}function p(t,e,r){var n=A.Axes.getFromId(t,r.id,"x")._id,i=A.Axes.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function v(t){return function(e){return t(e).replace(" ","_")}}function m(t,e,r){var n,a=t._fullLayout._size;if(e){var o=i(e);n=function(t){return e._offset+e.l2p(o(t,!0))},"date"===e.type&&(n=g(n))}else n=r?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return n}function y(t,e,r){var n,i=t._fullLayout._size;if(e){var o=a(e);n=function(t){return o(e.p2l(t-e._offset))}}else n=r?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return n}function b(t,e){var r,n,a,o,s=e.type,l=M.getFromId(t,e.xref),u=M.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=i(l),n=function(t){return l._offset+l.l2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(a=i(u),o=function(t){return u._offset+u.l2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===s)return l&&"date"===l.type&&(n=g(n)),u&&"date"===u.type&&(o=g(o)),C.convertPath(e.path,n,o);var f=n(e.x0),h=n(e.x1),d=o(e.y0),p=o(e.y1);if("line"===s)return"M"+f+","+d+"L"+h+","+p;if("rect"===s)return"M"+f+","+d+"H"+h+"V"+p+"H"+f+"Z";var v=(f+h)/2,m=(d+p)/2,y=Math.abs(v-f),b=Math.abs(m-d),x="A"+y+","+b,_=v+y+","+m,w=v+","+(m-b);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function x(t,e,r){return t.replace(R,function(t){var n=0,i=t.charAt(0),a=P[i],o=O[i],s=N[i],l=t.substr(1).replace(I,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}function _(t,e,r,n,i){var a="category"===t.type?Number:t.d2c;if(void 0!==e)return[a(e),a(r)];if(n){var o,s,l,u,c,f=1/0,h=-(1/0),d=n.match(R);for("date"===t.type&&(a=g(a)),o=0;oc&&(f=c),c>h&&(h=c)));return h>=f?[f,h]:void 0}}var w=t("fast-isnumeric"),A=t("../../plotly"),k=t("../../lib"),M=t("../../plots/cartesian/axes"),E=t("../color"),T=t("../drawing"),L=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var r=t.shapes||[],i=e.shapes=[],a=0;as&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),k.log("Ignoring extra params in segment "+t)),i+l})},C.calcAutorange=function(t){var e,r,n,i,a,o=t._fullLayout,s=o.shapes;if(s.length&&t._fullData.length)for(e=0;eh?r=h:(c.left-=b.offsetLeft,c.right-=b.offsetLeft,c.top-=b.offsetTop,c.bottom-=b.offsetTop,b.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(r=Math.max(r,o*(t[b.side]-c[a])+u))}),r=Math.min(h,r)),r>0||0>h){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){T=0,L=!0,S=R,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,k=g.titlefont.family,M=g.titlefont.size,E=g.titlefont.color,T=1,L=!1,S=g.title.trim();""===S&&(T=0),S.match(/Click to enter .+ title/)&&(T=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var R="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":257,"../../lib/svg_text_utils":270,"../../plotly":277,"../../plots/plots":304,"../color":176,"../drawing":199,d3:62,"fast-isnumeric":65}],240:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:o,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":254,"../../plots/font_attributes":298,"../color/attributes":175}],241:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],242:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,u,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(l.enter().append("g").classed(E.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&m(t),0!==r.length){var u=l.selectAll("g."+E.headerGroupClassName).data(r,i);u.enter().append("g").classed(E.headerGroupClassName,!0);var c=l.selectAll("g."+E.buttonGroupClassName).data([0]);c.enter().append("g").classed(E.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(v).attr(E.menuIndexAttrName,"-1"),u.exit().each(function(e){y.select(this).remove(),c.call(v).attr(E.menuIndexAttrName,"-1"),x.autoMargin(t,E.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],248:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],249:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.16.3",r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=n.register,r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=n.Snapshot,r.PlotSchema=n.PlotSchema,r.Queue=n.Queue,r.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":274,"./plot_api/to_image":275,"./plot_api/validate":276,"./plotly":277,"./snapshot/download":311,d3:62}],250:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],251:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("./nested_property"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)}},"boolean":{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(o(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r?!0:"string"!=typeof t?!1:!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),a=0;a2)return!1;var l=o[0].split("-"); +if(l.length>3||3!==l.length&&o[1])return!1;if(4===l[0].length)r=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();r=((Number(l[0])-u+70)%100+200)%100+u-70}return s(r)?1===l.length?new Date(r,0,1).getTime():(n=Number(l[1])-1,l[1].length>2||!(n>=0&&11>=n)?!1:2===l.length?new Date(r,n,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(r,n,i).getTime(),o[1]?(l=o[1].split(":"),l.length>3?!1:(a=Number(l[0]),l[0].length>2||!(a>=0&&23>=a)?!1:(i+=36e5*a,1===l.length?i:(n=Number(l[1]),l[1].length>2||!(n>=0&&59>=n)?!1:(i+=6e4*n,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){if("undefined"==typeof o)return void l.error("d3 is not defined.");e||(e=0);var r=new Date(t),i=o.time.format("%Y-%m-%d")(r);return 7776e6>e?(i+=" "+n(r.getHours(),2),432e6>e&&(i+=":"+n(r.getMinutes(),2),108e5>e&&(i+=":"+n(r.getSeconds(),2),3e5>e&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={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"]},c={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"]},f=o.time.format.utc,h={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){h[t].D.push(f(e)),["H","I","D"].forEach(function(r){u[r].forEach(function(n){var i=h[t][r];i.push(f(e+"~"+n)),i.push(f(n+"~"+e))})})})});var d=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,v=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},b=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,A=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],M=function(t,e){return k[e-1]},E=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,p).replace(g,"").replace(v,"~").replace(m,y).replace(A,M).trim().replace(E,"");var e,r,n=null,o=i(t),s=a(t);e=h[o][s],r=e.length;for(var l=0;r>l&&!(n=e[l].parse(t));l++);if(!(n instanceof Date))return!1;var u=n.getTimezoneOffset();return n.setTime(n.getTime()+60*u*1e3),n}},{"../lib":257,d3:62,"fast-isnumeric":65}],253:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof n)return t;var e=new n;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(r,n){"undefined"!=typeof jQuery&&jQuery(t).trigger(r,n),e.emit(r,n)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof jQuery&&(n=jQuery(t).triggerHandler(e,r));var a=t._ev;if(!a)return n;var o=a._events[e];if(!o)return n;"function"==typeof o&&(o=[o]);for(var s=o.pop(),l=0;lm;m++){l=t[m];for(u in l)c=g[u],f=l[u],s&&o(f)?g[u]=f:e&&f&&(a(f)||(h=o(f)))?(h?(h=!1,d=c&&o(c)?c:[]):d=c&&a(c)?c:{},g[u]=i([d,f],e,r,s)):("undefined"!=typeof f||r)&&(g[u]=f)}return g}var a=t("./is_plain_object.js"),o=Array.isArray;r.extendFlat=function(){return i(arguments,!1,!1,!1)},r.extendDeep=function(){return i(arguments,!0,!1,!1)},r.extendDeepAll=function(){return i(arguments,!0,!0,!1)},r.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":258}],255:[function(t,e,r){"use strict";function n(t,e){var r=f(t);return r[3]*=e,r}function i(t){return s(t).isValid()?t:c}function a(t){return l(t)?t:h}function o(t,e,r){var o,s,l,f,d,p=t.color,g=Array.isArray(p),v=Array.isArray(e),m=[];if(o=void 0!==t.colorscale?u(t.colorscale,t.cmin,t.cmax):i,s=g?function(t,e){return void 0===t[e]?c:o(t[e])}:i,l=v?function(t,e){return void 0===t[e]?h:a(t[e])}:a,g||v)for(var y=0;r>y;y++)f=s(p,y),d=l(e,y),m[y]=n(f,d);else m=n(p,e);return m}var s=t("tinycolor2"),l=t("fast-isnumeric"),u=t("../components/colorscale/make_scale_function"),c=t("../components/color/attributes").defaultLine,f=t("./str2rgbarray"),h=1;e.exports=o},{"../components/color/attributes":175,"../components/colorscale/make_scale_function":193,"./str2rgbarray":269,"fast-isnumeric":65,tinycolor2:148}],256:[function(t,e,r){"use strict";function n(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(e>r)break;t=t.slice(0,e)+l(t.slice(e+5,r))+t.slice(r+6)}return t}function i(t){return t.replace(/\/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(r>n)r+=1;else{var i=e[t.slice(r+1,n)];t=i?t.slice(0,r)+i+t.slice(n+1):t.slice(0,r)+t.slice(n+1)}}return t}function s(t){return""+o(a(n(i(t))))}var l=t("superscript-text"),u=t("../constants/string_mappings");e.exports=s},{"../constants/string_mappings":247,"superscript-text":137}],257:[function(t,e,r){"use strict";var n=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var a=t("./coerce");i.valObjects=a.valObjects,i.coerce=a.coerce,i.coerce2=a.coerce2,i.coerceFont=a.coerceFont,i.validate=a.validate;var o=t("./dates");i.dateTime2ms=o.dateTime2ms,i.isDateTime=o.isDateTime,i.ms2DateTime=o.ms2DateTime,i.parseDate=o.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var f=t("./loggers");i.log=f.log,i.warn=f.warn,i.error=f.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var a=0;ar?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.randstr=function h(t,e,r){if(r||(r=16),void 0===e&&(e=24),0>=e)return"0";var n,i,a,o=Math.log(Math.pow(2,e))/Math.log(r),s="";for(n=2;o===1/0;n*=2)o=Math.log(Math.pow(2,e/n))/Math.log(r)*n;var l=o-Math.floor(o);for(n=0;n-1||u!==1/0&&u>=Math.pow(2,e)?h(t,e,r):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;l>r;r++)u[r]=(1-Math.cos(Math.PI*(r+1)/e))/(2*e);for(r=0;o>r;r++){for(a=0,n=0;l>n;n++)i=r+n+1-e,-o>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,a=!1,o=!0;for(n=0;ni;i++)e[i][r]=t[i]},i.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,a,o,s=3,l=Object.keys(t);for(n=0;n1?n+a[1]:"";if(i&&(a.length>1||o.length>4))for(;r.test(o);)o=o.replace(r,"$1"+i+"$2");return o+s}},{"./coerce":251,"./dates":252,"./extend":254,"./is_plain_object":258,"./loggers":259,"./matrix":260,"./nested_property":261,"./notifier":262,"./search":265,"./stats":268,d3:62}],258:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],259:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;en;n++)r[n]=new Array(e);return r},r.transposeRagged=function(t){var e,r,n=0,i=t.length;for(e=0;i>e;e++)n=Math.max(n,t[e].length);var a=new Array(n);for(e=0;n>e;e++)for(a[e]=new Array(i),r=0;i>r;r++)a[e][r]=t[r][e];return a},r.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var n,i,a=t.length;if(t[0].length)for(n=new Array(a),i=0;a>i;i++)n[i]=r.dot(t[i],e);else if(e[0].length){var o=r.transposeRagged(e);for(n=new Array(o.length),i=0;ii;i++)n+=t[i]*e[i];return n},r.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},r.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},r.rotationXYMatrix=function(t,e,n){return r.dot(r.dot(r.translationMatrix(e,n),r.rotationMatrix(t)),r.translationMatrix(-e,-n))},r.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var n=1===arguments.length?e[0]:[e[0],e[1]];return r.dot(t,[n[0],n[1],1]).slice(0,2)}},r.apply2DTransform2=function(t){var e=r.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],261:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,a,o,s,l=t;for(o=0;o=0;e--){if(n=t[e],o=!1,Array.isArray(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sr||r>a||o>n||n>s?!1:!e||!u(t)}function r(t,e){var r=t[0],l=t[1];if(i>r||r>a||o>l||l>s)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;p>u;u++)if(c=g,f=v,g=n[u][0],v=n[u][1],h=Math.min(c,g),!(h>r||r>Math.max(c,g)||l>Math.max(f,v)))if(l=l&&r!==h&&m++}return m%2===1}var n=t.slice(),i=n[0][0],a=i,o=n[0][1],s=o;n.push(n[0]);for(var l=1;la;a++)if(o=[t[a][0]-l[0],t[a][1]-l[1]],s=n(o,u),0>s||s>c||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":260}],264:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;rt}function i(t,e){return e>=t}function a(t,e){return t>e}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;h>f&&d++<100;)u=Math.floor((f+h)/2),c(e[u],t)?f=u+1:h=u;return d>90&&l.log("Long binary search..."),f-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,a=i/(n||1)/1e4,o=[e[0]],s=0;n>s;s++)e[s+1]>e[s]+a&&(i=Math.min(i,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,a=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;a>i&&o++<100;)n=u((i+a)/2),e[n]<=t?i=n+s:a=n-l;return e[i]}},{"../lib":257,"fast-isnumeric":65}],266:[function(t,e,r){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],267:[function(t,e,r){"use strict";var n=t("../components/color"),i=function(){};e.exports=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=i);t.destroy=function(){t.container.parentNode.removeChild(t.container)};var r=document.createElement("div");return r.textContent="Webgl is not supported by your browser - visit http://get.webgl.org for more info",r.style.cursor="pointer",r.style.fontSize="24px",r.style.color=n.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../components/color":176}],268:[function(t,e,r){"use strict";var n=t("fast-isnumeric");r.aggNums=function(t,e,i,a){var o,s;if(a||(a=i.length),n(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(a),o=0;a>o;o++)s[o]=r.aggNums(t,e,i[o]);i=s}for(o=0;a>o;o++)n(e)?n(i[o])&&(e=t(+e,+i[o])):e=i[o];return e},r.len=function(t){return r.aggNums(function(t){return t+1},0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums(function(t,e){return t+e},0,t)/e},r.variance=function(t,e,i){return e||(e=r.len(t)),n(i)||(i=r.mean(t,e)),r.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":65}],269:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:8,tinycolor2:148}],270:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,-1===v.indexOf(c.protocol)?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},a="right"===o?function(){return l.right-n.width}:"center"===o?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({"class":p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":247,"../constants/xmlns_namespaces":248,"../lib":257,d3:62}],271:[function(t,e,r){"use strict";function n(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function i(t){Array.isArray(t._promises)&&t._promises.length>0&&O.log("Clearing previous rejected promises from queue."), +t._promises=[]}function a(t,e){t._fullLayout._paperdiv.style("background","white"),P.defaultConfig.setBackground(t,e)}function o(t,e){t._context||(t._context=O.extendFlat({},P.defaultConfig));var r=t._context;e&&(Object.keys(e).forEach(function(t){t in r&&("setBackground"===t&&"opaque"===e[t]?r[t]=a:r[t]=e[t])}),e.plot3dPixelRatio&&!r.plotGlPixelRatio&&(r.plotGlPixelRatio=r.plot3dPixelRatio)),r.staticPlot&&(r.editable=!1,r.autosizable=!1,r.scrollZoom=!1,r.doubleClick=!1,r.showTips=!1,r.showLink=!1,r.displayModeBar=!1)}function s(t,e,r){var n=C.select(t).selectAll(".plot-container").data([0]);n.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=n.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),r&&(t.layout=r),P.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(A(t,{}),t._fullLayout.autosize=r.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=P.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var a=t.framework.svg(),o=1,s=t._fullLayout.title;""!==s&&s||(o=0);var l="Click to enter title",u=function(){this.call(P.util.convertToTspans)},c=a.select(".title-group text").call(u);if(t._context.editable){c.attr({"data-unformatted":s}),s&&s!==l||(o=.2,c.attr({"data-unformatted":l}).text(l).style({opacity:o}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(P.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(u),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(u)})};c.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),D.addLinks(t),Promise.resolve()}function l(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var n=P.Axes.list({_fullLayout:t});for(e=0;ee;e++){var o=t.annotations[e];o.ref&&("paper"===o.ref?(o.xref="paper",o.yref="paper"):"data"===o.ref&&(o.xref="x",o.yref="y"),delete o.ref),u(o,"xref"),u(o,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(O.warn("Shapes must be an array."),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var l=t.shapes[e];u(l,"xref"),u(l,"yref")}var c=t.legend;c&&(c.x>3?(c.x=1.02,c.xanchor="left"):c.x<-2&&(c.x=-.02,c.xanchor="right"),c.y>3?(c.y=1.02,c.yanchor="bottom"):c.y<-2&&(c.y=-.02,c.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=D.getSubplotIds(t,"gl3d");for(e=0;er;++r)b[r]=v[e]+m*y[2+4*r];d.camera={eye:{x:b[0],y:b[1],z:b[2]},center:{x:v[0],y:v[1],z:v[2]},up:{x:y[1],y:y[5],z:y[9]}},delete d.cameraposition}}return B.clean(t),t}function u(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=P.Axes.cleanId(r,n))}function c(t,e){for(var r=[],n=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),i=0;ia&&(s=O.randstr(n),-1!==r.indexOf(s));a++);o.uid=O.randstr(n),n.push(o.uid)}if(r.push(o.uid),"histogramy"===o.type&&"xbins"in o&&!("ybins"in o)&&(o.ybins=o.xbins,delete o.xbins),o.error_y&&"opacity"in o.error_y){var l=B.defaults,u=o.error_y.color||(D.traceIs(o,"bar")?B.defaultLine:l[i%l.length]);o.error_y.color=B.addOpacity(B.rgb(u),B.opacity(u)*o.error_y.opacity),delete o.error_y.opacity}if("bardir"in o&&("h"!==o.bardir||!D.traceIs(o,"bar")&&"histogram"!==o.type.substr(0,9)||(o.orientation="h",_(o)),delete o.bardir),"histogramy"===o.type&&_(o),"histogramx"!==o.type&&"histogramy"!==o.type||(o.type="histogram"),"scl"in o&&(o.colorscale=o.scl,delete o.scl),"reversescl"in o&&(o.reversescale=o.reversescl,delete o.reversescl),o.xaxis&&(o.xaxis=P.Axes.cleanId(o.xaxis,"x")),o.yaxis&&(o.yaxis=P.Axes.cleanId(o.yaxis,"y")),D.traceIs(o,"gl3d")&&o.scene&&(o.scene=D.subplotsRegistry.gl3d.cleanId(o.scene)),D.traceIs(o,"pie")||(Array.isArray(o.textposition)?o.textposition=o.textposition.map(f):o.textposition&&(o.textposition=f(o.textposition))),D.traceIs(o,"2dMap")&&("YIGnBu"===o.colorscale&&(o.colorscale="YlGnBu"),"YIOrRd"===o.colorscale&&(o.colorscale="YlOrRd")),D.traceIs(o,"markerColorscale")&&o.marker){var c=o.marker;"YIGnBu"===c.colorscale&&(c.colorscale="YlGnBu"),"YIOrRd"===c.colorscale&&(c.colorscale="YlOrRd")}if("surface"===o.type&&O.isPlainObject(o.contours)){var d=["x","y","z"];for(a=0;an?a.push(i+n):a.push(n);return a}function g(t,e,r){var n,i;for(n=0;n=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||0>i&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function v(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&g(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function m(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&l0){var s=w(t._boundingBoxMargins),l=s.left+s.right,u=s.bottom+s.top,c=a._container.node().getBoundingClientRect(),f=1-2*o.frameMargins;i=Math.round(f*(c.width-l)),n=Math.round(f*(c.height-u))}else r=window.getComputedStyle(t),n=parseFloat(r.height)||a.height,i=parseFloat(r.width)||a.width;return Math.abs(a.width-i)>1||Math.abs(a.height-n)>1?(a.height=t.layout.height=n,a.width=t.layout.width=i):"initial"!==a.autosize&&(delete e.autosize,a.autosize=t.layout.autosize=!0),D.sanitizeMargins(a),e}function k(t){var e=C.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===r.autosize&&(A(t,{}),r.autosize=!0,t.layout.autosize=!0),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];C.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=O.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0);var a=P.Axes.getSubplots(t);a.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&M(t,a),r._has("cartesian")&&E(t,a),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var o=r._paper.selectAll(".layer-subplot");r._imageSubplotLayer=o.selectAll(".imagelayer"),r._shapeSubplotLayer=o.selectAll(".shapelayer");var s=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=s.append("g").classed("imagelayer",!0),r._shapeUpperLayer=s.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var l=O.syncOrAsync([T,function(){return P.Axes.doTicks(t,"redraw")},F.init],t);return l&&l.then&&t._promises.push(l),l}function M(t,e){function r(e,r){return function(){return P.Axes.getFromId(t,e,r)}}for(var n,i,a=t._fullLayout._plots={},o=0;o0,_=P.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),A=w===_;x?t.framework===k&&!b&&A||(t.framework=k,k(t)):A?b&&k(t):(t.framework=k,k(t)),b&&P.Axes.saveRangeInitial(t);var M=t._fullLayout,E=!t.calcdata||t.calcdata.length!==(t.data||[]).length;E&&d(t);for(var L=0;LW.range[0]?[1,2]:[2,1]);else{var Q=W.range[0],$=W.range[1];"log"===F?(0>=Q&&0>=$&&a(G+".autorange",!0),0>=Q?Q=$/1e6:0>=$&&($=Q/1e6),a(G+".range[0]",Math.log(Q)/Math.LN10),a(G+".range[1]",Math.log($)/Math.LN10)):(a(G+".range[0]",Math.pow(10,Q)),a(G+".range[1]",Math.pow(10,$)))}else a(G+".autorange",!0)}if("reverse"===U)X.range?X.range.reverse():(a(G+".autorange",!0),X.range=[1,0]),Y.autorange?w=!0:_=!0;else if("annotations"===N.parts[0]||"shapes"===N.parts[0]){var K=N.parts[1],J=N.parts[0],tt=g[J]||[],et=P[O.titleCase(J)],rt=tt[K]||{};2===N.parts.length&&("add"===m[R]||O.isPlainObject(m[R])?L[R]="remove":"remove"===m[R]?-1===K?(L[J]=tt,delete L[R]):L[R]=rt:O.log("???",m)),!o(rt,"x")&&!o(rt,"y")||O.containsAny(R,["color","opacity","align","dash"])||(w=!0),et.draw(t,K,N.parts.slice(2).join("."),m[R]),delete m[R]}else if("images"===N.parts[0]){var it=O.objectFromPath(R,F);O.extendDeepAll(t.layout,it),V.supplyLayoutDefaults(t.layout,t._fullLayout),V.draw(t)}else if("mapbox"===N.parts[0]&&"layers"===N.parts[1]){O.extendDeepAll(t.layout,O.objectFromPath(R,F));var at=(t._fullLayout.mapbox||{}).layers||[];for(I=N.parts[2]+1-at.length,p=0;I>p;p++)at.push({});_=!0}else if("updatemenus"===N.parts[0]){O.extendDeepAll(t.layout,O.objectFromPath(R,F));var ot=t._fullLayout.updatemenus||[];for(I=N.parts[2]+1-ot.length,p=0;I>p;p++)ot.push({});_=!0}else 0===N.parts[0].indexOf("scene")?_=!0:0===N.parts[0].indexOf("geo")?_=!0:0===N.parts[0].indexOf("ternary")?_=!0:!v._has("gl2d")||-1===R.indexOf("axis")&&"plot_bgcolor"!==N.parts[0]?"hiddenlabels"===R?w=!0:-1!==N.parts[0].indexOf("legend")?y=!0:-1!==R.indexOf("title")?b=!0:-1!==N.parts[0].indexOf("bgcolor")?x=!0:N.parts.length>1&&O.containsAny(N.parts[1],["tick","exponent","grid","zeroline"])?b=!0:-1!==R.indexOf(".linewidth")&&-1!==R.indexOf("axis")?b=x=!0:N.parts.length>1&&-1!==N.parts[1].indexOf("line")?x=!0:N.parts.length>1&&"mirror"===N.parts[1]?b=x=!0:"margin.pad"===R?b=x=!0:"margin"===N.parts[0]||"autorange"===N.parts[1]||"rangemode"===N.parts[1]||"type"===N.parts[1]||"domain"===N.parts[1]||R.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(R)?k=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(R)&&(_=!0):_=!0,N.set(F)}z.add(t,nt,[t,L],nt,[t,E]),m.autosize&&(m=A(t,m)),(m.height||m.width||m.autosize)&&(w=!0);var st=Object.keys(m),lt=[D.previousPromises];if(_||w)lt.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),P.plot(t,"",g)});else if(st.length&&(D.supplyDefaults(t),v=t._fullLayout,y&<.push(function(){return q.draw(t),D.previousPromises(t)}),x&<.push(T),b&<.push(function(){return P.Axes.doTicks(t,"redraw"),S(t),D.previousPromises(t)}),k)){var ut;for(Z(t),P.Fx.supplyLayoutDefaults(t.layout,v,t._fullData),P.Fx.init(t),ut=D.getSubplotIds(v,"gl3d"),p=0;p1)};u(r.width)&&u(r.height)||s(new Error("Height and width should be pixel values."));var c=n.clone(e,{format:"png",height:r.height,width:r.width}),f=c.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var h=n.getRedrawFunc(f);a.plot(f,c.data,c.layout,c.config).then(h).then(l).then(function(e){t(e)}).catch(function(t){s(t)})});return s}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib");e.exports=n},{"../lib":257,"../plotly":277,"../snapshot":313,"fast-isnumeric":65}],276:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;v>m;m++){var y=r[m],b=["data",m];if(p(y)){var x=c[m],_=x.type,w=s.traces[_].attributes;w.type={valType:"enumerated",values:[_]},x.visible===!1&&y.visible!==!1&&l.push(o("invisible",b)),n(y,x,w,l,b);var A=y.transforms,k=x.transforms;if(A){g(A)||l.push(o("array",b,["transforms"])),b.push("transforms");for(var M=0;Mu&&c>e&&(void 0===i[r]?a[f]=E.tickText(t,e):a[f]=s(t,e,String(i[r])),f++);return f=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{b(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function o(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a=e.x,s=t._tickround,l=new Date(a),u="";r&&t.hoverformat?i=o(t.hoverformat,a):t.tickformat?i=o(t.tickformat,a):(n&&(b(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=N(l):"m"===s?i=z(l):(a!==t._tmin||r||(u="
"+N(l)),"d"===s?i=D(l):"H"===s?i=F(l):(a!==t._tmin||r||(u="
"+D(l)+", "+N(l)),i=B(l),"M"!==s&&(i+=j(l),"S"!==s&&(i+=h(m(a/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>o?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=0>t,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat;if(n){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};a(c),o=(Number(c._tickround)||0)+4,l=c._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),f>t)t="0",i=!1;else{if(t+=f,l&&(t*=Math.pow(10,-l),o+=l),0===o)t=String(Math.floor(t));else if(0>o){t=String(Math.round(t)),t=t.substr(0,t.length+o);for(var h=o;0>h;h++)t+="0"}else{t=String(t);var d=t.indexOf(".")+1;d&&(t=t.substr(0,d+o).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(l&&"hide"!==s){var p;p=0>l?"\u2212"+-l:"power"!==s?"+"+l:String(l),"e"===s||("SI"===s||"B"===s)&&(l>12||-15>l)?t+="e"+p:"E"===s?t+="E"+p:"power"===s?t+="\xd710"+p+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},E.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var p=n-1,g=n+1;r="tozero"===t.rangemode?0>n?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r},E.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=E.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},E.saveRangeInitial=function(t,e){for(var r=E.list(t,"",!0),n=!1,i=0;ip&&(p=g/10),u=t.c2l(p),c=t.c2l(g),y&&(u=Math.min(0,u),c=Math.max(0,c)),n(u)){for(d=!0,o=0;o=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;6>a;a++)i(a);for(a=v-1;a>5;a--)i(a)}},E.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[a,o]};E.autoTicks(f,s);var h,d=E.tickIncrement(E.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;yg&&(p>.3*x||i(a)||i(o))){var w=f.dtick/2;d+=a>d+w?w:-w}var A=1+Math.floor((o-d)/f.dtick);h=d+A*f.dtick}else for(h=d;o>=h;)h=E.tickIncrement(h,f.dtick);return{start:d,end:h,size:f.dtick}},E.calcTicks=function(t){if("array"===t.tickmode)return n(t);if("auto"===t.tickmode||!t.dtick){var e,r=t.nticks;r||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/e):(e="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/e,4,9)+1)),E.autoTicks(t,Math.abs(t.range[1]-t.range[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),a(t),t._tmin=E.tickFirst(t);var i=t.range[1]=s:s>=l)&&(o.push(l),!(o.length>1e3));l=E.tickIncrement(l,t.dtick,i));t._tmax=o[o.length-1];for(var u=new Array(o.length),c=0;c157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,S)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,C)):e>432e5?(t.dtick=i(e,864e5,I),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,C):e>3e4?t.dtick=i(e,6e4,R):e>500?t.dtick=i(e,1e3,R):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var a=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(a)}},E.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?O:P,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},E.tickFirst=function(t){var e=t.range[1]n:n>u;)u=E.tickIncrement(u,i,e);return u}if("L"===c)return Math.log(r((Math.pow(10,n)-a)/f)*f+a)/Math.LN10;if("D"===c){var h="D2"===i?O:P,d=_.roundUp(m(n,1),h,e);return Math.floor(n)+Math.log(y.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var N=y.time.format("%Y"),z=y.time.format("%b %Y"),D=y.time.format("%b %-d"),F=y.time.format("%b %-d %Hh"),B=y.time.format("%H:%M"),j=y.time.format(":%S"),U=/%(\d?)f/g;E.tickText=function(t,e,r){function n(n){var i;return void 0===n?!0:r?"none"===n:(i={first:t._tmin,last:t._tmax}[n],"all"!==n&&e!==i)}var i,a,o=s(t,e),h="array"===t.tickmode,d=r||h;if(h&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(a=0;a1&&er&&(k=90),i(c,k)}u._lastangle=k}return o(e),e+" done"}function l(){u._boundingBox=r.node().getBoundingClientRect()}var c=r.selectAll("g."+C).data(L,S);if(!u.showticklabels||!b(n))return c.remove(),void o(e);var f,h,p,m,x;"x"===v?(x="bottom"===j?1:-1,f=function(t){return t.dx+N*x},m=n+(O+P)*x,h=function(t){return t.dy+m+t.fontSize*("bottom"===j?1:-.5)},p=function(t){return b(t)&&0!==t&&180!==t?0>t*x?"end":"start":"middle"}):(x="right"===j?1:-1,h=function(t){return t.dy+t.fontSize/2-N*x},f=function(t){return t.dx+n+(O+P+(90===Math.abs(u.tickangle)?t.fontSize/2:0))*x},p=function(t){return b(t)&&90===Math.abs(t)?"middle":"right"===j?"start":"end"});var A=0,k=0,E=[];c.enter().append("g").classed(C,1).append("text").attr("text-anchor","middle").each(function(e){var r=y.select(this),n=t._promises.length;r.call(M.setPosition,f(e),h(e)).call(M.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),n=t._promises[n],n?E.push(t._promises.pop().then(function(){i(r,u.tickangle)})):i(r,u.tickangle)}),c.exit().remove(),c.each(function(t){A=Math.max(A,t.fontSize)}),i(c,u._lastangle||u.tickangle);var T=_.syncOrAsync([a,s,l]);return T&&T.then&&t._promises.push(T),T}function o(e){if(!r){var n,i,a,o,s=T.getFromId(t,e),l=y.select(t).selectAll("g."+e+"tick"),u={selection:l,side:s.side},f=e.charAt(0),h=t._fullLayout._size,d=1.5,p=s.titlefont.size;if(l.size()){var g=y.select(l.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);g&&(u.offsetLeft=+g[1],u.offsetTop=+g[2])}"x"===f?(i="free"===s.anchor?{_offset:h.t+(1-(s.position||0))*h.h,_length:0}:T.getFromId(t,s.anchor),a=s._offset+s._length/2,o=i._offset+("top"===s.side?-10-p*(d+(s.showticklabels?1:0)):i._length+10+p*(d+(s.showticklabels?1.5:.5))),s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(o+=(c.height-c.margin.b-c.margin.t)*s.rangeslider.thickness+s._boundingBox.height),u.side||(u.side="bottom")):(i="free"===s.anchor?{_offset:h.l+(s.position||0)*h.w,_length:0}:T.getFromId(t,s.anchor),o=s._offset+s._length/2,a=i._offset+("right"===s.side?i._length+10+p*(d+(s.showticklabels?1:.5)):-10-p*(d+(s.showticklabels?.5:0))),n={rotate:"-90",offset:0},u.side||(u.side="left")),A.draw(t,e+"title",{propContainer:s,propName:s._name+".title",dfltName:f.toUpperCase()+" axis",avoid:u,transform:n,attributes:{x:a,y:o,"text-anchor":"middle"}})}}function s(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:x.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[v]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===v}function l(e,r,i){var a=e.gridlayer,o=e.zerolinelayer,l=e["hidegrid"+v]?[]:V,c=u._gridpath||"M0,0"+("x"===v?"v":"h")+r._length,f=a.selectAll("path."+R).data(u.showgrid===!1?[]:l,S);if(f.enter().append("path").classed(R,1).classed("crisp",1).attr("d",c).each(function(t){u.zeroline&&("linear"===u.type||"-"===u.type)&&Math.abs(t.x)g;g++){var y=u.mirrors[o._id+h[g]];"ticks"!==y&&"labels"!==y||(f[g]=!0)}return void 0!==n[2]&&(f[2]=!0),f.forEach(function(t,e){var r=n[e],i=U[e];t&&b(r)&&(d+=p(r+P*i,i*u.ticklen))}),i(r,d),l(e,o,t),a(r,n[3])}}).filter(function(t){return t&&t.then});return H.length?Promise.all(H):0},E.swap=function(t,e){for(var r=d(t,e),n=0;n2*n}function c(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var f=t("fast-isnumeric"),h=t("tinycolor2").mix,d=t("../../lib"),p=t("../plots"),g=t("../../components/color/attributes").lightFraction,v=t("./layout_attributes"),m=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),b=t("./tick_label_defaults"),x=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),A=t("./clean_datum"),k=t("./axis_ids");e.exports=function(t,e,r,i){function a(r,n){return d.coerce2(t,e,v,r,n)}var o=i.letter,s=i.font||{},l="Click to enter "+(i.title||o.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=k.name2id(i.name));var u=r("type");"-"===u&&(n(e,i.data),"-"===e.type?e.type="linear":u=t.type=e.type),_(e);var c=r("color"),p=c===t.color?c:s.color;r("title",l),d.coerceFont(r,"titlefont",{family:s.family,size:Math.round(1.2*s.size),color:p});var A=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),M=r("autorange",!A);M&&r("rangemode");var E=r("range",[-1,"x"===o?6:4]);E[0]===E[1]&&(e.range=[E[0]-1,E[0]+1]),d.noneOrAll(t.range,e.range,[0,1]),r("fixedrange"),m(t,e,r,u),b(t,e,r,u,i),y(t,e,r,i),x(t,e,r);var T=a("linecolor",c),L=a("linewidth"),S=r("showline",!!T||!!L);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&r("mirror");var C=a("gridcolor",h(c,i.bgColor,g).toRgbString()),R=a("gridwidth"),I=r("showgrid",i.showGrid||!!C||!!R);I||(delete e.gridcolor,delete e.gridwidth);var P=a("zerolinecolor",c),O=a("zerolinewidth"),N=r("zeroline",i.showGrid||!!P||!!O);return N||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===u?w(o,e.categoryorder,e.categoryarray,i.data):[],e}},{"../../components/color/attributes":175,"../../lib":257,"../plots":304,"./axis_ids":282,"./category_order_defaults":283,"./clean_datum":284,"./layout_attributes":289,"./ordered_categories":291,"./set_convert":294,"./tick_label_defaults":295,"./tick_mark_defaults":296,"./tick_value_defaults":297,"fast-isnumeric":65,tinycolor2:148}],282:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,a=[],o=0;o0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],284:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":257,"fast-isnumeric":65}],285:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],286:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?c.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/setcursor"),g=t("../../components/dragelement"),v=t("./axes"),m=t("./select"),y=t("./constants"),b=!0;e.exports=function(t,e,r,s,x,_,w,A){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+gt+")").attr("d",lt+"Z"),ht=dt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+gt+")").attr("d","M0,0Z"),T();for(var a=0;ai?(ct="",ot.r=ot.l,ot.t=ot.b,ht.attr("d","M0,0Z")):(ot.t=0,ot.b=q,ct="x",ht.attr("d","M"+(ot.l-.5)+","+(at-G-.5)+"h-3v"+(2*G+1)+"h3ZM"+(ot.r+.5)+","+(at-G-.5)+"h3v"+(2*G+1)+"h-3Z")):!$||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),b=!1)))}function R(e,r){var i=1===(w+A).length;if(e)z();else if(2!==r||i){if(1===r&&i){var a=w?U[0]:j[0],o="s"===w||"w"===A?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",h="middle";if(a.fixedrange)return;w?(h="n"===w?"top":"bottom","right"===a.side&&(c="right")):"e"===A&&(c="right"),et.call(f.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var r="category"===a.type?a.c2l(e):a.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else N()}function I(e){function r(t,e,r){if(!t.fixedrange){M(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||F._enablescrollzoom){var n=t.querySelector(".plotly");if(!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(mt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void c.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=vt[0]+vt[2]*l,f=(s.bottom-e.clientY)/s.height,h=vt[1]+vt[3]*(1-f);if(A){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function i(t,e,r){for(var i=1-e,a=0,o=0;o0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nE;E++){var T=a[E],L=d[T];if(L)k[E]=w.getFromId(t,L.xaxis._id),M[E]=w.getFromId(t,L.yaxis._id);else{var S=o[T]._subplot;k[E]=S.xaxis,M[E]=S.yaxis}}var C=e.hovermode||o.hovermode;if(-1===["x","y","closest"].indexOf(C)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var R,I,P,O,N,z,D,F,B,j,U,V,q=[],H=[];if(Array.isArray(e))for(C="array",P=0;PG||G>Y.width||0>X||X>Y.height)return _.unhoverRaw(t,e)}else G="xpx"in e?e.xpx:k[0]._length/2,X="ypx"in e?e.ypx:M[0]._length/2;if(R="xval"in e?n(a,e.xval):i(k,G),I="yval"in e?n(a,e.yval):i(M,X),!g(R[0])||!g(I[0]))return v.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(O=0;O1||-1!==z.hoverinfo.indexOf("name")?z.name:void 0,index:!1,distance:Math.min(W,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},V=q.length,"array"===F){var Z=e[O];"pointNumber"in Z?(U.index=Z.pointNumber,F="closest"):(F="","xval"in Z&&(B=Z.xval,F="x"),"yval"in Z&&(j=Z.yval,F=F?"closest":"y"))}else B=R[D],j=I[D];if(z._module&&z._module.hoverPoints){var Q=z._module.hoverPoints(U,B,j,F);if(Q)for(var $,K=0;KV&&(q.splice(0,V),W=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var J="y"===C&&H.length>1;q.sort(function(t,e){return t.distance-e.distance});var tt=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),et={hovermode:C,rotateLabels:J,bgColor:tt,container:o._hoverlayer,outerContainer:o._paperdiv},rt=u(q,et);c(q,J?"xa":"ya"),f(rt,J);var nt=t._hoverdata,it=[];for(P=0;P128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):M&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0; +r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*I):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),O=T.width+R+I+v;t.ty0=_-T.top,t.bx=T.width+2*I,t.by=T.height+2*I,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=k>=S+P/2+O,A=S-P/2-O>=0,"top"!==t.idealAlign&&m||!A?m?(S+=P/2,t.anchor="start"):t.anchor="middle":(S-=P/2,t.anchor="end")):(t.pos=S,m=w>=L+C/2+O,A=L-C/2-O>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,a=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(.01>a)){if(-.01>i){for(s=t.length-1;s>=0;s--)t[s].dp-=a;n=!1}if(n){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(0>=u);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=u);o++)if(l=t[o],l.pos=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(0>=u);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?L:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(R+I),s=o+a*(t.txwidth+I),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*S),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*R+l)+","+(R+u)+"v"+(t.by/2-R)+"h"+n*t.bx+"v-"+t.by+"H"+(n*R+l)+"V"+(u-R)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+I).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*I+l,u+t.ty0-t.by/2+I),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),k=t("./dragbox"),M=e.exports={};M.unhover=_.unhover,M.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},M.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,M.layoutAttributes,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=M.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},M.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},M.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},M.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indext*e||0===t?A.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":176,"../../components/dragelement":197,"../../components/drawing":199,"../../lib":257,"../../lib/events":253,"../../lib/svg_text_utils":270,"./axes":280,"./constants":285,"./dragbox":286,d3:62,"fast-isnumeric":65,tinycolor2:148}],288:[function(t,e,r){"use strict";var n=t("../plots"),i=t("./constants");r.name="cartesian",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex=i.idRegex,r.attrRegex=i.attrRegex,r.attributes=t("./attributes"),r.plot=function(t){function e(t,e){for(var r=[],n=0;nf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":257,"fast-isnumeric":65}],293:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.x()._offset,y=i.plotinfo.y()._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,k=i.xaxes[0]._length,M=i.yaxes[0]._length,E=i.xaxes.map(n),T=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,R,I,P,O,N=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),z=[],D=i.gd,F=[];for(C=0;C0)return Math.log(e)/Math.LN10;if(0>=e&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*c*Math.abs(n-i))}return o.BADNUM}function r(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):o.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?r:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var n=l.getFromId(t._gd,t.overlaying);t.domain=n.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)i(t.range[e])||(t.range[e]=i(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):o.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):o.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?a.ms2DateTime(t):o.BADNUM},t.d2c=function(t){return i(t)?Number(t):a.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(a.dateTime2ms);!i(t.range[0])&&i(f[0])&&(t.range[0]=f[0]),!i(t.range[1])&&i(f[1])&&(t.range[1]=f[1])}catch(h){a.error(h,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var r=t._categories.indexOf(e);return-1===r?o.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;ad;++d){for(e=u[d],r=t[this.scene[e]._name],n=/Click to enter .+ title/.test(r.title)?"":r.title,p=0;2>=p;p+=2)this.labelEnable[d+p]=!1,this.labels[d+p]=o(n),this.labelColor[d+p]=s(r.titlefont.color),this.labelFont[d+p]=r.titlefont.family,this.labelSize[d+p]=r.titlefont.size,this.labelPad[d+p]=this.getLabelPad(e,r),this.tickEnable[d+p]=!1,this.tickColor[d+p]=s((r.tickfont||{}).color),this.tickAngle[d+p]="auto"===r.tickangle?0:Math.PI*-r.tickangle/180,this.tickPad[d+p]=this.getTickPad(r),this.tickMarkLength[d+p]=0,this.tickMarkWidth[d+p]=r.tickwidth||0,this.tickMarkColor[d+p]=s(r.tickcolor),this.borderLineEnable[d+p]=!1,this.borderLineColor[d+p]=s(r.linecolor),this.borderLineWidth[d+p]=r.linewidth||0;c=this.hasSharedAxis(r),a=this.hasAxisInDfltPos(e,r)&&!c,l=this.hasAxisInAltrPos(e,r)&&!c,i=r.mirror||!1,f=c?-1!==String(i).indexOf("all"):!!i,h=c?"allticks"===i:-1!==String(i).indexOf("ticks"),a?this.labelEnable[d]=!0:l&&(this.labelEnable[d+2]=!0),a?this.tickEnable[d]=r.showticklabels:l&&(this.tickEnable[d+2]=r.showticklabels),(a||f)&&(this.borderLineEnable[d]=r.showline),(l||f)&&(this.borderLineEnable[d+2]=r.showline),(a||h)&&(this.tickMarkLength[d]=this.getTickMarkLength(r)),(l||h)&&(this.tickMarkLength[d+2]=this.getTickMarkLength(r)),this.gridLineEnable[d]=r.showgrid,this.gridLineColor[d]=s(r.gridcolor),this.gridLineWidth[d]=r.gridwidth,this.zeroLineEnable[d]=r.zeroline,this.zeroLineColor[d]=s(r.zerolinecolor),this.zeroLineWidth[d]=r.zerolinewidth}},l.hasSharedAxis=function(t){var e=this.scene,r=a.Plots.getSubplotIds(e.fullLayout,"gl2d"),n=a.Axes.findSubplotsWithAxis(r,t);return 0!==n.indexOf(e.id)},l.hasAxisInDfltPos=function(t,e){var r=e.side;return"xaxis"===t?"bottom"===r:"yaxis"===t?"left"===r:void 0},l.hasAxisInAltrPos=function(t,e){var r=e.side;return"xaxis"===t?"top"===r:"yaxis"===t?"right"===r:void 0},l.getLabelPad=function(t,e){var r=1.5,n=e.titlefont.size,i=e.showticklabels;return"xaxis"===t?"top"===e.side?-10+n*(r+(i?1:0)):-10+n*(r+(i?.5:0)):"yaxis"===t?"right"===e.side?10+n*(r+(i?1:.5)):10+n*(r+(i?.5:0)):void 0},l.getTickPad=function(t){return"outside"===t.ticks?10+t.ticklen:15},l.getTickMarkLength=function(t){if(!t.ticks)return 0;var e=t.ticklen;return"inside"===t.ticks?-e:e},e.exports=i},{"../../lib/html2unicode":256,"../../lib/str2rgbarray":269,"../../plotly":277}],301:[function(t,e,r){"use strict";var n=t("./scene2d"),i=t("../plots"),a=t("../../constants/xmlns_namespaces");r.name="gl2d",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex={x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},r.attrRegex={x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},r.attributes=t("../cartesian/attributes"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,a=i.getSubplotIds(e,"gl2d"),o=0;or;++r){var n=t[r],i=e[r];if(n.length!==i.length)return!0;for(var a=0;ao;++o,--s)for(var l=0;r>l;++l)for(var u=0;4>u;++u){var c=i[4*(r*o+l)+u];i[4*(r*o+l)+u]=i[4*(r*s+l)+u],i[4*(r*s+l)+u]=c}var f=document.createElement("canvas");f.width=r,f.height=n;var h=f.getContext("2d"),d=h.createImageData(r,n);d.data.set(i),h.putImageData(d,0,0);var p;switch(t){case"jpeg":p=f.toDataURL("image/jpeg");break;case"webp":p=f.toDataURL("image/webp");break;default:p=f.toDataURL("image/png")}return this.staticPlot&&this.container.removeChild(a),p},m.computeTickMarks=function(){this.xaxis._length=this.glplot.viewBox[2]-this.glplot.viewBox[0],this.yaxis._length=this.glplot.viewBox[3]-this.glplot.viewBox[1];for(var t=[s.calcTicks(this.xaxis),s.calcTicks(this.yaxis)],e=0;2>e;++e)for(var r=0;r_;++_)g[_]=Math.min(g[_],x.bounds[_]),g[_+2]=Math.max(g[_+2],x.bounds[_+2]);for(y=0;2>y;++y)g[y]>g[y+2]&&(g[y]=-1,g[y+2]=1),m=this[v[y]],m._length=f.viewBox[y+2]-f.viewBox[y],s.doAutoRange(m);f.ticks=this.computeTickMarks();var w=this.xaxis.range,A=this.yaxis.range;f.dataBox=[w[0],A[0],w[1],A[1]],f.merge(r),n.update(f),this.glplot.draw()},m.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);t:for(r=0;r=e.width-20?(a["text-anchor"]="start",a.x=5):(a["text-anchor"]="end",a.x=e._paper.attr("width")-7),r.attr(a);var o=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&i(t,o),s.text(o.text()&&u.text()?" - ":"")},d.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=d.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},d.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},i=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];d.supplyLayoutGlobalDefaults(i,n),n._dataLength=l.length,d.supplyDataDefaults(l,s,n),n._has=d._hasPlotType.bind(n);var u=n._modules;for(e=0;ea&&(e=(r-1)/(i.l+i.r),i.l=Math.floor(e*i.l),i.r=Math.floor(e*i.r)),0>o&&(e=(n-1)/(i.t+i.b),i.t=Math.floor(e*i.t),i.b=Math.floor(e*i.b))}},d.autoMargin=function(t,e,r){var n=t._fullLayout;if(n._pushmargin||(n._pushmargin={}),n.margin.autoexpand!==!1){if(r){var i=void 0===r.pad?12:r.pad;r.l+r.r>.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||d.doAutoMargin(t)}},d.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;return e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,t._replotting||"{}"===n||n===JSON.stringify(e._size)?void 0:c.plot(t)},d.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):t&&t.getTime?f.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&d.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)}},{"../components/color":176,"../lib":257,"../plotly":277,"./attributes":278,"./font_attributes":298,"./layout_attributes":303,d3:62,"fast-isnumeric":65}],305:[function(t,e,r){"use strict";var n=t("../../traces/scatter/attributes"),i=n.marker;e.exports={r:n.r,t:n.t,marker:{color:i.color,size:i.size,symbol:i.symbol,opacity:i.opacity}}},{"../../traces/scatter/attributes":342}],306:[function(t,e,r){"use strict";function n(t,e){var r={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return a({},e,r)}var i=t("../cartesian/layout_attributes"),a=t("../../lib/extend").extendFlat,o=a({},i.domain,{});e.exports={radialaxis:n("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:o,orientation:{valType:"number"}}),angularaxis:n("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:o}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":254,"../cartesian/layout_attributes":289}],307:[function(t,e,r){var n=t("../../plotly"),i=t("d3"),a=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},o=n.Lib.extendDeepAll;a.Axis=function(){function t(t){r=t||r;var u=l.data,f=l.layout;return("string"==typeof r||r.nodeName)&&(r=i.select(r)),r.datum(u).each(function(t,r){function l(t,e){return s(t)%360+f.orientation}var u=t.slice();c={data:a.util.cloneJson(u),layout:a.util.cloneJson(f)};var h=0;u.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[h],h=(h+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:i.rgb(t.color).darker().toString()),c.data[e].color=t.color,c.data[e].strokeColor=t.strokeColor,c.data[e].strokeDash=t.strokeDash,c.data[e].strokeSize=t.strokeSize});var d=u.filter(function(t,e){var r=t.visible;return"undefined"==typeof r||r===!0}),p=!1,g=d.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var v=i.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(g),m=[],y=v.map(function(t,e){if("unstacked"===t.key)return t.values;var r=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,n){t.yStack=[r],m.push(r),r=a.util.sumArrays(t.r,r)}),t.values});d=i.merge(y)}d.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var b=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;b=Math.max(10,b);var x,_=[f.margin.left+b,f.margin.top+b];if(p){var w=i.max(a.util.sumArrays(a.util.arrayLast(d).r[0],a.util.arrayLast(m)));x=[0,w]}else x=i.extent(a.util.flattenArray(d.map(function(t,e){return t.r})));f.radialAxis.domain!=a.DATAEXTENT&&(x[0]=0),n=i.scale.linear().domain(f.radialAxis.domain!=a.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:x).range([0,b]),c.layout.radialAxis.domain=n.domain();var A,k=a.util.flattenArray(d.map(function(t,e){return t.t})),M="string"==typeof k[0];M&&(k=a.util.deduplicate(k),A=k.slice(),k=i.range(k.length),d=d.map(function(t,e){var r=t;return t.t=[k],p&&(r.yStack=t.yStack),r}));var E=d.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===d.length,T=null===f.needsEndSpacing?M||!E:f.needsEndSpacing,L=f.angularAxis.domain&&f.angularAxis.domain!=a.DATAEXTENT&&!M&&f.angularAxis.domain[0]>=0,S=L?f.angularAxis.domain:i.extent(k),C=Math.abs(k[1]-k[0]);E&&!M&&(C=0);var R=S.slice();T&&M&&(R[1]+=C);var I=f.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),f.angularAxis.ticksStep&&(I=(R[1]-R[0])/I);var P=f.angularAxis.ticksStep||(R[1]-R[0])/(I*(f.minorTicks+1));A&&(P=Math.max(Math.round(P),1)),R[2]||(R[2]=P);var O=i.range.apply(this,R);if(O=O.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=i.scale.linear().domain(R.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=T?C:0,e=i.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",z=(new DOMParser).parseFromString(N,"application/xml"),D=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));e=i.select(D)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,B=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=a.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});a.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},a.Legend.defaultConfig().legendConfig,{container:F,elements:V,reverseOrder:f.legend.reverseOrder})})();var q=F.node().getBBox();b=Math.min(f.width-q.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],n.range([0,b]),c.layout.radialAxis.domain=n.domain(),F.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),B.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(f.width-(f.margin.left+f.margin.right+2*b+(q?q.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(H[0]=Math.max(0,H[0]),H[1]=Math.max(0,H[1]),e.select(".outer-group").attr("transform","translate("+H+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(n.ticks(5));W.enter().append("circle").attr({"class":"grid-circle"}).style(j),W.attr("r",n),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(j);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=i.svg.axis().scale(n).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(j),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(O),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(j),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?270>r&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(180>=r&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=i.max(B.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=n,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=i.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return o(a[r].defaultConfig(),t)});a[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=a.tooltipPanel().config({container:ut,fontSize:8})(),ft=a.tooltipPanel().config({container:ut,fontSize:8})(),ht=a.tooltipPanel().config({container:ut,hasTick:!0})();if(!M){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});B.on("mousemove.angular-guide",function(t,e){var r=a.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=a.util.convertToCartesian(b+12,r+180);ct.text(a.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});B.on("mousemove.radial-guide",function(t,e){var r=a.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=n.invert(a.util.getMousePos(Z).radius);var i=a.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(a.util.round(st)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var n=i.select(this),o=n.style("fill"),s="black",l=n.style("opacity")||1;if(n.attr({"data-opacity":l}),"none"!=o){n.attr({"data-fill":o}),s=i.hsl(o).darker().toString(),n.style({fill:s,opacity:1});var u={t:a.util.round(t[0]),r:a.util.round(t[1])};M&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-H[0]-h.left,f.top+f.height/2-H[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else o=n.style("stroke"),n.attr({"data-stroke":o}),s=i.hsl(o).darker().toString(),n.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=i.event.which?!1:void(i.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.hide();var r=i.select(this),n=r.attr("data-fill");n?r.style({fill:n,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),h}var e,r,n,s,l={data:[],layout:{}},u={},c={},f=i.dispatch("hover"),h={};return h.render=function(e){return t(e),this},h.config=function(t){if(!arguments.length)return l;var e=a.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),o(l.data[e],a.Axis.defaultConfig().data[0]),o(l.data[e],t)}),o(l.layout,a.Axis.defaultConfig().layout),o(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return n},h.angularScale=function(t){return s},h.svg=function(){return e},i.rebind(h,f,"on"),h},a.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:i.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0, +tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return r},a.util={},a.DATAEXTENT="dataExtent",a.AREA="AreaChart",a.LINE="LinePlot",a.DOT="DotPlot",a.BAR="BarChart",a.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},a.util._extend=function(t,e){for(var r in t)e[r]=t[r]},a.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},a.util.dataFromEquation2=function(t,e){var r=e||6,n=i.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return n},a.util.dataFromEquation=function(t,e,r){var n=e||6,a=[],o=[];i.range(0,360+n,n).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},a.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return i.range(e).map(function(t,e){return r[e]||r[0]})},a.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=a.util.ensureArray(t[e],r)}),t},a.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},a.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},a.util.sumArrays=function(t,e){return i.zip(t,e).map(function(t,e){return i.sum(t)})},a.util.arrayLast=function(t){return t[t.length-1]},a.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},a.util.flattenArray=function(t){for(var e=[];!a.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},a.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},a.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},a.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},a.util.getMousePos=function(t){var e=i.mouse(t.node()),r=e[0],n=e[1],a={};return a.x=r,a.y=n,a.pos=e,a.angle=180*(Math.atan2(n,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+n*n),a},a.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;a>i;i++)e=t[i],e in r?(r[e]++,n[e]=r[e]):r[e]=1;return n},a.util.duplicates=function(t){return Object.keys(a.util.duplicatesCount(t))},a.util.translator=function(t,e,r,n){if(n){var i=r.slice();r=e,e=i}var a=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof a&&(e.reduce(function(t,r,n){return"undefined"!=typeof t?(n===e.length-1&&delete t[r],t[r]):void 0},t),r.reduce(function(t,e,n){return"undefined"==typeof t[e]&&(t[e]={}),n===r.length-1&&(t[e]=a),t[e]},t))},a.PolyChart=function(){function t(){var t=r[0].geometryConfig,e=t.container;"string"==typeof e&&(e=i.select(e)),e.datum(r).each(function(e,r){function n(e,r){var n=t.radialScale(e[1]),i=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:n,t:i}}function a(t){var e=t.r*Math.cos(t.t),r=t.r*Math.sin(t.t);return{x:e,y:r}}var o=!!e[0].data.yStack,l=e.map(function(t,e){return o?i.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):i.zip(t.data.t[0],t.data.r[0])}),u=t.angularScale,c=t.radialScale.domain()[0],f={};f.bar=function(r,n,a){var o=e[a].data,s=t.radialScale(r[1])-t.radialScale(0),l=t.radialScale(r[2]||0),c=o.barWidth;i.select(this).attr({"class":"mark bar",d:"M"+[[s+l,-c/2],[s+l,c/2],[l,c/2],[l,-c/2]].join("L")+"Z",transform:function(e,r){return"rotate("+(t.orientation+u(e[0]))+")"}})},f.dot=function(t,r,o){var s=t[2]?[t[0],t[1]+t[2]]:t,l=i.svg.symbol().size(e[o].data.dotSize).type(e[o].data.dotType)(t,r);i.select(this).attr({"class":"mark dot",d:l,transform:function(t,e){var r=a(n(s));return"translate("+[r.x,r.y]+")"}})};var h=i.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(r,n,a){var o=r[2]?l[a].map(function(t,e){return[t[0],t[1]+t[2]]}):l[a];if(i.select(this).each(f.dot).style({opacity:function(t,r){return+e[a].data.dotVisible},fill:v.stroke(r,n,a)}).attr({"class":"mark dot"}),!(n>0)){var s=i.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({"class":"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,n,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,n,a)},"stroke-width":function(t,e){return v["stroke-width"](r,n,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,n,a)},opacity:function(t,e){return v.opacity(r,n,a)},display:function(t,e){return v.display(r,n,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=i.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,n){i.select(this).attr({"class":"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=i.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({"class":"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[a.PolyChart.defaultConfig()],n=i.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),o(r[e],a.PolyChart.defaultConfig()),o(r[e],t)}),this):r},t.getColorScale=function(){return e},i.rebind(t,n,"on"),t},a.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:i.scale.category20()}};return t},a.BarChart=function(){return a.PolyChart()},a.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},a.AreaChart=function(){return a.PolyChart()},a.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},a.DotPlot=function(){return a.PolyChart()},a.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},a.LinePlot=function(){return a.PolyChart()},a.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},a.Legend=function(){function t(){var r=e.legendConfig,n=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=o({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),a=i.merge(n);a=a.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(a=a.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=i.select(s));var l=a.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof a[0]:r.isContinuous,f=c?r.height:u*a.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=i.range(a.length),v=i.scale[c?"linear":"ordinal"]().domain(g).range(l),m=i.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=i.svg.symbolTypes.indexOf(t)?i.svg.symbol().type(t).size(r)():i.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(a);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=i.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return a[e].name}),t}var e=a.Legend.defaultConfig(),r=i.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},i.rebind(t,r,"on"),t},a.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},a.tooltipPanel=function(){var t,e,r,n={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+a.tooltipPanel.uid++,l=10,u=function(){t=n.container.selectAll("g."+s).data([0]);var i=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return r=i.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=i.append("text").attr({dx:n.padding+l,dy:.3*+n.fontSize}),u};return u.text=function(a){var o=i.hsl(n.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":n.fontSize+"px"}).text(f);var h=n.padding,d=e.node().getBBox(),p={fill:n.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[n.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u):void 0},u.hide=function(){return t?(t.style({display:"none"}),u):void 0},u.show=function(){return t?(t.style({display:"block"}),u):void 0},u.config=function(t){return o(n,t),u},u},a.tooltipPanel.uid=1,a.adapter={},a.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=o({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){a.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var n=a.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var i=n.indexOf(t.geometry);-1!=i&&(r.data[e].groupId=i)})}if(t.layout){var s=o({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){a.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};i.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../plotly":277,"./micropolar_manager":308,d3:62}],308:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("d3"),a=t("./undo_manager"),o=e.exports={},s=n.Lib.extendDeepAll;o.framework=function(t){function e(e,a){return a&&(f=a),i.select(i.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?s(r,e):e,u||(u=n.micropolar.Axis()),c=n.micropolar.adapter.plotly().convert(r),u.config(c).render(f),t.data=r.data,t.layout=r.layout,o.fillLayout(t),r}var r,l,u,c,f,h=new a;return e.isPolar=!0,e.svg=function(){return u.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return n.micropolar.adapter.plotly().convert(u.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:u.angularScale(),r:u.radialScale()}},e.setUndoPoint=function(){var t=this,e=n.micropolar.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,l),l=n.micropolar.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},o.fillLayout=function(t){var e=i.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:n.Color.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=s(o,t.layout)}},{"../../plotly":277,"./undo_manager":309,d3:62}],309:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return n-1}var a=t("../plotly"),o=a.Lib.extendFlat,s=a.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,l=t.data,u=t.layout,c=s([],l),f=s({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;rr;r++)e=f[r],d[r]=e[0]*(t.zmax-t.zmin)+t.zmin,p[r]=e[1];var g=n.extent([t.zmin,t.zmax,a.start,a.start+l*(u-1)]),v=g[t.zminr;r++)e=f[r],d[r]=(e[0]*(u+c-1)-c/2)*l+o,p[r]=e[1];var y=n.scale.linear().interpolate(n.interpolateRgb).domain(d).range(p);return y}},{"../../components/colorscale/get_scale":188,d3:62}],322:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i){var a,o=r("contours.coloring");"fill"===o&&(a=r("contours.showlines")),a!==!1&&("lines"!==o&&r("line.color","#000"),r("line.width",.5),r("line.dash")),r("line.smoothing"),"none"!==(e.contours||{}).coloring&&n(t,e,i,r,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":186}],323:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.type="contourgl",this.name="",this.hoverinfo="all",this.xData=[],this.yData=[],this.zData=[],this.textLabels=[],this.idToIndex=[],this.bounds=[0,0,0,0],this.contourOptions={z:new Float32Array(0),x:[],y:[],shape:[0,0],levels:[0],levelColors:[0,0,0,1],lineWidth:1},this.contour=s(t.glplot,this.contourOptions),this.contour._trace=this,this.heatmapOptions={z:new Float32Array(0),x:[],y:[],shape:[0,0],colorLevels:[0],colorValues:[0,0,0,0]},this.heatmap=l(t.glplot,this.heatmapOptions),this.heatmap._trace=this}function i(t,e,r){for(var n=new Float32Array(e*r),i=0,a=0;e>a;a++)for(var o=0;r>o;o++)n[i++]=t[o][a];return n}function a(t,e){for(var r=t.contours,n=r.start,i=r.end,a=r.size||1,o=e.fill,s=c(t),l=Math.floor((i-n)/a)+(o?2:1),u=new Array(l),h=new Array(4*l),d=0;l>d;d++)for(var p=u[d]=n+a*d-(o?a/2:0),g=f(s(p)),v=0;4>v;v++)h[4*d+v]=g[v];return{levels:u,levelColors:h}}function o(t,e,r){var i=new n(t,e.uid);return i.update(e,r),i}var s=t("gl-contour2d"),l=t("gl-heatmap2d"),u=t("../../plots/cartesian/axes"),c=t("../contour/make_color_map"),f=t("../../lib/str2rgbarray"),h=n.prototype;h.handlePick=function(t){var e=t.pointId,r=this.heatmapOptions,n=r.shape;return{trace:this,dataCoord:t.dataCoord,traceCoord:[r.x[e%n[0]],r.y[Math.floor(e/n[0])],r.z[e]],textLabel:this.textLabels[e],name:this.name,hoverinfo:this.hoverinfo}},h.update=function(t,e){var r=e[0];this.name=t.name,this.hoverinfo=t.hoverinfo;var n,o=r.z,s=o[0].length,l=o.length;this.contourOptions.z=i(o,s,l),this.heatmapOptions.z=[].concat.apply([],o),this.contourOptions.shape=this.heatmapOptions.shape=[s,l],this.contourOptions.x=this.heatmapOptions.x=r.x,this.contourOptions.y=this.heatmapOptions.y=r.y,"fill"===t.contours.coloring?(n=a(t,{fill:!0}),this.contourOptions.levels=n.levels.slice(1),this.contourOptions.fillColors=n.levelColors,this.contourOptions.levelColors=[].concat.apply([],this.contourOptions.levels.map(function(){return[.25,.25,.25,1]}))):(n=a(t,{fill:!1}),this.contourOptions.levels=n.levels,this.contourOptions.levelColors=n.levelColors),this.textLabels=[].concat.apply([],t.text),this.contour.update(this.contourOptions),this.heatmap.update(this.heatmapOptions),u.expand(this.scene.xaxis,r.x),u.expand(this.scene.yaxis,r.y)},h.dispose=function(){this.contour.dispose(),this.heatmap.dispose()},e.exports=o},{"../../lib/str2rgbarray":269,"../../plots/cartesian/axes":280,"../contour/make_color_map":321,"gl-contour2d":67,"gl-heatmap2d":73}],324:[function(t,e,r){"use strict";var n={};n.attributes=t("../contour/attributes"),n.supplyDefaults=t("../contour/defaults"),n.colorbar=t("../contour/colorbar"),n.calc=t("../contour/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="contourgl",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","2dMap"],n.meta={},e.exports=n},{"../../plots/gl2d":301,"../contour/attributes":317,"../contour/calc":318,"../contour/colorbar":319,"../contour/defaults":320,"./convert":323}],325:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat;e.exports=a({},{z:{valType:"data_array"},x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:{valType:"data_array"},transpose:{valType:"boolean",dflt:!1},xtype:{valType:"enumerated",values:["array","scaled"]},ytype:{valType:"enumerated",values:["array","scaled"]},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1},connectgaps:{valType:"boolean",dflt:!1},_nestedModules:{colorbar:"Colorbar"}},i,{autocolorscale:a({},i.autocolorscale,{dflt:!1})})},{"../../components/colorscale/attributes":182,"../../lib/extend":254,"../scatter/attributes":342}],326:[function(t,e,r){"use strict";function n(t){function e(t){ +return u(t)?+t:void 0}var r,n,i,a,o,s,l=t.z;if(t.transpose){for(r=0,o=0;oo;o++)for(n=i(l,o),c[o]=new Array(n),s=0;n>s;s++)c[o][s]=e(a(l,o,s));return c}function i(t,e,r,n,i,a){var o,s,l,u=[],c=h.traceIs(t,"contour"),f=h.traceIs(t,"histogram"),d=h.traceIs(t,"gl2d"),p=Array.isArray(e)&&e.length>1;if(p&&!f&&"category"!==a.type){e=e.map(a.d2c);var g=e.length;if(!(i>=g))return c?e.slice(0,i):e.slice(0,i+1);if(c||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;g>l;l++)u.push(.5*(e[l-1]+e[l]));u.push(1.5*e[g-1]-.5*e[g-2])}if(i>g){var v=u[u.length-1],m=v-u[u.length-2];for(l=g;i>l;l++)v+=m,u.push(v)}}else for(s=n||1,o=f||"category"===a.type?r||0:Array.isArray(e)&&1===e.length?e[0]:void 0===r?0:a.d2c(r),l=c||d?0:-.5;i>l;l++)u.push(o+s*l);return u}function a(t){return.5-.25*Math.min(1,.5*t)}function o(t,e,r){var n,i,o=1;if(Array.isArray(r))for(n=0;nn&&o>y;n++)o=l(t,e,a(o));return o>y&&c.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},f=[],h=t[0],d=[],p=[0,0,0],g=m(t);for(r=0;rn;n++)void 0===d[n]&&(o=(void 0!==d[n-1]?1:0)+(void 0!==d[n+1]?1:0)+(void 0!==e[n]?1:0)+(void 0!==h[n]?1:0),o?(0===r&&o++,0===n&&o++,r===t.length-1&&o++,n===d.length-1&&o++,4>o&&(c[[r,n]]=[r,n,o]),u.push([r,n,o])):f.push([r,n]));for(;f.length;){for(s={},l=!1,a=f.length-1;a>=0;a--)i=f[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],f.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,f,h,d,p,g,v=0;for(o=0;os;s++)l=b[s],u=t[i+l[0]],u&&(c=u[a+l[1]],void 0!==c&&(0===h?p=g=c:(p=Math.min(p,c),g=Math.max(g,c)),f++,h+=c));if(0===f)throw"iterateInterp2d order is wrong: no defined neighbors";t[i][a]=h/f,void 0===d?4>f&&(v=1):(t[i][a]=(1+r)*t[i][a]-r*d,g>p&&(v=Math.max(v,Math.abs(t[i][a]-d)/(g-p))))}return v}var u=t("fast-isnumeric"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../../plots/plots"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),v=t("./convert_column_xyz"),m=t("./max_row_length");e.exports=function(t,e){function r(t){L=e._input.zsmooth=e.zsmooth=!1,c.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,b,x,_,w,A=f.getFromId(t,e.xaxis||"x"),k=f.getFromId(t,e.yaxis||"y"),M=h.traceIs(e,"contour"),E=h.traceIs(e,"histogram"),T=h.traceIs(e,"gl2d"),L=M?"best":e.zsmooth;if(A._minDtick=0,k._minDtick=0,E){var S=d(t,e);a=S.x,l=S.x0,u=S.dx,y=S.y,b=S.y0,x=S.dy,_=S.z}else g(e)&&v(e,A,k),a=e.x?A.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(M||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===L)if("log"===A.type||"log"===k.type)r("log axis found");else if(!E){if(a.length){var C=(a[a.length-1]-a[0])/(a.length-1),R=Math.abs(C/100);for(w=0;wR){r("x scale is not linear");break}}if(y.length&&"fast"===L){var I=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(I/100);for(w=0;wP){r("y scale is not linear");break}}}var O=m(_),N="scaled"===e.xtype?"":e.x,z=i(e,N,l,u,O,A),D="scaled"===e.ytype?"":e.y,F=i(e,D,b,x,_.length,k);T||(f.expand(A,z),f.expand(k,F));var B={x:z,y:F,z:_};if(p(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j="contour"===e.type?"heatmap":"histogram2d";B.xfill=i(j,N,l,u,O,A),B.yfill=i(j,D,b,x,_.length,k)}return[B]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":183,"../../lib":257,"../../plots/cartesian/axes":280,"../../plots/plots":304,"../histogram2d/calc":339,"./convert_column_xyz":328,"./has_columns":330,"./max_row_length":331,"fast-isnumeric":65}],327:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u="cb"+r.uid,c=s(r.colorscale),f=r.zmin,h=r.zmax;if(i(f)||(f=a.aggNums(Math.min,null,r.z)),i(h)||(h=a.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+u).remove(),!r.showscale)return void o.autoMargin(t,u);var d=e[0].t.cb=l(t,u);d.fillcolor(n.scale.linear().domain(c.map(function(t){return f+t[0]*(h-f)})).range(c.map(function(t){return t[1]}))).filllevels({start:f,end:h,size:(h-f)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":179,"../../components/colorscale/get_scale":188,"../../lib":257,"../../plots/plots":304,d3:62,"fast-isnumeric":65}],328:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(ui;i++)a[i]=e.d2c(a[i]),o[i]=r.d2c(o[i]);var f,h,d,p=n.distinctVals(a),g=p.vals,v=n.distinctVals(o),m=v.vals,y=n.init2dArray(m.length,g.length);for(c&&(d=n.init2dArray(m.length,g.length)),i=0;u>i;i++)f=n.findBin(a[i]+p.minDiff/2,g),h=n.findBin(o[i]+v.minDiff/2,m),y[h][f]=s[i],c&&(d[h][f]=l[i]);t.x=g,t.y=m,t.z=y,c&&(t.text=d)}},{"../../lib":257}],329:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./has_columns"),a=t("./xyz_defaults"),o=t("../../components/colorscale/defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function u(r,i){return n.coerce(t,e,s,r,i)}var c=a(t,e,u);return c?(u("text"),u("zsmooth"),u("connectgaps",i(e)&&e.zsmooth!==!1),void o(t,e,l,u,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":186,"../../lib":257,"./attributes":325,"./has_columns":330,"./xyz_defaults":332}],330:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],331:[function(t,e,r){"use strict";e.exports=function(t){for(var e=0,r=0;r0&&(n=!0);for(var s=0;ss;s++){var u=e[s],c=l(u[1]);a[s]=r+u[0]*(n-r);for(var f=0;4>f;f++)o[4*s+f]=c[f]}return{colorLevels:a,colorValues:o}}function a(t,e,r){var i=new n(t,e.uid);return i.update(e,r),i}var o=t("gl-heatmap2d"),s=t("../../plots/cartesian/axes"),l=t("../../lib/str2rgbarray"),u=n.prototype;u.handlePick=function(t){var e=t.pointId,r=this.options.shape;return{trace:this,dataCoord:t.dataCoord,traceCoord:[this.options.x[e%r[0]],this.options.y[Math.floor(e/r[0])],this.options.z[e]],textLabel:this.textLabels[e],name:this.name,hoverinfo:this.hoverinfo}},u.update=function(t,e){var r=e[0];this.name=t.name,this.hoverinfo=t.hoverinfo;var n=r.z;this.options.z=[].concat.apply([],n);var a=n[0].length,o=n.length;this.options.shape=[a,o],this.options.x=r.x,this.options.y=r.y;var l=i(t);this.options.colorLevels=l.colorLevels,this.options.colorValues=l.colorValues,this.textLabels=[].concat.apply([],t.text),this.heatmap.update(this.options),s.expand(this.scene.xaxis,r.x),s.expand(this.scene.yaxis,r.y)},u.dispose=function(){this.heatmap.dispose()},e.exports=a},{"../../lib/str2rgbarray":269,"../../plots/cartesian/axes":280,"gl-heatmap2d":73}],335:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("../heatmap/defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("../heatmap/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="heatmapgl",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","2dMap"],n.meta={},e.exports=n},{"../../plots/gl2d":301,"../heatmap/calc":326,"../heatmap/colorbar":327,"../heatmap/defaults":329,"./attributes":333,"./convert":334}],336:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=t.length,n=0,i=0;r>i;i++)e[i]?(t[i]/=e[i],n+=t[i]):t[i]=null;return n}},{}],337:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports={count:function(t,e,r){return r[t]++,1},sum:function(t,e,r,i){var a=i[e];return n(a)?(a=Number(a),r[t]+=a,a):0},avg:function(t,e,r,i,a){var o=i[e];return n(o)&&(o=Number(o),r[t]+=o,a[t]++),0},min:function(t,e,r,i){var a=i[e];if(n(a)){if(a=Number(a),!n(r[t]))return r[t]=a,a;if(r[t]>a)return r[t]=a,a-r[t]}return 0},max:function(t,e,r,i){var a=i[e];if(n(a)){if(a=Number(a),!n(r[t]))return r[t]=a,a;if(r[t]i;i++)t[i]*=n},probability:function(t,e){for(var r=t.length,n=0;r>n;n++)t[n]/=e},density:function(t,e,r,n){var i=t.length;n=n||1;for(var a=0;i>a;a++)t[a]*=r[a]*n},"probability density":function(t,e,r,n){var i=t.length;n&&(e/=n);for(var a=0;i>a;a++)t[a]*=r[a]/e}}},{}],339:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("../histogram/bin_functions"),o=t("../histogram/norm_functions"),s=t("../histogram/average");e.exports=function(t,e){var r,l,u,c,f,h,d=i.getFromId(t,e.xaxis||"x"),p=e.x?d.makeCalcdata(e,"x"):[],g=i.getFromId(t,e.yaxis||"y"),v=e.y?g.makeCalcdata(e,"y"):[],m=Math.min(p.length,v.length);p.length>m&&p.splice(m,p.length-m),v.length>m&&v.splice(m,v.length-m),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(p,d,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(v,g,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),f=[];var y,b,x=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,A="string"==typeof e.xbins.size?[]:e.ybins,k=0,M=[],E=e.histnorm,T=e.histfunc,L=-1!==E.indexOf("density"),S="max"===T||"min"===T,C=S?null:0,R=a.count,I=o[E],P=!1,O=[],N=[],z="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";z&&"count"!==T&&(P="avg"===T,R=a[T]);var D=e.xbins,F=D.end+(D.start-i.tickIncrement(D.start,D.size))/1e6;for(h=D.start;F>h;h=i.tickIncrement(h,D.size))x.push(C),Array.isArray(w)&&w.push(h),P&&_.push(0);Array.isArray(w)&&w.push(h);var B=x.length;for(r=e.xbins.start,l=(h-r)/B,r+=l/2,D=e.ybins,F=D.end+(D.start-i.tickIncrement(D.start,D.size))/1e6,h=D.start;F>h;h=i.tickIncrement(h,D.size))f.push(x.concat()),Array.isArray(A)&&A.push(h),P&&M.push(_.concat());Array.isArray(A)&&A.push(h);var j=f.length;for(u=e.ybins.start,c=(h-u)/j,u+=c/2,L&&(O=x.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/l}),N=f.map(function(t,e){return Array.isArray(A)?1/(A[e+1]-A[e]):1/c})),h=0;m>h;h++)y=n.findBin(p[h],w),b=n.findBin(v[h],A),y>=0&&B>y&&b>=0&&j>b&&(k+=R(y,h,f[b],z,M[b]));if(P)for(b=0;j>b;b++)k+=s(f[b],M[b]);if(I)for(b=0;j>b;b++)I(f[b],k,O,N[b]);return{x:p,x0:r,dx:l,y:v,y0:u,dy:c,z:f}}},{"../../lib":257,"../../plots/cartesian/axes":280,"../histogram/average":336,"../histogram/bin_functions":337,"../histogram/norm_functions":338}],340:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var a=r.marker.line.width||0;Array.isArray(a)&&(a=a[e.i]||0),t.style({"stroke-width":a,fill:e.color}).call(n.stroke,i)}},{"../../components/color":176}],341:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var i=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(i.color,t,"mlc"),n.mergeArray(i.width,t,"mlw")}}},{"../../lib":257}],342:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/drawing"),a=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:a({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:a({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":184,"../../components/drawing":199,"../../lib/extend":254,"./constants":347}],343:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("./subtypes"),s=t("./colorscale_calc");e.exports=function(t,e){var r,l,u,c=i.getFromId(t,e.xaxis||"x"),f=i.getFromId(t,e.yaxis||"y"),h=c.makeCalcdata(e,"x"),d=f.makeCalcdata(e,"y"),p=Math.min(h.length,d.length);c._minDtick=0,f._minDtick=0,h.length>p&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;p>u;u++)x[u]=n(h[u])&&n(d[u])?{x:h[u],y:d[u]}:{x:!1,y:!1};return void 0!==typeof l&&a.mergeArray(l,x,"ms"),t.firstscatter=!1,x}},{"../../lib":257,"../../plots/cartesian/axes":280,"./colorscale_calc":346,"./subtypes":361,"fast-isnumeric":65}],344:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i,a;for(e=0;e=0;i--)if(a=t[i],"scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}},{}],345:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void o.autoMargin(t,c);var f=s(u.colorscale),h=u.color,d=u.cmin,p=u.cmax;i(d)||(d=a.aggNums(Math.min,null,h)),i(p)||(p=a.aggNums(Math.max,null,h));var g=e[0].t.cb=l(t,c);g.fillcolor(n.scale.linear().domain(f.map(function(t){return d+t[0]*(p-d)})).range(f.map(function(t){return t[1]}))).filllevels({start:d,end:p,size:(p-d)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":179,"../../components/colorscale/get_scale":188,"../../lib":257,"../../plots/plots":304,d3:62,"fast-isnumeric":65}],346:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("./subtypes");e.exports=function(t){a.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),a.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":183,"../../components/colorscale/has_colorscale":189,"./subtypes":361}],347:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],348:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=P>=U&&(C=L[E-1][0],R=L[E][0],S=C+(R-C)*(U-I)/(P-I),D=Math.min(D,S),F=Math.max(F,S));D=Math.max(D,0),F=Math.min(F,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:D,x1:F,y0:U,y1:U,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":176,"../../components/errorbars":205,"../../lib":257,"../../plots/cartesian/constants":285,"../../plots/cartesian/graph_interact":287,"./get_trace_color":350}],352:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":288,"./arrays_to_calcdata":341,"./attributes":342,"./calc":343,"./clean_data":344,"./colorbar":345,"./defaults":348,"./hover":351,"./plot":358,"./select":359,"./style":360,"./subtypes":361}],353:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":186,"../../components/colorscale/has_colorscale":189}],354:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=A.c2p(t[e].y);return r===L||n===L?!1:[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*M}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,k=e.connectGaps,M=e.baseTolerance,E=e.linear,T=[],L=n.BADNUM,S=.2,C=new Array(t.length),R=0;for(o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):m>y&&(m=y,c=f,d=!0)}if(d?(C[R++]=u,l!==c&&(C[R++]=c)):(c!==s&&(C[R++]=c),l!==u&&(C[R++]=u)),C[R++]=l,o>=t.length||!f)break;C[R++]=f,s=f}}else C[R++]=u}T.push(C.slice(0,R))}return T}},{"../../plots/cartesian/axes":280}],355:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],356:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t){var e=t.marker,r=e.sizeref||1,i=e.sizemin||0,a="area"===e.sizemode?function(t){return Math.sqrt(t/r)}:function(t){return t/r};return function(t){var e=a(t/2);return n(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":65}],357:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":176,"../../components/colorscale/defaults":186,"../../components/colorscale/has_colorscale":189,"./subtypes":361}],358:[function(t,e,r){"use strict";function n(t,e,r){var n=e.x(),a=e.y(),o=i.extent(n.range.map(n.l2c)),s=i.extent(a.range.map(a.l2c));r.forEach(function(t,e){var n=t[0].trace;if(u.hasMarkers(n)){var i=n.marker.maxdisplayed;if(0!==i){var a=t.filter(function(t){return t.x>=o[0]&&t.x<=o[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(a.length/i),c=0;r.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&e>r&&c++});var f=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),a.forEach(function(t,e){0===Math.round((e+f)%l)&&(t.vis=!0)})}}})}var i=t("d3"),a=t("../../lib"),o=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,r){function h(t){return t.filter(function(t){return t.vis})}n(t,e,r);var d=e.x(),p=e.y(),g=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(r);g.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),g.call(s.plot,e);var v,m,y,b,x="",_=[];g.each(function(t){var e=t[0].trace,r=e.line,n=i.select(this);if(e.visible===!0&&(m=e.fill.charAt(e.fill.length-1),"x"!==m&&"y"!==m&&(m=""),t[0].node3=n,c(t),u.hasLines(e)||"none"!==e.fill)){var a,s,h,g,w,A="",k="";v="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!x?n.append("path").classed("js-fill",!0):null,b&&(y=b.datum(t)),b=n.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(r.shape)?(h=o.steps(r.shape),g=o.steps(r.shape.split("").reverse().join(""))):h=g="spline"===r.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?o.smoothclosed(t.slice(1),r.smoothing):o.smoothopen(t,r.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return g(t.reverse())};var M,E=f(t,{xaxis:d,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(r.width||1,3)/4,linear:"linear"===r.shape}),T=e._polygons=new Array(E.length);for(M=0;M1&&n.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",a)}v?L&&C&&(m?("y"===m?L[1]=C[1]=p.c2p(0,!0):"x"===m&&(L[0]=C[0]=d.c2p(0,!0)),v.attr("d",A+"L"+C+"L"+L+"Z")):v.attr("d",A+"Z")):"tonext"===e.fill.substr(0,6)&&A&&x&&("tonext"===e.fill?y.attr("d",A+"Z"+x+"Z"):y.attr("d",A+"L"+x.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),x=k,_=T}}}),g.selectAll("path:not([d])").remove(),g.append("g").attr("class","points").each(function(t){var e=t[0].trace,r=i.select(this),n=u.hasMarkers(e),s=u.hasText(e);!n&&!s||e.visible!==!0?r.remove():(n&&r.selectAll("path.point").data(e.marker.maxdisplayed?h:a.identity).enter().append("path").classed("point",!0).call(o.translatePoints,d,p),s&&r.selectAll("g").data(e.marker.maxdisplayed?h:a.identity).enter().append("g").append("text").call(o.translatePoints,d,p))})}},{"../../components/drawing":199,"../../components/errorbars":205,"../../lib":257,"../../lib/polygon":263,"./arrays_to_calcdata":341,"./line_points":354,"./subtypes":361,d3:62}],359:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;ra;++a)n[a]=t(a>=e.length?i:e[a]);return n}function o(t,e,r){return l(S(t,r),L(e,r),r)}function s(t,e,r,n){var i=x(t,e,n);return i=Array.isArray(i[0])?i:a(v.identity,[i],n),l(i,L(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;r>i;++i){for(var a=0;3>a;++a)n[4*i+a]=t[i][a];n[4*i+3]=t[i][3]*e[i]}return n}function u(t,e){if(void 0===Float32Array.slice){for(var r=new Float32Array(e),n=0;e>n;n++)r[n]=t[n];return r}return t.slice(0,e)}function c(t,e){var r=new n(t,e.uid);return r.update(e),r}var f=t("gl-scatter2d"),h=t("gl-scatter2d-fancy"),d=t("gl-line2d"),p=t("gl-error2d"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../plots/cartesian/axes"),y=t("../../components/errorbars"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/subtypes"),w=t("../scatter/make_bubble_size_func"),A=t("../scatter/get_trace_color"),k=t("../../constants/gl_markers"),M=t("../../constants/gl2d_dashes"),E=["xaxis","yaxis"],T=n.prototype;T.handlePick=function(t){var e=t.pointId;return(t.object!==this.line||this.connectgaps)&&(e=this.idToIndex[t.pointId]),{trace:this,dataCoord:t.dataCoord,traceCoord:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:Array.isArray(this.color)?this.color[e]:this.color,name:this.name,hoverinfo:this.hoverinfo}},T.isFancy=function(t){if("linear"!==this.scene.xaxis.type)return!0;if("linear"!==this.scene.yaxis.type)return!0;if(!t.x||!t.y)return!0;if(this.hasMarkers){var e=t.marker||{};if(Array.isArray(e.symbol)||"circle"!==e.symbol||Array.isArray(e.size)||Array.isArray(e.color)||Array.isArray(e.line.width)||Array.isArray(e.line.color)||Array.isArray(e.opacity))return!0}return this.hasLines&&!this.connectgaps?!0:this.hasErrorX?!0:!!this.hasErrorY};var L=i.bind(null,function(t){return+t}),S=i.bind(null,b),C=i.bind(null,function(t){return k[t]||"\u25cf"});T.update=function(t){t.visible!==!0?(this.hasLines=!1,this.hasErrorX=!1,this.hasErrorY=!1,this.hasMarkers=!1):(this.hasLines=_.hasLines(t),this.hasErrorX=t.error_x.visible===!0,this.hasErrorY=t.error_y.visible===!0,this.hasMarkers=_.hasMarkers(t)),this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.connectgaps=!!t.connectgaps,this.isFancy(t)?this.updateFancy(t):this.updateFast(t),this.color=A(t,{})},T.updateFast=function(t){for(var e,r,n=this.xData=this.pickXData=t.x,i=this.yData=this.pickYData=t.y,a=n.length,o=new Array(a),s=new Float32Array(2*a),l=this.bounds,c=0,f=0,h=0;a>h;++h)e=n[h],r=i[h],g(e)&&g(r)&&(o[c++]=h,s[f++]=e,s[f++]=r,l[0]=Math.min(l[0],e),l[1]=Math.min(l[1],r),l[2]=Math.max(l[2],e),l[3]=Math.max(l[3],r));s=u(s,f),this.idToIndex=o,this.updateLines(t,s),this.updateError("X",t),this.updateError("Y",t);var d;if(this.hasMarkers){this.scatterOptions.positions=s;var p=b(t.marker.color),v=b(t.marker.line.color),m=t.opacity*t.marker.opacity;p[3]*=m,this.scatterOptions.color=p,v[3]*=m,this.scatterOptions.borderColor=v,d=t.marker.size,this.scatterOptions.size=d,this.scatterOptions.borderSize=t.marker.line.width,this.scatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions),this.expandAxesFast(l,d)},T.updateFancy=function(t){var e=this.scene,r=e.xaxis,n=e.yaxis,a=this.bounds,o=this.pickXData=r.makeCalcdata(t,"x").slice(),l=this.pickYData=n.makeCalcdata(t,"y").slice();this.xData=o.slice(),this.yData=l.slice();var c,f,h,d,p,g,v,m,b=y.calcFromTrace(t,e.fullLayout),x=o.length,_=new Array(x),A=new Float32Array(2*x),k=new Float32Array(4*x),M=new Float32Array(4*x),E=0,T=0,S=0,R=0,I="log"===r.type?function(t){return r.d2l(t)}:function(t){return t},P="log"===n.type?function(t){return n.d2l(t)}:function(t){return t};for(c=0;x>c;++c)this.xData[c]=h=I(o[c]),this.yData[c]=d=P(l[c]),isNaN(h)||isNaN(d)||(_[E++]=c,A[T++]=h,A[T++]=d,p=k[S++]=h-b[c].xs||0,g=k[S++]=b[c].xh-h||0,k[S++]=0,k[S++]=0,M[R++]=0,M[R++]=0,v=M[R++]=d-b[c].ys||0,m=M[R++]=b[c].yh-d||0,a[0]=Math.min(a[0],h-p),a[1]=Math.min(a[1],d-v),a[2]=Math.max(a[2],h+g),a[3]=Math.max(a[3],d+m));A=u(A,T),this.idToIndex=_,this.updateLines(t,A),this.updateError("X",t,A,k),this.updateError("Y",t,A,M);var O;if(this.hasMarkers){this.scatterOptions.positions=A,this.scatterOptions.sizes=new Array(E),this.scatterOptions.glyphs=new Array(E),this.scatterOptions.borderWidths=new Array(E),this.scatterOptions.colors=new Array(4*E),this.scatterOptions.borderColors=new Array(4*E);var N,z=w(t),D=t.marker,F=D.opacity,B=t.opacity,j=s(D,F,B,x),U=C(D.symbol,x),V=L(D.line.width,x),q=s(D.line,F,B,x);for(O=i(z,D.size,x),c=0;E>c;++c)for(N=_[c],this.scatterOptions.sizes[c]=4*O[N],this.scatterOptions.glyphs[c]=U[N],this.scatterOptions.borderWidths[c]=.5*V[N],f=0;4>f;++f)this.scatterOptions.colors[4*c+f]=j[4*N+f],this.scatterOptions.borderColors[4*c+f]=q[4*N+f];this.fancyScatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions),this.expandAxesFancy(o,l,O)},T.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var i=0,a=this.xData,s=this.yData;for(n=new Float32Array(2*a.length),r=0;ro;o++)r=this.scene[E[o]],n=r._min,n||(n=[]),n.push({val:t[o],pad:a}),i=r._max,i||(i=[]),i.push({val:t[o+2],pad:a})},T.expandAxesFancy=function(t,e,r){var n=this.scene,i={padded:!0,ppad:r};m.expand(n.xaxis,t,i),m.expand(n.yaxis,e,i)},T.dispose=function(){this.line.dispose(),this.errorX.dispose(),this.errorY.dispose(),this.scatter.dispose(),this.fancyScatter.dispose()},e.exports=c},{"../../components/errorbars":205,"../../constants/gl2d_dashes":245,"../../constants/gl_markers":246,"../../lib":257,"../../lib/gl_format_color":255,"../../lib/str2rgbarray":269,"../../plots/cartesian/axes":280,"../scatter/get_trace_color":350,"../scatter/make_bubble_size_func":356,"../scatter/subtypes":361,"fast-isnumeric":65,"gl-error2d":70,"gl-line2d":77,"gl-scatter2d":92,"gl-scatter2d-fancy":87}],367:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),a=t("../scatter/subtypes"),o=t("../scatter/xy_defaults"),s=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),u=t("../scatter/fillcolor_defaults"),c=t("../../components/errorbars/defaults"),f=t("./attributes");e.exports=function(t,e,r,h){function d(r,i){return n.coerce(t,e,f,r,i)}var p=o(t,e,d);return p?(d("text"),d("mode",p_inline_52_arg0_||255>_inline_52_arg1_||255>_inline_52_arg2_||255>_inline_52_arg3_){var _inline_52_l=_inline_52_arg4_-_inline_52_arg6_[0],_inline_52_a=_inline_52_arg5_-_inline_52_arg6_[1],_inline_52_f=_inline_52_l*_inline_52_l+_inline_52_a*_inline_52_a;_inline_52_f_inline_49_arg0_||255>_inline_49_arg1_||255>_inline_49_arg2_||255>_inline_49_arg3_){var _inline_49_l=_inline_49_arg4_-_inline_49_arg6_[0],_inline_49_a=_inline_49_arg5_-_inline_49_arg6_[1],_inline_49_f=_inline_49_l*_inline_49_l+_inline_49_a*_inline_49_a;_inline_49_ft.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var f=!0;"depth"in n&&(f=!!n.depth);var h=!1;return"stencil"in n&&(h=!!n.stencil),new c(t,e,r,l,s,f,h,i)}var d=t("gl-texture2d");e.exports=h;var p,g,v,m,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t=0|t,f(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t=0|t,f(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;en;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;3>r;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function o(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function a(t,e,r,n,i,o){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=o,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}function s(t){var e=t.gl||t.scene&&t.scene.gl,r=g(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var n=v(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=l(e),o=u(e,[{buffer:i,size:3,offset:0,stride:48},{buffer:i,size:3,offset:12,stride:48},{buffer:i,size:1,offset:24,stride:48},{buffer:i,size:1,offset:28,stride:48},{buffer:i,size:4,offset:32,stride:48}]),s=d(new Array(1024),[256,1,4]),f=0;1024>f;++f)s.data[f]=255;var h=c(e,s);h.wrap=e.REPEAT;var p=new a(e,r,n,i,o,h);return p.update(t),p}e.exports=s;var l=t("gl-buffer"),u=t("gl-vao"),c=t("gl-texture2d"),f=t("glsl-read-float"),h=t("binary-search-bounds"),d=t("ndarray"),p=t("./lib/shaders"),g=p.createShader,v=p.createPickShader,m=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],y=a.prototype;y.isTransparent=function(){return this.opacity<1},y.isOpaque=function(){return this.opacity>=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||m,view:t.view||m,projection:t.projection||m,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||m,view:t.view||m,projection:t.projection||m,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var o=t.position||t.positions;if(o){var a=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],f=0,p=0,g=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],v=!1;t:for(e=1;er;++r){if(isNaN(m[r])||isNaN(y[r])||!isFinite(m[r])||!isFinite(y[r])){if(!i&&l.length>0){for(var b=0;24>b;++b)l.push(l[l.length-12]);p+=2,v=!0}continue t}g[0][r]=Math.min(g[0][r],m[r],y[r]),g[1][r]=Math.max(g[1][r],m[r],y[r])}var x,_;Array.isArray(a[0])?(x=a[e-1],_=a[e]):x=_=a,3===x.length&&(x=[x[0],x[1],x[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var A=f;if(f+=n(m,y),v){for(r=0;2>r;++r)l.push(m[0],m[1],m[2],y[0],y[1],y[2],A,w,x[0],x[1],x[2],x[3]);p+=2,v=!1}l.push(m[0],m[1],m[2],y[0],y[1],y[2],A,w,x[0],x[1],x[2],x[3],m[0],m[1],m[2],y[0],y[1],y[2],A,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],m[0],m[1],m[2],f,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],m[0],m[1],m[2],f,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),u.push(f),c.push(o[o.length-1].slice()),this.bounds=g,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var M=t.dashes,k=M.slice();for(k.unshift(0),e=1;ee;++e){for(r=0;4>r;++r)T.set(e,0,r,0);1&h.le(k,k[k.length-1]*e/255)?T.set(e,0,0,0):T.set(e,0,0,255)}this.texture.setPixels(T)}}},y.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()},y.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=f(t.value[0],t.value[1],t.value[2],0),r=h.le(this.arcLength,e);if(0>r)return null;if(r===this.arcLength.length-1)return new o(this.arcLength[this.arcLength.length-1],this.points[this.points.length-1].slice(),r);for(var n=this.points[r],i=this.points[Math.min(r+1,this.points.length-1)],a=(e-this.arcLength[r])/(this.arcLength[r+1]-this.arcLength[r]),s=1-a,l=[0,0,0],u=0;3>u;++u)l[u]=s*n[u]+a*i[u];var c=Math.min(.5>a?r:r+1,this.points.length-1);return new o(e,l,c,this.points[c])}},{"./lib/shaders":109,"binary-search-bounds":111,"gl-buffer":105,"gl-texture2d":188,"gl-vao":192,"glsl-read-float":112,ndarray:219}],111:[function(t,e,r){arguments[4][9][0].apply(r,arguments)},{dup:9}],112:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,o[0]}e.exports=n;var i=new Uint8Array(4),o=new Float32Array(i.buffer)},{}],113:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=c*a-s*u,h=-c*o+s*l,d=u*o-a*l,p=r*f+n*h+i*d;return p?(p=1/p,t[0]=f*p,t[1]=(-c*n+i*u)*p,t[2]=(s*n-i*a)*p,t[3]=h*p,t[4]=(c*r-i*l)*p,t[5]=(-s*r+i*o)*p,t[6]=d*p,t[7]=(-u*r+n*l)*p,t[8]=(a*r-n*o)*p,t):null}e.exports=n},{}],114:[function(t,e,r){function n(t){var e=new Float32Array(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}e.exports=n},{}],115:[function(t,e,r){function n(){var t=new Float32Array(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],116:[function(t,e,r){function n(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],f=t[10],h=t[11],d=t[12],p=t[13],g=t[14],v=t[15],m=e*a-r*o,y=e*s-n*o,b=e*l-i*o,x=r*s-n*a,_=r*l-i*a,w=n*l-i*s,A=u*p-c*d,M=u*g-f*d,k=u*v-h*d,T=c*g-f*p,E=c*v-h*p,L=f*v-h*g;return m*L-y*E+b*T+x*k-_*M+w*A}e.exports=n},{}],117:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,f=n*s,h=i*a,d=i*s,p=i*l,g=o*a,v=o*s,m=o*l;return t[0]=1-f-p,t[1]=c+m,t[2]=h-v,t[3]=0,t[4]=c-m,t[5]=1-u-p,t[6]=d+g,t[7]=0,t[8]=h+v,t[9]=d-g,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],118:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,u=o+o,c=n*s,f=n*l,h=n*u,d=i*l,p=i*u,g=o*u,v=a*s,m=a*l,y=a*u;return t[0]=1-(d+g),t[1]=f+y,t[2]=h-m,t[3]=0,t[4]=f-y,t[5]=1-(c+g),t[6]=p+v,t[7]=0,t[8]=h+m,t[9]=p-v,t[10]=1-(c+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}e.exports=n},{}],119:[function(t,e,r){function n(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],120:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=e[9],h=e[10],d=e[11],p=e[12],g=e[13],v=e[14],m=e[15],y=r*s-n*a,b=r*l-i*a,x=r*u-o*a,_=n*l-i*s,w=n*u-o*s,A=i*u-o*l,M=c*g-f*p,k=c*v-h*p,T=c*m-d*p,E=f*v-h*g,L=f*m-d*g,S=h*m-d*v,C=y*S-b*L+x*E+_*T-w*k+A*M;return C?(C=1/C,t[0]=(s*S-l*L+u*E)*C,t[1]=(i*L-n*S-o*E)*C,t[2]=(g*A-v*w+m*_)*C,t[3]=(h*w-f*A-d*_)*C,t[4]=(l*T-a*S-u*k)*C,t[5]=(r*S-i*T+o*k)*C,t[6]=(v*x-p*A-m*b)*C,t[7]=(c*A-h*x+d*b)*C,t[8]=(a*L-s*T+u*M)*C,t[9]=(n*T-r*L-o*M)*C,t[10]=(p*w-g*x+m*y)*C,t[11]=(f*x-c*w-d*y)*C,t[12]=(s*k-a*E-l*M)*C,t[13]=(r*E-n*k+i*M)*C,t[14]=(g*b-p*_-v*y)*C,t[15]=(c*_-f*b+h*y)*C,t):null}e.exports=n},{}],121:[function(t,e,r){function n(t,e,r,n){var o,a,s,l,u,c,f,h,d,p,g=e[0],v=e[1],m=e[2],y=n[0],b=n[1],x=n[2],_=r[0],w=r[1],A=r[2];return Math.abs(g-_)<1e-6&&Math.abs(v-w)<1e-6&&Math.abs(m-A)<1e-6?i(t):(f=g-_,h=v-w,d=m-A,p=1/Math.sqrt(f*f+h*h+d*d),f*=p,h*=p,d*=p,o=b*d-x*h,a=x*f-y*d,s=y*h-b*f,p=Math.sqrt(o*o+a*a+s*s),p?(p=1/p,o*=p,a*=p,s*=p):(o=0,a=0,s=0),l=h*s-d*a,u=d*o-f*s,c=f*a-h*o,p=Math.sqrt(l*l+u*u+c*c),p?(p=1/p,l*=p,u*=p,c*=p):(l=0,u=0,c=0),t[0]=o,t[1]=l,t[2]=f,t[3]=0,t[4]=a,t[5]=u,t[6]=h,t[7]=0,t[8]=s,t[9]=c,t[10]=d,t[11]=0,t[12]=-(o*g+a*v+s*m),t[13]=-(l*g+u*v+c*m),t[14]=-(f*g+h*v+d*m),t[15]=1,t)}var i=t("./identity");e.exports=n},{"./identity":119}],122:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],f=e[8],h=e[9],d=e[10],p=e[11],g=e[12],v=e[13],m=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*f+w*g,t[1]=b*i+x*l+_*h+w*v,t[2]=b*o+x*u+_*d+w*m,t[3]=b*a+x*c+_*p+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*f+w*g,t[5]=b*i+x*l+_*h+w*v,t[6]=b*o+x*u+_*d+w*m,t[7]=b*a+x*c+_*p+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*f+w*g,t[9]=b*i+x*l+_*h+w*v,t[10]=b*o+x*u+_*d+w*m,t[11]=b*a+x*c+_*p+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*f+w*g,t[13]=b*i+x*l+_*h+w*v,t[14]=b*o+x*u+_*d+w*m,t[15]=b*a+x*c+_*p+w*y,t}e.exports=n},{}],123:[function(t,e,r){function n(t,e,r,n,i){var o=1/Math.tan(e/2),a=1/(n-i);return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t}e.exports=n},{}],124:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w,A,M,k,T,E,L=n[0],S=n[1],C=n[2],P=Math.sqrt(L*L+S*S+C*C);return Math.abs(P)<1e-6?null:(P=1/P,L*=P,S*=P,C*=P,i=Math.sin(r),o=Math.cos(r),a=1-o,s=e[0],l=e[1],u=e[2],c=e[3],f=e[4],h=e[5],d=e[6],p=e[7],g=e[8],v=e[9],m=e[10],y=e[11],b=L*L*a+o,x=S*L*a+C*i,_=C*L*a-S*i,w=L*S*a-C*i,A=S*S*a+o,M=C*S*a+L*i,k=L*C*a+S*i,T=S*C*a-L*i,E=C*C*a+o,t[0]=s*b+f*x+g*_,t[1]=l*b+h*x+v*_,t[2]=u*b+d*x+m*_,t[3]=c*b+p*x+y*_,t[4]=s*w+f*A+g*M,t[5]=l*w+h*A+v*M,t[6]=u*w+d*A+m*M,t[7]=c*w+p*A+y*M,t[8]=s*k+f*T+g*E,t[9]=l*k+h*T+v*E,t[10]=u*k+d*T+m*E,t[11]=c*k+p*T+y*E,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}e.exports=n},{}],125:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],f=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=a*i+c*n,t[6]=s*i+f*n,t[7]=l*i+h*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=f*i-s*n,t[11]=h*i-l*n,t}e.exports=n},{}],126:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],f=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=a*i-c*n,t[2]=s*i-f*n,t[3]=l*i-h*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+f*i,t[11]=l*n+h*i,t}e.exports=n},{}],127:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],f=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*n,t[1]=a*i+c*n,t[2]=s*i+f*n,t[3]=l*i+h*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=f*i-s*n,t[7]=h*i-l*n,t}e.exports=n},{}],128:[function(t,e,r){function n(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}e.exports=n},{}],129:[function(t,e,r){function n(t,e,r){var n,i,o,a,s,l,u,c,f,h,d,p,g=r[0],v=r[1],m=r[2];return e===t?(t[12]=e[0]*g+e[4]*v+e[8]*m+e[12],t[13]=e[1]*g+e[5]*v+e[9]*m+e[13],t[14]=e[2]*g+e[6]*v+e[10]*m+e[14],t[15]=e[3]*g+e[7]*v+e[11]*m+e[15]):(n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],f=e[8],h=e[9],d=e[10],p=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=f,t[9]=h,t[10]=d,t[11]=p,t[12]=n*g+s*v+f*m+e[12],t[13]=i*g+l*v+h*m+e[13],t[14]=o*g+u*v+d*m+e[14],t[15]=a*g+c*v+p*m+e[15]),t}e.exports=n},{}],130:[function(t,e,r){function n(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}e.exports=n},{}],131:[function(t,e,r){"use strict";function n(t,e){for(var r=[0,0,0,0],n=0;4>n;++n)for(var i=0;4>i;++i)r[i]+=t[4*n+i]*e[n];return r}function i(t,e,r,i,o){for(var a=n(i,n(r,n(e,[t[0],t[1],t[2],1]))),s=0;3>s;++s)a[s]/=a[3];return[.5*o[0]*(1+a[0]),.5*o[1]*(1-a[1])]}function o(t,e){if(2===t.length){for(var r=0,n=0,i=0;2>i;++i)r+=Math.pow(e[i]-t[0][i],2),n+=Math.pow(e[i]-t[1][i],2);return r=Math.sqrt(r),n=Math.sqrt(n),1e-6>r+n?[1,0]:[n/(r+n),r/(n+r)]}if(3===t.length){var o=[0,0];return u(t[0],t[1],t[2],e,o),l(t,o)}return[]}function a(t,e){for(var r=[0,0,0],n=0;na;++a)r[a]+=o*i[a];return r}function s(t,e,r,n,s,l){if(1===t.length)return[0,t[0].slice()];for(var u=new Array(t.length),c=0;cp;++p)d+=Math.pow(u[c][p]-e[p],2);h>d&&(h=d,f=c)}for(var g=o(u,e),v=0,c=0;3>c;++c){if(g[c]<-.001||g[c]>1.0001)return null;v+=g[c]}return Math.abs(v-1)>.001?null:[f,a(t,g),g]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:134,"polytope-closest-point/lib/closest_point_2d.js":136}],132:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n f_data = position;\n f_uv = uv;\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",f="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}",h="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",d="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:o,fragment:a,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:f,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:h,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],133:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w,A,M,k,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=o,this.pointPickShader=a,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=h,this.triangleUVs=f,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=v,this.edgeUVs=m,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=A,this.pointIds=x,this.pointVAO=M,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=I,this._view=I,this._projection=I,this._resolution=[1,1]}function i(t){for(var e=M({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;256>n;++n){for(var i=e[n],o=0;3>o;++o)r[4*n+o]=i[o];r[4*n+3]=255*i[3]}return A(r,[256,256,4],[4,0,1])}function o(t,e,r){for(var n=new Array(e),i=0;e>i;++i)n[i]=0;for(var o=t.length,i=0;o>i;++i)for(var a=t[i],s=0;sn;++n)r[n]=t[n][2];return r}function s(t){var e=v(t,S);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function l(t){var e=v(t,C);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function u(t){var e=v(t,P);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=v(t,R);return e.attributes.position.location=0,e.attributes.id.location=1,e}function f(t){var e=v(t,N);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function h(t){var e=v(t,z);return e.attributes.position.location=0,e}function d(t){var e=t.gl,r=s(e),i=l(e),o=u(e),a=c(e),d=f(e),p=h(e),g=b(e,A(new Uint8Array([255,255,255,255]),[1,1,4]));g.generateMipmap(),g.minFilter=e.LINEAR_MIPMAP_LINEAR,g.magFilter=e.LINEAR;var v=m(e),x=m(e),_=m(e),w=m(e),M=m(e),k=y(e,[{buffer:v,type:e.FLOAT,size:3},{buffer:M,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:x,type:e.FLOAT,size:4},{buffer:_,type:e.FLOAT,size:2},{buffer:w,type:e.FLOAT,size:3}]),T=m(e),E=m(e),L=m(e),S=m(e),C=y(e,[{buffer:T,type:e.FLOAT,size:3},{buffer:S,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:E,type:e.FLOAT,size:4},{buffer:L,type:e.FLOAT,size:2}]),P=m(e),R=m(e),N=m(e),z=m(e),I=m(e),O=y(e,[{buffer:P,type:e.FLOAT,size:3},{buffer:I,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:R,type:e.FLOAT,size:4},{buffer:N,type:e.FLOAT,size:2},{buffer:z,type:e.FLOAT,size:1}]),j=m(e),D=y(e,[{buffer:j,type:e.FLOAT,size:3}]),F=new n(e,g,r,i,o,a,d,p,v,M,x,_,w,k,T,S,E,L,C,P,I,R,N,z,O,j,D);return F.update(t),F}var p=1e-6,g=1e-6,v=t("gl-shader"),m=t("gl-buffer"),y=t("gl-vao"),b=t("gl-texture2d"),x=t("normals"),_=t("gl-mat4/multiply"),w=t("gl-mat4/invert"),A=t("ndarray"),M=t("colormap"),k=t("simplicial-complex-contour"),T=t("typedarray-pool"),E=t("./lib/shaders"),L=t("./lib/closest-point"),S=E.meshShader,C=E.wireShader,P=E.pointShader,R=E.pickShader,N=E.pointPickShader,z=E.contourShader,I=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],O=n.prototype;O.isOpaque=function(){return this.opacity>=1},O.isTransparent=function(){return this.opacity<1},O.pickSlots=1,O.setPickBase=function(t){this.pickId=t},O.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=k(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,o=r.length,a=T.mallocFloat32(6*o),s=0,l=0;o>l;++l)for(var u=r[l],c=0;2>c;++c){var f=u[0];2===u.length&&(f=u[c]);for(var h=n[f][0],d=n[f][1],p=i[f],g=1-p,v=this.positions[h],m=this.positions[d],y=0;3>y;++y)a[s++]=p*v[y]+g*m[y]}this.contourCount=s/3|0,this.contourPositions.update(a.subarray(0,s)),T.free(a)},O.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"contourEnable"in t&&(this.contourEnable=t.contourEnable),"contourColor"in t&&(this.contourColor=t.contourColor),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"lightPosition"in t&&(this.lightPosition=t.lightPosition),"opacity"in t&&(this.opacity=t.opacity),"ambient"in t&&(this.ambientLight=t.ambient),"diffuse"in t&&(this.diffuseLight=t.diffuse),"specular"in t&&(this.specularLight=t.specular),"roughness"in t&&(this.roughness=t.roughness),"fresnel"in t&&(this.fresnel=t.fresnel),t.texture?(this.texture.dispose(),this.texture=b(e,t.texture)):t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(i(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions;if(n&&r){var s=[],l=[],u=[],c=[],f=[],h=[],d=[],v=[],m=[],y=[],_=[],w=[],A=[],M=[];this.cells=r,this.positions=n;var k=t.vertexNormals,T=t.cellNormals,E=void 0===t.vertexNormalsEpsilon?p:t.vertexNormalsEpsilon,L=void 0===t.faceNormalsEpsilon?g:t.faceNormalsEpsilon;t.useFacetNormals&&!T&&(T=x.faceNormals(r,n,L)),T||k||(k=x.vertexNormals(r,n,E));var S=t.vertexColors,C=t.cellColors,P=t.meshColor||[1,1,1,1],R=t.vertexUVs,N=t.vertexIntensity,z=t.cellUVs,I=t.cellIntensity,O=1/0,j=-(1/0);if(!R&&!z)if(N)for(var D=0;Dq;++q)!isNaN(V[q])&&isFinite(V[q])&&(this.bounds[0][q]=Math.min(this.bounds[0][q],V[q]),this.bounds[1][q]=Math.max(this.bounds[1][q],V[q]));var H=0,G=0,X=0;t:for(var D=0;Dq;++q)if(isNaN(V[q])||!isFinite(V[q]))continue t;y.push(V[0],V[1],V[2]);var Z;Z=S?S[W]:C?C[D]:P,3===Z.length?_.push(Z[0],Z[1],Z[2],1):_.push(Z[0],Z[1],Z[2],Z[3]);var Q;Q=R?R[W]:N?[(N[W]-O)/(j-O),0]:z?z[D]:I?[(I[D]-O)/(j-O),0]:[(V[2]-O)/(j-O),0],w.push(Q[0],Q[1]),B?A.push(B[W]):A.push(U),M.push(D),X+=1;break;case 2:for(var q=0;2>q;++q)for(var W=Y[q],V=n[W],$=0;3>$;++$)if(isNaN(V[$])||!isFinite(V[$]))continue t; for(var q=0;2>q;++q){var W=Y[q],V=n[W];h.push(V[0],V[1],V[2]);var Z;Z=S?S[W]:C?C[D]:P,3===Z.length?d.push(Z[0],Z[1],Z[2],1):d.push(Z[0],Z[1],Z[2],Z[3]);var Q;Q=R?R[W]:N?[(N[W]-O)/(j-O),0]:z?z[D]:I?[(I[D]-O)/(j-O),0]:[(V[2]-O)/(j-O),0],v.push(Q[0],Q[1]),m.push(D)}G+=1;break;case 3:for(var q=0;3>q;++q)for(var W=Y[q],V=n[W],$=0;3>$;++$)if(isNaN(V[$])||!isFinite(V[$]))continue t;for(var q=0;3>q;++q){var W=Y[q],V=n[W];s.push(V[0],V[1],V[2]);var Z;Z=S?S[W]:C?C[D]:P,3===Z.length?l.push(Z[0],Z[1],Z[2],1):l.push(Z[0],Z[1],Z[2],Z[3]);var Q;Q=R?R[W]:N?[(N[W]-O)/(j-O),0]:z?z[D]:I?[(I[D]-O)/(j-O),0]:[(V[2]-O)/(j-O),0],c.push(Q[0],Q[1]);var K;K=k?k[W]:T[D],u.push(K[0],K[1],K[2]),f.push(D)}H+=1}}this.pointCount=X,this.edgeCount=G,this.triangleCount=H,this.pointPositions.update(y),this.pointColors.update(_),this.pointUVs.update(w),this.pointSizes.update(A),this.pointIds.update(new Uint32Array(M)),this.edgePositions.update(h),this.edgeColors.update(d),this.edgeUVs.update(v),this.edgeIds.update(new Uint32Array(m)),this.trianglePositions.update(s),this.triangleColors.update(l),this.triangleUVs.update(c),this.triangleNormals.update(u),this.triangleIds.update(new Uint32Array(f))}},O.drawTransparent=O.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||I,n=t.view||I,i=t.projection||I,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);var s={model:r,view:n,projection:i,clipBounds:o,kambient:this.ambientLight,kdiffuse:this.diffuseLight,kspecular:this.specularLight,roughness:this.roughness,fresnel:this.fresnel,eyePosition:[0,0,0],lightPosition:[0,0,0],opacity:this.opacity,contourColor:this.contourColor,texture:0};this.texture.bind(0);var l=new Array(16);_(l,s.view,s.model),_(l,s.projection,l),w(l,l);for(var a=0;3>a;++a)s.eyePosition[a]=l[12+a]/l[15];for(var u=l[15],a=0;3>a;++a)u+=this.lightPosition[a]*l[4*a+3];for(var a=0;3>a;++a){for(var c=l[12+a],f=0;3>f;++f)c+=l[4*f+a]*this.lightPosition[f];s.lightPosition[a]=c/u}if(this.triangleCount>0){var h=this.triShader;h.bind(),h.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var h=this.lineShader;h.bind(),h.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var h=this.pointShader;h.bind(),h.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var h=this.contourShader;h.bind(),h.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},O.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||I,n=t.view||I,i=t.projection||I,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:o,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},O.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),o=0;oa;++a){for(var s=new Array(r+1),l=0;r>=l;++l)s[l]=t[l][a];i[a]=s}i[r]=new Array(r+1);for(var a=0;r>=a;++a)i[r][a]=1;for(var u=new Array(r+1),a=0;r>a;++a)u[a]=e[a];u[r]=1;var c=o(i,u),f=n(c[r+1]);0===f&&(f=1);for(var h=new Array(r+1),a=0;r>=a;++a)h[a]=n(c[a])/f;return h}e.exports=i;var o=t("robust-linear-solve")},{"robust-linear-solve":222}],135:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,o=new Array(i),a=void 0===r?n:r,s=0;i>s;++s)o[s]=[0,0,0];for(var s=0;sx;++x)v[x]=d[x]-p[x],m+=v[x]*v[x],y[x]=g[x]-p[x],b+=y[x]*y[x];if(m*b>a)for(var _=o[c],w=1/Math.sqrt(m*b),x=0;3>x;++x){var A=(x+1)%3,M=(x+2)%3;_[x]+=w*(y[A]*v[M]-y[M]*v[A])}}for(var s=0;i>s;++s){for(var _=o[s],k=0,x=0;3>x;++x)k+=_[x]*_[x];if(k>a)for(var w=1/Math.sqrt(k),x=0;3>x;++x)_[x]*=w;else for(var x=0;3>x;++x)_[x]=0}return o},r.faceNormals=function(t,e,r){for(var n=t.length,o=new Array(n),a=void 0===r?i:r,s=0;n>s;++s){for(var l=t[s],u=new Array(3),c=0;3>c;++c)u[c]=e[l[c]];for(var f=new Array(3),h=new Array(3),c=0;3>c;++c)f[c]=u[1][c]-u[0][c],h[c]=u[2][c]-u[0][c];for(var d=new Array(3),p=0,c=0;3>c;++c){var g=(c+1)%3,v=(c+2)%3;d[c]=f[g]*h[v]-f[v]*h[g],p+=d[c]*d[c]}p=p>a?1/Math.sqrt(p):0;for(var c=0;3>c;++c)d[c]*=p;o[s]=d}return o}},{}],136:[function(t,e,r){"use strict";function n(t,e,r,n,s){i.length=x+_)if(0>x)0>_&&0>h?(_=0,-h>=u?(x=1,y=u+2*h+p):(x=-h/u,y=h*x+p)):(x=0,d>=0?(_=0,y=p):-d>=f?(_=1,y=f+2*d+p):(_=-d/f,y=d*_+p));else if(0>_)_=0,h>=0?(x=0,y=p):-h>=u?(x=1,y=u+2*h+p):(x=-h/u,y=h*x+p);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p}else{var A,M,k,T;0>x?(A=c+h,M=f+d,M>A?(k=M-A,T=u-2*c+f,k>=T?(x=1,_=0,y=u+2*h+p):(x=k/T,_=1-x,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)):(x=0,0>=M?(_=1,y=f+2*d+p):d>=0?(_=0,y=p):(_=-d/f,y=d*_+p))):0>_?(A=c+d,M=u+h,M>A?(k=M-A,T=u-2*c+f,k>=T?(_=1,x=0,y=f+2*d+p):(_=k/T,x=1-_,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)):(_=0,0>=M?(x=1,y=u+2*h+p):h>=0?(x=0,y=p):(x=-h/u,y=h*x+p))):(k=f+d-c-h,0>=k?(x=0,_=1,y=f+2*d+p):(T=u-2*c+f,k>=T?(x=1,_=0,y=u+2*h+p):(x=k/T,_=1-x,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)))}for(var E=1-x-_,l=0;ly?0:y}var i=new Float64Array(4),o=new Float64Array(4),a=new Float64Array(4);e.exports=n},{}],137:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r=0|Math.max(r,t[n].length);return r-1}function i(t,e){for(var r=t.length,n=f.mallocUint8(r),i=0;r>i;++i)n[i]=t[i]a;++a)for(var s=t[a],e=s.length,l=0;e>l;++l)for(var u=0;l>u;++u){var d=s[u],p=s[l];i[o++]=0|Math.min(d,p),i[o++]=0|Math.max(d,p)}var g=o/2|0;h(c(i,[g,2]));for(var v=2,a=2;o>a;a+=2)i[a-2]===i[a]&&i[a-1]===i[a+1]||(i[v++]=i[a],i[v++]=i[a+1]);return c(i,[v/2|0,2])}function a(t,e,r,n){for(var i=t.data,o=t.shape[0],a=f.mallocDouble(o),s=0,l=0;o>l;++l){var u=i[2*l],h=i[2*l+1];if(r[u]!==r[h]){var d=e[u],p=e[h];i[2*s]=u,i[2*s+1]=h,a[s++]=(p-n)/(p-d)}}return t.shape[0]=s,c(a,[s])}function s(t,e){var r=f.mallocInt32(2*e),n=t.shape[0],i=t.data;r[0]=0;for(var o=0,a=0;n>a;++a){var s=i[2*a];if(s!==o){for(r[2*o+1]=a;++oi;++i)n[i]=[r[2*i],r[2*i+1]];return n}function u(t,e,r,u){r=r||0,"undefined"==typeof u&&(u=n(t));var c=t.length;if(0===c||1>u)return{cells:[],vertexIds:[],vertexWeights:[]};var h=i(e,+r),p=o(t,u),g=a(p,e,h,+r),v=s(p,0|e.length),m=d(u)(t,p.data,v,h),y=l(p),b=[].slice.call(g.data,0,g.shape[0]);return f.free(h),f.free(p.data),f.free(g.data),f.free(v),{cells:m,vertexIds:y,vertexWeights:b}}e.exports=u;var c=t("ndarray"),f=t("typedarray-pool"),h=t("ndarray-sort"),d=t("./lib/codegen")},{"./lib/codegen":138,ndarray:219,"ndarray-sort":141,"typedarray-pool":242}],138:[function(t,e,r){"use strict";function n(t){function e(t){if(!(t.length<=0)){u.push("R.push(");for(var e=0;e0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;t>=i;++i)for(var s=n[i]=a(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){t+1>i&&u.push("else "),u.push("if(l===",i,"){");for(var c=[],l=0;i>l;++l)c.push("(S[c["+l+"]]<<"+l+")");u.push("var M=",c.join("+"),";if(M===0||M===",(1<i;++i)n[i]=0,i===e&&(n[i]+=.5),i===r&&(n[i]+=.5);return n}function i(t,e){if(0===e||e===(1<=o;++o)if(e&1<=s;++s)~e&1<n;++n)r[n]=i(t,n);return r}e.exports=o;var a=t("convex-hull")},{"convex-hull":90}],140:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;t>r;++r)e.push("s"+r);for(var r=0;t>r;++r)e.push("n"+r);for(var r=1;t>r;++r)e.push("d"+r);for(var r=1;t>r;++r)e.push("e"+r);for(var r=1;t>r;++r)e.push("f"+r);return e}function o(t,e){function r(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function o(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}var a=["'use strict'"],s=["ndarrayInsertionSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(i(t.length)),u=n(e),c=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var f=[],h=1;h1){a.push("dptr=0;sptr=ptr");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&a.push(["for(i",d,"=0;i",d,"left){","dptr=0","sptr=cptr-s0");for(var h=1;hb){break __l}"].join(""));for(var h=t.length-1;h>=1;--h)a.push("sptr+=e"+h,"dptr+=f"+h,"}");a.push("dptr=cptr;sptr=cptr-s0");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&a.push(["for(i",d,"=0;i",d,"=0;--h){var d=t[h];0!==d&&a.push(["for(i",d,"=0;i",d,"left)&&("+r("cptr-s0")+">scratch)){",o("cptr",r("cptr-s0")),"cptr-=s0","}",o("cptr","scratch"));if(a.push("}"),t.length>1&&u&&a.push("free(scratch)"),a.push("} return "+s),u){var p=new Function("malloc","free",a.join("\n"));return p(u[0],u[1])}var p=new Function(a.join("\n"));return p()}function a(t,e,r){function o(t){return["(offset+",t,"*s0)"].join("")}function a(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+o(e[0]));else for(var i=0;i=0;--i){var a=t[i];0!==a&&_.push(["for(i",a,"=0;i",a,"1)for(var i=0;i1?_.push("ptr_shift+=d"+a):_.push("ptr0+=d"+a),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+o(r[0]));else{for(var a=0;a1)for(var a=0;a=1;--a)n&&_.push("pivot_ptr+=f"+a),r.length>1?_.push("ptr_shift+=e"+a):_.push("ptr0+=e"+a),_.push("}")}function f(){t.length>1&&M&&_.push("free(pivot1)","free(pivot2)")}function h(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",a("ptr0"),"-",a("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",a(o(n)),">",a(o(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",a("ptr1"))):_.push(s(o(e),a(o(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",a("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",a(o(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join(""))}function v(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","ptr2=",o(n),"\n","++",r,"\n","--",n,"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join(""))}function m(t,e){g(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",a("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(o(e),a(o(r))),s(o(r),"pivot"+n))}function b(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function x(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",a("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",a(o(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),A=["left","right","data","offset"].concat(i(t.length)),M=n(e),k=0;_.push(["function ",w,"(",A.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],L=1;LL;++L)T.push("b_ptr"+L);T.push("ptr3","ptr4","ptr5","ptr6","ptr7","pivot_ptr","ptr_shift","elementSize="+E.join("*")),M?T.push("pivot1=malloc(elementSize)","pivot2=malloc(elementSize)"):T.push("pivot1=new Array(elementSize),pivot2=new Array(elementSize)")}else T.push("pivot1","pivot2");if(_.push("var "+T.join(",")),h(1,2),h(4,5),h(1,3),h(2,3),h(1,4),h(3,4),h(2,5),h(2,3),h(4,5),t.length>1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",a("ptr1"),"\n","pivot2[pivot_ptr]=",a("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",a("ptr0"),"\n","y=",a("ptr2"),"\n","z=",a("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",a(o("el2")),"\n","pivot2=",a(o("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",a(o("el1")),"\n","y=",a(o("el3")),"\n","z=",a(o("el5")),"\n",s(o("index1"),"x"),"\n",s(o("index3"),"y"),"\n",s(o("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),v("k","less","great"),_.push("break"),_.push("}else{"),m("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&M){var S=new Function("insertionSort","malloc","free",_.join("\n"));return S(r,M[0],M[1])}var S=new Function("insertionSort",_.join("\n"));return S(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",v,"=s",v,"-d",p,"*n",p].join("")):l.push(["d",v,"=s",v].join("")),p=v);var d=t.length-1-c;0!==d&&(g>0?l.push(["e",d,"=s",d,"-e",g,"*n",g,",f",d,"=",f[d],"-f",g,"*n",g].join("")):l.push(["e",d,"=s",d,",f",d,"=",f[d]].join("")),g=d)}r.push("var "+l.join(","));var m=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",m.join(","),")}else{","quickSort(",m.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=o(t,e),x=a(t,e,b);return y(b,x)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":242}],141:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],a=n.join(":"),s=o[a];return s||(o[a]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),o={};e.exports=n},{"./lib/compile_sort.js":140}],142:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\nattribute vec2 position;\nvarying vec2 uv;\nvoid main() {\n uv = position;\n gl_Position = vec4(position, 0, 1);\n}",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D accumBuffer;\nvarying vec2 uv;\n\nvoid main() {\n vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0));\n gl_FragColor = min(vec4(1,1,1,1), accum);\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec2"}])}},{"gl-shader":164}],143:[function(t,e,r){"use strict";function n(t,e){t=t||document.body,e=e||{};var r=[.01,1/0];"distanceLimits"in e&&(r[0]=e.distanceLimits[0],r[1]=e.distanceLimits[1]),"zoomMin"in e&&(r[0]=e.zoomMin),"zoomMax"in e&&(r[1]=e.zoomMax);var n=o({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:r}),l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],u=0,c=t.clientWidth,f=t.clientHeight,h={view:n,element:t,delay:e.delay||16,rotateSpeed:e.rotateSpeed||1,zoomSpeed:e.zoomSpeed||1,translateSpeed:e.translateSpeed||1,flipX:!!e.flipX,flipY:!!e.flipY,modes:n.modes,tick:function(){var e=i(),r=this.delay;n.idle(e-r),n.flush(e-(100+2*r));var o=e-2*r;n.recalcMatrix(o);for(var a=!0,s=n.computedMatrix,h=0;16>h;++h)a=a&&l[h]===s[h],l[h]=s[h];var d=t.clientWidth===c&&t.clientHeight===f;return c=t.clientWidth,f=t.clientHeight,a?!d:(u=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(h,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){return n.setMode(t),n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return u},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var d=0,p=0;return a(t,function(e,r,o,a){var s=1/t.clientHeight,l=s*(r-d),c=s*(o-p),f=h.flipX?1:-1,g=h.flipY?1:-1,v=Math.PI*h.rotateSpeed,m=i();if(1&e)a.shift?n.rotate(m,0,0,-l*v):n.rotate(m,f*v*l,-g*v*c,0);else if(2&e)n.pan(m,-h.translateSpeed*l*u,h.translateSpeed*c*u,0);else if(4&e){var y=h.zoomSpeed*c/window.innerHeight*(m-n.lastT())*50;n.pan(m,0,0,u*(Math.exp(y)-1))}d=r,p=o}),s(t,function(t,e,r){var o=h.flipX?1:-1,a=h.flipY?1:-1,s=i();if(Math.abs(t)>Math.abs(e))n.rotate(s,0,0,-t*o*Math.PI*h.rotateSpeed/window.innerWidth);else{var l=h.zoomSpeed*a*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,u*(Math.exp(l)-1))}},!0),h}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":27,"mouse-change":207,"mouse-wheel":211,"right-now":221}],144:[function(t,e,r){!function(){"use strict";function t(e){e.permitHostObjects___&&e.permitHostObjects___(t)}function r(t){return!(t.substr(0,d.length)==d&&"___"===t.substr(t.length-3))}function n(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[p];if(e&&e.key===t)return e;if(h(t)){e={key:t};try{return f(t,p,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(r){return}}}function i(t){return t.prototype=null,Object.freeze(t)}function o(){y||"undefined"==typeof console||(y=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=t);var a=!1;if("function"==typeof WeakMap){var s=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var l=new s,u=Object.freeze({});if(l.set(u,1),1===l.get(u))return void(e.exports=WeakMap);a=!0}}var c=(Object.prototype.hasOwnProperty,Object.getOwnPropertyNames),f=Object.defineProperty,h=Object.isExtensible,d="weakmap:",p=d+"ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var g=new ArrayBuffer(25),v=new Uint8Array(g);crypto.getRandomValues(v),p=d+"rand:"+Array.prototype.map.call(v,function(t){return(t%36).toString(36)}).join("")+"___"}if(f(Object,"getOwnPropertyNames",{value:function(t){return c(t).filter(r)}}),"getPropertyNames"in Object){var m=Object.getPropertyNames;f(Object,"getPropertyNames",{value:function(t){return m(t).filter(r)}})}!function(){var t=Object.freeze;f(Object,"freeze",{value:function(e){return n(e),t(e)}});var e=Object.seal;f(Object,"seal",{value:function(t){return n(t),e(t)}});var r=Object.preventExtensions;f(Object,"preventExtensions",{value:function(t){return n(t),r(t)}})}();var y=!1,b=0,x=function(){function t(t,e){var r,i=n(t);return i?u in i?i[u]:e:(r=s.indexOf(t),r>=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function a(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),0>e?!1:(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||o();var s=[],l=[],u=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(a)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},"delete":{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||(c?c.has___(t):!1)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||o();var l,u=new s,c=void 0,f=!1;return l=a?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new x),c.set(t,e)),this}:function(t,e){if(f)try{u.set(t,e)}catch(r){c||(c=new x),c.set___(t,e)}else u.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");f=!0})}})}a&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],145:[function(t,e,r){"use strict";function n(t){var e=s.get(t);if(!e||!t.isBuffer(e._triangleBuffer.buffer)){var r=o(t,new Float32Array([-1,-1,-1,4,4,-1]));e=a(t,[{buffer:r,type:t.FLOAT,size:2}]),e._triangleBuffer=r,s.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}var i="undefined"==typeof WeakMap?t("weak-map"):WeakMap,o=t("gl-buffer"),a=t("gl-vao"),s=new i;e.exports=n},{"gl-buffer":105,"gl-vao":192,"weak-map":144}],146:[function(t,e,r){"use strict";function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function i(t){this.gl=t,this.pixelRatio=1,this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.autoTicks=!0,this.tickSpacing=[1,1,1],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[10,10,10],this.lastCubeProps={cubeEdges:[0,0,0],axis:[0,0,0]},this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont="sans-serif",this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[10,10,10],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[0,0,0],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!1,!1,!1],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._firstInit=!0,this._text=null,this._lines=null,this._background=c(t)}function o(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}function a(t,e,r,n,i){for(var o=t.primalOffset,a=t.primalMinor,s=t.mirrorOffset,l=t.mirrorMinor,u=n[e],c=0;3>c;++c)if(e!==c){var f=o,h=s,d=a,p=l;u&1<0?(d[c]=-1,p[c]=0):(d[c]=0,p[c]=1)}}function s(t,e){var r=new i(t);return r.update(e),r}e.exports=s;var l=t("./lib/text.js"),u=t("./lib/lines.js"),c=t("./lib/background.js"),f=t("./lib/cube.js"),h=t("./lib/ticks.js"),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),p=i.prototype; p.update=function(t){function e(e,r,n){if(n in t){var i,o=t[n],a=this[n];(e?Array.isArray(o)&&Array.isArray(o[0]):Array.isArray(o))?this[n]=i=[r(o[0]),r(o[1]),r(o[2])]:this[n]=i=[r(o),r(o),r(o)];for(var s=0;3>s;++s)if(i[s]!==a[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),o=e.bind(this,!1,String),a=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),s=!1,c=!1;if("bounds"in t)for(var f=t.bounds,d=0;2>d;++d)for(var p=0;3>p;++p)f[d][p]!==this.bounds[d][p]&&(c=!0),this.bounds[d][p]=f[d][p];if("ticks"in t){r=t.ticks,s=!0,this.autoTicks=!1;for(var d=0;3>d;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,c=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),c=!0,s=!0,this._firstInit=!1),c&&this.autoTicks&&(r=h.create(this.bounds,this.tickSpacing),s=!0),s){for(var d=0;3>d;++d)r[d].sort(function(t,e){return t.x-e.x});h.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),o("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),a("tickColor");var g=o("labels");o("labelFont")&&(g=!0),i("labelEnable"),n("labelSize"),n("labelPad"),a("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),a("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),a("lineTickColor"),i("gridEnable"),n("gridWidth"),a("gridColor"),i("zeroEnable"),a("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),a("backgroundColor"),this._text?this._text&&(g||s)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=l(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&s&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=u(this.gl,this.bounds,this.ticks))};var g=[new o,new o,new o],v=[0,0,0],m={model:d,view:d,projection:d};p.isOpaque=function(){return!0},p.isTransparent=function(){return!1},p.drawTransparent=function(t){};var y=[0,0,0],b=[0,0,0],x=[0,0,0];p.draw=function(t){t=t||m;for(var e=this.gl,r=t.model||d,i=t.view||d,o=t.projection||d,s=this.bounds,l=f(r,i,o,s),u=l.cubeEdges,c=l.axis,h=i[12],p=i[13],_=i[14],w=i[15],A=this.pixelRatio*(o[3]*h+o[7]*p+o[11]*_+o[15]*w)/e.drawingBufferHeight,M=0;3>M;++M)this.lastCubeProps.cubeEdges[M]=u[M],this.lastCubeProps.axis[M]=c[M];for(var k=g,M=0;3>M;++M)a(g[M],M,this.bounds,u,c);for(var e=this.gl,T=v,M=0;3>M;++M)this.backgroundEnable[M]?T[M]=c[M]:T[M]=0;this._background.draw(r,i,o,s,T,this.backgroundColor),this._lines.bind(r,i,o,this);for(var M=0;3>M;++M){var E=[0,0,0];c[M]>0?E[M]=s[1][M]:E[M]=s[0][M];for(var L=0;2>L;++L){var S=(M+1+L)%3,C=(M+1+(1^L))%3;this.gridEnable[S]&&this._lines.drawGrid(S,C,this.bounds,E,this.gridColor[S],this.gridWidth[S]*this.pixelRatio)}for(var L=0;2>L;++L){var S=(M+1+L)%3,C=(M+1+(1^L))%3;this.zeroEnable[C]&&s[0][C]<=0&&s[1][C]>=0&&this._lines.drawZero(S,C,this.bounds,E,this.zeroLineColor[C],this.zeroLineWidth[C]*this.pixelRatio)}}for(var M=0;3>M;++M){this.lineEnable[M]&&this._lines.drawAxisLine(M,this.bounds,k[M].primalOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio),this.lineMirror[M]&&this._lines.drawAxisLine(M,this.bounds,k[M].mirrorOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio);for(var P=n(y,k[M].primalMinor),R=n(b,k[M].mirrorMinor),N=this.lineTickLength,L=0;3>L;++L){var z=A/r[5*L];P[L]*=N[L]*z,R[L]*=N[L]*z}this.lineTickEnable[M]&&this._lines.drawAxisTicks(M,k[M].primalOffset,P,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio),this.lineTickMirror[M]&&this._lines.drawAxisTicks(M,k[M].mirrorOffset,R,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio)}this._text.bind(r,i,o,this.pixelRatio);for(var M=0;3>M;++M){for(var I=k[M].primalMinor,O=n(x,k[M].primalOffset),L=0;3>L;++L)this.lineTickEnable[M]&&(O[L]+=A*I[L]*Math.max(this.lineTickLength[L],0)/r[5*L]);if(this.tickEnable[M]){for(var L=0;3>L;++L)O[L]+=A*I[L]*this.tickPad[L]/r[5*L];this._text.drawTicks(M,this.tickSize[M],this.tickAngle[M],O,this.tickColor[M])}if(this.labelEnable[M]){for(var L=0;3>L;++L)O[L]+=A*I[L]*this.labelPad[L]/r[5*L];O[M]+=.5*(s[0][M]+s[1][M]),this._text.drawLabel(M,this.labelSize[M],this.labelAngle[M],O,this.labelColor[M])}}},p.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":147,"./lib/cube.js":148,"./lib/lines.js":149,"./lib/text.js":151,"./lib/ticks.js":152}],147:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}function i(t){for(var e=[],r=[],i=0,l=0;3>l;++l)for(var u=(l+1)%3,c=(l+2)%3,f=[0,0,0],h=[0,0,0],d=-1;1>=d;d+=2){r.push(i,i+2,i+1,i+1,i+2,i+3),f[l]=d,h[l]=d;for(var p=-1;1>=p;p+=2){f[u]=p;for(var g=-1;1>=g;g+=2)f[c]=g,e.push(f[0],f[1],f[2],h[0],h[1],h[2]),i+=1}var v=u;u=c,c=v}var m=o(t,new Float32Array(e)),y=o(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=a(t,[{buffer:m,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:m,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=s(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,m,b,x)}e.exports=i;var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.draw=function(t,e,r,n,i,o){for(var a=!1,s=0;3>s;++s)a=a||i[s];if(a){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:o},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":150,"gl-buffer":105,"gl-vao":192}],148:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;4>n;++n){t[n]=r[12+n];for(var i=0;3>i;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;eg;++g){d[2]=o[g][2];for(var b=0;2>b;++b){d[1]=o[b][1];for(var x=0;2>x;++x)d[0]=o[x][0],n(f[l],d,c),l+=1}}for(var _=-1,g=0;8>g;++g){for(var w=f[g][3],A=0;3>A;++A)h[g][A]=f[g][A]/w;0>w&&(0>_?_=g:h[g][2]_){_=0;for(var M=0;3>M;++M){for(var k=(M+2)%3,T=(M+1)%3,E=-1,L=-1,S=0;2>S;++S){var C=S<E||0>L)L>E&&(_|=1<S;++S){var C=S<E&&(_|=1<g;++g)g!==_&&g!==z&&(0>I?I=g:h[I][1]>h[g][1]&&(I=g));for(var O=-1,g=0;3>g;++g){var j=I^1<O&&(O=j);var T=h[j];T[0]g;++g){var j=I^1<D&&(D=j);var T=h[j];T[0]>h[D][0]&&(D=j)}}var F=v;F[0]=F[1]=F[2]=0,F[a.log2(O^I)]=I&O,F[a.log2(I^D)]=I&D;var B=7^D;B===_||B===z?(B=7^O,F[a.log2(D^B)]=B&D):F[a.log2(O^B)]=B&O;for(var U=m,V=_,M=0;3>M;++M)V&1<t;++t)f[t]=[1,1,1,1],h[t]=[1,1,1]}();var g=[[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]],v=[1,1,1],m=[0,0,0],y={cubeEdges:v,axis:m}},{"bit-twiddle":38,"gl-mat4/invert":120,"gl-mat4/multiply":122,"robust-orientation":225,"split-polygon":154}],149:[function(t,e,r){"use strict";function n(t){return t[0]=t[1]=t[2]=0,t}function i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(t,e,r,n,i,o,a,s){this.gl=t,this.vertBuffer=e,this.vao=r,this.shader=n,this.tickCount=i,this.tickOffset=o,this.gridCount=a,this.gridOffset=s}function a(t,e,r){var n=[],i=[0,0,0],a=[0,0,0],c=[0,0,0],f=[0,0,0];n.push(0,0,1,0,1,1,0,0,-1,0,0,-1,0,1,1,0,1,-1);for(var h=0;3>h;++h){for(var d=n.length/3|0,p=0;ph;++h)for(var p=c[h],g=2;g>=0;--g){var v=u[p[g]];s.push(l*v[0],-l*v[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],u=[0,0,0],c=[0,0,0],d=[0,0,0],p=0;3>p;++p){c[p]=s.length/h|0,a(.5*(t[0][p]+t[1][p]),e[p],r),d[p]=(s.length/h|0)-c[p],l[p]=s.length/h|0;for(var g=0;g=0&&(i=r.length-n-1);var o=Math.pow(10,i),a=Math.round(t*e*o),s=a+"";if(s.indexOf("e")>=0)return s;var l=a/o,u=a%o;0>a?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u=0|u);var c=""+l;if(0>a&&(c="-"+c),i){for(var f=""+u;f.lengthi;++i){for(var o=[],a=(.5*(t[0][i]+t[1][i]),0);a*e[i]<=t[1][i];++a)o.push({x:a*e[i],text:n(e[i],a)});for(var a=-1;a*e[i]>=t[0][i];--a)o.push({x:a*e[i],text:n(e[i],a)});r.push(o)}return r}function o(t,e){for(var r=0;3>r;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;no?o=0:o>1&&(o=1);for(var a=1-o,s=t.length,l=new Array(s),u=0;s>u;++u)l[u]=o*t[u]+a*r[u];return l}function o(t,e){for(var r=[],o=[],a=n(t[t.length-1],e),s=t[t.length-1],l=t[0],u=0;ua&&c>0||a>0&&0>c){var f=i(s,c,l,a);r.push(f),o.push(f.slice())}0>c?o.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),o.push(l.slice())),a=c}return{positive:r,negative:o}}function a(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;lo&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),u>=0&&r.push(s.slice()),o=u}return r}function s(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;lo&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),0>=u&&r.push(s.slice()),o=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=o,e.exports.positive=a,e.exports.negative=s},{"robust-dot-product":155,"robust-sum":228}],155:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t[0],e[0]),n=1;no;++o){for(var a=p,s=g,l=0;3>l;++l)s[l]=a[l]=r[l];s[3]=a[3]=1,s[o]+=1,f(s,s,e),s[3]<0&&(t[o]=1/0),a[o]-=1,f(a,a,e),a[3]<0&&(t[o]=1/0);var u=(a[0]/a[3]-s[0]/s[3])*n,c=(a[1]/a[3]-s[1]/s[3])*i;t[o]=.25*Math.sqrt(u*u+c*c)}return t}function o(t,e,r,n,o){var f=e.model||h,p=e.view||h,g=e.projection||h,y=t.bounds,o=o||l(f,p,g,y),b=o.axis;o.edges;u(d,p,f),u(d,g,d);for(var x=v,_=0;3>_;++_)x[_].lo=1/0,x[_].hi=-(1/0),x[_].pixelsPerDataUnit=1/0;var w=a(c(d,d));c(d,d);for(var A=0;3>A;++A){var M=(A+1)%3,k=(A+2)%3,T=m;t:for(var _=0;2>_;++_){var E=[];if(b[A]<0!=!!_){T[A]=y[_][A];for(var L=0;2>L;++L){T[M]=y[L^_][M];for(var S=0;2>S;++S)T[k]=y[S^L^_][k],E.push(T.slice())}for(var L=0;LS;++S)x[S].lo=Math.min(x[S].lo,k[S]),x[S].hi=Math.max(x[S].hi,k[S]),S!==A&&(x[S].pixelsPerDataUnit=Math.min(x[S].pixelsPerDataUnit,Math.abs(C[S])))}}}return x}e.exports=o;var a=t("extract-frustum-planes"),s=t("split-polygon"),l=t("./lib/cube.js"),u=t("gl-mat4/multiply"),c=t("gl-mat4/transpose"),f=t("gl-vec4/transformMat4"),h=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),d=new Float32Array(16),p=[0,0,0,1],g=[0,0,0,1],v=[new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0)],m=[0,0,0]},{"./lib/cube.js":148,"extract-frustum-planes":153,"gl-mat4/multiply":122,"gl-mat4/transpose":130,"gl-vec4/transformMat4":193,"split-polygon":154}],157:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":164}],158:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}function i(t,e){function r(t,e,r,n,o,a){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=o,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=a,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s)}var i=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=o(t,i),u=a(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),c=s(t);c.attributes.position.location=0,c.attributes.color.location=1,c.attributes.weight.location=2;var f=new n(t,l,u,c);return f.update(e),f}var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders/index");e.exports=i;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype,c=[0,0,0],f=[0,0,0],h=[0,0];u.isTransparent=function(){return!1},u.drawTransparent=function(t){},u.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,o=t.model||l,a=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,d=f,p=0;3>p;++p)i&&i[p]<0?(u[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(u[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);h[0]=e.drawingBufferWidth,h[1]=e.drawingBufferHeight,n.uniforms.model=o,n.uniforms.view=a,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=h;for(var p=0;3>p;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},u.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},u.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":157,"gl-buffer":105,"gl-vao":192}],159:[function(t,e,r){"use strict";function n(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function i(t,e){var r=null;try{r=t.getContext("webgl",e),r||(r=t.getContext("experimental-webgl",e))}catch(n){return null}return r}function o(t){var e=Math.round(Math.log(Math.abs(t))/Math.log(10));if(0>e){var r=Math.round(Math.pow(10,-e));return Math.ceil(t*r)/r}if(e>0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function a(t){return"boolean"==typeof t?t:!0}function s(t){function e(){if(!_&&H.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*H.pixelRatio),i=0|Math.ceil(r*H.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var o=w.style;o.position=o.position||"absolute",o.left="0px",o.top="0px",o.width=e+"px",o.height=r+"px",D=!0}}}function r(){for(var t=z.length,e=j.length,r=0;e>r;++r)O[r]=0;t:for(var r=0;t>r;++r){var n=z[r],i=n.pickSlots;if(i){for(var o=0;e>o;++o)if(O[o]+i<255){I[r]=o,n.setPickBase(O[o]+1),O[o]+=i;continue t}var a=h(M,q);I[r]=e,j.push(a),O.push(i),n.setPickBase(1),e+=1}else I[r]=-1}for(;e>0&&0===O[e-1];)O.pop(),j.pop().dispose()}function s(){return H.contextLost?!0:void(M.isContextLost()&&(H.contextLost=!0,H.mouseListener.enabled=!1,H.selection.object=null,H.oncontextloss&&H.oncontextloss()))}function y(){if(!s()){M.colorMask(!0,!0,!0,!0),M.depthMask(!0),M.disable(M.BLEND),M.enable(M.DEPTH_TEST);for(var t=z.length,e=j.length,r=0;e>r;++r){var n=j[r];n.shape=G,n.begin();for(var i=0;t>i;++i)if(I[i]===r){var o=z[i];o.drawPick&&(o.pixelRatio=1,o.drawPick(V))}n.end()}}}function b(){if(!s()){e();var t=H.camera.tick();V.view=H.camera.matrix,D=D||t,F=F||t,P.pixelRatio=H.pixelRatio,N.pixelRatio=H.pixelRatio;var r=z.length,n=W[0],i=W[1];n[0]=n[1]=n[2]=1/0,i[0]=i[1]=i[2]=-(1/0);for(var a=0;r>a;++a){var l=z[a];l.pixelRatio=H.pixelRatio,l.axes=H.axes,D=D||!!l.dirty,F=F||!!l.dirty;var u=l.bounds;if(u)for(var f=u[0],h=u[1],d=0;3>d;++d)n[d]=Math.min(n[d],f[d]),i[d]=Math.max(i[d],h[d])}var g=H.bounds;if(H.autoBounds)for(var d=0;3>d;++d){if(i[d]d;++d)b=b||Z[0][d]!==g[0][d]||Z[1][d]!==g[1][d],Z[0][d]=g[0][d],Z[1][d]=g[1][d];if(b){for(var x=[0,0,0],a=0;3>a;++a)x[a]=o((g[1][a]-g[0][a])/10);P.autoTicks?P.update({bounds:g,tickSpacing:x}):P.update({bounds:g})}F=F||b,D=D||b;var _=M.drawingBufferWidth,w=M.drawingBufferHeight;q[0]=_,q[1]=w,G[0]=0|Math.max(_/H.pixelRatio,1),G[1]=0|Math.max(w/H.pixelRatio,1),v(B,H.fovy,_/w,H.zNear,H.zFar);for(var a=0;16>a;++a)U[a]=0;U[15]=1;for(var A=0,a=0;3>a;++a)A=Math.max(A,g[1][a]-g[0][a]);for(var a=0;3>a;++a)H.autoScale?U[5*a]=H.aspect[a]/(g[1][a]-g[0][a]):U[5*a]=1/A,H.autoCenter&&(U[12+a]=.5*-U[5*a]*(g[0][a]+g[1][a]));for(var a=0;r>a;++a){var l=z[a];l.axesBounds=g,H.clipToBounds&&(l.clipBounds=g)}if(T.object&&(H.snapToData?N.position=T.dataCoordinate:N.position=T.dataPosition,N.bounds=g),F&&(F=!1,y()),D){H.axesPixels=c(H.axes,V,_,w),H.onrender&&H.onrender(),M.bindFramebuffer(M.FRAMEBUFFER,null),M.viewport(0,0,_,w);var k=H.clearColor;M.clearColor(k[0],k[1],k[2],k[3]),M.clear(M.COLOR_BUFFER_BIT|M.DEPTH_BUFFER_BIT),M.depthMask(!0),M.colorMask(!0,!0,!0,!0),M.enable(M.DEPTH_TEST),M.depthFunc(M.LEQUAL),M.disable(M.BLEND),M.disable(M.CULL_FACE);var S=!1;P.enable&&(S=S||P.isTransparent(),P.draw(V)),N.axes=P,T.object&&N.draw(V),M.disable(M.CULL_FACE);for(var a=0;r>a;++a){var l=z[a];l.axes=P,l.pixelRatio=H.pixelRatio,l.isOpaque&&l.isOpaque()&&l.draw(V),l.isTransparent&&l.isTransparent()&&(S=!0)}if(S){E.shape=q,E.bind(),M.clear(M.DEPTH_BUFFER_BIT),M.colorMask(!1,!1,!1,!1),M.depthMask(!0),M.depthFunc(M.LESS),P.enable&&P.isTransparent()&&P.drawTransparent(V);for(var a=0;r>a;++a){var l=z[a];l.isOpaque&&l.isOpaque()&&l.draw(V)}M.enable(M.BLEND),M.blendEquation(M.FUNC_ADD),M.blendFunc(M.ONE,M.ONE_MINUS_SRC_ALPHA),M.colorMask(!0,!0,!0,!0),M.depthMask(!1),M.clearColor(0,0,0,0),M.clear(M.COLOR_BUFFER_BIT),P.isTransparent()&&P.drawTransparent(V);for(var a=0;r>a;++a){var l=z[a];l.isTransparent&&l.isTransparent()&&l.drawTransparent(V)}M.bindFramebuffer(M.FRAMEBUFFER,null),M.blendFunc(M.ONE,M.ONE_MINUS_SRC_ALPHA),M.disable(M.DEPTH_TEST),L.bind(),E.color[0].bind(0),L.uniforms.accumBuffer=0,p(M),M.disable(M.BLEND)}D=!1;for(var a=0;r>a;++a)z[a].dirty=!1}}}function x(){_||H.contextLost||(requestAnimationFrame(x),b())}t=t||{};var _=!1,w=(t.pixelRatio||parseFloat(window.devicePixelRatio),t.canvas);if(!w)if(w=document.createElement("canvas"),t.container){var A=t.container;A.appendChild(w)}else document.body.appendChild(w);var M=t.gl;if(M||(M=i(w,t.glOptions||{premultipliedAlpha:!0,antialias:!0})),!M)throw new Error("webgl not supported");var k=t.bounds||[[-10,-10,-10],[10,10,10]],T=new n,E=d(M,[M.drawingBufferWidth,M.drawingBufferHeight],{preferFloat:!0}),L=m(M),S=t.camera||{eye:[2,0,0],center:[0,0,0],up:[0,1,0],zoomMin:.1,zoomMax:100,mode:"turntable"},C=t.axes||{},P=u(M,C);P.enable=!C.disable;var R=t.spikes||{},N=f(M,R),z=[],I=[],O=[],j=[],D=!0,F=!0,B=new Array(16),U=new Array(16),V={view:null,projection:B,model:U},F=!0,q=[M.drawingBufferWidth,M.drawingBufferHeight],H={gl:M,contextLost:!1,pixelRatio:t.pixelRatio||parseFloat(window.devicePixelRatio),canvas:w,selection:T,camera:l(w,S),axes:P,axesPixels:null,spikes:N,bounds:k,objects:z,shape:q,aspect:t.aspectRatio||[1,1,1],pickRadius:t.pickRadius||10,zNear:t.zNear||.01,zFar:t.zFar||1e3,fovy:t.fovy||Math.PI/4,clearColor:t.clearColor||[0,0,0,0],autoResize:a(t.autoResize),autoBounds:a(t.autoBounds),autoScale:!!t.autoScale,autoCenter:a(t.autoCenter),clipToBounds:a(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:V,oncontextloss:null,mouseListener:null},G=[M.drawingBufferWidth/H.pixelRatio|0,M.drawingBufferHeight/H.pixelRatio|0];H.autoResize&&e(),window.addEventListener("resize",e),H.update=function(t){_||(t=t||{},D=!0,F=!0)},H.add=function(t){_||(t.axes=P,z.push(t),I.push(-1),D=!0,F=!0,r())},H.remove=function(t){if(!_){var e=z.indexOf(t);0>e||(z.splice(e,1),I.pop(),D=!0,F=!0,r())}},H.dispose=function(){if(!_&&(_=!0,window.removeEventListener("resize",e),w.removeEventListener("webglcontextlost",s),H.mouseListener.enabled=!1,!H.contextLost)){P.dispose(),N.dispose();for(var t=0;ts;++s){var l=j[s].query(e,G[1]-r-1,H.pickRadius);if(l){if(l.distance>T.distance)continue;for(var u=0;i>u;++u){var c=z[u];if(I[u]===s){var f=c.pick(l);f&&(T.buttons=t,T.screen=l.coord,T.distance=l.distance,T.object=c,T.index=f.distance,T.dataPosition=f.position,T.dataCoordinate=f.dataCoordinate,T.data=f,a=!0)}}}}}o&&o!==T.object&&(o.highlight&&o.highlight(null),D=!0),T.object&&(T.object.highlight&&T.object.highlight(T.data),D=!0),a=a||T.object!==o,a&&H.onselect&&H.onselect(T),1&t&&!(1&Y)&&H.onclick&&H.onclick(T),Y=t}}),w.addEventListener("webglcontextlost",s);var W=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],Z=[W[0].slice(),W[1].slice()];return x(),H.redraw=function(){_||(D=!0,b())},H}e.exports=s;var l=t("3d-view-controls"),u=t("gl-axes3d"),c=t("gl-axes3d/properties"),f=t("gl-spikes3d"),h=t("gl-select-static"),d=t("gl-fbo"),p=t("a-big-triangle"),g=t("mouse-change"),v=t("gl-mat4/perspective"),m=t("./lib/shader")},{"./lib/shader":142,"3d-view-controls":143,"a-big-triangle":145,"gl-axes3d":146,"gl-axes3d/properties":156,"gl-fbo":108,"gl-mat4/perspective":123,"gl-select-static":163,"gl-spikes3d":158,"mouse-change":207}],160:[function(t,e,r){"use strict";function n(t,e){var r=o[e];if(r||(r=o[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),a=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lc;++c)s[0][c]=Math.min(s[0][c],u[c]),s[1][c]=Math.max(s[1][c],u[c]); -return r[t]=[a,n,s]}var i=t("vectorize-text");e.exports=n;var o={}},{"vectorize-text":244}],161:[function(t,e,r){function n(t,e){var r=i(t,e),n=r.attributes;return n.position.location=0,n.color.location=1,n.glyph.location=2,n.id.location=3,r}var i=t("gl-shader"),o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\n\nuniform vec4 highlightId;\nuniform float highlightScale;\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = 1.0;\n if(distance(highlightId, id) < 0.0001) {\n scale = highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1);\n vec4 viewPosition = view * worldPosition;\n viewPosition = viewPosition / viewPosition.w;\n vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\n \n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float highlightScale, pixelRatio;\nuniform vec4 highlightId;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = pixelRatio;\n if(distance(highlightId.bgr, id.bgr) < 0.001) {\n scale *= highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1.0);\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n \n gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform float highlightScale;\nuniform vec4 highlightId;\nuniform vec3 axes[2];\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float scale, pixelRatio;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) ||\n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float lscale = pixelRatio * scale;\n if(distance(highlightId, id) < 0.0001) {\n lscale *= highlightScale;\n }\n\n vec4 clipCenter = projection * view * model * vec4(position, 1);\n vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\n vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = dataPosition;\n }\n}\n",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) ||\n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = interpColor * opacity;\n }\n}\n",u="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) || \n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n }\n}",c=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],f={vertex:o,fragment:l,attributes:c},h={vertex:a,fragment:l,attributes:c},d={vertex:s,fragment:l,attributes:c},p={vertex:o,fragment:u,attributes:c},g={vertex:a,fragment:u,attributes:c},v={vertex:s,fragment:u,attributes:c};r.createPerspective=function(t){return n(t,f)},r.createOrtho=function(t){return n(t,h)},r.createProject=function(t){return n(t,d)},r.createPickPerspective=function(t){return n(t,p)},r.createPickOrtho=function(t){return n(t,g)},r.createPickProject=function(t){return n(t,v)}},{"gl-shader":164}],162:[function(t,e,r){"use strict";function n(t,e){var r=t[0],n=t[1],i=t[2],o=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*i+e[12]*o,t[1]=e[1]*r+e[5]*n+e[9]*i+e[13]*o,t[2]=e[2]*r+e[6]*n+e[10]*i+e[14]*o,t[3]=e[3]*r+e[7]*n+e[11]*i+e[15]*o,t}function i(t,e,r,i){return n(i,i,r),n(i,i,e),n(i,i,t)}function o(t,e){this.index=t,this.dataCoordinate=this.position=e}function a(t,e,r,n,i,a,s,l,u,c,f,h){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=i,this.colorBuffer=a,this.glyphBuffer=s,this.idBuffer=l,this.vao=u,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.pickId=0,this.pickPerspectiveShader=c,this.pickOrthoShader=f,this.pickProjectShader=h,this.points=[],this._selectResult=new o(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.dirty=!0}function s(t){return t[0]=t[1]=t[2]=0,t}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function u(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function c(t){for(var e=S,r=0;2>r;++r)for(var n=0;3>n;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}function f(t,e,r,n,o){var a,f=e.axesProject,h=e.gl,d=t.uniforms,p=r.model||x,g=r.view||x,v=r.projection||x,y=e.axesBounds,b=c(e.clipBounds);a=e.axes?e.axes.lastCubeProps.axis:[1,1,1],w[0]=2/h.drawingBufferWidth,w[1]=2/h.drawingBufferHeight,t.bind(),d.view=g,d.projection=v,d.screenSize=w,d.highlightId=e.highlightId,d.highlightScale=e.highlightScale,d.clipBounds=b,d.pickGroup=e.pickId/255,d.pixelRatio=e.pixelRatio;for(var _=0;3>_;++_)if(f[_]&&e.projectOpacity[_]<1===n){d.scale=e.projectScale[_],d.opacity=e.projectOpacity[_];for(var S=E,C=0;16>C;++C)S[C]=0;for(var C=0;4>C;++C)S[5*C]=1;S[5*_]=0,a[_]<0?S[12+_]=y[0][_]:S[12+_]=y[1][_],m(S,p,S),d.model=S;var P=(_+1)%3,R=(_+2)%3,N=s(A),z=s(M);N[P]=1,z[R]=1;var I=i(v,g,p,l(k,N)),O=i(v,g,p,l(T,z));if(Math.abs(I[1])>Math.abs(O[1])){var j=I;I=O,O=j,j=N,N=z,z=j;var D=P;P=R,R=D}I[0]<0&&(N[P]=-1),O[1]>0&&(z[R]=-1);for(var F=0,B=0,C=0;4>C;++C)F+=Math.pow(p[4*P+C],2),B+=Math.pow(p[4*R+C],2);N[P]/=Math.sqrt(F),z[R]/=Math.sqrt(B),d.axes[0]=N,d.axes[1]=z,d.fragClipBounds[0]=u(L,b[0],_,-1e8),d.fragClipBounds[1]=u(L,b[1],_,1e8),e.vao.draw(h.TRIANGLES,e.vertexCount),e.lineWidth>0&&(h.lineWidth(e.lineWidth),e.vao.draw(h.LINES,e.lineVertexCount,e.vertexCount))}}function h(t,e,r,n,i,o){var a=r.gl;if(r.vao.bind(),i===r.opacity<1||o){t.bind();var s=t.uniforms;s.model=n.model||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/a.drawingBufferWidth,w[1]=2/a.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=R,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(a.TRIANGLES,r.vertexCount),r.lineWidth>0&&(a.lineWidth(r.lineWidth),r.vao.draw(a.LINES,r.lineVertexCount,r.vertexCount))}f(e,r,n,i,o),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),o=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),f=p(e),h=p(e),d=g(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:f,size:2,type:e.FLOAT},{buffer:h,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),v=new a(e,r,n,i,u,c,f,h,d,o,s,l);return v.update(t),v}var p=t("gl-buffer"),g=t("gl-vao"),v=t("typedarray-pool"),m=t("gl-mat4/multiply"),y=t("./lib/shaders"),b=t("./lib/glyphs"),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=a.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],A=[0,0,0],M=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=x.slice(),L=[0,0,0],S=[[0,0,0],[0,0,0]],C=[-1e8,-1e8,-1e8],P=[1e8,1e8,1e8],R=[C,P];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;h(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;h(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;h(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||0>e)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;3>i;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",o=t.alignment||[0,0],a=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,f=t.angle,h=t.lineColor,d=0,p=0,g=0,m=n.length;t:for(var y=0;m>y;++y){for(var x=n[y],_=0;3>_;++_)if(isNaN(x[_])||!isFinite(x[_]))continue t;var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var A=w[0],M=w[1],k=w[2];p+=3*A.cells.length,g+=2*M.edges.length}var T=p+g,E=v.mallocFloat(3*T),L=v.mallocFloat(4*T),S=v.mallocFloat(2*T),C=v.mallocUint32(T),P=[0,o[1]],R=0,N=p,z=[0,0,0,1],I=[0,0,0,1],O=Array.isArray(u)&&Array.isArray(u[0]),j=Array.isArray(h)&&Array.isArray(h[0]);t:for(var y=0;m>y;++y){for(var x=n[y],_=0;3>_;++_){if(isNaN(x[_])||!isFinite(x[_])){d+=1;continue t}s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_])}var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var A=w[0],M=w[1],k=w[2];if(Array.isArray(u)){var D;if(D=O?u[y]:u,3===D.length){for(var _=0;3>_;++_)z[_]=D[_];z[3]=1}else if(4===D.length)for(var _=0;4>_;++_)z[_]=D[_]}else z[0]=z[1]=z[2]=0,z[3]=1;if(Array.isArray(h)){var D;if(D=j?h[y]:h,3===D.length){for(var _=0;3>_;++_)I[_]=D[_];I[_]=1}else if(4===D.length)for(var _=0;4>_;++_)I[_]=D[_]}else I[0]=I[1]=I[2]=0,I[3]=1;var F=.5;Array.isArray(c)?F=+c[y]:c?F=+c:this.useOrtho&&(F=12);var B=0;Array.isArray(f)?B=+f[y]:f&&(B=+f);for(var U=Math.cos(B),V=Math.sin(B),x=n[y],_=0;3>_;++_)s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_]);o[0]<0?P[0]=o[0]*(1+k[1][0]):o[0]>0&&(P[0]=-o[0]*(1+k[0][0]));for(var q=A.cells,H=A.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*R+Y]=x[Y];for(var Y=0;4>Y;++Y)L[4*R+Y]=z[Y];C[R]=d;var W=H[G[X]];S[2*R]=F*(U*W[0]-V*W[1]+P[0]),S[2*R+1]=F*(V*W[0]+U*W[1]+P[1]),R+=1}for(var q=M.edges,H=M.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*N+Y]=x[Y];for(var Y=0;4>Y;++Y)L[4*N+Y]=I[Y];C[N]=d;var W=H[G[X]];S[2*N]=F*(U*W[0]-V*W[1]+P[0]),S[2*N+1]=F*(V*W[0]+U*W[1]+P[1]),N+=1}d+=1}this.vertexCount=p,this.lineVertexCount=g,this.pointBuffer.update(E),this.colorBuffer.update(L),this.glyphBuffer.update(S),this.idBuffer.update(new Uint32Array(C)),v.free(E),v.free(L),v.free(S),v.free(C),this.bounds=[a,s],this.points=n,this.pointCount=n.length}},_.dispose=function(){this.shader.dispose(),this.orthoShader.dispose(),this.pickPerspectiveShader.dispose(),this.pickOrthoShader.dispose(),this.vao.dispose(),this.pointBuffer.dispose(),this.colorBuffer.dispose(),this.glyphBuffer.dispose(),this.idBuffer.dispose()}},{"./lib/glyphs":160,"./lib/shaders":161,"gl-buffer":105,"gl-mat4/multiply":122,"gl-vao":192,"typedarray-pool":242}],163:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function o(t,e){var r=a(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=o;var a=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(255>_inline_52_arg0_||255>_inline_52_arg1_||255>_inline_52_arg2_||255>_inline_52_arg3_){var _inline_52_l=_inline_52_arg4_-_inline_52_arg6_[0],_inline_52_a=_inline_52_arg5_-_inline_52_arg6_[1],_inline_52_f=_inline_52_l*_inline_52_l+_inline_52_a*_inline_52_a;_inline_52_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;r*e*4>i;++i)n[i]=255}return t}}}),f.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))},f.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},f.query=function(t,e,r){if(!this.gl)return null;var i=this.fbo.shape.slice();t=0|t,e=0|e,"number"!=typeof r&&(r=1);var o=0|Math.min(Math.max(t-r,0),i[0]),a=0|Math.min(Math.max(t+r,0),i[0]),s=0|Math.min(Math.max(e-r,0),i[1]),u=0|Math.min(Math.max(e+r,0),i[1]);if(o>=a||s>=u)return null;var f=[a-o,u-s],h=l(this.buffer,[f[0],f[1],4],[4,4*i[0],1],4*(o+i[0]*s)),d=c(h.hi(f[0],f[1],1),r,r),p=d[0],g=d[1];if(0>p||Math.pow(this.radius,2)=0){for(var M=0|A.type.charAt(A.type.length-1),k=new Array(M),T=0;M>T;++T)k[T]=_.length,x.push(A.name+"["+T+"]"),"number"==typeof A.location?_.push(A.location+T):Array.isArray(A.location)&&A.location.length===M&&"number"==typeof A.location[T]?_.push(0|A.location[T]):_.push(-1);b.push({name:A.name,type:A.type,locations:k})}else b.push({name:A.name,type:A.type,locations:[_.length]}),x.push(A.name),"number"==typeof A.location?_.push(0|A.location):_.push(-1)}for(var E=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(E)>=0;)E+=1;_[w]=E}var L=new Array(r.length);o(),d._relink=o,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",a(p,d,r,L))},e.exports=o},{"./lib/GLError":165,"./lib/create-attributes":166,"./lib/create-uniforms":167,"./lib/reflect":168,"./lib/runtime-reflect":169,"./lib/shader-cache":170}],165:[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},{}],166:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=o}function i(t,e,r,i,o,a,s){for(var l=["gl","v"],u=[],c=0;o>c;++c)l.push("x"+c),u.push("x"+c);l.push("if(x0.length===void 0){return gl.vertexAttrib"+o+"f(v,"+u.join()+")}else{return gl.vertexAttrib"+o+"fv(v,x0)}");var f=Function.apply(null,l),h=new n(t,e,r,i,o,f);Object.defineProperty(a,s,{set:function(e){return t.disableVertexAttribArray(i[r]),f(t,i[r],e),e},get:function(){return h},enumerable:!0})}function o(t,e,r,n,o,a,s){for(var l=new Array(o),u=new Array(o),c=0;o>c;++c)i(t,e,r[c],n,o,l,c),u[c]=l[c];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;o>e;++e)u[e].location=t[e];else for(var e=0;o>e;++e)u[e].location=t+e;return t},get:function(){for(var t=new Array(o),e=0;o>e;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,a,s){e=e||t.FLOAT,i=!!i,a=a||o*o,s=s||0;for(var l=0;o>l;++l){var u=n[r[l]];t.vertexAttribPointer(u,o,e,i,a,s+l*o),t.enableVertexAttribArray(u)}};var f=new Array(o),h=t["vertexAttrib"+o+"fv"];Object.defineProperty(a,s,{set:function(e){for(var i=0;o>i;++i){var a=n[r[i]];if(t.disableVertexAttribArray(a),Array.isArray(e[0]))h.call(t,a,e[i]);else{for(var s=0;o>s;++s)f[s]=e[o*i+s];h.call(t,a,f)}}return e},get:function(){return l},enumerable:!0})}function a(t,e,r,n){for(var a={},l=0,u=r.length;u>l;++l){var c=r[l],f=c.name,h=c.type,d=c.locations;switch(h){case"bool":case"int":case"float":i(t,e,d[0],n,1,a,f);break;default:if(h.indexOf("vec")>=0){var p=h.charCodeAt(h.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,a,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);o(t,e,d,n,p,a,f)}}}return a}e.exports=a;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,o=i._gl,a=i._locations[i._index];o.vertexAttribPointer(a,i._dimension,t||o.FLOAT,!!e,r||0,n||0),o.enableVertexAttribArray(a)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":165}],167:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e,r,o){function l(r){var n=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}");return n(t,e,o)}function u(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(n>=0&&1>=n&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],o=t;o+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(o,i)):r.push([o,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=c("",e),a=0;a=0&&1>=e&&t.length===4+e){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var a=p(i);Object.defineProperty(t,e,{get:n(a),set:f(i),enumerable:!0,configurable:!1})}else o[i]?Object.defineProperty(t,e,{get:l(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=h(r[i].type)}function p(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in a||(a[l[0]]=[]),a=a[l[0]];for(var u=1;uo;++o){var a=t.getActiveUniform(e,o);if(a){var s=n(t,a.type);if(a.size>1)for(var l=0;lo;++o){var a=t.getActiveAttrib(e,o);a&&i.push({name:a.name,type:n(t,a.type)})}return i}r.uniforms=i,r.attributes=o;var a={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},s=null},{}],170:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=o,this.programs=[],this.cache=a}function i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function o(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);try{var o=f(i,r,e)}catch(a){throw console.warn("Failed to format compiler error: "+a),new c(i,"Error compiling shader:\n"+i)}throw new c(i,o.short,o.long)}return n}function a(t,e,r,n,i){var o=t.createProgram();t.attachShader(o,e),t.attachShader(o,r);for(var a=0;an;++n){var o=t.programs[r[n]];o&&(delete t.programs[n],e.deleteProgram(o))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var g=i.prototype;g.getShaderReference=function(t,e){var r=this.gl,i=this.shaders[t===r.FRAGMENT_SHADER|0],a=i[e];if(a&&r.isShader(a.shader))a.count+=1;else{var s=o(r,t,e);a=i[e]=new n(p++,e,t,s,[],1,this)}return a},g.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),o=this.programs[i];return o&&this.gl.isProgram(o)||(this.programs[i]=o=a(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),o}},{"./GLError":165,"gl-format-compiler-error":171,"weakmap-shim":181}],171:[function(t,e,r){function n(t,e,r){"use strict";var n=a(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===o.FRAGMENT_SHADER?"fragment":"vertex");for(var u=i("Error compiling %s shader %s:\n",l,n),c=i("%s%s",u,t),f=t.split("\n"),h={},d=0;dr;++r)for(var n=0;3>n;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}function f(t,e,r,n,o){var a,f=e.axesProject,h=e.gl,d=t.uniforms,p=r.model||x,g=r.view||x,v=r.projection||x,y=e.axesBounds,b=c(e.clipBounds);a=e.axes?e.axes.lastCubeProps.axis:[1,1,1],w[0]=2/h.drawingBufferWidth,w[1]=2/h.drawingBufferHeight,t.bind(),d.view=g,d.projection=v,d.screenSize=w,d.highlightId=e.highlightId,d.highlightScale=e.highlightScale,d.clipBounds=b,d.pickGroup=e.pickId/255,d.pixelRatio=e.pixelRatio;for(var _=0;3>_;++_)if(f[_]&&e.projectOpacity[_]<1===n){d.scale=e.projectScale[_],d.opacity=e.projectOpacity[_];for(var S=E,C=0;16>C;++C)S[C]=0;for(var C=0;4>C;++C)S[5*C]=1;S[5*_]=0,a[_]<0?S[12+_]=y[0][_]:S[12+_]=y[1][_],m(S,p,S),d.model=S;var P=(_+1)%3,R=(_+2)%3,N=s(A),z=s(M);N[P]=1,z[R]=1;var I=i(v,g,p,l(k,N)),O=i(v,g,p,l(T,z));if(Math.abs(I[1])>Math.abs(O[1])){var j=I;I=O,O=j,j=N,N=z,z=j;var D=P;P=R,R=D}I[0]<0&&(N[P]=-1),O[1]>0&&(z[R]=-1);for(var F=0,B=0,C=0;4>C;++C)F+=Math.pow(p[4*P+C],2),B+=Math.pow(p[4*R+C],2);N[P]/=Math.sqrt(F),z[R]/=Math.sqrt(B),d.axes[0]=N,d.axes[1]=z,d.fragClipBounds[0]=u(L,b[0],_,-1e8),d.fragClipBounds[1]=u(L,b[1],_,1e8),e.vao.draw(h.TRIANGLES,e.vertexCount),e.lineWidth>0&&(h.lineWidth(e.lineWidth),e.vao.draw(h.LINES,e.lineVertexCount,e.vertexCount))}}function h(t,e,r,n,i,o){var a=r.gl;if(r.vao.bind(),i===r.opacity<1||o){t.bind();var s=t.uniforms;s.model=n.model||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/a.drawingBufferWidth,w[1]=2/a.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=R,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(a.TRIANGLES,r.vertexCount),r.lineWidth>0&&(a.lineWidth(r.lineWidth),r.vao.draw(a.LINES,r.lineVertexCount,r.vertexCount))}f(e,r,n,i,o),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),o=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),f=p(e),h=p(e),d=g(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:f,size:2,type:e.FLOAT},{buffer:h,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),v=new a(e,r,n,i,u,c,f,h,d,o,s,l);return v.update(t),v}var p=t("gl-buffer"),g=t("gl-vao"),v=t("typedarray-pool"),m=t("gl-mat4/multiply"),y=t("./lib/shaders"),b=t("./lib/glyphs"),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=a.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],A=[0,0,0],M=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=x.slice(),L=[0,0,0],S=[[0,0,0],[0,0,0]],C=[-1e8,-1e8,-1e8],P=[1e8,1e8,1e8],R=[C,P];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;h(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;h(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;h(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||0>e)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;3>i;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",o=t.alignment||[0,0],a=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,f=t.angle,h=t.lineColor,d=0,p=0,g=0,m=n.length;t:for(var y=0;m>y;++y){for(var x=n[y],_=0;3>_;++_)if(isNaN(x[_])||!isFinite(x[_]))continue t;var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var A=w[0],M=w[1],k=w[2];p+=3*A.cells.length,g+=2*M.edges.length}var T=p+g,E=v.mallocFloat(3*T),L=v.mallocFloat(4*T),S=v.mallocFloat(2*T),C=v.mallocUint32(T),P=[0,o[1]],R=0,N=p,z=[0,0,0,1],I=[0,0,0,1],O=Array.isArray(u)&&Array.isArray(u[0]),j=Array.isArray(h)&&Array.isArray(h[0]);t:for(var y=0;m>y;++y){for(var x=n[y],_=0;3>_;++_){if(isNaN(x[_])||!isFinite(x[_])){d+=1;continue t}s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_])}var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var A=w[0],M=w[1],k=w[2];if(Array.isArray(u)){var D;if(D=O?u[y]:u,3===D.length){for(var _=0;3>_;++_)z[_]=D[_];z[3]=1}else if(4===D.length)for(var _=0;4>_;++_)z[_]=D[_]}else z[0]=z[1]=z[2]=0,z[3]=1;if(Array.isArray(h)){var D;if(D=j?h[y]:h,3===D.length){for(var _=0;3>_;++_)I[_]=D[_];I[_]=1}else if(4===D.length)for(var _=0;4>_;++_)I[_]=D[_]}else I[0]=I[1]=I[2]=0,I[3]=1;var F=.5;Array.isArray(c)?F=+c[y]:c?F=+c:this.useOrtho&&(F=12);var B=0;Array.isArray(f)?B=+f[y]:f&&(B=+f);for(var U=Math.cos(B),V=Math.sin(B),x=n[y],_=0;3>_;++_)s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_]);o[0]<0?P[0]=o[0]*(1+k[1][0]):o[0]>0&&(P[0]=-o[0]*(1+k[0][0]));for(var q=A.cells,H=A.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*R+Y]=x[Y];for(var Y=0;4>Y;++Y)L[4*R+Y]=z[Y];C[R]=d;var W=H[G[X]];S[2*R]=F*(U*W[0]-V*W[1]+P[0]),S[2*R+1]=F*(V*W[0]+U*W[1]+P[1]),R+=1}for(var q=M.edges,H=M.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*N+Y]=x[Y];for(var Y=0;4>Y;++Y)L[4*N+Y]=I[Y];C[N]=d;var W=H[G[X]];S[2*N]=F*(U*W[0]-V*W[1]+P[0]),S[2*N+1]=F*(V*W[0]+U*W[1]+P[1]),N+=1}d+=1}this.vertexCount=p,this.lineVertexCount=g,this.pointBuffer.update(E),this.colorBuffer.update(L),this.glyphBuffer.update(S),this.idBuffer.update(new Uint32Array(C)),v.free(E),v.free(L),v.free(S),v.free(C),this.bounds=[a,s],this.points=n,this.pointCount=n.length}},_.dispose=function(){this.shader.dispose(),this.orthoShader.dispose(),this.pickPerspectiveShader.dispose(),this.pickOrthoShader.dispose(),this.vao.dispose(),this.pointBuffer.dispose(),this.colorBuffer.dispose(),this.glyphBuffer.dispose(),this.idBuffer.dispose()}},{"./lib/glyphs":160,"./lib/shaders":161,"gl-buffer":105,"gl-mat4/multiply":122,"gl-vao":192,"typedarray-pool":242}],163:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function o(t,e){var r=a(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=o;var a=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(255>_inline_49_arg0_||255>_inline_49_arg1_||255>_inline_49_arg2_||255>_inline_49_arg3_){var _inline_49_l=_inline_49_arg4_-_inline_49_arg6_[0],_inline_49_a=_inline_49_arg5_-_inline_49_arg6_[1],_inline_49_f=_inline_49_l*_inline_49_l+_inline_49_a*_inline_49_a;_inline_49_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;r*e*4>i;++i)n[i]=255}return t}}}),f.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))},f.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},f.query=function(t,e,r){if(!this.gl)return null;var i=this.fbo.shape.slice();t=0|t,e=0|e,"number"!=typeof r&&(r=1);var o=0|Math.min(Math.max(t-r,0),i[0]),a=0|Math.min(Math.max(t+r,0),i[0]),s=0|Math.min(Math.max(e-r,0),i[1]),u=0|Math.min(Math.max(e+r,0),i[1]);if(o>=a||s>=u)return null;var f=[a-o,u-s],h=l(this.buffer,[f[0],f[1],4],[4,4*i[0],1],4*(o+i[0]*s)),d=c(h.hi(f[0],f[1],1),r,r),p=d[0],g=d[1];if(0>p||Math.pow(this.radius,2)=0){for(var M=0|A.type.charAt(A.type.length-1),k=new Array(M),T=0;M>T;++T)k[T]=_.length,x.push(A.name+"["+T+"]"),"number"==typeof A.location?_.push(A.location+T):Array.isArray(A.location)&&A.location.length===M&&"number"==typeof A.location[T]?_.push(0|A.location[T]):_.push(-1);b.push({name:A.name,type:A.type,locations:k})}else b.push({name:A.name,type:A.type,locations:[_.length]}),x.push(A.name),"number"==typeof A.location?_.push(0|A.location):_.push(-1)}for(var E=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(E)>=0;)E+=1;_[w]=E}var L=new Array(r.length);o(),d._relink=o,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",a(p,d,r,L))},e.exports=o},{"./lib/GLError":165,"./lib/create-attributes":166,"./lib/create-uniforms":167,"./lib/reflect":168,"./lib/runtime-reflect":169,"./lib/shader-cache":170}],165:[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},{}],166:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=o}function i(t,e,r,i,o,a,s){for(var l=["gl","v"],u=[],c=0;o>c;++c)l.push("x"+c),u.push("x"+c);l.push("if(x0.length===void 0){return gl.vertexAttrib"+o+"f(v,"+u.join()+")}else{return gl.vertexAttrib"+o+"fv(v,x0)}");var f=Function.apply(null,l),h=new n(t,e,r,i,o,f);Object.defineProperty(a,s,{set:function(e){return t.disableVertexAttribArray(i[r]),f(t,i[r],e),e},get:function(){return h},enumerable:!0})}function o(t,e,r,n,o,a,s){for(var l=new Array(o),u=new Array(o),c=0;o>c;++c)i(t,e,r[c],n,o,l,c),u[c]=l[c];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;o>e;++e)u[e].location=t[e];else for(var e=0;o>e;++e)u[e].location=t+e;return t},get:function(){for(var t=new Array(o),e=0;o>e;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,a,s){e=e||t.FLOAT,i=!!i,a=a||o*o,s=s||0;for(var l=0;o>l;++l){var u=n[r[l]];t.vertexAttribPointer(u,o,e,i,a,s+l*o),t.enableVertexAttribArray(u)}};var f=new Array(o),h=t["vertexAttrib"+o+"fv"];Object.defineProperty(a,s,{set:function(e){for(var i=0;o>i;++i){var a=n[r[i]];if(t.disableVertexAttribArray(a),Array.isArray(e[0]))h.call(t,a,e[i]);else{for(var s=0;o>s;++s)f[s]=e[o*i+s];h.call(t,a,f)}}return e},get:function(){return l},enumerable:!0})}function a(t,e,r,n){for(var a={},l=0,u=r.length;u>l;++l){var c=r[l],f=c.name,h=c.type,d=c.locations;switch(h){case"bool":case"int":case"float":i(t,e,d[0],n,1,a,f);break;default:if(h.indexOf("vec")>=0){var p=h.charCodeAt(h.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,a,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);o(t,e,d,n,p,a,f)}}}return a}e.exports=a;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,o=i._gl,a=i._locations[i._index];o.vertexAttribPointer(a,i._dimension,t||o.FLOAT,!!e,r||0,n||0),o.enableVertexAttribArray(a)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":165}],167:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e,r,o){function l(r){var n=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}");return n(t,e,o)}function u(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(n>=0&&1>=n&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],o=t;o+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(o,i)):r.push([o,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=c("",e),a=0;a=0&&1>=e&&t.length===4+e){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var a=p(i);Object.defineProperty(t,e,{get:n(a),set:f(i),enumerable:!0,configurable:!1})}else o[i]?Object.defineProperty(t,e,{get:l(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=h(r[i].type)}function p(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in a||(a[l[0]]=[]),a=a[l[0]];for(var u=1;uo;++o){var a=t.getActiveUniform(e,o);if(a){var s=n(t,a.type);if(a.size>1)for(var l=0;lo;++o){var a=t.getActiveAttrib(e,o);a&&i.push({name:a.name,type:n(t,a.type)})}return i}r.uniforms=i,r.attributes=o;var a={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},s=null},{}],170:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=o,this.programs=[],this.cache=a}function i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function o(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);try{var o=f(i,r,e)}catch(a){throw console.warn("Failed to format compiler error: "+a),new c(i,"Error compiling shader:\n"+i)}throw new c(i,o.short,o.long)}return n}function a(t,e,r,n,i){var o=t.createProgram();t.attachShader(o,e),t.attachShader(o,r);for(var a=0;an;++n){var o=t.programs[r[n]];o&&(delete t.programs[n],e.deleteProgram(o))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var g=i.prototype;g.getShaderReference=function(t,e){var r=this.gl,i=this.shaders[t===r.FRAGMENT_SHADER|0],a=i[e];if(a&&r.isShader(a.shader))a.count+=1;else{var s=o(r,t,e);a=i[e]=new n(p++,e,t,s,[],1,this)}return a},g.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),o=this.programs[i];return o&&this.gl.isProgram(o)||(this.programs[i]=o=a(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),o}},{"./GLError":165,"gl-format-compiler-error":171,"weakmap-shim":181}],171:[function(t,e,r){function n(t,e,r){"use strict";var n=a(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===o.FRAGMENT_SHADER?"fragment":"vertex");for(var u=i("Error compiling %s shader %s:\n",l,n),c=i("%s%s",u,t),f=t.split("\n"),h={},d=0;ds;s++)if(g=i(t[s]),"string"===g)v[v.length]=t[s];else if("array"===g){if(u=t[s],u[2])for(n=e[d],l=0;l=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}a.json.test(u[8])?v[v.length]=n:(!a.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(a.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?o(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=a.text.exec(e)))n[n.length]=r[0];else if(null!==(r=a.modulo.exec(e)))n[n.length]="%";else{if(null===(r=a.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var o=[],s=r[2],l=[];if(null===(l=a.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=a.key_access.exec(s)))o[o.length]=l[1];else{if(null===(l=a.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=l[1]}r[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],179:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":180}],180:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],181:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},"delete":function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":179}],182:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n worldCoordinate = vec3(uv.zw, f.x);\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = beckmannSpecular_1_1(L, V, N, roughness);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = texture2D(colormap, vec2(value, value));\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,a,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},r.createPickContourShader=function(t){var e=n(t,a,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":164}],183:[function(t,e,r){arguments[4][9][0].apply(r,arguments)},{dup:9}],184:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;t>r;++r)e.push("out",r,"s=0.5*(inp",r,"l-inp",r,"r);");for(var n=["array"],i=["junk"],r=0;t>r;++r){n.push("array"),i.push("out"+r+"s");var o=a(t);o[r]=-1,n.push({array:0,offset:o.slice()}),o[r]=1,n.push({array:0,offset:o.slice()}),i.push("inp"+r+"l","inp"+r+"r")}return l[t]=s({args:n,pre:c,post:c,body:{body:e.join(""),args:i.map(function(t){return{name:t,lvalue:0===t.indexOf("out"),rvalue:0===t.indexOf("inp"),count:"junk"!==t|0}}),thisVars:[],localVars:[]},funcName:"fdTemplate"+t})}function i(t){function e(e){for(var r=o-e.length,n=[],i=[],s=[],l=0;o>l;++l)e.indexOf(l+1)>=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",h.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>1){diff(",f,",src.pick(",h.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",f,");};");break;case"mirror":0===r?a.push("dst.set(",s.join(),",",c,",0);"):a.push("zero(",f,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===r?a.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>2){diff(",f,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",f,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var o=t.length,a=["function gradient(dst,src){var s=src.shape.slice();"],s=0;1<s;++s){for(var c=[],d=0;o>d;++d)s&1<=s;++s)v.push("grad"+s),m.push(n(s));v.push(a.join(""));var y=Function.apply(void 0,v),i=y.apply(void 0,m);return l[r]=i,i}function o(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?a(e.dimension,r):a(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;nr;++r)for(a=a||e.surfaceProject[r],n=0;3>n;++n)s=s||e.contourProject[r][n];for(r=0;3>r;++r){var l=F.projections[r];for(n=0;16>n;++n)l[n]=0;for(n=0;4>n;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(o[r]>0)][r],A(l,t.model,l);var u=F.clipBounds[r];for(i=0;2>i;++i)for(n=0;3>n;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return F.showSurface=a,F.showContour=s,F}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||N,n.view=t.view||N,n.projection=t.projection||N,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=M(n.inverseModel,n.model);for(var i=0;2>i;++i)for(var o=n.clipBounds[i],s=0;3>s;++s)o[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V;var l=U;for(A(l,n.view,n.model),A(l,n.projection,l),M(l,l),i=0;3>i;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;3>i;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;3>i;++i){var c=l[12+i];for(s=0;3>s;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var f=a(n,this);if(f.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;3>i;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=f.projections[i],this._shader.uniforms.clipBounds=f.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(f.showContour&&!e){var h=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,h.bind(),h.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;3>i;++i)for(h.uniforms.permutation=I[i],r.lineWidth(this.contourWidth[i]),s=0;si;++i)for(h.uniforms.model=f.projections[i],h.uniforms.clipBounds=f.clipBounds[i],s=0;3>s;++s)if(this.contourProject[i][s]){h.uniforms.permutation=I[s],r.lineWidth(this.contourWidth[s]);for(var p=0;pi;++i)if(0!==this._dynamicCounts[i])for(h.uniforms.model=n.model,h.uniforms.clipBounds=n.clipBounds,h.uniforms.permutation=I[i],r.lineWidth(this.dynamicWidth[i]),h.uniforms.contourColor=this.dynamicColor[i],h.uniforms.contourTint=this.dynamicTint[i],h.uniforms.height=this.dynamicLevel[i],d.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]),s=0;3>s;++s)this.contourProject[s][i]&&(h.uniforms.model=f.projections[s],h.uniforms.clipBounds=f.clipBounds[s],d.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]));d.unbind()}}function l(t,e){var r=e.shape.slice(),n=t.shape.slice();b.assign(t.lo(1,1).hi(r[0],r[1]),e),b.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),b.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),b.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),b.assign(t.lo(n[0]-1,1).hi(1,r[1]),e.lo(r[0]-1)),t.set(0,0,e.get(0,0)),t.set(0,n[1]-1,e.get(0,r[1]-1)),t.set(n[0]-1,0,e.get(r[0]-1,0)),t.set(n[0]-1,n[1]-1,e.get(r[0]-1,r[1]-1))}function u(t,e){return Array.isArray(t)?[e(t[0]),e(t[1]),e(t[2])]:[e(t),e(t),e(t)]}function c(t){return Array.isArray(t)?3===t.length?[t[0],t[1],t[2],1]:[t[0],t[1],t[2],t[3]]:[0,0,0,1]}function f(t){if(Array.isArray(t)){if(Array.isArray(t))return[c(t[0]),c(t[1]),c(t[2])];var e=c(t);return[e.slice(),e.slice(),e.slice()]}}function h(t){var e=t.gl,r=L(e),n=C(e),i=S(e),a=P(e),s=p(e),l=g(e,[{buffer:s,size:4,stride:R,offset:0},{buffer:s,size:3,stride:R,offset:16},{buffer:s,size:3,stride:R,offset:28}]),u=p(e),c=g(e,[{buffer:u,size:4,stride:20,offset:0},{buffer:u,size:1,stride:20,offset:16}]),f=p(e),h=g(e,[{buffer:f,size:2,type:e.FLOAT}]),d=v(e,1,O,e.RGBA,e.UNSIGNED_BYTE);d.minFilter=e.LINEAR,d.magFilter=e.LINEAR;var m=new o(e,[0,0],[[0,0,0],[0,0,0]],r,n,s,l,d,i,a,u,c,f,h),y={levels:[[],[],[]]};for(var b in t)y[b]=t[b];return y.colormap=y.colormap||"jet",m.update(y),m}e.exports=h;var d=t("bit-twiddle"),p=t("gl-buffer"),g=t("gl-vao"),v=t("gl-texture2d"),m=t("typedarray-pool"),y=t("colormap"),b=t("ndarray-ops"),x=t("ndarray-pack"),_=t("ndarray"),w=t("surface-nets"),A=t("gl-mat4/multiply"),M=t("gl-mat4/invert"),k=t("binary-search-bounds"),T=t("ndarray-gradient"),E=t("./lib/shaders"),L=E.createShader,S=E.createContourShader,C=E.createPickShader,P=E.createPickContourShader,R=40,N=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],z=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],I=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];!function(){for(var t=0;3>t;++t){var e=I[t],r=(t+1)%3,n=(t+2)%3;e[r+0]=1,e[n+3]=1,e[t+6]=1}}();var O=265,j=o.prototype;j.isTransparent=function(){return this.opacity<1},j.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},j.pickSlots=1,j.setPickBase=function(t){this.pickId=t};var D=[0,0,0],F={showSurface:!1,showContour:!1,projections:[N.slice(),N.slice(),N.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:N,view:N,projection:N,inverseModel:N.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1},U=N.slice(),V=[1,0,0,0,1,0,0,0,1];j.draw=function(t){return s.call(this,t,!1)},j.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:N,view:N,projection:N,inverseModel:N,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};j.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||N,r.view=t.view||N,r.projection=t.projection||N,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;2>n;++n)for(var i=r.clipBounds[n],o=0;3>o;++o)i[o]=Math.min(Math.max(this.clipBounds[n][o],-1e8),1e8);var s=a(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;3>n;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),o=0;3>o;++o)for(e.lineWidth(this.contourWidth[o]),l.uniforms.permutation=I[o],n=0;nn;++n)for(l.uniforms.model=s.projections[n],l.uniforms.clipBounds=s.clipBounds[n],o=0;3>o;++o)if(this.contourProject[n][o]){l.uniforms.permutation=I[o],e.lineWidth(this.contourWidth[o]);for(var c=0;c>4)/16)/255,i=Math.floor(n),o=n-i,a=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(a),l=a-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;2>c;++c)for(var f=c?o:1-o,h=0;2>h;++h)for(var d=h?l:1-l,p=i+c,g=s+h,v=f*d,m=0;3>m;++m)u[m]+=this._field[m].get(p,g)*v;for(var y=this._pickResult.level,b=0;3>b;++b)if(y[b]=k.le(this.contourLevels[b],u[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]Math.abs(_-u[b])&&(y[b]+=1)}for(r.index[0]=.5>o?i:i+1,r.index[1]=.5>l?s:s+1,r.uv[0]=n/e[0],r.uv[1]=a/e[1],m=0;3>m;++m)r.dataCoordinate[m]=this._field[m].get(r.index[0],r.index[1]);return r},j.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=f(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=f(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(m.freeFloat(this._field[2].data),this._field[2].data=m.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var o=this.shape,a=0;2>a;++a)this._field[2].size>this._field[a].data.length&&(m.freeFloat(this._field[a].data),this._field[a].data=m.mallocFloat(this._field[2].size)),this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(a=0;2>a;++a){var c=s[a];for(y=0;2>y;++y)if(c.shape[y]!==o[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[a],c)}}else if(t.ticks){var h=t.ticks;if(!Array.isArray(h)||2!==h.length)throw new Error("gl-surface: invalid ticks");for(a=0;2>a;++a){var p=h[a];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==o[a])throw new Error("gl-surface: invalid tick length");var g=_(p.data,o);g.stride[a]=p.stride[0],g.stride[1^a]=0,l(this._field[a],g)}}else{for(a=0;2>a;++a){var v=[0,0];v[a]=1,this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2],v,0)}this._field[0].set(0,0,0);for(var y=0;ya;++a)T(x.pick(a),b[a],"mirror");var A=_(m.mallocFloat(3*b[2].size),[o[0]+2,o[1]+2,3]);for(a=0;aI?(I=Math.max(Math.abs(P),Math.abs(R),Math.abs(N)),1e-8>I?(N=1,R=P=0,I=1):I=1/I):I=1/Math.sqrt(I),A.set(a,y,0,P*I), A.set(a,y,1,R*I),A.set(a,y,2,N*I)}m.free(x.data);var O=[1/0,1/0,1/0],j=[-(1/0),-(1/0),-(1/0)],D=1/0,F=-(1/0),B=(o[0]-1)*(o[1]-1)*6,U=m.mallocFloat(d.nextPow2(10*B)),V=0,q=0;for(a=0;aH;++H)for(var G=0;2>G;++G)for(var X=0;3>X;++X){var Y=this._field[X].get(1+a+H,1+y+G);if(isNaN(Y)||!isFinite(Y))continue t}for(X=0;6>X;++X){var W=a+z[X][0],Z=y+z[X][1],Q=this._field[0].get(W+1,Z+1),$=this._field[1].get(W+1,Z+1);Y=this._field[2].get(W+1,Z+1);var K=Y;P=A.get(W+1,Z+1,0),R=A.get(W+1,Z+1,1),N=A.get(W+1,Z+1,2),t.intensity&&(K=t.intensity.get(W,Z)),U[V++]=W,U[V++]=Z,U[V++]=Q,U[V++]=$,U[V++]=Y,U[V++]=0,U[V++]=K,U[V++]=P,U[V++]=R,U[V++]=N,O[0]=Math.min(O[0],Q),O[1]=Math.min(O[1],$),O[2]=Math.min(O[2],Y),D=Math.min(D,K),j[0]=Math.max(j[0],Q),j[1]=Math.max(j[1],$),j[2]=Math.max(j[2],Y),F=Math.max(F,K),q+=1}}for(t.intensityBounds&&(D=+t.intensityBounds[0],F=+t.intensityBounds[1]),a=6;V>a;a+=10)U[a]=(U[a]-D)/(F-D);this._vertexCount=q,this._coordinateBuffer.update(U.subarray(0,V)),m.freeFloat(U),m.free(A.data),this.bounds=[O,j],this.intensity=t.intensity||this._field[2],this.intensityBounds[0]===D&&this.intensityBounds[1]===F||(r=!0),this.intensityBounds=[D,F]}if("levels"in t){var J=t.levels;for(J=Array.isArray(J[0])?J.slice():[[],[],J],a=0;3>a;++a)J[a]=J[a].slice(),J.sort(function(t,e){return t-e});t:for(a=0;3>a;++a){if(J[a].length!==this.contourLevels[a].length){r=!0;break}for(y=0;yet;++et){J=this.contourLevels[et];var rt=[],nt=[],it=[0,0,0];for(a=0;aX;++X){var st=ot.positions[at[X]],lt=st[0],ut=0|Math.floor(lt),ct=lt-ut,ft=st[1],ht=0|Math.floor(ft),dt=ft-ht,pt=!1;e:for(var gt=0;3>gt;++gt){it[gt]=0;var vt=(et+gt+1)%3;for(H=0;2>H;++H){var mt=H?ct:1-ct;for(W=0|Math.min(Math.max(ut+H,0),o[0]),G=0;2>G;++G){var yt=G?dt:1-dt;if(Z=0|Math.min(Math.max(ht+G,0),o[1]),Y=2>gt?this._field[vt].get(W,Z):(this.intensity.get(W,Z)-this.intensityBounds[0])/(this.intensityBounds[1]-this.intensityBounds[0]),!isFinite(Y)||isNaN(Y)){pt=!0;break e}var bt=mt*yt;it[gt]+=bt*Y}}}if(pt){if(X>0){for(var xt=0;5>xt;++xt)tt.pop();q-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),q+=1}}nt.push(q)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=m.mallocFloat(tt.length);for(a=0;at;++t)m.freeFloat(this._field[t].data)},j.highlight=function(t){if(!t)return this._dynamicCounts=[0,0,0],this.dyanamicLevel=[NaN,NaN,NaN],void(this.highlightLevel=[-1,-1,-1]);for(var e=0;3>e;++e)this.enableHighlight[e]?this.highlightLevel[e]=t.level[e]:this.highlightLevel[e]=-1;var r;if(r=this.snapToData?t.dataCoordinate:t.position,this.enableDynamic[0]&&r[0]!==this.dynamicLevel[0]||this.enableDynamic[1]&&r[1]!==this.dynamicLevel[1]||this.enableDynamic[2]&&r[2]!==this.dynamicLevel[2]){for(var n=0,i=this.shape,o=m.mallocFloat(12*i[0]*i[1]),a=0;3>a;++a)if(this.enableDynamic[a]){this.dynamicLevel[a]=r[a];var s=(a+1)%3,l=(a+2)%3,u=this._field[a],c=this._field[s],f=this._field[l],h=(this.intensity,w(u,r[a])),d=h.cells,p=h.positions;for(this._dynamicOffsets[a]=n,e=0;ev;++v){var y=p[g[v]],b=+y[0],x=0|b,_=0|Math.min(x+1,i[0]),A=b-x,M=1-A,k=+y[1],T=0|k,E=0|Math.min(T+1,i[1]),L=k-T,S=1-L,C=M*S,P=M*L,R=A*S,N=A*L,z=C*c.get(x,T)+P*c.get(x,E)+R*c.get(_,T)+N*c.get(_,E),I=C*f.get(x,T)+P*f.get(x,E)+R*f.get(_,T)+N*f.get(_,E);if(isNaN(z)||isNaN(I)){v&&(n-=1);break}o[2*n+0]=z,o[2*n+1]=I,n+=1}this._dynamicCounts[a]=n-this._dynamicOffsets[a]}else this.dynamicLevel[a]=NaN,this._dynamicCounts[a]=0;this._dynamicBuffer.update(o.subarray(0,2*n)),m.freeFloat(o)}}},{"./lib/shaders":182,"binary-search-bounds":183,"bit-twiddle":38,colormap:88,"gl-buffer":105,"gl-mat4/invert":120,"gl-mat4/multiply":122,"gl-texture2d":188,"gl-vao":192,ndarray:219,"ndarray-gradient":184,"ndarray-ops":218,"ndarray-pack":185,"surface-nets":238,"typedarray-pool":242}],188:[function(t,e,r){"use strict";function n(t){v=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],m=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(0>e||e>i||0>r||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function o(t,e,r,n,i,o){this.gl=t,this.handle=e,this.format=i,this.type=o,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var a=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return a._wrapS},set:function(t){return a.wrapS=t}},{get:function(){return a._wrapT},set:function(t){return a.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return a._shape[0]},set:function(t){return a.width=t}},{get:function(){return a._shape[1]},set:function(t){return a.height=t}}]),this._shapeVector=l}function a(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,o,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,v=a(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,v=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,v=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),f===o&&v)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data.subarray(l.offset,l.offset+y));else{var _;_=o===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&o===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,_.subarray(0,y)),o===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(0>e||e>a||0>r||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function f(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=a(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var f,h,v=e.size;if(s)f=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var m=[n[2],n[2]*n[0],1];h=g.malloc(v,r);var y=d(h,n,m,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),f=h.subarray(0,v)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,f),s||g.free(h),new o(t,x,n[0],n[1],c,u)}function h(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=h;var v=null,m=null,y=null,b=function(t,e){p.muls(t,e,255)},x=o.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.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&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;2>e;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||0>e||0>r)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:219,"ndarray-ops":218,"typedarray-pool":242}],189:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;ii;++i)t.disableVertexAttribArray(i)}else{t.bindBuffer(t.ARRAY_BUFFER,null);for(var i=0;n>i;++i)t.disableVertexAttribArray(i)}}e.exports=n},{}],190:[function(t,e,r){"use strict";function n(t){this.gl=t,this._elements=null,this._attributes=null,this._elementsType=t.UNSIGNED_SHORT}function i(t){return new n(t)}var o=t("./do-bind.js");n.prototype.bind=function(){o(this.gl,this._elements,this._attributes)},n.prototype.update=function(t,e,r){this._elements=e,this._attributes=t,this._elementsType=r||this.gl.UNSIGNED_SHORT},n.prototype.dispose=function(){},n.prototype.unbind=function(){},n.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._elements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=i},{"./do-bind.js":189}],191:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.location=t,this.dimension=e,this.a=r,this.b=n,this.c=i,this.d=o}function i(t,e,r){this.gl=t,this._ext=e,this.handle=r,this._attribs=[],this._useElements=!1,this._elementsType=t.UNSIGNED_SHORT}function o(t,e){return new i(t,e,e.createVertexArrayOES())}var a=t("./do-bind.js");n.prototype.bind=function(t){switch(this.dimension){case 1:t.vertexAttrib1f(this.location,this.a);break;case 2:t.vertexAttrib2f(this.location,this.a,this.b);break;case 3:t.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:t.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d)}},i.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var t=0;tD;){switch(e=D,B){case f:D=L();break;case h:D=E();break;case d:D=T();break;case p:D=S();break;case g:D=R();break;case w:D=P();break;case v:D=N();break;case c:D=z();break;case x:D=k();break;case u:D=M()}if(e!==D)switch(W[e]){case"\n":H=0,++q;break;default:++H}}return F+=D,W=W.slice(D),V}function n(t){return U.length&&e(U.join("")),B=_,e("(eof)"),V}function M(){return U=U.length?[]:U,"/"===O&&"*"===I?(G=F+D-1,B=f,O=I,D+1):"/"===O&&"/"===I?(G=F+D-1,B=h,O=I,D+1):"#"===I?(B=d,G=F+D,D):/\s/.test(I)?(B=x,G=F+D,D):(X=/\d/.test(I),Y=/[^\w_]/.test(I),G=F+D,B=X?g:Y?p:c,D)}function k(){return/[^\s]/g.test(I)?(e(U.join("")),B=u,D):(U.push(I),O=I,D+1)}function T(){return"\n"===I&&"\\"!==O?(e(U.join("")),B=u,D):(U.push(I),O=I,D+1)}function E(){return T()}function L(){return"/"===I&&"*"===O?(U.push(I),e(U.join("")),B=u,D+1):(U.push(I),O=I,D+1)}function S(){if("."===O&&/\d/.test(I))return B=v,D;if("/"===O&&"*"===I)return B=f,D;if("/"===O&&"/"===I)return B=h,D;if("."===I&&U.length){for(;C(U););return B=v,D}if(";"===I||")"===I||"("===I){if(U.length)for(;C(U););return e(I),B=u,D+1}var t=2===U.length&&"="!==I;if(/[\w_\d\s]/.test(I)||t){for(;C(U););return B=u,D}return U.push(I),O=I,D+1}function C(t){for(var r,n,i=0;;){if(r=o.indexOf(t.slice(0,t.length+i).join("")),n=o[r],-1===r){if(i--+t.length>0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function P(){return/[^a-fA-F0-9]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),O=I,D+1)}function R(){return"."===I?(U.push(I),B=v,O=I,D+1):/[eE]/.test(I)?(U.push(I),B=v,O=I,D+1):"x"===I&&1===U.length&&"0"===U[0]?(B=w,U.push(I),O=I,D+1):/[^\d]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),O=I,D+1)}function N(){return"f"===I&&(U.push(I),O=I,D+=1),/[eE]/.test(I)?(U.push(I),O=I,D+1):"-"===I&&/[eE]/.test(O)?(U.push(I),O=I,D+1):/[^\d]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),O=I,D+1)}function z(){if(/[^\d\w_]/.test(I)){var t=U.join("");return B=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),B=u,D}return U.push(I),O=I,D+1}var I,O,j,D=0,F=0,B=u,U=[],V=[],q=1,H=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=a,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t):n()}}e.exports=n;var i=t("./lib/literals"),o=t("./lib/operators"),a=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":196,"./lib/builtins-300es":195,"./lib/literals":198,"./lib/literals-300es":197,"./lib/operators":199}],195:[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":196}],196:[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"]},{}],197:[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","uint","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":198}],198:[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","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"]},{}],199:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],200:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":194}],201:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function o(t,e){return c(t.vertices,e.vertices)}function a(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;t>=r;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(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 n=0;t>=n;++n)this.tuple[n]=this.vertices[n];var i=f[t];i||(i=f[t]=a(t)),this.orient=i}function l(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(i>=r)throw new Error("Must input at least d+1 points");var o=t.slice(0,i+1),a=u.apply(void 0,o);if(0===a)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;i>=c;++c)l[c]=c;0>a&&(l[0]=1,l[1]=0);for(var f=new n(l,new Array(i+1),!1),h=f.adjacent,d=new Array(i+2),c=0;i>=c;++c){for(var p=l.slice(),g=0;i>=g;++g)g===c&&(p[g]=-1);var v=p[0];p[0]=p[1],p[1]=v;var m=new n(p,new Array(i+1),!0);h[c]=m,d[c]=m}d[i+1]=f;for(var c=0;i>=c;++c)for(var p=h[c].vertices,y=h[c].adjacent,g=0;i>=g;++g){var b=p[g];if(0>b)y[g]=f;else for(var x=0;i>=x;++x)h[x].vertices.indexOf(b)<0&&(y[g]=h[x])}for(var _=new s(i,o,d),w=!!e,c=i+1;r>c;++c)_.insert(t[c],w);return _.boundary()}e.exports=l;var u=t("robust-orientation"),c=t("simplicial-complex").compareCells;n.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 f=[],h=s.prototype;h.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,o=this.vertices,a=[t];for(t.lastVisited=-n;a.length>0;){t=a.pop();for(var s=(t.vertices,t.adjacent),l=0;r>=l;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,f=0;r>=f;++f){var h=c[f];0>h?i[f]=e:i[f]=o[h]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&a.push(u)}}}return null},h.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,o=this.tuple,a=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[a];t:for(;!s.boundary;){for(var l=s.vertices,u=s.adjacent,c=0;n>=c;++c)o[c]=i[l[c]];s.lastVisited=r;for(var c=0;n>=c;++c){var f=u[c];if(!(f.lastVisited>=r)){var h=o[c];o[c]=t;var d=this.orient();if(o[c]=h,0>d){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},h.addPeaks=function(t,e){var r=this.vertices.length-1,a=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var h=[];f.length>0;){var e=f.pop(),d=e.vertices,p=e.adjacent,g=d.indexOf(r);if(!(0>g))for(var v=0;a>=v;++v)if(v!==g){var m=p[v];if(m.boundary&&!(m.lastVisited>=r)){var y=m.vertices;if(m.lastVisited!==-r){for(var b=0,x=0;a>=x;++x)y[x]<0?(b=x,l[x]=t):l[x]=s[y[x]];var _=this.orient();if(_>0){y[b]=r,m.boundary=!1,u.push(m),f.push(m),m.lastVisited=r;continue}m.lastVisited=-r}var w=m.adjacent,A=d.slice(),M=p.slice(),k=new n(A,M,!0);c.push(k);var T=w.indexOf(e);if(!(0>T)){w[T]=k,M[g]=m,A[v]=-1,M[v]=e,p[v]=k,k.flip();for(var x=0;a>=x;++x){var E=A[x];if(!(0>E||E===r)){for(var L=new Array(a-1),S=0,C=0;a>=C;++C){var P=A[C];0>P||C===x||(L[S++]=P)}h.push(new i(L,k,x))}}}}}}h.sort(o);for(var v=0;v+1z||0>I||(R.cell.adjacent[R.index]=N.cell,N.cell.adjacent[N.index]=R.cell)}},h.insert=function(t,e){var r=this.vertices;r.push(t);var n=this.walk(t,e);if(n){for(var i=this.dimension,o=this.tuple,a=0;i>=a;++a){var s=n.vertices[a];0>s?o[a]=t:o[a]=r[s]}var l=this.orient(o);0>l||(0!==l||(n=this.handleBoundaryDegeneracy(n,t)))&&this.addPeaks(t,n)}},h.boundary=function(){for(var t=this.dimension,e=[],r=this.simplices,n=r.length,i=0;n>i;++i){var o=r[i];if(o.boundary){for(var a=new Array(t),s=o.vertices,l=0,u=0,c=0;t>=c;++c)s[c]>=0?a[l++]=s[c]:u=1&c;if(u===(1&t)){var f=a[0];a[0]=a[1],a[1]=f}e.push(a)}}return e}},{"robust-orientation":225,"simplicial-complex":204}],202:[function(t,e,r){arguments[4][38][0].apply(r,arguments)},{dup:38}],203:[function(t,e,r){arguments[4][85][0].apply(r,arguments)},{dup:85}],204:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;i>n;++n)e=r(e,t[n].length);return e-1}function i(t){for(var e=-1,r=Math.max,n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)e=r(e,o[a]);return e+1}function o(t){for(var e=new Array(t.length),r=0,n=t.length;n>r;++r)e[r]=t[r].slice(0);return e}function a(t,e){var r=t.length,n=t.length-e.length,i=Math.min;if(n)return n;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:var o=t[0]+t[1]-e[0]-e[1];return o?o:i(t[0],t[1])-i(e[0],e[1]);case 3:var a=t[0]+t[1],s=e[0]+e[1];if(o=a+t[2]-(s+e[2]))return o;var l=i(t[0],t[1]),u=i(e[0],e[1]),o=i(l,t[2])-i(u,e[2]);return o?o:i(l+t[2],a)-i(u+e[2],s);default:var c=t.slice(0);c.sort();var f=e.slice(0);f.sort();for(var h=0;r>h;++h)if(n=c[h]-f[h])return n;return 0}}function s(t,e){return a(t[0],e[0])}function l(t,e){if(e){for(var r=t.length,n=new Array(r),i=0;r>i;++i)n[i]=[t[i],e[i]];n.sort(s);for(var i=0;r>i;++i)t[i]=n[i][0],e[i]=n[i][1];return t}return t.sort(a),t}function u(t){if(0===t.length)return[];for(var e=1,r=t.length,n=1;r>n;++n){var i=t[n];if(a(i,t[n-1])){if(n===e){e++;continue}t[e++]=i}}return t.length=e,t}function c(t,e){for(var r=0,n=t.length-1,i=-1;n>=r;){var o=r+n>>1,s=a(t[o],e);0>=s?(0===s&&(i=o),r=o+1):s>0&&(n=o-1)}return i; -}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;i>n;++n)r[n]=[];for(var o=[],n=0,s=e.length;s>n;++n)for(var l=e[n],u=l.length,f=1,h=1<f;++f){o.length=b.popCount(f);for(var d=0,p=0;u>p;++p)f&1<g))for(;;)if(r[g++].push(n),g>=t.length||0!==a(t[g],o))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;e>n;++n)r[n]=[];for(var n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)r[o[a]].push(n);return r}function d(t){for(var e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0|i.length,a=1,s=1<a;++a){for(var u=[],c=0;o>c;++c)a>>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(0>e)return[];for(var r=[],n=(1<r;++r)for(var i=t[r],o=0,a=i.length;a>o;++o){for(var s=new Array(i.length-1),u=0,c=0;a>u;++u)u!==o&&(s[c++]=i[u]);e.push(s)}return l(e)}function v(t,e){for(var r=new x(e),n=0;nr;++r)e[r]=r;return e}e.exports=n},{}],206:[function(t,e,r){e.exports=function(t){return!(null==t||!(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)))}},{}],207:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==g.alt,g.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==g.shift,g.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==g.control,g.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var o=i.x(n),a=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==h||o!==d||a!==p||r(n))&&(h=0|t,d=o||0,p=a||0,e(h,d,p,g))}function o(t){n(0,t)}function a(){(h||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,h=0,g.shift=g.alt=g.control=g.meta=!1,e(0,0,0,g))}function s(t){r(t)&&e(h,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(h,t)}function u(t){n(h|i.buttons(t),t)}function c(t){n(h&~i.buttons(t),t)}function f(){v||(v=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",o),t.addEventListener("mouseenter",o),t.addEventListener("mouseout",o),t.addEventListener("mouseover",o),t.addEventListener("blur",a),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",a),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var h=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},v=!1;f();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return v},set:function(t){t&&f()},enumerable:!0},buttons:{get:function(){return h},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),m}e.exports=n;var i=t("mouse-event")},{"mouse-event":208}],208:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0&&r=0&&r+1=0&&n=0&&n+1=0&&s=0&&s+1=0&&i=0&&i+1=0&&l=0&&l+1=0&&h=0&&h+1e;++e)r=+arguments[e+1],i[e]=Math.floor(r),o[e]=r-i[e],a[e]=0<=i[e]&&i[e]e;++e){for(u=1,c=t.offset,l=0;n>l;++l)if(e&1<r;++r){t[r]=a[(n+1)*n+r];for(var i=0;n>i;++i)t[r]+=a[(n+1)*i+r]*e[i]}for(var o=a[(n+1)*(n+1)-1],i=0;n>i;++i)o+=a[(n+1)*i+n]*e[i];for(var s=1/o,r=0;n>r;++r)t[r]*=s;return t}),t}var i=t("ndarray-warp"),o=t("gl-matrix-invert");e.exports=n},{"gl-matrix-invert":213,"ndarray-warp":216}],218:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var f=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=a({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=a({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=a({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":96}],219:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;te&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var o="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}",a=new Function(o);return a()}if(0===e){var o="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}",a=new Function("TrivialArray",o);return a(f[t][0])}var o=["'use strict'"],s=l(e),u=s.map(function(t){return"i"+t}),c="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),h=s.map(function(t){return"b"+t}).join(","),d=s.map(function(t){return"c"+t}).join(",");o.push("function "+r+"(a,"+h+","+d+",d){this.data=a","this.shape=["+h+"]","this.stride=["+d+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),o.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>e?(o.push("function "+r+"_order(){"),2===e?o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?o.push("return this.data.set("+c+",v)}"):o.push("return this.data["+c+"]=v}"),o.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?o.push("return this.data.get("+c+")}"):o.push("return this.data["+c+"]}"),o.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),o.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;e>v;++v)o.push("if(typeof i"+v+"==='number'&&i"+v+">=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),o.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;e>v;++v)o.push("if(typeof i"+v+"==='number'){d=i"+v+"|0;if(d<0){c+=b"+v+"*(a"+v+"-1);a"+v+"=ceil(-a"+v+"/d)}else{a"+v+"=ceil(a"+v+"/d)}b"+v+"*=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");for(var m=new Array(e),y=new Array(e),v=0;e>v;++v)m[v]="a[i"+v+"]",y[v]="b[i"+v+"]";o.push("proto.transpose=function "+r+"_transpose("+u+"){"+u.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+m.join(",")+","+y.join(",")+",this.offset)}"),o.push("proto.pick=function "+r+"_pick("+u+"){var a=[],b=[],c=this.offset");for(var v=0;e>v;++v)o.push("if(typeof i"+v+"==='number'&&i"+v+">=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var a=new Function("CTOR_LIST","ORDER",o.join("\n"));return a(f[t],i)}function a(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;s>l;++l)r[l]<0&&(n-=(e[l]-1)*r[l])}for(var c=a(t),h=f[c];h.length<=s+1;)h.push(o(c,h.length-1));var i=h[s+1];return i(t,e,r,n)}var l=t("iota-array"),u=t("is-buffer"),c="undefined"!=typeof Float64Array,f={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s},{"iota-array":205,"is-buffer":206}],220:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,o="");r>o.length&&e>0&&(1&e&&(o+=t),e>>=1);)t+=t;return o.substr(0,r)}var i,o="";e.exports=n},{}],221:[function(t,e,r){(function(t){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],222:[function(t,e,r){"use strict";function n(t){for(var e="robustLinearSolve"+t+"d",r=["function ",e,"(A,b){return ["],n=0;t>n;++n){r.push("det([");for(var i=0;t>i;++i){i>0&&r.push(","),r.push("[");for(var o=0;t>o;++o)o>0&&r.push(","),o===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",o,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var a=new Function("det",r.join(""));return a(6>t?s[t]:s)}function i(){return[0]}function o(t,e){return[[e[0]],[t[0][0]]]}function a(){for(;u.lengthi;++i)t.push("s"+i),r.push("case ",i,":return s",i,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);e.exports=o.apply(void 0,u.concat([u,n]));for(var i=0;l>i;++i)e.exports[i]=u[i]}var s=t("robust-determinant"),l=6,u=[i,o];a()},{"robust-determinant":224}],223:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var o=r,a=t[i];r=o+a;var s=r-o,l=a-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;e>i;++i){var o=t[i],a=r;r=o+a;var s=r-o,l=a-s;l&&(t[u++]=l)}return t[u++]=r,t.length=u,t}e.exports=n},{}],224:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m[",r,"][",n,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;rn;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var i=Function.apply(void 0,t);e.exports=i.apply(void 0,g.concat([g,l]));for(var n=0;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join(""); +}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;i>n;++n)r[n]=[];for(var o=[],n=0,s=e.length;s>n;++n)for(var l=e[n],u=l.length,f=1,h=1<f;++f){o.length=b.popCount(f);for(var d=0,p=0;u>p;++p)f&1<g))for(;;)if(r[g++].push(n),g>=t.length||0!==a(t[g],o))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;e>n;++n)r[n]=[];for(var n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)r[o[a]].push(n);return r}function d(t){for(var e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0|i.length,a=1,s=1<a;++a){for(var u=[],c=0;o>c;++c)a>>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(0>e)return[];for(var r=[],n=(1<r;++r)for(var i=t[r],o=0,a=i.length;a>o;++o){for(var s=new Array(i.length-1),u=0,c=0;a>u;++u)u!==o&&(s[c++]=i[u]);e.push(s)}return l(e)}function v(t,e){for(var r=new x(e),n=0;nr;++r)e[r]=r;return e}e.exports=n},{}],206:[function(t,e,r){e.exports=function(t){return!(null==t||!(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)))}},{}],207:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==g.alt,g.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==g.shift,g.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==g.control,g.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var o=i.x(n),a=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==h||o!==d||a!==p||r(n))&&(h=0|t,d=o||0,p=a||0,e(h,d,p,g))}function o(t){n(0,t)}function a(){(h||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,h=0,g.shift=g.alt=g.control=g.meta=!1,e(0,0,0,g))}function s(t){r(t)&&e(h,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(h,t)}function u(t){n(h|i.buttons(t),t)}function c(t){n(h&~i.buttons(t),t)}function f(){v||(v=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",o),t.addEventListener("mouseenter",o),t.addEventListener("mouseout",o),t.addEventListener("mouseover",o),t.addEventListener("blur",a),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",a),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var h=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},v=!1;f();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return v},set:function(t){t&&f()},enumerable:!0},buttons:{get:function(){return h},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),m}e.exports=n;var i=t("mouse-event")},{"mouse-event":208}],208:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0&&r=0&&r+1=0&&n=0&&n+1=0&&s=0&&s+1=0&&i=0&&i+1=0&&l=0&&l+1=0&&h=0&&h+1e;++e)r=+arguments[e+1],i[e]=Math.floor(r),o[e]=r-i[e],a[e]=0<=i[e]&&i[e]e;++e){for(u=1,c=t.offset,l=0;n>l;++l)if(e&1<r;++r){t[r]=a[(n+1)*n+r];for(var i=0;n>i;++i)t[r]+=a[(n+1)*i+r]*e[i]}for(var o=a[(n+1)*(n+1)-1],i=0;n>i;++i)o+=a[(n+1)*i+n]*e[i];for(var s=1/o,r=0;n>r;++r)t[r]*=s;return t}),t}var i=t("ndarray-warp"),o=t("gl-matrix-invert");e.exports=n},{"gl-matrix-invert":213,"ndarray-warp":216}],218:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var f=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=a({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=a({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=a({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":96}],219:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;te&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var o="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}",a=new Function(o);return a()}if(0===e){var o="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}",a=new Function("TrivialArray",o);return a(f[t][0])}var o=["'use strict'"],s=l(e),u=s.map(function(t){return"i"+t}),c="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),h=s.map(function(t){return"b"+t}).join(","),d=s.map(function(t){return"c"+t}).join(",");o.push("function "+r+"(a,"+h+","+d+",d){this.data=a","this.shape=["+h+"]","this.stride=["+d+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),o.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>e?(o.push("function "+r+"_order(){"),2===e?o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?o.push("return this.data.set("+c+",v)}"):o.push("return this.data["+c+"]=v}"),o.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?o.push("return this.data.get("+c+")}"):o.push("return this.data["+c+"]}"),o.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),o.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;e>v;++v)o.push("if(typeof i"+v+"==='number'&&i"+v+">=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),o.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;e>v;++v)o.push("if(typeof i"+v+"==='number'){d=i"+v+"|0;if(d<0){c+=b"+v+"*(a"+v+"-1);a"+v+"=ceil(-a"+v+"/d)}else{a"+v+"=ceil(a"+v+"/d)}b"+v+"*=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");for(var m=new Array(e),y=new Array(e),v=0;e>v;++v)m[v]="a[i"+v+"]",y[v]="b[i"+v+"]";o.push("proto.transpose=function "+r+"_transpose("+u+"){"+u.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+m.join(",")+","+y.join(",")+",this.offset)}"),o.push("proto.pick=function "+r+"_pick("+u+"){var a=[],b=[],c=this.offset");for(var v=0;e>v;++v)o.push("if(typeof i"+v+"==='number'&&i"+v+">=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var a=new Function("CTOR_LIST","ORDER",o.join("\n"));return a(f[t],i)}function a(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;s>l;++l)r[l]<0&&(n-=(e[l]-1)*r[l])}for(var c=a(t),h=f[c];h.length<=s+1;)h.push(o(c,h.length-1));var i=h[s+1];return i(t,e,r,n)}var l=t("iota-array"),u=t("is-buffer"),c="undefined"!=typeof Float64Array,f={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s},{"iota-array":205,"is-buffer":206}],220:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,o="");r>o.length&&e>0&&(1&e&&(o+=t),e>>=1);)t+=t;return o.substr(0,r)}var i,o="";e.exports=n},{}],221:[function(t,e,r){(function(t){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],222:[function(t,e,r){"use strict";function n(t){for(var e="robustLinearSolve"+t+"d",r=["function ",e,"(A,b){return ["],n=0;t>n;++n){r.push("det([");for(var i=0;t>i;++i){i>0&&r.push(","),r.push("[");for(var o=0;t>o;++o)o>0&&r.push(","),o===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",o,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var a=new Function("det",r.join(""));return a(6>t?s[t]:s)}function i(){return[0]}function o(t,e){return[[e[0]],[t[0][0]]]}function a(){for(;u.lengthi;++i)t.push("s"+i),r.push("case ",i,":return s",i,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);e.exports=o.apply(void 0,u.concat([u,n]));for(var i=0;l>i;++i)e.exports[i]=u[i]}var s=t("robust-determinant"),l=6,u=[i,o];a()},{"robust-determinant":224}],223:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var o=r,a=t[i];r=o+a;var s=r-o,l=a-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;e>i;++i){var o=t[i],a=r;r=o+a;var s=r-o,l=a-s;l&&(t[u++]=l)}return t[u++]=r,t.length=u,t}e.exports=n},{}],224:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m[",r,"][",n,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;rn;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var i=Function.apply(void 0,t);e.exports=i.apply(void 0,g.concat([g,l]));for(var n=0;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join(""); }return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;ru;++u)0===(1&u)?e.push.apply(e,s(n(o,u))):r.push.apply(r,s(n(o,u))),l.push("m"+u);var c=a(e),g=a(r),v="orientation"+t+"Exact",m=["function ",v,"(",l.join(),"){var p=",c,",n=",g,",d=sub(p,n);return d[d.length-1];};return ",v].join(""),y=new Function("sum","prod","scale","sub",m);return y(h,f,d,p)}function u(t){var e=_[t.length];return e||(e=_[t.length]=l(t.length)),e.apply(void 0,t)}function c(){for(;_.length<=g;)_.push(l(_.length));for(var t=[],r=["slow"],n=0;g>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;g>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i=n;++n)e.exports[n]=_[n]}var f=t("two-product"),h=t("robust-sum"),d=t("robust-scale"),p=t("robust-subtract"),g=5,v=1.1102230246251565e-16,m=(3+16*v)*v,y=(7+56*v)*v,b=l(3),x=l(4),_=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,r){var n,i=(t[1]-r[1])*(e[0]-r[0]),o=(t[0]-r[0])*(e[1]-r[1]),a=i-o;if(i>0){if(0>=o)return a;n=i+o}else{if(!(0>i))return a;if(o>=0)return a;n=-(i+o)}var s=m*n;return a>=s||-s>=a?a:b(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],o=e[0]-n[0],a=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=o*u,p=a*l,g=a*s,v=i*u,m=i*l,b=o*s,_=c*(d-p)+f*(g-v)+h*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(m)+Math.abs(b))*Math.abs(h),A=y*w;return _>A||-_>A?_:x(t,e,r,n)}];c()},{"robust-scale":226,"robust-subtract":227,"robust-sum":228,"two-product":240}],226:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if(1===r){var n=i(t[0],e);return n[0]?n:[n[1]]}var a=new Array(2*r),s=[.1,.1],l=[.1,.1],u=0;i(t[0],e,s),s[0]&&(a[u++]=s[0]);for(var c=1;r>c;++c){i(t[c],e,l);var f=s[1];o(f,l[0],s),s[0]&&(a[u++]=s[0]);var h=l[1],d=s[1],p=h+d,g=p-h,v=d-g;s[1]=p,v&&(a[u++]=v)}return s[1]&&(a[u++]=s[1]),0===u&&(a[u++]=0),a.length=u,a}var i=t("two-product"),o=t("two-sum");e.exports=n},{"two-product":240,"two-sum":241}],227:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,o=e-n,a=t-i,s=a+o;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var o,a,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);v>p?(a=d,c+=1,r>c&&(d=t[c],p=h(d))):(a=g,f+=1,i>f&&(g=-e[f],v=h(g))),r>c&&v>p||f>=i?(o=d,c+=1,r>c&&(d=t[c],p=h(d))):(o=g,f+=1,i>f&&(g=-e[f],v=h(g)));for(var m,y,b,x,_,w=o+a,A=w-o,M=a-A,k=M,T=w;r>c&&i>f;)v>p?(o=d,c+=1,r>c&&(d=t[c],p=h(d))):(o=g,f+=1,i>f&&(g=-e[f],v=h(g))),a=k,w=o+a,A=w-o,M=a-A,M&&(l[u++]=M),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,k=_+x,T=m;for(;r>c;)o=d,a=k,w=o+a,A=w-o,M=a-A,M&&(l[u++]=M),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,k=_+x,T=m,c+=1,r>c&&(d=t[c]);for(;i>f;)o=g,a=k,w=o+a,A=w-o,M=a-A,M&&(l[u++]=M),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,k=_+x,T=m,f+=1,i>f&&(g=-e[f]);return k&&(l[u++]=k),T&&(l[u++]=T),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],228:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,o=e-n,a=t-i,s=a+o;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],e[0]);var o,a,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=e[f],v=h(g);v>p?(a=d,c+=1,r>c&&(d=t[c],p=h(d))):(a=g,f+=1,i>f&&(g=e[f],v=h(g))),r>c&&v>p||f>=i?(o=d,c+=1,r>c&&(d=t[c],p=h(d))):(o=g,f+=1,i>f&&(g=e[f],v=h(g)));for(var m,y,b,x,_,w=o+a,A=w-o,M=a-A,k=M,T=w;r>c&&i>f;)v>p?(o=d,c+=1,r>c&&(d=t[c],p=h(d))):(o=g,f+=1,i>f&&(g=e[f],v=h(g))),a=k,w=o+a,A=w-o,M=a-A,M&&(l[u++]=M),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,k=_+x,T=m;for(;r>c;)o=d,a=k,w=o+a,A=w-o,M=a-A,M&&(l[u++]=M),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,k=_+x,T=m,c+=1,r>c&&(d=t[c]);for(;i>f;)o=g,a=k,w=o+a,A=w-o,M=a-A,M&&(l[u++]=M),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,k=_+x,T=m,f+=1,i>f&&(g=e[f]);return k&&(l[u++]=k),T&&(l[u++]=T),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],229:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],230:[function(t,e,r){"use strict";function n(t){return"a"+t}function i(t){return"d"+t}function o(t,e){return"c"+t+"_"+e}function a(t){return"s"+t}function s(t,e){return"t"+t+"_"+e}function l(t){return"o"+t}function u(t){return"x"+t}function c(t){return"p"+t}function f(t,e){return"d"+t+"_"+e}function h(t){return"i"+t}function d(t,e){return"u"+t+"_"+e}function p(t){return"b"+t}function g(t){return"y"+t}function v(t){return"e"+t}function m(t){return"v"+t}function y(t,e,r){for(var n=0,i=0;t>i;++i)e&1<e;++e)D.push(c(e),"+=",d(e,x[t]),";");D.push("}")}function P(t){for(var e=t-1;e>=0;--e)S(e,0);for(var r=[],e=0;I>e;++e)L[e]?r.push(i(e)+".get("+c(e)+")"):r.push(i(e)+"["+c(e)+"]");for(var e=0;b>e;++e)r.push(u(e));D.push(A,"[",T,"++]=phase(",r.join(),");");for(var e=0;t>e;++e)C(e);for(var n=0;I>n;++n)D.push(c(n),"+=",d(n,x[t]),";")}function R(t){for(var e=0;I>e;++e)L[e]?D.push(o(e,0),"=",i(e),".get(",c(e),");"):D.push(o(e,0),"=",i(e),"[",c(e),"];");for(var r=[],e=0;I>e;++e)r.push(o(e,0));for(var e=0;b>e;++e)r.push(u(e));D.push(p(0),"=",A,"[",T,"]=phase(",r.join(),");");for(var n=1;1<n;++n)D.push(p(n),"=",A,"[",T,"+",v(n),"];");for(var a=[],n=1;1<n;++n)a.push("("+p(0)+"!=="+p(n)+")");D.push("if(",a.join("||"),"){");for(var s=[],e=0;O>e;++e)s.push(h(e));for(var e=0;I>e;++e){s.push(o(e,0));for(var n=1;1<n;++n)L[e]?D.push(o(e,n),"=",i(e),".get(",c(e),"+",f(e,n),");"):D.push(o(e,n),"=",i(e),"[",c(e),"+",f(e,n),"];"),s.push(o(e,n))}for(var e=0;1<e;++e)s.push(p(e));for(var e=0;b>e;++e)s.push(u(e));D.push("vertex(",s.join(),");",m(0),"=",w,"[",T,"]=",M,"++;");for(var l=(1<n;++n)if(0===(t&~(1<0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;I>_;++_)1&n?x.push(o(_,l),o(_,g)):x.push(o(_,g),o(_,l));1&n?x.push(d,y):x.push(y,d);for(var _=0;b>_;++_)x.push(u(_));D.push("if(",d,"!==",y,"){","face(",x.join(),")}")}D.push("}",T,"+=1;")}function N(){for(var t=1;1<t;++t)D.push(E,"=",v(t),";",v(t),"=",g(t),";",g(t),"=",E,";")}function z(t,e){if(0>t)return void R(e);P(t),D.push("if(",a(x[t]),">0){",h(x[t]),"=1;"),z(t-1,e|1<r;++r)D.push(c(r),"+=",d(r,x[t]),";");t===O-1&&(D.push(T,"=0;"),N()),S(t,2),z(t-1,e),t===O-1&&(D.push("if(",h(x[O-1]),"&1){",T,"=0;}"),N()),C(t),D.push("}")}var I=L.length,O=x.length;if(2>O)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var j="extractContour"+x.join("_"),D=[],F=[],B=[],U=0;I>U;++U)B.push(n(U));for(var U=0;b>U;++U)B.push(u(U));for(var U=0;O>U;++U)F.push(a(U)+"="+n(0)+".shape["+U+"]|0");for(var U=0;I>U;++U){F.push(i(U)+"="+n(U)+".data",l(U)+"="+n(U)+".offset|0");for(var V=0;O>V;++V)F.push(s(U,V)+"="+n(U)+".stride["+V+"]|0")}for(var U=0;I>U;++U){F.push(c(U)+"="+l(U)),F.push(o(U,0));for(var V=1;1<V;++V){for(var q=[],H=0;O>H;++H)V&1<U;++U)for(var V=0;O>V;++V){var G=[s(U,x[V])];V>0&&G.push(s(U,x[V-1])+"*"+a(x[V-1])),F.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;O>U;++U)F.push(h(U)+"=0");F.push(M+"=0");for(var X=["2"],U=O-2;U>=0;--U)X.push(a(x[U]));F.push(k+"=("+X.join("*")+")|0",A+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),F.push(p(0)+"=0");for(var V=1;1<V;++V){for(var Y=[],W=[],H=0;O>H;++H)V&1<n&&e("Must have at least one array argument");var i=t.scalarArguments||0;0>i&&e("Scalar arg count must be > 0"),"function"!=typeof t.vertex&&e("Must specify vertex creation function"),"function"!=typeof t.cell&&e("Must specify cell creation function"),"function"!=typeof t.phase&&e("Must specify phase function");for(var o=t.getters||[],a=new Array(n),s=0;n>s;++s)o.indexOf(s)>=0?a[s]=!0:a[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,a)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",M="N",k="Q",T="X",E="T"},{"typedarray-pool":242}],231:[function(t,e,r){function n(t){if(0>t)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,o=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function l(t){if(.5>t)return Math.PI/(Math.sin(Math.PI*t)*l(1-t));if(t>100)return Math.exp(n(t));t-=1;for(var e=o[0],r=1;i+2>r;r++)e+=o[r]/(t+r);var a=t+i+.5;return Math.sqrt(2*Math.PI)*Math.pow(a,t+.5)*Math.exp(-a)*e},e.exports.log=n},{}],232:[function(t,e,r){"use strict";function n(t){var e=t.length;if(i>e){for(var r=1,n=0;e>n;++n)for(var a=0;n>a;++a)if(t[n]n;++n)s[n]=0;for(var r=1,n=0;e>n;++n)if(!s[n]){var l=1;s[n]=1;for(var a=t[n];a!==n;a=t[a]){if(s[a])return o.freeUint8(s),0;l+=1,s[a]=1}1&l||(r=-r)}return o.freeUint8(s),r}e.exports=n;var i=32,o=t("typedarray-pool")},{"typedarray-pool":242}],233:[function(t,e,r){"use strict";function n(t){var e=t.length;switch(e){case 0:case 1:return 0;case 2:return t[1]}var r,n,i,s=o.mallocUint32(e),l=o.mallocUint32(e),u=0;for(a(t,l),i=0;e>i;++i)s[i]=t[i];for(i=e-1;i>0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return o.freeUint32(l),o.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,o,a=1;for(r[0]=0,o=1;t>o;++o)r[o]=o,a=a*o|0;for(o=t-1;o>0;--o)n=e/a|0,e=e-n*a|0,a=a/o|0,i=0|r[o],r[o]=0|r[n],r[n]=0|i;return r}var o=t("typedarray-pool"),a=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":234,"typedarray-pool":242}],234:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;rt)return[];if(0===t)return[[0]];for(var e=0|Math.round(a(t+1)),r=[],n=0;e>n;++n){for(var s=i.unrank(t,n),l=[0],u=0,c=0;c= 0) !== (_inline_1_db >= 0)) {\n _inline_1_arg2_.push(_inline_1_arg4_[0] + 0.5 + 0.5 * (_inline_1_da + _inline_1_db) / (_inline_1_da - _inline_1_db))\n }\n }",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg3_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:["_inline_1_da","_inline_1_db"]},funcName:"zeroCrossings"})},{"cwise-compiler":96}],237:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":236}],238:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var o=[],l=[],u=0;r>u;++u)o.push("d"+u),l.push("d"+u);for(var u=0;1<u;++u)o.push("v"+u),l.push("v"+u);for(var u=0;1<u;++u)o.push("p"+u),l.push("p"+u);o.push("a","b","c"),l.push("a","c"),n.push("vertex:function vertexFunc(",o.join(),"){");for(var c=[],u=0;1<u;++u)c.push("(p"+u+"<<"+u+")");n.push("var m=(",c.join("+"),")|0;if(m===0||m===",(1<<(1<=1<<(1<>>7){");for(var u=0;1<<(1<u;++u){if(1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;r>b;++b)p[b]=[],g[b]=[],v[b]=0,m[b]=0;for(var b=0;1<b;++b)for(var x=0;r>x;++x){var _=b^1<b)&&!(u&1<<_)!=!(u&1<w?(p[x].push("-v"+b+"-v"+_),v[x]+=2):(p[x].push("v"+b+"+v"+_),v[x]-=2),y+=1;for(var A=0;r>A;++A)A!==x&&(_&1<x;++x)if(0===p[x].length)M.push("d"+x+"-0.5");else{var k="";v[x]<0?k=v[x]+"*c":v[x]>0&&(k="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);M.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}h.push("a.push([",M.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;1<u;++u)L.push("v"+u);L.push("c0","c1","p0","p1","a","b","c"),n.push("cell:function cellFunc(",L.join(),"){");var S=s(r-1);n.push("if(p0){b.push(",S.map(function(t){return"["+t.map(function(t){return"v"+t})+"]"}).join(),")}else{b.push(",S.map(function(t){var e=t.slice();return e.reverse(),"["+e.map(function(t){return"v"+t})+"]"}).join(),")}}});function ",i,"(array,level){var verts=[],cells=[];contour(array,verts,cells,level);return {positions:verts,cells:cells};} return ",i,";");for(var u=0;ua;++a)i[a]=[r[a]],o[a]=[a];return{positions:i,cells:o}}function o(t,e){if(t.dimension<=0)return{positions:[],cells:[]};if(1===t.dimension)return i(t,e);var r=t.order.join()+"-"+t.dtype,o=u[r],e=+e||0;return o||(o=u[r]=n(t.order,t.dtype)),o(t,e)}e.exports=o;var a=t("ndarray-extract-contour"),s=t("triangulate-hypercube"),l=t("zero-crossings"),u={}},{"ndarray-extract-contour":230,"triangulate-hypercube":235,"zero-crossings":237}],239:[function(e,r,n){!function(){function e(t,r){if(t=t?t:"",r=r||{},t instanceof e)return t;if(!(this instanceof e))return new e(t,r);var i=n(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=U(100*this._a)/100,this._format=r.format||i.format,this._gradientType=r.gradientType,this._r<1&&(this._r=U(this._r)),this._g<1&&(this._g=U(this._g)),this._b<1&&(this._b=U(this._b)),this._ok=i.ok,this._tc_id=F++}function n(t){var e={r:0,g:0,b:0},r=1,n=!1,o=!1;return"string"==typeof t&&(t=I(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(e=i(t.r,t.g,t.b),n=!0,o="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=R(t.s),t.v=R(t.v),e=l(t.h,t.s,t.v),n=!0,o="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=R(t.s),t.l=R(t.l),e=a(t.h,t.s,t.l),n=!0,o="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=k(r),{ok:n,format:t.format||o,r:V(255,q(e.r,0)),g:V(255,q(e.g,0)),b:V(255,q(e.b,0)),a:r}}function i(t,e,r){return{r:255*T(t,255),g:255*T(e,255),b:255*T(r,255)}}function o(t,e,r){t=T(t,255),e=T(e,255),r=T(r,255);var n,i,o=q(t,e,r),a=V(t,e,r),s=(o+a)/2;if(o==a)n=i=0;else{var l=o-a;switch(i=s>.5?l/(2-o-a):l/(o+a),o){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,l:s}}function a(t,e,r){function n(t,e,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?t+6*(e-t)*r:.5>r?e:2/3>r?t+(e-t)*(2/3-r)*6:t}var i,o,a;if(t=T(t,360),e=T(e,100),r=T(r,100),0===e)i=o=a=r;else{var s=.5>r?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),o=n(l,s,t),a=n(l,s,t-1/3)}return{r:255*i,g:255*o,b:255*a}}function s(t,e,r){t=T(t,255),e=T(e,255),r=T(r,255);var n,i,o=q(t,e,r),a=V(t,e,r),s=o,l=o-a;if(i=0===o?0:l/o,o==a)n=0;else{switch(o){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,v:s}}function l(t,e,r){t=6*T(t,360),e=T(e,100),r=T(r,100);var n=B.floor(t),i=t-n,o=r*(1-e),a=r*(1-i*e),s=r*(1-(1-i)*e),l=n%6,u=[r,a,o,o,s,r][l],c=[s,r,r,a,o,o][l],f=[o,o,s,r,r,a][l];return{r:255*u,g:255*c,b:255*f}}function u(t,e,r,n){var i=[P(U(t).toString(16)),P(U(e).toString(16)),P(U(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function c(t,e,r,n){var i=[P(N(n)),P(U(t).toString(16)),P(U(e).toString(16)),P(U(r).toString(16))];return i.join("")}function f(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s-=r/100,n.s=E(n.s),e(n)}function h(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s+=r/100,n.s=E(n.s),e(n)}function d(t){return e(t).desaturate(100)}function p(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l+=r/100,n.l=E(n.l),e(n)}function g(t,r){r=0===r?0:r||10;var n=e(t).toRgb();return n.r=q(0,V(255,n.r-U(255*-(r/100)))),n.g=q(0,V(255,n.g-U(255*-(r/100)))),n.b=q(0,V(255,n.b-U(255*-(r/100)))),e(n)}function v(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l-=r/100,n.l=E(n.l),e(n)}function m(t,r){var n=e(t).toHsl(),i=(U(n.h)+r)%360;return n.h=0>i?360+i:i,e(n)}function y(t){var r=e(t).toHsl();return r.h=(r.h+180)%360,e(r)}function b(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+120)%360,s:r.s,l:r.l}),e({h:(n+240)%360,s:r.s,l:r.l})]}function x(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+90)%360,s:r.s,l:r.l}),e({h:(n+180)%360,s:r.s,l:r.l}),e({h:(n+270)%360,s:r.s,l:r.l})]}function _(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+72)%360,s:r.s,l:r.l}),e({h:(n+216)%360,s:r.s,l:r.l})]}function w(t,r,n){r=r||6,n=n||30;var i=e(t).toHsl(),o=360/n,a=[e(t)];for(i.h=(i.h-(o*r>>1)+720)%360;--r;)i.h=(i.h+o)%360,a.push(e(i));return a}function A(t,r){r=r||6;for(var n=e(t).toHsv(),i=n.h,o=n.s,a=n.v,s=[],l=1/r;r--;)s.push(e({h:i,s:o,v:a})),a=(a+l)%1;return s}function M(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function k(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function T(t,e){S(t)&&(t="100%");var r=C(t);return t=V(e,q(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),B.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function E(t){return V(1,q(0,t))}function L(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function C(t){return"string"==typeof t&&-1!=t.indexOf("%")}function P(t){return 1==t.length?"0"+t:""+t}function R(t){return 1>=t&&(t=100*t+"%"),t}function N(t){return Math.round(255*parseFloat(t)).toString(16)}function z(t){return L(t)/255}function I(t){t=t.replace(j,"").replace(D,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Y.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Y.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Y.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Y.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Y.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Y.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Y.hex8.exec(t))?{a:z(r[1]),r:L(r[2]),g:L(r[3]),b:L(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:L(r[1]),g:L(r[2]),b:L(r[3]),format:e?"name":"hex"}:(r=Y.hex3.exec(t))?{r:L(r[1]+""+r[1]),g:L(r[2]+""+r[2]),b:L(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function O(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var j=/^\s+/,D=/\s+$/,F=0,B=Math,U=B.round,V=B.min,q=B.max,H=B.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,n,i,o,a=this.toRgb();return t=a.r/255,e=a.g/255,r=a.b/255,n=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),i=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),o=.03928>=r?r/12.92:Math.pow((r+.055)/1.055,2.4),.2126*n+.7152*i+.0722*o},setAlpha:function(t){return this._a=k(t),this._roundA=U(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return c(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:U(this._r),g:U(this._g),b:U(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+U(this._r)+", "+U(this._g)+", "+U(this._b)+")":"rgba("+U(this._r)+", "+U(this._g)+", "+U(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:U(100*T(this._r,255))+"%",g:U(100*T(this._g,255))+"%",b:U(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+U(100*T(this._r,255))+"%, "+U(100*T(this._g,255))+"%, "+U(100*T(this._b,255))+"%)":"rgba("+U(100*T(this._r,255))+"%, "+U(100*T(this._g,255))+"%, "+U(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:X[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+c(this._r,this._g,this._b,this._a),n=r,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=e(t);n=o.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(g,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(h,arguments)},greyscale:function(){return this._applyModification(d,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(x,arguments)}},e.fromRatio=function(t,r){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?n[i]=t[i]:n[i]=R(t[i]));t=n}return e(t,r)},e.equals=function(t,r){return t&&r?e(t).toRgbString()==e(r).toRgbString():!1},e.random=function(){return e.fromRatio({r:H(),g:H(),b:H()})},e.mix=function(t,r,n){n=0===n?0:n||50;var i,o=e(t).toRgb(),a=e(r).toRgb(),s=n/100,l=2*s-1,u=a.a-o.a;i=l*u==-1?l:(l+u)/(1+l*u),i=(i+1)/2;var c=1-i,f={r:a.r*i+o.r*c,g:a.g*i+o.g*c,b:a.b*i+o.b*c,a:a.a*s+o.a*(1-s)};return e(f)},e.readability=function(t,r){var n=e(t),i=e(r);return(Math.max(n.getLuminance(),i.getLuminance())+.05)/(Math.min(n.getLuminance(),i.getLuminance())+.05)},e.isReadable=function(t,r,n){var i,o,a=e.readability(t,r);switch(o=!1,i=O(n),i.level+i.size){case"AAsmall":case"AAAlarge":o=a>=4.5;break;case"AAlarge":o=a>=3;break;case"AAAsmall":o=a>=7}return o},e.mostReadable=function(t,r,n){var i,o,a,s,l=null,u=0;n=n||{},o=n.includeFallbackColors,a=n.level,s=n.size;for(var c=0;cu&&(u=i,l=e(r[c]));return e.isReadable(t,l,{level:a,size:s})||!o?l:(n.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],n))};var G=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},X=e.hexNames=M(G),Y=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof r&&r.exports?r.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],240:[function(t,e,r){"use strict";function n(t,e,r){var n=t*e,o=i*t,a=o-t,s=o-a,l=t-s,u=i*e,c=u-e,f=u-c,h=e-f,d=n-s*f,p=d-l*f,g=p-s*h,v=l*h-g;return r?(r[0]=v,r[1]=n,r):[v,n]}e.exports=n;var i=+(Math.pow(2,27)+1)},{}],241:[function(t,e,r){"use strict";function n(t,e,r){var n=t+e,i=n-t,o=n-i,a=e-i,s=t-o;return r?(r[0]=s+a,r[1]=n,r):[s+a,n]}e.exports=n},{}],242:[function(t,e,r){(function(e,n){"use strict";function i(t){if(t){var e=t.length||t.byteLength,r=y.log2(e);w[r].push(t)}}function o(t){i(t.buffer)}function a(t){var t=y.nextPow2(t),e=y.log2(t),r=w[e];return r.length>0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(a(t),0,t)}function l(t){return new Uint16Array(a(2*t),0,t)}function u(t){return new Uint32Array(a(4*t),0,t)}function c(t){return new Int8Array(a(t),0,t)}function f(t){return new Int16Array(a(2*t),0,t)}function h(t){return new Int32Array(a(4*t),0,t)}function d(t){return new Float32Array(a(4*t),0,t)}function p(t){return new Float64Array(a(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(a(t),0,t):s(t)}function v(t){return new DataView(a(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={ UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=o,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return a(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=a,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;32>t;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":38,buffer:39,dup:102}],243:[function(t,e,r){"use strict";function n(t,e){for(var r=1,n=t.length,i=t[0],o=t[0],a=1;n>a;++a)if(o=i,i=t[a],e(i,o)){if(a===r){r++;continue}t[r++]=i}return t.length=r,t}function i(t){for(var e=1,r=t.length,n=t[0],i=t[0],o=1;r>o;++o,i=n)if(i=n,n=t[o],n!==i){if(o===e){e++;continue}t[e++]=n}return t.length=e,t}function o(t,e,r){return 0===t.length?t:e?(r||t.sort(e),n(t,e)):(r||t.sort(),i(t))}e.exports=o},{}],244:[function(t,e,r){"use strict";function n(t,e){return"object"==typeof e&&null!==e||(e={}),i(t,e.canvas||o,e.context||a,e)}e.exports=n;var i=t("./lib/vtext"),o=null,a=null;"undefined"!=typeof document&&(o=document.createElement("canvas"),o.width=8192,o.height=1024,a=o.getContext("2d"))},{"./lib/vtext":245}],245:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",o=[1<<30,1<<30],a=[0,0],s=t.length,l=0;s>l;++l)for(var u=t[l],c=0;2>c;++c)o[c]=0|Math.min(o[c],u[c]),a[c]=0|Math.max(a[c],u[c]);var f=0;switch(n){case"center":f=-.5*(o[0]+a[0]);break;case"right":case"end":f=-a[0];break;case"left":case"start":f=-o[0];break;default:throw new Error("vectorize-text: Unrecognized textAlign: '"+n+"'")}var h=0;switch(i){case"hanging":case"top":h=-o[1];break;case"middle":h=-.5*(o[1]+a[1]);break;case"alphabetic":case"ideographic":h=-3*r;break;case"bottom":h=-a[1];break;default:throw new Error("vectorize-text: Unrecoginized textBaseline: '"+i+"'")}var d=1/r;return"lineHeight"in e?d*=+e.lineHeight:"width"in e?d=e.width/(a[0]-o[0]):"height"in e&&(d=e.height/(a[1]-o[1])),t.map(function(t){return[d*(t[0]+f),d*(t[1]+h)]})}function i(t,e,r,n){var i=0|Math.ceil(e.measureText(r).width+2*n);if(i>8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var o=3*n;t.height=l&&a.push(s)}for(;a.length>0;){var u=a.pop();n[u]=!1;for(var c=r[u],s=0;sn;++n){var o=t[n];e=Math.max(e,o[0],o[1])}e=(0|e)+1}e=0|e;for(var a=new Array(e),n=0;e>n;++n)a[n]=[];for(var n=0;r>n;++n){var o=t[n];a[o[0]].push(o[1]),a[o[1]].push(o[0])}for(var s=0;e>s;++s)i(a[s],function(t,e){return t-e});return a}e.exports=n;var i=t("uniq")},{uniq:243}],248:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,o){for(var a,s,l,c=0;2>c;++c)if(u[c][n].length>0){a=u[c][n][0],l=c;break}s=a[1^l];for(var f=0;2>f;++f)for(var h=u[f][n],d=0;d0&&(a=p,s=g,l=f)}return o?s:(a&&r(a,l),s)}function o(t,o){var a=u[o][t][0],s=[t];r(a,o);for(var l=a[1^o];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],f=t,h=s[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;s.push(t),l=n(c,f)}return s}function a(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;s>c;++c)u[0][c]=[],u[1][c]=[];for(var c=0;l>c;++c){var f=t[c];u[0][f[0]].push(f),u[1][f[1]].push(f)}for(var h=[],c=0;s>c;++c)u[0][c].length+u[1][c].length===0&&h.push([c]);for(var c=0;s>c;++c)for(var d=0;2>d;++d){for(var p=[];u[d][c].length>0;){var g=(u[0][c].length,o(c,d));a(p,g)?p.push.apply(p,g):(p.length>0&&h.push(p),p=g)}p.length>0&&h.push(p)}return h}e.exports=n;var i=t("compare-angle")},{"compare-angle":249}],249:[function(t,e,r){"use strict";function n(t,e,r){var n=s(t[0],-e[0]),i=s(t[1],-e[1]),o=s(r[0],-e[0]),a=s(r[1],-e[1]),c=u(l(n,o),l(i,a));return c[c.length-1]>=0}function i(t,e,r,i){var s=o(e,r,i);if(0===s){var l=a(o(t,e,r)),u=a(o(t,e,i));if(l===u){if(0===l){var c=n(t,e,r),f=n(t,e,i);return c===f?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,i)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:a(u-l)}var h=o(t,e,r);if(h>0)return s>0&&o(t,e,i)>0?1:-1;if(0>h)return s>0||o(t,e,i)>0?1:-1;var d=o(t,e,i);return d>0?1:n(t,e,r)?1:-1}e.exports=i;var o=t("robust-orientation"),a=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":225,"robust-product":250,"robust-sum":228,signum:251,"two-sum":241}],250:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return o(e,t[0]);if(1===e.length)return o(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.lengtht?-1:t>0?1:0}},{}],252:[function(t,e,r){arguments[4][9][0].apply(r,arguments)},{dup:9}],253:[function(t,e,r){"use strict";function n(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}function i(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 o(t,e){var r=p(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 a(t,e){var r=t.intervals([]);r.push(e),o(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return 0>n?y:(r.splice(n,1),o(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],o=[],a=[],s=[],r=0;r3*(e+1)?a(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?a(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var o=this.left?this.left.count:0;if(4*o>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var a=this,l=this.left;l.right;)a=l,l=l.right;if(a===this)l.right=this.right;else{var u=this.left,n=this.right;a.count-=l.count,a.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){return this.root?this.root.queryPoint(t,e):void 0},w.queryInterval=function(t,e,r){return e>=t&&this.root?this.root.queryInterval(t,e,r):void 0},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":252}],254:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),a=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return s>a?a-s:i>l?i-l:a-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var a,s;if(t[0][0]t[1][0]))return-n(t,e);a=t[1],s=t[0]}var l=o(r,i,s),u=o(r,i,a);if(0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;if(l=o(s,a,i),u=o(s,a,r),0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;return i[0]-s[0]}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":225}],255:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=o}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function o(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function a(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}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(0>=i){if(n.left){var o=u(t,e,r,n.left);if(o)return o}var o=r(n.key,n.value);if(o)return o}return n.right?u(t,e,r,n.right):void 0}function c(t,e,r,n,i){var o,a=r(t,i.key),s=r(e,i.key);if(0>=a){if(i.left&&(o=c(t,e,r,n,i.left)))return o;if(s>0&&(o=n(i.key,i.value)))return o}return s>0&&i.right?c(t,e,r,n,i.right):void 0}function f(t,e){this.tree=t,this._stack=e}function h(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 d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=m);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===v){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=m,r._color=m,s._color=m,a(r),a(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===v){if(n=r.right=i(n),s=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=m,n._color=m,e._color=m,a(r),a(n),a(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.right=o(v,n));r.right=o(v,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=v,a(r),a(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===v){if(n=r.left=i(n),s=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=m,n._color=m,e._color=m,a(r),a(n),a(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.left=o(v,n));r.left=o(v,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=v,a(r),a(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1t?-1:t>e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var v=0,m=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=0>=c?i.left:i.right}l.push(new n(v,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var i=l[f];u[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(var f=l.length-1;f>1;--f){var h=l[f-1],i=l[f];if(h._color===m||i._color===m)break;var d=l[f-2];if(d.left===h)if(h.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=h.right,h._color=m,h.right=d,l[f-2]=h,l[f-1]=i,a(d),a(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=m,d.right=o(m,p),d._color=v,f-=1}else{var p=d.right;if(!p||p._color!==v){if(h.right=i.left,d._color=v,d.left=i.right,i._color=m,i.left=h,i.right=d,l[f-2]=i,l[f-1]=h,a(d),a(h),a(i),f>=3){var g=l[f-3];g.left===d?g.left=i:g.right=i}break}h._color=m,d.right=o(m,p),d._color=v,f-=1}else if(h.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=h.left,h._color=m,h.left=d,l[f-2]=h,l[f-1]=i,a(d),a(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=m,d.left=o(m,p),d._color=v,f-=1}else{var p=d.left;if(!p||p._color!==v){if(h.left=i.right,d._color=v,d.right=i.left,i._color=m,i.right=h,i.left=d,l[f-2]=i,l[f-1]=h,a(d),a(h),a(i),f>=3){var g=l[f-3];g.right===d?g.right=i:g.left=i}break}h._color=m,d.left=o(m,p),d._color=v,f-=1}}return l[0]._color=m,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),y.at=function(t){if(0>t)return new f(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new f(this,[])},y.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),0>=o&&(i=n.length),r=0>=o?r.left:r.right}return n.length=i,new f(this,n)},y.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),0>o&&(i=n.length),r=0>o?r.left:r.right}return n.length=i,new f(this,n)},y.lt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),o>0&&(i=n.length),r=0>=o?r.left:r.right}return n.length=i,new f(this,n)},y.le=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),o>=0&&(i=n.length),r=0>o?r.left:r.right}return n.length=i,new f(this,n)},y.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 f(this,n);r=0>=i?r.left:r.right}return new f(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.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=0>=n?r.left:r.right}};var b=f.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new f(this.tree,this._stack.slice())},b.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 i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var o=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var a=e[o-1];e.push(new n(r._color,a.key,a.value,r.left,r.right,r._count)),e[o-1].key=r.key,e[o-1].value=r.value;for(var i=e.length-2;i>=o;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[o-1].left=e[o]}if(r=e[e.length-1],r._color===v){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0?this._stack[this._stack.length-1].key:void 0},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1].value:void 0},enumerable:!0}),Object.defineProperty(b,"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}),b.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(b,"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}}),b.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 o=e.length-2;o>=0;--o)i=e[o],i.left===e[o+1]?r[o]=new n(i._color,i.key,i.value,r[o+1],i.right,i._count):r[o]=new n(i._color,i.key,i.value,i.left,r[o+1],i._count);return new s(this.tree._compare,r[0])},b.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(b,"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}})},{}],256:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function o(t,e){for(var r=null;t;){var n,i,a=t.key;a[0][0]s)t=t.left;else if(s>0)if(e[0]!==a[1][0])r=t,t=t.right;else{var l=o(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==a[1][0])return t;var l=o(t.right,e);if(l)return l;t=t.left}}return r}function a(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),o=0;e>o;++o){var l=t[o],u=l[0][0]o;){for(var v=i[o].x,m=[];r>o;){var y=i[o];if(y.x!==v)break;o+=1,y.segment[0][0]===y.x&&y.segment[1][0]===y.x?y.create&&(y.segment[0][1]e)return-1;var r=(this.slabs[e],o(this.slabs[e],t)),n=-1;if(r&&(n=r.value),this.coordinates[e]===t[0]){var a=null;if(r&&(a=r.key),e>0){var s=o(this.slabs[e-1],t);s&&(a?h(s.key,a)>0&&(a=s.key,n=s.value):(n=s.value,a=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(a){var p=f(a[0],a[1],[t[0],d.y]);a[0][0]>a[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":254,"binary-search-bounds":252,"functional-red-black-tree":255,"robust-orientation":225}],257:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return i?!!i.queryPoint(r,n):!1}}function o(t){for(var e={},r=0;rn)return 1;var i=t[n];if(!i){if(!(n>0&&e[n]===r[0]))return 1;i=t[n-1]}for(var o=1;i;){var a=i.key,s=f(r,a[0],a[1]);if(a[0][0]s)i=i.left;else{if(!(s>0))return 0;o=-1,i=i.right}else if(s>0)i=i.left;else{if(!(0>s))return 0;o=1,i=i.right}}return o}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;e>i;++i)for(var c=t[i],f=c.length,d=f-1,p=0;f>p;d=p++){var g=c[d],v=c[p];g[0]===v[0]?n.push([g,v]):r.push([g,v])}if(0===r.length)return 0===n.length?s:l(o(n));var m=h(r),y=a(m.slabs,m.coordinates);return 0===n.length?y:u(o(n),y)}e.exports=c;var f=t("robust-orientation")[3],h=t("slab-decomposition"),d=t("interval-tree-1d"),p=t("binary-search-bounds")},{"binary-search-bounds":252,"interval-tree-1d":253,"robust-orientation":225,"slab-decomposition":256}],258:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function i(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=[];return e}function o(t,e){function r(t){for(var r=t.length,n=[0],i=0;r>i;++i){var o=e[t[i]],a=e[t[(i+1)%r]],s=u(-o[0],o[1]),l=u(-o[0],a[1]),f=u(a[0],o[1]),h=u(a[0],a[1]);n=c(n,c(c(s,l),c(f,h)))}return n[n.length-1]>0}function o(t){for(var e=t.length,r=0;e>r;++r)if(!z[t[r]])return!1;return!0}var d=h(t,e);t=d[0],e=d[1];for(var p=e.length,g=(t.length,a(t,e.length)),v=0;p>v;++v)if(g[v].length%2===1)throw new Error("planar-graph-to-polyline: graph must be manifold");var m=s(t,e);m=m.filter(r);for(var y=m.length,b=new Array(y),x=new Array(y),v=0;y>v;++v){b[v]=v;var _=new Array(y),w=m[v].map(function(t){return e[t]}),A=l([w]),M=0;t:for(var k=0;y>k;++k)if(_[k]=0,v!==k){for(var T=m[k],E=T.length,L=0;E>L;++L){var S=A(e[T[L]]);if(0!==S){0>S&&(_[k]=1,M+=1);continue t}}_[k]=1,M+=1}x[v]=[M,v,_]}x.sort(function(t,e){return e[0]-t[0]});for(var v=0;y>v;++v)for(var _=x[v],C=_[1],P=_[2],k=0;y>k;++k)P[k]&&(b[k]=C);for(var R=i(y),v=0;y>v;++v)R[v].push(b[v]),R[b[v]].push(v);for(var N={},z=n(p,!1),v=0;y>v;++v)for(var T=m[v],E=T.length,k=0;E>k;++k){var I=T[k],O=T[(k+1)%E],j=Math.min(I,O)+":"+Math.max(I,O);if(j in N){var D=N[j];R[D].push(v),R[v].push(D),z[I]=z[O]=!0}else N[j]=v}for(var F=[],B=n(y,-1),v=0;y>v;++v)b[v]!==v||o(m[v])?B[v]=-1:(F.push(v),B[v]=0);for(var d=[];F.length>0;){var U=F.pop(),V=R[U];f(V,function(t,e){return t-e});var q,H=V.length,G=B[U];if(0===G){var T=m[U];q=[T]}for(var v=0;H>v;++v){var X=V[v];if(!(B[X]>=0)&&(B[X]=1^G,F.push(X),0===G)){var T=m[X];o(T)||(T.reverse(),q.push(T))}}0===G&&d.push(q)}return d}e.exports=o;var a=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),f=t("uniq"),h=t("./lib/trim-leaves")},{"./lib/trim-leaves":246,"edges-to-adjacency-list":247,"planar-dual":248,"point-in-big-polygon":257,"robust-sum":228,"two-product":240,uniq:243}],259:[function(t,e,r){arguments[4][38][0].apply(r,arguments)},{dup:38}],260:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n,n.prototype.length=function(){return this.roots.length},n.prototype.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},n.prototype.find=function(t){for(var e=this.roots;e[t]!==t;){var r=e[t];e[t]=e[r],t=r}return t},n.prototype.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,o=this.roots,a=i[r],s=i[n];s>a?o[r]=n:a>s?o[n]=r:(o[n]=r,++i[r])}}},{}],261:[function(t,e,r){arguments[4][204][0].apply(r,arguments)},{"bit-twiddle":259,dup:204,"union-find":260}],262:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.abs(o(t,e,r)),i=Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2));return n/i}function i(t,e,r){function i(t){if(x[t])return 1/0;var r=m[t],i=y[t];return 0>r||0>i?1/0:n(e[t],e[r],e[i])}function o(t,e){var r=k[t],n=k[e];k[t]=n,k[e]=r,T[r]=e,T[n]=t}function s(t){return b[k[t]]}function l(t){return 1&t?t-1>>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(L>n){var l=s(n);r>l&&(a=n,r=l)}if(L>i){var u=s(i);r>u&&(a=i)}if(a===t)return t;o(t,a),t=a}}function c(t){for(var e=s(t);t>0;){var r=l(t);if(r>=0){var n=s(r);if(n>e){o(t,r),t=r;continue}}return t}}function f(){if(L>0){var t=k[0];return o(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=k[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],i(e)),T[r]>=0&&h(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||0>i||i===n)break;if(n=i,i=t[n],!x[n]||0>i||i===n)break;n=i,r=t[r]}while(r!==n);for(var o=e;o!==n;o=t[o])t[o]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;g>_;++_)m[_]=y[_]=-1,b[_]=1/0,x[_]=!1;for(var _=0;v>_;++_){var w=t[_];if(2!==w.length)throw new Error("Input must be a graph");var A=w[1],M=w[0];-1!==y[M]?y[M]=-2:y[M]=A,-1!==m[A]?m[A]=-2:m[A]=M}for(var k=[],T=new Array(g),_=0;g>_;++_){var E=b[_]=i(_);1/0>E?(T[_]=k.length,k.push(_)):T[_]=-1}for(var L=k.length,_=L>>1;_>=0;--_)u(_);for(;;){var S=f();if(0>S||b[S]>r)break;d(S)}for(var C=[],_=0;g>_;++_)x[_]||(T[_]=C.length,C.push(e[_].slice()));var P=(C.length,[]);return t.forEach(function(t){var e=p(m,t[0]),r=p(y,t[1]);if(e>=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&P.push([n,i])}}),a.unique(a.normalize(P)),{positions:C,edges:P}}e.exports=i;var o=t("robust-orientation"),a=t("simplicial-complex")},{"robust-orientation":225,"simplicial-complex":261}],263:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z", backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],264:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),a=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:a({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":345,"../../plots/cartesian/constants":376,"../../plots/font_attributes":389,"./arrow_paths":263}],265:[function(t,e,r){"use strict";function n(t,e){function r(e,r){return u.coerce(t,n,v.layoutAttributes,e,r)}var n={};r("opacity"),r("align"),r("bgcolor");var i=r("bordercolor"),o=f.opacity(i);r("borderpad");var a=r("borderwidth"),s=r("showarrow");s&&(r("arrowcolor",o?n.bordercolor:f.defaultLine),r("arrowhead"),r("arrowsize"),r("arrowwidth",2*(o&&a||1)),r("ax"),r("ay"),r("axref"),r("ayref"),u.noneOrAll(t,n,["ax","ay"])),r("text",s?" ":"new text"),r("textangle"),u.coerceFont(r,"font",e.font);for(var l=["x","y"],h=0;2>h;h++){var d=l[h],p={_fullLayout:e},g=c.coerceRef(t,n,p,d),m=c.coerceARef(t,n,p,d),y=.5;if("paper"!==g){var b=c.getFromId(p,g);if(y=b.range[0]+y*(b.range[1]-b.range[0]),-1!==["date","category"].indexOf(b.type)&&"string"==typeof t[d]){var x;if("date"===b.type){if(x=u.dateTime2ms(t[d]),x!==!1&&(t[d]=x),m===g){var _=u.dateTime2ms(t["a"+d]);_!==!1&&(t["a"+d]=_)}}else(b._categories||[]).length&&(x=b._categories.indexOf(t[d]),-1!==x&&(t[d]=x))}}r(d,y),s||r(d+"anchor")}return u.noneOrAll(t,n,["x","y"]),n}function i(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=c.getFromId(t,e.xref),n=c.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,a=(e._ysize||0)/2,s=e._yshift||0,l=i-o,u=i+o,f=a-s,h=a+s;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;l=Math.max(l,d),u=Math.max(u,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&c.expand(r,[r.l2c(e.x)],{ppadplus:u,ppadminus:l}),n&&n.autorange&&c.expand(n,[n.l2c(e.y)],{ppadplus:h,ppadminus:f})}})}function o(t,e,r,n,i,o,a,s){var l=r-t,u=i-t,c=a-i,f=n-e,h=o-e,d=s-o,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return 0>v||v>1||0>g||g>1?null:{x:t+l*g,y:e+f*g}}var a=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),f=t("../color"),h=t("../drawing"),d=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),g=t("../dragelement"),v=e.exports={};v.ARROWPATHS=t("./arrow_paths"),v.layoutAttributes=t("./attributes"),v.supplyLayoutDefaults=function(t,e){for(var r=t.annotations||[],i=e.annotations=[],o=0;ot?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var n=W.select(".annotation-math-group"),i=!n.empty(),s=h.bBox((i?n:tt).node()),d=s.width,m=s.height,y=Math.round(d+2*$),b=Math.round(m+2*$);U._w=d,U._h=m;var x=!1;if(["x","y"].forEach(function(e){var n,i=U[e+"ref"]||e,o=c.getFromId(t,i),a=(G+("x"===e?0:90))*Math.PI/180,s=y*Math.abs(Math.cos(a))+b*Math.abs(Math.sin(a)),l=U[e+"anchor"];if(o){if(!o.autorange&&(U[e]-o.range[0])*(U[e]-o.range[1])>0&&(U["a"+e+"ref"]===i?(U["a"+e]-o.range[0])*(U["a"+e]-o.range[1])>0&&(x=!0):x=!0,x))return;H[e]=o._offset+o.l2p(U[e]),n=.5}else n=U[e],"y"===e&&(n=1-n),H[e]="x"===e?S.l+S.w*n:S.t+S.h*n;var u=0;U["a"+e+"ref"]===i?H["aa"+e]=o._offset+o.l2p(U["a"+e]):(u=U.showarrow?U["a"+e]:s*r(n,l),H[e]+=u),U["_"+e+"type"]=o&&o.type,U["_"+e+"size"]=s,U["_"+e+"shift"]=u}),x)return void W.remove();var w,A;U.showarrow&&(w=U.axref===U.xref?H.x:u.constrain(H.x-U.ax,1,_.width-1),A=U.ayref===U.yref?H.y:u.constrain(H.y-U.ay,1,_.height-1)),H.x=u.constrain(H.x,1,_.width-1),H.y=u.constrain(H.y,1,_.height-1);var M=$-s.top,k=$-s.left;i?n.select("svg").attr({x:$-1,y:$}):(tt.attr({x:k,y:M}),tt.selectAll("tspan.line").attr({y:M,x:k})),K.call(h.setRect,Z/2,Z/2,y-Z,b-Z);var T=0,E=0;T=U.axref===U.xref?Math.round(H.aax-y/2):Math.round(H.x-y/2),E=U.ayref===U.yref?Math.round(H.aay-b/2):Math.round(H.y-b/2),W.call(u.setTranslate,T,E);var L="annotations["+e+"]",C=function(r,n){a.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=U.axref===U.xref?H.aax+r:H.x+r,s=U.ayref===U.yref?H.aay+n:H.y+n;var c=u.rotationXYMatrix(G,i,s),h=u.apply2DTransform(c),d=u.apply2DTransform2(c),p=K.attr("width")/2,m=K.attr("height")/2,y=[[i-p,s-m,i-p,s+m],[i-p,s+m,i+p,s+m],[i+p,s+m,i+p,s-m],[i+p,s-m,i-p,s-m]].map(d);if(!y.reduce(function(t,e){return t^!!o(w,A,w+1e6,A+1e6,e[0],e[1],e[2],e[3])},!1)){y.forEach(function(t){var e=o(i,s,w,A,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var b=U.arrowwidth,x=U.arrowcolor,_=X.append("g").style({opacity:f.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=_.append("path").attr("d","M"+i+","+s+"L"+w+","+A).style("stroke-width",b+"px").call(f.stroke,f.rgb(x));v.arrowhead(M,U.arrowhead,"end",U.arrowsize);var k=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-w)+","+(s-A),transform:"translate("+w+","+A+")"}).style("stroke-width",b+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,C;g.init({element:k.node(),prepFn:function(){var t=u.getTranslate(W);E=t.x,C=t.y,T={},V&&V.autorange&&(T[V._name+".autorange"]=!0),q&&q.autorange&&(T[q._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var r=h(E,C),n=r[0]+t,i=r[1]+e;W.call(u.setTranslate,n,i),T[L+".x"]=V?U.x+t/V._m:(w+t-S.l)/S.w,T[L+".y"]=q?U.y+e/q._m:1-(A+e-S.t)/S.h,U.axref===U.xref&&(T[L+".ax"]=V?U.ax+t/V._m:(w+t-S.l)/S.w),U.ayref===U.yref&&(T[L+".ay"]=q?U.ay+e/q._m:1-(A+e-S.t)/S.h),Y.attr({transform:"rotate("+G+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};U.showarrow&&C(0,0);var P=u.rotationXYMatrix(G,H.x,H.y),R=u.apply2DTransform(P);if(t._context.editable){var N,z,I;g.init({element:W.node(),prepFn:function(){var t=u.getTranslate(W);N=t.x,z=t.y,I={}},moveFn:function(t,e){W.call(u.setTranslate,N+t,z+e);var r="pointer";if(U.showarrow)U.axref===U.xref?I[L+".ax"]=V.p2l(V.l2p(U.ax)+t):I[L+".ax"]=U.ax+t,U.ayref===U.yref?I[L+".ay"]=q.p2l(q.l2p(U.ay)+e):I[L+".ay"]=U.ay+e,C(t,e);else{if(V)I[L+".x"]=U.x+t/V._m;else{var n=U._xsize/S.w,i=U.x+U._xshift/S.w-n/2;I[L+".x"]=g.align(i+t/S.w,n,0,1,U.xanchor)}if(q)I[L+".y"]=U.y+e/q._m;else{var o=U._ysize/S.h,a=U.y-U._yshift/S.h-o/2;I[L+".y"]=g.align(a-e/S.h,o,0,1,U.yanchor)}V&&q||(r=g.getCursor(V?.5:I[L+".x"],q?.5:I[L+".y"],U.xanchor,U.yanchor))}var s=R(N,z),l=s[0]+t,c=s[1]+e;W.call(u.setTranslate,N+t,z+e),Y.attr({transform:"rotate("+G+","+l+","+c+")"}),p(W,r)},doneFn:function(e){if(p(W),e){l.relayout(t,I);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var b,x=t.layout,_=t._fullLayout;if(!s(e)||-1===e){if(!e&&Array.isArray(i))return x.annotations=i,v.supplyLayoutDefaults(x,_),void v.drawAll(t);if("remove"===i)return delete x.annotations,_.annotations=[],void v.drawAll(t);if(r&&"add"!==i){for(b=0;b<_.annotations.length;b++)v.draw(t,b,r,i);return}e=_.annotations.length,_.annotations.push({})}if(!r&&i){if("remove"===i){for(_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),_.annotations.splice(e,1),x.annotations.splice(e,1),b=e;b<_.annotations.length;b++)_._infolayer.selectAll('.annotation[data-index="'+(b+1)+'"]').attr("data-index",String(b)),v.draw(t,b);return}if("add"===i||u.isPlainObject(i)){_.annotations.splice(e,0,{});var w=u.isPlainObject(i)?u.extendFlat({},i):{text:"New text"};for(x.annotations?x.annotations.splice(e,0,w):x.annotations=[w],b=_.annotations.length-1;b>e;b--)_._infolayer.selectAll('.annotation[data-index="'+(b-1)+'"]').attr("data-index",String(b)),v.draw(t,b)}}_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var A=x.annotations[e],M=_.annotations[e];if(A){var k={xref:A.xref,yref:A.yref},T={};"string"==typeof r&&r?T[r]=i:u.isPlainObject(r)&&(T=r);var E=Object.keys(T);for(b=0;bb;b++){var P=C[b];if(void 0===T[P]&&void 0!==A[P]){var R=c.getFromId(t,c.coerceRef(k,{},t,P)),N=c.getFromId(t,c.coerceRef(A,{},t,P)),z=A[P],I=M["_"+P+"type"];if(void 0!==T[P+"ref"]){var O="auto"===A[P+"anchor"],j="x"===P?S.w:S.h,D=(M["_"+P+"size"]||0)/(2*j);if(R&&N)z=(z-R.range[0])/(R.range[1]-R.range[0]),z=N.range[0]+z*(N.range[1]-N.range[0]);else if(R){if(z=(z-R.range[0])/(R.range[1]-R.range[0]),z=R.domain[0]+z*(R.domain[1]-R.domain[0]),O){var F=z+D,B=z-D;2/3>z+B?z=B:z+F>4/3&&(z=F)}}else N&&(O&&(1/3>z?z+=D:z>2/3&&(z-=D)),z=(z-N.domain[0])/(N.domain[1]-N.domain[0]),z=N.range[0]+z*(N.range[1]-N.range[0]))}N&&N===R&&I&&("log"===I&&"log"!==N.type?z=Math.pow(10,z):"log"!==I&&"log"===N.type&&(z=z>0?Math.log(z)/Math.LN10:void 0)),A[P]=z}}var U=n(A,_);_.annotations[e]=U;var V=c.getFromId(t,U.xref),q=c.getFromId(t,U.yref),H={x:0,y:0},G=+U.textangle||0,X=_._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",U.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:A,fullAnnotation:U})}),Y=X.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),W=Y.append("g"),Z=U.borderwidth,Q=U.borderpad,$=Z+Q,K=W.append("rect").attr("class","bg").style("stroke-width",Z+"px").call(f.stroke,U.bordercolor).call(f.fill,U.bgcolor),J=U.font,tt=W.append("text").classed("annotation",!0).attr("data-unformatted",U.text).text(U.text);t._context.editable?tt.call(d.makeEditable,W).call(m).on("edit",function(r){U.text=r,this.attr({"data-unformatted":U.text}),this.call(m);var n={};n["annotations["+e+"].text"]=U.text,V&&V.autorange&&(n[V._name+".autorange"]=!0),q&&q.autorange&&(n[q._name+".autorange"]=!0),l.relayout(t,n)}):tt.call(m),Y.attr({transform:"rotate("+G+","+H.x+","+H.y+")"}).call(h.setPosition,H.x,H.y)}},v.arrowhead=function(t,e,r,n){s(n)||(n=1);var i=t.node(),o=v.ARROWPATHS[e||0];if(o){"string"==typeof r&&r||(r="end");var l,u,c,d,p=(h.getPx(t,"stroke-width")||1)*n,g=t.style("stroke")||f.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=o.backoff*p;if("line"===i.nodeName){if(l={x:+t.attr("x1"),y:+t.attr("y1")},u={x:+t.attr("x2"),y:+t.attr("y2")},c=Math.atan2(l.y-u.y,l.x-u.x),d=c+Math.PI,x){var _=x*Math.cos(c),w=x*Math.sin(c);y&&(l.x-=_,l.y-=w,t.attr({x1:l.x,y1:l.y})),b&&(u.x+=_,u.y+=w,t.attr({x2:u.x,y2:u.y}))}}else if("path"===i.nodeName){var A=i.getTotalLength(),M="";if(y){var k=i.getPointAtLength(0),T=i.getPointAtLength(.1);c=Math.atan2(k.y-T.y,k.x-T.x),l=i.getPointAtLength(Math.min(x,A)),x&&(M="0px,"+x+"px,")}if(b){var E=i.getPointAtLength(A),L=i.getPointAtLength(A-.1);if(d=Math.atan2(E.y-L.y,E.x-L.x),u=i.getPointAtLength(Math.max(0,A-x)),x){var S=M?2*x:x;M+=A-S+"px,"+A+"px"}}else M&&(M+=A+"px");M&&t.style("stroke-dasharray",M)}var C=function(r,n){e>5&&(n=0),a.select(i.parentElement).append("path").attr({"class":t.attr("class"),d:o.path,transform:"translate("+r.x+","+r.y+")rotate("+180*n/Math.PI+")scale("+p+")"}).style({fill:g,opacity:m,"stroke-width":0})};y&&C(l,c),b&&C(u,d)}},v.calcAutorange=function(t){var e=t._fullLayout,r=e.annotations;if(r.length&&t._fullData.length){var n={};r.forEach(function(t){n[t.xref]=!0,n[t.yref]=!0});var o=c.list(t).filter(function(t){return t.autorange&&n[t._id]});if(o.length)return u.syncOrAsync([v.drawAll,i],t)}}},{"../../lib":348,"../../lib/setcursor":357,"../../lib/svg_text_utils":361,"../../plotly":368,"../../plots/cartesian/axes":371,"../color":267,"../dragelement":288,"../drawing":290,"./arrow_paths":263,"./attributes":264,d3:100,"fast-isnumeric":104}],266:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],267:[function(t,e,r){"use strict";function n(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var a=0;a=0))return t;if(3===a)n[a]>1&&(n[a]=1);else if(n[a]>=1)return t}var s=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),o=t("fast-isnumeric"),a=e.exports={},s=t("./attributes");a.defaults=s.defaults,a.defaultLine=s.defaultLine,a.lightLine=s.lightLine,a.background=s.background,a.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},a.rgb=function(t){return a.tinyRGB(i(t))},a.opacity=function(t){return t?i(t).getAlpha():0},a.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},a.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||a.background).toRgb(),o=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r:o.r*(1-r.a)+r.r*r.a,g:o.g*(1-r.a)+r.g*r.a,b:o.b*(1-r.a)+r.b*r.a};return i(s).toRgbString()},a.contrast=function(t,e,r){var n=i(t),o=n.isLight()?n.darken(r):n.lighten(e);return o.toString()},a.stroke=function(t,e){var r=i(e);t.style({stroke:a.tinyRGB(r),"stroke-opacity":r.getAlpha()})},a.fill=function(t,e){var r=i(e);t.style({fill:a.tinyRGB(r),"fill-opacity":r.getAlpha()})},a.clean=function(t){if(t&&"object"==typeof t){var e,r,i,o,s=Object.keys(t);for(e=0;el&&(o[1]-=(at-l)/2)):r.node()&&!r.classed("js-placeholder")&&(at=h.bBox(e.node()).height),at){if(at+=5,"top"===x.titleside)K.domain[1]-=at/k.h,o[1]*=-1;else{K.domain[0]+=at/k.h;var c=Math.max(1,r.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}it.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(k.h*(1-K.domain[1]))+")");var f=it.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?E[0]:(S[e]+S[e-1])/2,e===S.length-1?E[1]:(S[e]+S[e+1])/2].map(K.c2p).map(Math.round);e!==S.length-1&&(r[1]+=r[1]>r[0]?1:-1);var o=P(t).replace("e-",""),a=i(o).toHexString();n.select(this).attr({x:X,width:Math.max(F,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:a})});var d=it.select(".cblines").selectAll("path.cbline").data(x.line.color&&x.line.width?L:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+X+","+(Math.round(K.c2p(t))+x.line.width/2%1)+"h"+F).call(h.lineGroupStyle,x.line.width,C(t),x.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=X+F+(x.outlinewidth||0)/2-("outside"===x.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(-1===["top","bottom"].indexOf(x.titleside)){var e=K.titlefont.size,r=K._offset+K._length/2,i=k.l+(K.position||0)*k.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));w("h"+K._id+"title",{avoid:{selection:n.select(t).selectAll("g."+K._id+"tick"),side:x.titleside,offsetLeft:k.l,offsetTop:k.t,maxShift:M.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,r){var n,i=b();n=a.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:it.select(".cbtitle")},s="h"===e.charAt(0)?e.substr(1):"h"+e;it.selectAll("."+s+",."+s+"-math-group").remove(),p.draw(t,e,c(o,r||{}))}function A(){var r=F+x.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(O=ot.select("text"),O.node()&&!O.classed("js-placeholder")){var n,i=ot.select(".h"+K._id+"title-math-group").node();n=i&&-1!==["top","bottom"].indexOf(x.titleside)?h.bBox(i).width:h.bBox(ot.node()).right-X-k.l,r=Math.max(r,n)}var o=2*x.xpad+r+x.borderwidth+x.outlinewidth/2,s=Z-Q;it.select(".cbbg").attr({x:X-x.xpad-(x.borderwidth+x.outlinewidth)/2,y:Q-H,width:Math.max(o,2),height:Math.max(s+2*H,2)}).call(d.fill,x.bgcolor).call(d.stroke,x.bordercolor).style({"stroke-width":x.borderwidth}),it.selectAll(".cboutline").attr({x:X,y:Q+x.ypad+("top"===x.titleside?at:0),width:Math.max(F,2),height:Math.max(s-2*x.ypad-at,2)}).call(d.stroke,x.outlinecolor).style({fill:"None","stroke-width":x.outlinewidth});var l=({center:.5,right:1}[x.xanchor]||0)*o;it.attr("transform","translate("+(k.l-l)+","+k.t+")"),a.autoMargin(t,e,{x:x.x,y:x.y,l:o*({right:1,center:.5}[x.xanchor]||0),r:o*({left:1,center:.5}[x.xanchor]||0),t:s*({bottom:1,middle:.5}[x.yanchor]||0),b:s*({top:1,middle:.5}[x.yanchor]||0)})}var M=t._fullLayout,k=M._size;if("function"!=typeof x.fillcolor&&"function"!=typeof x.line.color)return void M._infolayer.selectAll("g."+e).remove();var T,E=n.extent(("function"==typeof x.fillcolor?x.fillcolor:x.line.color).domain()),L=[],S=[],C="function"==typeof x.line.color?x.line.color:function(){return x.line.color},P="function"==typeof x.fillcolor?x.fillcolor:function(){return x.fillcolor},R=x.levels.end+x.levels.size/100,N=x.levels.size,z=1.001*E[0]-.001*E[1],I=1.001*E[1]-.001*E[0];for(T=x.levels.start;0>(T-R)*N;T+=N)T>z&&I>T&&L.push(T);if("function"==typeof x.fillcolor)if(x.filllevels)for(R=x.filllevels.end+x.filllevels.size/100,N=x.filllevels.size,T=x.filllevels.start;0>(T-R)*N;T+=N)T>E[0]&&T1){var nt=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));tt*=nt*u.roundUp(rt/nt,[2,5,10]),(Math.abs(x.levels.start)/x.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=tt}K.domain=[W+G,W+V-G],K.setScale();var it=M._infolayer.selectAll("g."+e).data([0]);it.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),it.attr("transform","translate("+Math.round(k.l)+","+Math.round(k.t)+")");var ot=it.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(k.l)+",-"+Math.round(k.t)+")");K._axislayer=it.select(".cbaxis");var at=0;if(-1!==["top","bottom"].indexOf(x.titleside)){var st,lt=k.l+(x.x+q)*k.w,ut=K.titlefont.size;st="top"===x.titleside?(1-(W+V-G))*k.h+k.t+3+.75*ut:(1-(W+G))*k.h+k.t-3-.25*ut,w(K._id+"title",{attributes:{x:lt,y:st,"text-anchor":"start"}})}var ct=u.syncOrAsync([a.previousPromises,_,a.previousPromises,A],t);if(ct&&ct.then&&(t._promises||[]).push(ct),t._context.editable){var ft,ht,dt;l.init({element:it.node(),prepFn:function(){ft=it.attr("transform"),f(it)},moveFn:function(t,e){it.attr("transform",ft+" translate("+t+","+e+")"),ht=l.align(Y+t/k.w,B,0,1,x.xanchor),dt=l.align(W-e/k.h,V,0,1,x.yanchor);var r=l.getCursor(ht,dt,x.xanchor,x.yanchor);f(it,r)},doneFn:function(e){f(it),e&&void 0!==ht&&void 0!==dt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":dt},b().index)}})}return ct}function b(){var r,n,i=e.substr(2);for(r=0;rc*f?i.RdBu:c>=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=o(h)),s.colorscale=h)}},{"../../lib":348,"./flip_scale":278,"./scales":285}],275:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":345,"./attributes":273,"./scales.js":285}],276:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":285}],277:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../colorbar/has_colorbar"),a=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,r,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&m>v;u(f+h+"auto",!b),u(f+h+"min"),u(f+h+"max");var x;void 0!==y&&(x=!s(y)),u(f+"autocolorscale",x);var _=u(f+"colorscale"),w=u(f+"reversescale");if(w&&(g.colorscale=l(_)),"marker.line."!==f){var A;f&&(A=o(p));var M=u(f+"showscale",A);M&&a(p,g,r)}}},{"../../lib":348,"../colorbar/defaults":269,"../colorbar/has_colorbar":271,"./flip_scale":278,"./is_valid_scale":282,"fast-isnumeric":104}],278:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=t.length,n=new Array(r),i=r-1,o=0;i>=0;i--,o++)e=t[i],n[o]=[1-e[0],e[1]];return n}},{}],279:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),o(t)?t:e):e}},{"./default_scale":276,"./is_valid_scale_array":283,"./scales":285}],280:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var r=e?i.nestedProperty(t,e).get()||{}:t,a=r.color,s=!1;if(Array.isArray(a))for(var l=0;lh;h++)l=t[h],c[h]=e+l[0]*(r-e),f[h]=i(l[1]).toRgb();var d=n.scale.linear().domain(c).interpolate(n.interpolateObject).range(f);return function(t){if(o(t)){var n=a.constrain(t,e,r),l=d(n);return i(l).toRgbString()}return i(t).isValid()?t:s.defaultLine}}},{"../../lib":348,"../color":267,d3:100,"fast-isnumeric":104,tinycolor2:239}],285:[function(t,e,r){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],286:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){var o=(t-r)/(n-r),a=o+e/(n-r),s=(o+a)/2;return"left"===i||"bottom"===i?o:"center"===i||"middle"===i?s:"right"===i||"top"===i?a:2/3-s>o?o:a>4/3-s?a:s}},{}],287:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,o){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":348}],288:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),a=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,a.pauseEvent(e)}var u,c,f,h,d,p,g=a.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":348,"../../plotly":368,"../../plots/cartesian/constants":376,"./align":286,"./cursor":287,"./unhover":289}],289:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":344}],290:[function(t,e,r){"use strict";function n(t,e,r,n){var o=t[0]-e[0],a=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(o*o+a*a,x/2),c=Math.pow(s*s+l*l,x/2),f=(c*c*o-u*u*s)*n,h=(c*c*a-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[i.round(e[0]+(d&&f/d),2),i.round(e[1]+(d&&h/d),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&h/p),2)]]}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../plots/plots"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),d=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},p.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},p.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},p.setRect=function(t,e,r,n,i){t.call(p.setPosition,e,r).call(p.setSize,n,i)},p.translatePoints=function(t,e,r){t.each(function(t){var n=t.xp||e.c2p(t.x),a=t.yp||r.c2p(t.y),s=i.select(this);o(n)&&o(a)?"text"===this.nodeName?s.attr("x",n).attr("y",a):s.attr("transform","translate("+n+","+a+")"):s.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):r||0},p.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},a=e||o.width||0,l=n||o.dash||"";i.select(this).call(s.stroke,r||o.color).call(p.dashLine,l,a)})},p.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(n){u.error(n,t),r.remove()}})};var g=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=p.symbolNames.length,m="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=r.line;if(a.traceIs(e,"symbols")){var o=d(e);t.attr("d",function(t){var n;n="various"===t.ms||"various"===r.size?3:h.isBubble(e)?o(t.ms):(r.size||6)/2,t.mrc=n;var i=p.symbolNumber(t.mx||r.symbol)||0,a=i%100;return t.om=i%200>=100,p.symbolFuncs[a](n)+(i>=200?m:"")}).style("opacity",function(t){return(t.mo+1||r.opacity+1)-1})}var l=(e._input||{}).marker||{},u=p.tryColorscale(r,l,""),c=p.tryColorscale(r,l,"line.");t.each(function(t){var e,o,a;t.so?(a=n.outlierwidth,o=n.outliercolor,e=r.outliercolor):(a=(t.mlw+1||n.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(n.color)?s.defaultLine:n.color,e="mc"in t?t.mcc=u(t.mc):Array.isArray(r.color)?s.defaultLine:r.color||"rgba(0,0,0,0)");var l=i.select(this);t.om?l.call(s.stroke,e).style({"stroke-width":(a||1)+"px",fill:"none"}):(l.style("stroke-width",a+"px").call(s.fill,e),a&&l.call(s.stroke,o))})}},p.tryColorscale=function(t,e,r){var n=u.nestedProperty(t,r+"color").get(),i=u.nestedProperty(t,r+"colorscale").get(),a=u.nestedProperty(t,r+"cauto").get(),s=u.nestedProperty(t,r+"cmin"),c=u.nestedProperty(t,r+"cmax"),f=s.get(),h=c.get();return i&&Array.isArray(n)?(!a&&o(f)&&o(h)||(f=1/0,h=-(1/0),n.forEach(function(t){o(t)&&(f>t&&(f=+t),t>h&&(h=+t))}),f>h&&(f=0,h=1),s.set(f),c.set(h),u.nestedProperty(e,r+"cmin").set(f),u.nestedProperty(e,r+"cmax").set(h)),l.makeScaleFunction(i,f,h)):u.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;p.textPointStyle=function(t,e){t.each(function(t){var r=i.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,s=-1!==a.indexOf("top")?"top":-1!==a.indexOf("bottom")?"bottom":"middle",l=-1!==a.indexOf("left")?"end":-1!==a.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(p.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(c.convertToTspans);var h=i.select(this.parentNode),d=r.selectAll("tspan.line"),g=((d[0].length||1)-1)*b+1,v=y[l]*f,m=.75*u+y[s]*f+(y[s]-1)*g*u/2;h.attr("transform","translate("+v+","+m+")"),g>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var x=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,i="M"+t[0],o=[];for(r=1;rr;r++)a.push(n(t[r-1],t[r],t[r+1],e));for(a.push(n(t[o-1],t[o],t[0],e)),r=1;o>=r;r++)i+="C"+a[r-1][1]+" "+a[r][0]+" "+t[r];return i+="C"+a[o][1]+" "+a[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+i.round(e[0],2)+"V"+i.round(e[1],2)},vh:function(t,e){return"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},hvh:function(t,e){return"H"+i.round((t[0]+e[0])/2,2)+"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},vhv:function(t,e){return"V"+i.round((t[1]+e[1])/2,2)+"H"+i.round(e[0],2)+"V"+i.round(e[1],2)}},w=function(t,e){return"L"+i.round(e[0],2)+","+i.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var r="M"+i.round(t[0][0],2)+","+i.round(t[0][1],2),n=1;n=M&&(i.selectAll("[data-bb]").attr("data-bb",null),A=[]),t.setAttribute("data-bb",A.length),A.push(l),u.extendFlat({},l)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":339,"../../lib":348,"../../lib/svg_text_utils":361,"../../plots/plots":404,"../../traces/scatter/make_bubble_size_func":439,"../../traces/scatter/subtypes":444,"../color":267,"../colorscale":281,"./symbol_defs":291,d3:100,"fast-isnumeric":104}],291:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,o="l-"+e+",-"+e,a="l-"+e+","+e;return"M0,"+e+r+i+o+i+o+a+o+a+r+a+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),o=n.round(t*-.309,2),a=n.round(.809*t,2);return"M"+e+","+o+"L"+r+","+a+"H-"+r+"L-"+e+","+o+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),o=n.round(.363*e,2),a=n.round(.588*e,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+o+","+u+"L"+a+","+c+"L0,"+f+"L-"+a+","+c+"L-"+o+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+r+a+e+","+r+a+"0,-"+i+a+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+r+a+"-"+e+",-"+r+a+"0,"+i+a+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:100}],292:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],293:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},l=o.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(o),f=0;fs;s++)a[s]={x:r[s],y:i[s]};return a[0].trace=t,n.calc({calcdata:[a],_fullLayout:e}),a},n.plot=t("./plot"),n.style=t("./style"),n.hoverInfo=function(t,e,r){(e.error_y||{}).visible&&(r.yerr=t.yh-t.y,e.error_y.symmetric||(r.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(r.xerr=t.xh-t.x,e.error_x.symmetric||(r.xerrneg=t.x-t.xs))}},{"./attributes":292,"./calc":293,"./defaults":295,"./plot":297,"./style":298}],297:[function(t,e,r){"use strict";function n(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};return void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),o(n.ys)||(n.noYS=!0,n.ys=r.c2p(t.ys,!0))),void 0!==t.xh&&(n.xh=e.c2p(t.xh),n.xs=e.c2p(t.xs),o(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0))),n}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../lib"),s=t("../../traces/scatter/subtypes");e.exports=function(t,e){var r=e.x(),l=e.y();t.each(function(t){var e=t[0].trace,u=e.error_x||{},c=e.error_y||{},f=s.hasMarkers(e)&&e.marker.maxdisplayed>0;if(c.visible||u.visible){var h=i.select(this).selectAll("g.errorbar").data(a.identity);h.enter().append("g").classed("errorbar",!0),h.each(function(t){var e=i.select(this),a=n(t,r,l);if(!f||t.vis){var s;if(c.visible&&o(a.x)&&o(a.yh)&&o(a.ys)){var h=c.width;s="M"+(a.x-h)+","+a.yh+"h"+2*h+"m-"+h+",0V"+a.ys,a.noYS||(s+="m-"+h+",0h"+2*h),e.append("path").classed("yerror",!0).attr("d",s)}if(u.visible&&o(a.y)&&o(a.xh)&&o(a.xs)){var d=(u.copy_ystyle?c:u).width;s="M"+a.xh+","+(a.y-d)+"v"+2*d+"m0,-"+d+"H"+a.xs,a.noXS||(s+="m0,-"+d+"v"+2*d),e.append("path").classed("xerror",!0).attr("d",s)}}})}})}},{"../../lib":348,"../../traces/scatter/subtypes":444,d3:100,"fast-isnumeric":104}],298:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},a=n.select(this);a.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),o.copy_ystyle&&(o=r),a.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(i.stroke,o.color)})}},{"../color":267,d3:100}],299:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":376}],300:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;2>s;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],o=0;o=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],304:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":345,"../../plots/font_attributes":389,"../color/attributes":266}],305:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],306:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/plots"),o=t("./attributes"),a=t("./helpers");e.exports=function(t,e,r){function s(t,e){return n.coerce(h,d,o,t,e)}for(var l,u,c,f,h=t.legend||{},d=e.legend={},p=0,g="normal",v=0;v1);if(y!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),n.coerceFont(s,"font",e.font),s("orientation"),"h"===d.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(l=0,c="left",u=1.1,f="bottom"):(l=0,c="left",u=-.1,f="top")}s("traceorder",g),a.isGrouped(e.legend)&&s("tracegroupgap"),s("x",l),s("xanchor",c),s("y",u),s("yanchor",f),n.noneOrAll(h,d,["x","y"])}}},{"../../lib":348, -"../../plots/plots":404,"./attributes":304,"./helpers":309}],307:[function(t,e,r){"use strict";function n(t,e){function r(r){c.util.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=h.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,i.legend.font).text(u),e._context.editable&&!s?f.call(c.util.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" "),c.restyle(e,"name",t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,o=t.data()[0][0],a=e._fullData,s=o.trace,l=s.legendgroup,u=[];if(h.traceIs(s,"pie")){var f=o.label,d=r.indexOf(f);-1===d?r.push(f):r.splice(d,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),d=h[0].length||1;r=l*d,n=c.node()&&p.bBox(c.node()).width;var g=l*(.3+(1-d)/2);c.attr("y",g),h.attr("y",g)}r=Math.max(r,16)+3,o.attr({x:0,y:-r/2,height:r}),i.height=r,i.width=n}function a(t,e,r){var n=t._fullLayout,i=n.legend,o=i.borderwidth,a=b.isGrouped(i);if(b.isVertical(i))a&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,o,5+o+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*o,i.height+=10+2*o,a&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),r.selectAll(".legendtoggle").attr("width",(t._context.editable?0:i.width)+40),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height);else if(a){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;h>c;c++){var d=l[c].map(function(t){return t[0].width}),p=40+Math.max.apply(null,d);i.width+=i.tracegroupgap+p,s.push(i.width)}e.each(function(t,e){f.setTranslate(this,s[e],0)}),e.each(function(){var t=u.select(this),e=t.selectAll("g.traces"),r=0;e.each(function(t){var e=t[0],n=e.height;f.setTranslate(this,0,5+o+r+n/2),r+=n}),i.height=Math.max(i.height,r)}),i.height+=10+2*o,i.width+=2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}else{i.width=0,i.height=0;var g=0,v=0,m=0,y=0;r.each(function(t){m=Math.max(40+t[0].width,m)}),r.each(function(t){var e=t[0],r=m,a=i.tracegroupgap||5;o+y+a+r>n.width-(n.margin.r+n.margin.l)&&(y=0,g+=v,i.height=i.height+v,v=0),f.setTranslate(this,o+y,5+o+e.height/2+g),i.width+=a+r,i.height=Math.max(i.height,e.height),y+=a+r,v=Math.max(e.height,v)}),i.width+=2*o,i.height+=10+2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}}function s(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center");var i="top";x.isBottomAnchor(r)?i="bottom":x.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../dragelement"),p=t("../drawing"),g=t("../color"),v=t("./constants"),m=t("./get_legend_data"),y=t("./style"),b=t("./helpers"),x=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),E.call(p.setRect,D,t,v.scrollBarWidth,v.scrollBarHeight),M.select("rect").attr({y:b.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var b=r.legend,_=r.showlegend&&m(t.calcdata,b),w=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void h.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({"class":"legend","pointer-events":"all"});var M=r._topdefs.selectAll("#"+o).data([0]);M.enter().append("clipPath").attr("id",o).append("rect");var k=A.selectAll("rect.bg").data([0]);k.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),k.call(g.stroke,b.bordercolor),k.call(g.fill,b.bgcolor),k.style("stroke-width",b.borderwidth+"px");var T=A.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var E=A.selectAll("rect.scrollbar").data([0]);E.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var L=T.selectAll("g.groups").data(_);L.enter().append("g").attr("class","groups"),L.exit().remove();var S=L.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var C=0!==A.enter().size();C&&(a(t,L,S),s(t));var P=0,R=r.width,N=0,z=r.height;a(t,L,S),b.height>z?l(t):s(t);var I=r._size,O=I.l+I.w*b.x,j=I.t+I.h*(1-b.y);x.isRightAnchor(b)?O-=b.width:x.isCenterAnchor(b)&&(O-=b.width/2),x.isBottomAnchor(b)?j-=b.height:x.isMiddleAnchor(b)&&(j-=b.height/2);var D=b.width,F=I.w;D>F?(O=I.l,D=F):(O+D>R&&(O=R-D),P>O&&(O=P),D=Math.min(R-O,b.width));var B=b.height,U=I.h;B>U?(j=I.t,B=U):(j+B>z&&(j=z-B),N>j&&(j=N),B=Math.min(z-j,b.height)),f.setTranslate(A,O,j);var V,q,H=B-v.scrollBarHeight-2*v.scrollBarMargin,G=b.height-B;if(b.height<=B||t._context.staticPlot)k.attr({width:D-b.borderwidth,height:B-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),f.setTranslate(T,0,0),M.select("rect").attr({width:D-2*b.borderwidth,height:B-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth}),T.call(p.setClipUrl,o);else{V=v.scrollBarMargin,q=T.attr("data-scroll")||0,k.attr({width:D-2*b.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:B-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),M.select("rect").attr({width:D-2*b.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:B-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth-q}),T.call(p.setClipUrl,o),C&&e(V,q),A.on("wheel",null),A.on("wheel",function(){q=f.constrain(T.attr("data-scroll")-u.event.deltaY/H*G,-G,0),V=v.scrollBarMargin-q/G*H,e(V,q),u.event.preventDefault()}),E.on(".drag",null),T.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=f.constrain(u.event.y-v.scrollBarHeight/2,v.scrollBarMargin,v.scrollBarMargin+H),q=-(V-v.scrollBarMargin)/H*G,e(V,q)});E.call(X),T.call(X)}if(t._context.editable){var Y,W,Z,Q;A.classed("cursor-move",!0),d.init({element:A.node(),prepFn:function(){var t=f.getTranslate(A);Z=t.x,Q=t.y},moveFn:function(t,e){var r=Z+t,n=Q+e;f.setTranslate(A,r,n),Y=d.align(r,0,I.l,I.l+I.w,b.xanchor),W=d.align(n,0,I.t+I.h,I.t,b.yanchor)},doneFn:function(e){e&&void 0!==Y&&void 0!==W&&c.relayout(t,{"legend.x":Y,"legend.y":W})}})}}}},{"../../lib":348,"../../plotly":368,"../../plots/plots":404,"../color":267,"../dragelement":288,"../drawing":290,"./anchor_utils":303,"./constants":305,"./get_legend_data":308,"./helpers":309,"./style":311,d3:100}],308:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+f;l.push(n),s[n]=[[r]],f++}}var o,a,s={},l=[],u=!1,c={},f=0;for(o=0;oo;o++)m=s[l[o]],y[o]=i.isReversed(e)?m.reverse():m;else{for(y=[new Array(b)],o=0;b>o;o++)m=s[l[o]][0],y[0][i.isReversed(e)?b-o-1:o]=m;b=1}return e._lgroupsLength=b,y}},{"../../plots/plots":404,"./helpers":309}],309:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.legendGetsTrace=function(t){return t.visible&&n.traceIs(t,"showLegend")},r.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},r.isVertical=function(t){return"h"!==t.orientation},r.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":404}],310:[function(t,e,r){"use strict";var n=e.exports={};n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.draw=t("./draw"),n.style=t("./style")},{"./attributes":304,"./defaults":306,"./draw":307,"./style":311}],311:[function(t,e,r){"use strict";function n(t){var e=t[0].trace,r=e.visible&&e.fill&&"none"!==e.fill,n=d.hasLines(e),i=l.select(this).select(".legendfill").selectAll("path").data(r?[t]:[]);i.enter().append("path").classed("js-fill",!0),i.exit().remove(),i.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var o=l.select(this).select(".legendlines").selectAll("path").data(n?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(f.lineGroupStyle)}function i(t){function e(t,e,r){var n=u.nestedProperty(a,t).get(),i=Array.isArray(n)&&e?e(n):n;if(r){if(ir[1])return r[1]}return i}function r(t){return t[0]}var n,i,o=t[0],a=o.trace,s=d.hasMarkers(a),c=d.hasText(a),h=d.hasLines(a);if(s||c||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(o,p)],i=u.minExtend(a,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function a(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../lib"),c=t("../../plots/plots"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(a).each(s).each(n).each(i)}},{"../../lib":348,"../../plots/plots":404,"../../traces/pie/style_one":423,"../../traces/scatter/subtypes":444,"../color":267,"../drawing":290,d3:100}],312:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,o=t._fullLayout,a={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,h=(1-c)/2,d=u.Axes.list(t,null,!0),p=0;py;y++){var b=s[y];h=m[b]={};for(var x=0;x1)return n(["resetViews","toggleHover"]),a(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&o(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),a(v,r)}function i(t){for(var e=l.Axes.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),o.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),o.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",a.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":348,"../color":267,"./attributes":315,"./button_attributes":316,"./constants":317}],319:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;ne){var r=e;e=t,t=r}s.setAttributes(w,{"data-min":t,"data-max":e}),s.setAttributes(N,{x:t,width:e-t}),s.setAttributes(k,{width:t}),s.setAttributes(T,{x:e,width:p-e}),s.setAttributes(E,{transform:"translate("+(t-v-1)+")"}),s.setAttributes(C,{transform:"translate("+e+")"})}var f=t._fullLayout,h=f._infolayer.selectAll("g.range-slider"),d=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*d.thickness,v=2,m=Math.floor(d.borderwidth/2),y=f.margin.l,b=f.height-g-f.margin.b,x=0,_=p,w=document.createElementNS(a,"g");s.setAttributes(w,{"class":"range-slider","data-min":x,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+b+")"});var A=document.createElementNS(a,"rect"),M=d.borderwidth%2===0?d.borderwidth:d.borderwidth-1;s.setAttributes(A,{fill:d.bgcolor,stroke:d.bordercolor,"stroke-width":d.borderwidth,height:g+M,width:p+M,transform:"translate(-"+m+", -"+m+")","shape-rendering":"crispEdges"});var k=document.createElementNS(a,"rect");s.setAttributes(k,{x:0,width:x,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(a,"rect");s.setAttributes(T,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var E=document.createElementNS(a,"g"),L=document.createElementNS(a,"rect"),S=document.createElementNS(a,"rect");s.setAttributes(E,{transform:"translate("+(x-v-1)+")"}),s.setAttributes(L,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),s.setAttributes(S,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(E,[S,L]);var C=document.createElementNS(a,"g"),P=document.createElementNS(a,"rect"),R=document.createElementNS(a,"rect");s.setAttributes(C,{transform:"translate("+_+")"}),s.setAttributes(P,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),s.setAttributes(R,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(C,[R,P]);var N=document.createElementNS(a,"rect");s.setAttributes(N,{x:x,width:_-x,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function r(t){var r,n,f=+t.clientX-o;switch(i){case N:w.style.cursor="ew-resize",r=+s+f,n=+l+f,c(r,n),u(e(r),e(n));break;case L:w.style.cursor="col-resize",r=+s+f,n=+l,c(r,n),u(e(r),e(n));break;case P:w.style.cursor="col-resize",r=+s,n=+l+f,c(r,n),u(e(r),e(n));break;default:w.style.cursor="ew-resize",r=a,n=a+f,c(r,n),u(e(r),e(n))}}function n(){window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n),w.style.cursor="auto"}var i=t.target,o=t.clientX,a=o-w.getBoundingClientRect().left,s=w.getAttribute("data-min"),l=w.getAttribute("data-max");window.addEventListener("mousemove",r),window.addEventListener("mouseup",n)}),d.range||(d.range=i.getAutoRange(f.xaxis));var z=l(t,p,g);s.appendChildren(w,[A,z,k,T,N,E,C]),r(f.xaxis.range[0],f.xaxis.range[1]),h.data([0]).enter().append(function(){return d.setRange=r,w})}},{"../../constants/xmlns_namespaces":339,"../../lib":348,"../../plotly":368,"../../plots/cartesian/axes":371,"./helpers":325,"./range_plot":327}],324:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,o){function a(t,e){return n.coerce(s,l,i,t,e)}if(t[r].rangeslider){var s=n.isPlainObject(t[r].rangeslider)?t[r].rangeslider:{},l=e[r].rangeslider={};if(a("bgcolor"),a("bordercolor"),a("borderwidth"),a("thickness"),a("visible"),a("range"),l.range&&!e[r].autorange){var u=l.range,c=e[r].range;u[0]=Math.min(u[0],c[0]),u[1]=Math.max(u[1],c[1])}else e[r]._needsExpand=!0;l.visible&&o.forEach(function(t){var r=e[t]||{};r.fixedrange=!0,e[t]=r})}}},{"../../lib":348,"./attributes":322}],325:[function(t,e,r){"use strict";r.setAttributes=function(t,e){for(var r in e)t.setAttribute(r,e[r])},r.appendChildren=function(t,e){for(var r=0;rl;l++){var u=s[l],c={_fullLayout:e},f=k.coerceRef(t,n,c,u);if("path"!==a){var h=.25,d=.75;if("paper"!==f){var p=k.getFromId(c,f),g=o(p);h=g(p.range[0]+h*(p.range[1]-p.range[0])),d=g(p.range[0]+d*(p.range[1]-p.range[0]))}r(u+"0",h),r(u+"1",d)}}return"path"===a?r("path"):M.noneOrAll(t,n,["x0","x1","y0","y1"]),n}function i(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function a(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function s(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function l(t,e,r){for(var n=0;ne;i--)d(t,i).selectAll('[data-index="'+(i-1)+'"]').attr("data-index",i),C.draw(t,i)}function f(t,e,r,a){function s(r){var n={"data-index":e,"fill-rule":"evenodd",d:b(t,C)},i=C.line.width?C.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",C.opacity).call(T.stroke,i).call(T.fill,C.fillcolor).call(E.dashLine,C.line.dash,C.line.width);P&&o.call(E.setClipUrl,"clip"+t._fullLayout._uid+P),t._context.editable&&h(t,o,C,e)}var l,u;d(t,e).selectAll('[data-index="'+e+'"]').remove();var c=t.layout.shapes[e];if(c){var f={xref:c.xref,yref:c.yref},g={};"string"==typeof r&&r?g[r]=a:M.isPlainObject(r)&&(g=r);var v=Object.keys(g);for(l=0;ll;l++){var x=y[l];if(void 0===g[x]&&void 0!==c[x]){var _,w=x.charAt(0),A=k.getFromId(t,k.coerceRef(f,{},t,w)),L=k.getFromId(t,k.coerceRef(c,{},t,w)),S=c[x];void 0!==g[w+"ref"]&&(A?(_=i(A)(S),S=(_-A.range[0])/(A.range[1]-A.range[0])):S=(S-L.domain[0])/(L.domain[1]-L.domain[0]),L?(_=L.range[0]+S*(L.range[1]-L.range[0]),S=o(L)(_)):S=A.domain[0]+S*(A.domain[1]-A.domain[0])),c[x]=S}}var C=n(c,t._fullLayout);t._fullLayout.shapes[e]=C;var P;if("below"!==C.layer)P=(C.xref+C.yref).replace(/paper/g,""),s(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)P="",s(t._fullLayout._shapeLowerLayer);else{var R,N=t._fullLayout._plots||{},z=Object.keys(N);for(l=0,u=z.length;u>l;l++)R=N[z[l]],P=z[l],p(t,C,R)&&s(R.shapelayer)}}}function h(t,e,r,n){function i(t){var r=$.right-$.left,n=$.bottom-$.top,i=t.clientX-$.left,o=t.clientY-$.top,a=r>W&&n>Z&&!t.shiftKey?L.getCursor(i/r,1-o/n):"move";S(e,a),Y=a.split("-")[0]}function o(e){U=k.getFromId(t,r.xref),V=k.getFromId(t,r.yref),q=m(t,U),H=m(t,V,!0),G=y(t,U),X=y(t,V,!0);var o="shapes["+n+"]";"path"===r.type?(F=r.path,B=o+".path"):(c=q(r.x0),f=H(r.y0),h=q(r.x1),d=H(r.y1),p=o+".x0",g=o+".y0",_=o+".x1",w=o+".y1"),h>c?(E=c,N=o+".x0",j="x0",C=h,z=o+".x1",D="x1"):(E=h,N=o+".x1",j="x1",C=c,z=o+".x0",D="x0"),d>f?(M=f,P=o+".y0",I="y0",T=d,R=o+".y1",O="y1"):(M=d,P=o+".y1",I="y1",T=f,R=o+".y0",O="y0"),u={},i(e),Q.moveFn="move"===Y?s:l}function a(r){S(e),r&&A.relayout(t,u)}function s(n,i){if("path"===r.type){var o=function(t){return G(q(t)+n)};U&&"date"===U.type&&(o=v(o));var a=function(t){return X(H(t)+i)};V&&"date"===V.type&&(a=v(a)),r.path=x(F,o,a),u[B]=r.path}else u[p]=r.x0=G(c+n),u[g]=r.y0=X(f+i),u[_]=r.x1=G(h+n),u[w]=r.y1=X(d+i);e.attr("d",b(t,r))}function l(n,i){if("path"===r.type){var o=function(t){return G(q(t)+n)};U&&"date"===U.type&&(o=v(o));var a=function(t){return X(H(t)+i)};V&&"date"===V.type&&(a=v(a)),r.path=x(F,o,a),u[B]=r.path}else{var s=~Y.indexOf("n")?M+i:M,l=~Y.indexOf("s")?T+i:T,c=~Y.indexOf("w")?E+n:E,f=~Y.indexOf("e")?C+n:C;l-s>Z&&(u[P]=r[I]=X(s),u[R]=r[O]=X(l)),f-c>W&&(u[N]=r[j]=G(c),u[z]=r[D]=G(f))}e.attr("d",b(t,r))}var u,c,f,h,d,p,g,_,w,M,T,E,C,P,R,N,z,I,O,j,D,F,B,U,V,q,H,G,X,Y,W=10,Z=10,Q={setCursor:i,element:e.node(),prepFn:o,doneFn:a},$=Q.element.getBoundingClientRect();L.init(Q)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):M.log("getShapeLayer: undefined shape: index",e),n}function p(t,e,r){var n=A.Axes.getFromId(t,r.id,"x")._id,i=A.Axes.getFromId(t,r.id,"y")._id,o="below"===e.layer,a=n===e.xref||i===e.yref,s=!!r.shapelayer;return o&&a&&s}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function v(t){return function(e){return t(e).replace(" ","_")}}function m(t,e,r){var n,o=t._fullLayout._size;if(e){var a=i(e);n=function(t){return e._offset+e.l2p(a(t,!0))},"date"===e.type&&(n=g(n))}else n=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return n}function y(t,e,r){var n,i=t._fullLayout._size;if(e){var a=o(e);n=function(t){return a(e.p2l(t-e._offset))}}else n=r?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return n}function b(t,e){var r,n,o,a,s=e.type,l=k.getFromId(t,e.xref),u=k.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=i(l),n=function(t){return l._offset+l.l2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(o=i(u),a=function(t){return u._offset+u.l2p(o(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===s)return l&&"date"===l.type&&(n=g(n)),u&&"date"===u.type&&(a=g(a)),C.convertPath(e.path,n,a);var f=n(e.x0),h=n(e.x1),d=a(e.y0),p=a(e.y1);if("line"===s)return"M"+f+","+d+"L"+h+","+p;if("rect"===s)return"M"+f+","+d+"H"+h+"V"+p+"H"+f+"Z";var v=(f+h)/2,m=(d+p)/2,y=Math.abs(v-f),b=Math.abs(m-d),x="A"+y+","+b,_=v+y+","+m,w=v+","+(m-b);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function x(t,e,r){return t.replace(P,function(t){var n=0,i=t.charAt(0),o=N[i],a=z[i],s=I[i],l=t.substr(1).replace(R,function(t){return n>=s?t:(o[n]?t=e(t):a[n]&&(t=r(t)),n++,t)});return i+l})}function _(t,e,r,n,i){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(r)];if(n){var a,s,l,u,c,f=1/0,h=-(1/0),d=n.match(P);for("date"===t.type&&(o=g(o)),a=0;ac&&(f=c),c>h&&(h=c)));return h>=f?[f,h]:void 0}}var w=t("fast-isnumeric"),A=t("../../plotly"),M=t("../../lib"),k=t("../../plots/cartesian/axes"),T=t("../color"),E=t("../drawing"),L=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var r=t.shapes||[],i=e.shapes=[],o=0;os&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),M.log("Ignoring extra params in segment "+t)),i+l})},C.calcAutorange=function(t){var e,r,n,i,o,a=t._fullLayout,s=a.shapes;if(s.length&&t._fullData.length)for(e=0;eh?r=h:(c.left-=b.offsetLeft,c.right-=b.offsetLeft,c.top-=b.offsetTop,c.bottom-=b.offsetTop,b.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(r=Math.max(r,a*(t[b.side]-c[o])+u))}),r=Math.min(h,r)),r>0||0>h){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=P,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,M=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var P="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":348,"../../lib/svg_text_utils":361,"../../plotly":368,"../../plots/plots":404,"../color":267,"../drawing":290,d3:100,"fast-isnumeric":104}],331:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat,a={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:a,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":345,"../../plots/font_attributes":389,"../color/attributes":266}],332:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],333:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return o.coerce(n,i,u,t,e)}for(var n,i,a=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(l.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&m(t),0!==r.length){var u=l.selectAll("g."+T.headerGroupClassName).data(r,i);u.enter().append("g").classed(T.headerGroupClassName,!0);var c=l.selectAll("g."+T.buttonGroupClassName).data([0]);c.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){y.select(this).remove(),c.call(v).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],339:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],340:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.16.2",r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=n.register,r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=n.Snapshot,r.PlotSchema=n.PlotSchema,r.Queue=n.Queue,r.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":365,"./plot_api/to_image":366,"./plot_api/validate":367,"./plotly":368,"./snapshot/download":412,d3:100}],341:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],342:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),o=t("./nested_property"),a=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)}},"boolean":{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r?!0:"string"!=typeof t?!1:!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),o=0;o2)return!1;var l=a[0].split("-");if(l.length>3||3!==l.length&&a[1])return!1;if(4===l[0].length)r=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();r=((Number(l[0])-u+70)%100+200)%100+u-70}return s(r)?1===l.length?new Date(r,0,1).getTime():(n=Number(l[1])-1,l[1].length>2||!(n>=0&&11>=n)?!1:2===l.length?new Date(r,n,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(r,n,i).getTime(),a[1]?(l=a[1].split(":"),l.length>3?!1:(o=Number(l[0]),l[0].length>2||!(o>=0&&23>=o)?!1:(i+=36e5*o,1===l.length?i:(n=Number(l[1]),l[1].length>2||!(n>=0&&59>=n)?!1:(i+=6e4*n,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){if("undefined"==typeof a)return void l.error("d3 is not defined.");e||(e=0);var r=new Date(t),i=a.time.format("%Y-%m-%d")(r);return 7776e6>e?(i+=" "+n(r.getHours(),2),432e6>e&&(i+=":"+n(r.getMinutes(),2),108e5>e&&(i+=":"+n(r.getSeconds(),2),3e5>e&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={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"]},c={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"]},f=a.time.format.utc,h={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){h[t].D.push(f(e)),["H","I","D"].forEach(function(r){u[r].forEach(function(n){var i=h[t][r];i.push(f(e+"~"+n)),i.push(f(n+"~"+e))})})})});var d=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,v=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},b=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,A=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],k=function(t,e){return M[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,p).replace(g,"").replace(v,"~").replace(m,y).replace(A,k).trim().replace(T,"");var e,r,n=null,a=i(t),s=o(t);e=h[a][s],r=e.length;for(var l=0;r>l&&!(n=e[l].parse(t));l++);if(!(n instanceof Date))return!1;var u=n.getTimezoneOffset();return n.setTime(n.getTime()+60*u*1e3),n}},{"../lib":348,d3:100,"fast-isnumeric":104}],344:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof n)return t;var e=new n;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(r,n){"undefined"!=typeof jQuery&&jQuery(t).trigger(r,n),e.emit(r,n)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof jQuery&&(n=jQuery(t).triggerHandler(e,r));var o=t._ev;if(!o)return n;var a=o._events[e];if(!a)return n;"function"==typeof a&&(a=[a]);for(var s=a.pop(),l=0;lm;m++){l=t[m];for(u in l)c=g[u],f=l[u],s&&a(f)?g[u]=f:e&&f&&(o(f)||(h=a(f)))?(h?(h=!1,d=c&&a(c)?c:[]):d=c&&o(c)?c:{},g[u]=i([d,f],e,r,s)):("undefined"!=typeof f||r)&&(g[u]=f)}return g}var o=t("./is_plain_object.js"),a=Array.isArray;r.extendFlat=function(){return i(arguments,!1,!1,!1)},r.extendDeep=function(){return i(arguments,!0,!1,!1)},r.extendDeepAll=function(){return i(arguments,!0,!0,!1)},r.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":349}],346:[function(t,e,r){"use strict";function n(t,e){var r=f(t);return r[3]*=e,r}function i(t){return s(t).isValid()?t:c}function o(t){return l(t)?t:h}function a(t,e,r){var a,s,l,f,d,p=t.color,g=Array.isArray(p),v=Array.isArray(e),m=[];if(a=void 0!==t.colorscale?u(t.colorscale,t.cmin,t.cmax):i,s=g?function(t,e){return void 0===t[e]?c:a(t[e])}:i,l=v?function(t,e){return void 0===t[e]?h:o(t[e])}:o,g||v)for(var y=0;r>y;y++)f=s(p,y),d=l(e,y),m[y]=n(f,d);else m=n(p,e);return m}var s=t("tinycolor2"),l=t("fast-isnumeric"),u=t("../components/colorscale/make_scale_function"),c=t("../components/color/attributes").defaultLine,f=t("./str2rgbarray"),h=1;e.exports=a},{"../components/color/attributes":266,"../components/colorscale/make_scale_function":284,"./str2rgbarray":360,"fast-isnumeric":104,tinycolor2:239}],347:[function(t,e,r){"use strict";function n(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(e>r)break;t=t.slice(0,e)+l(t.slice(e+5,r))+t.slice(r+6)}return t}function i(t){return t.replace(/\/g,"\n")}function o(t){return t.replace(/\<.*\>/g,"")}function a(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(r>n)r+=1;else{var i=e[t.slice(r+1,n)];t=i?t.slice(0,r)+i+t.slice(n+1):t.slice(0,r)+t.slice(n+1)}}return t}function s(t){return""+a(o(n(i(t))))}var l=t("superscript-text"),u=t("../constants/string_mappings");e.exports=s},{"../constants/string_mappings":338,"superscript-text":229}],348:[function(t,e,r){"use strict";var n=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var o=t("./coerce");i.valObjects=o.valObjects,i.coerce=o.coerce,i.coerce2=o.coerce2,i.coerceFont=o.coerceFont,i.validate=o.validate;var a=t("./dates");i.dateTime2ms=a.dateTime2ms,i.isDateTime=a.isDateTime,i.ms2DateTime=a.ms2DateTime,i.parseDate=a.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var f=t("./loggers");i.log=f.log,i.warn=f.warn,i.error=f.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var o=0;or?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.randstr=function h(t,e,r){if(r||(r=16),void 0===e&&(e=24),0>=e)return"0";var n,i,o,a=Math.log(Math.pow(2,e))/Math.log(r),s="";for(n=2;a===1/0;n*=2)a=Math.log(Math.pow(2,e/n))/Math.log(r)*n;var l=a-Math.floor(a);for(n=0;n-1||u!==1/0&&u>=Math.pow(2,e)?h(t,e,r):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var r,n,i,o,a=t.length,s=2*a,l=2*e-1,u=new Array(l),c=new Array(a);for(r=0;l>r;r++)u[r]=(1-Math.cos(Math.PI*(r+1)/e))/(2*e);for(r=0;a>r;r++){for(o=0,n=0;l>n;n++)i=r+n+1-e,-a>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=a&&(i=s-1-i),o+=t[i]*u[n];c[r]=o}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var o,a;t.length;)if(a=t.splice(0,1)[0],o=a(e),o&&o.then)return o.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,o=!1,a=!0;for(n=0;ni;i++)e[i][r]=t[i]},i.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,o,a,s=3,l=Object.keys(t);for(n=0;n1?n+o[1]:"";if(i&&(o.length>1||a.length>4))for(;r.test(a);)a=a.replace(r,"$1"+i+"$2");return a+s}},{"./coerce":342,"./dates":343,"./extend":345,"./is_plain_object":349,"./loggers":350,"./matrix":351,"./nested_property":352,"./notifier":353,"./search":356,"./stats":359,d3:100}],349:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],350:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;en;n++)r[n]=new Array(e);return r},r.transposeRagged=function(t){var e,r,n=0,i=t.length;for(e=0;i>e;e++)n=Math.max(n,t[e].length);var o=new Array(n);for(e=0;n>e;e++)for(o[e]=new Array(i),r=0;i>r;r++)o[e][r]=t[r][e];return o},r.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var n,i,o=t.length;if(t[0].length)for(n=new Array(o),i=0;o>i;i++)n[i]=r.dot(t[i],e);else if(e[0].length){var a=r.transposeRagged(e);for(n=new Array(a.length),i=0;ii;i++)n+=t[i]*e[i];return n},r.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},r.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},r.rotationXYMatrix=function(t,e,n){return r.dot(r.dot(r.translationMatrix(e,n),r.rotationMatrix(t)),r.translationMatrix(-e,-n))},r.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var n=1===arguments.length?e[0]:[e[0],e[1]];return r.dot(t,[n[0],n[1],1]).slice(0,2)}},r.apply2DTransform2=function(t){var e=r.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],352:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,o,a,s,l=t;for(a=0;a=0;e--){if(n=t[e],a=!1,Array.isArray(n))for(r=n.length-1;r>=0;r--)u(n[r])?a?n[r]=void 0:n.pop():a=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),a=!1,r=o.length-1;r>=0;r--)u(n[o[r]])&&!i(n[o[r]],o[r])?delete n[o[r]]:a=!0;if(a)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,a,s=0,l=e.split(".");sr||r>o||a>n||n>s?!1:!e||!u(t)}function r(t,e){var r=t[0],l=t[1];if(i>r||r>o||a>l||l>s)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;p>u;u++)if(c=g,f=v,g=n[u][0],v=n[u][1],h=Math.min(c,g),!(h>r||r>Math.max(c,g)||l>Math.max(f,v)))if(l=l&&r!==h&&m++}return m%2===1}var n=t.slice(),i=n[0][0],o=i,a=n[0][1],s=a;n.push(n[0]);for(var l=1;lo;o++)if(a=[t[o][0]-l[0],t[o][1]-l[1]],s=n(a,u),0>s||s>c||Math.abs(n(a,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":351}],355:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},a.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},a.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},a.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;rt}function i(t,e){return e>=t}function o(t,e){return t>e}function a(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?a:o;h>f&&d++<100;)u=Math.floor((f+h)/2),c(e[u],t)?f=u+1:h=u;return d>90&&l.log("Long binary search..."),f-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,o=i/(n||1)/1e4,a=[e[0]],s=0;n>s;s++)e[s+1]>e[s]+o&&(i=Math.min(i,e[s+1]-e[s]),a.push(e[s+1]));return{vals:a,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,o=e.length-1,a=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;o>i&&a++<100;)n=u((i+o)/2),e[n]<=t?i=n+s:o=n-l;return e[i]}},{"../lib":348,"fast-isnumeric":104}],357:[function(t,e,r){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],358:[function(t,e,r){"use strict";var n=t("../components/color"),i=function(){};e.exports=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=i);t.destroy=function(){t.container.parentNode.removeChild(t.container)};var r=document.createElement("div");return r.textContent="Webgl is not supported by your browser - visit http://get.webgl.org for more info",r.style.cursor="pointer",r.style.fontSize="24px",r.style.color=n.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../components/color":267}],359:[function(t,e,r){"use strict";var n=t("fast-isnumeric");r.aggNums=function(t,e,i,o){var a,s;if(o||(o=i.length),n(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(o),a=0;o>a;a++)s[a]=r.aggNums(t,e,i[a]);i=s}for(a=0;o>a;a++)n(e)?n(i[a])&&(e=t(+e,+i[a])):e=i[a];return e},r.len=function(t){return r.aggNums(function(t){return t+1},0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums(function(t,e){return t+e},0,t)/e},r.variance=function(t,e,i){return e||(e=r.len(t)),n(i)||(i=r.mean(t,e)),r.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":104}],360:[function(t,e,r){"use strict";function n(t){return t=i(t),o.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),o=t("arraytools");e.exports=n},{arraytools:37,tinycolor2:239}],361:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+h.randstr([],64),o=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function a(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var o=e[1],a=e[3],s=a.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"
";if("href"!==a.substr(0,4).toLowerCase())return"";var u=a.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,-1===v.indexOf(c.protocol)?"":''}if("br"===n)return"
";if(o)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),i="",a=n.length-1;a>=0;a--){var s=n[a].match(/<(\/?).*>/i);if(s&&"
"!==n[a]){s[1]||(i=n[a]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),o+=2)});var a=e.join(""),u=a.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,o,a=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},o="right"===a?function(){return l.right-n.width}:"center"===a?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:o()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),c=t.appendSVG(a),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),a=u(i),s=t,l=!s.attr("data-notex")&&a.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};o(l[2],i,function(i,o,a){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),o&&o.node()&&l.node().insertBefore(o.node().cloneNode(!0),l.node().firstChild),l.attr({"class":p,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){o(),a.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(a.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=f.select(h.getPlotDiv(a.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":a.style("font-family")||"Arial","font-size":a.style("font-size")||12,color:r.fill||a.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(a.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||a.attr("data-unformatted")).call(c(a,e,r)).on("blur",function(){ -a.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(a.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(a,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(a.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(a,this.textContent)):(s.input.call(a,this.textContent),f.select(this).call(c(a,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var a=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":338,"../constants/xmlns_namespaces":339,"../lib":348,d3:100}],362:[function(t,e,r){"use strict";function n(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function i(t){Array.isArray(t._promises)&&t._promises.length>0&&z.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),N.defaultConfig.setBackground(t,e)}function a(t,e){t._context||(t._context=z.extendFlat({},N.defaultConfig));var r=t._context;e&&(Object.keys(e).forEach(function(t){t in r&&("setBackground"===t&&"opaque"===e[t]?r[t]=o:r[t]=e[t])}),e.plot3dPixelRatio&&!r.plotGlPixelRatio&&(r.plotGlPixelRatio=r.plot3dPixelRatio)),r.staticPlot&&(r.editable=!1,r.autosizable=!1,r.scrollZoom=!1,r.doubleClick=!1,r.showTips=!1,r.showLink=!1,r.displayModeBar=!1)}function s(t,e,r){var n=C.select(t).selectAll(".plot-container").data([0]);n.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=n.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),r&&(t.layout=r),N.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(A(t,{}),t._fullLayout.autosize=r.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=N.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var o=t.framework.svg(),a=1,s=t._fullLayout.title;""!==s&&s||(a=0);var l="Click to enter title",u=function(){this.call(N.util.convertToTspans)},c=o.select(".title-group text").call(u);if(t._context.editable){c.attr({"data-unformatted":s}),s&&s!==l||(a=.2,c.attr({"data-unformatted":l}).text(l).style({opacity:a}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(N.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(u),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(u)})};c.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),j.addLinks(t),Promise.resolve()}function l(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var n=N.Axes.list({_fullLayout:t});for(e=0;ee;e++){var a=t.annotations[e];a.ref&&("paper"===a.ref?(a.xref="paper",a.yref="paper"):"data"===a.ref&&(a.xref="x",a.yref="y"),delete a.ref),u(a,"xref"),u(a,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(z.warn("Shapes must be an array."),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var l=t.shapes[e];u(l,"xref"),u(l,"yref")}var c=t.legend;c&&(c.x>3?(c.x=1.02,c.xanchor="left"):c.x<-2&&(c.x=-.02,c.xanchor="right"),c.y>3?(c.y=1.02,c.yanchor="bottom"):c.y<-2&&(c.y=-.02,c.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=j.getSubplotIds(t,"gl3d");for(e=0;er;++r)b[r]=v[e]+m*y[2+4*r];d.camera={eye:{x:b[0],y:b[1],z:b[2]},center:{x:v[0],y:v[1],z:v[2]},up:{x:y[1],y:y[5],z:y[9]}},delete d.cameraposition}}return F.clean(t),t}function u(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=N.Axes.cleanId(r,n))}function c(t,e){for(var r=[],n=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),i=0;io&&(s=z.randstr(n),-1!==r.indexOf(s));o++);a.uid=z.randstr(n),n.push(a.uid)}if(r.push(a.uid),"histogramy"===a.type&&"xbins"in a&&!("ybins"in a)&&(a.ybins=a.xbins,delete a.xbins),a.error_y&&"opacity"in a.error_y){var l=F.defaults,u=a.error_y.color||(j.traceIs(a,"bar")?F.defaultLine:l[i%l.length]);a.error_y.color=F.addOpacity(F.rgb(u),F.opacity(u)*a.error_y.opacity),delete a.error_y.opacity}if("bardir"in a&&("h"!==a.bardir||!j.traceIs(a,"bar")&&"histogram"!==a.type.substr(0,9)||(a.orientation="h",_(a)),delete a.bardir),"histogramy"===a.type&&_(a),"histogramx"!==a.type&&"histogramy"!==a.type||(a.type="histogram"),"scl"in a&&(a.colorscale=a.scl,delete a.scl),"reversescl"in a&&(a.reversescale=a.reversescl,delete a.reversescl),a.xaxis&&(a.xaxis=N.Axes.cleanId(a.xaxis,"x")),a.yaxis&&(a.yaxis=N.Axes.cleanId(a.yaxis,"y")),j.traceIs(a,"gl3d")&&a.scene&&(a.scene=j.subplotsRegistry.gl3d.cleanId(a.scene)),j.traceIs(a,"pie")||(Array.isArray(a.textposition)?a.textposition=a.textposition.map(f):a.textposition&&(a.textposition=f(a.textposition))),j.traceIs(a,"2dMap")&&("YIGnBu"===a.colorscale&&(a.colorscale="YlGnBu"),"YIOrRd"===a.colorscale&&(a.colorscale="YlOrRd")),j.traceIs(a,"markerColorscale")&&a.marker){var c=a.marker;"YIGnBu"===c.colorscale&&(c.colorscale="YlGnBu"),"YIOrRd"===c.colorscale&&(c.colorscale="YlOrRd")}if("surface"===a.type&&z.isPlainObject(a.contours)){var d=["x","y","z"];for(o=0;on?o.push(i+n):o.push(n);return o}function g(t,e,r){var n,i;for(n=0;n=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||0>i&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function v(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&g(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function m(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&l0){var s=w(t._boundingBoxMargins),l=s.left+s.right,u=s.bottom+s.top,c=o._container.node().getBoundingClientRect(),f=1-2*a.frameMargins;i=Math.round(f*(c.width-l)),n=Math.round(f*(c.height-u))}else r=window.getComputedStyle(t),n=parseFloat(r.height)||o.height,i=parseFloat(r.width)||o.width;return Math.abs(o.width-i)>1||Math.abs(o.height-n)>1?(o.height=t.layout.height=n,o.width=t.layout.width=i):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),j.sanitizeMargins(o),e}function M(t){var e=C.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===r.autosize&&(A(t,{}),r.autosize=!0,t.layout.autosize=!0),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];C.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=z.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0);var o=N.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&k(t,o),r._has("cartesian")&&T(t,o),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.selectAll(".layer-subplot");r._imageSubplotLayer=a.selectAll(".imagelayer"),r._shapeSubplotLayer=a.selectAll(".shapelayer");var s=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=s.append("g").classed("imagelayer",!0),r._shapeUpperLayer=s.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var l=z.syncOrAsync([E,function(){return N.Axes.doTicks(t,"redraw")},D.init],t);return l&&l.then&&t._promises.push(l),l}function k(t,e){function r(e,r){return function(){return N.Axes.getFromId(t,e,r)}}for(var n,i,o=t._fullLayout._plots={},a=0;a0,_=N.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),A=w===_;x?t.framework===M&&!b&&A||(t.framework=M,M(t)):A?b&&M(t):(t.framework=M,M(t)),b&&N.Axes.saveRangeInitial(t);var k=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&d(t);for(var L=0;LW.range[0]?[1,2]:[2,1]);else{var Q=W.range[0],$=W.range[1];"log"===D?(0>=Q&&0>=$&&o(G+".autorange",!0),0>=Q?Q=$/1e6:0>=$&&($=Q/1e6),o(G+".range[0]",Math.log(Q)/Math.LN10),o(G+".range[1]",Math.log($)/Math.LN10)):(o(G+".range[0]",Math.pow(10,Q)),o(G+".range[1]",Math.pow(10,$)))}else o(G+".autorange",!0)}if("reverse"===U)X.range?X.range.reverse():(o(G+".autorange",!0),X.range=[1,0]),Y.autorange?w=!0:_=!0;else if("annotations"===I.parts[0]||"shapes"===I.parts[0]){var K=I.parts[1],J=I.parts[0],tt=g[J]||[],et=N[z.titleCase(J)],rt=tt[K]||{};2===I.parts.length&&("add"===m[P]||z.isPlainObject(m[P])?L[P]="remove":"remove"===m[P]?-1===K?(L[J]=tt,delete L[P]):L[P]=rt:z.log("???",m)),!a(rt,"x")&&!a(rt,"y")||z.containsAny(P,["color","opacity","align","dash"])||(w=!0),et.draw(t,K,I.parts.slice(2).join("."),m[P]),delete m[P]}else if("images"===I.parts[0]){var it=z.objectFromPath(P,D);z.extendDeepAll(t.layout,it),V.supplyLayoutDefaults(t.layout,t._fullLayout),V.draw(t)}else if("mapbox"===I.parts[0]&&"layers"===I.parts[1]){z.extendDeepAll(t.layout,z.objectFromPath(P,D));var ot=(t._fullLayout.mapbox||{}).layers||[];for(R=I.parts[2]+1-ot.length,p=0;R>p;p++)ot.push({});_=!0}else if("updatemenus"===I.parts[0]){z.extendDeepAll(t.layout,z.objectFromPath(P,D));var at=t._fullLayout.updatemenus||[];for(R=I.parts[2]+1-at.length,p=0;R>p;p++)at.push({});_=!0}else 0===I.parts[0].indexOf("scene")?_=!0:0===I.parts[0].indexOf("geo")?_=!0:0===I.parts[0].indexOf("ternary")?_=!0:!v._has("gl2d")||-1===P.indexOf("axis")&&"plot_bgcolor"!==I.parts[0]?"hiddenlabels"===P?w=!0:-1!==I.parts[0].indexOf("legend")?y=!0:-1!==P.indexOf("title")?b=!0:-1!==I.parts[0].indexOf("bgcolor")?x=!0:I.parts.length>1&&z.containsAny(I.parts[1],["tick","exponent","grid","zeroline"])?b=!0:-1!==P.indexOf(".linewidth")&&-1!==P.indexOf("axis")?b=x=!0:I.parts.length>1&&-1!==I.parts[1].indexOf("line")?x=!0:I.parts.length>1&&"mirror"===I.parts[1]?b=x=!0:"margin.pad"===P?b=x=!0:"margin"===I.parts[0]||"autorange"===I.parts[1]||"rangemode"===I.parts[1]||"type"===I.parts[1]||"domain"===I.parts[1]||P.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(P)?M=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(P)&&(_=!0):_=!0,I.set(D)}O.add(t,nt,[t,L],nt,[t,T]),m.autosize&&(m=A(t,m)),(m.height||m.width||m.autosize)&&(w=!0);var st=Object.keys(m),lt=[j.previousPromises];if(_||w)lt.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),N.plot(t,"",g)});else if(st.length&&(j.supplyDefaults(t),v=t._fullLayout,y&<.push(function(){return q.draw(t),j.previousPromises(t)}),x&<.push(E),b&<.push(function(){return N.Axes.doTicks(t,"redraw"),S(t),j.previousPromises(t)}),M)){var ut;for(Z(t),N.Fx.supplyLayoutDefaults(t.layout,v,t._fullData),N.Fx.init(t),ut=j.getSubplotIds(v,"gl3d"),p=0;p1)};u(r.width)&&u(r.height)||s(new Error("Height and width should be pixel values."));var c=n.clone(e,{format:"png",height:r.height,width:r.width}),f=c.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var h=n.getRedrawFunc(f);o.plot(f,c.data,c.layout,c.config).then(h).then(l).then(function(e){t(e)}).catch(function(t){s(t)})});return s}var i=t("fast-isnumeric"),o=t("../plotly"),a=t("../lib");e.exports=n},{"../lib":348,"../plotly":368,"../snapshot":414,"fast-isnumeric":104}],367:[function(t,e,r){"use strict";function n(t,e,r,i,o,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(a("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;v>m;m++){var y=r[m],b=["data",m];if(p(y)){var x=c[m],_=x.type,w=s.traces[_].attributes;w.type={valType:"enumerated",values:[_]},x.visible===!1&&y.visible!==!1&&l.push(a("invisible",b)),n(y,x,w,l,b);var A=y.transforms,M=x.transforms;if(A){g(A)||l.push(a("array",b,["transforms"])),b.push("transforms");for(var k=0;ku&&c>e&&(void 0===i[r]?o[f]=T.tickText(t,e):o[f]=s(t,e,String(i[r])),f++);return f=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{b(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function a(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,o))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,o=e.x,s=t._tickround,l=new Date(o),u="";r&&t.hoverformat?i=a(t.hoverformat,o):t.tickformat?i=a(t.tickformat,o):(n&&(b(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=I(l):"m"===s?i=O(l):(o!==t._tmin||r||(u="
"+I(l)),"d"===s?i=j(l):"H"===s?i=D(l):(o!==t._tmin||r||(u="
"+j(l)+", "+I(l)),i=F(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=h(m(o/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var o=t.dtick,a=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=h(Math.pow(10,a),t,i,n);else if(b(o)||"D"===o.charAt(0)&&m(a+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(a);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,a),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,m(a,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>a?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=0>t,a=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat;if(n){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(c),a=(Number(c._tickround)||0)+4,l=c._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-a)/2;if("none"===s&&(l=0),t=Math.abs(t),f>t)t="0",i=!1;else{if(t+=f,l&&(t*=Math.pow(10,-l),a+=l),0===a)t=String(Math.floor(t));else if(0>a){t=String(Math.round(t)),t=t.substr(0,t.length+a);for(var h=a;0>h;h++)t+="0"}else{t=String(t);var d=t.indexOf(".")+1;d&&(t=t.substr(0,d+a).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(l&&"hide"!==s){var p;p=0>l?"\u2212"+-l:"power"!==s?"+"+l:String(l),"e"===s||("SI"===s||"B"===s)&&(l>12||-15>l)?t+="e"+p:"E"===s?t+="E"+p:"power"===s?t+="\xd710"+p+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=a,u=s,h=f/c);if(n===i){var p=n-1,g=n+1;r="tozero"===t.rangemode?0>n?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,i=0;ip&&(p=g/10),u=t.c2l(p),c=t.c2l(g),y&&(u=Math.min(0,u),c=Math.max(0,c)),n(u)){for(d=!0,a=0;a=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(a,1),a--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,a=0;a=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(a,1),a--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,a,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(o=0;6>o;o++)i(o);for(o=v-1;o>5;o--)i(o)}},T.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),a=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:a+.5,size:1};var s;if(r)s=(a-o)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,a]};T.autoTicks(f,s);var h,d=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;yg&&(p>.3*x||i(o)||i(a))){var w=f.dtick/2;d+=o>d+w?w:-w}var A=1+Math.floor((a-d)/f.dtick);h=d+A*f.dtick}else for(h=d;a>=h;)h=T.tickIncrement(h,f.dtick);return{start:d,end:h,size:f.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return n(t);if("auto"===t.tickmode||!t.dtick){var e,r=t.nticks;r||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/e):(e="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var i=t.range[1]=s:s>=l)&&(a.push(l),!(a.length>1e3));l=T.tickIncrement(l,t.dtick,i));t._tmax=a[a.length-1];for(var u=new Array(a.length),c=0;c157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,S)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,C)):e>432e5?(t.dtick=i(e,864e5,R),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,C):e>3e4?t.dtick=i(e,6e4,P):e>500?t.dtick=i(e,1e3,P):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),o=n*Number(e.substr(1));if("M"===i){ -var a=new Date(t);return a.setMonth(a.getMonth()+o)}if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===i){var s="D2"===e?z:N,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]n:n>u;)u=T.tickIncrement(u,i,e);return u}if("L"===c)return Math.log(r((Math.pow(10,n)-o)/f)*f+o)/Math.LN10;if("D"===c){var h="D2"===i?z:N,d=_.roundUp(m(n,1),h,e);return Math.floor(n)+Math.log(y.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var I=y.time.format("%Y"),O=y.time.format("%b %Y"),j=y.time.format("%b %-d"),D=y.time.format("%b %-d %Hh"),F=y.time.format("%H:%M"),B=y.time.format(":%S"),U=/%(\d?)f/g;T.tickText=function(t,e,r){function n(n){var i;return void 0===n?!0:r?"none"===n:(i={first:t._tmin,last:t._tmax}[n],"all"!==n&&e!==i)}var i,o,a=s(t,e),h="array"===t.tickmode,d=r||h;if(h&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&er&&(M=90),i(c,M)}u._lastangle=M}return a(e),e+" done"}function l(){u._boundingBox=r.node().getBoundingClientRect()}var c=r.selectAll("g."+C).data(L,S);if(!u.showticklabels||!b(n))return c.remove(),void a(e);var f,h,p,m,x;"x"===v?(x="bottom"===B?1:-1,f=function(t){return t.dx+I*x},m=n+(z+N)*x,h=function(t){return t.dy+m+t.fontSize*("bottom"===B?1:-.5)},p=function(t){return b(t)&&0!==t&&180!==t?0>t*x?"end":"start":"middle"}):(x="right"===B?1:-1,h=function(t){return t.dy+t.fontSize/2-I*x},f=function(t){return t.dx+n+(z+N+(90===Math.abs(u.tickangle)?t.fontSize/2:0))*x},p=function(t){return b(t)&&90===Math.abs(t)?"middle":"right"===B?"start":"end"});var A=0,M=0,T=[];c.enter().append("g").classed(C,1).append("text").attr("text-anchor","middle").each(function(e){var r=y.select(this),n=t._promises.length;r.call(k.setPosition,f(e),h(e)).call(k.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),n=t._promises[n],n?T.push(t._promises.pop().then(function(){i(r,u.tickangle)})):i(r,u.tickangle)}),c.exit().remove(),c.each(function(t){A=Math.max(A,t.fontSize)}),i(c,u._lastangle||u.tickangle);var E=_.syncOrAsync([o,s,l]);return E&&E.then&&t._promises.push(E),E}function a(e){if(!r){var n,i,o,a,s=E.getFromId(t,e),l=y.select(t).selectAll("g."+e+"tick"),u={selection:l,side:s.side},f=e.charAt(0),h=t._fullLayout._size,d=1.5,p=s.titlefont.size;if(l.size()){var g=y.select(l.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);g&&(u.offsetLeft=+g[1],u.offsetTop=+g[2])}"x"===f?(i="free"===s.anchor?{_offset:h.t+(1-(s.position||0))*h.h,_length:0}:E.getFromId(t,s.anchor),o=s._offset+s._length/2,a=i._offset+("top"===s.side?-10-p*(d+(s.showticklabels?1:0)):i._length+10+p*(d+(s.showticklabels?1.5:.5))),s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(a+=(c.height-c.margin.b-c.margin.t)*s.rangeslider.thickness+s._boundingBox.height),u.side||(u.side="bottom")):(i="free"===s.anchor?{_offset:h.l+(s.position||0)*h.w,_length:0}:E.getFromId(t,s.anchor),a=s._offset+s._length/2,o=i._offset+("right"===s.side?i._length+10+p*(d+(s.showticklabels?1:.5)):-10-p*(d+(s.showticklabels?.5:0))),n={rotate:"-90",offset:0},u.side||(u.side="left")),A.draw(t,e+"title",{propContainer:s,propName:s._name+".title",dfltName:f.toUpperCase()+" axis",avoid:u,transform:n,attributes:{x:o,y:a,"text-anchor":"middle"}})}}function s(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:x.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[v]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===v}function l(e,r,i){var o=e.gridlayer,a=e.zerolinelayer,l=e["hidegrid"+v]?[]:V,c=u._gridpath||"M0,0"+("x"===v?"v":"h")+r._length,f=o.selectAll("path."+P).data(u.showgrid===!1?[]:l,S);if(f.enter().append("path").classed(P,1).classed("crisp",1).attr("d",c).each(function(t){u.zeroline&&("linear"===u.type||"-"===u.type)&&Math.abs(t.x)g;g++){var y=u.mirrors[a._id+h[g]];"ticks"!==y&&"labels"!==y||(f[g]=!0)}return void 0!==n[2]&&(f[2]=!0),f.forEach(function(t,e){var r=n[e],i=U[e];t&&b(r)&&(d+=p(r+N*i,i*u.ticklen))}),i(r,d),l(e,a,t),o(r,n[3])}}).filter(function(t){return t&&t.then});return H.length?Promise.all(H):0},T.swap=function(t,e){for(var r=d(t,e),n=0;n2*n}function c(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,o=0;o2*n}var f=t("fast-isnumeric"),h=t("tinycolor2").mix,d=t("../../lib"),p=t("../plots"),g=t("../../components/color/attributes").lightFraction,v=t("./layout_attributes"),m=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),b=t("./tick_label_defaults"),x=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),A=t("./clean_datum"),M=t("./axis_ids");e.exports=function(t,e,r,i){function o(r,n){return d.coerce2(t,e,v,r,n)}var a=i.letter,s=i.font||{},l="Click to enter "+(i.title||a.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=M.name2id(i.name));var u=r("type");"-"===u&&(n(e,i.data),"-"===e.type?e.type="linear":u=t.type=e.type),_(e);var c=r("color"),p=c===t.color?c:s.color;r("title",l),d.coerceFont(r,"titlefont",{family:s.family,size:Math.round(1.2*s.size),color:p});var A=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),k=r("autorange",!A);k&&r("rangemode");var T=r("range",[-1,"x"===a?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),d.noneOrAll(t.range,e.range,[0,1]),r("fixedrange"),m(t,e,r,u),b(t,e,r,u,i),y(t,e,r,i),x(t,e,r);var E=o("linecolor",c),L=o("linewidth"),S=r("showline",!!E||!!L);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&r("mirror");var C=o("gridcolor",h(c,i.bgColor,g).toRgbString()),P=o("gridwidth"),R=r("showgrid",i.showGrid||!!C||!!P);R||(delete e.gridcolor,delete e.gridwidth);var N=o("zerolinecolor",c),z=o("zerolinewidth"),I=r("zeroline",i.showGrid||!!N||!!z);return I||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===u?w(a,e.categoryorder,e.categoryarray,i.data):[],e}},{"../../components/color/attributes":266,"../../lib":348,"../plots":404,"./axis_ids":373,"./category_order_defaults":374,"./clean_datum":375,"./layout_attributes":380,"./ordered_categories":382,"./set_convert":385,"./tick_label_defaults":386,"./tick_mark_defaults":387,"./tick_value_defaults":388,"fast-isnumeric":104,tinycolor2:239}],373:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,o=[],a=0;a0;o&&(n="array");var a=r("categoryorder",n);"array"===a&&r("categoryarray"),o||"array"!==a||(e.categoryorder="trace")}}},{}],375:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":348,"fast-isnumeric":104}],376:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],377:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?c.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function a(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/setcursor"),g=t("../../components/dragelement"),v=t("./axes"),m=t("./select"),y=t("./constants"),b=!0;e.exports=function(t,e,r,s,x,_,w,A){function M(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+gt+")").attr("d",lt+"Z"),ht=dt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+gt+")").attr("d","M0,0Z"),E();for(var o=0;oi?(ct="",at.r=at.l,at.t=at.b,ht.attr("d","M0,0Z")):(at.t=0,at.b=q,ct="x",ht.attr("d","M"+(at.l-.5)+","+(ot-G-.5)+"h-3v"+(2*G+1)+"h3ZM"+(at.r+.5)+","+(ot-G-.5)+"h3v"+(2*G+1)+"h-3Z")):!$||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,r){var n,i,o;for(n=0;nzoom back out","long"),b=!1)))}function P(e,r){var i=1===(w+A).length;if(e)O();else if(2!==r||i){if(1===r&&i){var o=w?U[0]:B[0],a="s"===w||"w"===A?0:1,s=o._name+".range["+a+"]",l=n(o,a),c="left",h="middle";if(o.fixedrange)return;w?(h="n"===w?"top":"bottom","right"===o.side&&(c="right")):"e"===A&&(c="right"),et.call(f.makeEditable,null,{immediate:!0,background:D.paper_bgcolor,text:String(l),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var r="category"===o.type?o.c2l(e):o.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else I()}function R(e){function r(t,e,r){if(!t.fixedrange){k(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||D._enablescrollzoom){var n=t.querySelector(".plotly");if(!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(mt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void c.log("Did not find wheel motion attributes: ",e);var o,a=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=vt[0]+vt[2]*l,f=(s.bottom-e.clientY)/s.height,h=vt[1]+vt[3]*(1-f);if(A){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function i(t,e,r){for(var i=1-e,o=0,a=0;a0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nT;T++){var E=o[T],L=d[E];if(L)M[T]=w.getFromId(t,L.xaxis._id),k[T]=w.getFromId(t,L.yaxis._id);else{var S=a[E]._subplot;M[T]=S.xaxis,k[T]=S.yaxis}}var C=e.hovermode||a.hovermode;if(-1===["x","y","closest"].indexOf(C)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var P,R,N,z,I,O,j,D,F,B,U,V,q=[],H=[];if(Array.isArray(e))for(C="array",N=0;NG||G>Y.width||0>X||X>Y.height)return _.unhoverRaw(t,e)}else G="xpx"in e?e.xpx:M[0]._length/2,X="ypx"in e?e.ypx:k[0]._length/2;if(P="xval"in e?n(o,e.xval):i(M,G),R="yval"in e?n(o,e.yval):i(k,X),!g(P[0])||!g(R[0]))return v.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(z=0;z1||-1!==O.hoverinfo.indexOf("name")?O.name:void 0,index:!1,distance:Math.min(W,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},V=q.length,"array"===D){var Z=e[z];"pointNumber"in Z?(U.index=Z.pointNumber,D="closest"):(D="","xval"in Z&&(F=Z.xval,D="x"),"yval"in Z&&(B=Z.yval,D=D?"closest":"y"))}else F=P[j],B=R[j];if(O._module&&O._module.hoverPoints){var Q=O._module.hoverPoints(U,F,B,D);if(Q)for(var $,K=0;KV&&(q.splice(0,V),W=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var J="y"===C&&H.length>1;q.sort(function(t,e){return t.distance-e.distance});var tt=b.combine(a.plot_bgcolor||b.background,a.paper_bgcolor),et={hovermode:C,rotateLabels:J,bgColor:tt,container:a._hoverlayer,outerContainer:a._paperdiv},rt=u(q,et);c(q,J?"xa":"ya"),f(rt,J);var nt=t._hoverdata,it=[];for(N=0;N128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*R):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,E=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),N=Math.abs(t.y1-t.y0),z=E.width+P+R+v;t.ty0=_-E.top,t.bx=E.width+2*R,t.by=E.height+2*R,t.anchor="start",t.txwidth=E.width,t.tx2width=v,t.offset=0,o?(t.pos=L,m=M>=S+N/2+z,A=S-N/2-z>=0,"top"!==t.idealAlign&&m||!A?m?(S+=N/2,t.anchor="start"):t.anchor="middle":(S-=N/2,t.anchor="end")):(t.pos=S,m=w>=L+C/2+z,A=L-C/2-z>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(o?"rotate("+T+")":""))}),S}function c(t,e){function r(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(.01>o)){if(-.01>i){for(s=t.length-1;s>=0;s--)t[s].dp-=o;n=!1}if(n){var u=0;for(a=0;ae.pmax&&u++;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos>e.pmax-1&&(l.del=!0,u--);for(a=0;a=u);a++)if(l=t[a],l.pos=0;s--)t[s].dp-=o;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,o,a,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?L:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,a=0;a.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(a+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(o=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=o;n=!1}else a++}f.forEach(r)}for(a=f.length-1;a>=0;a--){var v=f[a];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],a=o*(P+R),s=a+o*(t.txwidth+R),l=0,u=t.offset;"middle"===t.anchor&&(a-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*S),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*P+l)+","+(P+u)+"v"+(t.by/2-P)+"h"+n*t.bx+"v-"+t.by+"H"+(n*P+l)+"V"+(u-P)+"Z"),i.call(x.setPosition,a+l,u+t.ty0-t.by/2+R).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+o*R+l,u+t.ty0-t.by/2+R),r.select("rect").call(x.setRect,s+(o-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],o=t._hoverdata[n];if(i.curveNumber!==o.curveNumber||String(i.pointNumber)!==String(o.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),M=t("./dragbox"),k=e.exports={};k.unhover=_.unhover,k.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},k.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,k.layoutAttributes,r,n)}n("dragmode");var i;if(e._has("cartesian")){var o=e._isHoriz=k.isHoriz(r);i=o?"y":"x"}else i="closest";n("hovermode",i)},k.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(a(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){a(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},k.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},k.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indext*e||0===t?A.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":267,"../../components/dragelement":288,"../../components/drawing":290,"../../lib":348,"../../lib/events":344,"../../lib/svg_text_utils":361,"./axes":371,"./constants":376,"./dragbox":377,d3:100,"fast-isnumeric":104,tinycolor2:239}],379:[function(t,e,r){"use strict";var n=t("../plots"),i=t("./constants");r.name="cartesian",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex=i.idRegex,r.attrRegex=i.attrRegex,r.attributes=t("./attributes"),r.plot=function(t){function e(t,e){for(var r=[],n=0;nf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":348,"fast-isnumeric":104}],384:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),o=t("../../components/color"),a=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.x()._offset,y=i.plotinfo.y()._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,M=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,P,R,N,z,I=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),O=[],j=i.gd,D=[];for(C=0;C0)return Math.log(e)/Math.LN10;if(0>=e&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*c*Math.abs(n-i))}return a.BADNUM}function r(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):a.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?r:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var n=l.getFromId(t._gd,t.overlaying);t.domain=n.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)i(t.range[e])||(t.range[e]=i(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):a.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):a.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?o.ms2DateTime(t):a.BADNUM},t.d2c=function(t){return i(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!i(t.range[0])&&i(f[0])&&(t.range[0]=f[0]),!i(t.range[1])&&i(f[1])&&(t.range[1]=f[1])}catch(h){o.error(h,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var r=t._categories.indexOf(e);return-1===r?a.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,o;if(r in e)for(n=e[r],i=new Array(n.length),o=0;oh;++h)a=a&&l[h]===s[h],l[h]=s[h];var d=t.clientWidth===c&&t.clientHeight===f;return c=t.clientWidth,f=t.clientHeight,a?!d:(u=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(h,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){var e=n.computedUp.slice(),r=n.computedEye.slice(),o=n.computedCenter.slice();if(n.setMode(t),"turntable"===t){var a=i();n._active.lookAt(a,r,o,e),n._active.lookAt(a+500,r,o,[0,0,1]),n._active.flush(a)}return n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return u},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var d=0,p=0;return a(t,function(e,r,o,a){var s="rotate"===h.keyBindingMode,l="pan"===h.keyBindingMode,c="zoom"===h.keyBindingMode,f=!!a.control,g=!!a.alt,v=!!a.shift,m=!!(1&e),y=!!(2&e),b=!!(4&e),x=1/t.clientHeight,_=x*(r-d),w=x*(o-p),A=h.flipX?1:-1,M=h.flipY?1:-1,k=i(),T=Math.PI*h.rotateSpeed;if((s&&m&&!f&&!g&&!v||m&&!f&&!g&&v)&&n.rotate(k,A*T*_,-M*T*w,0),(l&&m&&!f&&!g&&!v||y||m&&f&&!g&&!v)&&n.pan(k,-h.translateSpeed*_*u,h.translateSpeed*w*u,0),c&&m&&!f&&!g&&!v||b||m&&!f&&g&&!v){var E=-h.zoomSpeed*w/window.innerHeight*(k-n.lastT())*100;n.pan(k,0,0,u*(Math.exp(E)-1))}return d=r,p=o,!0}),s(t,function(t,e){var r=h.flipX?1:-1,o=h.flipY?1:-1,a=i();if(Math.abs(t)>Math.abs(e))n.rotate(a,0,0,-t*r*Math.PI*h.rotateSpeed/window.innerWidth);else{var s=-h.zoomSpeed*o*e/window.innerHeight*(a-n.lastT())/100;n.pan(a,0,0,u*(Math.exp(s)-1))}},!0),h}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":27,"mouse-change":207,"mouse-wheel":211,"right-now":221}],391:[function(t,e,r){"use strict";function n(t,e){for(var r=0;3>r;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),o=t("../plots"),a=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,a=o.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sh;h++)l=t[h],c[h]=e+l[0]*(r-e),f[h]=i(l[1]).toRgb();var d=n.scale.linear().domain(c).interpolate(n.interpolateObject).range(f);return function(t){if(o(t)){var n=a.constrain(t,e,r),l=d(n);return i(l).toRgbString()}return i(t).isValid()?t:s.defaultLine}}},{"../../lib":348,"../color":267,d3:100,"fast-isnumeric":104,tinycolor2:239}],285:[function(t,e,r){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],286:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){var o=(t-r)/(n-r),a=o+e/(n-r),s=(o+a)/2;return"left"===i||"bottom"===i?o:"center"===i||"middle"===i?s:"right"===i||"top"===i?a:2/3-s>o?o:a>4/3-s?a:s}},{}],287:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,o){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":348}],288:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),a=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,a.pauseEvent(e)}var u,c,f,h,d,p,g=a.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":348,"../../plotly":368,"../../plots/cartesian/constants":376,"./align":286,"./cursor":287,"./unhover":289}],289:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":344}],290:[function(t,e,r){"use strict";function n(t,e,r,n){var o=t[0]-e[0],a=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(o*o+a*a,x/2),c=Math.pow(s*s+l*l,x/2),f=(c*c*o-u*u*s)*n,h=(c*c*a-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[i.round(e[0]+(d&&f/d),2),i.round(e[1]+(d&&h/d),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&h/p),2)]]}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../plots/plots"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),d=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},p.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},p.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},p.setRect=function(t,e,r,n,i){t.call(p.setPosition,e,r).call(p.setSize,n,i)},p.translatePoints=function(t,e,r){t.each(function(t){var n=t.xp||e.c2p(t.x),a=t.yp||r.c2p(t.y),s=i.select(this);o(n)&&o(a)?"text"===this.nodeName?s.attr("x",n).attr("y",a):s.attr("transform","translate("+n+","+a+")"):s.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):r||0},p.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},a=e||o.width||0,l=n||o.dash||"";i.select(this).call(s.stroke,r||o.color).call(p.dashLine,l,a)})},p.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(n){u.error(n,t),r.remove()}})};var g=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=p.symbolNames.length,m="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=r.line;if(a.traceIs(e,"symbols")){var o=d(e);t.attr("d",function(t){var n;n="various"===t.ms||"various"===r.size?3:h.isBubble(e)?o(t.ms):(r.size||6)/2,t.mrc=n;var i=p.symbolNumber(t.mx||r.symbol)||0,a=i%100;return t.om=i%200>=100,p.symbolFuncs[a](n)+(i>=200?m:"")}).style("opacity",function(t){return(t.mo+1||r.opacity+1)-1})}var l=(e._input||{}).marker||{},u=p.tryColorscale(r,l,""),c=p.tryColorscale(r,l,"line.");t.each(function(t){var e,o,a;t.so?(a=n.outlierwidth,o=n.outliercolor,e=r.outliercolor):(a=(t.mlw+1||n.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(n.color)?s.defaultLine:n.color,e="mc"in t?t.mcc=u(t.mc):Array.isArray(r.color)?s.defaultLine:r.color||"rgba(0,0,0,0)");var l=i.select(this);t.om?l.call(s.stroke,e).style({"stroke-width":(a||1)+"px",fill:"none"}):(l.style("stroke-width",a+"px").call(s.fill,e),a&&l.call(s.stroke,o))})}},p.tryColorscale=function(t,e,r){var n=u.nestedProperty(t,r+"color").get(),i=u.nestedProperty(t,r+"colorscale").get(),a=u.nestedProperty(t,r+"cauto").get(),s=u.nestedProperty(t,r+"cmin"),c=u.nestedProperty(t,r+"cmax"),f=s.get(),h=c.get();return i&&Array.isArray(n)?(!a&&o(f)&&o(h)||(f=1/0,h=-(1/0),n.forEach(function(t){o(t)&&(f>t&&(f=+t),t>h&&(h=+t))}),f>h&&(f=0,h=1),s.set(f),c.set(h),u.nestedProperty(e,r+"cmin").set(f),u.nestedProperty(e,r+"cmax").set(h)),l.makeScaleFunction(i,f,h)):u.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;p.textPointStyle=function(t,e){t.each(function(t){var r=i.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,s=-1!==a.indexOf("top")?"top":-1!==a.indexOf("bottom")?"bottom":"middle",l=-1!==a.indexOf("left")?"end":-1!==a.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(p.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(c.convertToTspans);var h=i.select(this.parentNode),d=r.selectAll("tspan.line"),g=((d[0].length||1)-1)*b+1,v=y[l]*f,m=.75*u+y[s]*f+(y[s]-1)*g*u/2;h.attr("transform","translate("+v+","+m+")"),g>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var x=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,i="M"+t[0],o=[];for(r=1;rr;r++)a.push(n(t[r-1],t[r],t[r+1],e));for(a.push(n(t[o-1],t[o],t[0],e)),r=1;o>=r;r++)i+="C"+a[r-1][1]+" "+a[r][0]+" "+t[r];return i+="C"+a[o][1]+" "+a[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+i.round(e[0],2)+"V"+i.round(e[1],2)},vh:function(t,e){return"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},hvh:function(t,e){return"H"+i.round((t[0]+e[0])/2,2)+"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},vhv:function(t,e){return"V"+i.round((t[1]+e[1])/2,2)+"H"+i.round(e[0],2)+"V"+i.round(e[1],2)}},w=function(t,e){return"L"+i.round(e[0],2)+","+i.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var r="M"+i.round(t[0][0],2)+","+i.round(t[0][1],2),n=1;n=M&&(i.selectAll("[data-bb]").attr("data-bb",null),A=[]),t.setAttribute("data-bb",A.length),A.push(l),u.extendFlat({},l)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":339,"../../lib":348,"../../lib/svg_text_utils":361,"../../plots/plots":404,"../../traces/scatter/make_bubble_size_func":439,"../../traces/scatter/subtypes":444,"../color":267,"../colorscale":281,"./symbol_defs":291,d3:100,"fast-isnumeric":104}],291:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,o="l-"+e+",-"+e,a="l-"+e+","+e;return"M0,"+e+r+i+o+i+o+a+o+a+r+a+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),o=n.round(t*-.309,2),a=n.round(.809*t,2);return"M"+e+","+o+"L"+r+","+a+"H-"+r+"L-"+e+","+o+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),o=n.round(.363*e,2),a=n.round(.588*e,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+o+","+u+"L"+a+","+c+"L0,"+f+"L-"+a+","+c+"L-"+o+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+r+a+e+","+r+a+"0,-"+i+a+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+r+a+"-"+e+",-"+r+a+"0,"+i+a+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:100}],292:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],293:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},l=o.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(o),f=0;fs;s++)a[s]={x:r[s],y:i[s]};return a[0].trace=t,n.calc({calcdata:[a],_fullLayout:e}),a},n.plot=t("./plot"),n.style=t("./style"),n.hoverInfo=function(t,e,r){(e.error_y||{}).visible&&(r.yerr=t.yh-t.y,e.error_y.symmetric||(r.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(r.xerr=t.xh-t.x,e.error_x.symmetric||(r.xerrneg=t.x-t.xs))}},{"./attributes":292,"./calc":293,"./defaults":295,"./plot":297,"./style":298}],297:[function(t,e,r){"use strict";function n(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};return void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),o(n.ys)||(n.noYS=!0,n.ys=r.c2p(t.ys,!0))),void 0!==t.xh&&(n.xh=e.c2p(t.xh),n.xs=e.c2p(t.xs),o(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0))),n}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../lib"),s=t("../../traces/scatter/subtypes");e.exports=function(t,e){var r=e.x(),l=e.y();t.each(function(t){var e=t[0].trace,u=e.error_x||{},c=e.error_y||{},f=s.hasMarkers(e)&&e.marker.maxdisplayed>0;if(c.visible||u.visible){var h=i.select(this).selectAll("g.errorbar").data(a.identity);h.enter().append("g").classed("errorbar",!0),h.each(function(t){var e=i.select(this),a=n(t,r,l);if(!f||t.vis){var s;if(c.visible&&o(a.x)&&o(a.yh)&&o(a.ys)){var h=c.width;s="M"+(a.x-h)+","+a.yh+"h"+2*h+"m-"+h+",0V"+a.ys,a.noYS||(s+="m-"+h+",0h"+2*h),e.append("path").classed("yerror",!0).attr("d",s)}if(u.visible&&o(a.y)&&o(a.xh)&&o(a.xs)){var d=(u.copy_ystyle?c:u).width;s="M"+a.xh+","+(a.y-d)+"v"+2*d+"m0,-"+d+"H"+a.xs,a.noXS||(s+="m0,-"+d+"v"+2*d),e.append("path").classed("xerror",!0).attr("d",s)}}})}})}},{"../../lib":348,"../../traces/scatter/subtypes":444,d3:100,"fast-isnumeric":104}],298:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},a=n.select(this);a.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),o.copy_ystyle&&(o=r),a.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(i.stroke,o.color)})}},{"../color":267,d3:100}],299:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":376}],300:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;2>s;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],o=0;o=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],304:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":345,"../../plots/font_attributes":389,"../color/attributes":266}],305:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],306:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/plots"),o=t("./attributes"),a=t("./helpers");e.exports=function(t,e,r){function s(t,e){return n.coerce(h,d,o,t,e)}for(var l,u,c,f,h=t.legend||{},d=e.legend={},p=0,g="normal",v=0;v1);if(y!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),n.coerceFont(s,"font",e.font),s("orientation"),"h"===d.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(l=0,c="left",u=1.1,f="bottom"):(l=0,c="left",u=-.1,f="top")}s("traceorder",g),a.isGrouped(e.legend)&&s("tracegroupgap"), +s("x",l),s("xanchor",c),s("y",u),s("yanchor",f),n.noneOrAll(h,d,["x","y"])}}},{"../../lib":348,"../../plots/plots":404,"./attributes":304,"./helpers":309}],307:[function(t,e,r){"use strict";function n(t,e){function r(r){c.util.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=h.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,i.legend.font).text(u),e._context.editable&&!s?f.call(c.util.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" "),c.restyle(e,"name",t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,o=t.data()[0][0],a=e._fullData,s=o.trace,l=s.legendgroup,u=[];if(h.traceIs(s,"pie")){var f=o.label,d=r.indexOf(f);-1===d?r.push(f):r.splice(d,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),d=h[0].length||1;r=l*d,n=c.node()&&p.bBox(c.node()).width;var g=l*(.3+(1-d)/2);c.attr("y",g),h.attr("y",g)}r=Math.max(r,16)+3,o.attr({x:0,y:-r/2,height:r}),i.height=r,i.width=n}function a(t,e,r){var n=t._fullLayout,i=n.legend,o=i.borderwidth,a=b.isGrouped(i);if(b.isVertical(i))a&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,o,5+o+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*o,i.height+=10+2*o,a&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),r.selectAll(".legendtoggle").attr("width",(t._context.editable?0:i.width)+40),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height);else if(a){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;h>c;c++){var d=l[c].map(function(t){return t[0].width}),p=40+Math.max.apply(null,d);i.width+=i.tracegroupgap+p,s.push(i.width)}e.each(function(t,e){f.setTranslate(this,s[e],0)}),e.each(function(){var t=u.select(this),e=t.selectAll("g.traces"),r=0;e.each(function(t){var e=t[0],n=e.height;f.setTranslate(this,0,5+o+r+n/2),r+=n}),i.height=Math.max(i.height,r)}),i.height+=10+2*o,i.width+=2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}else{i.width=0,i.height=0;var g=0,v=0,m=0,y=0;r.each(function(t){m=Math.max(40+t[0].width,m)}),r.each(function(t){var e=t[0],r=m,a=i.tracegroupgap||5;o+y+a+r>n.width-(n.margin.r+n.margin.l)&&(y=0,g+=v,i.height=i.height+v,v=0),f.setTranslate(this,o+y,5+o+e.height/2+g),i.width+=a+r,i.height=Math.max(i.height,e.height),y+=a+r,v=Math.max(e.height,v)}),i.width+=2*o,i.height+=10+2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}}function s(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center");var i="top";x.isBottomAnchor(r)?i="bottom":x.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../dragelement"),p=t("../drawing"),g=t("../color"),v=t("./constants"),m=t("./get_legend_data"),y=t("./style"),b=t("./helpers"),x=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),E.call(p.setRect,D,t,v.scrollBarWidth,v.scrollBarHeight),M.select("rect").attr({y:b.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var b=r.legend,_=r.showlegend&&m(t.calcdata,b),w=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void h.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({"class":"legend","pointer-events":"all"});var M=r._topdefs.selectAll("#"+o).data([0]);M.enter().append("clipPath").attr("id",o).append("rect");var k=A.selectAll("rect.bg").data([0]);k.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),k.call(g.stroke,b.bordercolor),k.call(g.fill,b.bgcolor),k.style("stroke-width",b.borderwidth+"px");var T=A.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var E=A.selectAll("rect.scrollbar").data([0]);E.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var L=T.selectAll("g.groups").data(_);L.enter().append("g").attr("class","groups"),L.exit().remove();var S=L.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var C=0!==A.enter().size();C&&(a(t,L,S),s(t));var P=0,R=r.width,N=0,z=r.height;a(t,L,S),b.height>z?l(t):s(t);var I=r._size,O=I.l+I.w*b.x,j=I.t+I.h*(1-b.y);x.isRightAnchor(b)?O-=b.width:x.isCenterAnchor(b)&&(O-=b.width/2),x.isBottomAnchor(b)?j-=b.height:x.isMiddleAnchor(b)&&(j-=b.height/2);var D=b.width,F=I.w;D>F?(O=I.l,D=F):(O+D>R&&(O=R-D),P>O&&(O=P),D=Math.min(R-O,b.width));var B=b.height,U=I.h;B>U?(j=I.t,B=U):(j+B>z&&(j=z-B),N>j&&(j=N),B=Math.min(z-j,b.height)),f.setTranslate(A,O,j);var V,q,H=B-v.scrollBarHeight-2*v.scrollBarMargin,G=b.height-B;if(b.height<=B||t._context.staticPlot)k.attr({width:D-b.borderwidth,height:B-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),f.setTranslate(T,0,0),M.select("rect").attr({width:D-2*b.borderwidth,height:B-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth}),T.call(p.setClipUrl,o);else{V=v.scrollBarMargin,q=T.attr("data-scroll")||0,k.attr({width:D-2*b.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:B-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),M.select("rect").attr({width:D-2*b.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:B-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth-q}),T.call(p.setClipUrl,o),C&&e(V,q),A.on("wheel",null),A.on("wheel",function(){q=f.constrain(T.attr("data-scroll")-u.event.deltaY/H*G,-G,0),V=v.scrollBarMargin-q/G*H,e(V,q),u.event.preventDefault()}),E.on(".drag",null),T.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=f.constrain(u.event.y-v.scrollBarHeight/2,v.scrollBarMargin,v.scrollBarMargin+H),q=-(V-v.scrollBarMargin)/H*G,e(V,q)});E.call(X),T.call(X)}if(t._context.editable){var Y,W,Z,Q;A.classed("cursor-move",!0),d.init({element:A.node(),prepFn:function(){var t=f.getTranslate(A);Z=t.x,Q=t.y},moveFn:function(t,e){var r=Z+t,n=Q+e;f.setTranslate(A,r,n),Y=d.align(r,0,I.l,I.l+I.w,b.xanchor),W=d.align(n,0,I.t+I.h,I.t,b.yanchor)},doneFn:function(e){e&&void 0!==Y&&void 0!==W&&c.relayout(t,{"legend.x":Y,"legend.y":W})}})}}}},{"../../lib":348,"../../plotly":368,"../../plots/plots":404,"../color":267,"../dragelement":288,"../drawing":290,"./anchor_utils":303,"./constants":305,"./get_legend_data":308,"./helpers":309,"./style":311,d3:100}],308:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+f;l.push(n),s[n]=[[r]],f++}}var o,a,s={},l=[],u=!1,c={},f=0;for(o=0;oo;o++)m=s[l[o]],y[o]=i.isReversed(e)?m.reverse():m;else{for(y=[new Array(b)],o=0;b>o;o++)m=s[l[o]][0],y[0][i.isReversed(e)?b-o-1:o]=m;b=1}return e._lgroupsLength=b,y}},{"../../plots/plots":404,"./helpers":309}],309:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.legendGetsTrace=function(t){return t.visible&&n.traceIs(t,"showLegend")},r.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},r.isVertical=function(t){return"h"!==t.orientation},r.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":404}],310:[function(t,e,r){"use strict";var n=e.exports={};n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.draw=t("./draw"),n.style=t("./style")},{"./attributes":304,"./defaults":306,"./draw":307,"./style":311}],311:[function(t,e,r){"use strict";function n(t){var e=t[0].trace,r=e.visible&&e.fill&&"none"!==e.fill,n=d.hasLines(e),i=l.select(this).select(".legendfill").selectAll("path").data(r?[t]:[]);i.enter().append("path").classed("js-fill",!0),i.exit().remove(),i.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var o=l.select(this).select(".legendlines").selectAll("path").data(n?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(f.lineGroupStyle)}function i(t){function e(t,e,r){var n=u.nestedProperty(a,t).get(),i=Array.isArray(n)&&e?e(n):n;if(r){if(ir[1])return r[1]}return i}function r(t){return t[0]}var n,i,o=t[0],a=o.trace,s=d.hasMarkers(a),c=d.hasText(a),h=d.hasLines(a);if(s||c||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(o,p)],i=u.minExtend(a,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function a(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../lib"),c=t("../../plots/plots"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(a).each(s).each(n).each(i)}},{"../../lib":348,"../../plots/plots":404,"../../traces/pie/style_one":423,"../../traces/scatter/subtypes":444,"../color":267,"../drawing":290,d3:100}],312:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,o=t._fullLayout,a={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,h=(1-c)/2,d=u.Axes.list(t,null,!0),p=0;py;y++){var b=s[y];h=m[b]={};for(var x=0;x1)return n(["resetViews","toggleHover"]),a(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&o(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),a(v,r)}function i(t){for(var e=l.Axes.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),o.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),o.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",a.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":348,"../color":267,"./attributes":315,"./button_attributes":316,"./constants":317}],319:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;ne){var r=e;e=t,t=r}s.setAttributes(w,{"data-min":t,"data-max":e}),s.setAttributes(N,{x:t,width:e-t}),s.setAttributes(k,{width:t}),s.setAttributes(T,{x:e,width:p-e}),s.setAttributes(E,{transform:"translate("+(t-v-1)+")"}),s.setAttributes(C,{transform:"translate("+e+")"})}var f=t._fullLayout,h=f._infolayer.selectAll("g.range-slider"),d=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*d.thickness,v=2,m=Math.floor(d.borderwidth/2),y=f.margin.l,b=f.height-g-f.margin.b,x=0,_=p,w=document.createElementNS(a,"g");s.setAttributes(w,{"class":"range-slider","data-min":x,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+b+")"});var A=document.createElementNS(a,"rect"),M=d.borderwidth%2===0?d.borderwidth:d.borderwidth-1;s.setAttributes(A,{fill:d.bgcolor,stroke:d.bordercolor,"stroke-width":d.borderwidth,height:g+M,width:p+M,transform:"translate(-"+m+", -"+m+")","shape-rendering":"crispEdges"});var k=document.createElementNS(a,"rect");s.setAttributes(k,{x:0,width:x,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(a,"rect");s.setAttributes(T,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var E=document.createElementNS(a,"g"),L=document.createElementNS(a,"rect"),S=document.createElementNS(a,"rect");s.setAttributes(E,{transform:"translate("+(x-v-1)+")"}),s.setAttributes(L,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),s.setAttributes(S,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(E,[S,L]);var C=document.createElementNS(a,"g"),P=document.createElementNS(a,"rect"),R=document.createElementNS(a,"rect");s.setAttributes(C,{transform:"translate("+_+")"}),s.setAttributes(P,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),s.setAttributes(R,{width:v,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(C,[R,P]);var N=document.createElementNS(a,"rect");s.setAttributes(N,{x:x,width:_-x,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function r(t){var r,n,f=+t.clientX-o;switch(i){case N:w.style.cursor="ew-resize",r=+s+f,n=+l+f,c(r,n),u(e(r),e(n));break;case L:w.style.cursor="col-resize",r=+s+f,n=+l,c(r,n),u(e(r),e(n));break;case P:w.style.cursor="col-resize",r=+s,n=+l+f,c(r,n),u(e(r),e(n));break;default:w.style.cursor="ew-resize",r=a,n=a+f,c(r,n),u(e(r),e(n))}}function n(){window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n),w.style.cursor="auto"}var i=t.target,o=t.clientX,a=o-w.getBoundingClientRect().left,s=w.getAttribute("data-min"),l=w.getAttribute("data-max");window.addEventListener("mousemove",r),window.addEventListener("mouseup",n)}),d.range||(d.range=i.getAutoRange(f.xaxis));var z=l(t,p,g);s.appendChildren(w,[A,z,k,T,N,E,C]),r(f.xaxis.range[0],f.xaxis.range[1]),h.data([0]).enter().append(function(){return d.setRange=r,w})}},{"../../constants/xmlns_namespaces":339,"../../lib":348,"../../plotly":368,"../../plots/cartesian/axes":371,"./helpers":325,"./range_plot":327}],324:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,o){function a(t,e){return n.coerce(s,l,i,t,e)}if(t[r].rangeslider){var s=n.isPlainObject(t[r].rangeslider)?t[r].rangeslider:{},l=e[r].rangeslider={};if(a("bgcolor"),a("bordercolor"),a("borderwidth"),a("thickness"),a("visible"),a("range"),l.range&&!e[r].autorange){var u=l.range,c=e[r].range;u[0]=Math.min(u[0],c[0]),u[1]=Math.max(u[1],c[1])}else e[r]._needsExpand=!0;l.visible&&o.forEach(function(t){var r=e[t]||{};r.fixedrange=!0,e[t]=r})}}},{"../../lib":348,"./attributes":322}],325:[function(t,e,r){"use strict";r.setAttributes=function(t,e){for(var r in e)t.setAttribute(r,e[r])},r.appendChildren=function(t,e){for(var r=0;rl;l++){var u=s[l],c={_fullLayout:e},f=k.coerceRef(t,n,c,u);if("path"!==a){var h=.25,d=.75;if("paper"!==f){var p=k.getFromId(c,f),g=o(p);h=g(p.range[0]+h*(p.range[1]-p.range[0])),d=g(p.range[0]+d*(p.range[1]-p.range[0]))}r(u+"0",h),r(u+"1",d)}}return"path"===a?r("path"):M.noneOrAll(t,n,["x0","x1","y0","y1"]),n}function i(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function a(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function s(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function l(t,e,r){for(var n=0;ne;i--)d(t,i).selectAll('[data-index="'+(i-1)+'"]').attr("data-index",i),C.draw(t,i)}function f(t,e,r,a){function s(r){var n={"data-index":e,"fill-rule":"evenodd",d:b(t,C)},i=C.line.width?C.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",C.opacity).call(T.stroke,i).call(T.fill,C.fillcolor).call(E.dashLine,C.line.dash,C.line.width);P&&o.call(E.setClipUrl,"clip"+t._fullLayout._uid+P),t._context.editable&&h(t,o,C,e)}var l,u;d(t,e).selectAll('[data-index="'+e+'"]').remove();var c=t.layout.shapes[e];if(c){var f={xref:c.xref,yref:c.yref},g={};"string"==typeof r&&r?g[r]=a:M.isPlainObject(r)&&(g=r);var v=Object.keys(g);for(l=0;ll;l++){var x=y[l];if(void 0===g[x]&&void 0!==c[x]){var _,w=x.charAt(0),A=k.getFromId(t,k.coerceRef(f,{},t,w)),L=k.getFromId(t,k.coerceRef(c,{},t,w)),S=c[x];void 0!==g[w+"ref"]&&(A?(_=i(A)(S),S=(_-A.range[0])/(A.range[1]-A.range[0])):S=(S-L.domain[0])/(L.domain[1]-L.domain[0]),L?(_=L.range[0]+S*(L.range[1]-L.range[0]),S=o(L)(_)):S=A.domain[0]+S*(A.domain[1]-A.domain[0])),c[x]=S}}var C=n(c,t._fullLayout);t._fullLayout.shapes[e]=C;var P;if("below"!==C.layer)P=(C.xref+C.yref).replace(/paper/g,""),s(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)P="",s(t._fullLayout._shapeLowerLayer);else{var R,N=t._fullLayout._plots||{},z=Object.keys(N);for(l=0,u=z.length;u>l;l++)R=N[z[l]],P=z[l],p(t,C,R)&&s(R.shapelayer)}}}function h(t,e,r,n){function i(t){var r=$.right-$.left,n=$.bottom-$.top,i=t.clientX-$.left,o=t.clientY-$.top,a=r>W&&n>Z&&!t.shiftKey?L.getCursor(i/r,1-o/n):"move";S(e,a),Y=a.split("-")[0]}function o(e){U=k.getFromId(t,r.xref),V=k.getFromId(t,r.yref),q=m(t,U),H=m(t,V,!0),G=y(t,U),X=y(t,V,!0);var o="shapes["+n+"]";"path"===r.type?(F=r.path,B=o+".path"):(c=q(r.x0),f=H(r.y0),h=q(r.x1),d=H(r.y1),p=o+".x0",g=o+".y0",_=o+".x1",w=o+".y1"),h>c?(E=c,N=o+".x0",j="x0",C=h,z=o+".x1",D="x1"):(E=h,N=o+".x1",j="x1",C=c,z=o+".x0",D="x0"),d>f?(M=f,P=o+".y0",I="y0",T=d,R=o+".y1",O="y1"):(M=d,P=o+".y1",I="y1",T=f,R=o+".y0",O="y0"),u={},i(e),Q.moveFn="move"===Y?s:l}function a(r){S(e),r&&A.relayout(t,u)}function s(n,i){if("path"===r.type){var o=function(t){return G(q(t)+n)};U&&"date"===U.type&&(o=v(o));var a=function(t){return X(H(t)+i)};V&&"date"===V.type&&(a=v(a)),r.path=x(F,o,a),u[B]=r.path}else u[p]=r.x0=G(c+n),u[g]=r.y0=X(f+i),u[_]=r.x1=G(h+n),u[w]=r.y1=X(d+i);e.attr("d",b(t,r))}function l(n,i){if("path"===r.type){var o=function(t){return G(q(t)+n)};U&&"date"===U.type&&(o=v(o));var a=function(t){return X(H(t)+i)};V&&"date"===V.type&&(a=v(a)),r.path=x(F,o,a),u[B]=r.path}else{var s=~Y.indexOf("n")?M+i:M,l=~Y.indexOf("s")?T+i:T,c=~Y.indexOf("w")?E+n:E,f=~Y.indexOf("e")?C+n:C;l-s>Z&&(u[P]=r[I]=X(s),u[R]=r[O]=X(l)),f-c>W&&(u[N]=r[j]=G(c),u[z]=r[D]=G(f))}e.attr("d",b(t,r))}var u,c,f,h,d,p,g,_,w,M,T,E,C,P,R,N,z,I,O,j,D,F,B,U,V,q,H,G,X,Y,W=10,Z=10,Q={setCursor:i,element:e.node(),prepFn:o,doneFn:a},$=Q.element.getBoundingClientRect();L.init(Q)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):M.log("getShapeLayer: undefined shape: index",e),n}function p(t,e,r){var n=A.Axes.getFromId(t,r.id,"x")._id,i=A.Axes.getFromId(t,r.id,"y")._id,o="below"===e.layer,a=n===e.xref||i===e.yref,s=!!r.shapelayer;return o&&a&&s}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function v(t){return function(e){return t(e).replace(" ","_")}}function m(t,e,r){var n,o=t._fullLayout._size;if(e){var a=i(e);n=function(t){return e._offset+e.l2p(a(t,!0))},"date"===e.type&&(n=g(n))}else n=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return n}function y(t,e,r){var n,i=t._fullLayout._size;if(e){var a=o(e);n=function(t){return a(e.p2l(t-e._offset))}}else n=r?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return n}function b(t,e){var r,n,o,a,s=e.type,l=k.getFromId(t,e.xref),u=k.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=i(l),n=function(t){return l._offset+l.l2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(o=i(u),a=function(t){return u._offset+u.l2p(o(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===s)return l&&"date"===l.type&&(n=g(n)),u&&"date"===u.type&&(a=g(a)),C.convertPath(e.path,n,a);var f=n(e.x0),h=n(e.x1),d=a(e.y0),p=a(e.y1);if("line"===s)return"M"+f+","+d+"L"+h+","+p;if("rect"===s)return"M"+f+","+d+"H"+h+"V"+p+"H"+f+"Z";var v=(f+h)/2,m=(d+p)/2,y=Math.abs(v-f),b=Math.abs(m-d),x="A"+y+","+b,_=v+y+","+m,w=v+","+(m-b);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function x(t,e,r){return t.replace(P,function(t){var n=0,i=t.charAt(0),o=N[i],a=z[i],s=I[i],l=t.substr(1).replace(R,function(t){return n>=s?t:(o[n]?t=e(t):a[n]&&(t=r(t)),n++,t)});return i+l})}function _(t,e,r,n,i){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(r)];if(n){var a,s,l,u,c,f=1/0,h=-(1/0),d=n.match(P);for("date"===t.type&&(o=g(o)),a=0;ac&&(f=c),c>h&&(h=c)));return h>=f?[f,h]:void 0}}var w=t("fast-isnumeric"),A=t("../../plotly"),M=t("../../lib"),k=t("../../plots/cartesian/axes"),T=t("../color"),E=t("../drawing"),L=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var r=t.shapes||[],i=e.shapes=[],o=0;os&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),M.log("Ignoring extra params in segment "+t)),i+l})},C.calcAutorange=function(t){var e,r,n,i,o,a=t._fullLayout,s=a.shapes;if(s.length&&t._fullData.length)for(e=0;eh?r=h:(c.left-=b.offsetLeft,c.right-=b.offsetLeft,c.top-=b.offsetTop,c.bottom-=b.offsetTop,b.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(r=Math.max(r,a*(t[b.side]-c[o])+u))}),r=Math.min(h,r)),r>0||0>h){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=P,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,M=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var P="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":348,"../../lib/svg_text_utils":361,"../../plotly":368,"../../plots/plots":404,"../color":267,"../drawing":290,d3:100,"fast-isnumeric":104}],331:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat,a={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:a,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":345,"../../plots/font_attributes":389,"../color/attributes":266}],332:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],333:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return o.coerce(n,i,u,t,e)}for(var n,i,a=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(l.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&m(t),0!==r.length){var u=l.selectAll("g."+T.headerGroupClassName).data(r,i);u.enter().append("g").classed(T.headerGroupClassName,!0);var c=l.selectAll("g."+T.buttonGroupClassName).data([0]);c.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){y.select(this).remove(),c.call(v).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],339:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],340:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.16.3",r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=n.register,r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=n.Snapshot,r.PlotSchema=n.PlotSchema,r.Queue=n.Queue,r.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":365,"./plot_api/to_image":366,"./plot_api/validate":367,"./plotly":368,"./snapshot/download":412,d3:100}],341:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],342:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),o=t("./nested_property"),a=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)}},"boolean":{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r?!0:"string"!=typeof t?!1:!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),o=0;o2)return!1;var l=a[0].split("-");if(l.length>3||3!==l.length&&a[1])return!1;if(4===l[0].length)r=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();r=((Number(l[0])-u+70)%100+200)%100+u-70}return s(r)?1===l.length?new Date(r,0,1).getTime():(n=Number(l[1])-1,l[1].length>2||!(n>=0&&11>=n)?!1:2===l.length?new Date(r,n,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(r,n,i).getTime(),a[1]?(l=a[1].split(":"),l.length>3?!1:(o=Number(l[0]),l[0].length>2||!(o>=0&&23>=o)?!1:(i+=36e5*o,1===l.length?i:(n=Number(l[1]),l[1].length>2||!(n>=0&&59>=n)?!1:(i+=6e4*n,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){if("undefined"==typeof a)return void l.error("d3 is not defined.");e||(e=0);var r=new Date(t),i=a.time.format("%Y-%m-%d")(r);return 7776e6>e?(i+=" "+n(r.getHours(),2),432e6>e&&(i+=":"+n(r.getMinutes(),2),108e5>e&&(i+=":"+n(r.getSeconds(),2),3e5>e&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={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"]},c={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"]},f=a.time.format.utc,h={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){h[t].D.push(f(e)),["H","I","D"].forEach(function(r){u[r].forEach(function(n){var i=h[t][r];i.push(f(e+"~"+n)),i.push(f(n+"~"+e))})})})});var d=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,v=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},b=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,A=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],k=function(t,e){return M[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,p).replace(g,"").replace(v,"~").replace(m,y).replace(A,k).trim().replace(T,"");var e,r,n=null,a=i(t),s=o(t);e=h[a][s],r=e.length;for(var l=0;r>l&&!(n=e[l].parse(t));l++);if(!(n instanceof Date))return!1;var u=n.getTimezoneOffset();return n.setTime(n.getTime()+60*u*1e3),n}},{"../lib":348,d3:100,"fast-isnumeric":104}],344:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof n)return t;var e=new n;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(r,n){"undefined"!=typeof jQuery&&jQuery(t).trigger(r,n),e.emit(r,n)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof jQuery&&(n=jQuery(t).triggerHandler(e,r));var o=t._ev;if(!o)return n;var a=o._events[e];if(!a)return n;"function"==typeof a&&(a=[a]);for(var s=a.pop(),l=0;lm;m++){l=t[m];for(u in l)c=g[u],f=l[u],s&&a(f)?g[u]=f:e&&f&&(o(f)||(h=a(f)))?(h?(h=!1,d=c&&a(c)?c:[]):d=c&&o(c)?c:{},g[u]=i([d,f],e,r,s)):("undefined"!=typeof f||r)&&(g[u]=f)}return g}var o=t("./is_plain_object.js"),a=Array.isArray;r.extendFlat=function(){return i(arguments,!1,!1,!1)},r.extendDeep=function(){return i(arguments,!0,!1,!1)},r.extendDeepAll=function(){return i(arguments,!0,!0,!1)},r.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":349}],346:[function(t,e,r){"use strict";function n(t,e){var r=f(t);return r[3]*=e,r}function i(t){return s(t).isValid()?t:c}function o(t){return l(t)?t:h}function a(t,e,r){var a,s,l,f,d,p=t.color,g=Array.isArray(p),v=Array.isArray(e),m=[];if(a=void 0!==t.colorscale?u(t.colorscale,t.cmin,t.cmax):i,s=g?function(t,e){return void 0===t[e]?c:a(t[e])}:i,l=v?function(t,e){return void 0===t[e]?h:o(t[e])}:o,g||v)for(var y=0;r>y;y++)f=s(p,y),d=l(e,y),m[y]=n(f,d);else m=n(p,e);return m}var s=t("tinycolor2"),l=t("fast-isnumeric"),u=t("../components/colorscale/make_scale_function"),c=t("../components/color/attributes").defaultLine,f=t("./str2rgbarray"),h=1;e.exports=a},{"../components/color/attributes":266,"../components/colorscale/make_scale_function":284,"./str2rgbarray":360,"fast-isnumeric":104,tinycolor2:239}],347:[function(t,e,r){"use strict";function n(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(e>r)break;t=t.slice(0,e)+l(t.slice(e+5,r))+t.slice(r+6)}return t}function i(t){return t.replace(/\/g,"\n")}function o(t){return t.replace(/\<.*\>/g,"")}function a(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(r>n)r+=1;else{var i=e[t.slice(r+1,n)];t=i?t.slice(0,r)+i+t.slice(n+1):t.slice(0,r)+t.slice(n+1)}}return t}function s(t){return""+a(o(n(i(t))))}var l=t("superscript-text"),u=t("../constants/string_mappings");e.exports=s},{"../constants/string_mappings":338,"superscript-text":229}],348:[function(t,e,r){"use strict";var n=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var o=t("./coerce");i.valObjects=o.valObjects,i.coerce=o.coerce,i.coerce2=o.coerce2,i.coerceFont=o.coerceFont,i.validate=o.validate;var a=t("./dates");i.dateTime2ms=a.dateTime2ms,i.isDateTime=a.isDateTime,i.ms2DateTime=a.ms2DateTime,i.parseDate=a.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var f=t("./loggers");i.log=f.log,i.warn=f.warn,i.error=f.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var o=0;or?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.randstr=function h(t,e,r){if(r||(r=16),void 0===e&&(e=24),0>=e)return"0";var n,i,o,a=Math.log(Math.pow(2,e))/Math.log(r),s="";for(n=2;a===1/0;n*=2)a=Math.log(Math.pow(2,e/n))/Math.log(r)*n;var l=a-Math.floor(a);for(n=0;n-1||u!==1/0&&u>=Math.pow(2,e)?h(t,e,r):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var r,n,i,o,a=t.length,s=2*a,l=2*e-1,u=new Array(l),c=new Array(a);for(r=0;l>r;r++)u[r]=(1-Math.cos(Math.PI*(r+1)/e))/(2*e);for(r=0;a>r;r++){for(o=0,n=0;l>n;n++)i=r+n+1-e,-a>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=a&&(i=s-1-i),o+=t[i]*u[n];c[r]=o}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var o,a;t.length;)if(a=t.splice(0,1)[0],o=a(e),o&&o.then)return o.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,o=!1,a=!0;for(n=0;ni;i++)e[i][r]=t[i]},i.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,o,a,s=3,l=Object.keys(t);for(n=0;n1?n+o[1]:"";if(i&&(o.length>1||a.length>4))for(;r.test(a);)a=a.replace(r,"$1"+i+"$2");return a+s}},{"./coerce":342,"./dates":343,"./extend":345,"./is_plain_object":349,"./loggers":350,"./matrix":351,"./nested_property":352,"./notifier":353,"./search":356,"./stats":359,d3:100}],349:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],350:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;en;n++)r[n]=new Array(e);return r},r.transposeRagged=function(t){var e,r,n=0,i=t.length;for(e=0;i>e;e++)n=Math.max(n,t[e].length);var o=new Array(n);for(e=0;n>e;e++)for(o[e]=new Array(i),r=0;i>r;r++)o[e][r]=t[r][e];return o},r.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var n,i,o=t.length;if(t[0].length)for(n=new Array(o),i=0;o>i;i++)n[i]=r.dot(t[i],e);else if(e[0].length){var a=r.transposeRagged(e);for(n=new Array(a.length),i=0;ii;i++)n+=t[i]*e[i];return n},r.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},r.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},r.rotationXYMatrix=function(t,e,n){return r.dot(r.dot(r.translationMatrix(e,n),r.rotationMatrix(t)),r.translationMatrix(-e,-n))},r.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var n=1===arguments.length?e[0]:[e[0],e[1]];return r.dot(t,[n[0],n[1],1]).slice(0,2)}},r.apply2DTransform2=function(t){var e=r.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],352:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,o,a,s,l=t;for(a=0;a=0;e--){if(n=t[e],a=!1,Array.isArray(n))for(r=n.length-1;r>=0;r--)u(n[r])?a?n[r]=void 0:n.pop():a=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),a=!1,r=o.length-1;r>=0;r--)u(n[o[r]])&&!i(n[o[r]],o[r])?delete n[o[r]]:a=!0;if(a)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,a,s=0,l=e.split(".");sr||r>o||a>n||n>s?!1:!e||!u(t)}function r(t,e){var r=t[0],l=t[1];if(i>r||r>o||a>l||l>s)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;p>u;u++)if(c=g,f=v,g=n[u][0],v=n[u][1],h=Math.min(c,g),!(h>r||r>Math.max(c,g)||l>Math.max(f,v)))if(l=l&&r!==h&&m++}return m%2===1}var n=t.slice(),i=n[0][0],o=i,a=n[0][1],s=a;n.push(n[0]);for(var l=1;lo;o++)if(a=[t[o][0]-l[0],t[o][1]-l[1]],s=n(a,u),0>s||s>c||Math.abs(n(a,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":351}],355:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},a.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},a.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},a.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;rt}function i(t,e){return e>=t}function o(t,e){return t>e}function a(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?a:o;h>f&&d++<100;)u=Math.floor((f+h)/2),c(e[u],t)?f=u+1:h=u;return d>90&&l.log("Long binary search..."),f-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,o=i/(n||1)/1e4,a=[e[0]],s=0;n>s;s++)e[s+1]>e[s]+o&&(i=Math.min(i,e[s+1]-e[s]),a.push(e[s+1]));return{vals:a,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,o=e.length-1,a=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;o>i&&a++<100;)n=u((i+o)/2),e[n]<=t?i=n+s:o=n-l;return e[i]}},{"../lib":348,"fast-isnumeric":104}],357:[function(t,e,r){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],358:[function(t,e,r){"use strict";var n=t("../components/color"),i=function(){};e.exports=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=i);t.destroy=function(){t.container.parentNode.removeChild(t.container)};var r=document.createElement("div");return r.textContent="Webgl is not supported by your browser - visit http://get.webgl.org for more info",r.style.cursor="pointer",r.style.fontSize="24px",r.style.color=n.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../components/color":267}],359:[function(t,e,r){"use strict";var n=t("fast-isnumeric");r.aggNums=function(t,e,i,o){var a,s;if(o||(o=i.length),n(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(o),a=0;o>a;a++)s[a]=r.aggNums(t,e,i[a]);i=s}for(a=0;o>a;a++)n(e)?n(i[a])&&(e=t(+e,+i[a])):e=i[a];return e},r.len=function(t){return r.aggNums(function(t){return t+1},0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums(function(t,e){return t+e},0,t)/e},r.variance=function(t,e,i){return e||(e=r.len(t)),n(i)||(i=r.mean(t,e)),r.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":104}],360:[function(t,e,r){"use strict";function n(t){return t=i(t),o.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),o=t("arraytools");e.exports=n},{arraytools:37,tinycolor2:239}],361:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+h.randstr([],64),o=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function a(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var o=e[1],a=e[3],s=a.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"
";if("href"!==a.substr(0,4).toLowerCase())return"";var u=a.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,-1===v.indexOf(c.protocol)?"":''}if("br"===n)return"
";if(o)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),i="",a=n.length-1;a>=0;a--){var s=n[a].match(/<(\/?).*>/i);if(s&&"
"!==n[a]){s[1]||(i=n[a]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),o+=2)});var a=e.join(""),u=a.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,o,a=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},o="right"===a?function(){return l.right-n.width}:"center"===a?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:o()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),c=t.appendSVG(a),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),a=u(i),s=t,l=!s.attr("data-notex")&&a.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};o(l[2],i,function(i,o,a){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),o&&o.node()&&l.node().insertBefore(o.node().cloneNode(!0),l.node().firstChild),l.attr({"class":p,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){o(),a.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(a.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=f.select(h.getPlotDiv(a.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":a.style("font-family")||"Arial","font-size":a.style("font-size")||12,color:r.fill||a.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(a.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box" +}).attr({contenteditable:!0}).text(r.text||a.attr("data-unformatted")).call(c(a,e,r)).on("blur",function(){a.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(a.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(a,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(a.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(a,this.textContent)):(s.input.call(a,this.textContent),f.select(this).call(c(a,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var a=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":338,"../constants/xmlns_namespaces":339,"../lib":348,d3:100}],362:[function(t,e,r){"use strict";function n(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function i(t){Array.isArray(t._promises)&&t._promises.length>0&&z.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),N.defaultConfig.setBackground(t,e)}function a(t,e){t._context||(t._context=z.extendFlat({},N.defaultConfig));var r=t._context;e&&(Object.keys(e).forEach(function(t){t in r&&("setBackground"===t&&"opaque"===e[t]?r[t]=o:r[t]=e[t])}),e.plot3dPixelRatio&&!r.plotGlPixelRatio&&(r.plotGlPixelRatio=r.plot3dPixelRatio)),r.staticPlot&&(r.editable=!1,r.autosizable=!1,r.scrollZoom=!1,r.doubleClick=!1,r.showTips=!1,r.showLink=!1,r.displayModeBar=!1)}function s(t,e,r){var n=C.select(t).selectAll(".plot-container").data([0]);n.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=n.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),r&&(t.layout=r),N.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(A(t,{}),t._fullLayout.autosize=r.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=N.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var o=t.framework.svg(),a=1,s=t._fullLayout.title;""!==s&&s||(a=0);var l="Click to enter title",u=function(){this.call(N.util.convertToTspans)},c=o.select(".title-group text").call(u);if(t._context.editable){c.attr({"data-unformatted":s}),s&&s!==l||(a=.2,c.attr({"data-unformatted":l}).text(l).style({opacity:a}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(N.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(u),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(u)})};c.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),j.addLinks(t),Promise.resolve()}function l(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var n=N.Axes.list({_fullLayout:t});for(e=0;ee;e++){var a=t.annotations[e];a.ref&&("paper"===a.ref?(a.xref="paper",a.yref="paper"):"data"===a.ref&&(a.xref="x",a.yref="y"),delete a.ref),u(a,"xref"),u(a,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(z.warn("Shapes must be an array."),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var l=t.shapes[e];u(l,"xref"),u(l,"yref")}var c=t.legend;c&&(c.x>3?(c.x=1.02,c.xanchor="left"):c.x<-2&&(c.x=-.02,c.xanchor="right"),c.y>3?(c.y=1.02,c.yanchor="bottom"):c.y<-2&&(c.y=-.02,c.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=j.getSubplotIds(t,"gl3d");for(e=0;er;++r)b[r]=v[e]+m*y[2+4*r];d.camera={eye:{x:b[0],y:b[1],z:b[2]},center:{x:v[0],y:v[1],z:v[2]},up:{x:y[1],y:y[5],z:y[9]}},delete d.cameraposition}}return F.clean(t),t}function u(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=N.Axes.cleanId(r,n))}function c(t,e){for(var r=[],n=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),i=0;io&&(s=z.randstr(n),-1!==r.indexOf(s));o++);a.uid=z.randstr(n),n.push(a.uid)}if(r.push(a.uid),"histogramy"===a.type&&"xbins"in a&&!("ybins"in a)&&(a.ybins=a.xbins,delete a.xbins),a.error_y&&"opacity"in a.error_y){var l=F.defaults,u=a.error_y.color||(j.traceIs(a,"bar")?F.defaultLine:l[i%l.length]);a.error_y.color=F.addOpacity(F.rgb(u),F.opacity(u)*a.error_y.opacity),delete a.error_y.opacity}if("bardir"in a&&("h"!==a.bardir||!j.traceIs(a,"bar")&&"histogram"!==a.type.substr(0,9)||(a.orientation="h",_(a)),delete a.bardir),"histogramy"===a.type&&_(a),"histogramx"!==a.type&&"histogramy"!==a.type||(a.type="histogram"),"scl"in a&&(a.colorscale=a.scl,delete a.scl),"reversescl"in a&&(a.reversescale=a.reversescl,delete a.reversescl),a.xaxis&&(a.xaxis=N.Axes.cleanId(a.xaxis,"x")),a.yaxis&&(a.yaxis=N.Axes.cleanId(a.yaxis,"y")),j.traceIs(a,"gl3d")&&a.scene&&(a.scene=j.subplotsRegistry.gl3d.cleanId(a.scene)),j.traceIs(a,"pie")||(Array.isArray(a.textposition)?a.textposition=a.textposition.map(f):a.textposition&&(a.textposition=f(a.textposition))),j.traceIs(a,"2dMap")&&("YIGnBu"===a.colorscale&&(a.colorscale="YlGnBu"),"YIOrRd"===a.colorscale&&(a.colorscale="YlOrRd")),j.traceIs(a,"markerColorscale")&&a.marker){var c=a.marker;"YIGnBu"===c.colorscale&&(c.colorscale="YlGnBu"),"YIOrRd"===c.colorscale&&(c.colorscale="YlOrRd")}if("surface"===a.type&&z.isPlainObject(a.contours)){var d=["x","y","z"];for(o=0;on?o.push(i+n):o.push(n);return o}function g(t,e,r){var n,i;for(n=0;n=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||0>i&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function v(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&g(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function m(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&l0){var s=w(t._boundingBoxMargins),l=s.left+s.right,u=s.bottom+s.top,c=o._container.node().getBoundingClientRect(),f=1-2*a.frameMargins;i=Math.round(f*(c.width-l)),n=Math.round(f*(c.height-u))}else r=window.getComputedStyle(t),n=parseFloat(r.height)||o.height,i=parseFloat(r.width)||o.width;return Math.abs(o.width-i)>1||Math.abs(o.height-n)>1?(o.height=t.layout.height=n,o.width=t.layout.width=i):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),j.sanitizeMargins(o),e}function M(t){var e=C.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===r.autosize&&(A(t,{}),r.autosize=!0,t.layout.autosize=!0),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];C.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=z.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0);var o=N.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&k(t,o),r._has("cartesian")&&T(t,o),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.selectAll(".layer-subplot");r._imageSubplotLayer=a.selectAll(".imagelayer"),r._shapeSubplotLayer=a.selectAll(".shapelayer");var s=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=s.append("g").classed("imagelayer",!0),r._shapeUpperLayer=s.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var l=z.syncOrAsync([E,function(){return N.Axes.doTicks(t,"redraw")},D.init],t);return l&&l.then&&t._promises.push(l),l}function k(t,e){function r(e,r){return function(){return N.Axes.getFromId(t,e,r)}}for(var n,i,o=t._fullLayout._plots={},a=0;a0,_=N.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),A=w===_;x?t.framework===M&&!b&&A||(t.framework=M,M(t)):A?b&&M(t):(t.framework=M,M(t)),b&&N.Axes.saveRangeInitial(t);var k=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&d(t);for(var L=0;LW.range[0]?[1,2]:[2,1]);else{var Q=W.range[0],$=W.range[1];"log"===D?(0>=Q&&0>=$&&o(G+".autorange",!0),0>=Q?Q=$/1e6:0>=$&&($=Q/1e6),o(G+".range[0]",Math.log(Q)/Math.LN10),o(G+".range[1]",Math.log($)/Math.LN10)):(o(G+".range[0]",Math.pow(10,Q)),o(G+".range[1]",Math.pow(10,$)))}else o(G+".autorange",!0)}if("reverse"===U)X.range?X.range.reverse():(o(G+".autorange",!0),X.range=[1,0]),Y.autorange?w=!0:_=!0;else if("annotations"===I.parts[0]||"shapes"===I.parts[0]){var K=I.parts[1],J=I.parts[0],tt=g[J]||[],et=N[z.titleCase(J)],rt=tt[K]||{};2===I.parts.length&&("add"===m[P]||z.isPlainObject(m[P])?L[P]="remove":"remove"===m[P]?-1===K?(L[J]=tt,delete L[P]):L[P]=rt:z.log("???",m)),!a(rt,"x")&&!a(rt,"y")||z.containsAny(P,["color","opacity","align","dash"])||(w=!0),et.draw(t,K,I.parts.slice(2).join("."),m[P]),delete m[P]}else if("images"===I.parts[0]){var it=z.objectFromPath(P,D);z.extendDeepAll(t.layout,it),V.supplyLayoutDefaults(t.layout,t._fullLayout),V.draw(t)}else if("mapbox"===I.parts[0]&&"layers"===I.parts[1]){z.extendDeepAll(t.layout,z.objectFromPath(P,D));var ot=(t._fullLayout.mapbox||{}).layers||[];for(R=I.parts[2]+1-ot.length,p=0;R>p;p++)ot.push({});_=!0}else if("updatemenus"===I.parts[0]){z.extendDeepAll(t.layout,z.objectFromPath(P,D));var at=t._fullLayout.updatemenus||[];for(R=I.parts[2]+1-at.length,p=0;R>p;p++)at.push({});_=!0}else 0===I.parts[0].indexOf("scene")?_=!0:0===I.parts[0].indexOf("geo")?_=!0:0===I.parts[0].indexOf("ternary")?_=!0:!v._has("gl2d")||-1===P.indexOf("axis")&&"plot_bgcolor"!==I.parts[0]?"hiddenlabels"===P?w=!0:-1!==I.parts[0].indexOf("legend")?y=!0:-1!==P.indexOf("title")?b=!0:-1!==I.parts[0].indexOf("bgcolor")?x=!0:I.parts.length>1&&z.containsAny(I.parts[1],["tick","exponent","grid","zeroline"])?b=!0:-1!==P.indexOf(".linewidth")&&-1!==P.indexOf("axis")?b=x=!0:I.parts.length>1&&-1!==I.parts[1].indexOf("line")?x=!0:I.parts.length>1&&"mirror"===I.parts[1]?b=x=!0:"margin.pad"===P?b=x=!0:"margin"===I.parts[0]||"autorange"===I.parts[1]||"rangemode"===I.parts[1]||"type"===I.parts[1]||"domain"===I.parts[1]||P.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(P)?M=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(P)&&(_=!0):_=!0,I.set(D)}O.add(t,nt,[t,L],nt,[t,T]),m.autosize&&(m=A(t,m)),(m.height||m.width||m.autosize)&&(w=!0);var st=Object.keys(m),lt=[j.previousPromises];if(_||w)lt.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),N.plot(t,"",g)});else if(st.length&&(j.supplyDefaults(t),v=t._fullLayout,y&<.push(function(){return q.draw(t),j.previousPromises(t)}),x&<.push(E),b&<.push(function(){return N.Axes.doTicks(t,"redraw"),S(t),j.previousPromises(t)}),M)){var ut;for(Z(t),N.Fx.supplyLayoutDefaults(t.layout,v,t._fullData),N.Fx.init(t),ut=j.getSubplotIds(v,"gl3d"),p=0;p1)};u(r.width)&&u(r.height)||s(new Error("Height and width should be pixel values."));var c=n.clone(e,{format:"png",height:r.height,width:r.width}),f=c.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var h=n.getRedrawFunc(f);o.plot(f,c.data,c.layout,c.config).then(h).then(l).then(function(e){t(e)}).catch(function(t){s(t)})});return s}var i=t("fast-isnumeric"),o=t("../plotly"),a=t("../lib");e.exports=n},{"../lib":348,"../plotly":368,"../snapshot":414,"fast-isnumeric":104}],367:[function(t,e,r){"use strict";function n(t,e,r,i,o,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(a("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;v>m;m++){var y=r[m],b=["data",m];if(p(y)){var x=c[m],_=x.type,w=s.traces[_].attributes;w.type={valType:"enumerated",values:[_]},x.visible===!1&&y.visible!==!1&&l.push(a("invisible",b)),n(y,x,w,l,b);var A=y.transforms,M=x.transforms;if(A){g(A)||l.push(a("array",b,["transforms"])),b.push("transforms");for(var k=0;ku&&c>e&&(void 0===i[r]?o[f]=T.tickText(t,e):o[f]=s(t,e,String(i[r])),f++);return f=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{b(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function a(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,o))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,o=e.x,s=t._tickround,l=new Date(o),u="";r&&t.hoverformat?i=a(t.hoverformat,o):t.tickformat?i=a(t.tickformat,o):(n&&(b(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=I(l):"m"===s?i=O(l):(o!==t._tmin||r||(u="
"+I(l)),"d"===s?i=j(l):"H"===s?i=D(l):(o!==t._tmin||r||(u="
"+j(l)+", "+I(l)),i=F(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=h(m(o/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var o=t.dtick,a=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=h(Math.pow(10,a),t,i,n);else if(b(o)||"D"===o.charAt(0)&&m(a+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(a);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,a),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,m(a,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>a?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=0>t,a=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat;if(n){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(c),a=(Number(c._tickround)||0)+4,l=c._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-a)/2;if("none"===s&&(l=0),t=Math.abs(t),f>t)t="0",i=!1;else{if(t+=f,l&&(t*=Math.pow(10,-l),a+=l),0===a)t=String(Math.floor(t));else if(0>a){t=String(Math.round(t)),t=t.substr(0,t.length+a);for(var h=a;0>h;h++)t+="0"}else{t=String(t);var d=t.indexOf(".")+1;d&&(t=t.substr(0,d+a).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(l&&"hide"!==s){var p;p=0>l?"\u2212"+-l:"power"!==s?"+"+l:String(l),"e"===s||("SI"===s||"B"===s)&&(l>12||-15>l)?t+="e"+p:"E"===s?t+="E"+p:"power"===s?t+="\xd710"+p+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=a,u=s,h=f/c);if(n===i){var p=n-1,g=n+1;r="tozero"===t.rangemode?0>n?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,i=0;ip&&(p=g/10),u=t.c2l(p),c=t.c2l(g),y&&(u=Math.min(0,u),c=Math.max(0,c)),n(u)){for(d=!0,a=0;a=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(a,1),a--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,a=0;a=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(a,1),a--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,a,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(o=0;6>o;o++)i(o);for(o=v-1;o>5;o--)i(o)}},T.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),a=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:a+.5,size:1};var s;if(r)s=(a-o)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,a]};T.autoTicks(f,s);var h,d=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;yg&&(p>.3*x||i(o)||i(a))){var w=f.dtick/2;d+=o>d+w?w:-w}var A=1+Math.floor((a-d)/f.dtick);h=d+A*f.dtick}else for(h=d;a>=h;)h=T.tickIncrement(h,f.dtick);return{start:d,end:h,size:f.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return n(t);if("auto"===t.tickmode||!t.dtick){var e,r=t.nticks;r||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/e):(e="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var i=t.range[1]=s:s>=l)&&(a.push(l),!(a.length>1e3));l=T.tickIncrement(l,t.dtick,i));t._tmax=a[a.length-1];for(var u=new Array(a.length),c=0;c157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,S)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,C)):e>432e5?(t.dtick=i(e,864e5,R),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,C):e>3e4?t.dtick=i(e,6e4,P):e>500?t.dtick=i(e,1e3,P):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),o=n*Number(e.substr(1)); +if("M"===i){var a=new Date(t);return a.setMonth(a.getMonth()+o)}if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===i){var s="D2"===e?z:N,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]n:n>u;)u=T.tickIncrement(u,i,e);return u}if("L"===c)return Math.log(r((Math.pow(10,n)-o)/f)*f+o)/Math.LN10;if("D"===c){var h="D2"===i?z:N,d=_.roundUp(m(n,1),h,e);return Math.floor(n)+Math.log(y.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var I=y.time.format("%Y"),O=y.time.format("%b %Y"),j=y.time.format("%b %-d"),D=y.time.format("%b %-d %Hh"),F=y.time.format("%H:%M"),B=y.time.format(":%S"),U=/%(\d?)f/g;T.tickText=function(t,e,r){function n(n){var i;return void 0===n?!0:r?"none"===n:(i={first:t._tmin,last:t._tmax}[n],"all"!==n&&e!==i)}var i,o,a=s(t,e),h="array"===t.tickmode,d=r||h;if(h&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&er&&(M=90),i(c,M)}u._lastangle=M}return a(e),e+" done"}function l(){u._boundingBox=r.node().getBoundingClientRect()}var c=r.selectAll("g."+C).data(L,S);if(!u.showticklabels||!b(n))return c.remove(),void a(e);var f,h,p,m,x;"x"===v?(x="bottom"===B?1:-1,f=function(t){return t.dx+I*x},m=n+(z+N)*x,h=function(t){return t.dy+m+t.fontSize*("bottom"===B?1:-.5)},p=function(t){return b(t)&&0!==t&&180!==t?0>t*x?"end":"start":"middle"}):(x="right"===B?1:-1,h=function(t){return t.dy+t.fontSize/2-I*x},f=function(t){return t.dx+n+(z+N+(90===Math.abs(u.tickangle)?t.fontSize/2:0))*x},p=function(t){return b(t)&&90===Math.abs(t)?"middle":"right"===B?"start":"end"});var A=0,M=0,T=[];c.enter().append("g").classed(C,1).append("text").attr("text-anchor","middle").each(function(e){var r=y.select(this),n=t._promises.length;r.call(k.setPosition,f(e),h(e)).call(k.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),n=t._promises[n],n?T.push(t._promises.pop().then(function(){i(r,u.tickangle)})):i(r,u.tickangle)}),c.exit().remove(),c.each(function(t){A=Math.max(A,t.fontSize)}),i(c,u._lastangle||u.tickangle);var E=_.syncOrAsync([o,s,l]);return E&&E.then&&t._promises.push(E),E}function a(e){if(!r){var n,i,o,a,s=E.getFromId(t,e),l=y.select(t).selectAll("g."+e+"tick"),u={selection:l,side:s.side},f=e.charAt(0),h=t._fullLayout._size,d=1.5,p=s.titlefont.size;if(l.size()){var g=y.select(l.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);g&&(u.offsetLeft=+g[1],u.offsetTop=+g[2])}"x"===f?(i="free"===s.anchor?{_offset:h.t+(1-(s.position||0))*h.h,_length:0}:E.getFromId(t,s.anchor),o=s._offset+s._length/2,a=i._offset+("top"===s.side?-10-p*(d+(s.showticklabels?1:0)):i._length+10+p*(d+(s.showticklabels?1.5:.5))),s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(a+=(c.height-c.margin.b-c.margin.t)*s.rangeslider.thickness+s._boundingBox.height),u.side||(u.side="bottom")):(i="free"===s.anchor?{_offset:h.l+(s.position||0)*h.w,_length:0}:E.getFromId(t,s.anchor),a=s._offset+s._length/2,o=i._offset+("right"===s.side?i._length+10+p*(d+(s.showticklabels?1:.5)):-10-p*(d+(s.showticklabels?.5:0))),n={rotate:"-90",offset:0},u.side||(u.side="left")),A.draw(t,e+"title",{propContainer:s,propName:s._name+".title",dfltName:f.toUpperCase()+" axis",avoid:u,transform:n,attributes:{x:o,y:a,"text-anchor":"middle"}})}}function s(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:x.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[v]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===v}function l(e,r,i){var o=e.gridlayer,a=e.zerolinelayer,l=e["hidegrid"+v]?[]:V,c=u._gridpath||"M0,0"+("x"===v?"v":"h")+r._length,f=o.selectAll("path."+P).data(u.showgrid===!1?[]:l,S);if(f.enter().append("path").classed(P,1).classed("crisp",1).attr("d",c).each(function(t){u.zeroline&&("linear"===u.type||"-"===u.type)&&Math.abs(t.x)g;g++){var y=u.mirrors[a._id+h[g]];"ticks"!==y&&"labels"!==y||(f[g]=!0)}return void 0!==n[2]&&(f[2]=!0),f.forEach(function(t,e){var r=n[e],i=U[e];t&&b(r)&&(d+=p(r+N*i,i*u.ticklen))}),i(r,d),l(e,a,t),o(r,n[3])}}).filter(function(t){return t&&t.then});return H.length?Promise.all(H):0},T.swap=function(t,e){for(var r=d(t,e),n=0;n2*n}function c(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,o=0;o2*n}var f=t("fast-isnumeric"),h=t("tinycolor2").mix,d=t("../../lib"),p=t("../plots"),g=t("../../components/color/attributes").lightFraction,v=t("./layout_attributes"),m=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),b=t("./tick_label_defaults"),x=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),A=t("./clean_datum"),M=t("./axis_ids");e.exports=function(t,e,r,i){function o(r,n){return d.coerce2(t,e,v,r,n)}var a=i.letter,s=i.font||{},l="Click to enter "+(i.title||a.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=M.name2id(i.name));var u=r("type");"-"===u&&(n(e,i.data),"-"===e.type?e.type="linear":u=t.type=e.type),_(e);var c=r("color"),p=c===t.color?c:s.color;r("title",l),d.coerceFont(r,"titlefont",{family:s.family,size:Math.round(1.2*s.size),color:p});var A=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),k=r("autorange",!A);k&&r("rangemode");var T=r("range",[-1,"x"===a?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),d.noneOrAll(t.range,e.range,[0,1]),r("fixedrange"),m(t,e,r,u),b(t,e,r,u,i),y(t,e,r,i),x(t,e,r);var E=o("linecolor",c),L=o("linewidth"),S=r("showline",!!E||!!L);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&r("mirror");var C=o("gridcolor",h(c,i.bgColor,g).toRgbString()),P=o("gridwidth"),R=r("showgrid",i.showGrid||!!C||!!P);R||(delete e.gridcolor,delete e.gridwidth);var N=o("zerolinecolor",c),z=o("zerolinewidth"),I=r("zeroline",i.showGrid||!!N||!!z);return I||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===u?w(a,e.categoryorder,e.categoryarray,i.data):[],e}},{"../../components/color/attributes":266,"../../lib":348,"../plots":404,"./axis_ids":373,"./category_order_defaults":374,"./clean_datum":375,"./layout_attributes":380,"./ordered_categories":382,"./set_convert":385,"./tick_label_defaults":386,"./tick_mark_defaults":387,"./tick_value_defaults":388,"fast-isnumeric":104,tinycolor2:239}],373:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,o=[],a=0;a0;o&&(n="array");var a=r("categoryorder",n);"array"===a&&r("categoryarray"),o||"array"!==a||(e.categoryorder="trace")}}},{}],375:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":348,"fast-isnumeric":104}],376:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],377:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?c.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function a(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/setcursor"),g=t("../../components/dragelement"),v=t("./axes"),m=t("./select"),y=t("./constants"),b=!0;e.exports=function(t,e,r,s,x,_,w,A){function M(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+gt+")").attr("d",lt+"Z"),ht=dt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+gt+")").attr("d","M0,0Z"),E();for(var o=0;oi?(ct="",at.r=at.l,at.t=at.b,ht.attr("d","M0,0Z")):(at.t=0,at.b=q,ct="x",ht.attr("d","M"+(at.l-.5)+","+(ot-G-.5)+"h-3v"+(2*G+1)+"h3ZM"+(at.r+.5)+","+(ot-G-.5)+"h3v"+(2*G+1)+"h-3Z")):!$||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,r){var n,i,o;for(n=0;nzoom back out","long"),b=!1)))}function P(e,r){var i=1===(w+A).length;if(e)O();else if(2!==r||i){if(1===r&&i){var o=w?U[0]:B[0],a="s"===w||"w"===A?0:1,s=o._name+".range["+a+"]",l=n(o,a),c="left",h="middle";if(o.fixedrange)return;w?(h="n"===w?"top":"bottom","right"===o.side&&(c="right")):"e"===A&&(c="right"),et.call(f.makeEditable,null,{immediate:!0,background:D.paper_bgcolor,text:String(l),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var r="category"===o.type?o.c2l(e):o.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else I()}function R(e){function r(t,e,r){if(!t.fixedrange){k(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||D._enablescrollzoom){var n=t.querySelector(".plotly");if(!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(mt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void c.log("Did not find wheel motion attributes: ",e);var o,a=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=vt[0]+vt[2]*l,f=(s.bottom-e.clientY)/s.height,h=vt[1]+vt[3]*(1-f);if(A){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function i(t,e,r){for(var i=1-e,o=0,a=0;a0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nT;T++){var E=o[T],L=d[E];if(L)M[T]=w.getFromId(t,L.xaxis._id),k[T]=w.getFromId(t,L.yaxis._id);else{var S=a[E]._subplot;M[T]=S.xaxis,k[T]=S.yaxis}}var C=e.hovermode||a.hovermode;if(-1===["x","y","closest"].indexOf(C)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var P,R,N,z,I,O,j,D,F,B,U,V,q=[],H=[];if(Array.isArray(e))for(C="array",N=0;NG||G>Y.width||0>X||X>Y.height)return _.unhoverRaw(t,e)}else G="xpx"in e?e.xpx:M[0]._length/2,X="ypx"in e?e.ypx:k[0]._length/2;if(P="xval"in e?n(o,e.xval):i(M,G),R="yval"in e?n(o,e.yval):i(k,X),!g(P[0])||!g(R[0]))return v.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(z=0;z1||-1!==O.hoverinfo.indexOf("name")?O.name:void 0,index:!1,distance:Math.min(W,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},V=q.length,"array"===D){var Z=e[z];"pointNumber"in Z?(U.index=Z.pointNumber,D="closest"):(D="","xval"in Z&&(F=Z.xval,D="x"),"yval"in Z&&(B=Z.yval,D=D?"closest":"y"))}else F=P[j],B=R[j];if(O._module&&O._module.hoverPoints){var Q=O._module.hoverPoints(U,F,B,D);if(Q)for(var $,K=0;KV&&(q.splice(0,V),W=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var J="y"===C&&H.length>1;q.sort(function(t,e){return t.distance-e.distance});var tt=b.combine(a.plot_bgcolor||b.background,a.paper_bgcolor),et={hovermode:C,rotateLabels:J,bgColor:tt,container:a._hoverlayer,outerContainer:a._paperdiv},rt=u(q,et);c(q,J?"xa":"ya"),f(rt,J);var nt=t._hoverdata,it=[];for(N=0;N128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*R):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,E=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),N=Math.abs(t.y1-t.y0),z=E.width+P+R+v;t.ty0=_-E.top,t.bx=E.width+2*R,t.by=E.height+2*R,t.anchor="start",t.txwidth=E.width,t.tx2width=v,t.offset=0,o?(t.pos=L,m=M>=S+N/2+z,A=S-N/2-z>=0,"top"!==t.idealAlign&&m||!A?m?(S+=N/2,t.anchor="start"):t.anchor="middle":(S-=N/2,t.anchor="end")):(t.pos=S,m=w>=L+C/2+z,A=L-C/2-z>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(o?"rotate("+T+")":""))}),S}function c(t,e){function r(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(.01>o)){if(-.01>i){for(s=t.length-1;s>=0;s--)t[s].dp-=o;n=!1}if(n){var u=0;for(a=0;ae.pmax&&u++;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos>e.pmax-1&&(l.del=!0,u--);for(a=0;a=u);a++)if(l=t[a],l.pos=0;s--)t[s].dp-=o;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,o,a,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?L:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,a=0;a.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(a+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(o=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=o;n=!1}else a++}f.forEach(r)}for(a=f.length-1;a>=0;a--){var v=f[a];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],a=o*(P+R),s=a+o*(t.txwidth+R),l=0,u=t.offset;"middle"===t.anchor&&(a-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*S),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*P+l)+","+(P+u)+"v"+(t.by/2-P)+"h"+n*t.bx+"v-"+t.by+"H"+(n*P+l)+"V"+(u-P)+"Z"),i.call(x.setPosition,a+l,u+t.ty0-t.by/2+R).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+o*R+l,u+t.ty0-t.by/2+R),r.select("rect").call(x.setRect,s+(o-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],o=t._hoverdata[n];if(i.curveNumber!==o.curveNumber||String(i.pointNumber)!==String(o.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),M=t("./dragbox"),k=e.exports={};k.unhover=_.unhover,k.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},k.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,k.layoutAttributes,r,n)}n("dragmode");var i;if(e._has("cartesian")){var o=e._isHoriz=k.isHoriz(r);i=o?"y":"x"}else i="closest";n("hovermode",i)},k.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(a(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){a(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},k.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},k.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indext*e||0===t?A.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":267,"../../components/dragelement":288,"../../components/drawing":290,"../../lib":348,"../../lib/events":344,"../../lib/svg_text_utils":361,"./axes":371,"./constants":376,"./dragbox":377,d3:100,"fast-isnumeric":104,tinycolor2:239}],379:[function(t,e,r){"use strict";var n=t("../plots"),i=t("./constants");r.name="cartesian",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex=i.idRegex,r.attrRegex=i.attrRegex,r.attributes=t("./attributes"),r.plot=function(t){function e(t,e){for(var r=[],n=0;nf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":348,"fast-isnumeric":104}],384:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),o=t("../../components/color"),a=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.x()._offset,y=i.plotinfo.y()._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,M=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,P,R,N,z,I=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),O=[],j=i.gd,D=[];for(C=0;C0)return Math.log(e)/Math.LN10;if(0>=e&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*c*Math.abs(n-i))}return a.BADNUM}function r(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):a.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?r:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var n=l.getFromId(t._gd,t.overlaying);t.domain=n.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)i(t.range[e])||(t.range[e]=i(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):a.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):a.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?o.ms2DateTime(t):a.BADNUM},t.d2c=function(t){return i(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!i(t.range[0])&&i(f[0])&&(t.range[0]=f[0]),!i(t.range[1])&&i(f[1])&&(t.range[1]=f[1])}catch(h){o.error(h,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var r=t._categories.indexOf(e);return-1===r?a.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,o;if(r in e)for(n=e[r],i=new Array(n.length),o=0;oh;++h)a=a&&l[h]===s[h],l[h]=s[h];var d=t.clientWidth===c&&t.clientHeight===f;return c=t.clientWidth,f=t.clientHeight,a?!d:(u=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(h,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){var e=n.computedUp.slice(),r=n.computedEye.slice(),o=n.computedCenter.slice();if(n.setMode(t),"turntable"===t){var a=i();n._active.lookAt(a,r,o,e),n._active.lookAt(a+500,r,o,[0,0,1]),n._active.flush(a)}return n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return u},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var d=0,p=0;return a(t,function(e,r,o,a){var s="rotate"===h.keyBindingMode,l="pan"===h.keyBindingMode,c="zoom"===h.keyBindingMode,f=!!a.control,g=!!a.alt,v=!!a.shift,m=!!(1&e),y=!!(2&e),b=!!(4&e),x=1/t.clientHeight,_=x*(r-d),w=x*(o-p),A=h.flipX?1:-1,M=h.flipY?1:-1,k=i(),T=Math.PI*h.rotateSpeed;if((s&&m&&!f&&!g&&!v||m&&!f&&!g&&v)&&n.rotate(k,A*T*_,-M*T*w,0),(l&&m&&!f&&!g&&!v||y||m&&f&&!g&&!v)&&n.pan(k,-h.translateSpeed*_*u,h.translateSpeed*w*u,0),c&&m&&!f&&!g&&!v||b||m&&!f&&g&&!v){var E=-h.zoomSpeed*w/window.innerHeight*(k-n.lastT())*100;n.pan(k,0,0,u*(Math.exp(E)-1))}return d=r,p=o,!0}),s(t,function(t,e){var r=h.flipX?1:-1,o=h.flipY?1:-1,a=i();if(Math.abs(t)>Math.abs(e))n.rotate(a,0,0,-t*r*Math.PI*h.rotateSpeed/window.innerWidth);else{var s=-h.zoomSpeed*o*e/window.innerHeight*(a-n.lastT())/100;n.pan(a,0,0,u*(Math.exp(s)-1))}},!0),h}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":27,"mouse-change":207,"mouse-wheel":211,"right-now":221}],391:[function(t,e,r){"use strict";function n(t,e){for(var r=0;3>r;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),o=t("../plots"),a=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,a=o.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sr;++r){var n=t[u[r]];e.labels[r]=a(n.title),"titlefont"in n&&(n.titlefont.color&&(e.labelColor[r]=s(n.titlefont.color)),n.titlefont.family&&(e.labelFont[r]=n.titlefont.family),n.titlefont.size&&(e.labelSize[r]=n.titlefont.size)),"showline"in n&&(e.lineEnable[r]=n.showline),"linecolor"in n&&(e.lineColor[r]=s(n.linecolor)),"linewidth"in n&&(e.lineWidth[r]=n.linewidth),"showgrid"in n&&(e.gridEnable[r]=n.showgrid),"gridcolor"in n&&(e.gridColor[r]=s(n.gridcolor)),"gridwidth"in n&&(e.gridWidth[r]=n.gridwidth),"log"===n.type?e.zeroEnable[r]=!1:"zeroline"in n&&(e.zeroEnable[r]=n.zeroline),"zerolinecolor"in n&&(e.zeroLineColor[r]=s(n.zerolinecolor)),"zerolinewidth"in n&&(e.zeroLineWidth[r]=n.zerolinewidth),"ticks"in n&&n.ticks?e.lineTickEnable[r]=!0:e.lineTickEnable[r]=!1,"ticklen"in n&&(e.lineTickLength[r]=e._defaultLineTickLength[r]=n.ticklen),"tickcolor"in n&&(e.lineTickColor[r]=s(n.tickcolor)),"tickwidth"in n&&(e.lineTickWidth[r]=n.tickwidth),"tickangle"in n&&(e.tickAngle[r]="auto"===n.tickangle?0:Math.PI*-n.tickangle/180),"showticklabels"in n&&(e.tickEnable[r]=n.showticklabels),"tickfont"in n&&(n.tickfont.color&&(e.tickColor[r]=s(n.tickfont.color)),n.tickfont.family&&(e.tickFont[r]=n.tickfont.family),n.tickfont.size&&(e.tickSize[r]=n.tickfont.size)),"mirror"in n?-1!==["ticks","all","allticks"].indexOf(n.mirror)?(e.lineTickMirror[r]=!0,e.lineMirror[r]=!0):n.mirror===!0?(e.lineTickMirror[r]=!1,e.lineMirror[r]=!0):(e.lineTickMirror[r]=!1,e.lineMirror[r]=!1):e.lineMirror[r]=!1,"showbackground"in n&&n.showbackground!==!1?(e.backgroundEnable[r]=!0,e.backgroundColor[r]=s(n.backgroundcolor)):e.backgroundEnable[r]=!1}},e.exports=i},{"../../../lib/html2unicode":347,"../../../lib/str2rgbarray":360,arraytools:37}],396:[function(t,e,r){"use strict";function n(t,e,r,n){for(var o=r("bgcolor"),l=i.combine(o,n.paper_bgcolor),u=Object.keys(a.camera),c=0;ce;++e){var r=t[a[e]];this.enabled[e]=r.showspikes,this.colors[e]=o(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness}},e.exports=i},{"../../../lib/str2rgbarray":360}],399:[function(t,e,r){"use strict";function n(t){for(var e=new Array(3),r=0;3>r;++r){for(var n=t[r],i=new Array(n.length),o=0;oc;++c){var f=i[s[c]];if(f._length=(r[c].hi-r[c].lo)*r[c].pixelsPerDataUnit/t.dataScale[c],Math.abs(f._length)===1/0)u[c]=[];else{f.range[0]=r[c].lo/t.dataScale[c],f.range[1]=r[c].hi/t.dataScale[c],f._m=1/(t.dataScale[c]*r[c].pixelsPerDataUnit),f.range[0]===f.range[1]&&(f.range[0]-=1,f.range[1]+=1);var h=f.tickmode;if("auto"===f.tickmode){f.tickmode="linear";var d=f.nticks||o.Lib.constrain(f._length/40,4,9);o.Axes.autoTicks(f,Math.abs(f.range[1]-f.range[0])/d)}for(var p=o.Axes.calcTicks(f),g=0;gc;++c){l[c]=.5*(t.glplot.bounds[0][c]+t.glplot.bounds[1][c]);for(var g=0;2>g;++g)e.bounds[g][c]=t.glplot.bounds[g][c]}t.contourLevels=n(u)}e.exports=i;var o=t("../../../plotly"),a=t("../../../lib/html2unicode"),s=["xaxis","yaxis","zaxis"],l=[0,0,0]},{"../../../lib/html2unicode":347,"../../../plotly":368}],400:[function(t,e,r){"use strict";function n(t,e){var r,n,i=[0,0,0,0];for(r=0;4>r;++r)for(n=0;4>n;++n)i[n]+=t[4*r+n]*e[r];return i}function i(t,e){var r=n(t.projection,n(t.view,n(t.model,[e[0],e[1],e[2],1])));return r}e.exports=i},{}],401:[function(t,e,r){"use strict";function n(t){function e(e,r){if("string"==typeof r)return r;var n=t.fullSceneLayout[e];return g.tickText(n,n.c2l(r),"hover").text}var r,n=t.svgContainer,i=t.container.getBoundingClientRect(),o=i.width,a=i.height;n.setAttributeNS(null,"viewBox","0 0 "+o+" "+a),n.setAttributeNS(null,"width",o),n.setAttributeNS(null,"height",a),M(t),t.glplot.axes.update(t.axesOptions);for(var s=Object.keys(t.traces),l=null,u=t.glplot.selection,c=0;co;++o)l=c[T[o]],_(l);t?Array.isArray(t)||(t=[t]):t=[];var h=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]];for(o=0;oa;++a)h[0][a]>h[1][a]?d[a]=1:h[1][a]===h[0][a]?d[a]=1:d[a]=1/(h[1][a]-h[0][a]);for(this.dataScale=d,o=0;oo;++o){if(l=c[T[o]],u=l.type,u in x?(x[u].acc*=d[o],x[u].count+=1):x[u]={acc:d[o],count:1},l.autorange){for(y[0][o]=1/0,y[1][o]=-(1/0),a=0;ay[1][o])y[0][o]=-1,y[1][o]=1;else{var A=y[1][o]-y[0][o];y[0][o]-=A/32,y[1][o]+=A/32}}else{var M=c[T[o]].range;y[0][o]=M[0],y[1][o]=M[1]}y[0][o]===y[1][o]&&(y[0][o]-=1,y[1][o]+=1),b[o]=y[1][o]-y[0][o],this.glplot.bounds[0][o]=y[0][o]*d[o],this.glplot.bounds[1][o]=y[1][o]*d[o]}var k=[1,1,1];for(o=0;3>o;++o){l=c[T[o]],u=l.type;var E=x[u];k[o]=Math.pow(E.acc,1/E.count)/d[o]}var L,S=4;if("auto"===c.aspectmode)L=Math.max.apply(null,k)/Math.min.apply(null,k)<=S?k:[1,1,1];else if("cube"===c.aspectmode)L=[1,1,1];else if("data"===c.aspectmode)L=k;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var C=c.aspectratio;L=[C.x,C.y,C.z]}c.aspectratio.x=f.aspectratio.x=L[0],c.aspectratio.y=f.aspectratio.y=L[1],c.aspectratio.z=f.aspectratio.z=L[2],this.glplot.aspect=L;var P=c.domain||null,R=e._size||null;if(P&&R){var N=this.container.style;N.position="absolute",N.left=R.l+P.x[0]*R.w+"px",N.top=R.t+(1-P.y[1])*R.h+"px",N.width=R.w*(P.x[1]-P.x[0])+"px",N.height=R.h*(P.y[1]-P.y[0])+"px"}this.glplot.redraw()}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},k.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},k.saveCamera=function(t){function e(t,e,r,n){var i=["up","center","eye"],o=["x","y","z"];return e[i[r]]&&t[i[r]][o[n]]===e[i[r]][o[n]]}var r=this.getCamera(),n=d.nestedProperty(t,this.id+".camera"),i=n.get(),o=!1;if(void 0===i)o=!0;else for(var a=0;3>a;a++)for(var s=0;3>s;s++)if(!e(r,i,a,s)){o=!0;break}return o&&n.set(r),o},k.updateFx=function(t,e){var r=this.camera;r&&("orbit"===t?(r.mode="orbit",r.keyBindingMode="rotate"):"turntable"===t?(r.up=[0,0,1],r.mode="turntable",r.keyBindingMode="rotate"):r.keyBindingMode=t),this.fullSceneLayout.hovermode=e},k.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var o=0,a=n-1;a>o;++o,--a)for(var s=0;r>s;++s)for(var l=0;4>l;++l){var u=i[4*(r*o+s)+l];i[4*(r*o+s)+l]=i[4*(r*a+s)+l],i[4*(r*a+s)+l]=u}var f=document.createElement("canvas");f.width=r,f.height=n;var h=f.getContext("2d"),d=h.createImageData(r,n);d.data.set(i),h.putImageData(d,0,0);var p;switch(t){case"jpeg":p=f.toDataURL("image/jpeg");break;case"webp":p=f.toDataURL("image/webp");break;default:p=f.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(c),p},e.exports=o},{"../../lib":348,"../../lib/show_no_webgl_msg":358,"../../lib/str2rgbarray":360,"../../plots/cartesian/axes":371,"../../plots/cartesian/graph_interact":378,"../../plots/plots":404,"./camera":390,"./layout/convert":395,"./layout/spikes":398,"./layout/tick_marks":399,"./project":400,"./set_convert":402,"gl-plot3d":159}],402:[function(t,e,r){"use strict";var n=t("../cartesian/axes"),i=function(){};e.exports=function(t){n.setConvert(t),t.setScale=i}},{"../cartesian/axes":371}],403:[function(t,e,r){"use strict";var n=t("../plotly"),i=t("./font_attributes"),o=t("../components/color/attributes"),a=n.Lib.extendFlat;e.exports={font:{family:a({},i.family,{dflt:'"Open Sans", verdana, arial, sans-serif'}),size:a({},i.size,{dflt:12}),color:a({},i.color,{dflt:o.defaultLine})},title:{valType:"string",dflt:"Click to enter Plot title"},titlefont:a({},i,{}),autosize:{valType:"enumerated",values:[!0,!1,"initial"]},width:{valType:"number",min:10,dflt:700},height:{valType:"number",min:10,dflt:450},margin:{l:{valType:"number",min:0,dflt:80},r:{valType:"number",min:0,dflt:80},t:{valType:"number",min:0,dflt:100},b:{valType:"number",min:0,dflt:80},pad:{valType:"number",min:0,dflt:0},autoexpand:{valType:"boolean",dflt:!0}},paper_bgcolor:{valType:"color",dflt:o.background},plot_bgcolor:{valType:"color",dflt:o.background},separators:{valType:"string",dflt:".,"},hidesources:{valType:"boolean",dflt:!1},smith:{valType:"enumerated",values:[!1],dflt:!1},showlegend:{valType:"boolean"},_composedModules:{"*":"Fx"},_nestedModules:{xaxis:"Axes",yaxis:"Axes",scene:"gl3d",geo:"geo",legend:"Legend",annotations:"Annotations",shapes:"Shapes",images:"Images",updatemenus:"UpdateMenus",ternary:"ternary",mapbox:"mapbox"}}},{"../components/color/attributes":266,"../plotly":368,"./font_attributes":389}],404:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}function i(t,e){e.text("");var r=e.append("a").attr({"xlink:xlink:href":"#","class":"link--impt link--embedview","font-weight":"bold"}).text(t._context.linkText+" "+String.fromCharCode(187));if(t._context.sendData)r.on("click",function(){d.sendDataToCloud(t)});else{var n=window.location.pathname.split("/"),i=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+i})}}function o(t,e){for(var r=f.isPlainObject,n=Array.isArray,i=Object.keys(e),a=0;a=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),r.attr(o);var a=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&i(t,a),s.text(a.text()&&u.text()?" - ":"")},d.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=d.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},d.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},i=t.layout||{},a=t._fullData||[],s=t._fullData=[],l=t.data||[];d.supplyLayoutGlobalDefaults(i,n),n._dataLength=l.length,d.supplyDataDefaults(l,s,n),n._has=d._hasPlotType.bind(n);var u=n._modules;for(e=0;eo&&(e=(r-1)/(i.l+i.r),i.l=Math.floor(e*i.l),i.r=Math.floor(e*i.r)),0>a&&(e=(n-1)/(i.t+i.b),i.t=Math.floor(e*i.t),i.b=Math.floor(e*i.b))}},d.autoMargin=function(t,e,r){var n=t._fullLayout;if(n._pushmargin||(n._pushmargin={}),n.margin.autoexpand!==!1){if(r){var i=void 0===r.pad?12:r.pad;r.l+r.r>.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||d.doAutoMargin(t)}},d.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),a=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;return e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:o},t:{val:1,size:a},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+o&&(i=p,o=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+a&&(s=y,a=b)}}})})),r.l=Math.round(i),r.r=Math.round(o),r.t=Math.round(a),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,t._replotting||"{}"===n||n===JSON.stringify(e._size)?void 0:c.plot(t)},d.graphJson=function(t,e,r,n,i){function o(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=o(t[e])}return i}return Array.isArray(t)?t.map(o):t&&t.getTime?f.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&d.supplyDefaults(t);var a=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(a||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(l.layout=o(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)}},{"../components/color":267,"../lib":348,"../plotly":368,"./attributes":369,"./font_attributes":389,"./layout_attributes":403,d3:100,"fast-isnumeric":104}],405:[function(t,e,r){"use strict";var n=t("../../traces/scatter/attributes"),i=n.marker;e.exports={r:n.r,t:n.t,marker:{color:i.color,size:i.size,symbol:i.symbol,opacity:i.opacity}}},{"../../traces/scatter/attributes":425}],406:[function(t,e,r){"use strict";function n(t,e){var r={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,r)}var i=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,a=o({},i.domain,{});e.exports={radialaxis:n("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:a,orientation:{valType:"number"}}),angularaxis:n("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:a}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":345,"../cartesian/layout_attributes":380}],407:[function(t,e,r){var n=t("../../plotly"),i=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},a=n.Lib.extendDeepAll;o.Axis=function(){function t(t){r=t||r;var u=l.data,f=l.layout;return("string"==typeof r||r.nodeName)&&(r=i.select(r)),r.datum(u).each(function(t,r){function l(t,e){return s(t)%360+f.orientation}var u=t.slice();c={data:o.util.cloneJson(u),layout:o.util.cloneJson(f)};var h=0;u.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[h],h=(h+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:i.rgb(t.color).darker().toString()),c.data[e].color=t.color,c.data[e].strokeColor=t.strokeColor,c.data[e].strokeDash=t.strokeDash,c.data[e].strokeSize=t.strokeSize});var d=u.filter(function(t,e){var r=t.visible;return"undefined"==typeof r||r===!0}),p=!1,g=d.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var v=i.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(g),m=[],y=v.map(function(t,e){if("unstacked"===t.key)return t.values;var r=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,n){t.yStack=[r],m.push(r),r=o.util.sumArrays(t.r,r)}),t.values});d=i.merge(y)}d.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var b=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2; b=Math.max(10,b);var x,_=[f.margin.left+b,f.margin.top+b];if(p){var w=i.max(o.util.sumArrays(o.util.arrayLast(d).r[0],o.util.arrayLast(m)));x=[0,w]}else x=i.extent(o.util.flattenArray(d.map(function(t,e){return t.r})));f.radialAxis.domain!=o.DATAEXTENT&&(x[0]=0),n=i.scale.linear().domain(f.radialAxis.domain!=o.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:x).range([0,b]),c.layout.radialAxis.domain=n.domain();var A,M=o.util.flattenArray(d.map(function(t,e){return t.t})),k="string"==typeof M[0];k&&(M=o.util.deduplicate(M),A=M.slice(),M=i.range(M.length),d=d.map(function(t,e){var r=t;return t.t=[M],p&&(r.yStack=t.yStack),r}));var T=d.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===d.length,E=null===f.needsEndSpacing?k||!T:f.needsEndSpacing,L=f.angularAxis.domain&&f.angularAxis.domain!=o.DATAEXTENT&&!k&&f.angularAxis.domain[0]>=0,S=L?f.angularAxis.domain:i.extent(M),C=Math.abs(M[1]-M[0]);T&&!k&&(C=0);var P=S.slice();E&&k&&(P[1]+=C);var R=f.angularAxis.ticksCount||4;R>8&&(R=R/(R/8)+R%8),f.angularAxis.ticksStep&&(R=(P[1]-P[0])/R);var N=f.angularAxis.ticksStep||(P[1]-P[0])/(R*(f.minorTicks+1));A&&(N=Math.max(Math.round(N),1)),P[2]||(P[2]=N);var z=i.range.apply(this,P);if(z=z.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=i.scale.linear().domain(P.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=i.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var I="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",O=(new DOMParser).parseFromString(I,"application/xml"),j=this.appendChild(this.ownerDocument.importNode(O.documentElement,!0));e=i.select(j)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var D,F=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){D=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:D,elements:V,reverseOrder:f.legend.reverseOrder})})();var q=D.node().getBBox();b=Math.min(f.width-q.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],n.range([0,b]),c.layout.radialAxis.domain=n.domain(),D.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else D=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(f.width-(f.margin.left+f.margin.right+2*b+(q?q.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(H[0]=Math.max(0,H[0]),H[1]=Math.max(0,H[1]),e.select(".outer-group").attr("transform","translate("+H+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(n.ticks(5));W.enter().append("circle").attr({"class":"grid-circle"}).style(B),W.attr("r",n),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(B);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=i.svg.axis().scale(n).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(B),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(z),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?270>r&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(180>=r&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=i.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));D.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=n,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=i.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),ot=[];it.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var at,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!k){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;at=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(at)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=n.invert(o.util.getMousePos(Z).radius);var i=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var n=i.select(this),a=n.style("fill"),s="black",l=n.style("opacity")||1;if(n.attr({"data-opacity":l}),"none"!=a){n.attr({"data-fill":a}),s=i.hsl(a).darker().toString(),n.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-H[0]-h.left,f.top+f.height/2-H[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=n.style("stroke"),n.attr({"data-stroke":a}),s=i.hsl(a).darker().toString(),n.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=i.event.which?!1:void(i.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.hide();var r=i.select(this),n=r.attr("data-fill");n?r.style({fill:n,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),h}var e,r,n,s,l={data:[],layout:{}},u={},c={},f=i.dispatch("hover"),h={};return h.render=function(e){return t(e),this},h.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return n},h.angularScale=function(t){return s},h.svg=function(){return e},i.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:i.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,n=i.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return n},o.util.dataFromEquation=function(t,e,r){var n=e||6,o=[],a=[];i.range(0,360+n,n).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);o.push(e),a.push(i)});var s={t:o,r:a};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return i.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return i.zip(t,e).map(function(t,e){return i.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=i.mouse(t.node()),r=e[0],n=e[1],o={};return o.x=r,o.y=n,o.pos=e,o.angle=180*(Math.atan2(n,r)+Math.PI)/Math.PI,o.radius=Math.sqrt(r*r+n*n),o},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,o=t.length;o>i;i++)e=t[i],e in r?(r[e]++,n[e]=r[e]):r[e]=1;return n},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,r,n){if(n){var i=r.slice();r=e,e=i}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,r,n){return"undefined"!=typeof t?(n===e.length-1&&delete t[r],t[r]):void 0},t),r.reduce(function(t,e,n){return"undefined"==typeof t[e]&&(t[e]={}),n===r.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=r[0].geometryConfig,e=t.container;"string"==typeof e&&(e=i.select(e)),e.datum(r).each(function(e,r){function n(e,r){var n=t.radialScale(e[1]),i=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:n,t:i}}function o(t){var e=t.r*Math.cos(t.t),r=t.r*Math.sin(t.t);return{x:e,y:r}}var a=!!e[0].data.yStack,l=e.map(function(t,e){return a?i.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):i.zip(t.data.t[0],t.data.r[0])}),u=t.angularScale,c=t.radialScale.domain()[0],f={};f.bar=function(r,n,o){var a=e[o].data,s=t.radialScale(r[1])-t.radialScale(0),l=t.radialScale(r[2]||0),c=a.barWidth;i.select(this).attr({"class":"mark bar",d:"M"+[[s+l,-c/2],[s+l,c/2],[l,c/2],[l,-c/2]].join("L")+"Z",transform:function(e,r){return"rotate("+(t.orientation+u(e[0]))+")"}})},f.dot=function(t,r,a){var s=t[2]?[t[0],t[1]+t[2]]:t,l=i.svg.symbol().size(e[a].data.dotSize).type(e[a].data.dotType)(t,r);i.select(this).attr({"class":"mark dot",d:l,transform:function(t,e){var r=o(n(s));return"translate("+[r.x,r.y]+")"}})};var h=i.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(r,n,o){var a=r[2]?l[o].map(function(t,e){return[t[0],t[1]+t[2]]}):l[o];if(i.select(this).each(f.dot).style({opacity:function(t,r){return+e[o].data.dotVisible},fill:v.stroke(r,n,o)}).attr({"class":"mark dot"}),!(n>0)){var s=i.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({"class":"line",d:h(a),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,n,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,n,o)},"stroke-width":function(t,e){return v["stroke-width"](r,n,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,n,o)},opacity:function(t,e){return v.opacity(r,n,o)},display:function(t,e){return v.display(r,n,o)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=i.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,n){i.select(this).attr({"class":"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=i.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({"class":"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],n=i.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},i.rebind(t,n,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:i.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,n=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=i.merge(n);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=i.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=i.range(o.length),v=i.scale[c?"linear":"ordinal"]().domain(g).range(l),m=i.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=i.svg.symbolTypes.indexOf(t)?i.svg.symbol().type(t).size(r)():i.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=i.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=i.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},i.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,n={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=n.container.selectAll("g."+s).data([0]);var i=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return r=i.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=i.append("text").attr({dx:n.padding+l,dy:.3*+n.fontSize}),u};return u.text=function(o){var a=i.hsl(n.color).l,s=a>=.5?"#aaa":"white",c=a>=.5?"black":"white",f=o||"";e.style({fill:c,"font-size":n.fontSize+"px"}).text(f);var h=n.padding,d=e.node().getBBox(),p={fill:n.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[n.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u):void 0},u.hide=function(){return t?(t.style({display:"none"}),u):void 0},u.show=function(){return t?(t.style({display:"block"}),u):void 0},u.config=function(t){return a(n,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var n=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var i=n.indexOf(t.geometry);-1!=i&&(r.data[e].groupId=i)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};i.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../plotly":368,"./micropolar_manager":408,d3:100}],408:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("d3"),o=t("./undo_manager"),a=e.exports={},s=n.Lib.extendDeepAll;a.framework=function(t){function e(e,o){return o&&(f=o),i.select(i.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?s(r,e):e,u||(u=n.micropolar.Axis()),c=n.micropolar.adapter.plotly().convert(r),u.config(c).render(f),t.data=r.data,t.layout=r.layout,a.fillLayout(t),r}var r,l,u,c,f,h=new o;return e.isPolar=!0,e.svg=function(){return u.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return n.micropolar.adapter.plotly().convert(u.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:u.angularScale(),r:u.radialScale()}},e.setUndoPoint=function(){var t=this,e=n.micropolar.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,l),l=n.micropolar.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},a.fillLayout=function(t){var e=i.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),a={width:800,height:600,paper_bgcolor:n.Color.background,_container:e,_paperdiv:r,_paper:o};t._fullLayout=s(a,t.layout)}},{"../../plotly":368,"./undo_manager":409,d3:100}],409:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return ng;g++){var v=d[g];s=t[v]?t[v]:t[v]={},e[v]=l={},a("domain."+h,[g/p,(g+1)/p]),a("domain."+{x:"y",y:"x"}[h]),o.id=v,f(s,l,a,o)}}},{"../lib":348,"./plots":404}],411:[function(t,e,r){"use strict";function n(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function i(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),a=o.Lib.extendFlat,s=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,l=t.data,u=t.layout,c=s([],l),f=s({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r0)s=f(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=o(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=o(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":360,"alpha-shape":28,"convex-hull":90,"delaunay-triangulate":101,"gl-mesh3d":133,tinycolor2:239}],421:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),o=t("./attributes");e.exports=function(t,e,r,a){function s(r,i){return n.coerce(t,e,o,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;ep&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(a.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(a.hasMarkers(e)||a.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;p>u;u++)x[u]=n(h[u])&&n(d[u])?{x:h[u],y:d[u]}:{x:!1,y:!1};return void 0!==typeof l&&o.mergeArray(l,x,"ms"),t.firstscatter=!1,x}},{"../../lib":348,"../../plots/cartesian/axes":371,"./colorscale_calc":429,"./subtypes":444,"fast-isnumeric":104}],427:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i,o;for(e=0;e=0;i--)if(o=t[i],"scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}},{}],428:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void a.autoMargin(t,c);var f=s(u.colorscale),h=u.color,d=u.cmin,p=u.cmax;i(d)||(d=o.aggNums(Math.min,null,h)),i(p)||(p=o.aggNums(Math.max,null,h));var g=e[0].t.cb=l(t,c);g.fillcolor(n.scale.linear().domain(f.map(function(t){return d+t[0]*(p-d)})).range(f.map(function(t){return t[1]}))).filllevels({start:d,end:p,size:(p-d)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":270,"../../components/colorscale/get_scale":279,"../../lib":348,"../../plots/plots":404,d3:100,"fast-isnumeric":104}],429:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),o.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":274,"../../components/colorscale/has_colorscale":280,"./subtypes":444}],430:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],431:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),o=t("./constants"),a=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,o){return n.coerce(t,e,i,r,o)}var v=s(t,e,g),m=vU!=N>=U&&(C=L[T-1][0],P=L[T][0],S=C+(P-C)*(U-R)/(N-R),j=Math.min(j,S),D=Math.max(D,S));j=Math.max(j,0),D=Math.min(D,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:o.MAXDIST+10,x0:j,x1:D,y0:U,y1:U,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":267,"../../components/errorbars":296,"../../lib":348,"../../plots/cartesian/constants":376,"../../plots/cartesian/graph_interact":378,"./get_trace_color":433}],435:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":379,"./arrays_to_calcdata":424,"./attributes":425,"./calc":426,"./clean_data":427,"./colorbar":428,"./defaults":431,"./hover":434,"./plot":441,"./select":442,"./style":443,"./subtypes":444}],436:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,a){var s=(t.marker||{}).color;if(a("line.color",r),n(t,"line"))i(t,e,o,a,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||r;a("line.color",l)}a("line.width"),a("line.dash")}},{"../../components/colorscale/defaults":277,"../../components/colorscale/has_colorscale":280}],437:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=A.c2p(t[e].y);return r===L||n===L?!1:[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*k}function o(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var a,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,M=e.connectGaps,k=e.baseTolerance,T=e.linear,E=[],L=n.BADNUM,S=.2,C=new Array(t.length),P=0;for(a=0;ai(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):m>y&&(m=y,c=f,d=!0)}if(d?(C[P++]=u,l!==c&&(C[P++]=c)):(c!==s&&(C[P++]=c),l!==u&&(C[P++]=u)),C[P++]=l,a>=t.length||!f)break;C[P++]=f,s=f}}else C[P++]=u}E.push(C.slice(0,P))}return E}},{"../../plots/cartesian/axes":371}],438:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],439:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t){var e=t.marker,r=e.sizeref||1,i=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/r)}:function(t){return t/r};return function(t){var e=o(t/2);return n(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":104}],440:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),a=t("./subtypes");e.exports=function(t,e,r,s,l){var u,c=a.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&o(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&o(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":267,"../../components/colorscale/defaults":277,"../../components/colorscale/has_colorscale":280,"./subtypes":444}],441:[function(t,e,r){"use strict";function n(t,e,r){var n=e.x(),o=e.y(),a=i.extent(n.range.map(n.l2c)),s=i.extent(o.range.map(o.l2c));r.forEach(function(t,e){var n=t[0].trace;if(u.hasMarkers(n)){var i=n.marker.maxdisplayed;if(0!==i){var o=t.filter(function(t){return t.x>=a[0]&&t.x<=a[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(o.length/i),c=0;r.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&e>r&&c++});var f=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+f)%l)&&(t.vis=!0)})}}})}var i=t("d3"),o=t("../../lib"),a=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,r){function h(t){return t.filter(function(t){return t.vis})}n(t,e,r);var d=e.x(),p=e.y(),g=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(r);g.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),g.call(s.plot,e);var v,m,y,b,x="",_=[];g.each(function(t){var e=t[0].trace,r=e.line,n=i.select(this);if(e.visible===!0&&(m=e.fill.charAt(e.fill.length-1),"x"!==m&&"y"!==m&&(m=""),t[0].node3=n,c(t),u.hasLines(e)||"none"!==e.fill)){var o,s,h,g,w,A="",M="";v="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!x?n.append("path").classed("js-fill",!0):null,b&&(y=b.datum(t)),b=n.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(r.shape)?(h=a.steps(r.shape),g=a.steps(r.shape.split("").reverse().join(""))):h=g="spline"===r.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?a.smoothclosed(t.slice(1),r.smoothing):a.smoothopen(t,r.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return g(t.reverse())};var k,T=f(t,{xaxis:d,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(r.width||1,3)/4,linear:"linear"===r.shape}),E=e._polygons=new Array(T.length);for(k=0;k1&&n.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}v?L&&C&&(m?("y"===m?L[1]=C[1]=p.c2p(0,!0):"x"===m&&(L[0]=C[0]=d.c2p(0,!0)),v.attr("d",A+"L"+C+"L"+L+"Z")):v.attr("d",A+"Z")):"tonext"===e.fill.substr(0,6)&&A&&x&&("tonext"===e.fill?y.attr("d",A+"Z"+x+"Z"):y.attr("d",A+"L"+x.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),x=M,_=E}}}),g.selectAll("path:not([d])").remove(),g.append("g").attr("class","points").each(function(t){var e=t[0].trace,r=i.select(this),n=u.hasMarkers(e),s=u.hasText(e);!n&&!s||e.visible!==!0?r.remove():(n&&r.selectAll("path.point").data(e.marker.maxdisplayed?h:o.identity).enter().append("path").classed("point",!0).call(a.translatePoints,d,p),s&&r.selectAll("g").data(e.marker.maxdisplayed?h:o.identity).enter().append("g").append("text").call(a.translatePoints,d,p))})}},{"../../components/drawing":290,"../../components/errorbars":296,"../../lib":348,"../../lib/polygon":354,"./arrays_to_calcdata":424,"./line_points":437,"./subtypes":444,d3:100}],442:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,o,a,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;rs;s++){for(var l=[[0,0,0],[0,0,0]],u=0;3>u;u++)if(r[u])for(var c=0;2>c;c++)l[c][u]=r[u][s][c];a[s]=l}return a}var a=t("../../components/errorbars/compute_error");e.exports=o},{"../../components/errorbars/compute_error":294}],450:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.linePlot=null,this.scatterPlot=null,this.errorBars=null,this.textMarkers=null,this.delaunayMesh=null,this.color=null,this.mode="",this.dataPoints=[],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.textLabels=null,this.data=null}function i(t,e,r){var n,i=(r+1)%3,o=(r+2)%3,a=[],s=[];for(n=0;ni;i++){var o=t[i];o&&o.copy_zstyle!==!1&&(o=t[2]),o&&(e[i]=o.width/2,r[i]=b(o.color),n=o.thickness)}return{capSize:e,color:r,lineWidth:n}}function a(t){var e=[0,0];return Array.isArray(t)?[0,-1]:(t.indexOf("bottom")>=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return A[t]}function u(t,e,r,n,i){var o=null;if(Array.isArray(t)){o=[];for(var a=0;e>a;a++)void 0===t[a]?o[a]=n:o[a]=r(t[a],i)}else o=r(t,y.identity);return o}function c(t,e){var r,n,i,c,f,h,d=[],p=t.fullSceneLayout,g=t.dataScale,v=p.xaxis,m=p.yaxis,w=p.zaxis,A=e.marker,k=e.line,T=e.x||[],E=e.y||[],L=e.z||[],S=T.length;for(n=0;S>n;n++)i=v.d2l(T[n])*g[0],c=m.d2l(E[n])*g[1],f=w.d2l(L[n])*g[2],d[n]=[i,c,f];if(Array.isArray(e.text))h=e.text;else if(void 0!==e.text)for(h=new Array(S), diff --git a/dist/plotly-mapbox.js b/dist/plotly-mapbox.js index 035e6e351b5..c483d563098 100644 --- a/dist/plotly-mapbox.js +++ b/dist/plotly-mapbox.js @@ -1,5 +1,5 @@ /** -* plotly.js (mapbox) v1.16.2 +* plotly.js (mapbox) v1.16.3 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -68,7 +68,7 @@ for(var selector in rules) { Plotly.Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/plotly":291}],2:[function(require,module,exports){ +},{"../src/plotly":314}],2:[function(require,module,exports){ 'use strict'; module.exports = { @@ -199,7 +199,7 @@ module.exports = { module.exports = require('../src/core'); -},{"../src/core":267}],4:[function(require,module,exports){ +},{"../src/core":290}],4:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -229,368 +229,7 @@ module.exports = Plotly; module.exports = require('../src/traces/scattermapbox'); -},{"../src/traces/scattermapbox":365}],6:[function(require,module,exports){ -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -// when used in node, this will actually load the util module we depend on -// versus loading the builtin util module as happens otherwise -// this is a bug in node module loading as far as I am concerned -var util = require('util/'); - -var pSlice = Array.prototype.slice; -var hasOwn = Object.prototype.hasOwnProperty; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } - else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = stackStartFunction.name; - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function replacer(key, value) { - if (util.isUndefined(value)) { - return '' + value; - } - if (util.isNumber(value) && !isFinite(value)) { - return value.toString(); - } - if (util.isFunction(value) || util.isRegExp(value)) { - return value.toString(); - } - return value; -} - -function truncate(s, n) { - if (util.isString(s)) { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} - -function getMessage(self) { - return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + - self.operator + ' ' + - truncate(JSON.stringify(self.expected, replacer), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (util.isBuffer(actual) && util.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if (!util.isObject(actual) && !util.isObject(expected)) { - return actual == expected; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b) { - if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) - return false; - // an identical 'prototype' property. - if (a.prototype !== b.prototype) return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) { - return a === b; - } - var aIsArgs = isArguments(a), - bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - var ka = objectKeys(a), - kb = objectKeys(b), - key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key])) return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } else if (actual instanceof expected) { - return true; - } else if (expected.call({}, actual) === true) { - return true; - } - - return false; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (util.isString(expected)) { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - if (!shouldThrow && expectedException(actual, expected)) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function(err) { if (err) {throw err;}}; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -},{"util/":12}],7:[function(require,module,exports){ +},{"../src/traces/scattermapbox":388}],6:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -890,7 +529,7 @@ function isUndefined(arg) { return arg === void 0; } -},{}],8:[function(require,module,exports){ +},{}],7:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -915,7 +554,7 @@ if (typeof Object.create === 'function') { } } -},{}],9:[function(require,module,exports){ +},{}],8:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -1143,7 +782,7 @@ var substr = 'ab'.substr(-1) === 'b' ; }).call(this,require('_process')) -},{"_process":10}],10:[function(require,module,exports){ +},{"_process":9}],9:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -1236,14 +875,1482 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; +},{}],10:[function(require,module,exports){ +(function (global){ +/*! https://mths.be/punycode v1.4.0 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.3.2', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],11:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +},{}],12:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; + +},{}],13:[function(require,module,exports){ +'use strict'; + +exports.decode = exports.parse = require('./decode'); +exports.encode = exports.stringify = require('./encode'); + +},{"./decode":11,"./encode":12}],14:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var punycode = require('punycode'); +var util = require('./util'); + +exports.parse = urlParse; +exports.resolve = urlResolve; +exports.resolveObject = urlResolveObject; +exports.format = urlFormat; + +exports.Url = Url; + +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; +} + +// Reference: RFC 3986, RFC 1808, RFC 2396 + +// define these here so at least they only have to be +// compiled once on the first module load. +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = require('querystring'); + +function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) return url; + + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; +} + +Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + hostEnd = rest.length; + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) continue; + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) this.pathname = rest; + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; +}; + +// format a parsed object into a url string +function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) obj = urlParse(obj); + if (!(obj instanceof Url)) return Url.prototype.format.call(obj); + return obj.format(); +} + +Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') protocol += ':'; + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') hash = '#' + hash; + if (search && search.charAt(0) !== '?') search = '?' + search; + + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; +}; + +function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); +} + +Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); +}; + +function urlResolveObject(source, relative) { + if (!source) return relative; + return urlParse(source, false, true).resolveObject(relative); +} + +Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + result[rkey] = relative[rkey]; + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())); + if (!relative.host) relative.host = ''; + if (!relative.hostname) relative.hostname = ''; + if (relPath[0] !== '') relPath.unshift(''); + if (relPath.length < 2) relPath.unshift(''); + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') srcPath[0] = result.host; + else srcPath.unshift(result.host); + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') relPath[0] = relative.host; + else relPath.unshift(relative.host); + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; +}; + +Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) this.hostname = host; +}; + +},{"./util":15,"punycode":10,"querystring":13}],15:[function(require,module,exports){ +'use strict'; + +module.exports = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; + } +}; + +},{}],16:[function(require,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],12:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -1833,7 +2940,7 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":11,"_process":10,"inherits":8}],13:[function(require,module,exports){ +},{"./support/isBuffer":16,"_process":9,"inherits":7}],18:[function(require,module,exports){ !function() { var d3 = { version: "3.5.16" @@ -11388,7 +12495,7 @@ function hasOwnProperty(obj, prop) { }); if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; }(); -},{}],14:[function(require,module,exports){ +},{}],19:[function(require,module,exports){ (function (process,global){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. @@ -12346,7 +13453,7 @@ function hasOwnProperty(obj, prop) { }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":10}],15:[function(require,module,exports){ +},{"_process":9}],20:[function(require,module,exports){ /** * inspired by is-number * but significantly simplified and sped up by ignoring number and string constructors @@ -12403,7 +13510,7 @@ module.exports = function(n) { return n - n < 1; }; -},{}],16:[function(require,module,exports){ +},{}],21:[function(require,module,exports){ module.exports = fromQuat; /** @@ -12451,24 +13558,73 @@ function fromQuat(out, q) { return out; }; -},{}],17:[function(require,module,exports){ +},{}],22:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +module.exports = ArrayGroup; +function ArrayGroup(arrayTypes) { + var LayoutVertexArrayType = arrayTypes.layoutVertexArrayType; + this.layoutVertexArray = new LayoutVertexArrayType(); + var ElementArrayType = arrayTypes.elementArrayType; + if (ElementArrayType) + this.elementArray = new ElementArrayType(); + var ElementArrayType2 = arrayTypes.elementArrayType2; + if (ElementArrayType2) + this.elementArray2 = new ElementArrayType2(); + this.paintVertexArrays = util.mapObject(arrayTypes.paintVertexArrayTypes, function (PaintVertexArrayType) { + return new PaintVertexArrayType(); + }); +} +ArrayGroup.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1; +ArrayGroup.prototype.hasCapacityFor = function (numVertices) { + return this.layoutVertexArray.length + numVertices <= ArrayGroup.MAX_VERTEX_ARRAY_LENGTH; +}; +ArrayGroup.prototype.isEmpty = function () { + return this.layoutVertexArray.length === 0; +}; +ArrayGroup.prototype.trim = function () { + this.layoutVertexArray.trim(); + if (this.elementArray) { + this.elementArray.trim(); + } + if (this.elementArray2) { + this.elementArray2.trim(); + } + for (var layerName in this.paintVertexArrays) { + this.paintVertexArrays[layerName].trim(); + } +}; +ArrayGroup.prototype.serialize = function () { + return { + layoutVertexArray: this.layoutVertexArray.serialize(), + elementArray: this.elementArray && this.elementArray.serialize(), + elementArray2: this.elementArray2 && this.elementArray2.serialize(), + paintVertexArrays: util.mapObject(this.paintVertexArrays, function (array) { + return array.serialize(); + }) + }; +}; +ArrayGroup.prototype.getTransferables = function (transferables) { + transferables.push(this.layoutVertexArray.arrayBuffer); + if (this.elementArray) { + transferables.push(this.elementArray.arrayBuffer); + } + if (this.elementArray2) { + transferables.push(this.elementArray2.arrayBuffer); + } + for (var layerName in this.paintVertexArrays) { + transferables.push(this.paintVertexArrays[layerName].arrayBuffer); + } +}; +},{"../util/util":136}],23:[function(require,module,exports){ 'use strict'; - var featureFilter = require('feature-filter'); -var Buffer = require('./buffer'); +var ArrayGroup = require('./array_group'); +var BufferGroup = require('./buffer_group'); var util = require('../util/util'); var StructArrayType = require('../util/struct_array'); -var VertexArrayObject = require('../render/vertex_array_object'); - module.exports = Bucket; - -/** - * Instantiate the appropriate subclass of `Bucket` for `options`. - * @private - * @param options See `Bucket` constructor options - * @returns {Bucket} - */ -Bucket.create = function(options) { +Bucket.create = function (options) { var Classes = { fill: require('./bucket/fill_bucket'), line: require('./bucket/line_bucket'), @@ -12477,47 +13633,12 @@ Bucket.create = function(options) { }; return new Classes[options.layer.type](options); }; - - -/** - * The maximum extent of a feature that can be safely stored in the buffer. - * In practice, all features are converted to this extent before being added. - * - * Positions are stored as signed 16bit integers. - * One bit is lost for signedness to support featuers extending past the left edge of the tile. - * One bit is lost because the line vertex buffer packs 1 bit of other data into the int. - * One bit is lost to support features extending past the extent on the right edge of the tile. - * This leaves us with 2^13 = 8192 - * - * @private - * @readonly - */ Bucket.EXTENT = 8192; - -/** - * The `Bucket` class is the single point of knowledge about turning vector - * tiles into WebGL buffers. - * - * `Bucket` is an abstract class. A subclass exists for each Mapbox GL - * style spec layer type. Because `Bucket` is an abstract class, - * instances should be created via the `Bucket.create` method. - * - * @class Bucket - * @private - * @param options - * @param {number} options.zoom Zoom level of the buffers being built. May be - * a fractional zoom level. - * @param options.layer A Mapbox GL style layer object - * @param {Object.} options.buffers The set of `Buffer`s being - * built for this tile. This object facilitates sharing of `Buffer`s be - between `Bucket`s. - */ function Bucket(options) { this.zoom = options.zoom; this.overscaling = options.overscaling; this.layer = options.layer; this.childLayers = options.childLayers; - this.type = this.layer.type; this.features = []; this.id = this.layer.id; @@ -12526,172 +13647,94 @@ function Bucket(options) { this.sourceLayerIndex = options.sourceLayerIndex; this.minZoom = this.layer.minzoom; this.maxZoom = this.layer.maxzoom; - this.paintAttributes = createPaintAttributes(this); - if (options.arrays) { - var childLayers = this.childLayers; - this.bufferGroups = util.mapObject(options.arrays, function(programArrayGroups, programName) { - return programArrayGroups.map(function(programArrayGroup) { - - var group = util.mapObject(programArrayGroup, function(arrays, layoutOrPaint) { - return util.mapObject(arrays, function(array, name) { - var arrayType = options.arrayTypes[programName][layoutOrPaint][name]; - var type = (arrayType.members.length && arrayType.members[0].name === 'vertices' ? Buffer.BufferType.ELEMENT : Buffer.BufferType.VERTEX); - return new Buffer(array, arrayType, type); - }); + var programInterfaces = this.programInterfaces; + this.bufferGroups = util.mapObject(options.arrays, function (programArrayGroups, programName) { + var programInterface = programInterfaces[programName]; + var paintVertexArrayTypes = options.paintVertexArrayTypes[programName]; + return programArrayGroups.map(function (arrayGroup) { + return new BufferGroup(arrayGroup, { + layoutVertexArrayType: programInterface.layoutVertexArrayType.serialize(), + elementArrayType: programInterface.elementArrayType && programInterface.elementArrayType.serialize(), + elementArrayType2: programInterface.elementArrayType2 && programInterface.elementArrayType2.serialize(), + paintVertexArrayTypes: paintVertexArrayTypes }); - - group.vaos = {}; - if (group.layout.element2) group.secondVaos = {}; - for (var l = 0; l < childLayers.length; l++) { - var layerName = childLayers[l].id; - group.vaos[layerName] = new VertexArrayObject(); - if (group.layout.element2) group.secondVaos[layerName] = new VertexArrayObject(); - } - - return group; }); }); } } - -/** - * Build the buffers! Features are set directly to the `features` property. - * @private - */ -Bucket.prototype.populateBuffers = function() { +Bucket.prototype.populateArrays = function () { this.createArrays(); this.recalculateStyleLayers(); - for (var i = 0; i < this.features.length; i++) { this.addFeature(this.features[i]); } - this.trimArrays(); }; - -/** - * Check if there is enough space available in the current element group for - * `vertexLength` vertices. If not, append a new elementGroup. Should be called - * by `populateBuffers` and its callees. - * @private - * @param {string} programName the name of the program associated with the buffer that will receive the vertices - * @param {number} vertexLength The number of vertices that will be inserted to the buffer. - */ -Bucket.prototype.makeRoomFor = function(programName, numVertices) { +Bucket.prototype.prepareArrayGroup = function (programName, numVertices) { var groups = this.arrayGroups[programName]; var currentGroup = groups.length && groups[groups.length - 1]; - - if (!currentGroup || currentGroup.layout.vertex.length + numVertices > 65535) { - - var arrayTypes = this.arrayTypes[programName]; - var VertexArrayType = arrayTypes.layout.vertex; - var ElementArrayType = arrayTypes.layout.element; - var ElementArrayType2 = arrayTypes.layout.element2; - - currentGroup = { - index: groups.length, - layout: {}, - paint: {} - }; - - currentGroup.layout.vertex = new VertexArrayType(); - if (ElementArrayType) currentGroup.layout.element = new ElementArrayType(); - if (ElementArrayType2) currentGroup.layout.element2 = new ElementArrayType2(); - - for (var i = 0; i < this.childLayers.length; i++) { - var layerName = this.childLayers[i].id; - var PaintVertexArrayType = arrayTypes.paint[layerName]; - currentGroup.paint[layerName] = new PaintVertexArrayType(); - } - + if (!currentGroup || !currentGroup.hasCapacityFor(numVertices)) { + currentGroup = new ArrayGroup({ + layoutVertexArrayType: this.programInterfaces[programName].layoutVertexArrayType, + elementArrayType: this.programInterfaces[programName].elementArrayType, + elementArrayType2: this.programInterfaces[programName].elementArrayType2, + paintVertexArrayTypes: this.paintVertexArrayTypes[programName] + }); + currentGroup.index = groups.length; groups.push(currentGroup); } - return currentGroup; }; - -/** - * Start using a new shared `buffers` object and recreate instances of `Buffer` - * as necessary. - * @private - */ -Bucket.prototype.createArrays = function() { +Bucket.prototype.createArrays = function () { this.arrayGroups = {}; - this.arrayTypes = {}; - + this.paintVertexArrayTypes = {}; for (var programName in this.programInterfaces) { - var programInterface = this.programInterfaces[programName]; - var programArrayTypes = this.arrayTypes[programName] = { layout: {}, paint: {} }; this.arrayGroups[programName] = []; - - if (programInterface.vertexBuffer) { - var VertexArrayType = new StructArrayType({ - members: this.programInterfaces[programName].layoutAttributes, - alignment: Buffer.VERTEX_ATTRIBUTE_ALIGNMENT - }); - - programArrayTypes.layout.vertex = VertexArrayType; - - var layerPaintAttributes = this.paintAttributes[programName]; - for (var layerName in layerPaintAttributes) { - var PaintVertexArrayType = new StructArrayType({ - members: layerPaintAttributes[layerName].attributes, - alignment: Buffer.VERTEX_ATTRIBUTE_ALIGNMENT - }); - - programArrayTypes.paint[layerName] = PaintVertexArrayType; - } - } - - if (programInterface.elementBuffer) { - var ElementArrayType = createElementBufferType(programInterface.elementBufferComponents); - programArrayTypes.layout.element = ElementArrayType; - } - - if (programInterface.elementBuffer2) { - var ElementArrayType2 = createElementBufferType(programInterface.elementBuffer2Components); - programArrayTypes.layout.element2 = ElementArrayType2; + var paintVertexArrayTypes = this.paintVertexArrayTypes[programName] = {}; + var layerPaintAttributes = this.paintAttributes[programName]; + for (var layerName in layerPaintAttributes) { + paintVertexArrayTypes[layerName] = new Bucket.VertexArrayType(layerPaintAttributes[layerName].attributes); } } }; - -Bucket.prototype.destroy = function(gl) { +Bucket.prototype.destroy = function (gl) { for (var programName in this.bufferGroups) { var programBufferGroups = this.bufferGroups[programName]; for (var i = 0; i < programBufferGroups.length; i++) { - var programBuffers = programBufferGroups[i]; - for (var paintBuffer in programBuffers.paint) { - programBuffers.paint[paintBuffer].destroy(gl); - } - for (var layoutBuffer in programBuffers.layout) { - programBuffers.layout[layoutBuffer].destroy(gl); - } - for (var j in programBuffers.vaos) { - programBuffers.vaos[j].destroy(gl); - } - for (var k in programBuffers.secondVaos) { - programBuffers.secondVaos[k].destroy(gl); - } + programBufferGroups[i].destroy(gl); } } - }; - -Bucket.prototype.trimArrays = function() { +Bucket.prototype.trimArrays = function () { + for (var programName in this.arrayGroups) { + var arrayGroups = this.arrayGroups[programName]; + for (var i = 0; i < arrayGroups.length; i++) { + arrayGroups[i].trim(); + } + } +}; +Bucket.prototype.isEmpty = function () { for (var programName in this.arrayGroups) { - var programArrays = this.arrayGroups[programName]; - for (var paintArray in programArrays.paint) { - programArrays.paint[paintArray].trim(); + var arrayGroups = this.arrayGroups[programName]; + for (var i = 0; i < arrayGroups.length; i++) { + if (!arrayGroups[i].isEmpty()) { + return false; + } } - for (var layoutArray in programArrays.layout) { - programArrays.layout[layoutArray].trim(); + } + return true; +}; +Bucket.prototype.getTransferables = function (transferables) { + for (var programName in this.arrayGroups) { + var arrayGroups = this.arrayGroups[programName]; + for (var i = 0; i < arrayGroups.length; i++) { + arrayGroups[i].getTransferables(transferables); } } }; - -Bucket.prototype.setUniforms = function(gl, programName, program, layer, globalProperties) { +Bucket.prototype.setUniforms = function (gl, programName, program, layer, globalProperties) { var uniforms = this.paintAttributes[programName][layer.id].uniforms; for (var i = 0; i < uniforms.length; i++) { var uniform = uniforms[i]; @@ -12699,79 +13742,60 @@ Bucket.prototype.setUniforms = function(gl, programName, program, layer, globalP gl['uniform' + uniform.components + 'fv'](uniformLocation, uniform.getValue(layer, globalProperties)); } }; - -Bucket.prototype.serialize = function() { +Bucket.prototype.serialize = function () { return { layerId: this.layer.id, zoom: this.zoom, - arrays: util.mapObject(this.arrayGroups, function(programArrayGroups) { - return programArrayGroups.map(function(arrayGroup) { - return util.mapObject(arrayGroup, function(arrays) { - return util.mapObject(arrays, function(array) { - return array.serialize(); - }); - }); + arrays: util.mapObject(this.arrayGroups, function (programArrayGroups) { + return programArrayGroups.map(function (arrayGroup) { + return arrayGroup.serialize(); }); }), - arrayTypes: util.mapObject(this.arrayTypes, function(programArrayTypes) { - return util.mapObject(programArrayTypes, function(arrayTypes) { - return util.mapObject(arrayTypes, function(arrayType) { - return arrayType.serialize(); - }); + paintVertexArrayTypes: util.mapObject(this.paintVertexArrayTypes, function (arrayTypes) { + return util.mapObject(arrayTypes, function (arrayType) { + return arrayType.serialize(); }); }), - - childLayerIds: this.childLayers.map(function(layer) { + childLayerIds: this.childLayers.map(function (layer) { return layer.id; }) }; }; - -Bucket.prototype.createFilter = function() { +Bucket.prototype.createFilter = function () { if (!this.filter) { this.filter = featureFilter(this.layer.filter); } }; - -var FAKE_ZOOM_HISTORY = { lastIntegerZoom: Infinity, lastIntegerZoomTime: 0, lastZoom: 0 }; -Bucket.prototype.recalculateStyleLayers = function() { +var FAKE_ZOOM_HISTORY = { + lastIntegerZoom: Infinity, + lastIntegerZoomTime: 0, + lastZoom: 0 +}; +Bucket.prototype.recalculateStyleLayers = function () { for (var i = 0; i < this.childLayers.length; i++) { this.childLayers[i].recalculate(this.zoom, FAKE_ZOOM_HISTORY); } }; - -Bucket.prototype.getProgramMacros = function(programInterface, layer) { - var macros = []; - var attributes = this.paintAttributes[programInterface][layer.id].attributes; - for (var i = 0; i < attributes.length; i++) { - var attribute = attributes[i]; - macros.push('ATTRIBUTE_' + (attribute.isFunction ? 'ZOOM_FUNCTION_' : '') + attribute.name.toUpperCase()); - } - return macros; -}; - -Bucket.prototype.addPaintAttributes = function(interfaceName, globalProperties, featureProperties, startGroup, startIndex) { +Bucket.prototype.populatePaintArrays = function (interfaceName, globalProperties, featureProperties, startGroup, startIndex) { for (var l = 0; l < this.childLayers.length; l++) { var layer = this.childLayers[l]; var groups = this.arrayGroups[interfaceName]; for (var g = startGroup.index; g < groups.length; g++) { var group = groups[g]; - var length = group.layout.vertex.length; - var vertexArray = group.paint[layer.id]; - vertexArray.resize(length); - + var length = group.layoutVertexArray.length; + var paintArray = group.paintVertexArrays[layer.id]; + paintArray.resize(length); var attributes = this.paintAttributes[interfaceName][layer.id].attributes; for (var m = 0; m < attributes.length; m++) { var attribute = attributes[m]; - var value = attribute.getValue(layer, globalProperties, featureProperties); var multiplier = attribute.multiplier || 1; var components = attribute.components || 1; - - for (var i = startIndex; i < length; i++) { - var vertex = vertexArray.get(i); + var start = g === startGroup.index ? startIndex : 0; + for (var i = start; i < length; i++) { + var vertex = paintArray.get(i); for (var c = 0; c < components; c++) { - var memberName = components > 1 ? (attribute.name + c) : attribute.name; + var memberName = components > 1 ? attribute.name + c : attribute.name; vertex[memberName] = value[c] * multiplier; } } @@ -12779,55 +13803,124 @@ Bucket.prototype.addPaintAttributes = function(interfaceName, globalProperties, } } }; - -function createElementBufferType(components) { +Bucket.VertexArrayType = function (members) { + return new StructArrayType({ + members: members, + alignment: 4 + }); +}; +Bucket.ElementArrayType = function (components) { return new StructArrayType({ members: [{ - type: Buffer.ELEMENT_ATTRIBUTE_TYPE, - name: 'vertices', - components: components || 3 - }] + type: 'Uint16', + name: 'vertices', + components: components || 3 + }] }); -} - +}; function createPaintAttributes(bucket) { var attributes = {}; for (var interfaceName in bucket.programInterfaces) { var layerPaintAttributes = attributes[interfaceName] = {}; - for (var c = 0; c < bucket.childLayers.length; c++) { var childLayer = bucket.childLayers[c]; - layerPaintAttributes[childLayer.id] = { attributes: [], uniforms: [] }; + layerPaintAttributes[childLayer.id] = { + attributes: [], + uniforms: [], + defines: [], + vertexPragmas: { + define: {}, + initialize: {} + }, + fragmentPragmas: { + define: {}, + initialize: {} + } + }; } - var interface_ = bucket.programInterfaces[interfaceName]; - if (!interface_.paintAttributes) continue; + if (!interface_.paintAttributes) + continue; + var attributePrecision = '{precision}'; + var attributeType = '{type}'; for (var i = 0; i < interface_.paintAttributes.length; i++) { var attribute = interface_.paintAttributes[i]; - + attribute.multiplier = attribute.multiplier || 1; for (var j = 0; j < bucket.childLayers.length; j++) { var layer = bucket.childLayers[j]; var paintAttributes = layerPaintAttributes[layer.id]; - + var attributeInputName = attribute.name; + var attributeInnerName = attribute.name.slice(2); + var attributeVaryingDefinition; + paintAttributes.fragmentPragmas.initialize[attributeInnerName] = ''; if (layer.isPaintValueFeatureConstant(attribute.paintProperty)) { paintAttributes.uniforms.push(attribute); + paintAttributes.fragmentPragmas.define[attributeInnerName] = paintAttributes.vertexPragmas.define[attributeInnerName] = [ + 'uniform', + attributePrecision, + attributeType, + attributeInputName + ].join(' ') + ';'; + paintAttributes.fragmentPragmas.initialize[attributeInnerName] = paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributePrecision, + attributeType, + attributeInnerName, + '=', + attributeInputName + ].join(' ') + ';\n'; } else if (layer.isPaintValueZoomConstant(attribute.paintProperty)) { - paintAttributes.attributes.push(attribute); + paintAttributes.attributes.push(util.extend({}, attribute, { name: attributeInputName })); + attributeVaryingDefinition = [ + 'varying', + attributePrecision, + attributeType, + attributeInnerName + ].join(' ') + ';\n'; + var attributeAttributeDefinition = [ + paintAttributes.fragmentPragmas.define[attributeInnerName], + 'attribute', + attributePrecision, + attributeType, + attributeInputName + ].join(' ') + ';\n'; + paintAttributes.fragmentPragmas.define[attributeInnerName] = attributeVaryingDefinition; + paintAttributes.vertexPragmas.define[attributeInnerName] = attributeVaryingDefinition + attributeAttributeDefinition; + paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributeInnerName, + '=', + attributeInputName, + '/', + attribute.multiplier.toFixed(1) + ].join(' ') + ';\n'; } else { - + var tName = 'u_' + attributeInputName.slice(2) + '_t'; var zoomLevels = layer.getPaintValueStopZoomLevels(attribute.paintProperty); - - // Pick the index of the first offset to add to the buffers. - // Find the four closest stops, ideally with two on each side of the zoom level. var numStops = 0; - while (numStops < zoomLevels.length && zoomLevels[numStops] < bucket.zoom) numStops++; + while (numStops < zoomLevels.length && zoomLevels[numStops] < bucket.zoom) + numStops++; var stopOffset = Math.max(0, Math.min(zoomLevels.length - 4, numStops - 2)); - var fourZoomLevels = []; for (var s = 0; s < 4; s++) { fourZoomLevels.push(zoomLevels[Math.min(stopOffset + s, zoomLevels.length - 1)]); } - + attributeVaryingDefinition = [ + 'varying', + attributePrecision, + attributeType, + attributeInnerName + ].join(' ') + ';\n'; + paintAttributes.vertexPragmas.define[attributeInnerName] = attributeVaryingDefinition + [ + 'uniform', + 'lowp', + 'float', + tName + ].join(' ') + ';\n'; + paintAttributes.fragmentPragmas.define[attributeInnerName] = attributeVaryingDefinition; + paintAttributes.uniforms.push(util.extend({}, attribute, { + name: tName, + getValue: createGetUniform(attribute, stopOffset), + components: 1 + })); var components = attribute.components; if (components === 1) { paintAttributes.attributes.push(util.extend({}, attribute, { @@ -12835,35 +13928,54 @@ function createPaintAttributes(bucket) { isFunction: true, components: components * 4 })); + paintAttributes.vertexPragmas.define[attributeInnerName] += [ + 'attribute', + attributePrecision, + 'vec4', + attributeInputName + ].join(' ') + ';\n'; + paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributeInnerName, + '=', + 'evaluate_zoom_function_1(' + attributeInputName + ', ' + tName + ')', + '/', + attribute.multiplier.toFixed(1) + ].join(' ') + ';\n'; } else { + var attributeInputNames = []; for (var k = 0; k < 4; k++) { + attributeInputNames.push(attributeInputName + k); paintAttributes.attributes.push(util.extend({}, attribute, { getValue: createFunctionGetValue(attribute, [fourZoomLevels[k]]), isFunction: true, - name: attribute.name + k + name: attributeInputName + k })); + paintAttributes.vertexPragmas.define[attributeInnerName] += [ + 'attribute', + attributePrecision, + attributeType, + attributeInputName + k + ].join(' ') + ';\n'; } + paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributeInnerName, + ' = ', + 'evaluate_zoom_function_4(' + attributeInputNames.join(', ') + ', ' + tName + ')', + '/', + attribute.multiplier.toFixed(1) + ].join(' ') + ';\n'; } - - paintAttributes.uniforms.push(util.extend({}, attribute, { - name: 'u_' + attribute.name.slice(2) + '_t', - getValue: createGetUniform(attribute, stopOffset), - components: 1 - })); } } } } return attributes; } - function createFunctionGetValue(attribute, stopZoomLevels) { - return function(layer, globalProperties, featureProperties) { + return function (layer, globalProperties, featureProperties) { if (stopZoomLevels.length === 1) { - // return one multi-component value like color0 return attribute.getValue(layer, util.extend({}, globalProperties, { zoom: stopZoomLevels[0] }), featureProperties); } else { - // pack multiple single-component values into a four component attribute var values = []; for (var z = 0; z < stopZoomLevels.length; z++) { var stopZoomLevel = stopZoomLevels[z]; @@ -12873,387 +13985,277 @@ function createFunctionGetValue(attribute, stopZoomLevels) { } }; } - function createGetUniform(attribute, stopOffset) { - return function(layer, globalProperties) { - // stopInterp indicates which stops need to be interpolated. - // If stopInterp is 3.5 then interpolate half way between stops 3 and 4. + return function (layer, globalProperties) { var stopInterp = layer.getPaintInterpolationT(attribute.paintProperty, globalProperties.zoom); - // We can only store four stop values in the buffers. stopOffset is the number of stops that come - // before the stops that were added to the buffers. return [Math.max(0, Math.min(4, stopInterp - stopOffset))]; }; } - -},{"../render/vertex_array_object":43,"../util/struct_array":117,"../util/util":119,"./bucket/circle_bucket":18,"./bucket/fill_bucket":19,"./bucket/line_bucket":20,"./bucket/symbol_bucket":21,"./buffer":22,"feature-filter":122}],18:[function(require,module,exports){ +},{"../util/struct_array":134,"../util/util":136,"./array_group":22,"./bucket/circle_bucket":24,"./bucket/fill_bucket":25,"./bucket/line_bucket":26,"./bucket/symbol_bucket":27,"./buffer_group":29,"feature-filter":140}],24:[function(require,module,exports){ 'use strict'; - var Bucket = require('../bucket'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); var EXTENT = Bucket.EXTENT; - module.exports = CircleBucket; - -/** - * Circles are represented by two triangles. - * - * Each corner has a pos that is the center of the circle and an extrusion - * vector that is where it points. - * @private - */ function CircleBucket() { Bucket.apply(this, arguments); } - CircleBucket.prototype = util.inherit(Bucket, {}); - -CircleBucket.prototype.addCircleVertex = function(vertexArray, x, y, extrudeX, extrudeY) { - return vertexArray.emplaceBack( - (x * 2) + ((extrudeX + 1) / 2), - (y * 2) + ((extrudeY + 1) / 2)); +CircleBucket.prototype.addCircleVertex = function (layoutVertexArray, x, y, extrudeX, extrudeY) { + return layoutVertexArray.emplaceBack(x * 2 + (extrudeX + 1) / 2, y * 2 + (extrudeY + 1) / 2); }; - CircleBucket.prototype.programInterfaces = { circle: { - vertexBuffer: true, - elementBuffer: true, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }], - paintAttributes: [{ - name: 'a_color', - components: 4, - type: 'Uint8', - getValue: function(layer, globalProperties, featureProperties) { - return util.premultiply(layer.getPaintValue("circle-color", globalProperties, featureProperties)); + layoutVertexArrayType: new Bucket.VertexArrayType([{ + name: 'a_pos', + components: 2, + type: 'Int16' + }]), + elementArrayType: new Bucket.ElementArrayType(), + paintAttributes: [ + { + name: 'a_color', + components: 4, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return layer.getPaintValue('circle-color', globalProperties, featureProperties); + }, + multiplier: 255, + paintProperty: 'circle-color' }, - multiplier: 255, - paintProperty: 'circle-color' - }, { - name: 'a_radius', - components: 1, - type: 'Uint16', - isLayerConstant: false, - getValue: function(layer, globalProperties, featureProperties) { - return [layer.getPaintValue("circle-radius", globalProperties, featureProperties)]; + { + name: 'a_radius', + components: 1, + type: 'Uint16', + isLayerConstant: false, + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('circle-radius', globalProperties, featureProperties)]; + }, + multiplier: 10, + paintProperty: 'circle-radius' + }, + { + name: 'a_blur', + components: 1, + type: 'Uint16', + isLayerConstant: false, + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('circle-blur', globalProperties, featureProperties)]; + }, + multiplier: 10, + paintProperty: 'circle-blur' }, - multiplier: 10, - paintProperty: 'circle-radius' - }] + { + name: 'a_opacity', + components: 1, + type: 'Uint16', + isLayerConstant: false, + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('circle-opacity', globalProperties, featureProperties)]; + }, + multiplier: 255, + paintProperty: 'circle-opacity' + } + ] } }; - -CircleBucket.prototype.addFeature = function(feature) { - var globalProperties = {zoom: this.zoom}; +CircleBucket.prototype.addFeature = function (feature) { + var globalProperties = { zoom: this.zoom }; var geometries = loadGeometry(feature); - - var startGroup = this.makeRoomFor('circle', 0); - var startIndex = startGroup.layout.vertex.length; - + var startGroup = this.prepareArrayGroup('circle', 0); + var startIndex = startGroup.layoutVertexArray.length; for (var j = 0; j < geometries.length; j++) { for (var k = 0; k < geometries[j].length; k++) { - var x = geometries[j][k].x; var y = geometries[j][k].y; - - // Do not include points that are outside the tile boundaries. - if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) continue; - - // this geometry will be of the Point type, and we'll derive - // two triangles from it. - // - // ┌─────────┐ - // │ 3 2 │ - // │ │ - // │ 0 1 │ - // └─────────┘ - - var group = this.makeRoomFor('circle', 4); - var vertexArray = group.layout.vertex; - - var index = this.addCircleVertex(vertexArray, x, y, -1, -1); - this.addCircleVertex(vertexArray, x, y, 1, -1); - this.addCircleVertex(vertexArray, x, y, 1, 1); - this.addCircleVertex(vertexArray, x, y, -1, 1); - - group.layout.element.emplaceBack(index, index + 1, index + 2); - group.layout.element.emplaceBack(index, index + 3, index + 2); + if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) + continue; + var group = this.prepareArrayGroup('circle', 4); + var layoutVertexArray = group.layoutVertexArray; + var index = this.addCircleVertex(layoutVertexArray, x, y, -1, -1); + this.addCircleVertex(layoutVertexArray, x, y, 1, -1); + this.addCircleVertex(layoutVertexArray, x, y, 1, 1); + this.addCircleVertex(layoutVertexArray, x, y, -1, 1); + group.elementArray.emplaceBack(index, index + 1, index + 2); + group.elementArray.emplaceBack(index, index + 3, index + 2); } } - - this.addPaintAttributes('circle', globalProperties, feature.properties, startGroup, startIndex); + this.populatePaintArrays('circle', globalProperties, feature.properties, startGroup, startIndex); }; - -},{"../../util/util":119,"../bucket":17,"../load_geometry":24}],19:[function(require,module,exports){ +},{"../../util/util":136,"../bucket":23,"../load_geometry":31}],25:[function(require,module,exports){ 'use strict'; - var Bucket = require('../bucket'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); - +var earcut = require('earcut'); +var classifyRings = require('../../util/classify_rings'); +var EARCUT_MAX_RINGS = 500; module.exports = FillBucket; - function FillBucket() { Bucket.apply(this, arguments); } - FillBucket.prototype = util.inherit(Bucket, {}); - FillBucket.prototype.programInterfaces = { fill: { - vertexBuffer: true, - elementBuffer: true, - elementBuffer2: true, - elementBuffer2Components: 2, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }] + layoutVertexArrayType: new Bucket.VertexArrayType([{ + name: 'a_pos', + components: 2, + type: 'Int16' + }]), + elementArrayType: new Bucket.ElementArrayType(1), + elementArrayType2: new Bucket.ElementArrayType(2), + paintAttributes: [ + { + name: 'a_color', + components: 4, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return layer.getPaintValue('fill-color', globalProperties, featureProperties); + }, + multiplier: 255, + paintProperty: 'fill-color' + }, + { + name: 'a_outline_color', + components: 4, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return layer.getPaintValue('fill-outline-color', globalProperties, featureProperties); + }, + multiplier: 255, + paintProperty: 'fill-outline-color' + }, + { + name: 'a_opacity', + components: 1, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('fill-opacity', globalProperties, featureProperties)]; + }, + multiplier: 255, + paintProperty: 'fill-opacity' + } + ] } }; - -FillBucket.prototype.addFeature = function(feature) { +FillBucket.prototype.addFeature = function (feature) { var lines = loadGeometry(feature); - for (var i = 0; i < lines.length; i++) { - this.addFill(lines[i]); - } -}; - -FillBucket.prototype.addFill = function(vertices) { - if (vertices.length < 3) { - //console.warn('a fill must have at least three vertices'); - return; - } - - // Calculate the total number of vertices we're going to produce so that we - // can resize the buffer beforehand, or detect whether the current line - // won't fit into the buffer anymore. - // In order to be able to use the vertex buffer for drawing the antialiased - // outlines, we separate all polygon vertices with a degenerate (out-of- - // viewplane) vertex. - - var len = vertices.length; - - // Expand this geometry buffer to hold all the required vertices. - var group = this.makeRoomFor('fill', len + 1); - - // We're generating triangle fans, so we always start with the first coordinate in this polygon. - var firstIndex, prevIndex; - for (var i = 0; i < vertices.length; i++) { - var currentVertex = vertices[i]; - - var currentIndex = group.layout.vertex.emplaceBack(currentVertex.x, currentVertex.y); - if (i === 0) firstIndex = currentIndex; - - // Only add triangles that have distinct vertices. - if (i >= 2 && (currentVertex.x !== vertices[0].x || currentVertex.y !== vertices[0].y)) { - group.layout.element.emplaceBack(firstIndex, prevIndex, currentIndex); - } - - if (i >= 1) { - group.layout.element2.emplaceBack(prevIndex, currentIndex); - } - - prevIndex = currentIndex; - } -}; - -},{"../../util/util":119,"../bucket":17,"../load_geometry":24}],20:[function(require,module,exports){ + var polygons = classifyRings(lines, EARCUT_MAX_RINGS); + var startGroup = this.prepareArrayGroup('fill', 0); + var startIndex = startGroup.layoutVertexArray.length; + for (var i = 0; i < polygons.length; i++) { + this.addPolygon(polygons[i]); + } + this.populatePaintArrays('fill', { zoom: this.zoom }, feature.properties, startGroup, startIndex); +}; +FillBucket.prototype.addPolygon = function (polygon) { + var numVertices = 0; + for (var k = 0; k < polygon.length; k++) { + numVertices += polygon[k].length; + } + var group = this.prepareArrayGroup('fill', numVertices); + var flattened = []; + var holeIndices = []; + var startIndex = group.layoutVertexArray.length; + for (var r = 0; r < polygon.length; r++) { + var ring = polygon[r]; + if (r > 0) + holeIndices.push(flattened.length / 2); + for (var v = 0; v < ring.length; v++) { + var vertex = ring[v]; + var index = group.layoutVertexArray.emplaceBack(vertex.x, vertex.y); + if (v >= 1) { + group.elementArray2.emplaceBack(index - 1, index); + } + flattened.push(vertex.x); + flattened.push(vertex.y); + } + } + var triangleIndices = earcut(flattened, holeIndices); + for (var i = 0; i < triangleIndices.length; i++) { + group.elementArray.emplaceBack(triangleIndices[i] + startIndex); + } +}; +},{"../../util/classify_rings":124,"../../util/util":136,"../bucket":23,"../load_geometry":31,"earcut":139}],26:[function(require,module,exports){ 'use strict'; - var Bucket = require('../bucket'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); var EXTENT = Bucket.EXTENT; - -// NOTE ON EXTRUDE SCALE: -// scale the extrusion vector so that the normal length is this value. -// contains the "texture" normals (-1..1). this is distinct from the extrude -// normals for line joins, because the x-value remains 0 for the texture -// normal array, while the extrude normal actually moves the vertex to create -// the acute/bevelled line join. var EXTRUDE_SCALE = 63; - -/* - * Sharp corners cause dashed lines to tilt because the distance along the line - * is the same at both the inner and outer corners. To improve the appearance of - * dashed lines we add extra points near sharp corners so that a smaller part - * of the line is tilted. - * - * COS_HALF_SHARP_CORNER controls how sharp a corner has to be for us to add an - * extra vertex. The default is 75 degrees. - * - * The newly created vertices are placed SHARP_CORNER_OFFSET pixels from the corner. - */ var COS_HALF_SHARP_CORNER = Math.cos(75 / 2 * (Math.PI / 180)); var SHARP_CORNER_OFFSET = 15; - -// The number of bits that is used to store the line distance in the buffer. -var LINE_DISTANCE_BUFFER_BITS = 14; - -// We don't have enough bits for the line distance as we'd like to have, so -// use this value to scale the line distance (in tile units) down to a smaller -// value. This lets us store longer distances while sacrificing precision. +var LINE_DISTANCE_BUFFER_BITS = 15; var LINE_DISTANCE_SCALE = 1 / 2; - -// The maximum line distance, in tile units, that fits in the buffer. -var MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS) / LINE_DISTANCE_SCALE; - - +var MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS - 1) / LINE_DISTANCE_SCALE; module.exports = LineBucket; - -/** - * @private - */ function LineBucket() { Bucket.apply(this, arguments); } - LineBucket.prototype = util.inherit(Bucket, {}); - -LineBucket.prototype.addLineVertex = function(vertexBuffer, point, extrude, tx, ty, dir, linesofar) { - return vertexBuffer.emplaceBack( - // a_pos - (point.x << 1) | tx, - (point.y << 1) | ty, - // a_data - // add 128 to store an byte in an unsigned byte - Math.round(EXTRUDE_SCALE * extrude.x) + 128, - Math.round(EXTRUDE_SCALE * extrude.y) + 128, - // Encode the -1/0/1 direction value into the first two bits of .z of a_data. - // Combine it with the lower 6 bits of `linesofar` (shifted by 2 bites to make - // room for the direction value). The upper 8 bits of `linesofar` are placed in - // the `w` component. `linesofar` is scaled down by `LINE_DISTANCE_SCALE` so that - // we can store longer distances while sacrificing precision. - ((dir === 0 ? 0 : (dir < 0 ? -1 : 1)) + 1) | (((linesofar * LINE_DISTANCE_SCALE) & 0x3F) << 2), - (linesofar * LINE_DISTANCE_SCALE) >> 6); +LineBucket.prototype.addLineVertex = function (layoutVertexBuffer, point, extrude, tx, ty, dir, linesofar) { + return layoutVertexBuffer.emplaceBack(point.x << 1 | tx, point.y << 1 | ty, Math.round(EXTRUDE_SCALE * extrude.x) + 128, Math.round(EXTRUDE_SCALE * extrude.y) + 128, (dir === 0 ? 0 : dir < 0 ? -1 : 1) + 1 | (linesofar * LINE_DISTANCE_SCALE & 63) << 2, linesofar * LINE_DISTANCE_SCALE >> 6); }; - LineBucket.prototype.programInterfaces = { line: { - vertexBuffer: true, - elementBuffer: true, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }, { - name: 'a_data', - components: 4, - type: 'Uint8' - }] + layoutVertexArrayType: new Bucket.VertexArrayType([ + { + name: 'a_pos', + components: 2, + type: 'Int16' + }, + { + name: 'a_data', + components: 4, + type: 'Uint8' + } + ]), + elementArrayType: new Bucket.ElementArrayType() } }; - -LineBucket.prototype.addFeature = function(feature) { - var lines = loadGeometry(feature); +LineBucket.prototype.addFeature = function (feature) { + var lines = loadGeometry(feature, LINE_DISTANCE_BUFFER_BITS); for (var i = 0; i < lines.length; i++) { - this.addLine( - lines[i], - this.layer.layout['line-join'], - this.layer.layout['line-cap'], - this.layer.layout['line-miter-limit'], - this.layer.layout['line-round-limit'] - ); + this.addLine(lines[i], this.layer.layout['line-join'], this.layer.layout['line-cap'], this.layer.layout['line-miter-limit'], this.layer.layout['line-round-limit']); } }; - -LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLimit) { - +LineBucket.prototype.addLine = function (vertices, join, cap, miterLimit, roundLimit) { var len = vertices.length; - // If the line has duplicate vertices at the end, adjust length to remove them. while (len > 2 && vertices[len - 1].equals(vertices[len - 2])) { len--; } - - if (vertices.length < 2) { - //console.warn('a line must have at least two vertices'); + if (vertices.length < 2) return; - } - - if (join === 'bevel') miterLimit = 1.05; - + if (join === 'bevel') + miterLimit = 1.05; var sharpCornerOffset = SHARP_CORNER_OFFSET * (EXTENT / (512 * this.overscaling)); - - var firstVertex = vertices[0], - lastVertex = vertices[len - 1], - closed = firstVertex.equals(lastVertex); - - // we could be more precise, but it would only save a negligible amount of space - this.makeRoomFor('line', len * 10); - - if (len === 2 && closed) { - // console.warn('a line may not have coincident points'); + var firstVertex = vertices[0], lastVertex = vertices[len - 1], closed = firstVertex.equals(lastVertex); + this.prepareArrayGroup('line', len * 10); + if (len === 2 && closed) return; - } - this.distance = 0; - - var beginCap = cap, - endCap = closed ? 'butt' : cap, - startOfLine = true, - currentVertex, prevVertex, nextVertex, prevNormal, nextNormal, offsetA, offsetB; - - // the last three vertices added + var beginCap = cap, endCap = closed ? 'butt' : cap, startOfLine = true, currentVertex, prevVertex, nextVertex, prevNormal, nextNormal, offsetA, offsetB; this.e1 = this.e2 = this.e3 = -1; - if (closed) { currentVertex = vertices[len - 2]; nextNormal = firstVertex.sub(currentVertex)._unit()._perp(); } - for (var i = 0; i < len; i++) { - - nextVertex = closed && i === len - 1 ? - vertices[1] : // if the line is closed, we treat the last vertex like the first - vertices[i + 1]; // just the next vertex - - // if two consecutive vertices exist, skip the current one - if (nextVertex && vertices[i].equals(nextVertex)) continue; - - if (nextNormal) prevNormal = nextNormal; - if (currentVertex) prevVertex = currentVertex; - + nextVertex = closed && i === len - 1 ? vertices[1] : vertices[i + 1]; + if (nextVertex && vertices[i].equals(nextVertex)) + continue; + if (nextNormal) + prevNormal = nextNormal; + if (currentVertex) + prevVertex = currentVertex; currentVertex = vertices[i]; - - // Calculate the normal towards the next vertex in this line. In case - // there is no next vertex, pretend that the line is continuing straight, - // meaning that we are just using the previous normal. nextNormal = nextVertex ? nextVertex.sub(currentVertex)._unit()._perp() : prevNormal; - - // If we still don't have a previous normal, this is the beginning of a - // non-closed line, so we're doing a straight "join". prevNormal = prevNormal || nextNormal; - - // Determine the normal of the join extrusion. It is the angle bisector - // of the segments between the previous line and the next line. var joinNormal = prevNormal.add(nextNormal)._unit(); - - /* joinNormal prevNormal - * ↖ ↑ - * .________. prevVertex - * | - * nextNormal ← | currentVertex - * | - * nextVertex ! - * - */ - - // Calculate the length of the miter (the ratio of the miter to the width). - // Find the cosine of the angle between the next and join normals - // using dot product. The inverse of that is the miter length. var cosHalfAngle = joinNormal.x * nextNormal.x + joinNormal.y * nextNormal.y; var miterLength = 1 / cosHalfAngle; - var isSharpCorner = cosHalfAngle < COS_HALF_SHARP_CORNER && prevVertex && nextVertex; - if (isSharpCorner && i > 0) { var prevSegmentLength = currentVertex.dist(prevVertex); if (prevSegmentLength > 2 * sharpCornerOffset) { @@ -13263,11 +14265,8 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi prevVertex = newPrevVertex; } } - - // The join if a middle vertex, otherwise the cap. var middleVertex = prevVertex && nextVertex; var currentJoin = middleVertex ? join : nextVertex ? beginCap : endCap; - if (middleVertex && currentJoin === 'round') { if (miterLength < roundLimit) { currentJoin = 'miter'; @@ -13275,36 +14274,23 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi currentJoin = 'fakeround'; } } - if (currentJoin === 'miter' && miterLength > miterLimit) { currentJoin = 'bevel'; } - if (currentJoin === 'bevel') { - // The maximum extrude length is 128 / 63 = 2 times the width of the line - // so if miterLength >= 2 we need to draw a different type of bevel where. - if (miterLength > 2) currentJoin = 'flipbevel'; - - // If the miterLength is really small and the line bevel wouldn't be visible, - // just draw a miter join to save a triangle. - if (miterLength < miterLimit) currentJoin = 'miter'; + if (miterLength > 2) + currentJoin = 'flipbevel'; + if (miterLength < miterLimit) + currentJoin = 'miter'; } - - // Calculate how far along the line the currentVertex is - if (prevVertex) this.distance += currentVertex.dist(prevVertex); - + if (prevVertex) + this.distance += currentVertex.dist(prevVertex); if (currentJoin === 'miter') { - joinNormal._mult(miterLength); this.addCurrentVertex(currentVertex, this.distance, joinNormal, 0, 0, false); - } else if (currentJoin === 'flipbevel') { - // miter is too big, flip the direction to make a beveled join - if (miterLength > 100) { - // Almost parallel lines joinNormal = nextNormal.clone(); - } else { var direction = prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x > 0 ? -1 : 1; var bevelLength = miterLength * prevNormal.add(nextNormal).mag() / prevNormal.sub(nextNormal).mag(); @@ -13312,9 +14298,8 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi } this.addCurrentVertex(currentVertex, this.distance, joinNormal, 0, 0, false); this.addCurrentVertex(currentVertex, this.distance, joinNormal.mult(-1), 0, 0, false); - } else if (currentJoin === 'bevel' || currentJoin === 'fakeround') { - var lineTurnsLeft = (prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x) > 0; + var lineTurnsLeft = prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x > 0; var offset = -Math.sqrt(miterLength * miterLength - 1); if (lineTurnsLeft) { offsetB = 0; @@ -13323,90 +14308,51 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi offsetA = 0; offsetB = offset; } - - // Close previous segment with a bevel if (!startOfLine) { this.addCurrentVertex(currentVertex, this.distance, prevNormal, offsetA, offsetB, false); } - if (currentJoin === 'fakeround') { - // The join angle is sharp enough that a round join would be visible. - // Bevel joins fill the gap between segments with a single pie slice triangle. - // Create a round join by adding multiple pie slices. The join isn't actually round, but - // it looks like it is at the sizes we render lines at. - - // Add more triangles for sharper angles. - // This math is just a good enough approximation. It isn't "correct". var n = Math.floor((0.5 - (cosHalfAngle - 0.5)) * 8); var approxFractionalJoinNormal; - for (var m = 0; m < n; m++) { approxFractionalJoinNormal = nextNormal.mult((m + 1) / (n + 1))._add(prevNormal)._unit(); this.addPieSliceVertex(currentVertex, this.distance, approxFractionalJoinNormal, lineTurnsLeft); } - this.addPieSliceVertex(currentVertex, this.distance, joinNormal, lineTurnsLeft); - for (var k = n - 1; k >= 0; k--) { approxFractionalJoinNormal = prevNormal.mult((k + 1) / (n + 1))._add(nextNormal)._unit(); this.addPieSliceVertex(currentVertex, this.distance, approxFractionalJoinNormal, lineTurnsLeft); } } - - // Start next segment if (nextVertex) { this.addCurrentVertex(currentVertex, this.distance, nextNormal, -offsetA, -offsetB, false); } - } else if (currentJoin === 'butt') { if (!startOfLine) { - // Close previous segment with a butt this.addCurrentVertex(currentVertex, this.distance, prevNormal, 0, 0, false); } - - // Start next segment with a butt if (nextVertex) { this.addCurrentVertex(currentVertex, this.distance, nextNormal, 0, 0, false); } - } else if (currentJoin === 'square') { - if (!startOfLine) { - // Close previous segment with a square cap this.addCurrentVertex(currentVertex, this.distance, prevNormal, 1, 1, false); - - // The segment is done. Unset vertices to disconnect segments. this.e1 = this.e2 = -1; } - - // Start next segment if (nextVertex) { this.addCurrentVertex(currentVertex, this.distance, nextNormal, -1, -1, false); } - } else if (currentJoin === 'round') { - if (!startOfLine) { - // Close previous segment with butt this.addCurrentVertex(currentVertex, this.distance, prevNormal, 0, 0, false); - - // Add round cap or linejoin at end of segment this.addCurrentVertex(currentVertex, this.distance, prevNormal, 1, 1, true); - - // The segment is done. Unset vertices to disconnect segments. this.e1 = this.e2 = -1; } - - - // Start next segment with a butt if (nextVertex) { - // Add round cap before first segment this.addCurrentVertex(currentVertex, this.distance, nextNormal, -1, -1, true); - this.addCurrentVertex(currentVertex, this.distance, nextNormal, 0, 0, false); } } - if (isSharpCorner && i < len - 1) { var nextSegmentLength = currentVertex.dist(nextVertex); if (nextSegmentLength > 2 * sharpCornerOffset) { @@ -13416,92 +14362,57 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi currentVertex = newCurrentVertex; } } - startOfLine = false; } - }; - -/** - * Add two vertices to the buffers. - * - * @param {Object} currentVertex the line vertex to add buffer vertices for - * @param {number} distance the distance from the beginning of the line to the vertex - * @param {number} endLeft extrude to shift the left vertex along the line - * @param {number} endRight extrude to shift the left vertex along the line - * @param {boolean} round whether this is a round cap - * @private - */ -LineBucket.prototype.addCurrentVertex = function(currentVertex, distance, normal, endLeft, endRight, round) { +LineBucket.prototype.addCurrentVertex = function (currentVertex, distance, normal, endLeft, endRight, round) { var tx = round ? 1 : 0; var extrude; - var layoutArrays = this.arrayGroups.line[this.arrayGroups.line.length - 1].layout; - var vertexArray = layoutArrays.vertex; - var elementArray = layoutArrays.element; - + var arrayGroup = this.arrayGroups.line[this.arrayGroups.line.length - 1]; + var layoutVertexArray = arrayGroup.layoutVertexArray; + var elementArray = arrayGroup.elementArray; extrude = normal.clone(); - if (endLeft) extrude._sub(normal.perp()._mult(endLeft)); - this.e3 = this.addLineVertex(vertexArray, currentVertex, extrude, tx, 0, endLeft, distance); + if (endLeft) + extrude._sub(normal.perp()._mult(endLeft)); + this.e3 = this.addLineVertex(layoutVertexArray, currentVertex, extrude, tx, 0, endLeft, distance); if (this.e1 >= 0 && this.e2 >= 0) { elementArray.emplaceBack(this.e1, this.e2, this.e3); } this.e1 = this.e2; this.e2 = this.e3; - extrude = normal.mult(-1); - if (endRight) extrude._sub(normal.perp()._mult(endRight)); - this.e3 = this.addLineVertex(vertexArray, currentVertex, extrude, tx, 1, -endRight, distance); + if (endRight) + extrude._sub(normal.perp()._mult(endRight)); + this.e3 = this.addLineVertex(layoutVertexArray, currentVertex, extrude, tx, 1, -endRight, distance); if (this.e1 >= 0 && this.e2 >= 0) { elementArray.emplaceBack(this.e1, this.e2, this.e3); } this.e1 = this.e2; this.e2 = this.e3; - - // There is a maximum "distance along the line" that we can store in the buffers. - // When we get close to the distance, reset it to zero and add the vertex again with - // a distance of zero. The max distance is determined by the number of bits we allocate - // to `linesofar`. if (distance > MAX_LINE_DISTANCE / 2) { this.distance = 0; this.addCurrentVertex(currentVertex, this.distance, normal, endLeft, endRight, round); } }; - -/** - * Add a single new vertex and a triangle using two previous vertices. - * This adds a pie slice triangle near a join to simulate round joins - * - * @param {Object} currentVertex the line vertex to add buffer vertices for - * @param {number} distance the distance from the beggining of the line to the vertex - * @param {Object} extrude the offset of the new vertex from the currentVertex - * @param {boolean} whether the line is turning left or right at this angle - * @private - */ -LineBucket.prototype.addPieSliceVertex = function(currentVertex, distance, extrude, lineTurnsLeft) { +LineBucket.prototype.addPieSliceVertex = function (currentVertex, distance, extrude, lineTurnsLeft) { var ty = lineTurnsLeft ? 1 : 0; extrude = extrude.mult(lineTurnsLeft ? -1 : 1); - var layoutArrays = this.arrayGroups.line[this.arrayGroups.line.length - 1].layout; - var vertexArray = layoutArrays.vertex; - var elementArray = layoutArrays.element; - - this.e3 = this.addLineVertex(vertexArray, currentVertex, extrude, 0, ty, 0, distance); - + var arrayGroup = this.arrayGroups.line[this.arrayGroups.line.length - 1]; + var layoutVertexArray = arrayGroup.layoutVertexArray; + var elementArray = arrayGroup.elementArray; + this.e3 = this.addLineVertex(layoutVertexArray, currentVertex, extrude, 0, ty, 0, distance); if (this.e1 >= 0 && this.e2 >= 0) { elementArray.emplaceBack(this.e1, this.e2, this.e3); } - if (lineTurnsLeft) { this.e2 = this.e3; } else { this.e1 = this.e3; } }; - -},{"../../util/util":119,"../bucket":17,"../load_geometry":24}],21:[function(require,module,exports){ +},{"../../util/util":136,"../bucket":23,"../load_geometry":31}],27:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - var Bucket = require('../bucket'); var Anchor = require('../../symbol/anchor'); var getAnchors = require('../../symbol/get_anchors'); @@ -13514,32 +14425,27 @@ var clipLine = require('../../symbol/clip_line'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); var CollisionFeature = require('../../symbol/collision_feature'); - var shapeText = Shaping.shapeText; var shapeIcon = Shaping.shapeIcon; var getGlyphQuads = Quads.getGlyphQuads; var getIconQuads = Quads.getIconQuads; - var EXTENT = Bucket.EXTENT; - module.exports = SymbolBucket; - function SymbolBucket(options) { Bucket.apply(this, arguments); this.showCollisionBoxes = options.showCollisionBoxes; this.overscaling = options.overscaling; this.collisionBoxArray = options.collisionBoxArray; - + this.symbolQuadsArray = options.symbolQuadsArray; + this.symbolInstancesArray = options.symbolInstancesArray; this.sdfIcons = options.sdfIcons; this.iconsNeedLinear = options.iconsNeedLinear; this.adjustedTextSize = options.adjustedTextSize; this.adjustedIconSize = options.adjustedIconSize; this.fontstack = options.fontstack; } - SymbolBucket.prototype = util.inherit(Bucket, {}); - -SymbolBucket.prototype.serialize = function() { +SymbolBucket.prototype.serialize = function () { var serialized = Bucket.prototype.serialize.apply(this); serialized.sdfIcons = this.sdfIcons; serialized.iconsNeedLinear = this.iconsNeedLinear; @@ -13548,114 +14454,95 @@ SymbolBucket.prototype.serialize = function() { serialized.fontstack = this.fontstack; return serialized; }; - -var programAttributes = [{ - name: 'a_pos', - components: 2, - type: 'Int16' -}, { - name: 'a_offset', - components: 2, - type: 'Int16' -}, { - name: 'a_data1', - components: 4, - type: 'Uint8' -}, { - name: 'a_data2', - components: 2, - type: 'Uint8' -}]; - -function addVertex(array, x, y, ox, oy, tx, ty, minzoom, maxzoom, labelminzoom) { - return array.emplaceBack( - // pos - x, - y, - // offset - Math.round(ox * 64), // use 1/64 pixels for placement - Math.round(oy * 64), - // data1 - tx / 4, // tex - ty / 4, // tex - (labelminzoom || 0) * 10, // labelminzoom - 0, - // data2 - (minzoom || 0) * 10, // minzoom - Math.min(maxzoom || 25, 25) * 10); // minzoom +var layoutVertexArrayType = new Bucket.VertexArrayType([ + { + name: 'a_pos', + components: 2, + type: 'Int16' + }, + { + name: 'a_offset', + components: 2, + type: 'Int16' + }, + { + name: 'a_texture_pos', + components: 2, + type: 'Uint16' + }, + { + name: 'a_data', + components: 4, + type: 'Uint8' + } +]); +var elementArrayType = new Bucket.ElementArrayType(); +function addVertex(array, x, y, ox, oy, tx, ty, minzoom, maxzoom, labelminzoom, labelangle) { + return array.emplaceBack(x, y, Math.round(ox * 64), Math.round(oy * 64), tx / 4, ty / 4, (labelminzoom || 0) * 10, labelangle, (minzoom || 0) * 10, Math.min(maxzoom || 25, 25) * 10); } - -SymbolBucket.prototype.addCollisionBoxVertex = function(vertexArray, point, extrude, maxZoom, placementZoom) { - return vertexArray.emplaceBack( - // pos - point.x, - point.y, - // extrude - Math.round(extrude.x), - Math.round(extrude.y), - // data - maxZoom * 10, - placementZoom * 10); +SymbolBucket.prototype.addCollisionBoxVertex = function (layoutVertexArray, point, extrude, maxZoom, placementZoom) { + return layoutVertexArray.emplaceBack(point.x, point.y, Math.round(extrude.x), Math.round(extrude.y), maxZoom * 10, placementZoom * 10); }; - SymbolBucket.prototype.programInterfaces = { - glyph: { - vertexBuffer: true, - elementBuffer: true, - layoutAttributes: programAttributes + layoutVertexArrayType: layoutVertexArrayType, + elementArrayType: elementArrayType }, - icon: { - vertexBuffer: true, - elementBuffer: true, - layoutAttributes: programAttributes + layoutVertexArrayType: layoutVertexArrayType, + elementArrayType: elementArrayType }, - collisionBox: { - vertexBuffer: true, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }, { - name: 'a_extrude', - components: 2, - type: 'Int16' - }, { - name: 'a_data', - components: 2, - type: 'Uint8' - }] - } -}; - -SymbolBucket.prototype.populateBuffers = function(collisionTile, stacks, icons) { - - // To reduce the number of labels that jump around when zooming we need - // to use a text-size value that is the same for all zoom levels. - // This calculates text-size at a high zoom level so that all tiles can - // use the same value when calculating anchor positions. - var zoomHistory = { lastIntegerZoom: Infinity, lastIntegerZoomTime: 0, lastZoom: 0 }; - this.adjustedTextMaxSize = this.layer.getLayoutValue('text-size', {zoom: 18, zoomHistory: zoomHistory}); - this.adjustedTextSize = this.layer.getLayoutValue('text-size', {zoom: this.zoom + 1, zoomHistory: zoomHistory}); - this.adjustedIconMaxSize = this.layer.getLayoutValue('icon-size', {zoom: 18, zoomHistory: zoomHistory}); - this.adjustedIconSize = this.layer.getLayoutValue('icon-size', {zoom: this.zoom + 1, zoomHistory: zoomHistory}); - + layoutVertexArrayType: new Bucket.VertexArrayType([ + { + name: 'a_pos', + components: 2, + type: 'Int16' + }, + { + name: 'a_extrude', + components: 2, + type: 'Int16' + }, + { + name: 'a_data', + components: 2, + type: 'Uint8' + } + ]) + } +}; +SymbolBucket.prototype.populateArrays = function (collisionTile, stacks, icons) { + var zoomHistory = { + lastIntegerZoom: Infinity, + lastIntegerZoomTime: 0, + lastZoom: 0 + }; + this.adjustedTextMaxSize = this.layer.getLayoutValue('text-size', { + zoom: 18, + zoomHistory: zoomHistory + }); + this.adjustedTextSize = this.layer.getLayoutValue('text-size', { + zoom: this.zoom + 1, + zoomHistory: zoomHistory + }); + this.adjustedIconMaxSize = this.layer.getLayoutValue('icon-size', { + zoom: 18, + zoomHistory: zoomHistory + }); + this.adjustedIconSize = this.layer.getLayoutValue('icon-size', { + zoom: this.zoom + 1, + zoomHistory: zoomHistory + }); var tileSize = 512 * this.overscaling; this.tilePixelRatio = EXTENT / tileSize; this.compareText = {}; - this.symbolInstances = []; this.iconsNeedLinear = false; - + this.symbolInstancesStartIndex = this.symbolInstancesArray.length; var layout = this.layer.layout; var features = this.features; var textFeatures = this.textFeatures; - - var horizontalAlign = 0.5, - verticalAlign = 0.5; - + var horizontalAlign = 0.5, verticalAlign = 0.5; switch (layout['text-anchor']) { case 'right': case 'top-right': @@ -13668,7 +14555,6 @@ SymbolBucket.prototype.populateBuffers = function(collisionTile, stacks, icons) horizontalAlign = 0; break; } - switch (layout['text-anchor']) { case 'bottom': case 'bottom-right': @@ -13681,155 +14567,93 @@ SymbolBucket.prototype.populateBuffers = function(collisionTile, stacks, icons) verticalAlign = 0; break; } - - var justify = layout['text-justify'] === 'right' ? 1 : - layout['text-justify'] === 'left' ? 0 : - 0.5; - + var justify = layout['text-justify'] === 'right' ? 1 : layout['text-justify'] === 'left' ? 0 : 0.5; var oneEm = 24; var lineHeight = layout['text-line-height'] * oneEm; var maxWidth = layout['symbol-placement'] !== 'line' ? layout['text-max-width'] * oneEm : 0; var spacing = layout['text-letter-spacing'] * oneEm; - var textOffset = [layout['text-offset'][0] * oneEm, layout['text-offset'][1] * oneEm]; + var textOffset = [ + layout['text-offset'][0] * oneEm, + layout['text-offset'][1] * oneEm + ]; var fontstack = this.fontstack = layout['text-font'].join(','); - var geometries = []; for (var g = 0; g < features.length; g++) { geometries.push(loadGeometry(features[g])); } - if (layout['symbol-placement'] === 'line') { - // Merge adjacent lines with the same text to improve labelling. - // It's better to place labels on one long line than on many short segments. var merged = mergeLines(features, textFeatures, geometries); - geometries = merged.geometries; features = merged.features; textFeatures = merged.textFeatures; } - var shapedText, shapedIcon; - for (var k = 0; k < features.length; k++) { - if (!geometries[k]) continue; - + if (!geometries[k]) + continue; if (textFeatures[k]) { - shapedText = shapeText(textFeatures[k], stacks[fontstack], maxWidth, - lineHeight, horizontalAlign, verticalAlign, justify, spacing, textOffset); + shapedText = shapeText(textFeatures[k], stacks[fontstack], maxWidth, lineHeight, horizontalAlign, verticalAlign, justify, spacing, textOffset); } else { shapedText = null; } - if (layout['icon-image']) { var iconName = resolveTokens(features[k].properties, layout['icon-image']); var image = icons[iconName]; shapedIcon = shapeIcon(image, layout); - if (image) { if (this.sdfIcons === undefined) { this.sdfIcons = image.sdf; } else if (this.sdfIcons !== image.sdf) { - console.warn('Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer'); + util.warnOnce('Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer'); } if (image.pixelRatio !== 1) { this.iconsNeedLinear = true; + } else if (layout['icon-rotate'] !== 0 || !this.layer.isLayoutValueFeatureConstant('icon-rotate')) { + this.iconsNeedLinear = true; } } } else { shapedIcon = null; } - if (shapedText || shapedIcon) { - this.addFeature(geometries[k], shapedText, shapedIcon, features[k].index); + this.addFeature(geometries[k], shapedText, shapedIcon, features[k]); } } - + this.symbolInstancesEndIndex = this.symbolInstancesArray.length; this.placeFeatures(collisionTile, this.showCollisionBoxes); - this.trimArrays(); }; - -SymbolBucket.prototype.addFeature = function(lines, shapedText, shapedIcon, featureIndex) { +SymbolBucket.prototype.addFeature = function (lines, shapedText, shapedIcon, feature) { var layout = this.layer.layout; - var glyphSize = 24; - - var fontScale = this.adjustedTextSize / glyphSize, - textMaxSize = this.adjustedTextMaxSize !== undefined ? this.adjustedTextMaxSize : this.adjustedTextSize, - textBoxScale = this.tilePixelRatio * fontScale, - textMaxBoxScale = this.tilePixelRatio * textMaxSize / glyphSize, - iconBoxScale = this.tilePixelRatio * this.adjustedIconSize, - symbolMinDistance = this.tilePixelRatio * layout['symbol-spacing'], - avoidEdges = layout['symbol-avoid-edges'], - textPadding = layout['text-padding'] * this.tilePixelRatio, - iconPadding = layout['icon-padding'] * this.tilePixelRatio, - textMaxAngle = layout['text-max-angle'] / 180 * Math.PI, - textAlongLine = layout['text-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', - iconAlongLine = layout['icon-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', - mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || - layout['text-ignore-placement'] || layout['icon-ignore-placement'], - isLine = layout['symbol-placement'] === 'line', - textRepeatDistance = symbolMinDistance / 2; - + var fontScale = this.adjustedTextSize / glyphSize, textMaxSize = this.adjustedTextMaxSize !== undefined ? this.adjustedTextMaxSize : this.adjustedTextSize, textBoxScale = this.tilePixelRatio * fontScale, textMaxBoxScale = this.tilePixelRatio * textMaxSize / glyphSize, iconBoxScale = this.tilePixelRatio * this.adjustedIconSize, symbolMinDistance = this.tilePixelRatio * layout['symbol-spacing'], avoidEdges = layout['symbol-avoid-edges'], textPadding = layout['text-padding'] * this.tilePixelRatio, iconPadding = layout['icon-padding'] * this.tilePixelRatio, textMaxAngle = layout['text-max-angle'] / 180 * Math.PI, textAlongLine = layout['text-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', iconAlongLine = layout['icon-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || layout['text-ignore-placement'] || layout['icon-ignore-placement'], isLine = layout['symbol-placement'] === 'line', textRepeatDistance = symbolMinDistance / 2; if (isLine) { lines = clipLine(lines, 0, 0, EXTENT, EXTENT); } - for (var i = 0; i < lines.length; i++) { var line = lines[i]; - - // Calculate the anchor points around which you want to place labels var anchors; if (isLine) { - anchors = getAnchors( - line, - symbolMinDistance, - textMaxAngle, - shapedText, - shapedIcon, - glyphSize, - textMaxBoxScale, - this.overscaling, - EXTENT - ); + anchors = getAnchors(line, symbolMinDistance, textMaxAngle, shapedText, shapedIcon, glyphSize, textMaxBoxScale, this.overscaling, EXTENT); } else { - anchors = [ new Anchor(line[0].x, line[0].y, 0) ]; + anchors = [new Anchor(line[0].x, line[0].y, 0)]; } - - // For each potential label, create the placement features used to check for collisions, and the quads use for rendering. for (var j = 0, len = anchors.length; j < len; j++) { var anchor = anchors[j]; - if (shapedText && isLine) { if (this.anchorIsTooClose(shapedText.text, textRepeatDistance, anchor)) { continue; } } - var inside = !(anchor.x < 0 || anchor.x > EXTENT || anchor.y < 0 || anchor.y > EXTENT); - - if (avoidEdges && !inside) continue; - - // Normally symbol layers are drawn across tile boundaries. Only symbols - // with their anchors within the tile boundaries are added to the buffers - // to prevent symbols from being drawn twice. - // - // Symbols in layers with overlap are sorted in the y direction so that - // symbols lower on the canvas are drawn on top of symbols near the top. - // To preserve this order across tile boundaries these symbols can't - // be drawn across tile boundaries. Instead they need to be included in - // the buffers for both tiles and clipped to tile boundaries at draw time. + if (avoidEdges && !inside) + continue; var addToBuffers = inside || mayOverlap; - - this.symbolInstances.push(new SymbolInstance(anchor, line, shapedText, shapedIcon, layout, - addToBuffers, this.symbolInstances.length, this.collisionBoxArray, featureIndex, this.sourceLayerIndex, this.index, - textBoxScale, textPadding, textAlongLine, - iconBoxScale, iconPadding, iconAlongLine)); + this.addSymbolInstance(anchor, line, shapedText, shapedIcon, this.layer, addToBuffers, this.symbolInstancesArray.length, this.collisionBoxArray, feature.index, this.sourceLayerIndex, this.index, textBoxScale, textPadding, textAlongLine, iconBoxScale, iconPadding, iconAlongLine, { zoom: this.zoom }, feature.properties); } } }; - -SymbolBucket.prototype.anchorIsTooClose = function(text, repeatDistance, anchor) { +SymbolBucket.prototype.anchorIsTooClose = function (text, repeatDistance, anchor) { var compareText = this.compareText; if (!(text in compareText)) { compareText[text] = []; @@ -13837,74 +14661,46 @@ SymbolBucket.prototype.anchorIsTooClose = function(text, repeatDistance, anchor) var otherAnchors = compareText[text]; for (var k = otherAnchors.length - 1; k >= 0; k--) { if (anchor.dist(otherAnchors[k]) < repeatDistance) { - // If it's within repeatDistance of one anchor, stop looking return true; } } } - // If anchor is not within repeatDistance of any other anchor, add to array compareText[text].push(anchor); return false; }; - -SymbolBucket.prototype.placeFeatures = function(collisionTile, showCollisionBoxes) { +SymbolBucket.prototype.placeFeatures = function (collisionTile, showCollisionBoxes) { this.recalculateStyleLayers(); - - // Calculate which labels can be shown and when they can be shown and - // create the bufers used for rendering. - this.createArrays(); - var layout = this.layer.layout; - var maxScale = collisionTile.maxScale; - var textAlongLine = layout['text-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line'; var iconAlongLine = layout['icon-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line'; - - var mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || - layout['text-ignore-placement'] || layout['icon-ignore-placement']; - - // Sort symbols by their y position on the canvas so that they lower symbols - // are drawn on top of higher symbols. - // Don't sort symbols that won't overlap because it isn't necessary and - // because it causes more labels to pop in and out when rotating. + var mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || layout['text-ignore-placement'] || layout['icon-ignore-placement']; if (mayOverlap) { + var symbolInstancesStructTypeArray = this.symbolInstancesArray.toArray(this.symbolInstancesStartIndex, this.symbolInstancesEndIndex); var angle = collisionTile.angle; - var sin = Math.sin(angle), - cos = Math.cos(angle); - - this.symbolInstances.sort(function(a, b) { - var aRotated = (sin * a.x + cos * a.y) | 0; - var bRotated = (sin * b.x + cos * b.y) | 0; - return (aRotated - bRotated) || (b.index - a.index); + var sin = Math.sin(angle), cos = Math.cos(angle); + this.sortedSymbolInstances = symbolInstancesStructTypeArray.sort(function (a, b) { + var aRotated = sin * a.anchorPointX + cos * a.anchorPointY | 0; + var bRotated = sin * b.anchorPointX + cos * b.anchorPointY | 0; + return aRotated - bRotated || b.index - a.index; }); } - - for (var p = 0; p < this.symbolInstances.length; p++) { - var symbolInstance = this.symbolInstances[p]; - var hasText = symbolInstance.hasText; - var hasIcon = symbolInstance.hasIcon; - - var iconWithoutText = layout['text-optional'] || !hasText, - textWithoutIcon = layout['icon-optional'] || !hasIcon; - - - // Calculate the scales at which the text and icon can be placed without collision. - - var glyphScale = hasText ? - collisionTile.placeCollisionFeature(symbolInstance.textCollisionFeature, - layout['text-allow-overlap'], layout['symbol-avoid-edges']) : - collisionTile.minScale; - - var iconScale = hasIcon ? - collisionTile.placeCollisionFeature(symbolInstance.iconCollisionFeature, - layout['icon-allow-overlap'], layout['symbol-avoid-edges']) : - collisionTile.minScale; - - - // Combine the scales for icons and text. - + for (var p = this.symbolInstancesStartIndex; p < this.symbolInstancesEndIndex; p++) { + var symbolInstance = this.sortedSymbolInstances ? this.sortedSymbolInstances[p - this.symbolInstancesStartIndex] : this.symbolInstancesArray.get(p); + var textCollisionFeature = { + boxStartIndex: symbolInstance.textBoxStartIndex, + boxEndIndex: symbolInstance.textBoxEndIndex + }; + var iconCollisionFeature = { + boxStartIndex: symbolInstance.iconBoxStartIndex, + boxEndIndex: symbolInstance.iconBoxEndIndex + }; + var hasText = !(symbolInstance.textBoxStartIndex === symbolInstance.textBoxEndIndex); + var hasIcon = !(symbolInstance.iconBoxStartIndex === symbolInstance.iconBoxEndIndex); + var iconWithoutText = layout['text-optional'] || !hasText, textWithoutIcon = layout['icon-optional'] || !hasIcon; + var glyphScale = hasText ? collisionTile.placeCollisionFeature(textCollisionFeature, layout['text-allow-overlap'], layout['symbol-avoid-edges']) : collisionTile.minScale; + var iconScale = hasIcon ? collisionTile.placeCollisionFeature(iconCollisionFeature, layout['icon-allow-overlap'], layout['symbol-avoid-edges']) : collisionTile.minScale; if (!iconWithoutText && !textWithoutIcon) { iconScale = glyphScale = Math.max(iconScale, glyphScale); } else if (!textWithoutIcon && glyphScale) { @@ -13912,170 +14708,137 @@ SymbolBucket.prototype.placeFeatures = function(collisionTile, showCollisionBoxe } else if (!iconWithoutText && iconScale) { iconScale = Math.max(iconScale, glyphScale); } - - - // Insert final placement into collision tree and add glyphs/icons to buffers - if (hasText) { - collisionTile.insertCollisionFeature(symbolInstance.textCollisionFeature, glyphScale, layout['text-ignore-placement']); + collisionTile.insertCollisionFeature(textCollisionFeature, glyphScale, layout['text-ignore-placement']); if (glyphScale <= maxScale) { - this.addSymbols('glyph', symbolInstance.glyphQuads, glyphScale, layout['text-keep-upright'], textAlongLine, collisionTile.angle); + this.addSymbols('glyph', symbolInstance.glyphQuadStartIndex, symbolInstance.glyphQuadEndIndex, glyphScale, layout['text-keep-upright'], textAlongLine, collisionTile.angle); } } - if (hasIcon) { - collisionTile.insertCollisionFeature(symbolInstance.iconCollisionFeature, iconScale, layout['icon-ignore-placement']); + collisionTile.insertCollisionFeature(iconCollisionFeature, iconScale, layout['icon-ignore-placement']); if (iconScale <= maxScale) { - this.addSymbols('icon', symbolInstance.iconQuads, iconScale, layout['icon-keep-upright'], iconAlongLine, collisionTile.angle); + this.addSymbols('icon', symbolInstance.iconQuadStartIndex, symbolInstance.iconQuadEndIndex, iconScale, layout['icon-keep-upright'], iconAlongLine, collisionTile.angle); } } - } - - if (showCollisionBoxes) this.addToDebugBuffers(collisionTile); + if (showCollisionBoxes) + this.addToDebugBuffers(collisionTile); }; - -SymbolBucket.prototype.addSymbols = function(programName, quads, scale, keepUpright, alongLine, placementAngle) { - - var group = this.makeRoomFor(programName, 4 * quads.length); - - var elementArray = group.layout.element; - var vertexArray = group.layout.vertex; - +SymbolBucket.prototype.addSymbols = function (programName, quadsStart, quadsEnd, scale, keepUpright, alongLine, placementAngle) { + var group = this.prepareArrayGroup(programName, 4 * (quadsEnd - quadsStart)); + var elementArray = group.elementArray; + var layoutVertexArray = group.layoutVertexArray; var zoom = this.zoom; var placementZoom = Math.max(Math.log(scale) / Math.LN2 + zoom, 0); - - for (var k = 0; k < quads.length; k++) { - - var symbol = quads[k], - angle = symbol.angle; - - // drop upside down versions of glyphs - var a = (angle + placementAngle + Math.PI) % (Math.PI * 2); - if (keepUpright && alongLine && (a <= Math.PI / 2 || a > Math.PI * 3 / 2)) continue; - - var tl = symbol.tl, - tr = symbol.tr, - bl = symbol.bl, - br = symbol.br, - tex = symbol.tex, - anchorPoint = symbol.anchorPoint, - - minZoom = Math.max(zoom + Math.log(symbol.minScale) / Math.LN2, placementZoom), - maxZoom = Math.min(zoom + Math.log(symbol.maxScale) / Math.LN2, 25); - - if (maxZoom <= minZoom) continue; - - // Lower min zoom so that while fading out the label it can be shown outside of collision-free zoom levels - if (minZoom === placementZoom) minZoom = 0; - - var index = addVertex(vertexArray, anchorPoint.x, anchorPoint.y, tl.x, tl.y, tex.x, tex.y, minZoom, maxZoom, placementZoom); - addVertex(vertexArray, anchorPoint.x, anchorPoint.y, tr.x, tr.y, tex.x + tex.w, tex.y, minZoom, maxZoom, placementZoom); - addVertex(vertexArray, anchorPoint.x, anchorPoint.y, bl.x, bl.y, tex.x, tex.y + tex.h, minZoom, maxZoom, placementZoom); - addVertex(vertexArray, anchorPoint.x, anchorPoint.y, br.x, br.y, tex.x + tex.w, tex.y + tex.h, minZoom, maxZoom, placementZoom); - + for (var k = quadsStart; k < quadsEnd; k++) { + var symbol = this.symbolQuadsArray.get(k).SymbolQuad; + var a = (symbol.anchorAngle + placementAngle + Math.PI) % (Math.PI * 2); + if (keepUpright && alongLine && (a <= Math.PI / 2 || a > Math.PI * 3 / 2)) + continue; + var tl = symbol.tl, tr = symbol.tr, bl = symbol.bl, br = symbol.br, tex = symbol.tex, anchorPoint = symbol.anchorPoint, minZoom = Math.max(zoom + Math.log(symbol.minScale) / Math.LN2, placementZoom), maxZoom = Math.min(zoom + Math.log(symbol.maxScale) / Math.LN2, 25); + if (maxZoom <= minZoom) + continue; + if (minZoom === placementZoom) + minZoom = 0; + var glyphAngle = Math.round(symbol.glyphAngle / (Math.PI * 2) * 256); + var index = addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, tl.x, tl.y, tex.x, tex.y, minZoom, maxZoom, placementZoom, glyphAngle); + addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, tr.x, tr.y, tex.x + tex.w, tex.y, minZoom, maxZoom, placementZoom, glyphAngle); + addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, bl.x, bl.y, tex.x, tex.y + tex.h, minZoom, maxZoom, placementZoom, glyphAngle); + addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, br.x, br.y, tex.x + tex.w, tex.y + tex.h, minZoom, maxZoom, placementZoom, glyphAngle); elementArray.emplaceBack(index, index + 1, index + 2); elementArray.emplaceBack(index + 1, index + 2, index + 3); } - }; - -SymbolBucket.prototype.updateIcons = function(icons) { +SymbolBucket.prototype.updateIcons = function (icons) { this.recalculateStyleLayers(); var iconValue = this.layer.layout['icon-image']; - if (!iconValue) return; - + if (!iconValue) + return; for (var i = 0; i < this.features.length; i++) { var iconName = resolveTokens(this.features[i].properties, iconValue); if (iconName) icons[iconName] = true; } }; - -SymbolBucket.prototype.updateFont = function(stacks) { +SymbolBucket.prototype.updateFont = function (stacks) { this.recalculateStyleLayers(); - var fontName = this.layer.layout['text-font'], - stack = stacks[fontName] = stacks[fontName] || {}; - + var fontName = this.layer.layout['text-font'], stack = stacks[fontName] = stacks[fontName] || {}; this.textFeatures = resolveText(this.features, this.layer.layout, stack); }; - -SymbolBucket.prototype.addToDebugBuffers = function(collisionTile) { - var group = this.makeRoomFor('collisionBox', 0); - var vertexArray = group.layout.vertex; +SymbolBucket.prototype.addToDebugBuffers = function (collisionTile) { + var group = this.prepareArrayGroup('collisionBox', 0); + var layoutVertexArray = group.layoutVertexArray; var angle = -collisionTile.angle; var yStretch = collisionTile.yStretch; - - for (var j = 0; j < this.symbolInstances.length; j++) { + for (var j = this.symbolInstancesStartIndex; j < this.symbolInstancesEndIndex; j++) { + var symbolInstance = this.symbolInstancesArray.get(j); + symbolInstance.textCollisionFeature = { + boxStartIndex: symbolInstance.textBoxStartIndex, + boxEndIndex: symbolInstance.textBoxEndIndex + }; + symbolInstance.iconCollisionFeature = { + boxStartIndex: symbolInstance.iconBoxStartIndex, + boxEndIndex: symbolInstance.iconBoxEndIndex + }; for (var i = 0; i < 2; i++) { - var feature = this.symbolInstances[j][i === 0 ? 'textCollisionFeature' : 'iconCollisionFeature']; - if (!feature) continue; - + var feature = symbolInstance[i === 0 ? 'textCollisionFeature' : 'iconCollisionFeature']; + if (!feature) + continue; for (var b = feature.boxStartIndex; b < feature.boxEndIndex; b++) { var box = this.collisionBoxArray.get(b); var anchorPoint = box.anchorPoint; - var tl = new Point(box.x1, box.y1 * yStretch)._rotate(angle); var tr = new Point(box.x2, box.y1 * yStretch)._rotate(angle); var bl = new Point(box.x1, box.y2 * yStretch)._rotate(angle); var br = new Point(box.x2, box.y2 * yStretch)._rotate(angle); - var maxZoom = Math.max(0, Math.min(25, this.zoom + Math.log(box.maxScale) / Math.LN2)); var placementZoom = Math.max(0, Math.min(25, this.zoom + Math.log(box.placementScale) / Math.LN2)); - - this.addCollisionBoxVertex(vertexArray, anchorPoint, tl, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, tr, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, tr, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, br, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, br, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, bl, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, bl, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, tl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tr, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tr, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, br, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, br, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, bl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, bl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tl, maxZoom, placementZoom); } } } }; - -function SymbolInstance(anchor, line, shapedText, shapedIcon, layout, addToBuffers, index, collisionBoxArray, featureIndex, sourceLayerIndex, bucketIndex, - textBoxScale, textPadding, textAlongLine, - iconBoxScale, iconPadding, iconAlongLine) { - - this.x = anchor.x; - this.y = anchor.y; - this.index = index; - this.hasText = !!shapedText; - this.hasIcon = !!shapedIcon; - - if (this.hasText) { - this.glyphQuads = addToBuffers ? getGlyphQuads(anchor, shapedText, textBoxScale, line, layout, textAlongLine) : []; - this.textCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, - shapedText, textBoxScale, textPadding, textAlongLine, false); +SymbolBucket.prototype.addSymbolInstance = function (anchor, line, shapedText, shapedIcon, layer, addToBuffers, index, collisionBoxArray, featureIndex, sourceLayerIndex, bucketIndex, textBoxScale, textPadding, textAlongLine, iconBoxScale, iconPadding, iconAlongLine, globalProperties, featureProperties) { + var glyphQuadStartIndex, glyphQuadEndIndex, iconQuadStartIndex, iconQuadEndIndex, textCollisionFeature, iconCollisionFeature, glyphQuads, iconQuads; + if (shapedText) { + glyphQuads = addToBuffers ? getGlyphQuads(anchor, shapedText, textBoxScale, line, layer, textAlongLine) : []; + textCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shapedText, textBoxScale, textPadding, textAlongLine, false); } - - if (this.hasIcon) { - this.iconQuads = addToBuffers ? getIconQuads(anchor, shapedIcon, iconBoxScale, line, layout, iconAlongLine) : []; - this.iconCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, - shapedIcon, iconBoxScale, iconPadding, iconAlongLine, true); + glyphQuadStartIndex = this.symbolQuadsArray.length; + if (glyphQuads && glyphQuads.length) { + for (var i = 0; i < glyphQuads.length; i++) { + this.addSymbolQuad(glyphQuads[i]); + } } -} - -},{"../../symbol/anchor":73,"../../symbol/clip_line":75,"../../symbol/collision_feature":77,"../../symbol/get_anchors":79,"../../symbol/mergelines":82,"../../symbol/quads":83,"../../symbol/resolve_text":84,"../../symbol/shaping":85,"../../util/token":118,"../../util/util":119,"../bucket":17,"../load_geometry":24,"point-geometry":174}],22:[function(require,module,exports){ + glyphQuadEndIndex = this.symbolQuadsArray.length; + var textBoxStartIndex = textCollisionFeature ? textCollisionFeature.boxStartIndex : this.collisionBoxArray.length; + var textBoxEndIndex = textCollisionFeature ? textCollisionFeature.boxEndIndex : this.collisionBoxArray.length; + if (shapedIcon) { + iconQuads = addToBuffers ? getIconQuads(anchor, shapedIcon, iconBoxScale, line, layer, iconAlongLine, shapedText, globalProperties, featureProperties) : []; + iconCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shapedIcon, iconBoxScale, iconPadding, iconAlongLine, true); + } + iconQuadStartIndex = this.symbolQuadsArray.length; + if (iconQuads && iconQuads.length === 1) { + this.addSymbolQuad(iconQuads[0]); + } + iconQuadEndIndex = this.symbolQuadsArray.length; + var iconBoxStartIndex = iconCollisionFeature ? iconCollisionFeature.boxStartIndex : this.collisionBoxArray.length; + var iconBoxEndIndex = iconCollisionFeature ? iconCollisionFeature.boxEndIndex : this.collisionBoxArray.length; + return this.symbolInstancesArray.emplaceBack(textBoxStartIndex, textBoxEndIndex, iconBoxStartIndex, iconBoxEndIndex, glyphQuadStartIndex, glyphQuadEndIndex, iconQuadStartIndex, iconQuadEndIndex, anchor.x, anchor.y, index); +}; +SymbolBucket.prototype.addSymbolQuad = function (symbolQuad) { + return this.symbolQuadsArray.emplaceBack(symbolQuad.anchorPoint.x, symbolQuad.anchorPoint.y, symbolQuad.tl.x, symbolQuad.tl.y, symbolQuad.tr.x, symbolQuad.tr.y, symbolQuad.bl.x, symbolQuad.bl.y, symbolQuad.br.x, symbolQuad.br.y, symbolQuad.tex.h, symbolQuad.tex.w, symbolQuad.tex.x, symbolQuad.tex.y, symbolQuad.anchorAngle, symbolQuad.glyphAngle, symbolQuad.maxScale, symbolQuad.minScale); +}; +},{"../../symbol/anchor":85,"../../symbol/clip_line":87,"../../symbol/collision_feature":89,"../../symbol/get_anchors":91,"../../symbol/mergelines":94,"../../symbol/quads":95,"../../symbol/resolve_text":96,"../../symbol/shaping":97,"../../util/token":135,"../../util/util":136,"../bucket":23,"../load_geometry":31,"point-geometry":194}],28:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); - module.exports = Buffer; - -/** - * The `Buffer` class turns a `StructArray` into a WebGL buffer. Each member of the StructArray's - * Struct type is converted to a WebGL atribute. - * - * @class Buffer - * @private - * @param {object} array A serialized StructArray. - * @param {object} arrayType A serialized StructArrayType. - * @param {BufferType} type - */ function Buffer(array, arrayType, type) { this.arrayBuffer = array.arrayBuffer; this.length = array.length; @@ -14084,132 +14847,118 @@ function Buffer(array, arrayType, type) { this.type = type; this.arrayType = arrayType; } - -/** - * Bind this buffer to a WebGL context. - * @private - * @param gl The WebGL context - */ -Buffer.prototype.bind = function(gl) { +Buffer.prototype.bind = function (gl) { var type = gl[this.type]; - if (!this.buffer) { this.buffer = gl.createBuffer(); gl.bindBuffer(type, this.buffer); gl.bufferData(type, this.arrayBuffer, gl.STATIC_DRAW); - - // dump array buffer once it's bound to gl this.arrayBuffer = null; } else { gl.bindBuffer(type, this.buffer); } }; - -/** - * @enum {string} AttributeType - * @private - * @readonly - */ var AttributeType = { - Int8: 'BYTE', - Uint8: 'UNSIGNED_BYTE', - Int16: 'SHORT', + Int8: 'BYTE', + Uint8: 'UNSIGNED_BYTE', + Int16: 'SHORT', Uint16: 'UNSIGNED_SHORT' }; - -/** - * Set the attribute pointers in a WebGL context - * @private - * @param gl The WebGL context - * @param program The active WebGL program - */ -Buffer.prototype.setVertexAttribPointers = function(gl, program) { +Buffer.prototype.setVertexAttribPointers = function (gl, program) { for (var j = 0; j < this.attributes.length; j++) { var member = this.attributes[j]; var attribIndex = program[member.name]; - assert(attribIndex !== undefined, 'array member "' + member.name + '" name does not match shader attribute name'); - - gl.vertexAttribPointer( - attribIndex, - member.components, - gl[AttributeType[member.type]], - false, - this.arrayType.bytesPerElement, - member.offset - ); + if (attribIndex !== undefined) { + gl.vertexAttribPointer(attribIndex, member.components, gl[AttributeType[member.type]], false, this.arrayType.bytesPerElement, member.offset); + } } }; - -/** - * Destroy the GL buffer bound to the given WebGL context - * @private - * @param gl The WebGL context - */ -Buffer.prototype.destroy = function(gl) { +Buffer.prototype.destroy = function (gl) { if (this.buffer) { gl.deleteBuffer(this.buffer); } }; - -/** - * @enum {string} BufferType - * @private - * @readonly - */ Buffer.BufferType = { VERTEX: 'ARRAY_BUFFER', ELEMENT: 'ELEMENT_ARRAY_BUFFER' }; - -/** - * An `BufferType.ELEMENT` buffer holds indicies of a corresponding `BufferType.VERTEX` buffer. - * These indicies are stored in the `BufferType.ELEMENT` buffer as `UNSIGNED_SHORT`s. - * - * @private - * @readonly - */ -Buffer.ELEMENT_ATTRIBUTE_TYPE = 'Uint16'; - -/** - * WebGL performs best if vertex attribute offsets are aligned to 4 byte boundaries. - * @private - * @readonly - */ -Buffer.VERTEX_ATTRIBUTE_ALIGNMENT = 4; - -},{"assert":6}],23:[function(require,module,exports){ +},{}],29:[function(require,module,exports){ 'use strict'; - -var Point = require('point-geometry'); -var loadGeometry = require('./load_geometry'); -var EXTENT = require('./bucket').EXTENT; -var featureFilter = require('feature-filter'); -var StructArrayType = require('../util/struct_array'); -var Grid = require('grid-index'); -var DictionaryCoder = require('../util/dictionary_coder'); -var vt = require('vector-tile'); +var util = require('../util/util'); +var Buffer = require('./buffer'); +var VertexArrayObject = require('../render/vertex_array_object'); +module.exports = BufferGroup; +function BufferGroup(arrayGroup, arrayTypes) { + this.layoutVertexBuffer = new Buffer(arrayGroup.layoutVertexArray, arrayTypes.layoutVertexArrayType, Buffer.BufferType.VERTEX); + if (arrayGroup.elementArray) { + this.elementBuffer = new Buffer(arrayGroup.elementArray, arrayTypes.elementArrayType, Buffer.BufferType.ELEMENT); + } + var vaos = this.vaos = {}; + var secondVaos; + if (arrayGroup.elementArray2) { + this.elementBuffer2 = new Buffer(arrayGroup.elementArray2, arrayTypes.elementArrayType2, Buffer.BufferType.ELEMENT); + secondVaos = this.secondVaos = {}; + } + this.paintVertexBuffers = util.mapObject(arrayGroup.paintVertexArrays, function (array, name) { + vaos[name] = new VertexArrayObject(); + if (arrayGroup.elementArray2) { + secondVaos[name] = new VertexArrayObject(); + } + return new Buffer(array, arrayTypes.paintVertexArrayTypes[name], Buffer.BufferType.VERTEX); + }); +} +BufferGroup.prototype.destroy = function (gl) { + this.layoutVertexBuffer.destroy(gl); + if (this.elementBuffer) { + this.elementBuffer.destroy(gl); + } + if (this.elementBuffer2) { + this.elementBuffer2.destroy(gl); + } + for (var n in this.paintVertexBuffers) { + this.paintVertexBuffers[n].destroy(gl); + } + for (var j in this.vaos) { + this.vaos[j].destroy(gl); + } + for (var k in this.secondVaos) { + this.secondVaos[k].destroy(gl); + } +}; +},{"../render/vertex_array_object":51,"../util/util":136,"./buffer":28}],30:[function(require,module,exports){ +'use strict'; +var Point = require('point-geometry'); +var loadGeometry = require('./load_geometry'); +var EXTENT = require('./bucket').EXTENT; +var featureFilter = require('feature-filter'); +var StructArrayType = require('../util/struct_array'); +var Grid = require('grid-index'); +var DictionaryCoder = require('../util/dictionary_coder'); +var vt = require('vector-tile'); var Protobuf = require('pbf'); var GeoJSONFeature = require('../util/vectortile_to_geojson'); var arraysIntersect = require('../util/util').arraysIntersect; - var intersection = require('../util/intersection_tests'); var multiPolygonIntersectsBufferedMultiPoint = intersection.multiPolygonIntersectsBufferedMultiPoint; var multiPolygonIntersectsMultiPolygon = intersection.multiPolygonIntersectsMultiPolygon; var multiPolygonIntersectsBufferedMultiLine = intersection.multiPolygonIntersectsBufferedMultiLine; - - var FeatureIndexArray = new StructArrayType({ members: [ - // the index of the feature in the original vectortile - { type: 'Uint32', name: 'featureIndex' }, - // the source layer the feature appears in - { type: 'Uint16', name: 'sourceLayerIndex' }, - // the bucket the feature appears in - { type: 'Uint16', name: 'bucketIndex' } - ]}); - + { + type: 'Uint32', + name: 'featureIndex' + }, + { + type: 'Uint16', + name: 'sourceLayerIndex' + }, + { + type: 'Uint16', + name: 'bucketIndex' + } + ] +}); module.exports = FeatureIndex; - function FeatureIndex(coord, overscaling, collisionTile) { if (coord.grid) { var serialized = coord; @@ -14231,18 +14980,18 @@ function FeatureIndex(coord, overscaling, collisionTile) { this.z = coord.z - Math.log(overscaling) / Math.LN2; this.setCollisionTile(collisionTile); } - -FeatureIndex.prototype.insert = function(feature, featureIndex, sourceLayerIndex, bucketIndex) { +FeatureIndex.prototype.insert = function (feature, featureIndex, sourceLayerIndex, bucketIndex) { var key = this.featureIndexArray.length; this.featureIndexArray.emplaceBack(featureIndex, sourceLayerIndex, bucketIndex); var geometry = loadGeometry(feature); - for (var r = 0; r < geometry.length; r++) { var ring = geometry[r]; - - // TODO: skip holes when we start using vector tile spec 2.0 - - var bbox = [Infinity, Infinity, -Infinity, -Infinity]; + var bbox = [ + Infinity, + Infinity, + -Infinity, + -Infinity + ]; for (var i = 0; i < ring.length; i++) { var p = ring[i]; bbox[0] = Math.min(bbox[0], p.x); @@ -14250,16 +14999,13 @@ FeatureIndex.prototype.insert = function(feature, featureIndex, sourceLayerIndex bbox[2] = Math.max(bbox[2], p.x); bbox[3] = Math.max(bbox[3], p.y); } - this.grid.insert(key, bbox[0], bbox[1], bbox[2], bbox[3]); } }; - -FeatureIndex.prototype.setCollisionTile = function(collisionTile) { +FeatureIndex.prototype.setCollisionTile = function (collisionTile) { this.collisionTile = collisionTile; }; - -FeatureIndex.prototype.serialize = function() { +FeatureIndex.prototype.serialize = function () { var data = { coord: this.coord, overscaling: this.overscaling, @@ -14269,35 +15015,26 @@ FeatureIndex.prototype.serialize = function() { }; return { data: data, - transferables: [data.grid, data.featureIndexArray.arrayBuffer] + transferables: [ + data.grid, + data.featureIndexArray.arrayBuffer + ] }; }; - function translateDistance(translate) { return Math.sqrt(translate[0] * translate[0] + translate[1] * translate[1]); } - -// Finds features in this tile at a particular position. -FeatureIndex.prototype.query = function(args, styleLayers) { +FeatureIndex.prototype.query = function (args, styleLayers) { if (!this.vtLayers) { this.vtLayers = new vt.VectorTile(new Protobuf(new Uint8Array(this.rawTileData))).layers; this.sourceLayerCoder = new DictionaryCoder(this.vtLayers ? Object.keys(this.vtLayers).sort() : ['_geojsonTileLayer']); } - var result = {}; - - var params = args.params || {}, - pixelsToTileUnits = EXTENT / args.tileSize / args.scale, - filter = featureFilter(params.filter); - - // Features are indexed their original geometries. The rendered geometries may - // be buffered, translated or offset. Figure out how much the search radius needs to be - // expanded by to include these features. + var params = args.params || {}, pixelsToTileUnits = EXTENT / args.tileSize / args.scale, filter = featureFilter(params.filter); var additionalRadius = 0; for (var id in styleLayers) { var styleLayer = styleLayers[id]; var paint = styleLayer.paint; - var styleLayerDistance = 0; if (styleLayer.type === 'line') { styleLayerDistance = getLineWidth(paint) / 2 + Math.abs(paint['line-offset']) + translateDistance(paint['line-translate']); @@ -14308,13 +15045,11 @@ FeatureIndex.prototype.query = function(args, styleLayers) { } additionalRadius = Math.max(additionalRadius, styleLayerDistance * pixelsToTileUnits); } - - var queryGeometry = args.queryGeometry.map(function(q) { - return q.map(function(p) { + var queryGeometry = args.queryGeometry.map(function (q) { + return q.map(function (p) { return new Point(p.x, p.y); }); }); - var minX = Infinity; var minY = Infinity; var maxX = -Infinity; @@ -14329,22 +15064,17 @@ FeatureIndex.prototype.query = function(args, styleLayers) { maxY = Math.max(maxY, p.y); } } - var matching = this.grid.query(minX - additionalRadius, minY - additionalRadius, maxX + additionalRadius, maxY + additionalRadius); matching.sort(topDownFeatureComparator); this.filterMatching(result, matching, this.featureIndexArray, queryGeometry, filter, params.layers, styleLayers, args.bearing, pixelsToTileUnits); - var matchingSymbols = this.collisionTile.queryRenderedSymbols(minX, minY, maxX, maxY, args.scale); matchingSymbols.sort(); this.filterMatching(result, matchingSymbols, this.collisionTile.collisionBoxArray, queryGeometry, filter, params.layers, styleLayers, args.bearing, pixelsToTileUnits); - return result; }; - function topDownFeatureComparator(a, b) { return b - a; } - function getLineWidth(paint) { if (paint['line-gap-width'] > 0) { return paint['line-gap-width'] + 2 * paint['line-width']; @@ -14352,76 +15082,57 @@ function getLineWidth(paint) { return paint['line-width']; } } - -FeatureIndex.prototype.filterMatching = function(result, matching, array, queryGeometry, filter, filterLayerIDs, styleLayers, bearing, pixelsToTileUnits) { +FeatureIndex.prototype.filterMatching = function (result, matching, array, queryGeometry, filter, filterLayerIDs, styleLayers, bearing, pixelsToTileUnits) { var previousIndex; for (var k = 0; k < matching.length; k++) { var index = matching[k]; - - // don't check the same feature more than once - if (index === previousIndex) continue; + if (index === previousIndex) + continue; previousIndex = index; - var match = array.get(index); - var layerIDs = this.bucketLayerIDs[match.bucketIndex]; - if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs)) continue; - + if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs)) + continue; var sourceLayerName = this.sourceLayerCoder.decode(match.sourceLayerIndex); var sourceLayer = this.vtLayers[sourceLayerName]; var feature = sourceLayer.feature(match.featureIndex); - - if (!filter(feature)) continue; - + if (!filter(feature)) + continue; var geometry = null; - for (var l = 0; l < layerIDs.length; l++) { var layerID = layerIDs[l]; - if (filterLayerIDs && filterLayerIDs.indexOf(layerID) < 0) { continue; } - var styleLayer = styleLayers[layerID]; - if (!styleLayer) continue; - + if (!styleLayer) + continue; var translatedPolygon; if (styleLayer.type !== 'symbol') { - // all symbols already match the style - - if (!geometry) geometry = loadGeometry(feature); - + if (!geometry) + geometry = loadGeometry(feature); var paint = styleLayer.paint; - if (styleLayer.type === 'line') { - translatedPolygon = translate(queryGeometry, - paint['line-translate'], paint['line-translate-anchor'], - bearing, pixelsToTileUnits); + translatedPolygon = translate(queryGeometry, paint['line-translate'], paint['line-translate-anchor'], bearing, pixelsToTileUnits); var halfWidth = getLineWidth(paint) / 2 * pixelsToTileUnits; if (paint['line-offset']) { geometry = offsetLine(geometry, paint['line-offset'] * pixelsToTileUnits); } - if (!multiPolygonIntersectsBufferedMultiLine(translatedPolygon, geometry, halfWidth)) continue; - + if (!multiPolygonIntersectsBufferedMultiLine(translatedPolygon, geometry, halfWidth)) + continue; } else if (styleLayer.type === 'fill') { - translatedPolygon = translate(queryGeometry, - paint['fill-translate'], paint['fill-translate-anchor'], - bearing, pixelsToTileUnits); - if (!multiPolygonIntersectsMultiPolygon(translatedPolygon, geometry)) continue; - + translatedPolygon = translate(queryGeometry, paint['fill-translate'], paint['fill-translate-anchor'], bearing, pixelsToTileUnits); + if (!multiPolygonIntersectsMultiPolygon(translatedPolygon, geometry)) + continue; } else if (styleLayer.type === 'circle') { - translatedPolygon = translate(queryGeometry, - paint['circle-translate'], paint['circle-translate-anchor'], - bearing, pixelsToTileUnits); + translatedPolygon = translate(queryGeometry, paint['circle-translate'], paint['circle-translate-anchor'], bearing, pixelsToTileUnits); var circleRadius = paint['circle-radius'] * pixelsToTileUnits; - if (!multiPolygonIntersectsBufferedMultiPoint(translatedPolygon, geometry, circleRadius)) continue; + if (!multiPolygonIntersectsBufferedMultiPoint(translatedPolygon, geometry, circleRadius)) + continue; } } - var geojsonFeature = new GeoJSONFeature(feature, this.z, this.x, this.y); - geojsonFeature.layer = styleLayer.serialize({ - includeRefProperties: true - }); + geojsonFeature.layer = styleLayer.serialize({ includeRefProperties: true }); var layerResult = result[layerID]; if (layerResult === undefined) { layerResult = result[layerID] = []; @@ -14430,18 +15141,14 @@ FeatureIndex.prototype.filterMatching = function(result, matching, array, queryG } } }; - function translate(queryGeometry, translate, translateAnchor, bearing, pixelsToTileUnits) { if (!translate[0] && !translate[1]) { return queryGeometry; } - translate = Point.convert(translate); - - if (translateAnchor === "viewport") { + if (translateAnchor === 'viewport') { translate._rotate(-bearing); } - var translated = []; for (var i = 0; i < queryGeometry.length; i++) { var ring = queryGeometry[i]; @@ -14453,7 +15160,6 @@ function translate(queryGeometry, translate, translateAnchor, bearing, pixelsToT } return translated; } - function offsetLine(rings, offset) { var newRings = []; var zero = new Point(0, 0); @@ -14467,160 +15173,81 @@ function offsetLine(rings, offset) { var aToB = i === 0 ? zero : b.sub(a)._unit()._perp(); var bToC = i === ring.length - 1 ? zero : c.sub(b)._unit()._perp(); var extrude = aToB._add(bToC)._unit(); - var cosHalfAngle = extrude.x * bToC.x + extrude.y * bToC.y; extrude._mult(1 / cosHalfAngle); - newRing.push(extrude._mult(offset)._add(b)); } newRings.push(newRing); } return newRings; } - -},{"../util/dictionary_coder":110,"../util/intersection_tests":114,"../util/struct_array":117,"../util/util":119,"../util/vectortile_to_geojson":120,"./bucket":17,"./load_geometry":24,"feature-filter":122,"grid-index":143,"pbf":172,"point-geometry":174,"vector-tile":183}],24:[function(require,module,exports){ +},{"../util/dictionary_coder":126,"../util/intersection_tests":131,"../util/struct_array":134,"../util/util":136,"../util/vectortile_to_geojson":137,"./bucket":23,"./load_geometry":31,"feature-filter":140,"grid-index":162,"pbf":192,"point-geometry":194,"vector-tile":204}],31:[function(require,module,exports){ 'use strict'; - +var util = require('../util/util'); var EXTENT = require('./bucket').EXTENT; -var EXTENT_MIN = EXTENT * -2; -var EXTENT_MAX = (EXTENT * 2) - 1; - -// only log a geometry warning once per context -var warned = false; - -/** - * Loads a geometry from a VectorTileFeature and scales it to the common extent - * used internally. - * @private - */ -module.exports = function loadGeometry(feature) { +function createBounds(bits) { + return { + min: -1 * Math.pow(2, bits - 1), + max: Math.pow(2, bits - 1) - 1 + }; +} +var boundsLookup = { + 15: createBounds(15), + 16: createBounds(16) +}; +module.exports = function loadGeometry(feature, bits) { + var bounds = boundsLookup[bits || 16]; var scale = EXTENT / feature.extent; var geometry = feature.loadGeometry(); for (var r = 0; r < geometry.length; r++) { var ring = geometry[r]; for (var p = 0; p < ring.length; p++) { var point = ring[p]; - // round here because mapbox-gl-native uses integers to represent - // points and we need to do the same to avoid renering differences. point.x = Math.round(point.x * scale); point.y = Math.round(point.y * scale); - if (warned === false && ( - point.x < EXTENT_MIN || - point.x > EXTENT_MAX || - point.y < EXTENT_MIN || - point.y > EXTENT_MAX)) { - console.warn('Geometry exceeds allowed extent, reduce your vector tile buffer size'); - warned = true; + if (point.x < bounds.min || point.x > bounds.max || point.y < bounds.min || point.y > bounds.max) { + util.warnOnce('Geometry exceeds allowed extent, reduce your vector tile buffer size'); } } } return geometry; }; - -},{"./bucket":17}],25:[function(require,module,exports){ +},{"../util/util":136,"./bucket":23}],32:[function(require,module,exports){ 'use strict'; - module.exports = Coordinate; - -/** - * A coordinate is a column, row, zoom combination, often used - * as the data component of a tile. - * - * @param {number} column - * @param {number} row - * @param {number} zoom - * @private - */ function Coordinate(column, row, zoom) { this.column = column; this.row = row; this.zoom = zoom; } - Coordinate.prototype = { - - /** - * Create a clone of this coordinate that can be mutated without - * changing the original coordinate - * - * @returns {Coordinate} clone - * @private - * var coord = new Coordinate(0, 0, 0); - * var c2 = coord.clone(); - * // since coord is cloned, modifying a property of c2 does - * // not modify it. - * c2.zoom = 2; - */ - clone: function() { + clone: function () { return new Coordinate(this.column, this.row, this.zoom); }, - - /** - * Zoom this coordinate to a given zoom level. This returns a new - * coordinate object, not mutating the old one. - * - * @param {number} zoom - * @returns {Coordinate} zoomed coordinate - * @private - * @example - * var coord = new Coordinate(0, 0, 0); - * var c2 = coord.zoomTo(1); - * c2 // equals new Coordinate(0, 0, 1); - */ - zoomTo: function(zoom) { return this.clone()._zoomTo(zoom); }, - - /** - * Subtract the column and row values of this coordinate from those - * of another coordinate. The other coordinat will be zoomed to the - * same level as `this` before the subtraction occurs - * - * @param {Coordinate} c other coordinate - * @returns {Coordinate} result - * @private - */ - sub: function(c) { return this.clone()._sub(c); }, - - _zoomTo: function(zoom) { + zoomTo: function (zoom) { + return this.clone()._zoomTo(zoom); + }, + sub: function (c) { + return this.clone()._sub(c); + }, + _zoomTo: function (zoom) { var scale = Math.pow(2, zoom - this.zoom); this.column *= scale; this.row *= scale; this.zoom = zoom; return this; }, - - _sub: function(c) { + _sub: function (c) { c = c.zoomTo(this.zoom); this.column -= c.column; this.row -= c.row; return this; } }; - -},{}],26:[function(require,module,exports){ +},{}],33:[function(require,module,exports){ 'use strict'; - module.exports = LngLat; - var wrap = require('../util/util').wrap; - -/** - * Create a longitude, latitude object from a given longitude and latitude pair in degrees. - * Mapbox GL uses Longitude, Latitude coordinate order to match GeoJSON. - * - * Note that any Mapbox GL method that accepts a `LngLat` object can also accept an - * `Array` and will perform an implicit conversion. The following lines are equivalent: - ``` - map.setCenter([-73.9749, 40.7736]); - map.setCenter( new mapboxgl.LngLat(-73.9749, 40.7736) ); - ``` - * - * @class LngLat - * @classdesc A representation of a longitude, latitude point, in degrees. - * @param {number} lng longitude - * @param {number} lat latitude - * @example - * var ll = new mapboxgl.LngLat(-73.9749, 40.7736); - */ function LngLat(lng, lat) { if (isNaN(lng) || isNaN(lat)) { throw new Error('Invalid LngLat object: (' + lng + ', ' + lat + ')'); @@ -14631,55 +15258,18 @@ function LngLat(lng, lat) { throw new Error('Invalid LngLat latitude value: must be between -90 and 90'); } } - -/** - * Return a new `LngLat` object whose longitude is wrapped to the range (-180, 180). - * - * @returns {LngLat} wrapped LngLat object - * @example - * var ll = new mapboxgl.LngLat(286.0251, 40.7736); - * var wrapped = ll.wrap(); - * wrapped.lng; // = -73.9749 - */ LngLat.prototype.wrap = function () { return new LngLat(wrap(this.lng, -180, 180), this.lat); }; - -/** - * Return a `LngLat` as an array - * - * @returns {array} [lng, lat] - * @example - * var ll = new mapboxgl.LngLat(-73.9749, 40.7736); - * ll.toArray(); // = [-73.9749, 40.7736] - */ LngLat.prototype.toArray = function () { - return [this.lng, this.lat]; + return [ + this.lng, + this.lat + ]; }; - -/** - * Return a `LngLat` as a string - * - * @returns {string} "LngLat(lng, lat)" - * @example - * var ll = new mapboxgl.LngLat(-73.9749, 40.7736); - * ll.toString(); // = "LngLat(-73.9749, 40.7736)" - */ LngLat.prototype.toString = function () { return 'LngLat(' + this.lng + ', ' + this.lat + ')'; }; - -/** - * Convert an array to a `LngLat` object, or return an existing `LngLat` object - * unchanged. - * - * @param {Array|LngLat} input `input` to convert - * @returns {LngLat} LngLat object or original input - * @example - * var arr = [-73.9749, 40.7736]; - * var ll = mapboxgl.LngLat.convert(arr); - * ll; // = LngLat {lng: -73.9749, lat: 40.7736} - */ LngLat.convert = function (input) { if (input instanceof LngLat) { return input; @@ -14689,215 +15279,107 @@ LngLat.convert = function (input) { } return input; }; - -},{"../util/util":119}],27:[function(require,module,exports){ +},{"../util/util":136}],34:[function(require,module,exports){ 'use strict'; - module.exports = LngLatBounds; - var LngLat = require('./lng_lat'); - -/** - * Creates a bounding box from the given pair of points. If parameteres are omitted, a `null` bounding box is created. - * - * @class LngLatBounds - * @classdesc A representation of rectangular box on the earth, defined by its southwest and northeast points in longitude and latitude. - * @param {LngLat} sw southwest - * @param {LngLat} ne northeast - * @example - * var sw = new mapboxgl.LngLat(-73.9876, 40.7661); - * var ne = new mapboxgl.LngLat(-73.9397, 40.8002); - * var llb = new mapboxgl.LngLatBounds(sw, ne); - */ function LngLatBounds(sw, ne) { if (!sw) { return; } else if (ne) { this.extend(sw).extend(ne); } else if (sw.length === 4) { - this.extend([sw[0], sw[1]]).extend([sw[2], sw[3]]); + this.extend([ + sw[0], + sw[1] + ]).extend([ + sw[2], + sw[3] + ]); } else { this.extend(sw[0]).extend(sw[1]); } } - LngLatBounds.prototype = { - - /** - * Extend the bounds to include a given LngLat or LngLatBounds. - * - * @param {LngLat|LngLatBounds} obj object to extend to - * @returns {LngLatBounds} `this` - */ - extend: function(obj) { - var sw = this._sw, - ne = this._ne, - sw2, ne2; - + extend: function (obj) { + var sw = this._sw, ne = this._ne, sw2, ne2; if (obj instanceof LngLat) { sw2 = obj; ne2 = obj; - } else if (obj instanceof LngLatBounds) { sw2 = obj._sw; ne2 = obj._ne; - - if (!sw2 || !ne2) return this; - + if (!sw2 || !ne2) + return this; } else { return obj ? this.extend(LngLat.convert(obj) || LngLatBounds.convert(obj)) : this; } - if (!sw && !ne) { this._sw = new LngLat(sw2.lng, sw2.lat); this._ne = new LngLat(ne2.lng, ne2.lat); - } else { sw.lng = Math.min(sw2.lng, sw.lng); sw.lat = Math.min(sw2.lat, sw.lat); ne.lng = Math.max(ne2.lng, ne.lng); ne.lat = Math.max(ne2.lat, ne.lat); } - return this; }, - - /** - * Get the point equidistant from this box's corners - * @returns {LngLat} centerpoint - * @example - * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); - * llb.getCenter(); // = LngLat {lng: -73.96365, lat: 40.78315} - */ - getCenter: function() { + getCenter: function () { return new LngLat((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2); }, - - /** - * Get southwest corner - * @returns {LngLat} southwest - */ - getSouthWest: function() { return this._sw; }, - - /** - * Get northeast corner - * @returns {LngLat} northeast - */ - getNorthEast: function() { return this._ne; }, - - /** - * Get northwest corner - * @returns {LngLat} northwest - */ - getNorthWest: function() { return new LngLat(this.getWest(), this.getNorth()); }, - - /** - * Get southeast corner - * @returns {LngLat} southeast - */ - getSouthEast: function() { return new LngLat(this.getEast(), this.getSouth()); }, - - /** - * Get west edge longitude - * @returns {number} west - */ - getWest: function() { return this._sw.lng; }, - - /** - * Get south edge latitude - * @returns {number} south - */ - getSouth: function() { return this._sw.lat; }, - - /** - * Get east edge longitude - * @returns {number} east - */ - getEast: function() { return this._ne.lng; }, - - /** - * Get north edge latitude - * @returns {number} north - */ - getNorth: function() { return this._ne.lat; }, - - /** - * Return a `LngLatBounds` as an array - * - * @returns {array} [lng, lat] - * @example - * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); - * llb.toArray(); // = [[-73.9876, 40.7661], [-73.9397, 40.8002]] - */ + getSouthWest: function () { + return this._sw; + }, + getNorthEast: function () { + return this._ne; + }, + getNorthWest: function () { + return new LngLat(this.getWest(), this.getNorth()); + }, + getSouthEast: function () { + return new LngLat(this.getEast(), this.getSouth()); + }, + getWest: function () { + return this._sw.lng; + }, + getSouth: function () { + return this._sw.lat; + }, + getEast: function () { + return this._ne.lng; + }, + getNorth: function () { + return this._ne.lat; + }, toArray: function () { - return [this._sw.toArray(), this._ne.toArray()]; + return [ + this._sw.toArray(), + this._ne.toArray() + ]; }, - - /** - * Return a `LngLatBounds` as a string - * - * @returns {string} "LngLatBounds(LngLat(lng, lat), LngLat(lng, lat))" - * @example - * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); - * llb.toString(); // = "LngLatBounds(LngLat(-73.9876, 40.7661), LngLat(-73.9397, 40.8002))" - */ toString: function () { return 'LngLatBounds(' + this._sw.toString() + ', ' + this._ne.toString() + ')'; } }; - -/** - * Convert an array to a `LngLatBounds` object, or return an existing - * `LngLatBounds` object unchanged. - * - * Calls `LngLat#convert` internally to convert arrays as `LngLat` values. - * - * @param {LngLatBounds|Array|Array>} input input to convert to a LngLatBounds - * @returns {LngLatBounds} LngLatBounds object or original input - * @example - * var arr = [[-73.9876, 40.7661], [-73.9397, 40.8002]]; - * var llb = mapboxgl.LngLatBounds.convert(arr); - * llb; // = LngLatBounds {_sw: LngLat {lng: -73.9876, lat: 40.7661}, _ne: LngLat {lng: -73.9397, lat: 40.8002}} - */ LngLatBounds.convert = function (input) { - if (!input || input instanceof LngLatBounds) return input; + if (!input || input instanceof LngLatBounds) + return input; return new LngLatBounds(input); }; - -},{"./lng_lat":26}],28:[function(require,module,exports){ +},{"./lng_lat":33}],35:[function(require,module,exports){ 'use strict'; - -var LngLat = require('./lng_lat'), - Point = require('point-geometry'), - Coordinate = require('./coordinate'), - wrap = require('../util/util').wrap, - interp = require('../util/interpolate'), - TileCoord = require('../source/tile_coord'), - EXTENT = require('../data/bucket').EXTENT, - glmatrix = require('gl-matrix'); - -var vec4 = glmatrix.vec4, - mat4 = glmatrix.mat4, - mat2 = glmatrix.mat2; - +var LngLat = require('./lng_lat'), Point = require('point-geometry'), Coordinate = require('./coordinate'), wrap = require('../util/util').wrap, interp = require('../util/interpolate'), TileCoord = require('../source/tile_coord'), EXTENT = require('../data/bucket').EXTENT, glmatrix = require('gl-matrix'); +var vec4 = glmatrix.vec4, mat4 = glmatrix.mat4, mat2 = glmatrix.mat2; module.exports = Transform; - -/** - * A single transform, generally used for a single tile to be - * scaled, rotated, and zoomed. - * - * @param {number} minZoom - * @param {number} maxZoom - * @private - */ function Transform(minZoom, maxZoom) { - this.tileSize = 512; // constant - + this.tileSize = 512; this._minZoom = minZoom || 0; this._maxZoom = maxZoom || 22; - - this.latRange = [-85.05113, 85.05113]; - + this.latRange = [ + -85.05113, + 85.05113 + ]; this.width = 0; this.height = 0; this._center = new LngLat(0, 0); @@ -14907,160 +15389,168 @@ function Transform(minZoom, maxZoom) { this._pitch = 0; this._unmodified = true; } - Transform.prototype = { - get minZoom() { return this._minZoom; }, + get minZoom() { + return this._minZoom; + }, set minZoom(zoom) { - if (this._minZoom === zoom) return; + if (this._minZoom === zoom) + return; this._minZoom = zoom; this.zoom = Math.max(this.zoom, zoom); }, - - get maxZoom() { return this._maxZoom; }, + get maxZoom() { + return this._maxZoom; + }, set maxZoom(zoom) { - if (this._maxZoom === zoom) return; + if (this._maxZoom === zoom) + return; this._maxZoom = zoom; this.zoom = Math.min(this.zoom, zoom); }, - get worldSize() { return this.tileSize * this.scale; }, - get centerPoint() { return this.size._div(2); }, - get size() { return new Point(this.width, this.height); }, - get bearing() { return -this.angle / Math.PI * 180; }, set bearing(bearing) { var b = -wrap(bearing, -180, 180) * Math.PI / 180; - if (this.angle === b) return; + if (this.angle === b) + return; this._unmodified = false; this.angle = b; - this._calcProjMatrix(); - - // 2x2 matrix for rotating points + this._calcMatrices(); this.rotationMatrix = mat2.create(); mat2.rotate(this.rotationMatrix, this.rotationMatrix, this.angle); }, - get pitch() { return this._pitch / Math.PI * 180; }, set pitch(pitch) { var p = Math.min(60, pitch) / 180 * Math.PI; - if (this._pitch === p) return; + if (this._pitch === p) + return; this._unmodified = false; this._pitch = p; - this._calcProjMatrix(); + this._calcMatrices(); }, - get altitude() { return this._altitude; }, set altitude(altitude) { var a = Math.max(0.75, altitude); - if (this._altitude === a) return; + if (this._altitude === a) + return; this._unmodified = false; this._altitude = a; - this._calcProjMatrix(); + this._calcMatrices(); + }, + get zoom() { + return this._zoom; }, - - get zoom() { return this._zoom; }, set zoom(zoom) { var z = Math.min(Math.max(zoom, this.minZoom), this.maxZoom); - if (this._zoom === z) return; + if (this._zoom === z) + return; this._unmodified = false; this._zoom = z; this.scale = this.zoomScale(z); this.tileZoom = Math.floor(z); this.zoomFraction = z - this.tileZoom; - this._calcProjMatrix(); + this._calcMatrices(); this._constrain(); }, - - get center() { return this._center; }, + get center() { + return this._center; + }, set center(center) { - if (center.lat === this._center.lat && center.lng === this._center.lng) return; + if (center.lat === this._center.lat && center.lng === this._center.lng) + return; this._unmodified = false; this._center = center; - this._calcProjMatrix(); + this._calcMatrices(); this._constrain(); }, - - resize: function(width, height) { + coveringZoomLevel: function (options) { + return (options.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / options.tileSize)); + }, + coveringTiles: function (options) { + var z = this.coveringZoomLevel(options); + var actualZ = z; + if (z < options.minzoom) + return []; + if (z > options.maxzoom) + z = options.maxzoom; + var tr = this, tileCenter = tr.locationCoordinate(tr.center)._zoomTo(z), centerPoint = new Point(tileCenter.column - 0.5, tileCenter.row - 0.5); + return TileCoord.cover(z, [ + tr.pointCoordinate(new Point(0, 0))._zoomTo(z), + tr.pointCoordinate(new Point(tr.width, 0))._zoomTo(z), + tr.pointCoordinate(new Point(tr.width, tr.height))._zoomTo(z), + tr.pointCoordinate(new Point(0, tr.height))._zoomTo(z) + ], options.reparseOverscaled ? actualZ : z).sort(function (a, b) { + return centerPoint.dist(a) - centerPoint.dist(b); + }); + }, + resize: function (width, height) { this.width = width; this.height = height; - - this.pixelsToGLUnits = [2 / width, -2 / height]; - this._calcProjMatrix(); + this.pixelsToGLUnits = [ + 2 / width, + -2 / height + ]; + this._calcMatrices(); this._constrain(); }, - - get unmodified() { return this._unmodified; }, - - zoomScale: function(zoom) { return Math.pow(2, zoom); }, - scaleZoom: function(scale) { return Math.log(scale) / Math.LN2; }, - - project: function(lnglat, worldSize) { - return new Point( - this.lngX(lnglat.lng, worldSize), - this.latY(lnglat.lat, worldSize)); + get unmodified() { + return this._unmodified; }, - - unproject: function(point, worldSize) { - return new LngLat( - this.xLng(point.x, worldSize), - this.yLat(point.y, worldSize)); + zoomScale: function (zoom) { + return Math.pow(2, zoom); }, - - get x() { return this.lngX(this.center.lng); }, - get y() { return this.latY(this.center.lat); }, - - get point() { return new Point(this.x, this.y); }, - - /** - * latitude to absolute x coord - * @param {number} lon - * @param {number} [worldSize=this.worldSize] - * @returns {number} pixel coordinate - * @private - */ - lngX: function(lng, worldSize) { + scaleZoom: function (scale) { + return Math.log(scale) / Math.LN2; + }, + project: function (lnglat, worldSize) { + return new Point(this.lngX(lnglat.lng, worldSize), this.latY(lnglat.lat, worldSize)); + }, + unproject: function (point, worldSize) { + return new LngLat(this.xLng(point.x, worldSize), this.yLat(point.y, worldSize)); + }, + get x() { + return this.lngX(this.center.lng); + }, + get y() { + return this.latY(this.center.lat); + }, + get point() { + return new Point(this.x, this.y); + }, + lngX: function (lng, worldSize) { return (180 + lng) * (worldSize || this.worldSize) / 360; }, - /** - * latitude to absolute y coord - * @param {number} lat - * @param {number} [worldSize=this.worldSize] - * @returns {number} pixel coordinate - * @private - */ - latY: function(lat, worldSize) { + latY: function (lat, worldSize) { var y = 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360)); return (180 - y) * (worldSize || this.worldSize) / 360; }, - - xLng: function(x, worldSize) { + xLng: function (x, worldSize) { return x * 360 / (worldSize || this.worldSize) - 180; }, - yLat: function(y, worldSize) { + yLat: function (y, worldSize) { var y2 = 180 - y * 360 / (worldSize || this.worldSize); return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90; }, - - panBy: function(offset) { + panBy: function (offset) { var point = this.centerPoint._add(offset); this.center = this.pointLocation(point); }, - - setLocationAtPoint: function(lnglat, point) { + setLocationAtPoint: function (lnglat, point) { var c = this.locationCoordinate(lnglat); var coordAtPoint = this.pointCoordinate(point); var coordCenter = this.pointCoordinate(this.centerPoint); @@ -15068,77 +15558,36 @@ Transform.prototype = { this._unmodified = false; this.center = this.coordinateLocation(coordCenter._sub(translate)); }, - - /** - * Given a location, return the screen point that corresponds to it - * @param {LngLat} lnglat location - * @returns {Point} screen point - * @private - */ - locationPoint: function(lnglat) { + locationPoint: function (lnglat) { return this.coordinatePoint(this.locationCoordinate(lnglat)); }, - - /** - * Given a point on screen, return its lnglat - * @param {Point} p screen point - * @returns {LngLat} lnglat location - * @private - */ - pointLocation: function(p) { + pointLocation: function (p) { return this.coordinateLocation(this.pointCoordinate(p)); }, - - /** - * Given a geographical lnglat, return an unrounded - * coordinate that represents it at this transform's zoom level and - * worldsize. - * @param {LngLat} lnglat - * @returns {Coordinate} - * @private - */ - locationCoordinate: function(lnglat) { - var k = this.zoomScale(this.tileZoom) / this.worldSize, - ll = LngLat.convert(lnglat); - - return new Coordinate( - this.lngX(ll.lng) * k, - this.latY(ll.lat) * k, - this.tileZoom); + locationCoordinate: function (lnglat) { + var k = this.zoomScale(this.tileZoom) / this.worldSize, ll = LngLat.convert(lnglat); + return new Coordinate(this.lngX(ll.lng) * k, this.latY(ll.lat) * k, this.tileZoom); }, - - /** - * Given a Coordinate, return its geographical position. - * @param {Coordinate} coord - * @returns {LngLat} lnglat - * @private - */ - coordinateLocation: function(coord) { + coordinateLocation: function (coord) { var worldSize = this.zoomScale(coord.zoom); - return new LngLat( - this.xLng(coord.column, worldSize), - this.yLat(coord.row, worldSize)); + return new LngLat(this.xLng(coord.column, worldSize), this.yLat(coord.row, worldSize)); }, - - pointCoordinate: function(p) { - + pointCoordinate: function (p) { var targetZ = 0; - - var matrix = this.coordinatePointMatrix(this.tileZoom); - mat4.invert(matrix, matrix); - - if (!matrix) throw new Error("failed to invert matrix"); - - // since we don't know the correct projected z value for the point, - // unproject two points to get a line and then find the point on that - // line with z=0 - - var coord0 = [p.x, p.y, 0, 1]; - var coord1 = [p.x, p.y, 1, 1]; - - vec4.transformMat4(coord0, coord0, matrix); - vec4.transformMat4(coord1, coord1, matrix); - + var coord0 = [ + p.x, + p.y, + 0, + 1 + ]; + var coord1 = [ + p.x, + p.y, + 1, + 1 + ]; + vec4.transformMat4(coord0, coord0, this.pixelMatrixInverse); + vec4.transformMat4(coord1, coord1, this.pixelMatrixInverse); var w0 = coord0[3]; var w1 = coord1[3]; var x0 = coord0[0] / w0; @@ -15147,568 +15596,3239 @@ Transform.prototype = { var y1 = coord1[1] / w1; var z0 = coord0[2] / w0; var z1 = coord1[2] / w1; - - var t = z0 === z1 ? 0 : (targetZ - z0) / (z1 - z0); - - return new Coordinate( - interp(x0, x1, t), - interp(y0, y1, t), - this.tileZoom); - }, - - /** - * Given a coordinate, return the screen point that corresponds to it - * @param {Coordinate} coord - * @returns {Point} screen point - * @private - */ - coordinatePoint: function(coord) { - var matrix = this.coordinatePointMatrix(coord.zoom); - var p = [coord.column, coord.row, 0, 1]; - vec4.transformMat4(p, p, matrix); + var scale = this.worldSize / this.zoomScale(this.tileZoom); + return new Coordinate(interp(x0, x1, t) / scale, interp(y0, y1, t) / scale, this.tileZoom); + }, + coordinatePoint: function (coord) { + var scale = this.worldSize / this.zoomScale(coord.zoom); + var p = [ + coord.column * scale, + coord.row * scale, + 0, + 1 + ]; + vec4.transformMat4(p, p, this.pixelMatrix); return new Point(p[0] / p[3], p[1] / p[3]); }, - - coordinatePointMatrix: function(z) { - var proj = mat4.copy(new Float64Array(16), this.projMatrix); - var scale = this.worldSize / this.zoomScale(z); - mat4.scale(proj, proj, [scale, scale, 1]); - mat4.multiply(proj, this.getPixelMatrix(), proj); - return proj; - }, - - /** - * converts gl coordinates -1..1 to pixels 0..width - * @returns {Object} matrix - * @private - */ - getPixelMatrix: function() { - var m = mat4.create(); - mat4.scale(m, m, [this.width / 2, -this.height / 2, 1]); - mat4.translate(m, m, [1, -1, 0]); - return m; - }, - - /** - * Calculate the posMatrix that, given a tile coordinate, would be used to display the tile on a map. - * @param {TileCoord|Coordinate} coord - * @param {Number} maxZoom maximum source zoom to account for overscaling - * @private - */ - calculatePosMatrix: function(coord, maxZoom) { - if (maxZoom === undefined) maxZoom = Infinity; - if (coord instanceof TileCoord) coord = coord.toCoordinate(maxZoom); - - // Initialize model-view matrix that converts from the tile coordinates to screen coordinates. - - // if z > maxzoom then the tile is actually a overscaled maxzoom tile, - // so calculate the matrix the maxzoom tile would use. + calculatePosMatrix: function (coord, maxZoom) { + if (maxZoom === undefined) + maxZoom = Infinity; + if (coord instanceof TileCoord) + coord = coord.toCoordinate(maxZoom); var z = Math.min(coord.zoom, maxZoom); - var scale = this.worldSize / Math.pow(2, z); var posMatrix = new Float64Array(16); - mat4.identity(posMatrix); - mat4.translate(posMatrix, posMatrix, [coord.column * scale, coord.row * scale, 0]); - mat4.scale(posMatrix, posMatrix, [ scale / EXTENT, scale / EXTENT, 1 ]); + mat4.translate(posMatrix, posMatrix, [ + coord.column * scale, + coord.row * scale, + 0 + ]); + mat4.scale(posMatrix, posMatrix, [ + scale / EXTENT, + scale / EXTENT, + 1 + ]); mat4.multiply(posMatrix, this.projMatrix, posMatrix); - return new Float32Array(posMatrix); }, - - _constrain: function() { - if (!this.center || !this.width || !this.height || this._constraining) return; - + _constrain: function () { + if (!this.center || !this.width || !this.height || this._constraining) + return; this._constraining = true; - - var minY, maxY, minX, maxX, sy, sx, x2, y2, - size = this.size, - unmodified = this._unmodified; - + var minY, maxY, minX, maxX, sy, sx, x2, y2, size = this.size, unmodified = this._unmodified; if (this.latRange) { minY = this.latY(this.latRange[1]); maxY = this.latY(this.latRange[0]); sy = maxY - minY < size.y ? size.y / (maxY - minY) : 0; } - if (this.lngRange) { minX = this.lngX(this.lngRange[0]); maxX = this.lngX(this.lngRange[1]); sx = maxX - minX < size.x ? size.x / (maxX - minX) : 0; } - - // how much the map should scale to fit the screen into given latitude/longitude ranges var s = Math.max(sx || 0, sy || 0); - if (s) { - this.center = this.unproject(new Point( - sx ? (maxX + minX) / 2 : this.x, - sy ? (maxY + minY) / 2 : this.y)); + this.center = this.unproject(new Point(sx ? (maxX + minX) / 2 : this.x, sy ? (maxY + minY) / 2 : this.y)); this.zoom += this.scaleZoom(s); this._unmodified = unmodified; this._constraining = false; return; } - if (this.latRange) { - var y = this.y, - h2 = size.y / 2; - - if (y - h2 < minY) y2 = minY + h2; - if (y + h2 > maxY) y2 = maxY - h2; + var y = this.y, h2 = size.y / 2; + if (y - h2 < minY) + y2 = minY + h2; + if (y + h2 > maxY) + y2 = maxY - h2; } - if (this.lngRange) { - var x = this.x, - w2 = size.x / 2; - - if (x - w2 < minX) x2 = minX + w2; - if (x + w2 > maxX) x2 = maxX - w2; + var x = this.x, w2 = size.x / 2; + if (x - w2 < minX) + x2 = minX + w2; + if (x + w2 > maxX) + x2 = maxX - w2; } - - // pan the map if the screen goes off the range if (x2 !== undefined || y2 !== undefined) { - this.center = this.unproject(new Point( - x2 !== undefined ? x2 : this.x, - y2 !== undefined ? y2 : this.y)); + this.center = this.unproject(new Point(x2 !== undefined ? x2 : this.x, y2 !== undefined ? y2 : this.y)); } - this._unmodified = unmodified; this._constraining = false; }, - - _calcProjMatrix: function() { - var m = new Float64Array(16); - - // Find the distance from the center point to the center top in altitude units using law of sines. + _calcMatrices: function () { + if (!this.height) + return; var halfFov = Math.atan(0.5 / this.altitude); var topHalfSurfaceDistance = Math.sin(halfFov) * this.altitude / Math.sin(Math.PI / 2 - this._pitch - halfFov); - - // Calculate z value of the farthest fragment that should be rendered. var farZ = Math.cos(Math.PI / 2 - this._pitch) * topHalfSurfaceDistance + this.altitude; - - mat4.perspective(m, 2 * Math.atan((this.height / 2) / this.altitude), this.width / this.height, 0.1, farZ); - - mat4.translate(m, m, [0, 0, -this.altitude]); - - // After the rotateX, z values are in pixel units. Convert them to - // altitude units. 1 altitude unit = the screen height. - mat4.scale(m, m, [1, -1, 1 / this.height]); - + var m = new Float64Array(16); + mat4.perspective(m, 2 * Math.atan(this.height / 2 / this.altitude), this.width / this.height, 0.1, farZ); + mat4.translate(m, m, [ + 0, + 0, + -this.altitude + ]); + mat4.scale(m, m, [ + 1, + -1, + 1 / this.height + ]); mat4.rotateX(m, m, this._pitch); mat4.rotateZ(m, m, this.angle); - mat4.translate(m, m, [-this.x, -this.y, 0]); - + mat4.translate(m, m, [ + -this.x, + -this.y, + 0 + ]); this.projMatrix = m; + m = mat4.create(); + mat4.scale(m, m, [ + this.width / 2, + -this.height / 2, + 1 + ]); + mat4.translate(m, m, [ + 1, + -1, + 0 + ]); + this.pixelMatrix = mat4.multiply(new Float64Array(16), m, this.projMatrix); + m = mat4.invert(new Float64Array(16), this.pixelMatrix); + if (!m) + throw new Error('failed to invert matrix'); + this.pixelMatrixInverse = m; } }; - -},{"../data/bucket":17,"../source/tile_coord":51,"../util/interpolate":113,"../util/util":119,"./coordinate":25,"./lng_lat":26,"gl-matrix":133,"point-geometry":174}],29:[function(require,module,exports){ +},{"../data/bucket":23,"../source/tile_coord":63,"../util/interpolate":130,"../util/util":136,"./coordinate":32,"./lng_lat":33,"gl-matrix":152,"point-geometry":194}],36:[function(require,module,exports){ 'use strict'; - -// Font data From Hershey Simplex Font -// http://paulbourke.net/dataformats/hershey/ var simplexFont = { - " ": [16, []], - "!": [10, [5, 21, 5, 7, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], - "\"": [16, [4, 21, 4, 14, -1, -1, 12, 21, 12, 14]], - "#": [21, [11, 25, 4, -7, -1, -1, 17, 25, 10, -7, -1, -1, 4, 12, 18, 12, -1, -1, 3, 6, 17, 6]], - "$": [20, [8, 25, 8, -4, -1, -1, 12, 25, 12, -4, -1, -1, 17, 18, 15, 20, 12, 21, 8, 21, 5, 20, 3, 18, 3, 16, 4, 14, 5, 13, 7, 12, 13, 10, 15, 9, 16, 8, 17, 6, 17, 3, 15, 1, 12, 0, 8, 0, 5, 1, 3, 3]], - "%": [24, [21, 21, 3, 0, -1, -1, 8, 21, 10, 19, 10, 17, 9, 15, 7, 14, 5, 14, 3, 16, 3, 18, 4, 20, 6, 21, 8, 21, 10, 20, 13, 19, 16, 19, 19, 20, 21, 21, -1, -1, 17, 7, 15, 6, 14, 4, 14, 2, 16, 0, 18, 0, 20, 1, 21, 3, 21, 5, 19, 7, 17, 7]], - "&": [26, [23, 12, 23, 13, 22, 14, 21, 14, 20, 13, 19, 11, 17, 6, 15, 3, 13, 1, 11, 0, 7, 0, 5, 1, 4, 2, 3, 4, 3, 6, 4, 8, 5, 9, 12, 13, 13, 14, 14, 16, 14, 18, 13, 20, 11, 21, 9, 20, 8, 18, 8, 16, 9, 13, 11, 10, 16, 3, 18, 1, 20, 0, 22, 0, 23, 1, 23, 2]], - "'": [10, [5, 19, 4, 20, 5, 21, 6, 20, 6, 18, 5, 16, 4, 15]], - "(": [14, [11, 25, 9, 23, 7, 20, 5, 16, 4, 11, 4, 7, 5, 2, 7, -2, 9, -5, 11, -7]], - ")": [14, [3, 25, 5, 23, 7, 20, 9, 16, 10, 11, 10, 7, 9, 2, 7, -2, 5, -5, 3, -7]], - "*": [16, [8, 21, 8, 9, -1, -1, 3, 18, 13, 12, -1, -1, 13, 18, 3, 12]], - "+": [26, [13, 18, 13, 0, -1, -1, 4, 9, 22, 9]], - ",": [10, [6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5, -3, 4, -4]], - "-": [26, [4, 9, 22, 9]], - ".": [10, [5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], - "/": [22, [20, 25, 2, -7]], - "0": [20, [9, 21, 6, 20, 4, 17, 3, 12, 3, 9, 4, 4, 6, 1, 9, 0, 11, 0, 14, 1, 16, 4, 17, 9, 17, 12, 16, 17, 14, 20, 11, 21, 9, 21]], - "1": [20, [6, 17, 8, 18, 11, 21, 11, 0]], - "2": [20, [4, 16, 4, 17, 5, 19, 6, 20, 8, 21, 12, 21, 14, 20, 15, 19, 16, 17, 16, 15, 15, 13, 13, 10, 3, 0, 17, 0]], - "3": [20, [5, 21, 16, 21, 10, 13, 13, 13, 15, 12, 16, 11, 17, 8, 17, 6, 16, 3, 14, 1, 11, 0, 8, 0, 5, 1, 4, 2, 3, 4]], - "4": [20, [13, 21, 3, 7, 18, 7, -1, -1, 13, 21, 13, 0]], - "5": [20, [15, 21, 5, 21, 4, 12, 5, 13, 8, 14, 11, 14, 14, 13, 16, 11, 17, 8, 17, 6, 16, 3, 14, 1, 11, 0, 8, 0, 5, 1, 4, 2, 3, 4]], - "6": [20, [16, 18, 15, 20, 12, 21, 10, 21, 7, 20, 5, 17, 4, 12, 4, 7, 5, 3, 7, 1, 10, 0, 11, 0, 14, 1, 16, 3, 17, 6, 17, 7, 16, 10, 14, 12, 11, 13, 10, 13, 7, 12, 5, 10, 4, 7]], - "7": [20, [17, 21, 7, 0, -1, -1, 3, 21, 17, 21]], - "8": [20, [8, 21, 5, 20, 4, 18, 4, 16, 5, 14, 7, 13, 11, 12, 14, 11, 16, 9, 17, 7, 17, 4, 16, 2, 15, 1, 12, 0, 8, 0, 5, 1, 4, 2, 3, 4, 3, 7, 4, 9, 6, 11, 9, 12, 13, 13, 15, 14, 16, 16, 16, 18, 15, 20, 12, 21, 8, 21]], - "9": [20, [16, 14, 15, 11, 13, 9, 10, 8, 9, 8, 6, 9, 4, 11, 3, 14, 3, 15, 4, 18, 6, 20, 9, 21, 10, 21, 13, 20, 15, 18, 16, 14, 16, 9, 15, 4, 13, 1, 10, 0, 8, 0, 5, 1, 4, 3]], - ":": [10, [5, 14, 4, 13, 5, 12, 6, 13, 5, 14, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], - ";": [10, [5, 14, 4, 13, 5, 12, 6, 13, 5, 14, -1, -1, 6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5, -3, 4, -4]], - "<": [24, [20, 18, 4, 9, 20, 0]], - "=": [26, [4, 12, 22, 12, -1, -1, 4, 6, 22, 6]], - ">": [24, [4, 18, 20, 9, 4, 0]], - "?": [18, [3, 16, 3, 17, 4, 19, 5, 20, 7, 21, 11, 21, 13, 20, 14, 19, 15, 17, 15, 15, 14, 13, 13, 12, 9, 10, 9, 7, -1, -1, 9, 2, 8, 1, 9, 0, 10, 1, 9, 2]], - "@": [27, [18, 13, 17, 15, 15, 16, 12, 16, 10, 15, 9, 14, 8, 11, 8, 8, 9, 6, 11, 5, 14, 5, 16, 6, 17, 8, -1, -1, 12, 16, 10, 14, 9, 11, 9, 8, 10, 6, 11, 5, -1, -1, 18, 16, 17, 8, 17, 6, 19, 5, 21, 5, 23, 7, 24, 10, 24, 12, 23, 15, 22, 17, 20, 19, 18, 20, 15, 21, 12, 21, 9, 20, 7, 19, 5, 17, 4, 15, 3, 12, 3, 9, 4, 6, 5, 4, 7, 2, 9, 1, 12, 0, 15, 0, 18, 1, 20, 2, 21, 3, -1, -1, 19, 16, 18, 8, 18, 6, 19, 5]], - "A": [18, [9, 21, 1, 0, -1, -1, 9, 21, 17, 0, -1, -1, 4, 7, 14, 7]], - "B": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 15, 17, 13, 16, 12, 13, 11, -1, -1, 4, 11, 13, 11, 16, 10, 17, 9, 18, 7, 18, 4, 17, 2, 16, 1, 13, 0, 4, 0]], - "C": [21, [18, 16, 17, 18, 15, 20, 13, 21, 9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5]], - "D": [21, [4, 21, 4, 0, -1, -1, 4, 21, 11, 21, 14, 20, 16, 18, 17, 16, 18, 13, 18, 8, 17, 5, 16, 3, 14, 1, 11, 0, 4, 0]], - "E": [19, [4, 21, 4, 0, -1, -1, 4, 21, 17, 21, -1, -1, 4, 11, 12, 11, -1, -1, 4, 0, 17, 0]], - "F": [18, [4, 21, 4, 0, -1, -1, 4, 21, 17, 21, -1, -1, 4, 11, 12, 11]], - "G": [21, [18, 16, 17, 18, 15, 20, 13, 21, 9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 18, 8, -1, -1, 13, 8, 18, 8]], - "H": [22, [4, 21, 4, 0, -1, -1, 18, 21, 18, 0, -1, -1, 4, 11, 18, 11]], - "I": [8, [4, 21, 4, 0]], - "J": [16, [12, 21, 12, 5, 11, 2, 10, 1, 8, 0, 6, 0, 4, 1, 3, 2, 2, 5, 2, 7]], - "K": [21, [4, 21, 4, 0, -1, -1, 18, 21, 4, 7, -1, -1, 9, 12, 18, 0]], - "L": [17, [4, 21, 4, 0, -1, -1, 4, 0, 16, 0]], - "M": [24, [4, 21, 4, 0, -1, -1, 4, 21, 12, 0, -1, -1, 20, 21, 12, 0, -1, -1, 20, 21, 20, 0]], - "N": [22, [4, 21, 4, 0, -1, -1, 4, 21, 18, 0, -1, -1, 18, 21, 18, 0]], - "O": [22, [9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 19, 8, 19, 13, 18, 16, 17, 18, 15, 20, 13, 21, 9, 21]], - "P": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 14, 17, 12, 16, 11, 13, 10, 4, 10]], - "Q": [22, [9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 19, 8, 19, 13, 18, 16, 17, 18, 15, 20, 13, 21, 9, 21, -1, -1, 12, 4, 18, -2]], - "R": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 15, 17, 13, 16, 12, 13, 11, 4, 11, -1, -1, 11, 11, 18, 0]], - "S": [20, [17, 18, 15, 20, 12, 21, 8, 21, 5, 20, 3, 18, 3, 16, 4, 14, 5, 13, 7, 12, 13, 10, 15, 9, 16, 8, 17, 6, 17, 3, 15, 1, 12, 0, 8, 0, 5, 1, 3, 3]], - "T": [16, [8, 21, 8, 0, -1, -1, 1, 21, 15, 21]], - "U": [22, [4, 21, 4, 6, 5, 3, 7, 1, 10, 0, 12, 0, 15, 1, 17, 3, 18, 6, 18, 21]], - "V": [18, [1, 21, 9, 0, -1, -1, 17, 21, 9, 0]], - "W": [24, [2, 21, 7, 0, -1, -1, 12, 21, 7, 0, -1, -1, 12, 21, 17, 0, -1, -1, 22, 21, 17, 0]], - "X": [20, [3, 21, 17, 0, -1, -1, 17, 21, 3, 0]], - "Y": [18, [1, 21, 9, 11, 9, 0, -1, -1, 17, 21, 9, 11]], - "Z": [20, [17, 21, 3, 0, -1, -1, 3, 21, 17, 21, -1, -1, 3, 0, 17, 0]], - "[": [14, [4, 25, 4, -7, -1, -1, 5, 25, 5, -7, -1, -1, 4, 25, 11, 25, -1, -1, 4, -7, 11, -7]], - "\\": [14, [0, 21, 14, -3]], - "]": [14, [9, 25, 9, -7, -1, -1, 10, 25, 10, -7, -1, -1, 3, 25, 10, 25, -1, -1, 3, -7, 10, -7]], - "^": [16, [6, 15, 8, 18, 10, 15, -1, -1, 3, 12, 8, 17, 13, 12, -1, -1, 8, 17, 8, 0]], - "_": [16, [0, -2, 16, -2]], - "`": [10, [6, 21, 5, 20, 4, 18, 4, 16, 5, 15, 6, 16, 5, 17]], - "a": [19, [15, 14, 15, 0, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "b": [19, [4, 21, 4, 0, -1, -1, 4, 11, 6, 13, 8, 14, 11, 14, 13, 13, 15, 11, 16, 8, 16, 6, 15, 3, 13, 1, 11, 0, 8, 0, 6, 1, 4, 3]], - "c": [18, [15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "d": [19, [15, 21, 15, 0, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "e": [18, [3, 8, 15, 8, 15, 10, 14, 12, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "f": [12, [10, 21, 8, 21, 6, 20, 5, 17, 5, 0, -1, -1, 2, 14, 9, 14]], - "g": [19, [15, 14, 15, -2, 14, -5, 13, -6, 11, -7, 8, -7, 6, -6, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "h": [19, [4, 21, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0]], - "i": [8, [3, 21, 4, 20, 5, 21, 4, 22, 3, 21, -1, -1, 4, 14, 4, 0]], - "j": [10, [5, 21, 6, 20, 7, 21, 6, 22, 5, 21, -1, -1, 6, 14, 6, -3, 5, -6, 3, -7, 1, -7]], - "k": [17, [4, 21, 4, 0, -1, -1, 14, 14, 4, 4, -1, -1, 8, 8, 15, 0]], - "l": [8, [4, 21, 4, 0]], - "m": [30, [4, 14, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0, -1, -1, 15, 10, 18, 13, 20, 14, 23, 14, 25, 13, 26, 10, 26, 0]], - "n": [19, [4, 14, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0]], - "o": [19, [8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3, 16, 6, 16, 8, 15, 11, 13, 13, 11, 14, 8, 14]], - "p": [19, [4, 14, 4, -7, -1, -1, 4, 11, 6, 13, 8, 14, 11, 14, 13, 13, 15, 11, 16, 8, 16, 6, 15, 3, 13, 1, 11, 0, 8, 0, 6, 1, 4, 3]], - "q": [19, [15, 14, 15, -7, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "r": [13, [4, 14, 4, 0, -1, -1, 4, 8, 5, 11, 7, 13, 9, 14, 12, 14]], - "s": [17, [14, 11, 13, 13, 10, 14, 7, 14, 4, 13, 3, 11, 4, 9, 6, 8, 11, 7, 13, 6, 14, 4, 14, 3, 13, 1, 10, 0, 7, 0, 4, 1, 3, 3]], - "t": [12, [5, 21, 5, 4, 6, 1, 8, 0, 10, 0, -1, -1, 2, 14, 9, 14]], - "u": [19, [4, 14, 4, 4, 5, 1, 7, 0, 10, 0, 12, 1, 15, 4, -1, -1, 15, 14, 15, 0]], - "v": [16, [2, 14, 8, 0, -1, -1, 14, 14, 8, 0]], - "w": [22, [3, 14, 7, 0, -1, -1, 11, 14, 7, 0, -1, -1, 11, 14, 15, 0, -1, -1, 19, 14, 15, 0]], - "x": [17, [3, 14, 14, 0, -1, -1, 14, 14, 3, 0]], - "y": [16, [2, 14, 8, 0, -1, -1, 14, 14, 8, 0, 6, -4, 4, -6, 2, -7, 1, -7]], - "z": [17, [14, 14, 3, 0, -1, -1, 3, 14, 14, 14, -1, -1, 3, 0, 14, 0]], - "{": [14, [9, 25, 7, 24, 6, 23, 5, 21, 5, 19, 6, 17, 7, 16, 8, 14, 8, 12, 6, 10, -1, -1, 7, 24, 6, 22, 6, 20, 7, 18, 8, 17, 9, 15, 9, 13, 8, 11, 4, 9, 8, 7, 9, 5, 9, 3, 8, 1, 7, 0, 6, -2, 6, -4, 7, -6, -1, -1, 6, 8, 8, 6, 8, 4, 7, 2, 6, 1, 5, -1, 5, -3, 6, -5, 7, -6, 9, -7]], - "|": [8, [4, 25, 4, -7]], - "}": [14, [5, 25, 7, 24, 8, 23, 9, 21, 9, 19, 8, 17, 7, 16, 6, 14, 6, 12, 8, 10, -1, -1, 7, 24, 8, 22, 8, 20, 7, 18, 6, 17, 5, 15, 5, 13, 6, 11, 10, 9, 6, 7, 5, 5, 5, 3, 6, 1, 7, 0, 8, -2, 8, -4, 7, -6, -1, -1, 8, 8, 6, 6, 6, 4, 7, 2, 8, 1, 9, -1, 9, -3, 8, -5, 7, -6, 5, -7]], - "~": [24, [3, 6, 3, 8, 4, 11, 6, 12, 8, 12, 10, 11, 14, 8, 16, 7, 18, 7, 20, 8, 21, 10, -1, -1, 3, 8, 4, 10, 6, 11, 8, 11, 10, 10, 14, 7, 16, 6, 18, 6, 20, 7, 21, 10, 21, 12]] -}; - -module.exports = function textVertices(text, left, baseline, scale) { - scale = scale || 1; - - var strokes = [], - i, len, j, len2, glyph, x, y, prev; - - for (i = 0, len = text.length; i < len; i++) { - glyph = simplexFont[text[i]]; - if (!glyph) continue; - prev = null; - - for (j = 0, len2 = glyph[1].length; j < len2; j += 2) { - if (glyph[1][j] === -1 && glyph[1][j + 1] === -1) { - prev = null; - - } else { - x = left + glyph[1][j] * scale; - y = baseline - glyph[1][j + 1] * scale; - if (prev) { - strokes.push(prev.x, prev.y, x, y); - } - prev = {x: x, y: y}; - } - } - left += glyph[0] * scale; - } - - return strokes; -}; - -},{}],30:[function(require,module,exports){ -'use strict'; - -/** - * mapboxgl is a A WebGL JavaScript interactive maps library that can render - * [Mapbox vector tiles](https://www.mapbox.com/blog/vector-tiles/). - * - * @module mapboxgl - * @summary WebGL JavaScript map library - */ - -// jshint -W079 -var mapboxgl = module.exports = {}; - -mapboxgl.Map = require('./ui/map'); -mapboxgl.Control = require('./ui/control/control'); -mapboxgl.Navigation = require('./ui/control/navigation'); -mapboxgl.Geolocate = require('./ui/control/geolocate'); -mapboxgl.Attribution = require('./ui/control/attribution'); -mapboxgl.Popup = require('./ui/popup'); - -mapboxgl.GeoJSONSource = require('./source/geojson_source'); -mapboxgl.VideoSource = require('./source/video_source'); -mapboxgl.ImageSource = require('./source/image_source'); - -mapboxgl.Style = require('./style/style'); - -mapboxgl.LngLat = require('./geo/lng_lat'); -mapboxgl.LngLatBounds = require('./geo/lng_lat_bounds'); -mapboxgl.Point = require('point-geometry'); - -mapboxgl.Evented = require('./util/evented'); -mapboxgl.util = require('./util/util'); - -mapboxgl.supported = require('./util/browser').supported; - -var ajax = require('./util/ajax'); -mapboxgl.util.getJSON = ajax.getJSON; -mapboxgl.util.getArrayBuffer = ajax.getArrayBuffer; - -var config = require('./util/config'); -mapboxgl.config = config; - -Object.defineProperty(mapboxgl, 'accessToken', { - get: function() { return config.ACCESS_TOKEN; }, - set: function(token) { config.ACCESS_TOKEN = token; } -}); - -},{"./geo/lng_lat":26,"./geo/lng_lat_bounds":27,"./source/geojson_source":44,"./source/image_source":46,"./source/video_source":54,"./style/style":60,"./ui/control/attribution":88,"./ui/control/control":89,"./ui/control/geolocate":90,"./ui/control/navigation":91,"./ui/map":101,"./ui/popup":102,"./util/ajax":104,"./util/browser":105,"./util/config":109,"./util/evented":111,"./util/util":119,"point-geometry":174}],31:[function(require,module,exports){ -'use strict'; - -var TilePyramid = require('../source/tile_pyramid'); -var pyramid = new TilePyramid({ tileSize: 512 }); -var util = require('../util/util'); -var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - -module.exports = drawBackground; - -function drawBackground(painter, source, layer) { - var gl = painter.gl; - var transform = painter.transform; - var color = util.premultiply(layer.paint['background-color']); - var image = layer.paint['background-pattern']; - var opacity = layer.paint['background-opacity']; - var program; - - var imagePosA = image ? painter.spriteAtlas.getPosition(image.from, true) : null; - var imagePosB = image ? painter.spriteAtlas.getPosition(image.to, true) : null; - - painter.setDepthSublayer(0); - if (imagePosA && imagePosB) { - - if (painter.isOpaquePass) return; - - // Draw texture fill - program = painter.useProgram('pattern'); - gl.uniform1i(program.u_image, 0); - gl.uniform2fv(program.u_pattern_tl_a, imagePosA.tl); - gl.uniform2fv(program.u_pattern_br_a, imagePosA.br); - gl.uniform2fv(program.u_pattern_tl_b, imagePosB.tl); - gl.uniform2fv(program.u_pattern_br_b, imagePosB.br); - gl.uniform1f(program.u_opacity, opacity); - - gl.uniform1f(program.u_mix, image.t); - - painter.spriteAtlas.bind(gl, true); - - painter.tileExtentPatternVAO.bind(gl, program, painter.tileExtentBuffer); - } else { - // Draw filling rectangle. - if (painter.isOpaquePass !== (color[3] === 1)) return; - - program = painter.useProgram('fill'); - gl.uniform4fv(program.u_color, color); - gl.uniform1f(program.u_opacity, opacity); - painter.tileExtentVAO.bind(gl, program, painter.tileExtentBuffer); - } - - gl.disable(gl.STENCIL_TEST); - - // We need to draw the background in tiles in order to use calculatePosMatrix - // which applies the projection matrix (transform.projMatrix). Otherwise - // the depth and stencil buffers get into a bad state. - // This can be refactored into a single draw call once earcut lands and - // we don't have so much going on in the stencil buffer. - var coords = pyramid.coveringTiles(transform); - for (var c = 0; c < coords.length; c++) { - var coord = coords[c]; - var tileSize = 512; - // var pixelsToTileUnitsBound = pixelsToTileUnits.bind({coord:coord, tileSize: tileSize}); - if (imagePosA && imagePosB) { - var imageSizeScaledA = [ - (imagePosA.size[0] * image.fromScale), - (imagePosA.size[1] * image.fromScale) - ]; - var imageSizeScaledB = [ - (imagePosB.size[0] * image.toScale), - (imagePosB.size[1] * image.toScale) - ]; - var tile = {coord:coord, tileSize: tileSize}; - - gl.uniform2fv(program.u_patternscale_a, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledA[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledA[1], painter.transform.tileZoom) - ]); - - gl.uniform2fv(program.u_patternscale_b, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledB[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledB[1], painter.transform.tileZoom) - ]); - var tileSizeAtNearestZoom = tileSize * Math.pow(2, painter.transform.tileZoom - coord.z); - - var offsetAx = ((tileSizeAtNearestZoom / imageSizeScaledA[0]) % 1) * (coord.x + coord.w * Math.pow(2, coord.z)); - var offsetAy = ((tileSizeAtNearestZoom / imageSizeScaledA[1]) % 1) * coord.y; - - var offsetBx = ((tileSizeAtNearestZoom / imageSizeScaledB[0]) % 1) * (coord.x + coord.w * Math.pow(2, coord.z)); - var offsetBy = ((tileSizeAtNearestZoom / imageSizeScaledB[1]) % 1) * coord.y; - - gl.uniform2fv(program.u_offset_a, [offsetAx, offsetAy]); - gl.uniform2fv(program.u_offset_b, [offsetBx, offsetBy]); - } - - gl.uniformMatrix4fv(program.u_matrix, false, painter.transform.calculatePosMatrix(coord)); - gl.drawArrays(gl.TRIANGLE_STRIP, 0, painter.tileExtentBuffer.length); - } - - gl.stencilMask(0x00); - gl.stencilFunc(gl.EQUAL, 0x80, 0x80); -} - -},{"../source/pixels_to_tile_units":47,"../source/tile_pyramid":52,"../util/util":119}],32:[function(require,module,exports){ -'use strict'; - + ' ': [ + 16, + [] + ], + '!': [ + 10, + [ + 5, + 21, + 5, + 7, + -1, + -1, + 5, + 2, + 4, + 1, + 5, + 0, + 6, + 1, + 5, + 2 + ] + ], + '"': [ + 16, + [ + 4, + 21, + 4, + 14, + -1, + -1, + 12, + 21, + 12, + 14 + ] + ], + '#': [ + 21, + [ + 11, + 25, + 4, + -7, + -1, + -1, + 17, + 25, + 10, + -7, + -1, + -1, + 4, + 12, + 18, + 12, + -1, + -1, + 3, + 6, + 17, + 6 + ] + ], + '$': [ + 20, + [ + 8, + 25, + 8, + -4, + -1, + -1, + 12, + 25, + 12, + -4, + -1, + -1, + 17, + 18, + 15, + 20, + 12, + 21, + 8, + 21, + 5, + 20, + 3, + 18, + 3, + 16, + 4, + 14, + 5, + 13, + 7, + 12, + 13, + 10, + 15, + 9, + 16, + 8, + 17, + 6, + 17, + 3, + 15, + 1, + 12, + 0, + 8, + 0, + 5, + 1, + 3, + 3 + ] + ], + '%': [ + 24, + [ + 21, + 21, + 3, + 0, + -1, + -1, + 8, + 21, + 10, + 19, + 10, + 17, + 9, + 15, + 7, + 14, + 5, + 14, + 3, + 16, + 3, + 18, + 4, + 20, + 6, + 21, + 8, + 21, + 10, + 20, + 13, + 19, + 16, + 19, + 19, + 20, + 21, + 21, + -1, + -1, + 17, + 7, + 15, + 6, + 14, + 4, + 14, + 2, + 16, + 0, + 18, + 0, + 20, + 1, + 21, + 3, + 21, + 5, + 19, + 7, + 17, + 7 + ] + ], + '&': [ + 26, + [ + 23, + 12, + 23, + 13, + 22, + 14, + 21, + 14, + 20, + 13, + 19, + 11, + 17, + 6, + 15, + 3, + 13, + 1, + 11, + 0, + 7, + 0, + 5, + 1, + 4, + 2, + 3, + 4, + 3, + 6, + 4, + 8, + 5, + 9, + 12, + 13, + 13, + 14, + 14, + 16, + 14, + 18, + 13, + 20, + 11, + 21, + 9, + 20, + 8, + 18, + 8, + 16, + 9, + 13, + 11, + 10, + 16, + 3, + 18, + 1, + 20, + 0, + 22, + 0, + 23, + 1, + 23, + 2 + ] + ], + '\'': [ + 10, + [ + 5, + 19, + 4, + 20, + 5, + 21, + 6, + 20, + 6, + 18, + 5, + 16, + 4, + 15 + ] + ], + '(': [ + 14, + [ + 11, + 25, + 9, + 23, + 7, + 20, + 5, + 16, + 4, + 11, + 4, + 7, + 5, + 2, + 7, + -2, + 9, + -5, + 11, + -7 + ] + ], + ')': [ + 14, + [ + 3, + 25, + 5, + 23, + 7, + 20, + 9, + 16, + 10, + 11, + 10, + 7, + 9, + 2, + 7, + -2, + 5, + -5, + 3, + -7 + ] + ], + '*': [ + 16, + [ + 8, + 21, + 8, + 9, + -1, + -1, + 3, + 18, + 13, + 12, + -1, + -1, + 13, + 18, + 3, + 12 + ] + ], + '+': [ + 26, + [ + 13, + 18, + 13, + 0, + -1, + -1, + 4, + 9, + 22, + 9 + ] + ], + ',': [ + 10, + [ + 6, + 1, + 5, + 0, + 4, + 1, + 5, + 2, + 6, + 1, + 6, + -1, + 5, + -3, + 4, + -4 + ] + ], + '-': [ + 26, + [ + 4, + 9, + 22, + 9 + ] + ], + '.': [ + 10, + [ + 5, + 2, + 4, + 1, + 5, + 0, + 6, + 1, + 5, + 2 + ] + ], + '/': [ + 22, + [ + 20, + 25, + 2, + -7 + ] + ], + '0': [ + 20, + [ + 9, + 21, + 6, + 20, + 4, + 17, + 3, + 12, + 3, + 9, + 4, + 4, + 6, + 1, + 9, + 0, + 11, + 0, + 14, + 1, + 16, + 4, + 17, + 9, + 17, + 12, + 16, + 17, + 14, + 20, + 11, + 21, + 9, + 21 + ] + ], + '1': [ + 20, + [ + 6, + 17, + 8, + 18, + 11, + 21, + 11, + 0 + ] + ], + '2': [ + 20, + [ + 4, + 16, + 4, + 17, + 5, + 19, + 6, + 20, + 8, + 21, + 12, + 21, + 14, + 20, + 15, + 19, + 16, + 17, + 16, + 15, + 15, + 13, + 13, + 10, + 3, + 0, + 17, + 0 + ] + ], + '3': [ + 20, + [ + 5, + 21, + 16, + 21, + 10, + 13, + 13, + 13, + 15, + 12, + 16, + 11, + 17, + 8, + 17, + 6, + 16, + 3, + 14, + 1, + 11, + 0, + 8, + 0, + 5, + 1, + 4, + 2, + 3, + 4 + ] + ], + '4': [ + 20, + [ + 13, + 21, + 3, + 7, + 18, + 7, + -1, + -1, + 13, + 21, + 13, + 0 + ] + ], + '5': [ + 20, + [ + 15, + 21, + 5, + 21, + 4, + 12, + 5, + 13, + 8, + 14, + 11, + 14, + 14, + 13, + 16, + 11, + 17, + 8, + 17, + 6, + 16, + 3, + 14, + 1, + 11, + 0, + 8, + 0, + 5, + 1, + 4, + 2, + 3, + 4 + ] + ], + '6': [ + 20, + [ + 16, + 18, + 15, + 20, + 12, + 21, + 10, + 21, + 7, + 20, + 5, + 17, + 4, + 12, + 4, + 7, + 5, + 3, + 7, + 1, + 10, + 0, + 11, + 0, + 14, + 1, + 16, + 3, + 17, + 6, + 17, + 7, + 16, + 10, + 14, + 12, + 11, + 13, + 10, + 13, + 7, + 12, + 5, + 10, + 4, + 7 + ] + ], + '7': [ + 20, + [ + 17, + 21, + 7, + 0, + -1, + -1, + 3, + 21, + 17, + 21 + ] + ], + '8': [ + 20, + [ + 8, + 21, + 5, + 20, + 4, + 18, + 4, + 16, + 5, + 14, + 7, + 13, + 11, + 12, + 14, + 11, + 16, + 9, + 17, + 7, + 17, + 4, + 16, + 2, + 15, + 1, + 12, + 0, + 8, + 0, + 5, + 1, + 4, + 2, + 3, + 4, + 3, + 7, + 4, + 9, + 6, + 11, + 9, + 12, + 13, + 13, + 15, + 14, + 16, + 16, + 16, + 18, + 15, + 20, + 12, + 21, + 8, + 21 + ] + ], + '9': [ + 20, + [ + 16, + 14, + 15, + 11, + 13, + 9, + 10, + 8, + 9, + 8, + 6, + 9, + 4, + 11, + 3, + 14, + 3, + 15, + 4, + 18, + 6, + 20, + 9, + 21, + 10, + 21, + 13, + 20, + 15, + 18, + 16, + 14, + 16, + 9, + 15, + 4, + 13, + 1, + 10, + 0, + 8, + 0, + 5, + 1, + 4, + 3 + ] + ], + ':': [ + 10, + [ + 5, + 14, + 4, + 13, + 5, + 12, + 6, + 13, + 5, + 14, + -1, + -1, + 5, + 2, + 4, + 1, + 5, + 0, + 6, + 1, + 5, + 2 + ] + ], + ';': [ + 10, + [ + 5, + 14, + 4, + 13, + 5, + 12, + 6, + 13, + 5, + 14, + -1, + -1, + 6, + 1, + 5, + 0, + 4, + 1, + 5, + 2, + 6, + 1, + 6, + -1, + 5, + -3, + 4, + -4 + ] + ], + '<': [ + 24, + [ + 20, + 18, + 4, + 9, + 20, + 0 + ] + ], + '=': [ + 26, + [ + 4, + 12, + 22, + 12, + -1, + -1, + 4, + 6, + 22, + 6 + ] + ], + '>': [ + 24, + [ + 4, + 18, + 20, + 9, + 4, + 0 + ] + ], + '?': [ + 18, + [ + 3, + 16, + 3, + 17, + 4, + 19, + 5, + 20, + 7, + 21, + 11, + 21, + 13, + 20, + 14, + 19, + 15, + 17, + 15, + 15, + 14, + 13, + 13, + 12, + 9, + 10, + 9, + 7, + -1, + -1, + 9, + 2, + 8, + 1, + 9, + 0, + 10, + 1, + 9, + 2 + ] + ], + '@': [ + 27, + [ + 18, + 13, + 17, + 15, + 15, + 16, + 12, + 16, + 10, + 15, + 9, + 14, + 8, + 11, + 8, + 8, + 9, + 6, + 11, + 5, + 14, + 5, + 16, + 6, + 17, + 8, + -1, + -1, + 12, + 16, + 10, + 14, + 9, + 11, + 9, + 8, + 10, + 6, + 11, + 5, + -1, + -1, + 18, + 16, + 17, + 8, + 17, + 6, + 19, + 5, + 21, + 5, + 23, + 7, + 24, + 10, + 24, + 12, + 23, + 15, + 22, + 17, + 20, + 19, + 18, + 20, + 15, + 21, + 12, + 21, + 9, + 20, + 7, + 19, + 5, + 17, + 4, + 15, + 3, + 12, + 3, + 9, + 4, + 6, + 5, + 4, + 7, + 2, + 9, + 1, + 12, + 0, + 15, + 0, + 18, + 1, + 20, + 2, + 21, + 3, + -1, + -1, + 19, + 16, + 18, + 8, + 18, + 6, + 19, + 5 + ] + ], + 'A': [ + 18, + [ + 9, + 21, + 1, + 0, + -1, + -1, + 9, + 21, + 17, + 0, + -1, + -1, + 4, + 7, + 14, + 7 + ] + ], + 'B': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 13, + 21, + 16, + 20, + 17, + 19, + 18, + 17, + 18, + 15, + 17, + 13, + 16, + 12, + 13, + 11, + -1, + -1, + 4, + 11, + 13, + 11, + 16, + 10, + 17, + 9, + 18, + 7, + 18, + 4, + 17, + 2, + 16, + 1, + 13, + 0, + 4, + 0 + ] + ], + 'C': [ + 21, + [ + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5 + ] + ], + 'D': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 11, + 21, + 14, + 20, + 16, + 18, + 17, + 16, + 18, + 13, + 18, + 8, + 17, + 5, + 16, + 3, + 14, + 1, + 11, + 0, + 4, + 0 + ] + ], + 'E': [ + 19, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 17, + 21, + -1, + -1, + 4, + 11, + 12, + 11, + -1, + -1, + 4, + 0, + 17, + 0 + ] + ], + 'F': [ + 18, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 17, + 21, + -1, + -1, + 4, + 11, + 12, + 11 + ] + ], + 'G': [ + 21, + [ + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5, + 18, + 8, + -1, + -1, + 13, + 8, + 18, + 8 + ] + ], + 'H': [ + 22, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 18, + 21, + 18, + 0, + -1, + -1, + 4, + 11, + 18, + 11 + ] + ], + 'I': [ + 8, + [ + 4, + 21, + 4, + 0 + ] + ], + 'J': [ + 16, + [ + 12, + 21, + 12, + 5, + 11, + 2, + 10, + 1, + 8, + 0, + 6, + 0, + 4, + 1, + 3, + 2, + 2, + 5, + 2, + 7 + ] + ], + 'K': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 18, + 21, + 4, + 7, + -1, + -1, + 9, + 12, + 18, + 0 + ] + ], + 'L': [ + 17, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 0, + 16, + 0 + ] + ], + 'M': [ + 24, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 12, + 0, + -1, + -1, + 20, + 21, + 12, + 0, + -1, + -1, + 20, + 21, + 20, + 0 + ] + ], + 'N': [ + 22, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 18, + 0, + -1, + -1, + 18, + 21, + 18, + 0 + ] + ], + 'O': [ + 22, + [ + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5, + 19, + 8, + 19, + 13, + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21 + ] + ], + 'P': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 13, + 21, + 16, + 20, + 17, + 19, + 18, + 17, + 18, + 14, + 17, + 12, + 16, + 11, + 13, + 10, + 4, + 10 + ] + ], + 'Q': [ + 22, + [ + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5, + 19, + 8, + 19, + 13, + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21, + -1, + -1, + 12, + 4, + 18, + -2 + ] + ], + 'R': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 13, + 21, + 16, + 20, + 17, + 19, + 18, + 17, + 18, + 15, + 17, + 13, + 16, + 12, + 13, + 11, + 4, + 11, + -1, + -1, + 11, + 11, + 18, + 0 + ] + ], + 'S': [ + 20, + [ + 17, + 18, + 15, + 20, + 12, + 21, + 8, + 21, + 5, + 20, + 3, + 18, + 3, + 16, + 4, + 14, + 5, + 13, + 7, + 12, + 13, + 10, + 15, + 9, + 16, + 8, + 17, + 6, + 17, + 3, + 15, + 1, + 12, + 0, + 8, + 0, + 5, + 1, + 3, + 3 + ] + ], + 'T': [ + 16, + [ + 8, + 21, + 8, + 0, + -1, + -1, + 1, + 21, + 15, + 21 + ] + ], + 'U': [ + 22, + [ + 4, + 21, + 4, + 6, + 5, + 3, + 7, + 1, + 10, + 0, + 12, + 0, + 15, + 1, + 17, + 3, + 18, + 6, + 18, + 21 + ] + ], + 'V': [ + 18, + [ + 1, + 21, + 9, + 0, + -1, + -1, + 17, + 21, + 9, + 0 + ] + ], + 'W': [ + 24, + [ + 2, + 21, + 7, + 0, + -1, + -1, + 12, + 21, + 7, + 0, + -1, + -1, + 12, + 21, + 17, + 0, + -1, + -1, + 22, + 21, + 17, + 0 + ] + ], + 'X': [ + 20, + [ + 3, + 21, + 17, + 0, + -1, + -1, + 17, + 21, + 3, + 0 + ] + ], + 'Y': [ + 18, + [ + 1, + 21, + 9, + 11, + 9, + 0, + -1, + -1, + 17, + 21, + 9, + 11 + ] + ], + 'Z': [ + 20, + [ + 17, + 21, + 3, + 0, + -1, + -1, + 3, + 21, + 17, + 21, + -1, + -1, + 3, + 0, + 17, + 0 + ] + ], + '[': [ + 14, + [ + 4, + 25, + 4, + -7, + -1, + -1, + 5, + 25, + 5, + -7, + -1, + -1, + 4, + 25, + 11, + 25, + -1, + -1, + 4, + -7, + 11, + -7 + ] + ], + '\\': [ + 14, + [ + 0, + 21, + 14, + -3 + ] + ], + ']': [ + 14, + [ + 9, + 25, + 9, + -7, + -1, + -1, + 10, + 25, + 10, + -7, + -1, + -1, + 3, + 25, + 10, + 25, + -1, + -1, + 3, + -7, + 10, + -7 + ] + ], + '^': [ + 16, + [ + 6, + 15, + 8, + 18, + 10, + 15, + -1, + -1, + 3, + 12, + 8, + 17, + 13, + 12, + -1, + -1, + 8, + 17, + 8, + 0 + ] + ], + '_': [ + 16, + [ + 0, + -2, + 16, + -2 + ] + ], + '`': [ + 10, + [ + 6, + 21, + 5, + 20, + 4, + 18, + 4, + 16, + 5, + 15, + 6, + 16, + 5, + 17 + ] + ], + 'a': [ + 19, + [ + 15, + 14, + 15, + 0, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'b': [ + 19, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 11, + 6, + 13, + 8, + 14, + 11, + 14, + 13, + 13, + 15, + 11, + 16, + 8, + 16, + 6, + 15, + 3, + 13, + 1, + 11, + 0, + 8, + 0, + 6, + 1, + 4, + 3 + ] + ], + 'c': [ + 18, + [ + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'd': [ + 19, + [ + 15, + 21, + 15, + 0, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'e': [ + 18, + [ + 3, + 8, + 15, + 8, + 15, + 10, + 14, + 12, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'f': [ + 12, + [ + 10, + 21, + 8, + 21, + 6, + 20, + 5, + 17, + 5, + 0, + -1, + -1, + 2, + 14, + 9, + 14 + ] + ], + 'g': [ + 19, + [ + 15, + 14, + 15, + -2, + 14, + -5, + 13, + -6, + 11, + -7, + 8, + -7, + 6, + -6, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'h': [ + 19, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 10, + 7, + 13, + 9, + 14, + 12, + 14, + 14, + 13, + 15, + 10, + 15, + 0 + ] + ], + 'i': [ + 8, + [ + 3, + 21, + 4, + 20, + 5, + 21, + 4, + 22, + 3, + 21, + -1, + -1, + 4, + 14, + 4, + 0 + ] + ], + 'j': [ + 10, + [ + 5, + 21, + 6, + 20, + 7, + 21, + 6, + 22, + 5, + 21, + -1, + -1, + 6, + 14, + 6, + -3, + 5, + -6, + 3, + -7, + 1, + -7 + ] + ], + 'k': [ + 17, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 14, + 14, + 4, + 4, + -1, + -1, + 8, + 8, + 15, + 0 + ] + ], + 'l': [ + 8, + [ + 4, + 21, + 4, + 0 + ] + ], + 'm': [ + 30, + [ + 4, + 14, + 4, + 0, + -1, + -1, + 4, + 10, + 7, + 13, + 9, + 14, + 12, + 14, + 14, + 13, + 15, + 10, + 15, + 0, + -1, + -1, + 15, + 10, + 18, + 13, + 20, + 14, + 23, + 14, + 25, + 13, + 26, + 10, + 26, + 0 + ] + ], + 'n': [ + 19, + [ + 4, + 14, + 4, + 0, + -1, + -1, + 4, + 10, + 7, + 13, + 9, + 14, + 12, + 14, + 14, + 13, + 15, + 10, + 15, + 0 + ] + ], + 'o': [ + 19, + [ + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3, + 16, + 6, + 16, + 8, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14 + ] + ], + 'p': [ + 19, + [ + 4, + 14, + 4, + -7, + -1, + -1, + 4, + 11, + 6, + 13, + 8, + 14, + 11, + 14, + 13, + 13, + 15, + 11, + 16, + 8, + 16, + 6, + 15, + 3, + 13, + 1, + 11, + 0, + 8, + 0, + 6, + 1, + 4, + 3 + ] + ], + 'q': [ + 19, + [ + 15, + 14, + 15, + -7, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'r': [ + 13, + [ + 4, + 14, + 4, + 0, + -1, + -1, + 4, + 8, + 5, + 11, + 7, + 13, + 9, + 14, + 12, + 14 + ] + ], + 's': [ + 17, + [ + 14, + 11, + 13, + 13, + 10, + 14, + 7, + 14, + 4, + 13, + 3, + 11, + 4, + 9, + 6, + 8, + 11, + 7, + 13, + 6, + 14, + 4, + 14, + 3, + 13, + 1, + 10, + 0, + 7, + 0, + 4, + 1, + 3, + 3 + ] + ], + 't': [ + 12, + [ + 5, + 21, + 5, + 4, + 6, + 1, + 8, + 0, + 10, + 0, + -1, + -1, + 2, + 14, + 9, + 14 + ] + ], + 'u': [ + 19, + [ + 4, + 14, + 4, + 4, + 5, + 1, + 7, + 0, + 10, + 0, + 12, + 1, + 15, + 4, + -1, + -1, + 15, + 14, + 15, + 0 + ] + ], + 'v': [ + 16, + [ + 2, + 14, + 8, + 0, + -1, + -1, + 14, + 14, + 8, + 0 + ] + ], + 'w': [ + 22, + [ + 3, + 14, + 7, + 0, + -1, + -1, + 11, + 14, + 7, + 0, + -1, + -1, + 11, + 14, + 15, + 0, + -1, + -1, + 19, + 14, + 15, + 0 + ] + ], + 'x': [ + 17, + [ + 3, + 14, + 14, + 0, + -1, + -1, + 14, + 14, + 3, + 0 + ] + ], + 'y': [ + 16, + [ + 2, + 14, + 8, + 0, + -1, + -1, + 14, + 14, + 8, + 0, + 6, + -4, + 4, + -6, + 2, + -7, + 1, + -7 + ] + ], + 'z': [ + 17, + [ + 14, + 14, + 3, + 0, + -1, + -1, + 3, + 14, + 14, + 14, + -1, + -1, + 3, + 0, + 14, + 0 + ] + ], + '{': [ + 14, + [ + 9, + 25, + 7, + 24, + 6, + 23, + 5, + 21, + 5, + 19, + 6, + 17, + 7, + 16, + 8, + 14, + 8, + 12, + 6, + 10, + -1, + -1, + 7, + 24, + 6, + 22, + 6, + 20, + 7, + 18, + 8, + 17, + 9, + 15, + 9, + 13, + 8, + 11, + 4, + 9, + 8, + 7, + 9, + 5, + 9, + 3, + 8, + 1, + 7, + 0, + 6, + -2, + 6, + -4, + 7, + -6, + -1, + -1, + 6, + 8, + 8, + 6, + 8, + 4, + 7, + 2, + 6, + 1, + 5, + -1, + 5, + -3, + 6, + -5, + 7, + -6, + 9, + -7 + ] + ], + '|': [ + 8, + [ + 4, + 25, + 4, + -7 + ] + ], + '}': [ + 14, + [ + 5, + 25, + 7, + 24, + 8, + 23, + 9, + 21, + 9, + 19, + 8, + 17, + 7, + 16, + 6, + 14, + 6, + 12, + 8, + 10, + -1, + -1, + 7, + 24, + 8, + 22, + 8, + 20, + 7, + 18, + 6, + 17, + 5, + 15, + 5, + 13, + 6, + 11, + 10, + 9, + 6, + 7, + 5, + 5, + 5, + 3, + 6, + 1, + 7, + 0, + 8, + -2, + 8, + -4, + 7, + -6, + -1, + -1, + 8, + 8, + 6, + 6, + 6, + 4, + 7, + 2, + 8, + 1, + 9, + -1, + 9, + -3, + 8, + -5, + 7, + -6, + 5, + -7 + ] + ], + '~': [ + 24, + [ + 3, + 6, + 3, + 8, + 4, + 11, + 6, + 12, + 8, + 12, + 10, + 11, + 14, + 8, + 16, + 7, + 18, + 7, + 20, + 8, + 21, + 10, + -1, + -1, + 3, + 8, + 4, + 10, + 6, + 11, + 8, + 11, + 10, + 10, + 14, + 7, + 16, + 6, + 18, + 6, + 20, + 7, + 21, + 10, + 21, + 12 + ] + ] +}; +module.exports = function textVertices(text, left, baseline, scale) { + scale = scale || 1; + var strokes = [], i, len, j, len2, glyph, x, y, prev; + for (i = 0, len = text.length; i < len; i++) { + glyph = simplexFont[text[i]]; + if (!glyph) + continue; + prev = null; + for (j = 0, len2 = glyph[1].length; j < len2; j += 2) { + if (glyph[1][j] === -1 && glyph[1][j + 1] === -1) { + prev = null; + } else { + x = left + glyph[1][j] * scale; + y = baseline - glyph[1][j + 1] * scale; + if (prev) { + strokes.push(prev.x, prev.y, x, y); + } + prev = { + x: x, + y: y + }; + } + } + left += glyph[0] * scale; + } + return strokes; +}; +},{}],37:[function(require,module,exports){ +'use strict'; +var mapboxgl = module.exports = {}; +mapboxgl.version = require('../package.json').version; +mapboxgl.Map = require('./ui/map'); +mapboxgl.Control = require('./ui/control/control'); +mapboxgl.Navigation = require('./ui/control/navigation'); +mapboxgl.Geolocate = require('./ui/control/geolocate'); +mapboxgl.Attribution = require('./ui/control/attribution'); +mapboxgl.Popup = require('./ui/popup'); +mapboxgl.Marker = require('./ui/marker'); +mapboxgl.Style = require('./style/style'); +mapboxgl.LngLat = require('./geo/lng_lat'); +mapboxgl.LngLatBounds = require('./geo/lng_lat_bounds'); +mapboxgl.Point = require('point-geometry'); +mapboxgl.Evented = require('./util/evented'); +mapboxgl.util = require('./util/util'); +mapboxgl.supported = require('./util/browser').supported; +var ajax = require('./util/ajax'); +mapboxgl.util.getJSON = ajax.getJSON; +mapboxgl.util.getArrayBuffer = ajax.getArrayBuffer; +var config = require('./util/config'); +mapboxgl.config = config; +Object.defineProperty(mapboxgl, 'accessToken', { + get: function () { + return config.ACCESS_TOKEN; + }, + set: function (token) { + config.ACCESS_TOKEN = token; + } +}); +},{"../package.json":213,"./geo/lng_lat":33,"./geo/lng_lat_bounds":34,"./style/style":72,"./ui/control/attribution":103,"./ui/control/control":104,"./ui/control/geolocate":105,"./ui/control/navigation":106,"./ui/map":115,"./ui/marker":116,"./ui/popup":117,"./util/ajax":119,"./util/browser":120,"./util/config":125,"./util/evented":128,"./util/util":136,"point-geometry":194}],38:[function(require,module,exports){ +'use strict'; +module.exports = function (uniforms) { + var pragmas = { + define: {}, + initialize: {} + }; + for (var i = 0; i < uniforms.length; i++) { + var uniform = uniforms[i]; + var type = '{precision} ' + (uniform.components === 1 ? 'float' : 'vec' + uniform.components); + pragmas.define[uniform.name.slice(2)] = 'uniform ' + type + ' ' + uniform.name + ';\n'; + pragmas.initialize[uniform.name.slice(2)] = type + ' ' + uniform.name.slice(2) + ' = ' + uniform.name + ';\n'; + } + return pragmas; +}; +},{}],39:[function(require,module,exports){ +'use strict'; +var pixelsToTileUnits = require('../source/pixels_to_tile_units'); +var createUniformPragmas = require('./create_uniform_pragmas'); +var tileSize = 512; +module.exports = drawBackground; +function drawBackground(painter, source, layer) { + var gl = painter.gl; + var transform = painter.transform; + var color = layer.paint['background-color']; + var image = layer.paint['background-pattern']; + var opacity = layer.paint['background-opacity']; + var program; + var imagePosA = image ? painter.spriteAtlas.getPosition(image.from, true) : null; + var imagePosB = image ? painter.spriteAtlas.getPosition(image.to, true) : null; + painter.setDepthSublayer(0); + if (imagePosA && imagePosB) { + if (painter.isOpaquePass) + return; + program = painter.useProgram('pattern'); + gl.uniform1i(program.u_image, 0); + gl.uniform2fv(program.u_pattern_tl_a, imagePosA.tl); + gl.uniform2fv(program.u_pattern_br_a, imagePosA.br); + gl.uniform2fv(program.u_pattern_tl_b, imagePosB.tl); + gl.uniform2fv(program.u_pattern_br_b, imagePosB.br); + gl.uniform1f(program.u_opacity, opacity); + gl.uniform1f(program.u_mix, image.t); + gl.uniform2fv(program.u_pattern_size_a, imagePosA.size); + gl.uniform2fv(program.u_pattern_size_b, imagePosB.size); + gl.uniform1f(program.u_scale_a, image.fromScale); + gl.uniform1f(program.u_scale_b, image.toScale); + gl.activeTexture(gl.TEXTURE0); + painter.spriteAtlas.bind(gl, true); + painter.tileExtentPatternVAO.bind(gl, program, painter.tileExtentBuffer); + } else { + if (painter.isOpaquePass !== (color[3] === 1)) + return; + var pragmas = createUniformPragmas([ + { + name: 'u_color', + components: 4 + }, + { + name: 'u_opacity', + components: 1 + } + ]); + program = painter.useProgram('fill', [], pragmas, pragmas); + gl.uniform4fv(program.u_color, color); + gl.uniform1f(program.u_opacity, opacity); + painter.tileExtentVAO.bind(gl, program, painter.tileExtentBuffer); + } + gl.disable(gl.STENCIL_TEST); + var coords = transform.coveringTiles({ tileSize: tileSize }); + for (var c = 0; c < coords.length; c++) { + var coord = coords[c]; + if (imagePosA && imagePosB) { + var tile = { + coord: coord, + tileSize: tileSize + }; + gl.uniform1f(program.u_tile_units_to_pixels, 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom)); + var tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom - tile.coord.z); + var pixelX = tileSizeAtNearestZoom * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); + var pixelY = tileSizeAtNearestZoom * tile.coord.y; + gl.uniform2f(program.u_pixel_coord_upper, pixelX >> 16, pixelY >> 16); + gl.uniform2f(program.u_pixel_coord_lower, pixelX & 65535, pixelY & 65535); + } + gl.uniformMatrix4fv(program.u_matrix, false, painter.transform.calculatePosMatrix(coord)); + gl.drawArrays(gl.TRIANGLE_STRIP, 0, painter.tileExtentBuffer.length); + } + gl.stencilMask(0); + gl.stencilFunc(gl.EQUAL, 128, 128); +} +},{"../source/pixels_to_tile_units":57,"./create_uniform_pragmas":38}],40:[function(require,module,exports){ +'use strict'; var browser = require('../util/browser'); - module.exports = drawCircles; - function drawCircles(painter, source, layer, coords) { - if (painter.isOpaquePass) return; - + if (painter.isOpaquePass) + return; var gl = painter.gl; - painter.setDepthSublayer(0); painter.depthMask(false); - - // Allow circles to be drawn across boundaries, so that - // large circles are not clipped to tiles gl.disable(gl.STENCIL_TEST); - for (var i = 0; i < coords.length; i++) { var coord = coords[i]; - var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bufferGroups = bucket.bufferGroups.circle; - if (!bufferGroups) continue; - - var program = painter.useProgram('circle', bucket.getProgramMacros('circle', layer)); - - gl.uniform2fv(program.u_extrude_scale, painter.transform.pixelsToGLUnits); - gl.uniform1f(program.u_blur, layer.paint['circle-blur']); + if (!bufferGroups) + continue; + var programOptions = bucket.paintAttributes.circle[layer.id]; + var program = painter.useProgram('circle', programOptions.defines, programOptions.vertexPragmas, programOptions.fragmentPragmas); + if (layer.paint['circle-pitch-scale'] === 'map') { + gl.uniform1i(program.u_scale_with_map, true); + gl.uniform2f(program.u_extrude_scale, painter.transform.pixelsToGLUnits[0] * painter.transform.altitude, painter.transform.pixelsToGLUnits[1] * painter.transform.altitude); + } else { + gl.uniform1i(program.u_scale_with_map, false); + gl.uniform2fv(program.u_extrude_scale, painter.transform.pixelsToGLUnits); + } gl.uniform1f(program.u_devicepixelratio, browser.devicePixelRatio); - gl.uniform1f(program.u_opacity, layer.paint['circle-opacity']); - - gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix( - coord.posMatrix, - tile, - layer.paint['circle-translate'], - layer.paint['circle-translate-anchor'] - )); - - bucket.setUniforms(gl, 'circle', program, layer, {zoom: painter.transform.zoom}); - + gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['circle-translate'], layer.paint['circle-translate-anchor'])); + bucket.setUniforms(gl, 'circle', program, layer, { zoom: painter.transform.zoom }); for (var k = 0; k < bufferGroups.length; k++) { var group = bufferGroups[k]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element, group.paint[layer.id]); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer, group.paintVertexBuffers[layer.id]); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } } - -},{"../util/browser":105}],33:[function(require,module,exports){ +},{"../util/browser":120}],41:[function(require,module,exports){ 'use strict'; - module.exports = drawCollisionDebug; - function drawCollisionDebug(painter, source, layer, coords) { var gl = painter.gl; gl.enable(gl.STENCIL_TEST); var program = painter.useProgram('collisionbox'); - for (var i = 0; i < coords.length; i++) { var coord = coords[i]; var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bufferGroups = bucket.bufferGroups.collisionBox; - - if (!bufferGroups || !bufferGroups.length) continue; + if (!bufferGroups || !bufferGroups.length) + continue; var group = bufferGroups[0]; - if (group.layout.vertex.length === 0) continue; - + if (group.layoutVertexBuffer.length === 0) + continue; gl.uniformMatrix4fv(program.u_matrix, false, coord.posMatrix); - painter.enableTileClippingMask(coord); - painter.lineWidth(1); gl.uniform1f(program.u_scale, Math.pow(2, painter.transform.zoom - tile.coord.z)); gl.uniform1f(program.u_zoom, painter.transform.zoom * 10); gl.uniform1f(program.u_maxzoom, (tile.coord.z + 1) * 10); - - group.vaos[layer.id].bind(gl, program, group.layout.vertex); - gl.drawArrays(gl.LINES, 0, group.layout.vertex.length); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer); + gl.drawArrays(gl.LINES, 0, group.layoutVertexBuffer.length); } } - -},{}],34:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ 'use strict'; - var textVertices = require('../lib/debugtext'); var browser = require('../util/browser'); var mat4 = require('gl-matrix').mat4; var EXTENT = require('../data/bucket').EXTENT; var Buffer = require('../data/buffer'); var VertexArrayObject = require('./vertex_array_object'); - module.exports = drawDebug; - function drawDebug(painter, source, coords) { - if (painter.isOpaquePass) return; - if (!painter.options.debug) return; - + if (painter.isOpaquePass) + return; + if (!painter.options.debug) + return; for (var i = 0; i < coords.length; i++) { drawDebugTile(painter, source, coords[i]); } } - function drawDebugTile(painter, source, coord) { var gl = painter.gl; - gl.disable(gl.STENCIL_TEST); painter.lineWidth(1 * browser.devicePixelRatio); - var posMatrix = coord.posMatrix; var program = painter.useProgram('debug'); - gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); gl.uniform4f(program.u_color, 1, 0, 0, 1); painter.debugVAO.bind(gl, program, painter.debugBuffer); gl.drawArrays(gl.LINE_STRIP, 0, painter.debugBuffer.length); - var vertices = textVertices(coord.toString(), 50, 200, 5); var debugTextArray = new painter.PosArray(); for (var v = 0; v < vertices.length; v += 2) { @@ -15718,224 +18838,143 @@ function drawDebugTile(painter, source, coord) { var debugTextVAO = new VertexArrayObject(); debugTextVAO.bind(gl, program, debugTextBuffer); gl.uniform4f(program.u_color, 1, 1, 1, 1); - - // Draw the halo with multiple 1px lines instead of one wider line because - // the gl spec doesn't guarantee support for lines with width > 1. var tileSize = source.getTile(coord).tileSize; var onePixel = EXTENT / (Math.pow(2, painter.transform.zoom - coord.z) * tileSize); - var translations = [[-1, -1], [-1, 1], [1, -1], [1, 1]]; + var translations = [ + [ + -1, + -1 + ], + [ + -1, + 1 + ], + [ + 1, + -1 + ], + [ + 1, + 1 + ] + ]; for (var i = 0; i < translations.length; i++) { var translation = translations[i]; - gl.uniformMatrix4fv(program.u_matrix, false, mat4.translate([], posMatrix, [onePixel * translation[0], onePixel * translation[1], 0])); + gl.uniformMatrix4fv(program.u_matrix, false, mat4.translate([], posMatrix, [ + onePixel * translation[0], + onePixel * translation[1], + 0 + ])); gl.drawArrays(gl.LINES, 0, debugTextBuffer.length); } - gl.uniform4f(program.u_color, 0, 0, 0, 1); gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); gl.drawArrays(gl.LINES, 0, debugTextBuffer.length); } - -},{"../data/bucket":17,"../data/buffer":22,"../lib/debugtext":29,"../util/browser":105,"./vertex_array_object":43,"gl-matrix":133}],35:[function(require,module,exports){ +},{"../data/bucket":23,"../data/buffer":28,"../lib/debugtext":36,"../util/browser":120,"./vertex_array_object":51,"gl-matrix":152}],43:[function(require,module,exports){ 'use strict'; - -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - module.exports = draw; - function draw(painter, source, layer, coords) { var gl = painter.gl; gl.enable(gl.STENCIL_TEST); - - var color = util.premultiply(layer.paint['fill-color']); - var image = layer.paint['fill-pattern']; - var strokeColor = util.premultiply(layer.paint['fill-outline-color']); - var opacity = layer.paint['fill-opacity']; - - // Draw fill - if (image ? !painter.isOpaquePass : painter.isOpaquePass === (color[3] === 1 && opacity === 1)) { - // Once we switch to earcut drawing we can pull most of the WebGL setup - // outside of this coords loop. + var isOpaque; + if (layer.paint['fill-pattern']) { + isOpaque = false; + } else { + isOpaque = layer.isPaintValueFeatureConstant('fill-color') && layer.isPaintValueFeatureConstant('fill-opacity') && layer.paint['fill-color'][3] === 1 && layer.paint['fill-opacity'] === 1; + } + if (painter.isOpaquePass === isOpaque) { + painter.setDepthSublayer(1); for (var i = 0; i < coords.length; i++) { drawFill(painter, source, layer, coords[i]); } } - - // Draw stroke if (!painter.isOpaquePass && layer.paint['fill-antialias']) { - if (strokeColor || !layer.paint['fill-pattern']) { - var outlineProgram = painter.useProgram('outline'); - painter.lineWidth(2); - painter.depthMask(false); - - if (strokeColor) { - // If we defined a different color for the fill outline, we are - // going to ignore the bits in 0x07 and just care about the global - // clipping mask. + painter.lineWidth(2); + painter.depthMask(false); + var isOutlineColorDefined = layer.getPaintProperty('fill-outline-color'); + if (isOutlineColorDefined || !layer.paint['fill-pattern']) { + if (isOutlineColorDefined) { painter.setDepthSublayer(2); } else { - // Otherwise, we only want to drawFill the antialiased parts that are - // *outside* the current shape. This is important in case the fill - // or stroke color is translucent. If we wouldn't clip to outside - // the current shape, some pixels from the outline stroke overlapped - // the (non-antialiased) fill. painter.setDepthSublayer(0); } - gl.uniform2f(outlineProgram.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); - gl.uniform4fv(outlineProgram.u_color, strokeColor ? strokeColor : color); - gl.uniform1f(outlineProgram.u_opacity, opacity); - - for (var j = 0; j < coords.length; j++) { - drawStroke(painter, source, layer, coords[j]); - } } else { - var outlinePatternProgram = painter.useProgram('outlinepattern'); - painter.lineWidth(2); - painter.depthMask(false); - // Otherwise, we only want to drawFill the antialiased parts that are - // *outside* the current shape. This is important in case the fill - // or stroke color is translucent. If we wouldn't clip to outside - // the current shape, some pixels from the outline stroke overlapped - // the (non-antialiased) fill. painter.setDepthSublayer(0); - gl.uniform2f(outlinePatternProgram.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); - - for (var k = 0; k < coords.length; k++) { - drawStroke(painter, source, layer, coords[k]); - } } - + for (var j = 0; j < coords.length; j++) { + drawStroke(painter, source, layer, coords[j]); + } } } - function drawFill(painter, source, layer, coord) { var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) return; + if (!bucket) + return; var bufferGroups = bucket.bufferGroups.fill; - if (!bufferGroups) return; - + if (!bufferGroups) + return; var gl = painter.gl; - - var color = util.premultiply(layer.paint['fill-color']); var image = layer.paint['fill-pattern']; - var opacity = layer.paint['fill-opacity']; - - var posMatrix = coord.posMatrix; - var translatedPosMatrix = painter.translatePosMatrix(posMatrix, tile, layer.paint['fill-translate'], layer.paint['fill-translate-anchor']); - - // Draw the stencil mask. - painter.setDepthSublayer(1); - - // We're only drawFilling to the first seven bits (== support a maximum of - // 8 overlapping polygons in one place before we get rendering errors). - gl.stencilMask(0x07); - gl.clear(gl.STENCIL_BUFFER_BIT); - - // Draw front facing triangles. Wherever the 0x80 bit is 1, we are - // increasing the lower 7 bits by one if the triangle is a front-facing - // triangle. This means that all visible polygons should be in CCW - // orientation, while all holes (see below) are in CW orientation. - painter.enableTileClippingMask(coord); - - // When we do a nonzero fill, we count the number of times a pixel is - // covered by a counterclockwise polygon, and subtract the number of - // times it is "uncovered" by a clockwise polygon. - gl.stencilOpSeparate(gl.FRONT, gl.KEEP, gl.KEEP, gl.INCR_WRAP); - gl.stencilOpSeparate(gl.BACK, gl.KEEP, gl.KEEP, gl.DECR_WRAP); - - // When drawFilling a shape, we first drawFill all shapes to the stencil buffer - // and incrementing all areas where polygons are - gl.colorMask(false, false, false, false); - painter.depthMask(false); - - // Draw the actual triangle fan into the stencil buffer. - var fillProgram = painter.useProgram('fill'); - gl.uniformMatrix4fv(fillProgram.u_matrix, false, translatedPosMatrix); - - for (var i = 0; i < bufferGroups.length; i++) { - var group = bufferGroups[i]; - group.vaos[layer.id].bind(gl, fillProgram, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); - } - - // Now that we have the stencil mask in the stencil buffer, we can start - // writing to the color buffer. - gl.colorMask(true, true, true, true); - painter.depthMask(true); - - // From now on, we don't want to update the stencil buffer anymore. - gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); - gl.stencilMask(0x0); var program; - - if (image) { - // Draw texture fill + if (!image) { + var programOptions = bucket.paintAttributes.fill[layer.id]; + program = painter.useProgram('fill', programOptions.defines, programOptions.vertexPragmas, programOptions.fragmentPragmas); + bucket.setUniforms(gl, 'fill', program, layer, { zoom: painter.transform.zoom }); + } else { program = painter.useProgram('pattern'); - setPattern(image, opacity, tile, coord, painter, program); - + setPattern(image, layer.paint['fill-opacity'], tile, coord, painter, program); gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); - - painter.tileExtentPatternVAO.bind(gl, program, painter.tileExtentBuffer); - - } else { - // Draw filling rectangle. - program = painter.useProgram('fill'); - gl.uniform4fv(fillProgram.u_color, color); - gl.uniform1f(fillProgram.u_opacity, opacity); - painter.tileExtentVAO.bind(gl, program, painter.tileExtentBuffer); } - - gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); - - // Only draw regions that we marked - gl.stencilFunc(gl.NOTEQUAL, 0x0, 0x07); - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, painter.tileExtentBuffer.length); - - gl.stencilMask(0x00); + gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['fill-translate'], layer.paint['fill-translate-anchor'])); + painter.enableTileClippingMask(coord); + for (var i = 0; i < bufferGroups.length; i++) { + var group = bufferGroups[i]; + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer, group.paintVertexBuffers[layer.id]); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length, gl.UNSIGNED_SHORT, 0); + } } - function drawStroke(painter, source, layer, coord) { var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) return; - + if (!bucket) + return; var gl = painter.gl; var bufferGroups = bucket.bufferGroups.fill; - var image = layer.paint['fill-pattern']; var opacity = layer.paint['fill-opacity']; - var program = image ? painter.useProgram('outlinepattern') : painter.useProgram('outline'); - - gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix( - coord.posMatrix, - tile, - layer.paint['fill-translate'], - layer.paint['fill-translate-anchor'] - )); - - if (image) { setPattern(image, opacity, tile, coord, painter, program); } - + var isOutlineColorDefined = layer.getPaintProperty('fill-outline-color'); + var program; + if (image && !isOutlineColorDefined) { + program = painter.useProgram('outlinepattern'); + gl.uniform2f(program.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); + } else { + var programOptions = bucket.paintAttributes.fill[layer.id]; + program = painter.useProgram('outline', programOptions.defines, programOptions.vertexPragmas, programOptions.fragmentPragmas); + gl.uniform2f(program.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); + gl.uniform1f(program.u_opacity, opacity); + bucket.setUniforms(gl, 'fill', program, layer, { zoom: painter.transform.zoom }); + } + gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['fill-translate'], layer.paint['fill-translate-anchor'])); + if (image) { + setPattern(image, opacity, tile, coord, painter, program); + } painter.enableTileClippingMask(coord); - for (var k = 0; k < bufferGroups.length; k++) { var group = bufferGroups[k]; - group.secondVaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element2); - gl.drawElements(gl.LINES, group.layout.element2.length * 2, gl.UNSIGNED_SHORT, 0); + group.secondVaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer2, group.paintVertexBuffers[layer.id]); + gl.drawElements(gl.LINES, group.elementBuffer2.length * 2, gl.UNSIGNED_SHORT, 0); } } - - function setPattern(image, opacity, tile, coord, painter, program) { var gl = painter.gl; - var imagePosA = painter.spriteAtlas.getPosition(image.from, true); var imagePosB = painter.spriteAtlas.getPosition(image.to, true); - if (!imagePosA || !imagePosB) return; - - + if (!imagePosA || !imagePosB) + return; gl.uniform1i(program.u_image, 0); gl.uniform2fv(program.u_pattern_tl_a, imagePosA.tl); gl.uniform2fv(program.u_pattern_br_a, imagePosA.br); @@ -15943,142 +18982,80 @@ function setPattern(image, opacity, tile, coord, painter, program) { gl.uniform2fv(program.u_pattern_br_b, imagePosB.br); gl.uniform1f(program.u_opacity, opacity); gl.uniform1f(program.u_mix, image.t); - - var imageSizeScaledA = [ - (imagePosA.size[0] * image.fromScale), - (imagePosA.size[1] * image.fromScale) - ]; - var imageSizeScaledB = [ - (imagePosB.size[0] * image.toScale), - (imagePosB.size[1] * image.toScale) - ]; - - gl.uniform2fv(program.u_patternscale_a, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledA[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledA[1], painter.transform.tileZoom) - ]); - - gl.uniform2fv(program.u_patternscale_b, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledB[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledB[1], painter.transform.tileZoom) - ]); - + gl.uniform1f(program.u_tile_units_to_pixels, 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom)); + gl.uniform2fv(program.u_pattern_size_a, imagePosA.size); + gl.uniform2fv(program.u_pattern_size_b, imagePosB.size); + gl.uniform1f(program.u_scale_a, image.fromScale); + gl.uniform1f(program.u_scale_b, image.toScale); var tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom - tile.coord.z); - - // shift images to match at tile boundaries - var offsetAx = ((tileSizeAtNearestZoom / imageSizeScaledA[0]) % 1) * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); - var offsetAy = ((tileSizeAtNearestZoom / imageSizeScaledA[1]) % 1) * tile.coord.y; - - var offsetBx = ((tileSizeAtNearestZoom / imageSizeScaledB[0]) % 1) * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); - var offsetBy = ((tileSizeAtNearestZoom / imageSizeScaledB[1]) % 1) * tile.coord.y; - - gl.uniform2fv(program.u_offset_a, [offsetAx, offsetAy]); - gl.uniform2fv(program.u_offset_b, [offsetBx, offsetBy]); - + var pixelX = tileSizeAtNearestZoom * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); + var pixelY = tileSizeAtNearestZoom * tile.coord.y; + gl.uniform2f(program.u_pixel_coord_upper, pixelX >> 16, pixelY >> 16); + gl.uniform2f(program.u_pixel_coord_lower, pixelX & 65535, pixelY & 65535); gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); } - -},{"../source/pixels_to_tile_units":47,"../util/util":119}],36:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":57}],44:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); var mat2 = require('gl-matrix').mat2; -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - -/** - * Draw a line. Under the hood this will read elements from - * a tile, dash textures from a lineAtlas, and style properties from a layer. - * @param {Object} painter - * @param {Object} layer - * @param {Object} posMatrix - * @param {Tile} tile - * @returns {undefined} draws with the painter - * @private - */ module.exports = function drawLine(painter, source, layer, coords) { - if (painter.isOpaquePass) return; + if (painter.isOpaquePass) + return; painter.setDepthSublayer(0); painter.depthMask(false); - var gl = painter.gl; gl.enable(gl.STENCIL_TEST); - - // don't draw zero-width lines - if (layer.paint['line-width'] <= 0) return; - - // the distance over which the line edge fades out. - // Retina devices need a smaller distance to avoid aliasing. + if (layer.paint['line-width'] <= 0) + return; var antialiasing = 1 / browser.devicePixelRatio; - var blur = layer.paint['line-blur'] + antialiasing; - var edgeWidth = layer.paint['line-width'] / 2; - var inset = -1; - var offset = 0; - var shift = 0; - - if (layer.paint['line-gap-width'] > 0) { - inset = layer.paint['line-gap-width'] / 2 + antialiasing * 0.5; - edgeWidth = layer.paint['line-width']; - - // shift outer lines half a pixel towards the middle to eliminate the crack - offset = inset - antialiasing / 2; - } - - var outset = offset + edgeWidth + antialiasing / 2 + shift; - var color = util.premultiply(layer.paint['line-color']); - + var color = layer.paint['line-color']; var tr = painter.transform; - var antialiasingMatrix = mat2.create(); - mat2.scale(antialiasingMatrix, antialiasingMatrix, [1, Math.cos(tr._pitch)]); + mat2.scale(antialiasingMatrix, antialiasingMatrix, [ + 1, + Math.cos(tr._pitch) + ]); mat2.rotate(antialiasingMatrix, antialiasingMatrix, painter.transform.angle); - - // calculate how much longer the real world distance is at the top of the screen - // than at the middle of the screen. - var topedgelength = Math.sqrt(tr.height * tr.height / 4 * (1 + tr.altitude * tr.altitude)); + var topedgelength = Math.sqrt(tr.height * tr.height / 4 * (1 + tr.altitude * tr.altitude)); var x = tr.height / 2 * Math.tan(tr._pitch); var extra = (topedgelength + x) / topedgelength - 1; - var dasharray = layer.paint['line-dasharray']; var image = layer.paint['line-pattern']; var program, posA, posB, imagePosA, imagePosB; - if (dasharray) { program = painter.useProgram('linesdfpattern'); - - gl.uniform2fv(program.u_linewidth, [ outset, inset ]); + gl.uniform1f(program.u_linewidth, layer.paint['line-width'] / 2); + gl.uniform1f(program.u_gapwidth, layer.paint['line-gap-width'] / 2); + gl.uniform1f(program.u_antialiasing, antialiasing / 2); gl.uniform1f(program.u_blur, blur); gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, layer.paint['line-opacity']); - posA = painter.lineAtlas.getDash(dasharray.from, layer.layout['line-cap'] === 'round'); posB = painter.lineAtlas.getDash(dasharray.to, layer.layout['line-cap'] === 'round'); - gl.uniform1i(program.u_image, 0); gl.activeTexture(gl.TEXTURE0); painter.lineAtlas.bind(gl); - gl.uniform1f(program.u_tex_y_a, posA.y); gl.uniform1f(program.u_tex_y_b, posB.y); gl.uniform1f(program.u_mix, dasharray.t); gl.uniform1f(program.u_extra, extra); gl.uniform1f(program.u_offset, -layer.paint['line-offset']); gl.uniformMatrix2fv(program.u_antialiasingmatrix, false, antialiasingMatrix); - } else if (image) { imagePosA = painter.spriteAtlas.getPosition(image.from, true); imagePosB = painter.spriteAtlas.getPosition(image.to, true); - if (!imagePosA || !imagePosB) return; - + if (!imagePosA || !imagePosB) + return; program = painter.useProgram('linepattern'); - gl.uniform1i(program.u_image, 0); gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); - - gl.uniform2fv(program.u_linewidth, [ outset, inset ]); + gl.uniform1f(program.u_linewidth, layer.paint['line-width'] / 2); + gl.uniform1f(program.u_gapwidth, layer.paint['line-gap-width'] / 2); + gl.uniform1f(program.u_antialiasing, antialiasing / 2); gl.uniform1f(program.u_blur, blur); gl.uniform2fv(program.u_pattern_tl_a, imagePosA.tl); gl.uniform2fv(program.u_pattern_br_a, imagePosA.br); @@ -16089,11 +19066,11 @@ module.exports = function drawLine(painter, source, layer, coords) { gl.uniform1f(program.u_extra, extra); gl.uniform1f(program.u_offset, -layer.paint['line-offset']); gl.uniformMatrix2fv(program.u_antialiasingmatrix, false, antialiasingMatrix); - } else { program = painter.useProgram('line'); - - gl.uniform2fv(program.u_linewidth, [ outset, inset ]); + gl.uniform1f(program.u_linewidth, layer.paint['line-width'] / 2); + gl.uniform1f(program.u_gapwidth, layer.paint['line-gap-width'] / 2); + gl.uniform1f(program.u_antialiasing, antialiasing / 2); gl.uniform1f(program.u_blur, blur); gl.uniform1f(program.u_extra, extra); gl.uniform1f(program.u_offset, -layer.paint['line-offset']); @@ -16101,34 +19078,35 @@ module.exports = function drawLine(painter, source, layer, coords) { gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, layer.paint['line-opacity']); } - for (var k = 0; k < coords.length; k++) { var coord = coords[k]; var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bufferGroups = bucket.bufferGroups.line; - if (!bufferGroups) continue; - + if (!bufferGroups) + continue; painter.enableTileClippingMask(coord); - - // set uniforms that are different for each tile var posMatrix = painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['line-translate'], layer.paint['line-translate-anchor']); gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); - var ratio = 1 / pixelsToTileUnits(tile, 1, painter.transform.zoom); - if (dasharray) { var widthA = posA.width * dasharray.fromScale; var widthB = posB.width * dasharray.toScale; - var scaleA = [1 / pixelsToTileUnits(tile, widthA, painter.transform.tileZoom), -posA.height / 2]; - var scaleB = [1 / pixelsToTileUnits(tile, widthB, painter.transform.tileZoom), -posB.height / 2]; + var scaleA = [ + 1 / pixelsToTileUnits(tile, widthA, painter.transform.tileZoom), + -posA.height / 2 + ]; + var scaleB = [ + 1 / pixelsToTileUnits(tile, widthB, painter.transform.tileZoom), + -posB.height / 2 + ]; var gamma = painter.lineAtlas.width / (Math.min(widthA, widthB) * 256 * browser.devicePixelRatio) / 2; gl.uniform1f(program.u_ratio, ratio); gl.uniform2fv(program.u_patternscale_a, scaleA); gl.uniform2fv(program.u_patternscale_b, scaleB); gl.uniform1f(program.u_sdfgamma, gamma); - } else if (image) { gl.uniform1f(program.u_ratio, ratio); gl.uniform2fv(program.u_pattern_size_a, [ @@ -16139,110 +19117,93 @@ module.exports = function drawLine(painter, source, layer, coords) { pixelsToTileUnits(tile, imagePosB.size[0] * image.toScale, painter.transform.tileZoom), imagePosB.size[1] ]); - } else { gl.uniform1f(program.u_ratio, ratio); } - for (var i = 0; i < bufferGroups.length; i++) { var group = bufferGroups[i]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } - }; - -},{"../source/pixels_to_tile_units":47,"../util/browser":105,"../util/util":119,"gl-matrix":133}],37:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":57,"../util/browser":120,"gl-matrix":152}],45:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var StructArrayType = require('../util/struct_array'); - module.exports = drawRaster; - function drawRaster(painter, source, layer, coords) { - if (painter.isOpaquePass) return; - + if (painter.isOpaquePass) + return; var gl = painter.gl; - gl.enable(gl.DEPTH_TEST); painter.depthMask(true); - - // Change depth function to prevent double drawing in areas where tiles overlap. gl.depthFunc(gl.LESS); - var minTileZ = coords.length && coords[0].z; - for (var i = 0; i < coords.length; i++) { var coord = coords[i]; - // set the lower zoom level to sublayer 0, and higher zoom levels to higher sublayers painter.setDepthSublayer(coord.z - minTileZ); drawRasterTile(painter, source, layer, coord); } - gl.depthFunc(gl.LEQUAL); } - drawRaster.RasterBoundsArray = new StructArrayType({ members: [ - { name: 'a_pos', type: 'Int16', components: 2 }, - { name: 'a_texture_pos', type: 'Int16', components: 2 } + { + name: 'a_pos', + type: 'Int16', + components: 2 + }, + { + name: 'a_texture_pos', + type: 'Int16', + components: 2 + } ] }); - function drawRasterTile(painter, source, layer, coord) { - var gl = painter.gl; - gl.disable(gl.STENCIL_TEST); - var tile = source.getTile(coord); var posMatrix = painter.transform.calculatePosMatrix(coord, source.maxzoom); - var program = painter.useProgram('raster'); gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); - - // color parameters gl.uniform1f(program.u_brightness_low, layer.paint['raster-brightness-min']); gl.uniform1f(program.u_brightness_high, layer.paint['raster-brightness-max']); gl.uniform1f(program.u_saturation_factor, saturationFactor(layer.paint['raster-saturation'])); gl.uniform1f(program.u_contrast_factor, contrastFactor(layer.paint['raster-contrast'])); gl.uniform3fv(program.u_spin_weights, spinWeights(layer.paint['raster-hue-rotate'])); - - var parentTile = tile.source && tile.source._pyramid.findLoadedParent(coord, 0, {}), - opacities = getOpacities(tile, parentTile, layer, painter.transform); - + var parentTile = tile.source && tile.source.findLoadedParent(coord, 0, {}), opacities = getOpacities(tile, parentTile, layer, painter.transform); var parentScaleBy, parentTL; - gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, tile.texture); - + gl.activeTexture(gl.TEXTURE1); if (parentTile) { - gl.activeTexture(gl.TEXTURE1); gl.bindTexture(gl.TEXTURE_2D, parentTile.texture); - parentScaleBy = Math.pow(2, parentTile.coord.z - tile.coord.z); - parentTL = [tile.coord.x * parentScaleBy % 1, tile.coord.y * parentScaleBy % 1]; + parentTL = [ + tile.coord.x * parentScaleBy % 1, + tile.coord.y * parentScaleBy % 1 + ]; } else { + gl.bindTexture(gl.TEXTURE_2D, tile.texture); opacities[1] = 0; } - - // cross-fade parameters - gl.uniform2fv(program.u_tl_parent, parentTL || [0, 0]); + gl.uniform2fv(program.u_tl_parent, parentTL || [ + 0, + 0 + ]); gl.uniform1f(program.u_scale_parent, parentScaleBy || 1); gl.uniform1f(program.u_buffer_scale, 1); gl.uniform1f(program.u_opacity0, opacities[0]); gl.uniform1f(program.u_opacity1, opacities[1]); gl.uniform1i(program.u_image0, 0); gl.uniform1i(program.u_image1, 1); - var buffer = tile.boundsBuffer || painter.rasterBoundsBuffer; var vao = tile.boundsVAO || painter.rasterBoundsVAO; vao.bind(gl, program, buffer); gl.drawArrays(gl.TRIANGLE_STRIP, 0, buffer.length); } - function spinWeights(angle) { angle *= Math.PI / 180; var s = Math.sin(angle); @@ -16253,288 +19214,184 @@ function spinWeights(angle) { (Math.sqrt(3) * s - c + 1) / 3 ]; } - function contrastFactor(contrast) { - return contrast > 0 ? - 1 / (1 - contrast) : - 1 + contrast; + return contrast > 0 ? 1 / (1 - contrast) : 1 + contrast; } - function saturationFactor(saturation) { - return saturation > 0 ? - 1 - 1 / (1.001 - saturation) : - -saturation; + return saturation > 0 ? 1 - 1 / (1.001 - saturation) : -saturation; } - function getOpacities(tile, parentTile, layer, transform) { - var opacity = [1, 0]; + var opacity = [ + 1, + 0 + ]; var fadeDuration = layer.paint['raster-fade-duration']; - if (tile.source && fadeDuration > 0) { var now = new Date().getTime(); - var sinceTile = (now - tile.timeAdded) / fadeDuration; var sinceParent = parentTile ? (now - parentTile.timeAdded) / fadeDuration : -1; - - var idealZ = tile.source._pyramid.coveringZoomLevel(transform); + var idealZ = transform.coveringZoomLevel(tile.source); var parentFurther = parentTile ? Math.abs(parentTile.coord.z - idealZ) > Math.abs(tile.coord.z - idealZ) : false; - if (!parentTile || parentFurther) { - // if no parent or parent is older opacity[0] = util.clamp(sinceTile, 0, 1); opacity[1] = 1 - opacity[0]; } else { - // parent is younger, zooming out opacity[0] = util.clamp(1 - sinceParent, 0, 1); opacity[1] = 1 - opacity[0]; } } - var op = layer.paint['raster-opacity']; opacity[0] *= op; opacity[1] *= op; - return opacity; } - -},{"../util/struct_array":117,"../util/util":119}],38:[function(require,module,exports){ +},{"../util/struct_array":134,"../util/util":136}],46:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); var drawCollisionDebug = require('./draw_collision_debug'); -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - - module.exports = drawSymbols; - function drawSymbols(painter, source, layer, coords) { - if (painter.isOpaquePass) return; - - var drawAcrossEdges = !(layer.layout['text-allow-overlap'] || layer.layout['icon-allow-overlap'] || - layer.layout['text-ignore-placement'] || layer.layout['icon-ignore-placement']); - + if (painter.isOpaquePass) + return; + var drawAcrossEdges = !(layer.layout['text-allow-overlap'] || layer.layout['icon-allow-overlap'] || layer.layout['text-ignore-placement'] || layer.layout['icon-ignore-placement']); var gl = painter.gl; - - // Disable the stencil test so that labels aren't clipped to tile boundaries. - // - // Layers with features that may be drawn overlapping aren't clipped. These - // layers are sorted in the y direction, and to draw the correct ordering near - // tile edges the icons are included in both tiles and clipped when drawing. if (drawAcrossEdges) { gl.disable(gl.STENCIL_TEST); } else { gl.enable(gl.STENCIL_TEST); } - painter.setDepthSublayer(0); painter.depthMask(false); gl.disable(gl.DEPTH_TEST); - - drawLayerSymbols(painter, source, layer, coords, false, - layer.paint['icon-translate'], - layer.paint['icon-translate-anchor'], - layer.layout['icon-rotation-alignment'], - layer.layout['icon-size'], - layer.paint['icon-halo-width'], - layer.paint['icon-halo-color'], - layer.paint['icon-halo-blur'], - layer.paint['icon-opacity'], - layer.paint['icon-color']); - - drawLayerSymbols(painter, source, layer, coords, true, - layer.paint['text-translate'], - layer.paint['text-translate-anchor'], - layer.layout['text-rotation-alignment'], - layer.layout['text-size'], - layer.paint['text-halo-width'], - layer.paint['text-halo-color'], - layer.paint['text-halo-blur'], - layer.paint['text-opacity'], - layer.paint['text-color']); - + drawLayerSymbols(painter, source, layer, coords, false, layer.paint['icon-translate'], layer.paint['icon-translate-anchor'], layer.layout['icon-rotation-alignment'], layer.layout['icon-rotation-alignment'], layer.layout['icon-size'], layer.paint['icon-halo-width'], layer.paint['icon-halo-color'], layer.paint['icon-halo-blur'], layer.paint['icon-opacity'], layer.paint['icon-color']); + drawLayerSymbols(painter, source, layer, coords, true, layer.paint['text-translate'], layer.paint['text-translate-anchor'], layer.layout['text-rotation-alignment'], layer.layout['text-pitch-alignment'], layer.layout['text-size'], layer.paint['text-halo-width'], layer.paint['text-halo-color'], layer.paint['text-halo-blur'], layer.paint['text-opacity'], layer.paint['text-color']); gl.enable(gl.DEPTH_TEST); - - drawCollisionDebug(painter, source, layer, coords); + if (source.map.showCollisionBoxes) { + drawCollisionDebug(painter, source, layer, coords); + } } - -function drawLayerSymbols(painter, source, layer, coords, isText, - translate, - translateAnchor, - rotationAlignment, - size, - haloWidth, - haloColor, - haloBlur, - opacity, - color) { - - haloColor = util.premultiply(haloColor); - color = util.premultiply(color); - +function drawLayerSymbols(painter, source, layer, coords, isText, translate, translateAnchor, rotationAlignment, pitchAlignment, size, haloWidth, haloColor, haloBlur, opacity, color) { for (var j = 0; j < coords.length; j++) { var tile = source.getTile(coords[j]); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bothBufferGroups = bucket.bufferGroups; var bufferGroups = isText ? bothBufferGroups.glyph : bothBufferGroups.icon; - if (!bufferGroups.length) continue; - + if (!bufferGroups.length) + continue; painter.enableTileClippingMask(coords[j]); - drawSymbol(painter, layer, coords[j].posMatrix, tile, bucket, bufferGroups, isText, - isText || bucket.sdfIcons, !isText && bucket.iconsNeedLinear, - isText ? bucket.adjustedTextSize : bucket.adjustedIconSize, bucket.fontstack, - translate, - translateAnchor, - rotationAlignment, - size, - haloWidth, - haloColor, - haloBlur, - opacity, - color); - } -} - -function drawSymbol(painter, layer, posMatrix, tile, bucket, bufferGroups, isText, sdf, iconsNeedLinear, adjustedSize, fontstack, - translate, - translateAnchor, - rotationAlignment, - size, - haloWidth, - haloColor, - haloBlur, - opacity, - color) { + drawSymbol(painter, layer, coords[j].posMatrix, tile, bucket, bufferGroups, isText, isText || bucket.sdfIcons, !isText && bucket.iconsNeedLinear, isText ? bucket.adjustedTextSize : bucket.adjustedIconSize, bucket.fontstack, translate, translateAnchor, rotationAlignment, pitchAlignment, size, haloWidth, haloColor, haloBlur, opacity, color); + } +} +function drawSymbol(painter, layer, posMatrix, tile, bucket, bufferGroups, isText, sdf, iconsNeedLinear, adjustedSize, fontstack, translate, translateAnchor, rotationAlignment, pitchAlignment, size, haloWidth, haloColor, haloBlur, opacity, color) { var gl = painter.gl; var tr = painter.transform; - var alignedWithMap = rotationAlignment === 'map'; - + var rotateWithMap = rotationAlignment === 'map'; + var pitchWithMap = pitchAlignment === 'map'; var defaultSize = isText ? 24 : 1; var fontScale = size / defaultSize; - var extrudeScale, s, gammaScale; - if (alignedWithMap) { + if (pitchWithMap) { s = pixelsToTileUnits(tile, 1, painter.transform.zoom) * fontScale; gammaScale = 1 / Math.cos(tr._pitch); - extrudeScale = [s, s]; + extrudeScale = [ + s, + s + ]; } else { s = painter.transform.altitude * fontScale; gammaScale = 1; - extrudeScale = [ tr.pixelsToGLUnits[0] * s, tr.pixelsToGLUnits[1] * s]; + extrudeScale = [ + tr.pixelsToGLUnits[0] * s, + tr.pixelsToGLUnits[1] * s + ]; } - - // calculate how much longer the real world distance is at the top of the screen - // than at the middle of the screen. - var topedgelength = Math.sqrt(tr.height * tr.height / 4 * (1 + tr.altitude * tr.altitude)); - var x = tr.height / 2 * Math.tan(tr._pitch); - var extra = (topedgelength + x) / topedgelength - 1; - if (!isText && !painter.style.sprite.loaded()) return; - var program = painter.useProgram(sdf ? 'sdf' : 'icon'); gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(posMatrix, tile, translate, translateAnchor)); - gl.uniform1i(program.u_skewed, alignedWithMap); - gl.uniform1f(program.u_extra, extra); + gl.uniform1i(program.u_rotate_with_map, rotateWithMap); + gl.uniform1i(program.u_pitch_with_map, pitchWithMap); gl.uniform2fv(program.u_extrude_scale, extrudeScale); - gl.activeTexture(gl.TEXTURE0); gl.uniform1i(program.u_texture, 0); - if (isText) { - // use the fonstack used when parsing the tile, not the fontstack - // at the current zoom level (layout['text-font']). var glyphAtlas = fontstack && painter.glyphSource.getGlyphAtlas(fontstack); - if (!glyphAtlas) return; - + if (!glyphAtlas) + return; glyphAtlas.updateTexture(gl); gl.uniform2f(program.u_texsize, glyphAtlas.width / 4, glyphAtlas.height / 4); } else { var mapMoving = painter.options.rotating || painter.options.zooming; var iconScaled = fontScale !== 1 || browser.devicePixelRatio !== painter.spriteAtlas.pixelRatio || iconsNeedLinear; - var iconTransformed = alignedWithMap || painter.transform.pitch; + var iconTransformed = pitchWithMap || painter.transform.pitch; painter.spriteAtlas.bind(gl, sdf || mapMoving || iconScaled || iconTransformed); gl.uniform2f(program.u_texsize, painter.spriteAtlas.width / 4, painter.spriteAtlas.height / 4); } - - // adjust min/max zooms for variable font sizes var zoomAdjust = Math.log(size / adjustedSize) / Math.LN2 || 0; - gl.uniform1f(program.u_zoom, (painter.transform.zoom - zoomAdjust) * 10); // current zoom level - + gl.uniform1f(program.u_zoom, (painter.transform.zoom - zoomAdjust) * 10); gl.activeTexture(gl.TEXTURE1); painter.frameHistory.bind(gl); gl.uniform1i(program.u_fadetexture, 1); - var group; - if (sdf) { var sdfPx = 8; var blurOffset = 1.19; var haloOffset = 6; var gamma = 0.105 * defaultSize / size / browser.devicePixelRatio; - if (haloWidth) { - // Draw halo underneath the text. gl.uniform1f(program.u_gamma, (haloBlur * blurOffset / fontScale / sdfPx + gamma) * gammaScale); gl.uniform4fv(program.u_color, haloColor); gl.uniform1f(program.u_opacity, opacity); gl.uniform1f(program.u_buffer, (haloOffset - haloWidth / fontScale) / sdfPx); - for (var j = 0; j < bufferGroups.length; j++) { group = bufferGroups[j]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } - gl.uniform1f(program.u_gamma, gamma * gammaScale); gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, opacity); gl.uniform1f(program.u_buffer, (256 - 64) / 256); - + gl.uniform1f(program.u_pitch, tr.pitch / 360 * 2 * Math.PI); + gl.uniform1f(program.u_bearing, tr.bearing / 360 * 2 * Math.PI); + gl.uniform1f(program.u_aspect_ratio, tr.width / tr.height); for (var i = 0; i < bufferGroups.length; i++) { group = bufferGroups[i]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } - } else { gl.uniform1f(program.u_opacity, opacity); for (var k = 0; k < bufferGroups.length; k++) { group = bufferGroups[k]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } } - -},{"../source/pixels_to_tile_units":47,"../util/browser":105,"../util/util":119,"./draw_collision_debug":33}],39:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":57,"../util/browser":120,"./draw_collision_debug":41}],47:[function(require,module,exports){ 'use strict'; - module.exports = FrameHistory; - function FrameHistory() { this.changeTimes = new Float64Array(256); this.changeOpacities = new Uint8Array(256); this.opacities = new Uint8ClampedArray(256); this.array = new Uint8Array(this.opacities.buffer); - this.fadeDuration = 300; this.previousZoom = 0; this.firstFrame = true; } - -FrameHistory.prototype.record = function(zoom) { +FrameHistory.prototype.record = function (zoom) { var now = Date.now(); - if (this.firstFrame) { now = 0; this.firstFrame = false; } - zoom = Math.floor(zoom * 10); - var z; if (zoom < this.previousZoom) { for (z = zoom + 1; z <= this.previousZoom; z++) { @@ -16547,7 +19404,6 @@ FrameHistory.prototype.record = function(zoom) { this.changeOpacities[z] = this.opacities[z]; } } - for (z = 0; z < 256; z++) { var timeSince = now - this.changeTimes[z]; var opacityChange = timeSince / this.fadeDuration * 255; @@ -16557,12 +19413,10 @@ FrameHistory.prototype.record = function(zoom) { this.opacities[z] = this.changeOpacities[z] - opacityChange; } } - this.changed = true; this.previousZoom = zoom; }; - -FrameHistory.prototype.bind = function(gl) { +FrameHistory.prototype.bind = function (gl) { if (!this.texture) { this.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.texture); @@ -16571,7 +19425,6 @@ FrameHistory.prototype.bind = function(gl) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, 256, 1, 0, gl.ALPHA, gl.UNSIGNED_BYTE, this.array); - } else { gl.bindTexture(gl.TEXTURE_2D, this.texture); if (this.changed) { @@ -16580,105 +19433,64 @@ FrameHistory.prototype.bind = function(gl) { } } }; - -},{}],40:[function(require,module,exports){ +},{}],48:[function(require,module,exports){ 'use strict'; - +var util = require('../util/util'); module.exports = LineAtlas; - -/** - * A LineAtlas lets us reuse rendered dashed lines - * by writing many of them to a texture and then fetching their positions - * using .getDash. - * - * @param {number} width - * @param {number} height - * @private - */ function LineAtlas(width, height) { this.width = width; this.height = height; this.nextRow = 0; - this.bytes = 4; this.data = new Uint8Array(this.width * this.height * this.bytes); - this.positions = {}; } - -LineAtlas.prototype.setSprite = function(sprite) { +LineAtlas.prototype.setSprite = function (sprite) { this.sprite = sprite; }; - -/** - * Get or create a dash line pattern. - * - * @param {Array} dasharray - * @param {boolean} round whether to add circle caps in between dash segments - * @returns {Object} position of dash texture in { y, height, width } - * @private - */ -LineAtlas.prototype.getDash = function(dasharray, round) { - var key = dasharray.join(",") + round; - +LineAtlas.prototype.getDash = function (dasharray, round) { + var key = dasharray.join(',') + round; if (!this.positions[key]) { this.positions[key] = this.addDash(dasharray, round); } return this.positions[key]; }; - -LineAtlas.prototype.addDash = function(dasharray, round) { - +LineAtlas.prototype.addDash = function (dasharray, round) { var n = round ? 7 : 0; var height = 2 * n + 1; var offset = 128; - if (this.nextRow + height > this.height) { - console.warn('LineAtlas out of space'); + util.warnOnce('LineAtlas out of space'); return null; } - var length = 0; for (var i = 0; i < dasharray.length; i++) { length += dasharray[i]; } - var stretch = this.width / length; var halfWidth = stretch / 2; - - // If dasharray has an odd length, both the first and last parts - // are dashes and should be joined seamlessly. var oddLength = dasharray.length % 2 === 1; - for (var y = -n; y <= n; y++) { var row = this.nextRow + n + y; var index = this.width * row; - var left = oddLength ? -dasharray[dasharray.length - 1] : 0; var right = dasharray[0]; var partIndex = 1; - for (var x = 0; x < this.width; x++) { - while (right < x / stretch) { left = right; right = right + dasharray[partIndex]; - if (oddLength && partIndex === dasharray.length - 1) { right += dasharray[0]; } - partIndex++; } - var distLeft = Math.abs(x - left * stretch); var distRight = Math.abs(x - right * stretch); var dist = Math.min(distLeft, distRight); - var inside = (partIndex % 2) === 1; + var inside = partIndex % 2 === 1; var signedDistance; - if (round) { - // Add circle caps var distMiddle = n ? y / n * (halfWidth + 1) : 0; if (inside) { var distEdge = halfWidth - Math.abs(distMiddle); @@ -16689,24 +19501,19 @@ LineAtlas.prototype.addDash = function(dasharray, round) { } else { signedDistance = (inside ? 1 : -1) * dist; } - this.data[3 + (index + x) * 4] = Math.max(0, Math.min(255, signedDistance + offset)); } } - var pos = { y: (this.nextRow + n + 0.5) / this.height, height: 2 * n / this.height, width: length }; - this.nextRow += height; this.dirty = true; - return pos; }; - -LineAtlas.prototype.bind = function(gl) { +LineAtlas.prototype.bind = function (gl) { if (!this.texture) { this.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.texture); @@ -16715,24 +19522,20 @@ LineAtlas.prototype.bind = function(gl) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.data); - } else { gl.bindTexture(gl.TEXTURE_2D, this.texture); - if (this.dirty) { this.dirty = false; gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, this.height, gl.RGBA, gl.UNSIGNED_BYTE, this.data); } } }; - -},{}],41:[function(require,module,exports){ +},{"../util/util":136}],49:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); var mat4 = require('gl-matrix').mat4; var FrameHistory = require('./frame_history'); -var TilePyramid = require('../source/tile_pyramid'); +var SourceCache = require('../source/source_cache'); var EXTENT = require('../data/bucket').EXTENT; var pixelsToTileUnits = require('../source/pixels_to_tile_units'); var util = require('../util/util'); @@ -16740,71 +19543,43 @@ var StructArrayType = require('../util/struct_array'); var Buffer = require('../data/buffer'); var VertexArrayObject = require('./vertex_array_object'); var RasterBoundsArray = require('./draw_raster').RasterBoundsArray; - +var createUniformPragmas = require('./create_uniform_pragmas'); module.exports = Painter; - -/** - * Initialize a new painter object. - * - * @param {Canvas} gl an experimental-webgl drawing context - * @private - */ function Painter(gl, transform) { this.gl = gl; this.transform = transform; - this.reusableTextures = {}; this.preFbos = {}; - this.frameHistory = new FrameHistory(); - this.setup(); - - // Within each layer there are multiple distinct z-planes that can be drawn to. - // This is implemented using the WebGL depth buffer. - this.numSublayers = TilePyramid.maxUnderzooming + TilePyramid.maxOverzooming + 1; + this.numSublayers = SourceCache.maxUnderzooming + SourceCache.maxOverzooming + 1; this.depthEpsilon = 1 / Math.pow(2, 16); - this.lineWidthRange = gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE); } - util.extend(Painter.prototype, require('./painter/use_program')); - -/* - * Update the GL viewport, projection matrix, and transforms to compensate - * for a new width and height value. - */ -Painter.prototype.resize = function(width, height) { +Painter.prototype.resize = function (width, height) { var gl = this.gl; - this.width = width * browser.devicePixelRatio; this.height = height * browser.devicePixelRatio; gl.viewport(0, 0, this.width, this.height); - }; - -Painter.prototype.setup = function() { +Painter.prototype.setup = function () { var gl = this.gl; - gl.verbose = true; - - // We are blending the new pixels *behind* the existing pixels. That way we can - // draw front-to-back and use then stencil buffer to cull opaque pixels early. gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - gl.enable(gl.STENCIL_TEST); - gl.enable(gl.DEPTH_TEST); gl.depthFunc(gl.LEQUAL); - this._depthMask = false; gl.depthMask(false); - var PosArray = this.PosArray = new StructArrayType({ - members: [{ name: 'a_pos', type: 'Int16', components: 2 }] + members: [{ + name: 'a_pos', + type: 'Int16', + components: 2 + }] }); - var tileExtentArray = new PosArray(); tileExtentArray.emplaceBack(0, 0); tileExtentArray.emplaceBack(EXTENT, 0); @@ -16813,7 +19588,6 @@ Painter.prototype.setup = function() { this.tileExtentBuffer = new Buffer(tileExtentArray.serialize(), PosArray.serialize(), Buffer.BufferType.VERTEX); this.tileExtentVAO = new VertexArrayObject(); this.tileExtentPatternVAO = new VertexArrayObject(); - var debugArray = new PosArray(); debugArray.emplaceBack(0, 0); debugArray.emplaceBack(EXTENT, 0); @@ -16822,7 +19596,6 @@ Painter.prototype.setup = function() { debugArray.emplaceBack(0, 0); this.debugBuffer = new Buffer(debugArray.serialize(), PosArray.serialize(), Buffer.BufferType.VERTEX); this.debugVAO = new VertexArrayObject(); - var rasterBoundsArray = new RasterBoundsArray(); rasterBoundsArray.emplaceBack(0, 0, 0, 0); rasterBoundsArray.emplaceBack(EXTENT, 0, 32767, 0); @@ -16831,80 +19604,67 @@ Painter.prototype.setup = function() { this.rasterBoundsBuffer = new Buffer(rasterBoundsArray.serialize(), RasterBoundsArray.serialize(), Buffer.BufferType.VERTEX); this.rasterBoundsVAO = new VertexArrayObject(); }; - -/* - * Reset the color buffers of the drawing canvas. - */ -Painter.prototype.clearColor = function() { +Painter.prototype.clearColor = function () { var gl = this.gl; gl.clearColor(0, 0, 0, 0); gl.clear(gl.COLOR_BUFFER_BIT); }; - -/* - * Reset the drawing canvas by clearing the stencil buffer so that we can draw - * new tiles at the same location, while retaining previously drawn pixels. - */ -Painter.prototype.clearStencil = function() { +Painter.prototype.clearStencil = function () { var gl = this.gl; - gl.clearStencil(0x0); - gl.stencilMask(0xFF); + gl.clearStencil(0); + gl.stencilMask(255); gl.clear(gl.STENCIL_BUFFER_BIT); }; - -Painter.prototype.clearDepth = function() { +Painter.prototype.clearDepth = function () { var gl = this.gl; gl.clearDepth(1); this.depthMask(true); gl.clear(gl.DEPTH_BUFFER_BIT); }; - -Painter.prototype._renderTileClippingMasks = function(coords) { +Painter.prototype._renderTileClippingMasks = function (coords) { var gl = this.gl; gl.colorMask(false, false, false, false); this.depthMask(false); gl.disable(gl.DEPTH_TEST); gl.enable(gl.STENCIL_TEST); - - // Only write clipping IDs to the last 5 bits. The first three are used for drawing fills. - gl.stencilMask(0xF8); - // Tests will always pass, and ref value will be written to stencil buffer. + gl.stencilMask(248); gl.stencilOp(gl.KEEP, gl.KEEP, gl.REPLACE); - var idNext = 1; this._tileClippingMaskIDs = {}; for (var i = 0; i < coords.length; i++) { var coord = coords[i]; - var id = this._tileClippingMaskIDs[coord.id] = (idNext++) << 3; - - gl.stencilFunc(gl.ALWAYS, id, 0xF8); - - var program = this.useProgram('fill'); + var id = this._tileClippingMaskIDs[coord.id] = idNext++ << 3; + gl.stencilFunc(gl.ALWAYS, id, 248); + var pragmas = createUniformPragmas([ + { + name: 'u_color', + components: 4 + }, + { + name: 'u_opacity', + components: 1 + } + ]); + var program = this.useProgram('fill', [], pragmas, pragmas); gl.uniformMatrix4fv(program.u_matrix, false, coord.posMatrix); - - // Draw the clipping mask this.tileExtentVAO.bind(gl, program, this.tileExtentBuffer); gl.drawArrays(gl.TRIANGLE_STRIP, 0, this.tileExtentBuffer.length); } - - gl.stencilMask(0x00); + gl.stencilMask(0); gl.colorMask(true, true, true, true); this.depthMask(true); gl.enable(gl.DEPTH_TEST); }; - -Painter.prototype.enableTileClippingMask = function(coord) { +Painter.prototype.enableTileClippingMask = function (coord) { var gl = this.gl; - gl.stencilFunc(gl.EQUAL, this._tileClippingMaskIDs[coord.id], 0xF8); + gl.stencilFunc(gl.EQUAL, this._tileClippingMaskIDs[coord.id], 248); }; - -// Overridden by headless tests. -Painter.prototype.prepareBuffers = function() {}; -Painter.prototype.bindDefaultFramebuffer = function() { +Painter.prototype.prepareBuffers = function () { +}; +Painter.prototype.bindDefaultFramebuffer = function () { var gl = this.gl; gl.bindFramebuffer(gl.FRAMEBUFFER, null); }; - var draw = { symbol: require('./draw_symbol'), circle: require('./draw_circle'), @@ -16914,41 +19674,29 @@ var draw = { background: require('./draw_background'), debug: require('./draw_debug') }; - -Painter.prototype.render = function(style, options) { +Painter.prototype.render = function (style, options) { this.style = style; this.options = options; - this.lineAtlas = style.lineAtlas; - this.spriteAtlas = style.spriteAtlas; this.spriteAtlas.setSprite(style.sprite); - this.glyphSource = style.glyphSource; - this.frameHistory.record(this.transform.zoom); - this.prepareBuffers(); this.clearColor(); this.clearDepth(); - this.showOverdrawInspector(options.showOverdrawInspector); - this.depthRange = (style._order.length + 2) * this.numSublayers * this.depthEpsilon; - - this.renderPass({isOpaquePass: true}); - this.renderPass({isOpaquePass: false}); + this.renderPass({ isOpaquePass: true }); + this.renderPass({ isOpaquePass: false }); }; - -Painter.prototype.renderPass = function(options) { +Painter.prototype.renderPass = function (options) { var groups = this.style._groups; var isOpaquePass = options.isOpaquePass; this.currentLayer = isOpaquePass ? this.style._order.length : -1; - for (var i = 0; i < groups.length; i++) { var group = groups[isOpaquePass ? groups.length - 1 - i : i]; var source = this.style.sources[group.source]; - var j; var coords = []; if (source) { @@ -16957,12 +19705,12 @@ Painter.prototype.renderPass = function(options) { coords[j].posMatrix = this.transform.calculatePosMatrix(coords[j], source.maxzoom); } this.clearStencil(); - if (source.prepare) source.prepare(); + if (source.prepare) + source.prepare(); if (source.isTileClipped) { this._renderTileClippingMasks(coords); } } - if (isOpaquePass) { if (!this._showOverdrawInspector) { this.gl.disable(this.gl.BLEND); @@ -16973,42 +19721,38 @@ Painter.prototype.renderPass = function(options) { this.isOpaquePass = false; coords.reverse(); } - for (j = 0; j < group.length; j++) { var layer = group[isOpaquePass ? group.length - 1 - j : j]; this.currentLayer += isOpaquePass ? -1 : 1; this.renderLayer(this, source, layer, coords); } - if (source) { draw.debug(this, source, coords); } } }; - -Painter.prototype.depthMask = function(mask) { +Painter.prototype.depthMask = function (mask) { if (mask !== this._depthMask) { this._depthMask = mask; this.gl.depthMask(mask); } }; - -Painter.prototype.renderLayer = function(painter, source, layer, coords) { - if (layer.isHidden(this.transform.zoom)) return; - if (layer.type !== 'background' && !coords.length) return; +Painter.prototype.renderLayer = function (painter, source, layer, coords) { + if (layer.isHidden(this.transform.zoom)) + return; + if (layer.type !== 'background' && !coords.length) + return; this.id = layer.id; draw[layer.type](painter, source, layer, coords); }; - -Painter.prototype.setDepthSublayer = function(n) { +Painter.prototype.setDepthSublayer = function (n) { var farDepth = 1 - ((1 + this.currentLayer) * this.numSublayers + n) * this.depthEpsilon; var nearDepth = farDepth - 1 + this.depthRange; this.gl.depthRange(nearDepth, farDepth); }; - -Painter.prototype.translatePosMatrix = function(matrix, tile, translate, anchor) { - if (!translate[0] && !translate[1]) return matrix; - +Painter.prototype.translatePosMatrix = function (matrix, tile, translate, anchor) { + if (!translate[0] && !translate[1]) + return matrix; if (anchor === 'viewport') { var sinA = Math.sin(-this.transform.angle); var cosA = Math.cos(-this.transform.angle); @@ -17017,19 +19761,16 @@ Painter.prototype.translatePosMatrix = function(matrix, tile, translate, anchor) translate[0] * sinA + translate[1] * cosA ]; } - var translation = [ pixelsToTileUnits(tile, translate[0], this.transform.zoom), pixelsToTileUnits(tile, translate[1], this.transform.zoom), 0 ]; - var translatedMatrix = new Float32Array(16); mat4.translate(translatedMatrix, matrix, translation); return translatedMatrix; }; - -Painter.prototype.saveTexture = function(texture) { +Painter.prototype.saveTexture = function (texture) { var textures = this.reusableTextures[texture.size]; if (!textures) { this.reusableTextures[texture.size] = [texture]; @@ -17037,21 +19778,17 @@ Painter.prototype.saveTexture = function(texture) { textures.push(texture); } }; - - -Painter.prototype.getTexture = function(size) { +Painter.prototype.getTexture = function (size) { var textures = this.reusableTextures[size]; return textures && textures.length > 0 ? textures.pop() : null; }; - -Painter.prototype.lineWidth = function(width) { +Painter.prototype.lineWidth = function (width) { this.gl.lineWidth(util.clamp(width, this.lineWidthRange[0], this.lineWidthRange[1])); }; - -Painter.prototype.showOverdrawInspector = function(enabled) { - if (!enabled && !this._showOverdrawInspector) return; +Painter.prototype.showOverdrawInspector = function (enabled) { + if (!enabled && !this._showOverdrawInspector) + return; this._showOverdrawInspector = enabled; - var gl = this.gl; if (enabled) { gl.blendFunc(gl.CONSTANT_COLOR, gl.ONE); @@ -17064,112 +19801,40 @@ Painter.prototype.showOverdrawInspector = function(enabled) { gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); } }; - -},{"../data/bucket":17,"../data/buffer":22,"../source/pixels_to_tile_units":47,"../source/tile_pyramid":52,"../util/browser":105,"../util/struct_array":117,"../util/util":119,"./draw_background":31,"./draw_circle":32,"./draw_debug":34,"./draw_fill":35,"./draw_line":36,"./draw_raster":37,"./draw_symbol":38,"./frame_history":39,"./painter/use_program":42,"./vertex_array_object":43,"gl-matrix":133}],42:[function(require,module,exports){ +},{"../data/bucket":23,"../data/buffer":28,"../source/pixels_to_tile_units":57,"../source/source_cache":61,"../util/browser":120,"../util/struct_array":134,"../util/util":136,"./create_uniform_pragmas":38,"./draw_background":39,"./draw_circle":40,"./draw_debug":42,"./draw_fill":43,"./draw_line":44,"./draw_raster":45,"./draw_symbol":46,"./frame_history":47,"./painter/use_program":50,"./vertex_array_object":51,"gl-matrix":152}],50:[function(require,module,exports){ 'use strict'; - - -var path = require('path'); -var assert = require('assert'); var util = require('../../util/util'); - -// readFileSync calls must be written out long-form for brfs. -var definitions = { - debug: { - fragmentSource: "precision mediump float;\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n" - }, - fill: { - fragmentSource: "precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvoid main() {\n gl_FragColor = u_color * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n" - }, - circle: { - fragmentSource: "precision mediump float;\n\nuniform lowp float u_blur;\nuniform lowp float u_opacity;\n\nvarying lowp vec4 v_color;\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n float t = smoothstep(1.0 - max(u_blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = v_color * (1.0 - t) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#ifdef ATTRIBUTE_A_COLOR\nattribute lowp vec4 a_color;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\nuniform lowp float u_color_t;\nattribute lowp vec4 a_color0;\nattribute lowp vec4 a_color1;\nattribute lowp vec4 a_color2;\nattribute lowp vec4 a_color3;\n#else\nuniform lowp vec4 a_color;\n#endif\n\n#ifdef ATTRIBUTE_A_RADIUS\nattribute mediump float a_radius;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\nuniform lowp float u_radius_t;\nattribute mediump vec4 a_radius;\n#else\nuniform mediump float a_radius;\n#endif\n\nvarying vec2 v_extrude;\nvarying lowp vec4 v_color;\nvarying lowp float v_antialiasblur;\n\nfloat evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\n\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n\nvoid main(void) {\n\n#ifdef ATTRIBUTE_A_RADIUS\n mediump float radius = a_radius / 10.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\n mediump float radius = evaluate_zoom_function_1(a_radius, u_radius_t) / 10.0;\n#else\n mediump float radius = a_radius;\n#endif\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n // gl_Position is divided by gl_Position.w after this shader runs.\n // Multiply the extrude by it so that it isn't affected by it.\n gl_Position.xy += extrude * gl_Position.w;\n\n#ifdef ATTRIBUTE_A_COLOR\n v_color = a_color / 255.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\n v_color = evaluate_zoom_function_4(a_color0, a_color1, a_color2, a_color3, u_color_t) / 255.0;\n#else\n v_color = a_color;\n#endif\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n" - }, - line: { - fragmentSource: "precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" - }, - linepattern: { - fragmentSource: "precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform float u_point;\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_b.y);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos), texture2D(u_image, pos2), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 extrude = a_extrude * scale;\n mediump vec2 dist = u_linewidth.s * extrude;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" - }, - linesdfpattern: { - fragmentSource: "precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump vec2 u_linewidth;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" - }, - outline: { - fragmentSource: "precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" - }, - outlinepattern: { - fragmentSource: "precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" - }, - pattern: { - fragmentSource: "precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n}\n" - }, - raster: { - fragmentSource: "precision mediump float;\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n" - }, - icon: { - fragmentSource: "precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" - }, - sdf: { - fragmentSource: "precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - y * u_extra);\n v_gamma_scale = perspective_scale;\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" - }, - collisionbox: { - fragmentSource: "precision mediump float;\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n" - } -}; - -module.exports._createProgram = function(name, macros) { +var shaders = require('mapbox-gl-shaders'); +var utilSource = shaders.util; +module.exports._createProgram = function (name, defines, vertexPragmas, fragmentPragmas) { var gl = this.gl; var program = gl.createProgram(); - var definition = definitions[name]; - - var defines = ''; - if (macros) { - for (var m = 0; m < macros.length; m++) { - defines += '#define ' + macros[m] + '\n'; - } + var definition = shaders[name]; + var definesSource = '#define MAPBOX_GL_JS;\n'; + for (var j = 0; j < defines.length; j++) { + definesSource += '#define ' + defines[j] + ';\n'; } - var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); - gl.shaderSource(fragmentShader, defines + definition.fragmentSource); + gl.shaderSource(fragmentShader, applyPragmas(definesSource + definition.fragmentSource, fragmentPragmas)); gl.compileShader(fragmentShader); - assert(gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS), gl.getShaderInfoLog(fragmentShader)); gl.attachShader(program, fragmentShader); - var vertexShader = gl.createShader(gl.VERTEX_SHADER); - gl.shaderSource(vertexShader, defines + definition.vertexSource); + gl.shaderSource(vertexShader, applyPragmas(definesSource + utilSource + definition.vertexSource, vertexPragmas)); gl.compileShader(vertexShader); - assert(gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS), gl.getShaderInfoLog(vertexShader)); gl.attachShader(program, vertexShader); - gl.linkProgram(program); - assert(gl.getProgramParameter(program, gl.LINK_STATUS), gl.getProgramInfoLog(program)); - var attributes = {}; var numAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); for (var i = 0; i < numAttributes; i++) { var attribute = gl.getActiveAttrib(program, i); - attributes[attribute.name] = i; + attributes[attribute.name] = gl.getAttribLocation(program, attribute.name); } - var uniforms = {}; var numUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); for (var ui = 0; ui < numUniforms; ui++) { var uniform = gl.getActiveUniform(program, ui); uniforms[uniform.name] = gl.getUniformLocation(program, uniform.name); } - return util.extend({ program: program, definition: definition, @@ -17177,41 +19842,41 @@ module.exports._createProgram = function(name, macros) { numAttributes: numAttributes }, attributes, uniforms); }; - -module.exports._createProgramCached = function(name, macros) { +module.exports._createProgramCached = function (name, defines, vertexPragmas, fragmentPragmas) { this.cache = this.cache || {}; - if (this._showOverdrawInspector) { - macros = macros || []; - macros.push('OVERDRAW_INSPECTOR'); - } - var key = JSON.stringify({name: name, macros: macros}); + var key = JSON.stringify({ + name: name, + defines: defines, + vertexPragmas: vertexPragmas, + fragmentPragmas: fragmentPragmas + }); if (!this.cache[key]) { - this.cache[key] = this._createProgram(name, macros); + this.cache[key] = this._createProgram(name, defines, vertexPragmas, fragmentPragmas); } return this.cache[key]; }; - -module.exports.useProgram = function (nextProgramName, macros) { +module.exports.useProgram = function (nextProgramName, defines, vertexPragmas, fragmentPragmas) { var gl = this.gl; - - var nextProgram = this._createProgramCached(nextProgramName, macros); + defines = defines || []; + if (this._showOverdrawInspector) { + defines = defines.concat('OVERDRAW_INSPECTOR'); + } + var nextProgram = this._createProgramCached(nextProgramName, defines, vertexPragmas, fragmentPragmas); var previousProgram = this.currentProgram; - if (previousProgram !== nextProgram) { gl.useProgram(nextProgram.program); this.currentProgram = nextProgram; } - return nextProgram; }; - -},{"../../util/util":119,"assert":6,"path":9}],43:[function(require,module,exports){ +function applyPragmas(source, pragmas) { + return source.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, function (match, operation, precision, type, name) { + return pragmas[operation][name].replace(/{type}/g, type).replace(/{precision}/g, precision); + }); +} +},{"../../util/util":136,"mapbox-gl-shaders":164}],51:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); - module.exports = VertexArrayObject; - function VertexArrayObject() { this.boundProgram = null; this.boundVertexBuffer = null; @@ -17219,262 +19884,141 @@ function VertexArrayObject() { this.boundElementBuffer = null; this.vao = null; } - -var reported = false; - -VertexArrayObject.prototype.bind = function(gl, program, vertexBuffer, elementBuffer, vertexBuffer2) { - - var ext = gl.extVertexArrayObject; - if (ext === undefined) { - ext = gl.extVertexArrayObject = gl.getExtension("OES_vertex_array_object"); - } - - if (ext) { - if (!this.vao) this.vao = ext.createVertexArrayOES(); - ext.bindVertexArrayOES(this.vao); - } else if (!reported) { - console.warn('Not using VertexArrayObject extension.'); - reported = true; +VertexArrayObject.prototype.bind = function (gl, program, layoutVertexBuffer, elementBuffer, vertexBuffer2) { + if (gl.extVertexArrayObject === undefined) { + gl.extVertexArrayObject = gl.getExtension('OES_vertex_array_object'); } - - if (!this.boundProgram) { - - var numPrevAttributes = ext ? 0 : (gl.currentNumAttributes || 0); - var numNextAttributes = program.numAttributes; - var i; - - // Enable all attributes for the new program. - for (i = numPrevAttributes; i < numNextAttributes; i++) { - gl.enableVertexAttribArray(i); - } - - if (!ext) { - // Disable all attributes from the previous program that aren't used in - // the new program. Note: attribute indices are *not* program specific! - // WebGL breaks if you disable attribute 0. http://stackoverflow.com/questions/20305231 - assert(i > 0); - for (i = numNextAttributes; i < numPrevAttributes; i++) { - gl.disableVertexAttribArray(i); - } - gl.currentNumAttributes = numNextAttributes; - } - - vertexBuffer.bind(gl); - vertexBuffer.setVertexAttribPointers(gl, program); - if (vertexBuffer2) { - vertexBuffer2.bind(gl); - vertexBuffer2.setVertexAttribPointers(gl, program); - } - if (elementBuffer) { - elementBuffer.bind(gl); - } - - if (ext) { - // store the arguments so that we can verify them when the vao is bound again - this.boundProgram = program; - this.boundVertexBuffer = vertexBuffer; - this.boundVertexBuffer2 = vertexBuffer2; - this.boundElementBuffer = elementBuffer; - } - + var isFreshBindRequired = !this.vao || this.boundProgram !== program || this.boundVertexBuffer !== layoutVertexBuffer || this.boundVertexBuffer2 !== vertexBuffer2 || this.boundElementBuffer !== elementBuffer; + if (!gl.extVertexArrayObject || isFreshBindRequired) { + this.freshBind(gl, program, layoutVertexBuffer, elementBuffer, vertexBuffer2); } else { - // verify that bind was called with the same arguments - assert(this.boundProgram === program, 'trying to bind a VAO to a different shader'); - assert(this.boundVertexBuffer === vertexBuffer, 'trying to bind a VAO to a different vertex buffer'); - assert(this.boundVertexBuffer2 === vertexBuffer2, 'trying to bind a VAO to a different vertex buffer'); - assert(this.boundElementBuffer === elementBuffer, 'trying to bind a VAO to a different element buffer'); + gl.extVertexArrayObject.bindVertexArrayOES(this.vao); + } +}; +VertexArrayObject.prototype.freshBind = function (gl, program, layoutVertexBuffer, elementBuffer, vertexBuffer2) { + var numPrevAttributes; + var numNextAttributes = program.numAttributes; + if (gl.extVertexArrayObject) { + if (this.vao) + this.destroy(gl); + this.vao = gl.extVertexArrayObject.createVertexArrayOES(); + gl.extVertexArrayObject.bindVertexArrayOES(this.vao); + numPrevAttributes = 0; + this.boundProgram = program; + this.boundVertexBuffer = layoutVertexBuffer; + this.boundVertexBuffer2 = vertexBuffer2; + this.boundElementBuffer = elementBuffer; + } else { + numPrevAttributes = gl.currentNumAttributes || 0; + for (var i = numNextAttributes; i < numPrevAttributes; i++) { + gl.disableVertexAttribArray(i); + } + } + for (var j = numPrevAttributes; j < numNextAttributes; j++) { + gl.enableVertexAttribArray(j); + } + layoutVertexBuffer.bind(gl); + layoutVertexBuffer.setVertexAttribPointers(gl, program); + if (vertexBuffer2) { + vertexBuffer2.bind(gl); + vertexBuffer2.setVertexAttribPointers(gl, program); } + if (elementBuffer) { + elementBuffer.bind(gl); + } + gl.currentNumAttributes = numNextAttributes; }; - -VertexArrayObject.prototype.unbind = function(gl) { +VertexArrayObject.prototype.unbind = function (gl) { var ext = gl.extVertexArrayObject; if (ext) { ext.bindVertexArrayOES(null); } }; - -VertexArrayObject.prototype.destroy = function(gl) { +VertexArrayObject.prototype.destroy = function (gl) { var ext = gl.extVertexArrayObject; if (ext && this.vao) { ext.deleteVertexArrayOES(this.vao); this.vao = null; } }; - -},{"assert":6}],44:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ 'use strict'; - -var util = require('../util/util'); var Evented = require('../util/evented'); -var TilePyramid = require('./tile_pyramid'); -var Source = require('./source'); +var util = require('../util/util'); var urlResolve = require('resolve-url'); var EXTENT = require('../data/bucket').EXTENT; - module.exports = GeoJSONSource; - -/** - * Create a GeoJSON data source instance given an options object - * @class GeoJSONSource - * @param {Object} [options] - * @param {Object|string} options.data A GeoJSON data object or URL to it. The latter is preferable in case of large GeoJSON files. - * @param {number} [options.maxzoom=18] Maximum zoom to preserve detail at. - * @param {number} [options.buffer] Tile buffer on each side in pixels. - * @param {number} [options.tolerance] Simplification tolerance (higher means simpler) in pixels. - * @param {number} [options.cluster] If the data is a collection of point features, setting this to true clusters the points by radius into groups. - * @param {number} [options.clusterRadius=50] Radius of each cluster when clustering points, in pixels. - * @param {number} [options.clusterMaxZoom] Max zoom to cluster points on. Defaults to one zoom less than `maxzoom` (so that last zoom features are not clustered). - - * @example - * var sourceObj = new mapboxgl.GeoJSONSource({ - * data: { - * "type": "FeatureCollection", - * "features": [{ - * "type": "Feature", - * "geometry": { - * "type": "Point", - * "coordinates": [ - * -76.53063297271729, - * 39.18174077994108 - * ] - * } - * }] - * } - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -function GeoJSONSource(options) { +function GeoJSONSource(id, options, dispatcher) { options = options || {}; - + this.id = id; + this.dispatcher = dispatcher; this._data = options.data; - - if (options.maxzoom !== undefined) this.maxzoom = options.maxzoom; - + if (options.maxzoom !== undefined) + this.maxzoom = options.maxzoom; + if (options.type) + this.type = options.type; var scale = EXTENT / this.tileSize; - - this.geojsonVtOptions = { - buffer: (options.buffer !== undefined ? options.buffer : 128) * scale, - tolerance: (options.tolerance !== undefined ? options.tolerance : 0.375) * scale, - extent: EXTENT, - maxZoom: this.maxzoom - }; - - this.cluster = options.cluster || false; - this.superclusterOptions = { - maxZoom: Math.min(options.clusterMaxZoom, this.maxzoom - 1) || (this.maxzoom - 1), - extent: EXTENT, - radius: (options.clusterRadius || 50) * scale, - log: false - }; - - this._pyramid = new TilePyramid({ - tileSize: this.tileSize, - minzoom: this.minzoom, - maxzoom: this.maxzoom, - reparseOverscaled: true, - load: this._loadTile.bind(this), - abort: this._abortTile.bind(this), - unload: this._unloadTile.bind(this), - add: this._addTile.bind(this), - remove: this._removeTile.bind(this), - redoPlacement: this._redoTilePlacement.bind(this) - }); + this.workerOptions = util.extend({ + source: this.id, + cluster: options.cluster || false, + geojsonVtOptions: { + buffer: (options.buffer !== undefined ? options.buffer : 128) * scale, + tolerance: (options.tolerance !== undefined ? options.tolerance : 0.375) * scale, + extent: EXTENT, + maxZoom: this.maxzoom + }, + superclusterOptions: { + maxZoom: Math.min(options.clusterMaxZoom, this.maxzoom - 1) || this.maxzoom - 1, + extent: EXTENT, + radius: (options.clusterRadius || 50) * scale, + log: false + } + }, options.workerOptions); + this._updateWorkerData(function done(err) { + if (err) { + this.fire('error', { error: err }); + return; + } + this.fire('load'); + }.bind(this)); } - -GeoJSONSource.prototype = util.inherit(Evented, /** @lends GeoJSONSource.prototype */{ +GeoJSONSource.prototype = util.inherit(Evented, { + type: 'geojson', minzoom: 0, maxzoom: 18, tileSize: 512, - _dirty: true, isTileClipped: true, - - /** - * Update source geojson data and rerender map - * - * @param {Object|string} data A GeoJSON data object or URL to it. The latter is preferable in case of large GeoJSON files. - * @returns {GeoJSONSource} this - */ - setData: function(data) { - this._data = data; - this._dirty = true; - - this.fire('change'); - - if (this.map) - this.update(this.map.transform); - - return this; - }, - - onAdd: function(map) { + reparseOverscaled: true, + onAdd: function (map) { this.map = map; }, - - loaded: function() { - return this._loaded && this._pyramid.loaded(); - }, - - update: function(transform) { - if (this._dirty) { - this._updateData(); - } - - if (this._loaded) { - this._pyramid.update(this.used, transform); - } - }, - - reload: function() { - if (this._loaded) { - this._pyramid.reload(); - } - }, - - serialize: function() { - return { - type: 'geojson', - data: this._data - }; + setData: function (data) { + this._data = data; + this._updateWorkerData(function (err) { + if (err) { + return this.fire('error', { error: err }); + } + this.fire('change'); + }.bind(this)); + return this; }, - - getVisibleCoordinates: Source._getVisibleCoordinates, - getTile: Source._getTile, - - queryRenderedFeatures: Source._queryRenderedVectorFeatures, - querySourceFeatures: Source._querySourceFeatures, - - _updateData: function() { - this._dirty = false; - var options = { - tileSize: this.tileSize, - source: this.id, - geojsonVtOptions: this.geojsonVtOptions, - cluster: this.cluster, - superclusterOptions: this.superclusterOptions - }; - + _updateWorkerData: function (callback) { + var options = util.extend({}, this.workerOptions); var data = this._data; if (typeof data === 'string') { options.url = typeof window != 'undefined' ? urlResolve(window.location.href, data) : data; } else { options.data = JSON.stringify(data); } - this.workerID = this.dispatcher.send('parse geojson', options, function(err) { + this.workerID = this.dispatcher.send(this.type + '.loadData', options, function (err) { this._loaded = true; - if (err) { - this.fire('error', {error: err}); - } else { - this._pyramid.reload(); - this.fire('change'); - } - + callback(err); }.bind(this)); }, - - _loadTile: function(tile) { + loadTile: function (tile, callback) { var overscaling = tile.coord.z > this.maxzoom ? Math.pow(2, tile.coord.z - this.maxzoom) : 1; var params = { + type: this.type, uid: tile.uid, coord: tile.coord, zoom: tile.coord.z, @@ -17486,89 +20030,153 @@ GeoJSONSource.prototype = util.inherit(Evented, /** @lends GeoJSONSource.prototy pitch: this.map.transform.pitch, showCollisionBoxes: this.map.showCollisionBoxes }; - - tile.workerID = this.dispatcher.send('load geojson tile', params, function(err, data) { - + tile.workerID = this.dispatcher.send('load tile', params, function (err, data) { tile.unloadVectorData(this.map.painter); - if (tile.aborted) return; - if (err) { - this.fire('tile.error', {tile: tile}); - return; + return callback(err); } - tile.loadVectorData(data, this.map.style); - if (tile.redoWhenDone) { tile.redoWhenDone = false; tile.redoPlacement(this); } - - this.fire('tile.load', {tile: tile}); - + return callback(null); }.bind(this), this.workerID); }, - - _abortTile: function(tile) { + abortTile: function (tile) { tile.aborted = true; }, - - _addTile: function(tile) { - this.fire('tile.add', {tile: tile}); + unloadTile: function (tile) { + tile.unloadVectorData(this.map.painter); + this.dispatcher.send('remove tile', { + uid: tile.uid, + source: this.id + }, function () { + }, tile.workerID); }, - - _removeTile: function(tile) { - this.fire('tile.remove', {tile: tile}); + serialize: function () { + return { + type: this.type, + data: this._data + }; + } +}); +},{"../data/bucket":23,"../util/evented":128,"../util/util":136,"resolve-url":196}],53:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var ajax = require('../util/ajax'); +var rewind = require('geojson-rewind'); +var GeoJSONWrapper = require('./geojson_wrapper'); +var vtpbf = require('vt-pbf'); +var supercluster = require('supercluster'); +var geojsonvt = require('geojson-vt'); +var VectorTileWorkerSource = require('./vector_tile_worker_source'); +module.exports = GeoJSONWorkerSource; +function GeoJSONWorkerSource(actor, styleLayers, loadGeoJSON) { + if (loadGeoJSON) { + this.loadGeoJSON = loadGeoJSON; + } + VectorTileWorkerSource.call(this, actor, styleLayers); +} +GeoJSONWorkerSource.prototype = util.inherit(VectorTileWorkerSource, { + _geoJSONIndexes: {}, + loadVectorData: function (params, callback) { + var source = params.source, coord = params.coord; + if (!this._geoJSONIndexes[source]) + return callback(null, null); + var geoJSONTile = this._geoJSONIndexes[source].getTile(Math.min(coord.z, params.maxZoom), coord.x, coord.y); + if (geoJSONTile) { + var geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features); + geojsonWrapper.name = '_geojsonTileLayer'; + var pbf = vtpbf({ layers: { '_geojsonTileLayer': geojsonWrapper } }); + if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) { + pbf = new Uint8Array(pbf); + } + callback(null, { + tile: geojsonWrapper, + rawTileData: pbf.buffer + }); + } else { + return callback(null, null); + } }, - - _unloadTile: function(tile) { - tile.unloadVectorData(this.map.painter); - this.dispatcher.send('remove tile', { uid: tile.uid, source: this.id }, null, tile.workerID); + loadData: function (params, callback) { + var handleData = function (err, data) { + if (err) + return callback(err); + if (typeof data != 'object') { + return callback(new Error('Input data is not a valid GeoJSON object.')); + } + rewind(data, true); + this._indexData(data, params, function (err, indexed) { + if (err) { + return callback(err); + } + this._geoJSONIndexes[params.source] = indexed; + callback(null); + }.bind(this)); + }.bind(this); + this.loadGeoJSON(params, handleData); }, - - redoPlacement: Source.redoPlacement, - - _redoTilePlacement: function(tile) { - tile.redoPlacement(this); + loadGeoJSON: function (params, callback) { + if (params.url) { + ajax.getJSON(params.url, callback); + } else if (typeof params.data === 'string') { + try { + return callback(null, JSON.parse(params.data)); + } catch (e) { + return callback(new Error('Input data is not a valid GeoJSON object.')); + } + } else { + return callback(new Error('Input data is not a valid GeoJSON object.')); + } + }, + _indexData: function (data, params, callback) { + try { + if (params.cluster) { + callback(null, supercluster(params.superclusterOptions).load(data.features)); + } else { + callback(null, geojsonvt(data, params.geojsonVtOptions)); + } + } catch (err) { + return callback(err); + } } }); - -},{"../data/bucket":17,"../util/evented":111,"../util/util":119,"./source":49,"./tile_pyramid":52,"resolve-url":175}],45:[function(require,module,exports){ +},{"../util/ajax":119,"../util/util":136,"./geojson_wrapper":54,"./vector_tile_worker_source":65,"geojson-rewind":141,"geojson-vt":147,"supercluster":198,"vt-pbf":208}],54:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); var VectorTileFeature = require('vector-tile').VectorTileFeature; var EXTENT = require('../data/bucket').EXTENT; - module.exports = GeoJSONWrapper; - -// conform to vectortile api function GeoJSONWrapper(features) { this.features = features; this.length = features.length; this.extent = EXTENT; } - -GeoJSONWrapper.prototype.feature = function(i) { +GeoJSONWrapper.prototype.feature = function (i) { return new FeatureWrapper(this.features[i]); }; - function FeatureWrapper(feature) { this.type = feature.type; - this.rawGeometry = feature.type === 1 ? [feature.geometry] : feature.geometry; + if (feature.type === 1) { + this.rawGeometry = []; + for (var i = 0; i < feature.geometry.length; i++) { + this.rawGeometry.push([feature.geometry[i]]); + } + } else { + this.rawGeometry = feature.geometry; + } this.properties = feature.tags; this.extent = EXTENT; } - -FeatureWrapper.prototype.loadGeometry = function() { +FeatureWrapper.prototype.loadGeometry = function () { var rings = this.rawGeometry; this.geometry = []; - for (var i = 0; i < rings.length; i++) { - var ring = rings[i], - newRing = []; + var ring = rings[i], newRing = []; for (var j = 0; j < ring.length; j++) { newRing.push(new Point(ring[j][0], ring[j][1])); } @@ -17576,39 +20184,31 @@ FeatureWrapper.prototype.loadGeometry = function() { } return this.geometry; }; - -FeatureWrapper.prototype.bbox = function() { - if (!this.geometry) this.loadGeometry(); - - var rings = this.geometry, - x1 = Infinity, - x2 = -Infinity, - y1 = Infinity, - y2 = -Infinity; - +FeatureWrapper.prototype.bbox = function () { + if (!this.geometry) + this.loadGeometry(); + var rings = this.geometry, x1 = Infinity, x2 = -Infinity, y1 = Infinity, y2 = -Infinity; for (var i = 0; i < rings.length; i++) { var ring = rings[i]; - for (var j = 0; j < ring.length; j++) { var coord = ring[j]; - x1 = Math.min(x1, coord.x); x2 = Math.max(x2, coord.x); y1 = Math.min(y1, coord.y); y2 = Math.max(y2, coord.y); } } - - return [x1, y1, x2, y2]; + return [ + x1, + y1, + x2, + y2 + ]; }; - FeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON; - -},{"../data/bucket":17,"point-geometry":174,"vector-tile":183}],46:[function(require,module,exports){ +},{"../data/bucket":23,"point-geometry":194,"vector-tile":204}],55:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); -var Tile = require('./tile'); var TileCoord = require('./tile_coord'); var LngLat = require('../geo/lng_lat'); var Point = require('point-geometry'); @@ -17618,124 +20218,76 @@ var EXTENT = require('../data/bucket').EXTENT; var RasterBoundsArray = require('../render/draw_raster').RasterBoundsArray; var Buffer = require('../data/buffer'); var VertexArrayObject = require('../render/vertex_array_object'); - module.exports = ImageSource; - -/** - * Create an Image source instance given an options object - * @class ImageSource - * @param {Object} [options] - * @param {string} options.url A string URL of an image file - * @param {Array} options.coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the image. Does not have to be a rectangle. - * @example - * var sourceObj = new mapboxgl.ImageSource({ - * url: 'https://www.mapbox.com/images/foo.png', - * coordinates: [ - * [-76.54335737228394, 39.18579907229748], - * [-76.52803659439087, 39.1838364847587], - * [-76.5295386314392, 39.17683392507606], - * [-76.54520273208618, 39.17876344106642] - * ] - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -function ImageSource(options) { - this.urls = options.urls; +function ImageSource(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + this.url = options.url; this.coordinates = options.coordinates; - - ajax.getImage(options.url, function(err, image) { - // @TODO handle errors via event. - if (err) return; - + ajax.getImage(options.url, function (err, image) { + if (err) + return this.fire('error', { error: err }); this.image = image; - - this.image.addEventListener('load', function() { + this.image.addEventListener('load', function () { this.map._rerender(); }.bind(this)); - this._loaded = true; - + this.fire('load'); if (this.map) { this.setCoordinates(options.coordinates); } }.bind(this)); } - -ImageSource.prototype = util.inherit(Evented, /** @lends ImageSource.prototype */ { - onAdd: function(map) { +ImageSource.prototype = util.inherit(Evented, { + minzoom: 0, + maxzoom: 22, + tileSize: 512, + onAdd: function (map) { this.map = map; if (this.image) { this.setCoordinates(this.coordinates); } }, - - /** - * Update image coordinates and rerender map - * - * @param {Array} coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the image. Does not have to be a rectangle. - * @returns {ImageSource} this - */ - setCoordinates: function(coordinates) { + setCoordinates: function (coordinates) { this.coordinates = coordinates; - - // Calculate which mercator tile is suitable for rendering the image in - // and create a buffer with the corner coordinates. These coordinates - // may be outside the tile, because raster tiles aren't clipped when rendering. - var map = this.map; - var cornerZ0Coords = coordinates.map(function(coord) { + var cornerZ0Coords = coordinates.map(function (coord) { return map.transform.locationCoordinate(LngLat.convert(coord)).zoomTo(0); }); - var centerCoord = this.centerCoord = util.getCoordinatesCenter(cornerZ0Coords); centerCoord.column = Math.round(centerCoord.column); centerCoord.row = Math.round(centerCoord.row); - - var tileCoords = cornerZ0Coords.map(function(coord) { + this.minzoom = this.maxzoom = centerCoord.zoom; + this._coord = new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row); + this._tileCoords = cornerZ0Coords.map(function (coord) { var zoomedCoord = coord.zoomTo(centerCoord.zoom); - return new Point( - Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), - Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); + return new Point(Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); }); - + this.fire('change'); + return this; + }, + _setTile: function (tile) { + this._prepared = false; + this.tile = tile; var maxInt16 = 32767; var array = new RasterBoundsArray(); - array.emplaceBack(tileCoords[0].x, tileCoords[0].y, 0, 0); - array.emplaceBack(tileCoords[1].x, tileCoords[1].y, maxInt16, 0); - array.emplaceBack(tileCoords[3].x, tileCoords[3].y, 0, maxInt16); - array.emplaceBack(tileCoords[2].x, tileCoords[2].y, maxInt16, maxInt16); - - this.tile = new Tile(new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row)); + array.emplaceBack(this._tileCoords[0].x, this._tileCoords[0].y, 0, 0); + array.emplaceBack(this._tileCoords[1].x, this._tileCoords[1].y, maxInt16, 0); + array.emplaceBack(this._tileCoords[3].x, this._tileCoords[3].y, 0, maxInt16); + array.emplaceBack(this._tileCoords[2].x, this._tileCoords[2].y, maxInt16, maxInt16); this.tile.buckets = {}; - this.tile.boundsBuffer = new Buffer(array.serialize(), RasterBoundsArray.serialize(), Buffer.BufferType.VERTEX); this.tile.boundsVAO = new VertexArrayObject(); - - this.fire('change'); - - return this; - }, - - loaded: function() { - return this.image && this.image.complete; - }, - - update: function() { - // noop - }, - - reload: function() { - // noop + this.tile.state = 'loaded'; }, - - prepare: function() { - if (!this._loaded || !this.loaded()) return; - + prepare: function () { + if (!this._loaded || !this.image || !this.image.complete) + return; + if (!this.tile) + return; var painter = this.map.painter; var gl = painter.gl; - - if (!this.tile.texture) { + if (!this._prepared) { this.tile.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); @@ -17748,905 +20300,381 @@ ImageSource.prototype = util.inherit(Evented, /** @lends ImageSource.prototype * gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.image); } }, - - getVisibleCoordinates: function() { - if (this.tile) return [this.tile.coord]; - else return []; - }, - - getTile: function() { - return this.tile; + loadTile: function (tile, callback) { + if (this._coord && this._coord.toString() === tile.coord.toString()) { + this._setTile(tile); + callback(null); + } else { + tile.state = 'errored'; + callback(null); + } }, - - serialize: function() { + serialize: function () { return { type: 'image', - urls: this.urls, + urls: this.url, coordinates: this.coordinates }; } }); - -},{"../data/bucket":17,"../data/buffer":22,"../geo/lng_lat":26,"../render/draw_raster":37,"../render/vertex_array_object":43,"../util/ajax":104,"../util/evented":111,"../util/util":119,"./tile":50,"./tile_coord":51,"point-geometry":174}],47:[function(require,module,exports){ -'use strict'; - -var Bucket = require('../data/bucket'); - -/** - * Converts a pixel value at a the given zoom level to tile units. - * - * The shaders mostly calculate everything in tile units so style - * properties need to be converted from pixels to tile units using this. - * - * For example, a translation by 30 pixels at zoom 6.5 will be a - * translation by pixelsToTileUnits(30, 6.5) tile units. - * - * @param {object} tile a {Tile object} will work well, but any object that follows the format {coord: {TileCord object}, tileSize: {number}} will work - * @param {number} pixelValue - * @param {number} z - * @returns {number} value in tile units - * @private - */ -module.exports = function(tile, pixelValue, z) { - return pixelValue * (Bucket.EXTENT / (tile.tileSize * Math.pow(2, z - tile.coord.z))); -}; - - -},{"../data/bucket":17}],48:[function(require,module,exports){ -'use strict'; - -var util = require('../util/util'); -var ajax = require('../util/ajax'); -var Evented = require('../util/evented'); -var Source = require('./source'); -var normalizeURL = require('../util/mapbox').normalizeTileURL; - -module.exports = RasterTileSource; - -function RasterTileSource(options) { - util.extend(this, util.pick(options, ['url', 'tileSize'])); - - Source._loadTileJSON.call(this, options); -} - -RasterTileSource.prototype = util.inherit(Evented, { - minzoom: 0, - maxzoom: 22, - roundZoom: true, - tileSize: 512, - _loaded: false, - - onAdd: function(map) { - this.map = map; - }, - - loaded: function() { - return this._pyramid && this._pyramid.loaded(); - }, - - update: function(transform) { - if (this._pyramid) { - this._pyramid.update(this.used, transform, this.map.style.rasterFadeDuration); - } - }, - - reload: function() { - // noop - }, - - serialize: function() { - return { - type: 'raster', - url: this.url, - tileSize: this.tileSize - }; - }, - - getVisibleCoordinates: Source._getVisibleCoordinates, - getTile: Source._getTile, - - _loadTile: function(tile) { - var url = normalizeURL(tile.coord.url(this.tiles), this.url, this.tileSize); - - tile.request = ajax.getImage(url, done.bind(this)); - - function done(err, img) { - delete tile.request; - - if (tile.aborted) - return; - - if (err) { - tile.errored = true; - this.fire('tile.error', {tile: tile, error: err}); - return; - } - - var gl = this.map.painter.gl; - tile.texture = this.map.painter.getTexture(img.width); - if (tile.texture) { - gl.bindTexture(gl.TEXTURE_2D, tile.texture); - gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, img); - } else { - tile.texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, tile.texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img); - tile.texture.size = img.width; - } - gl.generateMipmap(gl.TEXTURE_2D); - - tile.timeAdded = new Date().getTime(); - this.map.animationLoop.set(this.style.rasterFadeDuration); - - tile.source = this; - tile.loaded = true; - - this.fire('tile.load', {tile: tile}); - } - }, - - _abortTile: function(tile) { - tile.aborted = true; - - if (tile.request) { - tile.request.abort(); - delete tile.request; - } - }, - - _addTile: function(tile) { - this.fire('tile.add', {tile: tile}); - }, - - _removeTile: function(tile) { - this.fire('tile.remove', {tile: tile}); - }, - - _unloadTile: function(tile) { - if (tile.texture) this.map.painter.saveTexture(tile.texture); - } -}); - -},{"../util/ajax":104,"../util/evented":111,"../util/mapbox":116,"../util/util":119,"./source":49}],49:[function(require,module,exports){ +},{"../data/bucket":23,"../data/buffer":28,"../geo/lng_lat":33,"../render/draw_raster":45,"../render/vertex_array_object":51,"../util/ajax":119,"../util/evented":128,"../util/util":136,"./tile_coord":63,"point-geometry":194}],56:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var ajax = require('../util/ajax'); -var browser = require('../util/browser'); -var TilePyramid = require('./tile_pyramid'); -var normalizeURL = require('../util/mapbox').normalizeSourceURL; -var TileCoord = require('./tile_coord'); - -exports._loadTileJSON = function(options) { - var loaded = function(err, tileJSON) { - if (err) { - this.fire('error', {error: err}); - return; - } - - util.extend(this, util.pick(tileJSON, - ['tiles', 'minzoom', 'maxzoom', 'attribution'])); - - if (tileJSON.vector_layers) { - this.vectorLayers = tileJSON.vector_layers; - this.vectorLayerIds = this.vectorLayers.map(function(layer) { return layer.id; }); - } - - this._pyramid = new TilePyramid({ - tileSize: this.tileSize, - minzoom: this.minzoom, - maxzoom: this.maxzoom, - roundZoom: this.roundZoom, - reparseOverscaled: this.reparseOverscaled, - load: this._loadTile.bind(this), - abort: this._abortTile.bind(this), - unload: this._unloadTile.bind(this), - add: this._addTile.bind(this), - remove: this._removeTile.bind(this), - redoPlacement: this._redoTilePlacement ? this._redoTilePlacement.bind(this) : undefined - }); - - this.fire('load'); - }.bind(this); - - if (options.url) { - ajax.getJSON(normalizeURL(options.url), loaded); - } else { - browser.frame(loaded.bind(this, null, options)); - } -}; - -exports.redoPlacement = function() { - if (!this._pyramid) { - return; - } - - var ids = this._pyramid.orderedIDs(); - for (var i = 0; i < ids.length; i++) { - var tile = this._pyramid.getTile(ids[i]); - this._redoTilePlacement(tile); - } -}; - -exports._getTile = function(coord) { - return this._pyramid.getTile(coord.id); -}; - -exports._getVisibleCoordinates = function() { - if (!this._pyramid) return []; - else return this._pyramid.renderedIDs().map(TileCoord.fromID); -}; - -function sortTilesIn(a, b) { - var coordA = a.tile.coord; - var coordB = b.tile.coord; - return (coordA.z - coordB.z) || (coordA.y - coordB.y) || (coordA.x - coordB.x); -} - -function mergeRenderedFeatureLayers(tiles) { - var result = tiles[0] || {}; - for (var i = 1; i < tiles.length; i++) { - var tile = tiles[i]; - for (var layerID in tile) { - var tileFeatures = tile[layerID]; - var resultFeatures = result[layerID]; - if (resultFeatures === undefined) { - resultFeatures = result[layerID] = tileFeatures; - } else { - for (var f = 0; f < tileFeatures.length; f++) { - resultFeatures.push(tileFeatures[f]); - } - } - } - } - return result; -} - -exports._queryRenderedVectorFeatures = function(queryGeometry, params, zoom, bearing) { - if (!this._pyramid) - return {}; - - var tilesIn = this._pyramid.tilesIn(queryGeometry); - - tilesIn.sort(sortTilesIn); - - var styleLayers = this.map.style._layers; - - var renderedFeatureLayers = []; - for (var r = 0; r < tilesIn.length; r++) { - var tileIn = tilesIn[r]; - if (!tileIn.tile.featureIndex) continue; - - renderedFeatureLayers.push(tileIn.tile.featureIndex.query({ - queryGeometry: tileIn.queryGeometry, - scale: tileIn.scale, - tileSize: tileIn.tile.tileSize, - bearing: bearing, - params: params - }, styleLayers)); - } - return mergeRenderedFeatureLayers(renderedFeatureLayers); -}; - -exports._querySourceFeatures = function(params) { - if (!this._pyramid) { - return []; - } - - var pyramid = this._pyramid; - var tiles = pyramid.renderedIDs().map(function(id) { - return pyramid.getTile(id); - }); - - var result = []; - - var dataTiles = {}; - for (var i = 0; i < tiles.length; i++) { - var tile = tiles[i]; - var dataID = new TileCoord(Math.min(tile.sourceMaxZoom, tile.coord.z), tile.coord.x, tile.coord.y, 0).id; - if (!dataTiles[dataID]) { - dataTiles[dataID] = true; - tile.querySourceFeatures(result, params); - } - } - - return result; -}; - -/* - * Create a tiled data source instance given an options object - * - * @param {Object} options - * @param {string} options.type Either `raster` or `vector`. - * @param {string} options.url A tile source URL. This should either be `mapbox://{mapid}` or a full `http[s]` url that points to a TileJSON endpoint. - * @param {Array} options.tiles An array of tile sources. If `url` is not specified, `tiles` can be used instead to specify tile sources, as in the TileJSON spec. Other TileJSON keys such as `minzoom` and `maxzoom` can be specified in a source object if `tiles` is used. - * @param {string} options.id An optional `id` to assign to the source - * @param {number} [options.tileSize=512] Optional tile size (width and height in pixels, assuming tiles are square). This option is only configurable for raster sources - * @example - * var sourceObj = new mapboxgl.Source.create({ - * type: 'vector', - * url: 'mapbox://mapbox.mapbox-streets-v5' - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -exports.create = function(source) { - // This is not at file scope in order to avoid a circular require. - var sources = { - vector: require('./vector_tile_source'), - raster: require('./raster_tile_source'), - geojson: require('./geojson_source'), - video: require('./video_source'), - image: require('./image_source') - }; - - return exports.is(source) ? source : new sources[source.type](source); -}; - -exports.is = function(source) { - // This is not at file scope in order to avoid a circular require. - var sources = { - vector: require('./vector_tile_source'), - raster: require('./raster_tile_source'), - geojson: require('./geojson_source'), - video: require('./video_source'), - image: require('./image_source') - }; - - for (var type in sources) { - if (source instanceof sources[type]) { - return true; - } - } - - return false; -}; - -},{"../util/ajax":104,"../util/browser":105,"../util/mapbox":116,"../util/util":119,"./geojson_source":44,"./image_source":46,"./raster_tile_source":48,"./tile_coord":51,"./tile_pyramid":52,"./vector_tile_source":53,"./video_source":54}],50:[function(require,module,exports){ -'use strict'; - -var util = require('../util/util'); -var Bucket = require('../data/bucket'); -var FeatureIndex = require('../data/feature_index'); -var vt = require('vector-tile'); -var Protobuf = require('pbf'); -var GeoJSONFeature = require('../util/vectortile_to_geojson'); -var featureFilter = require('feature-filter'); -var CollisionTile = require('../symbol/collision_tile'); -var CollisionBoxArray = require('../symbol/collision_box'); - -module.exports = Tile; - -/** - * A tile object is the combination of a Coordinate, which defines - * its place, as well as a unique ID and data tracking for its content - * - * @param {Coordinate} coord - * @param {number} size - * @private - */ -function Tile(coord, size, sourceMaxZoom) { - this.coord = coord; - this.uid = util.uniqueId(); - this.loaded = false; // TODO rename loaded - this.isUnloaded = false; - this.uses = 0; - this.tileSize = size; - this.sourceMaxZoom = sourceMaxZoom; - this.buckets = {}; -} - -Tile.prototype = { - - /** - * Given a data object with a 'buffers' property, load it into - * this tile's elementGroups and buffers properties and set loaded - * to true. If the data is null, like in the case of an empty - * GeoJSON tile, no-op but still set loaded to true. - * @param {Object} data - * @returns {undefined} - * @private - */ - loadVectorData: function(data, style) { - this.loaded = true; - - // empty GeoJSON tile - if (!data) return; - - this.collisionBoxArray = new CollisionBoxArray(data.collisionBoxArray); - this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); - this.featureIndex = new FeatureIndex(data.featureIndex, data.rawTileData, this.collisionTile); - this.rawTileData = data.rawTileData; - this.buckets = unserializeBuckets(data.buckets, style); - }, - - /** - * given a data object and a GL painter, destroy and re-create - * all of its buffers. - * @param {Object} data - * @param {Object} painter - * @returns {undefined} - * @private - */ - reloadSymbolData: function(data, painter, style) { - if (this.isUnloaded) return; - - this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); - this.featureIndex.setCollisionTile(this.collisionTile); - - // Destroy and delete existing symbol buckets - for (var id in this.buckets) { - var bucket = this.buckets[id]; - if (bucket.type === 'symbol') { - bucket.destroy(painter.gl); - delete this.buckets[id]; - } - } - - // Add new symbol buckets - util.extend(this.buckets, unserializeBuckets(data.buckets, style)); - }, - - /** - * Make sure that this tile doesn't own any data within a given - * painter, so that it doesn't consume any memory or maintain - * any references to the painter. - * @param {Object} painter gl painter object - * @returns {undefined} - * @private - */ - unloadVectorData: function(painter) { - for (var id in this.buckets) { - var bucket = this.buckets[id]; - bucket.destroy(painter.gl); - } - - this.collisionBoxArray = null; - this.collisionTile = null; - this.featureIndex = null; - this.rawTileData = null; - this.buckets = null; - this.loaded = false; - this.isUnloaded = true; - }, - - redoPlacement: function(source) { - if (!this.loaded || this.redoingPlacement) { - this.redoWhenDone = true; - return; - } - - this.redoingPlacement = true; - - source.dispatcher.send('redo placement', { - uid: this.uid, - source: source.id, - angle: source.map.transform.angle, - pitch: source.map.transform.pitch, - showCollisionBoxes: source.map.showCollisionBoxes - }, done.bind(this), this.workerID); - - function done(_, data) { - this.reloadSymbolData(data, source.map.painter, source.map.style); - source.fire('tile.load', {tile: this}); - - this.redoingPlacement = false; - if (this.redoWhenDone) { - this.redoPlacement(source); - this.redoWhenDone = false; - } - } - }, - - getBucket: function(layer) { - return this.buckets && this.buckets[layer.ref || layer.id]; - }, - - querySourceFeatures: function(result, params) { - if (!this.rawTileData) return; - - if (!this.vtLayers) { - this.vtLayers = new vt.VectorTile(new Protobuf(new Uint8Array(this.rawTileData))).layers; +var browser = require('../util/browser'); +var normalizeURL = require('../util/mapbox').normalizeSourceURL; +module.exports = function (options, callback) { + var loaded = function (err, tileJSON) { + if (err) { + return callback(err); } - - var layer = this.vtLayers._geojsonTileLayer || this.vtLayers[params.sourceLayer]; - - if (!layer) return; - - var filter = featureFilter(params.filter); - var coord = { z: this.coord.z, x: this.coord.x, y: this.coord.y }; - - for (var i = 0; i < layer.length; i++) { - var feature = layer.feature(i); - if (filter(feature)) { - var geojsonFeature = new GeoJSONFeature(feature, this.coord.z, this.coord.x, this.coord.y); - geojsonFeature.tile = coord; - result.push(geojsonFeature); - } + var result = util.pick(tileJSON, [ + 'tiles', + 'minzoom', + 'maxzoom', + 'attribution' + ]); + if (tileJSON.vector_layers) { + result.vectorLayers = tileJSON.vector_layers; + result.vectorLayerIds = result.vectorLayers.map(function (layer) { + return layer.id; + }); } + callback(null, result); + }; + if (options.url) { + ajax.getJSON(normalizeURL(options.url), loaded); + } else { + browser.frame(loaded.bind(null, null, options)); } }; - -function unserializeBuckets(input, style) { - var output = {}; - for (var i = 0; i < input.length; i++) { - var layer = style.getLayer(input[i].layerId); - if (!layer) continue; - - var bucket = Bucket.create(util.extend({ - layer: layer, - childLayers: input[i].childLayerIds - .map(style.getLayer.bind(style)) - .filter(function(layer) { return layer; }) - }, input[i])); - output[bucket.id] = bucket; - } - return output; -} - -},{"../data/bucket":17,"../data/feature_index":23,"../symbol/collision_box":76,"../symbol/collision_tile":78,"../util/util":119,"../util/vectortile_to_geojson":120,"feature-filter":122,"pbf":172,"vector-tile":183}],51:[function(require,module,exports){ +},{"../util/ajax":119,"../util/browser":120,"../util/mapbox":133,"../util/util":136}],57:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); -var Coordinate = require('../geo/coordinate'); - -module.exports = TileCoord; - -function TileCoord(z, x, y, w) { - assert(!isNaN(z) && z >= 0 && z % 1 === 0); - assert(!isNaN(x) && x >= 0 && x % 1 === 0); - assert(!isNaN(y) && y >= 0 && y % 1 === 0); - - if (isNaN(w)) w = 0; - - this.z = +z; - this.x = +x; - this.y = +y; - this.w = +w; - - // calculate id - w *= 2; - if (w < 0) w = w * -1 - 1; - var dim = 1 << this.z; - this.id = ((dim * dim * w + dim * this.y + this.x) * 32) + this.z; - - // for caching pos matrix calculation when rendering - this.posMatrix = null; -} - -TileCoord.prototype.toString = function() { - return this.z + "/" + this.x + "/" + this.y; -}; - -TileCoord.prototype.toCoordinate = function(sourceMaxZoom) { - var zoom = Math.min(this.z, sourceMaxZoom); - var tileScale = Math.pow(2, zoom); - var row = this.y; - var column = this.x + tileScale * this.w; - return new Coordinate(column, row, zoom); -}; - -// Parse a packed integer id into a TileCoord object -TileCoord.fromID = function(id) { - var z = id % 32, dim = 1 << z; - var xy = ((id - z) / 32); - var x = xy % dim, y = ((xy - x) / dim) % dim; - var w = Math.floor(xy / (dim * dim)); - if (w % 2 !== 0) w = w * -1 - 1; - w /= 2; - return new TileCoord(z, x, y, w); -}; - -// given a list of urls, choose a url template and return a tile URL -TileCoord.prototype.url = function(urls, sourceMaxZoom) { - return urls[(this.x + this.y) % urls.length] - .replace('{prefix}', (this.x % 16).toString(16) + (this.y % 16).toString(16)) - .replace('{z}', Math.min(this.z, sourceMaxZoom || this.z)) - .replace('{x}', this.x) - .replace('{y}', this.y); +var Bucket = require('../data/bucket'); +module.exports = function (tile, pixelValue, z) { + return pixelValue * (Bucket.EXTENT / (tile.tileSize * Math.pow(2, z - tile.coord.z))); }; - -// Return the coordinate of the parent tile -TileCoord.prototype.parent = function(sourceMaxZoom) { - if (this.z === 0) return null; - - // the id represents an overscaled tile, return the same coordinates with a lower z - if (this.z > sourceMaxZoom) { - return new TileCoord(this.z - 1, this.x, this.y, this.w); +},{"../data/bucket":23}],58:[function(require,module,exports){ +'use strict'; +var TileCoord = require('./tile_coord'); +exports.rendered = function (sourceCache, styleLayers, queryGeometry, params, zoom, bearing) { + var tilesIn = sourceCache.tilesIn(queryGeometry); + tilesIn.sort(sortTilesIn); + var renderedFeatureLayers = []; + for (var r = 0; r < tilesIn.length; r++) { + var tileIn = tilesIn[r]; + if (!tileIn.tile.featureIndex) + continue; + renderedFeatureLayers.push(tileIn.tile.featureIndex.query({ + queryGeometry: tileIn.queryGeometry, + scale: tileIn.scale, + tileSize: tileIn.tile.tileSize, + bearing: bearing, + params: params + }, styleLayers)); } - - return new TileCoord(this.z - 1, Math.floor(this.x / 2), Math.floor(this.y / 2), this.w); -}; - -TileCoord.prototype.wrapped = function() { - return new TileCoord(this.z, this.x, this.y, 0); + return mergeRenderedFeatureLayers(renderedFeatureLayers); }; - -// Return the coordinates of the tile's children -TileCoord.prototype.children = function(sourceMaxZoom) { - - if (this.z >= sourceMaxZoom) { - // return a single tile coord representing a an overscaled tile - return [new TileCoord(this.z + 1, this.x, this.y, this.w)]; +exports.source = function (sourceCache, params) { + var tiles = sourceCache.renderedIDs().map(function (id) { + return sourceCache.getTileByID(id); + }); + var result = []; + var dataTiles = {}; + for (var i = 0; i < tiles.length; i++) { + var tile = tiles[i]; + var dataID = new TileCoord(Math.min(tile.sourceMaxZoom, tile.coord.z), tile.coord.x, tile.coord.y, 0).id; + if (!dataTiles[dataID]) { + dataTiles[dataID] = true; + tile.querySourceFeatures(result, params); + } } - - var z = this.z + 1; - var x = this.x * 2; - var y = this.y * 2; - return [ - new TileCoord(z, x, y, this.w), - new TileCoord(z, x + 1, y, this.w), - new TileCoord(z, x, y + 1, this.w), - new TileCoord(z, x + 1, y + 1, this.w) - ]; + return result; }; - -// Taken from polymaps src/Layer.js -// https://github.com/simplegeo/polymaps/blob/master/src/Layer.js#L333-L383 - -function edge(a, b) { - if (a.row > b.row) { var t = a; a = b; b = t; } - return { - x0: a.column, - y0: a.row, - x1: b.column, - y1: b.row, - dx: b.column - a.column, - dy: b.row - a.row - }; +function sortTilesIn(a, b) { + var coordA = a.coord; + var coordB = b.coord; + return coordA.z - coordB.z || coordA.y - coordB.y || coordA.w - coordB.w || coordA.x - coordB.x; } - -function scanSpans(e0, e1, ymin, ymax, scanLine) { - var y0 = Math.max(ymin, Math.floor(e1.y0)); - var y1 = Math.min(ymax, Math.ceil(e1.y1)); - - // sort edges by x-coordinate - if ((e0.x0 === e1.x0 && e0.y0 === e1.y0) ? - (e0.x0 + e1.dy / e0.dy * e0.dx < e1.x1) : - (e0.x1 - e1.dy / e0.dy * e0.dx < e1.x0)) { - var t = e0; e0 = e1; e1 = t; - } - - // scan lines! - var m0 = e0.dx / e0.dy; - var m1 = e1.dx / e1.dy; - var d0 = e0.dx > 0; // use y + 1 to compute x0 - var d1 = e1.dx < 0; // use y + 1 to compute x1 - for (var y = y0; y < y1; y++) { - var x0 = m0 * Math.max(0, Math.min(e0.dy, y + d0 - e0.y0)) + e0.x0; - var x1 = m1 * Math.max(0, Math.min(e1.dy, y + d1 - e1.y0)) + e1.x0; - scanLine(Math.floor(x1), Math.ceil(x0), y); +function mergeRenderedFeatureLayers(tiles) { + var result = tiles[0] || {}; + for (var i = 1; i < tiles.length; i++) { + var tile = tiles[i]; + for (var layerID in tile) { + var tileFeatures = tile[layerID]; + var resultFeatures = result[layerID]; + if (resultFeatures === undefined) { + resultFeatures = result[layerID] = tileFeatures; + } else { + for (var f = 0; f < tileFeatures.length; f++) { + resultFeatures.push(tileFeatures[f]); + } + } + } } + return result; } - -function scanTriangle(a, b, c, ymin, ymax, scanLine) { - var ab = edge(a, b), - bc = edge(b, c), - ca = edge(c, a); - - var t; - - // sort edges by y-length - if (ab.dy > bc.dy) { t = ab; ab = bc; bc = t; } - if (ab.dy > ca.dy) { t = ab; ab = ca; ca = t; } - if (bc.dy > ca.dy) { t = bc; bc = ca; ca = t; } - - // scan span! scan span! - if (ab.dy) scanSpans(ca, ab, ymin, ymax, scanLine); - if (bc.dy) scanSpans(ca, bc, ymin, ymax, scanLine); +},{"./tile_coord":63}],59:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var ajax = require('../util/ajax'); +var Evented = require('../util/evented'); +var loadTileJSON = require('./load_tilejson'); +var normalizeURL = require('../util/mapbox').normalizeTileURL; +module.exports = RasterTileSource; +function RasterTileSource(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + util.extend(this, util.pick(options, [ + 'url', + 'scheme', + 'tileSize' + ])); + loadTileJSON(options, function (err, tileJSON) { + if (err) { + return this.fire('error', err); + } + util.extend(this, tileJSON); + this.fire('load'); + }.bind(this)); } - -TileCoord.cover = function(z, bounds, actualZ) { - var tiles = 1 << z; - var t = {}; - - function scanLine(x0, x1, y) { - var x, wx, coord; - if (y >= 0 && y <= tiles) { - for (x = x0; x < x1; x++) { - wx = (x % tiles + tiles) % tiles; - coord = new TileCoord(actualZ, wx, y, Math.floor(x / tiles)); - t[coord.id] = coord; +RasterTileSource.prototype = util.inherit(Evented, { + minzoom: 0, + maxzoom: 22, + roundZoom: true, + scheme: 'xyz', + tileSize: 512, + _loaded: false, + onAdd: function (map) { + this.map = map; + }, + serialize: function () { + return { + type: 'raster', + url: this.url, + tileSize: this.tileSize + }; + }, + loadTile: function (tile, callback) { + var url = normalizeURL(tile.coord.url(this.tiles, null, this.scheme), this.url, this.tileSize); + tile.request = ajax.getImage(url, done.bind(this)); + function done(err, img) { + delete tile.request; + if (tile.aborted) + return; + if (err) { + return callback(err); + } + var gl = this.map.painter.gl; + tile.texture = this.map.painter.getTexture(img.width); + if (tile.texture) { + gl.bindTexture(gl.TEXTURE_2D, tile.texture); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, img); + } else { + tile.texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tile.texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img); + tile.texture.size = img.width; } + gl.generateMipmap(gl.TEXTURE_2D); + this.map.animationLoop.set(this.map.style.rasterFadeDuration); + tile.state = 'loaded'; + callback(null); + } + }, + abortTile: function (tile) { + if (tile.request) { + tile.request.abort(); + delete tile.request; } + }, + unloadTile: function (tile) { + if (tile.texture) + this.map.painter.saveTexture(tile.texture); } - - // Divide the screen up in two triangles and scan each of them: - // +---/ - // | / | - // /---+ - scanTriangle(bounds[0], bounds[1], bounds[2], 0, tiles, scanLine); - scanTriangle(bounds[2], bounds[3], bounds[0], 0, tiles, scanLine); - - return Object.keys(t).map(function(id) { - return t[id]; - }); +}); +},{"../util/ajax":119,"../util/evented":128,"../util/mapbox":133,"../util/util":136,"./load_tilejson":56}],60:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var sourceTypes = { + 'vector': require('../source/vector_tile_source'), + 'raster': require('../source/raster_tile_source'), + 'geojson': require('../source/geojson_source'), + 'video': require('../source/video_source'), + 'image': require('../source/image_source') +}; +exports.create = function (id, source, dispatcher) { + source = new sourceTypes[source.type](id, source, dispatcher); + if (source.id !== id) { + throw new Error('Expected Source id to be ' + id + ' instead of ' + source.id); + } + util.bindAll([ + 'load', + 'abort', + 'unload', + 'serialize', + 'prepare' + ], source); + return source; }; - -},{"../geo/coordinate":25,"assert":6}],52:[function(require,module,exports){ +exports.getType = function (name) { + return sourceTypes[name]; +}; +exports.setType = function (name, type) { + sourceTypes[name] = type; +}; +},{"../source/geojson_source":52,"../source/image_source":55,"../source/raster_tile_source":59,"../source/vector_tile_source":64,"../source/video_source":66,"../util/util":136}],61:[function(require,module,exports){ 'use strict'; - +var Source = require('./source'); var Tile = require('./tile'); +var Evented = require('../util/evented'); var TileCoord = require('./tile_coord'); -var Point = require('point-geometry'); var Cache = require('../util/lru_cache'); var Coordinate = require('../geo/coordinate'); var util = require('../util/util'); var EXTENT = require('../data/bucket').EXTENT; - -module.exports = TilePyramid; - -/** - * A tile pyramid is a specialized cache and datastructure - * that contains tiles. It's used by sources to manage their - * data. - * - * @param {Object} options - * @param {number} options.tileSize - * @param {number} options.minzoom - * @param {number} options.maxzoom - * @private - */ -function TilePyramid(options) { - this.tileSize = options.tileSize; - this.minzoom = options.minzoom; - this.maxzoom = options.maxzoom; - this.roundZoom = options.roundZoom; - this.reparseOverscaled = options.reparseOverscaled; - - this._load = options.load; - this._abort = options.abort; - this._unload = options.unload; - this._add = options.add; - this._remove = options.remove; - this._redoPlacement = options.redoPlacement; - +module.exports = SourceCache; +function SourceCache(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + var source = this._source = Source.create(id, options, dispatcher).on('load', function () { + if (this.map && this._source.onAdd) { + this._source.onAdd(this.map); + } + this._sourceLoaded = true; + this.tileSize = source.tileSize; + this.minzoom = source.minzoom; + this.maxzoom = source.maxzoom; + this.roundZoom = source.roundZoom; + this.reparseOverscaled = source.reparseOverscaled; + this.isTileClipped = source.isTileClipped; + this.attribution = source.attribution; + this.vectorLayerIds = source.vectorLayerIds; + this.fire('load'); + }.bind(this)).on('error', function (e) { + this._sourceErrored = true; + this.fire('error', e); + }.bind(this)).on('change', function () { + this.reload(); + if (this.transform) { + this.update(this.transform, this.map && this.map.style.rasterFadeDuration); + } + this.fire('change'); + }.bind(this)); this._tiles = {}; - this._cache = new Cache(0, function(tile) { return this._unload(tile); }.bind(this)); - - this._filterRendered = this._filterRendered.bind(this); + this._cache = new Cache(0, this.unloadTile.bind(this)); + this._isIdRenderable = this._isIdRenderable.bind(this); } - - -TilePyramid.maxOverzooming = 10; -TilePyramid.maxUnderzooming = 3; - -TilePyramid.prototype = { - /** - * Confirm that every tracked tile is loaded. - * @returns {boolean} whether all tiles are loaded. - * @private - */ - loaded: function() { +SourceCache.maxOverzooming = 10; +SourceCache.maxUnderzooming = 3; +SourceCache.prototype = util.inherit(Evented, { + onAdd: function (map) { + this.map = map; + if (this._source && this._source.onAdd) { + this._source.onAdd(map); + } + }, + loaded: function () { + if (this._sourceErrored) { + return true; + } + if (!this._sourceLoaded) { + return false; + } for (var t in this._tiles) { - if (!this._tiles[t].loaded && !this._tiles[t].errored) + var tile = this._tiles[t]; + if (tile.state !== 'loaded' && tile.state !== 'errored') return false; } return true; }, - - /** - * Return all tile ids ordered with z-order, and cast to numbers - * @returns {Array} ids - * @private - */ - orderedIDs: function() { + getSource: function () { + return this._source; + }, + loadTile: function (tile, callback) { + return this._source.loadTile(tile, callback); + }, + unloadTile: function (tile) { + if (this._source.unloadTile) + return this._source.unloadTile(tile); + }, + abortTile: function (tile) { + if (this._source.abortTile) + return this._source.abortTile(tile); + }, + serialize: function () { + return this._source.serialize(); + }, + prepare: function () { + if (this._sourceLoaded && this._source.prepare) + return this._source.prepare(); + }, + getIds: function () { return Object.keys(this._tiles).map(Number).sort(compareKeyZoom); }, - - renderedIDs: function() { - return this.orderedIDs().filter(this._filterRendered); + getRenderableIds: function () { + return this.getIds().filter(this._isIdRenderable); }, - - _filterRendered: function(id) { - return this._tiles[id].loaded && !this._coveredTiles[id]; + _isIdRenderable: function (id) { + return this._tiles[id].isRenderable() && !this._coveredTiles[id]; }, - - reload: function() { + reload: function () { this._cache.reset(); for (var i in this._tiles) { - this._load(this._tiles[i]); + var tile = this._tiles[i]; + if (tile.state !== 'loading') { + tile.state = 'reloading'; + } + this.loadTile(this._tiles[i], this._tileLoaded.bind(this, this._tiles[i])); } }, - - /** - * Get a specific tile by id - * @param {string|number} id tile id - * @returns {Object} tile - * @private - */ - getTile: function(id) { - return this._tiles[id]; + _tileLoaded: function (tile, err) { + if (err) { + tile.state = 'errored'; + this.fire('tile.error', { + tile: tile, + error: err + }); + this._source.fire('tile.error', { + tile: tile, + error: err + }); + return; + } + tile.source = this; + tile.timeAdded = new Date().getTime(); + this.fire('tile.load', { tile: tile }); + this._source.fire('tile.load', { tile: tile }); }, - - /** - * get the zoom level adjusted for the difference in map and source tilesizes - * @param {Object} transform - * @returns {number} zoom level - * @private - */ - getZoom: function(transform) { - return transform.zoom + Math.log(transform.tileSize / this.tileSize) / Math.LN2; + getTile: function (coord) { + return this.getTileByID(coord.id); }, - - /** - * Return a zoom level that will cover all tiles in a given transform - * @param {Object} transform - * @returns {number} zoom level - * @private - */ - coveringZoomLevel: function(transform) { - return (this.roundZoom ? Math.round : Math.floor)(this.getZoom(transform)); + getTileByID: function (id) { + return this._tiles[id]; }, - - /** - * Given a transform, return all coordinates that could cover that - * transform for a covering zoom level. - * @param {Object} transform - * @returns {Array} tiles - * @private - */ - coveringTiles: function(transform) { - var z = this.coveringZoomLevel(transform); - var actualZ = z; - - if (z < this.minzoom) return []; - if (z > this.maxzoom) z = this.maxzoom; - - var tr = transform, - tileCenter = tr.locationCoordinate(tr.center)._zoomTo(z), - centerPoint = new Point(tileCenter.column - 0.5, tileCenter.row - 0.5); - - return TileCoord.cover(z, [ - tr.pointCoordinate(new Point(0, 0))._zoomTo(z), - tr.pointCoordinate(new Point(tr.width, 0))._zoomTo(z), - tr.pointCoordinate(new Point(tr.width, tr.height))._zoomTo(z), - tr.pointCoordinate(new Point(0, tr.height))._zoomTo(z) - ], this.reparseOverscaled ? actualZ : z).sort(function(a, b) { - return centerPoint.dist(a) - centerPoint.dist(b); - }); + getZoom: function (transform) { + return transform.zoom + transform.scaleZoom(transform.tileSize / this.tileSize); }, - - /** - * Recursively find children of the given tile (up to maxCoveringZoom) that are already loaded; - * adds found tiles to retain object; returns true if any child is found. - * - * @param {Coordinate} coord - * @param {number} maxCoveringZoom - * @param {boolean} retain - * @returns {boolean} whether the operation was complete - * @private - */ - findLoadedChildren: function(coord, maxCoveringZoom, retain) { + findLoadedChildren: function (coord, maxCoveringZoom, retain) { var found = false; - for (var id in this._tiles) { var tile = this._tiles[id]; - - // only consider loaded tiles on higher zoom levels (up to maxCoveringZoom) - if (retain[id] || !tile.loaded || tile.coord.z <= coord.z || tile.coord.z > maxCoveringZoom) continue; - - // disregard tiles that are not descendants of the given tile coordinate + if (retain[id] || !tile.isRenderable() || tile.coord.z <= coord.z || tile.coord.z > maxCoveringZoom) + continue; var z2 = Math.pow(2, Math.min(tile.coord.z, this.maxzoom) - Math.min(coord.z, this.maxzoom)); - if (Math.floor(tile.coord.x / z2) !== coord.x || - Math.floor(tile.coord.y / z2) !== coord.y) + if (Math.floor(tile.coord.x / z2) !== coord.x || Math.floor(tile.coord.y / z2) !== coord.y) continue; - - // found loaded child retain[id] = true; found = true; - - // loop through parents; retain the topmost loaded one if found while (tile && tile.coord.z - 1 > coord.z) { var parentId = tile.coord.parent(this.maxzoom).id; tile = this._tiles[parentId]; - - if (tile && tile.loaded) { + if (tile && tile.isRenderable()) { delete retain[id]; retain[parentId] = true; } @@ -18654,22 +20682,11 @@ TilePyramid.prototype = { } return found; }, - - /** - * Find a loaded parent of the given tile (up to minCoveringZoom); - * adds the found tile to retain object and returns the tile if found - * - * @param {Coordinate} coord - * @param {number} minCoveringZoom - * @param {boolean} retain - * @returns {Tile} tile object - * @private - */ - findLoadedParent: function(coord, minCoveringZoom, retain) { + findLoadedParent: function (coord, minCoveringZoom, retain) { for (var z = coord.z - 1; z >= minCoveringZoom; z--) { coord = coord.parent(this.maxzoom); var tile = this._tiles[coord.id]; - if (tile && tile.loaded) { + if (tile && tile.isRenderable()) { retain[coord.id] = true; return tile; } @@ -18680,192 +20697,121 @@ TilePyramid.prototype = { } } }, - - /** - * Resizes the tile cache based on the current viewport's size. - * - * Larger viewports use more tiles and need larger caches. Larger viewports - * are more likely to be found on devices with more memory and on pages where - * the map is more important. - * - * @private - */ - updateCacheSize: function(transform) { + updateCacheSize: function (transform) { var widthInTiles = Math.ceil(transform.width / transform.tileSize) + 1; var heightInTiles = Math.ceil(transform.height / transform.tileSize) + 1; var approxTilesInView = widthInTiles * heightInTiles; var commonZoomRange = 5; this._cache.setMaxSize(Math.floor(approxTilesInView * commonZoomRange)); }, - - /** - * Removes tiles that are outside the viewport and adds new tiles that - * are inside the viewport. - * @private - */ - update: function(used, transform, fadeDuration) { + update: function (transform, fadeDuration) { + if (!this._sourceLoaded) { + return; + } var i; var coord; var tile; - this.updateCacheSize(transform); - - // Determine the overzooming/underzooming amounts. var zoom = (this.roundZoom ? Math.round : Math.floor)(this.getZoom(transform)); - var minCoveringZoom = Math.max(zoom - TilePyramid.maxOverzooming, this.minzoom); - var maxCoveringZoom = Math.max(zoom + TilePyramid.maxUnderzooming, this.minzoom); - - // Retain is a list of tiles that we shouldn't delete, even if they are not - // the most ideal tile for the current viewport. This may include tiles like - // parent or child tiles that are *already* loaded. + var minCoveringZoom = Math.max(zoom - SourceCache.maxOverzooming, this.minzoom); + var maxCoveringZoom = Math.max(zoom + SourceCache.maxUnderzooming, this.minzoom); var retain = {}; var now = new Date().getTime(); - - // Covered is a list of retained tiles who's areas are full covered by other, - // better, retained tiles. They are not drawn separately. this._coveredTiles = {}; - - var required = used ? this.coveringTiles(transform) : []; + var required = this.used ? transform.coveringTiles(this._source) : []; for (i = 0; i < required.length; i++) { coord = required[i]; tile = this.addTile(coord); - retain[coord.id] = true; - - if (tile.loaded) + if (tile.isRenderable()) continue; - - // The tile we require is not yet loaded. - // Retain child or parent tiles that cover the same area. if (!this.findLoadedChildren(coord, maxCoveringZoom, retain)) { this.findLoadedParent(coord, minCoveringZoom, retain); } } - var parentsForFading = {}; - var ids = Object.keys(retain); for (var k = 0; k < ids.length; k++) { var id = ids[k]; coord = TileCoord.fromID(id); tile = this._tiles[id]; if (tile && tile.timeAdded > now - (fadeDuration || 0)) { - // This tile is still fading in. Find tiles to cross-fade with it. if (this.findLoadedChildren(coord, maxCoveringZoom, retain)) { retain[id] = true; } this.findLoadedParent(coord, minCoveringZoom, parentsForFading); } } - var fadedParent; for (fadedParent in parentsForFading) { if (!retain[fadedParent]) { - // If a tile is only needed for fading, mark it as covered so that it isn't rendered on it's own. this._coveredTiles[fadedParent] = true; } } for (fadedParent in parentsForFading) { retain[fadedParent] = true; } - - // Remove the tiles we don't need anymore. var remove = util.keysDifference(this._tiles, retain); for (i = 0; i < remove.length; i++) { this.removeTile(+remove[i]); } - this.transform = transform; }, - - /** - * Add a tile, given its coordinate, to the pyramid. - * @param {Coordinate} coord - * @returns {Coordinate} the coordinate. - * @private - */ - addTile: function(coord) { + addTile: function (coord) { var tile = this._tiles[coord.id]; if (tile) return tile; - var wrapped = coord.wrapped(); tile = this._tiles[wrapped.id]; - if (!tile) { tile = this._cache.get(wrapped.id); if (tile && this._redoPlacement) { this._redoPlacement(tile); } } - if (!tile) { var zoom = coord.z; var overscaling = zoom > this.maxzoom ? Math.pow(2, zoom - this.maxzoom) : 1; tile = new Tile(wrapped, this.tileSize * overscaling, this.maxzoom); - this._load(tile); + this.loadTile(tile, this._tileLoaded.bind(this, tile)); } - tile.uses++; this._tiles[coord.id] = tile; - this._add(tile, coord); - + this.fire('tile.add', { tile: tile }); + this._source.fire('tile.add', { tile: tile }); return tile; }, - - /** - * Remove a tile, given its id, from the pyramid - * @param {string|number} id tile id - * @returns {undefined} nothing - * @private - */ - removeTile: function(id) { + removeTile: function (id) { var tile = this._tiles[id]; if (!tile) return; - tile.uses--; delete this._tiles[id]; - this._remove(tile); - + this.fire('tile.remove', { tile: tile }); + this._source.fire('tile.remove', { tile: tile }); if (tile.uses > 0) return; - - if (tile.loaded) { + if (tile.isRenderable()) { this._cache.add(tile.coord.wrapped().id, tile); } else { - this._abort(tile); - this._unload(tile); + tile.aborted = true; + this.abortTile(tile); + this.unloadTile(tile); } }, - - /** - * Remove all tiles from this pyramid - * @private - */ - clearTiles: function() { + clearTiles: function () { for (var id in this._tiles) this.removeTile(id); this._cache.reset(); }, - - /** - * Search through our current tiles and attempt to find the tiles that - * cover the given bounds. - * @param {Array} queryGeometry coordinates of the corners of bounding rectangle - * @returns {Array} result items have {tile, minX, maxX, minY, maxY}, where min/max bounding values are the given bounds transformed in into the coordinate space of this tile. - * @private - */ - tilesIn: function(queryGeometry) { + tilesIn: function (queryGeometry) { var tileResults = {}; - var ids = this.orderedIDs(); - + var ids = this.getIds(); var minX = Infinity; var minY = Infinity; var maxX = -Infinity; var maxY = -Infinity; var z = queryGeometry[0].zoom; - for (var k = 0; k < queryGeometry.length; k++) { var p = queryGeometry[k]; minX = Math.min(minX, p.column); @@ -18873,129 +20819,390 @@ TilePyramid.prototype = { maxX = Math.max(maxX, p.column); maxY = Math.max(maxY, p.row); } - for (var i = 0; i < ids.length; i++) { var tile = this._tiles[ids[i]]; var coord = TileCoord.fromID(ids[i]); - var tileSpaceBounds = [ coordinateToTilePoint(coord, tile.sourceMaxZoom, new Coordinate(minX, minY, z)), coordinateToTilePoint(coord, tile.sourceMaxZoom, new Coordinate(maxX, maxY, z)) ]; - - if (tileSpaceBounds[0].x < EXTENT && tileSpaceBounds[0].y < EXTENT && - tileSpaceBounds[1].x >= 0 && tileSpaceBounds[1].y >= 0) { - + if (tileSpaceBounds[0].x < EXTENT && tileSpaceBounds[0].y < EXTENT && tileSpaceBounds[1].x >= 0 && tileSpaceBounds[1].y >= 0) { var tileSpaceQueryGeometry = []; for (var j = 0; j < queryGeometry.length; j++) { tileSpaceQueryGeometry.push(coordinateToTilePoint(coord, tile.sourceMaxZoom, queryGeometry[j])); } - var tileResult = tileResults[tile.coord.id]; if (tileResult === undefined) { tileResult = tileResults[tile.coord.id] = { tile: tile, + coord: coord, queryGeometry: [], scale: Math.pow(2, this.transform.zoom - tile.coord.z) }; } - - // Wrapped tiles share one tileResult object but can have multiple queryGeometry parts tileResult.queryGeometry.push(tileSpaceQueryGeometry); } } - var results = []; for (var t in tileResults) { results.push(tileResults[t]); } return results; + }, + redoPlacement: function () { + var ids = this.getIds(); + for (var i = 0; i < ids.length; i++) { + var tile = this.getTileByID(ids[i]); + tile.redoPlacement(this); + } + }, + getVisibleCoordinates: function () { + return this.getRenderableIds().map(TileCoord.fromID); + } +}); +function coordinateToTilePoint(tileCoord, sourceMaxZoom, coord) { + var zoomedCoord = coord.zoomTo(Math.min(tileCoord.z, sourceMaxZoom)); + return { + x: (zoomedCoord.column - (tileCoord.x + tileCoord.w * Math.pow(2, tileCoord.z))) * EXTENT, + y: (zoomedCoord.row - tileCoord.y) * EXTENT + }; +} +function compareKeyZoom(a, b) { + return a % 32 - b % 32; +} +},{"../data/bucket":23,"../geo/coordinate":32,"../util/evented":128,"../util/lru_cache":132,"../util/util":136,"./source":60,"./tile":62,"./tile_coord":63}],62:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var Bucket = require('../data/bucket'); +var FeatureIndex = require('../data/feature_index'); +var vt = require('vector-tile'); +var Protobuf = require('pbf'); +var GeoJSONFeature = require('../util/vectortile_to_geojson'); +var featureFilter = require('feature-filter'); +var CollisionTile = require('../symbol/collision_tile'); +var CollisionBoxArray = require('../symbol/collision_box'); +var SymbolInstancesArray = require('../symbol/symbol_instances'); +var SymbolQuadsArray = require('../symbol/symbol_quads'); +module.exports = Tile; +function Tile(coord, size, sourceMaxZoom) { + this.coord = coord; + this.uid = util.uniqueId(); + this.uses = 0; + this.tileSize = size; + this.sourceMaxZoom = sourceMaxZoom; + this.buckets = {}; + this.state = 'loading'; +} +Tile.prototype = { + loadVectorData: function (data, style) { + this.state = 'loaded'; + if (!data) + return; + this.collisionBoxArray = new CollisionBoxArray(data.collisionBoxArray); + this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); + this.symbolInstancesArray = new SymbolInstancesArray(data.symbolInstancesArray); + this.symbolQuadsArray = new SymbolQuadsArray(data.symbolQuadsArray); + this.featureIndex = new FeatureIndex(data.featureIndex, data.rawTileData, this.collisionTile); + this.rawTileData = data.rawTileData; + this.buckets = unserializeBuckets(data.buckets, style); + }, + reloadSymbolData: function (data, painter, style) { + if (this.state === 'unloaded') + return; + this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); + this.featureIndex.setCollisionTile(this.collisionTile); + for (var id in this.buckets) { + var bucket = this.buckets[id]; + if (bucket.type === 'symbol') { + bucket.destroy(painter.gl); + delete this.buckets[id]; + } + } + util.extend(this.buckets, unserializeBuckets(data.buckets, style)); + }, + unloadVectorData: function (painter) { + for (var id in this.buckets) { + var bucket = this.buckets[id]; + bucket.destroy(painter.gl); + } + this.collisionBoxArray = null; + this.symbolQuadsArray = null; + this.symbolInstancesArray = null; + this.collisionTile = null; + this.featureIndex = null; + this.rawTileData = null; + this.buckets = null; + this.state = 'unloaded'; + }, + redoPlacement: function (source) { + if (this.state !== 'loaded' || this.state === 'reloading') { + this.redoWhenDone = true; + return; + } + this.state = 'reloading'; + source.dispatcher.send('redo placement', { + uid: this.uid, + source: source.id, + angle: source.map.transform.angle, + pitch: source.map.transform.pitch, + showCollisionBoxes: source.map.showCollisionBoxes + }, done.bind(this), this.workerID); + function done(_, data) { + this.reloadSymbolData(data, source.map.painter, source.map.style); + source.fire('tile.load', { tile: this }); + this.state = 'loaded'; + if (this.redoWhenDone) { + this.redoPlacement(source); + this.redoWhenDone = false; + } + } + }, + getBucket: function (layer) { + return this.buckets && this.buckets[layer.ref || layer.id]; + }, + querySourceFeatures: function (result, params) { + if (!this.rawTileData) + return; + if (!this.vtLayers) { + this.vtLayers = new vt.VectorTile(new Protobuf(new Uint8Array(this.rawTileData))).layers; + } + var layer = this.vtLayers._geojsonTileLayer || this.vtLayers[params.sourceLayer]; + if (!layer) + return; + var filter = featureFilter(params.filter); + var coord = { + z: this.coord.z, + x: this.coord.x, + y: this.coord.y + }; + for (var i = 0; i < layer.length; i++) { + var feature = layer.feature(i); + if (filter(feature)) { + var geojsonFeature = new GeoJSONFeature(feature, this.coord.z, this.coord.x, this.coord.y); + geojsonFeature.tile = coord; + result.push(geojsonFeature); + } + } + }, + isRenderable: function () { + return this.state === 'loaded' || this.state === 'reloading'; + } +}; +function unserializeBuckets(input, style) { + if (!style) + return; + var output = {}; + for (var i = 0; i < input.length; i++) { + var layer = style.getLayer(input[i].layerId); + if (!layer) + continue; + var bucket = Bucket.create(util.extend({ + layer: layer, + childLayers: input[i].childLayerIds.map(style.getLayer.bind(style)).filter(function (layer) { + return layer; + }) + }, input[i])); + output[bucket.id] = bucket; + } + return output; +} +},{"../data/bucket":23,"../data/feature_index":30,"../symbol/collision_box":88,"../symbol/collision_tile":90,"../symbol/symbol_instances":99,"../symbol/symbol_quads":100,"../util/util":136,"../util/vectortile_to_geojson":137,"feature-filter":140,"pbf":192,"vector-tile":204}],63:[function(require,module,exports){ +'use strict'; +var WhooTS = require('whoots-js'); +var Coordinate = require('../geo/coordinate'); +module.exports = TileCoord; +function TileCoord(z, x, y, w) { + if (isNaN(w)) + w = 0; + this.z = +z; + this.x = +x; + this.y = +y; + this.w = +w; + w *= 2; + if (w < 0) + w = w * -1 - 1; + var dim = 1 << this.z; + this.id = (dim * dim * w + dim * this.y + this.x) * 32 + this.z; + this.posMatrix = null; +} +TileCoord.prototype.toString = function () { + return this.z + '/' + this.x + '/' + this.y; +}; +TileCoord.prototype.toCoordinate = function (sourceMaxZoom) { + var zoom = Math.min(this.z, sourceMaxZoom); + var tileScale = Math.pow(2, zoom); + var row = this.y; + var column = this.x + tileScale * this.w; + return new Coordinate(column, row, zoom); +}; +TileCoord.fromID = function (id) { + var z = id % 32, dim = 1 << z; + var xy = (id - z) / 32; + var x = xy % dim, y = (xy - x) / dim % dim; + var w = Math.floor(xy / (dim * dim)); + if (w % 2 !== 0) + w = w * -1 - 1; + w /= 2; + return new TileCoord(z, x, y, w); +}; +function getQuadkey(z, x, y) { + var quadkey = '', mask; + for (var i = z; i > 0; i--) { + mask = 1 << i - 1; + quadkey += (x & mask ? 1 : 0) + (y & mask ? 2 : 0); } + return quadkey; +} +TileCoord.prototype.url = function (urls, sourceMaxZoom, scheme) { + var bbox = WhooTS.getTileBBox(this.x, this.y, this.z); + var quadkey = getQuadkey(this.z, this.x, this.y); + return urls[(this.x + this.y) % urls.length].replace('{prefix}', (this.x % 16).toString(16) + (this.y % 16).toString(16)).replace('{z}', Math.min(this.z, sourceMaxZoom || this.z)).replace('{x}', this.x).replace('{y}', scheme === 'tms' ? Math.pow(2, this.z) - this.y - 1 : this.y).replace('{quadkey}', quadkey).replace('{bbox-epsg-3857}', bbox); }; - -/** - * Convert a coordinate to a point in a tile's coordinate space. - * @param {Coordinate} tileCoord - * @param {Coordinate} coord - * @returns {Object} position - * @private - */ -function coordinateToTilePoint(tileCoord, sourceMaxZoom, coord) { - var zoomedCoord = coord.zoomTo(Math.min(tileCoord.z, sourceMaxZoom)); +TileCoord.prototype.parent = function (sourceMaxZoom) { + if (this.z === 0) + return null; + if (this.z > sourceMaxZoom) { + return new TileCoord(this.z - 1, this.x, this.y, this.w); + } + return new TileCoord(this.z - 1, Math.floor(this.x / 2), Math.floor(this.y / 2), this.w); +}; +TileCoord.prototype.wrapped = function () { + return new TileCoord(this.z, this.x, this.y, 0); +}; +TileCoord.prototype.children = function (sourceMaxZoom) { + if (this.z >= sourceMaxZoom) { + return [new TileCoord(this.z + 1, this.x, this.y, this.w)]; + } + var z = this.z + 1; + var x = this.x * 2; + var y = this.y * 2; + return [ + new TileCoord(z, x, y, this.w), + new TileCoord(z, x + 1, y, this.w), + new TileCoord(z, x, y + 1, this.w), + new TileCoord(z, x + 1, y + 1, this.w) + ]; +}; +function edge(a, b) { + if (a.row > b.row) { + var t = a; + a = b; + b = t; + } return { - x: (zoomedCoord.column - (tileCoord.x + tileCoord.w * Math.pow(2, tileCoord.z))) * EXTENT, - y: (zoomedCoord.row - tileCoord.y) * EXTENT + x0: a.column, + y0: a.row, + x1: b.column, + y1: b.row, + dx: b.column - a.column, + dy: b.row - a.row }; - } - -function compareKeyZoom(a, b) { - return (a % 32) - (b % 32); +function scanSpans(e0, e1, ymin, ymax, scanLine) { + var y0 = Math.max(ymin, Math.floor(e1.y0)); + var y1 = Math.min(ymax, Math.ceil(e1.y1)); + if (e0.x0 === e1.x0 && e0.y0 === e1.y0 ? e0.x0 + e1.dy / e0.dy * e0.dx < e1.x1 : e0.x1 - e1.dy / e0.dy * e0.dx < e1.x0) { + var t = e0; + e0 = e1; + e1 = t; + } + var m0 = e0.dx / e0.dy; + var m1 = e1.dx / e1.dy; + var d0 = e0.dx > 0; + var d1 = e1.dx < 0; + for (var y = y0; y < y1; y++) { + var x0 = m0 * Math.max(0, Math.min(e0.dy, y + d0 - e0.y0)) + e0.x0; + var x1 = m1 * Math.max(0, Math.min(e1.dy, y + d1 - e1.y0)) + e1.x0; + scanLine(Math.floor(x1), Math.ceil(x0), y); + } } - -},{"../data/bucket":17,"../geo/coordinate":25,"../util/lru_cache":115,"../util/util":119,"./tile":50,"./tile_coord":51,"point-geometry":174}],53:[function(require,module,exports){ +function scanTriangle(a, b, c, ymin, ymax, scanLine) { + var ab = edge(a, b), bc = edge(b, c), ca = edge(c, a); + var t; + if (ab.dy > bc.dy) { + t = ab; + ab = bc; + bc = t; + } + if (ab.dy > ca.dy) { + t = ab; + ab = ca; + ca = t; + } + if (bc.dy > ca.dy) { + t = bc; + bc = ca; + ca = t; + } + if (ab.dy) + scanSpans(ca, ab, ymin, ymax, scanLine); + if (bc.dy) + scanSpans(ca, bc, ymin, ymax, scanLine); +} +TileCoord.cover = function (z, bounds, actualZ) { + var tiles = 1 << z; + var t = {}; + function scanLine(x0, x1, y) { + var x, wx, coord; + if (y >= 0 && y <= tiles) { + for (x = x0; x < x1; x++) { + wx = (x % tiles + tiles) % tiles; + coord = new TileCoord(actualZ, wx, y, Math.floor(x / tiles)); + t[coord.id] = coord; + } + } + } + scanTriangle(bounds[0], bounds[1], bounds[2], 0, tiles, scanLine); + scanTriangle(bounds[2], bounds[3], bounds[0], 0, tiles, scanLine); + return Object.keys(t).map(function (id) { + return t[id]; + }); +}; +},{"../geo/coordinate":32,"whoots-js":212}],64:[function(require,module,exports){ 'use strict'; - -var util = require('../util/util'); var Evented = require('../util/evented'); -var Source = require('./source'); +var util = require('../util/util'); +var loadTileJSON = require('./load_tilejson'); var normalizeURL = require('../util/mapbox').normalizeTileURL; - module.exports = VectorTileSource; - -function VectorTileSource(options) { - util.extend(this, util.pick(options, ['url', 'tileSize'])); +function VectorTileSource(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + util.extend(this, util.pick(options, [ + 'url', + 'scheme', + 'tileSize' + ])); this._options = util.extend({ type: 'vector' }, options); - if (this.tileSize !== 512) { throw new Error('vector tile sources must have a tileSize of 512'); } - - Source._loadTileJSON.call(this, options); + loadTileJSON(options, function (err, tileJSON) { + if (err) { + this.fire('error', err); + return; + } + util.extend(this, tileJSON); + this.fire('load'); + }.bind(this)); } - VectorTileSource.prototype = util.inherit(Evented, { minzoom: 0, maxzoom: 22, + scheme: 'xyz', tileSize: 512, reparseOverscaled: true, - _loaded: false, isTileClipped: true, - - onAdd: function(map) { + onAdd: function (map) { this.map = map; }, - - loaded: function() { - return this._pyramid && this._pyramid.loaded(); - }, - - update: function(transform) { - if (this._pyramid) { - this._pyramid.update(this.used, transform); - } - }, - - reload: function() { - if (this._pyramid) { - this._pyramid.reload(); - } - }, - - serialize: function() { + serialize: function () { return util.extend({}, this._options); }, - - getVisibleCoordinates: Source._getVisibleCoordinates, - getTile: Source._getTile, - - queryRenderedFeatures: Source._queryRenderedVectorFeatures, - querySourceFeatures: Source._querySourceFeatures, - - _loadTile: function(tile) { + loadTile: function (tile, callback) { var overscaling = tile.coord.z > this.maxzoom ? Math.pow(2, tile.coord.z - this.maxzoom) : 1; var params = { - url: normalizeURL(tile.coord.url(this.tiles, this.maxzoom), this.url), + url: normalizeURL(tile.coord.url(this.tiles, this.maxzoom, this.scheme), this.url), uid: tile.uid, coord: tile.coord, zoom: tile.coord.z, @@ -19006,66 +21213,135 @@ VectorTileSource.prototype = util.inherit(Evented, { pitch: this.map.transform.pitch, showCollisionBoxes: this.map.showCollisionBoxes }; - if (tile.workerID) { - params.rawTileData = tile.rawTileData; - this.dispatcher.send('reload tile', params, this._tileLoaded.bind(this, tile), tile.workerID); + if (tile.state === 'loading') { + tile.reloadCallback = callback; + } else { + params.rawTileData = tile.rawTileData; + this.dispatcher.send('reload tile', params, done.bind(this), tile.workerID); + } } else { - tile.workerID = this.dispatcher.send('load tile', params, this._tileLoaded.bind(this, tile)); + tile.workerID = this.dispatcher.send('load tile', params, done.bind(this)); } - }, - - _tileLoaded: function(tile, err, data) { - if (tile.aborted) - return; - - if (err) { - tile.errored = true; - this.fire('tile.error', {tile: tile, error: err}); - return; + function done(err, data) { + if (tile.aborted) + return; + if (err) { + return callback(err); + } + tile.loadVectorData(data, this.map.style); + if (tile.redoWhenDone) { + tile.redoWhenDone = false; + tile.redoPlacement(this); + } + callback(null); + if (tile.reloadCallback) { + this.loadTile(tile, tile.reloadCallback); + tile.reloadCallback = null; + } } - - tile.loadVectorData(data, this.map.style); - - if (tile.redoWhenDone) { - tile.redoWhenDone = false; - tile.redoPlacement(this); + }, + abortTile: function (tile) { + this.dispatcher.send('abort tile', { + uid: tile.uid, + source: this.id + }, null, tile.workerID); + }, + unloadTile: function (tile) { + tile.unloadVectorData(this.map.painter); + this.dispatcher.send('remove tile', { + uid: tile.uid, + source: this.id + }, null, tile.workerID); + } +}); +},{"../util/evented":128,"../util/mapbox":133,"../util/util":136,"./load_tilejson":56}],65:[function(require,module,exports){ +'use strict'; +var ajax = require('../util/ajax'); +var vt = require('vector-tile'); +var Protobuf = require('pbf'); +var WorkerTile = require('./worker_tile'); +module.exports = VectorTileWorkerSource; +function VectorTileWorkerSource(actor, styleLayers, loadVectorData) { + this.actor = actor; + this.styleLayers = styleLayers; + if (loadVectorData) { + this.loadVectorData = loadVectorData; + } + this.loading = {}; + this.loaded = {}; +} +VectorTileWorkerSource.prototype = { + loadTile: function (params, callback) { + var source = params.source, uid = params.uid; + if (!this.loading[source]) + this.loading[source] = {}; + var tile = this.loading[source][uid] = new WorkerTile(params); + tile.abort = this.loadVectorData(params, done.bind(this)); + function done(err, data) { + delete this.loading[source][uid]; + if (err) + return callback(err); + if (!data) + return callback(null, null); + tile.data = data.tile; + tile.parse(tile.data, this.styleLayers.getLayerFamilies(), this.actor, data.rawTileData, callback); + this.loaded[source] = this.loaded[source] || {}; + this.loaded[source][uid] = tile; } - - this.fire('tile.load', {tile: tile}); - this.fire('tile.stats', data.bucketStats); }, - - _abortTile: function(tile) { - tile.aborted = true; - this.dispatcher.send('abort tile', { uid: tile.uid, source: this.id }, null, tile.workerID); + reloadTile: function (params, callback) { + var loaded = this.loaded[params.source], uid = params.uid; + if (loaded && loaded[uid]) { + var tile = loaded[uid]; + tile.parse(tile.data, this.styleLayers.getLayerFamilies(), this.actor, params.rawTileData, callback); + } }, - - _addTile: function(tile) { - this.fire('tile.add', {tile: tile}); + abortTile: function (params) { + var loading = this.loading[params.source], uid = params.uid; + if (loading && loading[uid] && loading[uid].abort) { + loading[uid].abort(); + delete loading[uid]; + } }, - - _removeTile: function(tile) { - this.fire('tile.remove', {tile: tile}); + removeTile: function (params) { + var loaded = this.loaded[params.source], uid = params.uid; + if (loaded && loaded[uid]) { + delete loaded[uid]; + } }, - - _unloadTile: function(tile) { - tile.unloadVectorData(this.map.painter); - this.dispatcher.send('remove tile', { uid: tile.uid, source: this.id }, null, tile.workerID); + loadVectorData: function (params, callback) { + var xhr = ajax.getArrayBuffer(params.url, done.bind(this)); + return function abort() { + xhr.abort(); + }; + function done(err, data) { + if (err) { + return callback(err); + } + var tile = new vt.VectorTile(new Protobuf(new Uint8Array(data))); + callback(err, { + tile: tile, + rawTileData: data + }); + } }, - - redoPlacement: Source.redoPlacement, - - _redoTilePlacement: function(tile) { - tile.redoPlacement(this); + redoPlacement: function (params, callback) { + var loaded = this.loaded[params.source], loading = this.loading[params.source], uid = params.uid; + if (loaded && loaded[uid]) { + var tile = loaded[uid]; + var result = tile.redoPlacement(params.angle, params.pitch, params.showCollisionBoxes); + if (result.result) { + callback(null, result.result, result.transferables); + } + } else if (loading && loading[uid]) { + loading[uid].angle = params.angle; + } } -}); - -},{"../util/evented":111,"../util/mapbox":116,"../util/util":119,"./source":49}],54:[function(require,module,exports){ +}; +},{"../util/ajax":119,"./worker_tile":68,"pbf":192,"vector-tile":204}],66:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); -var Tile = require('./tile'); var TileCoord = require('./tile_coord'); var LngLat = require('../geo/lng_lat'); var Point = require('point-geometry'); @@ -19075,150 +21351,88 @@ var EXTENT = require('../data/bucket').EXTENT; var RasterBoundsArray = require('../render/draw_raster').RasterBoundsArray; var Buffer = require('../data/buffer'); var VertexArrayObject = require('../render/vertex_array_object'); - module.exports = VideoSource; - -/** - * Create a Video data source instance given an options object - * @class VideoSource - * @param {Object} [options] - * @param {Array} options.urls An array of URLs to video files - * @param {Array} options.coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the video. Does not have to be a rectangle. - * @example - * var sourceObj = new mapboxgl.VideoSource({ - * url: [ - * 'https://www.mapbox.com/videos/baltimore-smoke.mp4', - * 'https://www.mapbox.com/videos/baltimore-smoke.webm' - * ], - * coordinates: [ - * [-76.54335737228394, 39.18579907229748], - * [-76.52803659439087, 39.1838364847587], - * [-76.5295386314392, 39.17683392507606], - * [-76.54520273208618, 39.17876344106642] - * ] - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -function VideoSource(options) { +function VideoSource(id, options) { + this.id = id; this.urls = options.urls; this.coordinates = options.coordinates; - - ajax.getVideo(options.urls, function(err, video) { - // @TODO handle errors via event. - if (err) return; - + ajax.getVideo(options.urls, function (err, video) { + if (err) + return this.fire('error', { error: err }); this.video = video; this.video.loop = true; - var loopID; - - // start repainting when video starts playing - this.video.addEventListener('playing', function() { + this.video.addEventListener('playing', function () { loopID = this.map.style.animationLoop.set(Infinity); this.map._rerender(); }.bind(this)); - - // stop repainting when video stops - this.video.addEventListener('pause', function() { + this.video.addEventListener('pause', function () { this.map.style.animationLoop.cancel(loopID); }.bind(this)); - - this._loaded = true; - if (this.map) { this.video.play(); this.setCoordinates(options.coordinates); } + this.fire('load'); }.bind(this)); } - -VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype */{ +VideoSource.prototype = util.inherit(Evented, { + minzoom: 0, + maxzoom: 22, + tileSize: 512, roundZoom: true, - - /** - * Return the HTML video element. - * - * @returns {Object} - */ - getVideo: function() { + getVideo: function () { return this.video; }, - - onAdd: function(map) { + onAdd: function (map) { + if (this.map) + return; this.map = map; if (this.video) { this.video.play(); this.setCoordinates(this.coordinates); } }, - - /** - * Update video coordinates and rerender map - * - * @param {Array} coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the video. Does not have to be a rectangle. - * @returns {VideoSource} this - */ - setCoordinates: function(coordinates) { + setCoordinates: function (coordinates) { this.coordinates = coordinates; - - // Calculate which mercator tile is suitable for rendering the video in - // and create a buffer with the corner coordinates. These coordinates - // may be outside the tile, because raster tiles aren't clipped when rendering. - var map = this.map; - var cornerZ0Coords = coordinates.map(function(coord) { + var cornerZ0Coords = coordinates.map(function (coord) { return map.transform.locationCoordinate(LngLat.convert(coord)).zoomTo(0); }); - var centerCoord = this.centerCoord = util.getCoordinatesCenter(cornerZ0Coords); centerCoord.column = Math.round(centerCoord.column); centerCoord.row = Math.round(centerCoord.row); - - - var tileCoords = cornerZ0Coords.map(function(coord) { + this.minzoom = this.maxzoom = centerCoord.zoom; + this._coord = new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row); + this._tileCoords = cornerZ0Coords.map(function (coord) { var zoomedCoord = coord.zoomTo(centerCoord.zoom); - return new Point( - Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), - Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); + return new Point(Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); }); - + this.fire('change'); + return this; + }, + _setTile: function (tile) { + this._prepared = false; + this.tile = tile; var maxInt16 = 32767; var array = new RasterBoundsArray(); - array.emplaceBack(tileCoords[0].x, tileCoords[0].y, 0, 0); - array.emplaceBack(tileCoords[1].x, tileCoords[1].y, maxInt16, 0); - array.emplaceBack(tileCoords[3].x, tileCoords[3].y, 0, maxInt16); - array.emplaceBack(tileCoords[2].x, tileCoords[2].y, maxInt16, maxInt16); - - this.tile = new Tile(new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row)); + array.emplaceBack(this._tileCoords[0].x, this._tileCoords[0].y, 0, 0); + array.emplaceBack(this._tileCoords[1].x, this._tileCoords[1].y, maxInt16, 0); + array.emplaceBack(this._tileCoords[3].x, this._tileCoords[3].y, 0, maxInt16); + array.emplaceBack(this._tileCoords[2].x, this._tileCoords[2].y, maxInt16, maxInt16); this.tile.buckets = {}; - this.tile.boundsBuffer = new Buffer(array.serialize(), RasterBoundsArray.serialize(), Buffer.BufferType.VERTEX); this.tile.boundsVAO = new VertexArrayObject(); - - this.fire('change'); - - return this; - }, - - loaded: function() { - return this.video && this.video.readyState >= 2; - }, - - update: function() { - // noop - }, - - reload: function() { - // noop + this.tile.state = 'loaded'; }, - - prepare: function() { - if (!this._loaded) return; - if (this.video.readyState < 2) return; // not enough data for current position - + prepare: function () { + if (this.video.readyState < 2) + return; + if (!this.tile) + return; var gl = this.map.painter.gl; - if (!this.tile.texture) { + if (!this._prepared) { + this._prepared = true; this.tile.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); @@ -19230,20 +21444,18 @@ VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype * gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.video); } - this._currentTime = this.video.currentTime; }, - - getVisibleCoordinates: function() { - if (this.tile) return [this.tile.coord]; - else return []; - }, - - getTile: function() { - return this.tile; + loadTile: function (tile, callback) { + if (this._coord && this._coord.toString() === tile.coord.toString()) { + this._setTile(tile); + callback(null); + } else { + tile.state = 'errored'; + callback(null); + } }, - - serialize: function() { + serialize: function () { return { type: 'video', urls: this.urls, @@ -19251,43 +21463,42 @@ VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype * }; } }); - -},{"../data/bucket":17,"../data/buffer":22,"../geo/lng_lat":26,"../render/draw_raster":37,"../render/vertex_array_object":43,"../util/ajax":104,"../util/evented":111,"../util/util":119,"./tile":50,"./tile_coord":51,"point-geometry":174}],55:[function(require,module,exports){ +},{"../data/bucket":23,"../data/buffer":28,"../geo/lng_lat":33,"../render/draw_raster":45,"../render/vertex_array_object":51,"../util/ajax":119,"../util/evented":128,"../util/util":136,"./tile_coord":63,"point-geometry":194}],67:[function(require,module,exports){ 'use strict'; - var Actor = require('../util/actor'); -var WorkerTile = require('./worker_tile'); var StyleLayer = require('../style/style_layer'); var util = require('../util/util'); -var ajax = require('../util/ajax'); -var vt = require('vector-tile'); -var Protobuf = require('pbf'); -var supercluster = require('supercluster'); - -var geojsonvt = require('geojson-vt'); -var rewind = require('geojson-rewind'); -var GeoJSONWrapper = require('./geojson_wrapper'); -var vtpbf = require('vt-pbf'); - -module.exports = function(self) { +var VectorTileWorkerSource = require('./vector_tile_worker_source'); +var GeoJSONWorkerSource = require('./geojson_worker_source'); +module.exports = function createWorker(self) { return new Worker(self); }; - function Worker(self) { this.self = self; this.actor = new Actor(self, this); - this.loading = {}; - - this.loaded = {}; - this.geoJSONIndexes = {}; + var styleLayers = { + getLayers: function () { + return this.layers; + }.bind(this), + getLayerFamilies: function () { + return this.layerFamilies; + }.bind(this) + }; + this.workerSources = { + vector: new VectorTileWorkerSource(this.actor, styleLayers), + geojson: new GeoJSONWorkerSource(this.actor, styleLayers) + }; + this.self.registerWorkerSource = function (name, WorkerSource) { + if (this.workerSources[name]) { + throw new Error('Worker source with name "' + name + '" already registered.'); + } + this.workerSources[name] = new WorkerSource(this.actor, styleLayers); + }.bind(this); } - util.extend(Worker.prototype, { - 'set layers': function(layers) { + 'set layers': function (layers) { this.layers = {}; var that = this; - - // Filter layers and create an id -> layer map var childLayerIndicies = []; for (var i = 0; i < layers.length; i++) { var layer = layers[i]; @@ -19299,41 +21510,30 @@ util.extend(Worker.prototype, { } } } - - // Create an instance of StyleLayer per layer for (var j = 0; j < childLayerIndicies.length; j++) { setLayer(layers[childLayerIndicies[j]]); } - function setLayer(serializedLayer) { - var styleLayer = StyleLayer.create( - serializedLayer, - serializedLayer.ref && that.layers[serializedLayer.ref] - ); - styleLayer.updatePaintTransitions({}, {transition: false}); + var styleLayer = StyleLayer.create(serializedLayer, serializedLayer.ref && that.layers[serializedLayer.ref]); + styleLayer.updatePaintTransitions({}, { transition: false }); that.layers[styleLayer.id] = styleLayer; } - this.layerFamilies = createLayerFamilies(this.layers); }, - - 'update layers': function(layers) { + 'update layers': function (layers) { var that = this; var id; var layer; - - // Update ref parents for (id in layers) { layer = layers[id]; - if (layer.ref) updateLayer(layer); + if (layer.ref) + updateLayer(layer); } - - // Update ref children for (id in layers) { layer = layers[id]; - if (!layer.ref) updateLayer(layer); + if (!layer.ref) + updateLayer(layer); } - function updateLayer(layer) { var refLayer = that.layers[layer.ref]; if (that.layers[layer.id]) { @@ -19341,151 +21541,47 @@ util.extend(Worker.prototype, { } else { that.layers[layer.id] = StyleLayer.create(layer, refLayer); } - that.layers[layer.id].updatePaintTransitions({}, {transition: false}); + that.layers[layer.id].updatePaintTransitions({}, { transition: false }); } - this.layerFamilies = createLayerFamilies(this.layers); }, - - 'load tile': function(params, callback) { - var source = params.source, - uid = params.uid; - - if (!this.loading[source]) - this.loading[source] = {}; - - - var tile = this.loading[source][uid] = new WorkerTile(params); - - tile.xhr = ajax.getArrayBuffer(params.url, done.bind(this)); - - function done(err, data) { - delete this.loading[source][uid]; - - if (err) return callback(err); - - tile.data = new vt.VectorTile(new Protobuf(new Uint8Array(data))); - tile.parse(tile.data, this.layerFamilies, this.actor, data, callback); - - this.loaded[source] = this.loaded[source] || {}; - this.loaded[source][uid] = tile; - } - }, - - 'reload tile': function(params, callback) { - var loaded = this.loaded[params.source], - uid = params.uid; - if (loaded && loaded[uid]) { - var tile = loaded[uid]; - tile.parse(tile.data, this.layerFamilies, this.actor, params.rawTileData, callback); - } + 'load tile': function (params, callback) { + var type = params.type || 'vector'; + this.workerSources[type].loadTile(params, callback); }, - - 'abort tile': function(params) { - var loading = this.loading[params.source], - uid = params.uid; - if (loading && loading[uid]) { - loading[uid].xhr.abort(); - delete loading[uid]; - } + 'reload tile': function (params, callback) { + var type = params.type || 'vector'; + this.workerSources[type].reloadTile(params, callback); }, - - 'remove tile': function(params) { - var loaded = this.loaded[params.source], - uid = params.uid; - if (loaded && loaded[uid]) { - delete loaded[uid]; - } + 'abort tile': function (params) { + var type = params.type || 'vector'; + this.workerSources[type].abortTile(params); }, - - 'redo placement': function(params, callback) { - var loaded = this.loaded[params.source], - loading = this.loading[params.source], - uid = params.uid; - - if (loaded && loaded[uid]) { - var tile = loaded[uid]; - var result = tile.redoPlacement(params.angle, params.pitch, params.showCollisionBoxes); - - if (result.result) { - callback(null, result.result, result.transferables); - } - - } else if (loading && loading[uid]) { - loading[uid].angle = params.angle; - } + 'remove tile': function (params) { + var type = params.type || 'vector'; + this.workerSources[type].removeTile(params); }, - - 'parse geojson': function(params, callback) { - var indexData = function(err, data) { - rewind(data, true); - if (err) return callback(err); - if (typeof data != 'object') { - return callback(new Error("Input data is not a valid GeoJSON object.")); - } - try { - this.geoJSONIndexes[params.source] = params.cluster ? - supercluster(params.superclusterOptions).load(data.features) : - geojsonvt(data, params.geojsonVtOptions); - } catch (err) { - return callback(err); - } - callback(null); - }.bind(this); - - // Not, because of same origin issues, urls must either include an - // explicit origin or absolute path. - // ie: /foo/bar.json or http://example.com/bar.json - // but not ../foo/bar.json - if (params.url) { - ajax.getJSON(params.url, indexData); - } else if (typeof params.data === 'string') { - indexData(null, JSON.parse(params.data)); - } else { - return callback(new Error("Input data is not a valid GeoJSON object.")); - } + 'redo placement': function (params, callback) { + var type = params.type || 'vector'; + this.workerSources[type].redoPlacement(params, callback); }, - - 'load geojson tile': function(params, callback) { - var source = params.source, - coord = params.coord; - - if (!this.geoJSONIndexes[source]) return callback(null, null); // we couldn't load the file - - // console.time('tile ' + coord.z + ' ' + coord.x + ' ' + coord.y); - - var geoJSONTile = this.geoJSONIndexes[source].getTile(Math.min(coord.z, params.maxZoom), coord.x, coord.y); - - // console.timeEnd('tile ' + coord.z + ' ' + coord.x + ' ' + coord.y); - - // if (!geoJSONTile) console.log('not found', this.geoJSONIndexes[source], coord); - - var tile = geoJSONTile ? new WorkerTile(params) : undefined; - - this.loaded[source] = this.loaded[source] || {}; - this.loaded[source][params.uid] = tile; - - if (geoJSONTile) { - var geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features); - geojsonWrapper.name = '_geojsonTileLayer'; - var rawTileData = vtpbf({ layers: { '_geojsonTileLayer': geojsonWrapper }}).buffer; - tile.parse(geojsonWrapper, this.layerFamilies, this.actor, rawTileData, callback); - } else { - return callback(null, null); // nothing in the given tile + 'load worker source': function (params, callback) { + try { + this.self.importScripts(params.url); + callback(); + } catch (e) { + callback(e); } } }); - function createLayerFamilies(layers) { var families = {}; - for (var layerId in layers) { var layer = layers[layerId]; var parentLayerId = layer.ref || layer.id; var parentLayer = layers[parentLayerId]; - - if (parentLayer.layout && parentLayer.layout.visibility === 'none') continue; - + if (parentLayer.layout && parentLayer.layout.visibility === 'none') + continue; families[parentLayerId] = families[parentLayerId] || []; if (layerId === parentLayerId) { families[parentLayerId].unshift(layer); @@ -19493,21 +21589,19 @@ function createLayerFamilies(layers) { families[parentLayerId].push(layer); } } - return families; } - -},{"../style/style_layer":63,"../util/actor":103,"../util/ajax":104,"../util/util":119,"./geojson_wrapper":45,"./worker_tile":56,"geojson-rewind":123,"geojson-vt":128,"pbf":172,"supercluster":177,"vector-tile":183,"vt-pbf":187}],56:[function(require,module,exports){ +},{"../style/style_layer":75,"../util/actor":118,"../util/util":136,"./geojson_worker_source":53,"./vector_tile_worker_source":65}],68:[function(require,module,exports){ 'use strict'; - var FeatureIndex = require('../data/feature_index'); var CollisionTile = require('../symbol/collision_tile'); var Bucket = require('../data/bucket'); var CollisionBoxArray = require('../symbol/collision_box'); var DictionaryCoder = require('../util/dictionary_coder'); - +var util = require('../util/util'); +var SymbolInstancesArray = require('../symbol/symbol_instances'); +var SymbolQuadsArray = require('../symbol/symbol_quads'); module.exports = WorkerTile; - function WorkerTile(params) { this.coord = params.coord; this.uid = params.uid; @@ -19519,19 +21613,15 @@ function WorkerTile(params) { this.pitch = params.pitch; this.showCollisionBoxes = params.showCollisionBoxes; } - -WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, callback) { - +WorkerTile.prototype.parse = function (data, layerFamilies, actor, rawTileData, callback) { this.status = 'parsing'; this.data = data; - this.collisionBoxArray = new CollisionBoxArray(); + this.symbolInstancesArray = new SymbolInstancesArray(); + this.symbolQuadsArray = new SymbolQuadsArray(); var collisionTile = new CollisionTile(this.angle, this.pitch, this.collisionBoxArray); var featureIndex = new FeatureIndex(this.coord, this.overscaling, collisionTile, data.layers); var sourceLayerCoder = new DictionaryCoder(data.layers ? Object.keys(data.layers).sort() : ['_geojsonTileLayer']); - - var stats = { _total: 0 }; - var tile = this; var bucketsById = {}; var bucketsBySourceLayer = {}; @@ -19539,19 +21629,21 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c var layer; var sourceLayerId; var bucket; - - // Map non-ref layers to buckets. var bucketIndex = 0; for (var layerId in layerFamilies) { layer = layerFamilies[layerId][0]; - - if (layer.source !== this.source) continue; - if (layer.ref) continue; - if (layer.minzoom && this.zoom < layer.minzoom) continue; - if (layer.maxzoom && this.zoom >= layer.maxzoom) continue; - if (layer.layout && layer.layout.visibility === 'none') continue; - if (data.layers && !data.layers[layer.sourceLayer]) continue; - + if (layer.source !== this.source) + continue; + if (layer.ref) + continue; + if (layer.minzoom && this.zoom < layer.minzoom) + continue; + if (layer.maxzoom && this.zoom >= layer.maxzoom) + continue; + if (layer.layout && layer.layout.visibility === 'none') + continue; + if (data.layers && !data.layers[layer.sourceLayer]) + continue; bucket = Bucket.create({ layer: layer, index: bucketIndex++, @@ -19560,31 +21652,31 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c overscaling: this.overscaling, showCollisionBoxes: this.showCollisionBoxes, collisionBoxArray: this.collisionBoxArray, + symbolQuadsArray: this.symbolQuadsArray, + symbolInstancesArray: this.symbolInstancesArray, sourceLayerIndex: sourceLayerCoder.encode(layer.sourceLayer || '_geojsonTileLayer') }); bucket.createFilter(); - bucketsById[layer.id] = bucket; - - if (data.layers) { // vectortile + if (data.layers) { sourceLayerId = layer.sourceLayer; bucketsBySourceLayer[sourceLayerId] = bucketsBySourceLayer[sourceLayerId] || {}; bucketsBySourceLayer[sourceLayerId][layer.id] = bucket; } } - - // read each layer, and sort its features into buckets - if (data.layers) { // vectortile + if (data.layers) { for (sourceLayerId in bucketsBySourceLayer) { + if (layer.version === 1) { + util.warnOnce('Vector tile source "' + this.source + '" layer "' + sourceLayerId + '" does not use vector tile spec v2 ' + 'and therefore may have some rendering errors.'); + } layer = data.layers[sourceLayerId]; if (layer) { sortLayerIntoBuckets(layer, bucketsBySourceLayer[sourceLayerId]); } } - } else { // geojson + } else { sortLayerIntoBuckets(data, bucketsById); } - function sortLayerIntoBuckets(layer, buckets) { for (var i = 0; i < layer.length; i++) { var feature = layer.feature(i); @@ -19595,52 +21687,40 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c } } } - - var buckets = [], - symbolBuckets = this.symbolBuckets = [], - otherBuckets = []; - + var buckets = [], symbolBuckets = this.symbolBuckets = [], otherBuckets = []; featureIndex.bucketLayerIDs = {}; - for (var id in bucketsById) { bucket = bucketsById[id]; - if (bucket.features.length === 0) continue; - + if (bucket.features.length === 0) + continue; featureIndex.bucketLayerIDs[bucket.index] = bucket.childLayers.map(getLayerId); - buckets.push(bucket); - if (bucket.type === 'symbol') symbolBuckets.push(bucket); else otherBuckets.push(bucket); } - var icons = {}; var stacks = {}; var deps = 0; - - if (symbolBuckets.length > 0) { - - // Get dependencies for symbol buckets for (i = symbolBuckets.length - 1; i >= 0; i--) { symbolBuckets[i].updateIcons(icons); symbolBuckets[i].updateFont(stacks); } - for (var fontName in stacks) { stacks[fontName] = Object.keys(stacks[fontName]).map(Number); } icons = Object.keys(icons); - - actor.send('get glyphs', {uid: this.uid, stacks: stacks}, function(err, newStacks) { + actor.send('get glyphs', { + uid: this.uid, + stacks: stacks + }, function (err, newStacks) { stacks = newStacks; gotDependency(err); }); - if (icons.length) { - actor.send('get icons', {icons: icons}, function(err, newIcons) { + actor.send('get icons', { icons: icons }, function (err, newIcons) { icons = newIcons; gotDependency(err); }); @@ -19648,91 +21728,69 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c gotDependency(); } } - - // immediately parse non-symbol buckets (they have no dependencies) for (i = otherBuckets.length - 1; i >= 0; i--) { parseBucket(this, otherBuckets[i]); } - if (symbolBuckets.length === 0) return done(); - function gotDependency(err) { - if (err) return callback(err); + if (err) + return callback(err); deps++; if (deps === 2) { - // all symbol bucket dependencies fetched; parse them in proper order for (var i = symbolBuckets.length - 1; i >= 0; i--) { parseBucket(tile, symbolBuckets[i]); } done(); } } - function parseBucket(tile, bucket) { - var now = Date.now(); - bucket.populateBuffers(collisionTile, stacks, icons); - var time = Date.now() - now; - - + bucket.populateArrays(collisionTile, stacks, icons); if (bucket.type !== 'symbol') { for (var i = 0; i < bucket.features.length; i++) { var feature = bucket.features[i]; featureIndex.insert(feature, feature.index, bucket.sourceLayerIndex, bucket.index); } } - bucket.features = null; - - stats._total += time; - stats[bucket.id] = (stats[bucket.id] || 0) + time; } - function done() { tile.status = 'done'; - if (tile.redoPlacementAfterDone) { tile.redoPlacement(tile.angle, tile.pitch, null); tile.redoPlacementAfterDone = false; } - var featureIndex_ = featureIndex.serialize(); var collisionTile_ = collisionTile.serialize(); var collisionBoxArray = tile.collisionBoxArray.serialize(); + var symbolInstancesArray = tile.symbolInstancesArray.serialize(); + var symbolQuadsArray = tile.symbolQuadsArray.serialize(); var transferables = [rawTileData].concat(featureIndex_.transferables).concat(collisionTile_.transferables); - - var nonEmptyBuckets = buckets.filter(isBucketEmpty); - + var nonEmptyBuckets = buckets.filter(isBucketNonEmpty); callback(null, { buckets: nonEmptyBuckets.map(serializeBucket), - bucketStats: stats, // TODO put this in a separate message? featureIndex: featureIndex_.data, collisionTile: collisionTile_.data, collisionBoxArray: collisionBoxArray, + symbolInstancesArray: symbolInstancesArray, + symbolQuadsArray: symbolQuadsArray, rawTileData: rawTileData }, getTransferables(nonEmptyBuckets).concat(transferables)); } }; - -WorkerTile.prototype.redoPlacement = function(angle, pitch, showCollisionBoxes) { +WorkerTile.prototype.redoPlacement = function (angle, pitch, showCollisionBoxes) { if (this.status !== 'done') { this.redoPlacementAfterDone = true; this.angle = angle; return {}; } - var collisionTile = new CollisionTile(angle, pitch, this.collisionBoxArray); - var buckets = this.symbolBuckets; - for (var i = buckets.length - 1; i >= 0; i--) { buckets[i].placeFeatures(collisionTile, showCollisionBoxes); } - var collisionTile_ = collisionTile.serialize(); - - var nonEmptyBuckets = buckets.filter(isBucketEmpty); - + var nonEmptyBuckets = buckets.filter(isBucketNonEmpty); return { result: { buckets: nonEmptyBuckets.map(serializeBucket), @@ -19741,116 +21799,72 @@ WorkerTile.prototype.redoPlacement = function(angle, pitch, showCollisionBoxes) transferables: getTransferables(nonEmptyBuckets).concat(collisionTile_.transferables) }; }; - -function isBucketEmpty(bucket) { - for (var programName in bucket.arrayGroups) { - var programArrayGroups = bucket.arrayGroups[programName]; - for (var k = 0; k < programArrayGroups.length; k++) { - var programArrayGroup = programArrayGroups[k]; - for (var layoutOrPaint in programArrayGroup) { - var arrays = programArrayGroup[layoutOrPaint]; - for (var bufferName in arrays) { - if (arrays[bufferName].length > 0) return true; - } - } - } - } - return false; +function isBucketNonEmpty(bucket) { + return !bucket.isEmpty(); } - function serializeBucket(bucket) { return bucket.serialize(); } - function getTransferables(buckets) { var transferables = []; for (var i in buckets) { - var bucket = buckets[i]; - for (var programName in bucket.arrayGroups) { - var programArrayGroups = bucket.arrayGroups[programName]; - for (var k = 0; k < programArrayGroups.length; k++) { - var programArrayGroup = programArrayGroups[k]; - for (var layoutOrPaint in programArrayGroup) { - var arrays = programArrayGroup[layoutOrPaint]; - for (var bufferName in arrays) { - transferables.push(arrays[bufferName].arrayBuffer); - } - } - } - } + buckets[i].getTransferables(transferables); } return transferables; } - function getLayerId(layer) { return layer.id; } - -},{"../data/bucket":17,"../data/feature_index":23,"../symbol/collision_box":76,"../symbol/collision_tile":78,"../util/dictionary_coder":110}],57:[function(require,module,exports){ +},{"../data/bucket":23,"../data/feature_index":30,"../symbol/collision_box":88,"../symbol/collision_tile":90,"../symbol/symbol_instances":99,"../symbol/symbol_quads":100,"../util/dictionary_coder":126,"../util/util":136}],69:[function(require,module,exports){ 'use strict'; - module.exports = AnimationLoop; - function AnimationLoop() { this.n = 0; this.times = []; } - -// Are all animations done? -AnimationLoop.prototype.stopped = function() { - this.times = this.times.filter(function(t) { - return t.time >= (new Date()).getTime(); +AnimationLoop.prototype.stopped = function () { + this.times = this.times.filter(function (t) { + return t.time >= new Date().getTime(); }); return !this.times.length; }; - -// Add a new animation that will run t milliseconds -// Returns an id that can be used to cancel it layer -AnimationLoop.prototype.set = function(t) { - this.times.push({ id: this.n, time: t + (new Date()).getTime() }); +AnimationLoop.prototype.set = function (t) { + this.times.push({ + id: this.n, + time: t + new Date().getTime() + }); return this.n++; }; - -// Cancel an animation -AnimationLoop.prototype.cancel = function(n) { - this.times = this.times.filter(function(t) { +AnimationLoop.prototype.cancel = function (n) { + this.times = this.times.filter(function (t) { return t.id !== n; }); }; - -},{}],58:[function(require,module,exports){ +},{}],70:[function(require,module,exports){ 'use strict'; - var Evented = require('../util/evented'); var ajax = require('../util/ajax'); var browser = require('../util/browser'); var normalizeURL = require('../util/mapbox').normalizeSpriteURL; - module.exports = ImageSprite; - function ImageSprite(base) { this.base = base; this.retina = browser.devicePixelRatio > 1; - var format = this.retina ? '@2x' : ''; - - ajax.getJSON(normalizeURL(base, format, '.json'), function(err, data) { + ajax.getJSON(normalizeURL(base, format, '.json'), function (err, data) { if (err) { - this.fire('error', {error: err}); + this.fire('error', { error: err }); return; } - this.data = data; - if (this.img) this.fire('load'); + if (this.img) + this.fire('load'); }.bind(this)); - - ajax.getImage(normalizeURL(base, format, '.png'), function(err, img) { + ajax.getImage(normalizeURL(base, format, '.png'), function (err, img) { if (err) { - this.fire('error', {error: err}); + this.fire('error', { error: err }); return; } - - // premultiply the sprite var data = img.getData(); var newdata = img.data = new Uint8Array(data.length); for (var i = 0; i < data.length; i += 4) { @@ -19860,96 +21874,82 @@ function ImageSprite(base) { newdata[i + 2] = data[i + 2] * alpha; newdata[i + 3] = data[i + 3]; } - this.img = img; - if (this.data) this.fire('load'); + if (this.data) + this.fire('load'); }.bind(this)); } - ImageSprite.prototype = Object.create(Evented); - -ImageSprite.prototype.toJSON = function() { +ImageSprite.prototype.toJSON = function () { return this.base; }; - -ImageSprite.prototype.loaded = function() { +ImageSprite.prototype.loaded = function () { return !!(this.data && this.img); }; - -ImageSprite.prototype.resize = function(/*gl*/) { +ImageSprite.prototype.resize = function () { if (browser.devicePixelRatio > 1 !== this.retina) { var newSprite = new ImageSprite(this.base); - newSprite.on('load', function() { + newSprite.on('load', function () { this.img = newSprite.img; this.data = newSprite.data; this.retina = newSprite.retina; }.bind(this)); } }; - -function SpritePosition() {} -SpritePosition.prototype = { x: 0, y: 0, width: 0, height: 0, pixelRatio: 1, sdf: false }; - -ImageSprite.prototype.getSpritePosition = function(name) { - if (!this.loaded()) return new SpritePosition(); - +function SpritePosition() { +} +SpritePosition.prototype = { + x: 0, + y: 0, + width: 0, + height: 0, + pixelRatio: 1, + sdf: false +}; +ImageSprite.prototype.getSpritePosition = function (name) { + if (!this.loaded()) + return new SpritePosition(); var pos = this.data && this.data[name]; - if (pos && this.img) return pos; - + if (pos && this.img) + return pos; return new SpritePosition(); }; - -},{"../util/ajax":104,"../util/browser":105,"../util/evented":111,"../util/mapbox":116}],59:[function(require,module,exports){ +},{"../util/ajax":119,"../util/browser":120,"../util/evented":128,"../util/mapbox":133}],71:[function(require,module,exports){ 'use strict'; - -var parseCSSColor = require('csscolorparser').parseCSSColor; +var parseColorString = require('csscolorparser').parseCSSColor; var util = require('../util/util'); - -var colorCache = {}; - -function parseColor(input) { - - if (colorCache[input]) { - return colorCache[input]; - - // RGBA array - } else if (Array.isArray(input)) { - return input; - - // GL function - } else if (input && input.stops) { +var StyleFunction = require('./style_function'); +var cache = {}; +module.exports = function parseColor(input) { + if (StyleFunction.isFunctionDefinition(input)) { return util.extend({}, input, { - stops: input.stops.map(parseFunctionStopColor) + stops: input.stops.map(function (stop) { + return [ + stop[0], + parseColor(stop[1]) + ]; + }) }); - - // Color string } else if (typeof input === 'string') { - var parsedColor = parseCSSColor(input); - if (!parsedColor) { throw new Error('Invalid color ' + input); } - - var output = colorDowngrade(parsedColor); - colorCache[input] = output; - return output; - - } else { - throw new Error('Invalid color ' + input); - } - -} - -function parseFunctionStopColor(stop) { - return [stop[0], parseColor(stop[1])]; -} - -function colorDowngrade(color) { - return [color[0] / 255, color[1] / 255, color[2] / 255, color[3] / 1]; -} - -module.exports = parseColor; - -},{"../util/util":119,"csscolorparser":121}],60:[function(require,module,exports){ + if (!cache[input]) { + var rgba = parseColorString(input); + if (!rgba) { + throw new Error('Invalid color ' + input); + } + cache[input] = [ + rgba[0] / 255 * rgba[3], + rgba[1] / 255 * rgba[3], + rgba[2] / 255 * rgba[3], + rgba[3] + ]; + } + return cache[input]; + } else { + throw new Error('Invalid color ' + input); + } +}; +},{"../util/util":136,"./style_function":74,"csscolorparser":138}],72:[function(require,module,exports){ 'use strict'; - var Evented = require('../util/evented'); var StyleLayer = require('./style_layer'); var ImageSprite = require('./image_sprite'); @@ -19964,67 +21964,56 @@ var Dispatcher = require('../util/dispatcher'); var AnimationLoop = require('./animation_loop'); var validateStyle = require('./validate_style'); var Source = require('../source/source'); +var QueryFeatures = require('../source/query_features'); +var SourceCache = require('../source/source_cache'); var styleSpec = require('./style_spec'); var StyleFunction = require('./style_function'); - module.exports = Style; - -function Style(stylesheet, animationLoop) { +function Style(stylesheet, animationLoop, workerCount) { this.animationLoop = animationLoop || new AnimationLoop(); - this.dispatcher = new Dispatcher(Math.max(browser.hardwareConcurrency - 1, 1), this); - this.spriteAtlas = new SpriteAtlas(512, 512); + this.dispatcher = new Dispatcher(workerCount || 1, this); + this.spriteAtlas = new SpriteAtlas(1024, 1024); this.lineAtlas = new LineAtlas(256, 512); - this._layers = {}; - this._order = []; + this._order = []; this._groups = []; this.sources = {}; this.zoomHistory = {}; - util.bindAll([ '_forwardSourceEvent', '_forwardTileEvent', '_forwardLayerEvent', '_redoPlacement' ], this); - this._resetUpdates(); - - var loaded = function(err, stylesheet) { + var stylesheetLoaded = function (err, stylesheet) { if (err) { - this.fire('error', {error: err}); + this.fire('error', { error: err }); return; } - - if (validateStyle.emitErrors(this, validateStyle(stylesheet))) return; - + if (validateStyle.emitErrors(this, validateStyle(stylesheet))) + return; this._loaded = true; this.stylesheet = stylesheet; - this.updateClasses(); - var sources = stylesheet.sources; for (var id in sources) { this.addSource(id, sources[id]); } - if (stylesheet.sprite) { this.sprite = new ImageSprite(stylesheet.sprite); this.sprite.on('load', this.fire.bind(this, 'change')); } - this.glyphSource = new GlyphSource(stylesheet.glyphs); this._resolve(); this.fire('load'); }.bind(this); - if (typeof stylesheet === 'string') { - ajax.getJSON(normalizeURL(stylesheet), loaded); + ajax.getJSON(normalizeURL(stylesheet), stylesheetLoaded); } else { - browser.frame(loaded.bind(this, null, stylesheet)); + browser.frame(stylesheetLoaded.bind(this, null, stylesheet)); } - - this.on('source.load', function(event) { + this.on('source.load', function (event) { var source = event.source; if (source && source.vectorLayerIds) { for (var layerId in this._layers) { @@ -20036,119 +22025,93 @@ function Style(stylesheet, animationLoop) { } }); } - Style.prototype = util.inherit(Evented, { _loaded: false, - - _validateLayer: function(layer) { + _validateLayer: function (layer) { var source = this.sources[layer.source]; - - if (!layer.sourceLayer) return; - if (!source) return; - if (!source.vectorLayerIds) return; - + if (!layer.sourceLayer) + return; + if (!source) + return; + if (!source.vectorLayerIds) + return; if (source.vectorLayerIds.indexOf(layer.sourceLayer) === -1) { - this.fire('error', { - error: new Error( - 'Source layer "' + layer.sourceLayer + '" ' + - 'does not exist on source "' + source.id + '" ' + - 'as specified by style layer "' + layer.id + '"' - ) - }); + this.fire('error', { error: new Error('Source layer "' + layer.sourceLayer + '" ' + 'does not exist on source "' + source.id + '" ' + 'as specified by style layer "' + layer.id + '"') }); } }, - - loaded: function() { + loaded: function () { if (!this._loaded) return false; - + if (Object.keys(this._updates.sources).length) + return false; for (var id in this.sources) if (!this.sources[id].loaded()) return false; - if (this.sprite && !this.sprite.loaded()) return false; - return true; }, - - _resolve: function() { + _resolve: function () { var layer, layerJSON; - this._layers = {}; - this._order = this.stylesheet.layers.map(function(layer) { + this._order = this.stylesheet.layers.map(function (layer) { return layer.id; }); - - // resolve all layers WITHOUT a ref for (var i = 0; i < this.stylesheet.layers.length; i++) { layerJSON = this.stylesheet.layers[i]; - if (layerJSON.ref) continue; + if (layerJSON.ref) + continue; layer = StyleLayer.create(layerJSON); this._layers[layer.id] = layer; layer.on('error', this._forwardLayerEvent); } - - // resolve all layers WITH a ref for (var j = 0; j < this.stylesheet.layers.length; j++) { layerJSON = this.stylesheet.layers[j]; - if (!layerJSON.ref) continue; + if (!layerJSON.ref) + continue; var refLayer = this.getLayer(layerJSON.ref); layer = StyleLayer.create(layerJSON, refLayer); this._layers[layer.id] = layer; layer.on('error', this._forwardLayerEvent); } - this._groupLayers(); this._updateWorkerLayers(); }, - - _groupLayers: function() { + _groupLayers: function () { var group; - this._groups = []; - - // Split into groups of consecutive top-level layers with the same source. for (var i = 0; i < this._order.length; ++i) { var layer = this._layers[this._order[i]]; - if (!group || layer.source !== group.source) { group = []; group.source = layer.source; this._groups.push(group); } - group.push(layer); } }, - - _updateWorkerLayers: function(ids) { + _updateWorkerLayers: function (ids) { this.dispatcher.broadcast(ids ? 'update layers' : 'set layers', this._serializeLayers(ids)); }, - - _serializeLayers: function(ids) { + _serializeLayers: function (ids) { ids = ids || this._order; var serialized = []; - var options = {includeRefProperties: true}; + var options = { includeRefProperties: true }; for (var i = 0; i < ids.length; i++) { serialized.push(this._layers[ids[i]].serialize(options)); } return serialized; }, - - _applyClasses: function(classes, options) { - if (!this._loaded) return; - + _applyClasses: function (classes, options) { + if (!this._loaded) + return; classes = classes || []; - options = options || {transition: true}; + options = options || { transition: true }; var transition = this.stylesheet.transition || {}; - var layers = this._updates.allPaintProps ? this._layers : this._updates.paintProps; - for (var id in layers) { var layer = this._layers[id]; var props = this._updates.paintProps[id]; - if (this._updates.allPaintProps || props.all) { layer.updatePaintTransitions(classes, options, transition, this.animationLoop); } else { @@ -20158,70 +22121,49 @@ Style.prototype = util.inherit(Evented, { } } }, - - _recalculate: function(z) { + _recalculate: function (z) { for (var sourceId in this.sources) this.sources[sourceId].used = false; - this._updateZoomHistory(z); - this.rasterFadeDuration = 300; for (var layerId in this._layers) { var layer = this._layers[layerId]; - layer.recalculate(z, this.zoomHistory); if (!layer.isHidden(z) && layer.source) { this.sources[layer.source].used = true; } } - var maxZoomTransitionDuration = 300; if (Math.floor(this.z) !== Math.floor(z)) { this.animationLoop.set(maxZoomTransitionDuration); } - this.z = z; this.fire('zoom'); }, - - _updateZoomHistory: function(z) { - + _updateZoomHistory: function (z) { var zh = this.zoomHistory; - if (zh.lastIntegerZoom === undefined) { - // first time zh.lastIntegerZoom = Math.floor(z); zh.lastIntegerZoomTime = 0; zh.lastZoom = z; } - - // check whether an integer zoom level as passed since the last frame - // and if yes, record it with the time. Used for transitioning patterns. if (Math.floor(zh.lastZoom) < Math.floor(z)) { zh.lastIntegerZoom = Math.floor(z); zh.lastIntegerZoomTime = Date.now(); - } else if (Math.floor(zh.lastZoom) > Math.floor(z)) { zh.lastIntegerZoom = Math.floor(z + 1); zh.lastIntegerZoomTime = Date.now(); } - zh.lastZoom = z; }, - _checkLoaded: function () { if (!this._loaded) { throw new Error('Style is not done loading'); } }, - - /** - * Apply queued style updates in a batch - * @private - */ - update: function(classes, options) { - if (!this._updates.changed) return this; - + update: function (classes, options) { + if (!this._updates.changed) + return this; if (this._updates.allLayers) { this._groupLayers(); this._updateWorkerLayers(); @@ -20231,30 +22173,23 @@ Style.prototype = util.inherit(Evented, { this._updateWorkerLayers(updatedIds); } } - var updatedSourceIds = Object.keys(this._updates.sources); var i; for (i = 0; i < updatedSourceIds.length; i++) { this._reloadSource(updatedSourceIds[i]); } - for (i = 0; i < this._updates.events.length; i++) { var args = this._updates.events[i]; this.fire(args[0], args[1]); } - this._applyClasses(classes, options); - if (this._updates.changed) { this.fire('change'); } - this._resetUpdates(); - return this; }, - - _resetUpdates: function() { + _resetUpdates: function () { this._updates = { events: [], layers: {}, @@ -20262,122 +22197,78 @@ Style.prototype = util.inherit(Evented, { paintProps: {} }; }, - - addSource: function(id, source) { + addSource: function (id, source) { this._checkLoaded(); if (this.sources[id] !== undefined) { throw new Error('There is already a source with this ID'); } - if (!Source.is(source) && this._handleErrors(validateStyle.source, 'sources.' + id, source)) return this; - - source = Source.create(source); + if (!source.type) { + throw new Error('The type property must be defined, but the only the following properties were given: ' + Object.keys(source) + '.'); + } + var builtIns = [ + 'vector', + 'raster', + 'geojson', + 'video', + 'image' + ]; + var shouldValidate = builtIns.indexOf(source.type) >= 0; + if (shouldValidate && this._handleErrors(validateStyle.source, 'sources.' + id, source)) + return this; + source = new SourceCache(id, source, this.dispatcher); this.sources[id] = source; - source.id = id; source.style = this; - source.dispatcher = this.dispatcher; - source - .on('load', this._forwardSourceEvent) - .on('error', this._forwardSourceEvent) - .on('change', this._forwardSourceEvent) - .on('tile.add', this._forwardTileEvent) - .on('tile.load', this._forwardTileEvent) - .on('tile.error', this._forwardTileEvent) - .on('tile.remove', this._forwardTileEvent) - .on('tile.stats', this._forwardTileEvent); - - this._updates.events.push(['source.add', {source: source}]); + source.on('load', this._forwardSourceEvent).on('error', this._forwardSourceEvent).on('change', this._forwardSourceEvent).on('tile.add', this._forwardTileEvent).on('tile.load', this._forwardTileEvent).on('tile.error', this._forwardTileEvent).on('tile.remove', this._forwardTileEvent).on('tile.stats', this._forwardTileEvent); + this._updates.events.push([ + 'source.add', + { source: source } + ]); this._updates.changed = true; - return this; }, - - /** - * Remove a source from this stylesheet, given its id. - * @param {string} id id of the source to remove - * @returns {Style} this style - * @throws {Error} if no source is found with the given ID - * @private - */ - removeSource: function(id) { + removeSource: function (id) { this._checkLoaded(); - if (this.sources[id] === undefined) { throw new Error('There is no source with this ID'); } var source = this.sources[id]; delete this.sources[id]; - source - .off('load', this._forwardSourceEvent) - .off('error', this._forwardSourceEvent) - .off('change', this._forwardSourceEvent) - .off('tile.add', this._forwardTileEvent) - .off('tile.load', this._forwardTileEvent) - .off('tile.error', this._forwardTileEvent) - .off('tile.remove', this._forwardTileEvent) - .off('tile.stats', this._forwardTileEvent); - - this._updates.events.push(['source.remove', {source: source}]); + delete this._updates.sources[id]; + source.off('load', this._forwardSourceEvent).off('error', this._forwardSourceEvent).off('change', this._forwardSourceEvent).off('tile.add', this._forwardTileEvent).off('tile.load', this._forwardTileEvent).off('tile.error', this._forwardTileEvent).off('tile.remove', this._forwardTileEvent).off('tile.stats', this._forwardTileEvent); + this._updates.events.push([ + 'source.remove', + { source: source } + ]); this._updates.changed = true; - return this; }, - - /** - * Get a source by id. - * @param {string} id id of the desired source - * @returns {Object} source - * @private - */ - getSource: function(id) { - return this.sources[id]; + getSource: function (id) { + return this.sources[id] && this.sources[id].getSource(); }, - - /** - * Add a layer to the map style. The layer will be inserted before the layer with - * ID `before`, or appended if `before` is omitted. - * @param {StyleLayer|Object} layer - * @param {string=} before ID of an existing layer to insert before - * @fires layer.add - * @returns {Style} `this` - * @private - */ - addLayer: function(layer, before) { + addLayer: function (layer, before) { this._checkLoaded(); - if (!(layer instanceof StyleLayer)) { - // this layer is not in the style.layers array, so we pass an impossible array index - if (this._handleErrors(validateStyle.layer, - 'layers.' + layer.id, layer, false, {arrayIndex: -1})) return this; - + if (this._handleErrors(validateStyle.layer, 'layers.' + layer.id, layer, false, { arrayIndex: -1 })) + return this; var refLayer = layer.ref && this.getLayer(layer.ref); layer = StyleLayer.create(layer, refLayer); } this._validateLayer(layer); - layer.on('error', this._forwardLayerEvent); - this._layers[layer.id] = layer; this._order.splice(before ? this._order.indexOf(before) : Infinity, 0, layer.id); - this._updates.allLayers = true; if (layer.source) { this._updates.sources[layer.source] = true; } - this._updates.events.push(['layer.add', {layer: layer}]); - + this._updates.events.push([ + 'layer.add', + { layer: layer } + ]); return this.updateClasses(layer.id); }, - - /** - * Remove a layer from this stylesheet, given its id. - * @param {string} id id of the layer to remove - * @returns {Style} this style - * @throws {Error} if no layer is found with the given ID - * @private - */ - removeLayer: function(id) { + removeLayer: function (id) { this._checkLoaded(); - var layer = this._layers[id]; if (layer === undefined) { throw new Error('There is no layer with this ID'); @@ -20387,53 +22278,34 @@ Style.prototype = util.inherit(Evented, { this.removeLayer(i); } } - layer.off('error', this._forwardLayerEvent); - delete this._layers[id]; + delete this._updates.layers[id]; + delete this._updates.paintProps[id]; this._order.splice(this._order.indexOf(id), 1); - this._updates.allLayers = true; - this._updates.events.push(['layer.remove', {layer: layer}]); + this._updates.events.push([ + 'layer.remove', + { layer: layer } + ]); this._updates.changed = true; - return this; }, - - /** - * Return the style layer object with the given `id`. - * - * @param {string} id - id of the desired layer - * @returns {?Object} a layer, if one with the given `id` exists - * @private - */ - getLayer: function(id) { + getLayer: function (id) { return this._layers[id]; }, - - /** - * If a layer has a `ref` property that makes it derive some values - * from another layer, return that referent layer. Otherwise, - * returns the layer itself. - * @param {string} id the layer's id - * @returns {Layer} the referent layer or the layer itself - * @private - */ - getReferentLayer: function(id) { + getReferentLayer: function (id) { var layer = this.getLayer(id); if (layer.ref) { layer = this.getLayer(layer.ref); } return layer; }, - - setLayerZoomRange: function(layerId, minzoom, maxzoom) { + setLayerZoomRange: function (layerId, minzoom, maxzoom) { this._checkLoaded(); - var layer = this.getReferentLayer(layerId); - - if (layer.minzoom === minzoom && layer.maxzoom === maxzoom) return this; - + if (layer.minzoom === minzoom && layer.maxzoom === maxzoom) + return this; if (minzoom != null) { layer.minzoom = minzoom; } @@ -20442,91 +22314,62 @@ Style.prototype = util.inherit(Evented, { } return this._updateLayer(layer); }, - - setFilter: function(layerId, filter) { + setFilter: function (layerId, filter) { this._checkLoaded(); - var layer = this.getReferentLayer(layerId); - - if (this._handleErrors(validateStyle.filter, 'layers.' + layer.id + '.filter', filter)) return this; - - if (util.deepEqual(layer.filter, filter)) return this; + if (filter !== null && this._handleErrors(validateStyle.filter, 'layers.' + layer.id + '.filter', filter)) + return this; + if (util.deepEqual(layer.filter, filter)) + return this; layer.filter = util.clone(filter); - return this._updateLayer(layer); }, - - /** - * Get a layer's filter object - * @param {string} layer the layer to inspect - * @returns {*} the layer's filter, if any - * @private - */ - getFilter: function(layer) { + getFilter: function (layer) { return this.getReferentLayer(layer).filter; }, - - setLayoutProperty: function(layerId, name, value) { + setLayoutProperty: function (layerId, name, value) { this._checkLoaded(); - var layer = this.getReferentLayer(layerId); - - if (util.deepEqual(layer.getLayoutProperty(name), value)) return this; - + if (util.deepEqual(layer.getLayoutProperty(name), value)) + return this; layer.setLayoutProperty(name, value); return this._updateLayer(layer); }, - - /** - * Get a layout property's value from a given layer - * @param {string} layer the layer to inspect - * @param {string} name the name of the layout property - * @returns {*} the property value - * @private - */ - getLayoutProperty: function(layer, name) { + getLayoutProperty: function (layer, name) { return this.getReferentLayer(layer).getLayoutProperty(name); }, - - setPaintProperty: function(layerId, name, value, klass) { + setPaintProperty: function (layerId, name, value, klass) { this._checkLoaded(); - var layer = this.getLayer(layerId); - - if (util.deepEqual(layer.getPaintProperty(name, klass), value)) return this; - + if (util.deepEqual(layer.getPaintProperty(name, klass), value)) + return this; var wasFeatureConstant = layer.isPaintValueFeatureConstant(name); layer.setPaintProperty(name, value, klass); - - var isFeatureConstant = !(StyleFunction.isFunctionDefinition(value) && value.property !== '$zoom' && value.property !== undefined); - + var isFeatureConstant = !(value && StyleFunction.isFunctionDefinition(value) && value.property !== '$zoom' && value.property !== undefined); if (!isFeatureConstant || !wasFeatureConstant) { this._updates.layers[layerId] = true; if (layer.source) { this._updates.sources[layer.source] = true; } } - return this.updateClasses(layerId, name); }, - - getPaintProperty: function(layer, name, klass) { + getPaintProperty: function (layer, name, klass) { return this.getLayer(layer).getPaintProperty(name, klass); }, - updateClasses: function (layerId, paintName) { this._updates.changed = true; if (!layerId) { this._updates.allPaintProps = true; } else { var props = this._updates.paintProps; - if (!props[layerId]) props[layerId] = {}; + if (!props[layerId]) + props[layerId] = {}; props[layerId][paintName || 'all'] = true; } return this; }, - - serialize: function() { + serialize: function () { return util.filterObject({ version: this.stylesheet.version, name: this.stylesheet.name, @@ -20538,15 +22381,16 @@ Style.prototype = util.inherit(Evented, { sprite: this.stylesheet.sprite, glyphs: this.stylesheet.glyphs, transition: this.stylesheet.transition, - sources: util.mapObject(this.sources, function(source) { + sources: util.mapObject(this.sources, function (source) { return source.serialize(); }), - layers: this._order.map(function(id) { + layers: this._order.map(function (id) { return this._layers[id].serialize(); }, this) - }, function(value) { return value !== undefined; }); + }, function (value) { + return value !== undefined; + }); }, - _updateLayer: function (layer) { this._updates.layers[layer.id] = true; if (layer.source) { @@ -20555,8 +22399,7 @@ Style.prototype = util.inherit(Evented, { this._updates.changed = true; return this; }, - - _flattenRenderedFeatures: function(sourceResults) { + _flattenRenderedFeatures: function (sourceResults) { var features = []; for (var l = this._order.length - 1; l >= 0; l--) { var layerID = this._order[l]; @@ -20571,31 +22414,48 @@ Style.prototype = util.inherit(Evented, { } return features; }, - - queryRenderedFeatures: function(queryGeometry, params, zoom, bearing) { + queryRenderedFeatures: function (queryGeometry, params, zoom, bearing) { if (params && params.filter) { this._handleErrors(validateStyle.filter, 'queryRenderedFeatures.filter', params.filter, true); } - + var includedSources = {}; + if (params && params.layers) { + for (var i = 0; i < params.layers.length; i++) { + var layerId = params.layers[i]; + includedSources[this._layers[layerId].source] = true; + } + } var sourceResults = []; for (var id in this.sources) { + if (params.layers && !includedSources[id]) + continue; var source = this.sources[id]; - if (source.queryRenderedFeatures) { - sourceResults.push(source.queryRenderedFeatures(queryGeometry, params, zoom, bearing)); - } + var results = QueryFeatures.rendered(source, this._layers, queryGeometry, params, zoom, bearing); + sourceResults.push(results); } return this._flattenRenderedFeatures(sourceResults); }, - - querySourceFeatures: function(sourceID, params) { + querySourceFeatures: function (sourceID, params) { if (params && params.filter) { this._handleErrors(validateStyle.filter, 'querySourceFeatures.filter', params.filter, true); } - var source = this.getSource(sourceID); - return source && source.querySourceFeatures ? source.querySourceFeatures(params) : []; + var source = this.sources[sourceID]; + return source ? QueryFeatures.source(source, params) : []; }, - - _handleErrors: function(validate, key, value, throws, props) { + addSourceType: function (name, SourceType, callback) { + if (Source.getType(name)) { + return callback(new Error('A source type called "' + name + '" already exists.')); + } + Source.setType(name, SourceType); + if (!SourceType.workerSourceURL) { + return callback(null, null); + } + this.dispatcher.broadcast('load worker source', { + name: name, + url: SourceType.workerSourceURL + }, callback); + }, + _handleErrors: function (validate, key, value, throws, props) { var action = throws ? validateStyle.throwErrors : validateStyle.emitErrors; var result = validate.call(validateStyle, util.extend({ key: key, @@ -20605,114 +22465,93 @@ Style.prototype = util.inherit(Evented, { }, props)); return action.call(validateStyle, this, result); }, - - _remove: function() { + _remove: function () { this.dispatcher.remove(); }, - - _reloadSource: function(id) { + _reloadSource: function (id) { this.sources[id].reload(); }, - - _updateSources: function(transform) { + _updateSources: function (transform) { for (var id in this.sources) { this.sources[id].update(transform); } }, - - _redoPlacement: function() { + _redoPlacement: function () { for (var id in this.sources) { - if (this.sources[id].redoPlacement) this.sources[id].redoPlacement(); + if (this.sources[id].redoPlacement) + this.sources[id].redoPlacement(); } }, - - _forwardSourceEvent: function(e) { - this.fire('source.' + e.type, util.extend({source: e.target}, e)); + _forwardSourceEvent: function (e) { + this.fire('source.' + e.type, util.extend({ source: e.target.getSource() }, e)); }, - - _forwardTileEvent: function(e) { - this.fire(e.type, util.extend({source: e.target}, e)); + _forwardTileEvent: function (e) { + this.fire(e.type, util.extend({ source: e.target }, e)); }, - - _forwardLayerEvent: function(e) { - this.fire('layer.' + e.type, util.extend({layer: {id: e.target.id}}, e)); + _forwardLayerEvent: function (e) { + this.fire('layer.' + e.type, util.extend({ layer: { id: e.target.id } }, e)); }, - - // Callbacks from web workers - - 'get sprite json': function(params, callback) { + 'get sprite json': function (params, callback) { var sprite = this.sprite; if (sprite.loaded()) { - callback(null, { sprite: sprite.data, retina: sprite.retina }); + callback(null, { + sprite: sprite.data, + retina: sprite.retina + }); } else { - sprite.on('load', function() { - callback(null, { sprite: sprite.data, retina: sprite.retina }); + sprite.on('load', function () { + callback(null, { + sprite: sprite.data, + retina: sprite.retina + }); }); } }, - - 'get icons': function(params, callback) { + 'get icons': function (params, callback) { var sprite = this.sprite; var spriteAtlas = this.spriteAtlas; if (sprite.loaded()) { spriteAtlas.setSprite(sprite); spriteAtlas.addIcons(params.icons, callback); } else { - sprite.on('load', function() { + sprite.on('load', function () { spriteAtlas.setSprite(sprite); spriteAtlas.addIcons(params.icons, callback); }); } }, - - 'get glyphs': function(params, callback) { - var stacks = params.stacks, - remaining = Object.keys(stacks).length, - allGlyphs = {}; - + 'get glyphs': function (params, callback) { + var stacks = params.stacks, remaining = Object.keys(stacks).length, allGlyphs = {}; for (var fontName in stacks) { this.glyphSource.getSimpleGlyphs(fontName, stacks[fontName], params.uid, done); } - function done(err, glyphs, fontName) { - if (err) console.error(err); - + if (err) + console.error(err); allGlyphs[fontName] = glyphs; remaining--; - if (remaining === 0) callback(null, allGlyphs); } } }); - -},{"../render/line_atlas":40,"../source/source":49,"../symbol/glyph_source":81,"../symbol/sprite_atlas":86,"../util/ajax":104,"../util/browser":105,"../util/dispatcher":107,"../util/evented":111,"../util/mapbox":116,"../util/util":119,"./animation_loop":57,"./image_sprite":58,"./style_function":62,"./style_layer":63,"./style_spec":70,"./validate_style":72}],61:[function(require,module,exports){ +},{"../render/line_atlas":48,"../source/query_features":58,"../source/source":60,"../source/source_cache":61,"../symbol/glyph_source":93,"../symbol/sprite_atlas":98,"../util/ajax":119,"../util/browser":120,"../util/dispatcher":127,"../util/evented":128,"../util/mapbox":133,"../util/util":136,"./animation_loop":69,"./image_sprite":70,"./style_function":74,"./style_layer":75,"./style_spec":82,"./validate_style":84}],73:[function(require,module,exports){ 'use strict'; - var MapboxGLFunction = require('./style_function'); var parseColor = require('./parse_color'); var util = require('../util/util'); - module.exports = StyleDeclaration; - function StyleDeclaration(reference, value) { - this.type = reference.type; - this.transitionable = reference.transition; this.value = util.clone(value); - this.isFunction = !!value.stops; - - // immutable representation of value. used for comparison + this.isFunction = MapboxGLFunction.isFunctionDefinition(value); this.json = JSON.stringify(this.value); - - var parsedValue = this.type === 'color' ? parseColor(this.value) : value; + var parsedValue = reference.type === 'color' && this.value ? parseColor(this.value) : value; this.calculate = MapboxGLFunction[reference.function || 'piecewise-constant'](parsedValue); this.isFeatureConstant = this.calculate.isFeatureConstant; this.isZoomConstant = this.calculate.isZoomConstant; - if (reference.function === 'piecewise-constant' && reference.transition) { this.calculate = transitioned(this.calculate); } - if (!this.isFeatureConstant && !this.isZoomConstant) { this.stopZoomLevels = []; var interpolationAmountStops = []; @@ -20721,81 +22560,76 @@ function StyleDeclaration(reference, value) { var zoom = stops[i][0].zoom; if (this.stopZoomLevels.indexOf(zoom) < 0) { this.stopZoomLevels.push(zoom); - interpolationAmountStops.push([zoom, interpolationAmountStops.length]); + interpolationAmountStops.push([ + zoom, + interpolationAmountStops.length + ]); } } - this.calculateInterpolationT = MapboxGLFunction.interpolated({ stops: interpolationAmountStops, base: value.base }); } } - function transitioned(calculate) { - return function(globalProperties, featureProperties) { + return function (globalProperties, featureProperties) { var z = globalProperties.zoom; var zh = globalProperties.zoomHistory; var duration = globalProperties.duration; - var fraction = z % 1; var t = Math.min((Date.now() - zh.lastIntegerZoomTime) / duration, 1); var fromScale = 1; var toScale = 1; var mix, from, to; - if (z > zh.lastIntegerZoom) { mix = fraction + (1 - fraction) * t; fromScale *= 2; - from = calculate({zoom: z - 1}, featureProperties); - to = calculate({zoom: z}, featureProperties); + from = calculate({ zoom: z - 1 }, featureProperties); + to = calculate({ zoom: z }, featureProperties); } else { mix = 1 - (1 - t) * fraction; - to = calculate({zoom: z}, featureProperties); - from = calculate({zoom: z + 1}, featureProperties); + to = calculate({ zoom: z }, featureProperties); + from = calculate({ zoom: z + 1 }, featureProperties); fromScale /= 2; } - - return { - from: from, - fromScale: fromScale, - to: to, - toScale: toScale, - t: mix - }; + if (from === undefined || to === undefined) { + return undefined; + } else { + return { + from: from, + fromScale: fromScale, + to: to, + toScale: toScale, + t: mix + }; + } }; } - -},{"../util/util":119,"./parse_color":59,"./style_function":62}],62:[function(require,module,exports){ +},{"../util/util":136,"./parse_color":71,"./style_function":74}],74:[function(require,module,exports){ 'use strict'; - var MapboxGLFunction = require('mapbox-gl-function'); - -exports.interpolated = function(parameters) { +exports.interpolated = function (parameters) { var inner = MapboxGLFunction.interpolated(parameters); - var outer = function(globalProperties, featureProperties) { + var outer = function (globalProperties, featureProperties) { return inner(globalProperties && globalProperties.zoom, featureProperties || {}); }; outer.isFeatureConstant = inner.isFeatureConstant; outer.isZoomConstant = inner.isZoomConstant; return outer; }; - -exports['piecewise-constant'] = function(parameters) { +exports['piecewise-constant'] = function (parameters) { var inner = MapboxGLFunction['piecewise-constant'](parameters); - var outer = function(globalProperties, featureProperties) { + var outer = function (globalProperties, featureProperties) { return inner(globalProperties && globalProperties.zoom, featureProperties || {}); }; outer.isFeatureConstant = inner.isFeatureConstant; outer.isZoomConstant = inner.isZoomConstant; return outer; }; - exports.isFunctionDefinition = MapboxGLFunction.isFunctionDefinition; - -},{"mapbox-gl-function":144}],63:[function(require,module,exports){ +},{"mapbox-gl-function":163}],75:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var StyleTransition = require('./style_transition'); var StyleDeclaration = require('./style_declaration'); @@ -20803,12 +22637,9 @@ var styleSpec = require('./style_spec'); var validateStyle = require('./validate_style'); var parseColor = require('./parse_color'); var Evented = require('../util/evented'); - module.exports = StyleLayer; - var TRANSITION_SUFFIX = '-transition'; - -StyleLayer.create = function(layer, refLayer) { +StyleLayer.create = function (layer, refLayer) { var Classes = { background: require('./style_layer/background_style_layer'), circle: require('./style_layer/circle_style_layer'), @@ -20819,14 +22650,11 @@ StyleLayer.create = function(layer, refLayer) { }; return new Classes[(refLayer || layer).type](layer, refLayer); }; - function StyleLayer(layer, refLayer) { this.set(layer, refLayer); } - StyleLayer.prototype = util.inherit(Evented, { - - set: function(layer, refLayer) { + set: function (layer, refLayer) { this.id = layer.id; this.ref = layer.ref; this.metadata = layer.metadata; @@ -20836,22 +22664,16 @@ StyleLayer.prototype = util.inherit(Evented, { this.minzoom = (refLayer || layer).minzoom; this.maxzoom = (refLayer || layer).maxzoom; this.filter = (refLayer || layer).filter; - this.paint = {}; this.layout = {}; - this._paintSpecifications = styleSpec['paint_' + this.type]; this._layoutSpecifications = styleSpec['layout_' + this.type]; - - this._paintTransitions = {}; // {[propertyName]: StyleTransition} - this._paintTransitionOptions = {}; // {[className]: {[propertyName]: { duration:Number, delay:Number }}} - this._paintDeclarations = {}; // {[className]: {[propertyName]: StyleDeclaration}} - this._layoutDeclarations = {}; // {[propertyName]: StyleDeclaration} - this._layoutFunctions = {}; // {[propertyName]: Boolean} - + this._paintTransitions = {}; + this._paintTransitionOptions = {}; + this._paintDeclarations = {}; + this._layoutDeclarations = {}; + this._layoutFunctions = {}; var paintName, layoutName; - - // Resolve paint declarations for (var key in layer) { var match = key.match(/^paint(?:\.(.*))?$/); if (match) { @@ -20861,8 +22683,6 @@ StyleLayer.prototype = util.inherit(Evented, { } } } - - // Resolve layout declarations if (this.ref) { this._layoutDeclarations = refLayer._layoutDeclarations; } else { @@ -20870,8 +22690,6 @@ StyleLayer.prototype = util.inherit(Evented, { this.setLayoutProperty(layoutName, layer.layout[layoutName]); } } - - // set initial layout/paint values for (paintName in this._paintSpecifications) { this.paint[paintName] = this.getPaintValue(paintName); } @@ -20879,40 +22697,31 @@ StyleLayer.prototype = util.inherit(Evented, { this._updateLayoutValue(layoutName); } }, - - setLayoutProperty: function(name, value) { - + setLayoutProperty: function (name, value) { if (value == null) { delete this._layoutDeclarations[name]; } else { var key = 'layers.' + this.id + '.layout.' + name; - if (this._handleErrors(validateStyle.layoutProperty, key, name, value)) return; + if (this._handleErrors(validateStyle.layoutProperty, key, name, value)) + return; this._layoutDeclarations[name] = new StyleDeclaration(this._layoutSpecifications[name], value); } this._updateLayoutValue(name); }, - - getLayoutProperty: function(name) { - return ( - this._layoutDeclarations[name] && - this._layoutDeclarations[name].value - ); + getLayoutProperty: function (name) { + return this._layoutDeclarations[name] && this._layoutDeclarations[name].value; }, - - getLayoutValue: function(name, globalProperties, featureProperties) { + getLayoutValue: function (name, globalProperties, featureProperties) { var specification = this._layoutSpecifications[name]; var declaration = this._layoutDeclarations[name]; - if (declaration) { return declaration.calculate(globalProperties, featureProperties); } else { return specification.default; } }, - - setPaintProperty: function(name, value, klass) { + setPaintProperty: function (name, value, klass) { var validateStyleKey = 'layers.' + this.id + (klass ? '["paint.' + klass + '"].' : '.paint.') + name; - if (util.endsWith(name, TRANSITION_SUFFIX)) { if (!this._paintTransitionOptions[klass || '']) { this._paintTransitionOptions[klass || ''] = {}; @@ -20920,7 +22729,8 @@ StyleLayer.prototype = util.inherit(Evented, { if (value === null || value === undefined) { delete this._paintTransitionOptions[klass || ''][name]; } else { - if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) return; + if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) + return; this._paintTransitionOptions[klass || ''][name] = value; } } else { @@ -20930,32 +22740,23 @@ StyleLayer.prototype = util.inherit(Evented, { if (value === null || value === undefined) { delete this._paintDeclarations[klass || ''][name]; } else { - if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) return; + if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) + return; this._paintDeclarations[klass || ''][name] = new StyleDeclaration(this._paintSpecifications[name], value); } } }, - - getPaintProperty: function(name, klass) { + getPaintProperty: function (name, klass) { klass = klass || ''; if (util.endsWith(name, TRANSITION_SUFFIX)) { - return ( - this._paintTransitionOptions[klass] && - this._paintTransitionOptions[klass][name] - ); + return this._paintTransitionOptions[klass] && this._paintTransitionOptions[klass][name]; } else { - return ( - this._paintDeclarations[klass] && - this._paintDeclarations[klass][name] && - this._paintDeclarations[klass][name].value - ); + return this._paintDeclarations[klass] && this._paintDeclarations[klass][name] && this._paintDeclarations[klass][name].value; } }, - - getPaintValue: function(name, globalProperties, featureProperties) { + getPaintValue: function (name, globalProperties, featureProperties) { var specification = this._paintSpecifications[name]; var transition = this._paintTransitions[name]; - if (transition) { return transition.calculate(globalProperties, featureProperties); } else if (specification.type === 'color' && specification.default) { @@ -20964,8 +22765,7 @@ StyleLayer.prototype = util.inherit(Evented, { return specification.default; } }, - - getPaintValueStopZoomLevels: function(name) { + getPaintValueStopZoomLevels: function (name) { var transition = this._paintTransitions[name]; if (transition) { return transition.declaration.stopZoomLevels; @@ -20973,58 +22773,60 @@ StyleLayer.prototype = util.inherit(Evented, { return []; } }, - - getPaintInterpolationT: function(name, zoom) { + getPaintInterpolationT: function (name, zoom) { var transition = this._paintTransitions[name]; return transition.declaration.calculateInterpolationT({ zoom: zoom }); }, - - isPaintValueFeatureConstant: function(name) { + isPaintValueFeatureConstant: function (name) { var transition = this._paintTransitions[name]; - if (transition) { return transition.declaration.isFeatureConstant; } else { return true; } }, - - isPaintValueZoomConstant: function(name) { + isLayoutValueFeatureConstant: function (name) { + var declaration = this._layoutDeclarations[name]; + if (declaration) { + return declaration.isFeatureConstant; + } else { + return true; + } + }, + isPaintValueZoomConstant: function (name) { var transition = this._paintTransitions[name]; - if (transition) { return transition.declaration.isZoomConstant; } else { return true; } }, - - - isHidden: function(zoom) { - if (this.minzoom && zoom < this.minzoom) return true; - if (this.maxzoom && zoom >= this.maxzoom) return true; - if (this.layout['visibility'] === 'none') return true; - if (this.paint[this.type + '-opacity'] === 0) return true; + isHidden: function (zoom) { + if (this.minzoom && zoom < this.minzoom) + return true; + if (this.maxzoom && zoom >= this.maxzoom) + return true; + if (this.layout['visibility'] === 'none') + return true; + if (this.paint[this.type + '-opacity'] === 0) + return true; return false; }, - - updatePaintTransitions: function(classes, options, globalOptions, animationLoop) { + updatePaintTransitions: function (classes, options, globalOptions, animationLoop) { var declarations = util.extend({}, this._paintDeclarations['']); for (var i = 0; i < classes.length; i++) { util.extend(declarations, this._paintDeclarations[classes[i]]); } - var name; - for (name in declarations) { // apply new declarations + for (name in declarations) { this._applyPaintDeclaration(name, declarations[name], options, globalOptions, animationLoop); } for (name in this._paintTransitions) { - if (!(name in declarations)) // apply removed declarations + if (!(name in declarations)) this._applyPaintDeclaration(name, null, options, globalOptions, animationLoop); } }, - - updatePaintTransition: function(name, classes, options, globalOptions, animationLoop) { + updatePaintTransition: function (name, classes, options, globalOptions, animationLoop) { var declaration = this._paintDeclarations[''][name]; for (var i = 0; i < classes.length; i++) { var classPaintDeclarations = this._paintDeclarations[classes[i]]; @@ -21034,18 +22836,21 @@ StyleLayer.prototype = util.inherit(Evented, { } this._applyPaintDeclaration(name, declaration, options, globalOptions, animationLoop); }, - - // update all zoom-dependent layout/paint values - recalculate: function(zoom, zoomHistory) { + recalculate: function (zoom, zoomHistory) { for (var paintName in this._paintTransitions) { - this.paint[paintName] = this.getPaintValue(paintName, {zoom: zoom, zoomHistory: zoomHistory}); + this.paint[paintName] = this.getPaintValue(paintName, { + zoom: zoom, + zoomHistory: zoomHistory + }); } for (var layoutName in this._layoutFunctions) { - this.layout[layoutName] = this.getLayoutValue(layoutName, {zoom: zoom, zoomHistory: zoomHistory}); + this.layout[layoutName] = this.getLayoutValue(layoutName, { + zoom: zoom, + zoomHistory: zoomHistory + }); } }, - - serialize: function(options) { + serialize: function (options) { var output = { 'id': this.id, 'ref': this.ref, @@ -21053,13 +22858,11 @@ StyleLayer.prototype = util.inherit(Evented, { 'minzoom': this.minzoom, 'maxzoom': this.maxzoom }; - for (var klass in this._paintDeclarations) { var key = klass === '' ? 'paint' : 'paint.' + klass; output[key] = util.mapObject(this._paintDeclarations[klass], getDeclarationValue); } - - if (!this.ref || (options && options.includeRefProperties)) { + if (!this.ref || options && options.includeRefProperties) { util.extend(output, { 'type': this.type, 'source': this.source, @@ -21068,31 +22871,23 @@ StyleLayer.prototype = util.inherit(Evented, { 'layout': util.mapObject(this._layoutDeclarations, getDeclarationValue) }); } - - return util.filterObject(output, function(value, key) { + return util.filterObject(output, function (value, key) { return value !== undefined && !(key === 'layout' && !Object.keys(value).length); }); }, - - // set paint transition based on a given paint declaration _applyPaintDeclaration: function (name, declaration, options, globalOptions, animationLoop) { var oldTransition = options.transition ? this._paintTransitions[name] : undefined; - + var spec = this._paintSpecifications[name]; if (declaration === null || declaration === undefined) { - var spec = this._paintSpecifications[name]; declaration = new StyleDeclaration(spec, spec.default); } - - if (oldTransition && oldTransition.declaration.json === declaration.json) return; - + if (oldTransition && oldTransition.declaration.json === declaration.json) + return; var transitionOptions = util.extend({ duration: 300, delay: 0 }, globalOptions, this.getPaintProperty(name + TRANSITION_SUFFIX)); - - var newTransition = this._paintTransitions[name] = - new StyleTransition(declaration, oldTransition, transitionOptions); - + var newTransition = this._paintTransitions[name] = new StyleTransition(spec, declaration, oldTransition, transitionOptions); if (!newTransition.instant()) { newTransition.loopID = animationLoop.set(newTransition.endTime - Date.now()); } @@ -21100,11 +22895,8 @@ StyleLayer.prototype = util.inherit(Evented, { animationLoop.cancel(oldTransition.loopID); } }, - - // update layout value if it's constant, or mark it as zoom-dependent - _updateLayoutValue: function(name) { + _updateLayoutValue: function (name) { var declaration = this._layoutDeclarations[name]; - if (declaration && declaration.isFunction) { this._layoutFunctions[name] = true; } else { @@ -21112,244 +22904,206 @@ StyleLayer.prototype = util.inherit(Evented, { this.layout[name] = this.getLayoutValue(name); } }, - - _handleErrors: function(validate, key, name, value) { + _handleErrors: function (validate, key, name, value) { return validateStyle.emitErrors(this, validate.call(validateStyle, { key: key, layerType: this.type, objectKey: name, value: value, styleSpec: styleSpec, - // Workaround for https://github.com/mapbox/mapbox-gl-js/issues/2407 - style: {glyphs: true, sprite: true} + style: { + glyphs: true, + sprite: true + } })); } }); - function getDeclarationValue(declaration) { return declaration.value; } - -},{"../util/evented":111,"../util/util":119,"./parse_color":59,"./style_declaration":61,"./style_layer/background_style_layer":64,"./style_layer/circle_style_layer":65,"./style_layer/fill_style_layer":66,"./style_layer/line_style_layer":67,"./style_layer/raster_style_layer":68,"./style_layer/symbol_style_layer":69,"./style_spec":70,"./style_transition":71,"./validate_style":72}],64:[function(require,module,exports){ +},{"../util/evented":128,"../util/util":136,"./parse_color":71,"./style_declaration":73,"./style_layer/background_style_layer":76,"./style_layer/circle_style_layer":77,"./style_layer/fill_style_layer":78,"./style_layer/line_style_layer":79,"./style_layer/raster_style_layer":80,"./style_layer/symbol_style_layer":81,"./style_spec":82,"./style_transition":83,"./validate_style":84}],76:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function BackgroundStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = BackgroundStyleLayer; - BackgroundStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":119,"../style_layer":63}],65:[function(require,module,exports){ +},{"../../util/util":136,"../style_layer":75}],77:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function CircleStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = CircleStyleLayer; - CircleStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":119,"../style_layer":63}],66:[function(require,module,exports){ +},{"../../util/util":136,"../style_layer":75}],78:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function FillStyleLayer() { StyleLayer.apply(this, arguments); } - +FillStyleLayer.prototype = util.inherit(StyleLayer, { + getPaintValue: function (name, globalProperties, featureProperties) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.getPaintValue.call(this, 'fill-color', globalProperties, featureProperties); + } else { + return StyleLayer.prototype.getPaintValue.call(this, name, globalProperties, featureProperties); + } + }, + getPaintValueStopZoomLevels: function (name) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.getPaintValueStopZoomLevels.call(this, 'fill-color'); + } else { + return StyleLayer.prototype.getPaintValueStopZoomLevels.call(this, arguments); + } + }, + getPaintInterpolationT: function (name, zoom) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.getPaintInterpolationT.call(this, 'fill-color', zoom); + } else { + return StyleLayer.prototype.getPaintInterpolationT.call(this, name, zoom); + } + }, + isPaintValueFeatureConstant: function (name) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.isPaintValueFeatureConstant.call(this, 'fill-color'); + } else { + return StyleLayer.prototype.isPaintValueFeatureConstant.call(this, name); + } + }, + isPaintValueZoomConstant: function (name) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.isPaintValueZoomConstant.call(this, 'fill-color'); + } else { + return StyleLayer.prototype.isPaintValueZoomConstant.call(this, name); + } + } +}); module.exports = FillStyleLayer; - -FillStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":119,"../style_layer":63}],67:[function(require,module,exports){ +},{"../../util/util":136,"../style_layer":75}],79:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function LineStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = LineStyleLayer; - LineStyleLayer.prototype = util.inherit(StyleLayer, { - - getPaintValue: function(name, globalProperties, featureProperties) { + getPaintValue: function (name, globalProperties, featureProperties) { var value = StyleLayer.prototype.getPaintValue.apply(this, arguments); - - // If the line is dashed, scale the dash lengths by the line - // width at the previous round zoom level. if (value && name === 'line-dasharray') { var flooredZoom = Math.floor(globalProperties.zoom); if (this._flooredZoom !== flooredZoom) { this._flooredZoom = flooredZoom; this._flooredLineWidth = this.getPaintValue('line-width', globalProperties, featureProperties); } - value.fromScale *= this._flooredLineWidth; value.toScale *= this._flooredLineWidth; } - return value; } }); - -},{"../../util/util":119,"../style_layer":63}],68:[function(require,module,exports){ +},{"../../util/util":136,"../style_layer":75}],80:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function RasterStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = RasterStyleLayer; - RasterStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":119,"../style_layer":63}],69:[function(require,module,exports){ +},{"../../util/util":136,"../style_layer":75}],81:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function SymbolStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = SymbolStyleLayer; - SymbolStyleLayer.prototype = util.inherit(StyleLayer, { - - isHidden: function() { - if (StyleLayer.prototype.isHidden.apply(this, arguments)) return true; - + isHidden: function () { + if (StyleLayer.prototype.isHidden.apply(this, arguments)) + return true; var isTextHidden = this.paint['text-opacity'] === 0 || !this.layout['text-field']; var isIconHidden = this.paint['icon-opacity'] === 0 || !this.layout['icon-image']; - if (isTextHidden && isIconHidden) return true; - + if (isTextHidden && isIconHidden) + return true; return false; }, - - getLayoutValue: function(name, globalProperties, featureProperties) { - if (name === 'text-rotation-alignment' && - this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && - !this.getLayoutProperty('text-rotation-alignment')) { + getLayoutValue: function (name, globalProperties, featureProperties) { + if (name === 'text-rotation-alignment' && this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && !this.getLayoutProperty('text-rotation-alignment')) { return 'map'; - } else if (name === 'icon-rotation-alignment' && - this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && - !this.getLayoutProperty('icon-rotation-alignment')) { + } else if (name === 'icon-rotation-alignment' && this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && !this.getLayoutProperty('icon-rotation-alignment')) { return 'map'; + } else if (name === 'text-pitch-alignment' && !this.getLayoutProperty('text-pitch-alignment')) { + return this.getLayoutValue('text-rotation-alignment'); } else { return StyleLayer.prototype.getLayoutValue.apply(this, arguments); } } - }); - -},{"../../util/util":119,"../style_layer":63}],70:[function(require,module,exports){ +},{"../../util/util":136,"../style_layer":75}],82:[function(require,module,exports){ 'use strict'; - module.exports = require('mapbox-gl-style-spec/reference/latest'); - -},{"mapbox-gl-style-spec/reference/latest":167}],71:[function(require,module,exports){ +},{"mapbox-gl-style-spec/reference/latest":186}],83:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var interpolate = require('../util/interpolate'); - module.exports = StyleTransition; - -/* - * Represents a transition between two declarations - */ -function StyleTransition(declaration, oldTransition, value) { - +function StyleTransition(reference, declaration, oldTransition, value) { this.declaration = declaration; - this.startTime = this.endTime = (new Date()).getTime(); - - var type = declaration.type; - if ((type === 'string' || type === 'array') && declaration.transitionable) { + this.startTime = this.endTime = new Date().getTime(); + if (reference.function === 'piecewise-constant' && reference.transition) { this.interp = interpZoomTransitioned; } else { - this.interp = interpolate[type]; + this.interp = interpolate[reference.type]; } - this.oldTransition = oldTransition; this.duration = value.duration || 0; this.delay = value.delay || 0; - if (!this.instant()) { this.endTime = this.startTime + this.duration + this.delay; this.ease = util.easeCubicInOut; } - if (oldTransition && oldTransition.endTime <= this.startTime) { - // Old transition is done running, so we can - // delete its reference to its old transition. - delete oldTransition.oldTransition; } } - -StyleTransition.prototype.instant = function() { - return !this.oldTransition || !this.interp || (this.duration === 0 && this.delay === 0); +StyleTransition.prototype.instant = function () { + return !this.oldTransition || !this.interp || this.duration === 0 && this.delay === 0; }; - -/* - * Return the value of the transitioning property at zoom level `z` and optional time `t` - */ -StyleTransition.prototype.calculate = function(globalProperties, featureProperties) { - var value = this.declaration.calculate( - util.extend({}, globalProperties, {duration: this.duration}), - featureProperties - ); - - if (this.instant()) return value; - +StyleTransition.prototype.calculate = function (globalProperties, featureProperties) { + var value = this.declaration.calculate(util.extend({}, globalProperties, { duration: this.duration }), featureProperties); + if (this.instant()) + return value; var t = globalProperties.time || Date.now(); - if (t < this.endTime) { - var oldValue = this.oldTransition.calculate( - util.extend({}, globalProperties, {time: this.startTime}), - featureProperties - ); + var oldValue = this.oldTransition.calculate(util.extend({}, globalProperties, { time: this.startTime }), featureProperties); var eased = this.ease((t - this.startTime - this.delay) / this.duration); value = this.interp(oldValue, value, eased); } - return value; - }; - function interpZoomTransitioned(from, to, t) { - return { - from: from.to, - fromScale: from.toScale, - to: to.to, - toScale: to.toScale, - t: t - }; + if ((from && from.to) === undefined || (to && to.to) === undefined) { + return undefined; + } else { + return { + from: from.to, + fromScale: from.toScale, + to: to.to, + toScale: to.toScale, + t: t + }; + } } - -},{"../util/interpolate":113,"../util/util":119}],72:[function(require,module,exports){ +},{"../util/interpolate":130,"../util/util":136}],84:[function(require,module,exports){ 'use strict'; - module.exports = require('mapbox-gl-style-spec/lib/validate_style.min'); - module.exports.emitErrors = function throwErrors(emitter, errors) { if (errors && errors.length) { for (var i = 0; i < errors.length; i++) { @@ -21360,7 +23114,6 @@ module.exports.emitErrors = function throwErrors(emitter, errors) { return false; } }; - module.exports.throwErrors = function throwErrors(emitter, errors) { if (errors) { for (var i = 0; i < errors.length; i++) { @@ -21368,140 +23121,77 @@ module.exports.throwErrors = function throwErrors(emitter, errors) { } } }; - -},{"mapbox-gl-style-spec/lib/validate_style.min":166}],73:[function(require,module,exports){ +},{"mapbox-gl-style-spec/lib/validate_style.min":185}],85:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - module.exports = Anchor; - function Anchor(x, y, angle, segment) { this.x = x; this.y = y; this.angle = angle; - if (segment !== undefined) { this.segment = segment; } } - Anchor.prototype = Object.create(Point.prototype); - -Anchor.prototype.clone = function() { +Anchor.prototype.clone = function () { return new Anchor(this.x, this.y, this.angle, this.segment); }; - -},{"point-geometry":174}],74:[function(require,module,exports){ +},{"point-geometry":194}],86:[function(require,module,exports){ 'use strict'; - module.exports = checkMaxAngle; - -/** - * Labels placed around really sharp angles aren't readable. Check if any - * part of the potential label has a combined angle that is too big. - * - * @param {Array} line - * @param {Anchor} anchor The point on the line around which the label is anchored. - * @param {number} labelLength The length of the label in geometry units. - * @param {number} windowSize The check fails if the combined angles within a part of the line that is `windowSize` long is too big. - * @param {number} maxAngle The maximum combined angle that any window along the label is allowed to have. - * - * @returns {boolean} whether the label should be placed - * @private - */ function checkMaxAngle(line, anchor, labelLength, windowSize, maxAngle) { - - // horizontal labels always pass - if (anchor.segment === undefined) return true; - + if (anchor.segment === undefined) + return true; var p = anchor; var index = anchor.segment + 1; var anchorDistance = 0; - - // move backwards along the line to the first segment the label appears on while (anchorDistance > -labelLength / 2) { index--; - - // there isn't enough room for the label after the beginning of the line - if (index < 0) return false; - + if (index < 0) + return false; anchorDistance -= line[index].dist(p); p = line[index]; } - anchorDistance += line[index].dist(line[index + 1]); index++; - - // store recent corners and their total angle difference var recentCorners = []; var recentAngleDelta = 0; - - // move forwards by the length of the label and check angles along the way while (anchorDistance < labelLength / 2) { var prev = line[index - 1]; var current = line[index]; var next = line[index + 1]; - - // there isn't enough room for the label before the end of the line - if (!next) return false; - + if (!next) + return false; var angleDelta = prev.angleTo(current) - current.angleTo(next); - // restrict angle to -pi..pi range - angleDelta = Math.abs(((angleDelta + 3 * Math.PI) % (Math.PI * 2)) - Math.PI); - + angleDelta = Math.abs((angleDelta + 3 * Math.PI) % (Math.PI * 2) - Math.PI); recentCorners.push({ distance: anchorDistance, angleDelta: angleDelta }); recentAngleDelta += angleDelta; - - // remove corners that are far enough away from the list of recent anchors while (anchorDistance - recentCorners[0].distance > windowSize) { recentAngleDelta -= recentCorners.shift().angleDelta; } - - // the sum of angles within the window area exceeds the maximum allowed value. check fails. - if (recentAngleDelta > maxAngle) return false; - + if (recentAngleDelta > maxAngle) + return false; index++; anchorDistance += current.dist(next); } - - // no part of the line had an angle greater than the maximum allowed. check passes. return true; } - -},{}],75:[function(require,module,exports){ +},{}],87:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - module.exports = clipLine; - -/** - * Returns the part of a multiline that intersects with the provided rectangular box. - * - * @param {Array>} lines - * @param {number} x1 the left edge of the box - * @param {number} y1 the top edge of the box - * @param {number} x2 the right edge of the box - * @param {number} y2 the bottom edge of the box - * @returns {Array>} lines - * @private - */ function clipLine(lines, x1, y1, x2, y2) { var clippedLines = []; - for (var l = 0; l < lines.length; l++) { var line = lines[l]; var clippedLine; - for (var i = 0; i < line.length - 1; i++) { var p0 = line[i]; var p1 = line[i + 1]; - - if (p0.x < x1 && p1.x < x1) { continue; } else if (p0.x < x1) { @@ -21509,7 +23199,6 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.x < x1) { p1 = new Point(x1, p0.y + (p1.y - p0.y) * ((x1 - p0.x) / (p1.x - p0.x)))._round(); } - if (p0.y < y1 && p1.y < y1) { continue; } else if (p0.y < y1) { @@ -21517,7 +23206,6 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.y < y1) { p1 = new Point(p0.x + (p1.x - p0.x) * ((y1 - p0.y) / (p1.y - p0.y)), y1)._round(); } - if (p0.x >= x2 && p1.x >= x2) { continue; } else if (p0.x >= x2) { @@ -21525,7 +23213,6 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.x >= x2) { p1 = new Point(x2, p0.y + (p1.y - p0.y) * ((x2 - p0.x) / (p1.x - p0.x)))._round(); } - if (p0.y >= y2 && p1.y >= y2) { continue; } else if (p0.y >= y2) { @@ -21533,253 +23220,160 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.y >= y2) { p1 = new Point(p0.x + (p1.x - p0.x) * ((y2 - p0.y) / (p1.y - p0.y)), y2)._round(); } - if (!clippedLine || !p0.equals(clippedLine[clippedLine.length - 1])) { clippedLine = [p0]; clippedLines.push(clippedLine); } - clippedLine.push(p1); } } - return clippedLines; } - -},{"point-geometry":174}],76:[function(require,module,exports){ +},{"point-geometry":194}],88:[function(require,module,exports){ 'use strict'; - var StructArrayType = require('../util/struct_array'); var util = require('../util/util'); var Point = require('point-geometry'); - -/** - * A collision box represents an area of the map that that is covered by a - * label. CollisionFeature uses one or more of these collision boxes to - * represent all the area covered by a single label. They are used to - * prevent collisions between labels. - * - * A collision box actually represents a 3d volume. The first two dimensions, - * x and y, are specified with `anchor` along with `x1`, `y1`, `x2`, `y2`. - * The third dimension, zoom, is limited by `maxScale` which determines - * how far in the z dimensions the box extends. - * - * As you zoom in on a map, all points on the map get further and further apart - * but labels stay roughly the same size. Labels cover less real world area on - * the map at higher zoom levels than they do at lower zoom levels. This is why - * areas are are represented with an anchor point and offsets from that point - * instead of just using four absolute points. - * - * Line labels are represented by a set of these boxes spaced out along a line. - * When you zoom in, line labels cover less real world distance along the line - * than they used to. Collision boxes near the edges that used to cover label - * no longer do. If a box doesn't cover the label anymore it should be ignored - * when doing collision checks. `maxScale` is how much you can scale the map - * before the label isn't within the box anymore. - * For example - * lower zoom: - * https://cloud.githubusercontent.com/assets/1421652/8060094/4d975f76-0e91-11e5-84b1-4edeb30a5875.png - * slightly higher zoom: - * https://cloud.githubusercontent.com/assets/1421652/8060061/26ae1c38-0e91-11e5-8c5a-9f380bf29f0a.png - * In the zoomed in image the two grey boxes on either side don't cover the - * label anymore. Their maxScale is smaller than the current scale. - * - * - * @class CollisionBoxArray - * @private - */ - var CollisionBoxArray = module.exports = new StructArrayType({ members: [ - // the box is centered around the anchor point - { type: 'Int16', name: 'anchorPointX' }, - { type: 'Int16', name: 'anchorPointY' }, - - // distances to the edges from the anchor - { type: 'Int16', name: 'x1' }, - { type: 'Int16', name: 'y1' }, - { type: 'Int16', name: 'x2' }, - { type: 'Int16', name: 'y2' }, - - // the box is only valid for scales < maxScale. - // The box does not block other boxes at scales >= maxScale; - { type: 'Float32', name: 'maxScale' }, - - // the index of the feature in the original vectortile - { type: 'Uint32', name: 'featureIndex' }, - // the source layer the feature appears in - { type: 'Uint16', name: 'sourceLayerIndex' }, - // the bucket the feature appears in - { type: 'Uint16', name: 'bucketIndex' }, - - // rotated and scaled bbox used for indexing - { type: 'Int16', name: 'bbox0' }, - { type: 'Int16', name: 'bbox1' }, - { type: 'Int16', name: 'bbox2' }, - { type: 'Int16', name: 'bbox3' }, - - { type: 'Float32', name: 'placementScale' } - ]}); - + { + type: 'Int16', + name: 'anchorPointX' + }, + { + type: 'Int16', + name: 'anchorPointY' + }, + { + type: 'Int16', + name: 'x1' + }, + { + type: 'Int16', + name: 'y1' + }, + { + type: 'Int16', + name: 'x2' + }, + { + type: 'Int16', + name: 'y2' + }, + { + type: 'Float32', + name: 'maxScale' + }, + { + type: 'Uint32', + name: 'featureIndex' + }, + { + type: 'Uint16', + name: 'sourceLayerIndex' + }, + { + type: 'Uint16', + name: 'bucketIndex' + }, + { + type: 'Int16', + name: 'bbox0' + }, + { + type: 'Int16', + name: 'bbox1' + }, + { + type: 'Int16', + name: 'bbox2' + }, + { + type: 'Int16', + name: 'bbox3' + }, + { + type: 'Float32', + name: 'placementScale' + } + ] +}); util.extendAll(CollisionBoxArray.prototype.StructType.prototype, { get anchorPoint() { return new Point(this.anchorPointX, this.anchorPointY); } }); - -},{"../util/struct_array":117,"../util/util":119,"point-geometry":174}],77:[function(require,module,exports){ +},{"../util/struct_array":134,"../util/util":136,"point-geometry":194}],89:[function(require,module,exports){ 'use strict'; - module.exports = CollisionFeature; - -/** - * A CollisionFeature represents the area of the tile covered by a single label. - * It is used with CollisionTile to check if the label overlaps with any - * previous labels. A CollisionFeature is mostly just a set of CollisionBox - * objects. - * - * @class CollisionFeature - * @param {Array} line The geometry the label is placed on. - * @param {Anchor} anchor The point along the line around which the label is anchored. - * @param {VectorTileFeature} feature The VectorTileFeature that this CollisionFeature was created for. - * @param {Array} layerIDs The IDs of the layers that this CollisionFeature is a part of. - * @param {Object} shaped The text or icon shaping results. - * @param {number} boxScale A magic number used to convert from glyph metrics units to geometry units. - * @param {number} padding The amount of padding to add around the label edges. - * @param {boolean} alignLine Whether the label is aligned with the line or the viewport. - * - * @private - */ function CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shaped, boxScale, padding, alignLine, straight) { - var y1 = shaped.top * boxScale - padding; var y2 = shaped.bottom * boxScale + padding; var x1 = shaped.left * boxScale - padding; var x2 = shaped.right * boxScale + padding; - this.boxStartIndex = collisionBoxArray.length; - if (alignLine) { - var height = y2 - y1; var length = x2 - x1; - if (height > 0) { - // set minimum box height to avoid very many small labels height = Math.max(10 * boxScale, height); - if (straight) { - // used for icon labels that are aligned with the line, but don't curve along it var vector = line[anchor.segment + 1].sub(line[anchor.segment])._unit()._mult(length); - var straightLine = [anchor.sub(vector), anchor.add(vector)]; + var straightLine = [ + anchor.sub(vector), + anchor.add(vector) + ]; this._addLineCollisionBoxes(collisionBoxArray, straightLine, anchor, 0, length, height, featureIndex, sourceLayerIndex, bucketIndex); } else { - // used for text labels that curve along a line this._addLineCollisionBoxes(collisionBoxArray, line, anchor, anchor.segment, length, height, featureIndex, sourceLayerIndex, bucketIndex); } } - } else { - collisionBoxArray.emplaceBack(anchor.x, anchor.y, x1, y1, x2, y2, Infinity, featureIndex, sourceLayerIndex, bucketIndex, - 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(anchor.x, anchor.y, x1, y1, x2, y2, Infinity, featureIndex, sourceLayerIndex, bucketIndex, 0, 0, 0, 0, 0); } - this.boxEndIndex = collisionBoxArray.length; } - -/** - * Create a set of CollisionBox objects for a line. - * - * @param {Array} line - * @param {Anchor} anchor - * @param {number} labelLength The length of the label in geometry units. - * @param {Anchor} anchor The point along the line around which the label is anchored. - * @param {VectorTileFeature} feature The VectorTileFeature that this CollisionFeature was created for. - * @param {number} boxSize The size of the collision boxes that will be created. - * - * @private - */ -CollisionFeature.prototype._addLineCollisionBoxes = function(collisionBoxArray, line, anchor, segment, labelLength, boxSize, featureIndex, sourceLayerIndex, bucketIndex) { +CollisionFeature.prototype._addLineCollisionBoxes = function (collisionBoxArray, line, anchor, segment, labelLength, boxSize, featureIndex, sourceLayerIndex, bucketIndex) { var step = boxSize / 2; var nBoxes = Math.floor(labelLength / step); - - // offset the center of the first box by half a box so that the edge of the - // box is at the edge of the label. var firstBoxOffset = -boxSize / 2; - var bboxes = this.boxes; - var p = anchor; var index = segment + 1; var anchorDistance = firstBoxOffset; - - // move backwards along the line to the first segment the label appears on do { index--; - - // there isn't enough room for the label after the beginning of the line - // checkMaxAngle should have already caught this - if (index < 0) return bboxes; - + if (index < 0) + return bboxes; anchorDistance -= line[index].dist(p); p = line[index]; } while (anchorDistance > -labelLength / 2); - var segmentLength = line[index].dist(line[index + 1]); - for (var i = 0; i < nBoxes; i++) { - // the distance the box will be from the anchor var boxDistanceToAnchor = -labelLength / 2 + i * step; - - // the box is not on the current segment. Move to the next segment. while (anchorDistance + segmentLength < boxDistanceToAnchor) { anchorDistance += segmentLength; index++; - - // There isn't enough room before the end of the line. - if (index + 1 >= line.length) return bboxes; - + if (index + 1 >= line.length) + return bboxes; segmentLength = line[index].dist(line[index + 1]); } - - // the distance the box will be from the beginning of the segment var segmentBoxDistance = boxDistanceToAnchor - anchorDistance; - var p0 = line[index]; var p1 = line[index + 1]; var boxAnchorPoint = p1.sub(p0)._unit()._mult(segmentBoxDistance)._add(p0)._round(); - var distanceToInnerEdge = Math.max(Math.abs(boxDistanceToAnchor - firstBoxOffset) - step / 2, 0); var maxScale = labelLength / 2 / distanceToInnerEdge; - - collisionBoxArray.emplaceBack(boxAnchorPoint.x, boxAnchorPoint.y, - -boxSize / 2, -boxSize / 2, boxSize / 2, boxSize / 2, maxScale, - featureIndex, sourceLayerIndex, bucketIndex, - 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(boxAnchorPoint.x, boxAnchorPoint.y, -boxSize / 2, -boxSize / 2, boxSize / 2, boxSize / 2, maxScale, featureIndex, sourceLayerIndex, bucketIndex, 0, 0, 0, 0, 0); } - return bboxes; }; - -},{}],78:[function(require,module,exports){ +},{}],90:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); var EXTENT = require('../data/bucket').EXTENT; var Grid = require('grid-index'); - module.exports = CollisionTile; - -/** - * A collision tile used to prevent symbols from overlapping. It keep tracks of - * where previous symbols have been placed and is used to check if a new - * symbol overlaps with any previously added symbols. - * - * @class CollisionTile - * @param {number} angle - * @param {number} pitch - * @private - */ function CollisionTile(angle, pitch, collisionBoxArray) { if (typeof angle === 'object') { var serialized = angle; @@ -21792,48 +23386,32 @@ function CollisionTile(angle, pitch, collisionBoxArray) { this.grid = new Grid(EXTENT, 12, 6); this.ignoredGrid = new Grid(EXTENT, 12, 0); } - this.angle = angle; this.pitch = pitch; - - var sin = Math.sin(angle), - cos = Math.cos(angle); - this.rotationMatrix = [cos, -sin, sin, cos]; - this.reverseRotationMatrix = [cos, sin, -sin, cos]; - - // Stretch boxes in y direction to account for the map tilt. + var sin = Math.sin(angle), cos = Math.cos(angle); + this.rotationMatrix = [ + cos, + -sin, + sin, + cos + ]; + this.reverseRotationMatrix = [ + cos, + sin, + -sin, + cos + ]; this.yStretch = 1 / Math.cos(pitch / 180 * Math.PI); - - // The amount the map is squished depends on the y position. - // Sort of account for this by making all boxes a bit bigger. this.yStretch = Math.pow(this.yStretch, 1.3); - this.collisionBoxArray = collisionBoxArray; if (collisionBoxArray.length === 0) { - // the first collisionBoxArray is passed to a CollisionTile - - // tempCollisionBox collisionBoxArray.emplaceBack(); - var maxInt16 = 32767; - //left - collisionBoxArray.emplaceBack(0, 0, 0, -maxInt16, 0, maxInt16, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); - // right - collisionBoxArray.emplaceBack(EXTENT, 0, 0, -maxInt16, 0, maxInt16, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); - // top - collisionBoxArray.emplaceBack(0, 0, -maxInt16, 0, maxInt16, 0, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); - // bottom - collisionBoxArray.emplaceBack(0, EXTENT, -maxInt16, 0, maxInt16, 0, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); + collisionBoxArray.emplaceBack(0, 0, 0, -maxInt16, 0, maxInt16, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(EXTENT, 0, 0, -maxInt16, 0, maxInt16, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(0, 0, -maxInt16, 0, maxInt16, 0, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(0, EXTENT, -maxInt16, 0, maxInt16, 0, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); } - this.tempCollisionBox = collisionBoxArray.get(0); this.edges = [ collisionBoxArray.get(1), @@ -21842,8 +23420,7 @@ function CollisionTile(angle, pitch, collisionBoxArray) { collisionBoxArray.get(4) ]; } - -CollisionTile.prototype.serialize = function() { +CollisionTile.prototype.serialize = function () { var data = { angle: this.angle, pitch: this.pitch, @@ -21852,71 +23429,51 @@ CollisionTile.prototype.serialize = function() { }; return { data: data, - transferables: [data.grid, data.ignoredGrid] + transferables: [ + data.grid, + data.ignoredGrid + ] }; }; - CollisionTile.prototype.minScale = 0.25; CollisionTile.prototype.maxScale = 2; - - -/** - * Find the scale at which the collisionFeature can be shown without - * overlapping with other features. - * - * @param {CollisionFeature} collisionFeature - * @returns {number} placementScale - * @private - */ -CollisionTile.prototype.placeCollisionFeature = function(collisionFeature, allowOverlap, avoidEdges) { - +CollisionTile.prototype.placeCollisionFeature = function (collisionFeature, allowOverlap, avoidEdges) { var collisionBoxArray = this.collisionBoxArray; var minPlacementScale = this.minScale; var rotationMatrix = this.rotationMatrix; var yStretch = this.yStretch; - for (var b = collisionFeature.boxStartIndex; b < collisionFeature.boxEndIndex; b++) { - var box = collisionBoxArray.get(b); - var anchorPoint = box.anchorPoint._matMult(rotationMatrix); var x = anchorPoint.x; var y = anchorPoint.y; - var x1 = x + box.x1; var y1 = y + box.y1 * yStretch; var x2 = x + box.x2; var y2 = y + box.y2 * yStretch; - box.bbox0 = x1; box.bbox1 = y1; box.bbox2 = x2; box.bbox3 = y2; - if (!allowOverlap) { var blockingBoxes = this.grid.query(x1, y1, x2, y2); - for (var i = 0; i < blockingBoxes.length; i++) { var blocking = collisionBoxArray.get(blockingBoxes[i]); var blockingAnchorPoint = blocking.anchorPoint._matMult(rotationMatrix); - minPlacementScale = this.getPlacementScale(minPlacementScale, anchorPoint, box, blockingAnchorPoint, blocking); if (minPlacementScale >= this.maxScale) { return minPlacementScale; } } } - if (avoidEdges) { var rotatedCollisionBox; - if (this.angle) { var reverseRotationMatrix = this.reverseRotationMatrix; var tl = new Point(box.x1, box.y1).matMult(reverseRotationMatrix); var tr = new Point(box.x2, box.y1).matMult(reverseRotationMatrix); var bl = new Point(box.x1, box.y2).matMult(reverseRotationMatrix); var br = new Point(box.x2, box.y2).matMult(reverseRotationMatrix); - rotatedCollisionBox = this.tempCollisionBox; rotatedCollisionBox.anchorPointX = box.anchorPoint.x; rotatedCollisionBox.anchorPointY = box.anchorPoint.y; @@ -21928,7 +23485,6 @@ CollisionTile.prototype.placeCollisionFeature = function(collisionFeature, allow } else { rotatedCollisionBox = box; } - for (var k = 0; k < this.edges.length; k++) { var edgeBox = this.edges[k]; minPlacementScale = this.getPlacementScale(minPlacementScale, box.anchorPoint, rotatedCollisionBox, edgeBox.anchorPoint, edgeBox); @@ -21938,18 +23494,14 @@ CollisionTile.prototype.placeCollisionFeature = function(collisionFeature, allow } } } - return minPlacementScale; }; - -CollisionTile.prototype.queryRenderedSymbols = function(minX, minY, maxX, maxY, scale) { +CollisionTile.prototype.queryRenderedSymbols = function (minX, minY, maxX, maxY, scale) { var sourceLayerFeatures = {}; var result = []; - var collisionBoxArray = this.collisionBoxArray; var rotationMatrix = this.rotationMatrix; var anchorPoint = new Point(minX, minY)._matMult(rotationMatrix); - var queryBox = this.tempCollisionBox; queryBox.anchorX = anchorPoint.x; queryBox.anchorY = anchorPoint.y; @@ -21958,32 +23510,25 @@ CollisionTile.prototype.queryRenderedSymbols = function(minX, minY, maxX, maxY, queryBox.x2 = maxX - minX; queryBox.y2 = maxY - minY; queryBox.maxScale = scale; - - // maxScale is stored using a Float32. Convert `scale` to the stored Float32 value. scale = queryBox.maxScale; - var searchBox = [ anchorPoint.x + queryBox.x1 / scale, anchorPoint.y + queryBox.y1 / scale * this.yStretch, anchorPoint.x + queryBox.x2 / scale, anchorPoint.y + queryBox.y2 / scale * this.yStretch ]; - var blockingBoxKeys = this.grid.query(searchBox[0], searchBox[1], searchBox[2], searchBox[3]); var blockingBoxKeys2 = this.ignoredGrid.query(searchBox[0], searchBox[1], searchBox[2], searchBox[3]); for (var k = 0; k < blockingBoxKeys2.length; k++) { blockingBoxKeys.push(blockingBoxKeys2[k]); } - for (var i = 0; i < blockingBoxKeys.length; i++) { var blocking = collisionBoxArray.get(blockingBoxKeys[i]); - var sourceLayer = blocking.sourceLayerIndex; var featureIndex = blocking.featureIndex; if (sourceLayerFeatures[sourceLayer] === undefined) { sourceLayerFeatures[sourceLayer] = {}; } - if (!sourceLayerFeatures[sourceLayer][featureIndex]) { var blockingAnchorPoint = blocking.anchorPoint.matMult(rotationMatrix); var minPlacementScale = this.getPlacementScale(this.minScale, anchorPoint, queryBox, blockingAnchorPoint, blocking); @@ -21993,66 +23538,36 @@ CollisionTile.prototype.queryRenderedSymbols = function(minX, minY, maxX, maxY, } } } - return result; }; - -CollisionTile.prototype.getPlacementScale = function(minPlacementScale, anchorPoint, box, blockingAnchorPoint, blocking) { - - // Find the lowest scale at which the two boxes can fit side by side without overlapping. - // Original algorithm: +CollisionTile.prototype.getPlacementScale = function (minPlacementScale, anchorPoint, box, blockingAnchorPoint, blocking) { var anchorDiffX = anchorPoint.x - blockingAnchorPoint.x; var anchorDiffY = anchorPoint.y - blockingAnchorPoint.y; - var s1 = (blocking.x1 - box.x2) / anchorDiffX; // scale at which new box is to the left of old box - var s2 = (blocking.x2 - box.x1) / anchorDiffX; // scale at which new box is to the right of old box - var s3 = (blocking.y1 - box.y2) * this.yStretch / anchorDiffY; // scale at which new box is to the top of old box - var s4 = (blocking.y2 - box.y1) * this.yStretch / anchorDiffY; // scale at which new box is to the bottom of old box - - if (isNaN(s1) || isNaN(s2)) s1 = s2 = 1; - if (isNaN(s3) || isNaN(s4)) s3 = s4 = 1; - + var s1 = (blocking.x1 - box.x2) / anchorDiffX; + var s2 = (blocking.x2 - box.x1) / anchorDiffX; + var s3 = (blocking.y1 - box.y2) * this.yStretch / anchorDiffY; + var s4 = (blocking.y2 - box.y1) * this.yStretch / anchorDiffY; + if (isNaN(s1) || isNaN(s2)) + s1 = s2 = 1; + if (isNaN(s3) || isNaN(s4)) + s3 = s4 = 1; var collisionFreeScale = Math.min(Math.max(s1, s2), Math.max(s3, s4)); var blockingMaxScale = blocking.maxScale; var boxMaxScale = box.maxScale; - if (collisionFreeScale > blockingMaxScale) { - // After a box's maxScale the label has shrunk enough that the box is no longer needed to cover it, - // so unblock the new box at the scale that the old box disappears. collisionFreeScale = blockingMaxScale; } - if (collisionFreeScale > boxMaxScale) { - // If the box can only be shown after it is visible, then the box can never be shown. - // But the label can be shown after this box is not visible. collisionFreeScale = boxMaxScale; } - - if (collisionFreeScale > minPlacementScale && - collisionFreeScale >= blocking.placementScale) { - // If this collision occurs at a lower scale than previously found collisions - // and the collision occurs while the other label is visible - - // this this is the lowest scale at which the label won't collide with anything + if (collisionFreeScale > minPlacementScale && collisionFreeScale >= blocking.placementScale) { minPlacementScale = collisionFreeScale; } - return minPlacementScale; }; - - -/** - * Remember this collisionFeature and what scale it was placed at to block - * later features from overlapping with it. - * - * @param {CollisionFeature} collisionFeature - * @param {number} minPlacementScale - * @private - */ -CollisionTile.prototype.insertCollisionFeature = function(collisionFeature, minPlacementScale, ignorePlacement) { - +CollisionTile.prototype.insertCollisionFeature = function (collisionFeature, minPlacementScale, ignorePlacement) { var grid = ignorePlacement ? this.ignoredGrid : this.grid; var collisionBoxArray = this.collisionBoxArray; - for (var k = collisionFeature.boxStartIndex; k < collisionFeature.boxEndIndex; k++) { var box = collisionBoxArray.get(k); box.placementScale = minPlacementScale; @@ -22061,211 +23576,122 @@ CollisionTile.prototype.insertCollisionFeature = function(collisionFeature, minP } } }; - -},{"../data/bucket":17,"grid-index":143,"point-geometry":174}],79:[function(require,module,exports){ +},{"../data/bucket":23,"grid-index":162,"point-geometry":194}],91:[function(require,module,exports){ 'use strict'; - var interpolate = require('../util/interpolate'); var Anchor = require('../symbol/anchor'); var checkMaxAngle = require('./check_max_angle'); - module.exports = getAnchors; - function getAnchors(line, spacing, maxAngle, shapedText, shapedIcon, glyphSize, boxScale, overscaling, tileExtent) { - - // Resample a line to get anchor points for labels and check that each - // potential label passes text-max-angle check and has enough froom to fit - // on the line. - - var angleWindowSize = shapedText ? - 3 / 5 * glyphSize * boxScale : - 0; - - var labelLength = Math.max( - shapedText ? shapedText.right - shapedText.left : 0, - shapedIcon ? shapedIcon.right - shapedIcon.left : 0); - - // Is the line continued from outside the tile boundary? + var angleWindowSize = shapedText ? 3 / 5 * glyphSize * boxScale : 0; + var labelLength = Math.max(shapedText ? shapedText.right - shapedText.left : 0, shapedIcon ? shapedIcon.right - shapedIcon.left : 0); var isLineContinued = line[0].x === 0 || line[0].x === tileExtent || line[0].y === 0 || line[0].y === tileExtent; - - // Is the label long, relative to the spacing? - // If so, adjust the spacing so there is always a minimum space of `spacing / 4` between label edges. - if (spacing - labelLength * boxScale < spacing / 4) { + if (spacing - labelLength * boxScale < spacing / 4) { spacing = labelLength * boxScale + spacing / 4; } - - // Offset the first anchor by: - // Either half the label length plus a fixed extra offset if the line is not continued - // Or half the spacing if the line is continued. - - // For non-continued lines, add a bit of fixed extra offset to avoid collisions at T intersections. var fixedExtraOffset = glyphSize * 2; - - var offset = !isLineContinued ? - ((labelLength / 2 + fixedExtraOffset) * boxScale * overscaling) % spacing : - (spacing / 2 * overscaling) % spacing; - + var offset = !isLineContinued ? (labelLength / 2 + fixedExtraOffset) * boxScale * overscaling % spacing : spacing / 2 * overscaling % spacing; return resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength * boxScale, isLineContinued, false, tileExtent); } - - function resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, placeAtMiddle, tileExtent) { - var halfLabelLength = labelLength / 2; var lineLength = 0; for (var k = 0; k < line.length - 1; k++) { lineLength += line[k].dist(line[k + 1]); } - - var distance = 0, - markedDistance = offset - spacing; - + var distance = 0, markedDistance = offset - spacing; var anchors = []; - for (var i = 0; i < line.length - 1; i++) { - - var a = line[i], - b = line[i + 1]; - - var segmentDist = a.dist(b), - angle = b.angleTo(a); - + var a = line[i], b = line[i + 1]; + var segmentDist = a.dist(b), angle = b.angleTo(a); while (markedDistance + spacing < distance + segmentDist) { markedDistance += spacing; - - var t = (markedDistance - distance) / segmentDist, - x = interpolate(a.x, b.x, t), - y = interpolate(a.y, b.y, t); - - // Check that the point is within the tile boundaries and that - // the label would fit before the beginning and end of the line - // if placed at this point. - if (x >= 0 && x < tileExtent && y >= 0 && y < tileExtent && - markedDistance - halfLabelLength >= 0 && - markedDistance + halfLabelLength <= lineLength) { + var t = (markedDistance - distance) / segmentDist, x = interpolate(a.x, b.x, t), y = interpolate(a.y, b.y, t); + if (x >= 0 && x < tileExtent && y >= 0 && y < tileExtent && markedDistance - halfLabelLength >= 0 && markedDistance + halfLabelLength <= lineLength) { var anchor = new Anchor(x, y, angle, i)._round(); - if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) { anchors.push(anchor); } } } - distance += segmentDist; } - if (!placeAtMiddle && !anchors.length && !isLineContinued) { - // The first attempt at finding anchors at which labels can be placed failed. - // Try again, but this time just try placing one anchor at the middle of the line. - // This has the most effect for short lines in overscaled tiles, since the - // initial offset used in overscaled tiles is calculated to align labels with positions in - // parent tiles instead of placing the label as close to the beginning as possible. anchors = resample(line, distance / 2, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, true, tileExtent); } - return anchors; } - -},{"../symbol/anchor":73,"../util/interpolate":113,"./check_max_angle":74}],80:[function(require,module,exports){ +},{"../symbol/anchor":85,"../util/interpolate":130,"./check_max_angle":86}],92:[function(require,module,exports){ 'use strict'; - var ShelfPack = require('shelf-pack'); - +var util = require('../util/util'); +var SIZE_GROWTH_RATE = 4; +var DEFAULT_SIZE = 128; +var MAX_SIZE = 2048; module.exports = GlyphAtlas; -function GlyphAtlas(width, height) { - this.width = width; - this.height = height; - - this.bin = new ShelfPack(width, height); +function GlyphAtlas() { + this.width = DEFAULT_SIZE; + this.height = DEFAULT_SIZE; + this.bin = new ShelfPack(this.width, this.height); this.index = {}; this.ids = {}; - this.data = new Uint8Array(width * height); + this.data = new Uint8Array(this.width * this.height); } - -GlyphAtlas.prototype.getGlyphs = function() { - var glyphs = {}, - split, - name, - id; - +GlyphAtlas.prototype.getGlyphs = function () { + var glyphs = {}, split, name, id; for (var key in this.ids) { split = key.split('#'); name = split[0]; id = split[1]; - - if (!glyphs[name]) glyphs[name] = []; + if (!glyphs[name]) + glyphs[name] = []; glyphs[name].push(id); } - return glyphs; }; - -GlyphAtlas.prototype.getRects = function() { - var rects = {}, - split, - name, - id; - +GlyphAtlas.prototype.getRects = function () { + var rects = {}, split, name, id; for (var key in this.ids) { split = key.split('#'); name = split[0]; id = split[1]; - - if (!rects[name]) rects[name] = {}; + if (!rects[name]) + rects[name] = {}; rects[name][id] = this.index[key]; } - return rects; }; - - -GlyphAtlas.prototype.addGlyph = function(id, name, glyph, buffer) { - if (!glyph) { - // console.warn('missing glyph', code, String.fromCharCode(code)); +GlyphAtlas.prototype.addGlyph = function (id, name, glyph, buffer) { + if (!glyph) return null; - } - var key = name + "#" + glyph.id; - - // The glyph is already in this texture. + var key = name + '#' + glyph.id; if (this.index[key]) { if (this.ids[key].indexOf(id) < 0) { this.ids[key].push(id); } return this.index[key]; } - - // The glyph bitmap has zero width. if (!glyph.bitmap) { return null; } - var bufferedWidth = glyph.width + buffer * 2; var bufferedHeight = glyph.height + buffer * 2; - - // Add a 1px border around every image. var padding = 1; var packWidth = bufferedWidth + 2 * padding; var packHeight = bufferedHeight + 2 * padding; - - // Increase to next number divisible by 4, but at least 1. - // This is so we can scale down the texture coordinates and pack them - // into 2 bytes rather than 4 bytes. - packWidth += (4 - packWidth % 4); - packHeight += (4 - packHeight % 4); - + packWidth += 4 - packWidth % 4; + packHeight += 4 - packHeight % 4; var rect = this.bin.packOne(packWidth, packHeight); if (!rect) { this.resize(); rect = this.bin.packOne(packWidth, packHeight); } if (!rect) { - console.warn('glyph bitmap overflow'); + util.warnOnce('glyph bitmap overflow'); return null; } - this.index[key] = rect; this.ids[key] = [id]; - var target = this.data; var source = glyph.bitmap; for (var y = 0; y < bufferedHeight; y++) { @@ -22275,42 +23701,32 @@ GlyphAtlas.prototype.addGlyph = function(id, name, glyph, buffer) { target[y1 + x] = source[y2 + x]; } } - this.dirty = true; - return rect; }; - -GlyphAtlas.prototype.resize = function() { - var origw = this.width, - origh = this.height; - - // For now, don't grow the atlas beyond 1024x1024 because of how - // texture coords pack into unsigned byte in symbol bucket. - if (origw > 512 || origh > 512) return; - +GlyphAtlas.prototype.resize = function () { + var prevWidth = this.width; + var prevHeight = this.height; + if (prevWidth >= MAX_SIZE || prevHeight >= MAX_SIZE) + return; if (this.texture) { if (this.gl) { this.gl.deleteTexture(this.texture); } this.texture = null; } - - this.width *= 2; - this.height *= 2; + this.width *= SIZE_GROWTH_RATE; + this.height *= SIZE_GROWTH_RATE; this.bin.resize(this.width, this.height); - - var buf = new ArrayBuffer(this.width * this.height), - src, dst; - for (var i = 0; i < origh; i++) { - src = new Uint8Array(this.data.buffer, origh * i, origw); - dst = new Uint8Array(buf, origh * i * 2, origw); + var buf = new ArrayBuffer(this.width * this.height); + for (var i = 0; i < prevHeight; i++) { + var src = new Uint8Array(this.data.buffer, prevHeight * i, prevWidth); + var dst = new Uint8Array(buf, prevHeight * i * SIZE_GROWTH_RATE, prevWidth); dst.set(src); } this.data = new Uint8Array(buf); }; - -GlyphAtlas.prototype.bind = function(gl) { +GlyphAtlas.prototype.bind = function (gl) { this.gl = gl; if (!this.texture) { this.texture = gl.createTexture(); @@ -22320,73 +23736,53 @@ GlyphAtlas.prototype.bind = function(gl) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, this.width, this.height, 0, gl.ALPHA, gl.UNSIGNED_BYTE, null); - } else { gl.bindTexture(gl.TEXTURE_2D, this.texture); } }; - -GlyphAtlas.prototype.updateTexture = function(gl) { +GlyphAtlas.prototype.updateTexture = function (gl) { this.bind(gl); if (this.dirty) { gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, this.height, gl.ALPHA, gl.UNSIGNED_BYTE, this.data); this.dirty = false; } }; - -},{"shelf-pack":176}],81:[function(require,module,exports){ +},{"../util/util":136,"shelf-pack":197}],93:[function(require,module,exports){ 'use strict'; - var normalizeURL = require('../util/mapbox').normalizeGlyphsURL; var getArrayBuffer = require('../util/ajax').getArrayBuffer; var Glyphs = require('../util/glyphs'); var GlyphAtlas = require('../symbol/glyph_atlas'); var Protobuf = require('pbf'); - module.exports = GlyphSource; - -/** - * A glyph source has a URL from which to load new glyphs and manages - * GlyphAtlases in which to store glyphs used by the requested fontstacks - * and ranges. - * - * @param {string} url glyph template url - * @private - */ function GlyphSource(url) { this.url = url && normalizeURL(url); this.atlases = {}; this.stacks = {}; this.loading = {}; } - -GlyphSource.prototype.getSimpleGlyphs = function(fontstack, glyphIDs, uid, callback) { +GlyphSource.prototype.getSimpleGlyphs = function (fontstack, glyphIDs, uid, callback) { if (this.stacks[fontstack] === undefined) { this.stacks[fontstack] = {}; } if (this.atlases[fontstack] === undefined) { - this.atlases[fontstack] = new GlyphAtlas(128, 128); + this.atlases[fontstack] = new GlyphAtlas(); } - var glyphs = {}; var stack = this.stacks[fontstack]; var atlas = this.atlases[fontstack]; - - // the number of pixels the sdf bitmaps are padded by var buffer = 3; - var missing = {}; var remaining = 0; var range; - for (var i = 0; i < glyphIDs.length; i++) { var glyphID = glyphIDs[i]; range = Math.floor(glyphID / 256); - if (stack[range]) { var glyph = stack[range].glyphs[glyphID]; - var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); - if (glyph) glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); + var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); + if (glyph) + glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); } else { if (missing[range] === undefined) { missing[range] = []; @@ -22395,30 +23791,27 @@ GlyphSource.prototype.getSimpleGlyphs = function(fontstack, glyphIDs, uid, callb missing[range].push(glyphID); } } - - if (!remaining) callback(undefined, glyphs, fontstack); - - var onRangeLoaded = function(err, range, data) { - // TODO not be silent about errors + if (!remaining) + callback(undefined, glyphs, fontstack); + var onRangeLoaded = function (err, range, data) { if (!err) { var stack = this.stacks[fontstack][range] = data.stacks[0]; for (var i = 0; i < missing[range].length; i++) { var glyphID = missing[range][i]; var glyph = stack.glyphs[glyphID]; - var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); - if (glyph) glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); + var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); + if (glyph) + glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); } } remaining--; - if (!remaining) callback(undefined, glyphs, fontstack); + if (!remaining) + callback(undefined, glyphs, fontstack); }.bind(this); - for (var r in missing) { this.loadRange(fontstack, r, onRangeLoaded); } }; - -// A simplified representation of the glyph containing only the properties needed for shaping. function SimpleGlyph(glyph, rect, buffer) { var padding = 1; this.advance = glyph.advance; @@ -22426,24 +23819,20 @@ function SimpleGlyph(glyph, rect, buffer) { this.top = glyph.top + buffer + padding; this.rect = rect; } - -GlyphSource.prototype.loadRange = function(fontstack, range, callback) { - if (range * 256 > 65535) return callback('glyphs > 65535 not supported'); - +GlyphSource.prototype.loadRange = function (fontstack, range, callback) { + if (range * 256 > 65535) + return callback('glyphs > 65535 not supported'); if (this.loading[fontstack] === undefined) { this.loading[fontstack] = {}; } var loading = this.loading[fontstack]; - if (loading[range]) { loading[range].push(callback); } else { loading[range] = [callback]; - - var rangeName = (range * 256) + '-' + (range * 256 + 255); + var rangeName = range * 256 + '-' + (range * 256 + 255); var url = glyphUrl(fontstack, rangeName, this.url); - - getArrayBuffer(url, function(err, data) { + getArrayBuffer(url, function (err, data) { var glyphs = !err && new Glyphs(new Protobuf(new Uint8Array(data))); for (var i = 0; i < loading[range].length; i++) { loading[range][i](err, range, glyphs); @@ -22452,190 +23841,116 @@ GlyphSource.prototype.loadRange = function(fontstack, range, callback) { }); } }; - -GlyphSource.prototype.getGlyphAtlas = function(fontstack) { +GlyphSource.prototype.getGlyphAtlas = function (fontstack) { return this.atlases[fontstack]; }; - -/** - * Use CNAME sharding to load a specific glyph range over a randomized - * but consistent subdomain. - * @param {string} fontstack comma-joined fonts - * @param {string} range comma-joined range - * @param {url} url templated url - * @param {string} [subdomains=abc] subdomains as a string where each letter is one. - * @returns {string} a url to load that section of glyphs - * @private - */ function glyphUrl(fontstack, range, url, subdomains) { subdomains = subdomains || 'abc'; - - return url - .replace('{s}', subdomains[fontstack.length % subdomains.length]) - .replace('{fontstack}', fontstack) - .replace('{range}', range); + return url.replace('{s}', subdomains[fontstack.length % subdomains.length]).replace('{fontstack}', fontstack).replace('{range}', range); } - -},{"../symbol/glyph_atlas":80,"../util/ajax":104,"../util/glyphs":112,"../util/mapbox":116,"pbf":172}],82:[function(require,module,exports){ +},{"../symbol/glyph_atlas":92,"../util/ajax":119,"../util/glyphs":129,"../util/mapbox":133,"pbf":192}],94:[function(require,module,exports){ 'use strict'; - module.exports = function (features, textFeatures, geometries) { - - var leftIndex = {}, - rightIndex = {}, - mergedFeatures = [], - mergedGeom = [], - mergedTexts = [], - mergedIndex = 0, - k; - + var leftIndex = {}, rightIndex = {}, mergedFeatures = [], mergedGeom = [], mergedTexts = [], mergedIndex = 0, k; function add(k) { mergedFeatures.push(features[k]); mergedGeom.push(geometries[k]); mergedTexts.push(textFeatures[k]); mergedIndex++; } - function mergeFromRight(leftKey, rightKey, geom) { var i = rightIndex[leftKey]; delete rightIndex[leftKey]; rightIndex[rightKey] = i; - mergedGeom[i][0].pop(); mergedGeom[i][0] = mergedGeom[i][0].concat(geom[0]); return i; } - function mergeFromLeft(leftKey, rightKey, geom) { var i = leftIndex[rightKey]; delete leftIndex[rightKey]; leftIndex[leftKey] = i; - mergedGeom[i][0].shift(); mergedGeom[i][0] = geom[0].concat(mergedGeom[i][0]); return i; } - function getKey(text, geom, onRight) { var point = onRight ? geom[0][geom[0].length - 1] : geom[0][0]; return text + ':' + point.x + ':' + point.y; } - for (k = 0; k < features.length; k++) { - var geom = geometries[k], - text = textFeatures[k]; - + var geom = geometries[k], text = textFeatures[k]; if (!text) { add(k); continue; } - - var leftKey = getKey(text, geom), - rightKey = getKey(text, geom, true); - - if ((leftKey in rightIndex) && (rightKey in leftIndex) && (rightIndex[leftKey] !== leftIndex[rightKey])) { - // found lines with the same text adjacent to both ends of the current line, merge all three + var leftKey = getKey(text, geom), rightKey = getKey(text, geom, true); + if (leftKey in rightIndex && rightKey in leftIndex && rightIndex[leftKey] !== leftIndex[rightKey]) { var j = mergeFromLeft(leftKey, rightKey, geom); var i = mergeFromRight(leftKey, rightKey, mergedGeom[j]); - delete leftIndex[leftKey]; delete rightIndex[rightKey]; - rightIndex[getKey(text, mergedGeom[i], true)] = i; mergedGeom[j] = null; - } else if (leftKey in rightIndex) { - // found mergeable line adjacent to the start of the current line, merge mergeFromRight(leftKey, rightKey, geom); - } else if (rightKey in leftIndex) { - // found mergeable line adjacent to the end of the current line, merge mergeFromLeft(leftKey, rightKey, geom); - } else { - // no adjacent lines, add as a new item add(k); leftIndex[leftKey] = mergedIndex - 1; rightIndex[rightKey] = mergedIndex - 1; } } - return { features: mergedFeatures, textFeatures: mergedTexts, geometries: mergedGeom }; }; - -},{}],83:[function(require,module,exports){ +},{}],95:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - module.exports = { getIconQuads: getIconQuads, - getGlyphQuads: getGlyphQuads + getGlyphQuads: getGlyphQuads, + SymbolQuad: SymbolQuad }; - -var minScale = 0.5; // underscale by 1 zoom level - -/** - * A textured quad for rendering a single icon or glyph. - * - * The zoom range the glyph can be shown is defined by minScale and maxScale. - * - * @param {Point} anchorPoint the point the symbol is anchored around - * @param {Point} tl The offset of the top left corner from the anchor. - * @param {Point} tr The offset of the top right corner from the anchor. - * @param {Point} bl The offset of the bottom left corner from the anchor. - * @param {Point} br The offset of the bottom right corner from the anchor. - * @param {Object} tex The texture coordinates. - * @param {number} angle The angle of the label at it's center, not the angle of this quad. - * @param {number} minScale The minimum scale, relative to the tile's intended scale, that the glyph can be shown at. - * @param {number} maxScale The maximum scale, relative to the tile's intended scale, that the glyph can be shown at. - * - * @class SymbolQuad - * @private - */ -function SymbolQuad(anchorPoint, tl, tr, bl, br, tex, angle, minScale, maxScale) { +var minScale = 0.5; +function SymbolQuad(anchorPoint, tl, tr, bl, br, tex, anchorAngle, glyphAngle, minScale, maxScale) { this.anchorPoint = anchorPoint; this.tl = tl; this.tr = tr; this.bl = bl; this.br = br; this.tex = tex; - this.angle = angle; + this.anchorAngle = anchorAngle; + this.glyphAngle = glyphAngle; this.minScale = minScale; this.maxScale = maxScale; } - -/** - * Create the quads used for rendering an icon. - * - * @param {Anchor} anchor - * @param {PositionedIcon} shapedIcon - * @param {number} boxScale A magic number for converting glyph metric units to geometry units. - * @param {Array>} line - * @param {LayoutProperties} layout - * @param {boolean} alongLine Whether the icon should be placed along the line. - * @returns {Array} - * @private - */ -function getIconQuads(anchor, shapedIcon, boxScale, line, layout, alongLine) { - +function getIconQuads(anchor, shapedIcon, boxScale, line, layer, alongLine, shapedText, globalProperties, featureProperties) { var rect = shapedIcon.image.rect; - + var layout = layer.layout; var border = 1; var left = shapedIcon.left - border; var right = left + rect.w / shapedIcon.image.pixelRatio; var top = shapedIcon.top - border; var bottom = top + rect.h / shapedIcon.image.pixelRatio; - var tl = new Point(left, top); - var tr = new Point(right, top); - var br = new Point(right, bottom); - var bl = new Point(left, bottom); - - var angle = layout['icon-rotate'] * Math.PI / 180; + var tl, tr, br, bl; + if (layout['icon-text-fit'] !== 'none' && shapedText) { + var iconWidth = right - left, iconHeight = bottom - top, size = layout['text-size'] / 24, textLeft = shapedText.left * size, textRight = shapedText.right * size, textTop = shapedText.top * size, textBottom = shapedText.bottom * size, textWidth = textRight - textLeft, textHeight = textBottom - textTop, padT = layout['icon-text-fit-padding'][0], padR = layout['icon-text-fit-padding'][1], padB = layout['icon-text-fit-padding'][2], padL = layout['icon-text-fit-padding'][3], offsetY = layout['icon-text-fit'] === 'width' ? (textHeight - iconHeight) * 0.5 : 0, offsetX = layout['icon-text-fit'] === 'height' ? (textWidth - iconWidth) * 0.5 : 0, width = layout['icon-text-fit'] === 'width' || layout['icon-text-fit'] === 'both' ? textWidth : iconWidth, height = layout['icon-text-fit'] === 'height' || layout['icon-text-fit'] === 'both' ? textHeight : iconHeight; + tl = new Point(textLeft + offsetX - padL, textTop + offsetY - padT); + tr = new Point(textLeft + offsetX + padR + width, textTop + offsetY - padT); + br = new Point(textLeft + offsetX + padR + width, textTop + offsetY + padB + height); + bl = new Point(textLeft + offsetX - padL, textTop + offsetY + padB + height); + } else { + tl = new Point(left, top); + tr = new Point(right, top); + br = new Point(right, bottom); + bl = new Point(left, bottom); + } + var angle = layer.getLayoutValue('icon-rotate', globalProperties, featureProperties) * Math.PI / 180; if (alongLine) { var prev = line[anchor.segment]; if (anchor.y === prev.y && anchor.x === prev.x && anchor.segment + 1 < line.length) { @@ -22645,50 +23960,32 @@ function getIconQuads(anchor, shapedIcon, boxScale, line, layout, alongLine) { angle += Math.atan2(anchor.y - prev.y, anchor.x - prev.x); } } - if (angle) { - var sin = Math.sin(angle), - cos = Math.cos(angle), - matrix = [cos, -sin, sin, cos]; - + var sin = Math.sin(angle), cos = Math.cos(angle), matrix = [ + cos, + -sin, + sin, + cos + ]; tl = tl.matMult(matrix); tr = tr.matMult(matrix); bl = bl.matMult(matrix); br = br.matMult(matrix); } - - return [new SymbolQuad(new Point(anchor.x, anchor.y), tl, tr, bl, br, shapedIcon.image.rect, 0, minScale, Infinity)]; + return [new SymbolQuad(new Point(anchor.x, anchor.y), tl, tr, bl, br, shapedIcon.image.rect, 0, 0, minScale, Infinity)]; } - -/** - * Create the quads used for rendering a text label. - * - * @param {Anchor} anchor - * @param {Shaping} shaping - * @param {number} boxScale A magic number for converting from glyph metric units to geometry units. - * @param {Array>} line - * @param {LayoutProperties} layout - * @param {boolean} alongLine Whether the label should be placed along the line. - * @returns {Array} - * @private - */ -function getGlyphQuads(anchor, shaping, boxScale, line, layout, alongLine) { - - var textRotate = layout['text-rotate'] * Math.PI / 180; - var keepUpright = layout['text-keep-upright']; - +function getGlyphQuads(anchor, shaping, boxScale, line, layer, alongLine) { + var textRotate = layer.layout['text-rotate'] * Math.PI / 180; + var keepUpright = layer.layout['text-keep-upright']; var positionedGlyphs = shaping.positionedGlyphs; var quads = []; - for (var k = 0; k < positionedGlyphs.length; k++) { var positionedGlyph = positionedGlyphs[k]; var glyph = positionedGlyph.glyph; var rect = glyph.rect; - - if (!rect) continue; - + if (!rect) + continue; var centerX = (positionedGlyph.x + glyph.advance / 2) * boxScale; - var glyphInstances; var labelMinScale = minScale; if (alongLine) { @@ -22697,99 +23994,55 @@ function getGlyphQuads(anchor, shaping, boxScale, line, layout, alongLine) { if (keepUpright) { labelMinScale = Math.min(labelMinScale, getSegmentGlyphs(glyphInstances, anchor, centerX, line, anchor.segment, false)); } - } else { glyphInstances = [{ - anchorPoint: new Point(anchor.x, anchor.y), - offset: 0, - angle: 0, - maxScale: Infinity, - minScale: minScale - }]; + anchorPoint: new Point(anchor.x, anchor.y), + offset: 0, + angle: 0, + maxScale: Infinity, + minScale: minScale + }]; } - - var x1 = positionedGlyph.x + glyph.left, - y1 = positionedGlyph.y - glyph.top, - x2 = x1 + rect.w, - y2 = y1 + rect.h, - - otl = new Point(x1, y1), - otr = new Point(x2, y1), - obl = new Point(x1, y2), - obr = new Point(x2, y2); - + var x1 = positionedGlyph.x + glyph.left, y1 = positionedGlyph.y - glyph.top, x2 = x1 + rect.w, y2 = y1 + rect.h, otl = new Point(x1, y1), otr = new Point(x2, y1), obl = new Point(x1, y2), obr = new Point(x2, y2); for (var i = 0; i < glyphInstances.length; i++) { - - var instance = glyphInstances[i], - tl = otl, - tr = otr, - bl = obl, - br = obr, - angle = instance.angle + textRotate; - - if (angle) { - var sin = Math.sin(angle), - cos = Math.cos(angle), - matrix = [cos, -sin, sin, cos]; - + var instance = glyphInstances[i], tl = otl, tr = otr, bl = obl, br = obr; + if (textRotate) { + var sin = Math.sin(textRotate), cos = Math.cos(textRotate), matrix = [ + cos, + -sin, + sin, + cos + ]; tl = tl.matMult(matrix); tr = tr.matMult(matrix); bl = bl.matMult(matrix); br = br.matMult(matrix); } - - // Prevent label from extending past the end of the line var glyphMinScale = Math.max(instance.minScale, labelMinScale); - - var glyphAngle = (anchor.angle + textRotate + instance.offset + 2 * Math.PI) % (2 * Math.PI); - quads.push(new SymbolQuad(instance.anchorPoint, tl, tr, bl, br, rect, glyphAngle, glyphMinScale, instance.maxScale)); - + var anchorAngle = (anchor.angle + instance.offset + 2 * Math.PI) % (2 * Math.PI); + var glyphAngle = (instance.angle + instance.offset + 2 * Math.PI) % (2 * Math.PI); + quads.push(new SymbolQuad(instance.anchorPoint, tl, tr, bl, br, rect, anchorAngle, glyphAngle, glyphMinScale, instance.maxScale)); } } - return quads; } - -/** - * We can only render glyph quads that slide along a straight line. To draw - * curved lines we need an instance of a glyph for each segment it appears on. - * This creates all the instances of a glyph that are necessary to render a label. - * - * We need a - * @param {Array} glyphInstances An empty array that glyphInstances are added to. - * @param {Anchor} anchor - * @param {number} offset The glyph's offset from the center of the label. - * @param {Array} line - * @param {number} segment The index of the segment of the line on which the anchor exists. - * @param {boolean} forward If true get the glyphs that come later on the line, otherwise get the glyphs that come earlier. - * - * @returns {Array} glyphInstances - * @private - */ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { var upsideDown = !forward; - - if (offset < 0) forward = !forward; - - if (forward) segment++; - + if (offset < 0) + forward = !forward; + if (forward) + segment++; var newAnchorPoint = new Point(anchor.x, anchor.y); var end = line[segment]; var prevScale = Infinity; - offset = Math.abs(offset); - var placementScale = minScale; - while (true) { var distance = newAnchorPoint.dist(end); var scale = offset / distance; - - // Get the angle of the line segment var angle = Math.atan2(end.y - newAnchorPoint.y, end.x - newAnchorPoint.x); - if (!forward) angle += Math.PI; - if (upsideDown) angle += Math.PI; - + if (!forward) + angle += Math.PI; glyphs.push({ anchorPoint: newAnchorPoint, offset: upsideDown ? Math.PI : 0, @@ -22797,12 +24050,9 @@ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { maxScale: prevScale, angle: (angle + 2 * Math.PI) % (2 * Math.PI) }); - - if (scale <= placementScale) break; - + if (scale <= placementScale) + break; newAnchorPoint = end; - - // skip duplicate nodes while (newAnchorPoint.equals(end)) { segment += forward ? 1 : -1; end = line[segment]; @@ -22810,33 +24060,18 @@ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { return scale; } } - var unit = end.sub(newAnchorPoint)._unit(); newAnchorPoint = newAnchorPoint.sub(unit._mult(distance)); - prevScale = scale; } - return placementScale; } - -},{"point-geometry":174}],84:[function(require,module,exports){ +},{"point-geometry":194}],96:[function(require,module,exports){ 'use strict'; - var resolveTokens = require('../util/token'); - module.exports = resolveText; - -/** - * For an array of features determine what glyphs need to be loaded - * and apply any text preprocessing. The remaining users of text should - * use the `textFeatures` key returned by this function rather than accessing - * feature text directly. - * @private - */ function resolveText(features, layoutProperties, codepoints) { var textFeatures = []; - for (var i = 0, fl = features.length; i < fl; i++) { var text = resolveTokens(features[i].properties, layoutProperties['text-field']); if (!text) { @@ -22844,43 +24079,31 @@ function resolveText(features, layoutProperties, codepoints) { continue; } text = text.toString(); - var transform = layoutProperties['text-transform']; if (transform === 'uppercase') { text = text.toLocaleUpperCase(); } else if (transform === 'lowercase') { text = text.toLocaleLowerCase(); } - for (var j = 0; j < text.length; j++) { codepoints[text.charCodeAt(j)] = true; } - - // Track indexes of features with text. textFeatures[i] = text; } - return textFeatures; } - -},{"../util/token":118}],85:[function(require,module,exports){ +},{"../util/token":135}],97:[function(require,module,exports){ 'use strict'; - module.exports = { shapeText: shapeText, shapeIcon: shapeIcon }; - - -// The position of a glyph relative to the text's anchor point. function PositionedGlyph(codePoint, x, y, glyph) { this.codePoint = codePoint; this.x = x; this.y = y; this.glyph = glyph; } - -// A collection of positioned glyphs and some metadata function Shaping(positionedGlyphs, text, top, bottom, left, right) { this.positionedGlyphs = positionedGlyphs; this.text = text; @@ -22889,153 +24112,114 @@ function Shaping(positionedGlyphs, text, top, bottom, left, right) { this.left = left; this.right = right; } - function shapeText(text, glyphs, maxWidth, lineHeight, horizontalAlign, verticalAlign, justify, spacing, translate) { - var positionedGlyphs = []; var shaping = new Shaping(positionedGlyphs, text, translate[1], translate[1], translate[0], translate[0]); - - // the y offset *should* be part of the font metadata var yOffset = -17; - var x = 0; var y = yOffset; - for (var i = 0; i < text.length; i++) { var codePoint = text.charCodeAt(i); var glyph = glyphs[codePoint]; - - if (!glyph) continue; - + if (!glyph) + continue; positionedGlyphs.push(new PositionedGlyph(codePoint, x, y, glyph)); x += glyph.advance + spacing; } - - if (!positionedGlyphs.length) return false; - + if (!positionedGlyphs.length) + return false; linewrap(shaping, glyphs, lineHeight, maxWidth, horizontalAlign, verticalAlign, justify, translate); - return shaping; } - var invisible = { - 0x20: true, // space - 0x200b: true // zero-width space + 32: true, + 8203: true }; - var breakable = { - 0x20: true, // space - 0x26: true, // ampersand - 0x2b: true, // plus sign - 0x2d: true, // hyphen-minus - 0x2f: true, // solidus - 0xad: true, // soft hyphen - 0xb7: true, // middle dot - 0x200b: true, // zero-width space - 0x2010: true, // hyphen - 0x2013: true // en dash + 32: true, + 38: true, + 43: true, + 45: true, + 47: true, + 173: true, + 183: true, + 8203: true, + 8208: true, + 8211: true }; - function linewrap(shaping, glyphs, lineHeight, maxWidth, horizontalAlign, verticalAlign, justify, translate) { var lastSafeBreak = null; - var lengthBeforeCurrentLine = 0; var lineStartIndex = 0; var line = 0; - var maxLineLength = 0; - var positionedGlyphs = shaping.positionedGlyphs; - if (maxWidth) { for (var i = 0; i < positionedGlyphs.length; i++) { var positionedGlyph = positionedGlyphs[i]; - positionedGlyph.x -= lengthBeforeCurrentLine; positionedGlyph.y += lineHeight * line; - if (positionedGlyph.x > maxWidth && lastSafeBreak !== null) { - var lineLength = positionedGlyphs[lastSafeBreak + 1].x; maxLineLength = Math.max(lineLength, maxLineLength); - for (var k = lastSafeBreak + 1; k <= i; k++) { positionedGlyphs[k].y += lineHeight; positionedGlyphs[k].x -= lineLength; } - if (justify) { - // Collapse invisible characters. var lineEnd = lastSafeBreak; if (invisible[positionedGlyphs[lastSafeBreak].codePoint]) { lineEnd--; } - justifyLine(positionedGlyphs, glyphs, lineStartIndex, lineEnd, justify); } - lineStartIndex = lastSafeBreak + 1; lastSafeBreak = null; lengthBeforeCurrentLine += lineLength; line++; } - if (breakable[positionedGlyph.codePoint]) { lastSafeBreak = i; } } } - var lastPositionedGlyph = positionedGlyphs[positionedGlyphs.length - 1]; var lastLineLength = lastPositionedGlyph.x + glyphs[lastPositionedGlyph.codePoint].advance; maxLineLength = Math.max(maxLineLength, lastLineLength); - var height = (line + 1) * lineHeight; - justifyLine(positionedGlyphs, glyphs, lineStartIndex, positionedGlyphs.length - 1, justify); align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, line, translate); - - // Calculate the bounding box shaping.top += -verticalAlign * height; shaping.bottom = shaping.top + height; shaping.left += -horizontalAlign * maxLineLength; shaping.right = shaping.left + maxLineLength; } - function justifyLine(positionedGlyphs, glyphs, start, end, justify) { var lastAdvance = glyphs[positionedGlyphs[end].codePoint].advance; var lineIndent = (positionedGlyphs[end].x + lastAdvance) * justify; - for (var j = start; j <= end; j++) { positionedGlyphs[j].x -= lineIndent; } - } - function align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, line, translate) { var shiftX = (justify - horizontalAlign) * maxLineLength + translate[0]; var shiftY = (-verticalAlign * (line + 1) + 0.5) * lineHeight + translate[1]; - for (var j = 0; j < positionedGlyphs.length; j++) { positionedGlyphs[j].x += shiftX; positionedGlyphs[j].y += shiftY; } } - - function shapeIcon(image, layout) { - if (!image || !image.rect) return null; - + if (!image || !image.rect) + return null; var dx = layout['icon-offset'][0]; var dy = layout['icon-offset'][1]; var x1 = dx - image.width / 2; var x2 = x1 + image.width; var y1 = dy - image.height / 2; var y2 = y1 + image.height; - return new PositionedIcon(image, y1, y2, x1, x2); } - function PositionedIcon(image, top, bottom, left, right) { this.image = image; this.top = top; @@ -23043,41 +24227,34 @@ function PositionedIcon(image, top, bottom, left, right) { this.left = left; this.right = right; } - -},{}],86:[function(require,module,exports){ +},{}],98:[function(require,module,exports){ 'use strict'; - var ShelfPack = require('shelf-pack'); var browser = require('../util/browser'); - +var util = require('../util/util'); module.exports = SpriteAtlas; function SpriteAtlas(width, height) { this.width = width; this.height = height; - this.bin = new ShelfPack(width, height); this.images = {}; this.data = false; - this.texture = 0; // WebGL ID - this.filter = 0; // WebGL ID + this.texture = 0; + this.filter = 0; this.pixelRatio = 1; this.dirty = true; } - function copyBitmap(src, srcStride, srcX, srcY, dst, dstStride, dstX, dstY, width, height, wrap) { var srcI = srcY * srcStride + srcX; var dstI = dstY * dstStride + dstX; var x, y; - if (wrap) { - // add 1 pixel wrapped padding on each side of the image dstI -= dstStride; for (y = -1; y <= height; y++, srcI = ((y + height) % height + srcY) * srcStride + srcX, dstI += dstStride) { for (x = -1; x <= width; x++) { - dst[dstI + x] = src[srcI + ((x + width) % width)]; + dst[dstI + x] = src[srcI + (x + width) % width]; } } - } else { for (y = 0; y < height; y++, srcI += srcStride, dstI += dstStride) { for (x = 0; x < width; x++) { @@ -23086,610 +24263,541 @@ function copyBitmap(src, srcStride, srcX, srcY, dst, dstStride, dstX, dstY, widt } } } - -SpriteAtlas.prototype.allocateImage = function(pixelWidth, pixelHeight) { - +SpriteAtlas.prototype.allocateImage = function (pixelWidth, pixelHeight) { pixelWidth = pixelWidth / this.pixelRatio; pixelHeight = pixelHeight / this.pixelRatio; - - // Increase to next number divisible by 4, but at least 1. - // This is so we can scale down the texture coordinates and pack them - // into 2 bytes rather than 4 bytes. - // Pad icons to prevent them from polluting neighbours during linear interpolation var padding = 2; var packWidth = pixelWidth + padding + (4 - (pixelWidth + padding) % 4); - var packHeight = pixelHeight + padding + (4 - (pixelHeight + padding) % 4);// + 4; - + var packHeight = pixelHeight + padding + (4 - (pixelHeight + padding) % 4); var rect = this.bin.packOne(packWidth, packHeight); if (!rect) { - console.warn('SpriteAtlas out of space.'); + util.warnOnce('SpriteAtlas out of space.'); return null; } - return rect; }; - -SpriteAtlas.prototype.getImage = function(name, wrap) { +SpriteAtlas.prototype.getImage = function (name, wrap) { if (this.images[name]) { return this.images[name]; } - if (!this.sprite) { return null; } - var pos = this.sprite.getSpritePosition(name); if (!pos.width || !pos.height) { return null; } - var rect = this.allocateImage(pos.width, pos.height); if (!rect) { return null; } - var image = new AtlasImage(rect, pos.width / pos.pixelRatio, pos.height / pos.pixelRatio, pos.sdf, pos.pixelRatio / this.pixelRatio); this.images[name] = image; - this.copy(rect, pos, wrap); - return image; }; - - -// Return position of a repeating fill pattern. -SpriteAtlas.prototype.getPosition = function(name, repeating) { - var image = this.getImage(name, repeating); - var rect = image && image.rect; - - if (!rect) { - return null; +SpriteAtlas.prototype.getPosition = function (name, repeating) { + var image = this.getImage(name, repeating); + var rect = image && image.rect; + if (!rect) { + return null; + } + var width = image.width * image.pixelRatio; + var height = image.height * image.pixelRatio; + var padding = 1; + return { + size: [ + image.width, + image.height + ], + tl: [ + (rect.x + padding) / this.width, + (rect.y + padding) / this.height + ], + br: [ + (rect.x + padding + width) / this.width, + (rect.y + padding + height) / this.height + ] + }; +}; +SpriteAtlas.prototype.allocate = function () { + if (!this.data) { + var w = Math.floor(this.width * this.pixelRatio); + var h = Math.floor(this.height * this.pixelRatio); + this.data = new Uint32Array(w * h); + for (var i = 0; i < this.data.length; i++) { + this.data[i] = 0; + } + } +}; +SpriteAtlas.prototype.copy = function (dst, src, wrap) { + if (!this.sprite.img.data) + return; + var srcImg = new Uint32Array(this.sprite.img.data.buffer); + this.allocate(); + var dstImg = this.data; + var padding = 1; + copyBitmap(srcImg, this.sprite.img.width, src.x, src.y, dstImg, this.width * this.pixelRatio, (dst.x + padding) * this.pixelRatio, (dst.y + padding) * this.pixelRatio, src.width, src.height, wrap); + this.dirty = true; +}; +SpriteAtlas.prototype.setSprite = function (sprite) { + if (sprite) { + this.pixelRatio = browser.devicePixelRatio > 1 ? 2 : 1; + if (this.canvas) { + this.canvas.width = this.width * this.pixelRatio; + this.canvas.height = this.height * this.pixelRatio; + } + } + this.sprite = sprite; +}; +SpriteAtlas.prototype.addIcons = function (icons, callback) { + for (var i = 0; i < icons.length; i++) { + this.getImage(icons[i]); + } + callback(null, this.images); +}; +SpriteAtlas.prototype.bind = function (gl, linear) { + var first = false; + if (!this.texture) { + this.texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, this.texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + first = true; + } else { + gl.bindTexture(gl.TEXTURE_2D, this.texture); + } + var filterVal = linear ? gl.LINEAR : gl.NEAREST; + if (filterVal !== this.filter) { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filterVal); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filterVal); + this.filter = filterVal; + } + if (this.dirty) { + this.allocate(); + if (first) { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width * this.pixelRatio, this.height * this.pixelRatio, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(this.data.buffer)); + } else { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width * this.pixelRatio, this.height * this.pixelRatio, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(this.data.buffer)); + } + this.dirty = false; + } +}; +function AtlasImage(rect, width, height, sdf, pixelRatio) { + this.rect = rect; + this.width = width; + this.height = height; + this.sdf = sdf; + this.pixelRatio = pixelRatio; +} +},{"../util/browser":120,"../util/util":136,"shelf-pack":197}],99:[function(require,module,exports){ +'use strict'; +var StructArrayType = require('../util/struct_array'); +var util = require('../util/util'); +var Point = require('point-geometry'); +var SymbolInstancesArray = module.exports = new StructArrayType({ + members: [ + { + type: 'Uint16', + name: 'textBoxStartIndex' + }, + { + type: 'Uint16', + name: 'textBoxEndIndex' + }, + { + type: 'Uint16', + name: 'iconBoxStartIndex' + }, + { + type: 'Uint16', + name: 'iconBoxEndIndex' + }, + { + type: 'Uint16', + name: 'glyphQuadStartIndex' + }, + { + type: 'Uint16', + name: 'glyphQuadEndIndex' + }, + { + type: 'Uint16', + name: 'iconQuadStartIndex' + }, + { + type: 'Uint16', + name: 'iconQuadEndIndex' + }, + { + type: 'Int16', + name: 'anchorPointX' + }, + { + type: 'Int16', + name: 'anchorPointY' + }, + { + type: 'Int8', + name: 'index' + } + ] +}); +util.extendAll(SymbolInstancesArray.prototype.StructType.prototype, { + get anchorPoint() { + return new Point(this.anchorPointX, this.anchorPointY); + } +}); +},{"../util/struct_array":134,"../util/util":136,"point-geometry":194}],100:[function(require,module,exports){ +'use strict'; +var StructArrayType = require('../util/struct_array'); +var util = require('../util/util'); +var Point = require('point-geometry'); +var SymbolQuad = require('./quads').SymbolQuad; +var SymbolQuadsArray = module.exports = new StructArrayType({ + members: [ + { + type: 'Int16', + name: 'anchorPointX' + }, + { + type: 'Int16', + name: 'anchorPointY' + }, + { + type: 'Float32', + name: 'tlX' + }, + { + type: 'Float32', + name: 'tlY' + }, + { + type: 'Float32', + name: 'trX' + }, + { + type: 'Float32', + name: 'trY' + }, + { + type: 'Float32', + name: 'blX' + }, + { + type: 'Float32', + name: 'blY' + }, + { + type: 'Float32', + name: 'brX' + }, + { + type: 'Float32', + name: 'brY' + }, + { + type: 'Int16', + name: 'texH' + }, + { + type: 'Int16', + name: 'texW' + }, + { + type: 'Int16', + name: 'texX' + }, + { + type: 'Int16', + name: 'texY' + }, + { + type: 'Float32', + name: 'anchorAngle' + }, + { + type: 'Float32', + name: 'glyphAngle' + }, + { + type: 'Float32', + name: 'maxScale' + }, + { + type: 'Float32', + name: 'minScale' + } + ] +}); +util.extendAll(SymbolQuadsArray.prototype.StructType.prototype, { + get anchorPoint() { + return new Point(this.anchorPointX, this.anchorPointY); + }, + get SymbolQuad() { + return new SymbolQuad(this.anchorPoint, new Point(this.tlX, this.tlY), new Point(this.trX, this.trY), new Point(this.blX, this.blY), new Point(this.brX, this.brY), { + x: this.texX, + y: this.texY, + h: this.texH, + w: this.texW, + height: this.texH, + width: this.texW + }, this.anchorAngle, this.glyphAngle, this.minScale, this.maxScale); + } +}); +},{"../util/struct_array":134,"../util/util":136,"./quads":95,"point-geometry":194}],101:[function(require,module,exports){ +'use strict'; +var DOM = require('../util/dom'); +var Point = require('point-geometry'); +var handlers = { + scrollZoom: require('./handler/scroll_zoom'), + boxZoom: require('./handler/box_zoom'), + dragRotate: require('./handler/drag_rotate'), + dragPan: require('./handler/drag_pan'), + keyboard: require('./handler/keyboard'), + doubleClickZoom: require('./handler/dblclick_zoom'), + touchZoomRotate: require('./handler/touch_zoom_rotate') +}; +module.exports = function bindHandlers(map, options) { + var el = map.getCanvasContainer(); + var contextMenuEvent = null; + var startPos = null; + var tapped = null; + for (var name in handlers) { + map[name] = new handlers[name](map, options); + if (options.interactive && options[name]) { + map[name].enable(); + } + } + el.addEventListener('mouseout', onMouseOut, false); + el.addEventListener('mousedown', onMouseDown, false); + el.addEventListener('mouseup', onMouseUp, false); + el.addEventListener('mousemove', onMouseMove, false); + el.addEventListener('touchstart', onTouchStart, false); + el.addEventListener('touchend', onTouchEnd, false); + el.addEventListener('touchmove', onTouchMove, false); + el.addEventListener('touchcancel', onTouchCancel, false); + el.addEventListener('click', onClick, false); + el.addEventListener('dblclick', onDblClick, false); + el.addEventListener('contextmenu', onContextMenu, false); + function onMouseOut(e) { + fireMouseEvent('mouseout', e); + } + function onMouseDown(e) { + map.stop(); + startPos = DOM.mousePos(el, e); + fireMouseEvent('mousedown', e); } - - var width = image.width * image.pixelRatio; - var height = image.height * image.pixelRatio; - var padding = 1; - - return { - size: [image.width, image.height], - tl: [(rect.x + padding) / this.width, (rect.y + padding) / this.height], - br: [(rect.x + padding + width) / this.width, (rect.y + padding + height) / this.height] - }; -}; - - -SpriteAtlas.prototype.allocate = function() { - if (!this.data) { - var w = Math.floor(this.width * this.pixelRatio); - var h = Math.floor(this.height * this.pixelRatio); - this.data = new Uint32Array(w * h); - for (var i = 0; i < this.data.length; i++) { - this.data[i] = 0; + function onMouseUp(e) { + var rotating = map.dragRotate && map.dragRotate.isActive(); + if (contextMenuEvent && !rotating) { + fireMouseEvent('contextmenu', contextMenuEvent); } + contextMenuEvent = null; + fireMouseEvent('mouseup', e); } -}; - - -SpriteAtlas.prototype.copy = function(dst, src, wrap) { - if (!this.sprite.img.data) return; - var srcImg = new Uint32Array(this.sprite.img.data.buffer); - - this.allocate(); - var dstImg = this.data; - - var padding = 1; - - copyBitmap( - /* source buffer */ srcImg, - /* source stride */ this.sprite.img.width, - /* source x */ src.x, - /* source y */ src.y, - /* dest buffer */ dstImg, - /* dest stride */ this.width * this.pixelRatio, - /* dest x */ (dst.x + padding) * this.pixelRatio, - /* dest y */ (dst.y + padding) * this.pixelRatio, - /* icon dimension */ src.width, - /* icon dimension */ src.height, - /* wrap */ wrap - ); - - this.dirty = true; -}; - -SpriteAtlas.prototype.setSprite = function(sprite) { - if (sprite) { - this.pixelRatio = browser.devicePixelRatio > 1 ? 2 : 1; - - if (this.canvas) { - this.canvas.width = this.width * this.pixelRatio; - this.canvas.height = this.height * this.pixelRatio; + function onMouseMove(e) { + if (map.dragPan && map.dragPan.isActive()) + return; + if (map.dragRotate && map.dragRotate.isActive()) + return; + var target = e.toElement || e.target; + while (target && target !== el) + target = target.parentNode; + if (target !== el) + return; + fireMouseEvent('mousemove', e); + } + function onTouchStart(e) { + map.stop(); + fireTouchEvent('touchstart', e); + if (!e.touches || e.touches.length > 1) + return; + if (!tapped) { + tapped = setTimeout(onTouchTimeout, 300); + } else { + clearTimeout(tapped); + tapped = null; + fireMouseEvent('dblclick', e); } } - this.sprite = sprite; -}; - -SpriteAtlas.prototype.addIcons = function(icons, callback) { - for (var i = 0; i < icons.length; i++) { - this.getImage(icons[i]); + function onTouchMove(e) { + fireTouchEvent('touchmove', e); } - - callback(null, this.images); -}; - -SpriteAtlas.prototype.bind = function(gl, linear) { - var first = false; - if (!this.texture) { - this.texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, this.texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - first = true; - } else { - gl.bindTexture(gl.TEXTURE_2D, this.texture); + function onTouchEnd(e) { + fireTouchEvent('touchend', e); } - - var filterVal = linear ? gl.LINEAR : gl.NEAREST; - if (filterVal !== this.filter) { - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filterVal); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filterVal); - this.filter = filterVal; + function onTouchCancel(e) { + fireTouchEvent('touchcancel', e); } - - if (this.dirty) { - this.allocate(); - - if (first) { - gl.texImage2D( - gl.TEXTURE_2D, // enum target - 0, // ind level - gl.RGBA, // ind internalformat - this.width * this.pixelRatio, // GLsizei width - this.height * this.pixelRatio, // GLsizei height - 0, // ind border - gl.RGBA, // enum format - gl.UNSIGNED_BYTE, // enum type - new Uint8Array(this.data.buffer) // Object data - ); - } else { - gl.texSubImage2D( - gl.TEXTURE_2D, // enum target - 0, // int level - 0, // int xoffset - 0, // int yoffset - this.width * this.pixelRatio, // long width - this.height * this.pixelRatio, // long height - gl.RGBA, // enum format - gl.UNSIGNED_BYTE, // enum type - new Uint8Array(this.data.buffer) // Object pixels - ); + function onTouchTimeout() { + tapped = null; + } + function onClick(e) { + var pos = DOM.mousePos(el, e); + if (pos.equals(startPos)) { + fireMouseEvent('click', e); } - - this.dirty = false; + } + function onDblClick(e) { + fireMouseEvent('dblclick', e); + e.preventDefault(); + } + function onContextMenu(e) { + contextMenuEvent = e; + e.preventDefault(); + } + function fireMouseEvent(type, e) { + var pos = DOM.mousePos(el, e); + return map.fire(type, { + lngLat: map.unproject(pos), + point: pos, + originalEvent: e + }); + } + function fireTouchEvent(type, e) { + var touches = DOM.touchPos(el, e); + var singular = touches.reduce(function (prev, curr, i, arr) { + return prev.add(curr.div(arr.length)); + }, new Point(0, 0)); + return map.fire(type, { + lngLat: map.unproject(singular), + point: singular, + lngLats: touches.map(function (t) { + return map.unproject(t); + }, this), + points: touches, + originalEvent: e + }); } }; - -function AtlasImage(rect, width, height, sdf, pixelRatio) { - this.rect = rect; - this.width = width; - this.height = height; - this.sdf = sdf; - this.pixelRatio = pixelRatio; -} - -},{"../util/browser":105,"shelf-pack":176}],87:[function(require,module,exports){ +},{"../util/dom":122,"./handler/box_zoom":107,"./handler/dblclick_zoom":108,"./handler/drag_pan":109,"./handler/drag_rotate":110,"./handler/keyboard":111,"./handler/scroll_zoom":112,"./handler/touch_zoom_rotate":113,"point-geometry":194}],102:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var interpolate = require('../util/interpolate'); var browser = require('../util/browser'); var LngLat = require('../geo/lng_lat'); var LngLatBounds = require('../geo/lng_lat_bounds'); var Point = require('point-geometry'); - -/** - * Options common to Map#jumpTo, Map#easeTo, and Map#flyTo, controlling the destination - * location, zoom level, bearing and pitch. All properties are options; unspecified - * options will default to the current value for that property. - * - * @typedef {Object} CameraOptions - * @property {LngLat} center Map center - * @property {number} zoom Map zoom level - * @property {number} bearing Map rotation bearing in degrees counter-clockwise from north - * @property {number} pitch Map angle in degrees at which the camera is looking at the ground - * @property {LngLat} around If zooming, the zoom center (defaults to map center) - */ - -/** - * Options common to map movement methods that involve animation, such as Map#panBy and - * Map#easeTo, controlling the duration of the animation and easing function. All properties - * are optional. - * - * @typedef {Object} AnimationOptions - * @property {number} duration Number in milliseconds - * @property {Function} easing - * @property {Array} offset point, origin of movement relative to map center - * @property {boolean} animate When set to false, no animation happens - */ - -var Camera = module.exports = function() {}; - -util.extend(Camera.prototype, /** @lends Map.prototype */{ - /** - * Get the current view geographical point. - * @returns {LngLat} - */ - getCenter: function() { return this.transform.center; }, - - /** - * Sets a map location. Equivalent to `jumpTo({center: center})`. - * - * @param {LngLat} center Map center to jump to - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - * @example - * map.setCenter([-74, 38]); - */ - setCenter: function(center, eventData) { - this.jumpTo({center: center}, eventData); +var Camera = module.exports = function () { +}; +util.extend(Camera.prototype, { + getCenter: function () { + return this.transform.center; + }, + setCenter: function (center, eventData) { + this.jumpTo({ center: center }, eventData); return this; }, - - /** - * Pan by a certain number of pixels - * - * @param {Array} offset [x, y] - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - panBy: function(offset, options, eventData) { - this.panTo(this.transform.center, - util.extend({offset: Point.convert(offset).mult(-1)}, options), eventData); + panBy: function (offset, options, eventData) { + this.panTo(this.transform.center, util.extend({ offset: Point.convert(offset).mult(-1) }, options), eventData); return this; }, - - /** - * Pan to a certain location with easing - * - * @param {LngLat} lnglat Location to pan to - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - panTo: function(lnglat, options, eventData) { - return this.easeTo(util.extend({ - center: lnglat - }, options), eventData); + panTo: function (lnglat, options, eventData) { + return this.easeTo(util.extend({ center: lnglat }, options), eventData); }, - - - /** - * Get the current zoom - * @returns {number} - */ - getZoom: function() { return this.transform.zoom; }, - - /** - * Sets a map zoom. Equivalent to `jumpTo({zoom: zoom})`. - * - * @param {number} zoom Map zoom level - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - * @example - * // zoom the map to 5 - * map.setZoom(5); - */ - setZoom: function(zoom, eventData) { - this.jumpTo({zoom: zoom}, eventData); + getZoom: function () { + return this.transform.zoom; + }, + setZoom: function (zoom, eventData) { + this.jumpTo({ zoom: zoom }, eventData); return this; }, - - /** - * Zooms to a certain zoom level with easing. - * - * @param {number} zoom - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - */ - zoomTo: function(zoom, options, eventData) { - return this.easeTo(util.extend({ - zoom: zoom - }, options), eventData); + zoomTo: function (zoom, options, eventData) { + return this.easeTo(util.extend({ zoom: zoom }, options), eventData); }, - - /** - * Zoom in by 1 level - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - */ - zoomIn: function(options, eventData) { + zoomIn: function (options, eventData) { this.zoomTo(this.getZoom() + 1, options, eventData); return this; }, - - /** - * Zoom out by 1 level - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - */ - zoomOut: function(options, eventData) { + zoomOut: function (options, eventData) { this.zoomTo(this.getZoom() - 1, options, eventData); return this; }, - - - /** - * Get the current bearing in degrees - * @returns {number} - */ - getBearing: function() { return this.transform.bearing; }, - - /** - * Sets a map rotation. Equivalent to `jumpTo({bearing: bearing})`. - * - * @param {number} bearing Map rotation bearing in degrees counter-clockwise from north - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - * @example - * // rotate the map to 90 degrees - * map.setBearing(90); - */ - setBearing: function(bearing, eventData) { - this.jumpTo({bearing: bearing}, eventData); + getBearing: function () { + return this.transform.bearing; + }, + setBearing: function (bearing, eventData) { + this.jumpTo({ bearing: bearing }, eventData); return this; }, - - /** - * Rotate bearing by a certain number of degrees with easing - * - * @param {number} bearing - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - rotateTo: function(bearing, options, eventData) { - return this.easeTo(util.extend({ - bearing: bearing - }, options), eventData); + rotateTo: function (bearing, options, eventData) { + return this.easeTo(util.extend({ bearing: bearing }, options), eventData); }, - - /** - * Sets map bearing to 0 (north) with easing - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - resetNorth: function(options, eventData) { - this.rotateTo(0, util.extend({duration: 1000}, options), eventData); + resetNorth: function (options, eventData) { + this.rotateTo(0, util.extend({ duration: 1000 }, options), eventData); return this; }, - - /** - * Animates map bearing to 0 (north) if it's already close to it. - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - snapToNorth: function(options, eventData) { - if (Math.abs(this.getBearing()) < this.options.bearingSnap) { + snapToNorth: function (options, eventData) { + if (Math.abs(this.getBearing()) < this._bearingSnap) { return this.resetNorth(options, eventData); } return this; }, - - /** - * Get the current angle in degrees - * @returns {number} - */ - getPitch: function() { return this.transform.pitch; }, - - /** - * Sets a map angle. Equivalent to `jumpTo({pitch: pitch})`. - * - * @param {number} pitch The angle at which the camera is looking at the ground - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - setPitch: function(pitch, eventData) { - this.jumpTo({pitch: pitch}, eventData); + getPitch: function () { + return this.transform.pitch; + }, + setPitch: function (pitch, eventData) { + this.jumpTo({ pitch: pitch }, eventData); return this; }, - - - /** - * Zoom to contain certain geographical bounds - * - * @param {LngLatBounds|Array>} bounds [[minLng, minLat], [maxLng, maxLat]] - * @param {Object} options - * @param {boolean} [options.linear] When true, the map transitions to the new camera using - * {@link #Map.easeTo}. When false, the map transitions using {@link #Map.flyTo}. See - * {@link #Map.flyTo} for information on options specific to that animation transition. - * @param {Function} options.easing - * @param {number} options.padding how much padding there is around the given bounds on each side in pixels - * @param {number} options.maxZoom The resulting zoom level will be at most - * this value. - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - fitBounds: function(bounds, options, eventData) { - + fitBounds: function (bounds, options, eventData) { options = util.extend({ padding: 0, - offset: [0, 0], + offset: [ + 0, + 0 + ], maxZoom: Infinity }, options); - bounds = LngLatBounds.convert(bounds); - - var offset = Point.convert(options.offset), - tr = this.transform, - nw = tr.project(bounds.getNorthWest()), - se = tr.project(bounds.getSouthEast()), - size = se.sub(nw), - scaleX = (tr.width - options.padding * 2 - Math.abs(offset.x) * 2) / size.x, - scaleY = (tr.height - options.padding * 2 - Math.abs(offset.y) * 2) / size.y; - + var offset = Point.convert(options.offset), tr = this.transform, nw = tr.project(bounds.getNorthWest()), se = tr.project(bounds.getSouthEast()), size = se.sub(nw), scaleX = (tr.width - options.padding * 2 - Math.abs(offset.x) * 2) / size.x, scaleY = (tr.height - options.padding * 2 - Math.abs(offset.y) * 2) / size.y; options.center = tr.unproject(nw.add(se).div(2)); options.zoom = Math.min(tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom); options.bearing = 0; - - return options.linear ? - this.easeTo(options, eventData) : - this.flyTo(options, eventData); + return options.linear ? this.easeTo(options, eventData) : this.flyTo(options, eventData); }, - - /** - * Change any combination of center, zoom, bearing, and pitch, without - * a transition. The map will retain the current values for any options - * not included in `options`. - * - * @param {CameraOptions} options map view options - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires rotate - * @fires pitch - * @fires zoomend - * @fires moveend - * @returns {Map} `this` - */ - jumpTo: function(options, eventData) { + jumpTo: function (options, eventData) { this.stop(); - - var tr = this.transform, - zoomChanged = false, - bearingChanged = false, - pitchChanged = false; - + var tr = this.transform, zoomChanged = false, bearingChanged = false, pitchChanged = false; if ('zoom' in options && tr.zoom !== +options.zoom) { zoomChanged = true; tr.zoom = +options.zoom; } - if ('center' in options) { tr.center = LngLat.convert(options.center); } - if ('bearing' in options && tr.bearing !== +options.bearing) { bearingChanged = true; tr.bearing = +options.bearing; } - if ('pitch' in options && tr.pitch !== +options.pitch) { pitchChanged = true; tr.pitch = +options.pitch; } - - this.fire('movestart', eventData) - .fire('move', eventData); - + this.fire('movestart', eventData).fire('move', eventData); if (zoomChanged) { - this.fire('zoomstart', eventData) - .fire('zoom', eventData) - .fire('zoomend', eventData); + this.fire('zoomstart', eventData).fire('zoom', eventData).fire('zoomend', eventData); } - if (bearingChanged) { this.fire('rotate', eventData); } - if (pitchChanged) { this.fire('pitch', eventData); } - return this.fire('moveend', eventData); }, - - /** - * Change any combination of center, zoom, bearing, and pitch, with a smooth animation - * between old and new values. The map will retain the current values for any options - * not included in `options`. - * - * @param {CameraOptions|AnimationOptions} options map view and animation options - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires rotate - * @fires pitch - * @fires zoomend - * @fires moveend - * @returns {Map} `this` - */ - easeTo: function(options, eventData) { + easeTo: function (options, eventData) { this.stop(); - options = util.extend({ - offset: [0, 0], + offset: [ + 0, + 0 + ], duration: 500, easing: util.ease }, options); - - var tr = this.transform, - offset = Point.convert(options.offset), - startZoom = this.getZoom(), - startBearing = this.getBearing(), - startPitch = this.getPitch(), - - zoom = 'zoom' in options ? +options.zoom : startZoom, - bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing, - pitch = 'pitch' in options ? +options.pitch : startPitch, - - toLngLat, - toPoint; - + var tr = this.transform, offset = Point.convert(options.offset), startZoom = this.getZoom(), startBearing = this.getBearing(), startPitch = this.getPitch(), zoom = 'zoom' in options ? +options.zoom : startZoom, bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing, pitch = 'pitch' in options ? +options.pitch : startPitch, toLngLat, toPoint; if ('center' in options) { toLngLat = LngLat.convert(options.center); toPoint = tr.centerPoint.add(offset); @@ -23700,39 +24808,30 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ toPoint = tr.centerPoint.add(offset); toLngLat = tr.pointLocation(toPoint); } - var fromPoint = tr.locationPoint(toLngLat); - - if (options.animate === false) options.duration = 0; - - this.zooming = (zoom !== startZoom); - this.rotating = (startBearing !== bearing); - this.pitching = (pitch !== startPitch); - + if (options.animate === false) + options.duration = 0; + this.zooming = zoom !== startZoom; + this.rotating = startBearing !== bearing; + this.pitching = pitch !== startPitch; if (!options.noMoveStart) { this.fire('movestart', eventData); } if (this.zooming) { this.fire('zoomstart', eventData); } - clearTimeout(this._onEaseEnd); - this._ease(function (k) { if (this.zooming) { tr.zoom = interpolate(startZoom, zoom, k); } - if (this.rotating) { tr.bearing = interpolate(startBearing, bearing, k); } - if (this.pitching) { tr.pitch = interpolate(startPitch, pitch, k); } - tr.setLocationAtPoint(toLngLat, fromPoint.add(toPoint.sub(fromPoint)._mult(k))); - this.fire('move', eventData); if (this.zooming) { this.fire('zoom', eventData); @@ -23743,106 +24842,41 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ if (this.pitching) { this.fire('pitch', eventData); } - }, function() { + }, function () { if (options.delayEndEvents) { this._onEaseEnd = setTimeout(this._easeToEnd.bind(this, eventData), options.delayEndEvents); } else { this._easeToEnd(eventData); } }.bind(this), options); - return this; }, - - _easeToEnd: function(eventData) { - if (this.zooming) { - this.fire('zoomend', eventData); - } - this.fire('moveend', eventData); - + _easeToEnd: function (eventData) { + var wasZooming = this.zooming; this.zooming = false; this.rotating = false; this.pitching = false; + if (wasZooming) { + this.fire('zoomend', eventData); + } + this.fire('moveend', eventData); }, - - /** - * Change any combination of center, zoom, bearing, and pitch, animated along a curve that - * evokes flight. The transition animation seamlessly incorporates zooming and panning to help - * the user find his or her bearings even after traversing a great distance. - * - * @param {CameraOptions|AnimationOptions} options map view and animation options - * @param {number} [options.curve=1.42] Relative amount of zooming that takes place along the - * flight path. A high value maximizes zooming for an exaggerated animation, while a low - * value minimizes zooming for something closer to {@link #Map.easeTo}. 1.42 is the average - * value selected by participants in the user study in - * [van Wijk (2003)](https://www.win.tue.nl/~vanwijk/zoompan.pdf). A value of - * `Math.pow(6, 0.25)` would be equivalent to the root mean squared average velocity. A - * value of 1 would produce a circular motion. - * @param {number} [options.minZoom] Zero-based zoom level at the peak of the flight path. If - * `options.curve` is specified, this option is ignored. - * @param {number} [options.speed=1.2] Average speed of the animation. A speed of 1.2 means that - * the map appears to move along the flight path by 1.2 times `options.curve` screenfuls every - * second. A _screenful_ is the visible span in pixels. It does not correspond to a fixed - * physical distance but rather varies by zoom level. - * @param {number} [options.screenSpeed] Average speed of the animation, measured in screenfuls - * per second, assuming a linear timing curve. If `options.speed` is specified, this option - * is ignored. - * @param {Function} [options.easing] Transition timing curve - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires rotate - * @fires pitch - * @fires zoomend - * @fires moveend - * @returns {this} - * @example - * // fly with default options to null island - * map.flyTo({center: [0, 0], zoom: 9}); - * // using flyTo options - * map.flyTo({ - * center: [0, 0], - * zoom: 9, - * speed: 0.2, - * curve: 1, - * easing: function(t) { - * return t; - * } - * }); - */ - flyTo: function(options, eventData) { - // This method implements an “optimal path” animation, as detailed in: - // - // Van Wijk, Jarke J.; Nuij, Wim A. A. “Smooth and efficient zooming and panning.” INFOVIS - // ’03. pp. 15–22. . - // - // Where applicable, local variable documentation begins with the associated variable or - // function in van Wijk (2003). - + flyTo: function (options, eventData) { this.stop(); - options = util.extend({ - offset: [0, 0], + offset: [ + 0, + 0 + ], speed: 1.2, curve: 1.42, easing: util.ease }, options); - - var tr = this.transform, - offset = Point.convert(options.offset), - startZoom = this.getZoom(), - startBearing = this.getBearing(), - startPitch = this.getPitch(); - + var tr = this.transform, offset = Point.convert(options.offset), startZoom = this.getZoom(), startBearing = this.getBearing(), startPitch = this.getPitch(); var center = 'center' in options ? LngLat.convert(options.center) : this.getCenter(); - var zoom = 'zoom' in options ? +options.zoom : startZoom; + var zoom = 'zoom' in options ? +options.zoom : startZoom; var bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing; var pitch = 'pitch' in options ? +options.pitch : startPitch; - - // If a path crossing the antimeridian would be shorter, extend the final coordinate so that - // interpolating between the two endpoints will cross it. if (Math.abs(tr.center.lng) + Math.abs(center.lng) > 180) { if (tr.center.lng > 0 && center.lng < 0) { center.lng += 360; @@ -23850,108 +24884,67 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ center.lng -= 360; } } - - var scale = tr.zoomScale(zoom - startZoom), - from = tr.point, - to = 'center' in options ? tr.project(center).sub(offset.div(scale)) : from; - - var startWorldSize = tr.worldSize, - rho = options.curve, - - // w₀: Initial visible span, measured in pixels at the initial scale. - w0 = Math.max(tr.width, tr.height), - // w₁: Final visible span, measured in pixels with respect to the initial scale. - w1 = w0 / scale, - // Length of the flight path as projected onto the ground plane, measured in pixels from - // the world image origin at the initial scale. - u1 = to.sub(from).mag(); - + var scale = tr.zoomScale(zoom - startZoom), from = tr.point, to = 'center' in options ? tr.project(center).sub(offset.div(scale)) : from; + var startWorldSize = tr.worldSize, rho = options.curve, w0 = Math.max(tr.width, tr.height), w1 = w0 / scale, u1 = to.sub(from).mag(); if ('minZoom' in options) { var minZoom = util.clamp(Math.min(options.minZoom, startZoom, zoom), tr.minZoom, tr.maxZoom); - // wm: Maximum visible span, measured in pixels with respect to the initial - // scale. var wMax = w0 / tr.zoomScale(minZoom - startZoom); rho = Math.sqrt(wMax / u1 * 2); } - - // ρ² var rho2 = rho * rho; - - /** - * rᵢ: Returns the zoom-out factor at one end of the animation. - * - * @param i 0 for the ascent or 1 for the descent. - * @private - */ function r(i) { var b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1); return Math.log(Math.sqrt(b * b + 1) - b); } - - function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; } - function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; } - function tanh(n) { return sinh(n) / cosh(n); } - - // r₀: Zoom-out factor during ascent. - var r0 = r(0), - /** - * w(s): Returns the visible span on the ground, measured in pixels with respect to the - * initial scale. - * - * Assumes an angular field of view of 2 arctan ½ ≈ 53°. - * @private - */ - w = function (s) { return (cosh(r0) / cosh(r0 + rho * s)); }, - /** - * u(s): Returns the distance along the flight path as projected onto the ground plane, - * measured in pixels from the world image origin at the initial scale. - * @private - */ - u = function (s) { return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1; }, - // S: Total length of the flight path, measured in ρ-screenfuls. - S = (r(1) - r0) / rho; - - // When u₀ = u₁, the optimal path doesn’t require both ascent and descent. + function sinh(n) { + return (Math.exp(n) - Math.exp(-n)) / 2; + } + function cosh(n) { + return (Math.exp(n) + Math.exp(-n)) / 2; + } + function tanh(n) { + return sinh(n) / cosh(n); + } + var r0 = r(0), w = function (s) { + return cosh(r0) / cosh(r0 + rho * s); + }, u = function (s) { + return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1; + }, S = (r(1) - r0) / rho; if (Math.abs(u1) < 0.000001) { - // Perform a more or less instantaneous transition if the path is too short. - if (Math.abs(w0 - w1) < 0.000001) return this.easeTo(options); - + if (Math.abs(w0 - w1) < 0.000001) + return this.easeTo(options); var k = w1 < w0 ? -1 : 1; S = Math.abs(Math.log(w1 / w0)) / rho; - - u = function() { return 0; }; - w = function(s) { return Math.exp(k * rho * s); }; + u = function () { + return 0; + }; + w = function (s) { + return Math.exp(k * rho * s); + }; } - if ('duration' in options) { options.duration = +options.duration; } else { var V = 'screenSpeed' in options ? +options.screenSpeed / rho : +options.speed; options.duration = 1000 * S / V; } - this.zooming = true; - if (startBearing !== bearing) this.rotating = true; - if (startPitch !== pitch) this.pitching = true; - + if (startBearing !== bearing) + this.rotating = true; + if (startPitch !== pitch) + this.pitching = true; this.fire('movestart', eventData); this.fire('zoomstart', eventData); - this._ease(function (k) { - // s: The distance traveled along the flight path, measured in ρ-screenfuls. - var s = k * S, - us = u(s); - + var s = k * S, us = u(s); tr.zoom = startZoom + tr.scaleZoom(1 / w(s)); tr.center = tr.unproject(from.add(to.sub(from).mult(us)), startWorldSize); - if (this.rotating) { tr.bearing = interpolate(startBearing, bearing, k); } if (this.pitching) { tr.pitch = interpolate(startPitch, pitch, k); } - this.fire('move', eventData); this.fire('zoom', eventData); if (this.rotating) { @@ -23960,35 +24953,26 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ if (this.pitching) { this.fire('pitch', eventData); } - }, function() { - this.fire('zoomend', eventData); - this.fire('moveend', eventData); + }, function () { this.zooming = false; this.rotating = false; this.pitching = false; + this.fire('zoomend', eventData); + this.fire('moveend', eventData); }, options); - return this; }, - - isEasing: function() { + isEasing: function () { return !!this._abortFn; }, - - /** - * Stop current animation - * - * @returns {Map} `this` - */ - stop: function() { + stop: function () { if (this._abortFn) { this._abortFn(); this._finishEase(); } return this; }, - - _ease: function(frame, finish, options) { + _ease: function (frame, finish, options) { this._finishFn = finish; this._abortFn = browser.timed(function (t) { frame.call(this, options.easing(t)); @@ -23997,166 +24981,102 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ } }, options.animate === false ? 0 : options.duration, this); }, - - _finishEase: function() { + _finishEase: function () { delete this._abortFn; - // The finish function might emit events which trigger new eases, which - // set a new _finishFn. Ensure we don't delete it unintentionally. var finish = this._finishFn; delete this._finishFn; finish.call(this); }, - - // convert bearing so that it's numerically close to the current one so that it interpolates properly - _normalizeBearing: function(bearing, currentBearing) { + _normalizeBearing: function (bearing, currentBearing) { bearing = util.wrap(bearing, -180, 180); var diff = Math.abs(bearing - currentBearing); - if (Math.abs(bearing - 360 - currentBearing) < diff) bearing -= 360; - if (Math.abs(bearing + 360 - currentBearing) < diff) bearing += 360; + if (Math.abs(bearing - 360 - currentBearing) < diff) + bearing -= 360; + if (Math.abs(bearing + 360 - currentBearing) < diff) + bearing += 360; return bearing; }, - - _updateEasing: function(duration, zoom, bezier) { + _updateEasing: function (duration, zoom, bezier) { var easing; - if (this.ease) { - var ease = this.ease, - t = (Date.now() - ease.start) / ease.duration, - speed = ease.easing(t + 0.01) - ease.easing(t), - - // Quick hack to make new bezier that is continuous with last - x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01, - y = Math.sqrt(0.27 * 0.27 - x * x); - + var ease = this.ease, t = (Date.now() - ease.start) / ease.duration, speed = ease.easing(t + 0.01) - ease.easing(t), x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01, y = Math.sqrt(0.27 * 0.27 - x * x); easing = util.bezier(x, y, 0.25, 1); } else { easing = bezier ? util.bezier.apply(util, bezier) : util.ease; } - - // store information on current easing this.ease = { - start: (new Date()).getTime(), + start: new Date().getTime(), to: Math.pow(2, zoom), duration: duration, easing: easing }; - return easing; } }); - -/** - * Pitch event. This event is emitted whenever the map's pitch changes. - * - * @event pitch - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../geo/lng_lat":26,"../geo/lng_lat_bounds":27,"../util/browser":105,"../util/interpolate":113,"../util/util":119,"point-geometry":174}],88:[function(require,module,exports){ +},{"../geo/lng_lat":33,"../geo/lng_lat_bounds":34,"../util/browser":120,"../util/interpolate":130,"../util/util":136,"point-geometry":194}],103:[function(require,module,exports){ 'use strict'; - var Control = require('./control'); var DOM = require('../../util/dom'); var util = require('../../util/util'); - module.exports = Attribution; - -/** - * Creates an attribution control - * @class Attribution - * @param {Object} [options] - * @param {string} [options.position='bottom-right'] A string indicating the control's position on the map. Options are `top-right`, `top-left`, `bottom-right`, `bottom-left` - * @example - * var map = new mapboxgl.Map({attributionControl: false}) - * .addControl(new mapboxgl.Attribution({position: 'top-left'})); - */ function Attribution(options) { util.setOptions(this, options); } - -Attribution.createAttributionString = function(sources) { +Attribution.createAttributionString = function (sources) { var attributions = []; - for (var id in sources) { var source = sources[id]; if (source.attribution && attributions.indexOf(source.attribution) < 0) { attributions.push(source.attribution); } } - - // remove any entries that are substrings of another entry. - // first sort by length so that substrings come first - attributions.sort(function (a, b) { return a.length - b.length; }); + attributions.sort(function (a, b) { + return a.length - b.length; + }); attributions = attributions.filter(function (attrib, i) { for (var j = i + 1; j < attributions.length; j++) { - if (attributions[j].indexOf(attrib) >= 0) { return false; } + if (attributions[j].indexOf(attrib) >= 0) { + return false; + } } return true; }); - return attributions.join(' | '); }; - Attribution.prototype = util.inherit(Control, { - options: { - position: 'bottom-right' - }, - - onAdd: function(map) { - var className = 'mapboxgl-ctrl-attrib', - container = this._container = DOM.create('div', className, map.getContainer()); - + options: { position: 'bottom-right' }, + onAdd: function (map) { + var className = 'mapboxgl-ctrl-attrib', container = this._container = DOM.create('div', className, map.getContainer()); this._update(); map.on('source.load', this._update.bind(this)); map.on('source.change', this._update.bind(this)); map.on('source.remove', this._update.bind(this)); map.on('moveend', this._updateEditLink.bind(this)); - return container; }, - - _update: function() { + _update: function () { if (this._map.style) { this._container.innerHTML = Attribution.createAttributionString(this._map.style.sources); } - this._editLink = this._container.getElementsByClassName('mapbox-improve-map')[0]; this._updateEditLink(); }, - - _updateEditLink: function() { + _updateEditLink: function () { if (this._editLink) { var center = this._map.getCenter(); - this._editLink.href = 'https://www.mapbox.com/map-feedback/#/' + - center.lng + '/' + center.lat + '/' + Math.round(this._map.getZoom() + 1); + this._editLink.href = 'https://www.mapbox.com/map-feedback/#/' + center.lng + '/' + center.lat + '/' + Math.round(this._map.getZoom() + 1); } } }); - -},{"../../util/dom":108,"../../util/util":119,"./control":89}],89:[function(require,module,exports){ +},{"../../util/dom":122,"../../util/util":136,"./control":104}],104:[function(require,module,exports){ 'use strict'; - +var util = require('../../util/util'); +var Evented = require('../../util/evented'); module.exports = Control; - -/** - * A base class for map-related interface elements. - * - * @class Control - */ -function Control() {} - +function Control() { +} Control.prototype = { - /** - * Add this control to the map, returning the control itself - * for chaining. This will insert the control's DOM element into - * the map's DOM element if the control has a `position` specified. - * - * @param {Map} map - * @returns {Control} `this` - */ - addTo: function(map) { + addTo: function (map) { this._map = map; var container = this._container = this.onAdd(map); if (this.options && this.options.position) { @@ -24169,200 +25089,146 @@ Control.prototype = { corner.appendChild(container); } } - return this; }, - - /** - * Remove this control from the map it has been added to. - * - * @returns {Control} `this` - */ - remove: function() { + remove: function () { this._container.parentNode.removeChild(this._container); - if (this.onRemove) this.onRemove(this._map); + if (this.onRemove) + this.onRemove(this._map); this._map = null; return this; } }; - -},{}],90:[function(require,module,exports){ +util.extend(Control.prototype, Evented); +},{"../../util/evented":128,"../../util/util":136}],105:[function(require,module,exports){ 'use strict'; - var Control = require('./control'); var browser = require('../../util/browser'); var DOM = require('../../util/dom'); var util = require('../../util/util'); - module.exports = Geolocate; - -var geoOptions = { enableHighAccuracy: false, timeout: 6000 /* 6sec */ }; - - -/** - * Creates a geolocation control - * @class Geolocate - * @param {Object} [options] - * @param {string} [options.position='top-right'] A string indicating the control's position on the map. Options are `top-right`, `top-left`, `bottom-right`, `bottom-left` - * @example - * map.addControl(new mapboxgl.Geolocate({position: 'top-left'})); // position is optional - */ +var geoOptions = { + enableHighAccuracy: false, + timeout: 6000 +}; function Geolocate(options) { util.setOptions(this, options); } - Geolocate.prototype = util.inherit(Control, { - options: { - position: 'top-right' - }, - - onAdd: function(map) { + options: { position: 'top-right' }, + onAdd: function (map) { var className = 'mapboxgl-ctrl'; - var container = this._container = DOM.create('div', className + '-group', map.getContainer()); - if (!browser.supportsGeolocation) return container; - + if (!browser.supportsGeolocation) + return container; this._container.addEventListener('contextmenu', this._onContextMenu.bind(this)); - - this._geolocateButton = DOM.create('button', (className + '-icon ' + className + '-geolocate'), this._container); + this._geolocateButton = DOM.create('button', className + '-icon ' + className + '-geolocate', this._container); + this._geolocateButton.type = 'button'; this._geolocateButton.addEventListener('click', this._onClickGeolocate.bind(this)); return container; }, - - _onContextMenu: function(e) { + _onContextMenu: function (e) { e.preventDefault(); }, - - _onClickGeolocate: function() { + _onClickGeolocate: function () { navigator.geolocation.getCurrentPosition(this._success.bind(this), this._error.bind(this), geoOptions); - - // This timeout ensures that we still call finish() even if - // the user declines to share their location in Firefox - this._timeoutId = setTimeout(this._finish.bind(this), 10000 /* 10sec */); + this._timeoutId = setTimeout(this._finish.bind(this), 10000); }, - - _success: function(position) { + _success: function (position) { this._map.jumpTo({ - center: [position.coords.longitude, position.coords.latitude], + center: [ + position.coords.longitude, + position.coords.latitude + ], zoom: 17, bearing: 0, pitch: 0 }); + this.fire('geolocate', position); this._finish(); }, - - _error: function() { + _error: function (error) { + this.fire('error', error); this._finish(); }, - - _finish: function() { - if (this._timeoutId) { clearTimeout(this._timeoutId); } + _finish: function () { + if (this._timeoutId) { + clearTimeout(this._timeoutId); + } this._timeoutId = undefined; } - }); - - -},{"../../util/browser":105,"../../util/dom":108,"../../util/util":119,"./control":89}],91:[function(require,module,exports){ +},{"../../util/browser":120,"../../util/dom":122,"../../util/util":136,"./control":104}],106:[function(require,module,exports){ 'use strict'; - var Control = require('./control'); var DOM = require('../../util/dom'); var util = require('../../util/util'); - module.exports = Navigation; - -/** - * Creates a navigation control with zoom buttons and a compass - * @class Navigation - * @param {Object} [options] - * @param {string} [options.position='top-right'] A string indicating the control's position on the map. Options are `top-right`, `top-left`, `bottom-right`, `bottom-left` - * @example - * map.addControl(new mapboxgl.Navigation({position: 'top-left'})); // position is optional - */ function Navigation(options) { util.setOptions(this, options); } - Navigation.prototype = util.inherit(Control, { - options: { - position: 'top-right' - }, - - onAdd: function(map) { + options: { position: 'top-right' }, + onAdd: function (map) { var className = 'mapboxgl-ctrl'; - var container = this._container = DOM.create('div', className + '-group', map.getContainer()); this._container.addEventListener('contextmenu', this._onContextMenu.bind(this)); - this._zoomInButton = this._createButton(className + '-icon ' + className + '-zoom-in', map.zoomIn.bind(map)); this._zoomOutButton = this._createButton(className + '-icon ' + className + '-zoom-out', map.zoomOut.bind(map)); this._compass = this._createButton(className + '-icon ' + className + '-compass', map.resetNorth.bind(map)); - this._compassArrow = DOM.create('div', 'arrow', this._compass); - this._compass.addEventListener('mousedown', this._onCompassDown.bind(this)); this._onCompassMove = this._onCompassMove.bind(this); this._onCompassUp = this._onCompassUp.bind(this); - map.on('rotate', this._rotateCompassArrow.bind(this)); this._rotateCompassArrow(); - this._el = map.getCanvasContainer(); - return container; }, - - _onContextMenu: function(e) { + _onContextMenu: function (e) { e.preventDefault(); }, - - _onCompassDown: function(e) { - if (e.button !== 0) return; - + _onCompassDown: function (e) { + if (e.button !== 0) + return; DOM.disableDrag(); document.addEventListener('mousemove', this._onCompassMove); document.addEventListener('mouseup', this._onCompassUp); - this._el.dispatchEvent(copyMouseEvent(e)); e.stopPropagation(); }, - - _onCompassMove: function(e) { - if (e.button !== 0) return; - + _onCompassMove: function (e) { + if (e.button !== 0) + return; this._el.dispatchEvent(copyMouseEvent(e)); e.stopPropagation(); }, - - _onCompassUp: function(e) { - if (e.button !== 0) return; - + _onCompassUp: function (e) { + if (e.button !== 0) + return; document.removeEventListener('mousemove', this._onCompassMove); document.removeEventListener('mouseup', this._onCompassUp); DOM.enableDrag(); - this._el.dispatchEvent(copyMouseEvent(e)); e.stopPropagation(); }, - - _createButton: function(className, fn) { + _createButton: function (className, fn) { var a = DOM.create('button', className, this._container); - a.addEventListener('click', function() { fn(); }); + a.type = 'button'; + a.addEventListener('click', function () { + fn(); + }); return a; }, - - _rotateCompassArrow: function() { - var rotate = 'rotate(' + (this._map.transform.angle * (180 / Math.PI)) + 'deg)'; + _rotateCompassArrow: function () { + var rotate = 'rotate(' + this._map.transform.angle * (180 / Math.PI) + 'deg)'; this._compassArrow.style.transform = rotate; } }); - - function copyMouseEvent(e) { return new MouseEvent(e.type, { - button: 2, // right click - buttons: 2, // right click + button: 2, + buttons: 2, bubbles: true, cancelable: true, detail: e.detail, @@ -24379,314 +25245,161 @@ function copyMouseEvent(e) { metaKey: e.metaKey }); } - - -},{"../../util/dom":108,"../../util/util":119,"./control":89}],92:[function(require,module,exports){ +},{"../../util/dom":122,"../../util/util":136,"./control":104}],107:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - LngLatBounds = require('../../geo/lng_lat_bounds'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), LngLatBounds = require('../../geo/lng_lat_bounds'), util = require('../../util/util'); module.exports = BoxZoomHandler; - -/** - * The `BoxZoomHandler` allows a user to zoom the map to fit a bounding box. - * The bounding box is defined by holding `shift` while dragging the cursor. - * @class BoxZoomHandler - */ function BoxZoomHandler(map) { this._map = map; this._el = map.getCanvasContainer(); this._container = map.getContainer(); - util.bindHandlers(this); } - BoxZoomHandler.prototype = { - _enabled: false, _active: false, - - /** - * Returns the current enabled/disabled state of the "box zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Returns true if the "box zoom" interaction is currently active, i.e. currently being used. - * @returns {boolean} active state - */ isActive: function () { return this._active; }, - - /** - * Enable the "box zoom" interaction. - * @example - * map.boxZoom.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('mousedown', this._onMouseDown, false); this._enabled = true; }, - - /** - * Disable the "box zoom" interaction. - * @example - * map.boxZoom.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('mousedown', this._onMouseDown); this._enabled = false; }, - _onMouseDown: function (e) { - if (!(e.shiftKey && e.button === 0)) return; - + if (!(e.shiftKey && e.button === 0)) + return; document.addEventListener('mousemove', this._onMouseMove, false); document.addEventListener('keydown', this._onKeyDown, false); document.addEventListener('mouseup', this._onMouseUp, false); - DOM.disableDrag(); this._startPos = DOM.mousePos(this._el, e); this._active = true; }, - _onMouseMove: function (e) { - var p0 = this._startPos, - p1 = DOM.mousePos(this._el, e); - + var p0 = this._startPos, p1 = DOM.mousePos(this._el, e); if (!this._box) { this._box = DOM.create('div', 'mapboxgl-boxzoom', this._container); this._container.classList.add('mapboxgl-crosshair'); this._fireEvent('boxzoomstart', e); } - - var minX = Math.min(p0.x, p1.x), - maxX = Math.max(p0.x, p1.x), - minY = Math.min(p0.y, p1.y), - maxY = Math.max(p0.y, p1.y); - + var minX = Math.min(p0.x, p1.x), maxX = Math.max(p0.x, p1.x), minY = Math.min(p0.y, p1.y), maxY = Math.max(p0.y, p1.y); DOM.setTransform(this._box, 'translate(' + minX + 'px,' + minY + 'px)'); - - this._box.style.width = (maxX - minX) + 'px'; - this._box.style.height = (maxY - minY) + 'px'; + this._box.style.width = maxX - minX + 'px'; + this._box.style.height = maxY - minY + 'px'; }, - _onMouseUp: function (e) { - if (e.button !== 0) return; - - var p0 = this._startPos, - p1 = DOM.mousePos(this._el, e), - bounds = new LngLatBounds(this._map.unproject(p0), this._map.unproject(p1)); - + if (e.button !== 0) + return; + var p0 = this._startPos, p1 = DOM.mousePos(this._el, e), bounds = new LngLatBounds(this._map.unproject(p0), this._map.unproject(p1)); this._finish(); - if (p0.x === p1.x && p0.y === p1.y) { this._fireEvent('boxzoomcancel', e); } else { - this._map - .fitBounds(bounds, {linear: true}) - .fire('boxzoomend', { originalEvent: e, boxZoomBounds: bounds }); + this._map.fitBounds(bounds, { linear: true }).fire('boxzoomend', { + originalEvent: e, + boxZoomBounds: bounds + }); } }, - _onKeyDown: function (e) { if (e.keyCode === 27) { this._finish(); this._fireEvent('boxzoomcancel', e); } }, - _finish: function () { this._active = false; - document.removeEventListener('mousemove', this._onMouseMove, false); document.removeEventListener('keydown', this._onKeyDown, false); document.removeEventListener('mouseup', this._onMouseUp, false); - this._container.classList.remove('mapboxgl-crosshair'); - if (this._box) { this._box.parentNode.removeChild(this._box); this._box = null; } - DOM.enableDrag(); }, - _fireEvent: function (type, e) { return this._map.fire(type, { originalEvent: e }); } }; - - -/** - * Boxzoom start event. This event is emitted at the start of a box zoom interaction. - * - * @event boxzoomstart - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Boxzoom end event. This event is emitted at the end of a box zoom interaction - * - * @event boxzoomend - * @memberof Map - * @instance - * @type {Object} - * @property {Event} originalEvent the original DOM event - * @property {LngLatBounds} boxZoomBounds the bounds of the box zoom target - */ - -/** - * Boxzoom cancel event. This event is emitted when the user cancels a box zoom interaction, - * or when the box zoom does not meet the minimum size threshold. - * - * @event boxzoomcancel - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../../geo/lng_lat_bounds":27,"../../util/dom":108,"../../util/util":119}],93:[function(require,module,exports){ +},{"../../geo/lng_lat_bounds":34,"../../util/dom":122,"../../util/util":136}],108:[function(require,module,exports){ 'use strict'; - module.exports = DoubleClickZoomHandler; - -/** - * The `DoubleClickZoomHandler` allows a user to zoom the map around point by - * double clicking. - * @class DoubleClickZoomHandler - */ function DoubleClickZoomHandler(map) { this._map = map; this._onDblClick = this._onDblClick.bind(this); } - DoubleClickZoomHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of the "double click to zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the "double click to zoom" interaction. - * @example - * map.doubleClickZoom.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._map.on('dblclick', this._onDblClick); this._enabled = true; }, - - /** - * Disable the "double click to zoom" interaction. - * @example - * map.doubleClickZoom.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._map.off('dblclick', this._onDblClick); this._enabled = false; }, - _onDblClick: function (e) { - this._map.zoomTo(this._map.getZoom() + - (e.originalEvent.shiftKey ? -1 : 1), {around: e.lngLat}); + this._map.zoomTo(this._map.getZoom() + (e.originalEvent.shiftKey ? -1 : 1), { around: e.lngLat }, e); } }; - -},{}],94:[function(require,module,exports){ +},{}],109:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), util = require('../../util/util'); module.exports = DragPanHandler; - -var inertiaLinearity = 0.3, - inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), - inertiaMaxSpeed = 1400, // px/s - inertiaDeceleration = 2500; // px/s^2 - - -/** - * The `DragPanHandler` allows a user to pan the map by clicking and dragging - * the cursor. - * @class DragPanHandler - */ +var inertiaLinearity = 0.3, inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), inertiaMaxSpeed = 1400, inertiaDeceleration = 2500; function DragPanHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - util.bindHandlers(this); } - DragPanHandler.prototype = { - _enabled: false, _active: false, - - /** - * Returns the current enabled/disabled state of the "drag to pan" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Returns true if the "drag to pan" interaction is currently active, i.e. currently being used. - * @returns {boolean} active state - */ isActive: function () { return this._active; }, - - /** - * Enable the "drag to pan" interaction. - * @example - * map.dragPan.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('mousedown', this._onDown); this._el.addEventListener('touchstart', this._onDown); this._enabled = true; }, - - /** - * Disable the "drag to pan" interaction. - * @example - * map.dragPan.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('mousedown', this._onDown); this._el.removeEventListener('touchstart', this._onDown); this._enabled = false; }, - _onDown: function (e) { - if (this._ignoreEvent(e)) return; - if (this.isActive()) return; - + if (this._ignoreEvent(e)) + return; + if (this.isActive()) + return; if (e.touches) { document.addEventListener('touchmove', this._onMove); document.addEventListener('touchend', this._onTouchEnd); @@ -24694,469 +25407,272 @@ DragPanHandler.prototype = { document.addEventListener('mousemove', this._onMove); document.addEventListener('mouseup', this._onMouseUp); } - this._active = false; this._startPos = this._pos = DOM.mousePos(this._el, e); - this._inertia = [[Date.now(), this._pos]]; + this._inertia = [[ + Date.now(), + this._pos + ]]; }, - _onMove: function (e) { - if (this._ignoreEvent(e)) return; - + if (this._ignoreEvent(e)) + return; if (!this.isActive()) { this._active = true; this._fireEvent('dragstart', e); this._fireEvent('movestart', e); } - - var pos = DOM.mousePos(this._el, e), - map = this._map; - + var pos = DOM.mousePos(this._el, e), map = this._map; map.stop(); this._drainInertiaBuffer(); - this._inertia.push([Date.now(), pos]); - + this._inertia.push([ + Date.now(), + pos + ]); map.transform.setLocationAtPoint(map.transform.pointLocation(this._pos), pos); - this._fireEvent('drag', e); this._fireEvent('move', e); - this._pos = pos; - e.preventDefault(); }, - _onUp: function (e) { - if (!this.isActive()) return; - + if (!this.isActive()) + return; this._active = false; this._fireEvent('dragend', e); this._drainInertiaBuffer(); - - var finish = function() { + var finish = function () { this._fireEvent('moveend', e); }.bind(this); - var inertia = this._inertia; if (inertia.length < 2) { finish(); return; } - - var last = inertia[inertia.length - 1], - first = inertia[0], - flingOffset = last[1].sub(first[1]), - flingDuration = (last[0] - first[0]) / 1000; - + var last = inertia[inertia.length - 1], first = inertia[0], flingOffset = last[1].sub(first[1]), flingDuration = (last[0] - first[0]) / 1000; if (flingDuration === 0 || last[1].equals(first[1])) { finish(); return; } - - // calculate px/s velocity & adjust for increased initial animation speed when easing out - var velocity = flingOffset.mult(inertiaLinearity / flingDuration), - speed = velocity.mag(); // px/s - + var velocity = flingOffset.mult(inertiaLinearity / flingDuration), speed = velocity.mag(); if (speed > inertiaMaxSpeed) { speed = inertiaMaxSpeed; velocity._unit()._mult(speed); } - - var duration = speed / (inertiaDeceleration * inertiaLinearity), - offset = velocity.mult(-duration / 2); - + var duration = speed / (inertiaDeceleration * inertiaLinearity), offset = velocity.mult(-duration / 2); this._map.panBy(offset, { duration: duration * 1000, easing: inertiaEasing, noMoveStart: true }, { originalEvent: e }); }, - _onMouseUp: function (e) { - if (this._ignoreEvent(e)) return; + if (this._ignoreEvent(e)) + return; this._onUp(e); document.removeEventListener('mousemove', this._onMove); document.removeEventListener('mouseup', this._onMouseUp); }, - _onTouchEnd: function (e) { - if (this._ignoreEvent(e)) return; + if (this._ignoreEvent(e)) + return; this._onUp(e); document.removeEventListener('touchmove', this._onMove); document.removeEventListener('touchend', this._onTouchEnd); }, - _fireEvent: function (type, e) { return this._map.fire(type, { originalEvent: e }); }, - _ignoreEvent: function (e) { var map = this._map; - - if (map.boxZoom && map.boxZoom.isActive()) return true; - if (map.dragRotate && map.dragRotate.isActive()) return true; + if (map.boxZoom && map.boxZoom.isActive()) + return true; + if (map.dragRotate && map.dragRotate.isActive()) + return true; if (e.touches) { - return (e.touches.length > 1); + return e.touches.length > 1; } else { - if (e.ctrlKey) return true; - var buttons = 1, // left button - button = 0; // left button - return (e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button); + if (e.ctrlKey) + return true; + var buttons = 1, button = 0; + return e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button; } }, - _drainInertiaBuffer: function () { - var inertia = this._inertia, - now = Date.now(), - cutoff = 160; // msec - - while (inertia.length > 0 && now - inertia[0][0] > cutoff) inertia.shift(); + var inertia = this._inertia, now = Date.now(), cutoff = 160; + while (inertia.length > 0 && now - inertia[0][0] > cutoff) + inertia.shift(); } }; - - -/** - * Drag start event. This event is emitted at the start of a user-initiated pan interaction. - * - * @event dragstart - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Drag event. This event is emitted repeatedly during a user-initiated pan interaction. - * - * @event drag - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Drag end event. This event is emitted at the end of a user-initiated pan interaction. - * - * @event dragend - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../../util/dom":108,"../../util/util":119}],95:[function(require,module,exports){ +},{"../../util/dom":122,"../../util/util":136}],110:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - Point = require('point-geometry'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), Point = require('point-geometry'), util = require('../../util/util'); module.exports = DragRotateHandler; - -var inertiaLinearity = 0.25, - inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), - inertiaMaxSpeed = 180, // deg/s - inertiaDeceleration = 720; // deg/s^2 - - -/** - * The `DragRotateHandler` allows a user to rotate the map by clicking and - * dragging the cursor while holding the right mouse button or the `ctrl` key. - * @class DragRotateHandler - */ -function DragRotateHandler(map) { +var inertiaLinearity = 0.25, inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), inertiaMaxSpeed = 180, inertiaDeceleration = 720; +function DragRotateHandler(map, options) { this._map = map; this._el = map.getCanvasContainer(); - + this._bearingSnap = options.bearingSnap; util.bindHandlers(this); } - DragRotateHandler.prototype = { - _enabled: false, _active: false, - - /** - * Returns the current enabled/disabled state of the "drag to rotate" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Returns true if the "drag to rotate" interaction is currently active, i.e. currently being used. - * @returns {boolean} active state - */ isActive: function () { return this._active; }, - - /** - * Enable the "drag to rotate" interaction. - * @example - * map.dragRotate.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('mousedown', this._onDown); this._enabled = true; }, - - /** - * Disable the "drag to rotate" interaction. - * @example - * map.dragRotate.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('mousedown', this._onDown); this._enabled = false; }, - _onDown: function (e) { - if (this._ignoreEvent(e)) return; - if (this.isActive()) return; - + if (this._ignoreEvent(e)) + return; + if (this.isActive()) + return; document.addEventListener('mousemove', this._onMove); document.addEventListener('mouseup', this._onUp); - this._active = false; - this._inertia = [[Date.now(), this._map.getBearing()]]; + this._inertia = [[ + Date.now(), + this._map.getBearing() + ]]; this._startPos = this._pos = DOM.mousePos(this._el, e); - this._center = this._map.transform.centerPoint; // Center of rotation - - // If the first click was too close to the center, move the center of rotation by 200 pixels - // in the direction of the click. - var startToCenter = this._startPos.sub(this._center), - startToCenterDist = startToCenter.mag(); - + this._center = this._map.transform.centerPoint; + var startToCenter = this._startPos.sub(this._center), startToCenterDist = startToCenter.mag(); if (startToCenterDist < 200) { this._center = this._startPos.add(new Point(-200, 0)._rotate(startToCenter.angle())); } - e.preventDefault(); }, - _onMove: function (e) { - if (this._ignoreEvent(e)) return; - + if (this._ignoreEvent(e)) + return; if (!this.isActive()) { this._active = true; this._fireEvent('rotatestart', e); this._fireEvent('movestart', e); } - var map = this._map; map.stop(); - - var p1 = this._pos, - p2 = DOM.mousePos(this._el, e), - center = this._center, - bearingDiff = p1.sub(center).angleWith(p2.sub(center)) / Math.PI * 180, - bearing = map.getBearing() - bearingDiff, - inertia = this._inertia, - last = inertia[inertia.length - 1]; - + var p1 = this._pos, p2 = DOM.mousePos(this._el, e), center = this._center, bearingDiff = p1.sub(center).angleWith(p2.sub(center)) / Math.PI * 180, bearing = map.getBearing() - bearingDiff, inertia = this._inertia, last = inertia[inertia.length - 1]; this._drainInertiaBuffer(); - inertia.push([Date.now(), map._normalizeBearing(bearing, last[1])]); - + inertia.push([ + Date.now(), + map._normalizeBearing(bearing, last[1]) + ]); map.transform.bearing = bearing; - this._fireEvent('rotate', e); this._fireEvent('move', e); - this._pos = p2; }, - _onUp: function (e) { - if (this._ignoreEvent(e)) return; + if (this._ignoreEvent(e)) + return; document.removeEventListener('mousemove', this._onMove); document.removeEventListener('mouseup', this._onUp); - - if (!this.isActive()) return; - + if (!this.isActive()) + return; this._active = false; this._fireEvent('rotateend', e); this._drainInertiaBuffer(); - - var map = this._map, - mapBearing = map.getBearing(), - inertia = this._inertia; - - var finish = function() { - if (Math.abs(mapBearing) < map.options.bearingSnap) { - map.resetNorth({noMoveStart: true}, { originalEvent: e }); + var map = this._map, mapBearing = map.getBearing(), inertia = this._inertia; + var finish = function () { + if (Math.abs(mapBearing) < this._bearingSnap) { + map.resetNorth({ noMoveStart: true }, { originalEvent: e }); } else { this._fireEvent('moveend', e); } }.bind(this); - if (inertia.length < 2) { finish(); return; } - - var first = inertia[0], - last = inertia[inertia.length - 1], - previous = inertia[inertia.length - 2], - bearing = map._normalizeBearing(mapBearing, previous[1]), - flingDiff = last[1] - first[1], - sign = flingDiff < 0 ? -1 : 1, - flingDuration = (last[0] - first[0]) / 1000; - + var first = inertia[0], last = inertia[inertia.length - 1], previous = inertia[inertia.length - 2], bearing = map._normalizeBearing(mapBearing, previous[1]), flingDiff = last[1] - first[1], sign = flingDiff < 0 ? -1 : 1, flingDuration = (last[0] - first[0]) / 1000; if (flingDiff === 0 || flingDuration === 0) { finish(); return; } - - var speed = Math.abs(flingDiff * (inertiaLinearity / flingDuration)); // deg/s + var speed = Math.abs(flingDiff * (inertiaLinearity / flingDuration)); if (speed > inertiaMaxSpeed) { speed = inertiaMaxSpeed; } - - var duration = speed / (inertiaDeceleration * inertiaLinearity), - offset = sign * speed * (duration / 2); - + var duration = speed / (inertiaDeceleration * inertiaLinearity), offset = sign * speed * (duration / 2); bearing += offset; - - if (Math.abs(map._normalizeBearing(bearing, 0)) < map.options.bearingSnap) { + if (Math.abs(map._normalizeBearing(bearing, 0)) < this._bearingSnap) { bearing = map._normalizeBearing(0, bearing); } - map.rotateTo(bearing, { duration: duration * 1000, easing: inertiaEasing, noMoveStart: true }, { originalEvent: e }); }, - _fireEvent: function (type, e) { return this._map.fire(type, { originalEvent: e }); }, - _ignoreEvent: function (e) { var map = this._map; - - if (map.boxZoom && map.boxZoom.isActive()) return true; - if (map.dragPan && map.dragPan.isActive()) return true; + if (map.boxZoom && map.boxZoom.isActive()) + return true; + if (map.dragPan && map.dragPan.isActive()) + return true; if (e.touches) { - return (e.touches.length > 1); + return e.touches.length > 1; } else { - var buttons = (e.ctrlKey ? 1 : 2), // ? ctrl+left button : right button - button = (e.ctrlKey ? 0 : 2); // ? ctrl+left button : right button - return (e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button); + var buttons = e.ctrlKey ? 1 : 2, button = e.ctrlKey ? 0 : 2; + return e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button; } }, - _drainInertiaBuffer: function () { - var inertia = this._inertia, - now = Date.now(), - cutoff = 160; //msec - + var inertia = this._inertia, now = Date.now(), cutoff = 160; while (inertia.length > 0 && now - inertia[0][0] > cutoff) inertia.shift(); } - }; - - -/** - * Rotate start event. This event is emitted at the start of a user-initiated rotate interaction. - * - * @event rotatestart - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Rotate event. This event is emitted repeatedly during a user-initiated rotate interaction. - * - * @event rotate - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Rotate end event. This event is emitted at the end of a user-initiated rotate interaction. - * - * @event rotateend - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../../util/dom":108,"../../util/util":119,"point-geometry":174}],96:[function(require,module,exports){ +},{"../../util/dom":122,"../../util/util":136,"point-geometry":194}],111:[function(require,module,exports){ 'use strict'; - module.exports = KeyboardHandler; - - -var panDelta = 80, - rotateDelta = 2, - pitchDelta = 5; - -/** - * The `KeyboardHandler` allows a user to zoom, rotate, and pan the map using - * following keyboard shortcuts: - * * `=` / `+`: increase zoom level by 1 - * * `Shift-=` / `Shift-+`: increase zoom level by 2 - * * `-`: decrease zoom level by 1 - * * `Shift--`: decrease zoom level by 2 - * * Arrow keys: pan by 80 pixels - * * `Shift+⇢`: increase rotation by 2 degrees - * * `Shift+⇠`: decrease rotation by 2 degrees - * * `Shift+⇡`: increase pitch by 5 degrees - * * `Shift+⇣`: decrease pitch by 5 degrees - * @class KeyboardHandler - */ +var panDelta = 80, rotateDelta = 2, pitchDelta = 5; function KeyboardHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - this._onKeyDown = this._onKeyDown.bind(this); } - KeyboardHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of keyboard interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the ability to interact with the map using keyboard input. - * @example - * map.keyboard.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('keydown', this._onKeyDown, false); this._enabled = true; }, - - /** - * Disable the ability to interact with the map using keyboard input. - * @example - * map.keyboard.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('keydown', this._onKeyDown); this._enabled = false; }, - _onKeyDown: function (e) { - if (e.altKey || e.ctrlKey || e.metaKey) return; - - var map = this._map, - eventData = { originalEvent: e }; - + if (e.altKey || e.ctrlKey || e.metaKey) + return; + var map = this._map, eventData = { originalEvent: e }; + if (map.isEasing()) + return; switch (e.keyCode) { case 61: case 107: @@ -25164,191 +25680,138 @@ KeyboardHandler.prototype = { case 187: map.zoomTo(Math.round(map.getZoom()) + (e.shiftKey ? 2 : 1), eventData); break; - case 189: case 109: case 173: map.zoomTo(Math.round(map.getZoom()) - (e.shiftKey ? 2 : 1), eventData); break; - case 37: if (e.shiftKey) { map.easeTo({ bearing: map.getBearing() - rotateDelta }, eventData); } else { e.preventDefault(); - map.panBy([-panDelta, 0], eventData); + map.panBy([ + -panDelta, + 0 + ], eventData); } break; - case 39: if (e.shiftKey) { map.easeTo({ bearing: map.getBearing() + rotateDelta }, eventData); } else { e.preventDefault(); - map.panBy([panDelta, 0], eventData); + map.panBy([ + panDelta, + 0 + ], eventData); } break; - case 38: if (e.shiftKey) { map.easeTo({ pitch: map.getPitch() + pitchDelta }, eventData); } else { e.preventDefault(); - map.panBy([0, -panDelta], eventData); + map.panBy([ + 0, + -panDelta + ], eventData); } break; - case 40: if (e.shiftKey) { map.easeTo({ pitch: Math.max(map.getPitch() - pitchDelta, 0) }, eventData); } else { e.preventDefault(); - map.panBy([0, panDelta], eventData); + map.panBy([ + 0, + panDelta + ], eventData); } break; } } }; - -},{}],97:[function(require,module,exports){ +},{}],112:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - browser = require('../../util/browser'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), browser = require('../../util/browser'), util = require('../../util/util'); module.exports = ScrollZoomHandler; - - -var ua = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase() : '', - firefox = ua.indexOf('firefox') !== -1, - safari = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') === -1; - - -/** - * The `ScrollZoomHandler` allows a user to zoom the map by scrolling. - * @class ScrollZoomHandler - */ +var ua = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase() : '', firefox = ua.indexOf('firefox') !== -1, safari = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') === -1; function ScrollZoomHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - util.bindHandlers(this); } - ScrollZoomHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of the "scroll to zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the "scroll to zoom" interaction. - * @example - * map.scrollZoom.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('wheel', this._onWheel, false); this._el.addEventListener('mousewheel', this._onWheel, false); this._enabled = true; }, - - /** - * Disable the "scroll to zoom" interaction. - * @example - * map.scrollZoom.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('wheel', this._onWheel); this._el.removeEventListener('mousewheel', this._onWheel); this._enabled = false; }, - _onWheel: function (e) { var value; - if (e.type === 'wheel') { value = e.deltaY; - // Firefox doubles the values on retina screens... - if (firefox && e.deltaMode === window.WheelEvent.DOM_DELTA_PIXEL) value /= browser.devicePixelRatio; - if (e.deltaMode === window.WheelEvent.DOM_DELTA_LINE) value *= 40; - + if (firefox && e.deltaMode === window.WheelEvent.DOM_DELTA_PIXEL) + value /= browser.devicePixelRatio; + if (e.deltaMode === window.WheelEvent.DOM_DELTA_LINE) + value *= 40; } else if (e.type === 'mousewheel') { value = -e.wheelDeltaY; - if (safari) value = value / 3; + if (safari) + value = value / 3; } - - var now = browser.now(), - timeDelta = now - (this._time || 0); - + var now = browser.now(), timeDelta = now - (this._time || 0); this._pos = DOM.mousePos(this._el, e); this._time = now; - - if (value !== 0 && (value % 4.000244140625) === 0) { - // This one is definitely a mouse wheel event. + if (value !== 0 && value % 4.000244140625 === 0) { this._type = 'wheel'; - // Normalize this value to match trackpad. value = Math.floor(value / 4); - } else if (value !== 0 && Math.abs(value) < 4) { - // This one is definitely a trackpad event because it is so small. this._type = 'trackpad'; - } else if (timeDelta > 400) { - // This is likely a new scroll action. this._type = null; this._lastValue = value; - - // Start a timeout in case this was a singular event, and dely it by up to 40ms. this._timeout = setTimeout(this._onTimeout, 40); - } else if (!this._type) { - // This is a repeating event, but we don't know the type of event just yet. - // If the delta per time is small, we assume it's a fast trackpad; otherwise we switch into wheel mode. - this._type = (Math.abs(timeDelta * value) < 200) ? 'trackpad' : 'wheel'; - - // Make sure our delayed event isn't fired again, because we accumulate - // the previous event (which was less than 40ms ago) into this event. + this._type = Math.abs(timeDelta * value) < 200 ? 'trackpad' : 'wheel'; if (this._timeout) { clearTimeout(this._timeout); this._timeout = null; value += this._lastValue; } } - - // Slow down zoom if shift key is held for more precise zooming - if (e.shiftKey && value) value = value / 4; - - // Only fire the callback if we actually know what type of scrolling device the user uses. - if (this._type) this._zoom(-value, e); - + if (e.shiftKey && value) + value = value / 4; + if (this._type) + this._zoom(-value, e); e.preventDefault(); }, - _onTimeout: function () { this._type = 'wheel'; this._zoom(-this._lastValue); }, - _zoom: function (delta, e) { - if (delta === 0) return; + if (delta === 0) + return; var map = this._map; - - // Scale by sigmoid of scroll wheel delta. var scale = 2 / (1 + Math.exp(-Math.abs(delta / 100))); - if (delta < 0 && scale !== 0) scale = 1 / scale; - - var fromScale = map.ease ? map.ease.to : map.transform.scale, - targetZoom = map.transform.scaleZoom(fromScale * scale); - + if (delta < 0 && scale !== 0) + scale = 1 / scale; + var fromScale = map.ease ? map.ease.to : map.transform.scale, targetZoom = map.transform.scaleZoom(fromScale * scale); map.zoomTo(targetZoom, { duration: 0, around: map.unproject(this._pos), @@ -25356,215 +25819,104 @@ ScrollZoomHandler.prototype = { }, { originalEvent: e }); } }; - - -/** - * Zoom start event. This event is emitted just before the map begins a transition from one - * zoom level to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event zoomstart - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Zoom event. This event is emitted repeatedly during animated transitions from one zoom level to - * another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event zoom - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Zoom end event. This event is emitted just after the map completes a transition from one - * zoom level to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event zoomend - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -},{"../../util/browser":105,"../../util/dom":108,"../../util/util":119}],98:[function(require,module,exports){ +},{"../../util/browser":120,"../../util/dom":122,"../../util/util":136}],113:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), util = require('../../util/util'); module.exports = TouchZoomRotateHandler; - -var inertiaLinearity = 0.15, - inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), - inertiaDeceleration = 12, // scale / s^2 - inertiaMaxSpeed = 2.5, // scale / s - significantScaleThreshold = 0.15, - significantRotateThreshold = 4; - - -/** - * The `TouchZoomRotateHandler` allows a user to zoom and rotate the map by - * pinching on a touchscreen. - * @class TouchZoomRotateHandler - */ +var inertiaLinearity = 0.15, inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), inertiaDeceleration = 12, inertiaMaxSpeed = 2.5, significantScaleThreshold = 0.15, significantRotateThreshold = 4; function TouchZoomRotateHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - util.bindHandlers(this); } - TouchZoomRotateHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of the "pinch to rotate and zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the "pinch to rotate and zoom" interaction. - * @example - * map.touchZoomRotate.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('touchstart', this._onStart, false); this._enabled = true; }, - - /** - * Disable the "pinch to rotate and zoom" interaction. - * @example - * map.touchZoomRotate.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('touchstart', this._onStart); this._enabled = false; }, - - /** - * Disable the "pinch to rotate" interaction, leaving the "pinch to zoom" - * interaction enabled. - * @example - * map.touchZoomRotate.disableRotation(); - */ - disableRotation: function() { + disableRotation: function () { this._rotationDisabled = true; }, - - /** - * Enable the "pinch to rotate" interaction, undoing a call to - * `disableRotation`. - * @example - * map.touchZoomRotate.enable(); - * map.touchZoomRotate.enableRotation(); - */ - enableRotation: function() { + enableRotation: function () { this._rotationDisabled = false; }, - _onStart: function (e) { - if (e.touches.length !== 2) return; - - var p0 = DOM.mousePos(this._el, e.touches[0]), - p1 = DOM.mousePos(this._el, e.touches[1]); - + if (e.touches.length !== 2) + return; + var p0 = DOM.mousePos(this._el, e.touches[0]), p1 = DOM.mousePos(this._el, e.touches[1]); this._startVec = p0.sub(p1); this._startScale = this._map.transform.scale; this._startBearing = this._map.transform.bearing; this._gestureIntent = undefined; this._inertia = []; - document.addEventListener('touchmove', this._onMove, false); document.addEventListener('touchend', this._onEnd, false); }, - _onMove: function (e) { - if (e.touches.length !== 2) return; - - var p0 = DOM.mousePos(this._el, e.touches[0]), - p1 = DOM.mousePos(this._el, e.touches[1]), - p = p0.add(p1).div(2), - vec = p0.sub(p1), - scale = vec.mag() / this._startVec.mag(), - bearing = this._rotationDisabled ? 0 : vec.angleWith(this._startVec) * 180 / Math.PI, - map = this._map; - - // Determine 'intent' by whichever threshold is surpassed first, - // then keep that state for the duration of this gesture. + if (e.touches.length !== 2) + return; + var p0 = DOM.mousePos(this._el, e.touches[0]), p1 = DOM.mousePos(this._el, e.touches[1]), p = p0.add(p1).div(2), vec = p0.sub(p1), scale = vec.mag() / this._startVec.mag(), bearing = this._rotationDisabled ? 0 : vec.angleWith(this._startVec) * 180 / Math.PI, map = this._map; if (!this._gestureIntent) { - var scalingSignificantly = (Math.abs(1 - scale) > significantScaleThreshold), - rotatingSignificantly = (Math.abs(bearing) > significantRotateThreshold); - + var scalingSignificantly = Math.abs(1 - scale) > significantScaleThreshold, rotatingSignificantly = Math.abs(bearing) > significantRotateThreshold; if (rotatingSignificantly) { this._gestureIntent = 'rotate'; } else if (scalingSignificantly) { this._gestureIntent = 'zoom'; } - if (this._gestureIntent) { this._startVec = vec; this._startScale = map.transform.scale; this._startBearing = map.transform.bearing; } - } else { - var param = { duration: 0, around: map.unproject(p) }; - + var param = { + duration: 0, + around: map.unproject(p) + }; if (this._gestureIntent === 'rotate') { param.bearing = this._startBearing + bearing; } if (this._gestureIntent === 'zoom' || this._gestureIntent === 'rotate') { param.zoom = map.transform.scaleZoom(this._startScale * scale); } - map.stop(); this._drainInertiaBuffer(); - this._inertia.push([Date.now(), scale, p]); - + this._inertia.push([ + Date.now(), + scale, + p + ]); map.easeTo(param, { originalEvent: e }); } - e.preventDefault(); }, - _onEnd: function (e) { document.removeEventListener('touchmove', this._onMove); document.removeEventListener('touchend', this._onEnd); this._drainInertiaBuffer(); - - var inertia = this._inertia, - map = this._map; - + var inertia = this._inertia, map = this._map; if (inertia.length < 2) { map.snapToNorth({}, { originalEvent: e }); return; } - - var last = inertia[inertia.length - 1], - first = inertia[0], - lastScale = map.transform.scaleZoom(this._startScale * last[1]), - firstScale = map.transform.scaleZoom(this._startScale * first[1]), - scaleOffset = lastScale - firstScale, - scaleDuration = (last[0] - first[0]) / 1000, - p = last[2]; - + var last = inertia[inertia.length - 1], first = inertia[0], lastScale = map.transform.scaleZoom(this._startScale * last[1]), firstScale = map.transform.scaleZoom(this._startScale * first[1]), scaleOffset = lastScale - firstScale, scaleDuration = (last[0] - first[0]) / 1000, p = last[2]; if (scaleDuration === 0 || lastScale === firstScale) { map.snapToNorth({}, { originalEvent: e }); return; } - - // calculate scale/s speed and adjust for increased initial animation speed when easing - var speed = scaleOffset * inertiaLinearity / scaleDuration; // scale/s - + var speed = scaleOffset * inertiaLinearity / scaleDuration; if (Math.abs(speed) > inertiaMaxSpeed) { if (speed > 0) { speed = inertiaMaxSpeed; @@ -25572,14 +25924,10 @@ TouchZoomRotateHandler.prototype = { speed = -inertiaMaxSpeed; } } - - var duration = Math.abs(speed / (inertiaDeceleration * inertiaLinearity)) * 1000, - targetScale = lastScale + speed * duration / 2000; - + var duration = Math.abs(speed / (inertiaDeceleration * inertiaLinearity)) * 1000, targetScale = lastScale + speed * duration / 2000; if (targetScale < 0) { targetScale = 0; } - map.easeTo({ zoom: targetScale, duration: duration, @@ -25587,68 +25935,43 @@ TouchZoomRotateHandler.prototype = { around: map.unproject(p) }, { originalEvent: e }); }, - - _drainInertiaBuffer: function() { - var inertia = this._inertia, - now = Date.now(), - cutoff = 160; // msec - - while (inertia.length > 2 && now - inertia[0][0] > cutoff) inertia.shift(); + _drainInertiaBuffer: function () { + var inertia = this._inertia, now = Date.now(), cutoff = 160; + while (inertia.length > 2 && now - inertia[0][0] > cutoff) + inertia.shift(); } }; - -},{"../../util/dom":108,"../../util/util":119}],99:[function(require,module,exports){ +},{"../../util/dom":122,"../../util/util":136}],114:[function(require,module,exports){ 'use strict'; - -/* - * Adds the map's position to its page's location hash. - * Passed as an option to the map object. - * - * @class mapboxgl.Hash - * @returns {Hash} `this` - */ module.exports = Hash; - var util = require('../util/util'); - function Hash() { util.bindAll([ '_onHashChange', '_updateHash' ], this); } - Hash.prototype = { - /* - * Map element to listen for coordinate changes - * - * @param {Object} map - * @returns {Hash} `this` - */ - addTo: function(map) { + addTo: function (map) { this._map = map; window.addEventListener('hashchange', this._onHashChange, false); this._map.on('moveend', this._updateHash); return this; }, - - /* - * Removes hash - * - * @returns {Popup} `this` - */ - remove: function() { + remove: function () { window.removeEventListener('hashchange', this._onHashChange, false); this._map.off('moveend', this._updateHash); delete this._map; return this; }, - - _onHashChange: function() { + _onHashChange: function () { var loc = location.hash.replace('#', '').split('/'); if (loc.length >= 3) { this._map.jumpTo({ - center: [+loc[2], +loc[1]], + center: [ + +loc[2], + +loc[1] + ], zoom: +loc[0], bearing: +(loc[3] || 0) }); @@ -25656,437 +25979,79 @@ Hash.prototype = { } return false; }, - - _updateHash: function() { - var center = this._map.getCenter(), - zoom = this._map.getZoom(), - bearing = this._map.getBearing(), - precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)), - - hash = '#' + (Math.round(zoom * 100) / 100) + - '/' + center.lat.toFixed(precision) + - '/' + center.lng.toFixed(precision) + - (bearing ? '/' + (Math.round(bearing * 10) / 10) : ''); - + _updateHash: function () { + var center = this._map.getCenter(), zoom = this._map.getZoom(), bearing = this._map.getBearing(), precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)), hash = '#' + Math.round(zoom * 100) / 100 + '/' + center.lat.toFixed(precision) + '/' + center.lng.toFixed(precision) + (bearing ? '/' + Math.round(bearing * 10) / 10 : ''); window.history.replaceState('', '', hash); } }; - -},{"../util/util":119}],100:[function(require,module,exports){ -'use strict'; - -var handlers = { - scrollZoom: require('./handler/scroll_zoom'), - boxZoom: require('./handler/box_zoom'), - dragRotate: require('./handler/drag_rotate'), - dragPan: require('./handler/drag_pan'), - keyboard: require('./handler/keyboard'), - doubleClickZoom: require('./handler/dblclick_zoom'), - touchZoomRotate: require('./handler/touch_zoom_rotate') -}; - -var DOM = require('../util/dom'), - util = require('../util/util'), - Point = require('point-geometry'); - -module.exports = Interaction; - -function Interaction(map) { - this._map = map; - this._el = map.getCanvasContainer(); - - for (var name in handlers) { - map[name] = new handlers[name](map); - } - - util.bindHandlers(this); -} - -Interaction.prototype = { - enable: function () { - var options = this._map.options, - el = this._el; - - for (var name in handlers) { - if (options[name]) this._map[name].enable(); - } - - el.addEventListener('mousedown', this._onMouseDown, false); - el.addEventListener('mouseup', this._onMouseUp, false); - el.addEventListener('mousemove', this._onMouseMove, false); - el.addEventListener('touchstart', this._onTouchStart, false); - el.addEventListener('touchend', this._onTouchEnd, false); - el.addEventListener('touchmove', this._onTouchMove, false); - el.addEventListener('touchcancel', this._onTouchCancel, false); - el.addEventListener('click', this._onClick, false); - el.addEventListener('dblclick', this._onDblClick, false); - el.addEventListener('contextmenu', this._onContextMenu, false); - }, - - disable: function () { - var options = this._map.options, - el = this._el; - - for (var name in handlers) { - if (options[name]) this._map[name].disable(); - } - - el.removeEventListener('mousedown', this._onMouseDown); - el.removeEventListener('mouseup', this._onMouseUp); - el.removeEventListener('mousemove', this._onMouseMove); - el.removeEventListener('touchstart', this._onTouchStart); - el.removeEventListener('touchend', this._onTouchEnd); - el.removeEventListener('touchmove', this._onTouchMove); - el.removeEventListener('touchcancel', this._onTouchCancel); - el.removeEventListener('click', this._onClick); - el.removeEventListener('dblclick', this._onDblClick); - el.removeEventListener('contextmenu', this._onContextMenu); - }, - - _onMouseDown: function (e) { - this._map.stop(); - this._startPos = DOM.mousePos(this._el, e); - this._fireMouseEvent('mousedown', e); - }, - - _onMouseUp: function (e) { - var map = this._map, - rotating = map.dragRotate && map.dragRotate.isActive(); - - if (this._contextMenuEvent && !rotating) { - this._fireMouseEvent('contextmenu', this._contextMenuEvent); - } - - this._contextMenuEvent = null; - this._fireMouseEvent('mouseup', e); - }, - - _onMouseMove: function (e) { - var map = this._map, - el = this._el; - - if (map.dragPan && map.dragPan.isActive()) return; - if (map.dragRotate && map.dragRotate.isActive()) return; - - var target = e.toElement || e.target; - while (target && target !== el) target = target.parentNode; - if (target !== el) return; - - this._fireMouseEvent('mousemove', e); - }, - - _onTouchStart: function (e) { - this._map.stop(); - this._fireTouchEvent('touchstart', e); - - if (!e.touches || e.touches.length > 1) return; - - if (!this._tapped) { - this._tapped = setTimeout(this._onTouchTimeout, 300); - - } else { - clearTimeout(this._tapped); - this._tapped = null; - this._fireMouseEvent('dblclick', e); - } - }, - - _onTouchMove: function (e) { - this._fireTouchEvent('touchmove', e); - }, - - _onTouchEnd: function (e) { - this._fireTouchEvent('touchend', e); - }, - - _onTouchCancel: function (e) { - this._fireTouchEvent('touchcancel', e); - }, - - _onTouchTimeout: function () { - this._tapped = null; - }, - - _onClick: function (e) { - var pos = DOM.mousePos(this._el, e); - - if (pos.equals(this._startPos)) { - this._fireMouseEvent('click', e); - } - }, - - _onDblClick: function (e) { - this._fireMouseEvent('dblclick', e); - e.preventDefault(); - }, - - _onContextMenu: function (e) { - this._contextMenuEvent = e; - e.preventDefault(); - }, - - _fireMouseEvent: function (type, e) { - var pos = DOM.mousePos(this._el, e); - - return this._map.fire(type, { - lngLat: this._map.unproject(pos), - point: pos, - originalEvent: e - }); - }, - - _fireTouchEvent: function (type, e) { - var touches = DOM.touchPos(this._el, e), - singular = touches.reduce(function (prev, curr, i, arr) { - return prev.add(curr.div(arr.length)); - }, new Point(0, 0)); - - return this._map.fire(type, { - lngLat: this._map.unproject(singular), - point: singular, - lngLats: touches.map(function(t) { return this._map.unproject(t); }, this), - points: touches, - originalEvent: e - }); - } -}; - - -/** - * When an event [fires]{@link #Evented.fire} as a result of a - * user interaction, the event will be called with an EventData - * object containing the original DOM event along with coordinates of - * the event target. - * - * @typedef {Object} EventData - * @property {Event} originalEvent The original DOM event - * @property {Point} point The pixel location of the event - * @property {LngLat} lngLat The geographic location of the event - * @example - * map.on('click', function(data) { - * var e = data && data.originalEvent; - * console.log('got click ' + (e ? 'button = ' + e.button : '')); - * }); - */ - -/** - * Mouse down event. - * - * @event mousedown - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [mousedown event](https://developer.mozilla.org/en-US/docs/Web/Events/mousedown) - */ - -/** - * Mouse up event. - * - * @event mouseup - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [mouseup event](https://developer.mozilla.org/en-US/docs/Web/Events/mouseup) - */ - -/** - * Mouse move event. - * - * @event mousemove - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [mousemouse event](https://developer.mozilla.org/en-US/docs/Web/Events/mousemove) - */ - -/** - * Touch start event. - * - * @event touchstart - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchstart event](https://developer.mozilla.org/en-US/docs/Web/Events/touchstart). - */ - -/** - * Touch end event. - * - * @event touchend - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchcancel event](https://developer.mozilla.org/en-US/docs/Web/Events/touchcancel). - */ - -/** - * Touch move event. - * - * @event touchmove - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchmove event](https://developer.mozilla.org/en-US/docs/Web/Events/touchmove). - */ - -/** - * Touch cancel event. - * - * @event touchcancel - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchcancel event](https://developer.mozilla.org/en-US/docs/Web/Events/touchcancel). - */ - -/** - * Click event. - * - * @event click - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [click event](https://developer.mozilla.org/en-US/docs/Web/Events/click) - */ - -/** - * Double click event. - * - * @event dblclick - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Context menu event. - * - * @event contextmenu - * @memberof Map - * @instance - * @property {EventData} data Original event data, if available - */ - -/** - * Load event. This event is emitted immediately after all necessary resources have been downloaded - * and the first visually complete rendering has occurred. - * - * @event load - * @memberof Map - * @instance - * @type {Object} - */ - -/** - * Move start event. This event is emitted just before the map begins a transition from one - * view to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event movestart - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Move event. This event is emitted repeatedly during animated transitions from one view to - * another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event move - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Move end event. This event is emitted just after the map completes a transition from one - * view to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event moveend - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -},{"../util/dom":108,"../util/util":119,"./handler/box_zoom":92,"./handler/dblclick_zoom":93,"./handler/drag_pan":94,"./handler/drag_rotate":95,"./handler/keyboard":96,"./handler/scroll_zoom":97,"./handler/touch_zoom_rotate":98,"point-geometry":174}],101:[function(require,module,exports){ +},{"../util/util":136}],115:[function(require,module,exports){ 'use strict'; - var Canvas = require('../util/canvas'); var util = require('../util/util'); var browser = require('../util/browser'); +var window = require('../util/browser').window; var Evented = require('../util/evented'); var DOM = require('../util/dom'); - var Style = require('../style/style'); var AnimationLoop = require('../style/animation_loop'); var Painter = require('../render/painter'); - var Transform = require('../geo/transform'); var Hash = require('./hash'); - -var Interaction = require('./interaction'); - +var bindHandlers = require('./bind_handlers'); var Camera = require('./camera'); var LngLat = require('../geo/lng_lat'); var LngLatBounds = require('../geo/lng_lat_bounds'); var Point = require('point-geometry'); var Attribution = require('./control/attribution'); - var defaultMinZoom = 0; var defaultMaxZoom = 20; - -/** - * Creates a map instance. This is usually the beginning of your map: - * you tell Mapbox GL JS where to put the map by specifying a `container` - * option, and the map's style with `style` and other attributes of the map, - * and in return Mapbox GL JS initializes the map on your page and returns - * a map variable that lets you programmatically call methods on the map. - * @class Map - * @param {Object} options - * @param {string|Element} options.container HTML element to initialize the map in (or element id as string) - * @param {number} [options.minZoom=0] Minimum zoom of the map - * @param {number} [options.maxZoom=20] Maximum zoom of the map - * @param {Object|string} [options.style] Map style. This must be an an object conforming to the schema described in the [style reference](https://mapbox.com/mapbox-gl-style-spec/), or a URL to a JSON style. To load a style from the Mapbox API, you can use a URL of the form `mapbox://styles/:owner/:style`, where `:owner` is your Mapbox account name and `:style` is the style ID. Or you can use one of the predefined Mapbox styles: - * * `mapbox://styles/mapbox/basic-v8` - Simple and flexible starting template. - * * `mapbox://styles/mapbox/bright-v8` - Template for complex custom basemaps. - * * `mapbox://styles/mapbox/streets-v8` - A ready-to-use basemap, perfect for minor customization or incorporating your own data. - * * `mapbox://styles/mapbox/light-v8` - Subtle light backdrop for data vizualizations. - * * `mapbox://styles/mapbox/dark-v8` - Subtle dark backdrop for data vizualizations. - * @param {boolean} [options.hash=false] If `true`, the map will track and update the page URL according to map position - * @param {boolean} [options.interactive=true] If `false`, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input - * @param {number} [options.bearingSnap=7] Snap to north threshold in degrees. - * @param {Array} [options.classes] Style class names with which to initialize the map - * @param {boolean} [options.attributionControl=true] If `true`, an attribution control will be added to the map. - * @param {boolean} [options.failIfMajorPerformanceCaveat=false] If `true`, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. - * @param {boolean} [options.preserveDrawingBuffer=false] If `true`, The maps canvas can be exported to a PNG using `map.getCanvas().toDataURL();`. This is false by default as a performance optimization. - * @param {LngLatBounds|Array>} [options.maxBounds] If set, the map is constrained to the given bounds. - * @param {boolean} [options.scrollZoom=true] If `true`, enable the "scroll to zoom" interaction (see `ScrollZoomHandler`) - * @param {boolean} [options.boxZoom=true] If `true`, enable the "box zoom" interaction (see `BoxZoomHandler`) - * @param {boolean} [options.dragRotate=true] If `true`, enable the "drag to rotate" interaction (see `DragRotateHandler`). - * @param {boolean} [options.dragPan=true] If `true`, enable the "drag to pan" interaction (see `DragPanHandler`). - * @param {boolean} [options.keyboard=true] If `true`, enable keyboard shortcuts (see `KeyboardHandler`). - * @param {boolean} [options.doubleClickZoom=true] If `true`, enable the "double click to zoom" interaction (see `DoubleClickZoomHandler`). - * @param {boolean} [options.touchZoomRotate=true] If `true`, enable the "pinch to rotate and zoom" interaction (see `TouchZoomRotateHandler`). - * @example - * var map = new mapboxgl.Map({ - * container: 'map', - * center: [-122.420679, 37.772537], - * zoom: 13, - * style: style_object, - * hash: true - * }); - */ -var Map = module.exports = function(options) { - - options = util.inherit(this.options, options); +var defaultOptions = { + center: [ + 0, + 0 + ], + zoom: 0, + bearing: 0, + pitch: 0, + minZoom: defaultMinZoom, + maxZoom: defaultMaxZoom, + interactive: true, + scrollZoom: true, + boxZoom: true, + dragRotate: true, + dragPan: true, + keyboard: true, + doubleClickZoom: true, + touchZoomRotate: true, + bearingSnap: 7, + hash: false, + attributionControl: true, + failIfMajorPerformanceCaveat: false, + preserveDrawingBuffer: false, + trackResize: true, + workerCount: Math.max(browser.hardwareConcurrency - 1, 1) +}; +var Map = module.exports = function (options) { + options = util.extend({}, defaultOptions, options); + if (options.workerCount < 1) { + throw new Error('workerCount must an integer greater than or equal to 1.'); + } this._interactive = options.interactive; this._failIfMajorPerformanceCaveat = options.failIfMajorPerformanceCaveat; this._preserveDrawingBuffer = options.preserveDrawingBuffer; - + this._trackResize = options.trackResize; + this._workerCount = options.workerCount; + this._bearingSnap = options.bearingSnap; if (typeof options.container === 'string') { this._container = document.getElementById(options.container); } else { this._container = options.container; } - this.animationLoop = new AnimationLoop(); this.transform = new Transform(options.minZoom, options.maxZoom); - if (options.maxBounds) { this.setMaxBounds(options.maxBounds); } - util.bindAll([ '_forwardStyleEvent', '_forwardSourceEvent', @@ -26097,230 +26062,122 @@ var Map = module.exports = function(options) { '_onSourceAdd', '_onSourceRemove', '_onSourceUpdate', + '_onWindowOnline', '_onWindowResize', - 'onError', '_update', '_render' ], this); - this._setupContainer(); this._setupPainter(); - this.on('move', this._update.bind(this, false)); this.on('zoom', this._update.bind(this, true)); - this.on('moveend', function() { - this.animationLoop.set(300); // text fading + this.on('moveend', function () { + this.animationLoop.set(300); this._rerender(); }.bind(this)); - - if (typeof window !== 'undefined') { - window.addEventListener('resize', this._onWindowResize, false); - } - - this.interaction = new Interaction(this); - - if (options.interactive) { - this.interaction.enable(); - } - - this._hash = options.hash && (new Hash()).addTo(this); - // don't set position from options if set through hash - if (!this._hash || !this._hash._onHashChange()) { - this.jumpTo(options); - } - - this.stacks = {}; - this._classes = []; - - this.resize(); - - if (options.classes) this.setClasses(options.classes); - if (options.style) this.setStyle(options.style); - if (options.attributionControl) this.addControl(new Attribution(options.attributionControl)); - - this.on('style.error', this.onError); - this.on('source.error', this.onError); - this.on('tile.error', this.onError); - this.on('layer.error', this.onError); -}; - -util.extend(Map.prototype, Evented); -util.extend(Map.prototype, Camera.prototype); -util.extend(Map.prototype, /** @lends Map.prototype */{ - - options: { - center: [0, 0], - zoom: 0, - bearing: 0, - pitch: 0, - - minZoom: defaultMinZoom, - maxZoom: defaultMaxZoom, - - interactive: true, - - scrollZoom: true, - boxZoom: true, - dragRotate: true, - dragPan: true, - keyboard: true, - doubleClickZoom: true, - touchZoomRotate: true, - - bearingSnap: 7, - - hash: false, - - attributionControl: true, - - failIfMajorPerformanceCaveat: false, - preserveDrawingBuffer: false - }, - - /** - * Adds a control to the map, calling `control.addTo(this)`. - * - * @param {Control} control - * @returns {Map} `this` - */ - addControl: function(control) { + if (typeof window !== 'undefined') { + window.addEventListener('online', this._onWindowOnline, false); + window.addEventListener('resize', this._onWindowResize, false); + } + bindHandlers(this, options); + this._hash = options.hash && new Hash().addTo(this); + if (!this._hash || !this._hash._onHashChange()) { + this.jumpTo({ + center: options.center, + zoom: options.zoom, + bearing: options.bearing, + pitch: options.pitch + }); + } + this.stacks = {}; + this._classes = []; + this.resize(); + if (options.classes) + this.setClasses(options.classes); + if (options.style) + this.setStyle(options.style); + if (options.attributionControl) + this.addControl(new Attribution(options.attributionControl)); + var fireError = this.fire.bind(this, 'error'); + this.on('style.error', fireError); + this.on('source.error', fireError); + this.on('tile.error', fireError); + this.on('layer.error', fireError); +}; +util.extend(Map.prototype, Evented); +util.extend(Map.prototype, Camera.prototype); +util.extend(Map.prototype, { + addControl: function (control) { control.addTo(this); return this; }, - - /** - * Adds a style class to a map. - * - * @param {string} klass name of style class - * @param {StyleOptions} [options] - * @fires change - * @returns {Map} `this` - */ - addClass: function(klass, options) { - if (this._classes.indexOf(klass) >= 0 || klass === '') return this; + addClass: function (klass, options) { + if (this._classes.indexOf(klass) >= 0 || klass === '') + return this; this._classes.push(klass); this._classOptions = options; - - if (this.style) this.style.updateClasses(); + if (this.style) + this.style.updateClasses(); return this._update(true); }, - - /** - * Removes a style class from a map. - * - * @param {string} klass name of style class - * @param {StyleOptions} [options] - * @fires change - * @returns {Map} `this` - */ - removeClass: function(klass, options) { + removeClass: function (klass, options) { var i = this._classes.indexOf(klass); - if (i < 0 || klass === '') return this; + if (i < 0 || klass === '') + return this; this._classes.splice(i, 1); this._classOptions = options; - - if (this.style) this.style.updateClasses(); + if (this.style) + this.style.updateClasses(); return this._update(true); }, - - /** - * Helper method to add more than one class. - * - * @param {Array} klasses An array of class names - * @param {StyleOptions} [options] - * @fires change - * @returns {Map} `this` - */ - setClasses: function(klasses, options) { + setClasses: function (klasses, options) { var uniqueClasses = {}; for (var i = 0; i < klasses.length; i++) { - if (klasses[i] !== '') uniqueClasses[klasses[i]] = true; + if (klasses[i] !== '') + uniqueClasses[klasses[i]] = true; } this._classes = Object.keys(uniqueClasses); this._classOptions = options; - - if (this.style) this.style.updateClasses(); + if (this.style) + this.style.updateClasses(); return this._update(true); }, - - /** - * Check whether a style class is active. - * - * @param {string} klass Name of style class - * @returns {boolean} - */ - hasClass: function(klass) { + hasClass: function (klass) { return this._classes.indexOf(klass) >= 0; }, - - /** - * Return an array of the current active style classes. - * - * @returns {boolean} - */ - getClasses: function() { + getClasses: function () { return this._classes; }, - - /** - * Detect the map's new width and height and resize it. Given - * the `container` of the map specified in the Map constructor, - * this reads the new width from the DOM: so this method is often - * called after the map's container is resized by another script - * or the map is shown after being initially hidden with CSS. - * - * @returns {Map} `this` - */ - resize: function() { + resize: function () { var width = 0, height = 0; - if (this._container) { width = this._container.offsetWidth || 400; height = this._container.offsetHeight || 300; } - this._canvas.resize(width, height); this.transform.resize(width, height); this.painter.resize(width, height); - - return this - .fire('movestart') - .fire('move') - .fire('resize') - .fire('moveend'); + return this.fire('movestart').fire('move').fire('resize').fire('moveend'); }, - - /** - * Get the map's geographical bounds. - * - * @returns {LngLatBounds} - */ - getBounds: function() { - var bounds = new LngLatBounds( - this.transform.pointLocation(new Point(0, 0)), - this.transform.pointLocation(this.transform.size)); - + getBounds: function () { + var bounds = new LngLatBounds(this.transform.pointLocation(new Point(0, 0)), this.transform.pointLocation(this.transform.size)); if (this.transform.angle || this.transform.pitch) { bounds.extend(this.transform.pointLocation(new Point(this.transform.size.x, 0))); bounds.extend(this.transform.pointLocation(new Point(0, this.transform.size.y))); } - return bounds; }, - - /** - * Set constraint on the map's geographical bounds. Pan or zoom operations that would result in - * displaying regions that fall outside of the bounds instead result in displaying the map at the - * closest point and/or zoom level of the requested operation that is within the max bounds. - * - * @param {LngLatBounds | Array> | null | undefined} lnglatbounds Desired max bounds of the map. If null or undefined, function removes any bounds constraints on the map. - * @returns {Map} `this` - */ setMaxBounds: function (lnglatbounds) { if (lnglatbounds) { var b = LngLatBounds.convert(lnglatbounds); - this.transform.lngRange = [b.getWest(), b.getEast()]; - this.transform.latRange = [b.getSouth(), b.getNorth()]; + this.transform.lngRange = [ + b.getWest(), + b.getEast() + ]; + this.transform.latRange = [ + b.getSouth(), + b.getNorth() + ]; this.transform._constrain(); this._update(); } else if (lnglatbounds === null || lnglatbounds === undefined) { @@ -26329,120 +26186,74 @@ util.extend(Map.prototype, /** @lends Map.prototype */{ this._update(); } return this; - }, - /** - * Set the map's minimum zoom level, and zooms map to that level if it is - * currently below it. If no parameter provided, unsets the current - * minimum zoom (sets it to 0) - * - * @param {number} minZoom Minimum zoom level. Must be between 0 and 20. - * @returns {Map} `this - */ - setMinZoom: function(minZoom) { - + setMinZoom: function (minZoom) { minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom; - if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) { this.transform.minZoom = minZoom; this._update(); - - if (this.getZoom() < minZoom) this.setZoom(minZoom); - + if (this.getZoom() < minZoom) + this.setZoom(minZoom); return this; - - } else throw new Error('minZoom must be between ' + defaultMinZoom + ' and the current maxZoom, inclusive'); + } else + throw new Error('minZoom must be between ' + defaultMinZoom + ' and the current maxZoom, inclusive'); }, - - /** - * Set the map's maximum zoom level, and zooms map to that level if it is - * currently above it. If no parameter provided, unsets the current - * maximum zoom (sets it to 20) - * @param {number} maxZoom Maximum zoom level. Must be between 0 and 20. - * @returns {Map} `this` - */ - setMaxZoom: function(maxZoom) { - + setMaxZoom: function (maxZoom) { maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom; - if (maxZoom >= this.transform.minZoom && maxZoom <= defaultMaxZoom) { this.transform.maxZoom = maxZoom; this._update(); - - if (this.getZoom() > maxZoom) this.setZoom(maxZoom); - + if (this.getZoom() > maxZoom) + this.setZoom(maxZoom); return this; - - } else throw new Error('maxZoom must be between the current minZoom and ' + defaultMaxZoom + ', inclusive'); + } else + throw new Error('maxZoom must be between the current minZoom and ' + defaultMaxZoom + ', inclusive'); }, - /** - * Get pixel coordinates relative to the map container, given a geographical - * location. - * - * @param {LngLat} lnglat - * @returns {Object} `x` and `y` coordinates - */ - project: function(lnglat) { + project: function (lnglat) { return this.transform.locationPoint(LngLat.convert(lnglat)); }, - - /** - * Get geographical coordinates, given pixel coordinates. - * - * @param {Array} point [x, y] pixel coordinates - * @returns {LngLat} - */ - unproject: function(point) { + unproject: function (point) { return this.transform.pointLocation(Point.convert(point)); }, - - /** - * Query rendered features within a point or rectangle. - * - * @param {Point|Array|Array|Array>} [pointOrBox] Either [x, y] pixel coordinates of a point, or [[x1, y1], [x2, y2]] pixel coordinates of opposite corners of bounding rectangle. Optional: use entire viewport if omitted. - * @param {Object} params - * @param {Array} [params.layers] Only query features from layers with these layer IDs. - * @param {Array} [params.filter] A mapbox-gl-style-spec filter. - * - * @returns {Array} features - An array of [GeoJSON](http://geojson.org/) features - * matching the query parameters. The GeoJSON properties of each feature are taken from - * the original source. Each feature object also contains a top-level `layer` - * property whose value is an object representing the style layer to which the - * feature belongs. Layout and paint properties in this object contain values - * which are fully evaluated for the given zoom level and feature. - * - * @example - * var features = map.queryRenderedFeatures([20, 35], { layers: ['my-layer-name'] }); - * - * @example - * var features = map.queryRenderedFeatures([[10, 20], [30, 50]], { layers: ['my-layer-name'] }); - */ - queryRenderedFeatures: function(pointOrBox, params) { - if (!(pointOrBox instanceof Point || Array.isArray(pointOrBox))) { - params = pointOrBox; - pointOrBox = undefined; + queryRenderedFeatures: function () { + var params = {}; + var geometry; + if (arguments.length === 2) { + geometry = arguments[0]; + params = arguments[1]; + } else if (arguments.length === 1 && isPointLike(arguments[0])) { + geometry = arguments[0]; + } else if (arguments.length === 1) { + params = arguments[0]; + } + return this.style.queryRenderedFeatures(this._makeQueryGeometry(geometry), params, this.transform.zoom, this.transform.angle); + function isPointLike(input) { + return input instanceof Point || Array.isArray(input); } - var queryGeometry = this._makeQueryGeometry(pointOrBox); - return this.style.queryRenderedFeatures(queryGeometry, params, this.transform.zoom, this.transform.angle); }, - - _makeQueryGeometry: function(pointOrBox) { + _makeQueryGeometry: function (pointOrBox) { if (pointOrBox === undefined) { - // bounds was omitted: use full viewport pointOrBox = [ - Point.convert([0, 0]), - Point.convert([this.transform.width, this.transform.height]) + Point.convert([ + 0, + 0 + ]), + Point.convert([ + this.transform.width, + this.transform.height + ]) ]; } - var queryGeometry; var isPoint = pointOrBox instanceof Point || typeof pointOrBox[0] === 'number'; - if (isPoint) { var point = Point.convert(pointOrBox); queryGeometry = [point]; } else { - var box = [Point.convert(pointOrBox[0]), Point.convert(pointOrBox[1])]; + var box = [ + Point.convert(pointOrBox[0]), + Point.convert(pointOrBox[1]) + ]; queryGeometry = [ box[0], new Point(box[1].x, box[0].y), @@ -26451,682 +26262,395 @@ util.extend(Map.prototype, /** @lends Map.prototype */{ box[0] ]; } - - queryGeometry = queryGeometry.map(function(p) { + queryGeometry = queryGeometry.map(function (p) { return this.transform.pointCoordinate(p); }.bind(this)); - return queryGeometry; }, - - /** - * Get data from vector tiles as an array of GeoJSON Features. - * - * @param {string} sourceID source ID - * @param {Object} params - * @param {string} [params.sourceLayer] The name of the vector tile layer to get features from. - * @param {Array} [params.filter] A mapbox-gl-style-spec filter. - * - * @returns {Array} features - An array of [GeoJSON](http://geojson.org/) features matching the query parameters. The GeoJSON properties of each feature are taken from the original source. Each feature object also contains a top-level `layer` property whose value is an object representing the style layer to which the feature belongs. Layout and paint properties in this object contain values which are fully evaluated for the given zoom level and feature. - */ - querySourceFeatures: function(sourceID, params) { + querySourceFeatures: function (sourceID, params) { return this.style.querySourceFeatures(sourceID, params); }, - - /** - * Replaces the map's style object with a new value. Unlike the `style` - * option in the Map constructor, this method only accepts an object - * of a new style, not a URL string. - * - * @param {Object} style A style object formatted as JSON - * @returns {Map} `this` - */ - setStyle: function(style) { + setStyle: function (style) { if (this.style) { - this.style - .off('load', this._onStyleLoad) - .off('error', this._forwardStyleEvent) - .off('change', this._onStyleChange) - .off('source.add', this._onSourceAdd) - .off('source.remove', this._onSourceRemove) - .off('source.load', this._onSourceUpdate) - .off('source.error', this._forwardSourceEvent) - .off('source.change', this._onSourceUpdate) - .off('layer.add', this._forwardLayerEvent) - .off('layer.remove', this._forwardLayerEvent) - .off('layer.error', this._forwardLayerEvent) - .off('tile.add', this._forwardTileEvent) - .off('tile.remove', this._forwardTileEvent) - .off('tile.load', this._update) - .off('tile.error', this._forwardTileEvent) - .off('tile.stats', this._forwardTileEvent) - ._remove(); - + this.style.off('load', this._onStyleLoad).off('error', this._forwardStyleEvent).off('change', this._onStyleChange).off('source.add', this._onSourceAdd).off('source.remove', this._onSourceRemove).off('source.load', this._onSourceUpdate).off('source.error', this._forwardSourceEvent).off('source.change', this._onSourceUpdate).off('layer.add', this._forwardLayerEvent).off('layer.remove', this._forwardLayerEvent).off('layer.error', this._forwardLayerEvent).off('tile.add', this._forwardTileEvent).off('tile.remove', this._forwardTileEvent).off('tile.load', this._update).off('tile.error', this._forwardTileEvent).off('tile.stats', this._forwardTileEvent)._remove(); this.off('rotate', this.style._redoPlacement); this.off('pitch', this.style._redoPlacement); } - if (!style) { this.style = null; return this; } else if (style instanceof Style) { this.style = style; } else { - this.style = new Style(style, this.animationLoop); - } - - this.style - .on('load', this._onStyleLoad) - .on('error', this._forwardStyleEvent) - .on('change', this._onStyleChange) - .on('source.add', this._onSourceAdd) - .on('source.remove', this._onSourceRemove) - .on('source.load', this._onSourceUpdate) - .on('source.error', this._forwardSourceEvent) - .on('source.change', this._onSourceUpdate) - .on('layer.add', this._forwardLayerEvent) - .on('layer.remove', this._forwardLayerEvent) - .on('layer.error', this._forwardLayerEvent) - .on('tile.add', this._forwardTileEvent) - .on('tile.remove', this._forwardTileEvent) - .on('tile.load', this._update) - .on('tile.error', this._forwardTileEvent) - .on('tile.stats', this._forwardTileEvent); - + this.style = new Style(style, this.animationLoop, this._workerCount); + } + this.style.on('load', this._onStyleLoad).on('error', this._forwardStyleEvent).on('change', this._onStyleChange).on('source.add', this._onSourceAdd).on('source.remove', this._onSourceRemove).on('source.load', this._onSourceUpdate).on('source.error', this._forwardSourceEvent).on('source.change', this._onSourceUpdate).on('layer.add', this._forwardLayerEvent).on('layer.remove', this._forwardLayerEvent).on('layer.error', this._forwardLayerEvent).on('tile.add', this._forwardTileEvent).on('tile.remove', this._forwardTileEvent).on('tile.load', this._update).on('tile.error', this._forwardTileEvent).on('tile.stats', this._forwardTileEvent); this.on('rotate', this.style._redoPlacement); this.on('pitch', this.style._redoPlacement); - return this; }, - - /** - * Get a style object that can be used to recreate the map's style. - * - * @returns {Object} style - */ - getStyle: function() { - return this.style.serialize(); + getStyle: function () { + if (this.style) { + return this.style.serialize(); + } }, - - /** - * Add a source to the map style. - * - * @param {string} id ID of the source. Must not be used by any existing source. - * @param {Object} source source specification, following the - * [Mapbox GL Style Reference](https://www.mapbox.com/mapbox-gl-style-spec/#sources) - * @fires source.add - * @returns {Map} `this` - */ - addSource: function(id, source) { + addSource: function (id, source) { this.style.addSource(id, source); this._update(true); return this; }, - - /** - * Remove an existing source from the map style. - * - * @param {string} id ID of the source to remove - * @fires source.remove - * @returns {Map} `this` - */ - removeSource: function(id) { + addSourceType: function (name, SourceType, callback) { + return this.style.addSourceType(name, SourceType, callback); + }, + removeSource: function (id) { this.style.removeSource(id); this._update(true); return this; }, - - /** - * Return the style source object with the given `id`. - * - * @param {string} id source ID - * @returns {Object} - */ - getSource: function(id) { + getSource: function (id) { return this.style.getSource(id); }, - - /** - * Add a layer to the map style. The layer will be inserted before the layer with - * ID `before`, or appended if `before` is omitted. - * @param {StyleLayer|Object} layer - * @param {string=} before ID of an existing layer to insert before - * @fires layer.add - * @returns {Map} `this` - */ - addLayer: function(layer, before) { + addLayer: function (layer, before) { this.style.addLayer(layer, before); this._update(true); return this; }, - - /** - * Remove the layer with the given `id` from the map. Any layers which refer to the - * specified layer via a `ref` property are also removed. - * - * @param {string} id layer id - * @throws {Error} if no layer with the given `id` exists - * @fires layer.remove - * @returns {Map} `this` - */ - removeLayer: function(id) { + removeLayer: function (id) { this.style.removeLayer(id); this._update(true); return this; }, - - /** - * Return the style layer object with the given `id`. - * - * @param {string} id layer id - * @returns {?Object} a layer, if one with the given `id` exists - */ - getLayer: function(id) { + getLayer: function (id) { return this.style.getLayer(id); }, - - /** - * Set the filter for a given style layer. - * - * @param {string} layer ID of a layer - * @param {Array} filter filter specification, as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#types-filter) - * @returns {Map} `this` - * @example - * map.setFilter('my-layer', ['==', 'name', 'USA']); - */ - setFilter: function(layer, filter) { + setFilter: function (layer, filter) { this.style.setFilter(layer, filter); this._update(true); return this; }, - - /** - * Set the zoom extent for a given style layer. - * - * @param {string} layerId ID of a layer - * @param {number} minzoom minimum zoom extent - * @param {number} maxzoom maximum zoom extent - * @returns {Map} `this` - * @example - * map.setLayerZoomRange('my-layer', 2, 5); - */ - setLayerZoomRange: function(layerId, minzoom, maxzoom) { + setLayerZoomRange: function (layerId, minzoom, maxzoom) { this.style.setLayerZoomRange(layerId, minzoom, maxzoom); this._update(true); return this; }, - - /** - * Get the filter for a given style layer. - * - * @param {string} layer ID of a layer - * @returns {Array} filter specification, as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#filter) - */ - getFilter: function(layer) { + getFilter: function (layer) { return this.style.getFilter(layer); }, - - /** - * Set the value of a paint property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a paint property - * @param {*} value value for the paint propery; must have the type appropriate for the property as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/) - * @param {string=} klass optional class specifier for the property - * @returns {Map} `this` - * @example - * map.setPaintProperty('my-layer', 'fill-color', '#faafee'); - */ - setPaintProperty: function(layer, name, value, klass) { + setPaintProperty: function (layer, name, value, klass) { this.style.setPaintProperty(layer, name, value, klass); this._update(true); return this; }, - - /** - * Get the value of a paint property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a paint property - * @param {string=} klass optional class specifier for the property - * @returns {*} value for the paint propery - */ - getPaintProperty: function(layer, name, klass) { + getPaintProperty: function (layer, name, klass) { return this.style.getPaintProperty(layer, name, klass); }, - - /** - * Set the value of a layout property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a layout property - * @param {*} value value for the layout propery; must have the type appropriate for the property as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/) - * @returns {Map} `this` - * @example - * map.setLayoutProperty('my-layer', 'visibility', 'none'); - */ - setLayoutProperty: function(layer, name, value) { + setLayoutProperty: function (layer, name, value) { this.style.setLayoutProperty(layer, name, value); this._update(true); return this; }, - - /** - * Get the value of a layout property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a layout property - * @param {string=} klass optional class specifier for the property - * @returns {*} value for the layout propery - */ - getLayoutProperty: function(layer, name) { + getLayoutProperty: function (layer, name) { return this.style.getLayoutProperty(layer, name); }, - - /** - * Get the Map's container as an HTML element - * @returns {HTMLElement} container - */ - getContainer: function() { + getContainer: function () { return this._container; }, - - /** - * Get the container for the map `canvas` element. - * - * If you want to add non-GL overlays to the map, you should append them to this element. This - * is the element to which event bindings for map interactivity such as panning and zooming are - * attached. It will receive bubbled events for child elements such as the `canvas`, but not for - * map controls. - * - * @returns {HTMLElement} container - */ - getCanvasContainer: function() { + getCanvasContainer: function () { return this._canvasContainer; }, - - /** - * Get the Map's canvas as an HTML canvas - * @returns {HTMLElement} canvas - */ - getCanvas: function() { + getCanvas: function () { return this._canvas.getElement(); }, - - _setupContainer: function() { + _setupContainer: function () { var container = this._container; container.classList.add('mapboxgl-map'); - var canvasContainer = this._canvasContainer = DOM.create('div', 'mapboxgl-canvas-container', container); if (this._interactive) { canvasContainer.classList.add('mapboxgl-interactive'); } this._canvas = new Canvas(this, canvasContainer); - var controlContainer = this._controlContainer = DOM.create('div', 'mapboxgl-control-container', container); var corners = this._controlCorners = {}; - ['top-left', 'top-right', 'bottom-left', 'bottom-right'].forEach(function (pos) { + [ + 'top-left', + 'top-right', + 'bottom-left', + 'bottom-right' + ].forEach(function (pos) { corners[pos] = DOM.create('div', 'mapboxgl-ctrl-' + pos, controlContainer); }); }, - - _setupPainter: function() { + _setupPainter: function () { var gl = this._canvas.getWebGLContext({ failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer }); - if (!gl) { - console.error('Failed to initialize WebGL'); + this.fire('error', { error: new Error('Failed to initialize WebGL') }); return; } - this.painter = new Painter(gl, this.transform); }, - - /** - * WebGL Context Lost event. - * - * @event webglcontextlost - * @memberof Map - * @instance - * @type {Object} - * @property {Event} originalEvent the original DOM event - */ - _contextLost: function(event) { + _contextLost: function (event) { event.preventDefault(); if (this._frameId) { browser.cancelFrame(this._frameId); } - this.fire("webglcontextlost", {originalEvent: event}); + this.fire('webglcontextlost', { originalEvent: event }); }, - - /** - * WebGL Context Restored event. - * - * @event webglcontextrestored - * @memberof Map - * @instance - * @type {Object} - */ - _contextRestored: function(event) { + _contextRestored: function (event) { this._setupPainter(); this.resize(); this._update(); - this.fire("webglcontextrestored", {originalEvent: event}); + this.fire('webglcontextrestored', { originalEvent: event }); }, - - /** - * Is this map fully loaded? If the style isn't loaded - * or it has a change to the sources or style that isn't - * propagated to its style, return false. - * - * @returns {boolean} whether the map is loaded - */ - loaded: function() { + loaded: function () { if (this._styleDirty || this._sourcesDirty) return false; if (!this.style || !this.style.loaded()) return false; return true; }, - - /** - * Update this map's style and sources, and re-render the map. - * - * @param {boolean} updateStyle mark the map's style for reprocessing as - * well as its sources - * @returns {Map} this - * @private - */ - _update: function(updateStyle) { - if (!this.style) return this; - + _update: function (updateStyle) { + if (!this.style) + return this; this._styleDirty = this._styleDirty || updateStyle; this._sourcesDirty = true; - this._rerender(); - return this; }, - - /** - * Call when a (re-)render of the map is required, e.g. when the - * user panned or zoomed,f or new data is available. - * @returns {Map} this - * @private - */ - _render: function() { - if (this.style && this._styleDirty) { - this._styleDirty = false; - this.style.update(this._classes, this._classOptions); - this._classOptions = null; - this.style._recalculate(this.transform.zoom); - } - - if (this.style && this._sourcesDirty) { - this._sourcesDirty = false; - this.style._updateSources(this.transform); - } - - this.painter.render(this.style, { - debug: this.showTileBoundaries, - showOverdrawInspector: this._showOverdrawInspector, - vertices: this.vertices, - rotating: this.rotating, - zooming: this.zooming - }); - - this.fire('render'); - - if (this.loaded() && !this._loaded) { - this._loaded = true; - this.fire('load'); - } - - this._frameId = null; - - if (!this.animationLoop.stopped()) { - this._styleDirty = true; - } - - if (this._sourcesDirty || this._repaint || !this.animationLoop.stopped()) { - this._rerender(); + _render: function () { + try { + if (this.style && this._styleDirty) { + this._styleDirty = false; + this.style.update(this._classes, this._classOptions); + this._classOptions = null; + this.style._recalculate(this.transform.zoom); + } + if (this.style && this._sourcesDirty) { + this._sourcesDirty = false; + this.style._updateSources(this.transform); + } + this.painter.render(this.style, { + debug: this.showTileBoundaries, + showOverdrawInspector: this._showOverdrawInspector, + vertices: this.vertices, + rotating: this.rotating, + zooming: this.zooming + }); + this.fire('render'); + if (this.loaded() && !this._loaded) { + this._loaded = true; + this.fire('load'); + } + this._frameId = null; + if (!this.animationLoop.stopped()) { + this._styleDirty = true; + } + if (this._sourcesDirty || this._repaint || !this.animationLoop.stopped()) { + this._rerender(); + } + } catch (error) { + this.fire('error', { error: error }); } - return this; }, - - /** - * Destroys the map's underlying resources, including web workers and DOM elements. Afterwards, - * you must not call any further methods on this Map instance. - * - * @returns {undefined} - */ - remove: function() { - if (this._hash) this._hash.remove(); + remove: function () { + if (this._hash) + this._hash.remove(); browser.cancelFrame(this._frameId); this.setStyle(null); if (typeof window !== 'undefined') { window.removeEventListener('resize', this._onWindowResize, false); } + var extension = this.painter.gl.getExtension('WEBGL_lose_context'); + if (extension) + extension.loseContext(); removeNode(this._canvasContainer); removeNode(this._controlContainer); this._container.classList.remove('mapboxgl-map'); }, - - /** - * A default error handler for `style.error`, `source.error`, `layer.error`, - * and `tile.error` events. - * It logs the error via `console.error`. - * - * @example - * // Disable the default error handler - * map.off('style.error', map.onError); - * map.off('source.error', map.onError); - * map.off('tile.error', map.onError); - * map.off('layer.error', map.onError); - */ - onError: function(e) { - console.error(e.error); - }, - - _rerender: function() { + _rerender: function () { if (this.style && !this._frameId) { this._frameId = browser.frame(this._render); } }, - - _forwardStyleEvent: function(e) { - this.fire('style.' + e.type, util.extend({style: e.target}, e)); + _forwardStyleEvent: function (e) { + this.fire('style.' + e.type, util.extend({ style: e.target }, e)); }, - - _forwardSourceEvent: function(e) { - this.fire(e.type, util.extend({style: e.target}, e)); + _forwardSourceEvent: function (e) { + this.fire(e.type, util.extend({ style: e.target }, e)); }, - - _forwardLayerEvent: function(e) { - this.fire(e.type, util.extend({style: e.target}, e)); + _forwardLayerEvent: function (e) { + this.fire(e.type, util.extend({ style: e.target }, e)); }, - - _forwardTileEvent: function(e) { - this.fire(e.type, util.extend({style: e.target}, e)); + _forwardTileEvent: function (e) { + this.fire(e.type, util.extend({ style: e.target }, e)); }, - - _onStyleLoad: function(e) { + _onStyleLoad: function (e) { if (this.transform.unmodified) { this.jumpTo(this.style.stylesheet); } - this.style.update(this._classes, {transition: false}); + this.style.update(this._classes, { transition: false }); this._forwardStyleEvent(e); }, - - _onStyleChange: function(e) { + _onStyleChange: function (e) { this._update(true); this._forwardStyleEvent(e); }, - - _onSourceAdd: function(e) { + _onSourceAdd: function (e) { var source = e.source; if (source.onAdd) source.onAdd(this); this._forwardSourceEvent(e); }, - - _onSourceRemove: function(e) { + _onSourceRemove: function (e) { var source = e.source; if (source.onRemove) source.onRemove(this); this._forwardSourceEvent(e); }, - - _onSourceUpdate: function(e) { + _onSourceUpdate: function (e) { this._update(); this._forwardSourceEvent(e); }, - - _onWindowResize: function() { - this.stop().resize()._update(); + _onWindowOnline: function () { + this._update(); + }, + _onWindowResize: function () { + if (this._trackResize) { + this.stop().resize()._update(); + } } }); - -util.extendAll(Map.prototype, /** @lends Map.prototype */{ - - /** - * Draw an outline around each rendered tile for debugging. - * - * @name showTileBoundaries - * @type {boolean} - */ +util.extendAll(Map.prototype, { _showTileBoundaries: false, - get showTileBoundaries() { return this._showTileBoundaries; }, + get showTileBoundaries() { + return this._showTileBoundaries; + }, set showTileBoundaries(value) { - if (this._showTileBoundaries === value) return; + if (this._showTileBoundaries === value) + return; this._showTileBoundaries = value; this._update(); }, - - /** - * Draw boxes around all symbols in the data source, showing which were - * rendered and which were hidden due to collisions with other symbols for - * style debugging. - * - * @name showCollisionBoxes - * @type {boolean} - */ _showCollisionBoxes: false, - get showCollisionBoxes() { return this._showCollisionBoxes; }, + get showCollisionBoxes() { + return this._showCollisionBoxes; + }, set showCollisionBoxes(value) { - if (this._showCollisionBoxes === value) return; + if (this._showCollisionBoxes === value) + return; this._showCollisionBoxes = value; this.style._redoPlacement(); }, - - /* - * Show how many times each fragment has been shaded. White fragments have - * been shaded 8 or more times. Black fragments have been shaded 0 times. - * - * @name showOverdraw - * @type {boolean} - */ _showOverdrawInspector: false, - get showOverdrawInspector() { return this._showOverdrawInspector; }, + get showOverdrawInspector() { + return this._showOverdrawInspector; + }, set showOverdrawInspector(value) { - if (this._showOverdrawInspector === value) return; + if (this._showOverdrawInspector === value) + return; this._showOverdrawInspector = value; this._update(); }, - - /** - * Enable continuous repaint to analyze performance. - * - * @name repaint - * @type {boolean} - */ _repaint: false, - get repaint() { return this._repaint; }, - set repaint(value) { this._repaint = value; this._update(); }, - - // show vertices + get repaint() { + return this._repaint; + }, + set repaint(value) { + this._repaint = value; + this._update(); + }, _vertices: false, - get vertices() { return this._vertices; }, - set vertices(value) { this._vertices = value; this._update(); } + get vertices() { + return this._vertices; + }, + set vertices(value) { + this._vertices = value; + this._update(); + } }); - function removeNode(node) { if (node.parentNode) { node.parentNode.removeChild(node); } } - -/** - * Options common to Map#addClass, Map#removeClass, and Map#setClasses, controlling - * whether or not to smoothly transition property changes triggered by the class change. - * - * @typedef {Object} StyleOptions - * @property {boolean} transition - */ - - /** - * This event is fired whenever the map is drawn to the screen because of - * - * - a change in map position, zoom, pitch, or bearing - * - a change to the map style - * - a change to a GeoJSON source - * - a vector tile, GeoJSON file, glyph, or sprite being loaded - * - * @event render - * @memberof Map - * @instance - */ - -},{"../geo/lng_lat":26,"../geo/lng_lat_bounds":27,"../geo/transform":28,"../render/painter":41,"../style/animation_loop":57,"../style/style":60,"../util/browser":105,"../util/canvas":106,"../util/dom":108,"../util/evented":111,"../util/util":119,"./camera":87,"./control/attribution":88,"./hash":99,"./interaction":100,"point-geometry":174}],102:[function(require,module,exports){ +},{"../geo/lng_lat":33,"../geo/lng_lat_bounds":34,"../geo/transform":35,"../render/painter":49,"../style/animation_loop":69,"../style/style":72,"../util/browser":120,"../util/canvas":121,"../util/dom":122,"../util/evented":128,"../util/util":136,"./bind_handlers":101,"./camera":102,"./control/attribution":103,"./hash":114,"point-geometry":194}],116:[function(require,module,exports){ +'use strict'; +module.exports = Marker; +var DOM = require('../util/dom'); +var LngLat = require('../geo/lng_lat'); +var Point = require('point-geometry'); +function Marker(element, options) { + if (!element) { + element = DOM.create('div'); + } + element.classList.add('mapboxgl-marker'); + this._el = element; + this._offset = Point.convert(options && options.offset || [ + 0, + 0 + ]); + this._update = this._update.bind(this); +} +Marker.prototype = { + addTo: function (map) { + this.remove(); + this._map = map; + map.getCanvasContainer().appendChild(this._el); + map.on('move', this._update); + this._update(); + return this; + }, + remove: function () { + if (this._map) { + this._map.off('move', this._update); + this._map = null; + } + var parent = this._el.parentNode; + if (parent) + parent.removeChild(this._el); + return this; + }, + getLngLat: function () { + return this._lngLat; + }, + setLngLat: function (lnglat) { + this._lngLat = LngLat.convert(lnglat); + this._update(); + return this; + }, + getElement: function () { + return this._el; + }, + _update: function () { + if (!this._map) + return; + var pos = this._map.project(this._lngLat)._add(this._offset); + DOM.setTransform(this._el, 'translate(' + pos.x + 'px,' + pos.y + 'px)'); + } +}; +},{"../geo/lng_lat":33,"../util/dom":122,"point-geometry":194}],117:[function(require,module,exports){ 'use strict'; - module.exports = Popup; - var util = require('../util/util'); var Evented = require('../util/evented'); var DOM = require('../util/dom'); var LngLat = require('../geo/lng_lat'); - -/** - * Creates a popup component - * @class Popup - * @param {Object} options - * @param {boolean} options.closeButton whether to show a close button in the - * top right corner of the popup. - * @param {boolean} options.closeOnClick whether to close the popup when the - * map is clicked. - * @param {string} options.anchor - One of "top", "bottom", "left", "right", "top-left", - * "top-right", "bottom-left", or "bottom-right", describing where the popup's anchor - * relative to the coordinate set via `setLngLat`. - * @example - * var tooltip = new mapboxgl.Popup() - * .setLngLat(e.lngLat) - * .setHTML("

Hello World!

") - * .addTo(map); - */ function Popup(options) { util.setOptions(this, options); util.bindAll([ '_update', - '_onClickClose'], - this); + '_onClickClose' + ], this); } - -Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ +Popup.prototype = util.inherit(Evented, { options: { closeButton: true, closeOnClick: true }, - - /** - * Attaches the popup to a map - * @param {Map} map - * @returns {Popup} `this` - */ - addTo: function(map) { + addTo: function (map) { this._map = map; this._map.on('move', this._update); if (this.options.closeOnClick) { @@ -27135,137 +26659,75 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ this._update(); return this; }, - - /** - * Removes the popup from a map - * @example - * var popup = new mapboxgl.Popup().addTo(map); - * popup.remove(); - * @returns {Popup} `this` - */ - remove: function() { + remove: function () { if (this._content && this._content.parentNode) { this._content.parentNode.removeChild(this._content); } - if (this._container) { this._container.parentNode.removeChild(this._container); delete this._container; } - if (this._map) { this._map.off('move', this._update); this._map.off('click', this._onClickClose); delete this._map; } - + this.fire('close'); return this; }, - - /** - * Get the popup's geographical location - * @returns {LngLat} - */ - getLngLat: function() { + getLngLat: function () { return this._lngLat; }, - - /** - * Set the popup's geographical position and move it. - * @param {LngLat} lnglat - * @returns {Popup} `this` - */ - setLngLat: function(lnglat) { + setLngLat: function (lnglat) { this._lngLat = LngLat.convert(lnglat); this._update(); return this; }, - - /** - * Fill a popup element with text only content. This creates a text node - * in the DOM, so it cannot end up appending raw HTML. Use this method - * if you want an added level of security against XSS if the popup - * content is user-provided. - * @param {string} text - * @returns {Popup} `this` - * @example - * var tooltip = new mapboxgl.Popup() - * .setLngLat(e.lngLat) - * .setText('Hello, world!') - * .addTo(map); - */ - setText: function(text) { + setText: function (text) { return this.setDOMContent(document.createTextNode(text)); }, - - /** - * Fill a popup element with HTML content, provided as a string. - * @param {string} html - * @returns {Popup} `this` - */ - setHTML: function(html) { + setHTML: function (html) { var frag = document.createDocumentFragment(); var temp = document.createElement('body'), child; temp.innerHTML = html; while (true) { child = temp.firstChild; - if (!child) break; + if (!child) + break; frag.appendChild(child); } - return this.setDOMContent(frag); }, - - /** - * Fill a popup element with DOM content - * @param {Node} htmlNode Popup content as a DOM node - * @returns {Popup} `this` - * @example - * // create an element with the popup content - * var div = document.createElement('div'); - * div.innerHTML = 'Hello, world!'; - * var tooltip = new mapboxgl.Popup() - * .setLngLat(e.lngLat) - * .setDOMContent(div) - * .addTo(map); - */ - setDOMContent: function(htmlNode) { + setDOMContent: function (htmlNode) { this._createContent(); this._content.appendChild(htmlNode); this._update(); return this; }, - - _createContent: function() { + _createContent: function () { if (this._content && this._content.parentNode) { this._content.parentNode.removeChild(this._content); } - this._content = DOM.create('div', 'mapboxgl-popup-content', this._container); - if (this.options.closeButton) { this._closeButton = DOM.create('button', 'mapboxgl-popup-close-button', this._content); + this._closeButton.type = 'button'; this._closeButton.innerHTML = '×'; this._closeButton.addEventListener('click', this._onClickClose); } }, - - _update: function() { - if (!this._map || !this._lngLat || !this._content) { return; } - + _update: function () { + if (!this._map || !this._lngLat || !this._content) { + return; + } if (!this._container) { this._container = DOM.create('div', 'mapboxgl-popup', this._map.getContainer()); - this._tip = DOM.create('div', 'mapboxgl-popup-tip', this._container); + this._tip = DOM.create('div', 'mapboxgl-popup-tip', this._container); this._container.appendChild(this._content); } - - var pos = this._map.project(this._lngLat).round(), - anchor = this.options.anchor; - + var pos = this._map.project(this._lngLat).round(), anchor = this.options.anchor; if (!anchor) { - var width = this._container.offsetWidth, - height = this._container.offsetHeight; - + var width = this._container.offsetWidth, height = this._container.offsetHeight; if (pos.y < height) { anchor = ['top']; } else if (pos.y > this._map.transform.height - height) { @@ -27273,20 +26735,17 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ } else { anchor = []; } - if (pos.x < width / 2) { anchor.push('left'); } else if (pos.x > this._map.transform.width - width / 2) { anchor.push('right'); } - if (anchor.length === 0) { anchor = 'bottom'; } else { anchor = anchor.join('-'); } } - var anchorTranslate = { 'top': 'translate(-50%,0)', 'top-left': 'translate(0,0)', @@ -27297,36 +26756,20 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ 'left': 'translate(0,-50%)', 'right': 'translate(-100%,-50%)' }; - var classList = this._container.classList; for (var key in anchorTranslate) { classList.remove('mapboxgl-popup-anchor-' + key); } classList.add('mapboxgl-popup-anchor-' + anchor); - DOM.setTransform(this._container, anchorTranslate[anchor] + ' translate(' + pos.x + 'px,' + pos.y + 'px)'); }, - - _onClickClose: function() { + _onClickClose: function () { this.remove(); } }); - -},{"../geo/lng_lat":26,"../util/dom":108,"../util/evented":111,"../util/util":119}],103:[function(require,module,exports){ +},{"../geo/lng_lat":33,"../util/dom":122,"../util/evented":128,"../util/util":136}],118:[function(require,module,exports){ 'use strict'; - module.exports = Actor; - -/** - * An implementation of the [Actor design pattern](http://en.wikipedia.org/wiki/Actor_model) - * that maintains the relationship between asynchronous tasks and the objects - * that spin them off - in this case, tasks like parsing parts of styles, - * owned by the styles - * - * @param {WebWorker} target - * @param {WebWorker} parent - * @private - */ function Actor(target, parent) { this.target = target; this.parent = parent; @@ -27335,59 +26778,53 @@ function Actor(target, parent) { this.receive = this.receive.bind(this); this.target.addEventListener('message', this.receive, false); } - -Actor.prototype.receive = function(message) { - var data = message.data, - callback; - +Actor.prototype.receive = function (message) { + var data = message.data, id = data.id, callback; if (data.type === '') { callback = this.callbacks[data.id]; delete this.callbacks[data.id]; - callback(data.error || null, data.data); - } else if (typeof data.id !== 'undefined') { - var id = data.id; - this.parent[data.type](data.data, function(err, data, buffers) { - this.postMessage({ - type: '', - id: String(id), - error: err ? String(err) : null, - data: data - }, buffers); - }.bind(this)); + if (callback) + callback(data.error || null, data.data); + } else if (typeof data.id !== 'undefined' && this.parent[data.type]) { + this.parent[data.type](data.data, done.bind(this)); + } else if (typeof data.id !== 'undefined' && this.parent.workerSources) { + var keys = data.type.split('.'); + this.parent.workerSources[keys[0]][keys[1]](data.data, done.bind(this)); } else { this.parent[data.type](data.data); } + function done(err, data, buffers) { + this.postMessage({ + type: '', + id: String(id), + error: err ? String(err) : null, + data: data + }, buffers); + } }; - -Actor.prototype.send = function(type, data, callback, buffers) { +Actor.prototype.send = function (type, data, callback, buffers) { var id = null; - if (callback) this.callbacks[id = this.callbackID++] = callback; - this.postMessage({ type: type, id: String(id), data: data }, buffers); + if (callback) + this.callbacks[id = this.callbackID++] = callback; + this.postMessage({ + type: type, + id: String(id), + data: data + }, buffers); }; - -/** - * Wrapped postMessage API that abstracts around IE's lack of - * `transferList` support. - * - * @param {Object} message - * @param {Object} transferList - * @private - */ -Actor.prototype.postMessage = function(message, transferList) { +Actor.prototype.postMessage = function (message, transferList) { this.target.postMessage(message, transferList); }; - -},{}],104:[function(require,module,exports){ +},{}],119:[function(require,module,exports){ 'use strict'; - -exports.getJSON = function(url, callback) { +exports.getJSON = function (url, callback) { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.setRequestHeader('Accept', 'application/json'); - xhr.onerror = function(e) { + xhr.onerror = function (e) { callback(e); }; - xhr.onload = function() { + xhr.onload = function () { if (xhr.status >= 200 && xhr.status < 300 && xhr.response) { var data; try { @@ -27403,15 +26840,14 @@ exports.getJSON = function(url, callback) { xhr.send(); return xhr; }; - -exports.getArrayBuffer = function(url, callback) { +exports.getArrayBuffer = function (url, callback) { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = 'arraybuffer'; - xhr.onerror = function(e) { + xhr.onerror = function (e) { callback(e); }; - xhr.onload = function() { + xhr.onload = function () { if (xhr.status >= 200 && xhr.status < 300 && xhr.response) { callback(null, xhr.response); } else { @@ -27421,24 +26857,23 @@ exports.getArrayBuffer = function(url, callback) { xhr.send(); return xhr; }; - function sameOrigin(url) { var a = document.createElement('a'); a.href = url; return a.protocol === document.location.protocol && a.host === document.location.host; } - -exports.getImage = function(url, callback) { - return exports.getArrayBuffer(url, function(err, imgData) { - if (err) return callback(err); +exports.getImage = function (url, callback) { + return exports.getArrayBuffer(url, function (err, imgData) { + if (err) + return callback(err); var img = new Image(); - img.onload = function() { + img.onload = function () { callback(null, img); (window.URL || window.webkitURL).revokeObjectURL(img.src); }; var blob = new Blob([new Uint8Array(imgData)], { type: 'image/png' }); img.src = (window.URL || window.webkitURL).createObjectURL(blob); - img.getData = function() { + img.getData = function () { var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); canvas.width = img.width; @@ -27449,10 +26884,9 @@ exports.getImage = function(url, callback) { return img; }); }; - -exports.getVideo = function(urls, callback) { +exports.getVideo = function (urls, callback) { var video = document.createElement('video'); - video.onloadstart = function() { + video.onloadstart = function () { callback(null, video); }; for (var i = 0; i < urls.length; i++) { @@ -27463,64 +26897,39 @@ exports.getVideo = function(urls, callback) { s.src = urls[i]; video.appendChild(s); } - video.getData = function() { return video; }; + video.getData = function () { + return video; + }; return video; }; - -},{}],105:[function(require,module,exports){ +},{}],120:[function(require,module,exports){ 'use strict'; - -/** - * Unlike js/util/browser.js, this code is written with the expectation - * of a browser environment with a global 'window' object - * @module browser - * @private - */ - -/** - * Provides a function that outputs milliseconds: either performance.now() - * or a fallback to Date.now() - */ -module.exports.now = (function() { - if (window.performance && - window.performance.now) { +exports.window = window; +module.exports.now = function () { + if (window.performance && window.performance.now) { return window.performance.now.bind(window.performance); } else { return Date.now.bind(Date); } -}()); - -var frame = window.requestAnimationFrame || - window.mozRequestAnimationFrame || - window.webkitRequestAnimationFrame || - window.msRequestAnimationFrame; - -exports.frame = function(fn) { +}(); +var frame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; +exports.frame = function (fn) { return frame(fn); }; - -var cancel = window.cancelAnimationFrame || - window.mozCancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.msCancelAnimationFrame; - -exports.cancelFrame = function(id) { +var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame; +exports.cancelFrame = function (id) { cancel(id); }; - exports.timed = function (fn, dur, ctx) { if (!dur) { fn.call(ctx, 1); return null; } - - var abort = false, - start = module.exports.now(); - + var abort = false, start = module.exports.now(); function tick(now) { - if (abort) return; + if (abort) + return; now = module.exports.now(); - if (now >= start + dur) { fn.call(ctx, 1); } else { @@ -27528,49 +26937,32 @@ exports.timed = function (fn, dur, ctx) { exports.frame(tick); } } - exports.frame(tick); - - return function() { abort = true; }; + return function () { + abort = true; + }; }; - -/** - * Test if the current browser supports Mapbox GL JS - * @param {Object} options - * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false` - * if the performance of Mapbox GL JS would be dramatically worse than - * expected (i.e. a software renderer would be used) - * @return {boolean} - */ -exports.supported = require('mapbox-gl-js-supported'); - -exports.hardwareConcurrency = navigator.hardwareConcurrency || 8; - +exports.supported = require('mapbox-gl-supported'); +exports.hardwareConcurrency = navigator.hardwareConcurrency || 4; Object.defineProperty(exports, 'devicePixelRatio', { - get: function() { return window.devicePixelRatio; } + get: function () { + return window.devicePixelRatio; + } }); - exports.supportsWebp = false; - var webpImgTest = document.createElement('img'); -webpImgTest.onload = function() { +webpImgTest.onload = function () { exports.supportsWebp = true; }; webpImgTest.src = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA='; - exports.supportsGeolocation = !!navigator.geolocation; - -},{"mapbox-gl-js-supported":145}],106:[function(require,module,exports){ +},{"mapbox-gl-supported":190}],121:[function(require,module,exports){ 'use strict'; - var util = require('../util'); -var isSupported = require('mapbox-gl-js-supported'); - +var isSupported = require('mapbox-gl-supported'); module.exports = Canvas; - function Canvas(parent, container) { this.canvas = document.createElement('canvas'); - if (parent && container) { this.canvas.style.position = 'absolute'; this.canvas.classList.add('mapboxgl-canvas'); @@ -27580,88 +26972,32 @@ function Canvas(parent, container) { container.appendChild(this.canvas); } } - -Canvas.prototype.resize = function(width, height) { +Canvas.prototype.resize = function (width, height) { var pixelRatio = window.devicePixelRatio || 1; - - // Request the required canvas size taking the pixelratio into account. this.canvas.width = pixelRatio * width; this.canvas.height = pixelRatio * height; - - // Maintain the same canvas size, potentially downscaling it for HiDPI displays this.canvas.style.width = width + 'px'; this.canvas.style.height = height + 'px'; }; - -Canvas.prototype.getWebGLContext = function(attributes) { +Canvas.prototype.getWebGLContext = function (attributes) { attributes = util.extend({}, attributes, isSupported.webGLContextAttributes); - - return this.canvas.getContext('webgl', attributes) || - this.canvas.getContext('experimental-webgl', attributes); + return this.canvas.getContext('webgl', attributes) || this.canvas.getContext('experimental-webgl', attributes); }; - -Canvas.prototype.getElement = function() { +Canvas.prototype.getElement = function () { return this.canvas; }; - -},{"../util":119,"mapbox-gl-js-supported":145}],107:[function(require,module,exports){ -'use strict'; - -var Actor = require('../actor'); -var WebWorkify = require('webworkify'); - -module.exports = Dispatcher; - -function Dispatcher(length, parent) { - this.actors = []; - this.currentActor = 0; - for (var i = 0; i < length; i++) { - var worker = new WebWorkify(require('../../source/worker')); - var actor = new Actor(worker, parent); - actor.name = "Worker " + i; - this.actors.push(actor); - } -} - -Dispatcher.prototype = { - broadcast: function(type, data) { - for (var i = 0; i < this.actors.length; i++) { - this.actors[i].send(type, data); - } - }, - - send: function(type, data, callback, targetID, buffers) { - if (typeof targetID !== 'number' || isNaN(targetID)) { - // Use round robin to send requests to web workers. - targetID = this.currentActor = (this.currentActor + 1) % this.actors.length; - } - - this.actors[targetID].send(type, data, callback, buffers); - return targetID; - }, - - remove: function() { - for (var i = 0; i < this.actors.length; i++) { - this.actors[i].target.terminate(); - } - this.actors = []; - } -}; - -},{"../../source/worker":55,"../actor":103,"webworkify":190}],108:[function(require,module,exports){ +},{"../util":136,"mapbox-gl-supported":190}],122:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - exports.create = function (tagName, className, container) { var el = document.createElement(tagName); - if (className) el.className = className; - if (container) container.appendChild(el); + if (className) + el.className = className; + if (container) + container.appendChild(el); return el; }; - var docStyle = document.documentElement.style; - function testProp(props) { for (var i = 0; i < props.length; i++) { if (props[i] in docStyle) { @@ -27669,9 +27005,12 @@ function testProp(props) { } } } - -var selectProp = testProp(['userSelect', 'MozUserSelect', 'WebkitUserSelect', 'msUserSelect']), - userSelect; +var selectProp = testProp([ + 'userSelect', + 'MozUserSelect', + 'WebkitUserSelect', + 'msUserSelect' + ]), userSelect; exports.disableDrag = function () { if (selectProp) { userSelect = docStyle[selectProp]; @@ -27683,61 +27022,98 @@ exports.enableDrag = function () { docStyle[selectProp] = userSelect; } }; - -var transformProp = testProp(['transform', 'WebkitTransform']); -exports.setTransform = function(el, value) { +var transformProp = testProp([ + 'transform', + 'WebkitTransform' +]); +exports.setTransform = function (el, value) { el.style[transformProp] = value; }; - -// Suppress the next click, but only if it's immediate. function suppressClick(e) { e.preventDefault(); e.stopPropagation(); window.removeEventListener('click', suppressClick, true); } -exports.suppressClick = function() { +exports.suppressClick = function () { window.addEventListener('click', suppressClick, true); - window.setTimeout(function() { + window.setTimeout(function () { window.removeEventListener('click', suppressClick, true); }, 0); }; - exports.mousePos = function (el, e) { var rect = el.getBoundingClientRect(); e = e.touches ? e.touches[0] : e; - return new Point( - e.clientX - rect.left - el.clientLeft, - e.clientY - rect.top - el.clientTop - ); + return new Point(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop); }; - exports.touchPos = function (el, e) { - var rect = el.getBoundingClientRect(), - points = []; + var rect = el.getBoundingClientRect(), points = []; for (var i = 0; i < e.touches.length; i++) { - points.push(new Point( - e.touches[i].clientX - rect.left - el.clientLeft, - e.touches[i].clientY - rect.top - el.clientTop - )); + points.push(new Point(e.touches[i].clientX - rect.left - el.clientLeft, e.touches[i].clientY - rect.top - el.clientTop)); + } + return points; +}; +},{"point-geometry":194}],123:[function(require,module,exports){ +'use strict'; +var WebWorkify = require('webworkify'); +module.exports = function () { + return new WebWorkify(require('../../source/worker')); +}; +},{"../../source/worker":67,"webworkify":211}],124:[function(require,module,exports){ +'use strict'; +var quickselect = require('quickselect'); +module.exports = function classifyRings(rings, maxRings) { + var len = rings.length; + if (len <= 1) + return [rings]; + var polygons = [], polygon, ccw; + for (var i = 0; i < len; i++) { + var area = calculateSignedArea(rings[i]); + if (area === 0) + continue; + rings[i].area = Math.abs(area); + if (ccw === undefined) + ccw = area < 0; + if (ccw === area < 0) { + if (polygon) + polygons.push(polygon); + polygon = [rings[i]]; + } else { + polygon.push(rings[i]); + } + } + if (polygon) + polygons.push(polygon); + if (maxRings > 1) { + for (var j = 0; j < polygons.length; j++) { + if (polygons[j].length <= maxRings) + continue; + quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas); + polygons[j] = polygons[j].slice(0, maxRings); + } + } + return polygons; +}; +function compareAreas(a, b) { + return b.area - a.area; +} +function calculateSignedArea(ring) { + var sum = 0; + for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) { + p1 = ring[i]; + p2 = ring[j]; + sum += (p2.x - p1.x) * (p1.y + p2.y); } - return points; -}; - -},{"point-geometry":174}],109:[function(require,module,exports){ + return sum; +} +},{"quickselect":195}],125:[function(require,module,exports){ 'use strict'; - module.exports = { API_URL: 'https://api.mapbox.com', REQUIRE_ACCESS_TOKEN: true }; - -},{}],110:[function(require,module,exports){ +},{}],126:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); - module.exports = DictionaryCoder; - function DictionaryCoder(strings) { this._stringToNumber = {}; this._numberToString = []; @@ -27747,59 +27123,67 @@ function DictionaryCoder(strings) { this._numberToString[i] = string; } } - -DictionaryCoder.prototype.encode = function(string) { - assert(string in this._stringToNumber); +DictionaryCoder.prototype.encode = function (string) { return this._stringToNumber[string]; }; - -DictionaryCoder.prototype.decode = function(n) { - assert(n < this._numberToString.length); +DictionaryCoder.prototype.decode = function (n) { return this._numberToString[n]; }; - -},{"assert":6}],111:[function(require,module,exports){ +},{}],127:[function(require,module,exports){ +'use strict'; +var util = require('./util'); +var Actor = require('./actor'); +var WebWorker = require('./web_worker'); +module.exports = Dispatcher; +function Dispatcher(length, parent) { + this.actors = []; + this.currentActor = 0; + for (var i = 0; i < length; i++) { + var worker = new WebWorker(); + var actor = new Actor(worker, parent); + actor.name = 'Worker ' + i; + this.actors.push(actor); + } +} +Dispatcher.prototype = { + broadcast: function (type, data, cb) { + cb = cb || function () { + }; + util.asyncAll(this.actors, function (actor, done) { + actor.send(type, data, done); + }, cb); + }, + send: function (type, data, callback, targetID, buffers) { + if (typeof targetID !== 'number' || isNaN(targetID)) { + targetID = this.currentActor = (this.currentActor + 1) % this.actors.length; + } + this.actors[targetID].send(type, data, callback, buffers); + return targetID; + }, + remove: function () { + for (var i = 0; i < this.actors.length; i++) { + this.actors[i].target.terminate(); + } + this.actors = []; + } +}; +},{"./actor":118,"./util":136,"./web_worker":123}],128:[function(require,module,exports){ 'use strict'; - var util = require('./util'); - -/** - * Methods mixed in to other classes for event capabilities. - * @mixin Evented - */ var Evented = { - - /** - * Subscribe to a specified event with a listener function the latter gets the data object that was passed to `fire` and additionally `target` and `type` properties - * - * @param {string} type Event type - * @param {Function} listener Function to be called when the event is fired - * @returns {Object} `this` - */ - on: function(type, listener) { + on: function (type, listener) { this._events = this._events || {}; this._events[type] = this._events[type] || []; this._events[type].push(listener); - return this; }, - - /** - * Remove a event listener - * - * @param {string} [type] Event type. If none is specified, remove all listeners - * @param {Function} [listener] Function to be called when the event is fired. If none is specified all listeners are removed - * @returns {Object} `this` - */ - off: function(type, listener) { + off: function (type, listener) { if (!type) { - // clear all listeners if no arguments specified delete this._events; return this; } - - if (!this.listens(type)) return this; - + if (!this.listens(type)) + return this; if (listener) { var idx = this._events[type].indexOf(listener); if (idx >= 0) { @@ -27811,123 +27195,91 @@ var Evented = { } else { delete this._events[type]; } - return this; }, - - /** - * Call a function once when an event has fired - * - * @param {string} type Event type. - * @param {Function} listener Function to be called once when the event is fired - * @returns {Object} `this` - */ - once: function(type, listener) { - var wrapper = function(data) { + once: function (type, listener) { + var wrapper = function (data) { this.off(type, wrapper); listener.call(this, data); }.bind(this); this.on(type, wrapper); return this; }, - - /** - * Fire event of a given string type with the given data object - * - * @param {string} type Event type - * @param {Object} [data] Optional data passed to the event receiver (e.g. {@link #EventData}) - * @returns {Object} `this` - */ - fire: function(type, data) { - if (!this.listens(type)) return this; - + fire: function (type, data) { + if (!this.listens(type)) { + if (util.endsWith(type, 'error')) { + console.error(data && data.error || data || 'Empty error event'); + } + return this; + } data = util.extend({}, data); - util.extend(data, {type: type, target: this}); - - // make sure adding/removing listeners inside other listeners won't cause infinite loop + util.extend(data, { + type: type, + target: this + }); var listeners = this._events[type].slice(); - for (var i = 0; i < listeners.length; i++) { listeners[i].call(this, data); } - return this; }, - - /** - * Check if an event is registered to a type - * @param {string} type Event type - * @returns {boolean} `true` if there is at least one registered listener for events of type `type` - */ - listens: function(type) { + listens: function (type) { return !!(this._events && this._events[type]); } }; - module.exports = Evented; - -},{"./util":119}],112:[function(require,module,exports){ +},{"./util":136}],129:[function(require,module,exports){ 'use strict'; - module.exports = Glyphs; - function Glyphs(pbf, end) { this.stacks = pbf.readFields(readFontstacks, [], end); } - function readFontstacks(tag, stacks, pbf) { if (tag === 1) { - var fontstack = pbf.readMessage(readFontstack, {glyphs: {}}); + var fontstack = pbf.readMessage(readFontstack, { glyphs: {} }); stacks.push(fontstack); } } - function readFontstack(tag, fontstack, pbf) { - if (tag === 1) fontstack.name = pbf.readString(); - else if (tag === 2) fontstack.range = pbf.readString(); + if (tag === 1) + fontstack.name = pbf.readString(); + else if (tag === 2) + fontstack.range = pbf.readString(); else if (tag === 3) { var glyph = pbf.readMessage(readGlyph, {}); fontstack.glyphs[glyph.id] = glyph; } } - function readGlyph(tag, glyph, pbf) { - if (tag === 1) glyph.id = pbf.readVarint(); - else if (tag === 2) glyph.bitmap = pbf.readBytes(); - else if (tag === 3) glyph.width = pbf.readVarint(); - else if (tag === 4) glyph.height = pbf.readVarint(); - else if (tag === 5) glyph.left = pbf.readSVarint(); - else if (tag === 6) glyph.top = pbf.readSVarint(); - else if (tag === 7) glyph.advance = pbf.readVarint(); + if (tag === 1) + glyph.id = pbf.readVarint(); + else if (tag === 2) + glyph.bitmap = pbf.readBytes(); + else if (tag === 3) + glyph.width = pbf.readVarint(); + else if (tag === 4) + glyph.height = pbf.readVarint(); + else if (tag === 5) + glyph.left = pbf.readSVarint(); + else if (tag === 6) + glyph.top = pbf.readSVarint(); + else if (tag === 7) + glyph.advance = pbf.readVarint(); } - -},{}],113:[function(require,module,exports){ +},{}],130:[function(require,module,exports){ 'use strict'; - module.exports = interpolate; - function interpolate(a, b, t) { - return (a * (1 - t)) + (b * t); + return a * (1 - t) + b * t; } - interpolate.number = interpolate; - -interpolate.vec2 = function(from, to, t) { +interpolate.vec2 = function (from, to, t) { return [ interpolate(from[0], to[0], t), interpolate(from[1], to[1], t) ]; }; - -/* - * Interpolate between two colors given as 4-element arrays. - * - * @param {Color} from - * @param {Color} to - * @param {number} t interpolation factor between 0 and 1 - * @returns {Color} interpolated color - */ -interpolate.color = function(from, to, t) { +interpolate.color = function (from, to, t) { return [ interpolate(from[0], to[0], t), interpolate(from[1], to[1], t), @@ -27935,22 +27287,18 @@ interpolate.color = function(from, to, t) { interpolate(from[3], to[3], t) ]; }; - -interpolate.array = function(from, to, t) { - return from.map(function(d, i) { +interpolate.array = function (from, to, t) { + return from.map(function (d, i) { return interpolate(d, to[i], t); }); }; - -},{}],114:[function(require,module,exports){ +},{}],131:[function(require,module,exports){ 'use strict'; - module.exports = { multiPolygonIntersectsBufferedMultiPoint: multiPolygonIntersectsBufferedMultiPoint, multiPolygonIntersectsMultiPolygon: multiPolygonIntersectsMultiPolygon, multiPolygonIntersectsBufferedMultiLine: multiPolygonIntersectsBufferedMultiLine }; - function multiPolygonIntersectsBufferedMultiPoint(multiPolygon, rings, radius) { for (var j = 0; j < multiPolygon.length; j++) { var polygon = multiPolygon[j]; @@ -27958,78 +27306,71 @@ function multiPolygonIntersectsBufferedMultiPoint(multiPolygon, rings, radius) { var ring = rings[i]; for (var k = 0; k < ring.length; k++) { var point = ring[k]; - if (polygonContainsPoint(polygon, point)) return true; - if (pointIntersectsBufferedLine(point, polygon, radius)) return true; + if (polygonContainsPoint(polygon, point)) + return true; + if (pointIntersectsBufferedLine(point, polygon, radius)) + return true; } } } return false; } - function multiPolygonIntersectsMultiPolygon(multiPolygonA, multiPolygonB) { - if (multiPolygonA.length === 1 && multiPolygonA[0].length === 1) { return multiPolygonContainsPoint(multiPolygonB, multiPolygonA[0][0]); } - for (var m = 0; m < multiPolygonB.length; m++) { var ring = multiPolygonB[m]; for (var n = 0; n < ring.length; n++) { - if (multiPolygonContainsPoint(multiPolygonA, ring[n])) return true; + if (multiPolygonContainsPoint(multiPolygonA, ring[n])) + return true; } } - for (var j = 0; j < multiPolygonA.length; j++) { var polygon = multiPolygonA[j]; for (var i = 0; i < polygon.length; i++) { - if (multiPolygonContainsPoint(multiPolygonB, polygon[i])) return true; + if (multiPolygonContainsPoint(multiPolygonB, polygon[i])) + return true; } - for (var k = 0; k < multiPolygonB.length; k++) { - if (lineIntersectsLine(polygon, multiPolygonB[k])) return true; + if (lineIntersectsLine(polygon, multiPolygonB[k])) + return true; } } - return false; } - function multiPolygonIntersectsBufferedMultiLine(multiPolygon, multiLine, radius) { for (var i = 0; i < multiLine.length; i++) { var line = multiLine[i]; - for (var j = 0; j < multiPolygon.length; j++) { var polygon = multiPolygon[j]; - if (polygon.length >= 3) { for (var k = 0; k < line.length; k++) { - if (polygonContainsPoint(polygon, line[k])) return true; + if (polygonContainsPoint(polygon, line[k])) + return true; } } - - if (lineIntersectsBufferedLine(polygon, line, radius)) return true; + if (lineIntersectsBufferedLine(polygon, line, radius)) + return true; } } return false; } - function lineIntersectsBufferedLine(lineA, lineB, radius) { - if (lineA.length > 1) { - if (lineIntersectsLine(lineA, lineB)) return true; - - // Check whether any point in either line is within radius of the other line + if (lineIntersectsLine(lineA, lineB)) + return true; for (var j = 0; j < lineB.length; j++) { - if (pointIntersectsBufferedLine(lineB[j], lineA, radius)) return true; + if (pointIntersectsBufferedLine(lineB[j], lineA, radius)) + return true; } } - for (var k = 0; k < lineA.length; k++) { - if (pointIntersectsBufferedLine(lineA[k], lineB, radius)) return true; + if (pointIntersectsBufferedLine(lineA[k], lineB, radius)) + return true; } - return false; } - function lineIntersectsLine(lineA, lineB) { for (var i = 0; i < lineA.length - 1; i++) { var a0 = lineA[i]; @@ -28037,292 +27378,205 @@ function lineIntersectsLine(lineA, lineB) { for (var j = 0; j < lineB.length - 1; j++) { var b0 = lineB[j]; var b1 = lineB[j + 1]; - if (lineSegmentIntersectsLineSegment(a0, a1, b0, b1)) return true; + if (lineSegmentIntersectsLineSegment(a0, a1, b0, b1)) + return true; } } return false; } - - -// http://bryceboe.com/2006/10/23/line-segment-intersection-algorithm/ function isCounterClockwise(a, b, c) { return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x); } - function lineSegmentIntersectsLineSegment(a0, a1, b0, b1) { - return isCounterClockwise(a0, b0, b1) !== isCounterClockwise(a1, b0, b1) && - isCounterClockwise(a0, a1, b0) !== isCounterClockwise(a0, a1, b1); + return isCounterClockwise(a0, b0, b1) !== isCounterClockwise(a1, b0, b1) && isCounterClockwise(a0, a1, b0) !== isCounterClockwise(a0, a1, b1); } - function pointIntersectsBufferedLine(p, line, radius) { var radiusSquared = radius * radius; - - if (line.length === 1) return p.distSqr(line[0]) < radiusSquared; - + if (line.length === 1) + return p.distSqr(line[0]) < radiusSquared; for (var i = 1; i < line.length; i++) { - // Find line segments that have a distance <= radius^2 to p - // In that case, we treat the line as "containing point p". var v = line[i - 1], w = line[i]; - if (distToSegmentSquared(p, v, w) < radiusSquared) return true; + if (distToSegmentSquared(p, v, w) < radiusSquared) + return true; } return false; } - -// Code from http://stackoverflow.com/a/1501725/331379. function distToSegmentSquared(p, v, w) { var l2 = v.distSqr(w); - if (l2 === 0) return p.distSqr(v); + if (l2 === 0) + return p.distSqr(v); var t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2; - if (t < 0) return p.distSqr(v); - if (t > 1) return p.distSqr(w); + if (t < 0) + return p.distSqr(v); + if (t > 1) + return p.distSqr(w); return p.distSqr(w.sub(v)._mult(t)._add(v)); } - -// point in polygon ray casting algorithm function multiPolygonContainsPoint(rings, p) { - var c = false, - ring, p1, p2; - + var c = false, ring, p1, p2; for (var k = 0; k < rings.length; k++) { ring = rings[k]; for (var i = 0, j = ring.length - 1; i < ring.length; j = i++) { p1 = ring[i]; p2 = ring[j]; - if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) { + if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) { c = !c; } } } return c; } - function polygonContainsPoint(ring, p) { var c = false; for (var i = 0, j = ring.length - 1; i < ring.length; j = i++) { var p1 = ring[i]; var p2 = ring[j]; - if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) { + if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) { c = !c; } } return c; } - -},{}],115:[function(require,module,exports){ +},{}],132:[function(require,module,exports){ 'use strict'; - module.exports = LRUCache; - -/** - * A [least-recently-used cache](http://en.wikipedia.org/wiki/Cache_algorithms) - * with hash lookup made possible by keeping a list of keys in parallel to - * an array of dictionary of values - * - * @param {number} max number of permitted values - * @param {Function} onRemove callback called with items when they expire - * @private - */ function LRUCache(max, onRemove) { this.max = max; this.onRemove = onRemove; this.reset(); } - -/** - * Clear the cache - * - * @returns {LRUCache} this cache - * @private - */ -LRUCache.prototype.reset = function() { +LRUCache.prototype.reset = function () { for (var key in this.data) { this.onRemove(this.data[key]); } - this.data = {}; this.order = []; - return this; }; - -/** - * Add a key, value combination to the cache, trimming its size if this pushes - * it over max length. - * - * @param {string} key lookup key for the item - * @param {*} data any value - * - * @returns {LRUCache} this cache - * @private - */ -LRUCache.prototype.add = function(key, data) { - +LRUCache.prototype.add = function (key, data) { if (this.has(key)) { this.order.splice(this.order.indexOf(key), 1); this.data[key] = data; this.order.push(key); - } else { this.data[key] = data; this.order.push(key); - if (this.order.length > this.max) { var removedData = this.get(this.order[0]); - if (removedData) this.onRemove(removedData); + if (removedData) + this.onRemove(removedData); } } - return this; }; - -/** - * Determine whether the value attached to `key` is present - * - * @param {string} key the key to be looked-up - * @returns {boolean} whether the cache has this value - * @private - */ -LRUCache.prototype.has = function(key) { +LRUCache.prototype.has = function (key) { return key in this.data; }; - -/** - * List all keys in the cache - * - * @returns {Array} an array of keys in this cache. - * @private - */ -LRUCache.prototype.keys = function() { +LRUCache.prototype.keys = function () { return this.order; }; - -/** - * Get the value attached to a specific key. If the key is not found, - * returns `null` - * - * @param {string} key the key to look up - * @returns {*} the data, or null if it isn't found - * @private - */ -LRUCache.prototype.get = function(key) { - if (!this.has(key)) { return null; } - +LRUCache.prototype.get = function (key) { + if (!this.has(key)) { + return null; + } var data = this.data[key]; - delete this.data[key]; this.order.splice(this.order.indexOf(key), 1); - return data; }; - -/** - * Change the max size of the cache. - * - * @param {number} max the max size of the cache - * @returns {LRUCache} this cache - * @private - */ -LRUCache.prototype.setMaxSize = function(max) { +LRUCache.prototype.setMaxSize = function (max) { this.max = max; - while (this.order.length > this.max) { var removedData = this.get(this.order[0]); - if (removedData) this.onRemove(removedData); + if (removedData) + this.onRemove(removedData); } - return this; }; - -},{}],116:[function(require,module,exports){ +},{}],133:[function(require,module,exports){ 'use strict'; - var config = require('./config'); var browser = require('./browser'); - +var URL = require('url'); +var util = require('./util'); function normalizeURL(url, pathPrefix, accessToken) { accessToken = accessToken || config.ACCESS_TOKEN; - if (!accessToken && config.REQUIRE_ACCESS_TOKEN) { - throw new Error('An API access token is required to use Mapbox GL. ' + - 'See https://www.mapbox.com/developers/api/#access-tokens'); + throw new Error('An API access token is required to use Mapbox GL. ' + 'See https://www.mapbox.com/developers/api/#access-tokens'); } - url = url.replace(/^mapbox:\/\//, config.API_URL + pathPrefix); url += url.indexOf('?') !== -1 ? '&access_token=' : '?access_token='; - if (config.REQUIRE_ACCESS_TOKEN) { if (accessToken[0] === 's') { - throw new Error('Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). ' + - 'See https://www.mapbox.com/developers/api/#access-tokens'); + throw new Error('Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). ' + 'See https://www.mapbox.com/developers/api/#access-tokens'); } - url += accessToken; } - return url; } - -module.exports.normalizeStyleURL = function(url, accessToken) { - if (!url.match(/^mapbox:\/\/styles\//)) +module.exports.normalizeStyleURL = function (url, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { return url; - - var split = url.split('/'); - var user = split[3]; - var style = split[4]; - var draft = split[5] ? '/draft' : ''; - return normalizeURL('mapbox://' + user + '/' + style + draft, '/styles/v1/', accessToken); + } else { + return normalizeURL('mapbox:/' + urlObject.pathname + formatQuery(urlObject.query), '/styles/v1/', accessToken); + } }; - -module.exports.normalizeSourceURL = function(url, accessToken) { - if (!url.match(/^mapbox:\/\//)) +module.exports.normalizeSourceURL = function (url, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { return url; - - // TileJSON requests need a secure flag appended to their URLs so - // that the server knows to send SSL-ified resource references. - return normalizeURL(url + '.json', '/v4/', accessToken) + '&secure'; + } else { + return normalizeURL(url + '.json', '/v4/', accessToken) + '&secure'; + } }; - -module.exports.normalizeGlyphsURL = function(url, accessToken) { - if (!url.match(/^mapbox:\/\//)) +module.exports.normalizeGlyphsURL = function (url, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { return url; - - var user = url.split('/')[3]; - return normalizeURL('mapbox://' + user + '/{fontstack}/{range}.pbf', '/fonts/v1/', accessToken); -}; - -module.exports.normalizeSpriteURL = function(url, format, ext, accessToken) { - if (!url.match(/^mapbox:\/\/sprites\//)) - return url + format + ext; - - var split = url.split('/'); - var user = split[3]; - var style = split[4]; - var draft = split[5] ? '/draft' : ''; - return normalizeURL('mapbox://' + user + '/' + style + draft + '/sprite' + format + ext, '/styles/v1/', accessToken); + } else { + var user = urlObject.pathname.split('/')[1]; + return normalizeURL('mapbox://' + user + '/{fontstack}/{range}.pbf' + formatQuery(urlObject.query), '/fonts/v1/', accessToken); + } }; - -module.exports.normalizeTileURL = function(url, sourceUrl, tileSize) { - if (!sourceUrl || !sourceUrl.match(/^mapbox:\/\//)) - return url; - - // The v4 mapbox tile API supports 512x512 image tiles only when @2x - // is appended to the tile URL. If `tileSize: 512` is specified for - // a Mapbox raster source force the @2x suffix even if a non hidpi - // device. - url = url.replace(/([?&]access_token=)tk\.[^&]+/, '$1' + config.ACCESS_TOKEN); - var extension = browser.supportsWebp ? 'webp' : '$1'; - return url.replace(/\.((?:png|jpg)\d*)(?=$|\?)/, browser.devicePixelRatio >= 2 || tileSize === 512 ? '@2x.' + extension : '.' + extension); +module.exports.normalizeSpriteURL = function (url, format, extension, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { + urlObject.pathname += format + extension; + return URL.format(urlObject); + } else { + return normalizeURL('mapbox:/' + urlObject.pathname + '/sprite' + format + extension + formatQuery(urlObject.query), '/styles/v1/', accessToken); + } +}; +module.exports.normalizeTileURL = function (tileURL, sourceURL, tileSize) { + var tileURLObject = URL.parse(tileURL, true); + if (!sourceURL) + return tileURL; + var sourceURLObject = URL.parse(sourceURL); + if (sourceURLObject.protocol !== 'mapbox:') + return tileURL; + var extension = browser.supportsWebp ? '.webp' : '$1'; + var resolution = browser.devicePixelRatio >= 2 || tileSize === 512 ? '@2x' : ''; + return URL.format({ + protocol: tileURLObject.protocol, + hostname: tileURLObject.hostname, + pathname: tileURLObject.pathname.replace(/(\.(?:png|jpg)\d*)/, resolution + extension), + query: replaceTempAccessToken(tileURLObject.query) + }); }; - -},{"./browser":105,"./config":109}],117:[function(require,module,exports){ +function formatQuery(query) { + return query ? '?' + query : ''; +} +function replaceTempAccessToken(query) { + if (query.access_token && query.access_token.slice(0, 3) === 'tk.') { + return util.extend({}, query, { 'access_token': config.ACCESS_TOKEN }); + } else { + return query; + } +} +},{"./browser":120,"./config":125,"./util":136,"url":14}],134:[function(require,module,exports){ 'use strict'; - -// Note: all "sizes" are measured in bytes - -var assert = require('assert'); - module.exports = StructArrayType; - var viewTypes = { 'Int8': Int8Array, 'Uint8': Uint8Array, @@ -28334,126 +27588,56 @@ var viewTypes = { 'Float32': Float32Array, 'Float64': Float64Array }; - -/** - * @typedef StructMember - * @private - * @property {string} name - * @property {string} type - * @property {number} components - */ - var structArrayTypeCache = {}; - -/** - * `StructArrayType` is used to create new `StructArray` types. - * - * `StructArray` provides an abstraction over `ArrayBuffer` and `TypedArray` making it behave like - * an array of typed structs. A StructArray is comprised of elements. Each element has a set of - * members that are defined when the `StructArrayType` is created. - * - * StructArrays useful for creating large arrays that: - * - can be transferred from workers as a Transferable object - * - can be copied cheaply - * - use less memory for lower-precision members - * - can be used as buffers in WebGL. - * - * @class StructArrayType - * @param {Array.} - * @param options - * @param {number} options.alignment Use `4` to align members to 4 byte boundaries. Default is 1. - * - * @example - * - * var PointArrayType = new StructArrayType({ - * members: [ - * { type: 'Int16', name: 'x' }, - * { type: 'Int16', name: 'y' } - * ]}); - * - * var pointArray = new PointArrayType(); - * pointArray.emplaceBack(10, 15); - * pointArray.emplaceBack(20, 35); - * - * point = pointArray.get(0); - * assert(point.x === 10); - * assert(point.y === 15); - * - * @private - */ function StructArrayType(options) { - var key = JSON.stringify(options); if (structArrayTypeCache[key]) { return structArrayTypeCache[key]; } - - if (options.alignment === undefined) options.alignment = 1; - + if (options.alignment === undefined) + options.alignment = 1; function StructType() { Struct.apply(this, arguments); } - StructType.prototype = Object.create(Struct.prototype); - var offset = 0; var maxSize = 0; var usedTypes = ['Uint8']; - - StructType.prototype.members = options.members.map(function(member) { + StructType.prototype.members = options.members.map(function (member) { member = { name: member.name, type: member.type, components: member.components || 1 }; - - assert(member.name.length); - assert(member.type in viewTypes); - - if (usedTypes.indexOf(member.type) < 0) usedTypes.push(member.type); - + if (usedTypes.indexOf(member.type) < 0) + usedTypes.push(member.type); var typeSize = sizeOf(member.type); maxSize = Math.max(maxSize, typeSize); member.offset = offset = align(offset, Math.max(options.alignment, typeSize)); - for (var c = 0; c < member.components; c++) { Object.defineProperty(StructType.prototype, member.name + (member.components === 1 ? '' : c), { get: createGetter(member, c), set: createSetter(member, c) }); } - offset += typeSize * member.components; - return member; }); - StructType.prototype.alignment = options.alignment; StructType.prototype.size = align(offset, Math.max(maxSize, options.alignment)); - function StructArrayType() { StructArray.apply(this, arguments); this.members = StructType.prototype.members; } - StructArrayType.serialize = serializeStructArrayType; - StructArrayType.prototype = Object.create(StructArray.prototype); StructArrayType.prototype.StructType = StructType; StructArrayType.prototype.bytesPerElement = StructType.prototype.size; StructArrayType.prototype.emplaceBack = createEmplaceBack(StructType.prototype.members, StructType.prototype.size); StructArrayType.prototype._usedTypes = usedTypes; - - structArrayTypeCache[key] = StructArrayType; - return StructArrayType; } - -/** - * Serialize the StructArray type. This serializes the *type* not an instance of the type. - * @private - */ function serializeStructArrayType() { return { members: this.prototype.StructType.prototype.members, @@ -28461,42 +27645,26 @@ function serializeStructArrayType() { bytesPerElement: this.prototype.bytesPerElement }; } - - function align(offset, size) { return Math.ceil(offset / size) * size; } - function sizeOf(type) { return viewTypes[type].BYTES_PER_ELEMENT; } - function getArrayViewName(type) { return type.toLowerCase(); } - - -/* - * > I saw major perf gains by shortening the source of these generated methods (i.e. renaming - * > elementIndex to i) (likely due to v8 inlining heuristics). - * - lucaswoj - */ function createEmplaceBack(members, bytesPerElement) { var usedTypeSizes = []; var argNames = []; - var body = '' + - 'var i = this.length;\n' + - 'this.resize(this.length + 1);\n'; - + var body = '' + 'var i = this.length;\n' + 'this.resize(this.length + 1);\n'; for (var m = 0; m < members.length; m++) { var member = members[m]; var size = sizeOf(member.type); - if (usedTypeSizes.indexOf(size) < 0) { usedTypeSizes.push(size); body += 'var o' + size.toFixed(0) + ' = i * ' + (bytesPerElement / size).toFixed(0) + ';\n'; } - for (var c = 0; c < member.components; c++) { var argName = 'v' + argNames.length; var index = 'o' + size.toFixed(0) + ' + ' + (member.offset / size + c).toFixed(0); @@ -28504,34 +27672,21 @@ function createEmplaceBack(members, bytesPerElement) { argNames.push(argName); } } - body += 'return i;'; - return new Function(argNames, body); } - function createMemberComponentString(member, component) { var elementOffset = 'this._pos' + sizeOf(member.type).toFixed(0); var componentOffset = (member.offset / sizeOf(member.type) + component).toFixed(0); var index = elementOffset + ' + ' + componentOffset; return 'this._structArray.' + getArrayViewName(member.type) + '[' + index + ']'; - } - function createGetter(member, c) { return new Function([], 'return ' + createMemberComponentString(member, c) + ';'); } - function createSetter(member, c) { return new Function(['x'], createMemberComponentString(member, c) + ' = x;'); } - -/** - * @class Struct - * @param {StructArray} structArray The StructArray the struct is stored in - * @param {number} index The index of the struct in the StructArray. - * @private - */ function Struct(structArray, index) { this._structArray = structArray; this._pos1 = index * this.size; @@ -28539,269 +27694,120 @@ function Struct(structArray, index) { this._pos4 = this._pos1 / 4; this._pos8 = this._pos1 / 8; } - -/** - * @class StructArray - * The StructArray class is inherited by the custom StructArrayType classes created with - * `new StructArrayType(members, options)`. - * @private - */ function StructArray(serialized) { if (serialized !== undefined) { - // Create from an serialized StructArray this.arrayBuffer = serialized.arrayBuffer; this.length = serialized.length; this.capacity = this.arrayBuffer.byteLength / this.bytesPerElement; this._refreshViews(); - - // Create a new StructArray } else { this.capacity = -1; this.resize(0); } } - -/** - * @property {number} - * @private - * @readonly - */ StructArray.prototype.DEFAULT_CAPACITY = 128; - -/** - * @property {number} - * @private - * @readonly - */ StructArray.prototype.RESIZE_MULTIPLIER = 5; - -/** - * Serialize this StructArray instance - * @private - */ -StructArray.prototype.serialize = function() { +StructArray.prototype.serialize = function () { this.trim(); return { length: this.length, arrayBuffer: this.arrayBuffer }; }; - -/** - * Return the Struct at the given location in the array. - * @private - * @param {number} index The index of the element. - */ -StructArray.prototype.get = function(index) { +StructArray.prototype.get = function (index) { return new this.StructType(this, index); }; - -/** - * Resize the array to discard unused capacity. - * @private - */ -StructArray.prototype.trim = function() { +StructArray.prototype.trim = function () { if (this.length !== this.capacity) { this.capacity = this.length; this.arrayBuffer = this.arrayBuffer.slice(0, this.length * this.bytesPerElement); this._refreshViews(); } }; - -/** - * Resize the array. - * If `n` is greater than the current length then additional elements with undefined values are added. - * If `n` is less than the current length then the array will be reduced to the first `n` elements. - * @param {number} n The new size of the array. - */ -StructArray.prototype.resize = function(n) { +StructArray.prototype.resize = function (n) { this.length = n; if (n > this.capacity) { this.capacity = Math.max(n, Math.floor(this.capacity * this.RESIZE_MULTIPLIER), this.DEFAULT_CAPACITY); this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement); - var oldUint8Array = this.uint8; this._refreshViews(); - if (oldUint8Array) this.uint8.set(oldUint8Array); + if (oldUint8Array) + this.uint8.set(oldUint8Array); } }; - -/** - * Create TypedArray views for the current ArrayBuffer. - * @private - */ -StructArray.prototype._refreshViews = function() { +StructArray.prototype._refreshViews = function () { for (var t = 0; t < this._usedTypes.length; t++) { var type = this._usedTypes[t]; this[getArrayViewName(type)] = new viewTypes[type](this.arrayBuffer); } }; - -},{"assert":6}],118:[function(require,module,exports){ +StructArray.prototype.toArray = function (startIndex, endIndex) { + var array = []; + for (var i = startIndex; i < endIndex; i++) { + var struct = this.get(i); + array.push(struct); + } + return array; +}; +},{}],135:[function(require,module,exports){ 'use strict'; - module.exports = resolveTokens; - -/** - * Replace tokens in a string template with values in an object - * - * @param {Object} properties a key/value relationship between tokens and replacements - * @param {string} text the template string - * @returns {string} the template with tokens replaced - * @private - */ function resolveTokens(properties, text) { - return text.replace(/{([^{}()\[\]<>$=:;.,^]+)}/g, function(match, key) { + return text.replace(/{([^{}]+)}/g, function (match, key) { return key in properties ? properties[key] : ''; }); } - -},{}],119:[function(require,module,exports){ +},{}],136:[function(require,module,exports){ 'use strict'; - var UnitBezier = require('unitbezier'); var Coordinate = require('../geo/coordinate'); - -/** - * Given a value `t` that varies between 0 and 1, return - * an interpolation function that eases between 0 and 1 in a pleasing - * cubic in-out fashion. - * - * @param {number} t input - * @returns {number} input - * @private - */ exports.easeCubicInOut = function (t) { - if (t <= 0) return 0; - if (t >= 1) return 1; - var t2 = t * t, - t3 = t2 * t; + if (t <= 0) + return 0; + if (t >= 1) + return 1; + var t2 = t * t, t3 = t2 * t; return 4 * (t < 0.5 ? t3 : 3 * (t - t2) + t3 - 0.75); }; - -/** - * Given given (x, y), (x1, y1) control points for a bezier curve, - * return a function that interpolates along that curve. - * - * @param {number} p1x control point 1 x coordinate - * @param {number} p1y control point 1 y coordinate - * @param {number} p2x control point 2 x coordinate - * @param {number} p2y control point 2 y coordinate - * @returns {Function} interpolator: receives number value, returns - * number value. - * @private - */ -exports.bezier = function(p1x, p1y, p2x, p2y) { +exports.bezier = function (p1x, p1y, p2x, p2y) { var bezier = new UnitBezier(p1x, p1y, p2x, p2y); - return function(t) { + return function (t) { return bezier.solve(t); }; }; - -/** - * A default bezier-curve powered easing function with - * control points (0.25, 0.1) and (0.25, 1) - * - * @param {number} t - * @returns {number} output - * @private - */ exports.ease = exports.bezier(0.25, 0.1, 0.25, 1); - -/** - * Given a four-element array of numbers that represents a color in - * RGBA, return a version for which the RGB components are multiplied - * by the A (alpha) component - * - * @param {Array} color color array - * @returns {Array} premultiplied color array - * @private - */ -exports.premultiply = function (color) { - if (!color) return null; - var opacity = color[3]; - return [ - color[0] * opacity, - color[1] * opacity, - color[2] * opacity, - opacity - ]; -}; - -/** - * constrain n to the given range via min + max - * - * @param {number} n value - * @param {number} min the minimum value to be returned - * @param {number} max the maximum value to be returned - * @returns {number} the clamped value - * @private - */ exports.clamp = function (n, min, max) { return Math.min(max, Math.max(min, n)); }; - -/* - * constrain n to the given range, excluding the minimum, via modular arithmetic - * @param {number} n value - * @param {number} min the minimum value to be returned, exclusive - * @param {number} max the maximum value to be returned, inclusive - * @returns {number} constrained number - * @private - */ exports.wrap = function (n, min, max) { var d = max - min; var w = ((n - min) % d + d) % d + min; - return (w === min) ? max : w; + return w === min ? max : w; }; - -/* - * return the first non-null and non-undefined argument to this function. - * @returns {*} argument - * @private - */ -exports.coalesce = function() { +exports.coalesce = function () { for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (arg !== null && arg !== undefined) return arg; } }; - -/* - * Call an asynchronous function on an array of arguments, - * calling `callback` with the completed results of all calls. - * - * @param {Array<*>} array input to each call of the async function. - * @param {Function} fn an async function with signature (data, callback) - * @param {Function} callback a callback run after all async work is done. - * called with an array, containing the results of each async call. - * @returns {undefined} - * @private - */ exports.asyncAll = function (array, fn, callback) { - if (!array.length) { return callback(null, []); } + if (!array.length) { + return callback(null, []); + } var remaining = array.length; var results = new Array(array.length); var error = null; array.forEach(function (item, i) { fn(item, function (err, result) { - if (err) error = err; + if (err) + error = err; results[i] = result; - if (--remaining === 0) callback(error, results); + if (--remaining === 0) + callback(error, results); }); }); }; - -/* - * Compute the difference between the keys in one object and the keys - * in another object. - * - * @param {Object} obj - * @param {Object} other - * @returns {Array} keys difference - * @private - */ exports.keysDifference = function (obj, other) { var difference = []; for (var i in obj) { @@ -28811,17 +27817,6 @@ exports.keysDifference = function (obj, other) { } return difference; }; - -/** - * Given a destination object and optionally many source objects, - * copy all properties from the source objects into the destination. - * The last source object given overrides properties from previous - * source objects. - * @param {Object} dest destination object - * @param {...Object} sources sources from which properties are pulled - * @returns {Object} dest - * @private - */ exports.extend = function (dest) { for (var i = 1; i < arguments.length; i++) { var src = arguments[i]; @@ -28831,52 +27826,17 @@ exports.extend = function (dest) { } return dest; }; - -/** - * Extend a destination object with all properties of the src object, - * using defineProperty instead of simple assignment. - * @param {Object} dest - * @param {Object} src - * @returns {Object} dest - * @private - */ exports.extendAll = function (dest, src) { for (var i in src) { Object.defineProperty(dest, i, Object.getOwnPropertyDescriptor(src, i)); } return dest; }; - -/** - * Extend a parent's prototype with all properties in a properties - * object. - * - * @param {Object} parent - * @param {Object} props - * @returns {Object} - * @private - */ exports.inherit = function (parent, props) { - var parentProto = typeof parent === 'function' ? parent.prototype : parent, - proto = Object.create(parentProto); + var parentProto = typeof parent === 'function' ? parent.prototype : parent, proto = Object.create(parentProto); exports.extendAll(proto, props); return proto; }; - -/** - * Given an object and a number of properties as strings, return version - * of that object with only those properties. - * - * @param {Object} src the object - * @param {Array} properties an array of property names chosen - * to appear on the resulting object. - * @returns {Object} object with limited properties. - * @example - * var foo = { name: 'Charlie', age: 10 }; - * var justName = pick(foo, ['name']); - * // justName = { name: 'Charlie' } - * @private - */ exports.pick = function (src, properties) { var result = {}; for (var i = 0; i < properties.length; i++) { @@ -28887,96 +27847,36 @@ exports.pick = function (src, properties) { } return result; }; - var id = 1; - -/** - * Return a unique numeric id, starting at 1 and incrementing with - * each call. - * - * @returns {number} unique numeric id. - * @private - */ exports.uniqueId = function () { return id++; }; - -/** - * Create a version of `fn` that is only called `time` milliseconds - * after its last invocation - * - * @param {Function} fn the function to be debounced - * @param {number} time millseconds after which the function will be invoked - * @returns {Function} debounced function - * @private - */ -exports.debounce = function(fn, time) { +exports.debounce = function (fn, time) { var timer, args; - - return function() { + return function () { args = arguments; clearTimeout(timer); - - timer = setTimeout(function() { + timer = setTimeout(function () { fn.apply(null, args); }, time); }; }; - -/** - * Given an array of member function names as strings, replace all of them - * with bound versions that will always refer to `context` as `this`. This - * is useful for classes where otherwise event bindings would reassign - * `this` to the evented object or some other value: this lets you ensure - * the `this` value always. - * - * @param {Array} fns list of member function names - * @param {*} context the context value - * @returns {undefined} changes functions in-place - * @example - * function MyClass() { - * bindAll(['ontimer'], this); - * this.name = 'Tom'; - * } - * MyClass.prototype.ontimer = function() { - * alert(this.name); - * }; - * var myClass = new MyClass(); - * setTimeout(myClass.ontimer, 100); - * @private - */ -exports.bindAll = function(fns, context) { - fns.forEach(function(fn) { +exports.bindAll = function (fns, context) { + fns.forEach(function (fn) { + if (!context[fn]) { + return; + } context[fn] = context[fn].bind(context); }); }; - -/** - * Given a class, bind all of the methods that look like handlers: that - * begin with _on, and bind them to the class. - * - * @param {Object} context an object with methods - * @private - */ -exports.bindHandlers = function(context) { +exports.bindHandlers = function (context) { for (var i in context) { if (typeof context[i] === 'function' && i.indexOf('_on') === 0) { context[i] = context[i].bind(context); } } }; - -/** - * Set the 'options' property on `obj` with properties - * from the `options` argument. Properties in the `options` - * object will override existing properties. - * - * @param {Object} obj destination object - * @param {Object} options object of override options - * @returns {Object} derived options object. - * @private - */ -exports.setOptions = function(obj, options) { +exports.setOptions = function (obj, options) { if (!obj.hasOwnProperty('options')) { obj.options = obj.options ? Object.create(obj.options) : {}; } @@ -28985,79 +27885,36 @@ exports.setOptions = function(obj, options) { } return obj.options; }; - -/** - * Given a list of coordinates, get their center as a coordinate. - * @param {Array} coords - * @returns {Coordinate} centerpoint - * @private - */ -exports.getCoordinatesCenter = function(coords) { +exports.getCoordinatesCenter = function (coords) { var minX = Infinity; var minY = Infinity; var maxX = -Infinity; var maxY = -Infinity; - for (var i = 0; i < coords.length; i++) { minX = Math.min(minX, coords[i].column); minY = Math.min(minY, coords[i].row); maxX = Math.max(maxX, coords[i].column); maxY = Math.max(maxY, coords[i].row); } - var dx = maxX - minX; var dy = maxY - minY; var dMax = Math.max(dx, dy); - return new Coordinate((minX + maxX) / 2, (minY + maxY) / 2, 0) - .zoomTo(Math.floor(-Math.log(dMax) / Math.LN2)); + return new Coordinate((minX + maxX) / 2, (minY + maxY) / 2, 0).zoomTo(Math.floor(-Math.log(dMax) / Math.LN2)); }; - -/** - * Determine if a string ends with a particular substring - * @param {string} string - * @param {string} suffix - * @returns {boolean} - * @private - */ -exports.endsWith = function(string, suffix) { +exports.endsWith = function (string, suffix) { return string.indexOf(suffix, string.length - suffix.length) !== -1; }; - -/** - * Determine if a string starts with a particular substring - * @param {string} string - * @param {string} prefix - * @returns {boolean} - * @private - */ -exports.startsWith = function(string, prefix) { +exports.startsWith = function (string, prefix) { return string.indexOf(prefix) === 0; }; - -/** - * Create an object by mapping all the values of an existing object while - * preserving their keys. - * @param {Object} input - * @param {Function} iterator - * @returns {Object} - * @private - */ -exports.mapObject = function(input, iterator, context) { +exports.mapObject = function (input, iterator, context) { var output = {}; for (var key in input) { output[key] = iterator.call(context || this, input[key], key, input); } return output; }; - -/** - * Create an object by filtering out values of an existing object - * @param {Object} input - * @param {Function} iterator - * @returns {Object} - * @private - */ -exports.filterObject = function(input, iterator, context) { +exports.filterObject = function (input, iterator, context) { var output = {}; for (var key in input) { if (iterator.call(context || this, input[key], key, input)) { @@ -29066,41 +27923,30 @@ exports.filterObject = function(input, iterator, context) { } return output; }; - -/** - * Deeply compares two object literals. - * @param {Object} obj1 - * @param {Object} obj2 - * @returns {boolean} - * @private - */ exports.deepEqual = function deepEqual(a, b) { if (Array.isArray(a)) { - if (!Array.isArray(b) || a.length !== b.length) return false; + if (!Array.isArray(b) || a.length !== b.length) + return false; for (var i = 0; i < a.length; i++) { - if (!deepEqual(a[i], b[i])) return false; + if (!deepEqual(a[i], b[i])) + return false; } return true; } - if (typeof a === 'object') { - if (!(typeof b === 'object')) return false; + if (typeof a === 'object' && a !== null && b !== null) { + if (!(typeof b === 'object')) + return false; var keys = Object.keys(a); - if (keys.length !== Object.keys(b).length) return false; + if (keys.length !== Object.keys(b).length) + return false; for (var key in a) { - if (!deepEqual(a[key], b[key])) return false; + if (!deepEqual(a[key], b[key])) + return false; } return true; } return a === b; }; - -/** - * Deeply clones two objects. - * @param {Object} obj1 - * @param {Object} obj2 - * @returns {boolean} - * @private - */ exports.clone = function deepEqual(input) { if (Array.isArray(input)) { return input.map(exports.clone); @@ -29110,108 +27956,56 @@ exports.clone = function deepEqual(input) { return input; } }; - -/** - * Check if two arrays have at least one common element. - * @param {Array} a - * @param {Array} b - * @returns {boolean} - * @private - */ -exports.arraysIntersect = function(a, b) { +exports.arraysIntersect = function (a, b) { for (var l = 0; l < a.length; l++) { - if (b.indexOf(a[l]) >= 0) return true; + if (b.indexOf(a[l]) >= 0) + return true; } return false; }; - -},{"../geo/coordinate":25,"unitbezier":182}],120:[function(require,module,exports){ +var warnOnceHistory = {}; +exports.warnOnce = function (message) { + if (!warnOnceHistory[message]) { + if (typeof console !== 'undefined') + console.warn(message); + warnOnceHistory[message] = true; + } +}; +},{"../geo/coordinate":32,"unitbezier":203}],137:[function(require,module,exports){ 'use strict'; - -var VectorTileFeature = require('vector-tile').VectorTileFeature; - module.exports = Feature; - function Feature(vectorTileFeature, z, x, y) { this._vectorTileFeature = vectorTileFeature; vectorTileFeature._z = z; vectorTileFeature._x = x; vectorTileFeature._y = y; - this.properties = vectorTileFeature.properties; - - if (vectorTileFeature._id) { - this.id = vectorTileFeature._id; + if (vectorTileFeature.id != null) { + this.id = vectorTileFeature.id; } } - Feature.prototype = { - type: "Feature", - + type: 'Feature', get geometry() { if (this._geometry === undefined) { - var feature = this._vectorTileFeature; - var coords = projectCoords( - feature.loadGeometry(), - feature.extent, - feature._z, feature._x, feature._y); - - var type = VectorTileFeature.types[feature.type]; - - if (type === 'Point' && coords.length === 1) { - coords = coords[0][0]; - } else if (type === 'Point') { - coords = coords[0]; - type = 'MultiPoint'; - } else if (type === 'LineString' && coords.length === 1) { - coords = coords[0]; - } else if (type === 'LineString') { - type = 'MultiLineString'; - } - - this._geometry = { - type: type, - coordinates: coords - }; - - this._vectorTileFeature = null; + this._geometry = this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x, this._vectorTileFeature._y, this._vectorTileFeature._z).geometry; } return this._geometry; }, - set geometry(g) { this._geometry = g; }, - - toJSON: function() { + toJSON: function () { var json = {}; for (var i in this) { - if (i === '_geometry' || i === '_vectorTileFeature') continue; + if (i === '_geometry' || i === '_vectorTileFeature' || i === 'toJSON') + continue; json[i] = this[i]; } return json; } }; - -function projectCoords(coords, extent, z, x, y) { - var size = extent * Math.pow(2, z), - x0 = extent * x, - y0 = extent * y; - for (var i = 0; i < coords.length; i++) { - var line = coords[i]; - for (var j = 0; j < line.length; j++) { - var p = line[j]; - var y2 = 180 - (p.y + y0) * 360 / size; - line[j] = [ - (p.x + x0) * 360 / size - 180, - 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90 - ]; - } - } - return coords; -} - -},{"vector-tile":183}],121:[function(require,module,exports){ +},{}],138:[function(require,module,exports){ // (c) Dean McNamee , 2012. // // https://github.com/deanm/css-color-parser-js @@ -29413,7 +28207,653 @@ function parseCSSColor(css_str) { try { exports.parseCSSColor = parseCSSColor } catch(e) { } -},{}],122:[function(require,module,exports){ +},{}],139:[function(require,module,exports){ +'use strict'; + +module.exports = earcut; + +function earcut(data, holeIndices, dim) { + + dim = dim || 2; + + var hasHoles = holeIndices && holeIndices.length, + outerLen = hasHoles ? holeIndices[0] * dim : data.length, + outerNode = linkedList(data, 0, outerLen, dim, true), + triangles = []; + + if (!outerNode) return triangles; + + var minX, minY, maxX, maxY, x, y, size; + + if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); + + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (data.length > 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; + + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) minX = x; + if (y < minY) minY = y; + if (x > maxX) maxX = x; + if (y > maxY) maxY = y; + } + + // minX, minY and size are later used to transform coords into integers for z-order calculation + size = Math.max(maxX - minX, maxY - minY); + } + + earcutLinked(outerNode, triangles, dim, minX, minY, size); + + return triangles; +} + +// create a circular doubly linked list from polygon points in the specified winding order +function linkedList(data, start, end, dim, clockwise) { + var i, last; + + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); + } else { + for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); + } + + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } + + return last; +} + +// eliminate colinear or duplicate points +function filterPoints(start, end) { + if (!start) return start; + if (!end) end = start; + + var p = start, + again; + do { + again = false; + + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) return null; + again = true; + + } else { + p = p.next; + } + } while (again || p !== end); + + return end; +} + +// main ear slicing loop which triangulates a polygon (given as a linked list) +function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { + if (!ear) return; + + // interlink polygon nodes in z-order + if (!pass && size) indexCurve(ear, minX, minY, size); + + var stop = ear, + prev, next; + + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; + + if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim); + triangles.push(ear.i / dim); + triangles.push(next.i / dim); + + removeNode(ear); + + // skipping the next vertice leads to less sliver triangles + ear = next.next; + stop = next.next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); + + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(ear, triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, size, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, size); + } + + break; + } + } +} + +// check whether a polygon node forms a valid ear with adjacent nodes +function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // now make sure we don't have other points inside the potential ear + var p = ear.next.next; + + while (p !== ear.prev) { + if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.next; + } + + return true; +} + +function isEarHashed(ear, minX, minY, size) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // triangle bbox; min & max are calculated like this for speed + var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), + minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), + maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), + maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); + + // z-order range for the current triangle bbox; + var minZ = zOrder(minTX, minTY, minX, minY, size), + maxZ = zOrder(maxTX, maxTY, minX, minY, size); + + // first look for points inside the triangle in increasing z-order + var p = ear.nextZ; + + while (p && p.z <= maxZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.nextZ; + } + + // then look for points in decreasing z-order + p = ear.prevZ; + + while (p && p.z >= minZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + } + + return true; +} + +// go through all polygon nodes and cure small local self-intersections +function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; + + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + + triangles.push(a.i / dim); + triangles.push(p.i / dim); + triangles.push(b.i / dim); + + // remove two nodes involved + removeNode(p); + removeNode(p.next); + + p = start = b; + } + p = p.next; + } while (p !== start); + + return p; +} + +// try splitting polygon into two and triangulate them independently +function splitEarcut(start, triangles, dim, minX, minY, size) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); + + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, size); + earcutLinked(c, triangles, dim, minX, minY, size); + return; + } + b = b.next; + } + a = a.next; + } while (a !== start); +} + +// link every hole into the outer loop, producing a single-ring polygon without holes +function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; + + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) list.steiner = true; + queue.push(getLeftmost(list)); + } + + queue.sort(compareX); + + // process holes from left to right + for (i = 0; i < queue.length; i++) { + eliminateHole(queue[i], outerNode); + outerNode = filterPoints(outerNode, outerNode.next); + } + + return outerNode; +} + +function compareX(a, b) { + return a.x - b.x; +} + +// find a bridge between vertices that connects hole with an outer ring and and link it +function eliminateHole(hole, outerNode) { + outerNode = findHoleBridge(hole, outerNode); + if (outerNode) { + var b = splitPolygon(outerNode, hole); + filterPoints(b, b.next); + } +} + +// David Eberly's algorithm for finding a bridge between hole and outer polygon +function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; + + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + if (x === hx) { + if (hy === p.y) return p; + if (hy === p.next.y) return p.next; + } + m = p.x < p.next.x ? p : p.next; + } + } + p = p.next; + } while (p !== outerNode); + + if (!m) return null; + + if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint + + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point + + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; + + p = m.next; + + while (p !== stop) { + if (hx >= p.x && p.x >= mx && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { + + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential + + if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { + m = p; + tanMin = tan; + } + } + + p = p.next; + } + + return m; +} + +// interlink polygon nodes in z-order +function indexCurve(start, minX, minY, size) { + var p = start; + do { + if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); + + p.prevZ.nextZ = null; + p.prevZ = null; + + sortLinked(p); +} + +// Simon Tatham's linked list merge sort algorithm +// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html +function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; + + do { + p = list; + list = null; + tail = null; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) break; + } + + qSize = inSize; + + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize === 0) { + e = q; + q = q.nextZ; + qSize--; + } else if (qSize === 0 || !q) { + e = p; + p = p.nextZ; + pSize--; + } else if (p.z <= q.z) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) tail.nextZ = e; + else list = e; + + e.prevZ = tail; + tail = e; + } + + p = q; + } + + tail.nextZ = null; + inSize *= 2; + + } while (numMerges > 1); + + return list; +} + +// z-order of a point given coords and size of the data bounding box +function zOrder(x, y, minX, minY, size) { + // coords are transformed into non-negative 15-bit integer range + x = 32767 * (x - minX) / size; + y = 32767 * (y - minY) / size; + + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); +} + +// find the leftmost node of a polygon ring +function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x) leftmost = p; + p = p.next; + } while (p !== start); + + return leftmost; +} + +// check if a point lies within a convex triangle +function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && + (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && + (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; +} + +// check if a diagonal between two polygon nodes is valid (lies in polygon interior) +function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && + locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); +} + +// signed area of a triangle +function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); +} + +// check if two points are equal +function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; +} + +// check if two segments intersect +function intersects(p1, q1, p2, q2) { + if ((equals(p1, q1) && equals(p2, q2)) || + (equals(p1, q2) && equals(p2, q1))) return true; + return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && + area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; +} + +// check if a polygon diagonal intersects any polygon segments +function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) return true; + p = p.next; + } while (p !== a); + + return false; +} + +// check if a polygon diagonal is locally inside the polygon +function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; +} + +// check if the middle point of a polygon diagonal is inside the polygon +function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + inside = !inside; + p = p.next; + } while (p !== a); + + return inside; +} + +// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; +// if one belongs to the outer ring and another to a hole, it merges it into a single ring +function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; + + a.next = b; + b.prev = a; + + a2.next = an; + an.prev = a2; + + b2.next = a2; + a2.prev = b2; + + bp.next = b2; + b2.prev = bp; + + return b2; +} + +// create a node and optionally link it with previous one (in a circular doubly linked list) +function insertNode(i, x, y, last) { + var p = new Node(i, x, y); + + if (!last) { + p.prev = p; + p.next = p; + + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; +} + +function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) p.prevZ.nextZ = p.nextZ; + if (p.nextZ) p.nextZ.prevZ = p.prevZ; +} + +function Node(i, x, y) { + // vertice index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertice nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = null; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; +} + +// return a percentage difference between the polygon area and its triangulation area; +// used to verify correctness of triangulation +earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); + } + } + + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } + + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); +}; + +function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; +} + +// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts +earcut.flatten = function (data) { + var dim = data[0][0].length, + result = {vertices: [], holes: [], dimensions: dim}, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); + } + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); + } + } + return result; +}; + +},{}],140:[function(require,module,exports){ 'use strict'; module.exports = createFilter; @@ -29455,7 +28895,9 @@ function compile(filter) { } function compilePropertyReference(property) { - return property === '$type' ? 'f.type' : 'p[' + JSON.stringify(property) + ']'; + return property === '$type' ? 'f.type' : + property === '$id' ? 'f.id' : + 'p[' + JSON.stringify(property) + ']'; } function compileComparisonOp(property, value, op, checkType) { @@ -29495,7 +28937,7 @@ function compare(a, b) { return a < b ? -1 : a > b ? 1 : 0; } -},{}],123:[function(require,module,exports){ +},{}],141:[function(require,module,exports){ var geojsonArea = require('geojson-area'); module.exports = rewind; @@ -29546,7 +28988,7 @@ function cw(_) { return geojsonArea.ring(_) >= 0; } -},{"geojson-area":124}],124:[function(require,module,exports){ +},{"geojson-area":142}],142:[function(require,module,exports){ var wgs84 = require('wgs84'); module.exports.geometry = geometry; @@ -29612,16 +29054,18 @@ function rad(_) { return _ * Math.PI / 180; } -},{"wgs84":125}],125:[function(require,module,exports){ +},{"wgs84":143}],143:[function(require,module,exports){ module.exports.RADIUS = 6378137; module.exports.FLATTENING = 1/298.257223563; module.exports.POLAR_RADIUS = 6356752.3142; -},{}],126:[function(require,module,exports){ +},{}],144:[function(require,module,exports){ 'use strict'; module.exports = clip; +var createFeature = require('./feature'); + /* clip features between two axis-parallel lines: * | | * ___|___ | / @@ -29661,13 +29105,7 @@ function clip(features, scale, k1, k2, axis, intersect, minAll, maxAll) { if (slices.length) { // if a feature got clipped, it will likely get clipped on the next zoom level as well, // so there's no need to recalculate bboxes - clipped.push({ - geometry: slices, - type: type, - tags: features[i].tags || null, - min: feature.min, - max: feature.max - }); + clipped.push(createFeature(feature.tags, type, slices, feature.id)); } } @@ -29698,6 +29136,7 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { points = geometry[i], area = points.area, dist = points.dist, + outer = points.outer, len = points.length, a, j, last; @@ -29713,7 +29152,7 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if ((bk > k2)) { // ---|-----|--> slice.push(intersect(a, b, k1), intersect(a, b, k2)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } else if (bk >= k1) slice.push(intersect(a, b, k1)); // ---|--> | @@ -29721,7 +29160,7 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if ((bk < k1)) { // <--|-----|--- slice.push(intersect(a, b, k2), intersect(a, b, k1)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } else if (bk <= k2) slice.push(intersect(a, b, k2)); // | <--|--- @@ -29731,11 +29170,11 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if (bk < k1) { // <--|--- | slice.push(intersect(a, b, k1)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } else if (bk > k2) { // | ---|--> slice.push(intersect(a, b, k2)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } // | --> | } @@ -29752,30 +29191,32 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if (closed && last && (slice[0][0] !== last[0] || slice[0][1] !== last[1])) slice.push(slice[0]); // add the final slice - newSlice(slices, slice, area, dist); + newSlice(slices, slice, area, dist, outer); } return slices; } -function newSlice(slices, slice, area, dist) { +function newSlice(slices, slice, area, dist, outer) { if (slice.length) { // we don't recalculate the area/length of the unclipped geometry because the case where it goes // below the visibility threshold as a result of clipping is rare, so we avoid doing unnecessary work slice.area = area; slice.dist = dist; + if (outer !== undefined) slice.outer = outer; slices.push(slice); } return []; } -},{}],127:[function(require,module,exports){ +},{"./feature":146}],145:[function(require,module,exports){ 'use strict'; module.exports = convert; var simplify = require('./simplify'); +var createFeature = require('./feature'); // converts GeoJSON feature into an intermediate projected JSON vector format with simplification data @@ -29797,36 +29238,46 @@ function convert(data, tolerance) { } function convertFeature(features, feature, tolerance) { + if (feature.geometry === null) { + // ignore features with null geometry + return; + } + var geom = feature.geometry, type = geom.type, coords = geom.coordinates, tags = feature.properties, - i, j, rings; + id = feature.id, + i, j, rings, projectedRing; if (type === 'Point') { - features.push(create(tags, 1, [projectPoint(coords)])); + features.push(createFeature(tags, 1, [projectPoint(coords)], id)); } else if (type === 'MultiPoint') { - features.push(create(tags, 1, project(coords))); + features.push(createFeature(tags, 1, project(coords), id)); } else if (type === 'LineString') { - features.push(create(tags, 2, [project(coords, tolerance)])); + features.push(createFeature(tags, 2, [project(coords, tolerance)], id)); } else if (type === 'MultiLineString' || type === 'Polygon') { rings = []; for (i = 0; i < coords.length; i++) { - rings.push(project(coords[i], tolerance)); + projectedRing = project(coords[i], tolerance); + if (type === 'Polygon') projectedRing.outer = (i === 0); + rings.push(projectedRing); } - features.push(create(tags, type === 'Polygon' ? 3 : 2, rings)); + features.push(createFeature(tags, type === 'Polygon' ? 3 : 2, rings, id)); } else if (type === 'MultiPolygon') { rings = []; for (i = 0; i < coords.length; i++) { for (j = 0; j < coords[i].length; j++) { - rings.push(project(coords[i][j], tolerance)); + projectedRing = project(coords[i][j], tolerance); + projectedRing.outer = (j === 0); + rings.push(projectedRing); } } - features.push(create(tags, 3, rings)); + features.push(createFeature(tags, 3, rings, id)); } else if (type === 'GeometryCollection') { for (i = 0; i < geom.geometries.length; i++) { @@ -29841,18 +29292,6 @@ function convertFeature(features, feature, tolerance) { } } -function create(tags, type, geometry) { - var feature = { - geometry: geometry, - type: type, - tags: tags || null, - min: [2, 1], // initial bbox values; - max: [-1, 0] // note that coords are usually in [0..1] range - }; - calcBBox(feature); - return feature; -} - function project(lonlats, tolerance) { var projected = []; for (var i = 0; i < lonlats.length; i++) { @@ -29870,7 +29309,7 @@ function projectPoint(p) { x = (p[0] / 360 + 0.5), y = (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI); - y = y < -1 ? -1 : + y = y < 0 ? 0 : y > 1 ? 1 : y; return [x, y, 0]; @@ -29894,14 +29333,37 @@ function calcSize(points) { points.dist = dist; } +},{"./feature":146,"./simplify":148}],146:[function(require,module,exports){ +'use strict'; + +module.exports = createFeature; + +function createFeature(tags, type, geom, id) { + var feature = { + id: id || null, + type: type, + geometry: geom, + tags: tags || null, + min: [Infinity, Infinity], // initial bbox values + max: [-Infinity, -Infinity] + }; + calcBBox(feature); + return feature; +} + // calculate the feature bounding box for faster clipping later function calcBBox(feature) { var geometry = feature.geometry, min = feature.min, max = feature.max; - if (feature.type === 1) calcRingBBox(min, max, geometry); - else for (var i = 0; i < geometry.length; i++) calcRingBBox(min, max, geometry[i]); + if (feature.type === 1) { + calcRingBBox(min, max, geometry); + } else { + for (var i = 0; i < geometry.length; i++) { + calcRingBBox(min, max, geometry[i]); + } + } return feature; } @@ -29916,7 +29378,7 @@ function calcRingBBox(min, max, points) { } } -},{"./simplify":129}],128:[function(require,module,exports){ +},{}],147:[function(require,module,exports){ 'use strict'; module.exports = geojsonvt; @@ -30066,10 +29528,12 @@ GeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) { if (debug > 1) console.timeEnd('clipping'); - if (tl) stack.push(tl, z + 1, x * 2, y * 2); - if (bl) stack.push(bl, z + 1, x * 2, y * 2 + 1); - if (tr) stack.push(tr, z + 1, x * 2 + 1, y * 2); - if (br) stack.push(br, z + 1, x * 2 + 1, y * 2 + 1); + if (features.length) { + stack.push(tl || [], z + 1, x * 2, y * 2); + stack.push(bl || [], z + 1, x * 2, y * 2 + 1); + stack.push(tr || [], z + 1, x * 2 + 1, y * 2); + stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1); + } } return solid; @@ -30158,7 +29622,7 @@ function isClippedSquare(tile, extent, buffer) { return true; } -},{"./clip":126,"./convert":127,"./tile":130,"./transform":131,"./wrap":132}],129:[function(require,module,exports){ +},{"./clip":144,"./convert":145,"./tile":149,"./transform":150,"./wrap":151}],148:[function(require,module,exports){ 'use strict'; module.exports = simplify; @@ -30234,7 +29698,7 @@ function getSqSegDist(p, a, b) { return dx * dx + dy * dy; } -},{}],130:[function(require,module,exports){ +},{}],149:[function(require,module,exports){ 'use strict'; module.exports = createTile; @@ -30308,20 +29772,41 @@ function addFeature(tile, feature, tolerance, noSimplify) { tile.numPoints++; } + if (type === 3) rewind(simplifiedRing, ring.outer); + simplified.push(simplifiedRing); } } if (simplified.length) { - tile.features.push({ + var tileFeature = { geometry: simplified, type: type, tags: feature.tags || null - }); + }; + if (feature.id !== null) { + tileFeature.id = feature.id; + } + tile.features.push(tileFeature); } } -},{}],131:[function(require,module,exports){ +function rewind(ring, clockwise) { + var area = signedArea(ring); + if (area < 0 === clockwise) ring.reverse(); +} + +function signedArea(ring) { + var sum = 0; + for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) { + p1 = ring[i]; + p2 = ring[j]; + sum += (p2[0] - p1[0]) * (p1[1] + p2[1]); + } + return sum; +} + +},{}],150:[function(require,module,exports){ 'use strict'; exports.tile = transformTile; @@ -30364,10 +29849,11 @@ function transformPoint(p, extent, z2, tx, ty) { return [x, y]; } -},{}],132:[function(require,module,exports){ +},{}],151:[function(require,module,exports){ 'use strict'; var clip = require('./clip'); +var createFeature = require('./feature'); module.exports = wrap; @@ -30377,7 +29863,7 @@ function wrap(features, buffer, intersectX) { right = clip(features, 1, 1 - buffer, 2 + buffer, 0, intersectX, -1, 2); // right world copy if (left || right) { - merged = clip(features, 1, -buffer, 1 + buffer, 0, intersectX, -1, 2); // center world copy + merged = clip(features, 1, -buffer, 1 + buffer, 0, intersectX, -1, 2) || []; // center world copy if (left) merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center if (right) merged = merged.concat(shiftFeatureCoords(right, -1)); // merge right into center @@ -30404,13 +29890,7 @@ function shiftFeatureCoords(features, offset) { } } - newFeatures.push({ - geometry: newGeometry, - type: type, - tags: feature.tags, - min: [feature.min[0] + offset, feature.min[1]], - max: [feature.max[0] + offset, feature.max[1]] - }); + newFeatures.push(createFeature(feature.tags, type, newGeometry, feature.id)); } return newFeatures; @@ -30427,7 +29907,7 @@ function shiftCoords(points, offset) { return newPoints; } -},{"./clip":126}],133:[function(require,module,exports){ +},{"./clip":144,"./feature":146}],152:[function(require,module,exports){ /** * @fileoverview gl-matrix - High performance matrix and vector operations * @author Brandon Jones @@ -30465,7 +29945,7 @@ exports.quat = require("./gl-matrix/quat.js"); exports.vec2 = require("./gl-matrix/vec2.js"); exports.vec3 = require("./gl-matrix/vec3.js"); exports.vec4 = require("./gl-matrix/vec4.js"); -},{"./gl-matrix/common.js":134,"./gl-matrix/mat2.js":135,"./gl-matrix/mat2d.js":136,"./gl-matrix/mat3.js":137,"./gl-matrix/mat4.js":138,"./gl-matrix/quat.js":139,"./gl-matrix/vec2.js":140,"./gl-matrix/vec3.js":141,"./gl-matrix/vec4.js":142}],134:[function(require,module,exports){ +},{"./gl-matrix/common.js":153,"./gl-matrix/mat2.js":154,"./gl-matrix/mat2d.js":155,"./gl-matrix/mat3.js":156,"./gl-matrix/mat4.js":157,"./gl-matrix/quat.js":158,"./gl-matrix/vec2.js":159,"./gl-matrix/vec3.js":160,"./gl-matrix/vec4.js":161}],153:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -30537,7 +30017,7 @@ glMatrix.equals = function(a, b) { module.exports = glMatrix; -},{}],135:[function(require,module,exports){ +},{}],154:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -30975,7 +30455,7 @@ mat2.multiplyScalarAndAdd = function(out, a, b, scale) { module.exports = mat2; -},{"./common.js":134}],136:[function(require,module,exports){ +},{"./common.js":153}],155:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -31446,7 +30926,7 @@ mat2d.equals = function (a, b) { module.exports = mat2d; -},{"./common.js":134}],137:[function(require,module,exports){ +},{"./common.js":153}],156:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -32194,7 +31674,7 @@ mat3.equals = function (a, b) { module.exports = mat3; -},{"./common.js":134}],138:[function(require,module,exports){ +},{"./common.js":153}],157:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -34332,7 +33812,7 @@ mat4.equals = function (a, b) { module.exports = mat4; -},{"./common.js":134}],139:[function(require,module,exports){ +},{"./common.js":153}],158:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -34934,7 +34414,7 @@ quat.equals = vec4.equals; module.exports = quat; -},{"./common.js":134,"./mat3.js":137,"./vec3.js":141,"./vec4.js":142}],140:[function(require,module,exports){ +},{"./common.js":153,"./mat3.js":156,"./vec3.js":160,"./vec4.js":161}],159:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -35523,7 +35003,7 @@ vec2.equals = function (a, b) { module.exports = vec2; -},{"./common.js":134}],141:[function(require,module,exports){ +},{"./common.js":153}],160:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -36302,7 +35782,7 @@ vec3.equals = function (a, b) { module.exports = vec3; -},{"./common.js":134}],142:[function(require,module,exports){ +},{"./common.js":153}],161:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -36913,7 +36393,7 @@ vec4.equals = function (a, b) { module.exports = vec4; -},{"./common.js":134}],143:[function(require,module,exports){ +},{"./common.js":153}],162:[function(require,module,exports){ 'use strict'; module.exports = GridIndex; @@ -36987,7 +36467,10 @@ GridIndex.prototype.query = function(x1, y1, x2, y2) { var min = this.min; var max = this.max; if (x1 <= min && y1 <= min && max <= x2 && max <= y2) { - return this.keys.slice(); + // We use `Array#slice` because `this.keys` may be a `Int32Array` and + // some browsers (Safari and IE) do not support `TypedArray#slice` + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice#Browser_compatibility + return Array.prototype.slice.call(this.keys); } else { var result = []; @@ -37072,7 +36555,7 @@ GridIndex.prototype.toArrayBuffer = function() { return array.buffer; }; -},{}],144:[function(require,module,exports){ +},{}],163:[function(require,module,exports){ 'use strict'; function createFunction(parameters, defaultType) { @@ -37239,131 +36722,69 @@ module.exports['piecewise-constant'] = function(parameters) { return createFunction(parameters, 'interval'); }; -},{}],145:[function(require,module,exports){ -'use strict'; - -if (typeof module !== 'undefined' && module.exports) { - module.exports = isSupported; -} else if (window) { - window.mapboxgl = window.mapboxgl || {}; - window.mapboxgl.supported = isSupported; -} - -/** - * Test whether the current browser supports Mapbox GL JS - * @param {Object} options - * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false` - * if the performance of Mapbox GL JS would be dramatically worse than - * expected (i.e. a software renderer is would be used) - * @return {boolean} - */ -function isSupported(options) { - return !!( - isBrowser() && - isArraySupported() && - isFunctionSupported() && - isObjectSupported() && - isJSONSupported() && - isWorkerSupported() && - isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat) - ); -} - -function isBrowser() { - return typeof window !== 'undefined' && typeof document !== 'undefined'; -} - -function isArraySupported() { - return ( - Array.prototype && - Array.prototype.every && - Array.prototype.filter && - Array.prototype.forEach && - Array.prototype.indexOf && - Array.prototype.lastIndexOf && - Array.prototype.map && - Array.prototype.some && - Array.prototype.reduce && - Array.prototype.reduceRight && - Array.isArray - ); -} +},{}],164:[function(require,module,exports){ -function isFunctionSupported() { - return Function.prototype && Function.prototype.bind; -} - -function isObjectSupported() { - return ( - Object.keys && - Object.create && - Object.getPrototypeOf && - Object.getOwnPropertyNames && - Object.isSealed && - Object.isFrozen && - Object.isExtensible && - Object.getOwnPropertyDescriptor && - Object.defineProperty && - Object.defineProperties && - Object.seal && - Object.freeze && - Object.preventExtensions - ); -} - -function isJSONSupported() { - return 'JSON' in window && 'parse' in JSON && 'stringify' in JSON; -} - -function isWorkerSupported() { - return 'Worker' in window; -} - -var isWebGLSupportedCache = {}; -function isWebGLSupportedCached(failIfMajorPerformanceCaveat) { - - if (isWebGLSupportedCache[failIfMajorPerformanceCaveat] === undefined) { - isWebGLSupportedCache[failIfMajorPerformanceCaveat] = isWebGLSupported(failIfMajorPerformanceCaveat); - } - - return isWebGLSupportedCache[failIfMajorPerformanceCaveat]; -} +var path = require('path'); -isSupported.webGLContextAttributes = { - antialias: false, - alpha: true, - stencil: true, - depth: true +// readFileSync calls must be written out long-form for brfs. +module.exports = { + debug: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n" + }, + fill: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n" + }, + circle: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n float t = smoothstep(1.0 - max(blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = color * (1.0 - t) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform bool u_scale_with_map;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main(void) {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize mediump float radius\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n if (u_scale_with_map) {\n gl_Position.xy += extrude;\n } else {\n gl_Position.xy += extrude * gl_Position.w;\n }\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n" + }, + line: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_linewidth;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\nuniform mediump float u_blur;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" + }, + linepattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" + }, + linesdfpattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" + }, + outline: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" + }, + outlinepattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" + }, + pattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n" + }, + raster: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n" + }, + icon: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" + }, + sdf: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" + }, + collisionbox: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n" + } }; -function isWebGLSupported(failIfMajorPerformanceCaveat) { - - var canvas = document.createElement('canvas'); - - var attributes = Object.create(isSupported.webGLContextAttributes); - attributes.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat; +module.exports.util = "float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"; - if (canvas.probablySupportsContext) { - return ( - canvas.probablySupportsContext('webgl', attributes) || - canvas.probablySupportsContext('experimental-webgl', attributes) - ); - - } else if (canvas.supportsContext) { - return ( - canvas.supportsContext('webgl', attributes) || - canvas.supportsContext('experimental-webgl', attributes) - ); - - } else { - return ( - canvas.getContext('webgl', attributes) || - canvas.getContext('experimental-webgl', attributes) - ); - } -} - -},{}],146:[function(require,module,exports){ +},{"path":8}],165:[function(require,module,exports){ 'use strict'; var format = require('util').format; @@ -37381,7 +36802,7 @@ function ValidationError(key, value /*, message, ...*/) { module.exports = ValidationError; -},{"util":12}],147:[function(require,module,exports){ +},{"util":17}],166:[function(require,module,exports){ 'use strict'; module.exports = function (output) { @@ -37394,7 +36815,7 @@ module.exports = function (output) { return output; }; -},{}],148:[function(require,module,exports){ +},{}],167:[function(require,module,exports){ 'use strict'; module.exports = function getType(val) { @@ -37413,7 +36834,7 @@ module.exports = function getType(val) { } }; -},{}],149:[function(require,module,exports){ +},{}],168:[function(require,module,exports){ 'use strict'; // Turn jsonlint-lines-primitives objects into primitive objects @@ -37425,7 +36846,7 @@ module.exports = function unbundle(value) { } }; -},{}],150:[function(require,module,exports){ +},{}],169:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -37492,7 +36913,7 @@ module.exports = function validate(options) { } }; -},{"../error/validation_error":146,"../util/extend":147,"../util/get_type":148,"./validate_array":151,"./validate_boolean":152,"./validate_color":153,"./validate_constants":154,"./validate_enum":155,"./validate_filter":156,"./validate_function":157,"./validate_layer":159,"./validate_number":161,"./validate_object":162,"./validate_source":164,"./validate_string":165}],151:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/extend":166,"../util/get_type":167,"./validate_array":170,"./validate_boolean":171,"./validate_color":172,"./validate_constants":173,"./validate_enum":174,"./validate_filter":175,"./validate_function":176,"./validate_layer":178,"./validate_number":180,"./validate_object":181,"./validate_source":183,"./validate_string":184}],170:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -37546,7 +36967,7 @@ module.exports = function validateArray(options) { return errors; }; -},{"../error/validation_error":146,"../util/get_type":148,"./validate":150}],152:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/get_type":167,"./validate":169}],171:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -37564,7 +36985,7 @@ module.exports = function validateBoolean(options) { return []; }; -},{"../error/validation_error":146,"../util/get_type":148}],153:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/get_type":167}],172:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -37587,7 +37008,7 @@ module.exports = function validateColor(options) { return []; }; -},{"../error/validation_error":146,"../util/get_type":148,"csscolorparser":121}],154:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/get_type":167,"csscolorparser":138}],173:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -37621,7 +37042,7 @@ module.exports = function validateConstants(options) { }; -},{"../error/validation_error":146,"../util/get_type":148}],155:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/get_type":167}],174:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -37639,7 +37060,7 @@ module.exports = function validateEnum(options) { return errors; }; -},{"../error/validation_error":146,"../util/unbundle_jsonlint":149}],156:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/unbundle_jsonlint":168}],175:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -37744,7 +37165,7 @@ module.exports = function validateFilter(options) { return errors; }; -},{"../error/validation_error":146,"../util/get_type":148,"../util/unbundle_jsonlint":149,"./validate_enum":155}],157:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/get_type":167,"../util/unbundle_jsonlint":168,"./validate_enum":174}],176:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -37755,12 +37176,13 @@ var validateArray = require('./validate_array'); var validateNumber = require('./validate_number'); module.exports = function validateFunction(options) { - var originalValueSpec = options.valueSpec; - var originalValue = options.value; - + var functionValueSpec = options.valueSpec; var stopKeyType; - return validateObject({ + var isPropertyFunction = options.value.property !== undefined || stopKeyType === 'object'; + var isZoomFunction = options.value.property === undefined || stopKeyType === 'object'; + + var errors = validateObject({ key: options.key, value: options.value, valueSpec: options.styleSpec.function, @@ -37769,6 +37191,16 @@ module.exports = function validateFunction(options) { objectElementValidators: { stops: validateFunctionStops } }); + if (options.styleSpec.$version >= 8) { + if (isPropertyFunction && !options.valueSpec['property-function']) { + errors.push(new ValidationError(options.key, options.value, 'property functions not supported')); + } else if (isZoomFunction && !options.valueSpec['zoom-function']) { + errors.push(new ValidationError(options.key, options.value, 'zoom functions not supported')); + } + } + + return errors; + function validateFunctionStops(options) { var errors = []; var value = options.value; @@ -37824,7 +37256,6 @@ module.exports = function validateFunction(options) { objectElementValidators: { zoom: validateNumber, value: validateValue } })); } else { - var isZoomFunction = !originalValue.property; errors = errors.concat((isZoomFunction ? validateNumber : validateValue)({ key: key + '[0]', value: value[0], @@ -37837,13 +37268,13 @@ module.exports = function validateFunction(options) { errors = errors.concat(validate({ key: key + '[1]', value: value[1], - valueSpec: originalValueSpec, + valueSpec: functionValueSpec, style: options.style, styleSpec: options.styleSpec })); if (getType(value[0]) === 'number') { - if (originalValueSpec.function === 'piecewise-constant' && value[0] % 1 !== 0) { + if (functionValueSpec.function === 'piecewise-constant' && value[0] % 1 !== 0) { errors.push(new ValidationError(key + '[0]', value[0], 'zoom level for piecewise-constant functions must be an integer')); } @@ -37868,7 +37299,7 @@ module.exports = function validateFunction(options) { }; -},{"../error/validation_error":146,"../util/get_type":148,"./validate":150,"./validate_array":151,"./validate_number":161,"./validate_object":162}],158:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/get_type":167,"./validate":169,"./validate_array":170,"./validate_number":180,"./validate_object":181}],177:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -37892,7 +37323,7 @@ module.exports = function(options) { return errors; }; -},{"../error/validation_error":146,"./validate_string":165}],159:[function(require,module,exports){ +},{"../error/validation_error":165,"./validate_string":184}],178:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -37950,7 +37381,7 @@ module.exports = function validateLayer(options) { if (!layer.source) { errors.push(new ValidationError(key, layer, 'missing required property "source"')); } else { - var source = style.sources[layer.source]; + var source = style.sources && style.sources[layer.source]; if (!source) { errors.push(new ValidationError(key, layer.source, 'source "%s" not found', layer.source)); } else if (source.type == 'vector' && type == 'raster') { @@ -38005,7 +37436,7 @@ module.exports = function validateLayer(options) { return errors; }; -},{"../error/validation_error":146,"../util/extend":147,"../util/unbundle_jsonlint":149,"./validate_filter":156,"./validate_layout_property":160,"./validate_object":162,"./validate_paint_property":163}],160:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/extend":166,"../util/unbundle_jsonlint":168,"./validate_filter":175,"./validate_layout_property":179,"./validate_object":181,"./validate_paint_property":182}],179:[function(require,module,exports){ 'use strict'; var validate = require('./validate'); @@ -38044,7 +37475,7 @@ module.exports = function validateLayoutProperty(options) { }; -},{"../error/validation_error":146,"./validate":150}],161:[function(require,module,exports){ +},{"../error/validation_error":165,"./validate":169}],180:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -38071,7 +37502,7 @@ module.exports = function validateNumber(options) { return []; }; -},{"../error/validation_error":146,"../util/get_type":148}],162:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/get_type":167}],181:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -38124,7 +37555,7 @@ module.exports = function validateObject(options) { return errors; }; -},{"../error/validation_error":146,"../util/get_type":148,"./validate":150}],163:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/get_type":167,"./validate":169}],182:[function(require,module,exports){ 'use strict'; var validate = require('./validate'); @@ -38164,7 +37595,7 @@ module.exports = function validatePaintProperty(options) { }; -},{"../error/validation_error":146,"./validate":150}],164:[function(require,module,exports){ +},{"../error/validation_error":165,"./validate":169}],183:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -38241,7 +37672,7 @@ module.exports = function validateSource(options) { } }; -},{"../error/validation_error":146,"../util/unbundle_jsonlint":149,"./validate_enum":155,"./validate_object":162}],165:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/unbundle_jsonlint":168,"./validate_enum":174,"./validate_object":181}],184:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -38259,7 +37690,7 @@ module.exports = function validateString(options) { return []; }; -},{"../error/validation_error":146,"../util/get_type":148}],166:[function(require,module,exports){ +},{"../error/validation_error":165,"../util/get_type":167}],185:[function(require,module,exports){ 'use strict'; var validateConstants = require('./validate/validate_constants'); @@ -38329,13 +37760,13 @@ function wrapCleanErrors(inner) { module.exports = validateStyleMin; -},{"../reference/latest.min":168,"./validate/validate":150,"./validate/validate_constants":154,"./validate/validate_filter":156,"./validate/validate_glyphs_url":158,"./validate/validate_layer":159,"./validate/validate_layout_property":160,"./validate/validate_paint_property":163,"./validate/validate_source":164}],167:[function(require,module,exports){ +},{"../reference/latest.min":187,"./validate/validate":169,"./validate/validate_constants":173,"./validate/validate_filter":175,"./validate/validate_glyphs_url":177,"./validate/validate_layer":178,"./validate/validate_layout_property":179,"./validate/validate_paint_property":182,"./validate/validate_source":183}],186:[function(require,module,exports){ module.exports = require('./v8.json'); -},{"./v8.json":169}],168:[function(require,module,exports){ +},{"./v8.json":188}],187:[function(require,module,exports){ module.exports = require('./v8.min.json'); -},{"./v8.min.json":170}],169:[function(require,module,exports){ +},{"./v8.min.json":189}],188:[function(require,module,exports){ module.exports={ "$version": 8, "$root": { @@ -38343,7 +37774,7 @@ module.exports={ "required": true, "type": "enum", "values": [8], - "doc": "Stylesheet version number. Must be 8.", + "doc": "Style specification version number. Must be 8.", "example": 8 }, "name": { @@ -38658,155 +38089,279 @@ module.exports={ "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_fill": { "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_circle": { "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_line": { "line-cap": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "butt", "round", "square" ], "default": "butt", - "doc": "The display of line endings." + "doc": "The display of line endings.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-join": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "bevel", "round", "miter" ], "default": "miter", - "doc": "The display of lines when joining." + "doc": "The display of lines when joining.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-miter-limit": { "type": "number", "default": 2, "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Used to automatically convert miter joins to bevel joins for sharp angles.", "requires": [ { "line-join": "miter" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-round-limit": { "type": "number", "default": 1.05, "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Used to automatically convert round joins to miter joins for shallow angles.", "requires": [ { "line-join": "round" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_symbol": { "symbol-placement": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "point", "line" ], "default": "point", - "doc": "Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons." + "doc": "Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "symbol-spacing": { "type": "number", "default": 250, "minimum": 1, "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "pixels", "doc": "Distance between two symbol anchors.", "requires": [ { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "symbol-avoid-edges": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, - "doc": "If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer." + "doc": "If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-allow-overlap": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, the icon will be visible even if it collides with other previously drawn symbols.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-ignore-placement": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, other symbols can be visible even if they collide with the icon.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-optional": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.", "requires": [ "icon-image", "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-rotation-alignment": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -38815,49 +38370,141 @@ module.exports={ "doc": "Orientation of icon when map is rotated.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-size": { "type": "number", "default": 1, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Scale factor for icon. 1 is original size, 3 triples the size.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } + }, + "icon-text-fit": { + "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": false, + "values": [ + "none", + "both", + "width", + "height" + ], + "default": "none", + "doc": "Position and scale an icon by the its corresponding text.", + "requires": [ + "icon-image", + "text-field" + ], + "sdk-support": { + "basic": { + } + } + }, + "icon-text-fit-padding": { + "type": "array", + "value": "number", + "length": 4, + "default": [ + 0, + 0, + 0, + 0 + ], + "units": "pixels", + "function": "interpolated", + "zoom-function": true, + "property-function": true, + "doc": "Size of padding area around the text-fit size in clockwise order: top, right, bottom, left.", + "requires": [ + "icon-image", + "icon-text-fit", + "text-field" + ], + "sdk-support": { + "basic": { + } + } }, "icon-image": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "doc": "A string with {tokens} replaced, referencing the data property to pull from.", - "tokens": true + "tokens": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-rotate": { "type": "number", "default": 0, "period": 360, "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "degrees", "doc": "Rotates the icon clockwise.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-padding": { "type": "number", "default": 2, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "pixels", "doc": "Size of the additional area around the icon bounding box used for detecting symbol collisions.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-keep-upright": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, the icon may be flipped to prevent it from being rendered upside-down.", "requires": [ @@ -38868,7 +38515,14 @@ module.exports={ { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-offset": { "type": "array", @@ -38879,14 +38533,43 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } + }, + "text-pitch-alignment": { + "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, + "values": [ + "map", + "viewport" + ], + "doc": "Aligns text to the plane of the `viewport` or the `map` when the map is pitched. Matches `text-rotation-alignment` if unspecified.", + "requires": [ + "text-field" + ], + "sdk-support": { + "basic": { + } + } }, "text-rotation-alignment": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -38895,24 +38578,49 @@ module.exports={ "doc": "Orientation of text when map is rotated.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-field": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": "", "tokens": true, - "doc": "Value to use for a text label. Feature properties are specified using tokens like {field_name}." + "doc": "Value to use for a text label. Feature properties are specified using tokens like {field_name}.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-font": { "type": "array", "value": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": ["Open Sans Regular", "Arial Unicode MS Regular"], "doc": "Font stack to use for displaying text.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-size": { "type": "number", @@ -38920,10 +38628,19 @@ module.exports={ "minimum": 0, "units": "pixels", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Font size.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-max-width": { "type": "number", @@ -38931,34 +38648,63 @@ module.exports={ "minimum": 0, "units": "em", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "The maximum line width for text wrapping.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-line-height": { "type": "number", "default": 1.2, "units": "em", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Text leading value for multi-line text.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-letter-spacing": { "type": "number", "default": 0, "units": "em", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Text tracking amount.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-justify": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "left", "center", @@ -38968,11 +38714,20 @@ module.exports={ "doc": "Text justification options.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "center", "left", @@ -38988,20 +38743,36 @@ module.exports={ "doc": "Part of the text placed closest to the anchor.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-max-angle": { "type": "number", "default": 45, "units": "degrees", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Maximum angle change between adjacent characters.", "requires": [ "text-field", { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-rotate": { "type": "number", @@ -39009,10 +38780,19 @@ module.exports={ "period": 360, "units": "degrees", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Rotates the text clockwise.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-padding": { "type": "number", @@ -39020,14 +38800,25 @@ module.exports={ "minimum": 0, "units": "pixels", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Size of the additional area around the text bounding box used for detecting symbol collisions.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-keep-upright": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": true, "doc": "If true, the text may be flipped vertically to prevent it from being rendered upside-down.", "requires": [ @@ -39038,11 +38829,20 @@ module.exports={ { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-transform": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "none", "uppercase", @@ -39052,7 +38852,14 @@ module.exports={ "doc": "Specifies how to capitalize text, similar to the CSS `text-transform` property.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-offset": { "type": "array", @@ -39060,6 +38867,8 @@ module.exports={ "value": "number", "units": "ems", "function": "interpolated", + "zoom-function": true, + "property-function": true, "length": 2, "default": [ 0, @@ -39067,57 +38876,107 @@ module.exports={ ], "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-allow-overlap": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, the text will be visible even if it collides with other previously drawn symbols.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-ignore-placement": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, other symbols can be visible even if they collide with the text.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-optional": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.", "requires": [ "text-field", "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_raster": { "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "filter": { @@ -39216,34 +39075,66 @@ module.exports={ "fill-antialias": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": true, - "doc": "Whether or not the fill should be antialiased." + "doc": "Whether or not the fill should be antialiased.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-opacity": { "type": "number", "function": "interpolated", + "zoom-function": true, + "property-function": true, "default": 1, "minimum": 0, "maximum": 1, - "doc": "The opacity given to the fill color.", - "transition": true + "doc": "The opacity of the entire fill layer. In contrast to the fill-color, this value will also affect the 1px stroke around the fill, if the stroke is used.", + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-color": { "type": "color", "default": "#000000", - "doc": "The color of the fill.", + "doc": "The color of the filled part of this layer. This color can be specified as rgba with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { "!": "fill-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.19.0" + } + } }, "fill-outline-color": { "type": "color", "doc": "The outline color of the fill. Matches the value of `fill-color` if unspecified.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { @@ -39252,7 +39143,17 @@ module.exports={ { "fill-antialias": true } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.19.0" + } + } }, "fill-translate": { "type": "array", @@ -39263,13 +39164,24 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively." + "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -39278,13 +39190,29 @@ module.exports={ "default": "map", "requires": [ "fill-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-pattern": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "transition": true, - "doc": "Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)." + "doc": "Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_line": { @@ -39292,22 +39220,40 @@ module.exports={ "type": "number", "doc": "The opacity at which the line will be drawn.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "default": 1, "minimum": 0, "maximum": 1, - "transition": true + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-color": { "type": "color", "doc": "The color with which the line will be drawn.", "default": "#000000", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { "!": "line-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-translate": { "type": "array", @@ -39318,13 +39264,24 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively." + "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -39333,16 +39290,32 @@ module.exports={ "default": "map", "requires": [ "line-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-width": { "type": "number", "default": 1, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "Stroke thickness." + "doc": "Stroke thickness.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-gap-width": { "type": "number", @@ -39350,30 +39323,59 @@ module.exports={ "minimum": 0, "doc": "Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, - "units": "pixels" + "units": "pixels", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-offset": { "type": "number", "default": 0, "doc": "The line's offset perpendicular to its direction. Values may be positive or negative, where positive indicates \"rightwards\" (if you were moving in the direction of the line) and negative indicates \"leftwards.\"", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, - "units": "pixels" + "units": "pixels", + "sdk-support": { + "basic": { + "js": "0.12.1", + "ios": "3.1.0", + "android": "3.0.0" + } + } }, "line-blur": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "Blur applied to the line, in pixels." + "doc": "Blur applied to the line, in pixels.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-dasharray": { "type": "array", "value": "number", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "doc": "Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.", "minimum": 0, "transition": true, @@ -39382,13 +39384,29 @@ module.exports={ { "!": "line-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-pattern": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "transition": true, - "doc": "Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512)." + "doc": "Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_circle": { @@ -39397,23 +39415,59 @@ module.exports={ "default": 5, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "Circle radius." + "doc": "Circle radius.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.18.0" + } + } }, "circle-color": { "type": "color", "default": "#000000", "doc": "The color of the circle.", "function": "interpolated", - "transition": true + "zoom-function": true, + "property-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.18.0" + } + } }, "circle-blur": { "type": "number", "default": 0, "doc": "Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.", "function": "interpolated", - "transition": true + "zoom-function": true, + "property-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.20.0" + } + } }, "circle-opacity": { "type": "number", @@ -39422,7 +39476,19 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "property-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.20.0" + } + } }, "circle-translate": { "type": "array", @@ -39430,13 +39496,24 @@ module.exports={ "length": 2, "default": [0, 0], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively." + "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "circle-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -39445,7 +39522,30 @@ module.exports={ "default": "map", "requires": [ "circle-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } + }, + "circle-pitch-scale": { + "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, + "values": [ + "map", + "viewport" + ], + "default": "map", + "doc": "Controls the scaling behavior of the circle when the map is pitched. The value `map` scales circles according to their apparent distance to the camera. The value `viewport` results in no pitch-related scaling.", + "sdk-support": { + "basic": { + } + } } }, "paint_symbol": { @@ -39456,54 +39556,99 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-color": { "type": "color", "default": "#000000", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the icon. This can only be used with sdf icons.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-halo-color": { "type": "color", "default": "rgba(0, 0, 0, 0)", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the icon's halo. Icon halos can only be used with sdf icons.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-halo-width": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance of halo to the icon outline.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-halo-blur": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Fade out the halo towards the outside.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-translate": { "type": "array", @@ -39514,16 +39659,27 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -39533,7 +39689,14 @@ module.exports={ "requires": [ "icon-image", "icon-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-opacity": { "type": "number", @@ -39542,54 +39705,99 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-color": { "type": "color", "doc": "The color with which the text will be drawn.", "default": "#000000", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-halo-color": { "type": "color", "default": "rgba(0, 0, 0, 0)", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the text's halo, which helps it stand out from backgrounds.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-halo-width": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-halo-blur": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "The halo's fadeout distance towards the outside.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-translate": { "type": "array", @@ -39600,16 +39808,27 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -39619,7 +39838,14 @@ module.exports={ "requires": [ "text-field", "text-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_raster": { @@ -39630,34 +39856,66 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-hue-rotate": { "type": "number", "default": 0, "period": 360, "function": "interpolated", + "zoom-function": true, "transition": true, "units": "degrees", - "doc": "Rotates hues around the color wheel." + "doc": "Rotates hues around the color wheel.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-brightness-min": { "type": "number", "function": "interpolated", + "zoom-function": true, "doc": "Increase or reduce the brightness of the image. The value is the minimum brightness.", "default": 0, "minimum": 0, "maximum": 1, - "transition": true + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-brightness-max": { "type": "number", "function": "interpolated", + "zoom-function": true, "doc": "Increase or reduce the brightness of the image. The value is the maximum brightness.", "default": 1, "minimum": 0, "maximum": 1, - "transition": true + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-saturation": { "type": "number", @@ -39666,7 +39924,15 @@ module.exports={ "minimum": -1, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-contrast": { "type": "number", @@ -39675,16 +39941,32 @@ module.exports={ "minimum": -1, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-fade-duration": { "type": "number", "default": 300, "minimum": 0, "function": "interpolated", + "zoom-function": true, "transition": true, "units": "milliseconds", - "doc": "Fade duration when a new tile is added." + "doc": "Fade duration when a new tile is added.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_background": { @@ -39693,18 +39975,34 @@ module.exports={ "default": "#000000", "doc": "The color with which the background will be drawn.", "function": "interpolated", + "zoom-function": true, "transition": true, "requires": [ { "!": "background-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "background-pattern": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, "transition": true, - "doc": "Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)." + "doc": "Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "background-opacity": { "type": "number", @@ -39713,7 +40011,15 @@ module.exports={ "maximum": 1, "doc": "The opacity at which the background will be drawn.", "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "transition": { @@ -39734,9 +40040,140 @@ module.exports={ } } -},{}],170:[function(require,module,exports){ -module.exports={"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"type":"enum","values":["vector","raster"]},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":["geojson"]},"data":{"type":"*"},"maxzoom":{"type":"number","default":14},"buffer":{"type":"number","default":64},"tolerance":{"type":"number","default":3},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":400},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":["video"]},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":["image"]},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":["fill","line","symbol","circle","raster","background"]},"metadata":{"type":"*"},"ref":{"type":"string"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":22},"maxzoom":{"type":"number","minimum":0,"maximum":22},"interactive":{"type":"boolean","default":false},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"paint.*":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],"layout_background":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","values":["butt","round","square"],"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","values":["bevel","round","miter"],"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","requires":[{"line-join":"round"}]},"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","values":["point","line"],"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"viewport","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","requires":["icon-image"]},"icon-image":{"type":"string","function":"piecewise-constant","tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","requires":["icon-image"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"viewport","requires":["text-field"]},"text-field":{"type":"string","function":"piecewise-constant","default":"","tokens":true},"text-font":{"type":"array","value":"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"]},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","function":"interpolated","requires":["text-field"]},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"em","function":"interpolated","requires":["text-field"]},"text-line-height":{"type":"number","default":1.2,"units":"em","function":"interpolated","requires":["text-field"]},"text-letter-spacing":{"type":"number","default":0,"units":"em","function":"interpolated","requires":["text-field"]},"text-justify":{"type":"enum","function":"piecewise-constant","values":["left","center","right"],"default":"center","requires":["text-field"]},"text-anchor":{"type":"enum","function":"piecewise-constant","values":["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center","requires":["text-field"]},"text-max-angle":{"type":"number","default":45,"units":"degrees","function":"interpolated","requires":["text-field",{"symbol-placement":"line"}]},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","function":"interpolated","requires":["text-field"]},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","function":"interpolated","requires":["text-field"]},"text-keep-upright":{"type":"boolean","function":"piecewise-constant","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{"type":"enum","function":"piecewise-constant","values":["none","uppercase","lowercase"],"default":"none","requires":["text-field"]},"text-offset":{"type":"array","value":"number","units":"ems","function":"interpolated","length":2,"default":[0,0],"requires":["text-field"]},"text-allow-overlap":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["text-field"]},"text-ignore-placement":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["text-field"]},"text-optional":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["text-field","icon-image"]},"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_raster":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"filter":{"type":"array","value":"*"},"filter_operator":{"type":"enum","values":["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},"geometry_type":{"type":"enum","values":["Point","LineString","Polygon"]},"color_operation":{"type":"enum","values":["lighten","saturate","spin","fade","mix"]},"function":{"stops":{"type":"array","required":true,"value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":["exponential","interval","categorical"],"default":"exponential"}},"function_stop":{"type":"array","minimum":0,"maximum":22,"value":["number","color"],"length":2},"paint":["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],"paint_fill":{"fill-antialias":{"type":"boolean","function":"piecewise-constant","default":true},"fill-opacity":{"type":"number","function":"interpolated","default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","transition":true}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["circle-translate"]}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["text-field","text-translate"]}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} -},{}],171:[function(require,module,exports){ +},{}],189:[function(require,module,exports){ +module.exports={"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"type":"enum","values":["vector","raster"]},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":["geojson"]},"data":{"type":"*"},"maxzoom":{"type":"number","default":14},"buffer":{"type":"number","default":64},"tolerance":{"type":"number","default":3},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":400},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":["video"]},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":["image"]},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":["fill","line","symbol","circle","raster","background"]},"metadata":{"type":"*"},"ref":{"type":"string"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":22},"maxzoom":{"type":"number","minimum":0,"maximum":22},"interactive":{"type":"boolean","default":false},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"paint.*":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],"layout_background":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["butt","round","square"],"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["bevel","round","miter"],"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"round"}]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["point","line"],"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"viewport","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"icon-text-fit":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":false,"values":["none","both","width","height"],"default":"none","requires":["icon-image","text-field"]},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image","icon-text-fit","text-field"]},"icon-image":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"property-function":true,"units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"text-pitch-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"requires":["text-field"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"viewport","requires":["text-field"]},"text-field":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":"","tokens":true},"text-font":{"type":"array","value":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"]},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-line-height":{"type":"number","default":1.2,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-letter-spacing":{"type":"number","default":0,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-justify":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["left","center","right"],"default":"center","requires":["text-field"]},"text-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center","requires":["text-field"]},"text-max-angle":{"type":"number","default":45,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field",{"symbol-placement":"line"}]},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["none","uppercase","lowercase"],"default":"none","requires":["text-field"]},"text-offset":{"type":"array","value":"number","units":"ems","function":"interpolated","zoom-function":true,"property-function":true,"length":2,"default":[0,0],"requires":["text-field"]},"text-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field","icon-image"]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_raster":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"filter":{"type":"array","value":"*"},"filter_operator":{"type":"enum","values":["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},"geometry_type":{"type":"enum","values":["Point","LineString","Polygon"]},"color_operation":{"type":"enum","values":["lighten","saturate","spin","fade","mix"]},"function":{"stops":{"type":"array","required":true,"value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":["exponential","interval","categorical"],"default":"exponential"}},"function_stop":{"type":"array","minimum":0,"maximum":22,"value":["number","color"],"length":2},"paint":["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],"paint_fill":{"fill-antialias":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":true},"fill-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","zoom-function":true,"property-function":true,"minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["circle-translate"]},"circle-pitch-scale":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["text-field","text-translate"]}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","zoom-function":true,"default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","zoom-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","zoom-function":true,"transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} +},{}],190:[function(require,module,exports){ +'use strict'; + +if (typeof module !== 'undefined' && module.exports) { + module.exports = isSupported; +} else if (window) { + window.mapboxgl = window.mapboxgl || {}; + window.mapboxgl.supported = isSupported; +} + +/** + * Test whether the current browser supports Mapbox GL JS + * @param {Object} options + * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false` + * if the performance of Mapbox GL JS would be dramatically worse than + * expected (i.e. a software renderer is would be used) + * @return {boolean} + */ +function isSupported(options) { + return !!( + isBrowser() && + isArraySupported() && + isFunctionSupported() && + isObjectSupported() && + isJSONSupported() && + isWorkerSupported() && + isUint8ClampedArraySupported() && + isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat) + ); +} + +function isBrowser() { + return typeof window !== 'undefined' && typeof document !== 'undefined'; +} + +function isArraySupported() { + return ( + Array.prototype && + Array.prototype.every && + Array.prototype.filter && + Array.prototype.forEach && + Array.prototype.indexOf && + Array.prototype.lastIndexOf && + Array.prototype.map && + Array.prototype.some && + Array.prototype.reduce && + Array.prototype.reduceRight && + Array.isArray + ); +} + +function isFunctionSupported() { + return Function.prototype && Function.prototype.bind; +} + +function isObjectSupported() { + return ( + Object.keys && + Object.create && + Object.getPrototypeOf && + Object.getOwnPropertyNames && + Object.isSealed && + Object.isFrozen && + Object.isExtensible && + Object.getOwnPropertyDescriptor && + Object.defineProperty && + Object.defineProperties && + Object.seal && + Object.freeze && + Object.preventExtensions + ); +} + +function isJSONSupported() { + return 'JSON' in window && 'parse' in JSON && 'stringify' in JSON; +} + +function isWorkerSupported() { + return 'Worker' in window; +} + +// IE11 only supports `Uint8ClampedArray` as of version +// [KB2929437](https://support.microsoft.com/en-us/kb/2929437) +function isUint8ClampedArraySupported() { + return 'Uint8ClampedArray' in window; +} + +var isWebGLSupportedCache = {}; +function isWebGLSupportedCached(failIfMajorPerformanceCaveat) { + + if (isWebGLSupportedCache[failIfMajorPerformanceCaveat] === undefined) { + isWebGLSupportedCache[failIfMajorPerformanceCaveat] = isWebGLSupported(failIfMajorPerformanceCaveat); + } + + return isWebGLSupportedCache[failIfMajorPerformanceCaveat]; +} + +isSupported.webGLContextAttributes = { + antialias: false, + alpha: true, + stencil: true, + depth: true +}; + +function isWebGLSupported(failIfMajorPerformanceCaveat) { + + var canvas = document.createElement('canvas'); + + var attributes = Object.create(isSupported.webGLContextAttributes); + attributes.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat; + + if (canvas.probablySupportsContext) { + return ( + canvas.probablySupportsContext('webgl', attributes) || + canvas.probablySupportsContext('experimental-webgl', attributes) + ); + + } else if (canvas.supportsContext) { + return ( + canvas.supportsContext('webgl', attributes) || + canvas.supportsContext('experimental-webgl', attributes) + ); + + } else { + return ( + canvas.getContext('webgl', attributes) || + canvas.getContext('experimental-webgl', attributes) + ); + } +} + +},{}],191:[function(require,module,exports){ 'use strict'; // lightweight Buffer shim for pbf browser build @@ -39897,7 +40334,7 @@ function encodeString(str) { return bytes; } -},{"ieee754":173}],172:[function(require,module,exports){ +},{"ieee754":193}],192:[function(require,module,exports){ (function (global){ 'use strict'; @@ -40323,7 +40760,7 @@ function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pb function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./buffer":171}],173:[function(require,module,exports){ +},{"./buffer":191}],193:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 @@ -40409,7 +40846,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],174:[function(require,module,exports){ +},{}],194:[function(require,module,exports){ 'use strict'; module.exports = Point; @@ -40542,7 +40979,69 @@ Point.convert = function (a) { return a; }; -},{}],175:[function(require,module,exports){ +},{}],195:[function(require,module,exports){ +'use strict'; + +module.exports = partialSort; + +// Floyd-Rivest selection algorithm: +// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right]; +// The k-th element will have the (k - left + 1)th smallest value in [left, right] + +function partialSort(arr, k, left, right, compare) { + left = left || 0; + right = right || (arr.length - 1); + compare = compare || defaultCompare; + + while (right > left) { + if (right - left > 600) { + var n = right - left + 1; + var m = k - left + 1; + var z = Math.log(n); + var s = 0.5 * Math.exp(2 * z / 3); + var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); + var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); + var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); + partialSort(arr, k, newLeft, newRight, compare); + } + + var t = arr[k]; + var i = left; + var j = right; + + swap(arr, left, k); + if (compare(arr[right], t) > 0) swap(arr, left, right); + + while (i < j) { + swap(arr, i, j); + i++; + j--; + while (compare(arr[i], t) < 0) i++; + while (compare(arr[j], t) > 0) j--; + } + + if (compare(arr[left], t) === 0) swap(arr, left, j); + else { + j++; + swap(arr, j, right); + } + + if (j <= k) left = j + 1; + if (k <= j) right = j - 1; + } +} + +function swap(arr, i, j) { + var tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; +} + +function defaultCompare(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +} + +},{}],196:[function(require,module,exports){ // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) @@ -40591,11 +41090,12 @@ void (function(root, factory) { })); -},{}],176:[function(require,module,exports){ -'use strict'; - -module.exports = ShelfPack; - +},{}],197:[function(require,module,exports){ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.ShelfPack = factory()); +}(this, function () { /** * Create a new ShelfPack bin allocator. @@ -40661,6 +41161,23 @@ ShelfPack.prototype.pack = function(bins, options) { } } + // Shrink the width/height of the sprite to the bare minimum. + // Since shelf-pack doubles first width, then height when running out of shelf space + // this can result in fairly large unused space both in width and height if that happens + // towards the end of bin packing. + if (this.shelves.length > 0) { + var w2 = 0; + var h2 = 0; + + for (var j = 0; j < this.shelves.length; j++) { + var shelf = this.shelves[j]; + h2 += shelf.h; + w2 = Math.max(shelf.w - shelf.free, w2); + } + + this.resize(w2, h2); + } + return results; }; @@ -40754,7 +41271,6 @@ ShelfPack.prototype.clear = function() { /** * Resize the sprite. - * The resize will fail if the requested dimensions are smaller than the current sprite dimensions. * * @param {number} w Requested new sprite width * @param {number} h Requested new sprite height @@ -40763,10 +41279,6 @@ ShelfPack.prototype.clear = function() { * sprite.resize(256, 256); */ ShelfPack.prototype.resize = function(w, h) { - if (w < this.w || h < this.h) { - return false; - } - this.w = w; this.h = h; for (var i = 0; i < this.shelves.length; i++) { @@ -40817,7 +41329,6 @@ Shelf.prototype.alloc = function(w, h) { /** * Resize the shelf. - * The resize will fail if the requested width is smaller than the current shelf width. * * @private * @param {number} w Requested new width of the shelf @@ -40826,15 +41337,15 @@ Shelf.prototype.alloc = function(w, h) { * shelf.resize(512); */ Shelf.prototype.resize = function(w) { - if (w < this.w) { - return false; - } this.free += (w - this.w); this.w = w; return true; }; -},{}],177:[function(require,module,exports){ +return ShelfPack; + +})); +},{}],198:[function(require,module,exports){ 'use strict'; var kdbush = require('kdbush'); @@ -41049,7 +41560,7 @@ function getY(p) { return p.y; } -},{"kdbush":178}],178:[function(require,module,exports){ +},{"kdbush":199}],199:[function(require,module,exports){ 'use strict'; var sort = require('./sort'); @@ -41095,7 +41606,7 @@ KDBush.prototype = { function defaultGetX(p) { return p[0]; } function defaultGetY(p) { return p[1]; } -},{"./range":179,"./sort":180,"./within":181}],179:[function(require,module,exports){ +},{"./range":200,"./sort":201,"./within":202}],200:[function(require,module,exports){ 'use strict'; module.exports = range; @@ -41143,7 +41654,7 @@ function range(ids, coords, minX, minY, maxX, maxY, nodeSize) { return result; } -},{}],180:[function(require,module,exports){ +},{}],201:[function(require,module,exports){ 'use strict'; module.exports = sortKD; @@ -41211,7 +41722,7 @@ function swap(arr, i, j) { arr[j] = tmp; } -},{}],181:[function(require,module,exports){ +},{}],202:[function(require,module,exports){ 'use strict'; module.exports = within; @@ -41263,7 +41774,7 @@ function sqDist(ax, ay, bx, by) { return dx * dx + dy * dy; } -},{}],182:[function(require,module,exports){ +},{}],203:[function(require,module,exports){ /* * Copyright (C) 2008 Apple Inc. All Rights Reserved. * @@ -41370,12 +41881,12 @@ UnitBezier.prototype.solve = function(x, epsilon) { return this.sampleCurveY(this.solveCurveX(x, epsilon)); }; -},{}],183:[function(require,module,exports){ +},{}],204:[function(require,module,exports){ module.exports.VectorTile = require('./lib/vectortile.js'); module.exports.VectorTileFeature = require('./lib/vectortilefeature.js'); module.exports.VectorTileLayer = require('./lib/vectortilelayer.js'); -},{"./lib/vectortile.js":184,"./lib/vectortilefeature.js":185,"./lib/vectortilelayer.js":186}],184:[function(require,module,exports){ +},{"./lib/vectortile.js":205,"./lib/vectortilefeature.js":206,"./lib/vectortilelayer.js":207}],205:[function(require,module,exports){ 'use strict'; var VectorTileLayer = require('./vectortilelayer'); @@ -41394,7 +41905,7 @@ function readTile(tag, layers, pbf) { } -},{"./vectortilelayer":186}],185:[function(require,module,exports){ +},{"./vectortilelayer":207}],206:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -41417,7 +41928,7 @@ function VectorTileFeature(pbf, end, extent, keys, values) { } function readFeature(tag, feature, pbf) { - if (tag == 1) feature._id = pbf.readVarint(); + if (tag == 1) feature.id = pbf.readVarint(); else if (tag == 2) readTag(pbf, feature); else if (tag == 3) feature.type = pbf.readVarint(); else if (tag == 4) feature._geometry = pbf.pos; @@ -41582,8 +42093,8 @@ VectorTileFeature.prototype.toGeoJSON = function(x, y, z) { properties: this.properties }; - if ('_id' in this) { - result.id = this._id; + if ('id' in this) { + result.id = this.id; } return result; @@ -41629,7 +42140,7 @@ function signedArea(ring) { return sum; } -},{"point-geometry":174}],186:[function(require,module,exports){ +},{"point-geometry":194}],207:[function(require,module,exports){ 'use strict'; var VectorTileFeature = require('./vectortilefeature.js'); @@ -41692,7 +42203,7 @@ VectorTileLayer.prototype.feature = function(i) { return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values); }; -},{"./vectortilefeature.js":185}],187:[function(require,module,exports){ +},{"./vectortilefeature.js":206}],208:[function(require,module,exports){ var Pbf = require('pbf') var vtpb = require('./vector-tile-pb') var GeoJSONWrapper = require('./lib/geojson_wrapper') @@ -41832,22 +42343,23 @@ function wrapValue (value) { } else if (type === 'boolean') { result = { bool_value: value } } else if (type === 'number') { - if (value !== (value | 0)) { - result = { float_value: value } + if (value % 1 !== 0) { + result = { double_value: value } } else if (value < 0) { result = { sint_value: value } } else { result = { uint_value: value } } } else { - result = { string_value: '' + value } + value = JSON.stringify(value) + result = { string_value: value } } result.key = type + ':' + value return result } -},{"./lib/geojson_wrapper":188,"./vector-tile-pb":189,"pbf":172}],188:[function(require,module,exports){ +},{"./lib/geojson_wrapper":209,"./vector-tile-pb":210,"pbf":192}],209:[function(require,module,exports){ 'use strict' var Point = require('point-geometry') @@ -41866,6 +42378,7 @@ GeoJSONWrapper.prototype.feature = function (i) { } function FeatureWrapper (feature) { + this.id = typeof feature.id === 'number' ? feature.id : undefined this.type = feature.type this.rawGeometry = feature.type === 1 ? [feature.geometry] : feature.geometry this.properties = feature.tags @@ -41914,7 +42427,7 @@ FeatureWrapper.prototype.bbox = function () { FeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON -},{"point-geometry":174,"vector-tile":183}],189:[function(require,module,exports){ +},{"point-geometry":194,"vector-tile":204}],210:[function(require,module,exports){ 'use strict'; // tile ======================================== @@ -42020,7 +42533,7 @@ function writeLayer(layer, pbf) { if (layer.extent !== undefined) pbf.writeVarintField(5, layer.extent); } -},{}],190:[function(require,module,exports){ +},{}],211:[function(require,module,exports){ var bundleFn = arguments[3]; var sources = arguments[4]; var cache = arguments[5]; @@ -42085,13 +42598,412 @@ module.exports = function (fn, options) { if (options && options.bare) { return blob; } var workerUrl = URL.createObjectURL(blob); var worker = new Worker(workerUrl); - if (typeof URL.revokeObjectURL == "function") { - URL.revokeObjectURL(workerUrl); - } + worker.objectURL = workerUrl; return worker; }; -},{}],191:[function(require,module,exports){ +},{}],212:[function(require,module,exports){ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.WhooTS = global.WhooTS || {}))); +}(this, function (exports) { + +/** + * getURL + * + * @param {String} baseUrl Base url of the WMS server + * @param {String} layer Layer name + * @param {Number} x Tile coordinate x + * @param {Number} y Tile coordinate y + * @param {Number} z Tile zoom + * @param {Object} [options] + * @param {String} [options.format='image/png'] + * @param {String} [options.service='WMS'] + * @param {String} [options.version='1.1.1'] + * @param {String} [options.request='GetMap'] + * @param {String} [options.srs='EPSG:3857'] + * @param {Number} [options.width='256'] + * @param {Number} [options.height='256'] + * @returns {String} url + * @example + * var baseUrl = 'http://geodata.state.nj.us/imagerywms/Natural2015'; + * var layer = 'Natural2015'; + * var url = whoots.getURL(baseUrl, layer, 154308, 197167, 19); + */ +function getURL(baseUrl, layer, x, y, z, options) { + options = options || {}; + + var url = baseUrl + '?' + [ + 'bbox=' + getTileBBox(x, y, z), + 'format=' + (options.format || 'image/png'), + 'service=' + (options.service || 'WMS'), + 'version=' + (options.version || '1.1.1'), + 'request=' + (options.request || 'GetMap'), + 'srs=' + (options.srs || 'EPSG:3857'), + 'width=' + (options.width || 256), + 'height=' + (options.height || 256), + 'layers=' + layer + ].join('&'); + + return url; +} + + +/** + * getTileBBox + * + * @param {Number} x Tile coordinate x + * @param {Number} y Tile coordinate y + * @param {Number} z Tile zoom + * @returns {String} String of the bounding box + */ +function getTileBBox(x, y, z) { + // for Google/OSM tile scheme we need to alter the y + y = (Math.pow(2, z) - y - 1); + + var min = getMercCoords(x * 256, y * 256, z), + max = getMercCoords((x + 1) * 256, (y + 1) * 256, z); + + return min[0] + ',' + min[1] + ',' + max[0] + ',' + max[1]; +} + + +/** + * getMercCoords + * + * @param {Number} x Pixel coordinate x + * @param {Number} y Pixel coordinate y + * @param {Number} z Tile zoom + * @returns {Array} [x, y] + */ +function getMercCoords(x, y, z) { + var resolution = (2 * Math.PI * 6378137 / 256) / Math.pow(2, z), + merc_x = (x * resolution - 2 * Math.PI * 6378137 / 2.0), + merc_y = (y * resolution - 2 * Math.PI * 6378137 / 2.0); + + return [merc_x, merc_y]; +} + +exports.getURL = getURL; +exports.getTileBBox = getTileBBox; +exports.getMercCoords = getMercCoords; + +Object.defineProperty(exports, '__esModule', { value: true }); + +})); +},{}],213:[function(require,module,exports){ +module.exports={ + "name": "mapbox-gl", + "description": "A WebGL interactive maps library", + "version": "0.22.0", + "main": "js/mapbox-gl.js", + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "git://github.com/mapbox/mapbox-gl-js.git" + }, + "engines": { + "node": ">=4.0.0" + }, + "dependencies": { + "csscolorparser": "^1.0.2", + "earcut": "^2.0.3", + "feature-filter": "^2.2.0", + "geojson-rewind": "^0.1.0", + "geojson-vt": "^2.4.0", + "gl-matrix": "^2.3.1", + "grid-index": "^1.0.0", + "mapbox-gl-function": "^1.2.1", + "mapbox-gl-shaders": "github:mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747", + "mapbox-gl-style-spec": "github:mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae", + "mapbox-gl-supported": "^1.2.0", + "pbf": "^1.3.2", + "pngjs": "^2.2.0", + "point-geometry": "^0.0.0", + "quickselect": "^1.0.0", + "request": "^2.39.0", + "resolve-url": "^0.2.1", + "shelf-pack": "^1.0.0", + "supercluster": "^2.0.1", + "unassertify": "^2.0.0", + "unitbezier": "^0.0.0", + "vector-tile": "^1.3.0", + "vt-pbf": "^2.0.2", + "webworkify": "^1.3.0", + "whoots-js": "^2.0.0" + }, + "devDependencies": { + "async": "^2.0.1", + "babel-preset-react": "^6.11.1", + "babelify": "^7.3.0", + "benchmark": "~2.1.0", + "browserify": "^13.0.0", + "browserify-middleware": "^7.0.0", + "clipboard": "^1.5.12", + "concat-stream": "1.5.1", + "coveralls": "^2.11.8", + "doctrine": "^1.2.1", + "documentation": "https://github.com/documentationjs/documentation/archive/bb41619c734e59ef3fbc3648610032efcfdaaace.tar.gz", + "documentation-theme-utils": "3.0.0", + "envify": "^3.4.0", + "eslint": "^2.5.3", + "eslint-config-mourner": "^2.0.0", + "eslint-plugin-html": "^1.5.1", + "express": "^4.13.4", + "gl": "^4.0.1", + "handlebars": "4.0.5", + "highlight.js": "9.3.0", + "istanbul": "^0.4.2", + "json-loader": "^0.5.4", + "lodash": "^4.13.1", + "mapbox-gl-test-suite": "github:mapbox/mapbox-gl-test-suite#1619d84e76ff3434becd51237720d370c7405ee5", + "memory-fs": "^0.3.0", + "minifyify": "^7.0.1", + "nyc": "6.4.0", + "proxyquire": "^1.7.9", + "react": "^15.3.0", + "react-dom": "^15.3.0", + "remark": "4.2.2", + "remark-html": "3.0.0", + "sinon": "^1.15.4", + "st": "^1.0.0", + "tap": "^5.7.0", + "through": "^2.3.7", + "transform-loader": "^0.2.3", + "unist-util-visit": "1.1.0", + "vinyl": "1.1.1", + "vinyl-fs": "2.4.3", + "watchify": "^3.2.2", + "webpack": "^1.13.1", + "webworkify-webpack": "^1.1.3" + }, + "browserify": { + "transform": [ + "unassertify" + ] + }, + "browser": { + "./js/util/ajax.js": "./js/util/browser/ajax.js", + "./js/util/browser.js": "./js/util/browser/browser.js", + "./js/util/canvas.js": "./js/util/browser/canvas.js", + "./js/util/dom.js": "./js/util/browser/dom.js", + "./js/util/web_worker.js": "./js/util/browser/web_worker.js" + }, + "scripts": { + "build-dev": "browserify js/mapbox-gl.js --debug --ignore-transform unassertify --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js", + "build-docs": "documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/", + "build-min": "browserify js/mapbox-gl.js --debug --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js", + "//": "The 'build' script is invoked by publisher when publishing docs on the mb-pages branch", + "build": "npm run build-docs", + "lint": "eslint js test bench server.js docs/_posts/examples/*.html", + "open-changed-examples": "git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open", + "start-docs": "npm run build-min && npm run build-docs && jekyll serve -w", + "start": "node server.js", + "test-suite": "node test/render.test.js && node test/query.test.js", + "test": "npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js" + }, + "gitHead": "98461d3e2db6369cbcb66d70595e3032558fba9d", + "bugs": { + "url": "https://github.com/mapbox/mapbox-gl-js/issues" + }, + "homepage": "https://github.com/mapbox/mapbox-gl-js#readme", + "_id": "mapbox-gl@0.22.0", + "_shasum": "7fb1d70984dc7d8671abcd09ef6ab5fb98c0a310", + "_from": "mapbox-gl@latest", + "_npmVersion": "2.15.5", + "_nodeVersion": "4.4.5", + "_npmUser": { + "name": "lucaswoj", + "email": "lucas@lucaswoj.com" + }, + "dist": { + "shasum": "7fb1d70984dc7d8671abcd09ef6ab5fb98c0a310", + "tarball": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.0.tgz" + }, + "maintainers": [ + { + "name": "aaronlidman", + "email": "aaronlidman@gmail.com" + }, + { + "name": "ajashton", + "email": "aj.ashton@gmail.com" + }, + { + "name": "ansis", + "email": "ansis.brammanis@gmail.com" + }, + { + "name": "bergwerkgis", + "email": "wb@bergwerk-gis.at" + }, + { + "name": "bhousel", + "email": "bryan@mapbox.com" + }, + { + "name": "bsudekum", + "email": "bobby@mapbox.com" + }, + { + "name": "camilleanne", + "email": "camille@mapbox.com" + }, + { + "name": "dnomadb", + "email": "damon@mapbox.com" + }, + { + "name": "dthompson", + "email": "dthompson@gmail.com" + }, + { + "name": "emilymcafee", + "email": "emily@mapbox.com" + }, + { + "name": "flippmoke", + "email": "flippmoke@gmail.com" + }, + { + "name": "freenerd", + "email": "spam@freenerd.de" + }, + { + "name": "gretacb", + "email": "carol@mapbox.com" + }, + { + "name": "ian29", + "email": "ian.villeda@gmail.com" + }, + { + "name": "ianshward", + "email": "ian@mapbox.com" + }, + { + "name": "ingalls", + "email": "nicholas.ingalls@gmail.com" + }, + { + "name": "jfirebaugh", + "email": "john.firebaugh@gmail.com" + }, + { + "name": "jrpruit1", + "email": "jake@jakepruitt.com" + }, + { + "name": "karenzshea", + "email": "karen@mapbox.com" + }, + { + "name": "kkaefer", + "email": "kkaefer@gmail.com" + }, + { + "name": "lbud", + "email": "lauren@mapbox.com" + }, + { + "name": "lucaswoj", + "email": "lucas@lucaswoj.com" + }, + { + "name": "lxbarth", + "email": "alex@mapbox.com" + }, + { + "name": "lyzidiamond", + "email": "lyzi@mapbox.com" + }, + { + "name": "mapbox-admin", + "email": "accounts@mapbox.com" + }, + { + "name": "mateov", + "email": "matt@mapbox.com" + }, + { + "name": "mcwhittemore", + "email": "mcwhittemore@gmail.com" + }, + { + "name": "miccolis", + "email": "jeff@miccolis.net" + }, + { + "name": "mikemorris", + "email": "michael.patrick.morris@gmail.com" + }, + { + "name": "morganherlocker", + "email": "morgan.herlocker@gmail.com" + }, + { + "name": "mourner", + "email": "agafonkin@gmail.com" + }, + { + "name": "nickidlugash", + "email": "nicki@mapbox.com" + }, + { + "name": "rclark", + "email": "ryan.clark.j@gmail.com" + }, + { + "name": "samanbb", + "email": "saman@mapbox.com" + }, + { + "name": "sbma44", + "email": "tlee@mapbox.com" + }, + { + "name": "scothis", + "email": "scothis@gmail.com" + }, + { + "name": "sgillies", + "email": "sean@mapbox.com" + }, + { + "name": "springmeyer", + "email": "dane@mapbox.com" + }, + { + "name": "themarex", + "email": "patrick@mapbox.com" + }, + { + "name": "tmcw", + "email": "tom@macwright.org" + }, + { + "name": "tristen", + "email": "tristen.brown@gmail.com" + }, + { + "name": "willwhite", + "email": "will@mapbox.com" + }, + { + "name": "yhahn", + "email": "young@mapbox.com" + } + ], + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/mapbox-gl-0.22.0.tgz_1471021366539_0.7491761057171971" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.0.tgz" +} + +},{}],214:[function(require,module,exports){ // TinyColor v1.3.0 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -43259,7 +44171,7 @@ else { })(); -},{}],192:[function(require,module,exports){ +},{}],215:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43321,7 +44233,7 @@ module.exports = [ } ]; -},{}],193:[function(require,module,exports){ +},{}],216:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43514,7 +44426,7 @@ module.exports = { } }; -},{"../../lib/extend":272,"../../plots/cartesian/constants":299,"../../plots/font_attributes":312,"./arrow_paths":192}],194:[function(require,module,exports){ +},{"../../lib/extend":295,"../../plots/cartesian/constants":322,"../../plots/font_attributes":335,"./arrow_paths":215}],217:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44523,7 +45435,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":273,"../../lib/setcursor":282,"../../lib/svg_text_utils":284,"../../plotly":291,"../../plots/cartesian/axes":294,"../color":196,"../dragelement":217,"../drawing":219,"./arrow_paths":192,"./attributes":193,"d3":13,"fast-isnumeric":15}],195:[function(require,module,exports){ +},{"../../lib":296,"../../lib/setcursor":305,"../../lib/svg_text_utils":307,"../../plotly":314,"../../plots/cartesian/axes":317,"../color":219,"../dragelement":240,"../drawing":242,"./arrow_paths":215,"./attributes":216,"d3":18,"fast-isnumeric":20}],218:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44563,7 +45475,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],196:[function(require,module,exports){ +},{}],219:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44717,7 +45629,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":195,"fast-isnumeric":15,"tinycolor2":191}],197:[function(require,module,exports){ +},{"./attributes":218,"fast-isnumeric":20,"tinycolor2":214}],220:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44872,7 +45784,7 @@ module.exports = { } }; -},{"../../lib/extend":272,"../../plots/cartesian/layout_attributes":303,"../../plots/font_attributes":312}],198:[function(require,module,exports){ +},{"../../lib/extend":295,"../../plots/cartesian/layout_attributes":326,"../../plots/font_attributes":335}],221:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44939,7 +45851,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":273,"../../plots/cartesian/tick_label_defaults":309,"../../plots/cartesian/tick_mark_defaults":310,"../../plots/cartesian/tick_value_defaults":311,"./attributes":197}],199:[function(require,module,exports){ +},{"../../lib":296,"../../plots/cartesian/tick_label_defaults":332,"../../plots/cartesian/tick_mark_defaults":333,"../../plots/cartesian/tick_value_defaults":334,"./attributes":220}],222:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45569,7 +46481,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":273,"../../lib/extend":272,"../../lib/setcursor":282,"../../plotly":291,"../../plots/cartesian/axes":294,"../../plots/cartesian/axis_defaults":295,"../../plots/cartesian/layout_attributes":303,"../../plots/cartesian/position_defaults":306,"../../plots/plots":321,"../color":196,"../dragelement":217,"../drawing":219,"../titles":259,"./attributes":197,"d3":13,"tinycolor2":191}],200:[function(require,module,exports){ +},{"../../lib":296,"../../lib/extend":295,"../../lib/setcursor":305,"../../plotly":314,"../../plots/cartesian/axes":317,"../../plots/cartesian/axis_defaults":318,"../../plots/cartesian/layout_attributes":326,"../../plots/cartesian/position_defaults":329,"../../plots/plots":344,"../color":219,"../dragelement":240,"../drawing":242,"../titles":282,"./attributes":220,"d3":18,"tinycolor2":214}],223:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45588,7 +46500,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":273}],201:[function(require,module,exports){ +},{"../../lib":296}],224:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45609,7 +46521,7 @@ exports.draw = require('./draw'); exports.hasColorbar = require('./has_colorbar'); -},{"./attributes":197,"./defaults":198,"./draw":199,"./has_colorbar":200}],202:[function(require,module,exports){ +},{"./attributes":220,"./defaults":221,"./draw":222,"./has_colorbar":223}],225:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45664,7 +46576,7 @@ module.exports = { } }; -},{}],203:[function(require,module,exports){ +},{}],226:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45730,7 +46642,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":273,"./flip_scale":207,"./scales":214}],204:[function(require,module,exports){ +},{"../../lib":296,"./flip_scale":230,"./scales":237}],227:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45774,7 +46686,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":272,"./attributes":202,"./scales.js":214}],205:[function(require,module,exports){ +},{"../../lib/extend":295,"./attributes":225,"./scales.js":237}],228:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45790,7 +46702,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":214}],206:[function(require,module,exports){ +},{"./scales":237}],229:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45854,7 +46766,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":273,"../colorbar/defaults":198,"../colorbar/has_colorbar":200,"./flip_scale":207,"./is_valid_scale":211,"fast-isnumeric":15}],207:[function(require,module,exports){ +},{"../../lib":296,"../colorbar/defaults":221,"../colorbar/has_colorbar":223,"./flip_scale":230,"./is_valid_scale":234,"fast-isnumeric":20}],230:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45879,7 +46791,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],208:[function(require,module,exports){ +},{}],231:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45919,7 +46831,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":205,"./is_valid_scale_array":212,"./scales":214}],209:[function(require,module,exports){ +},{"./default_scale":228,"./is_valid_scale_array":235,"./scales":237}],232:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45965,7 +46877,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":273,"./is_valid_scale":211,"fast-isnumeric":15}],210:[function(require,module,exports){ +},{"../../lib":296,"./is_valid_scale":234,"fast-isnumeric":20}],233:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45997,7 +46909,7 @@ exports.flipScale = require('./flip_scale'); exports.makeScaleFunction = require('./make_scale_function'); -},{"./attributes":202,"./calc":203,"./default_scale":205,"./defaults":206,"./flip_scale":207,"./get_scale":208,"./has_colorscale":209,"./is_valid_scale":211,"./make_scale_function":213,"./scales":214}],211:[function(require,module,exports){ +},{"./attributes":225,"./calc":226,"./default_scale":228,"./defaults":229,"./flip_scale":230,"./get_scale":231,"./has_colorscale":232,"./is_valid_scale":234,"./make_scale_function":236,"./scales":237}],234:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46018,7 +46930,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":212,"./scales":214}],212:[function(require,module,exports){ +},{"./is_valid_scale_array":235,"./scales":237}],235:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46055,7 +46967,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":191}],213:[function(require,module,exports){ +},{"tinycolor2":214}],236:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46104,7 +47016,7 @@ module.exports = function makeScaleFunction(scl, cmin, cmax) { }; }; -},{"../../lib":273,"../color":196,"d3":13,"fast-isnumeric":15,"tinycolor2":191}],214:[function(require,module,exports){ +},{"../../lib":296,"../color":219,"d3":18,"fast-isnumeric":20,"tinycolor2":214}],237:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46235,7 +47147,7 @@ module.exports = { ] }; -},{}],215:[function(require,module,exports){ +},{}],238:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46268,7 +47180,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],216:[function(require,module,exports){ +},{}],239:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46306,7 +47218,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":273}],217:[function(require,module,exports){ +},{"../../lib":296}],240:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46491,7 +47403,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":273,"../../plotly":291,"../../plots/cartesian/constants":299,"./align":215,"./cursor":216,"./unhover":218}],218:[function(require,module,exports){ +},{"../../lib":296,"../../plotly":314,"../../plots/cartesian/constants":322,"./align":238,"./cursor":239,"./unhover":241}],241:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46542,7 +47454,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":271}],219:[function(require,module,exports){ +},{"../../lib/events":294}],242:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47106,7 +48018,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":266,"../../lib":273,"../../lib/svg_text_utils":284,"../../plots/plots":321,"../../traces/scatter/make_bubble_size_func":351,"../../traces/scatter/subtypes":356,"../color":196,"../colorscale":210,"./symbol_defs":220,"d3":13,"fast-isnumeric":15}],220:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":289,"../../lib":296,"../../lib/svg_text_utils":307,"../../plots/plots":344,"../../traces/scatter/make_bubble_size_func":374,"../../traces/scatter/subtypes":379,"../color":219,"../colorscale":233,"./symbol_defs":243,"d3":18,"fast-isnumeric":20}],243:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47582,7 +48494,7 @@ module.exports = { } }; -},{"d3":13}],221:[function(require,module,exports){ +},{"d3":18}],244:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47681,7 +48593,7 @@ module.exports = { } }; -},{}],222:[function(require,module,exports){ +},{}],245:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47744,7 +48656,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":294,"../../plots/plots":321,"./compute_error":223,"fast-isnumeric":15}],223:[function(require,module,exports){ +},{"../../plots/cartesian/axes":317,"../../plots/plots":344,"./compute_error":246,"fast-isnumeric":20}],246:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47840,7 +48752,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],224:[function(require,module,exports){ +},{}],247:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47917,7 +48829,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":273,"../../plots/plots":321,"./attributes":221,"fast-isnumeric":15}],225:[function(require,module,exports){ +},{"../../lib":296,"../../plots/plots":344,"./attributes":244,"fast-isnumeric":20}],248:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47976,7 +48888,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":221,"./calc":222,"./defaults":224,"./plot":226,"./style":227}],226:[function(require,module,exports){ +},{"./attributes":244,"./calc":245,"./defaults":247,"./plot":249,"./style":250}],249:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48097,7 +49009,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../lib":273,"../../traces/scatter/subtypes":356,"d3":13,"fast-isnumeric":15}],227:[function(require,module,exports){ +},{"../../lib":296,"../../traces/scatter/subtypes":379,"d3":18,"fast-isnumeric":20}],250:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48134,7 +49046,7 @@ module.exports = function style(traces) { }); }; -},{"../color":196,"d3":13}],228:[function(require,module,exports){ +},{"../color":219,"d3":18}],251:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48249,7 +49161,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":299}],229:[function(require,module,exports){ +},{"../../plots/cartesian/constants":322}],252:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48315,7 +49227,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":273,"../../plots/cartesian/axes":294,"./attributes":228}],230:[function(require,module,exports){ +},{"../../lib":296,"../../plots/cartesian/axes":317,"./attributes":251}],253:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48329,6 +49241,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = require('d3'); var Drawing = require('../drawing'); var Axes = require('../../plots/cartesian/axes'); +var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -48370,9 +49283,10 @@ module.exports = function draw(gd) { // Images must be converted to dataURL's for exporting. function setImage(d) { - var thisImage = d3.select(this); + thisImage.attr('xmlns', xmlnsNamespaces.svg); + var imagePromise = new Promise(function(resolve) { var img = new Image(); @@ -48410,7 +49324,6 @@ module.exports = function draw(gd) { } function applyAttributes(d) { - var thisImage = d3.select(this); // Axes if specified @@ -48458,7 +49371,9 @@ module.exports = function draw(gd) { yId = yref ? yref._id : '', clipAxes = xId + yId; - thisImage.call(Drawing.setClipUrl, 'clip' + fullLayout._uid + clipAxes); + if(clipAxes) { + thisImage.call(Drawing.setClipUrl, 'clip' + fullLayout._uid + clipAxes); + } } @@ -48488,7 +49403,7 @@ module.exports = function draw(gd) { imagesAbove.each(applyAttributes); }; -},{"../../plots/cartesian/axes":294,"../drawing":219,"d3":13}],231:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":289,"../../plots/cartesian/axes":317,"../drawing":242,"d3":18}],254:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48511,7 +49426,7 @@ module.exports = { supplyLayoutDefaults: supplyLayoutDefaults }; -},{"./attributes":228,"./defaults":229,"./draw":230}],232:[function(require,module,exports){ +},{"./attributes":251,"./defaults":252,"./draw":253}],255:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48560,7 +49475,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],233:[function(require,module,exports){ +},{}],256:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48651,7 +49566,7 @@ module.exports = { } }; -},{"../../lib/extend":272,"../../plots/font_attributes":312,"../color/attributes":195}],234:[function(require,module,exports){ +},{"../../lib/extend":295,"../../plots/font_attributes":335,"../color/attributes":218}],257:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48669,7 +49584,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],235:[function(require,module,exports){ +},{}],258:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48761,7 +49676,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":273,"../../plots/plots":321,"./attributes":233,"./helpers":238}],236:[function(require,module,exports){ +},{"../../lib":296,"../../plots/plots":344,"./attributes":256,"./helpers":261}],259:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49434,7 +50349,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":273,"../../plotly":291,"../../plots/plots":321,"../color":196,"../dragelement":217,"../drawing":219,"./anchor_utils":232,"./constants":234,"./get_legend_data":237,"./helpers":238,"./style":240,"d3":13}],237:[function(require,module,exports){ +},{"../../lib":296,"../../plotly":314,"../../plots/plots":344,"../color":219,"../dragelement":240,"../drawing":242,"./anchor_utils":255,"./constants":257,"./get_legend_data":260,"./helpers":261,"./style":263,"d3":18}],260:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49540,7 +50455,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../plots/plots":321,"./helpers":238}],238:[function(require,module,exports){ +},{"../../plots/plots":344,"./helpers":261}],261:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49571,7 +50486,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../plots/plots":321}],239:[function(require,module,exports){ +},{"../../plots/plots":344}],262:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49594,7 +50509,7 @@ legend.draw = require('./draw'); legend.style = require('./style'); -},{"./attributes":233,"./defaults":235,"./draw":236,"./style":240}],240:[function(require,module,exports){ +},{"./attributes":256,"./defaults":258,"./draw":259,"./style":263}],263:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49816,7 +50731,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":273,"../../plots/plots":321,"../../traces/pie/style_one":335,"../../traces/scatter/subtypes":356,"../color":196,"../drawing":219,"d3":13}],241:[function(require,module,exports){ +},{"../../lib":296,"../../plots/plots":344,"../../traces/pie/style_one":358,"../../traces/scatter/subtypes":379,"../color":219,"../drawing":242,"d3":18}],264:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50324,7 +51239,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":273,"../../plotly":291,"../../snapshot/download":329}],242:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":296,"../../plotly":314,"../../snapshot/download":352}],265:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50614,7 +51529,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":273,"d3":13}],243:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":296,"d3":18}],266:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50842,7 +51757,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plotly":291,"../../traces/scatter/subtypes":356,"./":242,"./buttons":241}],244:[function(require,module,exports){ +},{"../../plotly":314,"../../traces/scatter/subtypes":379,"./":265,"./buttons":264}],267:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50931,7 +51846,7 @@ module.exports = { } }; -},{"../../lib/extend":272,"../../plots/font_attributes":312,"../color/attributes":195,"./button_attributes":245}],245:[function(require,module,exports){ +},{"../../lib/extend":295,"../../plots/font_attributes":335,"../color/attributes":218,"./button_attributes":268}],268:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50972,7 +51887,7 @@ module.exports = { } }; -},{}],246:[function(require,module,exports){ +},{}],269:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51001,7 +51916,7 @@ module.exports = { darkAmount: 10 }; -},{}],247:[function(require,module,exports){ +},{}],270:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51087,13 +52002,14 @@ function getPosDflt(containerOut, layout, counterAxes) { var posY = 0; for(var i = 0; i < anchoredList.length; i++) { - posY = Math.max(layout[anchoredList[i]].domain[1], posY); + var domain = layout[anchoredList[i]].domain; + if(domain) posY = Math.max(domain[1], posY); } return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":273,"../color":196,"./attributes":244,"./button_attributes":245,"./constants":246}],248:[function(require,module,exports){ +},{"../../lib":296,"../color":219,"./attributes":267,"./button_attributes":268,"./constants":269}],271:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51368,7 +52284,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":284,"../../plotly":291,"../../plots/cartesian/axis_ids":296,"../../plots/plots":321,"../color":196,"../drawing":219,"../legend/anchor_utils":232,"./constants":246,"./get_update_object":249,"d3":13}],249:[function(require,module,exports){ +},{"../../lib/svg_text_utils":307,"../../plotly":314,"../../plots/cartesian/axis_ids":319,"../../plots/plots":344,"../color":219,"../drawing":242,"../legend/anchor_utils":255,"./constants":269,"./get_update_object":272,"d3":18}],272:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51426,7 +52342,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":13}],250:[function(require,module,exports){ +},{"d3":18}],273:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51444,7 +52360,7 @@ exports.supplyLayoutDefaults = require('./defaults'); exports.draw = require('./draw'); -},{"./attributes":244,"./defaults":247,"./draw":248}],251:[function(require,module,exports){ +},{"./attributes":267,"./defaults":270,"./draw":271}],274:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51502,7 +52418,7 @@ module.exports = { } }; -},{"../color/attributes":195}],252:[function(require,module,exports){ +},{"../color/attributes":218}],275:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51798,7 +52714,7 @@ module.exports = function createSlider(gd) { }); }; -},{"../../constants/xmlns_namespaces":266,"../../lib":273,"../../plotly":291,"../../plots/cartesian/axes":294,"./helpers":254,"./range_plot":256}],253:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":289,"../../lib":296,"../../plotly":314,"../../plots/cartesian/axes":317,"./helpers":277,"./range_plot":279}],276:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51851,7 +52767,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, axName, coun } }; -},{"../../lib":273,"./attributes":251}],254:[function(require,module,exports){ +},{"../../lib":296,"./attributes":274}],277:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51877,7 +52793,7 @@ exports.appendChildren = function appendChildren(el, children) { } }; -},{}],255:[function(require,module,exports){ +},{}],278:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51934,7 +52850,7 @@ function draw(gd) { }); } -},{"../../plots/plots":321,"./create_slider":252,"./defaults":253}],256:[function(require,module,exports){ +},{"../../plots/plots":344,"./create_slider":275,"./defaults":276}],279:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52115,7 +53031,7 @@ function makeScatter(trace, pointPairs, w, h) { return [line, markers, fill]; } -},{"../../constants/xmlns_namespaces":266,"../../lib":273,"../drawing":219,"../drawing/symbol_defs":220,"./helpers":254,"d3":13}],257:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":289,"../../lib":296,"../drawing":242,"../drawing/symbol_defs":243,"./helpers":277,"d3":18}],280:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52206,7 +53122,7 @@ module.exports = { } }; -},{"../../lib/extend":272,"../../traces/scatter/attributes":337,"../annotations/attributes":193}],258:[function(require,module,exports){ +},{"../../lib/extend":295,"../../traces/scatter/attributes":360,"../annotations/attributes":216}],281:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52996,7 +53912,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":273,"../../lib/setcursor":282,"../../plotly":291,"../../plots/cartesian/axes":294,"../color":196,"../dragelement":217,"../drawing":219,"./attributes":257,"fast-isnumeric":15}],259:[function(require,module,exports){ +},{"../../lib":296,"../../lib/setcursor":305,"../../plotly":314,"../../plots/cartesian/axes":317,"../color":219,"../dragelement":240,"../drawing":242,"./attributes":280,"fast-isnumeric":20}],282:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53226,7 +54142,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":273,"../../lib/svg_text_utils":284,"../../plotly":291,"../../plots/plots":321,"../color":196,"../drawing":219,"d3":13,"fast-isnumeric":15}],260:[function(require,module,exports){ +},{"../../lib":296,"../../lib/svg_text_utils":307,"../../plotly":314,"../../plots/plots":344,"../color":219,"../drawing":242,"d3":18,"fast-isnumeric":20}],283:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53344,7 +54260,7 @@ module.exports = { } }; -},{"../../lib/extend":272,"../../plots/font_attributes":312,"../color/attributes":195}],261:[function(require,module,exports){ +},{"../../lib/extend":295,"../../plots/font_attributes":335,"../color/attributes":218}],284:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53419,7 +54335,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],262:[function(require,module,exports){ +},{}],285:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53515,7 +54431,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":273,"./attributes":260,"./constants":261}],263:[function(require,module,exports){ +},{"../../lib":296,"./attributes":283,"./constants":284}],286:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53974,7 +54890,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":273,"../../lib/svg_text_utils":284,"../../plotly":291,"../../plots/plots":321,"../color":196,"../drawing":219,"../legend/anchor_utils":232,"./constants":261,"d3":13}],264:[function(require,module,exports){ +},{"../../lib":296,"../../lib/svg_text_utils":307,"../../plotly":314,"../../plots/plots":344,"../color":219,"../drawing":242,"../legend/anchor_utils":255,"./constants":284,"d3":18}],287:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53992,7 +54908,7 @@ exports.supplyLayoutDefaults = require('./defaults'); exports.draw = require('./draw'); -},{"./attributes":260,"./defaults":262,"./draw":263}],265:[function(require,module,exports){ +},{"./attributes":283,"./defaults":285,"./draw":286}],288:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54030,7 +54946,7 @@ module.exports = { }; -},{}],266:[function(require,module,exports){ +},{}],289:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54054,7 +54970,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],267:[function(require,module,exports){ +},{}],290:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54072,7 +54988,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.16.2'; +exports.version = '1.16.3'; // plot api exports.plot = Plotly.plot; @@ -54105,7 +55021,7 @@ exports.Queue = Plotly.Queue; // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/ploticon":2,"./plot_api/set_plot_config":288,"./plot_api/to_image":289,"./plot_api/validate":290,"./plotly":291,"./snapshot/download":329,"d3":13}],268:[function(require,module,exports){ +},{"../build/ploticon":2,"./plot_api/set_plot_config":311,"./plot_api/to_image":312,"./plot_api/validate":313,"./plotly":314,"./snapshot/download":352,"d3":18}],291:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54138,7 +55054,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],269:[function(require,module,exports){ +},{}],292:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54448,7 +55364,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":208,"../components/colorscale/scales":214,"./nested_property":277,"fast-isnumeric":15,"tinycolor2":191}],270:[function(require,module,exports){ +},{"../components/colorscale/get_scale":231,"../components/colorscale/scales":237,"./nested_property":300,"fast-isnumeric":20,"tinycolor2":214}],293:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54787,7 +55703,7 @@ exports.parseDate = function(v) { return out; }; -},{"../lib":273,"d3":13,"fast-isnumeric":15}],271:[function(require,module,exports){ +},{"../lib":296,"d3":18,"fast-isnumeric":20}],294:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54921,7 +55837,7 @@ var Events = { module.exports = Events; -},{"events":7}],272:[function(require,module,exports){ +},{"events":6}],295:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55035,7 +55951,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":274}],273:[function(require,module,exports){ +},{"./is_plain_object.js":297}],296:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55655,7 +56571,7 @@ lib.numSeparate = function(value, separators) { return x1 + x2; }; -},{"./coerce":269,"./dates":270,"./extend":272,"./is_plain_object":274,"./loggers":275,"./matrix":276,"./nested_property":277,"./notifier":278,"./search":281,"./stats":283,"d3":13}],274:[function(require,module,exports){ +},{"./coerce":292,"./dates":293,"./extend":295,"./is_plain_object":297,"./loggers":298,"./matrix":299,"./nested_property":300,"./notifier":301,"./search":304,"./stats":306,"d3":18}],297:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55684,7 +56600,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],275:[function(require,module,exports){ +},{}],298:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55751,7 +56667,7 @@ loggers.error = function() { }; /* eslint-enable no-console */ -},{"../plot_api/plot_config":286}],276:[function(require,module,exports){ +},{"../plot_api/plot_config":309}],299:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55861,7 +56777,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],277:[function(require,module,exports){ +},{}],300:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56117,7 +57033,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"fast-isnumeric":15}],278:[function(require,module,exports){ +},{"fast-isnumeric":20}],301:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56194,7 +57110,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":13,"fast-isnumeric":15}],279:[function(require,module,exports){ +},{"d3":18,"fast-isnumeric":20}],302:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56434,7 +57350,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":276}],280:[function(require,module,exports){ +},{"./matrix":299}],303:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56645,7 +57561,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":273,"../plot_api/plot_config":286}],281:[function(require,module,exports){ +},{"../lib":296,"../plot_api/plot_config":309}],304:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56757,7 +57673,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"../lib":273,"fast-isnumeric":15}],282:[function(require,module,exports){ +},{"../lib":296,"fast-isnumeric":20}],305:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56780,7 +57696,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],283:[function(require,module,exports){ +},{}],306:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56876,7 +57792,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":15}],284:[function(require,module,exports){ +},{"fast-isnumeric":20}],307:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57403,7 +58319,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":265,"../constants/xmlns_namespaces":266,"../lib":273,"d3":13}],285:[function(require,module,exports){ +},{"../constants/string_mappings":288,"../constants/xmlns_namespaces":289,"../lib":296,"d3":18}],308:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60518,7 +61434,7 @@ function drawMainTitle(gd) { }); } -},{"../components/color":196,"../components/drawing":219,"../components/errorbars":225,"../components/images":231,"../components/legend":239,"../components/modebar/manage":243,"../components/rangeselector":250,"../components/rangeslider":255,"../components/shapes":258,"../components/titles":259,"../components/updatemenus":264,"../constants/xmlns_namespaces":266,"../lib":273,"../lib/events":271,"../lib/queue":280,"../plotly":291,"../plots/cartesian/graph_interact":301,"../plots/plots":321,"d3":13,"fast-isnumeric":15,"gl-mat4/fromQuat":16}],286:[function(require,module,exports){ +},{"../components/color":219,"../components/drawing":242,"../components/errorbars":248,"../components/images":254,"../components/legend":262,"../components/modebar/manage":266,"../components/rangeselector":273,"../components/rangeslider":278,"../components/shapes":281,"../components/titles":282,"../components/updatemenus":287,"../constants/xmlns_namespaces":289,"../lib":296,"../lib/events":294,"../lib/queue":303,"../plotly":314,"../plots/cartesian/graph_interact":324,"../plots/plots":344,"d3":18,"fast-isnumeric":20,"gl-mat4/fromQuat":21}],309:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60627,7 +61543,7 @@ function defaultSetBackground(gd, bgColor) { catch(e) { Lib.error(e); } } -},{"../lib":273}],287:[function(require,module,exports){ +},{"../lib":296}],310:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60967,7 +61883,7 @@ function handleLinkedToArray(layoutAttributes) { PlotSchema.crawl(layoutAttributes, callback); } -},{"../lib":273,"../plotly":291,"../plots/plots":321,"../plots/polar/area_attributes":322,"../plots/polar/axis_attributes":323}],288:[function(require,module,exports){ +},{"../lib":296,"../plotly":314,"../plots/plots":344,"../plots/polar/area_attributes":345,"../plots/polar/axis_attributes":346}],311:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60993,7 +61909,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":273,"../plotly":291}],289:[function(require,module,exports){ +},{"../lib":296,"../plotly":314}],312:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61106,7 +62022,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":273,"../plotly":291,"../snapshot":331,"fast-isnumeric":15}],290:[function(require,module,exports){ +},{"../lib":296,"../plotly":314,"../snapshot":354,"fast-isnumeric":20}],313:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61476,7 +62392,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":273,"../plots/plots":321,"./plot_schema":287}],291:[function(require,module,exports){ +},{"../lib":296,"../plots/plots":344,"./plot_schema":310}],314:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61594,7 +62510,7 @@ exports.PlotSchema = require('./plot_api/plot_schema'); // imaging routines exports.Snapshot = require('./snapshot'); -},{"../build/plotcss":1,"./components/annotations":194,"./components/color":196,"./components/colorbar":201,"./components/colorscale":210,"./components/drawing":219,"./components/errorbars":225,"./components/images":231,"./components/legend":239,"./components/modebar":242,"./components/shapes":258,"./components/updatemenus":264,"./fonts/mathjax_config":268,"./lib":273,"./lib/queue":280,"./lib/svg_text_utils":284,"./plot_api/plot_api":285,"./plot_api/plot_config":286,"./plot_api/plot_schema":287,"./plots/cartesian/axes":294,"./plots/cartesian/graph_interact":301,"./plots/plots":321,"./plots/polar/micropolar":324,"./snapshot":331,"./traces/scatter":347,"es6-promise":14}],292:[function(require,module,exports){ +},{"../build/plotcss":1,"./components/annotations":217,"./components/color":219,"./components/colorbar":224,"./components/colorscale":233,"./components/drawing":242,"./components/errorbars":248,"./components/images":254,"./components/legend":262,"./components/modebar":265,"./components/shapes":281,"./components/updatemenus":287,"./fonts/mathjax_config":291,"./lib":296,"./lib/queue":303,"./lib/svg_text_utils":307,"./plot_api/plot_api":308,"./plot_api/plot_config":309,"./plot_api/plot_schema":310,"./plots/cartesian/axes":317,"./plots/cartesian/graph_interact":324,"./plots/plots":344,"./plots/polar/micropolar":347,"./snapshot":354,"./traces/scatter":370,"es6-promise":19}],315:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61675,7 +62591,7 @@ module.exports = { } }; -},{}],293:[function(require,module,exports){ +},{}],316:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61702,7 +62618,7 @@ module.exports = { } }; -},{}],294:[function(require,module,exports){ +},{}],317:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -63726,7 +64642,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":196,"../../components/drawing":219,"../../components/titles":259,"../../lib":273,"../../lib/svg_text_utils":284,"../../plotly":291,"./axis_ids":296,"./layout_attributes":303,"./layout_defaults":304,"./set_convert":308,"d3":13,"fast-isnumeric":15}],295:[function(require,module,exports){ +},{"../../components/color":219,"../../components/drawing":242,"../../components/titles":282,"../../lib":296,"../../lib/svg_text_utils":307,"../../plotly":314,"./axis_ids":319,"./layout_attributes":326,"./layout_defaults":327,"./set_convert":331,"d3":18,"fast-isnumeric":20}],318:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64009,7 +64925,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../components/color/attributes":195,"../../lib":273,"../plots":321,"./axis_ids":296,"./category_order_defaults":297,"./clean_datum":298,"./layout_attributes":303,"./ordered_categories":305,"./set_convert":308,"./tick_label_defaults":309,"./tick_mark_defaults":310,"./tick_value_defaults":311,"fast-isnumeric":15,"tinycolor2":191}],296:[function(require,module,exports){ +},{"../../components/color/attributes":218,"../../lib":296,"../plots":344,"./axis_ids":319,"./category_order_defaults":320,"./clean_datum":321,"./layout_attributes":326,"./ordered_categories":328,"./set_convert":331,"./tick_label_defaults":332,"./tick_mark_defaults":333,"./tick_value_defaults":334,"fast-isnumeric":20,"tinycolor2":214}],319:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64130,7 +65046,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":273,"../plots":321,"./constants":299}],297:[function(require,module,exports){ +},{"../../lib":296,"../plots":344,"./constants":322}],320:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64164,7 +65080,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],298:[function(require,module,exports){ +},{}],321:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64203,7 +65119,7 @@ module.exports = function cleanDatum(c) { return c; }; -},{"../../lib":273,"fast-isnumeric":15}],299:[function(require,module,exports){ +},{"../../lib":296,"fast-isnumeric":20}],322:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64281,7 +65197,7 @@ module.exports = { REDRAWDELAY: 50 }; -},{}],300:[function(require,module,exports){ +},{}],323:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64970,7 +65886,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":196,"../../components/dragelement":217,"../../components/drawing":219,"../../lib":273,"../../lib/setcursor":282,"../../lib/svg_text_utils":284,"../../plotly":291,"./axes":294,"./constants":299,"./select":307,"d3":13,"tinycolor2":191}],301:[function(require,module,exports){ +},{"../../components/color":219,"../../components/dragelement":240,"../../components/drawing":242,"../../lib":296,"../../lib/setcursor":305,"../../lib/svg_text_utils":307,"../../plotly":314,"./axes":317,"./constants":322,"./select":330,"d3":18,"tinycolor2":214}],324:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66312,7 +67228,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":196,"../../components/dragelement":217,"../../components/drawing":219,"../../lib":273,"../../lib/events":271,"../../lib/svg_text_utils":284,"./axes":294,"./constants":299,"./dragbox":300,"d3":13,"fast-isnumeric":15,"tinycolor2":191}],302:[function(require,module,exports){ +},{"../../components/color":219,"../../components/dragelement":240,"../../components/drawing":242,"../../lib":296,"../../lib/events":294,"../../lib/svg_text_utils":307,"./axes":317,"./constants":322,"./dragbox":323,"d3":18,"fast-isnumeric":20,"tinycolor2":214}],325:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66399,7 +67315,7 @@ exports.plot = function(gd) { } }; -},{"../plots":321,"./attributes":293,"./constants":299}],303:[function(require,module,exports){ +},{"../plots":344,"./attributes":316,"./constants":322}],326:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66744,7 +67660,7 @@ module.exports = { } }; -},{"../../components/color/attributes":195,"../../components/rangeselector/attributes":244,"../../components/rangeslider/attributes":251,"../../lib/extend":272,"../font_attributes":312,"./constants":299}],304:[function(require,module,exports){ +},{"../../components/color/attributes":218,"../../components/rangeselector/attributes":267,"../../components/rangeslider/attributes":274,"../../lib/extend":295,"../font_attributes":335,"./constants":322}],327:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66917,7 +67833,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":196,"../../components/rangeselector":250,"../../components/rangeslider":255,"../../lib":273,"../plots":321,"./axis_defaults":295,"./axis_ids":296,"./constants":299,"./layout_attributes":303,"./position_defaults":306}],305:[function(require,module,exports){ +},{"../../components/color":219,"../../components/rangeselector":273,"../../components/rangeslider":278,"../../lib":296,"../plots":344,"./axis_defaults":318,"./axis_ids":319,"./constants":322,"./layout_attributes":326,"./position_defaults":329}],328:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66961,7 +67877,7 @@ function flattenUniqueSort(axisLetter, sortFunction, data) { insertionIndex = bisector(categoryArray, category); // skip loop on already encountered values - if(insertionIndex < categoryArray.length - 1 && categoryArray[insertionIndex] === category) continue; + if(insertionIndex < categoryArray.length && categoryArray[insertionIndex] === category) continue; // insert value categoryArray.splice(insertionIndex, 0, category); @@ -66996,7 +67912,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":13}],306:[function(require,module,exports){ +},{"d3":18}],329:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67061,7 +67977,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":273,"fast-isnumeric":15}],307:[function(require,module,exports){ +},{"../../lib":296,"fast-isnumeric":20}],330:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67261,7 +68177,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":196,"../../lib/polygon":279,"./axes":294,"./constants":299}],308:[function(require,module,exports){ +},{"../../components/color":219,"../../lib/polygon":302,"./axes":317,"./constants":322}],331:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67505,7 +68421,7 @@ module.exports = function setConvert(ax) { ax._forceTick0 = null; }; -},{"../../lib":273,"./axis_ids":296,"./clean_datum":298,"./constants":299,"d3":13,"fast-isnumeric":15}],309:[function(require,module,exports){ +},{"../../lib":296,"./axis_ids":319,"./clean_datum":321,"./constants":322,"d3":18,"fast-isnumeric":20}],332:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67588,7 +68504,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":273}],310:[function(require,module,exports){ +},{"../../lib":296}],333:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67621,7 +68537,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":273,"./layout_attributes":303}],311:[function(require,module,exports){ +},{"../../lib":296,"./layout_attributes":326}],334:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67662,7 +68578,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":15}],312:[function(require,module,exports){ +},{"fast-isnumeric":20}],335:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67693,7 +68609,7 @@ module.exports = { } }; -},{}],313:[function(require,module,exports){ +},{}],336:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67858,7 +68774,7 @@ module.exports = { } }; -},{"../components/color/attributes":195,"../plotly":291,"./font_attributes":312}],314:[function(require,module,exports){ +},{"../components/color/attributes":218,"../plotly":314,"./font_attributes":335}],337:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67888,7 +68804,7 @@ module.exports = { mapOnErrorMsg: 'Mapbox error.' }; -},{}],315:[function(require,module,exports){ +},{}],338:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67962,7 +68878,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":273}],316:[function(require,module,exports){ +},{"../../lib":296}],339:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68115,7 +69031,7 @@ function findAccessToken(gd, mapboxIds) { return accessToken; } -},{"../../constants/xmlns_namespaces":266,"../plots":321,"./constants":314,"./layout_attributes":318,"./layout_defaults":319,"./mapbox":320,"mapbox-gl":30}],317:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":289,"../plots":344,"./constants":337,"./layout_attributes":341,"./layout_defaults":342,"./mapbox":343,"mapbox-gl":37}],340:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68340,7 +69256,7 @@ module.exports = function createMapboxLayer(mapbox, index, opts) { return mapboxLayer; }; -},{"../../lib":273,"./convert_text_opts":315}],318:[function(require,module,exports){ +},{"../../lib":296,"./convert_text_opts":338}],341:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68543,7 +69459,7 @@ module.exports = { }; -},{"../../components/color":196,"../../lib":273,"../../traces/scatter/attributes":337,"../font_attributes":312}],319:[function(require,module,exports){ +},{"../../components/color":219,"../../lib":296,"../../traces/scatter/attributes":360,"../font_attributes":335}],342:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68639,7 +69555,7 @@ function handleLayerDefaults(containerIn, containerOut) { } } -},{"../../lib":273,"../subplot_defaults":327,"./layout_attributes":318}],320:[function(require,module,exports){ +},{"../../lib":296,"../subplot_defaults":350,"./layout_attributes":341}],343:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -69000,16 +69916,24 @@ proto.toImage = function() { // convenience wrapper to create blank GeoJSON sources // and avoid 'invalid GeoJSON' errors -proto.createGeoJSONSource = function() { +proto.initSource = function(idSource) { var blank = { - type: 'Feature', - geometry: { - type: 'Point', - coordinates: [] + type: 'geojson', + data: { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [] + } } }; - return new mapboxgl.GeoJSONSource({data: blank}); + return this.map.addSource(idSource, blank); +}; + +// convenience wrapper to set data of GeoJSON sources +proto.setSourceData = function(idSource, data) { + this.map.getSource(idSource).setData(data); }; // convenience wrapper to create set multiple layer @@ -69077,7 +70001,7 @@ function convertCenter(center) { return [center.lon, center.lat]; } -},{"../../lib":273,"../cartesian/graph_interact":301,"./constants":314,"./layers":317,"./layout_attributes":318,"mapbox-gl":30}],321:[function(require,module,exports){ +},{"../../lib":296,"../cartesian/graph_interact":324,"./constants":337,"./layers":340,"./layout_attributes":341,"mapbox-gl":37}],344:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70268,7 +71192,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { return (output === 'object') ? obj : JSON.stringify(obj); }; -},{"../components/color":196,"../lib":273,"../plotly":291,"./attributes":292,"./font_attributes":312,"./layout_attributes":313,"d3":13,"fast-isnumeric":15}],322:[function(require,module,exports){ +},{"../components/color":219,"../lib":296,"../plotly":314,"./attributes":315,"./font_attributes":335,"./layout_attributes":336,"d3":18,"fast-isnumeric":20}],345:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70293,7 +71217,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":337}],323:[function(require,module,exports){ +},{"../../traces/scatter/attributes":360}],346:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70408,7 +71332,7 @@ module.exports = { } }; -},{"../../lib/extend":272,"../cartesian/layout_attributes":303}],324:[function(require,module,exports){ +},{"../../lib/extend":295,"../cartesian/layout_attributes":326}],347:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71831,7 +72755,7 @@ var extendDeepAll = Plotly.Lib.extendDeepAll; return exports; }; -},{"../../plotly":291,"./micropolar_manager":325,"d3":13}],325:[function(require,module,exports){ +},{"../../plotly":314,"./micropolar_manager":348,"d3":18}],348:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71914,7 +72838,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../plotly":291,"./undo_manager":326,"d3":13}],326:[function(require,module,exports){ +},{"../../plotly":314,"./undo_manager":349,"d3":18}],349:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71980,7 +72904,7 @@ module.exports = function UndoManager() { }; }; -},{}],327:[function(require,module,exports){ +},{}],350:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72055,7 +72979,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":273,"./plots":321}],328:[function(require,module,exports){ +},{"../lib":296,"./plots":344}],351:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72211,7 +73135,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../plotly":291}],329:[function(require,module,exports){ +},{"../plotly":314}],352:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72277,7 +73201,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":273,"../plot_api/to_image":289,"./filesaver":330}],330:[function(require,module,exports){ +},{"../lib":296,"../plot_api/to_image":312,"./filesaver":353}],353:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72345,7 +73269,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],331:[function(require,module,exports){ +},{}],354:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72390,7 +73314,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":328,"./download":329,"./svgtoimg":332,"./toimage":333,"./tosvg":334}],332:[function(require,module,exports){ +},{"./cloneplot":351,"./download":352,"./svgtoimg":355,"./toimage":356,"./tosvg":357}],355:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72521,7 +73445,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":273,"events":7}],333:[function(require,module,exports){ +},{"../lib":296,"events":6}],356:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72600,7 +73524,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":273,"../plotly":291,"events":7}],334:[function(require,module,exports){ +},{"../lib":296,"../plotly":314,"events":6}],357:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72712,7 +73636,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":196,"../components/drawing":219,"../constants/xmlns_namespaces":266,"../lib/svg_text_utils":284,"d3":13}],335:[function(require,module,exports){ +},{"../components/color":219,"../components/drawing":242,"../constants/xmlns_namespaces":289,"../lib/svg_text_utils":307,"d3":18}],358:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72739,7 +73663,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":196}],336:[function(require,module,exports){ +},{"../../components/color":219}],359:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72777,7 +73701,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":273}],337:[function(require,module,exports){ +},{"../../lib":296}],360:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73027,7 +73951,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":204,"../../components/drawing":219,"../../lib/extend":272,"./constants":342}],338:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":227,"../../components/drawing":242,"../../lib/extend":295,"./constants":365}],361:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73154,7 +74078,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":273,"../../plots/cartesian/axes":294,"./colorscale_calc":341,"./subtypes":356,"fast-isnumeric":15}],339:[function(require,module,exports){ +},{"../../lib":296,"../../plots/cartesian/axes":317,"./colorscale_calc":364,"./subtypes":379,"fast-isnumeric":20}],362:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73195,7 +74119,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],340:[function(require,module,exports){ +},{}],363:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73248,7 +74172,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":199,"../../components/colorscale/get_scale":208,"../../lib":273,"../../plots/plots":321,"d3":13,"fast-isnumeric":15}],341:[function(require,module,exports){ +},{"../../components/colorbar/draw":222,"../../components/colorscale/get_scale":231,"../../lib":296,"../../plots/plots":344,"d3":18,"fast-isnumeric":20}],364:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73281,7 +74205,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":203,"../../components/colorscale/has_colorscale":209,"./subtypes":356}],342:[function(require,module,exports){ +},{"../../components/colorscale/calc":226,"../../components/colorscale/has_colorscale":232,"./subtypes":379}],365:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73297,7 +74221,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],343:[function(require,module,exports){ +},{}],366:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73375,7 +74299,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":224,"../../lib":273,"./attributes":337,"./constants":342,"./fillcolor_defaults":344,"./line_defaults":348,"./line_shape_defaults":350,"./marker_defaults":352,"./subtypes":356,"./text_defaults":357,"./xy_defaults":358}],344:[function(require,module,exports){ +},{"../../components/errorbars/defaults":247,"../../lib":296,"./attributes":360,"./constants":365,"./fillcolor_defaults":367,"./line_defaults":371,"./line_shape_defaults":373,"./marker_defaults":375,"./subtypes":379,"./text_defaults":380,"./xy_defaults":381}],367:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73414,7 +74338,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":196}],345:[function(require,module,exports){ +},{"../../components/color":219}],368:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73467,7 +74391,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":196,"./subtypes":356}],346:[function(require,module,exports){ +},{"../../components/color":219,"./subtypes":379}],369:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73636,7 +74560,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":196,"../../components/errorbars":225,"../../lib":273,"../../plots/cartesian/constants":299,"../../plots/cartesian/graph_interact":301,"./get_trace_color":345}],347:[function(require,module,exports){ +},{"../../components/color":219,"../../components/errorbars":248,"../../lib":296,"../../plots/cartesian/constants":322,"../../plots/cartesian/graph_interact":324,"./get_trace_color":368}],370:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73679,7 +74603,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":302,"./arrays_to_calcdata":336,"./attributes":337,"./calc":338,"./clean_data":339,"./colorbar":340,"./defaults":343,"./hover":346,"./plot":353,"./select":354,"./style":355,"./subtypes":356}],348:[function(require,module,exports){ +},{"../../plots/cartesian":325,"./arrays_to_calcdata":359,"./attributes":360,"./calc":361,"./clean_data":362,"./colorbar":363,"./defaults":366,"./hover":369,"./plot":376,"./select":377,"./style":378,"./subtypes":379}],371:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73712,7 +74636,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":206,"../../components/colorscale/has_colorscale":209}],349:[function(require,module,exports){ +},{"../../components/colorscale/defaults":229,"../../components/colorscale/has_colorscale":232}],372:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73881,7 +74805,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":294}],350:[function(require,module,exports){ +},{"../../plots/cartesian/axes":317}],373:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73900,7 +74824,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],351:[function(require,module,exports){ +},{}],374:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73942,7 +74866,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":15}],352:[function(require,module,exports){ +},{"fast-isnumeric":20}],375:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74002,7 +74926,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":196,"../../components/colorscale/defaults":206,"../../components/colorscale/has_colorscale":209,"./subtypes":356}],353:[function(require,module,exports){ +},{"../../components/color":219,"../../components/colorscale/defaults":229,"../../components/colorscale/has_colorscale":232,"./subtypes":379}],376:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74295,7 +75219,7 @@ function selectMarkers(gd, plotinfo, cdscatter) { }); } -},{"../../components/drawing":219,"../../components/errorbars":225,"../../lib":273,"../../lib/polygon":279,"./arrays_to_calcdata":336,"./line_points":349,"./subtypes":356,"d3":13}],354:[function(require,module,exports){ +},{"../../components/drawing":242,"../../components/errorbars":248,"../../lib":296,"../../lib/polygon":302,"./arrays_to_calcdata":359,"./line_points":372,"./subtypes":379,"d3":18}],377:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74366,7 +75290,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":356}],355:[function(require,module,exports){ +},{"./subtypes":379}],378:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74408,7 +75332,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":219,"../../components/errorbars":225,"d3":13}],356:[function(require,module,exports){ +},{"../../components/drawing":242,"../../components/errorbars":248,"d3":18}],379:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74444,7 +75368,7 @@ module.exports = { } }; -},{"../../lib":273}],357:[function(require,module,exports){ +},{"../../lib":296}],380:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74465,7 +75389,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":273}],358:[function(require,module,exports){ +},{"../../lib":296}],381:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74510,7 +75434,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return len; }; -},{}],359:[function(require,module,exports){ +},{}],382:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74585,7 +75509,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":204,"../../lib/extend":272,"../../plots/attributes":292,"../scatter/attributes":337}],360:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":227,"../../lib/extend":295,"../../plots/attributes":315,"../scatter/attributes":360}],383:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74684,7 +75608,7 @@ module.exports = { } }; -},{"../../lib/extend":272,"../../plots/attributes":292,"../../plots/mapbox/layout_attributes":318,"../scatter/attributes":337,"../scattergeo/attributes":359}],361:[function(require,module,exports){ +},{"../../lib/extend":295,"../../plots/attributes":315,"../../plots/mapbox/layout_attributes":341,"../scatter/attributes":360,"../scattergeo/attributes":382}],384:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74781,7 +75705,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale/has_colorscale":209,"../../components/colorscale/make_scale_function":213,"../../lib":273,"../scatter/colorscale_calc":341,"../scatter/make_bubble_size_func":351,"../scatter/subtypes":356,"fast-isnumeric":15}],362:[function(require,module,exports){ +},{"../../components/colorscale/has_colorscale":232,"../../components/colorscale/make_scale_function":236,"../../lib":296,"../scatter/colorscale_calc":364,"../scatter/make_bubble_size_func":374,"../scatter/subtypes":379,"fast-isnumeric":20}],385:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74931,9 +75855,21 @@ function makeBlankGeoJSON() { } function makeFillGeoJSON(_, coords) { + if(coords.length === 1) { + return { + type: 'Polygon', + coordinates: coords + }; + } + + var _coords = new Array(coords.length); + for(var i = 0; i < coords.length; i++) { + _coords[i] = [coords[i]]; + } + return { - type: 'Polygon', - coordinates: coords + type: 'MultiPolygon', + coordinates: _coords }; } @@ -75132,7 +76068,7 @@ function getFillFunc(attr) { function blankFillFunc() { return ''; } -},{"../../lib":273,"../../plots/mapbox/convert_text_opts":315,"../scatter/subtypes":356}],363:[function(require,module,exports){ +},{"../../lib":296,"../../plots/mapbox/convert_text_opts":338,"../scatter/subtypes":379}],386:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75220,7 +76156,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":273,"../scatter/attributes":337,"../scatter/fillcolor_defaults":344,"../scatter/line_defaults":348,"../scatter/marker_defaults":352,"../scatter/subtypes":356,"../scatter/text_defaults":357,"./attributes":360}],364:[function(require,module,exports){ +},{"../../lib":296,"../scatter/attributes":360,"../scatter/fillcolor_defaults":367,"../scatter/line_defaults":371,"../scatter/marker_defaults":375,"../scatter/subtypes":379,"../scatter/text_defaults":380,"./attributes":383}],387:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75313,7 +76249,7 @@ function getExtraText(trace, di) { return text.join('
'); } -},{"../../plots/cartesian/graph_interact":301,"../scatter/get_trace_color":345}],365:[function(require,module,exports){ +},{"../../plots/cartesian/graph_interact":324,"../scatter/get_trace_color":368}],388:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75345,7 +76281,7 @@ ScatterMapbox.meta = { module.exports = ScatterMapbox; -},{"../../plots/mapbox":316,"../scatter/colorbar":340,"./attributes":360,"./calc":361,"./defaults":363,"./hover":364,"./plot":366}],366:[function(require,module,exports){ +},{"../../plots/mapbox":339,"../scatter/colorbar":363,"./attributes":383,"./calc":384,"./defaults":386,"./hover":387,"./plot":389}],389:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75376,17 +76312,10 @@ function ScatterMapbox(mapbox, uid) { this.idLayerCircle = uid + '-layer-circle'; this.idLayerSymbol = uid + '-layer-symbol'; - this.sourceFill = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceFill, this.sourceFill); - - this.sourceLine = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceLine, this.sourceLine); - - this.sourceCircle = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceCircle, this.sourceCircle); - - this.sourceSymbol = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceSymbol, this.sourceSymbol); + this.mapbox.initSource(this.idSourceFill); + this.mapbox.initSource(this.idSourceLine); + this.mapbox.initSource(this.idSourceCircle); + this.mapbox.initSource(this.idSourceSymbol); this.map.addLayer({ id: this.idLayerFill, @@ -75421,7 +76350,6 @@ var proto = ScatterMapbox.prototype; proto.update = function update(calcTrace) { var mapbox = this.mapbox; - var opts = convert(calcTrace); mapbox.setOptions(this.idLayerFill, 'setLayoutProperty', opts.fill.layout); @@ -75430,22 +76358,22 @@ proto.update = function update(calcTrace) { mapbox.setOptions(this.idLayerSymbol, 'setLayoutProperty', opts.symbol.layout); if(isVisible(opts.fill)) { - this.sourceFill.setData(opts.fill.geojson); + mapbox.setSourceData(this.idSourceFill, opts.fill.geojson); mapbox.setOptions(this.idLayerFill, 'setPaintProperty', opts.fill.paint); } if(isVisible(opts.line)) { - this.sourceLine.setData(opts.line.geojson); + mapbox.setSourceData(this.idSourceLine, opts.line.geojson); mapbox.setOptions(this.idLayerLine, 'setPaintProperty', opts.line.paint); } if(isVisible(opts.circle)) { - this.sourceCircle.setData(opts.circle.geojson); + mapbox.setSourceData(this.idSourceCircle, opts.circle.geojson); mapbox.setOptions(this.idLayerCircle, 'setPaintProperty', opts.circle.paint); } if(isVisible(opts.symbol)) { - this.sourceSymbol.setData(opts.symbol.geojson); + mapbox.setSourceData(this.idSourceSymbol, opts.symbol.geojson); mapbox.setOptions(this.idLayerSymbol, 'setPaintProperty', opts.symbol.paint); } }; @@ -75477,5 +76405,5 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { return scatterMapbox; }; -},{"./convert":362}]},{},[4])(4) +},{"./convert":385}]},{},[4])(4) }); \ No newline at end of file diff --git a/dist/plotly-mapbox.min.js b/dist/plotly-mapbox.min.js index 014ed751e6f..21361c98b25 100644 --- a/dist/plotly-mapbox.min.js +++ b/dist/plotly-mapbox.min.js @@ -1,37 +1,39 @@ /** -* plotly.js (mapbox - minified) v1.16.2 +* plotly.js (mapbox - minified) v1.16.3 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[o]={exports:{}};t[o][0].call(c.exports,function(e){var n=t[o][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o=0;a--)if(o[a]!=s[a])return!1;for(a=o.length-1;a>=0;a--)if(i=o[a],!l(t[i],e[i]))return!1;return!0}function f(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0:!1}function h(t,e,n,r){var i;d.isString(n)&&(r=n,n=null);try{e()}catch(a){i=a}if(r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&o(i,n,"Missing expected exception"+r),!t&&f(i,n)&&o(i,n,"Got unwanted exception"+r),t&&i&&n&&!f(i,n)||!t&&i)throw i}var d=t("util/"),p=Array.prototype.slice,m=Object.prototype.hasOwnProperty,g=e.exports=s;g.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=a(this),this.generatedMessage=!0);var e=t.stackStartFunction||o;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,i=e.name,s=r.indexOf("\n"+i);if(s>=0){var l=r.indexOf("\n",s+1);r=r.substring(l+1)}this.stack=r}}},d.inherits(g.AssertionError,Error),g.fail=o,g.ok=s,g.equal=function(t,e,n){t!=e&&o(t,e,n,"==",g.equal)},g.notEqual=function(t,e,n){t==e&&o(t,e,n,"!=",g.notEqual)},g.deepEqual=function(t,e,n){l(t,e)||o(t,e,n,"deepEqual",g.deepEqual)},g.notDeepEqual=function(t,e,n){l(t,e)&&o(t,e,n,"notDeepEqual",g.notDeepEqual)},g.strictEqual=function(t,e,n){t!==e&&o(t,e,n,"===",g.strictEqual)},g.notStrictEqual=function(t,e,n){t===e&&o(t,e,n,"!==",g.notStrictEqual)},g.throws=function(t,e,n){h.apply(this,[!0].concat(p.call(arguments)))},g.doesNotThrow=function(t,e){h.apply(this,[!1].concat(p.call(arguments)))},g.ifError=function(t){if(t)throw t};var v=Object.keys||function(t){var e=[];for(var n in t)m.call(t,n)&&e.push(n);return e}},{"util/":12}],7:[function(t,e,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function a(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!a(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,a,l,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[t],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(o(n))for(a=Array.prototype.slice.call(arguments,1),u=n.slice(),r=u.length,l=0;r>l;l++)u[l].apply(this,a);return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],a=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(n)){for(s=a;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],8:[function(t,e,n){"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 n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],9:[function(t,e,n){(function(t){function e(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!i;a--){var o=a>=0?arguments[a]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,i="/"===o.charAt(0))}return n=e(r(n.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(t){var i=n.isAbsolute(t),a="/"===o(t,-1);return t=e(r(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&a&&(t+="/"),(i?"/":"")+t},n.isAbsolute=function(t){return"/"===t.charAt(0)},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},n.relative=function(t,e){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),a=r(e.split("/")),o=Math.min(i.length,a.length),s=o,l=0;o>l;l++)if(i[l]!==a[l]){s=l;break}for(var u=[],l=s;le&&(e=t.length+e),t.substr(e,n)}}).call(this,t("_process"))},{_process:10}],10:[function(t,e,n){function r(){c=!1,s.length?u=s.concat(u):f=-1,u.length&&i()}function i(){if(!c){var t=setTimeout(r);c=!0;for(var e=u.length;e;){for(s=u,u=[];++f1)for(var n=1;n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(e)?r.showHidden=e:e&&n._extend(r,e),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),l(r,t,r.depth)}function a(t,e){var n=i.styles[e];return n?"["+i.colors[n][0]+"m"+t+"["+i.colors[n][1]+"m":t}function o(t,e){return t}function s(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function l(t,e,r){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(r,t);return x(i)||(i=l(t,i,r)),i}var a=u(t,e);if(a)return a;var o=Object.keys(e),m=s(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),S(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(T(e)){var g=e.name?": "+e.name:"";return t.stylize("[Function"+g+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(k(e))return t.stylize(Date.prototype.toString.call(e),"date");if(S(e))return c(e)}var v="",y=!1,_=["{","}"];if(p(e)&&(y=!0,_=["[","]"]),T(e)){var b=e.name?": "+e.name:"";v=" [Function"+b+"]"}if(w(e)&&(v=" "+RegExp.prototype.toString.call(e)),k(e)&&(v=" "+Date.prototype.toUTCString.call(e)),S(e)&&(v=" "+c(e)),0===o.length&&(!y||0==e.length))return _[0]+v+_[1];if(0>r)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?f(t,e,r,m,o):o.map(function(n){return h(t,e,r,m,n,y)}),t.seen.pop(),d(M,v,_)}function u(t,e){if(b(e))return t.stylize("undefined","undefined");if(x(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return y(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,n,r,i){for(var a=[],o=0,s=e.length;s>o;++o)I(e,String(o))?a.push(h(t,e,n,r,String(o),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(h(t,e,n,r,i,!0))}),a}function h(t,e,n,r,i,a){var o,s,u;if(u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},u.get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),I(r,i)||(o="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=g(n)?l(t,u.value,null):l(t,u.value,n-1),s.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")),b(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.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 d(t,e,n){var r=0,i=t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function p(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function g(t){return null===t}function v(t){return null==t}function y(t){return"number"==typeof t}function x(t){return"string"==typeof t}function _(t){return"symbol"==typeof t}function b(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===E(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===E(t)}function S(t){return M(t)&&("[object Error]"===E(t)||t instanceof Error)}function T(t){return"function"==typeof t}function A(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function E(t){return Object.prototype.toString.call(t)}function L(t){return 10>t?"0"+t.toString(10):t.toString(10)}function z(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var D=/%[sdj%]/g;n.format=function(t){if(!x(t)){for(var e=[],n=0;n=a)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return t}}),s=r[n];a>n;s=r[++n])o+=g(s)||!M(s)?" "+s:" "+i(s);return o},n.deprecate=function(t,i){function a(){if(!o){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),o=!0}return t.apply(this,arguments)}if(b(r.process))return function(){return n.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var o=!1;return a};var P,C={};n.debuglog=function(t){if(b(P)&&(P=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!C[t])if(new RegExp("\\b"+t+"\\b","i").test(P)){var r=e.pid;C[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else C[t]=function(){};return C[t]},n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=m,n.isNull=g,n.isNullOrUndefined=v,n.isNumber=y,n.isString=x,n.isSymbol=_,n.isUndefined=b,n.isRegExp=w,n.isObject=M,n.isDate=k,n.isError=S,n.isFunction=T,n.isPrimitive=A,n.isBuffer=t("./support/isBuffer");var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",z(),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!M(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":11,_process:10,inherits:8}],13:[function(e,n,r){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function r(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function a(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);i>r;){var a=r+i>>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);i>r;){var a=r+i>>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function f(){this._=Object.create(null)}function h(t){return(t+="")===Mo||t[0]===ko?ko+t:t}function d(t){return(t+="")[0]===ko?t.slice(1):t}function p(t){return h(t)in this._}function m(t){return(t=h(t))in this._&&delete this._[t]}function g(){var t=[];for(var e in this._)t.push(d(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function _(t){return t}function b(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=So.length;r>n;++n){var i=So[n]+e;if(i in t)return i}}function M(){}function k(){}function S(t){function e(){for(var e,r=n,i=-1,a=r.length;++in;n++)for(var i,a=t[n],o=0,s=a.length;s>o;o++)(i=a[o])&&e(i,o,n);return t}function G(t){return Ao(t,Co),t}function X(t){var e,n;return function(r,i,a){var o,s=t[a].update,l=s.length;for(a!=n&&(n=a,e=0),i>=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Oo.get(t);return u&&(t=u,l=J),s?e?i:r:e?M:a}function W(t,e){return function(n){var r=uo.event;uo.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=r}}}function J(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function $(t){var n=".dragsuppress-"+ ++Ro,i="click"+n,a=uo.select(r(t)).on("touchmove"+n,T).on("dragstart"+n,T).on("selectstart"+n,T);if(null==Fo&&(Fo="onselectstart"in t?!1:w(t.style,"userSelect")),Fo){var o=e(t).style,s=o[Fo];o[Fo]="none"}return function(t){if(a.on(n,null),Fo&&(o[Fo]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function Q(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();if(0>No){var a=r(t);if(a.scrollX||a.scrollY){n=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=n[0][0].getScreenCTM();No=!(o.f||o.e),n.remove()}}return No?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function K(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:0>t?-1:0}function et(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function nt(t){return t>1?0:-1>t?qo:Math.acos(t)}function rt(t){return t>1?Zo:-1>t?-Zo:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function at(t){return((t=Math.exp(t))+1/t)/2}function ot(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,n){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):Mt(""+t,kt,ut):new ut(t,e,n)}function ct(t,e,n){function r(t){return t>360?t-=360:0>t&&(t+=360),60>t?a+(o-a)*t/60:180>t?o:240>t?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*r(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:0>e?0:e>1?1:e,n=0>n?0:n>1?1:n,o=.5>=n?n*(1+e):n+e-n*e,a=2*n-o,new xt(i(t+120),i(t),i(t-120))}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?mt(t.l,t.a,t.b):mt((t=St((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,n)}function ht(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(n,Math.cos(t*=Ho)*e,Math.sin(t)*e)}function dt(t,e,n){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ft?ht(t.h,t.c,t.l):St((t=xt(t)).r,t.g,t.b):new dt(t,e,n)}function pt(t,e,n){var r=(t+16)/116,i=r+e/500,a=r-n/200;return i=gt(i)*ns,r=gt(r)*rs,a=gt(a)*is,new xt(yt(3.2404542*i-1.5371385*r-.4985314*a),yt(-.969266*i+1.8760108*r+.041556*a),yt(.0556434*i-.2040259*r+1.0572252*a))}function mt(t,e,n){return t>0?new ft(Math.atan2(n,e)*Go,Math.sqrt(e*e+n*n),t):new ft(NaN,NaN,t)}function gt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,n){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):Mt(""+t,xt,ct):new xt(t,e,n)}function _t(t){return new xt(t>>16,t>>8&255,255&t)}function bt(t){return _t(t)+""}function wt(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,n){var r,i,a,o=0,s=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(At(i[0]),At(i[1]),At(i[2]))}return(a=ss.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|o,s=240&a,s=s>>4|s,l=15&a,l=l<<4|l):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function kt(t,e,n){var r,i,a=Math.min(t/=255,e/=255,n/=255),o=Math.max(t,e,n),s=o-a,l=(o+a)/2;return s?(i=.5>l?s/(o+a):s/(2-o-a),r=t==o?(e-n)/s+(n>e?6:0):e==o?(n-t)/s+2:(t-e)/s+4,r*=60):(r=NaN,i=l>0&&1>l?0:r),new ut(r,i,l)}function St(t,e,n){t=Tt(t),e=Tt(e),n=Tt(n);var r=vt((.4124564*t+.3575761*e+.1804375*n)/ns),i=vt((.2126729*t+.7151522*e+.072175*n)/rs),a=vt((.0193339*t+.119192*e+.9503041*n)/is);return dt(116*i-16,500*(r-i),200*(i-a))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function At(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Et(t){return"function"==typeof t?t:function(){return t}}function Lt(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),zt(e,n,t,r)}}function zt(t,e,n,r){function i(){var t,e=l.status;if(!e&&Dt(l)||e>=200&&300>e||304===e){try{t=n.call(a,l)}catch(r){return void o.error.call(a,r)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=uo.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(a,l)}finally{uo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(u=t,a):u},a.response=function(t){return n=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(fo(arguments)))}}),a.send=function(n,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),l.open(n,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==r?null:r),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==r?a:a.get(It(r))}function It(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Dt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,n){var r=arguments.length;2>r&&(e=0),3>r&&(n=Date.now());var i=n+e,a={c:t,t:i,n:null};return us?us.n=a:ls=a,us=a,cs||(fs=clearTimeout(fs),cs=1,hs(Ct)),a}function Ct(){var t=Ot(),e=Ft()-t;e>24?(isFinite(e)&&(clearTimeout(fs),fs=setTimeout(Ct,e)),cs=0):(cs=1,hs(Ct))}function Ot(){for(var t=Date.now(),e=ls;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ft(){for(var t,e=ls,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function jt(t){var e=t.decimal,n=t.thousands,r=t.grouping,i=t.currency,a=r&&n?function(t,e){for(var i=t.length,a=[],o=0,s=r[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=r[o=(o+1)%r.length];return a.reverse().join(n)}:_;return function(t){var n=ps.exec(t),r=n[1]||" ",o=n[2]||">",s=n[3]||"-",l=n[4]||"",u=n[5],c=+n[6],f=n[7],h=n[8],d=n[9],p=1,m="",g="",v=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===r&&"="===o)&&(u=r="0",o="="),d){case"n":f=!0,d="g";break;case"%":p=100,g="%",d="f";break;case"p":p=100,g="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],g=i[1]),"r"!=d||h||(d="g"),null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):"e"!=d&&"f"!=d||(h=Math.max(0,Math.min(20,h)))),d=ms.get(d)||Bt;var x=u&&f;return function(t){var n=g;if(v&&t%1)return"";var i=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===s?"":s;if(0>p){var l=uo.formatPrefix(t,h);t=l.scale(t),n=l.symbol+g}else t*=p;t=d(t,h);var _,b,w=t.lastIndexOf(".");if(0>w){var M=y?t.lastIndexOf("e"):-1;0>M?(_=t,b=""):(_=t.substring(0,M),b=t.substring(M))}else _=t.substring(0,w),b=e+t.substring(w+1);!u&&f&&(_=a(_,1/0));var k=m.length+_.length+b.length+(x?0:i.length),S=c>k?new Array(k=c-k+1).join(r):"";return x&&(_=a(S+_,S.length?c-b.length:1/0)),i+=m,t=_+b,("<"===o?i+t+S:">"===o?S+i+t:"^"===o?S.substring(0,k>>=1)+i+t+S.substring(k):i+(x?t:S+t))+n}}}function Bt(t){return t+""}function qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,n){function r(e){var n=t(e),r=a(n,1);return r-e>e-n?n:r}function i(n){return e(n=t(new vs(n-1)),1),n}function a(t,n){return e(t=new vs(+t),n),t}function o(t,r,a){var o=i(t),s=[];if(a>1)for(;r>o;)n(o)%a||s.push(new Date(+o)),e(o,1);else for(;r>o;)s.push(new Date(+o)),e(o,1);return s}function s(t,e,n){try{vs=qt;var r=new qt;return r._=t,o(r,e,n)}finally{vs=Date}}t.floor=t,t.round=r,t.ceil=i,t.offset=a,t.range=o;var l=t.utc=Ut(t);return l.floor=l,l.round=Ut(r),l.ceil=Ut(i),l.offset=Ut(a),l.range=s,t}function Ut(t){return function(e,n){try{vs=qt;var r=new qt;return r._=e,t(r,n)._}finally{vs=Date}}}function Zt(t){function e(t){function e(e){for(var n,i,a,o=[],s=-1,l=0;++ss;){if(r>=u)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=L[o in xs?e.charAt(s++):o],!a||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){w.lastIndex=0;var r=w.exec(e.slice(n));return r?(t.w=M.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){_.lastIndex=0;var r=_.exec(e.slice(n));return r?(t.w=b.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){k.lastIndex=0;var r=k.exec(e.slice(n));return r?(t.m=S.get(r[0].toLowerCase()),n+r[0].length):-1}function s(t,e,r){return n(t,E.c.toString(),e,r)}function l(t,e,r){return n(t,E.x.toString(),e,r)}function u(t,e,r){return n(t,E.X.toString(),e,r)}function c(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,h=t.date,d=t.time,p=t.periods,m=t.days,g=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{vs=qt;var e=new vs;return e._=t,r(e)}finally{vs=Date}}var r=e(t);return n.parse=function(t){try{vs=qt;var e=r.parse(t);return e&&e._}finally{vs=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ce;var x=uo.map(),_=Gt(m),b=Xt(m),w=Gt(g),M=Xt(g),k=Gt(v),S=Xt(v),T=Gt(y),A=Xt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var E={a:function(t){return g[t.getDay()]},A:function(t){return m[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Ht(t.getDate(),e,2)},e:function(t,e){return Ht(t.getDate(),e,2)},H:function(t,e){return Ht(t.getHours(),e,2)},I:function(t,e){return Ht(t.getHours()%12||12,e,2)},j:function(t,e){return Ht(1+gs.dayOfYear(t),e,3)},L:function(t,e){return Ht(t.getMilliseconds(),e,3)},m:function(t,e){return Ht(t.getMonth()+1,e,2)},M:function(t,e){return Ht(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Ht(t.getSeconds(),e,2)},U:function(t,e){return Ht(gs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ht(gs.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return Ht(t.getFullYear()%100,e,2)},Y:function(t,e){return Ht(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},L={a:r,A:i,b:a,B:o,c:s,d:ne,e:ne,H:ie,I:ie,j:re,L:se,m:ee,M:ae,p:c,S:oe,U:Wt,w:Yt,W:Jt,x:l,X:u,y:Qt,Y:$t,Z:Kt,"%":ue};return e}function Ht(t,e,n){var r=0>t?"-":"",i=(r?-t:t)+"",a=i.length;return r+(n>a?new Array(n-a+1).join(e)+i:i)}function Gt(t){return new RegExp("^(?:"+t.map(uo.requote).join("|")+")","i")}function Xt(t){for(var e=new f,n=-1,r=t.length;++n68?1900:2e3)}function ee(t,e,n){_s.lastIndex=0;var r=_s.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){_s.lastIndex=0;var r=_s.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){_s.lastIndex=0;var r=_s.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ie(t,e,n){_s.lastIndex=0;var r=_s.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ae(t,e,n){_s.lastIndex=0;var r=_s.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function oe(t,e,n){_s.lastIndex=0;var r=_s.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function se(t,e,n){_s.lastIndex=0;var r=_s.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function le(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=wo(e)/60|0,i=wo(e)%60;return n+Ht(r,"0",2)+Ht(i,"0",2)}function ue(t,e,n){bs.lastIndex=0;var r=bs.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ce(t){for(var e=t.length,n=-1;++n=0?1:-1,s=o*n,l=Math.cos(e),u=Math.sin(e),c=a*u,f=i*l+c*Math.cos(s),h=c*o*Math.sin(s);As.add(Math.atan2(h,f)),r=t,i=l,a=u}var e,n,r,i,a;Es.point=function(o,s){Es.point=t,r=(e=o)*Ho,i=Math.cos(s=(n=s)*Ho/2+qo/4),a=Math.sin(s)},Es.lineEnd=function(){t(e,n)}}function ve(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 _e(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function be(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),rt(t[2])]}function ke(t,e){return wo(t[0]-e[0])s;++s)i.point((n=t[s])[0],n[1]);return void i.lineEnd()}var l=new Ce(n,t,null,!0),u=new Ce(n,null,l,!1);l.o=u,a.push(l),o.push(u),l=new Ce(r,t,null,!1),u=new Ce(r,null,l,!0),l.o=u,a.push(l),o.push(u)}}),o.sort(e),Pe(a),Pe(o),a.length){for(var s=0,l=n,u=o.length;u>s;++s)o[s].e=l=!l;for(var c,f,h=a[0];;){for(var d=h,p=!0;d.v;)if((d=d.n)===h)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(var s=0,u=c.length;u>s;++s)i.point((f=c[s])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(p){c=d.p.z;for(var s=c.length-1;s>=0;--s)i.point((f=c[s])[0],f[1])}else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r0){for(b||(a.polygonStart(),b=!0),a.lineStart();++o1&&2&e&&n.push(n.pop().concat(n.shift())),d.push(n.filter(Fe))}var d,p,m,g=e(a),v=i.invert(r[0],r[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=f,y.lineEnd=h,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=Ve(v,p);d.length?(b||(a.polygonStart(),b=!0),De(d,Ne,t,n,a)):t&&(b||(a.polygonStart(),b=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),b&&(a.polygonEnd(),b=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}},x=Re(),_=e(x),b=!1;return y}}function Fe(t){return t.length>1}function Re(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:M,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Ne(t,e){return((t=t.x)[0]<0?t[1]-Zo-jo:Zo-t[1])-((e=e.x)[0]<0?e[1]-Zo-jo:Zo-e[1])}function je(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?qo:-qo,l=wo(a-n);wo(l-qo)0?Zo:-Zo),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(a,r),e=0):i!==s&&l>=qo&&(wo(n-i)jo?Math.atan((Math.sin(e)*(a=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+r)/2}function qe(t,e,n,r){var i;if(null==t)i=n*Zo,r.point(-qo,i),r.point(0,i),r.point(qo,i),r.point(qo,0),r.point(qo,-i),r.point(0,-i),r.point(-qo,-i),r.point(-qo,0),r.point(-qo,i);else if(wo(t[0]-e[0])>jo){var a=t[0]s;++s){var u=e[s],c=u.length;if(c)for(var f=u[0],h=f[0],d=f[1]/2+qo/4,p=Math.sin(d),m=Math.cos(d),g=1;;){g===c&&(g=0),t=u[g];var v=t[0],y=t[1]/2+qo/4,x=Math.sin(y),_=Math.cos(y),b=v-h,w=b>=0?1:-1,M=w*b,k=M>qo,S=p*x;if(As.add(Math.atan2(S*w*Math.sin(M),m*_+S*Math.cos(M))),a+=k?b+w*Vo:b,k^h>=n^v>=n){var T=xe(ve(f),ve(t));we(T);var A=xe(i,T);we(A);var E=(k^b>=0?-1:1)*rt(A[2]);(r>E||r===E&&(T[0]||T[1]))&&(o+=k^b>=0?1:-1)}if(!g++)break;h=v,p=x,m=_,f=t}}return(-jo>a||jo>a&&0>As)^1&o}function Ue(t){function e(t,e){return Math.cos(t)*Math.cos(e)>a}function n(t){var n,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],m=e(f,h),g=o?m?0:i(f,h):m?i(f+(0>f?qo:-qo),h):0;if(!n&&(u=l=m)&&t.lineStart(),m!==l&&(d=r(n,p),(ke(n,d)||ke(p,d))&&(p[0]+=jo,p[1]+=jo,m=e(p[0],p[1]))),m!==l)c=0,m?(t.lineStart(),d=r(p,n),t.point(d[0],d[1])):(d=r(n,p),t.point(d[0],d[1]),t.lineEnd()),n=d;else if(s&&n&&o^m){var v;g&a||!(v=r(p,n,!0))||(c=0,o?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!m||n&&ke(n,p)||t.point(p[0],p[1]),n=p,l=m,a=g},lineEnd:function(){l&&t.lineEnd(),n=null},clean:function(){return c|(u&&l)<<1}}}function r(t,e,n){var r=ve(t),i=ve(e),o=[1,0,0],s=xe(r,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!n&&t;var f=a*l/c,h=-a*u/c,d=xe(o,s),p=be(o,f),m=be(s,h);_e(p,m);var g=d,v=ye(p,g),y=ye(g,g),x=v*v-y*(ye(p,p)-1);if(!(0>x)){var _=Math.sqrt(x),b=be(g,(-v-_)/y);if(_e(b,p),b=Me(b),!n)return b;var w,M=t[0],k=e[0],S=t[1],T=e[1];M>k&&(w=M,M=k,k=w);var A=k-M,E=wo(A-qo)A;if(!E&&S>T&&(w=S,S=T,T=w),L?E?S+T>0^b[1]<(wo(b[0]-M)qo^(M<=b[0]&&b[0]<=k)){var z=be(g,(-v+_)/y);return _e(z,p),[b,Me(z)]}}}function i(e,n){var r=o?t:qo-t,i=0;return-r>e?i|=1:e>r&&(i|=2),-r>n?i|=4:n>r&&(i|=8),i}var a=Math.cos(t),o=a>0,s=wo(a)>jo,l=vn(t,6*Ho);return Oe(e,n,l,o?[0,-t]:[-qo,t-qo])}function Ze(t,e,n,r){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,m=f-u;if(a=t-l,p||!(a>0)){if(a/=p,0>p){if(h>a)return;d>a&&(d=a)}else if(p>0){if(a>d)return;a>h&&(h=a)}if(a=n-l,p||!(0>a)){if(a/=p,0>p){if(a>d)return;a>h&&(h=a)}else if(p>0){if(h>a)return;d>a&&(d=a)}if(a=e-u,m||!(a>0)){if(a/=m,0>m){if(h>a)return;d>a&&(d=a)}else if(m>0){if(a>d)return;a>h&&(h=a)}if(a=r-u,m||!(0>a)){if(a/=m,0>m){if(a>d)return;a>h&&(h=a)}else if(m>0){if(h>a)return;d>a&&(d=a)}return h>0&&(i.a={x:l+h*p,y:u+h*m}),1>d&&(i.b={x:l+d*p,y:u+d*m}),i}}}}}}function He(t,e,n,r){function i(r,i){return wo(r[0]-t)0?0:3:wo(r[0]-n)0?2:1:wo(r[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var n=i(t,1),r=i(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,n=g.length,r=t[1],i=0;n>i;++i)for(var a,o=1,s=g[i],l=s.length,u=s[0];l>o;++o)a=s[o],u[1]<=r?a[1]>r&&et(u,a,t)>0&&++e:a[1]<=r&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,f=0;if(null==a||(c=i(a,l))!==(f=i(s,l))||o(a,s)<0^l>0){do u.point(0===c||3===c?t:n,c>1?r:e);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(i,a){return i>=t&&n>=i&&a>=e&&r>=a}function f(t,e){c(t,e)&&s.point(t,e)}function h(){L.point=p,g&&g.push(v=[]),k=!0,M=!1,b=w=NaN}function d(){m&&(p(y,x),_&&M&&A.rejoin(),m.push(A.buffer())),L.point=f,M&&s.lineEnd()}function p(t,e){t=Math.max(-Vs,Math.min(Vs,t)),e=Math.max(-Vs,Math.min(Vs,e));var n=c(t,e);if(g&&v.push([t,e]),k)y=t,x=e,_=n,k=!1,n&&(s.lineStart(),s.point(t,e));else if(n&&M)s.point(t,e);else{var r={a:{x:b,y:w},b:{x:t,y:e}};E(r)?(M||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),n||s.lineEnd(),S=!1):n&&(s.lineStart(),s.point(t,e),S=!1)}b=t,w=e,M=n}var m,g,v,y,x,_,b,w,M,k,S,T=s,A=Re(),E=Ze(t,e,n,r),L={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=A,m=[],g=[],S=!0},polygonEnd:function(){s=T,m=uo.merge(m);var e=l([t,r]),n=S&&e,i=m.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&De(m,a,e,u,s),s.polygonEnd()),m=g=v=null}};return L}}function Ge(t){var e=0,n=qo/3,r=un(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*qo/180,n=t[1]*qo/180):[e/qo*180,n/qo*180]},i}function Xe(t,e){function n(t,e){var n=Math.sqrt(a-2*i*Math.sin(e))/i;return[n*Math.sin(t*=i),o-n*Math.cos(t)]}var r=Math.sin(t),i=(r+Math.sin(e))/2,a=1+r*(2*i-r),o=Math.sqrt(a)/i;return n.invert=function(t,e){var n=o-e;return[Math.atan2(t,n)/i,rt((a-(t*t+n*n)*i*i)/(2*i))]},n}function Ye(){function t(t,e){Zs+=i*t-r*e,r=t,i=e}var e,n,r,i;Ws.point=function(a,o){Ws.point=t,e=r=a,n=i=o},Ws.lineEnd=function(){t(e,n)}}function We(t,e){Hs>t&&(Hs=t),t>Xs&&(Xs=t),Gs>e&&(Gs=e),e>Ys&&(Ys=e)}function Je(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=n}function n(t,e){o.push("L",t,",",e)}function r(){s.point=t}function i(){o.push("Z")}var a=$e(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:r,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=r,s.point=t},pointRadius:function(t){return a=$e(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Qe(t,e){Is+=t,Ds+=e,++Ps}function Ke(){function t(t,r){var i=t-e,a=r-n,o=Math.sqrt(i*i+a*a);Cs+=o*(e+t)/2,Os+=o*(n+r)/2,Fs+=o,Qe(e=t,n=r)}var e,n;$s.point=function(r,i){$s.point=t,Qe(e=r,n=i)}}function tn(){$s.point=Qe}function en(){function t(t,e){var n=t-r,a=e-i,o=Math.sqrt(n*n+a*a);Cs+=o*(r+t)/2,Os+=o*(i+e)/2,Fs+=o,o=i*t-r*e,Rs+=o*(r+t),Ns+=o*(i+e),js+=3*o,Qe(r=t,i=e)}var e,n,r,i;$s.point=function(a,o){$s.point=t,Qe(e=r=a,n=i=o)},$s.lineEnd=function(){t(e,n)}}function nn(t){function e(e,n){t.moveTo(e+o,n),t.arc(e,n,o,0,Vo)}function n(e,n){t.moveTo(e,n),s.point=r}function r(e,n){t.lineTo(e,n)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=n},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:M};return s}function rn(t){function e(t){return(s?r:n)(t)}function n(e){return sn(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,k.point=a,e.lineStart()}function a(n,r){var a=ve([n,r]),o=t(n,r);i(x,_,y,b,w,M,x=o[0],_=o[1],y=n,b=a[0],w=a[1],M=a[2],s,e),e.point(x,_)}function o(){k.point=n,e.lineEnd()}function l(){r(),k.point=u,k.lineEnd=c}function u(t,e){a(f=t,h=e),d=x,p=_,m=b,g=w,v=M,k.point=a}function c(){i(x,_,y,b,w,M,d,p,f,m,g,v,s,e),k.lineEnd=o,o()}var f,h,d,p,m,g,v,y,x,_,b,w,M,k={point:n,lineStart:r,lineEnd:o,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=r}};return k}function i(e,n,r,s,l,u,c,f,h,d,p,m,g,v){var y=c-e,x=f-n,_=y*y+x*x;if(_>4*a&&g--){var b=s+d,w=l+p,M=u+m,k=Math.sqrt(b*b+w*w+M*M),S=Math.asin(M/=k),T=wo(wo(M)-1)a||wo((y*z+x*I)/_-.5)>.3||o>s*d+l*p+u*m)&&(i(e,n,r,s,l,u,E,L,T,b/=k,w/=k,M,g,v),v.point(E,L),i(E,L,T,b,w,M,c,f,h,d,p,m,g,v))}}var a=.5,o=Math.cos(30*Ho),s=16;return e.precision=function(t){return arguments.length?(s=(a=t*t)>0&&16,e):Math.sqrt(a)},e}function an(t){var e=rn(function(e,n){return t([e*Go,n*Go])});return function(t){return cn(e(t))}}function on(t){this.stream=t}function sn(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 ln(t){return un(function(){return t})()}function un(t){function e(t){return t=s(t[0]*Ho,t[1]*Ho),[t[0]*h+l,u-t[1]*h]}function n(t){return t=s.invert((t[0]-l)/h,(u-t[1])/h),t&&[t[0]*Go,t[1]*Go]}function r(){s=ze(o=dn(v,y,x),a);var t=a(m,g);return l=d-t[0]*h,u=p+t[1]*h,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,f=rn(function(t,e){return t=a(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,m=0,g=0,v=0,y=0,x=0,b=qs,w=_,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=cn(b(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(b=null==t?(M=t,qs):Ue((M=+t)*Ho),i()):M},e.clipExtent=function(t){return arguments.length?(k=t,w=t?He(t[0][0],t[0][1],t[1][0],t[1][1]):_,i()):k},e.scale=function(t){return arguments.length?(h=+t,r()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],r()):[d,p]},e.center=function(t){return arguments.length?(m=t[0]%360*Ho,g=t[1]%360*Ho,r()):[m*Go,g*Go]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Ho,y=t[1]%360*Ho,x=t.length>2?t[2]%360*Ho:0,r()):[v*Go,y*Go,x*Go]},uo.rebind(e,f,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&n,r()}}function cn(t){return sn(t,function(e,n){t.point(e*Ho,n*Ho)})}function fn(t,e){return[t,e]}function hn(t,e){return[t>qo?t-Vo:-qo>t?t+Vo:t,e]}function dn(t,e,n){return t?e||n?ze(mn(t),gn(e,n)):mn(t):e||n?gn(e,n):hn}function pn(t){return function(e,n){return e+=t,[e>qo?e-Vo:-qo>e?e+Vo:e,n]}}function mn(t){var e=pn(t);return e.invert=pn(-t),e}function gn(t,e){function n(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*r+s*i;return[Math.atan2(l*a-c*o,s*r-u*i),rt(c*a+l*o)]}var r=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*a-l*o;return[Math.atan2(l*a+u*o,s*r+c*i),rt(c*r-s*i)]},n}function vn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=yn(n,i),a=yn(n,a),(o>0?a>i:i>a)&&(i+=o*Vo)):(i=t+o*Vo,a=t-.5*l);for(var u,c=i;o>0?c>a:a>c;c-=l)s.point((u=Me([n,-r*Math.cos(c),-r*Math.sin(c)]))[0],u[1])}}function yn(t,e){var n=ve(e);n[0]-=t,we(n);var r=nt(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-jo)%(2*Math.PI)}function xn(t,e,n){var r=uo.range(t,e-jo,n).concat(e);return function(t){ -return r.map(function(e){return[t,e]})}}function _n(t,e,n){var r=uo.range(t,e-jo,n).concat(e);return function(t){return r.map(function(e){return[e,t]})}}function bn(t){return t.source}function wn(t){return t.target}function Mn(t,e,n,r){var i=Math.cos(e),a=Math.sin(e),o=Math.cos(r),s=Math.sin(r),l=i*Math.cos(t),u=i*Math.sin(t),c=o*Math.cos(n),f=o*Math.sin(n),h=2*Math.asin(Math.sqrt(st(r-e)+i*o*st(n-t))),d=1/Math.sin(h),p=h?function(t){var e=Math.sin(t*=h)*d,n=Math.sin(h-t)*d,r=n*l+e*c,i=n*u+e*f,o=n*a+e*s;return[Math.atan2(i,r)*Go,Math.atan2(o,Math.sqrt(r*r+i*i))*Go]}:function(){return[t*Go,e*Go]};return p.distance=h,p}function kn(){function t(t,i){var a=Math.sin(i*=Ho),o=Math.cos(i),s=wo((t*=Ho)-e),l=Math.cos(s);Qs+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*a-n*o*l)*s),n*a+r*o*l),e=t,n=a,r=o}var e,n,r;Ks.point=function(i,a){e=i*Ho,n=Math.sin(a*=Ho),r=Math.cos(a),Ks.point=t},Ks.lineEnd=function(){Ks.point=Ks.lineEnd=M}}function Sn(t,e){function n(e,n){var r=Math.cos(e),i=Math.cos(n),a=t(r*i);return[a*i*Math.sin(e),a*Math.sin(n)]}return n.invert=function(t,n){var r=Math.sqrt(t*t+n*n),i=e(r),a=Math.sin(i),o=Math.cos(i);return[Math.atan2(t*a,r*o),Math.asin(r&&n*a/r)]},n}function Tn(t,e){function n(t,e){o>0?-Zo+jo>e&&(e=-Zo+jo):e>Zo-jo&&(e=Zo-jo);var n=o/Math.pow(i(e),a);return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),i=function(t){return Math.tan(qo/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(i(e)/i(t)),o=r*Math.pow(i(t),a)/a;return a?(n.invert=function(t,e){var n=o-e,r=tt(a)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/a,2*Math.atan(Math.pow(o/r,1/a))-Zo]},n):En}function An(t,e){function n(t,e){var n=a-e;return[n*Math.sin(i*t),a-n*Math.cos(i*t)]}var r=Math.cos(t),i=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/i+t;return wo(i)i;i++){for(;r>1&&et(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function Cn(t,e){return t[0]-e[0]||t[1]-e[1]}function On(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function Fn(t,e,n,r){var i=t[0],a=n[0],o=e[0]-i,s=r[0]-a,l=t[1],u=n[1],c=e[1]-l,f=r[1]-u,h=(s*(l-u)-f*(i-a))/(f*o-s*c);return[i+h*o,l+h*c]}function Rn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function Nn(){ar(this),this.edge=this.site=this.circle=null}function jn(t){var e=fl.pop()||new Nn;return e.site=t,e}function Bn(t){Jn(t),ll.remove(t),fl.push(t),ar(t)}function qn(t){var e=t.circle,n=e.x,r=e.cy,i={x:n,y:r},a=t.P,o=t.N,s=[t];Bn(t);for(var l=a;l.circle&&wo(n-l.circle.x)c;++c)u=s[c],l=s[c-1],nr(u.edge,l.site,u.site,i);l=s[0],u=s[f-1],u.edge=tr(l.site,u.site,null,i),Wn(l),Wn(u)}function Vn(t){for(var e,n,r,i,a=t.x,o=t.y,s=ll._;s;)if(r=Un(s,o)-a,r>jo)s=s.L;else{if(i=a-Zn(s,o),!(i>jo)){r>-jo?(e=s.P,n=s):i>-jo?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}var l=jn(t);if(ll.insert(e,l),e||n){if(e===n)return Jn(e),n=jn(e.site),ll.insert(l,n),l.edge=n.edge=tr(e.site,l.site),Wn(e),void Wn(n);if(!n)return void(l.edge=tr(e.site,l.site));Jn(e),Jn(n);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=n.site,m=p.x-c,g=p.y-f,v=2*(h*g-d*m),y=h*h+d*d,x=m*m+g*g,_={x:(g*y-d*x)/v+c,y:(h*x-m*y)/v+f};nr(n.edge,u,p,_),l.edge=tr(u,t,null,_),n.edge=tr(t,p,null,_),Wn(e),Wn(n)}}function Un(t,e){var n=t.site,r=n.x,i=n.y,a=i-e;if(!a)return r;var o=t.P;if(!o)return-(1/0);n=o.site;var s=n.x,l=n.y,u=l-e;if(!u)return s;var c=s-r,f=1/a-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-a/2)))/f+r:(r+s)/2}function Zn(t,e){var n=t.N;if(n)return Un(n,e);var r=t.site;return r.y===e?r.x:1/0}function Hn(t){this.site=t,this.edges=[]}function Gn(t){for(var e,n,r,i,a,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],m=sl,g=m.length;g--;)if(a=m[g],a&&a.prepare())for(s=a.edges,l=s.length,o=0;l>o;)c=s[o].end(),r=c.x,i=c.y,u=s[++o%l].start(),e=u.x,n=u.y,(wo(r-e)>jo||wo(i-n)>jo)&&(s.splice(o,0,new rr(er(a.site,c,wo(r-f)jo?{x:f,y:wo(e-f)jo?{x:wo(n-p)jo?{x:h,y:wo(e-h)jo?{x:wo(n-d)=-Bo)){var d=l*l+u*u,p=c*c+f*f,m=(f*d-u*p)/h,g=(l*p-c*d)/h,f=g+s,v=hl.pop()||new Yn;v.arc=t,v.site=i,v.x=m+o,v.y=f+Math.sqrt(m*m+g*g),v.cy=f,t.circle=v;for(var y=null,x=cl._;x;)if(v.yg||g>=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:g,y:l};n={x:g,y:u}}else{if(a){if(a.yr||r>1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/r,y:l};n={x:(u-i)/r,y:u}}else{if(a){if(a.yd){if(a){if(a.x>=s)return}else a={x:o,y:r*o+i};n={x:s,y:r*s+i}}else{if(a){if(a.xa||f>o||r>h||i>d)){if(p=t.point){var p,m=e-t.x,g=n-t.y,v=m*m+g*g;if(l>v){var y=Math.sqrt(l=v);r=e-y,i=n-y,a=e+y,o=n+y,s=p}}for(var x=t.nodes,_=.5*(c+h),b=.5*(f+d),w=e>=_,M=n>=b,k=M<<1|w,S=k+4;S>k;++k)if(t=x[3&k])switch(3&k){case 0:u(t,c,f,_,b);break;case 1:u(t,_,f,h,b);break;case 2:u(t,c,b,_,d);break;case 3:u(t,_,b,h,d)}}}(t,r,i,a,o),s}function vr(t,e){t=uo.rgb(t),e=uo.rgb(e);var n=t.r,r=t.g,i=t.b,a=e.r-n,o=e.g-r,s=e.b-i;return function(t){return"#"+wt(Math.round(n+a*t))+wt(Math.round(r+o*t))+wt(Math.round(i+s*t))}}function yr(t,e){var n,r={},i={};for(n in t)n in e?r[n]=br(t[n],e[n]):i[n]=t[n];for(n in e)n in t||(i[n]=e[n]);return function(t){for(n in r)i[n]=r[n](t);return i}}function xr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function _r(t,e){var n,r,i,a=pl.lastIndex=ml.lastIndex=0,o=-1,s=[],l=[];for(t+="",e+="";(n=pl.exec(t))&&(r=ml.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:xr(n,r)})),a=ml.lastIndex;return ar;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function br(t,e){for(var n,r=uo.interpolators.length;--r>=0&&!(n=uo.interpolators[r](t,e)););return n}function wr(t,e){var n,r=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(n=0;s>n;++n)r.push(br(t[n],e[n]));for(;a>n;++n)i[n]=t[n];for(;o>n;++n)i[n]=e[n];return function(t){for(n=0;s>n;++n)i[n]=r[n](t);return i}}function Mr(t){return function(e){return 0>=e?0:e>=1?1:t(e)}}function kr(t){return function(e){return 1-t(1-e)}}function Sr(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}}function Tr(t){return t*t}function Ar(t){return t*t*t}function Er(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(.5>t?n:3*(t-e)+n-.75)}function Lr(t){return function(e){return Math.pow(e,t)}}function zr(t){return 1-Math.cos(t*Zo)}function Ir(t){return Math.pow(2,10*(t-1))}function Dr(t){return 1-Math.sqrt(1-t*t)}function Pr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/Vo*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Vo/e)}}function Cr(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Or(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Fr(t,e){t=uo.hcl(t),e=uo.hcl(e);var n=t.h,r=t.c,i=t.l,a=e.h-n,o=e.c-r,s=e.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?e.c:r),isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:-180>a&&(a+=360),function(t){return ht(n+a*t,r+o*t,i+s*t)+""}}function Rr(t,e){t=uo.hsl(t),e=uo.hsl(e);var n=t.h,r=t.s,i=t.l,a=e.h-n,o=e.s-r,s=e.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?e.s:r),isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:-180>a&&(a+=360),function(t){return ct(n+a*t,r+o*t,i+s*t)+""}}function Nr(t,e){t=uo.lab(t),e=uo.lab(e);var n=t.l,r=t.a,i=t.b,a=e.l-n,o=e.a-r,s=e.b-i;return function(t){return pt(n+a*t,r+o*t,i+s*t)+""}}function jr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function Br(t){var e=[t.a,t.b],n=[t.c,t.d],r=Vr(e),i=qr(e,n),a=Vr(Ur(n,e,-i))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Zr(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Zr(n)+"rotate("+e+")")}function Xr(t,e,n,r){t!==e?r.push({i:n.push(Zr(n)+"skewX(",null,")")-2,x:xr(t,e)}):e&&n.push(Zr(n)+"skewX("+e+")")}function Yr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var i=n.push(Zr(n)+"scale(",null,",",null,")");r.push({i:i-4,x:xr(t[0],e[0])},{i:i-2,x:xr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Zr(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=uo.transform(t),e=uo.transform(e),Hr(t.translate,e.translate,n,r),Gr(t.rotate,e.rotate,n,r),Xr(t.skew,e.skew,n,r),Yr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,i=-1,a=r.length;++i=0;)n.push(i[r])}function li(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++on;++n)(e=t[n][1])>i&&(r=n,i=e);return r}function xi(t){return t.reduce(_i,0)}function _i(t,e){return t+e[1]}function bi(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var n=-1,r=+t[0],i=(t[1]-r)/e,a=[];++n<=e;)a[n]=i*n+r;return a}function Mi(t){return[uo.min(t),uo.max(t)]}function ki(t,e){return t.value-e.value}function Si(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ai(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return.999*i*i>n*n+r*r}function Ei(t){function e(t){c=Math.min(t.x-t.r,c),f=Math.max(t.x+t.r,f),h=Math.min(t.y-t.r,h),d=Math.max(t.y+t.r,d)}if((n=t.children)&&(u=n.length)){var n,r,i,a,o,s,l,u,c=1/0,f=-(1/0),h=1/0,d=-(1/0);if(n.forEach(Li),r=n[0],r.x=-r.r,r.y=0,e(r),u>1&&(i=n[1],i.x=i.r,i.y=0,e(i),u>2))for(a=n[2],Di(r,i,a),e(a),Si(r,a),r._pack_prev=a,Si(a,i),i=r._pack_next,o=3;u>o;o++){Di(r,i,a=n[o]);var p=0,m=1,g=1;for(s=i._pack_next;s!==i;s=s._pack_next,m++)if(Ai(s,a)){p=1;break}if(1==p)for(l=r._pack_prev;l!==s._pack_prev&&!Ai(l,a);l=l._pack_prev,g++);p?(g>m||m==g&&i.ro;o++)a=n[o],a.x-=v,a.y-=y,x=Math.max(x,a.r+Math.sqrt(a.x*a.x+a.y*a.y));t.r=x,n.forEach(zi)}}function Li(t){t._pack_next=t._pack_prev=t}function zi(t){delete t._pack_next,delete t._pack_prev}function Ii(t,e,n,r){var i=t.children;if(t.x=e+=r*t.x,t.y=n+=r*t.y,t.r*=r,i)for(var a=-1,o=i.length;++a=0;)e=i[a],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function Ni(t,e,n){return t.a.parent===e.parent?t.a:n}function ji(t){return 1+uo.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function qi(t){var e=t.children;return e&&e.length?qi(e[0]):t}function Vi(t){var e,n=t.children;return n&&(e=n.length)?Vi(n[e-1]):t}function Ui(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Zi(t,e){var n=t.x+e[3],r=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return 0>i&&(n+=i/2,i=0),0>a&&(r+=a/2,a=0),{x:n,y:r,dx:i,dy:a}}function Hi(t){var e=t[0],n=t[t.length-1];return n>e?[e,n]:[n,e]}function Gi(t){return t.rangeExtent?t.rangeExtent():Hi(t.range())}function Xi(t,e,n,r){var i=n(t[0],t[1]),a=r(e[0],e[1]);return function(t){return a(i(t))}}function Yi(t,e){var n,r=0,i=t.length-1,a=t[r],o=t[i];return a>o&&(n=r,r=i,i=n,n=a,a=o,o=n),t[r]=e.floor(a),t[i]=e.ceil(o),t}function Wi(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:Tl}function Ji(t,e,n,r){var i=[],a=[],o=0,s=Math.min(t.length,e.length)-1;for(t[s]2?Ji:Xi,l=r?$r:Jr;return o=i(t,e,l,n),s=i(e,t,l,br),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(jr)},a.clamp=function(t){return arguments.length?(r=t,i()):r},a.interpolate=function(t){return arguments.length?(n=t,i()):n},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,n){return na(t,e,n)},a.nice=function(e){return Ki(t,e),i()},a.copy=function(){return $i(t,e,n,r)},i()}function Qi(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ki(t,e){return Yi(t,Wi(ta(t,e)[2])),Yi(t,Wi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var n=Hi(t),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),a=e/r*i;return.15>=a?i*=10:.35>=a?i*=5:.75>=a&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+.5*i,n[2]=i,n}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function na(t,e,n){var r=ta(t,e);if(n){var i=ps.exec(n);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(wo(r[0]),wo(r[1])));return i[7]||(i[7]="."+ra(a.scale(r[2]))),i[8]="f",n=uo.format(i.join("")),function(t){return n(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],r)),n=i.join("")}else n=",."+ra(r[2])+"f";return uo.format(n)}function ra(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var n=ra(e[2]);return t in Al?Math.abs(n-ra(Math.max(wo(e[0]),wo(e[1]))))+ +("e"!==t):n-2*("%"===t)}function aa(t,e,n,r){function i(t){return(n?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(i)),o):r},o.base=function(n){return arguments.length?(e=+n,t.domain(r.map(i)),o):e},o.nice=function(){var e=Yi(r.map(i),n?Math:Ll);return t.domain(e),r=e.map(a),o},o.ticks=function(){var t=Hi(r),o=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(c-u)){if(n){for(;c>u;u++)for(var h=1;f>h;h++)o.push(a(u)*h);o.push(a(u))}else for(o.push(a(u));u++0;h--)o.push(a(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,n){if(!arguments.length)return El;arguments.length<2?n=El:"function"!=typeof n&&(n=uo.format(n));var r=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return e-.5>o*e&&(o*=e),r>=o?n(t):""}},o.copy=function(){return aa(t.copy(),e,n,r)},Qi(o,t)}function oa(t,e,n){function r(e){return t(i(e))}var i=sa(e),a=sa(1/e);return r.invert=function(e){return a(t.invert(e))},r.domain=function(e){return arguments.length?(t.domain((n=e.map(Number)).map(i)),r):n},r.ticks=function(t){return ea(n,t)},r.tickFormat=function(t,e){return na(n,t,e)},r.nice=function(t){return r.domain(Ki(n,t))},r.exponent=function(o){return arguments.length?(i=sa(e=o),a=sa(1/e),t.domain(n.map(i)),r):e},r.copy=function(){return oa(t.copy(),e,n)},Qi(r,t)}function sa(t){return function(e){return 0>e?-Math.pow(-e,t):Math.pow(e,t)}}function la(t,e){function n(n){return a[((i.get(n)||("range"===e.t?i.set(n,t.push(n)):NaN))-1)%a.length]}function r(e,n){return uo.range(t.length).map(function(t){return e+n*t})}var i,a,o;return n.domain=function(r){if(!arguments.length)return t;t=[],i=new f;for(var a,o=-1,s=r.length;++on?[NaN,NaN]:[n>0?s[n-1]:t[0],ne?NaN:e/a+t,[e,e+1/a]},r.copy=function(){return ca(t,e,n)},i()}function fa(t,e){function n(n){return n>=n?e[uo.bisect(t,n)]:void 0}return n.domain=function(e){return arguments.length?(t=e,n):t},n.range=function(t){return arguments.length?(e=t,n):e},n.invertExtent=function(n){return n=e.indexOf(n),[t[n-1],t[n]]},n.copy=function(){return fa(t,e)},n}function ha(t){function e(t){return+t}return e.invert=e,e.domain=e.range=function(n){return arguments.length?(t=n.map(e),e):t},e.ticks=function(e){return ea(t,e)},e.tickFormat=function(e,n){return na(t,e,n)},e.copy=function(){return ha(t)},e}function da(){return 0}function pa(t){return t.innerRadius}function ma(t){return t.outerRadius}function ga(t){return t.startAngle}function va(t){return t.endAngle}function ya(t){return t&&t.padAngle}function xa(t,e,n,r){return(t-n)*e-(e-r)*t>0?0:1}function _a(t,e,n,r,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?r:-r)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,m=(f+d)/2,g=h-c,v=d-f,y=g*g+v*v,x=n-r,_=c*d-h*f,b=(0>v?-1:1)*Math.sqrt(Math.max(0,x*x*y-_*_)),w=(_*v-g*b)/y,M=(-_*g-v*b)/y,k=(_*v+g*b)/y,S=(-_*g+v*b)/y,T=w-p,A=M-m,E=k-p,L=S-m;return T*T+A*A>E*E+L*L&&(w=k,M=S),[[w-l,M-u],[w*n/x,M*n/x]]}function ba(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Et(n),p=Et(r);++f1?t.join("L"):t+"Z"}function Ma(t){return t.join("L")+"Z"}function ka(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1&&i.push("H",r[0]),i.join("")}function Sa(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1){s=e[1],a=t[l],l++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*n,o[s+1]=i*r));for(s=-1;++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}function qa(t){return t.length<3?wa(t):t[0]+za(t,Ba(t))}function Va(t){for(var e,n,r,i=-1,a=t.length;++i=e?o(t-e):void(u.c=o)}function o(n){var i=p.active,a=p[i];a&&(a.timer.c=null,a.timer.t=NaN,--p.count,delete p[i],a.event&&a.event.interrupt.call(t,t.__data__,a.index));for(var o in p)if(r>+o){var f=p[o];f.timer.c=null,f.timer.t=NaN,--p.count,delete p[o]}u.c=s,Pt(function(){return u.c&&s(n||1)&&(u.c=null,u.t=NaN),1},0,l),p.active=r,m.event&&m.event.start.call(t,t.__data__,e),d=[],m.tween.forEach(function(n,r){(r=r.call(t,t.__data__,e))&&d.push(r)}),h=m.ease,c=m.duration}function s(i){for(var a=i/c,o=h(a),s=d.length;s>0;)d[--s].call(t,o);return a>=1?(m.event&&m.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1):void 0}var l,u,c,h,d,p=t[n]||(t[n]={active:0,count:0}),m=p[r];m||(l=i.time,u=Pt(a,0,l),m=p[r]={tween:new f,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function no(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function ro(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,n){function r(e){return t(e)}function i(t,n){var r=t[1]-t[0],i=r/n,a=uo.bisect(tu,i);return a==tu.length?[e.year,ta(t.map(function(t){return t/31536e6}),n)[2]]:a?e[i/tu[a-1]1?{floor:function(e){for(;n(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Hi(r.domain()),a=null==t?i(n,10):"number"==typeof t?i(n,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(n[0],oo(+n[1]+1),1>e?1:e)},r.tickFormat=function(){return n},r.copy=function(){return ao(t.copy(),e,n)},Qi(r,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=ho.createRange();return e.selectNode(ho.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.16"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(po){fo=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(mo){var go=this.Element.prototype,vo=go.setAttribute,yo=go.setAttributeNS,xo=this.CSSStyleDeclaration.prototype,_o=xo.setProperty;go.setAttribute=function(t,e){vo.call(this,t,e+"")},go.setAttributeNS=function(t,e,n){yo.call(this,t,e,n+"")},xo.setProperty=function(t,e,n){_o.call(this,t,e+"",n)}}uo.ascending=i,uo.descending=function(t,e){return t>e?-1:e>t?1:e>=t?0:NaN},uo.min=function(t,e){var n,r,i=-1,a=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++ir&&(n=r)}else{for(;++i=r){n=r;break}for(;++ir&&(n=r)}return n},uo.max=function(t,e){var n,r,i=-1,a=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++in&&(n=r)}else{for(;++i=r){n=r;break}for(;++in&&(n=r)}return n},uo.extent=function(t,e){var n,r,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=i=r;break}for(;++ar&&(n=r),r>i&&(i=r))}else{for(;++a=r){n=i=r;break}for(;++ar&&(n=r),r>i&&(i=r))}return[n,i]},uo.sum=function(t,e){var n,r=0,i=t.length,a=-1;if(1===arguments.length)for(;++a1?l/(c-1):void 0},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var bo=s(i);uo.bisectLeft=bo.left,uo.bisect=uo.bisectRight=bo.right,uo.bisector=function(t){return s(1===t.length?function(e,n){return i(t(e),n)}:t)},uo.shuffle=function(t,e,n){(a=arguments.length)<3&&(n=t.length,2>a&&(e=0));for(var r,i,a=n-e;a;)i=Math.random()*a--|0,r=t[a+e],t[a+e]=t[i+e],t[i+e]=r;return t},uo.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},uo.pairs=function(t){for(var e,n=0,r=t.length-1,i=t[0],a=new Array(0>r?0:r);r>n;)a[n]=[e=i,i=t[++n]];return a},uo.transpose=function(t){if(!(i=t.length))return[];for(var e=-1,n=uo.min(t,l),r=new Array(n);++e=0;)for(r=t[i],e=r.length;--e>=0;)n[--o]=r[e];return n};var wo=Math.abs;uo.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,i=[],a=u(wo(n)),o=-1;if(t*=a,e*=a,n*=a,0>n)for(;(r=t+n*++o)>e;)i.push(r/a);else for(;(r=t+n*++o)=a.length)return r?r.call(i,o):n?o.sort(n):o;for(var l,u,c,h,d=-1,p=o.length,m=a[s++],g=new f;++d=a.length)return t;var r=[],i=o[n++];return t.forEach(function(t,i){r.push({key:t,values:e(i,n)})}),i?r.sort(function(t,e){return i(t.key,e.key)}):r}var n,r,i={},a=[],o=[];return i.map=function(e,n){return t(n,e,0)},i.entries=function(n){return e(t(uo.map,n,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return n=t,i},i.rollup=function(t){return r=t,i},i},uo.set=function(t){var e=new x;if(t)for(var n=0,r=t.length;r>n;++n)e.add(t[n]);return e},c(x,{has:p,add:function(t){return this._[h(t+="")]=!0,t},remove:m,values:g,size:v,empty:y,forEach:function(t){for(var e in this._)t.call(this,d(e))}}),uo.behavior={},uo.rebind=function(t,e){for(var n,r=1,i=arguments.length;++r=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},uo.event=null,uo.requote=function(t){return t.replace(To,"\\$&")};var To=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ao={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},Eo=function(t,e){return e.querySelector(t)},Lo=function(t,e){return e.querySelectorAll(t)},zo=function(t,e){var n=t.matches||t[w(t,"matchesSelector")];return(zo=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Eo=function(t,e){return Sizzle(t,e)[0]||null},Lo=Sizzle,zo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var Io=uo.selection.prototype=[];Io.select=function(t){var e,n,r,i,a=[];t=z(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Po.hasOwnProperty(n)?{space:Po[n],local:t}:t}},Io.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return t=uo.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(D(e,t[e]));return this}return this.each(D(t,e))},Io.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=O(t)).length,i=-1;if(e=n.classList){for(;++ii){if("string"!=typeof t){2>i&&(e="");for(n in t)this.each(N(n,t[n],e));return this}if(2>i){var a=this.node();return r(a).getComputedStyle(a,null).getPropertyValue(t)}n=""}return this.each(N(t,e,n))},Io.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(j(e,t[e]));return this}return this.each(j(t,e))},Io.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},Io.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},Io.append=function(t){return t=B(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},Io.insert=function(t,e){return t=B(t),e=z(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},Io.remove=function(){return this.each(q)},Io.data=function(t,e){function n(t,n){var r,i,a,o=t.length,c=n.length,h=Math.min(o,c),d=new Array(c),p=new Array(c),m=new Array(o);if(e){var g,v=new f,y=new Array(o);for(r=-1;++rr;++r)p[r]=V(n[r]);for(;o>r;++r)m[r]=t[r]}p.update=d,p.parentNode=d.parentNode=m.parentNode=t.parentNode,s.push(p),l.push(d),u.push(m)}var r,i,a=-1,o=this.length;if(!arguments.length){for(t=new Array(o=(r=this[0]).length);++aa;a++){i.push(e=[]),e.parentNode=(n=this[a]).parentNode;for(var s=0,l=n.length;l>s;s++)(r=n[s])&&t.call(r,r.__data__,s,a)&&e.push(r)}return L(i)},Io.order=function(){for(var t=-1,e=this.length;++t=0;)(n=r[i])&&(a&&a!==n.nextSibling&&a.parentNode.insertBefore(n,a),a=n);return this},Io.sort=function(t){t=Z.apply(this,arguments);for(var e=-1,n=this.length;++et;t++)for(var n=this[t],r=0,i=n.length;i>r;r++){var a=n[r];if(a)return a}return null},Io.size=function(){var t=0;return H(this,function(){++t}),t};var Co=[];uo.selection.enter=G,uo.selection.enter.prototype=Co,Co.append=Io.append,Co.empty=Io.empty,Co.node=Io.node,Co.call=Io.call,Co.size=Io.size,Co.select=function(t){for(var e,n,r,i,a,o=[],s=-1,l=this.length;++sr){if("string"!=typeof t){2>r&&(e=!1);for(n in t)this.each(Y(n,t[n],e));return this}if(2>r)return(r=this.node()["__on"+t])&&r._;n=!1}return this.each(Y(t,e,n))};var Oo=uo.map({mouseenter:"mouseover",mouseleave:"mouseout"});ho&&Oo.forEach(function(t){"on"+t in ho&&Oo.remove(t)});var Fo,Ro=0;uo.mouse=function(t){return Q(t,A())};var No=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;uo.touch=function(t,e,n){if(arguments.length<3&&(n=e,e=A().changedTouches),e)for(var r,i=0,a=e.length;a>i;++i)if((r=e[i]).identifier===n)return Q(t,r)},uo.behavior.drag=function(){function t(){this.on("mousedown.drag",a).on("touchstart.drag",o)}function e(t,e,r,a,o){return function(){function s(){var t,n,r=e(h,m);r&&(t=r[0]-x[0],n=r[1]-x[1],p|=t|n,x=r,d({type:"drag",x:r[0]+u[0],y:r[1]+u[1],dx:t,dy:n}))}function l(){e(h,m)&&(v.on(a+g,null).on(o+g,null),y(p),d({type:"dragend"}))}var u,c=this,f=uo.event.target.correspondingElement||uo.event.target,h=c.parentNode,d=n.of(c,arguments),p=0,m=t(),g=".drag"+(null==m?"":"-"+m),v=uo.select(r(f)).on(a+g,s).on(o+g,l),y=$(f),x=e(h,m);i?(u=i.apply(c,arguments),u=[u.x-x[0],u.y-x[1]]):u=[0,0],d({type:"dragstart"})}}var n=E(t,"drag","dragstart","dragend"),i=null,a=e(M,uo.mouse,r,"mousemove","mouseup"),o=e(K,uo.touch,_,"touchmove","touchend");return t.origin=function(e){return arguments.length?(i=e,t):i},uo.rebind(t,n,"on")},uo.touches=function(t,e){return arguments.length<2&&(e=A().touches),e?fo(e).map(function(e){var n=Q(t,e);return n.identifier=e.identifier,n}):[]};var jo=1e-6,Bo=jo*jo,qo=Math.PI,Vo=2*qo,Uo=Vo-jo,Zo=qo/2,Ho=qo/180,Go=180/qo,Xo=Math.SQRT2,Yo=2,Wo=4;uo.interpolateZoom=function(t,e){var n,r,i=t[0],a=t[1],o=t[2],s=e[0],l=e[1],u=e[2],c=s-i,f=l-a,h=c*c+f*f;if(Bo>h)r=Math.log(u/o)/Xo,n=function(t){return[i+t*c,a+t*f,o*Math.exp(Xo*t*r)]};else{var d=Math.sqrt(h),p=(u*u-o*o+Wo*h)/(2*o*Yo*d),m=(u*u-o*o-Wo*h)/(2*u*Yo*d),g=Math.log(Math.sqrt(p*p+1)-p),v=Math.log(Math.sqrt(m*m+1)-m);r=(v-g)/Xo,n=function(t){var e=t*r,n=at(g),s=o/(Yo*d)*(n*ot(Xo*e+g)-it(g));return[i+s*c,a+s*f,o*n/at(Xo*e+g)]}}return n.duration=1e3*r,n},uo.behavior.zoom=function(){function t(t){t.on(I,f).on($o+".zoom",d).on("dblclick.zoom",p).on(C,h)}function e(t){return[(t[0]-k.x)/k.k,(t[1]-k.y)/k.k]}function n(t){return[t[0]*k.k+k.x,t[1]*k.k+k.y]}function i(t){k.k=Math.max(A[0],Math.min(A[1],t))}function a(t,e){e=n(e),k.x+=t[0]-e[0],k.y+=t[1]-e[1]}function o(e,n,r,o){e.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2,o)),a(g=n,r),e=uo.select(e),L>0&&(e=e.transition().duration(L)),e.call(t.event)}function s(){b&&b.domain(_.range().map(function(t){return(t-k.x)/k.k}).map(_.invert)),M&&M.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){z++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--z||(t({type:"zoomend"}),g=null)}function f(){function t(){s=1,a(uo.mouse(i),h),u(o)}function n(){f.on(D,null).on(P,null),d(s),c(o)}var i=this,o=O.of(i,arguments),s=0,f=uo.select(r(i)).on(D,t).on(P,n),h=e(uo.mouse(i)),d=$(i);Zl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=k.k,t.forEach(function(t){t.identifier in g&&(g[t.identifier]=e(t))}),t}function n(){var e=uo.event.target;uo.select(e).on(_,r).on(b,s),w.push(e);for(var n=uo.event.changedTouches,i=0,a=n.length;a>i;++i)g[n[i].identifier]=null;var l=t(),u=Date.now();if(1===l.length){if(500>u-x){var c=l[0];o(p,c,g[c.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),T()}x=u}else if(l.length>1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];v=h*h+d*d}}function r(){var t,e,n,r,o=uo.touches(p);Zl.call(p);for(var s=0,l=o.length;l>s;++s,r=null)if(n=o[s],r=g[n.identifier]){if(e)break;t=n,e=r}if(r){var c=(c=n[0]-t[0])*c+(c=n[1]-t[1])*c,f=v&&Math.sqrt(c/v);t=[(t[0]+n[0])/2,(t[1]+n[1])/2],e=[(e[0]+r[0])/2,(e[1]+r[1])/2],i(f*d)}x=null,a(t,e),u(m)}function s(){if(uo.event.touches.length){for(var e=uo.event.changedTouches,n=0,r=e.length;r>n;++n)delete g[e[n].identifier];for(var i in g)return void t()}uo.selectAll(w).on(y,null),M.on(I,f).on(C,h),S(),c(m)}var d,p=this,m=O.of(p,arguments),g={},v=0,y=".zoom-"+uo.event.changedTouches[0].identifier,_="touchmove"+y,b="touchend"+y,w=[],M=uo.select(p),S=$(p);n(),l(m),M.on(I,null).on(C,n)}function d(){var t=O.of(this,arguments);y?clearTimeout(y):(Zl.call(this),m=e(g=v||uo.mouse(this)),l(t)),y=setTimeout(function(){y=null,c(t)},50),T(),i(Math.pow(2,.002*Jo())*k.k),a(g,m),u(t)}function p(){var t=uo.mouse(this),n=Math.log(k.k)/Math.LN2;o(this,t,e(t),uo.event.shiftKey?Math.ceil(n)-1:Math.floor(n)+1)}var m,g,v,y,x,_,b,w,M,k={x:0,y:0,k:1},S=[960,500],A=Qo,L=250,z=0,I="mousedown.zoom",D="mousemove.zoom",P="mouseup.zoom",C="touchstart.zoom",O=E(t,"zoomstart","zoom","zoomend");return $o||($o="onwheel"in ho?(Jo=function(){return-uo.event.deltaY*(uo.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ho?(Jo=function(){return uo.event.wheelDelta},"mousewheel"):(Jo=function(){return-uo.event.detail},"MozMousePixelScroll")),t.event=function(t){t.each(function(){var t=O.of(this,arguments),e=k;Vl?uo.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(t)}).tween("zoom:zoom",function(){var n=S[0],r=S[1],i=g?g[0]:n/2,a=g?g[1]:r/2,o=uo.interpolateZoom([(i-k.x)/k.k,(a-k.y)/k.k,n/k.k],[(i-e.x)/e.k,(a-e.y)/e.k,n/e.k]);return function(e){var r=o(e),s=n/r[2];this.__chart__=k={x:i-r[0]*s,y:a-r[1]*s,k:s},u(t)}}).each("interrupt.zoom",function(){c(t)}).each("end.zoom",function(){c(t)}):(this.__chart__=k,l(t),u(t),c(t))})},t.translate=function(e){return arguments.length?(k={x:+e[0],y:+e[1],k:k.k},s(),t):[k.x,k.y]},t.scale=function(e){return arguments.length?(k={x:k.x,y:k.y,k:null},i(+e),s(),t):k.k},t.scaleExtent=function(e){return arguments.length?(A=null==e?Qo:[+e[0],+e[1]],t):A},t.center=function(e){return arguments.length?(v=e&&[+e[0],+e[1]],t):v},t.size=function(e){return arguments.length?(S=e&&[+e[0],+e[1]],t):S},t.duration=function(e){return arguments.length?(L=+e,t):L},t.x=function(e){return arguments.length?(b=e,_=e.copy(),k={x:0,y:0,k:1},t):b},t.y=function(e){return arguments.length?(M=e,w=e.copy(),k={x:0,y:0,k:1},t):M},uo.rebind(t,O,"on")};var Jo,$o,Qo=[0,1/0];uo.color=lt,lt.prototype.toString=function(){return this.rgb()+""},uo.hsl=ut;var Ko=ut.prototype=new lt;Ko.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,this.l/t)},Ko.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,t*this.l)},Ko.rgb=function(){return ct(this.h,this.s,this.l)},uo.hcl=ft;var ts=ft.prototype=new lt;ts.brighter=function(t){return new ft(this.h,this.c,Math.min(100,this.l+es*(arguments.length?t:1)))},ts.darker=function(t){return new ft(this.h,this.c,Math.max(0,this.l-es*(arguments.length?t:1)))},ts.rgb=function(){return ht(this.h,this.c,this.l).rgb()},uo.lab=dt;var es=18,ns=.95047,rs=1,is=1.08883,as=dt.prototype=new lt;as.brighter=function(t){return new dt(Math.min(100,this.l+es*(arguments.length?t:1)),this.a,this.b)},as.darker=function(t){return new dt(Math.max(0,this.l-es*(arguments.length?t:1)),this.a,this.b)},as.rgb=function(){return pt(this.l,this.a,this.b)},uo.rgb=xt;var os=xt.prototype=new lt;os.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,n=this.g,r=this.b,i=30;return e||n||r?(e&&i>e&&(e=i),n&&i>n&&(n=i),r&&i>r&&(r=i),new xt(Math.min(255,e/t),Math.min(255,n/t),Math.min(255,r/t))):new xt(i,i,i)},os.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new xt(t*this.r,t*this.g,t*this.b)},os.hsl=function(){return kt(this.r,this.g,this.b)},os.toString=function(){return"#"+wt(this.r)+wt(this.g)+wt(this.b)};var ss=uo.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});ss.forEach(function(t,e){ss.set(t,_t(e))}),uo.functor=Et,uo.xhr=Lt(_),uo.dsv=function(t,e){function n(t,n,a){arguments.length<3&&(a=n,n=null);var o=zt(t,e,null==n?r:i(n),a);return o.row=function(t){return arguments.length?o.response(null==(n=t)?r:i(t)):n},o}function r(t){return n.parse(t.responseText)}function i(t){return function(e){return n.parse(e.responseText,t)}}function a(e){return e.map(o).join(t)}function o(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return n.parse=function(t,e){var r;return n.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,n){return e(i(t),n)}:i})},n.parseRows=function(t,e){function n(){if(c>=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var n=e;n++c;){var r=t.charCodeAt(c++),s=1;if(10===r)i=!0;else if(13===r)i=!0,10===t.charCodeAt(c)&&(++c,++s);else if(r!==l)continue;return t.slice(e,c-s)}return t.slice(e)}for(var r,i,a={},o={},s=[],u=t.length,c=0,f=0;(r=n())!==o;){for(var h=[];r!==a&&r!==o;)h.push(r),r=n();e&&null==(h=e(h,f++))||s.push(h)}return s},n.format=function(e){if(Array.isArray(e[0]))return n.formatRows(e);var r=new x,i=[];return e.forEach(function(t){for(var e in t)r.has(e)||i.push(r.add(e))}),[i.map(o).join(t)].concat(e.map(function(e){return i.map(function(t){return o(e[t])}).join(t)})).join("\n")},n.formatRows=function(t){return t.map(a).join("\n")},n},uo.csv=uo.dsv(",","text/csv"),uo.tsv=uo.dsv(" ","text/tab-separated-values");var ls,us,cs,fs,hs=this[w(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};uo.timer=function(){Pt.apply(this,arguments)},uo.timer.flush=function(){Ot(),Ft()},uo.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var ds=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Nt);uo.formatPrefix=function(t,e){var n=0;return(t=+t)&&(0>t&&(t*=-1),e&&(t=uo.round(t,Rt(t,e))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),ds[8+n/3]};var ps=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ms=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,Rt(t,e))).toFixed(Math.max(0,Math.min(20,Rt(t*(1+1e-15),e))))}}),gs=uo.time={},vs=Date;qt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ys.setUTCDate.apply(this._,arguments)},setDay:function(){ys.setUTCDay.apply(this._,arguments)},setFullYear:function(){ys.setUTCFullYear.apply(this._,arguments)},setHours:function(){ys.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ys.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ys.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ys.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ys.setUTCSeconds.apply(this._,arguments)},setTime:function(){ys.setTime.apply(this._,arguments)}};var ys=Date.prototype;gs.year=Vt(function(t){return t=gs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),gs.years=gs.year.range,gs.years.utc=gs.year.utc.range,gs.day=Vt(function(t){var e=new vs(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}),gs.days=gs.day.range,gs.days.utc=gs.day.utc.range,gs.dayOfYear=function(t){var e=gs.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 n=gs[t]=Vt(function(t){return(t=gs.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=gs.year(t).getDay();return Math.floor((gs.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});gs[t+"s"]=n.range,gs[t+"s"].utc=n.utc.range,gs[t+"OfYear"]=function(t){var n=gs.year(t).getDay();return Math.floor((gs.dayOfYear(t)+(n+e)%7)/7)}}),gs.week=gs.sunday,gs.weeks=gs.sunday.range,gs.weeks.utc=gs.sunday.utc.range,gs.weekOfYear=gs.sundayOfYear;var xs={"-":"",_:" ",0:"0"},_s=/^\s*\d+/,bs=/^%/;uo.locale=function(t){return{numberFormat:jt(t),timeFormat:Zt(t)}};var ws=uo.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"]});uo.format=ws.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,Ms),he(Ms.s,this.s,this),this.s?this.t+=Ms.t:this.s=Ms.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Ms=new fe;uo.geo.stream=function(t,e){t&&ks.hasOwnProperty(t.type)?ks[t.type](t,e):de(t,e)};var ks={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rt?4*qo+t:t,Es.lineStart=Es.lineEnd=Es.point=M}};uo.geo.bounds=function(){function t(t,e){x.push(_=[c=t,h=t]),f>e&&(f=e),e>d&&(d=e)}function e(e,n){var r=ve([e*Ho,n*Ho]);if(v){var i=xe(v,r),a=[i[1],-i[0],0],o=xe(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,m=o[0]*Go*u,g=wo(l)>180;if(g^(m>u*p&&u*e>m)){var y=o[1]*Go;y>d&&(d=y)}else if(m=(m+360)%360-180,g^(m>u*p&&u*e>m)){var y=-o[1]*Go;f>y&&(f=y)}else f>n&&(f=n),n>d&&(d=n);g?p>e?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(c>e&&(c=e),e>h&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,n);v=r,p=e}function n(){b.point=e}function r(){_[0]=c,_[1]=h,b.point=t,v=null}function i(t,n){if(v){var r=t-p;y+=wo(r)>180?r+(r>0?360:-360):r}else m=t,g=n;Es.point(t,n),e(t,n)}function a(){Es.lineStart()}function o(){i(m,g),Es.lineEnd(),wo(y)>jo&&(c=-(h=180)),_[0]=c,_[1]=h,v=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tAs?(c=-(h=180),f=-(d=90)):y>jo?d=90:-jo>y&&(f=-90),_[0]=c,_[1]=h}};return function(t){d=h=-(c=f=1/0),x=[],uo.geo.stream(t,b);var e=x.length;if(e){x.sort(l);for(var n,r=1,i=x[0],a=[i];e>r;++r)n=x[r],u(n[0],i)||u(n[1],i)?(s(i[0],n[1])>s(i[0],i[1])&&(i[1]=n[1]),s(n[0],i[1])>s(i[0],i[1])&&(i[0]=n[0])):a.push(i=n);for(var o,n,p=-(1/0),e=a.length-1,r=0,i=a[e];e>=r;i=n,++r)n=a[r],(o=s(i[1],n[0]))>p&&(p=o,c=n[0],h=i[1])}return x=_=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){Ls=zs=Is=Ds=Ps=Cs=Os=Fs=Rs=Ns=js=0,uo.geo.stream(t,Bs);var e=Rs,n=Ns,r=js,i=e*e+n*n+r*r;return Bo>i&&(e=Cs,n=Os,r=Fs,jo>zs&&(e=Is,n=Ds,r=Ps),i=e*e+n*n+r*r,Bo>i)?[NaN,NaN]:[Math.atan2(n,e)*Go,rt(r/Math.sqrt(i))*Go]; -};var Ls,zs,Is,Ds,Ps,Cs,Os,Fs,Rs,Ns,js,Bs={sphere:M,point:Se,lineStart:Ae,lineEnd:Ee,polygonStart:function(){Bs.lineStart=Le},polygonEnd:function(){Bs.lineStart=Ae}},qs=Oe(Ie,je,qe,[-qo,-qo/2]),Vs=1e9;uo.geo.clipExtent=function(){var t,e,n,r,i,a,o={stream:function(t){return i&&(i.valid=!1),i=a(t),i.valid=!0,i},extent:function(s){return arguments.length?(a=He(t=+s[0][0],e=+s[0][1],n=+s[1][0],r=+s[1][1]),i&&(i.valid=!1,i=null),o):[[t,e],[n,r]]}};return o.extent([[0,0],[960,500]])},(uo.geo.conicEqualArea=function(){return Ge(Xe)}).raw=Xe,uo.geo.albers=function(){return uo.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},uo.geo.albersUsa=function(){function t(t){var a=t[0],o=t[1];return e=null,n(a,o),e||(r(a,o),e)||i(a,o),e}var e,n,r,i,a=uo.geo.albers(),o=uo.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=uo.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,n){e=[t,n]}};return t.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?o:i>=.166&&.234>i&&r>=-.214&&-.115>r?s:a).invert(t)},t.stream=function(t){var e=a.stream(t),n=o.stream(t),r=s.stream(t);return{point:function(t,i){e.point(t,i),n.point(t,i),r.point(t,i)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),c=+e[0],f=+e[1];return n=a.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,r=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+jo,f+.12*u+jo],[c-.214*u-jo,f+.234*u-jo]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+jo,f+.166*u+jo],[c-.115*u-jo,f+.234*u-jo]]).stream(l).point,t},t.scale(1070)};var Us,Zs,Hs,Gs,Xs,Ys,Ws={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Zs=0,Ws.lineStart=Ye},polygonEnd:function(){Ws.lineStart=Ws.lineEnd=Ws.point=M,Us+=wo(Zs/2)}},Js={point:We,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},$s={point:Qe,lineStart:Ke,lineEnd:tn,polygonStart:function(){$s.lineStart=en},polygonEnd:function(){$s.point=Qe,$s.lineStart=Ke,$s.lineEnd=tn}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var n,r,i,a,o,s=4.5;return t.area=function(t){return Us=0,uo.geo.stream(t,i(Ws)),Us},t.centroid=function(t){return Is=Ds=Ps=Cs=Os=Fs=Rs=Ns=js=0,uo.geo.stream(t,i($s)),js?[Rs/js,Ns/js]:Fs?[Cs/Fs,Os/Fs]:Ps?[Is/Ps,Ds/Ps]:[NaN,NaN]},t.bounds=function(t){return Xs=Ys=-(Hs=Gs=1/0),uo.geo.stream(t,i(Js)),[[Hs,Gs],[Xs,Ys]]},t.projection=function(t){return arguments.length?(i=(n=t)?t.stream||an(t):_,e()):n},t.context=function(t){return arguments.length?(a=null==(r=t)?new Je:new nn(t),"function"!=typeof s&&a.pointRadius(s),e()):r},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var n=new on(e);for(var r in t)n[r]=t[r];return n}}},on.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()}},uo.geo.projection=ln,uo.geo.projectionMutator=un,(uo.geo.equirectangular=function(){return ln(fn)}).raw=fn.invert=fn,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Ho,e[1]*Ho),e[0]*=Go,e[1]*=Go,e}return t=dn(t[0]%360*Ho,t[1]*Ho,t.length>2?t[2]*Ho:0),e.invert=function(e){return e=t.invert(e[0]*Ho,e[1]*Ho),e[0]*=Go,e[1]*=Go,e},e},hn.invert=fn,uo.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=dn(-t[0]*Ho,-t[1]*Ho,0).invert,i=[];return n(null,null,1,{point:function(t,n){i.push(t=e(t,n)),t[0]*=Go,t[1]*=Go}}),{type:"Polygon",coordinates:[i]}}var e,n,r=[0,0],i=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=vn((e=+r)*Ho,i*Ho),t):e},t.precision=function(r){return arguments.length?(n=vn(e*Ho,(i=+r)*Ho),t):i},t.angle(90)},uo.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Ho,i=t[1]*Ho,a=e[1]*Ho,o=Math.sin(r),s=Math.cos(r),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((n=f*o)*n+(n=u*c-l*f*s)*n),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/g)*g,i,g).map(h).concat(uo.range(Math.ceil(u/v)*v,l,v).map(d)).concat(uo.range(Math.ceil(r/p)*p,n,p).filter(function(t){return wo(t%g)>jo}).map(c)).concat(uo.range(Math.ceil(s/m)*m,o,m).filter(function(t){return wo(t%v)>jo}).map(f))}var n,r,i,a,o,s,l,u,c,f,h,d,p=10,m=p,g=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(a).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[a,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[r,s],[n,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],t):[g,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],m=+e[1],t):[p,m]},t.precision=function(e){return arguments.length?(y=+e,c=xn(s,o,90),f=_n(r,n,y),h=xn(u,l,90),d=_n(a,i,y),t):y},t.majorExtent([[-180,-90+jo],[180,90-jo]]).minorExtent([[-180,-80-jo],[180,80+jo]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||i.apply(this,arguments)]}}var e,n,r=bn,i=wn;return t.distance=function(){return uo.geo.distance(e||r.apply(this,arguments),n||i.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(i=e,n="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return Mn(t[0]*Ho,t[1]*Ho,e[0]*Ho,e[1]*Ho)},uo.geo.length=function(t){return Qs=0,uo.geo.stream(t,Ks),Qs};var Qs,Ks={sphere:M,point:M,lineStart:kn,lineEnd:M,polygonStart:M,polygonEnd:M},tl=Sn(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return ln(tl)}).raw=tl;var el=Sn(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},_);(uo.geo.azimuthalEquidistant=function(){return ln(el)}).raw=el,(uo.geo.conicConformal=function(){return Ge(Tn)}).raw=Tn,(uo.geo.conicEquidistant=function(){return Ge(An)}).raw=An;var nl=Sn(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return ln(nl)}).raw=nl,En.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Zo]},(uo.geo.mercator=function(){return Ln(En)}).raw=En;var rl=Sn(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return ln(rl)}).raw=rl;var il=Sn(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return ln(il)}).raw=il,zn.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Zo]},(uo.geo.transverseMercator=function(){var t=Ln(zn),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=zn,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Et(n),a=Et(r),o=t.length,s=[],l=[];for(e=0;o>e;e++)s.push([+i.call(this,t[e],e),+a.call(this,t[e],e),e]);for(s.sort(Cn),e=0;o>e;e++)l.push([s[e][0],-s[e][1]]);var u=Pn(s),c=Pn(l),f=c[0]===u[0],h=c[c.length-1]===u[u.length-1],d=[];for(e=u.length-1;e>=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=r&&u.x<=a&&u.y>=i&&u.y<=o?[[r,o],[a,o],[a,i],[r,i]]:[];c.point=t[s]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/jo)*jo,y:Math.round(o(t,e)/jo)*jo,i:e}})}var r=In,i=Dn,a=r,o=i,s=dl;return t?e(t):(e.links=function(t){return ur(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return ur(n(t)).cells.forEach(function(n,r){for(var i,a,o=n.site,s=n.edges.sort(Xn),l=-1,u=s.length,c=s[u-1].edge,f=c.l===o?c.r:c.l;++l=u,h=r>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pr()),f?i=u:s=u,h?o=c:l=c,a(t,e,n,r,i,o,s,l)}var c,f,h,d,p,m,g,v,y,x=Et(s),_=Et(l);if(null!=e)m=e,g=n,v=r,y=i;else if(v=y=-(m=g=1/0),f=[],h=[],p=t.length,o)for(d=0;p>d;++d)c=t[d],c.xv&&(v=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;p>d;++d){var b=+x(c=t[d],d),w=+_(c,d);m>b&&(m=b),g>w&&(g=w),b>v&&(v=b),w>y&&(y=w),f.push(b),h.push(w)}var M=v-m,k=y-g;M>k?y=g+M:v=m+k;var S=pr();if(S.add=function(t){a(S,t,+x(t,++d),+_(t,d),m,g,v,y)},S.visit=function(t){mr(t,S,m,g,v,y)},S.find=function(t){return gr(S,t[0],t[1],m,g,v,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=vl.get(n)||gl,r=yl.get(r)||_,Mr(r(n.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Fr,uo.interpolateHsl=Rr,uo.interpolateLab=Nr,uo.interpolateRound=jr,uo.transform=function(t){var e=ho.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Br(n?n.matrix:xl)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var xl={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Wr,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++ns*s/v){if(m>l){var u=e.charge/l;t.px-=a*u,t.py-=o*u}return!0}if(e.point&&l&&m>l){var u=e.pointCharge/l;t.px-=a*u,t.py-=o*u}}return!e.charge}}function e(t){t.px=uo.event.x,t.py=uo.event.y,l.resume()}var n,r,i,a,o,s,l={},u=uo.dispatch("start","tick","end"),c=[1,1],f=.9,h=_l,d=bl,p=-30,m=wl,g=.1,v=.64,y=[],x=[];return l.tick=function(){if((i*=.99)<.005)return n=null,u.end({type:"end",alpha:i=0}),!0;var e,r,l,h,d,m,v,_,b,w=y.length,M=x.length;for(r=0;M>r;++r)l=x[r],h=l.source,d=l.target,_=d.x-h.x,b=d.y-h.y,(m=_*_+b*b)&&(m=i*o[r]*((m=Math.sqrt(m))-a[r])/m,_*=m,b*=m,d.x-=_*(v=h.weight+d.weight?h.weight/(h.weight+d.weight):.5),d.y-=b*v,h.x+=_*(v=1-v),h.y+=b*v);if((v=i*g)&&(_=c[0]/2,b=c[1]/2,r=-1,v))for(;++r0?i=t:(n.c=null,n.t=NaN,n=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),n=Pt(l.tick)),l):i},l.start=function(){function t(t,r){if(!n){for(n=new Array(i),l=0;i>l;++l)n[l]=[];for(l=0;u>l;++l){var a=x[l];n[a.source.index].push(a.target),n[a.target.index].push(a.source)}}for(var o,s=n[e],l=-1,c=s.length;++le;++e)(r=y[e]).index=e,r.weight=0;for(e=0;u>e;++e)r=x[e],"number"==typeof r.source&&(r.source=y[r.source]),"number"==typeof r.target&&(r.target=y[r.target]),++r.source.weight,++r.target.weight;for(e=0;i>e;++e)r=y[e],isNaN(r.x)&&(r.x=t("x",f)),isNaN(r.y)&&(r.y=t("y",m)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(a=[],"function"==typeof h)for(e=0;u>e;++e)a[e]=+h.call(this,x[e],e);else for(e=0;u>e;++e)a[e]=h;if(o=[],"function"==typeof d)for(e=0;u>e;++e)o[e]=+d.call(this,x[e],e);else for(e=0;u>e;++e)o[e]=d;if(s=[],"function"==typeof p)for(e=0;i>e;++e)s[e]=+p.call(this,y[e],e);else for(e=0;i>e;++e)s[e]=p;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return r||(r=uo.behavior.drag().origin(_).on("dragstart.force",ei).on("drag.force",e).on("dragend.force",ni)),arguments.length?void this.on("mouseover.force",ri).on("mouseout.force",ii).call(r):r},uo.rebind(l,u,"on")};var _l=20,bl=1,wl=1/0;uo.layout.hierarchy=function(){function t(i){var a,o=[i],s=[];for(i.depth=0;null!=(a=o.pop());)if(s.push(a),(u=n.call(t,a,a.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;r&&(a.value=0),a.children=u}else r&&(a.value=+r.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var n,i;e&&(n=t.children)&&n.sort(e),r&&(i=t.parent)&&(i.value+=t.value)}),s}var e=fi,n=ui,r=ci;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},uo.layout.partition=function(){function t(e,n,r,i){var a=e.children;if(e.x=n,e.y=e.depth*i,e.dx=r,e.dy=i,a&&(o=a.length)){var o,s,l,u=-1;for(r=e.value?r/e.value:0;++uf?-1:1),p=uo.sum(u),m=p?(f-l*d)/p:0,g=uo.range(l),v=[];return null!=n&&g.sort(n===Ml?function(t,e){return u[e]-u[t]}:function(t,e){return n(o[t],o[e])}),g.forEach(function(t){v[t]={data:o[t],value:s=u[t],startAngle:c,endAngle:c+=s*m+d,padAngle:h}}),v}var e=Number,n=Ml,r=0,i=Vo,a=0;return t.value=function(n){return arguments.length?(e=n,t):e},t.sort=function(e){return arguments.length?(n=e,t):n},t.startAngle=function(e){return arguments.length?(r=e,t):r},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(a=e,t):a},t};var Ml={};uo.layout.stack=function(){function t(s,l){if(!(h=s.length))return s;var u=s.map(function(n,r){return e.call(t,n,r)}),c=u.map(function(e){return e.map(function(e,n){return[a.call(t,e,n),o.call(t,e,n)]})}),f=n.call(t,c,l);u=uo.permute(u,f),c=uo.permute(c,f);var h,d,p,m,g=r.call(t,c,l),v=u[0].length;for(p=0;v>p;++p)for(i.call(t,u[0][p],m=g[p],c[0][p][1]),d=1;h>d;++d)i.call(t,u[d][p],m+=c[d-1][p][1],c[d][p][1]);return s}var e=_,n=gi,r=vi,i=mi,a=di,o=pi;return t.values=function(n){return arguments.length?(e=n,t):e},t.order=function(e){return arguments.length?(n="function"==typeof e?e:kl.get(e)||gi,t):n},t.offset=function(e){return arguments.length?(r="function"==typeof e?e:Sl.get(e)||vi,t):r},t.x=function(e){return arguments.length?(a=e,t):a},t.y=function(e){return arguments.length?(o=e,t):o},t.out=function(e){return arguments.length?(i=e,t):i},t};var kl=uo.map({"inside-out":function(t){var e,n,r=t.length,i=t.map(yi),a=t.map(xi),o=uo.range(r).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,u=[],c=[];for(e=0;r>e;++e)n=o[e],l>s?(s+=a[n],u.push(n)):(l+=a[n],c.push(n));return c.reverse().concat(u)},reverse:function(t){return uo.range(t.length).reverse()},"default":gi}),Sl=uo.map({silhouette:function(t){var e,n,r,i=t.length,a=t[0].length,o=[],s=0,l=[];for(n=0;a>n;++n){for(e=0,r=0;i>e;e++)r+=t[e][n][1];r>s&&(s=r),o.push(r)}for(n=0;a>n;++n)l[n]=(s-o[n])/2;return l},wiggle:function(t){var e,n,r,i,a,o,s,l,u,c=t.length,f=t[0],h=f.length,d=[];for(d[0]=l=u=0,n=1;h>n;++n){for(e=0,i=0;c>e;++e)i+=t[e][n][1];for(e=0,a=0,s=f[n][0]-f[n-1][0];c>e;++e){for(r=0,o=(t[e][n][1]-t[e][n-1][1])/(2*s);e>r;++r)o+=(t[r][n][1]-t[r][n-1][1])/s;a+=o*t[e][n][1]}d[n]=l-=i?a/i*s:0,u>l&&(u=l)}for(n=0;h>n;++n)d[n]-=u;return d},expand:function(t){var e,n,r,i=t.length,a=t[0].length,o=1/i,s=[];for(n=0;a>n;++n){for(e=0,r=0;i>e;e++)r+=t[e][n][1];if(r)for(e=0;i>e;e++)t[e][n][1]/=r;else for(e=0;i>e;e++)t[e][n][1]=o}for(n=0;a>n;++n)s[n]=0;return s},zero:vi});uo.layout.histogram=function(){function t(t,a){for(var o,s,l=[],u=t.map(n,this),c=r.call(this,u,a),f=i.call(this,c,u,a),a=-1,h=u.length,d=f.length-1,p=e?1:1/h;++a0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,n=Number,r=Mi,i=bi;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=Et(e),t):r},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Et(e),t):i},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},uo.layout.pack=function(){function t(t,a){var o=n.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Ei),r){var f=r*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=f}),li(s,Ei),li(s,function(t){t.r-=f})}return Ii(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,n=uo.layout.hierarchy().sort(ki),r=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},oi(t,n)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),f=c[0],h=e(f);if(li(h,n),h.parent.m=-h.z,si(h,r),u)si(f,a);else{var d=f,p=f,m=f;si(f,function(t){t.xp.x&&(p=t),t.depth>m.depth&&(m=t)});var g=s(d,p)/2-d.x,v=l[0]/(p.x+s(p,d)/2+g),y=l[1]/(m.depth||1);si(f,function(t){t.x=(t.x+g)*v,t.y=t.depth*y})}return c}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var i,a=e.children,o=0,s=a.length;s>o;++o)r.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 n.children[0]}function n(t){var e=t.children,n=t.parent.children,r=t.i?n[t.i-1]:null;if(e.length){Ri(t);var a=(e[0].z+e[e.length-1].z)/2;r?(t.z=r.z+s(t._,r._),t.m=t.z-a):t.z=a}else r&&(t.z=r.z+s(t._,r._));t.parent.A=i(t,r,t.parent.A||n[0])}function r(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t,e,n){if(e){for(var r,i=t,a=t,o=e,l=i.parent.children[0],u=i.m,c=a.m,f=o.m,h=l.m;o=Oi(o),i=Ci(i),o&&i;)l=Ci(l),a=Oi(a),a.a=t,r=o.z+f-i.z-u+s(o._,i._),r>0&&(Fi(Ni(o,t,n),t,r),u+=r,c+=r),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Oi(a)&&(a.t=o,a.m+=f-c),i&&!Ci(l)&&(l.t=i,l.m+=u-h,n=t)}return n}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Pi,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=ji(e)):(t.x=o?u+=n(t,o):0,t.y=0,o=t)});var c=qi(l),f=Vi(l),h=c.x-n(c,f)/2,d=f.x+n(f,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*r[0],t.y=(l.y-t.y)*r[1]}:function(t){t.x=(t.x-h)/(d-h)*r[0],t.y=(1-(l.y?t.y/l.y:1))*r[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),n=Pi,r=[1,1],i=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(i=null==(r=e),t):i?null:r},t.nodeSize=function(e){return arguments.length?(i=null!=(r=e),t):i?r:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var n,r,i=-1,a=t.length;++ie?0:e),n.area=isNaN(r)||0>=r?0:r}function e(n){var a=n.children;if(a&&a.length){var o,s,l,u=f(n),c=[],h=a.slice(),p=1/0,m="slice"===d?u.dx:"dice"===d?u.dy:"slice-dice"===d?1&n.depth?u.dy:u.dx:Math.min(u.dx,u.dy);for(t(h,u.dx*u.dy/n.value),c.area=0;(l=h.length)>0;)c.push(o=h[l-1]),c.area+=o.area,"squarify"!==d||(s=r(c,m))<=p?(h.pop(),p=s):(c.area-=c.pop().area,i(c,m,u,!1),m=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,m,u,!0),c.length=c.area=0),a.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var a,o=f(e),s=r.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,i=0,a=1/0,o=-1,s=t.length;++on&&(a=n),n>i&&(i=n));return r*=r,e*=e,r?Math.max(e*i*p/r,r/(e*a*p)):1/0}function i(t,e,n,r){var i,a=-1,o=t.length,s=n.x,u=n.y,c=e?l(t.area/e):0;if(e==n.dx){for((r||c>n.dy)&&(c=n.dy);++an.dx)&&(c=n.dx);++an&&(e=1),1>n&&(t=0),function(){var n,r,i;do n=2*Math.random()-1,r=2*Math.random()-1,i=n*n+r*r;while(!i||i>1);return t+e*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;t>n;n++)e+=Math.random();return e}}},uo.scale={};var Tl={floor:_,ceil:_};uo.scale.linear=function(){return $i([0,1],[0,1],br,!1)};var Al={s:1,g:1,p:1,r:1,e:1};uo.scale.log=function(){return aa(uo.scale.linear().domain([0,1]),10,!0,[1,10])};var El=uo.format(".0e"),Ll={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};uo.scale.pow=function(){return oa(uo.scale.linear(),1,[0,1])},uo.scale.sqrt=function(){return uo.scale.pow().exponent(.5)},uo.scale.ordinal=function(){return la([],{t:"range",a:[[]]})},uo.scale.category10=function(){return uo.scale.ordinal().range(zl)},uo.scale.category20=function(){return uo.scale.ordinal().range(Il)},uo.scale.category20b=function(){return uo.scale.ordinal().range(Dl)},uo.scale.category20c=function(){return uo.scale.ordinal().range(Pl)};var zl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(bt),Il=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(bt),Dl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(bt),Pl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(bt);uo.scale.quantile=function(){return ua([],[])},uo.scale.quantize=function(){return ca(0,1,[0,1])},uo.scale.threshold=function(){return fa([.5],[0,1])},uo.scale.identity=function(){return ha([0,1])},uo.svg={},uo.svg.arc=function(){function t(){var t=Math.max(0,+n.apply(this,arguments)),u=Math.max(0,+r.apply(this,arguments)),c=o.apply(this,arguments)-Zo,f=s.apply(this,arguments)-Zo,h=Math.abs(f-c),d=c>f?0:1; -if(t>u&&(p=u,u=t,t=p),h>=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,m,g,v,y,x,_,b,w,M,k,S,T=0,A=0,E=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=a===Cl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(A*=-1),u&&(A=rt(g/u*Math.sin(v))),t&&(T=rt(g/t*Math.sin(v)))),u){y=u*Math.cos(c+A),x=u*Math.sin(c+A),_=u*Math.cos(f-A),b=u*Math.sin(f-A);var L=Math.abs(f-c-2*A)<=qo?0:1;if(A&&xa(y,x,_,b)===d^L){var z=(c+f)/2;y=u*Math.cos(z),x=u*Math.sin(z),_=b=null}}else y=x=0;if(t){w=t*Math.cos(f-T),M=t*Math.sin(f-T),k=t*Math.cos(c+T),S=t*Math.sin(c+T);var I=Math.abs(c-f+2*T)<=qo?0:1;if(T&&xa(w,M,k,S)===1-d^I){var D=(c+f)/2;w=t*Math.cos(D),M=t*Math.sin(D),k=S=null}}else w=M=0;if(h>jo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){m=u>t^d?0:1;var P=p,C=p;if(qo>h){var O=null==k?[w,M]:null==_?[y,x]:Fn([y,x],[k,S],[_,b],[w,M]),F=y-O[0],R=x-O[1],N=_-O[0],j=b-O[1],B=1/Math.sin(Math.acos((F*N+R*j)/(Math.sqrt(F*F+R*R)*Math.sqrt(N*N+j*j)))/2),q=Math.sqrt(O[0]*O[0]+O[1]*O[1]);C=Math.min(p,(t-q)/(B-1)),P=Math.min(p,(u-q)/(B+1))}if(null!=_){var V=_a(null==k?[w,M]:[k,S],[y,x],u,P,d),U=_a([_,b],[w,M],u,P,d);p===P?E.push("M",V[0],"A",P,",",P," 0 0,",m," ",V[1],"A",u,",",u," 0 ",1-d^xa(V[1][0],V[1][1],U[1][0],U[1][1]),",",d," ",U[1],"A",P,",",P," 0 0,",m," ",U[0]):E.push("M",V[0],"A",P,",",P," 0 1,",m," ",U[0])}else E.push("M",y,",",x);if(null!=k){var Z=_a([y,x],[k,S],t,-C,d),H=_a([w,M],null==_?[y,x]:[_,b],t,-C,d);p===C?E.push("L",H[0],"A",C,",",C," 0 0,",m," ",H[1],"A",t,",",t," 0 ",d^xa(H[1][0],H[1][1],Z[1][0],Z[1][1]),",",1-d," ",Z[1],"A",C,",",C," 0 0,",m," ",Z[0]):E.push("L",H[0],"A",C,",",C," 0 0,",m," ",Z[0])}else E.push("L",w,",",M)}else E.push("M",y,",",x),null!=_&&E.push("A",u,",",u," 0 ",L,",",d," ",_,",",b),E.push("L",w,",",M),null!=k&&E.push("A",t,",",t," 0 ",I,",",1-d," ",k,",",S);return E.push("Z"),E.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var n=pa,r=ma,i=da,a=Cl,o=ga,s=va,l=ya;return t.innerRadius=function(e){return arguments.length?(n=Et(e),t):n},t.outerRadius=function(e){return arguments.length?(r=Et(e),t):r},t.cornerRadius=function(e){return arguments.length?(i=Et(e),t):i},t.padRadius=function(e){return arguments.length?(a=e==Cl?Cl:Et(e),t):a},t.startAngle=function(e){return arguments.length?(o=Et(e),t):o},t.endAngle=function(e){return arguments.length?(s=Et(e),t):s},t.padAngle=function(e){return arguments.length?(l=Et(e),t):l},t.centroid=function(){var t=(+n.apply(this,arguments)+ +r.apply(this,arguments))/2,e=(+o.apply(this,arguments)+ +s.apply(this,arguments))/2-Zo;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Cl="auto";uo.svg.line=function(){return ba(_)};var Ol=uo.map({linear:wa,"linear-closed":Ma,step:ka,"step-before":Sa,"step-after":Ta,basis:Da,"basis-open":Pa,"basis-closed":Ca,bundle:Oa,cardinal:La,"cardinal-open":Aa,"cardinal-closed":Ea,monotone:qa});Ol.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var Fl=[0,2/3,1/3,0],Rl=[0,1/3,2/3,0],Nl=[0,1/6,2/3,1/6];uo.svg.line.radial=function(){var t=ba(Va);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},Sa.reverse=Ta,Ta.reverse=Sa,uo.svg.area=function(){return Ua(_)},uo.svg.area.radial=function(){var t=Ua(Va);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},uo.svg.chord=function(){function t(t,s){var l=e(this,a,t,s),u=e(this,o,t,s);return"M"+l.p0+r(l.r,l.p1,l.a1-l.a0)+(n(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+r(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function e(t,e,n,r){var i=e.call(t,n,r),a=s.call(t,i,r),o=l.call(t,i,r)-Zo,c=u.call(t,i,r)-Zo;return{r:a,a0:o,a1:c,p0:[a*Math.cos(o),a*Math.sin(o)],p1:[a*Math.cos(c),a*Math.sin(c)]}}function n(t,e){return t.a0==e.a0&&t.a1==e.a1}function r(t,e,n){return"A"+t+","+t+" 0 "+ +(n>qo)+",1 "+e}function i(t,e,n,r){return"Q 0,0 "+r}var a=bn,o=wn,s=Za,l=ga,u=va;return t.radius=function(e){return arguments.length?(s=Et(e),t):s},t.source=function(e){return arguments.length?(a=Et(e),t):a},t.target=function(e){return arguments.length?(o=Et(e),t):o},t.startAngle=function(e){return arguments.length?(l=Et(e),t):l},t.endAngle=function(e){return arguments.length?(u=Et(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=n.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=bn,n=wn,r=Ha;return t.source=function(n){return arguments.length?(e=Et(n),t):e},t.target=function(e){return arguments.length?(n=Et(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ha,n=t.projection;return t.projection=function(t){return arguments.length?n(Ga(e=t)):e},t},uo.svg.symbol=function(){function t(t,r){return(jl.get(e.call(this,t,r))||Wa)(n.call(this,t,r))}var e=Ya,n=Xa;return t.type=function(n){return arguments.length?(e=Et(n),t):e},t.size=function(e){return arguments.length?(n=Et(e),t):n},t};var jl=uo.map({circle:Wa,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*ql)),n=e*ql;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Bl),n=e*Bl/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Bl),n=e*Bl/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});uo.svg.symbolTypes=jl.keys();var Bl=Math.sqrt(3),ql=Math.tan(30*Ho);Io.transition=function(t){for(var e,n,r=Vl||++Gl,i=to(t),a=[],o=Ul||{time:Date.now(),ease:Er,delay:0,duration:250},s=-1,l=this.length;++sa;a++){i.push(e=[]);for(var n=this[a],s=0,l=n.length;l>s;s++)(r=n[s])&&t.call(r,r.__data__,s,a)&&e.push(r)}return $a(i,this.namespace,this.id)},Hl.tween=function(t,e){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(t):H(this,null==e?function(e){e[r][n].tween.remove(t)}:function(i){i[r][n].tween.set(t,e)})},Hl.attr=function(t,e){function n(){this.removeAttribute(s)}function r(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?n:(t+="",function(){var e,n=this.getAttribute(s);return n!==t&&(e=o(n,t),function(t){this.setAttribute(s,e(t))})})}function a(t){return null==t?r:(t+="",function(){var e,n=this.getAttributeNS(s.space,s.local);return n!==t&&(e=o(n,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var o="transform"==t?Wr:br,s=uo.ns.qualify(t);return Qa(this,"attr."+t,e,s.local?a:i)},Hl.attrTween=function(t,e){function n(t,n){var r=e.call(this,t,n,this.getAttribute(i));return r&&function(t){this.setAttribute(i,r(t))}}function r(t,n){var r=e.call(this,t,n,this.getAttributeNS(i.space,i.local));return r&&function(t){this.setAttributeNS(i.space,i.local,r(t))}}var i=uo.ns.qualify(t);return this.tween("attr."+t,i.local?r:n)},Hl.style=function(t,e,n){function i(){this.style.removeProperty(t)}function a(e){return null==e?i:(e+="",function(){var i,a=r(this).getComputedStyle(this,null).getPropertyValue(t);return a!==e&&(i=br(a,e),function(e){this.style.setProperty(t,i(e),n)})})}var o=arguments.length;if(3>o){if("string"!=typeof t){2>o&&(e="");for(n in t)this.style(n,t[n],e);return this}n=""}return Qa(this,"style."+t,e,a)},Hl.styleTween=function(t,e,n){function i(i,a){var o=e.call(this,i,a,r(this).getComputedStyle(this,null).getPropertyValue(t));return o&&function(e){this.style.setProperty(t,o(e),n)}}return arguments.length<3&&(n=""),this.tween("style."+t,i)},Hl.text=function(t){return Qa(this,"text",t,Ka)},Hl.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Hl.ease=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].ease:("function"!=typeof t&&(t=uo.ease.apply(uo,arguments)),H(this,function(r){r[n][e].ease=t}))},Hl.delay=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].delay:H(this,"function"==typeof t?function(r,i,a){r[n][e].delay=+t.call(r,r.__data__,i,a)}:(t=+t,function(r){r[n][e].delay=t}))},Hl.duration=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].duration:H(this,"function"==typeof t?function(r,i,a){r[n][e].duration=Math.max(1,t.call(r,r.__data__,i,a))}:(t=Math.max(1,t),function(r){r[n][e].duration=t}))},Hl.each=function(t,e){var n=this.id,r=this.namespace;if(arguments.length<2){var i=Ul,a=Vl;try{Vl=n,H(this,function(e,i,a){Ul=e[r][n],t.call(e,e.__data__,i,a)})}finally{Ul=i,Vl=a}}else H(this,function(i){var a=i[r][n];(a.event||(a.event=uo.dispatch("start","end","interrupt"))).on(t,e)});return this},Hl.transition=function(){for(var t,e,n,r,i=this.id,a=++Gl,o=this.namespace,s=[],l=0,u=this.length;u>l;l++){s.push(t=[]);for(var e=this[l],c=0,f=e.length;f>c;c++)(n=e[c])&&(r=n[o][i],eo(n,c,o,a,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),t.push(n)}return $a(s,o,a)},uo.svg.axis=function(){function t(t){t.each(function(){var t,u=uo.select(this),c=this.__chart__||n,f=this.__chart__=n.copy(),h=null==l?f.ticks?f.ticks.apply(f,s):f.domain():l,d=null==e?f.tickFormat?f.tickFormat.apply(f,s):_:e,p=u.selectAll(".tick").data(h,f),m=p.enter().insert("g",".domain").attr("class","tick").style("opacity",jo),g=uo.transition(p.exit()).style("opacity",jo).remove(),v=uo.transition(p.order()).style("opacity",1),y=Math.max(i,0)+o,x=Gi(f),b=u.selectAll(".domain").data([0]),w=(b.enter().append("path").attr("class","domain"),uo.transition(b));m.append("line"),m.append("text");var M,k,S,T,A=m.select("line"),E=v.select("line"),L=p.select("text").text(d),z=m.select("text"),I=v.select("text"),D="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(t=no,M="x",S="y",k="x2",T="y2",L.attr("dy",0>D?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+D*a+"V0H"+x[1]+"V"+D*a)):(t=ro,M="y",S="x",k="y2",T="x2",L.attr("dy",".32em").style("text-anchor",0>D?"end":"start"),w.attr("d","M"+D*a+","+x[0]+"H0V"+x[1]+"H"+D*a)),A.attr(T,D*i),z.attr(S,D*y),E.attr(k,0).attr(T,D*i),I.attr(M,0).attr(S,D*y),f.rangeBand){var P=f,C=P.rangeBand()/2;c=f=function(t){return P(t)+C}}else c.rangeBand?c=f:g.call(t,f,c);m.call(t,c,f),v.call(t,f,f)})}var e,n=uo.scale.linear(),r=Xl,i=6,a=6,o=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(n=e,t):n},t.orient=function(e){return arguments.length?(r=e in Yl?e+"":Xl,t):r},t.ticks=function(){return arguments.length?(s=fo(arguments),t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(n){return arguments.length?(e=n,t):e},t.tickSize=function(e){var n=arguments.length;return n?(i=+e,a=+arguments[n-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(a=+e,t):a},t.tickPadding=function(e){return arguments.length?(o=+e,t):o},t.tickSubdivide=function(){return arguments.length&&t},t};var Xl="bottom",Yl={top:1,right:1,bottom:1,left:1};uo.svg.brush=function(){function t(r){r.each(function(){var r=uo.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",a).on("touchstart.brush",a),o=r.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),r.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=r.selectAll(".resize").data(m,_);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Wl[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var l,f=uo.transition(r),h=uo.transition(o);u&&(l=Gi(u),h.attr("x",l[0]).attr("width",l[1]-l[0]),n(f)),c&&(l=Gi(c),h.attr("y",l[0]).attr("height",l[1]-l[0]),i(f)),e(f)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+f[+/e$/.test(t)]+","+h[+/^s/.test(t)]+")"})}function n(t){t.select(".extent").attr("x",f[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function a(){function a(){32==uo.event.keyCode&&(L||(x=null,I[0]-=f[1],I[1]-=h[1],L=2),T())}function m(){32==uo.event.keyCode&&2==L&&(I[0]+=f[1],I[1]+=h[1],L=0,T())}function g(){var t=uo.mouse(b),r=!1;_&&(t[0]+=_[0],t[1]+=_[1]),L||(uo.event.altKey?(x||(x=[(f[0]+f[1])/2,(h[0]+h[1])/2]),I[0]=f[+(t[0]c?(i=r,r=c):i=c),m[0]!=r||m[1]!=i?(n?s=null:o=null,m[0]=r,m[1]=i,!0):void 0}function y(){g(),k.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),uo.select("body").style("cursor",null),D.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),M({type:"brushend"})}var x,_,b=this,w=uo.select(uo.event.target),M=l.of(b,arguments),k=uo.select(b),S=w.datum(),A=!/^(n|s)$/.test(S)&&u,E=!/^(e|w)$/.test(S)&&c,L=w.classed("extent"),z=$(b),I=uo.mouse(b),D=uo.select(r(b)).on("keydown.brush",a).on("keyup.brush",m);if(uo.event.changedTouches?D.on("touchmove.brush",g).on("touchend.brush",y):D.on("mousemove.brush",g).on("mouseup.brush",y),k.interrupt().selectAll("*").interrupt(),L)I[0]=f[0]-I[0],I[1]=h[0]-I[1];else if(S){var P=+/w$/.test(S),C=+/^n/.test(S);_=[f[1-P]-I[0],h[1-C]-I[1]],I[0]=f[P],I[1]=h[C]}else uo.event.altKey&&(x=I.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),uo.select("body").style("cursor",w.style("cursor")),M({type:"brushstart"}),g()}var o,s,l=E(t,"brushstart","brush","brushend"),u=null,c=null,f=[0,0],h=[0,0],d=!0,p=!0,m=Jl[0];return t.event=function(t){t.each(function(){var t=l.of(this,arguments),e={x:f,y:h,i:o,j:s},n=this.__chart__||e;this.__chart__=e,Vl?uo.select(this).transition().each("start.brush",function(){o=n.i,s=n.j,f=n.x,h=n.y,t({type:"brushstart"})}).tween("brush:brush",function(){var n=wr(f,e.x),r=wr(h,e.y);return o=s=null,function(i){f=e.x=n(i),h=e.y=r(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(u=e,m=Jl[!u<<1|!c],t):u},t.y=function(e){return arguments.length?(c=e,m=Jl[!u<<1|!c],t):c},t.clamp=function(e){return arguments.length?(u&&c?(d=!!e[0],p=!!e[1]):u?d=!!e:c&&(p=!!e),t):u&&c?[d,p]:u?d:c?p:null},t.extent=function(e){var n,r,i,a,l;return arguments.length?(u&&(n=e[0],r=e[1],c&&(n=n[0],r=r[0]),o=[n,r],u.invert&&(n=u(n),r=u(r)),n>r&&(l=n,n=r,r=l),n==f[0]&&r==f[1]||(f=[n,r])),c&&(i=e[0],a=e[1],u&&(i=i[1],a=a[1]),s=[i,a],c.invert&&(i=c(i),a=c(a)),i>a&&(l=i,i=a,a=l),i==h[0]&&a==h[1]||(h=[i,a])),t):(u&&(o?(n=o[0],r=o[1]):(n=f[0],r=f[1],u.invert&&(n=u.invert(n),r=u.invert(r)),n>r&&(l=n,n=r,r=l))),c&&(s?(i=s[0],a=s[1]):(i=h[0],a=h[1],c.invert&&(i=c.invert(i),a=c.invert(a)),i>a&&(l=i,i=a,a=l))),u&&c?[[n,i],[r,a]]:u?[n,r]:c&&[i,a])},t.clear=function(){return t.empty()||(f=[0,0],h=[0,0],o=s=null),t},t.empty=function(){return!!u&&f[0]==f[1]||!!c&&h[0]==h[1]},uo.rebind(t,l,"on")};var Wl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Jl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],$l=gs.format=ws.timeFormat,Ql=$l.utc,Kl=Ql("%Y-%m-%dT%H:%M:%S.%LZ");$l.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?io:Kl,io.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},io.toString=Kl.toString,gs.second=Vt(function(t){return new vs(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),gs.seconds=gs.second.range,gs.seconds.utc=gs.second.utc.range,gs.minute=Vt(function(t){return new vs(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),gs.minutes=gs.minute.range,gs.minutes.utc=gs.minute.utc.range,gs.hour=Vt(function(t){var e=t.getTimezoneOffset()/60;return new vs(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),gs.hours=gs.hour.range,gs.hours.utc=gs.hour.utc.range,gs.month=Vt(function(t){return t=gs.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),gs.months=gs.month.range,gs.months.utc=gs.month.utc.range;var tu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],eu=[[gs.second,1],[gs.second,5],[gs.second,15],[gs.second,30],[gs.minute,1],[gs.minute,5],[gs.minute,15],[gs.minute,30],[gs.hour,1],[gs.hour,3],[gs.hour,6],[gs.hour,12],[gs.day,1],[gs.day,2],[gs.week,1],[gs.month,1],[gs.month,3],[gs.year,1]],nu=$l.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Ie]]),ru={range:function(t,e,n){return uo.range(Math.ceil(t/n)*n,+e,n).map(oo)},floor:_,ceil:_};eu.year=gs.year,gs.scale=function(){return ao(uo.scale.linear(),eu,nu)};var iu=eu.map(function(t){return[t[0].utc,t[1]]}),au=Ql.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Ie]]);iu.year=gs.year.utc,gs.scale.utc=function(){return ao(uo.scale.linear(),iu,au)},uo.text=Lt(function(t){return t.responseText}),uo.json=function(t,e){return zt(t,"application/json",so,e)},uo.html=function(t,e){return zt(t,"text/html",lo,e)},uo.xml=Lt(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=uo,t(uo)):"object"==typeof n&&n.exports?n.exports=uo:this.d3=uo}()},{}],14:[function(e,n,r){(function(r,i){(function(){"use strict";function a(t){return"function"==typeof t||"object"==typeof t&&null!==t}function o(t){return"function"==typeof t}function s(t){G=t}function l(t){J=t}function u(){return function(){r.nextTick(p)}}function c(){return function(){H(p)}}function f(){var t=0,e=new K(p),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function h(){var t=new MessageChannel;return t.port1.onmessage=p,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(p,1)}}function p(){for(var t=0;W>t;t+=2){var e=nt[t],n=nt[t+1];e(n),nt[t]=void 0,nt[t+1]=void 0}W=0}function m(){try{var t=e,n=t("vertx");return H=n.runOnLoop||n.runOnContext,c()}catch(r){return d()}}function g(t,e){var n=this,r=n._state;if(r===ot&&!t||r===st&&!e)return this;var i=new this.constructor(y),a=n._result;if(r){var o=arguments[r-1];J(function(){C(r,i,o,a)})}else z(n,i,t,e);return i}function v(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(y);return T(n,t),n}function y(){}function x(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function b(t){try{return t.then}catch(e){return lt.error=e,lt}}function w(t,e,n,r){try{t.call(e,n,r)}catch(i){return i}}function M(t,e,n){J(function(t){var r=!1,i=w(n,e,function(n){r||(r=!0,e!==n?T(t,n):E(t,n))},function(e){r||(r=!0,L(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,L(t,i))},t)}function k(t,e){e._state===ot?E(t,e._result):e._state===st?L(t,e._result):z(e,void 0,function(e){T(t,e)},function(e){L(t,e)})}function S(t,e,n){e.constructor===t.constructor&&n===rt&&constructor.resolve===it?k(t,e):n===lt?L(t,lt.error):void 0===n?E(t,e):o(n)?M(t,e,n):E(t,e)}function T(t,e){t===e?L(t,x()):a(e)?S(t,e,b(e)):E(t,e)}function A(t){t._onerror&&t._onerror(t._result),I(t)}function E(t,e){t._state===at&&(t._result=e,t._state=ot,0!==t._subscribers.length&&J(I,t))}function L(t,e){t._state===at&&(t._state=st,t._result=e,J(A,t))}function z(t,e,n,r){var i=t._subscribers,a=i.length;t._onerror=null,i[a]=e,i[a+ot]=n,i[a+st]=r,0===a&&t._state&&J(I,t)}function I(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,i,a=t._result,o=0;oo;o++)z(r.resolve(t[o]),void 0,e,n);return i}function N(t){var e=this,n=new e(y);return L(n,t),n}function j(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function q(t){this._id=dt++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==t&&("function"!=typeof t&&j(),this instanceof q?O(this,t):B())}function V(t,e){this._instanceConstructor=t,this.promise=new t(y),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&E(this.promise,this._result))):L(this.promise,this._validationError())}function U(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;n&&"[object Promise]"===Object.prototype.toString.call(n.resolve())&&!n.cast||(t.Promise=pt)}var Z;Z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var H,G,X,Y=Z,W=0,J=function(t,e){nt[W]=t,nt[W+1]=e,W+=2,2===W&&(G?G(p):X())},$="undefined"!=typeof window?window:void 0,Q=$||{},K=Q.MutationObserver||Q.WebKitMutationObserver,tt="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);X=tt?u():K?f():et?h():void 0===$&&"function"==typeof e?m():d();var rt=g,it=v,at=void 0,ot=1,st=2,lt=new D,ut=new D,ct=F,ft=R,ht=N,dt=0,pt=q;q.all=ct,q.race=ft,q.resolve=it,q.reject=ht,q._setScheduler=s,q._setAsap=l,q._asap=J,q.prototype={constructor:q,then:rt,"catch":function(t){return this.then(null,t)}};var mt=V;V.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},V.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===at&&t>n;n++)this._eachEntry(e[n],n)},V.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===it){var i=b(t);if(i===rt&&t._state!==at)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===pt){var a=new n(y);S(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},V.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===at&&(this._remaining--,t===st?L(r,n):this._result[e]=n),0===this._remaining&&E(r,this._result)},V.prototype._willSettleAt=function(t,e){var n=this;z(t,void 0,function(t){n._settledAt(ot,e,t)},function(t){n._settledAt(st,e,t)})};var gt=U,vt={Promise:pt,polyfill:gt};"function"==typeof t&&t.amd?t(function(){return vt}):"undefined"!=typeof n&&n.exports?n.exports=vt:"undefined"!=typeof this&&(this.ES6Promise=vt),gt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:10}],15:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;n>r;r++)if(e=t.charCodeAt(r),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],16:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n+n,s=r+r,l=i+i,u=n*o,c=r*o,f=r*s,h=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-f-p,t[1]=c+v,t[2]=h-g,t[3]=0,t[4]=c-v,t[5]=1-u-p,t[6]=d+m,t[7]=0,t[8]=h+g,t[9]=d-m,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],17:[function(t,e,n){"use strict";function r(t){if(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layer=t.layer,this.childLayers=t.childLayers,this.type=this.layer.type,this.features=[],this.id=this.layer.id,this.index=t.index,this.sourceLayer=this.layer.sourceLayer,this.sourceLayerIndex=t.sourceLayerIndex,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,this.paintAttributes=a(this),t.arrays){var e=this.childLayers;this.bufferGroups=c.mapObject(t.arrays,function(n,r){return n.map(function(n){var i=c.mapObject(n,function(e,n){return c.mapObject(e,function(e,i){var a=t.arrayTypes[r][n][i],o=a.members.length&&"vertices"===a.members[0].name?u.BufferType.ELEMENT:u.BufferType.VERTEX;return new u(e,a,o)})});i.vaos={},i.layout.element2&&(i.secondVaos={});for(var a=0;ax;x++)y.push(m[Math.min(v+x,m.length-1)]);var _=f.components;if(1===_)p.attributes.push(c.extend({},f,{getValue:o(f,y),isFunction:!0,components:4*_}));else for(var b=0;4>b;b++)p.attributes.push(c.extend({},f,{getValue:o(f,[y[b]]),isFunction:!0,name:f.name+b}));p.uniforms.push(c.extend({},f,{name:"u_"+f.name.slice(2)+"_t",getValue:s(f,v),components:1}))}}}return e}function o(t,e){return function(n,r,i){if(1===e.length)return t.getValue(n,c.extend({},r,{zoom:e[0]}),i);for(var a=[],o=0;o65535){var i=this.arrayTypes[t],a=i.layout.vertex,o=i.layout.element,s=i.layout.element2;r={index:n.length,layout:{},paint:{}},r.layout.vertex=new a,o&&(r.layout.element=new o),s&&(r.layout.element2=new s);for(var l=0;ly;y++)for(var x=f.get(y),_=0;v>_;_++){var b=v>1?p.name+_:p.name;x[b]=m[_]*g}}}},{"../render/vertex_array_object":43,"../util/struct_array":117,"../util/util":119,"./bucket/circle_bucket":18,"./bucket/fill_bucket":19,"./bucket/line_bucket":20,"./bucket/symbol_bucket":21,"./buffer":22,"feature-filter":122}],18:[function(t,e,n){"use strict";function r(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=i.EXTENT;e.exports=r,r.prototype=a.inherit(i,{}),r.prototype.addCircleVertex=function(t,e,n,r,i){return t.emplaceBack(2*e+(r+1)/2,2*n+(i+1)/2)},r.prototype.programInterfaces={circle:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"}],paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,n){return a.premultiply(t.getPaintValue("circle-color",e,n))},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,n){return[t.getPaintValue("circle-radius",e,n)]},multiplier:10,paintProperty:"circle-radius"}]}},r.prototype.addFeature=function(t){for(var e={zoom:this.zoom},n=o(t),r=this.makeRoomFor("circle",0),i=r.layout.vertex.length,a=0;au||u>=s||0>c||c>=s)){var f=this.makeRoomFor("circle",4),h=f.layout.vertex,d=this.addCircleVertex(h,u,c,-1,-1);this.addCircleVertex(h,u,c,1,-1),this.addCircleVertex(h,u,c,1,1),this.addCircleVertex(h,u,c,-1,1),f.layout.element.emplaceBack(d,d+1,d+2),f.layout.element.emplaceBack(d,d+3,d+2)}}this.addPaintAttributes("circle",e,t.properties,r,i)}},{"../../util/util":119,"../bucket":17,"../load_geometry":24}],19:[function(t,e,n){"use strict";function r(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry");e.exports=r,r.prototype=a.inherit(i,{}),r.prototype.programInterfaces={fill:{vertexBuffer:!0,elementBuffer:!0,elementBuffer2:!0,elementBuffer2Components:2,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"}]}},r.prototype.addFeature=function(t){for(var e=o(t),n=0;n=2&&(o.x!==t[0].x||o.y!==t[0].y)&&i.layout.element.emplaceBack(e,n,s),a>=1&&i.layout.element2.emplaceBack(n,s),n=s}}},{"../../util/util":119,"../bucket":17,"../load_geometry":24}],20:[function(t,e,n){"use strict";function r(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=i.EXTENT,l=63,u=Math.cos(37.5*(Math.PI/180)),c=15,f=14,h=.5,d=Math.pow(2,f)/h;e.exports=r,r.prototype=a.inherit(i,{}),r.prototype.addLineVertex=function(t,e,n,r,i,a,o){return t.emplaceBack(e.x<<1|r,e.y<<1|i,Math.round(l*n.x)+128,Math.round(l*n.y)+128,(0===a?0:0>a?-1:1)+1|(o*h&63)<<2,o*h>>6)},r.prototype.programInterfaces={line:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]}},r.prototype.addFeature=function(t){for(var e=o(t),n=0;n2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(r=1.05);var o=c*(s/(512*this.overscaling)),l=t[0],f=t[a-1],h=l.equals(f);if(this.makeRoomFor("line",10*a),2!==a||!h){this.distance=0;var d,p,m,g,v,y,x,_=n,b=h?"butt":n,w=!0;this.e1=this.e2=this.e3=-1,h&&(d=t[a-2],v=l.sub(d)._unit()._perp());for(var M=0;a>M;M++)if(m=h&&M===a-1?t[1]:t[M+1],!m||!t[M].equals(m)){v&&(g=v),d&&(p=d),d=t[M],v=m?m.sub(d)._unit()._perp():g,g=g||v;var k=g.add(v)._unit(),S=k.x*v.x+k.y*v.y,T=1/S,A=u>S&&p&&m;if(A&&M>0){var E=d.dist(p);if(E>2*o){var L=d.sub(d.sub(p)._mult(o/E)._round());this.distance+=L.dist(p),this.addCurrentVertex(L,this.distance,g.mult(1),0,0,!1),p=L}}var z=p&&m,I=z?e:m?_:b;if(z&&"round"===I&&(i>T?I="miter":2>=T&&(I="fakeround")),"miter"===I&&T>r&&(I="bevel"),"bevel"===I&&(T>2&&(I="flipbevel"),r>T&&(I="miter")),p&&(this.distance+=d.dist(p)),"miter"===I)k._mult(T),this.addCurrentVertex(d,this.distance,k,0,0,!1);else if("flipbevel"===I){if(T>100)k=v.clone();else{var D=g.x*v.y-g.y*v.x>0?-1:1,P=T*g.add(v).mag()/g.sub(v).mag();k._perp()._mult(P*D)}this.addCurrentVertex(d,this.distance,k,0,0,!1),this.addCurrentVertex(d,this.distance,k.mult(-1),0,0,!1)}else if("bevel"===I||"fakeround"===I){var C=g.x*v.y-g.y*v.x>0,O=-Math.sqrt(T*T-1);if(C?(x=0,y=O):(y=0,x=O),w||this.addCurrentVertex(d,this.distance,g,y,x,!1),"fakeround"===I){for(var F,R=Math.floor(8*(.5-(S-.5))),N=0;R>N;N++)F=v.mult((N+1)/(R+1))._add(g)._unit(),this.addPieSliceVertex(d,this.distance,F,C);this.addPieSliceVertex(d,this.distance,k,C);for(var j=R-1;j>=0;j--)F=g.mult((j+1)/(R+1))._add(v)._unit(),this.addPieSliceVertex(d,this.distance,F,C)}m&&this.addCurrentVertex(d,this.distance,v,-y,-x,!1)}else"butt"===I?(w||this.addCurrentVertex(d,this.distance,g,0,0,!1),m&&this.addCurrentVertex(d,this.distance,v,0,0,!1)):"square"===I?(w||(this.addCurrentVertex(d,this.distance,g,1,1,!1),this.e1=this.e2=-1),m&&this.addCurrentVertex(d,this.distance,v,-1,-1,!1)):"round"===I&&(w||(this.addCurrentVertex(d,this.distance,g,0,0,!1),this.addCurrentVertex(d,this.distance,g,1,1,!0),this.e1=this.e2=-1),m&&(this.addCurrentVertex(d,this.distance,v,-1,-1,!0),this.addCurrentVertex(d,this.distance,v,0,0,!1)));if(A&&a-1>M){var B=d.dist(m);if(B>2*o){var q=d.add(m.sub(d)._mult(o/B)._round());this.distance+=q.dist(d),this.addCurrentVertex(q,this.distance,v.mult(1),0,0,!1),d=q}}w=!1}}}},r.prototype.addCurrentVertex=function(t,e,n,r,i,a){var o,s=a?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1].layout,u=l.vertex,c=l.element;o=n.clone(),r&&o._sub(n.perp()._mult(r)),this.e3=this.addLineVertex(u,t,o,s,0,r,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,o=n.mult(-1),i&&o._sub(n.perp()._mult(i)),this.e3=this.addLineVertex(u,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>d/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,n,r,i,a))},r.prototype.addPieSliceVertex=function(t,e,n,r){var i=r?1:0;n=n.mult(r?-1:1);var a=this.arrayGroups.line[this.arrayGroups.line.length-1].layout,o=a.vertex,s=a.element;this.e3=this.addLineVertex(o,t,n,0,i,0,e),this.e1>=0&&this.e2>=0&&s.emplaceBack(this.e1,this.e2,this.e3),r?this.e2=this.e3:this.e1=this.e3}},{"../../util/util":119,"../bucket":17,"../load_geometry":24}],21:[function(t,e,n){"use strict";function r(t){s.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,n,r,i,a,o,s,l,u){return t.emplaceBack(e,n,Math.round(64*r),Math.round(64*i),a/4,o/4,10*(u||0),0,10*(s||0),10*Math.min(l||25,25))}function a(t,e,n,r,i,a,o,s,l,u,c,f,h,d,p,m,g){this.x=t.x,this.y=t.y,this.index=o,this.hasText=!!n,this.hasIcon=!!r,this.hasText&&(this.glyphQuads=a?b(t,n,f,e,i,d):[],this.textCollisionFeature=new y(s,e,t,l,u,c,n,f,h,d,!1)),this.hasIcon&&(this.iconQuads=a?w(t,r,p,e,i,g):[],this.iconCollisionFeature=new y(s,e,t,l,u,c,r,p,m,g,!0))}var o=t("point-geometry"),s=t("../bucket"),l=t("../../symbol/anchor"),u=t("../../symbol/get_anchors"),c=t("../../util/token"),f=t("../../symbol/quads"),h=t("../../symbol/shaping"),d=t("../../symbol/resolve_text"),p=t("../../symbol/mergelines"),m=t("../../symbol/clip_line"),g=t("../../util/util"),v=t("../load_geometry"),y=t("../../symbol/collision_feature"),x=h.shapeText,_=h.shapeIcon,b=f.getGlyphQuads,w=f.getIconQuads,M=s.EXTENT;e.exports=r,r.prototype=g.inherit(s,{}),r.prototype.serialize=function(){var t=s.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var k=[{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_data1",components:4,type:"Uint8"},{name:"a_data2",components:2,type:"Uint8"}];r.prototype.addCollisionBoxVertex=function(t,e,n,r,i){return t.emplaceBack(e.x,e.y,Math.round(n.x),Math.round(n.y),10*r,10*i)},r.prototype.programInterfaces={glyph:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:k},icon:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:k},collisionBox:{vertexBuffer:!0,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}]}},r.prototype.populateBuffers=function(t,e,n){var r={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:r}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:r}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:r}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:r});var i=512*this.overscaling;this.tilePixelRatio=M/i,this.compareText={},this.symbolInstances=[],this.iconsNeedLinear=!1;var a=this.layer.layout,o=this.features,s=this.textFeatures,l=.5,u=.5;switch(a["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(a["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":u=1;break;case"top":case"top-right":case"top-left":u=0}for(var f="right"===a["text-justify"]?1:"left"===a["text-justify"]?0:.5,h=24,d=a["text-line-height"]*h,m="line"!==a["symbol-placement"]?a["text-max-width"]*h:0,g=a["text-letter-spacing"]*h,y=[a["text-offset"][0]*h,a["text-offset"][1]*h],b=this.fontstack=a["text-font"].join(","),w=[],k=0;kL;L++){var I=A[L];if(!(e&&k&&this.anchorIsTooClose(e.text,S,I))){var D=!(I.x<0||I.x>M||I.y<0||I.y>M);if(!g||D){var P=D||w;this.symbolInstances.push(new a(I,E,e,n,i,P,this.symbolInstances.length,this.collisionBoxArray,r,this.sourceLayerIndex,this.index,f,v,_,d,y,b))}}}}},r.prototype.anchorIsTooClose=function(t,e,n){var r=this.compareText;if(t in r){for(var i=r[t],a=i.length-1;a>=0;a--)if(n.dist(i[a])=g&&this.addSymbols("glyph",f.glyphQuads,g,n["text-keep-upright"],i,t.angle)),d&&(t.insertCollisionFeature(f.iconCollisionFeature,v,n["icon-ignore-placement"]),r>=v&&this.addSymbols("icon",f.iconQuads,v,n["icon-keep-upright"],a,t.angle))}e&&this.addToDebugBuffers(t)},r.prototype.addSymbols=function(t,e,n,r,a,o){for(var s=this.makeRoomFor(t,4*e.length),l=s.layout.element,u=s.layout.vertex,c=this.zoom,f=Math.max(Math.log(n)/Math.LN2+c,0),h=0;h3*Math.PI/2))){var g=d.tl,v=d.tr,y=d.bl,x=d.br,_=d.tex,b=d.anchorPoint,w=Math.max(c+Math.log(d.minScale)/Math.LN2,f),M=Math.min(c+Math.log(d.maxScale)/Math.LN2,25);if(!(w>=M)){w===f&&(w=0);var k=i(u,b.x,b.y,g.x,g.y,_.x,_.y,w,M,f);i(u,b.x,b.y,v.x,v.y,_.x+_.w,_.y,w,M,f),i(u,b.x,b.y,y.x,y.y,_.x,_.y+_.h,w,M,f),i(u,b.x,b.y,x.x,x.y,_.x+_.w,_.y+_.h,w,M,f),l.emplaceBack(k,k+1,k+2),l.emplaceBack(k+1,k+2,k+3)}}}},r.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var n=0;ns;s++){var l=this.symbolInstances[a][0===s?"textCollisionFeature":"iconCollisionFeature"];if(l)for(var u=l.boxStartIndex;u0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,n,r,i){if(!e[0]&&!e[1])return t;e=u.convert(e),"viewport"===n&&e._rotate(-r);for(var a=[],o=0;oa||c.ya)&&(console.warn("Geometry exceeds allowed extent, reduce your vector tile buffer size"),o=!0)}return n}},{"./bucket":17}],25:[function(t,e,n){"use strict";function r(t,e,n){this.column=t,this.row=e,this.zoom=n}e.exports=r,r.prototype={clone:function(){return new r(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],26:[function(t,e,n){"use strict";function r(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}e.exports=r;var i=t("../util/util").wrap;r.prototype.wrap=function(){return new r(i(this.lng,-180,180),this.lat)},r.prototype.toArray=function(){return[this.lng,this.lat]},r.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t}},{"../util/util":119}],27:[function(t,e,n){"use strict";function r(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=r;var i=t("./lng_lat");r.prototype={extend:function(t){var e,n,a=this._sw,o=this._ne;if(t instanceof i)e=t,n=t;else{if(!(t instanceof r))return t?this.extend(i.convert(t)||r.convert(t)):this;if(e=t._sw,n=t._ne,!e||!n)return this}return a||o?(a.lng=Math.min(e.lng,a.lng),a.lat=Math.min(e.lat,a.lat),o.lng=Math.max(n.lng,o.lng),o.lat=Math.max(n.lat,o.lat)):(this._sw=new i(e.lng,e.lat),this._ne=new i(n.lng,n.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},r.convert=function(t){return!t||t instanceof r?t:new r(t)}},{"./lng_lat":26}],28:[function(t,e,n){"use strict";function r(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),a=t("point-geometry"),o=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),u=t("../source/tile_coord"),c=t("../data/bucket").EXTENT,f=t("gl-matrix"),h=f.vec4,d=f.mat4,p=f.mat2;e.exports=r,r.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new a(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcProjMatrix(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcProjMatrix())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcProjMatrix())},get zoom(){return this._zoom},set zoom(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._calcProjMatrix(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcProjMatrix(),this._constrain())},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcProjMatrix(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new a(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new a(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var n=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-n)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var n=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var n=this.locationCoordinate(t),r=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),a=r._sub(n);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(a))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,n=i.convert(t);return new o(this.lngX(n.lng)*e,this.latY(n.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=0,n=this.coordinatePointMatrix(this.tileZoom);if(d.invert(n,n),!n)throw new Error("failed to invert matrix");var r=[t.x,t.y,0,1],i=[t.x,t.y,1,1];h.transformMat4(r,r,n),h.transformMat4(i,i,n);var a=r[3],s=i[3],u=r[0]/a,c=i[0]/s,f=r[1]/a,p=i[1]/s,m=r[2]/a,g=i[2]/s,v=m===g?0:(e-m)/(g-m);return new o(l(u,c,v),l(f,p,v),this.tileZoom)},coordinatePoint:function(t){var e=this.coordinatePointMatrix(t.zoom),n=[t.column,t.row,0,1];return h.transformMat4(n,n,e),new a(n[0]/n[3],n[1]/n[3])},coordinatePointMatrix:function(t){var e=d.copy(new Float64Array(16),this.projMatrix),n=this.worldSize/this.zoomScale(t);return d.scale(e,e,[n,n,1]),d.multiply(e,this.getPixelMatrix(),e),e},getPixelMatrix:function(){var t=d.create();return d.scale(t,t,[this.width/2,-this.height/2,1]),d.translate(t,t,[1,-1,0]),t},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof u&&(t=t.toCoordinate(e));var n=Math.min(t.zoom,e),r=this.worldSize/Math.pow(2,n),i=new Float64Array(16);return d.identity(i),d.translate(i,i,[t.column*r,t.row*r,0]),d.scale(i,i,[r/c,r/c,1]),d.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,n,r,i,o,s,l,u=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),e=this.latY(this.latRange[0]),i=e-th-d&&(l=t+d),h+d>e&&(l=e-d)}if(this.lngRange){var p=this.x,m=u.x/2;n>p-m&&(s=n+m),p+m>r&&(s=r-m)}void 0===s&&void 0===l||(this.center=this.unproject(new a(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=c,this._constraining=!1}},_calcProjMatrix:function(){var t=new Float64Array(16),e=Math.atan(.5/this.altitude),n=Math.sin(e)*this.altitude/Math.sin(Math.PI/2-this._pitch-e),r=Math.cos(Math.PI/2-this._pitch)*n+this.altitude;d.perspective(t,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,r),d.translate(t,t,[0,0,-this.altitude]),d.scale(t,t,[1,-1,1/this.height]),d.rotateX(t,t,this._pitch),d.rotateZ(t,t,this.angle),d.translate(t,t,[-this.x,-this.y,0]),this.projMatrix=t}}},{"../data/bucket":17,"../source/tile_coord":51,"../util/interpolate":113,"../util/util":119,"./coordinate":25,"./lng_lat":26,"gl-matrix":133,"point-geometry":174}],29:[function(t,e,n){"use strict";var r={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]], -"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]};e.exports=function(t,e,n,i){i=i||1;var a,o,s,l,u,c,f,h,d=[];for(a=0,o=t.length;o>a;a++)if(u=r[t[a]]){for(h=null,s=0,l=u[1].length;l>s;s+=2)-1===u[1][s]&&-1===u[1][s+1]?h=null:(c=e+u[1][s]*i,f=n-u[1][s+1]*i,h&&d.push(h.x,h.y,c,f),h={x:c,y:f});e+=u[0]*i}return d}},{}],30:[function(t,e,n){"use strict";var r=e.exports={};r.Map=t("./ui/map"),r.Control=t("./ui/control/control"),r.Navigation=t("./ui/control/navigation"),r.Geolocate=t("./ui/control/geolocate"),r.Attribution=t("./ui/control/attribution"),r.Popup=t("./ui/popup"),r.GeoJSONSource=t("./source/geojson_source"),r.VideoSource=t("./source/video_source"),r.ImageSource=t("./source/image_source"),r.Style=t("./style/style"),r.LngLat=t("./geo/lng_lat"),r.LngLatBounds=t("./geo/lng_lat_bounds"),r.Point=t("point-geometry"),r.Evented=t("./util/evented"),r.util=t("./util/util"),r.supported=t("./util/browser").supported;var i=t("./util/ajax");r.util.getJSON=i.getJSON,r.util.getArrayBuffer=i.getArrayBuffer;var a=t("./util/config");r.config=a,Object.defineProperty(r,"accessToken",{get:function(){return a.ACCESS_TOKEN},set:function(t){a.ACCESS_TOKEN=t}})},{"./geo/lng_lat":26,"./geo/lng_lat_bounds":27,"./source/geojson_source":44,"./source/image_source":46,"./source/video_source":54,"./style/style":60,"./ui/control/attribution":88,"./ui/control/control":89,"./ui/control/geolocate":90,"./ui/control/navigation":91,"./ui/map":101,"./ui/popup":102,"./util/ajax":104,"./util/browser":105,"./util/config":109,"./util/evented":111,"./util/util":119,"point-geometry":174}],31:[function(t,e,n){"use strict";function r(t,e,n){var r,i=t.gl,l=t.transform,u=o.premultiply(n.paint["background-color"]),c=n.paint["background-pattern"],f=n.paint["background-opacity"],h=c?t.spriteAtlas.getPosition(c.from,!0):null,d=c?t.spriteAtlas.getPosition(c.to,!0):null;if(t.setDepthSublayer(0),h&&d){if(t.isOpaquePass)return;r=t.useProgram("pattern"),i.uniform1i(r.u_image,0),i.uniform2fv(r.u_pattern_tl_a,h.tl),i.uniform2fv(r.u_pattern_br_a,h.br),i.uniform2fv(r.u_pattern_tl_b,d.tl),i.uniform2fv(r.u_pattern_br_b,d.br),i.uniform1f(r.u_opacity,f),i.uniform1f(r.u_mix,c.t),t.spriteAtlas.bind(i,!0),t.tileExtentPatternVAO.bind(i,r,t.tileExtentBuffer)}else{if(t.isOpaquePass!==(1===u[3]))return;r=t.useProgram("fill"),i.uniform4fv(r.u_color,u),i.uniform1f(r.u_opacity,f),t.tileExtentVAO.bind(i,r,t.tileExtentBuffer)}i.disable(i.STENCIL_TEST);for(var p=a.coveringTiles(l),m=0;m0&&(h=n.paint["line-gap-width"]/2+.5*u,f=n.paint["line-width"],d=h-u/2);var m=d+f+u/2+p,g=a.premultiply(n.paint["line-color"]),v=t.transform,y=i.create();i.scale(y,y,[1,Math.cos(v._pitch)]),i.rotate(y,y,t.transform.angle);var x,_,b,w,M,k=Math.sqrt(v.height*v.height/4*(1+v.altitude*v.altitude)),S=v.height/2*Math.tan(v._pitch),T=(k+S)/k-1,A=n.paint["line-dasharray"],E=n.paint["line-pattern"];if(A)x=t.useProgram("linesdfpattern"),l.uniform2fv(x.u_linewidth,[m,h]),l.uniform1f(x.u_blur,c),l.uniform4fv(x.u_color,g),l.uniform1f(x.u_opacity,n.paint["line-opacity"]),_=t.lineAtlas.getDash(A.from,"round"===n.layout["line-cap"]),b=t.lineAtlas.getDash(A.to,"round"===n.layout["line-cap"]),l.uniform1i(x.u_image,0),l.activeTexture(l.TEXTURE0),t.lineAtlas.bind(l),l.uniform1f(x.u_tex_y_a,_.y),l.uniform1f(x.u_tex_y_b,b.y),l.uniform1f(x.u_mix,A.t),l.uniform1f(x.u_extra,T),l.uniform1f(x.u_offset,-n.paint["line-offset"]),l.uniformMatrix2fv(x.u_antialiasingmatrix,!1,y);else if(E){if(w=t.spriteAtlas.getPosition(E.from,!0),M=t.spriteAtlas.getPosition(E.to,!0),!w||!M)return;x=t.useProgram("linepattern"),l.uniform1i(x.u_image,0),l.activeTexture(l.TEXTURE0),t.spriteAtlas.bind(l,!0),l.uniform2fv(x.u_linewidth,[m,h]),l.uniform1f(x.u_blur,c),l.uniform2fv(x.u_pattern_tl_a,w.tl),l.uniform2fv(x.u_pattern_br_a,w.br),l.uniform2fv(x.u_pattern_tl_b,M.tl),l.uniform2fv(x.u_pattern_br_b,M.br),l.uniform1f(x.u_fade,E.t),l.uniform1f(x.u_opacity,n.paint["line-opacity"]),l.uniform1f(x.u_extra,T),l.uniform1f(x.u_offset,-n.paint["line-offset"]),l.uniformMatrix2fv(x.u_antialiasingmatrix,!1,y)}else x=t.useProgram("line"),l.uniform2fv(x.u_linewidth,[m,h]),l.uniform1f(x.u_blur,c),l.uniform1f(x.u_extra,T),l.uniform1f(x.u_offset,-n.paint["line-offset"]),l.uniformMatrix2fv(x.u_antialiasingmatrix,!1,y),l.uniform4fv(x.u_color,g),l.uniform1f(x.u_opacity,n.paint["line-opacity"]);for(var L=0;L0?1/(1-t):1+t}function s(t){return t>0?1-1/(1.001-t):-t}function l(t,e,n,r){var i=[1,0],a=n.paint["raster-fade-duration"];if(t.source&&a>0){var o=(new Date).getTime(),s=(o-t.timeAdded)/a,l=e?(o-e.timeAdded)/a:-1,c=t.source._pyramid.coveringZoomLevel(r),f=e?Math.abs(e.coord.z-c)>Math.abs(t.coord.z-c):!1;!e||f?(i[0]=u.clamp(s,0,1),i[1]=1-i[0]):(i[0]=u.clamp(1-l,0,1),i[1]=1-i[0])}var h=n.paint["raster-opacity"];return i[0]*=h,i[1]*=h,i}var u=t("../util/util"),c=t("../util/struct_array");e.exports=r,r.RasterBoundsArray=new c({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":117,"../util/util":119}],38:[function(t,e,n){"use strict";function r(t,e,n,r){if(!t.isOpaquePass){var a=!(n.layout["text-allow-overlap"]||n.layout["icon-allow-overlap"]||n.layout["text-ignore-placement"]||n.layout["icon-ignore-placement"]),o=t.gl;a?o.disable(o.STENCIL_TEST):o.enable(o.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),o.disable(o.DEPTH_TEST),i(t,e,n,r,!1,n.paint["icon-translate"],n.paint["icon-translate-anchor"],n.layout["icon-rotation-alignment"],n.layout["icon-size"],n.paint["icon-halo-width"],n.paint["icon-halo-color"],n.paint["icon-halo-blur"],n.paint["icon-opacity"],n.paint["icon-color"]),i(t,e,n,r,!0,n.paint["text-translate"],n.paint["text-translate-anchor"],n.layout["text-rotation-alignment"],n.layout["text-size"],n.paint["text-halo-width"],n.paint["text-halo-color"],n.paint["text-halo-blur"],n.paint["text-opacity"],n.paint["text-color"]),o.enable(o.DEPTH_TEST),s(t,e,n,r)}}function i(t,e,n,r,i,o,s,u,c,f,h,d,p,m){h=l.premultiply(h),m=l.premultiply(m);for(var g=0;gthis.previousZoom;n--)this.changeTimes[n]=e,this.changeOpacities[n]=this.opacities[n];for(n=0;256>n;n++){var r=e-this.changeTimes[n],i=r/this.fadeDuration*255;t>=n?this.opacities[n]=this.changeOpacities[n]+i:this.opacities[n]=this.changeOpacities[n]-i}this.changed=!0,this.previousZoom=t},r.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],40:[function(t,e,n){"use strict";function r(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}e.exports=r,r.prototype.setSprite=function(t){this.sprite=t},r.prototype.getDash=function(t,e){var n=t.join(",")+e;return this.positions[n]||(this.positions[n]=this.addDash(t,e)),this.positions[n]},r.prototype.addDash=function(t,e){var n=e?7:0,r=2*n+1,i=128;if(this.nextRow+r>this.height)return console.warn("LineAtlas out of space"),null;for(var a=0,o=0;o=c;c++)for(var f=this.nextRow+n+c,h=this.width*f,d=u?-t[t.length-1]:0,p=t[0],m=1,g=0;gp;)d=p,p+=t[m],u&&m===t.length-1&&(p+=t[0]),m++;var v,y=Math.abs(g-d*s),x=Math.abs(g-p*s),_=Math.min(y,x),b=m%2===1;if(e){var w=n?c/n*(l+1):0;if(b){var M=l-Math.abs(w);v=Math.sqrt(_*_+M*M)}else v=l-Math.sqrt(_*_+w*w)}else v=(b?1:-1)*_;this.data[3+4*(h+g)]=Math.max(0,Math.min(255,v+i))}var k={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:a};return this.nextRow+=r,this.dirty=!0,k},r.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,this.data))}},{}],41:[function(t,e,n){"use strict";function r(t,e){this.gl=t,this.transform=e,this.reusableTextures={},this.preFbos={},this.frameHistory=new o,this.setup(),this.numSublayers=s.maxUnderzooming+s.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.lineWidthRange=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE)}var i=t("../util/browser"),a=t("gl-matrix").mat4,o=t("./frame_history"),s=t("../source/tile_pyramid"),l=t("../data/bucket").EXTENT,u=t("../source/pixels_to_tile_units"),c=t("../util/util"),f=t("../util/struct_array"),h=t("../data/buffer"),d=t("./vertex_array_object"),p=t("./draw_raster").RasterBoundsArray;e.exports=r,c.extend(r.prototype,t("./painter/use_program")),r.prototype.resize=function(t,e){var n=this.gl;this.width=t*i.devicePixelRatio,this.height=e*i.devicePixelRatio,n.viewport(0,0,this.width,this.height)},r.prototype.setup=function(){var t=this.gl;t.verbose=!0,t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.enable(t.STENCIL_TEST),t.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),this._depthMask=!1,t.depthMask(!1);var e=this.PosArray=new f({members:[{name:"a_pos",type:"Int16",components:2}]}),n=new e;n.emplaceBack(0,0),n.emplaceBack(l,0),n.emplaceBack(0,l),n.emplaceBack(l,l),this.tileExtentBuffer=new h(n.serialize(),e.serialize(),h.BufferType.VERTEX),this.tileExtentVAO=new d,this.tileExtentPatternVAO=new d;var r=new e;r.emplaceBack(0,0),r.emplaceBack(l,0),r.emplaceBack(l,l),r.emplaceBack(0,l),r.emplaceBack(0,0),this.debugBuffer=new h(r.serialize(),e.serialize(),h.BufferType.VERTEX),this.debugVAO=new d;var i=new p;i.emplaceBack(0,0,0,0),i.emplaceBack(l,0,32767,0),i.emplaceBack(0,l,0,32767),i.emplaceBack(l,l,32767,32767),this.rasterBoundsBuffer=new h(i.serialize(),p.serialize(),h.BufferType.VERTEX),this.rasterBoundsVAO=new d},r.prototype.clearColor=function(){var t=this.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},r.prototype.clearStencil=function(){var t=this.gl;t.clearStencil(0),t.stencilMask(255),t.clear(t.STENCIL_BUFFER_BIT)},r.prototype.clearDepth=function(){var t=this.gl;t.clearDepth(1),this.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},r.prototype._renderTileClippingMasks=function(t){var e=this.gl;e.colorMask(!1,!1,!1,!1),this.depthMask(!1),e.disable(e.DEPTH_TEST),e.enable(e.STENCIL_TEST),e.stencilMask(248),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE);var n=1;this._tileClippingMaskIDs={};for(var r=0;r0?e.pop():null},r.prototype.lineWidth=function(t){this.gl.lineWidth(c.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},r.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);var n=8,r=1/n;e.blendColor(r,r,r,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":17,"../data/buffer":22,"../source/pixels_to_tile_units":47,"../source/tile_pyramid":52,"../util/browser":105,"../util/struct_array":117,"../util/util":119,"./draw_background":31,"./draw_circle":32,"./draw_debug":34,"./draw_fill":35,"./draw_line":36,"./draw_raster":37,"./draw_symbol":38,"./frame_history":39,"./painter/use_program":42,"./vertex_array_object":43,"gl-matrix":133}],42:[function(t,e,n){"use strict";var r=(t("path"),t("assert")),i=t("../../util/util"),a={debug:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n"},fill:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvoid main() {\n gl_FragColor = u_color * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},circle:{fragmentSource:"precision mediump float;\n\nuniform lowp float u_blur;\nuniform lowp float u_opacity;\n\nvarying lowp vec4 v_color;\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n float t = smoothstep(1.0 - max(u_blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = v_color * (1.0 - t) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#ifdef ATTRIBUTE_A_COLOR\nattribute lowp vec4 a_color;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\nuniform lowp float u_color_t;\nattribute lowp vec4 a_color0;\nattribute lowp vec4 a_color1;\nattribute lowp vec4 a_color2;\nattribute lowp vec4 a_color3;\n#else\nuniform lowp vec4 a_color;\n#endif\n\n#ifdef ATTRIBUTE_A_RADIUS\nattribute mediump float a_radius;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\nuniform lowp float u_radius_t;\nattribute mediump vec4 a_radius;\n#else\nuniform mediump float a_radius;\n#endif\n\nvarying vec2 v_extrude;\nvarying lowp vec4 v_color;\nvarying lowp float v_antialiasblur;\n\nfloat evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\n\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n\nvoid main(void) {\n\n#ifdef ATTRIBUTE_A_RADIUS\n mediump float radius = a_radius / 10.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\n mediump float radius = evaluate_zoom_function_1(a_radius, u_radius_t) / 10.0;\n#else\n mediump float radius = a_radius;\n#endif\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n // gl_Position is divided by gl_Position.w after this shader runs.\n // Multiply the extrude by it so that it isn't affected by it.\n gl_Position.xy += extrude * gl_Position.w;\n\n#ifdef ATTRIBUTE_A_COLOR\n v_color = a_color / 255.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\n v_color = evaluate_zoom_function_4(a_color0, a_color1, a_color2, a_color3, u_color_t) / 255.0;\n#else\n v_color = a_color;\n#endif\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n"},line:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform float u_point;\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_b.y);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos), texture2D(u_image, pos2), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 extrude = a_extrude * scale;\n mediump vec2 dist = u_linewidth.s * extrude;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump vec2 u_linewidth;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n}\n"},raster:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - y * u_extra);\n v_gamma_scale = perspective_scale;\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},collisionbox:{fragmentSource:"precision mediump float;\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}};e.exports._createProgram=function(t,e){var n=this.gl,o=n.createProgram(),s=a[t],l="";if(e)for(var u=0;up;p++){var m=n.getActiveAttrib(o,p);h[m.name]=p}for(var g={},v=n.getProgramParameter(o,n.ACTIVE_UNIFORMS),y=0;v>y;y++){var x=n.getActiveUniform(o,y);g[x.name]=n.getUniformLocation(o,x.name)}return i.extend({program:o,definition:s,attributes:h,numAttributes:d},h,g)},e.exports._createProgramCached=function(t,e){this.cache=this.cache||{},this._showOverdrawInspector&&(e=e||[],e.push("OVERDRAW_INSPECTOR"));var n=JSON.stringify({name:t,macros:e});return this.cache[n]||(this.cache[n]=this._createProgram(t,e)),this.cache[n]},e.exports.useProgram=function(t,e){var n=this.gl,r=this._createProgramCached(t,e),i=this.currentProgram;return i!==r&&(n.useProgram(r.program),this.currentProgram=r),r}},{"../../util/util":119,assert:6,path:9}],43:[function(t,e,n){"use strict";function r(){this.boundProgram=null,this.boundVertexBuffer=null,this.boundVertexBuffer2=null,this.boundElementBuffer=null,this.vao=null}var i=t("assert");e.exports=r;var a=!1;r.prototype.bind=function(t,e,n,r,o){var s=t.extVertexArrayObject;if(void 0===s&&(s=t.extVertexArrayObject=t.getExtension("OES_vertex_array_object")),s?(this.vao||(this.vao=s.createVertexArrayOES()),s.bindVertexArrayOES(this.vao)):a||(console.warn("Not using VertexArrayObject extension."),a=!0),this.boundProgram)i(this.boundProgram===e,"trying to bind a VAO to a different shader"),i(this.boundVertexBuffer===n,"trying to bind a VAO to a different vertex buffer"),i(this.boundVertexBuffer2===o,"trying to bind a VAO to a different vertex buffer"),i(this.boundElementBuffer===r,"trying to bind a VAO to a different element buffer");else{var l,u=s?0:t.currentNumAttributes||0,c=e.numAttributes;for(l=u;c>l;l++)t.enableVertexAttribArray(l);if(!s){for(i(l>0),l=c;u>l;l++)t.disableVertexAttribArray(l);t.currentNumAttributes=c}n.bind(t),n.setVertexAttribPointers(t,e),o&&(o.bind(t),o.setVertexAttribPointers(t,e)),r&&r.bind(t),s&&(this.boundProgram=e,this.boundVertexBuffer=n,this.boundVertexBuffer2=o,this.boundElementBuffer=r)}},r.prototype.unbind=function(t){var e=t.extVertexArrayObject;e&&e.bindVertexArrayOES(null)},r.prototype.destroy=function(t){var e=t.extVertexArrayObject;e&&this.vao&&(e.deleteVertexArrayOES(this.vao),this.vao=null)}},{assert:6}],44:[function(t,e,n){"use strict";function r(t){t=t||{},this._data=t.data,void 0!==t.maxzoom&&(this.maxzoom=t.maxzoom);var e=u/this.tileSize;this.geojsonVtOptions={buffer:(void 0!==t.buffer?t.buffer:128)*e,tolerance:(void 0!==t.tolerance?t.tolerance:.375)*e,extent:u,maxZoom:this.maxzoom},this.cluster=t.cluster||!1, -this.superclusterOptions={maxZoom:Math.min(t.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:u,radius:(t.clusterRadius||50)*e,log:!1},this._pyramid=new o({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!0,load:this._loadTile.bind(this),abort:this._abortTile.bind(this),unload:this._unloadTile.bind(this),add:this._addTile.bind(this),remove:this._removeTile.bind(this),redoPlacement:this._redoTilePlacement.bind(this)})}var i=t("../util/util"),a=t("../util/evented"),o=t("./tile_pyramid"),s=t("./source"),l=t("resolve-url"),u=t("../data/bucket").EXTENT;e.exports=r,r.prototype=i.inherit(a,{minzoom:0,maxzoom:18,tileSize:512,_dirty:!0,isTileClipped:!0,setData:function(t){return this._data=t,this._dirty=!0,this.fire("change"),this.map&&this.update(this.map.transform),this},onAdd:function(t){this.map=t},loaded:function(){return this._loaded&&this._pyramid.loaded()},update:function(t){this._dirty&&this._updateData(),this._loaded&&this._pyramid.update(this.used,t)},reload:function(){this._loaded&&this._pyramid.reload()},serialize:function(){return{type:"geojson",data:this._data}},getVisibleCoordinates:s._getVisibleCoordinates,getTile:s._getTile,queryRenderedFeatures:s._queryRenderedVectorFeatures,querySourceFeatures:s._querySourceFeatures,_updateData:function(){this._dirty=!1;var t={tileSize:this.tileSize,source:this.id,geojsonVtOptions:this.geojsonVtOptions,cluster:this.cluster,superclusterOptions:this.superclusterOptions},e=this._data;"string"==typeof e?t.url="undefined"!=typeof window?l(window.location.href,e):e:t.data=JSON.stringify(e),this.workerID=this.dispatcher.send("parse geojson",t,function(t){this._loaded=!0,t?this.fire("error",{error:t}):(this._pyramid.reload(),this.fire("change"))}.bind(this))},_loadTile:function(t){var e=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,n={uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:e,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load geojson tile",n,function(e,n){if(t.unloadVectorData(this.map.painter),!t.aborted){if(e)return void this.fire("tile.error",{tile:t});t.loadVectorData(n,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),this.fire("tile.load",{tile:t})}}.bind(this),this.workerID)},_abortTile:function(t){t.aborted=!0},_addTile:function(t){this.fire("tile.add",{tile:t})},_removeTile:function(t){this.fire("tile.remove",{tile:t})},_unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)},redoPlacement:s.redoPlacement,_redoTilePlacement:function(t){t.redoPlacement(this)}})},{"../data/bucket":17,"../util/evented":111,"../util/util":119,"./source":49,"./tile_pyramid":52,"resolve-url":175}],45:[function(t,e,n){"use strict";function r(t){this.features=t,this.length=t.length,this.extent=s}function i(t){this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=s}var a=t("point-geometry"),o=t("vector-tile").VectorTileFeature,s=t("../data/bucket").EXTENT;e.exports=r,r.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e=0&&t%1===0),s(!isNaN(e)&&e>=0&&e%1===0),s(!isNaN(n)&&n>=0&&n%1===0),isNaN(r)&&(r=0),this.z=+t,this.x=+e,this.y=+n,this.w=+r,r*=2,0>r&&(r=-1*r-1);var i=1<e.row){var n=t;t=e,e=n}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function a(t,e,n,r,i){var a=Math.max(n,Math.floor(e.y0)),o=Math.min(r,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx0,f=e.dx<0,h=a;o>h;h++){var d=l*Math.max(0,Math.min(t.dy,h+c-t.y0))+t.x0,p=u*Math.max(0,Math.min(e.dy,h+f-e.y0))+e.x0;i(Math.floor(p),Math.ceil(d),h)}}function o(t,e,n,r,o,s){var l,u=i(t,e),c=i(e,n),f=i(n,t);u.dy>c.dy&&(l=u,u=c,c=l),u.dy>f.dy&&(l=u,u=f,f=l),c.dy>f.dy&&(l=c,c=f,f=l),u.dy&&a(f,u,r,o,s),c.dy&&a(f,c,r,o,s)}var s=t("assert"),l=t("../geo/coordinate");e.exports=r,r.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},r.prototype.toCoordinate=function(t){var e=Math.min(this.z,t),n=Math.pow(2,e),r=this.y,i=this.x+n*this.w;return new l(i,r,e)},r.fromID=function(t){var e=t%32,n=1<t?new r(this.z-1,this.x,this.y,this.w):new r(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},r.prototype.wrapped=function(){return new r(this.z,this.x,this.y,0)},r.prototype.children=function(t){if(this.z>=t)return[new r(this.z+1,this.x,this.y,this.w)];var e=this.z+1,n=2*this.x,i=2*this.y;return[new r(e,n,i,this.w),new r(e,n+1,i,this.w),new r(e,n,i+1,this.w),new r(e,n+1,i+1,this.w)]},r.cover=function(t,e,n){function i(t,e,i){var o,l,u;if(i>=0&&a>=i)for(o=t;e>o;o++)l=(o%a+a)%a,u=new r(n,l,i,Math.floor(o/a)),s[u.id]=u}var a=1<this.maxzoom&&(e=this.maxzoom);var r=t,i=r.locationCoordinate(r.center)._zoomTo(e),a=new l(i.column-.5,i.row-.5);return s.cover(e,[r.pointCoordinate(new l(0,0))._zoomTo(e),r.pointCoordinate(new l(r.width,0))._zoomTo(e),r.pointCoordinate(new l(r.width,r.height))._zoomTo(e),r.pointCoordinate(new l(0,r.height))._zoomTo(e)],this.reparseOverscaled?n:e).sort(function(t,e){return a.dist(t)-a.dist(e)})},findLoadedChildren:function(t,e,n){var r=!1;for(var i in this._tiles){var a=this._tiles[i];if(!(n[i]||!a.loaded||a.coord.z<=t.z||a.coord.z>e)){var o=Math.pow(2,Math.min(a.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(a.coord.x/o)===t.x&&Math.floor(a.coord.y/o)===t.y)for(n[i]=!0,r=!0;a&&a.coord.z-1>t.z;){var s=a.coord.parent(this.maxzoom).id;a=this._tiles[s],a&&a.loaded&&(delete n[i],n[s]=!0)}}}return r},findLoadedParent:function(t,e,n){for(var r=t.z-1;r>=e;r--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.loaded)return n[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),n[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=Math.ceil(t.width/t.tileSize)+1,n=Math.ceil(t.height/t.tileSize)+1,r=e*n,i=5;this._cache.setMaxSize(Math.floor(r*i))},update:function(t,e,n){var i,a,o;this.updateCacheSize(e);var l=(this.roundZoom?Math.round:Math.floor)(this.getZoom(e)),u=Math.max(l-r.maxOverzooming,this.minzoom),c=Math.max(l+r.maxUnderzooming,this.minzoom),h={},d=(new Date).getTime();this._coveredTiles={};var p=t?this.coveringTiles(e):[];for(i=0;id-(n||0)&&(this.findLoadedChildren(a,c,h)&&(h[y]=!0),this.findLoadedParent(a,u,m))}var x;for(x in m)h[x]||(this._coveredTiles[x]=!0);for(x in m)h[x]=!0;var _=f.keysDifference(this._tiles,h);for(i=0;i<_.length;i++)this.removeTile(+_[i]);this.transform=e},addTile:function(t){var e=this._tiles[t.id];if(e)return e;var n=t.wrapped();if(e=this._tiles[n.id],e||(e=this._cache.get(n.id),e&&this._redoPlacement&&this._redoPlacement(e)),!e){var r=t.z,i=r>this.maxzoom?Math.pow(2,r-this.maxzoom):1;e=new o(n,this.tileSize*i,this.maxzoom),this._load(e)}return e.uses++,this._tiles[t.id]=e,this._add(e,t),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._remove(e),e.uses>0||(e.loaded?this._cache.add(e.coord.wrapped().id,e):(this._abort(e),this._unload(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},n=this.orderedIDs(),r=1/0,a=1/0,o=-(1/0),l=-(1/0),u=t[0].zoom,f=0;f=0&&v[1].y>=0){for(var y=[],x=0;xthis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,n={url:s(t.coord.url(this.tiles,this.maxzoom),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*e,source:this.id,overscaling:e,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?(n.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",n,this._tileLoaded.bind(this,t),t.workerID)):t.workerID=this.dispatcher.send("load tile",n,this._tileLoaded.bind(this,t))},_tileLoaded:function(t,e,n){if(!t.aborted){if(e)return t.errored=!0,void this.fire("tile.error",{tile:t,error:e});t.loadVectorData(n,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),this.fire("tile.load",{tile:t}),this.fire("tile.stats",n.bucketStats)}},_abortTile:function(t){t.aborted=!0,this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},_addTile:function(t){this.fire("tile.add",{tile:t})},_removeTile:function(t){this.fire("tile.remove",{tile:t})},_unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)},redoPlacement:o.redoPlacement,_redoTilePlacement:function(t){t.redoPlacement(this)}})},{"../util/evented":111,"../util/mapbox":116,"../util/util":119,"./source":49}],54:[function(t,e,n){"use strict";function r(t){this.urls=t.urls,this.coordinates=t.coordinates,c.getVideo(t.urls,function(e,n){if(!e){this.video=n,this.video.loop=!0;var r;this.video.addEventListener("playing",function(){r=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(r)}.bind(this)),this._loaded=!0,this.map&&(this.video.play(),this.setCoordinates(t.coordinates))}}.bind(this))}var i=t("../util/util"),a=t("./tile"),o=t("./tile_coord"),s=t("../geo/lng_lat"),l=t("point-geometry"),u=t("../util/evented"),c=t("../util/ajax"),f=t("../data/bucket").EXTENT,h=t("../render/draw_raster").RasterBoundsArray,d=t("../data/buffer"),p=t("../render/vertex_array_object");e.exports=r,r.prototype=i.inherit(u,{roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates))},setCoordinates:function(t){this.coordinates=t;var e=this.map,n=t.map(function(t){return e.transform.locationCoordinate(s.convert(t)).zoomTo(0)}),r=this.centerCoord=i.getCoordinatesCenter(n);r.column=Math.round(r.column),r.row=Math.round(r.row);var u=n.map(function(t){var e=t.zoomTo(r.zoom);return new l(Math.round((e.column-r.column)*f),Math.round((e.row-r.row)*f))}),c=32767,m=new h;return m.emplaceBack(u[0].x,u[0].y,0,0),m.emplaceBack(u[1].x,u[1].y,c,0),m.emplaceBack(u[3].x,u[3].y,0,c),m.emplaceBack(u[2].x,u[2].y,c,c),this.tile=new a(new o(r.zoom,r.column,r.row)),this.tile.buckets={},this.tile.boundsBuffer=new d(m.serialize(),h.serialize(),d.BufferType.VERTEX),this.tile.boundsVAO=new p,this.fire("change"),this},loaded:function(){return this.video&&this.video.readyState>=2},update:function(){},reload:function(){},prepare:function(){if(this._loaded&&!(this.video.readyState<2)){var t=this.map.painter.gl;this.tile.texture?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},getVisibleCoordinates:function(){return this.tile?[this.tile.coord]:[]},getTile:function(){return this.tile},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":17,"../data/buffer":22,"../geo/lng_lat":26,"../render/draw_raster":37,"../render/vertex_array_object":43,"../util/ajax":104,"../util/evented":111,"../util/util":119,"./tile":50,"./tile_coord":51,"point-geometry":174}],55:[function(t,e,n){"use strict";function r(t){this.self=t,this.actor=new a(t,this),this.loading={},this.loaded={},this.geoJSONIndexes={}}function i(t){var e={};for(var n in t){var r=t[n],i=r.ref||r.id,a=t[i];a.layout&&"none"===a.layout.visibility||(e[i]=e[i]||[],n===i?e[i].unshift(r):e[i].push(r))}return e}var a=t("../util/actor"),o=t("./worker_tile"),s=t("../style/style_layer"),l=t("../util/util"),u=t("../util/ajax"),c=t("vector-tile"),f=t("pbf"),h=t("supercluster"),d=t("geojson-vt"),p=t("geojson-rewind"),m=t("./geojson_wrapper"),g=t("vt-pbf");e.exports=function(t){return new r(t)},l.extend(r.prototype,{"set layers":function(t){function e(t){var e=s.create(t,t.ref&&n.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),n.layers[e.id]=e}this.layers={};for(var n=this,r=[],a=0;a0)return!0}}return!1}function a(t){return t.serialize()}function o(t){var e=[];for(var n in t){var r=t[n];for(var i in r.arrayGroups)for(var a=r.arrayGroups[i],o=0;o=0;e--)g(T,D[e]);v()}}function g(t,e){var n=Date.now();e.populateBuffers(w,F,O);var r=Date.now()-n;if("symbol"!==e.type)for(var i=0;i=x.maxzoom||x.layout&&"none"===x.layout.visibility||t.layers&&!t.layers[x.sourceLayer]||(b=c.create({layer:x,index:L++,childLayers:e[z],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:k.encode(x.sourceLayer||"_geojsonTileLayer")}),b.createFilter(),A[x.id]=b,t.layers&&(_=x.sourceLayer,E[_]=E[_]||{},E[_][x.id]=b)));if(t.layers)for(_ in E)x=t.layers[_],x&&p(x,E[_]);else p(t,A);var I=[],D=this.symbolBuckets=[],P=[];M.bucketLayerIDs={};for(var C in A)b=A[C],0!==b.features.length&&(M.bucketLayerIDs[b.index]=b.childLayers.map(s),I.push(b),"symbol"===b.type?D.push(b):P.push(b));var O={},F={},R=0;if(D.length>0){for(y=D.length-1;y>=0;y--)D[y].updateIcons(O),D[y].updateFont(F);for(var N in F)F[N]=Object.keys(F[N]).map(Number);O=Object.keys(O),n.send("get glyphs",{uid:this.uid,stacks:F},function(t,e){F=e,m(t)}),O.length?n.send("get icons",{icons:O},function(t,e){O=e,m(t)}):m()}for(y=P.length-1;y>=0;y--)g(this,P[y]);return 0===D.length?v():void 0},r.prototype.redoPlacement=function(t,e,n){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var r=new u(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(r,n);var c=r.serialize(),f=s.filter(i);return{result:{buckets:f.map(a),collisionTile:c.data},transferables:o(f).concat(c.transferables)}}},{"../data/bucket":17,"../data/feature_index":23,"../symbol/collision_box":76,"../symbol/collision_tile":78,"../util/dictionary_coder":110}],57:[function(t,e,n){"use strict";function r(){this.n=0,this.times=[]}e.exports=r,r.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},r.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},r.prototype.cancel=function(t){this.times=this.times.filter(function(e){return e.id!==t})}},{}],58:[function(t,e,n){"use strict";function r(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";o.getJSON(l(t,e,".json"),function(t,e){return t?void this.fire("error",{error:t}):(this.data=e,void(this.img&&this.fire("load")))}.bind(this)),o.getImage(l(t,e,".png"),function(t,e){if(t)return void this.fire("error",{error:t});for(var n=e.getData(),r=e.data=new Uint8Array(n.length),i=0;i1!==this.retina){var t=new r(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},i.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},r.prototype.getSpritePosition=function(t){if(!this.loaded())return new i;var e=this.data&&this.data[t];return e&&this.img?e:new i}},{"../util/ajax":104,"../util/browser":105,"../util/evented":111,"../util/mapbox":116}],59:[function(t,e,n){"use strict";function r(t){if(l[t])return l[t];if(Array.isArray(t))return t;if(t&&t.stops)return s.extend({},t,{stops:t.stops.map(i)});if("string"==typeof t){var e=o(t);if(!e)throw new Error("Invalid color "+t);var n=a(e);return l[t]=n,n}throw new Error("Invalid color "+t)}function i(t){return[t[0],r(t[1])]}function a(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]/1]}var o=t("csscolorparser").parseCSSColor,s=t("../util/util"),l={};e.exports=r},{"../util/util":119,csscolorparser:121}],60:[function(t,e,n){"use strict";function r(t,e){this.animationLoop=e||new m,this.dispatcher=new p(Math.max(d.hardwareConcurrency-1,1),this),this.spriteAtlas=new l(512,512),this.lineAtlas=new u(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},c.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var n=function(t,e){if(t)return void this.fire("error",{error:t});if(!g.emitErrors(this,g(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var n=e.sources;for(var r in n)this.addSource(r,n[r]);e.sprite&&(this.sprite=new o(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?f.getJSON(h(t),n):d.frame(n.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var n in this._layers){var r=this._layers[n];r.source===e.id&&this._validateLayer(r)}})}var i=t("../util/evented"),a=t("./style_layer"),o=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),u=t("../render/line_atlas"),c=t("../util/util"),f=t("../util/ajax"),h=t("../util/mapbox").normalizeStyleURL,d=t("../util/browser"),p=t("../util/dispatcher"),m=t("./animation_loop"),g=t("./validate_style"),v=t("../source/source"),y=t("./style_spec"),x=t("./style_function");e.exports=r,r.prototype=c.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&-1===e.vectorLayerIds.indexOf(t.sourceLayer)&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!this.sprite||this.sprite.loaded()},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var n=0;nMath.floor(t)&&(e.lastIntegerZoom=Math.floor(t+1),e.lastIntegerZoomTime=Date.now()),e.lastZoom=t},_checkLoaded:function(){if(!this._loaded)throw new Error("Style is not done loading")},update:function(t,e){if(!this._updates.changed)return this;if(this._updates.allLayers)this._groupLayers(),this._updateWorkerLayers();else{var n=Object.keys(this._updates.layers);n.length&&this._updateWorkerLayers(n)}var r,i=Object.keys(this._updates.sources);for(r=0;r=0;n--)for(var r=this._order[n],i=0;is.lastIntegerZoom?(r=u+(1-u)*c,f*=2,i=t({zoom:o-1},n),a=t({zoom:o},n)):(r=1-(1-c)*u,a=t({zoom:o},n),i=t({zoom:o+1},n),f/=2),{from:i,fromScale:f,to:a,toScale:h,t:r}}}var a=t("./style_function"),o=t("./parse_color"),s=t("../util/util");e.exports=r},{"../util/util":119,"./parse_color":59,"./style_function":62}],62:[function(t,e,n){"use strict";var r=t("mapbox-gl-function");n.interpolated=function(t){var e=r.interpolated(t),n=function(t,n){return e(t&&t.zoom,n||{})};return n.isFeatureConstant=e.isFeatureConstant,n.isZoomConstant=e.isZoomConstant,n},n["piecewise-constant"]=function(t){var e=r["piecewise-constant"](t),n=function(t,n){return e(t&&t.zoom,n||{})};return n.isFeatureConstant=e.isFeatureConstant,n.isZoomConstant=e.isZoomConstant,n},n.isFunctionDefinition=r.isFunctionDefinition},{"mapbox-gl-function":144}],63:[function(t,e,n){"use strict";function r(t,e){this.set(t,e)}function i(t){return t.value}var a=t("../util/util"),o=t("./style_transition"),s=t("./style_declaration"),l=t("./style_spec"),u=t("./validate_style"),c=t("./parse_color"),f=t("../util/evented");e.exports=r;var h="-transition";r.create=function(e,n){var r={background:t("./style_layer/background_style_layer"),circle:t("./style_layer/circle_style_layer"),fill:t("./style_layer/fill_style_layer"),line:t("./style_layer/line_style_layer"),raster:t("./style_layer/raster_style_layer"),symbol:t("./style_layer/symbol_style_layer")};return new r[(n||e).type](e,n)},r.prototype=a.inherit(f,{set:function(t,e){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(e||t).type,this.source=(e||t).source,this.sourceLayer=(e||t)["source-layer"],this.minzoom=(e||t).minzoom,this.maxzoom=(e||t).maxzoom,this.filter=(e||t).filter,this.paint={},this.layout={},this._paintSpecifications=l["paint_"+this.type],this._layoutSpecifications=l["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var n,r;for(var i in t){var a=i.match(/^paint(?:\.(.*))?$/);if(a){var o=a[1]||"";for(n in t[i])this.setPaintProperty(n,t[i][n],o)}}if(this.ref)this._layoutDeclarations=e._layoutDeclarations;else for(r in t.layout)this.setLayoutProperty(r,t.layout[r]);for(n in this._paintSpecifications)this.paint[n]=this.getPaintValue(n);for(r in this._layoutSpecifications)this._updateLayoutValue(r)},setLayoutProperty:function(t,e){if(null==e)delete this._layoutDeclarations[t];else{var n="layers."+this.id+".layout."+t;if(this._handleErrors(u.layoutProperty,n,t,e))return;this._layoutDeclarations[t]=new s(this._layoutSpecifications[t],e)}this._updateLayoutValue(t)},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,e,n){var r=this._layoutSpecifications[t],i=this._layoutDeclarations[t];return i?i.calculate(e,n):r.default},setPaintProperty:function(t,e,n){var r="layers."+this.id+(n?'["paint.'+n+'"].':".paint.")+t;if(a.endsWith(t,h))if(this._paintTransitionOptions[n||""]||(this._paintTransitionOptions[n||""]={}),null===e||void 0===e)delete this._paintTransitionOptions[n||""][t];else{if(this._handleErrors(u.paintProperty,r,t,e))return;this._paintTransitionOptions[n||""][t]=e}else if(this._paintDeclarations[n||""]||(this._paintDeclarations[n||""]={}),null===e||void 0===e)delete this._paintDeclarations[n||""][t];else{if(this._handleErrors(u.paintProperty,r,t,e))return;this._paintDeclarations[n||""][t]=new s(this._paintSpecifications[t],e)}},getPaintProperty:function(t,e){return e=e||"",a.endsWith(t,h)?this._paintTransitionOptions[e]&&this._paintTransitionOptions[e][t]:this._paintDeclarations[e]&&this._paintDeclarations[e][t]&&this._paintDeclarations[e][t].value},getPaintValue:function(t,e,n){var r=this._paintSpecifications[t],i=this._paintTransitions[t];return i?i.calculate(e,n):"color"===r.type&&r.default?c(r.default):r.default},getPaintValueStopZoomLevels:function(t){var e=this._paintTransitions[t];return e?e.declaration.stopZoomLevels:[]},getPaintInterpolationT:function(t,e){var n=this._paintTransitions[t];return n.declaration.calculateInterpolationT({zoom:e})},isPaintValueFeatureConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isFeatureConstant:!0},isPaintValueZoomConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isZoomConstant:!0},isHidden:function(t){return this.minzoom&&t=this.maxzoom?!0:"none"===this.layout.visibility?!0:0===this.paint[this.type+"-opacity"]},updatePaintTransitions:function(t,e,n,r){for(var i=a.extend({},this._paintDeclarations[""]),o=0;o-n/2;){if(o--,0>o)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],u=0;n/2>s;){var c=t[o-1],f=t[o],h=t[o+1];if(!h)return!1;var d=c.angleTo(f)-f.angleTo(h);for(d=Math.abs((d+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:d}),u+=d;s-l[0].distance>r;)u-=l.shift().angleDelta;if(u>i)return!1;o++,s+=f.dist(h)}return!0}e.exports=r},{}],75:[function(t,e,n){"use strict";function r(t,e,n,r,a){for(var o=[],s=0;s=r&&h.x>=r||(f.x>=r?f=new i(r,f.y+(h.y-f.y)*((r-f.x)/(h.x-f.x)))._round():h.x>=r&&(h=new i(r,f.y+(h.y-f.y)*((r-f.x)/(h.x-f.x)))._round()),f.y>=a&&h.y>=a||(f.y>=a?f=new i(f.x+(h.x-f.x)*((a-f.y)/(h.y-f.y)),a)._round():h.y>=a&&(h=new i(f.x+(h.x-f.x)*((a-f.y)/(h.y-f.y)),a)._round()),l&&f.equals(l[l.length-1])||(l=[f],o.push(l)),l.push(h)))))}return o}var i=t("point-geometry");e.exports=r},{"point-geometry":174}],76:[function(t,e,n){"use strict";var r=t("../util/struct_array"),i=t("../util/util"),a=t("point-geometry"),o=e.exports=new r({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});i.extendAll(o.prototype.StructType.prototype,{get anchorPoint(){return new a(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":117,"../util/util":119,"point-geometry":174}],77:[function(t,e,n){"use strict";function r(t,e,n,r,i,a,o,s,l,u,c){var f=o.top*s-l,h=o.bottom*s+l,d=o.left*s-l,p=o.right*s+l;if(this.boxStartIndex=t.length,u){var m=h-f,g=p-d;if(m>0)if(m=Math.max(10*s,m),c){var v=e[n.segment+1].sub(e[n.segment])._unit()._mult(g),y=[n.sub(v),n.add(v)];this._addLineCollisionBoxes(t,y,n,0,g,m,r,i,a)}else this._addLineCollisionBoxes(t,e,n,n.segment,g,m,r,i,a)}else t.emplaceBack(n.x,n.y,d,f,p,h,1/0,r,i,a,0,0,0,0,0);this.boxEndIndex=t.length}e.exports=r,r.prototype._addLineCollisionBoxes=function(t,e,n,r,i,a,o,s,l){var u=a/2,c=Math.floor(i/u),f=-a/2,h=this.boxes,d=n,p=r+1,m=f;do{if(p--,0>p)return h;m-=e[p].dist(d),d=e[p]}while(m>-i/2);for(var g=e[p].dist(e[p+1]),v=0;c>v;v++){for(var y=-i/2+v*u;y>m+g;){if(m+=g,p++,p+1>=e.length)return h;g=e[p].dist(e[p+1])}var x=y-m,_=e[p],b=e[p+1],w=b.sub(_)._unit()._mult(x)._add(_)._round(),M=Math.max(Math.abs(y-f)-u/2,0),k=i/2/M;t.emplaceBack(w.x,w.y,-a/2,-a/2,a/2,a/2,k,o,s,l,0,0,0,0,0)}return h}},{}],78:[function(t,e,n){"use strict";function r(t,e,n){if("object"==typeof t){var r=t;n=e,t=r.angle,e=r.pitch,this.grid=new o(r.grid),this.ignoredGrid=new o(r.ignoredGrid)}else this.grid=new o(a,12,6),this.ignoredGrid=new o(a,12,0);this.angle=t,this.pitch=e;var i=Math.sin(t),s=Math.cos(t);if(this.rotationMatrix=[s,-i,i,s],this.reverseRotationMatrix=[s,i,-i,s],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=n,0===n.length){n.emplaceBack();var l=32767;n.emplaceBack(0,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),n.emplaceBack(a,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),n.emplaceBack(0,0,-l,0,l,0,l,0,0,0,0,0,0,0,0,0),n.emplaceBack(0,a,-l,0,l,0,l,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=n.get(0),this.edges=[n.get(1),n.get(2),n.get(3),n.get(4)]}var i=t("point-geometry"),a=t("../data/bucket").EXTENT,o=t("grid-index");e.exports=r,r.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},r.prototype.minScale=.25,r.prototype.maxScale=2,r.prototype.placeCollisionFeature=function(t,e,n){for(var r=this.collisionBoxArray,a=this.minScale,o=this.rotationMatrix,s=this.yStretch,l=t.boxStartIndex;l=this.maxScale)return a}if(n){var b;if(this.angle){var w=this.reverseRotationMatrix,M=new i(u.x1,u.y1).matMult(w),k=new i(u.x2,u.y1).matMult(w),S=new i(u.x1,u.y2).matMult(w),T=new i(u.x2,u.y2).matMult(w);b=this.tempCollisionBox,b.anchorPointX=u.anchorPoint.x,b.anchorPointY=u.anchorPoint.y,b.x1=Math.min(M.x,k.x,S.x,T.x),b.y1=Math.min(M.y,k.x,S.x,T.x),b.x2=Math.max(M.x,k.x,S.x,T.x),b.y2=Math.max(M.y,k.x,S.x,T.x),b.maxScale=u.maxScale}else b=u;for(var A=0;A=this.maxScale)return a}}}return a},r.prototype.queryRenderedSymbols=function(t,e,n,r,a){var o={},s=[],l=this.collisionBoxArray,u=this.rotationMatrix,c=new i(t,e)._matMult(u),f=this.tempCollisionBox;f.anchorX=c.x,f.anchorY=c.y,f.x1=0,f.y1=0,f.x2=n-t,f.y2=r-e,f.maxScale=a,a=f.maxScale;for(var h=[c.x+f.x1/a,c.y+f.y1/a*this.yStretch,c.x+f.x2/a,c.y+f.y2/a*this.yStretch],d=this.grid.query(h[0],h[1],h[2],h[3]),p=this.ignoredGrid.query(h[0],h[1],h[2],h[3]),m=0;m=a&&(o[y][x]=!0,s.push(d[g]))}}return s},r.prototype.getPlacementScale=function(t,e,n,r,i){var a=e.x-r.x,o=e.y-r.y,s=(i.x1-n.x2)/a,l=(i.x2-n.x1)/a,u=(i.y1-n.y2)*this.yStretch/o,c=(i.y2-n.y1)*this.yStretch/o;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(u)||isNaN(c))&&(u=c=1);var f=Math.min(Math.max(s,l),Math.max(u,c)),h=i.maxScale,d=n.maxScale;return f>h&&(f=h),f>d&&(f=d),f>t&&f>=i.placementScale&&(t=f),t},r.prototype.insertCollisionFeature=function(t,e,n){for(var r=n?this.ignoredGrid:this.grid,i=this.collisionBoxArray,a=t.boxStartIndex;ae-f*s&&(e=f*s+e/4);var d=2*o,p=h?e/2*l%e:(f/2+d)*s*l%e;return i(t,p,e,c,n,f*s,h,!1,u)}function i(t,e,n,r,l,u,c,f,h){for(var d=u/2,p=0,m=0;mv+n;){v+=n;var k=(v-g)/w,S=a(_.x,b.x,k),T=a(_.y,b.y,k);if(S>=0&&h>S&&T>=0&&h>T&&v-d>=0&&p>=v+d){var A=new o(S,T,M,x)._round();r&&!s(t,A,u,r,l)||y.push(A)}}g+=w}return f||y.length||c||(y=i(t,g/2,n,r,l,u,c,!0,h)),y}var a=t("../util/interpolate"),o=t("../symbol/anchor"),s=t("./check_max_angle");e.exports=r},{"../symbol/anchor":73,"../util/interpolate":113,"./check_max_angle":74}],80:[function(t,e,n){"use strict";function r(t,e){this.width=t,this.height=e,this.bin=new i(t,e),this.index={},this.ids={},this.data=new Uint8Array(t*e)}var i=t("shelf-pack");e.exports=r,r.prototype.getGlyphs=function(){var t,e,n,r={};for(var i in this.ids)t=i.split("#"),e=t[0],n=t[1],r[e]||(r[e]=[]),r[e].push(n);return r},r.prototype.getRects=function(){var t,e,n,r={};for(var i in this.ids)t=i.split("#"),e=t[0],n=t[1],r[e]||(r[e]={}),r[e][n]=this.index[i];return r},r.prototype.addGlyph=function(t,e,n,r){if(!n)return null;var i=e+"#"+n.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!n.bitmap)return null;var a=n.width+2*r,o=n.height+2*r,s=1,l=a+2*s,u=o+2*s;l+=4-l%4,u+=4-u%4;var c=this.bin.packOne(l,u);if(c||(this.resize(),c=this.bin.packOne(l,u)),!c)return console.warn("glyph bitmap overflow"),null;this.index[i]=c,this.ids[i]=[t];for(var f=this.data,h=n.bitmap,d=0;o>d;d++)for(var p=this.width*(c.y+d+s)+c.x+s,m=a*d,g=0;a>g;g++)f[p+g]=h[m+g];return this.dirty=!0,c},r.prototype.resize=function(){var t=this.width,e=this.height;if(!(t>512||e>512)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=2,this.height*=2,this.bin.resize(this.width,this.height);for(var n,r,i=new ArrayBuffer(this.width*this.height),a=0;e>a;a++)n=new Uint8Array(this.data.buffer,e*a,t),r=new Uint8Array(i,e*a*2,t),r.set(n);this.data=new Uint8Array(i)}},r.prototype.bind=function(t){this.gl=t,this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,null))},r.prototype.updateTexture=function(t){this.bind(t),this.dirty&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data),this.dirty=!1)}},{"shelf-pack":176}],81:[function(t,e,n){"use strict";function r(t){this.url=t&&o(t),this.atlases={},this.stacks={},this.loading={}}function i(t,e,n){var r=1;this.advance=t.advance,this.left=t.left-n-r,this.top=t.top+n+r,this.rect=e}function a(t,e,n,r){return r=r||"abc",n.replace("{s}",r[t.length%r.length]).replace("{fontstack}",t).replace("{range}",e)}var o=t("../util/mapbox").normalizeGlyphsURL,s=t("../util/ajax").getArrayBuffer,l=t("../util/glyphs"),u=t("../symbol/glyph_atlas"),c=t("pbf");e.exports=r,r.prototype.getSimpleGlyphs=function(t,e,n,r){void 0===this.stacks[t]&&(this.stacks[t]={}),void 0===this.atlases[t]&&(this.atlases[t]=new u(128,128));for(var a,o={},s=this.stacks[t],l=this.atlases[t],c=3,f={},h=0,d=0;d65535)return n("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var r=this.loading[t];if(r[e])r[e].push(n);else{r[e]=[n];var i=256*e+"-"+(256*e+255),o=a(t,i,this.url);s(o,function(t,n){for(var i=!t&&new l(new c(new Uint8Array(n))),a=0;an&&(a=!a),a&&i++;var u=new s(e.x,e.y),c=r[i],f=1/0;n=Math.abs(n);for(var h=l;;){var d=u.dist(c),p=n/d,m=Math.atan2(c.y-u.y,c.x-u.x);if(a||(m+=Math.PI),o&&(m+=Math.PI),t.push({anchorPoint:u,offset:o?Math.PI:0,minScale:p,maxScale:f,angle:(m+2*Math.PI)%(2*Math.PI)}),h>=p)break;for(u=c;u.equals(c);)if(i+=a?1:-1,c=r[i],!c)return p;var g=c.sub(u)._unit();u=u.sub(g._mult(d)),f=p}return h}var s=t("point-geometry");e.exports={getIconQuads:i,getGlyphQuads:a};var l=.5},{"point-geometry":174}],84:[function(t,e,n){"use strict";function r(t,e,n){for(var r=[],a=0,o=t.length;o>a;a++){var s=i(t[a].properties,e["text-field"]);if(s){s=s.toString();var l=e["text-transform"];"uppercase"===l?s=s.toLocaleUpperCase():"lowercase"===l&&(s=s.toLocaleLowerCase());for(var u=0;ur&&null!==c){var _=v[c+1].x;g=Math.max(_,g);for(var b=c+1;y>=b;b++)v[b].y+=n,v[b].x-=_;if(o){var w=c;f[v[c].codePoint]&&w--,s(v,e,p,w,o)}p=c+1,c=null,d+=_,m++}h[x.codePoint]&&(c=y)}var M=v[v.length-1],k=M.x+e[M.codePoint].advance;g=Math.max(g,k);var S=(m+1)*n;s(v,e,p,v.length-1,o),l(v,o,i,a,g,n,m,u),t.top+=-a*S,t.bottom=t.top+S,t.left+=-i*g,t.right=t.left+g}function s(t,e,n,r,i){for(var a=e[t[r].codePoint].advance,o=(t[r].x+a)*i,s=n;r>=s;s++)t[s].x-=o}function l(t,e,n,r,i,a,o,s){for(var l=(e-n)*i+s[0],u=(-r*(o+1)+.5)*a+s[1],c=0;c=h;h++,d=((h+u)%u+r)*e+n,p+=a)for(f=-1;l>=f;f++)i[p+f]=t[d+(f+l)%l];else for(h=0;u>h;h++,d+=e,p+=a)for(f=0;l>f;f++)i[p+f]=t[d+f]}function a(t,e,n,r,i){this.rect=t,this.width=e,this.height=n,this.sdf=r,this.pixelRatio=i}var o=t("shelf-pack"),s=t("../util/browser");e.exports=r,r.prototype.allocateImage=function(t,e){t/=this.pixelRatio,e/=this.pixelRatio;var n=2,r=t+n+(4-(t+n)%4),i=e+n+(4-(e+n)%4),a=this.bin.packOne(r,i);return a?a:(console.warn("SpriteAtlas out of space."),null)},r.prototype.getImage=function(t,e){if(this.images[t])return this.images[t];if(!this.sprite)return null;var n=this.sprite.getSpritePosition(t);if(!n.width||!n.height)return null;var r=this.allocateImage(n.width,n.height);if(!r)return null;var i=new a(r,n.width/n.pixelRatio,n.height/n.pixelRatio,n.sdf,n.pixelRatio/this.pixelRatio);return this.images[t]=i,this.copy(r,n,e),i},r.prototype.getPosition=function(t,e){var n=this.getImage(t,e),r=n&&n.rect;if(!r)return null;var i=n.width*n.pixelRatio,a=n.height*n.pixelRatio,o=1;return{size:[n.width,n.height],tl:[(r.x+o)/this.width,(r.y+o)/this.height],br:[(r.x+o+i)/this.width,(r.y+o+a)/this.height]}},r.prototype.allocate=function(){if(!this.data){var t=Math.floor(this.width*this.pixelRatio),e=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(t*e);for(var n=0;n1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},r.prototype.addIcons=function(t,e){for(var n=0;n180&&(c.center.lng>0&&m.lng<0?m.lng+=360:c.center.lng<0&&m.lng>0&&(m.lng-=360));var x=c.zoomScale(g-h),_=c.point,b="center"in t?c.project(m).sub(f.div(x)):_,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),S=k/x,T=b.sub(_).mag();if("minZoom"in t){var A=r.clamp(Math.min(t.minZoom,h,g),c.minZoom,c.maxZoom),E=k/c.zoomScale(A-h);M=Math.sqrt(E/T*2)}var L=M*M,z=n(0),I=function(t){return s(z)/s(z+M*t)},D=function(t){return k*((s(z)*u(z+M*t)-a(z))/L)/T},P=(n(1)-z)/M;if(Math.abs(T)<1e-6){if(Math.abs(k-S)<1e-6)return this.easeTo(t);var C=k>S?-1:1;P=Math.abs(Math.log(S/k))/M,D=function(){return 0},I=function(t){return Math.exp(C*M*t)}}if("duration"in t)t.duration=+t.duration;else{var O="screenSpeed"in t?+t.screenSpeed/M:+t.speed;t.duration=1e3*P/O}return this.zooming=!0,d!==v&&(this.rotating=!0),p!==y&&(this.pitching=!0),this.fire("movestart",e),this.fire("zoomstart",e),this._ease(function(t){var n=t*P,r=D(n);c.zoom=h+c.scaleZoom(1/I(n)),c.center=c.unproject(_.add(b.sub(_).mult(r)),w),this.rotating&&(c.bearing=i(d,v,t)),this.pitching&&(c.pitch=i(p,y,t)),this.fire("move",e),this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){this.fire("zoomend",e),this.fire("moveend",e),this.zooming=!1,this.rotating=!1,this.pitching=!1},t),this},isEasing:function(){return!!this._abortFn},stop:function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},_ease:function(t,e,n){this._finishFn=e,this._abortFn=a.timed(function(e){t.call(this,n.easing(e)),1===e&&this._finishEase()},n.animate===!1?0:n.duration,this)},_finishEase:function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},_normalizeBearing:function(t,e){t=r.wrap(t,-180,180);var n=Math.abs(t-e);return Math.abs(t-360-e)=0)return!1;return!0}),e.join(" | ")},r.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",n=this._container=a.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),n},_update:function(){this._map.style&&(this._container.innerHTML=r.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":108,"../../util/util":119,"./control":89}],89:[function(t,e,n){"use strict";function r(){}e.exports=r,r.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var n=this.options.position,r=t._controlCorners[n];e.className+=" mapboxgl-ctrl",-1!==n.indexOf("bottom")?r.insertBefore(e,r.firstChild):r.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}}},{}],90:[function(t,e,n){"use strict";function r(t){s.setOptions(this,t)}var i=t("./control"),a=t("../../util/browser"),o=t("../../util/dom"),s=t("../../util/util");e.exports=r;var l={enableHighAccuracy:!1,timeout:6e3};r.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",n=this._container=o.create("div",e+"-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),n):n},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this._finish()},_error:function(){this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":105,"../../util/dom":108,"../../util/util":119,"./control":89}],91:[function(t,e,n){"use strict";function r(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var a=t("./control"),o=t("../../util/dom"),s=t("../../util/util");e.exports=r,r.prototype=s.inherit(a,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",n=this._container=o.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=o.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),n},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(o.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),o.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var n=o.create("button",t,this._container);return n.addEventListener("click",function(){e()}),n},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":108,"../../util/util":119,"./control":89}],92:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../geo/lng_lat_bounds"),o=t("../../util/util");e.exports=r,r.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,n=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var r=Math.min(e.x,n.x),a=Math.max(e.x,n.x),o=Math.min(e.y,n.y),s=Math.max(e.y,n.y);i.setTransform(this._box,"translate("+r+"px,"+o+"px)"),this._box.style.width=a-r+"px",this._box.style.height=s-o+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,n=i.mousePos(this._el,t),r=new a(this._map.unproject(e),this._map.unproject(n));this._finish(),e.x===n.x&&e.y===n.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(r,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:r})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":27,"../../util/dom":108,"../../util/util":119}],93:[function(t,e,n){"use strict";function r(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=r,r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat})}}},{}],94:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=r;var o=.3,s=a.bezier(0,0,o,1),l=1400,u=2500;r.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),n=this._map;n.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),n.transform.setLocationAtPoint(n.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),n=this._inertia;if(n.length<2)return void e();var r=n[n.length-1],i=n[0],a=r[1].sub(i[1]),c=(r[0]-i[0])/1e3;if(0===c||r[1].equals(i[1]))return void e();var f=a.mult(o/c),h=f.mag();h>l&&(h=l,f._unit()._mult(h));var d=h/(u*o),p=f.mult(-d/2);this._map.panBy(p,{duration:1e3*d,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var n=1,r=0;return"mousemove"===t.type?t.buttons&0===n:t.button!==r},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),n=160;t.length>0&&e-t[0][0]>n;)t.shift()}}},{"../../util/dom":108,"../../util/util":119}],95:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("point-geometry"),o=t("../../util/util");e.exports=r;var s=.25,l=o.bezier(0,0,s,1),u=180,c=720;r.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0); -},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),n=e.mag();200>n&&(this._center=this._startPos.add(new a(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var n=this._pos,r=i.mousePos(this._el,t),a=this._center,o=n.sub(a).angleWith(r.sub(a))/Math.PI*180,s=e.getBearing()-o,l=this._inertia,u=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,u[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=r}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,n=e.getBearing(),r=this._inertia,i=function(){Math.abs(n)d?-1:1,m=(o[0]-a[0])/1e3;if(0===d||0===m)return void i();var g=Math.abs(d*(s/m));g>u&&(g=u);var v=g/(c*s),y=p*g*(v/2);h+=y,Math.abs(e._normalizeBearing(h,0))1;var n=t.ctrlKey?1:2,r=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===n:t.button!==r},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),n=160;t.length>0&&e-t[0][0]>n;)t.shift()}}},{"../../util/dom":108,"../../util/util":119,"point-geometry":174}],96:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=r;var i=80,a=2,o=5;r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,n={originalEvent:t};switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),n);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),n);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-a},n):(t.preventDefault(),e.panBy([-i,0],n));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+a},n):(t.preventDefault(),e.panBy([i,0],n));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+o},n):(t.preventDefault(),e.panBy([0,-i],n));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-o,0)},n):(t.preventDefault(),e.panBy([0,i],n))}}}}},{}],97:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/browser"),o=t("../../util/util");e.exports=r;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=-1!==s.indexOf("firefox"),u=-1!==s.indexOf("safari")&&-1===s.indexOf("chrom");r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=a.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,u&&(e/=3));var n=a.now(),r=n-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=n,0!==e&&e%4.000244140625===0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(r*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var n=this._map,r=2/(1+Math.exp(-Math.abs(t/100)));0>t&&0!==r&&(r=1/r);var i=n.ease?n.ease.to:n.transform.scale,a=n.transform.scaleZoom(i*r);n.zoomTo(a,{duration:0,around:n.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":105,"../../util/dom":108,"../../util/util":119}],98:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=r;var o=.15,s=a.bezier(0,0,o,1),l=12,u=2.5,c=.15,f=4;r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),n=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(n),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),n=i.mousePos(this._el,t.touches[1]),r=e.add(n).div(2),a=e.sub(n),o=a.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*a.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var u={duration:0,around:l.unproject(r)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=l.transform.scaleZoom(this._startScale*o)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),o,r]),l.easeTo(u,{originalEvent:t})}else{var h=Math.abs(1-o)>c,d=Math.abs(s)>f;d?this._gestureIntent="rotate":h&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=a,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,n=this._map;if(e.length<2)return void n.snapToNorth({},{originalEvent:t});var r=e[e.length-1],i=e[0],a=n.transform.scaleZoom(this._startScale*r[1]),c=n.transform.scaleZoom(this._startScale*i[1]),f=a-c,h=(r[0]-i[0])/1e3,d=r[2];if(0===h||a===c)return void n.snapToNorth({},{originalEvent:t});var p=f*o/h;Math.abs(p)>u&&(p=p>0?u:-u);var m=1e3*Math.abs(p/(l*o)),g=a+p*m/2e3;0>g&&(g=0),n.easeTo({zoom:g,duration:m,easing:s,around:n.unproject(d)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),n=160;t.length>2&&e-t[0][0]>n;)t.shift()}}},{"../../util/dom":108,"../../util/util":119}],99:[function(t,e,n){"use strict";function r(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=r;var i=t("../util/util");r.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3?(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0):!1},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),n=this._map.getBearing(),r=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(r)+"/"+t.lng.toFixed(r)+(n?"/"+Math.round(10*n)/10:"");window.history.replaceState("","",i)}}},{"../util/util":119}],100:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer();for(var e in i)t[e]=new i[e](t);o.bindHandlers(this)}var i={scrollZoom:t("./handler/scroll_zoom"),boxZoom:t("./handler/box_zoom"),dragRotate:t("./handler/drag_rotate"),dragPan:t("./handler/drag_pan"),keyboard:t("./handler/keyboard"),doubleClickZoom:t("./handler/dblclick_zoom"),touchZoomRotate:t("./handler/touch_zoom_rotate")},a=t("../util/dom"),o=t("../util/util"),s=t("point-geometry");e.exports=r,r.prototype={enable:function(){var t=this._map.options,e=this._el;for(var n in i)t[n]&&this._map[n].enable();e.addEventListener("mousedown",this._onMouseDown,!1),e.addEventListener("mouseup",this._onMouseUp,!1),e.addEventListener("mousemove",this._onMouseMove,!1),e.addEventListener("touchstart",this._onTouchStart,!1),e.addEventListener("touchend",this._onTouchEnd,!1),e.addEventListener("touchmove",this._onTouchMove,!1),e.addEventListener("touchcancel",this._onTouchCancel,!1),e.addEventListener("click",this._onClick,!1),e.addEventListener("dblclick",this._onDblClick,!1),e.addEventListener("contextmenu",this._onContextMenu,!1)},disable:function(){var t=this._map.options,e=this._el;for(var n in i)t[n]&&this._map[n].disable();e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp),e.removeEventListener("mousemove",this._onMouseMove),e.removeEventListener("touchstart",this._onTouchStart),e.removeEventListener("touchend",this._onTouchEnd),e.removeEventListener("touchmove",this._onTouchMove),e.removeEventListener("touchcancel",this._onTouchCancel),e.removeEventListener("click",this._onClick),e.removeEventListener("dblclick",this._onDblClick),e.removeEventListener("contextmenu",this._onContextMenu)},_onMouseDown:function(t){this._map.stop(),this._startPos=a.mousePos(this._el,t),this._fireMouseEvent("mousedown",t)},_onMouseUp:function(t){var e=this._map,n=e.dragRotate&&e.dragRotate.isActive();this._contextMenuEvent&&!n&&this._fireMouseEvent("contextmenu",this._contextMenuEvent),this._contextMenuEvent=null,this._fireMouseEvent("mouseup",t)},_onMouseMove:function(t){var e=this._map,n=this._el;if(!(e.dragPan&&e.dragPan.isActive()||e.dragRotate&&e.dragRotate.isActive())){for(var r=t.toElement||t.target;r&&r!==n;)r=r.parentNode;r===n&&this._fireMouseEvent("mousemove",t)}},_onTouchStart:function(t){this._map.stop(),this._fireTouchEvent("touchstart",t),!t.touches||t.touches.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._fireMouseEvent("dblclick",t)):this._tapped=setTimeout(this._onTouchTimeout,300))},_onTouchMove:function(t){this._fireTouchEvent("touchmove",t)},_onTouchEnd:function(t){this._fireTouchEvent("touchend",t)},_onTouchCancel:function(t){this._fireTouchEvent("touchcancel",t)},_onTouchTimeout:function(){this._tapped=null},_onClick:function(t){var e=a.mousePos(this._el,t);e.equals(this._startPos)&&this._fireMouseEvent("click",t)},_onDblClick:function(t){this._fireMouseEvent("dblclick",t),t.preventDefault()},_onContextMenu:function(t){this._contextMenuEvent=t,t.preventDefault()},_fireMouseEvent:function(t,e){var n=a.mousePos(this._el,e);return this._map.fire(t,{lngLat:this._map.unproject(n),point:n,originalEvent:e})},_fireTouchEvent:function(t,e){var n=a.touchPos(this._el,e),r=n.reduce(function(t,e,n,r){return t.add(e.div(r.length))},new s(0,0));return this._map.fire(t,{lngLat:this._map.unproject(r),point:r,lngLats:n.map(function(t){return this._map.unproject(t)},this),points:n,originalEvent:e})}}},{"../util/dom":108,"../util/util":119,"./handler/box_zoom":92,"./handler/dblclick_zoom":93,"./handler/drag_pan":94,"./handler/drag_rotate":95,"./handler/keyboard":96,"./handler/scroll_zoom":97,"./handler/touch_zoom_rotate":98,"point-geometry":174}],101:[function(t,e,n){"use strict";function r(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),a=t("../util/util"),o=t("../util/browser"),s=t("../util/evented"),l=t("../util/dom"),u=t("../style/style"),c=t("../style/animation_loop"),f=t("../render/painter"),h=t("../geo/transform"),d=t("./hash"),p=t("./interaction"),m=t("./camera"),g=t("../geo/lng_lat"),v=t("../geo/lng_lat_bounds"),y=t("point-geometry"),x=t("./control/attribution"),_=0,b=20,w=e.exports=function(t){t=a.inherit(this.options,t),this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new c,this.transform=new h(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),a.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowResize","onError","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof window&&window.addEventListener("resize",this._onWindowResize,!1),this.interaction=new p(this),t.interactive&&this.interaction.enable(),this._hash=t.hash&&(new d).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo(t),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new x(t.attributionControl)),this.on("style.error",this.onError),this.on("source.error",this.onError),this.on("tile.error",this.onError),this.on("layer.error",this.onError)};a.extend(w.prototype,s),a.extend(w.prototype,m.prototype),a.extend(w.prototype,{options:{center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:_,maxZoom:b,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1},addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var n=this._classes.indexOf(t);return 0>n||""===t?this:(this._classes.splice(n,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var n={},r=0;r=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new v(this.transform.pointLocation(new y(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new y(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new y(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=v.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?_:t,t>=_&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&b>=t)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+b+", inclusive")},project:function(t){return this.transform.locationPoint(g.convert(t))},unproject:function(t){return this.transform.pointLocation(y.convert(t))},queryRenderedFeatures:function(t,e){t instanceof y||Array.isArray(t)||(e=t,t=void 0);var n=this._makeQueryGeometry(t);return this.style.queryRenderedFeatures(n,e,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[y.convert([0,0]),y.convert([this.transform.width,this.transform.height])]);var e,n=t instanceof y||"number"==typeof t[0];if(n){var r=y.convert(t);e=[r]}else{var i=[y.convert(t[0]),y.convert(t[1])];e=[i[0],new y(i[1].x,i[0].y),i[1],new y(i[0].x,i[1].y),i[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement),this.off("pitch",this.style._redoPlacement)),t?(t instanceof u?this.style=t:this.style=new u(t,this.animationLoop),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){return this.style.serialize()},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,n){return this.style.setLayerZoomRange(t,e,n),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,n,r){return this.style.setPaintProperty(t,e,n,r),this._update(!0),this},getPaintProperty:function(t,e,n){return this.style.getPaintProperty(t,e,n)},setLayoutProperty:function(t,e,n){return this.style.setLayoutProperty(t,e,n),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=l.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var n=this._controlContainer=l.create("div","mapboxgl-control-container",t),r=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){r[t]=l.create("div","mapboxgl-ctrl-"+t,n)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});return t?void(this.painter=new f(t,this.transform)):void console.error("Failed to initialize WebGL")},_contextLost:function(t){t.preventDefault(),this._frameId&&o.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return this._styleDirty||this._sourcesDirty?!1:!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){return this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||!this.animationLoop.stopped())&&this._rerender(),this},remove:function(){this._hash&&this._hash.remove(),o.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof window&&window.removeEventListener("resize",this._onWindowResize,!1),r(this._canvasContainer),r(this._controlContainer),this._container.classList.remove("mapboxgl-map")},onError:function(t){console.error(t.error)},_rerender:function(){this.style&&!this._frameId&&(this._frameId=o.frame(this._render))},_forwardStyleEvent:function(t){this.fire("style."+t.type,a.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowResize:function(){this.stop().resize()._update()}}),a.extendAll(w.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":26,"../geo/lng_lat_bounds":27,"../geo/transform":28,"../render/painter":41,"../style/animation_loop":57,"../style/style":60,"../util/browser":105,"../util/canvas":106,"../util/dom":108,"../util/evented":111,"../util/util":119,"./camera":87,"./control/attribution":88,"./hash":99,"./interaction":100,"point-geometry":174}],102:[function(t,e,n){"use strict";function r(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=r;var i=t("../util/util"),a=t("../util/evented"),o=t("../util/dom"),s=t("../geo/lng_lat");r.prototype=i.inherit(a,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,n=document.createDocumentFragment(),r=document.createElement("body");for(r.innerHTML=t;;){if(e=r.firstChild,!e)break;n.appendChild(e)}return this.setDOMContent(n)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=o.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=o.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=o.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=o.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var n=this._container.offsetWidth,r=this._container.offsetHeight;e=t.ythis._map.transform.height-r?["bottom"]:[],t.xthis._map.transform.width-n/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},a=this._container.classList;for(var s in i)a.remove("mapboxgl-popup-anchor-"+s);a.add("mapboxgl-popup-anchor-"+e),o.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":26,"../util/dom":108,"../util/evented":111,"../util/util":119}],103:[function(t,e,n){"use strict";function r(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=r,r.prototype.receive=function(t){var e,n=t.data;if(""===n.type)e=this.callbacks[n.id],delete this.callbacks[n.id],e(n.error||null,n.data);else if("undefined"!=typeof n.id){var r=n.id;this.parent[n.type](n.data,function(t,e,n){this.postMessage({type:"",id:String(r),error:t?String(t):null,data:e},n)}.bind(this))}else this.parent[n.type](n.data)},r.prototype.send=function(t,e,n,r){var i=null;n&&(this.callbacks[i=this.callbackID++]=n),this.postMessage({type:t,id:String(i),data:e},r)},r.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],104:[function(t,e,n){"use strict";function r(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}n.getJSON=function(t,e){var n=new XMLHttpRequest;return n.open("GET",t,!0),n.setRequestHeader("Accept","application/json"),n.onerror=function(t){e(t)},n.onload=function(){if(n.status>=200&&n.status<300&&n.response){var t;try{t=JSON.parse(n.response)}catch(r){return e(r)}e(null,t)}else e(new Error(n.statusText))},n.send(),n},n.getArrayBuffer=function(t,e){var n=new XMLHttpRequest;return n.open("GET",t,!0),n.responseType="arraybuffer",n.onerror=function(t){e(t)},n.onload=function(){n.status>=200&&n.status<300&&n.response?e(null,n.response):e(new Error(n.statusText))},n.send(),n},n.getImage=function(t,e){return n.getArrayBuffer(t,function(t,n){if(t)return e(t);var r=new Image;r.onload=function(){e(null,r),(window.URL||window.webkitURL).revokeObjectURL(r.src)};var i=new Blob([new Uint8Array(n)],{type:"image/png"});return r.src=(window.URL||window.webkitURL).createObjectURL(i),r.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=r.width,t.height=r.height,e.drawImage(r,0,0),e.getImageData(0,0,r.width,r.height).data},r})},n.getVideo=function(t,e){var n=document.createElement("video");n.onloadstart=function(){e(null,n)};for(var i=0;i=s+r?t.call(i,1):(t.call(i,(l-s)/r),n.frame(a)))}if(!r)return t.call(i,1),null;var o=!1,s=e.exports.now();return n.frame(a),function(){o=!0}},n.supported=t("mapbox-gl-js-supported"),n.hardwareConcurrency=navigator.hardwareConcurrency||8,Object.defineProperty(n,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),n.supportsWebp=!1;var a=document.createElement("img");a.onload=function(){n.supportsWebp=!0},a.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",n.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-js-supported":145}],106:[function(t,e,n){"use strict";function r(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),a=t("mapbox-gl-js-supported");e.exports=r,r.prototype.resize=function(t,e){ -var n=window.devicePixelRatio||1;this.canvas.width=n*t,this.canvas.height=n*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},r.prototype.getWebGLContext=function(t){return t=i.extend({},t,a.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},r.prototype.getElement=function(){return this.canvas}},{"../util":119,"mapbox-gl-js-supported":145}],107:[function(t,e,n){"use strict";function r(e,n){this.actors=[],this.currentActor=0;for(var r=0;e>r;r++){var o=new a(t("../../source/worker")),s=new i(o,n);s.name="Worker "+r,this.actors.push(s)}}var i=t("../actor"),a=t("webworkify");e.exports=r,r.prototype={broadcast:function(t,e){for(var n=0;n=0&&this._events[t].splice(n,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var n=function(r){this.off(t,n),e.call(this,r)}.bind(this);return this.on(t,n),this},fire:function(t,e){if(!this.listens(t))return this;e=r.extend({},e),r.extend(e,{type:t,target:this});for(var n=this._events[t].slice(),i=0;i=3)for(var l=0;l1){if(s(t,e))return!0;for(var r=0;r(e.y-t.y)*(n.x-t.x)}function u(t,e,n,r){return l(t,n,r)!==l(e,n,r)&&l(t,e,n)!==l(t,e,r)}function c(t,e,n){var r=n*n;if(1===e.length)return t.distSqr(e[0])i?t.distSqr(e):i>1?t.distSqr(n):t.distSqr(n.sub(e)._mult(i)._add(e))}function h(t,e){for(var n,r,i,a=!1,o=0;oe.y!=i.y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(a=!a)}return a}function d(t,e){for(var n=!1,r=0,i=t.length-1;re.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(n=!n)}return n}e.exports={multiPolygonIntersectsBufferedMultiPoint:r,multiPolygonIntersectsMultiPolygon:i,multiPolygonIntersectsBufferedMultiLine:a}},{}],115:[function(t,e,n){"use strict";function r(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=r,r.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},r.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var n=this.get(this.order[0]);n&&this.onRemove(n)}return this},r.prototype.has=function(t){return t in this.data},r.prototype.keys=function(){return this.order},r.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},r.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],116:[function(t,e,n){"use strict";function r(t,e,n){if(n=n||i.ACCESS_TOKEN,!n&&i.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,i.API_URL+e),t+=-1!==t.indexOf("?")?"&access_token=":"?access_token=",i.REQUIRE_ACCESS_TOKEN){if("s"===n[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=n}return t}var i=t("./config"),a=t("./browser");e.exports.normalizeStyleURL=function(t,e){if(!t.match(/^mapbox:\/\/styles\//))return t;var n=t.split("/"),i=n[3],a=n[4],o=n[5]?"/draft":"";return r("mapbox://"+i+"/"+a+o,"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){return t.match(/^mapbox:\/\//)?r(t+".json","/v4/",e)+"&secure":t},e.exports.normalizeGlyphsURL=function(t,e){if(!t.match(/^mapbox:\/\//))return t;var n=t.split("/")[3];return r("mapbox://"+n+"/{fontstack}/{range}.pbf","/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,n,i){if(!t.match(/^mapbox:\/\/sprites\//))return t+e+n;var a=t.split("/"),o=a[3],s=a[4],l=a[5]?"/draft":"";return r("mapbox://"+o+"/"+s+l+"/sprite"+e+n,"/styles/v1/",i)},e.exports.normalizeTileURL=function(t,e,n){if(!e||!e.match(/^mapbox:\/\//))return t;t=t.replace(/([?&]access_token=)tk\.[^&]+/,"$1"+i.ACCESS_TOKEN);var r=a.supportsWebp?"webp":"$1";return t.replace(/\.((?:png|jpg)\d*)(?=$|\?)/,a.devicePixelRatio>=2||512===n?"@2x."+r:"."+r)}},{"./browser":105,"./config":109}],117:[function(t,e,n){"use strict";function r(t){function e(){h.apply(this,arguments)}function n(){d.apply(this,arguments),this.members=e.prototype.members}var r=JSON.stringify(t);if(g[r])return g[r];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(h.prototype);var s=0,u=0,v=["Uint8"];return e.prototype.members=t.members.map(function(n){n={name:n.name,type:n.type,components:n.components||1},p(n.name.length),p(n.type in m),v.indexOf(n.type)<0&&v.push(n.type);var r=o(n.type);u=Math.max(u,r),n.offset=s=a(s,Math.max(t.alignment,r));for(var i=0;ithis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},d.prototype._refreshViews=function(){for(var t=0;t$=:;.,^]+)}/g,function(e,n){return n in t?t[n]:""})}e.exports=r},{}],119:[function(t,e,n){"use strict";var r=t("unitbezier"),i=t("../geo/coordinate");n.easeCubicInOut=function(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(.5>t?n:3*(t-e)+n-.75)},n.bezier=function(t,e,n,i){var a=new r(t,e,n,i);return function(t){return a.solve(t)}},n.ease=n.bezier(.25,.1,.25,1),n.premultiply=function(t){if(!t)return null;var e=t[3];return[t[0]*e,t[1]*e,t[2]*e,e]},n.clamp=function(t,e,n){return Math.min(n,Math.max(e,t))},n.wrap=function(t,e,n){var r=n-e,i=((t-e)%r+r)%r+e;return i===e?n:i},n.coalesce=function(){for(var t=0;t=0)return!0;return!1}},{"../geo/coordinate":25,unitbezier:182}],120:[function(t,e,n){"use strict";function r(t,e,n,r){this._vectorTileFeature=t,t._z=e,t._x=n,t._y=r,this.properties=t.properties,t._id&&(this.id=t._id)}function i(t,e,n,r,i){for(var a=e*Math.pow(2,n),o=e*r,s=e*i,l=0;lt?0:t>255?255:t}function i(t){return 0>t?0:t>1?1:t}function a(t){return r("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return i("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function s(t,e,n){return 0>n?n+=1:n>1&&(n-=1),1>6*n?t+(e-t)*n*6:1>2*n?e:2>3*n?t+(e-t)*(2/3-n)*6:t}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in u)return u[e].slice();if("#"===e[0]){if(4===e.length){var n=parseInt(e.substr(1),16);return n>=0&&4095>=n?[(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1]:null}if(7===e.length){var n=parseInt(e.substr(1),16);return n>=0&&16777215>=n?[(16711680&n)>>16,(65280&n)>>8,255&n,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(-1!==i&&l+1===e.length){var c=e.substr(0,i),f=e.substr(i+1,l-(i+1)).split(","),h=1;switch(c){case"rgba":if(4!==f.length)return null;h=o(f.pop());case"rgb":return 3!==f.length?null:[a(f[0]),a(f[1]),a(f[2]),h];case"hsla":if(4!==f.length)return null;h=o(f.pop());case"hsl":if(3!==f.length)return null;var d=(parseFloat(f[0])%360+360)%360/360,p=o(f[1]),m=o(f[2]),g=.5>=m?m*(p+1):m+p-m*p,v=2*m-g;return[r(255*s(v,g,d+1/3)),r(255*s(v,g,d)),r(255*s(v,g,d-1/3)),h];default:return null}}return null}var u={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{n.parseCSSColor=l}catch(c){}},{}],122:[function(t,e,n){"use strict";function r(t){return new Function("f","var p = (f && f.properties || {}); return "+i(t))}function i(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";var n="=="===e?o(t[1],t[2],"===",!1):"!="===e?o(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?o(t[1],t[2],e,!0):"any"===e?s(t.slice(1),"||"):"all"===e?s(t.slice(1),"&&"):"none"===e?c(s(t.slice(1),"||")):"in"===e?l(t[1],t.slice(2)):"!in"===e?c(l(t[1],t.slice(2))):"has"===e?u(t[1]):"!has"===e?c(u([t[1]])):"true";return"("+n+")"}function a(t){return"$type"===t?"f.type":"p["+JSON.stringify(t)+"]"}function o(t,e,n,r){var i=a(t),o="$type"===t?h.indexOf(e):JSON.stringify(e);return(r?"typeof "+i+"=== typeof "+o+"&&":"")+i+n+o}function s(t,e){return t.map(i).join(e)}function l(t,e){"$type"===t&&(e=e.map(function(t){return h.indexOf(t)}));var n=JSON.stringify(e.sort(f)),r=a(t);return e.length<=200?n+".indexOf("+r+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+r+", "+n+",0,"+(e.length-1)+")"}function u(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function f(t,e){return e>t?-1:t>e?1:0}e.exports=r;var h=["Unknown","Point","LineString","Polygon"]},{}],123:[function(t,e,n){function r(t,e){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.map(i(r,e)),t;case"Feature":return t.geometry=r(t.geometry,e),t;case"Polygon":case"MultiPolygon":return a(t,e);default:return t}}function i(t,e){return function(n){return t(n,e)}}function a(t,e){return"Polygon"===t.type?t.coordinates=o(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(i(o,e))),t}function o(t,e){e=!!e,t[0]=s(t[0],!e);for(var n=1;n=0}var u=t("geojson-area");e.exports=r},{"geojson-area":124}],124:[function(t,e,n){function r(t){if("Polygon"===t.type)return i(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,n=0;n0){e+=Math.abs(a(t[0]));for(var n=1;n2){for(var n,r,i=0;i=n&&r>=u)return t;if(l>r||n>u)return null;for(var c=[],f=0;f=n&&r>=d)c.push(p);else if(!(h>r||n>d)){var v=1===g?i(m,n,r,o):a(m,n,r,o,s,3===g);v.length&&c.push({geometry:v,type:g,tags:t[f].tags||null,min:p.min,max:p.max})}}return c.length?c:null}function i(t,e,n,r){for(var i=[],a=0;a=e&&n>=s&&i.push(o)}return i}function a(t,e,n,r,i,a){for(var s=[],l=0;lc;c++)u=p||m[c],p=m[c+1],h=d||u[r],d=p[r],e>h?d>n?(x.push(i(u,p,e),i(u,p,n)),a||(x=o(s,x,g,v))):d>=e&&x.push(i(u,p,e)):h>n?e>d?(x.push(i(u,p,n),i(u,p,e)),a||(x=o(s,x,g,v))):n>=d&&x.push(i(u,p,n)):(x.push(u),e>d?(x.push(i(u,p,e)),a||(x=o(s,x,g,v))):d>n&&(x.push(i(u,p,n)),a||(x=o(s,x,g,v))));u=m[y-1],h=u[r],h>=e&&n>=h&&x.push(u),f=x[x.length-1],a&&f&&(x[0][0]!==f[0]||x[0][1]!==f[1])&&x.push(x[0]),o(s,x,g,v)}return s}function o(t,e,n,r){return e.length&&(e.area=n,e.dist=r,t.push(e)),[]}e.exports=r},{}],127:[function(t,e,n){"use strict";function r(t,e){var n=[];if("FeatureCollection"===t.type)for(var r=0;rr?-1:r>1?1:r,[n,r,0]}function l(t){for(var e,n,r=0,i=0,a=0;a1)return!1;var a=i.geometry[0].length;if(5!==a)return!1;for(var o=0;a>o;o++){var s=f.point(i.geometry[0][o],e,t.z2,t.x,t.y);if(s[0]!==-n&&s[0]!==e+n||s[1]!==-n&&s[1]!==e+n)return!1}return!0}e.exports=r;var c=t("./convert"),f=t("./transform"),h=t("./clip"),d=t("./wrap"),p=t("./tile");i.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},i.prototype.splitTile=function(t,e,n,r,i,l,c){for(var f=[t,e,n,r],d=this.options,m=d.debug,g=null;f.length;){r=f.pop(),n=f.pop(),e=f.pop(),t=f.pop();var v=1<1&&console.time("creation"),x=this.tiles[y]=p(t,v,n,r,_,e===d.maxZoom),this.tileCoords.push({z:e,x:n,y:r}),m)){m>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,r,x.numFeatures,x.numPoints,x.numSimplified),console.timeEnd("creation"));var b="z"+e;this.stats[b]=(this.stats[b]||0)+1,this.total++}if(x.source=t,i){if(e===d.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,k,S,T,A,E,L=.5*d.buffer/d.extent,z=.5-L,I=.5+L,D=1+L;M=k=S=T=null,A=h(t,v,n-L,n+I,0,o,x.min[0],x.max[0]),E=h(t,v,n+z,n+D,0,o,x.min[0],x.max[0]),A&&(M=h(A,v,r-L,r+I,1,s,x.min[1],x.max[1]),k=h(A,v,r+z,r+D,1,s,x.min[1],x.max[1])),E&&(S=h(E,v,r-L,r+I,1,s,x.min[1],x.max[1]),T=h(E,v,r+z,r+D,1,s,x.min[1],x.max[1])),m>1&&console.timeEnd("clipping"),M&&f.push(M,e+1,2*n,2*r),k&&f.push(k,e+1,2*n,2*r+1),S&&f.push(S,e+1,2*n+1,2*r),T&&f.push(T,e+1,2*n+1,2*r+1)}else i&&(g=e)}return g},i.prototype.getTile=function(t,e,n){var r=this.options,i=r.extent,o=r.debug,s=1<1&&console.log("drilling down to z%d-%d-%d",t,e,n);for(var c,h=t,d=e,p=n;!c&&h>0;)h--,d=Math.floor(d/2),p=Math.floor(p/2),c=this.tiles[a(h,d,p)];if(!c||!c.source)return null;if(o>1&&console.log("found parent tile z%d-%d-%d",h,d,p),u(c,i,r.buffer))return f.tile(c,i);o>1&&console.time("drilling down");var m=this.splitTile(c.source,h,d,p,t,e,n);if(o>1&&console.timeEnd("drilling down"),null!==m){var g=1<n;n++)a=i(t[n],t[u],t[c]),a>r&&(o=n,r=a);r>s?(t[o][2]=r,f.push(u),f.push(o),u=o):(c=f.pop(),u=f.pop())}}function i(t,e,n){var r=e[0],i=e[1],a=n[0],o=n[1],s=t[0],l=t[1],u=a-r,c=o-i;if(0!==u||0!==c){var f=((s-r)*u+(l-i)*c)/(u*u+c*c);f>1?(r=a,i=o):f>0&&(r+=u*f,i+=c*f)}return u=s-r,c=l-i,u*u+c*c}e.exports=r},{}],130:[function(t,e,n){"use strict";function r(t,e,n,r,a,o){for(var s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:r,z2:e,transformed:!1,min:[2,1],max:[-1,0]},l=0;ls.max[0]&&(s.max[0]=c[0]),c[1]>s.max[1]&&(s.max[1]=c[1])}return s}function i(t,e,n,r){var i,a,o,s,l=e.geometry,u=e.type,c=[],f=n*n;if(1===u)for(i=0;if)&&(h.push(s),t.numSimplified++),t.numPoints++;c.push(h)}else t.numPoints+=o.length;c.length&&t.features.push({geometry:c,type:u,tags:e.tags||null})}e.exports=r},{}],131:[function(t,e,n){"use strict";function r(t,e){if(t.transformed)return t;var n,r,a,o=t.z2,s=t.x,l=t.y;for(n=0;n0?(r=2*Math.sqrt(n+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t},i.fromRotationTranslationScale=function(t,e,n,r){var i=e[0],a=e[1],o=e[2],s=e[3],l=i+i,u=a+a,c=o+o,f=i*l,h=i*u,d=i*c,p=a*u,m=a*c,g=o*c,v=s*l,y=s*u,x=s*c,_=r[0],b=r[1],w=r[2];return t[0]=(1-(p+g))*_,t[1]=(h+x)*_,t[2]=(d-y)*_,t[3]=0,t[4]=(h-x)*b,t[5]=(1-(f+g))*b,t[6]=(m+v)*b,t[7]=0,t[8]=(d+y)*w,t[9]=(m-v)*w,t[10]=(1-(f+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,n,r,i){var a=e[0],o=e[1],s=e[2],l=e[3],u=a+a,c=o+o,f=s+s,h=a*u,d=a*c,p=a*f,m=o*c,g=o*f,v=s*f,y=l*u,x=l*c,_=l*f,b=r[0],w=r[1],M=r[2],k=i[0],S=i[1],T=i[2];return t[0]=(1-(m+v))*b,t[1]=(d+_)*b,t[2]=(p-x)*b,t[3]=0,t[4]=(d-_)*w,t[5]=(1-(h+v))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(p+x)*M,t[9]=(g-y)*M,t[10]=(1-(h+m))*M,t[11]=0,t[12]=n[0]+k-(t[0]*k+t[4]*S+t[8]*T),t[13]=n[1]+S-(t[1]*k+t[5]*S+t[9]*T),t[14]=n[2]+T-(t[2]*k+t[6]*S+t[10]*T),t[15]=1,t},i.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n+n,s=r+r,l=i+i,u=n*o,c=r*o,f=r*s,h=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-f-p,t[1]=c+v,t[2]=h-g,t[3]=0,t[4]=c-v,t[5]=1-u-p,t[6]=d+m,t[7]=0,t[8]=h+g,t[9]=d-m,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,n,r,i,a,o){var s=1/(n-e),l=1/(i-r),u=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]=(n+e)*s,t[9]=(i+r)*l,t[10]=(o+a)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*u,t[15]=0,t},i.perspective=function(t,e,n,r,i){var a=1/Math.tan(e/2),o=1/(r-i);return t[0]=a/n,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+r)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*r*o,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,n,r){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),u=2/(i+a);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((o-s)*l*.5),t[9]=(i-a)*u*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},i.ortho=function(t,e,n,r,i,a,o){var s=1/(e-n),l=1/(r-i),u=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*u,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*l,t[14]=(o+a)*u,t[15]=1,t},i.lookAt=function(t,e,n,a){var o,s,l,u,c,f,h,d,p,m,g=e[0],v=e[1],y=e[2],x=a[0],_=a[1],b=a[2],w=n[0],M=n[1],k=n[2];return Math.abs(g-w)l?(a.cross(t,e,i),a.length(t)<1e-6&&a.cross(t,n,i),a.normalize(t,t),s.setAxisAngle(r,t,Math.PI),r):l>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(a.cross(t,i,o),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+l,s.normalize(r,r))}}(),s.setAxes=function(){var t=i.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=o.clone,s.fromValues=o.fromValues,s.copy=o.copy,s.set=o.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,n){n=.5*n;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t},s.getAxisAngle=function(t,e){var n=2*Math.acos(e[3]),r=Math.sin(n/2);return 0!=r?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n},s.add=o.add,s.multiply=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3],s=n[0],l=n[1],u=n[2],c=n[3];return t[0]=r*c+o*s+i*u-a*l,t[1]=i*c+o*l+a*s-r*u,t[2]=a*c+o*u+r*l-i*s,t[3]=o*c-r*s-i*l-a*u,t},s.mul=s.multiply,s.scale=o.scale,s.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l+o*s,t[1]=i*l+a*s,t[2]=a*l-i*s,t[3]=o*l-r*s,t},s.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l-a*s,t[1]=i*l+o*s,t[2]=a*l+r*s,t[3]=o*l-i*s,t},s.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l+i*s,t[1]=i*l-r*s,t[2]=a*l+o*s,t[3]=o*l-a*s,t},s.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},s.dot=o.dot,s.lerp=o.lerp,s.slerp=function(t,e,n,r){var i,a,o,s,l,u=e[0],c=e[1],f=e[2],h=e[3],d=n[0],p=n[1],m=n[2],g=n[3];return a=u*d+c*p+f*m+h*g,0>a&&(a=-a,d=-d,p=-p,m=-m,g=-g),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-r)*i)/o,l=Math.sin(r*i)/o):(s=1-r,l=r),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*m,t[3]=s*h+l*g,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(n,r,i,a,o,l){return s.slerp(t,r,o,l),s.slerp(e,i,a,l),s.slerp(n,t,e,2*l*(1-l)),n}}(),s.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n*n+r*r+i*i+a*a,s=o?1/o:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-i*s,t[3]=a*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=o.length,s.len=s.length,s.squaredLength=o.squaredLength,s.sqrLen=s.squaredLength,s.normalize=o.normalize,s.fromMat3=function(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*o+o]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*a+o]-e[3*o+a])*n,t[a]=(e[3*a+i]+e[3*i+a])*n,t[o]=(e[3*o+i]+e[3*i+o])*n}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=o.exactEquals,s.equals=o.equals,e.exports=s},{"./common.js":134,"./mat3.js":137,"./vec3.js":141,"./vec4.js":142}],140:[function(t,e,n){var r=t("./common.js"),i={};i.create=function(){var t=new r.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,n){return t[0]=e,t[1]=n,t},i.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},i.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},i.sub=i.subtract,i.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t},i.mul=i.multiply,i.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},i.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},i.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},i.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)},i.dist=i.distance,i.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},i.len=i.length,i.squaredLength=function(t){var e=t[0],n=t[1];return e*e+n*n},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},i.lerp=function(t,e,n,r){var i=e[0],a=e[1];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t},i.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},i.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},i.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},i.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,a,o){var s,l;for(n||(n=2),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;l>s;s+=n)t[0]=e[s],t[1]=e[s+1],a(t,t,o),e[s]=t[0],e[s+1]=t[1];return e}}(),i.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},i.equals=function(t,e){var n=t[0],i=t[1],a=e[0],o=e[1];return Math.abs(n-a)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-o)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))},e.exports=i},{"./common.js":134}],141:[function(t,e,n){var r=t("./common.js"),i={};i.create=function(){var t=new r.ARRAY_TYPE(3);return t[0]=0,t[1]=0,t[2]=0,t},i.clone=function(t){var e=new r.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},i.fromValues=function(t,e,n){var i=new r.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=n,i},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},i.set=function(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t},i.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t},i.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t},i.sub=i.subtract,i.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t},i.mul=i.multiply,i.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},i.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t},i.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},i.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t},i.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t},i.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)},i.dist=i.distance,i.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},i.normalize=function(t,e){var n=e[0],r=e[1],i=e[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[0],s=n[1],l=n[2];return t[0]=i*l-a*s,t[1]=a*o-r*l,t[2]=r*s-i*o,t},i.lerp=function(t,e,n,r){var i=e[0],a=e[1],o=e[2];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=o+r*(n[2]-o),t},i.hermite=function(t,e,n,r,i,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),c=o*(3-2*a);return t[0]=e[0]*s+n[0]*l+r[0]*u+i[0]*c,t[1]=e[1]*s+n[1]*l+r[1]*u+i[1]*c,t[2]=e[2]*s+n[2]*l+r[2]*u+i[2]*c,t},i.bezier=function(t,e,n,r,i,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,f=3*l*o,h=l*a;return t[0]=e[0]*u+n[0]*c+r[0]*f+i[0]*h,t[1]=e[1]*u+n[1]*c+r[1]*f+i[1]*h,t[2]=e[2]*u+n[2]*c+r[2]*f+i[2]*h,t},i.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI,i=2*r.RANDOM()-1,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*a,t[1]=Math.sin(n)*a,t[2]=i*e,t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return o=o||1,t[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/o,t[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,t[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,t},i.transformMat3=function(t,e,n){var r=e[0],i=e[1],a=e[2];return t[0]=r*n[0]+i*n[3]+a*n[6],t[1]=r*n[1]+i*n[4]+a*n[7],t[2]=r*n[2]+i*n[5]+a*n[8],t},i.transformQuat=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[0],s=n[1],l=n[2],u=n[3],c=u*r+s*a-l*i,f=u*i+l*r-o*a,h=u*a+o*i-s*r,d=-o*r-s*i-l*a;return t[0]=c*u+d*-o+f*-l-h*-s,t[1]=f*u+d*-s+h*-o-c*-l,t[2]=h*u+d*-l+c*-s-f*-o,t},i.rotateX=function(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[0],a[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),a[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},i.rotateY=function(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),a[1]=i[1],a[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},i.rotateZ=function(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),a[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),a[2]=i[2],t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,a,o){var s,l;for(n||(n=3),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;l>s;s+=n)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],a(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}}(),i.angle=function(t,e){var n=i.fromValues(t[0],t[1],t[2]),r=i.fromValues(e[0],e[1],e[2]);i.normalize(n,n),i.normalize(r,r);var a=i.dot(n,r);return a>1?0:Math.acos(a)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var n=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))},e.exports=i},{"./common.js":134}],142:[function(t,e,n){var r=t("./common.js"),i={};i.create=function(){var t=new r.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,n,i){var a=new r.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},i.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},i.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t},i.sub=i.subtract,i.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},i.mul=i.multiply,i.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},i.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},i.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t},i.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+a*a)},i.dist=i.distance,i.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+i*i+a*a},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n*n+r*r+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=a*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,n,r){var i=e[0],a=e[1],o=e[2],s=e[3];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=o+r*(n[2]-o),t[3]=s+r*(n[3]-s),t},i.random=function(t,e){return e=e||1,t[0]=r.RANDOM(),t[1]=r.RANDOM(),t[2]=r.RANDOM(),t[3]=r.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*o,t[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*o,t[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*o,t[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*o,t},i.transformQuat=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[0],s=n[1],l=n[2],u=n[3],c=u*r+s*a-l*i,f=u*i+l*r-o*a,h=u*a+o*i-s*r,d=-o*r-s*i-l*a;return t[0]=c*u+d*-o+f*-l-h*-s,t[1]=f*u+d*-s+h*-o-c*-l,t[2]=h*u+d*-l+c*-s-f*-o,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,a,o){var s,l;for(n||(n=4),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;l>s;s+=n)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],a(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}(),i.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[0],l=e[1],u=e[2],c=e[3];return Math.abs(n-s)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-u)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(o-c)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))},e.exports=i},{"./common.js":134}],143:[function(t,e,n){"use strict";function r(t,e,n){var r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],n=a[2],this.d=e+2*n;for(var o=0;o=t&&i>=e&&n>=a&&r>=a)return this.keys.slice();var o=[],s={};return this._forEachCell(t,e,n,r,this._queryCell,o,s),o},r.prototype._queryCell=function(t,e,n,r,i,a,o){var s=this.cells[i];if(null!==s)for(var l=this.keys,u=this.bboxes,c=0;c=u[h+0]&&r>=u[h+1]?(o[f]=!0,a.push(l[f])):o[f]=!1}}},r.prototype._forEachCell=function(t,e,n,r,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(n),c=this._convertToCellCoord(r),f=s;u>=f;f++)for(var h=l;c>=h;h++){var d=this.d*h+f;if(i.call(this,t,e,n,r,d,a,o))return}},r.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},r.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,n=0,r=0;r=t.stops.length)break;if(e<=t.stops[r][0])break;r++}return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:s(e,n,t.stops[r-1][0],t.stops[r][0],t.stops[r-1][1],t.stops[r][1])}function s(t,e,n,r,i,a){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),l=a.apply(void 0,arguments);return s(t,e,n,r,o,l)}:i.length?u(t,e,n,r,i,a):l(t,e,n,r,i,a)}function l(t,e,n,r,i,a){var o,s=r-n,l=t-n;return o=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-o)+a*o}function u(t,e,n,r,i,a){for(var o=[],s=0;s7)return[new r(c,l,"constants have been deprecated as of v8")];if(!(l in h.constants))return[new r(c,l,'constant "%s" not found',l)];e=a({},e,{value:h.constants[l]})}return u.function&&"object"===i(l)?n(e):u.type&&s[u.type]?s[u.type](e):o(a({},e,{valueSpec:u.type?f[u.type]:u}))}},{"../error/validation_error":146,"../util/extend":147,"../util/get_type":148,"./validate_array":151,"./validate_boolean":152,"./validate_color":153,"./validate_constants":154,"./validate_enum":155,"./validate_filter":156,"./validate_function":157,"./validate_layer":159,"./validate_number":161,"./validate_object":162,"./validate_source":164,"./validate_string":165}],151:[function(t,e,n){"use strict";var r=t("../util/get_type"),i=t("./validate"),a=t("../error/validation_error");e.exports=function(t){var e=t.value,n=t.valueSpec,o=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==r(e))return[new a(l,e,"array expected, %s found",r(e))];if(n.length&&e.length!==n.length)return[new a(l,e,"array length %d expected, length %d found",n.length,e.length)];if(n["min-length"]&&e.length7)return n?[new r(e,n,"constants have been deprecated as of v8")]:[];var o=i(n);if("object"!==o)return[new r(e,n,"object expected, %s found",o)];var s=[];for(var l in n)"@"!==l[0]&&s.push(new r(e+"."+l,n[l],'constants must start with "@"'));return s}},{"../error/validation_error":146,"../util/get_type":148 -}],155:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,n=t.value,a=t.valueSpec,o=[];return-1===a.values.indexOf(i(n))&&o.push(new r(e,n,"expected one of [%s], %s found",a.values.join(", "),n)),o}},{"../error/validation_error":146,"../util/unbundle_jsonlint":149}],156:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("./validate_enum"),a=t("../util/get_type"),o=t("../util/unbundle_jsonlint");e.exports=function s(t){var e,n=t.value,l=t.key,u=t.styleSpec,c=[];if("array"!==a(n))return[new r(l,n,"array expected, %s found",a(n))];if(n.length<1)return[new r(l,n,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:n[0],valueSpec:u.filter_operator,style:t.style,styleSpec:t.styleSpec})),o(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"==n[1]&&c.push(new r(l,n,'"$type" cannot be use with operator "%s"',n[0]));case"==":case"!=":3!=n.length&&c.push(new r(l,n,'filter array for operator "%s" must have 3 elements',n[0]));case"in":case"!in":n.length>=2&&(e=a(n[1]),"string"!==e?c.push(new r(l+"[1]",n[1],"string expected, %s found",e)):"@"===n[1][0]&&c.push(new r(l+"[1]",n[1],"filter key cannot be a constant")));for(var f=2;fa.maximum?[new i(e,n,"%s is greater than the maximum value %s",n,a.maximum)]:[]}},{"../error/validation_error":146,"../util/get_type":148}],162:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("../util/get_type"),a=t("./validate");e.exports=function(t){var e=t.key,n=t.value,o=t.valueSpec,s=t.objectElementValidators||{},l=t.style,u=t.styleSpec,c=[],f=i(n);if("object"!==f)return[new r(e,n,"object expected, %s found",f)];for(var h in n){var d=h.split(".")[0],p=o&&(o[d]||o["*"]),m=s[d]||s["*"];p||m?c=c.concat((m||a)({key:(e?e+".":e)+h,value:n[h],valueSpec:p,style:l,styleSpec:u,object:n,objectKey:h})):""!==e&&1!==e.split(".").length&&c.push(new r(e,n[h],'unknown property "%s"',h))}for(d in o)o[d].required&&void 0===o[d].default&&void 0===n[d]&&c.push(new r(e,n,'missing required property "%s"',d));return c}},{"../error/validation_error":146,"../util/get_type":148,"./validate":150}],163:[function(t,e,n){"use strict";var r=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,n=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a["paint_"+t.layerType],u=s.match(/^(.*)-transition$/);return u&&l[u[1]]&&l[u[1]].transition?r({key:e,value:o,valueSpec:a.transition,style:n,styleSpec:a}):t.valueSpec||l[s]?r({key:t.key,value:o,valueSpec:t.valueSpec||l[s],style:n,styleSpec:a}):[new i(e,o,'unknown property "%s"',s)]}},{"../error/validation_error":146,"./validate":150}],164:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),a=t("./validate_object"),o=t("./validate_enum");e.exports=function(t){var e=t.value,n=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new r(n,e,'"type" is required')];var u=i(e.type);switch(u){case"vector":case"raster":var c=[];if(c=c.concat(a({key:n,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var f in e)["type","url","tileSize"].indexOf(f)<0&&c.push(new r(n+"."+f,e[f],'a source with a "url" property may not include a "%s" property',f));return c;case"geojson":return a({key:n,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return a({key:n,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return a({key:n,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return o({key:n+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":146,"../util/unbundle_jsonlint":149,"./validate_enum":155,"./validate_object":162}],165:[function(t,e,n){"use strict";var r=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,n=t.key,a=r(e);return"string"!==a?[new i(n,e,"string expected, %s found",a)]:[]}},{"../error/validation_error":146,"../util/get_type":148}],166:[function(t,e,n){"use strict";function r(t,e){e=e||l;var n=[];return n=n.concat(s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:u}})),e.$version>7&&t.constants&&(n=n.concat(o({key:"constants",value:t.constants,style:t,styleSpec:e}))),i(n)}function i(t){return[].concat(t).sort(function(t,e){return t.line-e.line})}function a(t){return function(){return i(t.apply(this,arguments))}}var o=t("./validate/validate_constants"),s=t("./validate/validate"),l=t("../reference/latest.min"),u=t("./validate/validate_glyphs_url");r.source=a(t("./validate/validate_source")),r.layer=a(t("./validate/validate_layer")),r.filter=a(t("./validate/validate_filter")),r.paintProperty=a(t("./validate/validate_paint_property")),r.layoutProperty=a(t("./validate/validate_layout_property")),e.exports=r},{"../reference/latest.min":168,"./validate/validate":150,"./validate/validate_constants":154,"./validate/validate_filter":156,"./validate/validate_glyphs_url":158,"./validate/validate_layer":159,"./validate/validate_layout_property":160,"./validate/validate_paint_property":163,"./validate/validate_source":164}],167:[function(t,e,n){e.exports=t("./v8.json")},{"./v8.json":169}],168:[function(t,e,n){e.exports=t("./v8.min.json")},{"./v8.min.json":170}],169:[function(t,e,n){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8],doc:"Stylesheet version number. Must be 8.",example:8},name:{type:"string",doc:"A human-readable name for the style.",example:"Bright"},metadata:{type:"*",doc:"Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},center:{type:"array",value:"number",doc:"Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:[-73.9749,40.7736]},zoom:{type:"number",doc:"Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:12.5},bearing:{type:"number","default":0,period:360,units:"degrees",doc:"Default bearing, in degrees. The style bearing will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:29},pitch:{type:"number","default":0,units:"degrees",doc:"Default pitch, in degrees. Zero is perpendicular to the surface. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:50},sources:{required:!0,type:"sources",doc:"Data source specifications.",example:{"mapbox-streets":{type:"vector",url:"mapbox://mapbox.mapbox-streets-v6"}}},sprite:{type:"string",doc:"A base URL for retrieving the sprite image and metadata. The extensions `.png`, `.json` and scale factor `@2x.png` will be automatically appended. This property is required if any layer uses the 'sprite-image' layout property.",example:"mapbox://sprites/mapbox/bright-v8"},glyphs:{type:"string",doc:"A URL template for loading signed-distance-field glyph sets in PBF format. The URL must include `{fontstack}` and `{range}` tokens. This property is required if any layer uses the 'text-field' layout property.",example:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},transition:{type:"transition",doc:"A global transition definition to use as a default across properties.",example:{duration:300,delay:0}},layers:{required:!0,type:"array",value:"layer",doc:"Layers will be drawn in the order of this array.",example:[{id:"water",source:"mapbox-streets","source-layer":"water",type:"fill",paint:{"fill-color":"#00ffff"}}]}},sources:{"*":{type:"source",doc:"Specification of a data source. For vector and raster sources, either TileJSON or a URL to a TileJSON must be provided. For GeoJSON and video sources, a URL must be provided."}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"],doc:"The data type of the tile source."},url:{type:"string",doc:"A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://`."},tiles:{type:"array",value:"string",doc:"An array of one or more tile source URLs, as in the TileJSON spec."},minzoom:{type:"number","default":0,doc:"Minimum zoom level for which tiles are available, as in the TileJSON spec."},maxzoom:{type:"number","default":22,doc:"Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."},tileSize:{type:"number","default":512,units:"pixels",doc:"The minimum visual size to display tiles for this layer. Only configurable for raster layers."},"*":{type:"*",doc:"Other keys to configure the data source."}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"],doc:"The data type of the GeoJSON source."},data:{type:"*",doc:"A URL to a GeoJSON file, or inline GeoJSON."},maxzoom:{type:"number","default":14,doc:"Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."},buffer:{type:"number","default":64,doc:"Tile buffer size on each side (higher means fewer rendering artifacts near tile edges but slower performance)."},tolerance:{type:"number","default":3,doc:"Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance)."},cluster:{type:"boolean","default":!1,doc:"If the data is a collection of point features, setting this to true clusters the points by radius into groups."},clusterRadius:{type:"number","default":400,doc:"Radius of each cluster when clustering points, relative to 4096 tile."},clusterMaxZoom:{type:"number",doc:"Max zoom to cluster points on. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered)."}},source_video:{type:{required:!0,type:"enum",values:["video"],doc:"The data type of the video source."},urls:{required:!0,type:"array",value:"string",doc:"URLs to video content in order of preferred format."},coordinates:{required:!0,doc:"Corners of video specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},source_image:{type:{required:!0,type:"enum",values:["image"],doc:"The data type of the image source."},url:{required:!0,type:"string",doc:"URL that points to an image"},coordinates:{required:!0,doc:"Corners of image specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},layer:{id:{type:"string",doc:"Unique layer name.",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"],doc:"Rendering type of this layer."},metadata:{type:"*",doc:"Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},ref:{type:"string",doc:"References another layer to copy `type`, `source`, `source-layer`, `minzoom`, `maxzoom`, `filter`, and `layout` properties from. This allows the layers to share processing and be more efficient."},source:{type:"string",doc:"Name of a source description to be used for this layer."},"source-layer":{type:"string",doc:"Layer to use from a vector tile source. Required if the source supports multiple layers."},minzoom:{type:"number",minimum:0,maximum:22,doc:"The minimum zoom level on which the layer gets parsed and appears on."},maxzoom:{type:"number",minimum:0,maximum:22,doc:"The maximum zoom level on which the layer gets parsed and appears on."},interactive:{type:"boolean",doc:"Enable querying of feature data from this layer for interactivity.","default":!1},filter:{type:"filter",doc:"A expression specifying conditions on source features. Only features that match the filter are displayed."},layout:{type:"layout",doc:"Layout properties for the layer."},paint:{type:"paint",doc:"Default paint properties for this layer."},"paint.*":{type:"paint",doc:"Class-specific paint properties for this layer. The class name is the part after the first dot."}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant",values:["butt","round","square"],"default":"butt",doc:"The display of line endings."},"line-join":{type:"enum","function":"piecewise-constant",values:["bevel","round","miter"],"default":"miter",doc:"The display of lines when joining."},"line-miter-limit":{type:"number","default":2,"function":"interpolated",doc:"Used to automatically convert miter joins to bevel joins for sharp angles.",requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number","default":1.05,"function":"interpolated",doc:"Used to automatically convert round joins to miter joins for shallow angles.",requires:[{"line-join":"round"}]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant",values:["point","line"],"default":"point",doc:"Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons."},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated",units:"pixels",doc:"Distance between two symbol anchors.",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer."},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the icon will be visible even if it collides with other previously drawn symbols.",requires:["icon-image"]},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, other symbols can be visible even if they collide with the icon.",requires:["icon-image"]},"icon-optional":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.",requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",doc:"Orientation of icon when map is rotated.",requires:["icon-image"]},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated",doc:"Scale factor for icon. 1 is original size, 3 triples the size.",requires:["icon-image"]},"icon-image":{type:"string","function":"piecewise-constant",doc:"A string with {tokens} replaced, referencing the data property to pull from.",tokens:!0},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated",units:"degrees",doc:"Rotates the icon clockwise.",requires:["icon-image"]},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated",units:"pixels",doc:"Size of the additional area around the icon bounding box used for detecting symbol collisions.",requires:["icon-image"]},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the icon may be flipped to prevent it from being rendered upside-down.",requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",doc:"Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"]},"text-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",doc:"Orientation of text when map is rotated.",requires:["text-field"]},"text-field":{type:"string","function":"piecewise-constant","default":"",tokens:!0,doc:"Value to use for a text label. Feature properties are specified using tokens like {field_name}."},"text-font":{type:"array",value:"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],doc:"Font stack to use for displaying text.",requires:["text-field"]},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated",doc:"Font size.",requires:["text-field"]},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated",doc:"The maximum line width for text wrapping.",requires:["text-field"]},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated",doc:"Text leading value for multi-line text.",requires:["text-field"]},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated",doc:"Text tracking amount.",requires:["text-field"]},"text-justify":{type:"enum","function":"piecewise-constant",values:["left","center","right"],"default":"center",doc:"Text justification options.",requires:["text-field"]},"text-anchor":{type:"enum","function":"piecewise-constant",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",doc:"Part of the text placed closest to the anchor.",requires:["text-field"]},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated",doc:"Maximum angle change between adjacent characters.",requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated",doc:"Rotates the text clockwise.",requires:["text-field"]},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated",doc:"Size of the additional area around the text bounding box used for detecting symbol collisions.",requires:["text-field"]},"text-keep-upright":{type:"boolean","function":"piecewise-constant","default":!0,doc:"If true, the text may be flipped vertically to prevent it from being rendered upside-down.",requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum","function":"piecewise-constant",values:["none","uppercase","lowercase"],"default":"none",doc:"Specifies how to capitalize text, similar to the CSS `text-transform` property.",requires:["text-field"]},"text-offset":{type:"array",doc:"Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.",value:"number",units:"ems","function":"interpolated",length:2,"default":[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the text will be visible even if it collides with other previously drawn symbols.",requires:["text-field"]},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, other symbols can be visible even if they collide with the text.",requires:["text-field"]},"text-optional":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.",requires:["text-field","icon-image"]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},filter:{type:"array",value:"*",doc:"A filter selects specific features from a layer."},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"],doc:"The filter operator."},geometry_type:{type:"enum",values:["Point","LineString","Polygon"],doc:"The geometry type for the filter to select."},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"],doc:"A color operation to apply."},"function":{stops:{type:"array",required:!0,doc:"An array of stops.",value:"function_stop"},base:{type:"number","default":1,minimum:0,doc:"The exponential base of the interpolation curve. It controls the rate at which the result increases. Higher values make the result increase more towards the high end of the range. With `1` the stops are interpolated linearly."},property:{type:"string",doc:"The name of a global property or feature property to use as the function input.","default":"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],doc:"The interpolation strategy to use in function evaluation.","default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2,doc:"Zoom level and value pair."},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","default":!0,doc:"Whether or not the fill should be antialiased."},"fill-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,doc:"The opacity given to the fill color.",transition:!0},"fill-color":{type:"color","default":"#000000",doc:"The color of the fill.","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color",doc:"The outline color of the fill. Matches the value of `fill-color` if unspecified.","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"fill-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["fill-translate"]},"fill-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)."}},paint_line:{"line-opacity":{type:"number",doc:"The opacity at which the line will be drawn.","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color",doc:"The color with which the line will be drawn.","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"line-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["line-translate"]},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Stroke thickness."},"line-gap-width":{type:"number","default":0,minimum:0,doc:"Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.","function":"interpolated",transition:!0,units:"pixels"},"line-offset":{type:"number","default":0,doc:'The line\'s offset perpendicular to its direction. Values may be positive or negative, where positive indicates "rightwards" (if you were moving in the direction of the line) and negative indicates "leftwards."',"function":"interpolated",transition:!0,units:"pixels"},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Blur applied to the line, in pixels."},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant",doc:"Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512)."}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Circle radius."},"circle-color":{type:"color","default":"#000000",doc:"The color of the circle.","function":"interpolated", -transition:!0},"circle-blur":{type:"number","default":0,doc:"Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.","function":"interpolated",transition:!0},"circle-opacity":{type:"number",doc:"The opacity at which the circle will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"circle-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["circle-translate"]}},paint_symbol:{"icon-opacity":{doc:"The opacity at which the icon will be drawn.",type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["icon-image"]},"icon-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,doc:"The color of the icon. This can only be used with sdf icons.",requires:["icon-image"]},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,doc:"The color of the icon's halo. Icon halos can only be used with sdf icons.",requires:["icon-image"]},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Distance of halo to the icon outline.",requires:["icon-image"]},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Fade out the halo towards the outside.",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"]},"icon-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number",doc:"The opacity at which the text will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["text-field"]},"text-color":{type:"color",doc:"The color with which the text will be drawn.","default":"#000000","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,doc:"The color of the text's halo, which helps it stand out from backgrounds.",requires:["text-field"]},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.",requires:["text-field"]},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"The halo's fadeout distance towards the outside.",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["text-field"]},"text-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number",doc:"The opacity at which the image will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated",transition:!0,units:"degrees",doc:"Rotates hues around the color wheel."},"raster-brightness-min":{type:"number","function":"interpolated",doc:"Increase or reduce the brightness of the image. The value is the minimum brightness.","default":0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number","function":"interpolated",doc:"Increase or reduce the brightness of the image. The value is the maximum brightness.","default":1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number",doc:"Increase or reduce the saturation of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-contrast":{type:"number",doc:"Increase or reduce the contrast of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated",transition:!0,units:"milliseconds",doc:"Fade duration when a new tile is added."}},paint_background:{"background-color":{type:"color","default":"#000000",doc:"The color with which the background will be drawn.","function":"interpolated",transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)."},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,doc:"The opacity at which the background will be drawn.","function":"interpolated",transition:!0}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds",doc:"Time allotted for transitions to complete."},delay:{type:"number","default":0,minimum:0,units:"milliseconds",doc:"Length of time before a transition begins."}}}},{}],170:[function(t,e,n){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number","default":0,period:360,units:"degrees"},pitch:{type:"number","default":0,units:"degrees"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number","default":0},maxzoom:{type:"number","default":22},tileSize:{type:"number","default":512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number","default":14},buffer:{type:"number","default":64},tolerance:{type:"number","default":3},cluster:{type:"boolean","default":!1},clusterRadius:{type:"number","default":400},clusterMaxZoom:{type:"number"}},source_video:{type:{required:!0,type:"enum",values:["video"]},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:["image"]},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean","default":!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant",values:["butt","round","square"],"default":"butt"},"line-join":{type:"enum","function":"piecewise-constant",values:["bevel","round","miter"],"default":"miter"},"line-miter-limit":{type:"number","default":2,"function":"interpolated",requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number","default":1.05,"function":"interpolated",requires:[{"line-join":"round"}]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant",values:["point","line"],"default":"point"},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated",units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","default":!1},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image"]},"icon-optional":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",requires:["icon-image"]},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated",requires:["icon-image"]},"icon-image":{type:"string","function":"piecewise-constant",tokens:!0},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated",units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated",units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",requires:["icon-image"]},"text-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",requires:["text-field"]},"text-field":{type:"string","function":"piecewise-constant","default":"",tokens:!0},"text-font":{type:"array",value:"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated",requires:["text-field"]},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated",requires:["text-field"]},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated",requires:["text-field"]},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated",requires:["text-field"]},"text-justify":{type:"enum","function":"piecewise-constant",values:["left","center","right"],"default":"center",requires:["text-field"]},"text-anchor":{type:"enum","function":"piecewise-constant",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",requires:["text-field"]},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated",requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated",requires:["text-field"]},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated",requires:["text-field"]},"text-keep-upright":{type:"boolean","function":"piecewise-constant","default":!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum","function":"piecewise-constant",values:["none","uppercase","lowercase"],"default":"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems","function":"interpolated",length:2,"default":[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field"]},"text-optional":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field","icon-image"]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},geometry_type:{type:"enum",values:["Point","LineString","Polygon"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},"function":{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number","default":1,minimum:0},property:{type:"string","default":"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],"default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","default":!0},"fill-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["fill-translate"]},"fill-pattern":{type:"string","function":"piecewise-constant",transition:!0}},paint_line:{"line-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["line-translate"]},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-gap-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-offset":{type:"number","default":0,"function":"interpolated",transition:!0,units:"pixels"},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string","function":"piecewise-constant",transition:!0}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"circle-color":{type:"color","default":"#000000","function":"interpolated",transition:!0},"circle-blur":{type:"number","default":0,"function":"interpolated",transition:!0},"circle-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["circle-translate"]}},paint_symbol:{"icon-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["icon-image"]},"icon-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["text-field"]},"text-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated",transition:!0,units:"degrees"},"raster-brightness-min":{type:"number","function":"interpolated","default":0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-contrast":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated",transition:!0,units:"milliseconds"}},paint_background:{"background-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string","function":"piecewise-constant",transition:!0},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds"},delay:{type:"number","default":0,minimum:0,units:"milliseconds"}}}},{}],171:[function(t,e,n){"use strict";function r(t){var e;t&&t.length&&(e=t,t=e.length);var n=new Uint8Array(t||0);return e&&n.set(e),n.readUInt32LE=a.readUInt32LE,n.writeUInt32LE=a.writeUInt32LE,n.readInt32LE=a.readInt32LE,n.writeInt32LE=a.writeInt32LE,n.readFloatLE=a.readFloatLE,n.writeFloatLE=a.writeFloatLE,n.readDoubleLE=a.readDoubleLE,n.writeDoubleLE=a.writeDoubleLE,n.toString=a.toString,n.write=a.write,n.slice=a.slice,n.copy=a.copy,n._isBuffer=!0,n}function i(t){for(var e,n,r=t.length,i=[],a=0;r>a;a++){if(e=t.charCodeAt(a),e>55295&&57344>e){if(!n){e>56319||a+1===r?i.push(239,191,189):n=e;continue}if(56320>e){i.push(239,191,189),n=e;continue}e=n-55296<<10|e-56320|65536,n=null}else n&&(i.push(239,191,189),n=null);128>e?i.push(e):2048>e?i.push(e>>6|192,63&e|128):65536>e?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=r;var a,o,s,l=t("ieee754");a={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,n){var r="",i="";e=e||0,n=Math.min(this.length,n||this.length);for(var a=e;n>a;a++){var o=this[a];127>=o?(r+=decodeURIComponent(i)+String.fromCharCode(o),i=""):i+="%"+o.toString(16)}return r+=decodeURIComponent(i)},write:function(t,e){for(var n=t===o?s:i(t),r=0;rn)return t;if(n=r[e.pos++],t+=34359738368*(127&n),128>n)return t;if(n=r[e.pos++],t+=4398046511104*(127&n),128>n)return t;if(n=r[e.pos++],t+=562949953421312*(127&n),128>n)return t;if(n=r[e.pos++],t+=72057594037927940*(127&n),128>n)return t;if(n=r[e.pos++],t+=0x8000000000000000*(127&n),128>n)return t;throw new Error("Expected varint not more than 10 bytes")}function a(t,e){e.realloc(10);for(var n=e.pos+10;t>=1;){if(e.pos>=n)throw new Error("Given varint doesn't fit into 10 bytes");var r=255&t;e.buf[e.pos++]=r|(t>=128?128:0),t/=128}}function o(t,e,n){var r=16383>=e?1:2097151>=e?2:268435455>=e?3:Math.ceil(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function s(t,e){for(var n=0;n>3,a=this.pos;t(i,e,this),this.pos===a&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*v;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*v;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,n=this.buf;return e=n[this.pos++],t=127&e,128>e?t:(e=n[this.pos++],t|=(127&e)<<7,128>e?t:(e=n[this.pos++],t|=(127&e)<<14,128>e?t:(e=n[this.pos++],t|=(127&e)<<21,128>e?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(x>e)return e;for(var n=this.pos-2;255===this.buf[n];)n--;t>n&&(n=t),e=0;for(var r=0;n-t+1>r;r++){var i=127&~this.buf[t+r];e+=4>r?i<<7*r:i*Math.pow(2,7*r)}return-e-1},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.buf.toString("utf8",this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.slice(this.pos,t);return this.pos=t,e},readPackedVarint:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos127;);else if(e===r.Bytes)this.pos=this.readVarint()+this.pos;else if(e===r.Fixed32)this.pos+=4;else{if(e!==r.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455?void a(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=t>>>7&127)))))},writeSVarint:function(t){this.writeVarint(0>t?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);var e=g.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;e>n;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var r=this.pos-n;r>=128&&o(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,r.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){this.writeMessage(t,s,e)},writePackedSVarint:function(t,e){this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){this.writeMessage(t,f,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,h,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedFixed64:function(t,e){this.writeMessage(t,p,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,m,e)},writeBytesField:function(t,e){this.writeTag(t,r.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,r.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,r.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,r.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":171}],173:[function(t,e,n){n.read=function(t,e,n,r,i){var a,o,s=8*i-r-1,l=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,r),a-=u}return(d?-1:1)*o*Math.pow(2,a-r)},n.write=function(t,e,n,r,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,p=r?1:-1,m=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=c):(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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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[n+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[n+d]=255&o,d+=p,o/=256,u-=8);t[n+d-p]|=128*m}},{}],174:[function(t,e,n){"use strict";function r(t,e){this.x=t,this.y=e}e.exports=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(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)},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,n=t.y-this.y;return e*e+n*n},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[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,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},_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),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t; -}},{}],175:[function(e,n,r){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof r?n.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var n=document.getElementsByTagName("head")[0];n.insertBefore(e,n.firstChild);for(var r,i=document.createElement("a"),a=1;t>a;a++)i.href=arguments[a],r=i.href,e.href=r;return n.removeChild(e),r}return t})},{}],176:[function(t,e,n){"use strict";function r(t,e,n){n=n||{},this.w=t||64,this.h=e||64,this.autoResize=!!n.autoResize,this.shelves=[],this.stats={},this.count=function(t){this.stats[t]=(0|this.stats[t])+1}}function i(t,e,n){this.x=0,this.y=t,this.w=this.free=e,this.h=n}e.exports=r,r.prototype.pack=function(t,e){t=[].concat(t),e=e||{};for(var n,r,i,a=[],o=0;on.h||t>n.free||e=c||t>c)&&(f=2*Math.max(t,c)),(c>l||e>l)&&(u=2*Math.max(e,l)),this.resize(f,u),this.packOne(t,e)}return null},r.prototype.clear=function(){this.shelves=[],this.stats={}},r.prototype.resize=function(t,e){if(tthis.free||e>this.h)return null;var n=this.x;return this.x+=t,this.free-=t,{x:n,y:this.y,w:t,h:e,width:t,height:e}},i.prototype.resize=function(t){return t=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:n}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return 0>n?0:n>1?1:n}function f(t){return 360*(t-.5)}function h(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function d(t,e){for(var n in e)t[n]=e[n];return t}function p(t){return t.x}function m(t){return t.y}var g=t("kdbush");e.exports=r,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var n="prepare "+t.length+" points";e&&console.time(n),this.points=t;var r=t.map(o);e&&console.timeEnd(n);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var a=+Date.now();this.trees[i+1]=g(r,p,m,this.options.nodeSize,Float32Array),r=this._cluster(r,i),e&&console.log("z%d: %d clusters in %dms",i,r.length,+Date.now()-a)}return this.trees[this.options.minZoom]=g(r,p,m,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var n=this.trees[this._limitZoom(e)],r=n.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],a=0;a=h-d)for(var p=d;h>=p;p++)s=e[2*p],l=e[2*p+1],s>=n&&i>=s&&l>=r&&a>=l&&c.push(t[p]);else{var m=Math.floor((d+h)/2);s=e[2*m],l=e[2*m+1],s>=n&&i>=s&&l>=r&&a>=l&&c.push(t[m]);var g=(f+1)%2;(0===f?s>=n:l>=r)&&(u.push(d),u.push(m-1),u.push(g)),(0===f?i>=s:a>=l)&&(u.push(m+1),u.push(h),u.push(g))}}return c}e.exports=r},{}],180:[function(t,e,n){"use strict";function r(t,e,n,a,o,s){if(!(n>=o-a)){var l=Math.floor((a+o)/2);i(t,e,l,a,o,s%2),r(t,e,n,a,l-1,s+1),r(t,e,n,l+1,o,s+1)}}function i(t,e,n,r,o,s){for(;o>r;){if(o-r>600){var l=o-r+1,u=n-r+1,c=Math.log(l),f=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*f*(l-f)/l)*(0>u-l/2?-1:1),d=Math.max(r,Math.floor(n-u*f/l+h)),p=Math.min(o,Math.floor(n+(l-u)*f/l+h));i(t,e,n,d,p,s)}var m=e[2*n+s],g=r,v=o;for(a(t,e,r,n),e[2*o+s]>m&&a(t,e,r,o);v>g;){for(a(t,e,g,v),g++,v--;e[2*g+s]m;)v--}e[2*r+s]===m?a(t,e,r,v):(v++,a(t,e,v,o)),n>=v&&(r=v+1),v>=n&&(o=v-1)}}function a(t,e,n,r){o(t,n,r),o(e,2*n,2*r),o(e,2*n+1,2*r+1)}function o(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}e.exports=r},{}],181:[function(t,e,n){"use strict";function r(t,e,n,r,a,o){for(var s=[0,t.length-1,0],l=[],u=a*a;s.length;){var c=s.pop(),f=s.pop(),h=s.pop();if(o>=f-h)for(var d=h;f>=d;d++)i(e[2*d],e[2*d+1],n,r)<=u&&l.push(t[d]);else{var p=Math.floor((h+f)/2),m=e[2*p],g=e[2*p+1];i(m,g,n,r)<=u&&l.push(t[p]);var v=(c+1)%2;(0===c?m>=n-a:g>=r-a)&&(s.push(h),s.push(p-1),s.push(v)),(0===c?n+a>=m:r+a>=g)&&(s.push(p+1),s.push(f),s.push(v))}}return l}function i(t,e,n,r){var i=t-n,a=e-r;return i*i+a*a}e.exports=r},{}],182:[function(t,e,n){function r(t,e,n,r){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=n,this.p2y=r}e.exports=r,r.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},r.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},r.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},r.prototype.solveCurveX=function(t,e){"undefined"==typeof e&&(e=1e-6);var n,r,i,a,o;for(i=t,o=0;8>o;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)i)return n;if(i>r)return r;for(;r>n;){if(a=this.sampleCurveX(i),Math.abs(a-t)a?n=i:r=i,i=.5*(r-n)+n}return i},r.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],183:[function(t,e,n){e.exports.VectorTile=t("./lib/vectortile.js"),e.exports.VectorTileFeature=t("./lib/vectortilefeature.js"),e.exports.VectorTileLayer=t("./lib/vectortilelayer.js")},{"./lib/vectortile.js":184,"./lib/vectortilefeature.js":185,"./lib/vectortilelayer.js":186}],184:[function(t,e,n){"use strict";function r(t,e){this.layers=t.readFields(i,{},e)}function i(t,e,n){if(3===t){var r=new a(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}var a=t("./vectortilelayer");e.exports=r},{"./vectortilelayer":186}],185:[function(t,e,n){"use strict";function r(t,e,n,r,a){this.properties={},this.extent=n,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=a,t.readFields(i,this,e)}function i(t,e,n){1==t?e._id=n.readVarint():2==t?a(n,e):3==t?e.type=n.readVarint():4==t&&(e._geometry=n.pos)}function a(t,e){for(var n=t.readVarint()+t.pos;t.pos=e)return[t];for(var n,r,i=[],a=0;e>a;a++){var o=s(t[a]);0!==o&&(void 0===r&&(r=0>o),r===0>o?(n&&i.push(n),n=[t[a]]):n.push(t[a]))}return n&&i.push(n),i}function s(t){for(var e,n,r=0,i=0,a=t.length,o=a-1;a>i;o=i++)e=t[i],n=t[o],r+=(n.x-e.x)*(e.y+n.y);return r}var l=t("point-geometry");e.exports=r,r.types=["Unknown","Point","LineString","Polygon"],r.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,r=1,i=0,a=0,o=0,s=[];t.pos>3}if(i--,1===r||2===r)a+=t.readSVarint(),o+=t.readSVarint(),1===r&&(e&&s.push(e),e=[]),e.push(new l(a,o));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&s.push(e),s},r.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,a=0,o=1/0,s=-(1/0),l=1/0,u=-(1/0);t.pos>3}if(r--,1===n||2===n)i+=t.readSVarint(),a+=t.readSVarint(),o>i&&(o=i),i>s&&(s=i),l>a&&(l=a),a>u&&(u=a);else if(7!==n)throw new Error("unknown command "+n)}return[o,l,s,u]},r.prototype.toGeoJSON=function(t,e,n){function i(t){for(var e=0;e>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}var o=t("./vectortilefeature.js");e.exports=r,r.prototype.feature=function(t){if(0>t||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new o(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":185}],187:[function(t,e,n){function r(t){var e=[];for(var n in t.layers)e.push(a(t.layers[n]));var r=new c;return f.tile.write({layers:e},r),r.finish()}function i(t){var e={};for(var n in t)e[n]=new h(t[n].features),e[n].name=n;return r({layers:e})}function a(t){for(var e={name:t.name||"",version:t.version||1,extent:t.extent||4096,keys:[],values:[],features:[]},n={},r={},i=0;i>31}function l(t){for(var e=[],n=0,r=0,i=t.length,a=0;i>a;a++){var l=t[a];e.push(o(1,1));for(var u=0;ut?{sint_value:t}:{uint_value:t}:{string_value:""+t},e.key=n+":"+t,e}var c=t("pbf"),f=t("./vector-tile-pb"),h=t("./lib/geojson_wrapper");e.exports=r,e.exports.fromVectorTileJs=r,e.exports.fromGeojsonVt=i,e.exports.GeoJSONWrapper=h},{"./lib/geojson_wrapper":188,"./vector-tile-pb":189,pbf:172}],188:[function(t,e,n){"use strict";function r(t){this.features=t,this.length=t.length}function i(t){this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=4096}var a=t("point-geometry"),o=t("vector-tile").VectorTileFeature;e.exports=r,r.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;el;l++){var c=s[l],f=a[c].exports;if(f===t||f&&f.default===t){n=c;break}}if(!n){n=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var h={},l=0,u=s.length;u>l;l++){var c=s[l];h[c]=c}i[n]=[Function(["require","module","exports"],"("+t+")(self)"),h]}var d=Math.floor(Math.pow(16,8)*Math.random()).toString(16),p={};p[n]=n,i[d]=[Function(["require"],"var f = require("+o(n)+");(f.default ? f.default : f)(self);"),p];var m="("+r+")({"+Object.keys(i).map(function(t){return o(t)+":["+i[t][0]+","+o(i[t][1])+"]"}).join(",")+"},{},["+o(d)+"])",g=window.URL||window.webkitURL||window.mozURL||window.msURL,v=new Blob([m],{type:"text/javascript"});if(e&&e.bare)return v;var y=g.createObjectURL(v),x=new Worker(y);return"function"==typeof g.revokeObjectURL&&g.revokeObjectURL(y),x}},{}],191:[function(e,n,r){!function(){function e(t,n){if(t=t?t:"",n=n||{},t instanceof e)return t;if(!(this instanceof e))return new e(t,n);var i=r(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=q(100*this._a)/100,this._format=n.format||i.format,this._gradientType=n.gradientType,this._r<1&&(this._r=q(this._r)),this._g<1&&(this._g=q(this._g)),this._b<1&&(this._b=q(this._b)),this._ok=i.ok,this._tc_id=j++}function r(t){var e={r:0,g:0,b:0},n=1,r=!1,a=!1;return"string"==typeof t&&(t=O(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(e=i(t.r,t.g,t.b),r=!0,a="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=D(t.s),t.v=D(t.v),e=l(t.h,t.s,t.v),r=!0,a="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=D(t.s),t.l=D(t.l),e=o(t.h,t.s,t.l),r=!0,a="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=S(n),{ok:r,format:t.format||a,r:V(255,U(e.r,0)),g:V(255,U(e.g,0)),b:V(255,U(e.b,0)),a:n}}function i(t,e,n){return{r:255*T(t,255),g:255*T(e,255),b:255*T(n,255)}}function a(t,e,n){t=T(t,255),e=T(e,255),n=T(n,255);var r,i,a=U(t,e,n),o=V(t,e,n),s=(a+o)/2;if(a==o)r=i=0;else{var l=a-o;switch(i=s>.5?l/(2-a-o):l/(a+o),a){case t:r=(e-n)/l+(n>e?6:0);break;case e:r=(n-t)/l+2;break;case n:r=(t-e)/l+4}r/=6}return{h:r,s:i,l:s}}function o(t,e,n){function r(t,e,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?t+6*(e-t)*n:.5>n?e:2/3>n?t+(e-t)*(2/3-n)*6:t}var i,a,o;if(t=T(t,360),e=T(e,100),n=T(n,100),0===e)i=a=o=n;else{var s=.5>n?n*(1+e):n+e-n*e,l=2*n-s;i=r(l,s,t+1/3),a=r(l,s,t),o=r(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function s(t,e,n){t=T(t,255),e=T(e,255),n=T(n,255);var r,i,a=U(t,e,n),o=V(t,e,n),s=a,l=a-o;if(i=0===a?0:l/a,a==o)r=0;else{switch(a){case t:r=(e-n)/l+(n>e?6:0);break;case e:r=(n-t)/l+2;break;case n:r=(t-e)/l+4}r/=6}return{h:r,s:i,v:s}}function l(t,e,n){t=6*T(t,360),e=T(e,100),n=T(n,100);var r=B.floor(t),i=t-r,a=n*(1-e),o=n*(1-i*e),s=n*(1-(1-i)*e),l=r%6,u=[n,o,a,a,s,n][l],c=[s,n,n,o,a,a][l],f=[a,a,s,n,n,o][l];return{r:255*u,g:255*c,b:255*f}}function u(t,e,n,r){var i=[I(q(t).toString(16)),I(q(e).toString(16)),I(q(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function c(t,e,n,r){var i=[I(P(r)),I(q(t).toString(16)),I(q(e).toString(16)),I(q(n).toString(16))];return i.join("")}function f(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.s-=n/100,r.s=A(r.s),e(r)}function h(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.s+=n/100,r.s=A(r.s),e(r)}function d(t){return e(t).desaturate(100)}function p(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.l+=n/100,r.l=A(r.l),e(r)}function m(t,n){n=0===n?0:n||10;var r=e(t).toRgb();return r.r=U(0,V(255,r.r-q(255*-(n/100)))),r.g=U(0,V(255,r.g-q(255*-(n/100)))),r.b=U(0,V(255,r.b-q(255*-(n/100)))),e(r)}function g(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.l-=n/100,r.l=A(r.l),e(r)}function v(t,n){var r=e(t).toHsl(),i=(q(r.h)+n)%360;return r.h=0>i?360+i:i,e(r)}function y(t){var n=e(t).toHsl();return n.h=(n.h+180)%360,e(n)}function x(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+120)%360,s:n.s,l:n.l}),e({h:(r+240)%360,s:n.s,l:n.l})]}function _(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+90)%360,s:n.s,l:n.l}),e({h:(r+180)%360,s:n.s,l:n.l}),e({h:(r+270)%360,s:n.s,l:n.l})]}function b(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+72)%360,s:n.s,l:n.l}),e({h:(r+216)%360,s:n.s,l:n.l})]}function w(t,n,r){n=n||6,r=r||30;var i=e(t).toHsl(),a=360/r,o=[e(t)];for(i.h=(i.h-(a*n>>1)+720)%360;--n;)i.h=(i.h+a)%360,o.push(e(i));return o}function M(t,n){n=n||6;for(var r=e(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/n;n--;)s.push(e({h:i,s:a,v:o})),o=(o+l)%1;return s}function k(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function S(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function T(t,e){L(t)&&(t="100%");var n=z(t);return t=V(e,U(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),B.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function A(t){return V(1,U(0,t))}function E(t){return parseInt(t,16)}function L(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function z(t){return"string"==typeof t&&-1!=t.indexOf("%")}function I(t){return 1==t.length?"0"+t:""+t}function D(t){return 1>=t&&(t=100*t+"%"),t}function P(t){return Math.round(255*parseFloat(t)).toString(16)}function C(t){return E(t)/255}function O(t){t=t.replace(R,"").replace(N,"").toLowerCase();var e=!1;if(H[t])t=H[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=X.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=X.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=X.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=X.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=X.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=X.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=X.hex8.exec(t))?{a:C(n[1]),r:E(n[2]),g:E(n[3]),b:E(n[4]),format:e?"name":"hex8"}:(n=X.hex6.exec(t))?{r:E(n[1]),g:E(n[2]),b:E(n[3]),format:e?"name":"hex"}:(n=X.hex3.exec(t))?{r:E(n[1]+""+n[1]),g:E(n[2]+""+n[2]),b:E(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function F(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var R=/^\s+/,N=/\s+$/,j=0,B=Math,q=B.round,V=B.min,U=B.max,Z=B.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,n,r,i,a,o=this.toRgb();return t=o.r/255,e=o.g/255,n=o.b/255,r=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),i=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),a=.03928>=n?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*i+.0722*a},setAlpha:function(t){return this._a=S(t),this._roundA=q(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=q(360*t.h),n=q(100*t.s),r=q(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=a(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=a(this._r,this._g,this._b),e=q(360*t.h),n=q(100*t.s),r=q(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return c(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:q(this._r),g:q(this._g),b:q(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+q(this._r)+", "+q(this._g)+", "+q(this._b)+")":"rgba("+q(this._r)+", "+q(this._g)+", "+q(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:q(100*T(this._r,255))+"%",g:q(100*T(this._g,255))+"%",b:q(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+q(100*T(this._r,255))+"%, "+q(100*T(this._g,255))+"%, "+q(100*T(this._b,255))+"%)":"rgba("+q(100*T(this._r,255))+"%, "+q(100*T(this._g,255))+"%, "+q(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:G[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+c(this._r,this._g,this._b,this._a),r=n,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=e(t);r=a.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,i=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(g,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(h,arguments)},greyscale:function(){return this._applyModification(d,arguments)},spin:function(){return this._applyModification(v,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(b,arguments)},triad:function(){return this._applyCombination(x,arguments)},tetrad:function(){return this._applyCombination(_,arguments)}},e.fromRatio=function(t,n){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=D(t[i]));t=r}return e(t,n)},e.equals=function(t,n){return t&&n?e(t).toRgbString()==e(n).toRgbString():!1},e.random=function(){return e.fromRatio({r:Z(),g:Z(),b:Z()})},e.mix=function(t,n,r){r=0===r?0:r||50;var i,a=e(t).toRgb(),o=e(n).toRgb(),s=r/100,l=2*s-1,u=o.a-a.a;i=l*u==-1?l:(l+u)/(1+l*u),i=(i+1)/2;var c=1-i,f={r:o.r*i+a.r*c,g:o.g*i+a.g*c,b:o.b*i+a.b*c,a:o.a*s+a.a*(1-s)};return e(f)},e.readability=function(t,n){var r=e(t),i=e(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)},e.isReadable=function(t,n,r){var i,a,o=e.readability(t,n);switch(a=!1,i=F(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},e.mostReadable=function(t,n,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=e(n[c]));return e.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],r))};var H=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},G=e.hexNames=k(H),X=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof n&&n.exports?n.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],192:[function(t,e,n){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6 -},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],193:[function(t,e,n){"use strict";var r=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":272,"../../plots/cartesian/constants":299,"../../plots/font_attributes":312,"./arrow_paths":192}],194:[function(t,e,n){"use strict";function r(t,e){function n(e,n){return u.coerce(t,r,g.layoutAttributes,e,n)}var r={};n("opacity"),n("align"),n("bgcolor");var i=n("bordercolor"),a=f.opacity(i);n("borderpad");var o=n("borderwidth"),s=n("showarrow");s&&(n("arrowcolor",a?r.bordercolor:f.defaultLine),n("arrowhead"),n("arrowsize"),n("arrowwidth",2*(a&&o||1)),n("ax"),n("ay"),n("axref"),n("ayref"),u.noneOrAll(t,r,["ax","ay"])),n("text",s?" ":"new text"),n("textangle"),u.coerceFont(n,"font",e.font);for(var l=["x","y"],h=0;2>h;h++){var d=l[h],p={_fullLayout:e},m=c.coerceRef(t,r,p,d),v=c.coerceARef(t,r,p,d),y=.5;if("paper"!==m){var x=c.getFromId(p,m);if(y=x.range[0]+y*(x.range[1]-x.range[0]),-1!==["date","category"].indexOf(x.type)&&"string"==typeof t[d]){var _;if("date"===x.type){if(_=u.dateTime2ms(t[d]),_!==!1&&(t[d]=_),v===m){var b=u.dateTime2ms(t["a"+d]);b!==!1&&(t["a"+d]=b)}}else(x._categories||[]).length&&(_=x._categories.indexOf(t[d]),-1!==_&&(t[d]=_))}}n(d,y),s||n(d+"anchor")}return u.noneOrAll(t,r,["x","y"]),r}function i(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=c.getFromId(t,e.xref),r=c.getFromId(t,e.yref);if(n||r){var i=(e._xsize||0)/2,a=e._xshift||0,o=(e._ysize||0)/2,s=e._yshift||0,l=i-a,u=i+a,f=o-s,h=o+s;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;l=Math.max(l,d),u=Math.max(u,d),f=Math.max(f,d),h=Math.max(h,d)}n&&n.autorange&&c.expand(n,[n.l2c(e.x)],{ppadplus:u,ppadminus:l}),r&&r.autorange&&c.expand(r,[r.l2c(e.y)],{ppadplus:h,ppadminus:f})}})}function a(t,e,n,r,i,a,o,s){var l=n-t,u=i-t,c=o-i,f=r-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var m=(u*d-c*h)/p,g=(u*f-l*h)/p;return 0>g||g>1||0>m||m>1?null:{x:t+l*m,y:e+f*m}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),f=t("../color"),h=t("../drawing"),d=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),m=t("../dragelement"),g=e.exports={};g.ARROWPATHS=t("./arrow_paths"),g.layoutAttributes=t("./attributes"),g.supplyLayoutDefaults=function(t,e){for(var n=t.annotations||[],i=e.annotations=[],a=0;at?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var r=Y.select(".annotation-math-group"),i=!r.empty(),s=h.bBox((i?r:tt).node()),d=s.width,v=s.height,y=Math.round(d+2*$),x=Math.round(v+2*$);q._w=d,q._h=v;var _=!1;if(["x","y"].forEach(function(e){var r,i=q[e+"ref"]||e,a=c.getFromId(t,i),o=(H+("x"===e?0:90))*Math.PI/180,s=y*Math.abs(Math.cos(o))+x*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){if(!a.autorange&&(q[e]-a.range[0])*(q[e]-a.range[1])>0&&(q["a"+e+"ref"]===i?(q["a"+e]-a.range[0])*(q["a"+e]-a.range[1])>0&&(_=!0):_=!0,_))return;Z[e]=a._offset+a.l2p(q[e]),r=.5}else r=q[e],"y"===e&&(r=1-r),Z[e]="x"===e?L.l+L.w*r:L.t+L.h*r;var u=0;q["a"+e+"ref"]===i?Z["aa"+e]=a._offset+a.l2p(q["a"+e]):(u=q.showarrow?q["a"+e]:s*n(r,l),Z[e]+=u),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=u}),_)return void Y.remove();var w,M;q.showarrow&&(w=q.axref===q.xref?Z.x:u.constrain(Z.x-q.ax,1,b.width-1),M=q.ayref===q.yref?Z.y:u.constrain(Z.y-q.ay,1,b.height-1)),Z.x=u.constrain(Z.x,1,b.width-1),Z.y=u.constrain(Z.y,1,b.height-1);var k=$-s.top,S=$-s.left;i?r.select("svg").attr({x:$-1,y:$}):(tt.attr({x:S,y:k}),tt.selectAll("tspan.line").attr({y:k,x:S})),Q.call(h.setRect,W/2,W/2,y-W,x-W);var T=0,A=0;T=q.axref===q.xref?Math.round(Z.aax-y/2):Math.round(Z.x-y/2),A=q.ayref===q.yref?Math.round(Z.aay-x/2):Math.round(Z.y-x/2),Y.call(u.setTranslate,T,A);var E="annotations["+e+"]",z=function(n,r){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?Z.aax+n:Z.x+n,s=q.ayref===q.yref?Z.aay+r:Z.y+r;var c=u.rotationXYMatrix(H,i,s),h=u.apply2DTransform(c),d=u.apply2DTransform2(c),p=Q.attr("width")/2,v=Q.attr("height")/2,y=[[i-p,s-v,i-p,s+v],[i-p,s+v,i+p,s+v],[i+p,s+v,i+p,s-v],[i+p,s-v,i-p,s-v]].map(d);if(!y.reduce(function(t,e){return t^!!a(w,M,w+1e6,M+1e6,e[0],e[1],e[2],e[3])},!1)){y.forEach(function(t){var e=a(i,s,w,M,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var x=q.arrowwidth,_=q.arrowcolor,b=G.append("g").style({opacity:f.opacity(_)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=b.append("path").attr("d","M"+i+","+s+"L"+w+","+M).style("stroke-width",x+"px").call(f.stroke,f.rgb(_));g.arrowhead(k,q.arrowhead,"end",q.arrowsize);var S=b.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-w)+","+(s-M),transform:"translate("+w+","+M+")"}).style("stroke-width",x+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,A,z;m.init({element:S.node(),prepFn:function(){var t=u.getTranslate(Y);A=t.x,z=t.y,T={},V&&V.autorange&&(T[V._name+".autorange"]=!0),U&&U.autorange&&(T[U._name+".autorange"]=!0)},moveFn:function(t,e){b.attr("transform","translate("+t+","+e+")");var n=h(A,z),r=n[0]+t,i=n[1]+e;Y.call(u.setTranslate,r,i),T[E+".x"]=V?q.x+t/V._m:(w+t-L.l)/L.w,T[E+".y"]=U?q.y+e/U._m:1-(M+e-L.t)/L.h,q.axref===q.xref&&(T[E+".ax"]=V?q.ax+t/V._m:(w+t-L.l)/L.w),q.ayref===q.yref&&(T[E+".ay"]=U?q.ay+e/U._m:1-(M+e-L.t)/L.h),X.attr({transform:"rotate("+H+","+r+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};q.showarrow&&z(0,0);var I=u.rotationXYMatrix(H,Z.x,Z.y),D=u.apply2DTransform(I);if(t._context.editable){var P,C,O;m.init({element:Y.node(),prepFn:function(){var t=u.getTranslate(Y);P=t.x,C=t.y,O={}},moveFn:function(t,e){Y.call(u.setTranslate,P+t,C+e);var n="pointer";if(q.showarrow)q.axref===q.xref?O[E+".ax"]=V.p2l(V.l2p(q.ax)+t):O[E+".ax"]=q.ax+t,q.ayref===q.yref?O[E+".ay"]=U.p2l(U.l2p(q.ay)+e):O[E+".ay"]=q.ay+e,z(t,e);else{if(V)O[E+".x"]=q.x+t/V._m;else{var r=q._xsize/L.w,i=q.x+q._xshift/L.w-r/2;O[E+".x"]=m.align(i+t/L.w,r,0,1,q.xanchor)}if(U)O[E+".y"]=q.y+e/U._m;else{var a=q._ysize/L.h,o=q.y-q._yshift/L.h-a/2;O[E+".y"]=m.align(o-e/L.h,a,0,1,q.yanchor)}V&&U||(n=m.getCursor(V?.5:O[E+".x"],U?.5:O[E+".y"],q.xanchor,q.yanchor))}var s=D(P,C),l=s[0]+t,c=s[1]+e;Y.call(u.setTranslate,P+t,C+e),X.attr({transform:"rotate("+H+","+l+","+c+")"}),p(Y,n)},doneFn:function(e){if(p(Y),e){l.relayout(t,O);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var x,_=t.layout,b=t._fullLayout;if(!s(e)||-1===e){if(!e&&Array.isArray(i))return _.annotations=i,g.supplyLayoutDefaults(_,b),void g.drawAll(t);if("remove"===i)return delete _.annotations,b.annotations=[],void g.drawAll(t);if(n&&"add"!==i){for(x=0;xe;x--)b._infolayer.selectAll('.annotation[data-index="'+(x-1)+'"]').attr("data-index",String(x)),g.draw(t,x)}}b._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var M=_.annotations[e],k=b.annotations[e];if(M){var S={xref:M.xref,yref:M.yref},T={};"string"==typeof n&&n?T[n]=i:u.isPlainObject(n)&&(T=n);var A=Object.keys(T);for(x=0;xx;x++){var I=z[x];if(void 0===T[I]&&void 0!==M[I]){var D=c.getFromId(t,c.coerceRef(S,{},t,I)),P=c.getFromId(t,c.coerceRef(M,{},t,I)),C=M[I],O=k["_"+I+"type"];if(void 0!==T[I+"ref"]){var F="auto"===M[I+"anchor"],R="x"===I?L.w:L.h,N=(k["_"+I+"size"]||0)/(2*R);if(D&&P)C=(C-D.range[0])/(D.range[1]-D.range[0]),C=P.range[0]+C*(P.range[1]-P.range[0]);else if(D){if(C=(C-D.range[0])/(D.range[1]-D.range[0]),C=D.domain[0]+C*(D.domain[1]-D.domain[0]),F){var j=C+N,B=C-N;2/3>C+B?C=B:C+j>4/3&&(C=j)}}else P&&(F&&(1/3>C?C+=N:C>2/3&&(C-=N)),C=(C-P.domain[0])/(P.domain[1]-P.domain[0]),C=P.range[0]+C*(P.range[1]-P.range[0]))}P&&P===D&&O&&("log"===O&&"log"!==P.type?C=Math.pow(10,C):"log"!==O&&"log"===P.type&&(C=C>0?Math.log(C)/Math.LN10:void 0)),M[I]=C}}var q=r(M,b);b.annotations[e]=q;var V=c.getFromId(t,q.xref),U=c.getFromId(t,q.yref),Z={x:0,y:0},H=+q.textangle||0,G=b._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:M,fullAnnotation:q})}),X=G.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),Y=X.append("g"),W=q.borderwidth,J=q.borderpad,$=W+J,Q=Y.append("rect").attr("class","bg").style("stroke-width",W+"px").call(f.stroke,q.bordercolor).call(f.fill,q.bgcolor),K=q.font,tt=Y.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?tt.call(d.makeEditable,Y).call(v).on("edit",function(n){q.text=n,this.attr({"data-unformatted":q.text}),this.call(v);var r={};r["annotations["+e+"].text"]=q.text,V&&V.autorange&&(r[V._name+".autorange"]=!0),U&&U.autorange&&(r[U._name+".autorange"]=!0),l.relayout(t,r)}):tt.call(v),X.attr({transform:"rotate("+H+","+Z.x+","+Z.y+")"}).call(h.setPosition,Z.x,Z.y)}},g.arrowhead=function(t,e,n,r){s(r)||(r=1);var i=t.node(),a=g.ARROWPATHS[e||0];if(a){"string"==typeof n&&n||(n="end");var l,u,c,d,p=(h.getPx(t,"stroke-width")||1)*r,m=t.style("stroke")||f.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,_=a.backoff*p;if("line"===i.nodeName){if(l={x:+t.attr("x1"),y:+t.attr("y1")},u={x:+t.attr("x2"),y:+t.attr("y2")},c=Math.atan2(l.y-u.y,l.x-u.x),d=c+Math.PI,_){var b=_*Math.cos(c),w=_*Math.sin(c);y&&(l.x-=b,l.y-=w,t.attr({x1:l.x,y1:l.y})),x&&(u.x+=b,u.y+=w,t.attr({x2:u.x,y2:u.y}))}}else if("path"===i.nodeName){var M=i.getTotalLength(),k="";if(y){var S=i.getPointAtLength(0),T=i.getPointAtLength(.1);c=Math.atan2(S.y-T.y,S.x-T.x),l=i.getPointAtLength(Math.min(_,M)),_&&(k="0px,"+_+"px,")}if(x){var A=i.getPointAtLength(M),E=i.getPointAtLength(M-.1);if(d=Math.atan2(A.y-E.y,A.x-E.x),u=i.getPointAtLength(Math.max(0,M-_)),_){var L=k?2*_:_;k+=M-L+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var z=function(n,r){e>5&&(r=0),o.select(i.parentElement).append("path").attr({"class":t.attr("class"),d:a.path,transform:"translate("+n.x+","+n.y+")rotate("+180*r/Math.PI+")scale("+p+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&z(l,c),x&&z(u,d)}},g.calcAutorange=function(t){var e=t._fullLayout,n=e.annotations;if(n.length&&t._fullData.length){var r={};n.forEach(function(t){r[t.xref]=!0,r[t.yref]=!0});var a=c.list(t).filter(function(t){return t.autorange&&r[t._id]});if(a.length)return u.syncOrAsync([g.drawAll,i],t)}}},{"../../lib":273,"../../lib/setcursor":282,"../../lib/svg_text_utils":284,"../../plotly":291,"../../plots/cartesian/axes":294,"../color":196,"../dragelement":217,"../drawing":219,"./arrow_paths":192,"./attributes":193,d3:13,"fast-isnumeric":15}],195:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],196:[function(t,e,n){"use strict";function r(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===r.length;if(!i&&3!==r.length)return t;for(var o=0;o=0))return t;if(3===o)r[o]>1&&(r[o]=1);else if(r[o]>=1)return t}var s=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return i?"rgba("+s+", "+r[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var n=i(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},o.combine=function(t,e){var n=i(t).toRgb();if(1===n.a)return i(t).toRgbString();var r=i(e||o.background).toRgb(),a=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},s={r:a.r*(1-n.a)+n.r*n.a,g:a.g*(1-n.a)+n.g*n.a,b:a.b*(1-n.a)+n.b*n.a};return i(s).toRgbString()},o.contrast=function(t,e,n){var r=i(t),a=r.isLight()?r.darken(n):r.lighten(e);return a.toString()},o.stroke=function(t,e){var n=i(e);t.style({stroke:o.tinyRGB(n),"stroke-opacity":n.getAlpha()})},o.fill=function(t,e){var n=i(e);t.style({fill:o.tinyRGB(n),"fill-opacity":n.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,n,i,a,s=Object.keys(t);for(e=0;el&&(a[1]-=(ot-l)/2)):n.node()&&!n.classed("js-placeholder")&&(ot=h.bBox(e.node()).height),ot){if(ot+=5,"top"===_.titleside)Q.domain[1]-=ot/S.h,a[1]*=-1;else{Q.domain[0]+=ot/S.h;var c=Math.max(1,n.selectAll("tspan.line").size());a[1]+=(1-c)*l}e.attr("transform","translate("+a+")"),Q.setScale()}}it.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(S.h*(1-Q.domain[1]))+")");var f=it.select(".cbfills").selectAll("rect.cbfill").data(L);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?A[0]:(L[e]+L[e-1])/2,e===L.length-1?A[1]:(L[e]+L[e+1])/2].map(Q.c2p).map(Math.round);e!==L.length-1&&(n[1]+=n[1]>n[0]?1:-1);var a=I(t).replace("e-",""),o=i(a).toHexString();r.select(this).attr({x:G,width:Math.max(j,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:o})});var d=it.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?E:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+G+","+(Math.round(Q.c2p(t))+_.line.width/2%1)+"h"+j).call(h.lineGroupStyle,_.line.width,z(t),_.line.dash)}),Q._axislayer.selectAll("g."+Q._id+"tick,path").remove(),Q._pos=G+j+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),Q.side="right",u.syncOrAsync([function(){return s.doTicks(t,Q,!0)},function(){if(-1===["top","bottom"].indexOf(_.titleside)){var e=Q.titlefont.size,n=Q._offset+Q._length/2,i=S.l+(Q.position||0)*S.w+("right"===Q.side?10+e*(Q.showticklabels?1:.5):-10-e*(Q.showticklabels?.5:0));w("h"+Q._id+"title",{avoid:{selection:r.select(t).selectAll("g."+Q._id+"tick"),side:_.titleside,offsetLeft:S.l,offsetTop:S.t,maxShift:k.width},attributes:{x:i,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,n){var r,i=x();r=o.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:Q,propName:r,traceIndex:i.index,dfltName:"colorscale",containerGroup:it.select(".cbtitle")},s="h"===e.charAt(0)?e.substr(1):"h"+e;it.selectAll("."+s+",."+s+"-math-group").remove(),p.draw(t,e,c(a,n||{}))}function M(){var n=j+_.outlinewidth/2+h.bBox(Q._axislayer.node()).width;if(F=at.select("text"),F.node()&&!F.classed("js-placeholder")){var r,i=at.select(".h"+Q._id+"title-math-group").node();r=i&&-1!==["top","bottom"].indexOf(_.titleside)?h.bBox(i).width:h.bBox(at.node()).right-G-S.l,n=Math.max(n,r)}var a=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,s=W-J;it.select(".cbbg").attr({x:G-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:J-Z,width:Math.max(a,2),height:Math.max(s+2*Z,2)}).call(d.fill,_.bgcolor).call(d.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),it.selectAll(".cboutline").attr({x:G,y:J+_.ypad+("top"===_.titleside?ot:0),width:Math.max(j,2),height:Math.max(s-2*_.ypad-ot,2)}).call(d.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;it.attr("transform","translate("+(S.l-l)+","+S.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,S=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var T,A=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),E=[],L=[],z="function"==typeof _.line.color?_.line.color:function(){return _.line.color},I="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},D=_.levels.end+_.levels.size/100,P=_.levels.size,C=1.001*A[0]-.001*A[1],O=1.001*A[1]-.001*A[0];for(T=_.levels.start;0>(T-D)*P;T+=P)T>C&&O>T&&E.push(T);if("function"==typeof _.fillcolor)if(_.filllevels)for(D=_.filllevels.end+_.filllevels.size/100,P=_.filllevels.size,T=_.filllevels.start;0>(T-D)*P;T+=P)T>A[0]&&T1){var rt=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));tt*=rt*u.roundUp(nt/rt,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(Q.tick0=0)}Q.dtick=tt}Q.domain=[Y+H,Y+V-H],Q.setScale();var it=k._infolayer.selectAll("g."+e).data([0]);it.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),it.attr("transform","translate("+Math.round(S.l)+","+Math.round(S.t)+")");var at=it.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(S.l)+",-"+Math.round(S.t)+")");Q._axislayer=it.select(".cbaxis");var ot=0;if(-1!==["top","bottom"].indexOf(_.titleside)){var st,lt=S.l+(_.x+U)*S.w,ut=Q.titlefont.size;st="top"===_.titleside?(1-(Y+V-H))*S.h+S.t+3+.75*ut:(1-(Y+H))*S.h+S.t-3-.25*ut,w(Q._id+"title",{attributes:{x:lt,y:st,"text-anchor":"start"}})}var ct=u.syncOrAsync([o.previousPromises,b,o.previousPromises,M],t);if(ct&&ct.then&&(t._promises||[]).push(ct),t._context.editable){var ft,ht,dt;l.init({element:it.node(),prepFn:function(){ft=it.attr("transform"),f(it)},moveFn:function(t,e){it.attr("transform",ft+" translate("+t+","+e+")"),ht=l.align(X+t/S.w,B,0,1,_.xanchor),dt=l.align(Y-e/S.h,V,0,1,_.yanchor);var n=l.getCursor(ht,dt,_.xanchor,_.yanchor);f(it,n)},doneFn:function(e){f(it),e&&void 0!==ht&&void 0!==dt&&a.restyle(t,{"colorbar.x":ht,"colorbar.y":dt},x().index)}})}return ct}function x(){var n,r,i=e.substr(2);for(n=0;nc*f?i.RdBu:c>=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":273,"./flip_scale":207,"./scales":214}],204:[function(t,e,n){"use strict";var r=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},r.colorscale,{}),cauto:i({},r.zauto,{}),cmax:i({},r.zmax,{}),cmin:i({},r.zmin,{}),autocolorscale:i({},r.autocolorscale,{}),reversescale:i({},r.reversescale,{})}}},{"../../lib/extend":272,"./attributes":202,"./scales.js":214}],205:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":214}],206:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../../lib"),a=t("../colorbar/has_colorbar"),o=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,n,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,m=f?i.nestedProperty(e,d).get()||{}:e,g=p[h+"min"],v=p[h+"max"],y=p.colorscale,x=r(g)&&r(v)&&v>g;u(f+h+"auto",!x),u(f+h+"min"),u(f+h+"max");var _;void 0!==y&&(_=!s(y)),u(f+"autocolorscale",_);var b=u(f+"colorscale"),w=u(f+"reversescale");if(w&&(m.colorscale=l(b)),"marker.line."!==f){var M;f&&(M=a(p));var k=u(f+"showscale",M);k&&o(p,m,n)}}},{"../../lib":273,"../colorbar/defaults":198,"../colorbar/has_colorbar":200,"./flip_scale":207,"./is_valid_scale":211,"fast-isnumeric":15}],207:[function(t,e,n){"use strict";e.exports=function(t){for(var e,n=t.length,r=new Array(n),i=n-1,a=0;i>=0;i--,a++)e=t[i],r[a]=[1-e[0],e[1]];return r}},{}],208:[function(t,e,n){"use strict";var r=t("./scales"),i=t("./default_scale"),a=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=i),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),a(t)?t:e):e}},{"./default_scale":205,"./is_valid_scale_array":212,"./scales":214}],209:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../../lib"),a=t("./is_valid_scale");e.exports=function(t,e){var n=e?i.nestedProperty(t,e).get()||{}:t,o=n.color,s=!1;if(Array.isArray(o))for(var l=0;lh;h++)l=t[h],c[h]=e+l[0]*(n-e),f[h]=i(l[1]).toRgb();var d=r.scale.linear().domain(c).interpolate(r.interpolateObject).range(f);return function(t){if(a(t)){var r=o.constrain(t,e,n),l=d(r);return i(l).toRgbString()}return i(t).isValid()?t:s.defaultLine}}},{"../../lib":273,"../color":196,d3:13,"fast-isnumeric":15,tinycolor2:191}],214:[function(t,e,n){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],215:[function(t,e,n){"use strict";e.exports=function(t,e,n,r,i){var a=(t-n)/(r-n),o=a+e/(r-n),s=(a+o)/2;return"left"===i||"bottom"===i?a:"center"===i||"middle"===i?s:"right"===i||"top"===i?o:2/3-s>a?a:o>4/3-s?o:s}},{}],216:[function(t,e,n){"use strict";var r=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,a){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===a?0:"middle"===a?1:"top"===a?2:r.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":273}],217:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,m._dragged=!1,m._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-m._mouseDownTimev&&(g=Math.max(g-1,1)),t.doneFn&&t.doneFn(m._dragged,g),!m._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),d.dispatchEvent(n)}return i(m),m._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,m=o.getPlotDiv(t.element)||{},g=1,v=s.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":273,"../../plotly":291,"../../plots/cartesian/constants":299,"./align":215,"./cursor":216,"./unhover":218}],218:[function(t,e,n){"use strict";var r=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,n)},i.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":271}],219:[function(t,e,n){"use strict";function r(t,e,n,r){var a=t[0]-e[0],o=t[1]-e[1],s=n[0]-e[0],l=n[1]-e[1],u=Math.pow(a*a+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*a-u*u*s)*r,h=(c*c*o-u*u*l)*r,d=3*c*(u+c),p=3*u*(u+c);return[[i.round(e[0]+(d&&f/d),2),i.round(e[1]+(d&&h/d),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&h/p),2)]]}var i=t("d3"),a=t("fast-isnumeric"),o=t("../../plots/plots"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),d=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},p.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},p.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},p.setRect=function(t,e,n,r,i){t.call(p.setPosition,e,n).call(p.setSize,r,i)},p.translatePoints=function(t,e,n){t.each(function(t){var r=t.xp||e.c2p(t.x),o=t.yp||n.c2p(t.y),s=i.select(this);a(r)&&a(o)?"text"===this.nodeName?s.attr("x",r).attr("y",o):s.attr("transform","translate("+r+","+o+")"):s.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,n){return e&&a(e)?t._context.staticPlot?e:1>e?1:Math.round(e):n||0},p.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,l=r||a.dash||"";i.select(this).call(s.stroke,n||a.color).call(p.dashLine,l,o)})},p.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=i.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(r){u.error(r,t),n.remove()}})};var m=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var g=p.symbolNames.length,v="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=g||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=n.line;if(o.traceIs(e,"symbols")){var a=d(e);t.attr("d",function(t){var r;r="various"===t.ms||"various"===n.size?3:h.isBubble(e)?a(t.ms):(n.size||6)/2,t.mrc=r;var i=p.symbolNumber(t.mx||n.symbol)||0,o=i%100;return t.om=i%200>=100,p.symbolFuncs[o](r)+(i>=200?v:"")}).style("opacity",function(t){return(t.mo+1||n.opacity+1)-1})}var l=(e._input||{}).marker||{},u=p.tryColorscale(n,l,""),c=p.tryColorscale(n,l,"line.");t.each(function(t){var e,a,o;t.so?(o=r.outlierwidth,a=r.outliercolor,e=n.outliercolor):(o=(t.mlw+1||r.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,a="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(r.color)?s.defaultLine:r.color,e="mc"in t?t.mcc=u(t.mc):Array.isArray(n.color)?s.defaultLine:n.color||"rgba(0,0,0,0)");var l=i.select(this);t.om?l.call(s.stroke,e).style({"stroke-width":(o||1)+"px",fill:"none"}):(l.style("stroke-width",o+"px").call(s.fill,e),o&&l.call(s.stroke,a))})}},p.tryColorscale=function(t,e,n){var r=u.nestedProperty(t,n+"color").get(),i=u.nestedProperty(t,n+"colorscale").get(),o=u.nestedProperty(t,n+"cauto").get(),s=u.nestedProperty(t,n+"cmin"),c=u.nestedProperty(t,n+"cmax"),f=s.get(),h=c.get();return i&&Array.isArray(r)?(!o&&a(f)&&a(h)||(f=1/0,h=-(1/0),r.forEach(function(t){a(t)&&(f>t&&(f=+t),t>h&&(h=+t))}),f>h&&(f=0,h=1),s.set(f),c.set(h),u.nestedProperty(e,n+"cmin").set(f),u.nestedProperty(e,n+"cmax").set(h)),l.makeScaleFunction(i,f,h)):u.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;p.textPointStyle=function(t,e){t.each(function(t){var n=i.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var o=t.tp||e.textposition,s=-1!==o.indexOf("top")?"top":-1!==o.indexOf("bottom")?"bottom":"middle",l=-1!==o.indexOf("left")?"end":-1!==o.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;u=a(u)&&u>0?u:0,n.call(p.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(r).call(c.convertToTspans);var h=i.select(this.parentNode),d=n.selectAll("tspan.line"),m=((d[0].length||1)-1)*x+1,g=y[l]*f,v=.75*u+y[s]*f+(y[s]-1)*m*u/2;h.attr("transform","translate("+g+","+v+")"),m>1&&d.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,i="M"+t[0],a=[];for(n=1;nn;n++)o.push(r(t[n-1],t[n],t[n+1],e));for(o.push(r(t[a-1],t[a],t[0],e)),n=1;a>=n;n++)i+="C"+o[n-1][1]+" "+o[n][0]+" "+t[n];return i+="C"+o[a][1]+" "+o[0][0]+" "+t[0]+"Z"};var b={hv:function(t,e){return"H"+i.round(e[0],2)+"V"+i.round(e[1],2)},vh:function(t,e){return"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},hvh:function(t,e){return"H"+i.round((t[0]+e[0])/2,2)+"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},vhv:function(t,e){return"V"+i.round((t[1]+e[1])/2,2)+"H"+i.round(e[0],2)+"V"+i.round(e[1],2)}},w=function(t,e){return"L"+i.round(e[0],2)+","+i.round(e[1],2)};p.steps=function(t){var e=b[t]||w;return function(t){for(var n="M"+i.round(t[0][0],2)+","+i.round(t[0][1],2),r=1;r=k&&(i.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),u.extendFlat({},l)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=i.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":266,"../../lib":273,"../../lib/svg_text_utils":284,"../../plots/plots":321,"../../traces/scatter/make_bubble_size_func":351,"../../traces/scatter/subtypes":356,"../color":196,"../colorscale":210,"./symbol_defs":220,d3:13,"fast-isnumeric":15}],220:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+n+i+a+i+a+o+a+o+n+o+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),i=r.round(-t,2),a=r.round(t*-.309,2),o=r.round(.809*t,2);return"M"+e+","+a+"L"+n+","+o+"H-"+n+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+n+"V"+n+"L0,"+e+"L-"+i+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+i+"H"+n+"L"+e+",0L"+n+",-"+i+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),i=r.round(.951*e,2),a=r.round(.363*e,2),o=r.round(.588*e,2),s=r.round(-e,2),l=r.round(e*-.309,2),u=r.round(.118*e,2),c=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+n+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),i=r.round(.76*t,2);return"M-"+i+",0l-"+n+",-"+e+"h"+i+"l"+n+",-"+e+"l"+n+","+e+"h"+i+"l-"+n+","+e+"l"+n+","+e+"h-"+i+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),a=r.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+n+o+e+","+n+o+"0,-"+i+o+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),a=r.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+n+o+"-"+e+",-"+n+o+"0,"+i+o+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),i="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),i="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:13}],221:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],222:[function(t,e,n){"use strict";function r(t,e,n,r){var a=e["error_"+r]||{},l=a.visible&&-1!==["linear","log"].indexOf(n.type),u=[];if(l){for(var c=s(a),f=0;fs;s++)o[s]={x:n[s],y:i[s]};return o[0].trace=t,r.calc({calcdata:[o],_fullLayout:e}),o},r.plot=t("./plot"),r.style=t("./style"),r.hoverInfo=function(t,e,n){(e.error_y||{}).visible&&(n.yerr=t.yh-t.y,e.error_y.symmetric||(n.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(n.xerr=t.xh-t.x,e.error_x.symmetric||(n.xerrneg=t.x-t.xs))}},{"./attributes":221,"./calc":222,"./defaults":224,"./plot":226,"./style":227}],226:[function(t,e,n){"use strict";function r(t,e,n){var r={x:e.c2p(t.x),y:n.c2p(t.y)};return void 0!==t.yh&&(r.yh=n.c2p(t.yh),r.ys=n.c2p(t.ys),a(r.ys)||(r.noYS=!0,r.ys=n.c2p(t.ys,!0))),void 0!==t.xh&&(r.xh=e.c2p(t.xh),r.xs=e.c2p(t.xs),a(r.xs)||(r.noXS=!0,r.xs=e.c2p(t.xs,!0))),r}var i=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),s=t("../../traces/scatter/subtypes");e.exports=function(t,e){var n=e.x(),l=e.y();t.each(function(t){var e=t[0].trace,u=e.error_x||{},c=e.error_y||{},f=s.hasMarkers(e)&&e.marker.maxdisplayed>0;if(c.visible||u.visible){var h=i.select(this).selectAll("g.errorbar").data(o.identity);h.enter().append("g").classed("errorbar",!0),h.each(function(t){var e=i.select(this),o=r(t,n,l);if(!f||t.vis){var s;if(c.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var h=c.width;s="M"+(o.x-h)+","+o.yh+"h"+2*h+"m-"+h+",0V"+o.ys,o.noYS||(s+="m-"+h+",0h"+2*h),e.append("path").classed("yerror",!0).attr("d",s)}if(u.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var d=(u.copy_ystyle?c:u).width;s="M"+o.xh+","+(o.y-d)+"v"+2*d+"m0,-"+d+"H"+o.xs,o.noXS||(s+="m0,-"+d+"v"+2*d),e.append("path").classed("xerror",!0).attr("d",s)}}})}})}},{"../../lib":273,"../../traces/scatter/subtypes":356,d3:13,"fast-isnumeric":15}],227:[function(t,e,n){"use strict";var r=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},a=e.error_x||{},o=r.select(this);o.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(i.stroke,n.color),a.copy_ystyle&&(a=n),o.selectAll("path.xerror").style("stroke-width",a.thickness+"px").call(i.stroke,a.color)})}},{"../color":196,d3:13}],228:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":299}],229:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,o,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var s=0;2>s;s++){var l={_fullLayout:n},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,i=e.images=[],a=0;a=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],233:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":272,"../../plots/font_attributes":312,"../color/attributes":195}],234:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],235:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../plots/plots"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,n){function s(t,e){return r.coerce(h,d,a,t,e)}for(var l,u,c,f,h=t.legend||{},d=e.legend={},p=0,m="normal",g=0;g1);if(y!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),r.coerceFont(s,"font",e.font),s("orientation"),"h"===d.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(l=0,c="left",u=1.1,f="bottom"):(l=0,c="left",u=-.1,f="top")}s("traceorder",m),o.isGrouped(e.legend)&&s("tracegroupgap"),s("x",l),s("xanchor",c),s("y",u),s("yanchor",f),r.noneOrAll(h,d,["x","y"])}}},{ -"../../lib":273,"../../plots/plots":321,"./attributes":233,"./helpers":238}],236:[function(t,e,n){"use strict";function r(t,e){function n(n){c.util.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(a,e)})}var r=t.data()[0][0],i=e._fullLayout,o=r.trace,s=h.traceIs(o,"pie"),l=o.index,u=s?r.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,i.legend.font).text(u),e._context.editable&&!s?f.call(c.util.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" "),c.restyle(e,"name",t,l)}):f.call(n)}function i(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(h.traceIs(s,"pie")){var f=a.label,d=n.indexOf(f);-1===d?n.push(f):n.splice(d,1),c.relayout(e,"hiddenlabels",n)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),d=h[0].length||1;n=l*d,r=c.node()&&p.bBox(c.node()).width;var m=l*(.3+(1-d)/2);c.attr("y",m),h.attr("y",m)}n=Math.max(n,16)+3,a.attr({x:0,y:-n/2,height:n}),i.height=n,i.width=r}function o(t,e,n){var r=t._fullLayout,i=r.legend,a=i.borderwidth,o=x.isGrouped(i);if(x.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,a,5+a+i.height+n/2),i.height+=n,i.width=Math.max(i.width,r)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),n.selectAll(".legendtoggle").attr("width",(t._context.editable?0:i.width)+40),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height);else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;h>c;c++){var d=l[c].map(function(t){return t[0].width}),p=40+Math.max.apply(null,d);i.width+=i.tracegroupgap+p,s.push(i.width)}e.each(function(t,e){f.setTranslate(this,s[e],0)}),e.each(function(){var t=u.select(this),e=t.selectAll("g.traces"),n=0;e.each(function(t){var e=t[0],r=e.height;f.setTranslate(this,0,5+a+n+r/2),n+=r}),i.height=Math.max(i.height,n)}),i.height+=10+2*a,i.width+=2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}else{i.width=0,i.height=0;var m=0,g=0,v=0,y=0;n.each(function(t){v=Math.max(40+t[0].width,v)}),n.each(function(t){var e=t[0],n=v,o=i.tracegroupgap||5;a+y+o+n>r.width-(r.margin.r+r.margin.l)&&(y=0,m+=g,i.height=i.height+g,g=0),f.setTranslate(this,a+y,5+a+e.height/2+m),i.width+=o+n,i.height=Math.max(i.height,e.height),y+=o+n,g=Math.max(e.height,g)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}}function s(t){var e=t._fullLayout,n=e.legend,r="left";_.isRightAnchor(n)?r="right":_.isCenterAnchor(n)&&(r="center");var i="top";_.isBottomAnchor(n)?i="bottom":_.isMiddleAnchor(n)&&(i="middle"),h.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[i]||0),t:n.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,n=e.legend,r="left";_.isRightAnchor(n)?r="right":_.isCenterAnchor(n)&&(r="center"),h.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../dragelement"),p=t("../drawing"),m=t("../color"),g=t("./constants"),v=t("./get_legend_data"),y=t("./style"),x=t("./helpers"),_=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),A.call(p.setRect,N,t,g.scrollBarWidth,g.scrollBarHeight),k.select("rect").attr({y:x.borderwidth-e})}var n=t._fullLayout,a="legend"+n._uid;if(n._infolayer&&t.calcdata){var x=n.legend,b=n.showlegend&&v(t.calcdata,x),w=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({"class":"legend","pointer-events":"all"});var k=n._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var S=M.selectAll("rect.bg").data([0]);S.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),S.call(m.stroke,x.bordercolor),S.call(m.fill,x.bgcolor),S.style("stroke-width",x.borderwidth+"px");var T=M.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var A=M.selectAll("rect.scrollbar").data([0]);A.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var E=T.selectAll("g.groups").data(b);E.enter().append("g").attr("class","groups"),E.exit().remove();var L=E.selectAll("g.traces").data(f.identity);L.enter().append("g").attr("class","traces"),L.exit().remove(),L.call(y).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(i,t)});var z=0!==M.enter().size();z&&(o(t,E,L),s(t));var I=0,D=n.width,P=0,C=n.height;o(t,E,L),x.height>C?l(t):s(t);var O=n._size,F=O.l+O.w*x.x,R=O.t+O.h*(1-x.y);_.isRightAnchor(x)?F-=x.width:_.isCenterAnchor(x)&&(F-=x.width/2),_.isBottomAnchor(x)?R-=x.height:_.isMiddleAnchor(x)&&(R-=x.height/2);var N=x.width,j=O.w;N>j?(F=O.l,N=j):(F+N>D&&(F=D-N),I>F&&(F=I),N=Math.min(D-F,x.width));var B=x.height,q=O.h;B>q?(R=O.t,B=q):(R+B>C&&(R=C-B),P>R&&(R=P),B=Math.min(C-R,x.height)),f.setTranslate(M,F,R);var V,U,Z=B-g.scrollBarHeight-2*g.scrollBarMargin,H=x.height-B;if(x.height<=B||t._context.staticPlot)S.attr({width:N-x.borderwidth,height:B-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),f.setTranslate(T,0,0),k.select("rect").attr({width:N-2*x.borderwidth,height:B-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth}),T.call(p.setClipUrl,a);else{V=g.scrollBarMargin,U=T.attr("data-scroll")||0,S.attr({width:N-2*x.borderwidth+g.scrollBarWidth+g.scrollBarMargin,height:B-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),k.select("rect").attr({width:N-2*x.borderwidth+g.scrollBarWidth+g.scrollBarMargin,height:B-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth-U}),T.call(p.setClipUrl,a),z&&e(V,U),M.on("wheel",null),M.on("wheel",function(){U=f.constrain(T.attr("data-scroll")-u.event.deltaY/Z*H,-H,0),V=g.scrollBarMargin-U/H*Z,e(V,U),u.event.preventDefault()}),A.on(".drag",null),T.on(".drag",null);var G=u.behavior.drag().on("drag",function(){V=f.constrain(u.event.y-g.scrollBarHeight/2,g.scrollBarMargin,g.scrollBarMargin+Z),U=-(V-g.scrollBarMargin)/Z*H,e(V,U)});A.call(G),T.call(G)}if(t._context.editable){var X,Y,W,J;M.classed("cursor-move",!0),d.init({element:M.node(),prepFn:function(){var t=f.getTranslate(M);W=t.x,J=t.y},moveFn:function(t,e){var n=W+t,r=J+e;f.setTranslate(M,n,r),X=d.align(n,0,O.l,O.l+O.w,x.xanchor),Y=d.align(r,0,O.t+O.h,O.t,x.yanchor)},doneFn:function(e){e&&void 0!==X&&void 0!==Y&&c.relayout(t,{"legend.x":X,"legend.y":Y})}})}}}},{"../../lib":273,"../../plotly":291,"../../plots/plots":321,"../color":196,"../dragelement":217,"../drawing":219,"./anchor_utils":232,"./constants":234,"./get_legend_data":237,"./helpers":238,"./style":240,d3:13}],237:[function(t,e,n){"use strict";var r=t("../../plots/plots"),i=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[n]]):s[t].push([n]);else{var r="~~i"+f;l.push(r),s[r]=[[n]],f++}}var a,o,s={},l=[],u=!1,c={},f=0;for(a=0;aa;a++)v=s[l[a]],y[a]=i.isReversed(e)?v.reverse():v;else{for(y=[new Array(x)],a=0;x>a;a++)v=s[l[a]][0],y[0][i.isReversed(e)?x-a-1:a]=v;x=1}return e._lgroupsLength=x,y}},{"../../plots/plots":321,"./helpers":238}],238:[function(t,e,n){"use strict";var r=t("../../plots/plots");n.legendGetsTrace=function(t){return t.visible&&r.traceIs(t,"showLegend")},n.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},n.isVertical=function(t){return"h"!==t.orientation},n.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":321}],239:[function(t,e,n){"use strict";var r=e.exports={};r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw"),r.style=t("./style")},{"./attributes":233,"./defaults":235,"./draw":236,"./style":240}],240:[function(t,e,n){"use strict";function r(t){var e=t[0].trace,n=e.visible&&e.fill&&"none"!==e.fill,r=d.hasLines(e),i=l.select(this).select(".legendfill").selectAll("path").data(n?[t]:[]);i.enter().append("path").classed("js-fill",!0),i.exit().remove(),i.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var a=l.select(this).select(".legendlines").selectAll("path").data(r?[t]:[]);a.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),a.exit().remove(),a.call(f.lineGroupStyle)}function i(t){function e(t,e,n){var r=u.nestedProperty(o,t).get(),i=Array.isArray(r)&&e?e(r):r;if(n){if(in[1])return n[1]}return i}function n(t){return t[0]}var r,i,a=t[0],o=a.trace,s=d.hasMarkers(o),c=d.hasText(o),h=d.hasLines(o);if(s||c||h){var p={},m={};s&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(m.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(a,p)],i=u.minExtend(o,m)}var g=l.select(this).select("g.legendpoints"),v=g.selectAll("path.scatterpts").data(s?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,i),s&&(r[0].mrc=3);var y=g.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||r.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||n.color),e&&i.call(h.stroke,t.mlc||r.color)})}function o(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=l.select(this);r.style("stroke-width",n+"px").call(h.fill,t.fc||e.fillcolor),n&&r.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var l=t("d3"),u=t("../../lib"),c=t("../../plots/plots"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(r).each(i)}},{"../../lib":273,"../../plots/plots":321,"../../traces/pie/style_one":335,"../../traces/scatter/subtypes":356,"../color":196,"../drawing":219,d3:13}],241:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),i=n.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===r){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,h=(1-c)/2,d=u.Axes.list(t,null,!0),p=0;py;y++){var x=s[y];h=v[x]={};for(var _=0;_1)return r(["resetViews","toggleHover"]),o(g,n);c&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),h&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||m)&&(y=["zoom2d","pan2d"]),(u||m)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!u&&!p||v||m||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):u?r(["hoverClosestCartesian","hoverCompareCartesian"]):d&&r(["hoverClosestPie"]),o(g,n)}function i(t){for(var e=l.Axes.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var m=i(e,n,l);c("x",m[0]),c("y",m[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",n.font);var g=c("bgcolor");c("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":273,"../color":196,"./attributes":244,"./button_attributes":245,"./constants":246}],248:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;re){var n=e;e=t,t=n}s.setAttributes(w,{"data-min":t,"data-max":e}),s.setAttributes(P,{x:t,width:e-t}),s.setAttributes(S,{width:t}),s.setAttributes(T,{x:e,width:p-e}),s.setAttributes(A,{transform:"translate("+(t-g-1)+")"}),s.setAttributes(z,{transform:"translate("+e+")"})}var f=t._fullLayout,h=f._infolayer.selectAll("g.range-slider"),d=f.xaxis.rangeslider,p=f._size.w,m=(f.height-f.margin.b-f.margin.t)*d.thickness,g=2,v=Math.floor(d.borderwidth/2),y=f.margin.l,x=f.height-m-f.margin.b,_=0,b=p,w=document.createElementNS(o,"g");s.setAttributes(w,{"class":"range-slider","data-min":_,"data-max":b,"pointer-events":"all",transform:"translate("+y+","+x+")"});var M=document.createElementNS(o,"rect"),k=d.borderwidth%2===0?d.borderwidth:d.borderwidth-1;s.setAttributes(M,{fill:d.bgcolor,stroke:d.bordercolor,"stroke-width":d.borderwidth,height:m+k,width:p+k,transform:"translate(-"+v+", -"+v+")","shape-rendering":"crispEdges"});var S=document.createElementNS(o,"rect");s.setAttributes(S,{x:0,width:_,height:m,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(o,"rect");s.setAttributes(T,{x:b,width:p-b,height:m,fill:"rgba(0,0,0,0.4)"});var A=document.createElementNS(o,"g"),E=document.createElementNS(o,"rect"),L=document.createElementNS(o,"rect");s.setAttributes(A,{transform:"translate("+(_-g-1)+")"}),s.setAttributes(E,{width:10,height:m,x:-6,fill:"transparent",cursor:"col-resize"}),s.setAttributes(L,{width:g,height:m/2,y:m/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(A,[L,E]);var z=document.createElementNS(o,"g"),I=document.createElementNS(o,"rect"),D=document.createElementNS(o,"rect");s.setAttributes(z,{transform:"translate("+b+")"}),s.setAttributes(I,{width:10,height:m,x:-2,fill:"transparent",cursor:"col-resize"}),s.setAttributes(D,{width:g,height:m/2,y:m/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(z,[D,I]);var P=document.createElementNS(o,"rect");s.setAttributes(P,{x:_,width:b-_,height:m,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function n(t){var n,r,f=+t.clientX-a;switch(i){case P:w.style.cursor="ew-resize",n=+s+f,r=+l+f,c(n,r),u(e(n),e(r));break;case E:w.style.cursor="col-resize",n=+s+f,r=+l,c(n,r),u(e(n),e(r));break;case I:w.style.cursor="col-resize",n=+s,r=+l+f,c(n,r),u(e(n),e(r));break;default:w.style.cursor="ew-resize",n=o,r=o+f,c(n,r),u(e(n),e(r))}}function r(){window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r),w.style.cursor="auto"}var i=t.target,a=t.clientX,o=a-w.getBoundingClientRect().left,s=w.getAttribute("data-min"),l=w.getAttribute("data-max");window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)}),d.range||(d.range=i.getAutoRange(f.xaxis));var C=l(t,p,m);s.appendChildren(w,[M,C,S,T,P,A,z]),n(f.xaxis.range[0],f.xaxis.range[1]),h.data([0]).enter().append(function(){return d.setRange=n,w})}},{"../../constants/xmlns_namespaces":266,"../../lib":273,"../../plotly":291,"../../plots/cartesian/axes":294,"./helpers":254,"./range_plot":256}],253:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("./attributes");e.exports=function(t,e,n,a){function o(t,e){return r.coerce(s,l,i,t,e)}if(t[n].rangeslider){var s=r.isPlainObject(t[n].rangeslider)?t[n].rangeslider:{},l=e[n].rangeslider={};if(o("bgcolor"),o("bordercolor"),o("borderwidth"),o("thickness"),o("visible"),o("range"),l.range&&!e[n].autorange){var u=l.range,c=e[n].range;u[0]=Math.min(u[0],c[0]),u[1]=Math.max(u[1],c[1])}else e[n]._needsExpand=!0;l.visible&&a.forEach(function(t){var n=e[t]||{};n.fixedrange=!0,e[t]=n})}}},{"../../lib":273,"./attributes":251}],254:[function(t,e,n){"use strict";n.setAttributes=function(t,e){for(var n in e)t.setAttribute(n,e[n])},n.appendChildren=function(t,e){for(var n=0;nl;l++){var u=s[l],c={_fullLayout:e},f=S.coerceRef(t,r,c,u);if("path"!==o){var h=.25,d=.75;if("paper"!==f){var p=S.getFromId(c,f),m=a(p);h=m(p.range[0]+h*(p.range[1]-p.range[0])),d=m(p.range[0]+d*(p.range[1]-p.range[0]))}n(u+"0",h),n(u+"1",d)}}return"path"===o?n("path"):k.noneOrAll(t,r,["x0","x1","y0","y1"]),r}function i(t){return"category"===t.type?t.c2l:t.d2l}function a(t){return"category"===t.type?t.l2c:t.l2d}function o(t,e){t.layout.shapes=e,z.supplyLayoutDefaults(t.layout,t._fullLayout),z.drawAll(t)}function s(t){delete t.layout.shapes,t._fullLayout.shapes=[],z.drawAll(t)}function l(t,e,n){for(var r=0;re;i--)d(t,i).selectAll('[data-index="'+(i-1)+'"]').attr("data-index",i),z.draw(t,i)}function f(t,e,n,o){function s(n){var r={"data-index":e,"fill-rule":"evenodd",d:x(t,z)},i=z.line.width?z.line.color:"rgba(0,0,0,0)",a=n.append("path").attr(r).style("opacity",z.opacity).call(T.stroke,i).call(T.fill,z.fillcolor).call(A.dashLine,z.line.dash,z.line.width);I&&a.call(A.setClipUrl,"clip"+t._fullLayout._uid+I),t._context.editable&&h(t,a,z,e)}var l,u;d(t,e).selectAll('[data-index="'+e+'"]').remove();var c=t.layout.shapes[e];if(c){var f={xref:c.xref,yref:c.yref},m={};"string"==typeof n&&n?m[n]=o:k.isPlainObject(n)&&(m=n);var g=Object.keys(m);for(l=0;ll;l++){var _=y[l];if(void 0===m[_]&&void 0!==c[_]){var b,w=_.charAt(0),M=S.getFromId(t,S.coerceRef(f,{},t,w)),E=S.getFromId(t,S.coerceRef(c,{},t,w)),L=c[_];void 0!==m[w+"ref"]&&(M?(b=i(M)(L),L=(b-M.range[0])/(M.range[1]-M.range[0])):L=(L-E.domain[0])/(E.domain[1]-E.domain[0]),E?(b=E.range[0]+L*(E.range[1]-E.range[0]),L=a(E)(b)):L=M.domain[0]+L*(M.domain[1]-M.domain[0])),c[_]=L}}var z=r(c,t._fullLayout);t._fullLayout.shapes[e]=z;var I;if("below"!==z.layer)I=(z.xref+z.yref).replace(/paper/g,""),s(t._fullLayout._shapeUpperLayer);else if("paper"===z.xref&&"paper"===z.yref)I="",s(t._fullLayout._shapeLowerLayer);else{var D,P=t._fullLayout._plots||{},C=Object.keys(P);for(l=0,u=C.length;u>l;l++)D=P[C[l]],I=C[l],p(t,z,D)&&s(D.shapelayer)}}}function h(t,e,n,r){function i(t){var n=$.right-$.left,r=$.bottom-$.top,i=t.clientX-$.left,a=t.clientY-$.top,o=n>Y&&r>W&&!t.shiftKey?E.getCursor(i/n,1-a/r):"move";L(e,o),X=o.split("-")[0]}function a(e){q=S.getFromId(t,n.xref),V=S.getFromId(t,n.yref),U=v(t,q),Z=v(t,V,!0),H=y(t,q),G=y(t,V,!0);var a="shapes["+r+"]";"path"===n.type?(j=n.path,B=a+".path"):(c=U(n.x0),f=Z(n.y0),h=U(n.x1),d=Z(n.y1),p=a+".x0",m=a+".y0",b=a+".x1",w=a+".y1"),h>c?(A=c,P=a+".x0",R="x0",z=h,C=a+".x1",N="x1"):(A=h,P=a+".x1",R="x1",z=c,C=a+".x0",N="x0"),d>f?(k=f,I=a+".y0",O="y0",T=d,D=a+".y1",F="y1"):(k=d,I=a+".y1",O="y1",T=f,D=a+".y0",F="y0"),u={},i(e),J.moveFn="move"===X?s:l}function o(n){L(e),n&&M.relayout(t,u)}function s(r,i){if("path"===n.type){var a=function(t){return H(U(t)+r)};q&&"date"===q.type&&(a=g(a));var o=function(t){return G(Z(t)+i)};V&&"date"===V.type&&(o=g(o)),n.path=_(j,a,o),u[B]=n.path}else u[p]=n.x0=H(c+r),u[m]=n.y0=G(f+i),u[b]=n.x1=H(h+r),u[w]=n.y1=G(d+i);e.attr("d",x(t,n))}function l(r,i){if("path"===n.type){var a=function(t){return H(U(t)+r)};q&&"date"===q.type&&(a=g(a));var o=function(t){return G(Z(t)+i)};V&&"date"===V.type&&(o=g(o)),n.path=_(j,a,o),u[B]=n.path}else{var s=~X.indexOf("n")?k+i:k,l=~X.indexOf("s")?T+i:T,c=~X.indexOf("w")?A+r:A,f=~X.indexOf("e")?z+r:z;l-s>W&&(u[I]=n[O]=G(s),u[D]=n[F]=G(l)),f-c>Y&&(u[P]=n[R]=H(c),u[C]=n[N]=H(f))}e.attr("d",x(t,n))}var u,c,f,h,d,p,m,b,w,k,T,A,z,I,D,P,C,O,F,R,N,j,B,q,V,U,Z,H,G,X,Y=10,W=10,J={setCursor:i,element:e.node(),prepFn:a,doneFn:o},$=J.element.getBoundingClientRect();E.init(J)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):k.log("getShapeLayer: undefined shape: index",e),r}function p(t,e,n){var r=M.Axes.getFromId(t,n.id,"x")._id,i=M.Axes.getFromId(t,n.id,"y")._id,a="below"===e.layer,o=r===e.xref||i===e.yref,s=!!n.shapelayer;return a&&o&&s}function m(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function g(t){return function(e){return t(e).replace(" ","_")}}function v(t,e,n){var r,a=t._fullLayout._size;if(e){var o=i(e);r=function(t){return e._offset+e.l2p(o(t,!0))},"date"===e.type&&(r=m(r))}else r=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return r}function y(t,e,n){var r,i=t._fullLayout._size;if(e){var o=a(e);r=function(t){return o(e.p2l(t-e._offset))}}else r=n?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return r}function x(t,e){var n,r,a,o,s=e.type,l=S.getFromId(t,e.xref),u=S.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=i(l),r=function(t){return l._offset+l.l2p(n(t,!0))}):r=function(t){return c.l+c.w*t},u?(a=i(u),o=function(t){return u._offset+u.l2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===s)return l&&"date"===l.type&&(r=m(r)),u&&"date"===u.type&&(o=m(o)),z.convertPath(e.path,r,o);var f=r(e.x0),h=r(e.x1),d=o(e.y0),p=o(e.y1);if("line"===s)return"M"+f+","+d+"L"+h+","+p;if("rect"===s)return"M"+f+","+d+"H"+h+"V"+p+"H"+f+"Z";var g=(f+h)/2,v=(d+p)/2,y=Math.abs(g-f),x=Math.abs(v-d),_="A"+y+","+x,b=g+y+","+v,w=g+","+(v-x);return"M"+b+_+" 0 1,1 "+w+_+" 0 0,1 "+b+"Z"}function _(t,e,n){return t.replace(I,function(t){var r=0,i=t.charAt(0),a=P[i],o=C[i],s=O[i],l=t.substr(1).replace(D,function(t){return r>=s?t:(a[r]?t=e(t):o[r]&&(t=n(t)),r++,t)});return i+l})}function b(t,e,n,r,i){var a="category"===t.type?Number:t.d2c;if(void 0!==e)return[a(e),a(n)];if(r){var o,s,l,u,c,f=1/0,h=-(1/0),d=r.match(I);for("date"===t.type&&(a=m(a)),o=0;oc&&(f=c),c>h&&(h=c)));return h>=f?[f,h]:void 0}}var w=t("fast-isnumeric"),M=t("../../plotly"),k=t("../../lib"),S=t("../../plots/cartesian/axes"),T=t("../color"),A=t("../drawing"),E=t("../dragelement"),L=t("../../lib/setcursor"),z=e.exports={};z.layoutAttributes=t("./attributes"),z.supplyLayoutDefaults=function(t,e){for(var n=t.shapes||[],i=e.shapes=[],a=0;as&&(t="X"),t});return r>s&&(l=l.replace(/[\s,]*X.*/,""),k.log("Ignoring extra params in segment "+t)),i+l})},z.calcAutorange=function(t){var e,n,r,i,a,o=t._fullLayout,s=o.shapes;if(s.length&&t._fullData.length)for(e=0;eh?n=h:(c.left-=x.offsetLeft,c.right-=x.offsetLeft,c.top-=x.offsetTop,c.bottom-=x.offsetTop,x.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(n=Math.max(n,o*(t[x.side]-c[a])+u))}),n=Math.min(h,n)),n>0||0>h){var d={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){A=0,E=!0,L=I,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var m=n.propContainer,g=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},_=n.attributes,b=n.transform,w=n.containerGroup,M=t._fullLayout,k=m.titlefont.family,S=m.titlefont.size,T=m.titlefont.color,A=1,E=!1,L=m.title.trim();""===L&&(A=0),L.match(/Click to enter .+ title/)&&(A=.2,E=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(f);var I="Click to enter "+y+" title";t._context.editable?(L||p(),z.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,g,e,v):a.relayout(t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(_).selectAll("tspan.line").attr(_)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",E)}},{"../../lib":273,"../../lib/svg_text_utils":284,"../../plotly":291,"../../plots/plots":321,"../color":196,"../drawing":219,d3:13,"fast-isnumeric":15}],260:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:o,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:a({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":272,"../../plots/font_attributes":312,"../color/attributes":195}],261:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],262:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,o,n,r)}var s=i(t,e),l=r("visible",s.length>0);l&&(r("active"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),a.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function i(t,e){function n(t,e){return a.coerce(r,i,u,t,e)}for(var r,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(l.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&v(t),0!==n.length){var u=l.selectAll("g."+T.headerGroupClassName).data(n,i);u.enter().append("g").classed(T.headerGroupClassName,!0);var c=l.selectAll("g."+T.buttonGroupClassName).data([0]);c.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(g).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){y.select(this).remove(),c.call(g).attr(T.menuIndexAttrName,"-1"),_.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],266:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],267:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.16.2",n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=r.register,n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=r.Snapshot,n.PlotSchema=r.PlotSchema,n.Queue=r.Queue,n.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":288,"./plot_api/to_image":289,"./plot_api/validate":290,"./plotly":291,"./snapshot/download":329,d3:13}],268:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],269:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("tinycolor2"),a=t("./nested_property"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)}},"boolean":{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,i){!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,i){t%1||!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var i="number"==typeof t;r.strict!==!0&&i?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){i(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n?!0:"string"!=typeof t?!1:!(t.substr(0,r)!==n||!s.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),a=0;a2)return!1;var l=o[0].split("-");if(l.length>3||3!==l.length&&o[1])return!1;if(4===l[0].length)n=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();n=((Number(l[0])-u+70)%100+200)%100+u-70}return s(n)?1===l.length?new Date(n,0,1).getTime():(r=Number(l[1])-1,l[1].length>2||!(r>=0&&11>=r)?!1:2===l.length?new Date(n,r,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(n,r,i).getTime(),o[1]?(l=o[1].split(":"),l.length>3?!1:(a=Number(l[0]),l[0].length>2||!(a>=0&&23>=a)?!1:(i+=36e5*a,1===l.length?i:(r=Number(l[1]),l[1].length>2||!(r>=0&&59>=r)?!1:(i+=6e4*r,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){if("undefined"==typeof o)return void l.error("d3 is not defined.");e||(e=0);var n=new Date(t),i=o.time.format("%Y-%m-%d")(n);return 7776e6>e?(i+=" "+r(n.getHours(),2),432e6>e&&(i+=":"+r(n.getMinutes(),2),108e5>e&&(i+=":"+r(n.getSeconds(),2),3e5>e&&(i+="."+r(n.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={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"]},c={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"]},f=o.time.format.utc,h={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){h[t].D.push(f(e)),["H","I","D"].forEach(function(n){u[n].forEach(function(r){var i=h[t][n];i.push(f(e+"~"+r)),i.push(f(r+"~"+e))})})})});var d=/[a-z]*/g,p=function(t){return t.substr(0,3)},m=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},x=/\d\d\d\d/,_=/(^|~)[a-z]{3}/,b=/[ap]m/,w=/:/,M=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],S=function(t,e){return k[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,p).replace(m,"").replace(g,"~").replace(v,y).replace(M,S).trim().replace(T,"");var e,n,r=null,o=i(t),s=a(t);e=h[o][s],n=e.length;for(var l=0;n>l&&!(r=e[l].parse(t));l++);if(!(r instanceof Date))return!1;var u=r.getTimezoneOffset();return r.setTime(r.getTime()+60*u*1e3),r}},{"../lib":273,d3:13,"fast-isnumeric":15}],271:[function(t,e,n){"use strict";var r=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof r)return t;var e=new r;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(n,r){"undefined"!=typeof jQuery&&jQuery(t).trigger(n,r),e.emit(n,r)},t},triggerHandler:function(t,e,n){var r,i;"undefined"!=typeof jQuery&&(r=jQuery(t).triggerHandler(e,n));var a=t._ev;if(!a)return r;var o=a._events[e];if(!o)return r;"function"==typeof o&&(o=[o]);for(var s=o.pop(),l=0;lv;v++){l=t[v];for(u in l)c=m[u],f=l[u],s&&o(f)?m[u]=f:e&&f&&(a(f)||(h=o(f)))?(h?(h=!1,d=c&&o(c)?c:[]):d=c&&a(c)?c:{},m[u]=i([d,f],e,n,s)):("undefined"!=typeof f||n)&&(m[u]=f)}return m}var a=t("./is_plain_object.js"),o=Array.isArray;n.extendFlat=function(){return i(arguments,!1,!1,!1)},n.extendDeep=function(){return i(arguments,!0,!1,!1)},n.extendDeepAll=function(){return i(arguments,!0,!0,!1)},n.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":274}],273:[function(t,e,n){"use strict";var r=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var a=t("./coerce");i.valObjects=a.valObjects,i.coerce=a.coerce,i.coerce2=a.coerce2,i.coerceFont=a.coerceFont,i.validate=a.validate;var o=t("./dates");i.dateTime2ms=o.dateTime2ms,i.isDateTime=o.isDateTime,i.ms2DateTime=o.ms2DateTime,i.parseDate=o.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var f=t("./loggers");i.log=f.log,i.warn=f.warn,i.error=f.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,n,r){n||(n="x"),r||(r="y");for(var a=0;an?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},i.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},i.identity=function(t){return t},i.randstr=function h(t,e,n){if(n||(n=16),void 0===e&&(e=24),0>=e)return"0";var r,i,a,o=Math.log(Math.pow(2,e))/Math.log(n),s="";for(r=2;o===1/0;r*=2)o=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var l=o-Math.floor(o);for(r=0;r-1||u!==1/0&&u>=Math.pow(2,e)?h(t,e,n):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var n,r,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(n=0;l>n;n++)u[n]=(1-Math.cos(Math.PI*(n+1)/e))/(2*e);for(n=0;o>n;n++){for(a=0,r=0;l>r;r++)i=n+r+1-e,-o>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[r];c[n]=a}return c},i.syncOrAsync=function(t,e,n){function r(){return i.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(r).then(void 0,i.promiseError);return n&&n(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,n){if(t){var r,i,a=!1,o=!0;for(r=0;ri;i++)e[i][n]=t[i]},i.minExtend=function(t,e){var n={};"object"!=typeof e&&(e={});var r,a,o,s=3,l=Object.keys(t);for(r=0;r1?r+a[1]:"";if(i&&(a.length>1||o.length>4))for(;n.test(o);)o=o.replace(n,"$1"+i+"$2");return o+s}},{"./coerce":269,"./dates":270,"./extend":272,"./is_plain_object":274,"./loggers":275,"./matrix":276,"./nested_property":277,"./notifier":278,"./search":281,"./stats":283,d3:13}],274:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],275:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;er;r++)n[r]=new Array(e);return n},n.transposeRagged=function(t){var e,n,r=0,i=t.length;for(e=0;i>e;e++)r=Math.max(r,t[e].length);var a=new Array(r);for(e=0;r>e;e++)for(a[e]=new Array(i),n=0;i>n;n++)a[e][n]=t[n][e];return a},n.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var r,i,a=t.length;if(t[0].length)for(r=new Array(a),i=0;a>i;i++)r[i]=n.dot(t[i],e);else if(e[0].length){var o=n.transposeRagged(e);for(r=new Array(o.length),i=0;ii;i++)r+=t[i]*e[i];return r},n.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},n.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},n.rotationXYMatrix=function(t,e,r){return n.dot(n.dot(n.translationMatrix(e,r),n.rotationMatrix(t)),n.translationMatrix(-e,-r))},n.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var r=1===arguments.length?e[0]:[e[0],e[1]];return n.dot(t,[r[0],r[1],1]).slice(0,2)}},n.apply2DTransform2=function(t){var e=n.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],277:[function(t,e,n){"use strict";function r(t,e){return function(){var n,i,a,o,s,l=t;for(o=0;o=0;e--){if(r=t[e],o=!1,Array.isArray(r))for(n=r.length-1;n>=0;n--)u(r[n])?o?r[n]=void 0:r.pop():o=!0;else if("object"==typeof r&&null!==r)for(a=Object.keys(r),o=!1,n=a.length-1;n>=0;n--)u(r[a[n]])&&!i(r[a[n]],a[n])?delete r[a[n]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,i,o,s=0,l=e.split(".");sn||n>a||o>r||r>s?!1:!e||!u(t)}function n(t,e){var n=t[0],l=t[1];if(i>n||n>a||o>l||l>s)return!1;var u,c,f,h,d,p=r.length,m=r[0][0],g=r[0][1],v=0;for(u=1;p>u;u++)if(c=m,f=g,m=r[u][0],g=r[u][1],h=Math.min(c,m),!(h>n||n>Math.max(c,m)||l>Math.max(f,g)))if(l=l&&n!==h&&v++}return v%2===1}var r=t.slice(),i=r[0][0],a=i,o=r[0][1],s=o;r.push(r[0]);for(var l=1;la;a++)if(o=[t[a][0]-l[0],t[a][1]-l[1]],s=r(o,u),0>s||s>c||Math.abs(r(o,h))>i)return!0;return!1};i.filter=function(t,e){function n(n){t.push(n);var s=r.length,l=i;r.splice(o+1);for(var u=l+1;u1){var s=t.pop();n(s)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":276}],280:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;nt}function i(t,e){return e>=t}function a(t,e){return t>e}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");n.findBin=function(t,e,n){if(s(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?n?r:i:n?o:a;h>f&&d++<100;)u=Math.floor((f+h)/2),c(e[u],t)?f=u+1:h=u;return d>90&&l.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,i=e[r]-e[0]||1,a=i/(r||1)/1e4,o=[e[0]],s=0;r>s;s++)e[s+1]>e[s]+a&&(i=Math.min(i,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:i}},n.roundUp=function(t,e,n){for(var r,i=0,a=e.length-1,o=0,s=n?0:1,l=n?1:0,u=n?Math.ceil:Math.floor;a>i&&o++<100;)r=u((i+a)/2),e[r]<=t?i=r+s:a=r-l;return e[i]}},{"../lib":273,"fast-isnumeric":15}],282:[function(t,e,n){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],283:[function(t,e,n){"use strict";var r=t("fast-isnumeric");n.aggNums=function(t,e,i,a){var o,s;if(a||(a=i.length),r(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(a),o=0;a>o;o++)s[o]=n.aggNums(t,e,i[o]);i=s}for(o=0;a>o;o++)r(e)?r(i[o])&&(e=t(+e,+i[o])):e=i[o];return e},n.len=function(t){return n.aggNums(function(t){return t+1},0,t)},n.mean=function(t,e){return e||(e=n.len(t)),n.aggNums(function(t,e){return t+e},0,t)/e},n.variance=function(t,e,i){return e||(e=n.len(t)),r(i)||(i=n.mean(t,e)),n.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},n.stdev=function(t,e,r){return Math.sqrt(n.variance(t,e,r))},n.interp=function(t,e){if(!r(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":15}],284:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,n){var r="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),n();else{var r=a.select("svg").node().getBoundingClientRect();n(a.select(".MathJax_SVG"),e,r)}a.remove()})}function o(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),i=m[r];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(a)return"";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,-1===g.indexOf(c.protocol)?"":''}if("br"===r)return"
";if(a)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))r.push(i);var a=0;r.forEach(function(t){for(var n=t+a,r=e.slice(0,n),i="",o=r.length-1;o>=0;o--){var s=r[o].match(/<(\/?).*>/i);if(s&&"
"!==r[o]){s[1]||(i=r[o]);break}}i&&(e.splice(n+1,0,i),e.splice(n,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,n){var r,i,a,o=n.horizontalAlign,s=n.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-r.height}:"middle"===s?function(){return l.top+(l.height-r.height)/2}:function(){return l.top},a="right"===o?function(){return l.right-r.width}:"center"===o?function(){return l.left+(l.width-r.width)/2}:function(){return l.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(h.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var m=t.node();m&&m.removeAttribute;m=m.parentNode)m.removeAttribute("data-bb");if(l){var g=h.getPlotDiv(s.node());(g&&g._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return n(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({"class":p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=r(l,"width"),h=r(l,"height"),m=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],g=parseInt(s.style("font-size"),10)||r(s,"height"),v=-g/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,v-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-h/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:m,y:+s.attr("y")+v-h/2}),e&&e.call(s,u),t(u)})}))}else n();return t}};var m={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},g=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:n.fill||o.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||o.attr("data-unformatted")).call(c(o,e,n)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}n||(n={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),n.immediate?r():u.on("click",r),f.rebind(this,s,"on")}},{"../constants/string_mappings":265,"../constants/xmlns_namespaces":266,"../lib":273,d3:13}],285:[function(t,e,n){"use strict";function r(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function i(t){Array.isArray(t._promises)&&t._promises.length>0&&C.log("Clearing previous rejected promises from queue."),t._promises=[]}function a(t,e){t._fullLayout._paperdiv.style("background","white"),P.defaultConfig.setBackground(t,e)}function o(t,e){t._context||(t._context=C.extendFlat({},P.defaultConfig));var n=t._context;e&&(Object.keys(e).forEach(function(t){t in n&&("setBackground"===t&&"opaque"===e[t]?n[t]=a:n[t]=e[t])}),e.plot3dPixelRatio&&!n.plotGlPixelRatio&&(n.plotGlPixelRatio=n.plot3dPixelRatio)),n.staticPlot&&(n.editable=!1,n.autosizable=!1,n.scrollZoom=!1,n.doubleClick=!1,n.showTips=!1,n.showLink=!1,n.displayModeBar=!1)}function s(t,e,n){var r=z.select(t).selectAll(".plot-container").data([0]);r.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=r.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),n&&(t.layout=n),P.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(M(t,{}),t._fullLayout.autosize=n.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=P.micropolar.manager.framework(t), -t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var a=t.framework.svg(),o=1,s=t._fullLayout.title;""!==s&&s||(o=0);var l="Click to enter title",u=function(){this.call(P.util.convertToTspans)},c=a.select(".title-group text").call(u);if(t._context.editable){c.attr({"data-unformatted":s}),s&&s!==l||(o=.2,c.attr({"data-unformatted":l}).text(l).style({opacity:o}).on("mouseover.opacity",function(){z.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){z.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(P.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(u),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(u)})};c.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),R.addLinks(t),Promise.resolve()}function l(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var r=P.Axes.list({_fullLayout:t});for(e=0;ee;e++){var o=t.annotations[e];o.ref&&("paper"===o.ref?(o.xref="paper",o.yref="paper"):"data"===o.ref&&(o.xref="x",o.yref="y"),delete o.ref),u(o,"xref"),u(o,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(C.warn("Shapes must be an array."),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var l=t.shapes[e];u(l,"xref"),u(l,"yref")}var c=t.legend;c&&(c.x>3?(c.x=1.02,c.xanchor="left"):c.x<-2&&(c.x=-.02,c.xanchor="right"),c.y>3?(c.y=1.02,c.yanchor="bottom"):c.y<-2&&(c.y=-.02,c.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=R.getSubplotIds(t,"gl3d");for(e=0;en;++n)x[n]=g[e]+v*y[2+4*n];d.camera={eye:{x:x[0],y:x[1],z:x[2]},center:{x:g[0],y:g[1],z:g[2]},up:{x:y[1],y:y[5],z:y[9]}},delete d.cameraposition}}return j.clean(t),t}function u(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=P.Axes.cleanId(n,r))}function c(t,e){for(var n=[],r=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),i=0;ia&&(s=C.randstr(r),-1!==n.indexOf(s));a++);o.uid=C.randstr(r),r.push(o.uid)}if(n.push(o.uid),"histogramy"===o.type&&"xbins"in o&&!("ybins"in o)&&(o.ybins=o.xbins,delete o.xbins),o.error_y&&"opacity"in o.error_y){var l=j.defaults,u=o.error_y.color||(R.traceIs(o,"bar")?j.defaultLine:l[i%l.length]);o.error_y.color=j.addOpacity(j.rgb(u),j.opacity(u)*o.error_y.opacity),delete o.error_y.opacity}if("bardir"in o&&("h"!==o.bardir||!R.traceIs(o,"bar")&&"histogram"!==o.type.substr(0,9)||(o.orientation="h",b(o)),delete o.bardir),"histogramy"===o.type&&b(o),"histogramx"!==o.type&&"histogramy"!==o.type||(o.type="histogram"),"scl"in o&&(o.colorscale=o.scl,delete o.scl),"reversescl"in o&&(o.reversescale=o.reversescl,delete o.reversescl),o.xaxis&&(o.xaxis=P.Axes.cleanId(o.xaxis,"x")),o.yaxis&&(o.yaxis=P.Axes.cleanId(o.yaxis,"y")),R.traceIs(o,"gl3d")&&o.scene&&(o.scene=R.subplotsRegistry.gl3d.cleanId(o.scene)),R.traceIs(o,"pie")||(Array.isArray(o.textposition)?o.textposition=o.textposition.map(f):o.textposition&&(o.textposition=f(o.textposition))),R.traceIs(o,"2dMap")&&("YIGnBu"===o.colorscale&&(o.colorscale="YlGnBu"),"YIOrRd"===o.colorscale&&(o.colorscale="YlOrRd")),R.traceIs(o,"markerColorscale")&&o.marker){var c=o.marker;"YIGnBu"===c.colorscale&&(c.colorscale="YlGnBu"),"YIOrRd"===c.colorscale&&(c.colorscale="YlOrRd")}if("surface"===o.type&&C.isPlainObject(o.contours)){var d=["x","y","z"];for(a=0;ar?a.push(i+r):a.push(r);return a}function m(t,e,n){var r,i;for(r=0;r=t.data.length||i<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(i,r+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||0>i&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+n+" must be unique.")}}function g(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),m(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&m(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function v(t,e,n){var r,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&l0){var s=w(t._boundingBoxMargins),l=s.left+s.right,u=s.bottom+s.top,c=a._container.node().getBoundingClientRect(),f=1-2*o.frameMargins;i=Math.round(f*(c.width-l)),r=Math.round(f*(c.height-u))}else n=window.getComputedStyle(t),r=parseFloat(n.height)||a.height,i=parseFloat(n.width)||a.width;return Math.abs(a.width-i)>1||Math.abs(a.height-r)>1?(a.height=t.layout.height=r,a.width=t.layout.width=i):"initial"!==a.autosize&&(delete e.autosize,a.autosize=t.layout.autosize=!0),R.sanitizeMargins(a),e}function k(t){var e=z.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===n.autosize&&(M(t,{}),n.autosize=!0,t.layout.autosize=!0),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];z.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=C.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(J.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var i=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=i.append("g").classed("imagelayer",!0),n._shapeLowerLayer=i.append("g").classed("shapelayer",!0);var a=P.Axes.getSubplots(t);a.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&S(t,a),n._has("cartesian")&&T(t,a),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.selectAll(".layer-subplot");n._imageSubplotLayer=o.selectAll(".imagelayer"),n._shapeSubplotLayer=o.selectAll(".shapelayer");var s=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=s.append("g").classed("imagelayer",!0),n._shapeUpperLayer=s.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var l=C.syncOrAsync([A,function(){return P.Axes.doTicks(t,"redraw")},N.init],t);return l&&l.then&&t._promises.push(l),l}function S(t,e){function n(e,n){return function(){return P.Axes.getFromId(t,e,n)}}for(var r,i,a=t._fullLayout._plots={},o=0;o0,b=P.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),M=w===b;_?t.framework===k&&!x&&M||(t.framework=k,k(t)):M?x&&k(t):(t.framework=k,k(t)),x&&P.Axes.saveRangeInitial(t);var S=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&d(t);for(var E=0;EY.range[0]?[1,2]:[2,1]);else{var J=Y.range[0],$=Y.range[1];"log"===N?(0>=J&&0>=$&&a(H+".autorange",!0),0>=J?J=$/1e6:0>=$&&($=J/1e6),a(H+".range[0]",Math.log(J)/Math.LN10),a(H+".range[1]",Math.log($)/Math.LN10)):(a(H+".range[0]",Math.pow(10,J)),a(H+".range[1]",Math.pow(10,$)))}else a(H+".autorange",!0)}if("reverse"===q)G.range?G.range.reverse():(a(H+".autorange",!0),G.range=[1,0]),X.autorange?w=!0:b=!0;else if("annotations"===O.parts[0]||"shapes"===O.parts[0]){var Q=O.parts[1],K=O.parts[0],tt=m[K]||[],et=P[C.titleCase(K)],nt=tt[Q]||{};2===O.parts.length&&("add"===v[I]||C.isPlainObject(v[I])?E[I]="remove":"remove"===v[I]?-1===Q?(E[K]=tt,delete E[I]):E[I]=nt:C.log("???",v)),!o(nt,"x")&&!o(nt,"y")||C.containsAny(I,["color","opacity","align","dash"])||(w=!0),et.draw(t,Q,O.parts.slice(2).join("."),v[I]),delete v[I]}else if("images"===O.parts[0]){var it=C.objectFromPath(I,N);C.extendDeepAll(t.layout,it),V.supplyLayoutDefaults(t.layout,t._fullLayout),V.draw(t)}else if("mapbox"===O.parts[0]&&"layers"===O.parts[1]){C.extendDeepAll(t.layout,C.objectFromPath(I,N));var at=(t._fullLayout.mapbox||{}).layers||[];for(D=O.parts[2]+1-at.length,p=0;D>p;p++)at.push({});b=!0}else if("updatemenus"===O.parts[0]){C.extendDeepAll(t.layout,C.objectFromPath(I,N));var ot=t._fullLayout.updatemenus||[];for(D=O.parts[2]+1-ot.length,p=0;D>p;p++)ot.push({});b=!0}else 0===O.parts[0].indexOf("scene")?b=!0:0===O.parts[0].indexOf("geo")?b=!0:0===O.parts[0].indexOf("ternary")?b=!0:!g._has("gl2d")||-1===I.indexOf("axis")&&"plot_bgcolor"!==O.parts[0]?"hiddenlabels"===I?w=!0:-1!==O.parts[0].indexOf("legend")?y=!0:-1!==I.indexOf("title")?x=!0:-1!==O.parts[0].indexOf("bgcolor")?_=!0:O.parts.length>1&&C.containsAny(O.parts[1],["tick","exponent","grid","zeroline"])?x=!0:-1!==I.indexOf(".linewidth")&&-1!==I.indexOf("axis")?x=_=!0:O.parts.length>1&&-1!==O.parts[1].indexOf("line")?_=!0:O.parts.length>1&&"mirror"===O.parts[1]?x=_=!0:"margin.pad"===I?x=_=!0:"margin"===O.parts[0]||"autorange"===O.parts[1]||"rangemode"===O.parts[1]||"type"===O.parts[1]||"domain"===O.parts[1]||I.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(I)?k=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(I)&&(b=!0):b=!0,O.set(N)}F.add(t,rt,[t,E],rt,[t,T]),v.autosize&&(v=M(t,v)),(v.height||v.width||v.autosize)&&(w=!0);var st=Object.keys(v),lt=[R.previousPromises];if(b||w)lt.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),P.plot(t,"",m)});else if(st.length&&(R.supplyDefaults(t),g=t._fullLayout,y&<.push(function(){return U.draw(t),R.previousPromises(t)}),_&<.push(A),x&<.push(function(){return P.Axes.doTicks(t,"redraw"),L(t),R.previousPromises(t)}),k)){var ut;for(W(t),P.Fx.supplyLayoutDefaults(t.layout,g,t._fullData),P.Fx.init(t),ut=R.getSubplotIds(g,"gl3d"),p=0;p1)};u(n.width)&&u(n.height)||s(new Error("Height and width should be pixel values."));var c=r.clone(e,{format:"png",height:n.height,width:n.width}),f=c.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var h=r.getRedrawFunc(f);a.plot(f,c.data,c.layout,c.config).then(h).then(l).then(function(e){t(e)}).catch(function(t){s(t)})});return s}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib");e.exports=r},{"../lib":273,"../plotly":291,"../snapshot":331,"fast-isnumeric":15}],290:[function(t,e,n){"use strict";function r(t,e,n,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,g=n.length,v=0;g>v;v++){var y=n[v],x=["data",v];if(p(y)){var _=c[v],b=_.type,w=s.traces[b].attributes;w.type={valType:"enumerated",values:[b]},_.visible===!1&&y.visible!==!1&&l.push(o("invisible",x)),r(y,_,w,l,x);var M=y.transforms,k=_.transforms;if(M){m(M)||l.push(o("array",x,["transforms"])),x.push("transforms");for(var S=0;Su&&c>e&&(void 0===i[n]?a[f]=T.tickText(t,e):a[f]=s(t,e,String(i[n])),f++);return f=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function o(t,e){var n=t.match(q),r=new Date(e);if(n){var i=Math.min(+n[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(q,a))(r)}return y.time.format(t)(r)}function s(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function l(t,e,n,r){var i,a=e.x,s=t._tickround,l=new Date(a),u="";n&&t.hoverformat?i=o(t.hoverformat,a):t.tickformat?i=o(t.tickformat,a):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=O(l):"m"===s?i=F(l):(a!==t._tmin||n||(u="
"+O(l)),"d"===s?i=R(l):"H"===s?i=N(l):(a!==t._tmin||n||(u="
"+R(l)+", "+O(l)),i=j(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=h(v(a/1e3,1),t,"none",n).substr(1)))))),e.text=i+u}function u(t,e,n,r,i){var a=t.dtick,o=e.x;if(!r||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,r);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>o?.5:.25)))}}function c(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,r)}function h(t,e,n,r){var i=0>t,o=e._tickround,s=n||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat;if(r){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};a(c),o=(Number(c._tickround)||0)+4,l=c._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),f>t)t="0",i=!1;else{if(t+=f,l&&(t*=Math.pow(10,-l),o+=l),0===o)t=String(Math.floor(t));else if(0>o){t=String(Math.round(t)),t=t.substr(0,t.length+o);for(var h=o;0>h;h++)t+="0"}else{t=String(t);var d=t.indexOf(".")+1;d&&(t=t.substr(0,d+o).replace(/\.?0+$/,""))}t=b.numSeparate(t,e._gd._fullLayout.separators)}if(l&&"hide"!==s){var p;p=0>l?"\u2212"+-l:"power"!==s?"+"+l:String(l),"e"===s||("SI"===s||"B"===s)&&(l>12||-15>l)?t+="e"+p:"E"===s?t+="E"+p:"power"===s?t+="\xd710"+p+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var n,r,i=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,n=[],r=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(r===i){var p=r-1,m=r+1;n="tozero"===t.rangemode?0>r?[p,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,m)]:[p,m]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),n=[l.val-h*l.pad,u.val+h*u.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),d&&n.reverse(),n},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var n=T.list(t,"",!0),r=!1,i=0;ip&&(p=m/10),u=t.c2l(p),c=t.c2l(m),y&&(u=Math.min(0,u),c=Math.max(0,c)),r(u)){for(d=!0,o=0;o=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(r(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,m,g=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),_=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),b=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(a=0;6>a;a++)i(a);for(a=g-1;a>5;a--)i(a)}},T.autoBin=function(t,e,n,r){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=b.aggNums(Math.min,null,t),o=b.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(n)s=(o-a)/n;else{var l=b.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*b.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*b.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[a,o]};T.autoTicks(f,s);var h,d=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,m=0,g=0,v=0,y=0;ym&&(p>.3*_||i(a)||i(o))){var w=f.dtick/2;d+=a>d+w?w:-w}var M=1+Math.floor((o-d)/f.dtick);h=d+M*f.dtick}else for(h=d;o>=h;)h=T.tickIncrement(h,f.dtick);return{start:d,end:h,size:f.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return r(t);if("auto"===t.tickmode||!t.dtick){var e,n=t.nticks;n||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/e):(e="y"===t._id.charAt(0)?40:80,n=b.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),a(t),t._tmin=T.tickFirst(t);var i=t.range[1]=s:s>=l)&&(o.push(l),!(o.length>1e3));l=T.tickIncrement(l,t.dtick,i));t._tmax=o[o.length-1];for(var u=new Array(o.length),c=0;c157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,n,L)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,z)):e>432e5?(t.dtick=i(e,864e5,D),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,z):e>3e4?t.dtick=i(e,6e4,I):e>500?t.dtick=i(e,1e3,I):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,L));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,n,L)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,L));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var a=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(a)}},T.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var i=e.charAt(0),a=r*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?C:P,l=t+.01*r,u=b.roundUp(v(l,1),s,n);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]r:r>u;)u=T.tickIncrement(u,i,e);return u}if("L"===c)return Math.log(n((Math.pow(10,r)-a)/f)*f+a)/Math.LN10;if("D"===c){var h="D2"===i?C:P,d=b.roundUp(v(r,1),h,e);return Math.floor(r)+Math.log(y.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var O=y.time.format("%Y"),F=y.time.format("%b %Y"),R=y.time.format("%b %-d"),N=y.time.format("%b %-d %Hh"),j=y.time.format("%H:%M"),B=y.time.format(":%S"),q=/%(\d?)f/g;T.tickText=function(t,e,n){function r(r){var i;return void 0===r?!0:n?"none"===r:(i={first:t._tmin,last:t._tmax}[r],"all"!==r&&e!==i)}var i,a,o=s(t,e),h="array"===t.tickmode,d=n||h;if(h&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(a=0;a1&&en&&(k=90),i(c,k)}u._lastangle=k}return o(e),e+" done"}function l(){u._boundingBox=n.node().getBoundingClientRect()}var c=n.selectAll("g."+z).data(E,L);if(!u.showticklabels||!x(r))return c.remove(),void o(e);var f,h,p,v,_;"x"===g?(_="bottom"===B?1:-1,f=function(t){return t.dx+O*_},v=r+(C+P)*_,h=function(t){return t.dy+v+t.fontSize*("bottom"===B?1:-.5)},p=function(t){return x(t)&&0!==t&&180!==t?0>t*_?"end":"start":"middle"}):(_="right"===B?1:-1,h=function(t){return t.dy+t.fontSize/2-O*_},f=function(t){return t.dx+r+(C+P+(90===Math.abs(u.tickangle)?t.fontSize/2:0))*_},p=function(t){return x(t)&&90===Math.abs(t)?"middle":"right"===B?"start":"end"});var M=0,k=0,T=[];c.enter().append("g").classed(z,1).append("text").attr("text-anchor","middle").each(function(e){var n=y.select(this),r=t._promises.length;n.call(S.setPosition,f(e),h(e)).call(S.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),r=t._promises[r],r?T.push(t._promises.pop().then(function(){i(n,u.tickangle)})):i(n,u.tickangle)}),c.exit().remove(),c.each(function(t){M=Math.max(M,t.fontSize)}),i(c,u._lastangle||u.tickangle);var A=b.syncOrAsync([a,s,l]);return A&&A.then&&t._promises.push(A),A}function o(e){if(!n){var r,i,a,o,s=A.getFromId(t,e),l=y.select(t).selectAll("g."+e+"tick"),u={selection:l,side:s.side},f=e.charAt(0),h=t._fullLayout._size,d=1.5,p=s.titlefont.size;if(l.size()){var m=y.select(l.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);m&&(u.offsetLeft=+m[1],u.offsetTop=+m[2])}"x"===f?(i="free"===s.anchor?{_offset:h.t+(1-(s.position||0))*h.h,_length:0}:A.getFromId(t,s.anchor),a=s._offset+s._length/2,o=i._offset+("top"===s.side?-10-p*(d+(s.showticklabels?1:0)):i._length+10+p*(d+(s.showticklabels?1.5:.5))),s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(o+=(c.height-c.margin.b-c.margin.t)*s.rangeslider.thickness+s._boundingBox.height),u.side||(u.side="bottom")):(i="free"===s.anchor?{_offset:h.l+(s.position||0)*h.w,_length:0}:A.getFromId(t,s.anchor),o=s._offset+s._length/2,a=i._offset+("right"===s.side?i._length+10+p*(d+(s.showticklabels?1:.5)):-10-p*(d+(s.showticklabels?.5:0))),r={rotate:"-90",offset:0},u.side||(u.side="left")),M.draw(t,e+"title",{propContainer:s,propName:s._name+".title",dfltName:f.toUpperCase()+" axis",avoid:u,transform:r,attributes:{x:a,y:o,"text-anchor":"middle"}})}}function s(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:_.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[g]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===g}function l(e,n,i){var a=e.gridlayer,o=e.zerolinelayer,l=e["hidegrid"+g]?[]:V,c=u._gridpath||"M0,0"+("x"===g?"v":"h")+n._length,f=a.selectAll("path."+I).data(u.showgrid===!1?[]:l,L);if(f.enter().append("path").classed(I,1).classed("crisp",1).attr("d",c).each(function(t){u.zeroline&&("linear"===u.type||"-"===u.type)&&Math.abs(t.x)m;m++){var y=u.mirrors[o._id+h[m]];"ticks"!==y&&"labels"!==y||(f[m]=!0)}return void 0!==r[2]&&(f[2]=!0),f.forEach(function(t,e){var n=r[e],i=q[e];t&&x(n)&&(d+=p(n+P*i,i*u.ticklen))}),i(n,d),l(e,o,t),a(n,r[3])}}).filter(function(t){return t&&t.then});return Z.length?Promise.all(Z):0},T.swap=function(t,e){for(var n=d(t,e),r=0;r2*r}function c(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,i=0,a=0;a2*r}var f=t("fast-isnumeric"),h=t("tinycolor2").mix,d=t("../../lib"),p=t("../plots"),m=t("../../components/color/attributes").lightFraction,g=t("./layout_attributes"),v=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),x=t("./tick_label_defaults"),_=t("./category_order_defaults"),b=t("./set_convert"),w=t("./ordered_categories"),M=t("./clean_datum"),k=t("./axis_ids");e.exports=function(t,e,n,i){function a(n,r){return d.coerce2(t,e,g,n,r)}var o=i.letter,s=i.font||{},l="Click to enter "+(i.title||o.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=k.name2id(i.name));var u=n("type");"-"===u&&(r(e,i.data),"-"===e.type?e.type="linear":u=t.type=e.type),b(e);var c=n("color"),p=c===t.color?c:s.color;n("title",l),d.coerceFont(n,"titlefont",{family:s.family,size:Math.round(1.2*s.size),color:p});var M=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),S=n("autorange",!M);S&&n("rangemode");var T=n("range",[-1,"x"===o?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),d.noneOrAll(t.range,e.range,[0,1]),n("fixedrange"),v(t,e,n,u),x(t,e,n,u,i),y(t,e,n,i),_(t,e,n);var A=a("linecolor",c),E=a("linewidth"),L=n("showline",!!A||!!E);L||(delete e.linecolor,delete e.linewidth),(L||e.ticks)&&n("mirror");var z=a("gridcolor",h(c,i.bgColor,m).toRgbString()),I=a("gridwidth"),D=n("showgrid",i.showGrid||!!z||!!I);D||(delete e.gridcolor,delete e.gridwidth);var P=a("zerolinecolor",c),C=a("zerolinewidth"),O=n("zeroline",i.showGrid||!!P||!!C);return O||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===u?w(o,e.categoryorder,e.categoryarray,i.data):[],e}},{"../../components/color/attributes":195,"../../lib":273,"../plots":321,"./axis_ids":296,"./category_order_defaults":297,"./clean_datum":298,"./layout_attributes":303,"./ordered_categories":305,"./set_convert":308,"./tick_label_defaults":309,"./tick_mark_defaults":310,"./tick_value_defaults":311,"fast-isnumeric":15,tinycolor2:191}],296:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),i=/^[xyz]axis[0-9]*/,a=[],o=0;o0;a&&(r="array");var o=n("categoryorder",r);"array"===o&&n("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],298:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":273,"fast-isnumeric":15}],299:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],300:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],i=Math.abs(r-t.range[1-e]);return"date"===t.type?c.ms2DateTime(r,i):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(n)+"g")(r))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/setcursor"),m=t("../../components/dragelement"),g=t("./axes"),v=t("./select"),y=t("./constants"),x=!0;e.exports=function(t,e,n,s,_,b,w,M){function k(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+mt+")").attr("d",lt+"Z"),ht=dt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+mt+")").attr("d","M0,0Z"),A();for(var a=0;ai?(ct="",ot.r=ot.l,ot.t=ot.b,ht.attr("d","M0,0Z")):(ot.t=0,ot.b=U,ct="x",ht.attr("d","M"+(ot.l-.5)+","+(at-H-.5)+"h-3v"+(2*H+1)+"h3ZM"+(ot.r+.5)+","+(at-H-.5)+"h3v"+(2*H+1)+"h-3Z")):!$||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function L(t,e,n){var r,i,a;for(r=0;rzoom back out","long"),x=!1)))}function I(e,n){var i=1===(w+M).length;if(e)F();else if(2!==n||i){if(1===n&&i){var a=w?q[0]:B[0],o="s"===w||"w"===M?0:1,s=a._name+".range["+o+"]",l=r(a,o),c="left",h="middle";if(a.fixedrange)return;w?(h="n"===w?"top":"bottom","right"===a.side&&(c="right")):"e"===M&&(c="right"),et.call(f.makeEditable,null,{immediate:!0,background:N.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var n="category"===a.type?a.c2l(e):a.d2l(e);void 0!==n&&u.relayout(t,s,n)})}}else O()}function D(e){function n(t,e,n){if(!t.fixedrange){S(t.range);var r=t.range,i=r[0]+(r[1]-r[0])*e;t.range=[i+(r[0]-i)*n,i+(r[1]-i)*n]}}if(t._context.scrollZoom||N._enablescrollzoom){var r=t.querySelector(".plotly");if(!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(vt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void c.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=gt[0]+gt[2]*l,f=(s.bottom-e.clientY)/s.height,h=gt[1]+gt[3]*(1-f);if(M){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function i(t,e,n){for(var i=1-e,a=0,o=0;o0;r--)n.push(e);return n}function i(t,e){for(var n=[],r=0;rT;T++){var A=a[T],E=d[A];if(E)k[T]=w.getFromId(t,E.xaxis._id),S[T]=w.getFromId(t,E.yaxis._id);else{var L=o[A]._subplot;k[T]=L.xaxis,S[T]=L.yaxis}}var z=e.hovermode||o.hovermode;if(-1===["x","y","closest"].indexOf(z)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return b.unhoverRaw(t,e);var I,D,P,C,O,F,R,N,j,B,q,V,U=[],Z=[];if(Array.isArray(e))for(z="array",P=0;PH||H>X.width||0>G||G>X.height)return b.unhoverRaw(t,e)}else H="xpx"in e?e.xpx:k[0]._length/2,G="ypx"in e?e.ypx:S[0]._length/2;if(I="xval"in e?r(a,e.xval):i(k,H),D="yval"in e?r(a,e.yval):i(S,G),!m(I[0])||!m(D[0]))return g.warn("Plotly.Fx.hover failed",e,t),b.unhoverRaw(t,e)}var Y=1/0;for(C=0;C1||-1!==F.hoverinfo.indexOf("name")?F.name:void 0,index:!1,distance:Math.min(Y,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},V=U.length,"array"===N){var W=e[C];"pointNumber"in W?(q.index=W.pointNumber,N="closest"):(N="","xval"in W&&(j=W.xval,N="x"),"yval"in W&&(B=W.yval,N=N?"closest":"y"))}else j=I[R],B=D[R];if(F._module&&F._module.hoverPoints){var J=F._module.hoverPoints(q,j,B,N);if(J)for(var $,Q=0;QV&&(U.splice(0,V),Y=U[0].distance)}if(0===U.length)return b.unhoverRaw(t,e);var K="y"===z&&Z.length>1;U.sort(function(t,e){return t.distance-e.distance});var tt=x.combine(o.plot_bgcolor||x.background,o.paper_bgcolor),et={hovermode:z,rotateLabels:K,bgColor:tt,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(U,et);c(U,K?"xa":"ya"),f(nt,K);var rt=t._hoverdata,it=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,n=c.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):S&&t[i+"Label"]===m?r=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",u).call(_.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(_.setPosition,0,0);var h=e.select("text.name"),g=0;n&&n!==r?(h.style("fill",l).text(n).call(_.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(_.setPosition,0,0),g=h.node().getBoundingClientRect().width+2*D):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var v,M,A=f.node().getBoundingClientRect(),E=t.xa._offset+(t.x0+t.x1)/2,L=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),C=A.width+I+D+g;t.ty0=b-A.top,t.bx=A.width+2*D,t.by=A.height+2*D,t.anchor="start",t.txwidth=A.width,t.tx2width=g,t.offset=0,a?(t.pos=E,v=k>=L+P/2+C,M=L-P/2-C>=0,"top"!==t.idealAlign&&v||!M?v?(L+=P/2,t.anchor="start"):t.anchor="middle":(L-=P/2,t.anchor="end")):(t.pos=L,v=w>=E+z/2+C,M=E-z/2-C>=0,"left"!==t.idealAlign&&v||!M?v?(E+=z/2,t.anchor="start"):t.anchor="middle":(E-=z/2,t.anchor="end")),f.attr("text-anchor",t.anchor),g&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+E+","+L+")"+(a?"rotate("+T+")":""))}),L}function c(t,e){function n(t){ -var e=t[0],n=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,a=n.pos+n.dp+n.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;r=!1}if(!(.01>a)){if(-.01>i){for(s=t.length-1;s>=0;s--)t[s].dp-=a;r=!1}if(r){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(0>=u);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=u);o++)if(l=t[o],l.pos=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(0>=u);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var r,i,a,o,s,l,u,c=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?E:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&c<=t.length;){for(c++,r=!0,o=0;o.01&&p.pmin===m.pmin&&p.pmax===m.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;r=!1}else o++}f.forEach(n)}for(o=f.length-1;o>=0;o--){var g=f[o];for(s=g.length-1;s>=0;s--){var v=g[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=d.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,i=n.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(I+D),s=o+a*(t.txwidth+D),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-z,l=t.offset*L),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*I+l)+","+(I+u)+"v"+(t.by/2-I)+"h"+r*t.bx+"v-"+t.by+"H"+(r*I+l)+"V"+(u-I)+"Z"),i.call(_.setPosition,o+l,u+t.ty0-t.by/2+D).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(_.setPosition,s+a*D+l,u+t.ty0-t.by/2+D),n.select("rect").call(_.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var i=n[r],a=t._hoverdata[r];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),m=t("fast-isnumeric"),g=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),_=t("../../components/drawing"),b=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),S=e.exports={};S.unhover=b.unhover,S.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},S.supplyLayoutDefaults=function(t,e,n){function r(n,r){return g.coerce(t,e,S.layoutAttributes,n,r)}r("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=S.isHoriz(n);i=a?"y":"x"}else i="closest";r("hovermode",i)},S.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+M.HOVERMINTIME?(o(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},S.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||a(e,n):"x"===t?e:n},S.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indext*e||0===t?M.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":196,"../../components/dragelement":217,"../../components/drawing":219,"../../lib":273,"../../lib/events":271,"../../lib/svg_text_utils":284,"./axes":294,"./constants":299,"./dragbox":300,d3:13,"fast-isnumeric":15,tinycolor2:191}],302:[function(t,e,n){"use strict";var r=t("../plots"),i=t("./constants");n.name="cartesian",n.attr=["xaxis","yaxis"],n.idRoot=["x","y"],n.idRegex=i.idRegex,n.attrRegex=i.attrRegex,n.attributes=t("./attributes"),n.plot=function(t){function e(t,e){for(var n=[],r=0;rf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":273,"fast-isnumeric":15}],307:[function(t,e,n){"use strict";function r(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,n,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function d(t,e){return t-e}var p,m=i.gd._fullLayout._zoomlayer,g=i.element.getBoundingClientRect(),v=i.plotinfo.x()._offset,y=i.plotinfo.y()._offset,x=e-g.left,_=n-g.top,b=x,w=_,M="M"+x+","+_,k=i.xaxes[0]._length,S=i.yaxes[0]._length,T=i.xaxes.map(r),A=i.yaxes.map(r),E=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[x,_]],s.BENDPX));var L=m.selectAll("path.select-outline").data([1,2]);L.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var z,I,D,P,C,O=m.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),F=[],R=i.gd,N=[];for(z=0;z0)return Math.log(e)/Math.LN10;if(0>=e&&n&&t.range&&2===t.range.length){var r=t.range[0],i=t.range[1];return.5*(r+i-3*c*Math.abs(r-i))}return o.BADNUM}function n(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):o.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?n:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var r=l.getFromId(t._gd,t.overlaying);t.domain=r.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)i(t.range[e])||(t.range[e]=i(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?r.round(t._b+t._m*e,2):o.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):o.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?a.ms2DateTime(t):o.BADNUM},t.d2c=function(t){return i(t)?Number(t):a.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(a.dateTime2ms);!i(t.range[0])&&i(f[0])&&(t.range[0]=f[0]),!i(t.range[1])&&i(f[1])&&(t.range[1]=f[1])}catch(h){a.error(h,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var n=t._categories.indexOf(e);return-1===n?o.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,i,a;if(n in e)for(r=e[n],i=new Array(r.length),a=0;a0}function a(t){var e={},n={};switch(t.type){case"circle":s.extendFlat(n,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(n,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(n,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var r=t.symbol,i=l(r.textposition,r.iconsize);s.extendFlat(e,{"icon-image":r.icon+"-15","icon-size":r.iconsize/10,"text-field":r.text,"text-size":r.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(n,{"icon-color":t.color,"text-color":r.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:n}}function o(t){var e,n=t.sourcetype,r=t.source,i={type:n},a="string"==typeof r;return"geojson"===n?e="data":"vector"===n&&(e=a?"url":"tiles"),i[e]=r,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=r.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var n=o(t);e.addSource(this.idSource,n)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var n={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",n)}},u.updateStyle=function(t){var e=a(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,n){var i=new r(t,e);return i.update(n),i}},{"../../lib":273,"./convert_text_opts":315}],318:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../font_attributes"),o=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},accesstoken:{valType:"string",noBlank:!0,strict:!0},style:{valType:"any",values:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],dflt:"basic"},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},layers:{_isLinkedToArray:!0,sourcetype:{valType:"enumerated",values:["geojson","vector"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},type:{valType:"enumerated",values:["circle","line","fill","symbol"],dflt:"circle"},below:{valType:"string",dflt:""},color:{valType:"color",dflt:i},opacity:{valType:"number",min:0,max:1,dflt:1},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2}},fill:{outlinecolor:{valType:"color",dflt:i}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},textfont:r.extendDeep({},a,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:r.extendFlat({},o,{arrayOk:!1})}}}},{"../../components/color":196,"../../lib":273,"../../traces/scatter/attributes":337,"../font_attributes":312}],319:[function(t,e,n){"use strict";function r(t,e,n){n("accesstoken"),n("style"),n("center.lon"),n("center.lat"),n("zoom"),n("bearing"),n("pitch"),i(t,e),e._input=t}function i(t,e){function n(t,e){return a.coerce(r,i,s.layers,t,e)}for(var r,i,o=t.layers||[],l=e.layers=[],u=0;u=e.width-20?(a["text-anchor"]="start",a.x=5):(a["text-anchor"]="end",a.x=e._paper.attr("width")-7),n.attr(a);var o=n.select(".js-link-to-tool"),s=n.select(".js-link-spacer"),u=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&i(t,o),s.text(o.text()&&u.text()?" - ":"")},d.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=l.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=r.append("input").attr({type:"text",name:"data"});return i.node().value=d.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},d.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},i=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];d.supplyLayoutGlobalDefaults(i,r),r._dataLength=l.length,d.supplyDataDefaults(l,s,r),r._has=d._hasPlotType.bind(r);var u=r._modules;for(e=0;ea&&(e=(n-1)/(i.l+i.r),i.l=Math.floor(e*i.l),i.r=Math.floor(e*i.r)),0>o&&(e=(r-1)/(i.t+i.b),i.t=Math.floor(e*i.t),i.b=Math.floor(e*i.b))}},d.autoMargin=function(t,e,n){var r=t._fullLayout;if(r._pushmargin||(r._pushmargin={}),r.margin.autoexpand!==!1){if(n){var i=void 0===n.pad?12:n.pad;n.l+n.r>.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+i},r:{val:n.x,size:n.r+i},b:{val:n.y,size:n.b+i},t:{val:n.y,size:n.t+i}}}else delete r._pushmargin[e];t._replotting||d.doAutoMargin(t)}},d.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;return e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var n=l[t].l||{},r=l[t].b||{},c=n.val,f=n.size,h=r.val,d=r.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var n=l[t].r.val,r=l[t].r.size;if(n>c){var p=(f*n+(r-e.width)*c)/(n-c),m=(r*(1-c)+(f-e.width)*(1-n))/(n-c);p>=0&&m>=0&&p+m>i+a&&(i=p,a=m)}}if(u(d)&&l[t].t){var g=l[t].t.val,v=l[t].t.size;if(g>h){var y=(d*g+(v-e.height)*h)/(g-h),x=(v*(1-h)+(d-e.height)*(1-g))/(g-h);y>=0&&x>=0&&y+x>s+o&&(s=y,o=x)}}})})),n.l=Math.round(i),n.r=Math.round(a),n.t=Math.round(o),n.b=Math.round(s),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,t._replotting||"{}"===r||r===JSON.stringify(e._size)?void 0:c.plot(t)},d.graphJson=function(t,e,n,r,i){function a(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,r,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):t&&t.getTime?f.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&d.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var n=a(t);return e&&delete n.fit,n})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===r?l:JSON.stringify(l)}},{"../components/color":196,"../lib":273,"../plotly":291,"./attributes":292,"./font_attributes":312,"./layout_attributes":313,d3:13,"fast-isnumeric":15}],322:[function(t,e,n){"use strict";var r=t("../../traces/scatter/attributes"),i=r.marker;e.exports={r:r.r,t:r.t,marker:{color:i.color,size:i.size,symbol:i.symbol,opacity:i.opacity}}},{"../../traces/scatter/attributes":337}],323:[function(t,e,n){"use strict";function r(t,e){var n={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return a({},e,n)}var i=t("../cartesian/layout_attributes"),a=t("../../lib/extend").extendFlat,o=a({},i.domain,{});e.exports={radialaxis:r("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:o,orientation:{valType:"number"}}),angularaxis:r("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:o}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":272,"../cartesian/layout_attributes":303}],324:[function(t,e,n){var r=t("../../plotly"),i=t("d3"),a=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},o=r.Lib.extendDeepAll;a.Axis=function(){function t(t){n=t||n;var u=l.data,f=l.layout;return("string"==typeof n||n.nodeName)&&(n=i.select(n)),n.datum(u).each(function(t,n){function l(t,e){return s(t)%360+f.orientation}var u=t.slice();c={data:a.util.cloneJson(u),layout:a.util.cloneJson(f)};var h=0;u.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[h],h=(h+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:i.rgb(t.color).darker().toString()),c.data[e].color=t.color,c.data[e].strokeColor=t.strokeColor,c.data[e].strokeDash=t.strokeDash,c.data[e].strokeSize=t.strokeSize});var d=u.filter(function(t,e){var n=t.visible;return"undefined"==typeof n||n===!0}),p=!1,m=d.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var g=i.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(m),v=[],y=g.map(function(t,e){if("unstacked"===t.key)return t.values;var n=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,r){t.yStack=[n],v.push(n),n=a.util.sumArrays(t.r,n)}),t.values});d=i.merge(y)}d.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var x=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;x=Math.max(10,x);var _,b=[f.margin.left+x,f.margin.top+x];if(p){var w=i.max(a.util.sumArrays(a.util.arrayLast(d).r[0],a.util.arrayLast(v)));_=[0,w]}else _=i.extent(a.util.flattenArray(d.map(function(t,e){return t.r})));f.radialAxis.domain!=a.DATAEXTENT&&(_[0]=0),r=i.scale.linear().domain(f.radialAxis.domain!=a.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:_).range([0,x]),c.layout.radialAxis.domain=r.domain();var M,k=a.util.flattenArray(d.map(function(t,e){return t.t})),S="string"==typeof k[0];S&&(k=a.util.deduplicate(k),M=k.slice(),k=i.range(k.length),d=d.map(function(t,e){var n=t;return t.t=[k],p&&(n.yStack=t.yStack),n}));var T=d.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===d.length,A=null===f.needsEndSpacing?S||!T:f.needsEndSpacing,E=f.angularAxis.domain&&f.angularAxis.domain!=a.DATAEXTENT&&!S&&f.angularAxis.domain[0]>=0,L=E?f.angularAxis.domain:i.extent(k),z=Math.abs(k[1]-k[0]);T&&!S&&(z=0);var I=L.slice();A&&S&&(I[1]+=z);var D=f.angularAxis.ticksCount||4;D>8&&(D=D/(D/8)+D%8),f.angularAxis.ticksStep&&(D=(I[1]-I[0])/D);var P=f.angularAxis.ticksStep||(I[1]-I[0])/(D*(f.minorTicks+1));M&&(P=Math.max(Math.round(P),1)),I[2]||(I[2]=P);var C=i.range.apply(this,I);if(C=C.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=i.scale.linear().domain(I.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=A?z:0,e=i.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var O="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",F=(new DOMParser).parseFromString(O,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(F.documentElement,!0));e=i.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var N,j=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){N=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var n=a.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});a.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},a.Legend.defaultConfig().legendConfig,{container:N,elements:V,reverseOrder:f.legend.reverseOrder})})();var U=N.node().getBBox();x=Math.min(f.width-U.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),b=[f.margin.left+x,f.margin.top+x],r.range([0,x]),c.layout.radialAxis.domain=r.domain(),N.attr("transform","translate("+[b[0]+x,b[1]-x]+")")}else N=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+b+")").style({cursor:"crosshair"});var Z=[(f.width-(f.margin.left+f.margin.right+2*x+(U?U.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Z[0]=Math.max(0,Z[0]),Z[1]=Math.max(0,Z[1]),e.select(".outer-group").attr("transform","translate("+Z+")"),f.title){var H=e.select("g.title-group text").style(q).text(f.title),G=H.node().getBBox();H.attr({x:b[0]-G.width/2,y:b[1]-x-20})}var X=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=X.selectAll("circle.grid-circle").data(r.ticks(5));Y.enter().append("circle").attr({"class":"grid-circle"}).style(B),Y.attr("r",r),Y.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var J=i.svg.axis().scale(r).ticks(5).tickSize(5);X.call(J).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(B),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(C),Q=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),Q.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(q);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=l(t,e),r=x+f.labelOffset,i=f.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-n+" "+r+" 0)":"radial"==i?270>n&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(180>=n&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":M?M[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=i.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));N.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(nt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),d[0]||et){var rt=[];d.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=s,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var it=i.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(a[n].defaultConfig(),t)});a[n]().config(r)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=a.tooltipPanel().config({container:ut,fontSize:8})(),ft=a.tooltipPanel().config({container:ut,fontSize:8})(),ht=a.tooltipPanel().config({container:ut,hasTick:!0})();if(!S){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var n=a.util.getMousePos(W).angle;dt.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;ot=s.invert(r);var i=a.util.convertToCartesian(x+12,n+180);ct.text(a.util.round(ot)).move([i[0]+b[0],i[1]+b[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var n=a.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),st=r.invert(a.util.getMousePos(W).radius);var i=a.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(a.util.round(st)).move([i[0]+b[0],i[1]+b[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var r=i.select(this),o=r.style("fill"),s="black",l=r.style("opacity")||1;if(r.attr({"data-opacity":l}),"none"!=o){r.attr({"data-fill":o}),s=i.hsl(o).darker().toString(),r.style({fill:s,opacity:1});var u={t:a.util.round(t[0]),r:a.util.round(t[1])};S&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-Z[0]-h.left,f.top+f.height/2-Z[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else o=r.style("stroke"),r.attr({"data-stroke":o}),s=i.hsl(o).darker().toString(),r.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=i.event.which?!1:void(i.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.hide();var n=i.select(this),r=n.attr("data-fill");r?n.style({fill:r,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),h}var e,n,r,s,l={data:[],layout:{}},u={},c={},f=i.dispatch("hover"),h={};return h.render=function(e){return t(e),this},h.config=function(t){if(!arguments.length)return l;var e=a.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),o(l.data[e],a.Axis.defaultConfig().data[0]),o(l.data[e],t)}),o(l.layout,a.Axis.defaultConfig().layout),o(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return r},h.angularScale=function(t){return s},h.svg=function(){return e},i.rebind(h,f,"on"),h},a.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:i.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},a.util={},a.DATAEXTENT="dataExtent",a.AREA="AreaChart",a.LINE="LinePlot",a.DOT="DotPlot",a.BAR="BarChart",a.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},a.util._extend=function(t,e){for(var n in t)e[n]=t[n]},a.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},a.util.dataFromEquation2=function(t,e){var n=e||6,r=i.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,i=t(r);return[e,i]});return r},a.util.dataFromEquation=function(t,e,n){var r=e||6,a=[],o=[];i.range(0,360+r,r).forEach(function(e,n){var r=e*Math.PI/180,i=t(r);a.push(e),o.push(i)});var s={t:a,r:o};return n&&(s.name=n),s},a.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return i.range(e).map(function(t,e){return n[e]||n[0]})},a.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=a.util.ensureArray(t[e],n)}),t},a.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},a.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},a.util.sumArrays=function(t,e){return i.zip(t,e).map(function(t,e){return i.sum(t)})},a.util.arrayLast=function(t){return t[t.length-1]},a.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return-2===n},a.util.flattenArray=function(t){for(var e=[];!a.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},a.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},a.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),i=t*Math.sin(n);return[r,i]},a.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},a.util.getMousePos=function(t){var e=i.mouse(t.node()),n=e[0],r=e[1],a={};return a.x=n,a.y=r,a.pos=e,a.angle=180*(Math.atan2(r,n)+Math.PI)/Math.PI,a.radius=Math.sqrt(n*n+r*r),a},a.util.duplicatesCount=function(t){for(var e,n={},r={},i=0,a=t.length;a>i;i++)e=t[i],e in n?(n[e]++,r[e]=n[e]):n[e]=1;return r},a.util.duplicates=function(t){return Object.keys(a.util.duplicatesCount(t))},a.util.translator=function(t,e,n,r){if(r){var i=n.slice();n=e,e=i}var a=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof a&&(e.reduce(function(t,n,r){return"undefined"!=typeof t?(r===e.length-1&&delete t[n],t[n]):void 0},t),n.reduce(function(t,e,r){return"undefined"==typeof t[e]&&(t[e]={}),r===n.length-1&&(t[e]=a),t[e]},t))},a.PolyChart=function(){function t(){var t=n[0].geometryConfig,e=t.container;"string"==typeof e&&(e=i.select(e)),e.datum(n).each(function(e,n){function r(e,n){var r=t.radialScale(e[1]),i=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:r,t:i}}function a(t){var e=t.r*Math.cos(t.t),n=t.r*Math.sin(t.t);return{x:e,y:n}}var o=!!e[0].data.yStack,l=e.map(function(t,e){return o?i.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):i.zip(t.data.t[0],t.data.r[0]); -}),u=t.angularScale,c=t.radialScale.domain()[0],f={};f.bar=function(n,r,a){var o=e[a].data,s=t.radialScale(n[1])-t.radialScale(0),l=t.radialScale(n[2]||0),c=o.barWidth;i.select(this).attr({"class":"mark bar",d:"M"+[[s+l,-c/2],[s+l,c/2],[l,c/2],[l,-c/2]].join("L")+"Z",transform:function(e,n){return"rotate("+(t.orientation+u(e[0]))+")"}})},f.dot=function(t,n,o){var s=t[2]?[t[0],t[1]+t[2]]:t,l=i.svg.symbol().size(e[o].data.dotSize).type(e[o].data.dotType)(t,n);i.select(this).attr({"class":"mark dot",d:l,transform:function(t,e){var n=a(r(s));return"translate("+[n.x,n.y]+")"}})};var h=i.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(n,r,a){var o=n[2]?l[a].map(function(t,e){return[t[0],t[1]+t[2]]}):l[a];if(i.select(this).each(f.dot).style({opacity:function(t,n){return+e[a].data.dotVisible},fill:g.stroke(n,r,a)}).attr({"class":"mark dot"}),!(r>0)){var s=i.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({"class":"line",d:h(o),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return g.fill(n,r,a)},"fill-opacity":0,stroke:function(t,e){return g.stroke(n,r,a)},"stroke-width":function(t,e){return g["stroke-width"](n,r,a)},"stroke-dasharray":function(t,e){return g["stroke-dasharray"](n,r,a)},opacity:function(t,e){return g.opacity(n,r,a)},display:function(t,e){return g.display(n,r,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,m=i.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,r){i.select(this).attr({"class":"mark arc",d:m,transform:function(e,n){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var g={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return s[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=i.select(this).selectAll("g.layer").data(l);v.enter().append("g").attr({"class":"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(g).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[a.PolyChart.defaultConfig()],r=i.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],a.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},i.rebind(t,r,"on"),t},a.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:i.scale.category20()}};return t},a.BarChart=function(){return a.PolyChart()},a.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},a.AreaChart=function(){return a.PolyChart()},a.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},a.DotPlot=function(){return a.PolyChart()},a.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},a.LinePlot=function(){return a.PolyChart()},a.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},a.Legend=function(){function t(){var n=e.legendConfig,r=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var i=o({},n.elements[e]);return i.name=t,i.color=[].concat(n.elements[e].color)[r],i})}),a=i.merge(r);a=a.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(a=a.reverse());var s=n.container;("string"==typeof s||s.nodeName)&&(s=i.select(s));var l=a.map(function(t,e){return t.color}),u=n.fontSize,c=null==n.isContinuous?"number"==typeof a[0]:n.isContinuous,f=c?n.height:u*a.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var m=i.range(a.length),g=i.scale[c?"linear":"ordinal"]().domain(m).range(l),v=i.scale[c?"linear":"ordinal"]().domain(m)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=i.svg.symbolTypes.indexOf(t)?i.svg.symbol().type(t).size(n)():i.svg.symbol().type("square").size(n)()};if(c){var x=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var _=d.select(".legend-marks").selectAll("path.legend-mark").data(a);_.enter().append("path").classed("legend-mark",!0),_.attr({transform:function(t,e){return"translate("+[u/2,v(e)+u/2]+")"},d:function(t,e){var n=t.symbol;return y(n,u)},fill:function(t,e){return g(e)}}),_.exit().remove()}var b=i.svg.axis().scale(v).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?n.colorBandWidth:u,u/2]+")"}).call(b);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return a[e].name}),t}var e=a.Legend.defaultConfig(),n=i.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},i.rebind(t,n,"on"),t},a.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},a.tooltipPanel=function(){var t,e,n,r={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+a.tooltipPanel.uid++,l=10,u=function(){t=r.container.selectAll("g."+s).data([0]);var i=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return n=i.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=i.append("text").attr({dx:r.padding+l,dy:.3*+r.fontSize}),u};return u.text=function(a){var o=i.hsl(r.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":r.fontSize+"px"}).text(f);var h=r.padding,d=e.node().getBBox(),p={fill:r.color,stroke:s,"stroke-width":"2px"},m=d.width+2*h+l,g=d.height+2*h;return n.attr({d:"M"+[[l,-g/2],[l,-g/4],[r.hasTick?0:l,0],[l,g/4],[l,g/2],[m,g/2],[m,-g/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-g/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u):void 0},u.hide=function(){return t?(t.style({display:"none"}),u):void 0},u.show=function(){return t?(t.style({display:"block"}),u):void 0},u.config=function(t){return o(r,t),u},u},a.tooltipPanel.uid=1,a.adapter={},a.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),i=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,n){a.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var r=a.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var i=r.indexOf(t.geometry);-1!=i&&(n.data[e].groupId=i)})}if(t.layout){var s=o({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,n){a.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};i.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),n.layout=s}return n},t}},{"../../plotly":291,"./micropolar_manager":325,d3:13}],325:[function(t,e,n){"use strict";var r=t("../../plotly"),i=t("d3"),a=t("./undo_manager"),o=e.exports={},s=r.Lib.extendDeepAll;o.framework=function(t){function e(e,a){return a&&(f=a),i.select(i.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,u||(u=r.micropolar.Axis()),c=r.micropolar.adapter.plotly().convert(n),u.config(c).render(f),t.data=n.data,t.layout=n.layout,o.fillLayout(t),n}var n,l,u,c,f,h=new a;return e.isPolar=!0,e.svg=function(){return u.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return r.micropolar.adapter.plotly().convert(u.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:u.angularScale(),r:u.radialScale()}},e.setUndoPoint=function(){var t=this,e=r.micropolar.util.cloneJson(n);!function(e,n){h.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,l),l=r.micropolar.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},o.fillLayout=function(t){var e=i.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:r.Color.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(o,t.layout)}},{"../../plotly":291,"./undo_manager":326,d3:13}],326:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,n=[],r=-1,i=!1;return{add:function(t){return i?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=n[r];return i?(t(i,"undo"),r-=1,e&&e(i.undo),this):this},redo:function(){var i=n[r+1];return i?(t(i,"redo"),r+=1,e&&e(i.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return rm;m++){var g=d[m];s=t[g]?t[g]:t[g]={},e[g]=l={},o("domain."+h,[m/p,(m+1)/p]),o("domain."+{x:"y",y:"x"}[h]),a.id=g,f(s,l,o,a)}}},{"../lib":273,"./plots":321}],328:[function(t,e,n){"use strict";function r(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function i(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var a=t("../plotly"),o=a.Lib.extendFlat,s=a.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,l=t.data,u=t.layout,c=s([],l),f=s({},u,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(n=0;np&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var m={padded:!0},g={padded:!0};if(o.hasMarkers(e)){if(n=e.marker,l=n.size,Array.isArray(l)){var v={type:"linear"};i.setConvert(v),l=v.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},m.ppad=g.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(o.hasMarkers(e)||o.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(g.padded=!1):g.tozero=!0,i.expand(c,h,m),i.expand(f,d,g);var _=new Array(p);for(u=0;p>u;u++)_[u]=r(h[u])&&r(d[u])?{x:h[u],y:d[u]}:{x:!1,y:!1};return void 0!==typeof l&&a.mergeArray(l,_,"ms"),t.firstscatter=!1,_}},{"../../lib":273,"../../plots/cartesian/axes":294,"./colorscale_calc":341,"./subtypes":356,"fast-isnumeric":15}],339:[function(t,e,n){"use strict";e.exports=function(t){var e,n,r,i,a;for(e=0;e=0;i--)if(a=t[i],"scatter"===a.type&&a.xaxis===n.xaxis&&a.yaxis===n.yaxis){a.opacity=void 0;break}}},{}],340:[function(t,e,n){"use strict";var r=t("d3"),i=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,u=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void o.autoMargin(t,c);var f=s(u.colorscale),h=u.color,d=u.cmin,p=u.cmax;i(d)||(d=a.aggNums(Math.min,null,h)),i(p)||(p=a.aggNums(Math.max,null,h));var m=e[0].t.cb=l(t,c);m.fillcolor(r.scale.linear().domain(f.map(function(t){return d+t[0]*(p-d)})).range(f.map(function(t){return t[1]}))).filllevels({start:d,end:p,size:(p-d)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":199,"../../components/colorscale/get_scale":208,"../../lib":273,"../../plots/plots":321,d3:13,"fast-isnumeric":15}],341:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("./subtypes");e.exports=function(t){a.hasLines(t)&&r(t,"line")&&i(t,t.line.color,"line","c"),a.hasMarkers(t)&&(r(t,"marker")&&i(t,t.marker.color,"marker","c"),r(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":203,"../../components/colorscale/has_colorscale":209,"./subtypes":356}],342:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],343:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function m(n,a){return r.coerce(t,e,i,n,a)}var g=s(t,e,m),v=gq!=P>=q&&(z=E[T-1][0],I=E[T][0],L=z+(I-z)*(q-D)/(P-D),R=Math.min(R,L),N=Math.max(N,L));R=Math.max(R,0),N=Math.min(N,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),r.extendFlat(t,{distance:a.MAXDIST+10,x0:R,x1:N,y0:q,y1:q,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":196,"../../components/errorbars":225,"../../lib":273,"../../plots/cartesian/constants":299,"../../plots/cartesian/graph_interact":301,"./get_trace_color":345}],347:[function(t,e,n){"use strict";var r={},i=t("./subtypes");r.hasLines=i.hasLines,r.hasMarkers=i.hasMarkers,r.hasText=i.hasText,r.isBubble=i.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":302, -"./arrays_to_calcdata":336,"./attributes":337,"./calc":338,"./clean_data":339,"./colorbar":340,"./defaults":343,"./hover":346,"./plot":353,"./select":354,"./style":355,"./subtypes":356}],348:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,n,a,o){var s=(t.marker||{}).color;if(o("line.color",n),r(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||n;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":206,"../../components/colorscale/has_colorscale":209}],349:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=M.c2p(t[e].y);return n===E||r===E?!1:[n,r]}function i(t){var e=t[0]/w._length,n=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*S}function a(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var o,s,l,u,c,f,h,d,p,m,g,v,y,x,_,b,w=e.xaxis,M=e.yaxis,k=e.connectGaps,S=e.baseTolerance,T=e.linear,A=[],E=r.BADNUM,L=.2,z=new Array(t.length),I=0;for(o=0;oi(f))break;l=f,y=m[0]*p[0]+m[1]*p[1],y>g?(g=y,u=f,d=!1):v>y&&(v=y,c=f,d=!0)}if(d?(z[I++]=u,l!==c&&(z[I++]=c)):(c!==s&&(z[I++]=c),l!==u&&(z[I++]=u)),z[I++]=l,o>=t.length||!f)break;z[I++]=f,s=f}}else z[I++]=u}A.push(z.slice(0,I))}return A}},{"../../plots/cartesian/axes":294}],350:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],351:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t){var e=t.marker,n=e.sizeref||1,i=e.sizemin||0,a="area"===e.sizemode?function(t){return Math.sqrt(t/n)}:function(t){return t/n};return function(t){var e=a(t/2);return r(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":15}],352:[function(t,e,n){"use strict";var r=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,n,s,l){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(n=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",n),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?r.background:r.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":196,"../../components/colorscale/defaults":206,"../../components/colorscale/has_colorscale":209,"./subtypes":356}],353:[function(t,e,n){"use strict";function r(t,e,n){var r=e.x(),a=e.y(),o=i.extent(r.range.map(r.l2c)),s=i.extent(a.range.map(a.l2c));n.forEach(function(t,e){var r=t[0].trace;if(u.hasMarkers(r)){var i=r.marker.maxdisplayed;if(0!==i){var a=t.filter(function(t){return t.x>=o[0]&&t.x<=o[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(a.length/i),c=0;n.forEach(function(t,n){var r=t[0].trace;u.hasMarkers(r)&&r.marker.maxdisplayed>0&&e>n&&c++});var f=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),a.forEach(function(t,e){0===Math.round((e+f)%l)&&(t.vis=!0)})}}})}var i=t("d3"),a=t("../../lib"),o=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,n){function h(t){return t.filter(function(t){return t.vis})}r(t,e,n);var d=e.x(),p=e.y(),m=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(n);m.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),m.call(s.plot,e);var g,v,y,x,_="",b=[];m.each(function(t){var e=t[0].trace,n=e.line,r=i.select(this);if(e.visible===!0&&(v=e.fill.charAt(e.fill.length-1),"x"!==v&&"y"!==v&&(v=""),t[0].node3=r,c(t),u.hasLines(e)||"none"!==e.fill)){var a,s,h,m,w,M="",k="";g="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!_?r.append("path").classed("js-fill",!0):null,x&&(y=x.datum(t)),x=r.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(n.shape)?(h=o.steps(n.shape),m=o.steps(n.shape.split("").reverse().join(""))):h=m="spline"===n.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?o.smoothclosed(t.slice(1),n.smoothing):o.smoothopen(t,n.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return m(t.reverse())};var S,T=f(t,{xaxis:d,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(n.width||1,3)/4,linear:"linear"===n.shape}),A=e._polygons=new Array(T.length);for(S=0;S1&&r.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",a)}g?E&&z&&(v?("y"===v?E[1]=z[1]=p.c2p(0,!0):"x"===v&&(E[0]=z[0]=d.c2p(0,!0)),g.attr("d",M+"L"+z+"L"+E+"Z")):g.attr("d",M+"Z")):"tonext"===e.fill.substr(0,6)&&M&&_&&("tonext"===e.fill?y.attr("d",M+"Z"+_+"Z"):y.attr("d",M+"L"+_.substr(1)+"Z"),e._polygons=e._polygons.concat(b)),_=k,b=A}}}),m.selectAll("path:not([d])").remove(),m.append("g").attr("class","points").each(function(t){var e=t[0].trace,n=i.select(this),r=u.hasMarkers(e),s=u.hasText(e);!r&&!s||e.visible!==!0?n.remove():(r&&n.selectAll("path.point").data(e.marker.maxdisplayed?h:a.identity).enter().append("path").classed("point",!0).call(o.translatePoints,d,p),s&&n.selectAll("g").data(e.marker.maxdisplayed?h:a.identity).enter().append("g").append("text").call(o.translatePoints,d,p))})}},{"../../components/drawing":219,"../../components/errorbars":225,"../../lib":273,"../../lib/polygon":279,"./arrays_to_calcdata":336,"./line_points":349,"./subtypes":356,d3:13}],354:[function(t,e,n){"use strict";var r=t("./subtypes"),i=.2;e.exports=function(t,e){var n,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,m=!r.hasMarkers(h)&&!r.hasText(h);if(h.visible===!0&&!m){var g=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;n_;_++){var b=e.lon[_],w=e.lat[_];if(r(b)&&r(w)){var M={};if(x++,M.lonlat=[+b,+w],f){if(h){var k=c.color[_];M.mc=k,M.mcc=g(k)}if(d){var S=c.size[_];M.ms=S,M.mrc=v(S)}if(p){var T=c.symbol[_];M.mx="string"==typeof T?T:"circle"}}if(m){var A=e.text[_];M.tx="string"==typeof A?A:""}y.push(M)}else x>0&&(y[x-1].gapAfter=!0)}return y}},{"../../components/colorscale/has_colorscale":209,"../../components/colorscale/make_scale_function":213,"../../lib":273,"../scatter/colorscale_calc":341,"../scatter/make_bubble_size_func":351,"../scatter/subtypes":356,"fast-isnumeric":15}],362:[function(t,e,n){"use strict";function r(){return{geojson:i(),layout:{visibility:"none"},paint:{}}}function i(){return{type:"Point",coordinates:[]}}function a(t,e){return{type:"Polygon",coordinates:e}}function o(t,e){return{type:"MultiLineString",coordinates:e}}function s(t,e){function n(t,n,r,i){void 0===e[n][r]&&(e[n][r]=i),t[n]=e[n][r]}for(var r=t[0].trace,i=r.marker,a=Array.isArray(i.color),o=Array.isArray(i.size),s=[],l=0;l0&&(r.push(i),i=[])}return r.push(i),r}function h(t){return Array.isArray(t)?function(t){return t}:t?function(){return t}:d}function d(){return""}var p=t("../../lib"),m=t("../scatter/subtypes"),g=t("../../plots/mapbox/convert_text_opts"),v="circle-color",y="circle-radius";e.exports=function(t){var e=t[0].trace,n=e.visible===!0,i="none"!==e.fill,h=m.hasLines(e),d=m.hasMarkers(e),x=m.hasText(e),_=d&&"circle"===e.marker.symbol,b=d&&"circle"!==e.marker.symbol,w=r(),M=r(),k=r(),S=r(),T={fill:w,line:M,circle:k,symbol:S};if(!n)return T;var A;if((i||h)&&(A=f(t)),i&&(w.geojson=a(t,A),w.layout.visibility="visible",p.extendFlat(w.paint,{"fill-color":e.fillcolor})),h&&(M.geojson=o(t,A),M.layout.visibility="visible",p.extendFlat(M.paint,{"line-width":e.line.width,"line-color":e.line.color,"line-opacity":e.opacity})),_){var E={};E[v]={},E[y]={},k.geojson=s(t,E),k.layout.visibility="visible",p.extendFlat(k.paint,{"circle-opacity":e.opacity*e.marker.opacity,"circle-color":u(e,E),"circle-radius":c(e,E)})}if((b||x)&&(S.geojson=l(t),p.extendFlat(S.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),b&&(p.extendFlat(S.layout,{"icon-size":e.marker.size/10}),p.extendFlat(S.paint,{"icon-opacity":e.opacity*e.marker.opacity,"icon-color":e.marker.color})),x)){var L=(e.marker||{}).size,z=g(e.textposition,L);p.extendFlat(S.layout,{"text-size":e.textfont.size,"text-anchor":z.anchor,"text-offset":z.offset}),p.extendFlat(S.paint,{"text-color":e.textfont.color,"text-opacity":e.opacity})}return T}},{"../../lib":273,"../../plots/mapbox/convert_text_opts":315,"../scatter/subtypes":356}],363:[function(t,e,n){"use strict";function r(t,e,n){var r=n("lon")||[],i=n("lat")||[],a=Math.min(r.length,i.length);return a")}var i=t("../../plots/cartesian/graph_interact"),a=t("../scatter/get_trace_color");e.exports=function(t,e,n){function o(t){var e=t.lonlat,r=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],n])),a=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(r*r+i*i)-a,1-3/a)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya,f=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),h=360*f,d=e-h;if(i.getClosest(s,o,t),t.index!==!1){var p=s[t.index],m=p.lonlat,g=[m[0]+h,m[1]],v=u.c2p(g),y=c.c2p(g),x=p.mrc||1;return t.x0=v-x,t.x1=v+x,t.y0=y-x,t.y1=y+x,t.color=a(l,p),t.extraText=r(l,p),[t]}}},{"../../plots/cartesian/graph_interact":301,"../scatter/get_trace_color":345}],365:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("./calc"),r.hoverPoints=t("./hover"),r.plot=t("./plot"),r.moduleType="trace",r.name="scattermapbox",r.basePlotModule=t("../../plots/mapbox"),r.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],r.meta={},e.exports=r},{"../../plots/mapbox":316,"../scatter/colorbar":340,"./attributes":360,"./calc":361,"./defaults":363,"./hover":364,"./plot":366}],366:[function(t,e,n){"use strict";function r(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.sourceFill=t.createGeoJSONSource(),this.map.addSource(this.idSourceFill,this.sourceFill),this.sourceLine=t.createGeoJSONSource(),this.map.addSource(this.idSourceLine,this.sourceLine),this.sourceCircle=t.createGeoJSONSource(),this.map.addSource(this.idSourceCircle,this.sourceCircle),this.sourceSymbol=t.createGeoJSONSource(),this.map.addSource(this.idSourceSymbol,this.sourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var a=t("./convert"),o=r.prototype;o.update=function(t){var e=this.mapbox,n=a(t);e.setOptions(this.idLayerFill,"setLayoutProperty",n.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",n.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",n.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",n.symbol.layout),i(n.fill)&&(this.sourceFill.setData(n.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",n.fill.paint)),i(n.line)&&(this.sourceLine.setData(n.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",n.line.paint)),i(n.circle)&&(this.sourceCircle.setData(n.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",n.circle.paint)),i(n.symbol)&&(this.sourceSymbol.setData(n.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",n.symbol.paint))},o.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var n=e[0].trace,i=new r(t,n.uid);return i.update(e),i}},{"./convert":362}]},{},[4])(4)}); \ No newline at end of file +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;at||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,o,l,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[t],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),u=n.slice(),r=u.length,l=0;r>l;l++)u[l].apply(this,o);return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(n)){for(s=o;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],7:[function(t,e,n){"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 n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],8:[function(t,e,n){(function(t){function e(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(n=a+"/"+n,i="/"===a.charAt(0))}return n=e(r(n.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(t){var i=n.isAbsolute(t),o="/"===a(t,-1);return t=e(r(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},n.isAbsolute=function(t){return"/"===t.charAt(0)},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},n.relative=function(t,e){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),o=r(e.split("/")),a=Math.min(i.length,o.length),s=a,l=0;a>l;l++)if(i[l]!==o[l]){s=l;break}for(var u=[],l=s;le&&(e=t.length+e),t.substr(e,n)}}).call(this,t("_process"))},{_process:9}],9:[function(t,e,n){function r(){c=!1,s.length?u=s.concat(u):f=-1,u.length&&i()}function i(){if(!c){var t=setTimeout(r);c=!0;for(var e=u.length;e;){for(s=u,u=[];++f1)for(var n=1;n1&&(r=n[0]+"@",t=n[1]),t=t.replace(D,".");var i=t.split("."),o=a(i,e).join(".");return r+o}function l(t){for(var e,n,r=[],i=0,o=t.length;o>i;)e=t.charCodeAt(i++),e>=55296&&56319>=e&&o>i?(n=t.charCodeAt(i++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),i--)):r.push(e);return r}function u(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=F(t>>>10&1023|55296),t=56320|1023&t),e+=F(t)}).join("")}function c(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:M}function f(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function h(t,e,n){var r=0;for(t=n?j(t/T):t>>1,t+=j(t/e);t>O*A>>1;r+=M)t=j(t/O);return j(r+(O+1)*t/(t+S))}function d(t){var e,n,r,i,a,s,l,f,d,p,m=[],g=t.length,y=0,v=E,x=z;for(n=t.lastIndexOf(L),0>n&&(n=0),r=0;n>r;++r)t.charCodeAt(r)>=128&&o("not-basic"),m.push(t.charCodeAt(r));for(i=n>0?n+1:0;g>i;){for(a=y,s=1,l=M;i>=g&&o("invalid-input"),f=c(t.charCodeAt(i++)),(f>=M||f>j((w-y)/s))&&o("overflow"),y+=f*s,d=x>=l?k:l>=x+A?A:l-x,!(d>f);l+=M)p=M-d,s>j(w/p)&&o("overflow"),s*=p;e=m.length+1,x=h(y-a,e,0==a),j(y/e)>w-v&&o("overflow"),v+=j(y/e),y%=e,m.splice(y++,0,v)}return u(m)}function p(t){var e,n,r,i,a,s,u,c,d,p,m,g,y,v,x,b=[];for(t=l(t),g=t.length,e=E,n=0,a=z,s=0;g>s;++s)m=t[s],128>m&&b.push(F(m));for(r=i=b.length,i&&b.push(L);g>r;){for(u=w,s=0;g>s;++s)m=t[s],m>=e&&u>m&&(u=m);for(y=r+1,u-e>j((w-n)/y)&&o("overflow"),n+=(u-e)*y,e=u,s=0;g>s;++s)if(m=t[s],e>m&&++n>w&&o("overflow"),m==e){for(c=n,d=M;p=a>=d?k:d>=a+A?A:d-a,!(p>c);d+=M)x=c-p,v=M-p,b.push(F(f(p+x%v,0))),c=j(x/v);b.push(F(f(c,0))),a=h(n,y,r==i),n=0,++r}++n,++e}return b.join("")}function m(t){return s(t,function(t){return I.test(t)?d(t.slice(4).toLowerCase()):t})}function g(t){return s(t,function(t){return P.test(t)?"xn--"+p(t):t})}var y="object"==typeof r&&r&&!r.nodeType&&r,v="object"==typeof n&&n&&!n.nodeType&&n,x="object"==typeof e&&e;x.global!==x&&x.window!==x&&x.self!==x||(i=x);var b,_,w=2147483647,M=36,k=1,A=26,S=38,T=700,z=72,E=128,L="-",I=/^xn--/,P=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,C={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=M-k,j=Math.floor,F=String.fromCharCode;if(b={version:"1.3.2",ucs2:{decode:l,encode:u},decode:d,encode:p,toASCII:g,toUnicode:m},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(y&&v)if(n.exports==y)v.exports=b;else for(_ in b)b.hasOwnProperty(_)&&(y[_]=b[_]);else i.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(t,e,n){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,n,o){e=e||"&",n=n||"=";var a={};if("string"!=typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var c=0;u>c;++c){var f,h,d,p,m=t[c].replace(s,"%20"),g=m.indexOf(n);g>=0?(f=m.substr(0,g),h=m.substr(g+1)):(f=m,h=""),d=decodeURIComponent(f),p=decodeURIComponent(h),r(a,d)?i(a[d])?a[d].push(p):a[d]=[a[d],p]:a[d]=p}return a};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],12:[function(t,e,n){"use strict";function r(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r",'"',"`"," ","\r","\n"," "],p=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(p),g=["%","/","?",";","#"].concat(m),y=["/","?","#"],v=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=t("querystring");r.prototype.parse=function(t,e,n){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),i=-1!==r&&rz)&&(S=z)}var E,L;L=-1===S?s.lastIndexOf("@"):s.lastIndexOf("@",S),-1!==L&&(E=s.slice(0,L),s=s.slice(L+1),this.auth=decodeURIComponent(E)),S=-1;for(var T=0;Tz)&&(S=z)}-1===S&&(S=s.length),this.host=s.slice(0,S),s=s.slice(S),this.parseHost(),this.hostname=this.hostname||"";var I="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!I)for(var P=this.hostname.split(/\./),T=0,D=P.length;D>T;T++){var C=P[T];if(C&&!C.match(x)){for(var O="",j=0,F=C.length;F>j;j++)O+=C.charCodeAt(j)>127?"x":C[j];if(!O.match(x)){var R=P.slice(0,T),N=P.slice(T+1),B=C.match(b);B&&(R.push(B[1]),N.unshift(B[2])),N.length&&(s="/"+N.join(".")+s),this.hostname=R.join(".");break}}}this.hostname.length>v?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=l.toASCII(this.hostname));var q=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+q,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[p])for(var T=0,D=m.length;D>T;T++){var U=m[T];if(-1!==s.indexOf(U)){var Z=encodeURIComponent(U);Z===U&&(Z=escape(U)),s=s.split(U).join(Z)}}var G=s.indexOf("#");-1!==G&&(this.hash=s.substr(G),s=s.slice(0,G));var H=s.indexOf("?");if(-1!==H?(this.search=s.substr(H),this.query=s.substr(H+1),e&&(this.query=k.parse(this.query)),s=s.slice(0,H)):e&&(this.search="",this.query={}),s&&(this.pathname=s),M[p]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var q=this.pathname||"",X=this.search||"";this.path=q+X}return this.href=this.format(),this},r.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",i=!1,o="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&u.isObject(this.query)&&Object.keys(this.query).length&&(o=k.stringify(this.query));var a=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||M[e])&&i!==!1?(i="//"+(i||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):i||(i=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),a=a.replace("#","%23"),e+i+n+a+r},r.prototype.resolve=function(t){return this.resolveObject(i(t,!1,!0)).format()},r.prototype.resolveObject=function(t){if(u.isString(t)){var e=new r;e.parse(t,!1,!0),t=e}for(var n=new r,i=Object.keys(this),o=0;o0?n.host.split("@"):!1;A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return n.search=t.search,n.query=t.query,u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!_.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=_.slice(-1)[0],T=(n.host||t.host||_.length>1)&&("."===S||".."===S)||""===S,z=0,E=_.length;E>=0;E--)S=_[E],"."===S?_.splice(E,1):".."===S?(_.splice(E,1),z++):z&&(_.splice(E,1),z--);if(!x&&!b)for(;z--;z)_.unshift("..");!x||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),T&&"/"!==_.join("/").substr(-1)&&_.push("");var L=""===_[0]||_[0]&&"/"===_[0].charAt(0);if(k){n.hostname=n.host=L?"":_.length?_.shift():"";var A=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return x=x||n.host&&_.length,x&&!L&&_.unshift(""),_.length?n.pathname=_.join("/"):(n.pathname=null,n.path=null),u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=f.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":15,punycode:10,querystring:13}],15:[function(t,e,n){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],16:[function(t,e,n){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],17:[function(t,e,n){(function(e,r){function i(t,e){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(e)?r.showHidden=e:e&&n._extend(r,e),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),l(r,t,r.depth)}function o(t,e){var n=i.styles[e];return n?"["+i.colors[n][0]+"m"+t+"["+i.colors[n][1]+"m":t}function a(t,e){return t}function s(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function l(t,e,r){if(t.customInspect&&e&&S(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){ +var i=e.inspect(r,t);return x(i)||(i=l(t,i,r)),i}var o=u(t,e);if(o)return o;var a=Object.keys(e),m=s(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),A(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(e);if(0===a.length){if(S(e)){var g=e.name?": "+e.name:"";return t.stylize("[Function"+g+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(k(e))return t.stylize(Date.prototype.toString.call(e),"date");if(A(e))return c(e)}var y="",v=!1,b=["{","}"];if(p(e)&&(v=!0,b=["[","]"]),S(e)){var _=e.name?": "+e.name:"";y=" [Function"+_+"]"}if(w(e)&&(y=" "+RegExp.prototype.toString.call(e)),k(e)&&(y=" "+Date.prototype.toUTCString.call(e)),A(e)&&(y=" "+c(e)),0===a.length&&(!v||0==e.length))return b[0]+y+b[1];if(0>r)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=v?f(t,e,r,m,a):a.map(function(n){return h(t,e,r,m,n,v)}),t.seen.pop(),d(M,y,b)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(x(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return v(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,n,r,i){for(var o=[],a=0,s=e.length;s>a;++a)I(e,String(a))?o.push(h(t,e,n,r,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(h(t,e,n,r,i,!0))}),o}function h(t,e,n,r,i,o){var a,s,u;if(u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},u.get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),I(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=g(n)?l(t,u.value,null):l(t,u.value,n-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n"))):s=t.stylize("[Circular]","special")),_(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function d(t,e,n){var r=0,i=t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function p(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function g(t){return null===t}function y(t){return null==t}function v(t){return"number"==typeof t}function x(t){return"string"==typeof t}function b(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===z(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===z(t)}function A(t){return M(t)&&("[object Error]"===z(t)||t instanceof Error)}function S(t){return"function"==typeof t}function T(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function z(t){return Object.prototype.toString.call(t)}function E(t){return 10>t?"0"+t.toString(10):t.toString(10)}function L(){var t=new Date,e=[E(t.getHours()),E(t.getMinutes()),E(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var P=/%[sdj%]/g;n.format=function(t){if(!x(t)){for(var e=[],n=0;n=o)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return t}}),s=r[n];o>n;s=r[++n])a+=g(s)||!M(s)?" "+s:" "+i(s);return a},n.deprecate=function(t,i){function o(){if(!a){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),a=!0}return t.apply(this,arguments)}if(_(r.process))return function(){return n.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var a=!1;return o};var D,C={};n.debuglog=function(t){if(_(D)&&(D=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!C[t])if(new RegExp("\\b"+t+"\\b","i").test(D)){var r=e.pid;C[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else C[t]=function(){};return C[t]},n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=m,n.isNull=g,n.isNullOrUndefined=y,n.isNumber=v,n.isString=x,n.isSymbol=b,n.isUndefined=_,n.isRegExp=w,n.isObject=M,n.isDate=k,n.isError=A,n.isFunction=S,n.isPrimitive=T,n.isBuffer=t("./support/isBuffer");var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",L(),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!M(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":16,_process:9,inherits:7}],18:[function(e,n,r){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function r(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function a(t){return!isNaN(t)}function s(t){return{left:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);i>r;){var o=r+i>>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);i>r;){var o=r+i>>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function f(){this._=Object.create(null)}function h(t){return(t+="")===Ma||t[0]===ka?ka+t:t}function d(t){return(t+="")[0]===ka?t.slice(1):t}function p(t){return h(t)in this._}function m(t){return(t=h(t))in this._&&delete this._[t]}function g(){var t=[];for(var e in this._)t.push(d(e));return t}function y(){var t=0;for(var e in this._)++t;return t}function v(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=Aa.length;r>n;++n){var i=Aa[n]+e;if(i in t)return i}}function M(){}function k(){}function A(t){function e(){for(var e,r=n,i=-1,o=r.length;++in;n++)for(var i,o=t[n],a=0,s=o.length;s>a;a++)(i=o[a])&&e(i,a,n);return t}function H(t){return Ta(t,Ca),t}function X(t){var e,n;return function(r,i,o){var a,s=t[o].update,l=s.length;for(o!=n&&(n=o,e=0),i>=e&&(e=i+1);!(a=s[e])&&++e0&&(t=t.slice(0,s));var u=Oa.get(t);return u&&(t=u,l=Q),s?e?i:r:e?M:o}function W(t,e){return function(n){var r=ca.event;ca.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{ca.event=r}}}function Q(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function J(t){var n=".dragsuppress-"+ ++Fa,i="click"+n,o=ca.select(r(t)).on("touchmove"+n,S).on("dragstart"+n,S).on("selectstart"+n,S);if(null==ja&&(ja="onselectstart"in t?!1:w(t.style,"userSelect")),ja){var a=e(t).style,s=a[ja];a[ja]="none"}return function(t){if(o.on(n,null),ja&&(a[ja]=s),t){var e=function(){o.on(i,null)};o.on(i,function(){S(),e()},!0),setTimeout(e,0)}}}function $(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();if(0>Ra){var o=r(t);if(o.scrollX||o.scrollY){n=ca.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=n[0][0].getScreenCTM();Ra=!(a.f||a.e),n.remove()}}return Ra?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function K(){return ca.event.changedTouches[0].identifier}function tt(t){return t>0?1:0>t?-1:0}function et(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function nt(t){return t>1?0:-1>t?qa:Math.acos(t)}function rt(t){return t>1?Za:-1>t?-Za:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function at(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,n){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):Mt(""+t,kt,ut):new ut(t,e,n)}function ct(t,e,n){function r(t){return t>360?t-=360:0>t&&(t+=360),60>t?o+(a-o)*t/60:180>t?a:240>t?o+(a-o)*(240-t)/60:o}function i(t){return Math.round(255*r(t))}var o,a;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:0>e?0:e>1?1:e,n=0>n?0:n>1?1:n,a=.5>=n?n*(1+e):n+e-n*e,o=2*n-a,new xt(i(t+120),i(t),i(t-120))}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?mt(t.l,t.a,t.b):mt((t=At((t=ca.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,n)}function ht(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(n,Math.cos(t*=Ga)*e,Math.sin(t)*e)}function dt(t,e,n){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ft?ht(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new dt(t,e,n)}function pt(t,e,n){var r=(t+16)/116,i=r+e/500,o=r-n/200;return i=gt(i)*ns,r=gt(r)*rs,o=gt(o)*is,new xt(vt(3.2404542*i-1.5371385*r-.4985314*o),vt(-.969266*i+1.8760108*r+.041556*o),vt(.0556434*i-.2040259*r+1.0572252*o))}function mt(t,e,n){return t>0?new ft(Math.atan2(n,e)*Ha,Math.sqrt(e*e+n*n),t):new ft(NaN,NaN,t)}function gt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function yt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function vt(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,n){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):Mt(""+t,xt,ct):new xt(t,e,n)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,n){var r,i,o,a=0,s=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Tt(i[0]),Tt(i[1]),Tt(i[2]))}return(o=ss.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(a=(3840&o)>>4,a=a>>4|a,s=240&o,s=s>>4|s,l=15&o,l=l<<4|l):7===t.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,l=255&o)),e(a,s,l))}function kt(t,e,n){var r,i,o=Math.min(t/=255,e/=255,n/=255),a=Math.max(t,e,n),s=a-o,l=(a+o)/2;return s?(i=.5>l?s/(a+o):s/(2-a-o),r=t==a?(e-n)/s+(n>e?6:0):e==a?(n-t)/s+2:(t-e)/s+4,r*=60):(r=NaN,i=l>0&&1>l?0:r),new ut(r,i,l)}function At(t,e,n){t=St(t),e=St(e),n=St(n);var r=yt((.4124564*t+.3575761*e+.1804375*n)/ns),i=yt((.2126729*t+.7151522*e+.072175*n)/rs),o=yt((.0193339*t+.119192*e+.9503041*n)/is);return dt(116*i-16,500*(r-i),200*(i-o))}function St(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Tt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function zt(t){return"function"==typeof t?t:function(){return t}}function Et(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),Lt(e,n,t,r)}}function Lt(t,e,n,r){function i(){var t,e=l.status;if(!e&&Pt(l)||e>=200&&300>e||304===e){try{t=n.call(o,l)}catch(r){return void a.error.call(o,r)}a.load.call(o,t)}else a.error.call(o,l)}var o={},a=ca.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=ca.event;ca.event=t;try{a.progress.call(o,l)}finally{ca.event=e}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(u=t,o):u},o.response=function(t){return n=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(ha(arguments)))}}),o.send=function(n,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),l.open(n,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),a.beforesend.call(o,l),l.send(null==r?null:r),o},o.abort=function(){return l.abort(),o},ca.rebind(o,a,"on"),null==r?o:o.get(It(r))}function It(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Pt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Dt(t,e,n){var r=arguments.length;2>r&&(e=0),3>r&&(n=Date.now());var i=n+e,o={c:t,t:i,n:null};return us?us.n=o:ls=o,us=o,cs||(fs=clearTimeout(fs),cs=1,hs(Ct)),o}function Ct(){var t=Ot(),e=jt()-t;e>24?(isFinite(e)&&(clearTimeout(fs),fs=setTimeout(Ct,e)),cs=0):(cs=1,hs(Ct))}function Ot(){for(var t=Date.now(),e=ls;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function jt(){for(var t,e=ls,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function Nt(t){var e=t.decimal,n=t.thousands,r=t.grouping,i=t.currency,o=r&&n?function(t,e){for(var i=t.length,o=[],a=0,s=r[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=r[a=(a+1)%r.length];return o.reverse().join(n)}:b;return function(t){var n=ps.exec(t),r=n[1]||" ",a=n[2]||">",s=n[3]||"-",l=n[4]||"",u=n[5],c=+n[6],f=n[7],h=n[8],d=n[9],p=1,m="",g="",y=!1,v=!0;switch(h&&(h=+h.substring(1)),(u||"0"===r&&"="===a)&&(u=r="0",a="="),d){case"n":f=!0,d="g";break;case"%":p=100,g="%",d="f";break;case"p":p=100,g="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+d.toLowerCase());case"c":v=!1;case"d":y=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],g=i[1]),"r"!=d||h||(d="g"),null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):"e"!=d&&"f"!=d||(h=Math.max(0,Math.min(20,h)))),d=ms.get(d)||Bt;var x=u&&f;return function(t){var n=g;if(y&&t%1)return"";var i=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===s?"":s;if(0>p){var l=ca.formatPrefix(t,h);t=l.scale(t),n=l.symbol+g}else t*=p;t=d(t,h);var b,_,w=t.lastIndexOf(".");if(0>w){var M=v?t.lastIndexOf("e"):-1;0>M?(b=t,_=""):(b=t.substring(0,M),_=t.substring(M))}else b=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(b=o(b,1/0));var k=m.length+b.length+_.length+(x?0:i.length),A=c>k?new Array(k=c-k+1).join(r):"";return x&&(b=o(A+b,A.length?c-_.length:1/0)),i+=m,t=b+_,("<"===a?i+t+A:">"===a?A+i+t:"^"===a?A.substring(0,k>>=1)+i+t+A.substring(k):i+(x?t:A+t))+n}}}function Bt(t){return t+""}function qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,n){function r(e){var n=t(e),r=o(n,1);return r-e>e-n?n:r}function i(n){return e(n=t(new ys(n-1)),1),n}function o(t,n){return e(t=new ys(+t),n),t}function a(t,r,o){var a=i(t),s=[];if(o>1)for(;r>a;)n(a)%o||s.push(new Date(+a)),e(a,1);else for(;r>a;)s.push(new Date(+a)),e(a,1);return s}function s(t,e,n){try{ys=qt;var r=new qt;return r._=t,a(r,e,n)}finally{ys=Date}}t.floor=t,t.round=r,t.ceil=i,t.offset=o,t.range=a;var l=t.utc=Ut(t);return l.floor=l,l.round=Ut(r),l.ceil=Ut(i),l.offset=Ut(o),l.range=s,t}function Ut(t){return function(e,n){try{ys=qt;var r=new qt;return r._=e,t(r,n)._}finally{ys=Date}}}function Zt(t){function e(t){function e(e){for(var n,i,o,a=[],s=-1,l=0;++ss;){if(r>=u)return-1;if(i=e.charCodeAt(s++),37===i){if(a=e.charAt(s++),o=E[a in xs?e.charAt(s++):a],!o||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){w.lastIndex=0;var r=w.exec(e.slice(n));return r?(t.w=M.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){b.lastIndex=0;var r=b.exec(e.slice(n));return r?(t.w=_.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){S.lastIndex=0;var r=S.exec(e.slice(n));return r?(t.m=T.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){k.lastIndex=0;var r=k.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function s(t,e,r){return n(t,z.c.toString(),e,r)}function l(t,e,r){return n(t,z.x.toString(),e,r)}function u(t,e,r){return n(t,z.X.toString(),e,r)}function c(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,h=t.date,d=t.time,p=t.periods,m=t.days,g=t.shortDays,y=t.months,v=t.shortMonths;e.utc=function(t){function n(t){try{ys=qt;var e=new ys;return e._=t,r(e)}finally{ys=Date}}var r=e(t);return n.parse=function(t){try{ys=qt;var e=r.parse(t);return e&&e._}finally{ys=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ce;var x=ca.map(),b=Ht(m),_=Xt(m),w=Ht(g),M=Xt(g),k=Ht(y),A=Xt(y),S=Ht(v),T=Xt(v);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var z={a:function(t){return g[t.getDay()]},A:function(t){return m[t.getDay()]},b:function(t){return v[t.getMonth()]},B:function(t){return y[t.getMonth()]},c:e(f),d:function(t,e){return Gt(t.getDate(),e,2)},e:function(t,e){return Gt(t.getDate(),e,2)},H:function(t,e){return Gt(t.getHours(),e,2)},I:function(t,e){return Gt(t.getHours()%12||12,e,2)},j:function(t,e){return Gt(1+gs.dayOfYear(t),e,3)},L:function(t,e){return Gt(t.getMilliseconds(),e,3)},m:function(t,e){return Gt(t.getMonth()+1,e,2)},M:function(t,e){return Gt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Gt(t.getSeconds(),e,2)},U:function(t,e){return Gt(gs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(gs.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return Gt(t.getFullYear()%100,e,2)},Y:function(t,e){return Gt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},E={a:r,A:i,b:o,B:a,c:s,d:ne,e:ne,H:ie,I:ie,j:re,L:se,m:ee,M:oe,p:c,S:ae,U:Wt,w:Yt,W:Qt,x:l,X:u,y:$t,Y:Jt,Z:Kt,"%":ue};return e}function Gt(t,e,n){var r=0>t?"-":"",i=(r?-t:t)+"",o=i.length;return r+(n>o?new Array(n-o+1).join(e)+i:i)}function Ht(t){return new RegExp("^(?:"+t.map(ca.requote).join("|")+")","i")}function Xt(t){for(var e=new f,n=-1,r=t.length;++n68?1900:2e3)}function ee(t,e,n){bs.lastIndex=0;var r=bs.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){bs.lastIndex=0;var r=bs.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){bs.lastIndex=0;var r=bs.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ie(t,e,n){bs.lastIndex=0;var r=bs.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function oe(t,e,n){bs.lastIndex=0;var r=bs.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ae(t,e,n){bs.lastIndex=0;var r=bs.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function se(t,e,n){bs.lastIndex=0;var r=bs.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function le(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=wa(e)/60|0,i=wa(e)%60;return n+Gt(r,"0",2)+Gt(i,"0",2)}function ue(t,e,n){_s.lastIndex=0;var r=_s.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ce(t){for(var e=t.length,n=-1;++n=0?1:-1,s=a*n,l=Math.cos(e),u=Math.sin(e),c=o*u,f=i*l+c*Math.cos(s),h=c*a*Math.sin(s);Ts.add(Math.atan2(h,f)),r=t,i=l,o=u}var e,n,r,i,o;zs.point=function(a,s){zs.point=t,r=(e=a)*Ga,i=Math.cos(s=(n=s)*Ga/2+qa/4),o=Math.sin(s)},zs.lineEnd=function(){t(e,n)}}function ye(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ve(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),rt(t[2])]}function ke(t,e){return wa(t[0]-e[0])s;++s)i.point((n=t[s])[0],n[1]);return void i.lineEnd()}var l=new Ce(n,t,null,!0),u=new Ce(n,null,l,!1);l.o=u,o.push(l),a.push(u),l=new Ce(r,t,null,!1),u=new Ce(r,null,l,!0),l.o=u,o.push(l),a.push(u)}}),a.sort(e),De(o),De(a),o.length){for(var s=0,l=n,u=a.length;u>s;++s)a[s].e=l=!l;for(var c,f,h=o[0];;){for(var d=h,p=!0;d.v;)if((d=d.n)===h)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(var s=0,u=c.length;u>s;++s)i.point((f=c[s])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(p){c=d.p.z;for(var s=c.length-1;s>=0;--s)i.point((f=c[s])[0],f[1])}else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function De(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r0){for(_||(o.polygonStart(),_=!0),o.lineStart();++a1&&2&e&&n.push(n.pop().concat(n.shift())),d.push(n.filter(je))}var d,p,m,g=e(o),y=i.invert(r[0],r[1]),v={point:a,lineStart:l,lineEnd:u,polygonStart:function(){v.point=c,v.lineStart=f,v.lineEnd=h,d=[],p=[]},polygonEnd:function(){v.point=a,v.lineStart=l,v.lineEnd=u,d=ca.merge(d);var t=Ve(y,p);d.length?(_||(o.polygonStart(),_=!0),Pe(d,Re,t,n,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),d=p=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=Fe(),b=e(x),_=!1;return v}}function je(t){return t.length>1}function Fe(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:M,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Re(t,e){return((t=t.x)[0]<0?t[1]-Za-Na:Za-t[1])-((e=e.x)[0]<0?e[1]-Za-Na:Za-e[1])}function Ne(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?qa:-qa,l=wa(o-n);wa(l-qa)0?Za:-Za),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&l>=qa&&(wa(n-i)Na?Math.atan((Math.sin(e)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(e))*Math.sin(t))/(i*o*a)):(e+r)/2}function qe(t,e,n,r){var i;if(null==t)i=n*Za,r.point(-qa,i),r.point(0,i),r.point(qa,i),r.point(qa,0),r.point(qa,-i),r.point(0,-i),r.point(-qa,-i),r.point(-qa,0),r.point(-qa,i);else if(wa(t[0]-e[0])>Na){var o=t[0]s;++s){var u=e[s],c=u.length;if(c)for(var f=u[0],h=f[0],d=f[1]/2+qa/4,p=Math.sin(d),m=Math.cos(d),g=1;;){g===c&&(g=0),t=u[g];var y=t[0],v=t[1]/2+qa/4,x=Math.sin(v),b=Math.cos(v),_=y-h,w=_>=0?1:-1,M=w*_,k=M>qa,A=p*x;if(Ts.add(Math.atan2(A*w*Math.sin(M),m*b+A*Math.cos(M))),o+=k?_+w*Va:_,k^h>=n^y>=n){var S=xe(ye(f),ye(t));we(S);var T=xe(i,S);we(T);var z=(k^_>=0?-1:1)*rt(T[2]);(r>z||r===z&&(S[0]||S[1]))&&(a+=k^_>=0?1:-1)}if(!g++)break;h=y,p=x,m=b,f=t}}return(-Na>o||Na>o&&0>Ts)^1&a}function Ue(t){function e(t,e){return Math.cos(t)*Math.cos(e)>o}function n(t){var n,o,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],m=e(f,h),g=a?m?0:i(f,h):m?i(f+(0>f?qa:-qa),h):0;if(!n&&(u=l=m)&&t.lineStart(),m!==l&&(d=r(n,p),(ke(n,d)||ke(p,d))&&(p[0]+=Na,p[1]+=Na,m=e(p[0],p[1]))),m!==l)c=0,m?(t.lineStart(),d=r(p,n), +t.point(d[0],d[1])):(d=r(n,p),t.point(d[0],d[1]),t.lineEnd()),n=d;else if(s&&n&&a^m){var y;g&o||!(y=r(p,n,!0))||(c=0,a?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!m||n&&ke(n,p)||t.point(p[0],p[1]),n=p,l=m,o=g},lineEnd:function(){l&&t.lineEnd(),n=null},clean:function(){return c|(u&&l)<<1}}}function r(t,e,n){var r=ye(t),i=ye(e),a=[1,0,0],s=xe(r,i),l=ve(s,s),u=s[0],c=l-u*u;if(!c)return!n&&t;var f=o*l/c,h=-o*u/c,d=xe(a,s),p=_e(a,f),m=_e(s,h);be(p,m);var g=d,y=ve(p,g),v=ve(g,g),x=y*y-v*(ve(p,p)-1);if(!(0>x)){var b=Math.sqrt(x),_=_e(g,(-y-b)/v);if(be(_,p),_=Me(_),!n)return _;var w,M=t[0],k=e[0],A=t[1],S=e[1];M>k&&(w=M,M=k,k=w);var T=k-M,z=wa(T-qa)T;if(!z&&A>S&&(w=A,A=S,S=w),E?z?A+S>0^_[1]<(wa(_[0]-M)qa^(M<=_[0]&&_[0]<=k)){var L=_e(g,(-y+b)/v);return be(L,p),[_,Me(L)]}}}function i(e,n){var r=a?t:qa-t,i=0;return-r>e?i|=1:e>r&&(i|=2),-r>n?i|=4:n>r&&(i|=8),i}var o=Math.cos(t),a=o>0,s=wa(o)>Na,l=yn(t,6*Ga);return Oe(e,n,l,a?[0,-t]:[-qa,t-qa])}function Ze(t,e,n,r){return function(i){var o,a=i.a,s=i.b,l=a.x,u=a.y,c=s.x,f=s.y,h=0,d=1,p=c-l,m=f-u;if(o=t-l,p||!(o>0)){if(o/=p,0>p){if(h>o)return;d>o&&(d=o)}else if(p>0){if(o>d)return;o>h&&(h=o)}if(o=n-l,p||!(0>o)){if(o/=p,0>p){if(o>d)return;o>h&&(h=o)}else if(p>0){if(h>o)return;d>o&&(d=o)}if(o=e-u,m||!(o>0)){if(o/=m,0>m){if(h>o)return;d>o&&(d=o)}else if(m>0){if(o>d)return;o>h&&(h=o)}if(o=r-u,m||!(0>o)){if(o/=m,0>m){if(o>d)return;o>h&&(h=o)}else if(m>0){if(h>o)return;d>o&&(d=o)}return h>0&&(i.a={x:l+h*p,y:u+h*m}),1>d&&(i.b={x:l+d*p,y:u+d*m}),i}}}}}}function Ge(t,e,n,r){function i(r,i){return wa(r[0]-t)0?0:3:wa(r[0]-n)0?2:1:wa(r[1]-e)0?1:0:i>0?3:2}function o(t,e){return a(t.x,e.x)}function a(t,e){var n=i(t,1),r=i(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,n=g.length,r=t[1],i=0;n>i;++i)for(var o,a=1,s=g[i],l=s.length,u=s[0];l>a;++a)o=s[a],u[1]<=r?o[1]>r&&et(u,o,t)>0&&++e:o[1]<=r&&et(u,o,t)<0&&--e,u=o;return 0!==e}function u(o,s,l,u){var c=0,f=0;if(null==o||(c=i(o,l))!==(f=i(s,l))||a(o,s)<0^l>0){do u.point(0===c||3===c?t:n,c>1?r:e);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(i,o){return i>=t&&n>=i&&o>=e&&r>=o}function f(t,e){c(t,e)&&s.point(t,e)}function h(){E.point=p,g&&g.push(y=[]),k=!0,M=!1,_=w=NaN}function d(){m&&(p(v,x),b&&M&&T.rejoin(),m.push(T.buffer())),E.point=f,M&&s.lineEnd()}function p(t,e){t=Math.max(-Vs,Math.min(Vs,t)),e=Math.max(-Vs,Math.min(Vs,e));var n=c(t,e);if(g&&y.push([t,e]),k)v=t,x=e,b=n,k=!1,n&&(s.lineStart(),s.point(t,e));else if(n&&M)s.point(t,e);else{var r={a:{x:_,y:w},b:{x:t,y:e}};z(r)?(M||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),n||s.lineEnd(),A=!1):n&&(s.lineStart(),s.point(t,e),A=!1)}_=t,w=e,M=n}var m,g,y,v,x,b,_,w,M,k,A,S=s,T=Fe(),z=Ze(t,e,n,r),E={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=T,m=[],g=[],A=!0},polygonEnd:function(){s=S,m=ca.merge(m);var e=l([t,r]),n=A&&e,i=m.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Pe(m,o,e,u,s),s.polygonEnd()),m=g=y=null}};return E}}function He(t){var e=0,n=qa/3,r=un(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*qa/180,n=t[1]*qa/180):[e/qa*180,n/qa*180]},i}function Xe(t,e){function n(t,e){var n=Math.sqrt(o-2*i*Math.sin(e))/i;return[n*Math.sin(t*=i),a-n*Math.cos(t)]}var r=Math.sin(t),i=(r+Math.sin(e))/2,o=1+r*(2*i-r),a=Math.sqrt(o)/i;return n.invert=function(t,e){var n=a-e;return[Math.atan2(t,n)/i,rt((o-(t*t+n*n)*i*i)/(2*i))]},n}function Ye(){function t(t,e){Zs+=i*t-r*e,r=t,i=e}var e,n,r,i;Ws.point=function(o,a){Ws.point=t,e=r=o,n=i=a},Ws.lineEnd=function(){t(e,n)}}function We(t,e){Gs>t&&(Gs=t),t>Xs&&(Xs=t),Hs>e&&(Hs=e),e>Ys&&(Ys=e)}function Qe(){function t(t,e){a.push("M",t,",",e,o)}function e(t,e){a.push("M",t,",",e),s.point=n}function n(t,e){a.push("L",t,",",e)}function r(){s.point=t}function i(){a.push("Z")}var o=Je(4.5),a=[],s={point:t,lineStart:function(){s.point=e},lineEnd:r,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=r,s.point=t},pointRadius:function(t){return o=Je(t),s},result:function(){if(a.length){var t=a.join("");return a=[],t}}};return s}function Je(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $e(t,e){Is+=t,Ps+=e,++Ds}function Ke(){function t(t,r){var i=t-e,o=r-n,a=Math.sqrt(i*i+o*o);Cs+=a*(e+t)/2,Os+=a*(n+r)/2,js+=a,$e(e=t,n=r)}var e,n;Js.point=function(r,i){Js.point=t,$e(e=r,n=i)}}function tn(){Js.point=$e}function en(){function t(t,e){var n=t-r,o=e-i,a=Math.sqrt(n*n+o*o);Cs+=a*(r+t)/2,Os+=a*(i+e)/2,js+=a,a=i*t-r*e,Fs+=a*(r+t),Rs+=a*(i+e),Ns+=3*a,$e(r=t,i=e)}var e,n,r,i;Js.point=function(o,a){Js.point=t,$e(e=r=o,n=i=a)},Js.lineEnd=function(){t(e,n)}}function nn(t){function e(e,n){t.moveTo(e+a,n),t.arc(e,n,a,0,Va)}function n(e,n){t.moveTo(e,n),s.point=r}function r(e,n){t.lineTo(e,n)}function i(){s.point=e}function o(){t.closePath()}var a=4.5,s={point:e,lineStart:function(){s.point=n},lineEnd:i,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return a=t,s},result:M};return s}function rn(t){function e(t){return(s?r:n)(t)}function n(e){return sn(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,k.point=o,e.lineStart()}function o(n,r){var o=ye([n,r]),a=t(n,r);i(x,b,v,_,w,M,x=a[0],b=a[1],v=n,_=o[0],w=o[1],M=o[2],s,e),e.point(x,b)}function a(){k.point=n,e.lineEnd()}function l(){r(),k.point=u,k.lineEnd=c}function u(t,e){o(f=t,h=e),d=x,p=b,m=_,g=w,y=M,k.point=o}function c(){i(x,b,v,_,w,M,d,p,f,m,g,y,s,e),k.lineEnd=a,a()}var f,h,d,p,m,g,y,v,x,b,_,w,M,k={point:n,lineStart:r,lineEnd:a,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=r}};return k}function i(e,n,r,s,l,u,c,f,h,d,p,m,g,y){var v=c-e,x=f-n,b=v*v+x*x;if(b>4*o&&g--){var _=s+d,w=l+p,M=u+m,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),S=wa(wa(M)-1)o||wa((v*L+x*I)/b-.5)>.3||a>s*d+l*p+u*m)&&(i(e,n,r,s,l,u,z,E,S,_/=k,w/=k,M,g,y),y.point(z,E),i(z,E,S,_,w,M,c,f,h,d,p,m,g,y))}}var o=.5,a=Math.cos(30*Ga),s=16;return e.precision=function(t){return arguments.length?(s=(o=t*t)>0&&16,e):Math.sqrt(o)},e}function on(t){var e=rn(function(e,n){return t([e*Ha,n*Ha])});return function(t){return cn(e(t))}}function an(t){this.stream=t}function sn(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 ln(t){return un(function(){return t})()}function un(t){function e(t){return t=s(t[0]*Ga,t[1]*Ga),[t[0]*h+l,u-t[1]*h]}function n(t){return t=s.invert((t[0]-l)/h,(u-t[1])/h),t&&[t[0]*Ha,t[1]*Ha]}function r(){s=Le(a=dn(y,v,x),o);var t=o(m,g);return l=d-t[0]*h,u=p+t[1]*h,i()}function i(){return c&&(c.valid=!1,c=null),e}var o,a,s,l,u,c,f=rn(function(t,e){return t=o(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,m=0,g=0,y=0,v=0,x=0,_=qs,w=b,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=cn(_(a,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,qs):Ue((M=+t)*Ga),i()):M},e.clipExtent=function(t){return arguments.length?(k=t,w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):b,i()):k},e.scale=function(t){return arguments.length?(h=+t,r()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],r()):[d,p]},e.center=function(t){return arguments.length?(m=t[0]%360*Ga,g=t[1]%360*Ga,r()):[m*Ha,g*Ha]},e.rotate=function(t){return arguments.length?(y=t[0]%360*Ga,v=t[1]%360*Ga,x=t.length>2?t[2]%360*Ga:0,r()):[y*Ha,v*Ha,x*Ha]},ca.rebind(e,f,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&n,r()}}function cn(t){return sn(t,function(e,n){t.point(e*Ga,n*Ga)})}function fn(t,e){return[t,e]}function hn(t,e){return[t>qa?t-Va:-qa>t?t+Va:t,e]}function dn(t,e,n){return t?e||n?Le(mn(t),gn(e,n)):mn(t):e||n?gn(e,n):hn}function pn(t){return function(e,n){return e+=t,[e>qa?e-Va:-qa>e?e+Va:e,n]}}function mn(t){var e=pn(t);return e.invert=pn(-t),e}function gn(t,e){function n(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*r+s*i;return[Math.atan2(l*o-c*a,s*r-u*i),rt(c*o+l*a)]}var r=Math.cos(t),i=Math.sin(t),o=Math.cos(e),a=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*o-l*a;return[Math.atan2(l*o+u*a,s*r+c*i),rt(c*r-s*i)]},n}function yn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(i,o,a,s){var l=a*e;null!=i?(i=vn(n,i),o=vn(n,o),(a>0?o>i:i>o)&&(i+=a*Va)):(i=t+a*Va,o=t-.5*l);for(var u,c=i;a>0?c>o:o>c;c-=l)s.point((u=Me([n,-r*Math.cos(c),-r*Math.sin(c)]))[0],u[1])}}function vn(t,e){var n=ye(e);n[0]-=t,we(n);var r=nt(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-Na)%(2*Math.PI)}function xn(t,e,n){var r=ca.range(t,e-Na,n).concat(e);return function(t){return r.map(function(e){return[t,e]})}}function bn(t,e,n){var r=ca.range(t,e-Na,n).concat(e);return function(t){return r.map(function(e){return[e,t]})}}function _n(t){return t.source}function wn(t){return t.target}function Mn(t,e,n,r){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(r),s=Math.sin(r),l=i*Math.cos(t),u=i*Math.sin(t),c=a*Math.cos(n),f=a*Math.sin(n),h=2*Math.asin(Math.sqrt(st(r-e)+i*a*st(n-t))),d=1/Math.sin(h),p=h?function(t){var e=Math.sin(t*=h)*d,n=Math.sin(h-t)*d,r=n*l+e*c,i=n*u+e*f,a=n*o+e*s;return[Math.atan2(i,r)*Ha,Math.atan2(a,Math.sqrt(r*r+i*i))*Ha]}:function(){return[t*Ha,e*Ha]};return p.distance=h,p}function kn(){function t(t,i){var o=Math.sin(i*=Ga),a=Math.cos(i),s=wa((t*=Ga)-e),l=Math.cos(s);$s+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=r*o-n*a*l)*s),n*o+r*a*l),e=t,n=o,r=a}var e,n,r;Ks.point=function(i,o){e=i*Ga,n=Math.sin(o*=Ga),r=Math.cos(o),Ks.point=t},Ks.lineEnd=function(){Ks.point=Ks.lineEnd=M}}function An(t,e){function n(e,n){var r=Math.cos(e),i=Math.cos(n),o=t(r*i);return[o*i*Math.sin(e),o*Math.sin(n)]}return n.invert=function(t,n){var r=Math.sqrt(t*t+n*n),i=e(r),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,r*a),Math.asin(r&&n*o/r)]},n}function Sn(t,e){function n(t,e){a>0?-Za+Na>e&&(e=-Za+Na):e>Za-Na&&(e=Za-Na);var n=a/Math.pow(i(e),o);return[n*Math.sin(o*t),a-n*Math.cos(o*t)]}var r=Math.cos(t),i=function(t){return Math.tan(qa/4+t/2)},o=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(i(e)/i(t)),a=r*Math.pow(i(t),o)/o;return o?(n.invert=function(t,e){var n=a-e,r=tt(o)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/o,2*Math.atan(Math.pow(a/r,1/o))-Za]},n):zn}function Tn(t,e){function n(t,e){var n=o-e;return[n*Math.sin(i*t),o-n*Math.cos(i*t)]}var r=Math.cos(t),i=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),o=r/i+t;return wa(i)i;i++){for(;r>1&&et(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function Cn(t,e){return t[0]-e[0]||t[1]-e[1]}function On(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function jn(t,e,n,r){var i=t[0],o=n[0],a=e[0]-i,s=r[0]-o,l=t[1],u=n[1],c=e[1]-l,f=r[1]-u,h=(s*(l-u)-f*(i-o))/(f*a-s*c);return[i+h*a,l+h*c]}function Fn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function Rn(){or(this),this.edge=this.site=this.circle=null}function Nn(t){var e=fl.pop()||new Rn;return e.site=t,e}function Bn(t){Qn(t),ll.remove(t),fl.push(t),or(t)}function qn(t){var e=t.circle,n=e.x,r=e.cy,i={x:n,y:r},o=t.P,a=t.N,s=[t];Bn(t);for(var l=o;l.circle&&wa(n-l.circle.x)c;++c)u=s[c],l=s[c-1],nr(u.edge,l.site,u.site,i);l=s[0],u=s[f-1],u.edge=tr(l.site,u.site,null,i),Wn(l),Wn(u)}function Vn(t){for(var e,n,r,i,o=t.x,a=t.y,s=ll._;s;)if(r=Un(s,a)-o,r>Na)s=s.L;else{if(i=o-Zn(s,a),!(i>Na)){r>-Na?(e=s.P,n=s):i>-Na?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}var l=Nn(t);if(ll.insert(e,l),e||n){if(e===n)return Qn(e),n=Nn(e.site),ll.insert(l,n),l.edge=n.edge=tr(e.site,l.site),Wn(e),void Wn(n);if(!n)return void(l.edge=tr(e.site,l.site));Qn(e),Qn(n);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=n.site,m=p.x-c,g=p.y-f,y=2*(h*g-d*m),v=h*h+d*d,x=m*m+g*g,b={x:(g*v-d*x)/y+c,y:(h*x-m*v)/y+f};nr(n.edge,u,p,b),l.edge=tr(u,t,null,b),n.edge=tr(t,p,null,b),Wn(e),Wn(n)}}function Un(t,e){var n=t.site,r=n.x,i=n.y,o=i-e;if(!o)return r;var a=t.P;if(!a)return-(1/0);n=a.site;var s=n.x,l=n.y,u=l-e;if(!u)return s;var c=s-r,f=1/o-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-o/2)))/f+r:(r+s)/2}function Zn(t,e){var n=t.N;if(n)return Un(n,e);var r=t.site;return r.y===e?r.x:1/0}function Gn(t){this.site=t,this.edges=[]}function Hn(t){for(var e,n,r,i,o,a,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],m=sl,g=m.length;g--;)if(o=m[g],o&&o.prepare())for(s=o.edges,l=s.length,a=0;l>a;)c=s[a].end(),r=c.x,i=c.y,u=s[++a%l].start(),e=u.x,n=u.y,(wa(r-e)>Na||wa(i-n)>Na)&&(s.splice(a,0,new rr(er(o.site,c,wa(r-f)Na?{x:f,y:wa(e-f)Na?{x:wa(n-p)Na?{x:h,y:wa(e-h)Na?{x:wa(n-d)=-Ba)){var d=l*l+u*u,p=c*c+f*f,m=(f*d-u*p)/h,g=(l*p-c*d)/h,f=g+s,y=hl.pop()||new Yn;y.arc=t,y.site=i,y.x=m+a,y.y=f+Math.sqrt(m*m+g*g),y.cy=f,t.circle=y;for(var v=null,x=cl._;x;)if(y.yg||g>=s)return;if(h>p){if(o){if(o.y>=u)return}else o={x:g,y:l};n={x:g,y:u}}else{if(o){if(o.yr||r>1)if(h>p){if(o){if(o.y>=u)return}else o={x:(l-i)/r,y:l};n={x:(u-i)/r,y:u}}else{if(o){if(o.yd){if(o){if(o.x>=s)return}else o={x:a,y:r*a+i};n={x:s,y:r*s+i}}else{if(o){if(o.xo||f>a||r>h||i>d)){if(p=t.point){var p,m=e-t.x,g=n-t.y,y=m*m+g*g;if(l>y){var v=Math.sqrt(l=y);r=e-v,i=n-v,o=e+v,a=n+v,s=p}}for(var x=t.nodes,b=.5*(c+h),_=.5*(f+d),w=e>=b,M=n>=_,k=M<<1|w,A=k+4;A>k;++k)if(t=x[3&k])switch(3&k){case 0:u(t,c,f,b,_);break;case 1:u(t,b,f,h,_);break;case 2:u(t,c,_,b,d);break;case 3:u(t,b,_,h,d)}}}(t,r,i,o,a),s}function yr(t,e){t=ca.rgb(t),e=ca.rgb(e);var n=t.r,r=t.g,i=t.b,o=e.r-n,a=e.g-r,s=e.b-i;return function(t){return"#"+wt(Math.round(n+o*t))+wt(Math.round(r+a*t))+wt(Math.round(i+s*t))}}function vr(t,e){var n,r={},i={};for(n in t)n in e?r[n]=_r(t[n],e[n]):i[n]=t[n];for(n in e)n in t||(i[n]=e[n]);return function(t){for(n in r)i[n]=r[n](t);return i}}function xr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function br(t,e){var n,r,i,o=pl.lastIndex=ml.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=pl.exec(t))&&(r=ml.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:xr(n,r)})),o=ml.lastIndex;return or;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function _r(t,e){for(var n,r=ca.interpolators.length;--r>=0&&!(n=ca.interpolators[r](t,e)););return n}function wr(t,e){var n,r=[],i=[],o=t.length,a=e.length,s=Math.min(t.length,e.length);for(n=0;s>n;++n)r.push(_r(t[n],e[n]));for(;o>n;++n)i[n]=t[n];for(;a>n;++n)i[n]=e[n];return function(t){for(n=0;s>n;++n)i[n]=r[n](t);return i}}function Mr(t){return function(e){return 0>=e?0:e>=1?1:t(e)}}function kr(t){return function(e){return 1-t(1-e)}}function Ar(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}}function Sr(t){return t*t}function Tr(t){return t*t*t}function zr(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(.5>t?n:3*(t-e)+n-.75)}function Er(t){return function(e){return Math.pow(e,t)}}function Lr(t){return 1-Math.cos(t*Za)}function Ir(t){return Math.pow(2,10*(t-1))}function Pr(t){return 1-Math.sqrt(1-t*t)}function Dr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/Va*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Va/e)}}function Cr(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Or(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function jr(t,e){t=ca.hcl(t),e=ca.hcl(e);var n=t.h,r=t.c,i=t.l,o=e.h-n,a=e.c-r,s=e.l-i;return isNaN(a)&&(a=0,r=isNaN(r)?e.c:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:-180>o&&(o+=360),function(t){return ht(n+o*t,r+a*t,i+s*t)+""}}function Fr(t,e){t=ca.hsl(t),e=ca.hsl(e);var n=t.h,r=t.s,i=t.l,o=e.h-n,a=e.s-r,s=e.l-i;return isNaN(a)&&(a=0,r=isNaN(r)?e.s:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:-180>o&&(o+=360),function(t){return ct(n+o*t,r+a*t,i+s*t)+""}}function Rr(t,e){t=ca.lab(t),e=ca.lab(e);var n=t.l,r=t.a,i=t.b,o=e.l-n,a=e.a-r,s=e.b-i;return function(t){return pt(n+o*t,r+a*t,i+s*t)+""}}function Nr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function Br(t){var e=[t.a,t.b],n=[t.c,t.d],r=Vr(e),i=qr(e,n),o=Vr(Ur(n,e,-i))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Zr(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Zr(n)+"rotate("+e+")")}function Xr(t,e,n,r){t!==e?r.push({i:n.push(Zr(n)+"skewX(",null,")")-2,x:xr(t,e)}):e&&n.push(Zr(n)+"skewX("+e+")")}function Yr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var i=n.push(Zr(n)+"scale(",null,",",null,")");r.push({i:i-4,x:xr(t[0],e[0])},{i:i-2,x:xr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Zr(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=ca.transform(t),e=ca.transform(e),Gr(t.translate,e.translate,n,r),Hr(t.rotate,e.rotate,n,r),Xr(t.skew,e.skew,n,r),Yr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,i=-1,o=r.length;++i=0;)n.push(i[r])}function li(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(o=t.children)&&(i=o.length))for(var i,o,a=-1;++an;++n)(e=t[n][1])>i&&(r=n,i=e);return r}function xi(t){return t.reduce(bi,0)}function bi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var n=-1,r=+t[0],i=(t[1]-r)/e,o=[];++n<=e;)o[n]=i*n+r;return o}function Mi(t){return[ca.min(t),ca.max(t)]}function ki(t,e){return t.value-e.value}function Ai(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Si(t,e){t._pack_next=e,e._pack_prev=t}function Ti(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return.999*i*i>n*n+r*r}function zi(t){function e(t){c=Math.min(t.x-t.r,c),f=Math.max(t.x+t.r,f),h=Math.min(t.y-t.r,h),d=Math.max(t.y+t.r,d)}if((n=t.children)&&(u=n.length)){var n,r,i,o,a,s,l,u,c=1/0,f=-(1/0),h=1/0,d=-(1/0);if(n.forEach(Ei),r=n[0],r.x=-r.r,r.y=0,e(r),u>1&&(i=n[1],i.x=i.r,i.y=0,e(i),u>2))for(o=n[2],Pi(r,i,o),e(o),Ai(r,o),r._pack_prev=o,Ai(o,i),i=r._pack_next,a=3;u>a;a++){Pi(r,i,o=n[a]);var p=0,m=1,g=1;for(s=i._pack_next;s!==i;s=s._pack_next,m++)if(Ti(s,o)){p=1;break}if(1==p)for(l=r._pack_prev;l!==s._pack_prev&&!Ti(l,o);l=l._pack_prev,g++);p?(g>m||m==g&&i.ra;a++)o=n[a],o.x-=y,o.y-=v,x=Math.max(x,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=x,n.forEach(Li)}}function Ei(t){t._pack_next=t._pack_prev=t}function Li(t){delete t._pack_next,delete t._pack_prev}function Ii(t,e,n,r){var i=t.children;if(t.x=e+=r*t.x,t.y=n+=r*t.y,t.r*=r,i)for(var o=-1,a=i.length;++o=0;)e=i[o],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function Ri(t,e,n){return t.a.parent===e.parent?t.a:n}function Ni(t){return 1+ca.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function qi(t){var e=t.children;return e&&e.length?qi(e[0]):t}function Vi(t){var e,n=t.children;return n&&(e=n.length)?Vi(n[e-1]):t}function Ui(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Zi(t,e){var n=t.x+e[3],r=t.y+e[0],i=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return 0>i&&(n+=i/2,i=0),0>o&&(r+=o/2,o=0),{x:n,y:r,dx:i,dy:o}}function Gi(t){var e=t[0],n=t[t.length-1];return n>e?[e,n]:[n,e]}function Hi(t){return t.rangeExtent?t.rangeExtent():Gi(t.range())}function Xi(t,e,n,r){var i=n(t[0],t[1]),o=r(e[0],e[1]);return function(t){return o(i(t))}}function Yi(t,e){var n,r=0,i=t.length-1,o=t[r],a=t[i];return o>a&&(n=r,r=i,i=n,n=o,o=a,a=n),t[r]=e.floor(o),t[i]=e.ceil(a),t}function Wi(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:Sl}function Qi(t,e,n,r){var i=[],o=[],a=0,s=Math.min(t.length,e.length)-1;for(t[s]2?Qi:Xi,l=r?Jr:Qr;return a=i(t,e,l,n),s=i(e,t,l,_r),o}function o(t){return a(t)}var a,s;return o.invert=function(t){return s(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},o.range=function(t){return arguments.length?(e=t,i()):e},o.rangeRound=function(t){return o.range(t).interpolate(Nr)},o.clamp=function(t){return arguments.length?(r=t,i()):r},o.interpolate=function(t){return arguments.length?(n=t,i()):n},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,n){return no(t,e,n)},o.nice=function(e){return Ki(t,e),i()},o.copy=function(){return Ji(t,e,n,r)},i()}function $i(t,e){return ca.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ki(t,e){return Yi(t,Wi(to(t,e)[2])),Yi(t,Wi(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var n=Gi(t),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),o=e/r*i;return.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+.5*i,n[2]=i,n}function eo(t,e){return ca.range.apply(ca,to(t,e))}function no(t,e,n){var r=to(t,e);if(n){var i=ps.exec(n);if(i.shift(),"s"===i[8]){var o=ca.formatPrefix(Math.max(wa(r[0]),wa(r[1])));return i[7]||(i[7]="."+ro(o.scale(r[2]))),i[8]="f",n=ca.format(i.join("")),function(t){return n(o.scale(t))+o.symbol}}i[7]||(i[7]="."+io(i[8],r)),n=i.join("")}else n=",."+ro(r[2])+"f";return ca.format(n)}function ro(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function io(t,e){var n=ro(e[2]);return t in Tl?Math.abs(n-ro(Math.max(wa(e[0]),wa(e[1]))))+ +("e"!==t):n-2*("%"===t)}function oo(t,e,n,r){function i(t){return(n?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function a(e){return t(i(e))}return a.invert=function(e){return o(t.invert(e))},a.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(i)),a):r},a.base=function(n){return arguments.length?(e=+n,t.domain(r.map(i)),a):e},a.nice=function(){var e=Yi(r.map(i),n?Math:El);return t.domain(e),r=e.map(o),a},a.ticks=function(){var t=Gi(r),a=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(c-u)){if(n){for(;c>u;u++)for(var h=1;f>h;h++)a.push(o(u)*h);a.push(o(u))}else for(a.push(o(u));u++0;h--)a.push(o(u)*h);for(u=0;a[u]l;c--);a=a.slice(u,c)}return a},a.tickFormat=function(t,n){if(!arguments.length)return zl;arguments.length<2?n=zl:"function"!=typeof n&&(n=ca.format(n));var r=Math.max(1,e*t/a.ticks().length);return function(t){var a=t/o(Math.round(i(t)));return e-.5>a*e&&(a*=e),r>=a?n(t):""}},a.copy=function(){return oo(t.copy(),e,n,r)},$i(a,t)}function ao(t,e,n){function r(e){return t(i(e))}var i=so(e),o=so(1/e);return r.invert=function(e){return o(t.invert(e))},r.domain=function(e){return arguments.length?(t.domain((n=e.map(Number)).map(i)),r):n},r.ticks=function(t){return eo(n,t)},r.tickFormat=function(t,e){return no(n,t,e)},r.nice=function(t){return r.domain(Ki(n,t))},r.exponent=function(a){return arguments.length?(i=so(e=a),o=so(1/e),t.domain(n.map(i)),r):e},r.copy=function(){return ao(t.copy(),e,n)},$i(r,t)}function so(t){return function(e){return 0>e?-Math.pow(-e,t):Math.pow(e,t)}}function lo(t,e){function n(n){return o[((i.get(n)||("range"===e.t?i.set(n,t.push(n)):NaN))-1)%o.length]}function r(e,n){return ca.range(t.length).map(function(t){return e+n*t})}var i,o,a;return n.domain=function(r){if(!arguments.length)return t;t=[],i=new f;for(var o,a=-1,s=r.length;++an?[NaN,NaN]:[n>0?s[n-1]:t[0],ne?NaN:e/o+t,[e,e+1/o]},r.copy=function(){return co(t,e,n)},i()}function fo(t,e){function n(n){return n>=n?e[ca.bisect(t,n)]:void 0}return n.domain=function(e){return arguments.length?(t=e,n):t},n.range=function(t){return arguments.length?(e=t,n):e},n.invertExtent=function(n){return n=e.indexOf(n),[t[n-1],t[n]]},n.copy=function(){return fo(t,e)},n}function ho(t){function e(t){return+t}return e.invert=e,e.domain=e.range=function(n){return arguments.length?(t=n.map(e),e):t},e.ticks=function(e){return eo(t,e)},e.tickFormat=function(e,n){return no(t,e,n)},e.copy=function(){return ho(t)},e}function po(){return 0}function mo(t){return t.innerRadius}function go(t){return t.outerRadius}function yo(t){return t.startAngle}function vo(t){return t.endAngle}function xo(t){return t&&t.padAngle}function bo(t,e,n,r){return(t-n)*e-(e-r)*t>0?0:1}function _o(t,e,n,r,i){var o=t[0]-e[0],a=t[1]-e[1],s=(i?r:-r)/Math.sqrt(o*o+a*a),l=s*a,u=-s*o,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,m=(f+d)/2,g=h-c,y=d-f,v=g*g+y*y,x=n-r,b=c*d-h*f,_=(0>y?-1:1)*Math.sqrt(Math.max(0,x*x*v-b*b)),w=(b*y-g*_)/v,M=(-b*g-y*_)/v,k=(b*y+g*_)/v,A=(-b*g+y*_)/v,S=w-p,T=M-m,z=k-p,E=A-m;return S*S+T*T>z*z+E*E&&(w=k,M=A),[[w-l,M-u],[w*n/x,M*n/x]]}function wo(t){function e(e){function a(){u.push("M",o(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=zt(n),p=zt(r);++f1?t.join("L"):t+"Z"}function ko(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1&&i.push("H",r[0]),i.join("")}function So(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1){s=e[1],o=t[l],l++,r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var u=2;u9&&(i=3*e/Math.sqrt(i),a[s]=i*n,a[s+1]=i*r));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}function Vo(t){return t.length<3?Mo(t):t[0]+Io(t,qo(t))}function Uo(t){for(var e,n,r,i=-1,o=t.length;++i=e?a(t-e):void(u.c=a)}function a(n){var i=p.active,o=p[i];o&&(o.timer.c=null,o.timer.t=NaN,--p.count,delete p[i],o.event&&o.event.interrupt.call(t,t.__data__,o.index));for(var a in p)if(r>+a){var f=p[a];f.timer.c=null,f.timer.t=NaN,--p.count,delete p[a]}u.c=s,Dt(function(){return u.c&&s(n||1)&&(u.c=null,u.t=NaN),1},0,l),p.active=r,m.event&&m.event.start.call(t,t.__data__,e),d=[],m.tween.forEach(function(n,r){(r=r.call(t,t.__data__,e))&&d.push(r)}),h=m.ease,c=m.duration}function s(i){for(var o=i/c,a=h(o),s=d.length;s>0;)d[--s].call(t,a);return o>=1?(m.event&&m.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1):void 0}var l,u,c,h,d,p=t[n]||(t[n]={active:0,count:0}),m=p[r];m||(l=i.time,u=Dt(o,0,l),m=p[r]={tween:new f,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function ra(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function ia(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function oa(t){return t.toISOString()}function aa(t,e,n){function r(e){return t(e)}function i(t,n){var r=t[1]-t[0],i=r/n,o=ca.bisect(tu,i);return o==tu.length?[e.year,to(t.map(function(t){return t/31536e6}),n)[2]]:o?e[i/tu[o-1]1?{floor:function(e){for(;n(e=t.floor(e));)e=sa(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=sa(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Gi(r.domain()),o=null==t?i(n,10):"number"==typeof t?i(n,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(n[0],sa(+n[1]+1),1>e?1:e)},r.tickFormat=function(){return n},r.copy=function(){return aa(t.copy(),e,n)},$i(r,t)}function sa(t){return new Date(t)}function la(t){return JSON.parse(t.responseText)}function ua(t){var e=da.createRange();return e.selectNode(da.body),e.createContextualFragment(t.responseText)}var ca={version:"3.5.16"},fa=[].slice,ha=function(t){return fa.call(t)},da=this.document;if(da)try{ha(da.documentElement.childNodes)[0].nodeType}catch(pa){ha=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),da)try{da.createElement("DIV").style.setProperty("opacity",0,"")}catch(ma){var ga=this.Element.prototype,ya=ga.setAttribute,va=ga.setAttributeNS,xa=this.CSSStyleDeclaration.prototype,ba=xa.setProperty;ga.setAttribute=function(t,e){ya.call(this,t,e+"")},ga.setAttributeNS=function(t,e,n){va.call(this,t,e,n+"")},xa.setProperty=function(t,e,n){ba.call(this,t,e+"",n)}}ca.ascending=i,ca.descending=function(t,e){return t>e?-1:e>t?1:e>=t?0:NaN},ca.min=function(t,e){var n,r,i=-1,o=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++ir&&(n=r)}else{for(;++i=r){n=r;break}for(;++ir&&(n=r)}return n},ca.max=function(t,e){var n,r,i=-1,o=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++in&&(n=r)}else{for(;++i=r){n=r;break}for(;++in&&(n=r)}return n},ca.extent=function(t,e){var n,r,i,o=-1,a=t.length;if(1===arguments.length){for(;++o=r){n=i=r;break}for(;++or&&(n=r),r>i&&(i=r))}else{for(;++o=r){n=i=r;break}for(;++or&&(n=r),r>i&&(i=r))}return[n,i]},ca.sum=function(t,e){var n,r=0,i=t.length,o=-1;if(1===arguments.length)for(;++o1?l/(c-1):void 0},ca.deviation=function(){var t=ca.variance.apply(this,arguments);return t?Math.sqrt(t):t};var _a=s(i);ca.bisectLeft=_a.left,ca.bisect=ca.bisectRight=_a.right,ca.bisector=function(t){return s(1===t.length?function(e,n){return i(t(e),n)}:t)},ca.shuffle=function(t,e,n){(o=arguments.length)<3&&(n=t.length,2>o&&(e=0));for(var r,i,o=n-e;o;)i=Math.random()*o--|0,r=t[o+e],t[o+e]=t[i+e],t[i+e]=r;return t},ca.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},ca.pairs=function(t){for(var e,n=0,r=t.length-1,i=t[0],o=new Array(0>r?0:r);r>n;)o[n]=[e=i,i=t[++n]];return o},ca.transpose=function(t){if(!(i=t.length))return[];for(var e=-1,n=ca.min(t,l),r=new Array(n);++e=0;)for(r=t[i],e=r.length;--e>=0;)n[--a]=r[e];return n};var wa=Math.abs;ca.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,i=[],o=u(wa(n)),a=-1;if(t*=o,e*=o,n*=o,0>n)for(;(r=t+n*++a)>e;)i.push(r/o);else for(;(r=t+n*++a)=o.length)return r?r.call(i,a):n?a.sort(n):a;for(var l,u,c,h,d=-1,p=a.length,m=o[s++],g=new f;++d=o.length)return t;var r=[],i=a[n++];return t.forEach(function(t,i){r.push({key:t,values:e(i,n)})}),i?r.sort(function(t,e){return i(t.key,e.key)}):r}var n,r,i={},o=[],a=[];return i.map=function(e,n){return t(n,e,0)},i.entries=function(n){return e(t(ca.map,n,0),0)},i.key=function(t){return o.push(t),i},i.sortKeys=function(t){return a[o.length-1]=t,i},i.sortValues=function(t){return n=t,i},i.rollup=function(t){return r=t,i},i},ca.set=function(t){var e=new x;if(t)for(var n=0,r=t.length;r>n;++n)e.add(t[n]);return e},c(x,{has:p,add:function(t){return this._[h(t+="")]=!0,t},remove:m,values:g,size:y,empty:v,forEach:function(t){for(var e in this._)t.call(this,d(e))}}),ca.behavior={},ca.rebind=function(t,e){for(var n,r=1,i=arguments.length;++r=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},ca.event=null,ca.requote=function(t){return t.replace(Sa,"\\$&")};var Sa=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ta={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},za=function(t,e){return e.querySelector(t)},Ea=function(t,e){return e.querySelectorAll(t)},La=function(t,e){var n=t.matches||t[w(t,"matchesSelector")];return(La=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(za=function(t,e){return Sizzle(t,e)[0]||null},Ea=Sizzle,La=Sizzle.matchesSelector),ca.selection=function(){return ca.select(da.documentElement)};var Ia=ca.selection.prototype=[];Ia.select=function(t){var e,n,r,i,o=[];t=L(t);for(var a=-1,s=this.length;++a=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Da.hasOwnProperty(n)?{space:Da[n],local:t}:t}},Ia.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return t=ca.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(P(e,t[e]));return this}return this.each(P(t,e))},Ia.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=O(t)).length,i=-1;if(e=n.classList){for(;++ii){if("string"!=typeof t){2>i&&(e="");for(n in t)this.each(R(n,t[n],e));return this}if(2>i){var o=this.node();return r(o).getComputedStyle(o,null).getPropertyValue(t)}n=""}return this.each(R(t,e,n))},Ia.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(N(e,t[e]));return this}return this.each(N(t,e))},Ia.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Ia.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Ia.append=function(t){return t=B(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},Ia.insert=function(t,e){return t=B(t),e=L(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},Ia.remove=function(){return this.each(q)},Ia.data=function(t,e){function n(t,n){var r,i,o,a=t.length,c=n.length,h=Math.min(a,c),d=new Array(c),p=new Array(c),m=new Array(a);if(e){var g,y=new f,v=new Array(a);for(r=-1;++rr;++r)p[r]=V(n[r]);for(;a>r;++r)m[r]=t[r]}p.update=d,p.parentNode=d.parentNode=m.parentNode=t.parentNode,s.push(p),l.push(d),u.push(m)}var r,i,o=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(r=this[0]).length);++oo;o++){i.push(e=[]),e.parentNode=(n=this[o]).parentNode;for(var s=0,l=n.length;l>s;s++)(r=n[s])&&t.call(r,r.__data__,s,o)&&e.push(r)}return E(i)},Ia.order=function(){for(var t=-1,e=this.length;++t=0;)(n=r[i])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},Ia.sort=function(t){t=Z.apply(this,arguments);for(var e=-1,n=this.length;++et;t++)for(var n=this[t],r=0,i=n.length;i>r;r++){var o=n[r];if(o)return o}return null},Ia.size=function(){var t=0;return G(this,function(){++t}),t};var Ca=[];ca.selection.enter=H,ca.selection.enter.prototype=Ca,Ca.append=Ia.append,Ca.empty=Ia.empty,Ca.node=Ia.node,Ca.call=Ia.call,Ca.size=Ia.size,Ca.select=function(t){for(var e,n,r,i,o,a=[],s=-1,l=this.length;++sr){if("string"!=typeof t){2>r&&(e=!1);for(n in t)this.each(Y(n,t[n],e));return this}if(2>r)return(r=this.node()["__on"+t])&&r._;n=!1}return this.each(Y(t,e,n))};var Oa=ca.map({mouseenter:"mouseover",mouseleave:"mouseout"});da&&Oa.forEach(function(t){"on"+t in da&&Oa.remove(t)});var ja,Fa=0;ca.mouse=function(t){return $(t,T())};var Ra=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ca.touch=function(t,e,n){if(arguments.length<3&&(n=e,e=T().changedTouches),e)for(var r,i=0,o=e.length;o>i;++i)if((r=e[i]).identifier===n)return $(t,r)},ca.behavior.drag=function(){function t(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function e(t,e,r,o,a){return function(){function s(){var t,n,r=e(h,m);r&&(t=r[0]-x[0],n=r[1]-x[1],p|=t|n,x=r,d({type:"drag",x:r[0]+u[0],y:r[1]+u[1],dx:t,dy:n}))}function l(){e(h,m)&&(y.on(o+g,null).on(a+g,null),v(p),d({type:"dragend"}))}var u,c=this,f=ca.event.target.correspondingElement||ca.event.target,h=c.parentNode,d=n.of(c,arguments),p=0,m=t(),g=".drag"+(null==m?"":"-"+m),y=ca.select(r(f)).on(o+g,s).on(a+g,l),v=J(f),x=e(h,m);i?(u=i.apply(c,arguments),u=[u.x-x[0],u.y-x[1]]):u=[0,0],d({type:"dragstart"})}}var n=z(t,"drag","dragstart","dragend"),i=null,o=e(M,ca.mouse,r,"mousemove","mouseup"),a=e(K,ca.touch,b,"touchmove","touchend");return t.origin=function(e){return arguments.length?(i=e,t):i},ca.rebind(t,n,"on")},ca.touches=function(t,e){return arguments.length<2&&(e=T().touches),e?ha(e).map(function(e){var n=$(t,e);return n.identifier=e.identifier,n}):[]};var Na=1e-6,Ba=Na*Na,qa=Math.PI,Va=2*qa,Ua=Va-Na,Za=qa/2,Ga=qa/180,Ha=180/qa,Xa=Math.SQRT2,Ya=2,Wa=4;ca.interpolateZoom=function(t,e){var n,r,i=t[0],o=t[1],a=t[2],s=e[0],l=e[1],u=e[2],c=s-i,f=l-o,h=c*c+f*f;if(Ba>h)r=Math.log(u/a)/Xa,n=function(t){return[i+t*c,o+t*f,a*Math.exp(Xa*t*r)]};else{var d=Math.sqrt(h),p=(u*u-a*a+Wa*h)/(2*a*Ya*d),m=(u*u-a*a-Wa*h)/(2*u*Ya*d),g=Math.log(Math.sqrt(p*p+1)-p),y=Math.log(Math.sqrt(m*m+1)-m);r=(y-g)/Xa,n=function(t){var e=t*r,n=ot(g),s=a/(Ya*d)*(n*at(Xa*e+g)-it(g));return[i+s*c,o+s*f,a*n/ot(Xa*e+g)]}}return n.duration=1e3*r,n},ca.behavior.zoom=function(){function t(t){t.on(I,f).on(Ja+".zoom",d).on("dblclick.zoom",p).on(C,h)}function e(t){return[(t[0]-k.x)/k.k,(t[1]-k.y)/k.k]}function n(t){return[t[0]*k.k+k.x,t[1]*k.k+k.y]}function i(t){k.k=Math.max(T[0],Math.min(T[1],t))}function o(t,e){e=n(e),k.x+=t[0]-e[0],k.y+=t[1]-e[1]}function a(e,n,r,a){e.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2,a)),o(g=n,r),e=ca.select(e),E>0&&(e=e.transition().duration(E)),e.call(t.event)}function s(){_&&_.domain(b.range().map(function(t){return(t-k.x)/k.k}).map(b.invert)),M&&M.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){L++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--L||(t({type:"zoomend"}),g=null)}function f(){function t(){s=1,o(ca.mouse(i),h),u(a)}function n(){f.on(P,null).on(D,null),d(s),c(a)}var i=this,a=O.of(i,arguments),s=0,f=ca.select(r(i)).on(P,t).on(D,n),h=e(ca.mouse(i)),d=J(i);Zl.call(i),l(a)}function h(){function t(){var t=ca.touches(p);return d=k.k,t.forEach(function(t){t.identifier in g&&(g[t.identifier]=e(t))}),t}function n(){var e=ca.event.target;ca.select(e).on(b,r).on(_,s),w.push(e);for(var n=ca.event.changedTouches,i=0,o=n.length;o>i;++i)g[n[i].identifier]=null;var l=t(),u=Date.now();if(1===l.length){if(500>u-x){var c=l[0];a(p,c,g[c.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),S()}x=u}else if(l.length>1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];y=h*h+d*d}}function r(){var t,e,n,r,a=ca.touches(p);Zl.call(p);for(var s=0,l=a.length;l>s;++s,r=null)if(n=a[s],r=g[n.identifier]){if(e)break;t=n,e=r}if(r){var c=(c=n[0]-t[0])*c+(c=n[1]-t[1])*c,f=y&&Math.sqrt(c/y);t=[(t[0]+n[0])/2,(t[1]+n[1])/2],e=[(e[0]+r[0])/2,(e[1]+r[1])/2],i(f*d)}x=null,o(t,e),u(m)}function s(){if(ca.event.touches.length){for(var e=ca.event.changedTouches,n=0,r=e.length;r>n;++n)delete g[e[n].identifier];for(var i in g)return void t()}ca.selectAll(w).on(v,null),M.on(I,f).on(C,h),A(),c(m)}var d,p=this,m=O.of(p,arguments),g={},y=0,v=".zoom-"+ca.event.changedTouches[0].identifier,b="touchmove"+v,_="touchend"+v,w=[],M=ca.select(p),A=J(p);n(),l(m),M.on(I,null).on(C,n)}function d(){var t=O.of(this,arguments);v?clearTimeout(v):(Zl.call(this),m=e(g=y||ca.mouse(this)),l(t)),v=setTimeout(function(){v=null,c(t)},50),S(),i(Math.pow(2,.002*Qa())*k.k),o(g,m),u(t)}function p(){var t=ca.mouse(this),n=Math.log(k.k)/Math.LN2;a(this,t,e(t),ca.event.shiftKey?Math.ceil(n)-1:Math.floor(n)+1)}var m,g,y,v,x,b,_,w,M,k={x:0,y:0,k:1},A=[960,500],T=$a,E=250,L=0,I="mousedown.zoom",P="mousemove.zoom",D="mouseup.zoom",C="touchstart.zoom",O=z(t,"zoomstart","zoom","zoomend");return Ja||(Ja="onwheel"in da?(Qa=function(){return-ca.event.deltaY*(ca.event.deltaMode?120:1)},"wheel"):"onmousewheel"in da?(Qa=function(){return ca.event.wheelDelta},"mousewheel"):(Qa=function(){return-ca.event.detail},"MozMousePixelScroll")),t.event=function(t){t.each(function(){var t=O.of(this,arguments),e=k;Vl?ca.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(t)}).tween("zoom:zoom",function(){var n=A[0],r=A[1],i=g?g[0]:n/2,o=g?g[1]:r/2,a=ca.interpolateZoom([(i-k.x)/k.k,(o-k.y)/k.k,n/k.k],[(i-e.x)/e.k,(o-e.y)/e.k,n/e.k]);return function(e){var r=a(e),s=n/r[2];this.__chart__=k={x:i-r[0]*s,y:o-r[1]*s,k:s},u(t)}}).each("interrupt.zoom",function(){c(t)}).each("end.zoom",function(){c(t)}):(this.__chart__=k,l(t),u(t),c(t))})},t.translate=function(e){return arguments.length?(k={x:+e[0],y:+e[1],k:k.k},s(),t):[k.x,k.y]},t.scale=function(e){return arguments.length?(k={x:k.x,y:k.y,k:null},i(+e),s(),t):k.k},t.scaleExtent=function(e){return arguments.length?(T=null==e?$a:[+e[0],+e[1]],t):T},t.center=function(e){return arguments.length?(y=e&&[+e[0],+e[1]],t):y},t.size=function(e){return arguments.length?(A=e&&[+e[0],+e[1]],t):A},t.duration=function(e){return arguments.length?(E=+e,t):E},t.x=function(e){return arguments.length?(_=e,b=e.copy(),k={x:0,y:0,k:1},t):_},t.y=function(e){return arguments.length?(M=e,w=e.copy(),k={x:0,y:0,k:1},t):M},ca.rebind(t,O,"on")};var Qa,Ja,$a=[0,1/0];ca.color=lt,lt.prototype.toString=function(){return this.rgb()+""},ca.hsl=ut;var Ka=ut.prototype=new lt;Ka.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,this.l/t)},Ka.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,t*this.l)},Ka.rgb=function(){return ct(this.h,this.s,this.l)},ca.hcl=ft;var ts=ft.prototype=new lt;ts.brighter=function(t){return new ft(this.h,this.c,Math.min(100,this.l+es*(arguments.length?t:1)))},ts.darker=function(t){return new ft(this.h,this.c,Math.max(0,this.l-es*(arguments.length?t:1)))},ts.rgb=function(){return ht(this.h,this.c,this.l).rgb()},ca.lab=dt;var es=18,ns=.95047,rs=1,is=1.08883,os=dt.prototype=new lt;os.brighter=function(t){return new dt(Math.min(100,this.l+es*(arguments.length?t:1)),this.a,this.b)},os.darker=function(t){return new dt(Math.max(0,this.l-es*(arguments.length?t:1)),this.a,this.b)},os.rgb=function(){return pt(this.l,this.a,this.b)},ca.rgb=xt;var as=xt.prototype=new lt;as.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,n=this.g,r=this.b,i=30;return e||n||r?(e&&i>e&&(e=i),n&&i>n&&(n=i),r&&i>r&&(r=i),new xt(Math.min(255,e/t),Math.min(255,n/t),Math.min(255,r/t))):new xt(i,i,i)},as.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new xt(t*this.r,t*this.g,t*this.b)},as.hsl=function(){return kt(this.r,this.g,this.b)},as.toString=function(){return"#"+wt(this.r)+wt(this.g)+wt(this.b)};var ss=ca.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944, +slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});ss.forEach(function(t,e){ss.set(t,bt(e))}),ca.functor=zt,ca.xhr=Et(b),ca.dsv=function(t,e){function n(t,n,o){arguments.length<3&&(o=n,n=null);var a=Lt(t,e,null==n?r:i(n),o);return a.row=function(t){return arguments.length?a.response(null==(n=t)?r:i(t)):n},a}function r(t){return n.parse(t.responseText)}function i(t){return function(e){return n.parse(e.responseText,t)}}function o(e){return e.map(a).join(t)}function a(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return n.parse=function(t,e){var r;return n.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,n){return e(i(t),n)}:i})},n.parseRows=function(t,e){function n(){if(c>=u)return a;if(i)return i=!1,o;var e=c;if(34===t.charCodeAt(e)){for(var n=e;n++c;){var r=t.charCodeAt(c++),s=1;if(10===r)i=!0;else if(13===r)i=!0,10===t.charCodeAt(c)&&(++c,++s);else if(r!==l)continue;return t.slice(e,c-s)}return t.slice(e)}for(var r,i,o={},a={},s=[],u=t.length,c=0,f=0;(r=n())!==a;){for(var h=[];r!==o&&r!==a;)h.push(r),r=n();e&&null==(h=e(h,f++))||s.push(h)}return s},n.format=function(e){if(Array.isArray(e[0]))return n.formatRows(e);var r=new x,i=[];return e.forEach(function(t){for(var e in t)r.has(e)||i.push(r.add(e))}),[i.map(a).join(t)].concat(e.map(function(e){return i.map(function(t){return a(e[t])}).join(t)})).join("\n")},n.formatRows=function(t){return t.map(o).join("\n")},n},ca.csv=ca.dsv(",","text/csv"),ca.tsv=ca.dsv(" ","text/tab-separated-values");var ls,us,cs,fs,hs=this[w(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};ca.timer=function(){Dt.apply(this,arguments)},ca.timer.flush=function(){Ot(),jt()},ca.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var ds=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Rt);ca.formatPrefix=function(t,e){var n=0;return(t=+t)&&(0>t&&(t*=-1),e&&(t=ca.round(t,Ft(t,e))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),ds[8+n/3]};var ps=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ms=ca.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ca.round(t,Ft(t,e))).toFixed(Math.max(0,Math.min(20,Ft(t*(1+1e-15),e))))}}),gs=ca.time={},ys=Date;qt.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(){vs.setUTCDate.apply(this._,arguments)},setDay:function(){vs.setUTCDay.apply(this._,arguments)},setFullYear:function(){vs.setUTCFullYear.apply(this._,arguments)},setHours:function(){vs.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){vs.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){vs.setUTCMinutes.apply(this._,arguments)},setMonth:function(){vs.setUTCMonth.apply(this._,arguments)},setSeconds:function(){vs.setUTCSeconds.apply(this._,arguments)},setTime:function(){vs.setTime.apply(this._,arguments)}};var vs=Date.prototype;gs.year=Vt(function(t){return t=gs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),gs.years=gs.year.range,gs.years.utc=gs.year.utc.range,gs.day=Vt(function(t){var e=new ys(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}),gs.days=gs.day.range,gs.days.utc=gs.day.utc.range,gs.dayOfYear=function(t){var e=gs.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 n=gs[t]=Vt(function(t){return(t=gs.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=gs.year(t).getDay();return Math.floor((gs.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});gs[t+"s"]=n.range,gs[t+"s"].utc=n.utc.range,gs[t+"OfYear"]=function(t){var n=gs.year(t).getDay();return Math.floor((gs.dayOfYear(t)+(n+e)%7)/7)}}),gs.week=gs.sunday,gs.weeks=gs.sunday.range,gs.weeks.utc=gs.sunday.utc.range,gs.weekOfYear=gs.sundayOfYear;var xs={"-":"",_:" ",0:"0"},bs=/^\s*\d+/,_s=/^%/;ca.locale=function(t){return{numberFormat:Nt(t),timeFormat:Zt(t)}};var ws=ca.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ca.format=ws.numberFormat,ca.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,Ms),he(Ms.s,this.s,this),this.s?this.t+=Ms.t:this.s=Ms.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Ms=new fe;ca.geo.stream=function(t,e){t&&ks.hasOwnProperty(t.type)?ks[t.type](t,e):de(t,e)};var ks={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rt?4*qa+t:t,zs.lineStart=zs.lineEnd=zs.point=M}};ca.geo.bounds=function(){function t(t,e){x.push(b=[c=t,h=t]),f>e&&(f=e),e>d&&(d=e)}function e(e,n){var r=ye([e*Ga,n*Ga]);if(y){var i=xe(y,r),o=[i[1],-i[0],0],a=xe(o,i);we(a),a=Me(a);var l=e-p,u=l>0?1:-1,m=a[0]*Ha*u,g=wa(l)>180;if(g^(m>u*p&&u*e>m)){var v=a[1]*Ha;v>d&&(d=v)}else if(m=(m+360)%360-180,g^(m>u*p&&u*e>m)){var v=-a[1]*Ha;f>v&&(f=v)}else f>n&&(f=n),n>d&&(d=n);g?p>e?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(c>e&&(c=e),e>h&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,n);y=r,p=e}function n(){_.point=e}function r(){b[0]=c,b[1]=h,_.point=t,y=null}function i(t,n){if(y){var r=t-p;v+=wa(r)>180?r+(r>0?360:-360):r}else m=t,g=n;zs.point(t,n),e(t,n)}function o(){zs.lineStart()}function a(){i(m,g),zs.lineEnd(),wa(v)>Na&&(c=-(h=180)),b[0]=c,b[1]=h,y=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tTs?(c=-(h=180),f=-(d=90)):v>Na?d=90:-Na>v&&(f=-90),b[0]=c,b[1]=h}};return function(t){d=h=-(c=f=1/0),x=[],ca.geo.stream(t,_);var e=x.length;if(e){x.sort(l);for(var n,r=1,i=x[0],o=[i];e>r;++r)n=x[r],u(n[0],i)||u(n[1],i)?(s(i[0],n[1])>s(i[0],i[1])&&(i[1]=n[1]),s(n[0],i[1])>s(i[0],i[1])&&(i[0]=n[0])):o.push(i=n);for(var a,n,p=-(1/0),e=o.length-1,r=0,i=o[e];e>=r;i=n,++r)n=o[r],(a=s(i[1],n[0]))>p&&(p=a,c=n[0],h=i[1])}return x=b=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),ca.geo.centroid=function(t){Es=Ls=Is=Ps=Ds=Cs=Os=js=Fs=Rs=Ns=0,ca.geo.stream(t,Bs);var e=Fs,n=Rs,r=Ns,i=e*e+n*n+r*r;return Ba>i&&(e=Cs,n=Os,r=js,Na>Ls&&(e=Is,n=Ps,r=Ds),i=e*e+n*n+r*r,Ba>i)?[NaN,NaN]:[Math.atan2(n,e)*Ha,rt(r/Math.sqrt(i))*Ha]};var Es,Ls,Is,Ps,Ds,Cs,Os,js,Fs,Rs,Ns,Bs={sphere:M,point:Ae,lineStart:Te,lineEnd:ze,polygonStart:function(){Bs.lineStart=Ee},polygonEnd:function(){Bs.lineStart=Te}},qs=Oe(Ie,Ne,qe,[-qa,-qa/2]),Vs=1e9;ca.geo.clipExtent=function(){var t,e,n,r,i,o,a={stream:function(t){return i&&(i.valid=!1),i=o(t),i.valid=!0,i},extent:function(s){return arguments.length?(o=Ge(t=+s[0][0],e=+s[0][1],n=+s[1][0],r=+s[1][1]),i&&(i.valid=!1,i=null),a):[[t,e],[n,r]]}};return a.extent([[0,0],[960,500]])},(ca.geo.conicEqualArea=function(){return He(Xe)}).raw=Xe,ca.geo.albers=function(){return ca.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ca.geo.albersUsa=function(){function t(t){var o=t[0],a=t[1];return e=null,n(o,a),e||(r(o,a),e)||i(o,a),e}var e,n,r,i,o=ca.geo.albers(),a=ca.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=ca.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,n){e=[t,n]}};return t.invert=function(t){var e=o.scale(),n=o.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?a:i>=.166&&.234>i&&r>=-.214&&-.115>r?s:o).invert(t)},t.stream=function(t){var e=o.stream(t),n=a.stream(t),r=s.stream(t);return{point:function(t,i){e.point(t,i),n.point(t,i),r.point(t,i)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),a.precision(e),s.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),a.scale(.35*e),s.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var u=o.scale(),c=+e[0],f=+e[1];return n=o.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,r=a.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+Na,f+.12*u+Na],[c-.214*u-Na,f+.234*u-Na]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Na,f+.166*u+Na],[c-.115*u-Na,f+.234*u-Na]]).stream(l).point,t},t.scale(1070)};var Us,Zs,Gs,Hs,Xs,Ys,Ws={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Zs=0,Ws.lineStart=Ye},polygonEnd:function(){Ws.lineStart=Ws.lineEnd=Ws.point=M,Us+=wa(Zs/2)}},Qs={point:We,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Js={point:$e,lineStart:Ke,lineEnd:tn,polygonStart:function(){Js.lineStart=en},polygonEnd:function(){Js.point=$e,Js.lineStart=Ke,Js.lineEnd=tn}};ca.geo.path=function(){function t(t){return t&&("function"==typeof s&&o.pointRadius(+s.apply(this,arguments)),a&&a.valid||(a=i(o)),ca.geo.stream(t,a)),o.result()}function e(){return a=null,t}var n,r,i,o,a,s=4.5;return t.area=function(t){return Us=0,ca.geo.stream(t,i(Ws)),Us},t.centroid=function(t){return Is=Ps=Ds=Cs=Os=js=Fs=Rs=Ns=0,ca.geo.stream(t,i(Js)),Ns?[Fs/Ns,Rs/Ns]:js?[Cs/js,Os/js]:Ds?[Is/Ds,Ps/Ds]:[NaN,NaN]},t.bounds=function(t){return Xs=Ys=-(Gs=Hs=1/0),ca.geo.stream(t,i(Qs)),[[Gs,Hs],[Xs,Ys]]},t.projection=function(t){return arguments.length?(i=(n=t)?t.stream||on(t):b,e()):n},t.context=function(t){return arguments.length?(o=null==(r=t)?new Qe:new nn(t),"function"!=typeof s&&o.pointRadius(s),e()):r},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(o.pointRadius(+e),+e),t):s},t.projection(ca.geo.albersUsa()).context(null)},ca.geo.transform=function(t){return{stream:function(e){var n=new an(e);for(var r in t)n[r]=t[r];return n}}},an.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ca.geo.projection=ln,ca.geo.projectionMutator=un,(ca.geo.equirectangular=function(){return ln(fn)}).raw=fn.invert=fn,ca.geo.rotation=function(t){function e(e){return e=t(e[0]*Ga,e[1]*Ga),e[0]*=Ha,e[1]*=Ha,e}return t=dn(t[0]%360*Ga,t[1]*Ga,t.length>2?t[2]*Ga:0),e.invert=function(e){return e=t.invert(e[0]*Ga,e[1]*Ga),e[0]*=Ha,e[1]*=Ha,e},e},hn.invert=fn,ca.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=dn(-t[0]*Ga,-t[1]*Ga,0).invert,i=[];return n(null,null,1,{point:function(t,n){i.push(t=e(t,n)),t[0]*=Ha,t[1]*=Ha}}),{type:"Polygon",coordinates:[i]}}var e,n,r=[0,0],i=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=yn((e=+r)*Ga,i*Ga),t):e},t.precision=function(r){return arguments.length?(n=yn(e*Ga,(i=+r)*Ga),t):i},t.angle(90)},ca.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Ga,i=t[1]*Ga,o=e[1]*Ga,a=Math.sin(r),s=Math.cos(r),l=Math.sin(i),u=Math.cos(i),c=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*a)*n+(n=u*c-l*f*s)*n),l*c+u*f*s)},ca.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ca.range(Math.ceil(o/g)*g,i,g).map(h).concat(ca.range(Math.ceil(u/y)*y,l,y).map(d)).concat(ca.range(Math.ceil(r/p)*p,n,p).filter(function(t){return wa(t%g)>Na}).map(c)).concat(ca.range(Math.ceil(s/m)*m,a,m).filter(function(t){return wa(t%y)>Na}).map(f))}var n,r,i,o,a,s,l,u,c,f,h,d,p=10,m=p,g=90,y=360,v=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],o>i&&(e=o,o=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(v)):[[o,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],a=+e[1][1],r>n&&(e=r,r=n,n=e),s>a&&(e=s,s=a,a=e),t.precision(v)):[[r,s],[n,a]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(g=+e[0],y=+e[1],t):[g,y]},t.minorStep=function(e){return arguments.length?(p=+e[0],m=+e[1],t):[p,m]},t.precision=function(e){return arguments.length?(v=+e,c=xn(s,a,90),f=bn(r,n,v),h=xn(u,l,90),d=bn(o,i,v),t):v},t.majorExtent([[-180,-90+Na],[180,90-Na]]).minorExtent([[-180,-80-Na],[180,80+Na]])},ca.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||i.apply(this,arguments)]}}var e,n,r=_n,i=wn;return t.distance=function(){return ca.geo.distance(e||r.apply(this,arguments),n||i.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(i=e,n="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},ca.geo.interpolate=function(t,e){return Mn(t[0]*Ga,t[1]*Ga,e[0]*Ga,e[1]*Ga)},ca.geo.length=function(t){return $s=0,ca.geo.stream(t,Ks),$s};var $s,Ks={sphere:M,point:M,lineStart:kn,lineEnd:M,polygonStart:M,polygonEnd:M},tl=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ca.geo.azimuthalEqualArea=function(){return ln(tl)}).raw=tl;var el=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ca.geo.azimuthalEquidistant=function(){return ln(el)}).raw=el,(ca.geo.conicConformal=function(){return He(Sn)}).raw=Sn,(ca.geo.conicEquidistant=function(){return He(Tn)}).raw=Tn;var nl=An(function(t){return 1/t},Math.atan);(ca.geo.gnomonic=function(){return ln(nl)}).raw=nl,zn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Za]},(ca.geo.mercator=function(){return En(zn)}).raw=zn;var rl=An(function(){return 1},Math.asin);(ca.geo.orthographic=function(){return ln(rl)}).raw=rl;var il=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ca.geo.stereographic=function(){return ln(il)}).raw=il,Ln.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Za]},(ca.geo.transverseMercator=function(){var t=En(Ln),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=Ln,ca.geom={},ca.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=zt(n),o=zt(r),a=t.length,s=[],l=[];for(e=0;a>e;e++)s.push([+i.call(this,t[e],e),+o.call(this,t[e],e),e]);for(s.sort(Cn),e=0;a>e;e++)l.push([s[e][0],-s[e][1]]);var u=Dn(s),c=Dn(l),f=c[0]===u[0],h=c[c.length-1]===u[u.length-1],d=[];for(e=u.length-1;e>=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=r&&u.x<=o&&u.y>=i&&u.y<=a?[[r,a],[o,a],[o,i],[r,i]]:[];c.point=t[s]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Na)*Na,y:Math.round(a(t,e)/Na)*Na,i:e}})}var r=In,i=Pn,o=r,a=i,s=dl;return t?e(t):(e.links=function(t){return ur(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return ur(n(t)).cells.forEach(function(n,r){for(var i,o,a=n.site,s=n.edges.sort(Xn),l=-1,u=s.length,c=s[u-1].edge,f=c.l===a?c.r:c.l;++l=u,h=r>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pr()),f?i=u:s=u,h?a=c:l=c,o(t,e,n,r,i,a,s,l)}var c,f,h,d,p,m,g,y,v,x=zt(s),b=zt(l);if(null!=e)m=e,g=n,y=r,v=i;else if(y=v=-(m=g=1/0),f=[],h=[],p=t.length,a)for(d=0;p>d;++d)c=t[d],c.xy&&(y=c.x),c.y>v&&(v=c.y),f.push(c.x),h.push(c.y);else for(d=0;p>d;++d){var _=+x(c=t[d],d),w=+b(c,d);m>_&&(m=_),g>w&&(g=w),_>y&&(y=_),w>v&&(v=w),f.push(_),h.push(w)}var M=y-m,k=v-g;M>k?v=g+M:y=m+k;var A=pr();if(A.add=function(t){o(A,t,+x(t,++d),+b(t,d),m,g,y,v)},A.visit=function(t){mr(t,A,m,g,y,v)},A.find=function(t){return gr(A,t[0],t[1],m,g,y,v)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=yl.get(n)||gl,r=vl.get(r)||b,Mr(r(n.apply(null,fa.call(arguments,1))))},ca.interpolateHcl=jr,ca.interpolateHsl=Fr,ca.interpolateLab=Rr,ca.interpolateRound=Nr,ca.transform=function(t){var e=da.createElementNS(ca.ns.prefix.svg,"g");return(ca.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Br(n?n.matrix:xl)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var xl={a:1,b:0,c:0,d:1,e:0,f:0};ca.interpolateTransform=Wr,ca.layout={},ca.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++ns*s/y){if(m>l){var u=e.charge/l;t.px-=o*u,t.py-=a*u}return!0}if(e.point&&l&&m>l){var u=e.pointCharge/l;t.px-=o*u,t.py-=a*u}}return!e.charge}}function e(t){t.px=ca.event.x,t.py=ca.event.y,l.resume()}var n,r,i,o,a,s,l={},u=ca.dispatch("start","tick","end"),c=[1,1],f=.9,h=bl,d=_l,p=-30,m=wl,g=.1,y=.64,v=[],x=[];return l.tick=function(){if((i*=.99)<.005)return n=null,u.end({type:"end",alpha:i=0}),!0;var e,r,l,h,d,m,y,b,_,w=v.length,M=x.length;for(r=0;M>r;++r)l=x[r],h=l.source,d=l.target,b=d.x-h.x,_=d.y-h.y,(m=b*b+_*_)&&(m=i*a[r]*((m=Math.sqrt(m))-o[r])/m,b*=m,_*=m,d.x-=b*(y=h.weight+d.weight?h.weight/(h.weight+d.weight):.5),d.y-=_*y,h.x+=b*(y=1-y),h.y+=_*y);if((y=i*g)&&(b=c[0]/2,_=c[1]/2,r=-1,y))for(;++r0?i=t:(n.c=null,n.t=NaN,n=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),n=Dt(l.tick)),l):i},l.start=function(){function t(t,r){if(!n){for(n=new Array(i),l=0;i>l;++l)n[l]=[];for(l=0;u>l;++l){var o=x[l];n[o.source.index].push(o.target),n[o.target.index].push(o.source)}}for(var a,s=n[e],l=-1,c=s.length;++le;++e)(r=v[e]).index=e,r.weight=0;for(e=0;u>e;++e)r=x[e],"number"==typeof r.source&&(r.source=v[r.source]),"number"==typeof r.target&&(r.target=v[r.target]),++r.source.weight,++r.target.weight;for(e=0;i>e;++e)r=v[e],isNaN(r.x)&&(r.x=t("x",f)),isNaN(r.y)&&(r.y=t("y",m)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(o=[],"function"==typeof h)for(e=0;u>e;++e)o[e]=+h.call(this,x[e],e);else for(e=0;u>e;++e)o[e]=h;if(a=[],"function"==typeof d)for(e=0;u>e;++e)a[e]=+d.call(this,x[e],e);else for(e=0;u>e;++e)a[e]=d;if(s=[],"function"==typeof p)for(e=0;i>e;++e)s[e]=+p.call(this,v[e],e);else for(e=0;i>e;++e)s[e]=p;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return r||(r=ca.behavior.drag().origin(b).on("dragstart.force",ei).on("drag.force",e).on("dragend.force",ni)),arguments.length?void this.on("mouseover.force",ri).on("mouseout.force",ii).call(r):r},ca.rebind(l,u,"on")};var bl=20,_l=1,wl=1/0;ca.layout.hierarchy=function(){function t(i){var o,a=[i],s=[];for(i.depth=0;null!=(o=a.pop());)if(s.push(o),(u=n.call(t,o,o.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)a.push(c=u[l]),c.parent=o,c.depth=o.depth+1;r&&(o.value=0),o.children=u}else r&&(o.value=+r.call(t,o,o.depth)||0),delete o.children;return li(i,function(t){var n,i;e&&(n=t.children)&&n.sort(e),r&&(i=t.parent)&&(i.value+=t.value)}),s}var e=fi,n=ui,r=ci;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},ca.layout.partition=function(){function t(e,n,r,i){var o=e.children;if(e.x=n,e.y=e.depth*i,e.dx=r,e.dy=i,o&&(a=o.length)){var a,s,l,u=-1;for(r=e.value?r/e.value:0;++uf?-1:1),p=ca.sum(u),m=p?(f-l*d)/p:0,g=ca.range(l),y=[];return null!=n&&g.sort(n===Ml?function(t,e){return u[e]-u[t]}:function(t,e){return n(a[t],a[e])}),g.forEach(function(t){y[t]={data:a[t],value:s=u[t],startAngle:c,endAngle:c+=s*m+d,padAngle:h}}),y}var e=Number,n=Ml,r=0,i=Va,o=0;return t.value=function(n){return arguments.length?(e=n,t):e},t.sort=function(e){return arguments.length?(n=e,t):n},t.startAngle=function(e){return arguments.length?(r=e,t):r},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(o=e,t):o},t};var Ml={};ca.layout.stack=function(){function t(s,l){if(!(h=s.length))return s;var u=s.map(function(n,r){return e.call(t,n,r)}),c=u.map(function(e){return e.map(function(e,n){return[o.call(t,e,n),a.call(t,e,n)]})}),f=n.call(t,c,l);u=ca.permute(u,f),c=ca.permute(c,f);var h,d,p,m,g=r.call(t,c,l),y=u[0].length;for(p=0;y>p;++p)for(i.call(t,u[0][p],m=g[p],c[0][p][1]),d=1;h>d;++d)i.call(t,u[d][p],m+=c[d-1][p][1],c[d][p][1]);return s}var e=b,n=gi,r=yi,i=mi,o=di,a=pi;return t.values=function(n){return arguments.length?(e=n,t):e},t.order=function(e){return arguments.length?(n="function"==typeof e?e:kl.get(e)||gi,t):n},t.offset=function(e){ +return arguments.length?(r="function"==typeof e?e:Al.get(e)||yi,t):r},t.x=function(e){return arguments.length?(o=e,t):o},t.y=function(e){return arguments.length?(a=e,t):a},t.out=function(e){return arguments.length?(i=e,t):i},t};var kl=ca.map({"inside-out":function(t){var e,n,r=t.length,i=t.map(vi),o=t.map(xi),a=ca.range(r).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,u=[],c=[];for(e=0;r>e;++e)n=a[e],l>s?(s+=o[n],u.push(n)):(l+=o[n],c.push(n));return c.reverse().concat(u)},reverse:function(t){return ca.range(t.length).reverse()},"default":gi}),Al=ca.map({silhouette:function(t){var e,n,r,i=t.length,o=t[0].length,a=[],s=0,l=[];for(n=0;o>n;++n){for(e=0,r=0;i>e;e++)r+=t[e][n][1];r>s&&(s=r),a.push(r)}for(n=0;o>n;++n)l[n]=(s-a[n])/2;return l},wiggle:function(t){var e,n,r,i,o,a,s,l,u,c=t.length,f=t[0],h=f.length,d=[];for(d[0]=l=u=0,n=1;h>n;++n){for(e=0,i=0;c>e;++e)i+=t[e][n][1];for(e=0,o=0,s=f[n][0]-f[n-1][0];c>e;++e){for(r=0,a=(t[e][n][1]-t[e][n-1][1])/(2*s);e>r;++r)a+=(t[r][n][1]-t[r][n-1][1])/s;o+=a*t[e][n][1]}d[n]=l-=i?o/i*s:0,u>l&&(u=l)}for(n=0;h>n;++n)d[n]-=u;return d},expand:function(t){var e,n,r,i=t.length,o=t[0].length,a=1/i,s=[];for(n=0;o>n;++n){for(e=0,r=0;i>e;e++)r+=t[e][n][1];if(r)for(e=0;i>e;e++)t[e][n][1]/=r;else for(e=0;i>e;e++)t[e][n][1]=a}for(n=0;o>n;++n)s[n]=0;return s},zero:yi});ca.layout.histogram=function(){function t(t,o){for(var a,s,l=[],u=t.map(n,this),c=r.call(this,u,o),f=i.call(this,c,u,o),o=-1,h=u.length,d=f.length-1,p=e?1:1/h;++o0)for(o=-1;++o=c[0]&&s<=c[1]&&(a=l[ca.bisect(f,s,1,d)-1],a.y+=p,a.push(t[o]));return l}var e=!0,n=Number,r=Mi,i=_i;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=zt(e),t):r},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:zt(e),t):i},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},ca.layout.pack=function(){function t(t,o){var a=n.call(this,t,o),s=a[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,zi),r){var f=r*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=f}),li(s,zi),li(s,function(t){t.r-=f})}return Ii(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),a}var e,n=ca.layout.hierarchy().sort(ki),r=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ai(t,n)},ca.layout.tree=function(){function t(t,i){var c=a.call(this,t,i),f=c[0],h=e(f);if(li(h,n),h.parent.m=-h.z,si(h,r),u)si(f,o);else{var d=f,p=f,m=f;si(f,function(t){t.xp.x&&(p=t),t.depth>m.depth&&(m=t)});var g=s(d,p)/2-d.x,y=l[0]/(p.x+s(p,d)/2+g),v=l[1]/(m.depth||1);si(f,function(t){t.x=(t.x+g)*y,t.y=t.depth*v})}return c}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var i,o=e.children,a=0,s=o.length;s>a;++a)r.push((o[a]=i={_:o[a],parent:e,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return n.children[0]}function n(t){var e=t.children,n=t.parent.children,r=t.i?n[t.i-1]:null;if(e.length){Fi(t);var o=(e[0].z+e[e.length-1].z)/2;r?(t.z=r.z+s(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+s(t._,r._));t.parent.A=i(t,r,t.parent.A||n[0])}function r(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t,e,n){if(e){for(var r,i=t,o=t,a=e,l=i.parent.children[0],u=i.m,c=o.m,f=a.m,h=l.m;a=Oi(a),i=Ci(i),a&&i;)l=Ci(l),o=Oi(o),o.a=t,r=a.z+f-i.z-u+s(a._,i._),r>0&&(ji(Ri(a,t,n),t,r),u+=r,c+=r),f+=a.m,u+=i.m,h+=l.m,c+=o.m;a&&!Oi(o)&&(o.t=a,o.m+=f-c),i&&!Ci(l)&&(l.t=i,l.m+=u-h,n=t)}return n}function o(t){t.x*=l[0],t.y=t.depth*l[1]}var a=ca.layout.hierarchy().sort(null).value(null),s=Di,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?o:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:o,t):u?l:null},ai(t,a)},ca.layout.cluster=function(){function t(t,o){var a,s=e.call(this,t,o),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Ni(e)):(t.x=a?u+=n(t,a):0,t.y=0,a=t)});var c=qi(l),f=Vi(l),h=c.x-n(c,f)/2,d=f.x+n(f,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*r[0],t.y=(l.y-t.y)*r[1]}:function(t){t.x=(t.x-h)/(d-h)*r[0],t.y=(1-(l.y?t.y/l.y:1))*r[1]}),s}var e=ca.layout.hierarchy().sort(null).value(null),n=Di,r=[1,1],i=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(i=null==(r=e),t):i?null:r},t.nodeSize=function(e){return arguments.length?(i=null!=(r=e),t):i?r:null},ai(t,e)},ca.layout.treemap=function(){function t(t,e){for(var n,r,i=-1,o=t.length;++ie?0:e),n.area=isNaN(r)||0>=r?0:r}function e(n){var o=n.children;if(o&&o.length){var a,s,l,u=f(n),c=[],h=o.slice(),p=1/0,m="slice"===d?u.dx:"dice"===d?u.dy:"slice-dice"===d?1&n.depth?u.dy:u.dx:Math.min(u.dx,u.dy);for(t(h,u.dx*u.dy/n.value),c.area=0;(l=h.length)>0;)c.push(a=h[l-1]),c.area+=a.area,"squarify"!==d||(s=r(c,m))<=p?(h.pop(),p=s):(c.area-=c.pop().area,i(c,m,u,!1),m=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,m,u,!0),c.length=c.area=0),o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,a=f(e),s=r.slice(),l=[];for(t(s,a.dx*a.dy/e.value),l.area=0;o=s.pop();)l.push(o),l.area+=o.area,null!=o.z&&(i(l,o.z?a.dx:a.dy,a,!s.length),l.length=l.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,i=0,o=1/0,a=-1,s=t.length;++an&&(o=n),n>i&&(i=n));return r*=r,e*=e,r?Math.max(e*i*p/r,r/(e*o*p)):1/0}function i(t,e,n,r){var i,o=-1,a=t.length,s=n.x,u=n.y,c=e?l(t.area/e):0;if(e==n.dx){for((r||c>n.dy)&&(c=n.dy);++on.dx)&&(c=n.dx);++on&&(e=1),1>n&&(t=0),function(){var n,r,i;do n=2*Math.random()-1,r=2*Math.random()-1,i=n*n+r*r;while(!i||i>1);return t+e*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=ca.random.normal.apply(ca,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ca.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;t>n;n++)e+=Math.random();return e}}},ca.scale={};var Sl={floor:b,ceil:b};ca.scale.linear=function(){return Ji([0,1],[0,1],_r,!1)};var Tl={s:1,g:1,p:1,r:1,e:1};ca.scale.log=function(){return oo(ca.scale.linear().domain([0,1]),10,!0,[1,10])};var zl=ca.format(".0e"),El={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};ca.scale.pow=function(){return ao(ca.scale.linear(),1,[0,1])},ca.scale.sqrt=function(){return ca.scale.pow().exponent(.5)},ca.scale.ordinal=function(){return lo([],{t:"range",a:[[]]})},ca.scale.category10=function(){return ca.scale.ordinal().range(Ll)},ca.scale.category20=function(){return ca.scale.ordinal().range(Il)},ca.scale.category20b=function(){return ca.scale.ordinal().range(Pl)},ca.scale.category20c=function(){return ca.scale.ordinal().range(Dl)};var Ll=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(_t),Il=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(_t),Pl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(_t),Dl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(_t);ca.scale.quantile=function(){return uo([],[])},ca.scale.quantize=function(){return co(0,1,[0,1])},ca.scale.threshold=function(){return fo([.5],[0,1])},ca.scale.identity=function(){return ho([0,1])},ca.svg={},ca.svg.arc=function(){function t(){var t=Math.max(0,+n.apply(this,arguments)),u=Math.max(0,+r.apply(this,arguments)),c=a.apply(this,arguments)-Za,f=s.apply(this,arguments)-Za,h=Math.abs(f-c),d=c>f?0:1;if(t>u&&(p=u,u=t,t=p),h>=Ua)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,m,g,y,v,x,b,_,w,M,k,A,S=0,T=0,z=[];if((y=(+l.apply(this,arguments)||0)/2)&&(g=o===Cl?Math.sqrt(t*t+u*u):+o.apply(this,arguments),d||(T*=-1),u&&(T=rt(g/u*Math.sin(y))),t&&(S=rt(g/t*Math.sin(y)))),u){v=u*Math.cos(c+T),x=u*Math.sin(c+T),b=u*Math.cos(f-T),_=u*Math.sin(f-T);var E=Math.abs(f-c-2*T)<=qa?0:1;if(T&&bo(v,x,b,_)===d^E){var L=(c+f)/2;v=u*Math.cos(L),x=u*Math.sin(L),b=_=null}}else v=x=0;if(t){w=t*Math.cos(f-S),M=t*Math.sin(f-S),k=t*Math.cos(c+S),A=t*Math.sin(c+S);var I=Math.abs(c-f+2*S)<=qa?0:1;if(S&&bo(w,M,k,A)===1-d^I){var P=(c+f)/2;w=t*Math.cos(P),M=t*Math.sin(P),k=A=null}}else w=M=0;if(h>Na&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){m=u>t^d?0:1;var D=p,C=p;if(qa>h){var O=null==k?[w,M]:null==b?[v,x]:jn([v,x],[k,A],[b,_],[w,M]),j=v-O[0],F=x-O[1],R=b-O[0],N=_-O[1],B=1/Math.sin(Math.acos((j*R+F*N)/(Math.sqrt(j*j+F*F)*Math.sqrt(R*R+N*N)))/2),q=Math.sqrt(O[0]*O[0]+O[1]*O[1]);C=Math.min(p,(t-q)/(B-1)),D=Math.min(p,(u-q)/(B+1))}if(null!=b){var V=_o(null==k?[w,M]:[k,A],[v,x],u,D,d),U=_o([b,_],[w,M],u,D,d);p===D?z.push("M",V[0],"A",D,",",D," 0 0,",m," ",V[1],"A",u,",",u," 0 ",1-d^bo(V[1][0],V[1][1],U[1][0],U[1][1]),",",d," ",U[1],"A",D,",",D," 0 0,",m," ",U[0]):z.push("M",V[0],"A",D,",",D," 0 1,",m," ",U[0])}else z.push("M",v,",",x);if(null!=k){var Z=_o([v,x],[k,A],t,-C,d),G=_o([w,M],null==b?[v,x]:[b,_],t,-C,d);p===C?z.push("L",G[0],"A",C,",",C," 0 0,",m," ",G[1],"A",t,",",t," 0 ",d^bo(G[1][0],G[1][1],Z[1][0],Z[1][1]),",",1-d," ",Z[1],"A",C,",",C," 0 0,",m," ",Z[0]):z.push("L",G[0],"A",C,",",C," 0 0,",m," ",Z[0])}else z.push("L",w,",",M)}else z.push("M",v,",",x),null!=b&&z.push("A",u,",",u," 0 ",E,",",d," ",b,",",_),z.push("L",w,",",M),null!=k&&z.push("A",t,",",t," 0 ",I,",",1-d," ",k,",",A);return z.push("Z"),z.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var n=mo,r=go,i=po,o=Cl,a=yo,s=vo,l=xo;return t.innerRadius=function(e){return arguments.length?(n=zt(e),t):n},t.outerRadius=function(e){return arguments.length?(r=zt(e),t):r},t.cornerRadius=function(e){return arguments.length?(i=zt(e),t):i},t.padRadius=function(e){return arguments.length?(o=e==Cl?Cl:zt(e),t):o},t.startAngle=function(e){return arguments.length?(a=zt(e),t):a},t.endAngle=function(e){return arguments.length?(s=zt(e),t):s},t.padAngle=function(e){return arguments.length?(l=zt(e),t):l},t.centroid=function(){var t=(+n.apply(this,arguments)+ +r.apply(this,arguments))/2,e=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-Za;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Cl="auto";ca.svg.line=function(){return wo(b)};var Ol=ca.map({linear:Mo,"linear-closed":ko,step:Ao,"step-before":So,"step-after":To,basis:Do,"basis-open":Co,"basis-closed":Oo,bundle:jo,cardinal:Lo,"cardinal-open":zo,"cardinal-closed":Eo,monotone:Vo});Ol.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var jl=[0,2/3,1/3,0],Fl=[0,1/3,2/3,0],Rl=[0,1/6,2/3,1/6];ca.svg.line.radial=function(){var t=wo(Uo);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},So.reverse=To,To.reverse=So,ca.svg.area=function(){return Zo(b)},ca.svg.area.radial=function(){var t=Zo(Uo);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},ca.svg.chord=function(){function t(t,s){var l=e(this,o,t,s),u=e(this,a,t,s);return"M"+l.p0+r(l.r,l.p1,l.a1-l.a0)+(n(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+r(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function e(t,e,n,r){var i=e.call(t,n,r),o=s.call(t,i,r),a=l.call(t,i,r)-Za,c=u.call(t,i,r)-Za;return{r:o,a0:a,a1:c,p0:[o*Math.cos(a),o*Math.sin(a)],p1:[o*Math.cos(c),o*Math.sin(c)]}}function n(t,e){return t.a0==e.a0&&t.a1==e.a1}function r(t,e,n){return"A"+t+","+t+" 0 "+ +(n>qa)+",1 "+e}function i(t,e,n,r){return"Q 0,0 "+r}var o=_n,a=wn,s=Go,l=yo,u=vo;return t.radius=function(e){return arguments.length?(s=zt(e),t):s},t.source=function(e){return arguments.length?(o=zt(e),t):o},t.target=function(e){return arguments.length?(a=zt(e),t):a},t.startAngle=function(e){return arguments.length?(l=zt(e),t):l},t.endAngle=function(e){return arguments.length?(u=zt(e),t):u},t},ca.svg.diagonal=function(){function t(t,i){var o=e.call(this,t,i),a=n.call(this,t,i),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=_n,n=wn,r=Ho;return t.source=function(n){return arguments.length?(e=zt(n),t):e},t.target=function(e){return arguments.length?(n=zt(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},ca.svg.diagonal.radial=function(){var t=ca.svg.diagonal(),e=Ho,n=t.projection;return t.projection=function(t){return arguments.length?n(Xo(e=t)):e},t},ca.svg.symbol=function(){function t(t,r){return(Nl.get(e.call(this,t,r))||Qo)(n.call(this,t,r))}var e=Wo,n=Yo;return t.type=function(n){return arguments.length?(e=zt(n),t):e},t.size=function(e){return arguments.length?(n=zt(e),t):n},t};var Nl=ca.map({circle:Qo,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*ql)),n=e*ql;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Bl),n=e*Bl/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Bl),n=e*Bl/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ca.svg.symbolTypes=Nl.keys();var Bl=Math.sqrt(3),ql=Math.tan(30*Ga);Ia.transition=function(t){for(var e,n,r=Vl||++Hl,i=ea(t),o=[],a=Ul||{time:Date.now(),ease:zr,delay:0,duration:250},s=-1,l=this.length;++so;o++){i.push(e=[]);for(var n=this[o],s=0,l=n.length;l>s;s++)(r=n[s])&&t.call(r,r.__data__,s,o)&&e.push(r)}return $o(i,this.namespace,this.id)},Gl.tween=function(t,e){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(t):G(this,null==e?function(e){e[r][n].tween.remove(t)}:function(i){i[r][n].tween.set(t,e)})},Gl.attr=function(t,e){function n(){this.removeAttribute(s)}function r(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?n:(t+="",function(){var e,n=this.getAttribute(s);return n!==t&&(e=a(n,t),function(t){this.setAttribute(s,e(t))})})}function o(t){return null==t?r:(t+="",function(){var e,n=this.getAttributeNS(s.space,s.local);return n!==t&&(e=a(n,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var a="transform"==t?Wr:_r,s=ca.ns.qualify(t);return Ko(this,"attr."+t,e,s.local?o:i)},Gl.attrTween=function(t,e){function n(t,n){var r=e.call(this,t,n,this.getAttribute(i));return r&&function(t){this.setAttribute(i,r(t))}}function r(t,n){var r=e.call(this,t,n,this.getAttributeNS(i.space,i.local));return r&&function(t){this.setAttributeNS(i.space,i.local,r(t))}}var i=ca.ns.qualify(t);return this.tween("attr."+t,i.local?r:n)},Gl.style=function(t,e,n){function i(){this.style.removeProperty(t)}function o(e){return null==e?i:(e+="",function(){var i,o=r(this).getComputedStyle(this,null).getPropertyValue(t);return o!==e&&(i=_r(o,e),function(e){this.style.setProperty(t,i(e),n)})})}var a=arguments.length;if(3>a){if("string"!=typeof t){2>a&&(e="");for(n in t)this.style(n,t[n],e);return this}n=""}return Ko(this,"style."+t,e,o)},Gl.styleTween=function(t,e,n){function i(i,o){var a=e.call(this,i,o,r(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(e){this.style.setProperty(t,a(e),n)}}return arguments.length<3&&(n=""),this.tween("style."+t,i)},Gl.text=function(t){return Ko(this,"text",t,ta)},Gl.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Gl.ease=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].ease:("function"!=typeof t&&(t=ca.ease.apply(ca,arguments)),G(this,function(r){r[n][e].ease=t}))},Gl.delay=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].delay:G(this,"function"==typeof t?function(r,i,o){r[n][e].delay=+t.call(r,r.__data__,i,o)}:(t=+t,function(r){r[n][e].delay=t}))},Gl.duration=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].duration:G(this,"function"==typeof t?function(r,i,o){r[n][e].duration=Math.max(1,t.call(r,r.__data__,i,o))}:(t=Math.max(1,t),function(r){r[n][e].duration=t}))},Gl.each=function(t,e){var n=this.id,r=this.namespace;if(arguments.length<2){var i=Ul,o=Vl;try{Vl=n,G(this,function(e,i,o){Ul=e[r][n],t.call(e,e.__data__,i,o)})}finally{Ul=i,Vl=o}}else G(this,function(i){var o=i[r][n];(o.event||(o.event=ca.dispatch("start","end","interrupt"))).on(t,e)});return this},Gl.transition=function(){for(var t,e,n,r,i=this.id,o=++Hl,a=this.namespace,s=[],l=0,u=this.length;u>l;l++){s.push(t=[]);for(var e=this[l],c=0,f=e.length;f>c;c++)(n=e[c])&&(r=n[a][i],na(n,c,a,o,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),t.push(n)}return $o(s,a,o)},ca.svg.axis=function(){function t(t){t.each(function(){var t,u=ca.select(this),c=this.__chart__||n,f=this.__chart__=n.copy(),h=null==l?f.ticks?f.ticks.apply(f,s):f.domain():l,d=null==e?f.tickFormat?f.tickFormat.apply(f,s):b:e,p=u.selectAll(".tick").data(h,f),m=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Na),g=ca.transition(p.exit()).style("opacity",Na).remove(),y=ca.transition(p.order()).style("opacity",1),v=Math.max(i,0)+a,x=Hi(f),_=u.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),ca.transition(_));m.append("line"),m.append("text");var M,k,A,S,T=m.select("line"),z=y.select("line"),E=p.select("text").text(d),L=m.select("text"),I=y.select("text"),P="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(t=ra,M="x",A="y",k="x2",S="y2",E.attr("dy",0>P?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+P*o+"V0H"+x[1]+"V"+P*o)):(t=ia,M="y",A="x",k="y2",S="x2",E.attr("dy",".32em").style("text-anchor",0>P?"end":"start"),w.attr("d","M"+P*o+","+x[0]+"H0V"+x[1]+"H"+P*o)),T.attr(S,P*i),L.attr(A,P*v),z.attr(k,0).attr(S,P*i),I.attr(M,0).attr(A,P*v),f.rangeBand){var D=f,C=D.rangeBand()/2;c=f=function(t){return D(t)+C}}else c.rangeBand?c=f:g.call(t,f,c);m.call(t,c,f),y.call(t,f,f)})}var e,n=ca.scale.linear(),r=Xl,i=6,o=6,a=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(n=e,t):n},t.orient=function(e){return arguments.length?(r=e in Yl?e+"":Xl,t):r},t.ticks=function(){return arguments.length?(s=ha(arguments),t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(n){return arguments.length?(e=n,t):e},t.tickSize=function(e){var n=arguments.length;return n?(i=+e,o=+arguments[n-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(o=+e,t):o},t.tickPadding=function(e){return arguments.length?(a=+e,t):a},t.tickSubdivide=function(){return arguments.length&&t},t};var Xl="bottom",Yl={top:1,right:1,bottom:1,left:1};ca.svg.brush=function(){function t(r){r.each(function(){var r=ca.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),a=r.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),r.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=r.selectAll(".resize").data(m,b);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Wl[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var l,f=ca.transition(r),h=ca.transition(a);u&&(l=Hi(u),h.attr("x",l[0]).attr("width",l[1]-l[0]),n(f)),c&&(l=Hi(c),h.attr("y",l[0]).attr("height",l[1]-l[0]),i(f)),e(f)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+f[+/e$/.test(t)]+","+h[+/^s/.test(t)]+")"})}function n(t){t.select(".extent").attr("x",f[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function o(){function o(){32==ca.event.keyCode&&(E||(x=null,I[0]-=f[1],I[1]-=h[1],E=2),S())}function m(){32==ca.event.keyCode&&2==E&&(I[0]+=f[1],I[1]+=h[1],E=0,S())}function g(){var t=ca.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),E||(ca.event.altKey?(x||(x=[(f[0]+f[1])/2,(h[0]+h[1])/2]),I[0]=f[+(t[0]c?(i=r,r=c):i=c),m[0]!=r||m[1]!=i?(n?s=null:a=null,m[0]=r,m[1]=i,!0):void 0}function v(){g(),k.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),ca.select("body").style("cursor",null),P.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),L(),M({type:"brushend"})}var x,b,_=this,w=ca.select(ca.event.target),M=l.of(_,arguments),k=ca.select(_),A=w.datum(),T=!/^(n|s)$/.test(A)&&u,z=!/^(e|w)$/.test(A)&&c,E=w.classed("extent"),L=J(_),I=ca.mouse(_),P=ca.select(r(_)).on("keydown.brush",o).on("keyup.brush",m);if(ca.event.changedTouches?P.on("touchmove.brush",g).on("touchend.brush",v):P.on("mousemove.brush",g).on("mouseup.brush",v),k.interrupt().selectAll("*").interrupt(),E)I[0]=f[0]-I[0],I[1]=h[0]-I[1];else if(A){var D=+/w$/.test(A),C=+/^n/.test(A);b=[f[1-D]-I[0],h[1-C]-I[1]],I[0]=f[D],I[1]=h[C]}else ca.event.altKey&&(x=I.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),ca.select("body").style("cursor",w.style("cursor")),M({type:"brushstart"}),g()}var a,s,l=z(t,"brushstart","brush","brushend"),u=null,c=null,f=[0,0],h=[0,0],d=!0,p=!0,m=Ql[0];return t.event=function(t){t.each(function(){var t=l.of(this,arguments),e={x:f,y:h,i:a,j:s},n=this.__chart__||e;this.__chart__=e,Vl?ca.select(this).transition().each("start.brush",function(){a=n.i,s=n.j,f=n.x,h=n.y,t({type:"brushstart"})}).tween("brush:brush",function(){var n=wr(f,e.x),r=wr(h,e.y);return a=s=null,function(i){f=e.x=n(i),h=e.y=r(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(u=e,m=Ql[!u<<1|!c],t):u},t.y=function(e){return arguments.length?(c=e,m=Ql[!u<<1|!c],t):c},t.clamp=function(e){return arguments.length?(u&&c?(d=!!e[0],p=!!e[1]):u?d=!!e:c&&(p=!!e),t):u&&c?[d,p]:u?d:c?p:null},t.extent=function(e){var n,r,i,o,l;return arguments.length?(u&&(n=e[0],r=e[1],c&&(n=n[0],r=r[0]),a=[n,r],u.invert&&(n=u(n),r=u(r)),n>r&&(l=n,n=r,r=l),n==f[0]&&r==f[1]||(f=[n,r])),c&&(i=e[0],o=e[1],u&&(i=i[1],o=o[1]),s=[i,o],c.invert&&(i=c(i),o=c(o)),i>o&&(l=i,i=o,o=l),i==h[0]&&o==h[1]||(h=[i,o])),t):(u&&(a?(n=a[0],r=a[1]):(n=f[0],r=f[1],u.invert&&(n=u.invert(n),r=u.invert(r)),n>r&&(l=n,n=r,r=l))),c&&(s?(i=s[0],o=s[1]):(i=h[0],o=h[1],c.invert&&(i=c.invert(i),o=c.invert(o)),i>o&&(l=i,i=o,o=l))),u&&c?[[n,i],[r,o]]:u?[n,r]:c&&[i,o])},t.clear=function(){return t.empty()||(f=[0,0],h=[0,0],a=s=null),t},t.empty=function(){return!!u&&f[0]==f[1]||!!c&&h[0]==h[1]},ca.rebind(t,l,"on")};var Wl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ql=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Jl=gs.format=ws.timeFormat,$l=Jl.utc,Kl=$l("%Y-%m-%dT%H:%M:%S.%LZ");Jl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?oa:Kl,oa.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},oa.toString=Kl.toString,gs.second=Vt(function(t){return new ys(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),gs.seconds=gs.second.range,gs.seconds.utc=gs.second.utc.range,gs.minute=Vt(function(t){return new ys(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),gs.minutes=gs.minute.range,gs.minutes.utc=gs.minute.utc.range,gs.hour=Vt(function(t){var e=t.getTimezoneOffset()/60;return new ys(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),gs.hours=gs.hour.range,gs.hours.utc=gs.hour.utc.range,gs.month=Vt(function(t){return t=gs.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),gs.months=gs.month.range,gs.months.utc=gs.month.utc.range;var tu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],eu=[[gs.second,1],[gs.second,5],[gs.second,15],[gs.second,30],[gs.minute,1],[gs.minute,5],[gs.minute,15],[gs.minute,30],[gs.hour,1],[gs.hour,3],[gs.hour,6],[gs.hour,12],[gs.day,1],[gs.day,2],[gs.week,1],[gs.month,1],[gs.month,3],[gs.year,1]],nu=Jl.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Ie]]),ru={range:function(t,e,n){return ca.range(Math.ceil(t/n)*n,+e,n).map(sa)},floor:b,ceil:b};eu.year=gs.year,gs.scale=function(){return aa(ca.scale.linear(),eu,nu)};var iu=eu.map(function(t){return[t[0].utc,t[1]]}),ou=$l.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Ie]]);iu.year=gs.year.utc,gs.scale.utc=function(){return aa(ca.scale.linear(),iu,ou)},ca.text=Et(function(t){return t.responseText}),ca.json=function(t,e){return Lt(t,"application/json",la,e)},ca.html=function(t,e){return Lt(t,"text/html",ua,e)},ca.xml=Et(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=ca,t(ca)):"object"==typeof n&&n.exports?n.exports=ca:this.d3=ca}()},{}],19:[function(e,n,r){(function(r,i){(function(){"use strict";function o(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return"function"==typeof t}function s(t){H=t}function l(t){Q=t}function u(){return function(){r.nextTick(p)}}function c(){return function(){G(p)}}function f(){var t=0,e=new K(p),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function h(){var t=new MessageChannel;return t.port1.onmessage=p,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(p,1)}}function p(){for(var t=0;W>t;t+=2){var e=nt[t],n=nt[t+1];e(n),nt[t]=void 0,nt[t+1]=void 0}W=0}function m(){try{var t=e,n=t("vertx");return G=n.runOnLoop||n.runOnContext,c()}catch(r){return d()}}function g(t,e){var n=this,r=n._state;if(r===at&&!t||r===st&&!e)return this;var i=new this.constructor(v),o=n._result;if(r){var a=arguments[r-1];Q(function(){C(r,i,a,o)})}else L(n,i,t,e);return i}function y(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(v);return S(n,t),n}function v(){}function x(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return lt.error=e,lt}}function w(t,e,n,r){try{t.call(e,n,r)}catch(i){return i}}function M(t,e,n){Q(function(t){var r=!1,i=w(n,e,function(n){r||(r=!0,e!==n?S(t,n):z(t,n))},function(e){r||(r=!0,E(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,E(t,i))},t)}function k(t,e){e._state===at?z(t,e._result):e._state===st?E(t,e._result):L(e,void 0,function(e){S(t,e)},function(e){E(t,e)})}function A(t,e,n){e.constructor===t.constructor&&n===rt&&constructor.resolve===it?k(t,e):n===lt?E(t,lt.error):void 0===n?z(t,e):a(n)?M(t,e,n):z(t,e)}function S(t,e){t===e?E(t,x()):o(e)?A(t,e,_(e)):z(t,e)}function T(t){t._onerror&&t._onerror(t._result),I(t)}function z(t,e){t._state===ot&&(t._result=e,t._state=at,0!==t._subscribers.length&&Q(I,t))}function E(t,e){t._state===ot&&(t._state=st,t._result=e,Q(T,t))}function L(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+at]=n,i[o+st]=r,0===o&&t._state&&Q(I,t)}function I(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,i,o=t._result,a=0;aa;a++)L(r.resolve(t[a]),void 0,e,n);return i}function R(t){var e=this,n=new e(v);return E(n,t),n}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function q(t){this._id=dt++,this._state=void 0,this._result=void 0,this._subscribers=[],v!==t&&("function"!=typeof t&&N(),this instanceof q?O(this,t):B())}function V(t,e){this._instanceConstructor=t,this.promise=new t(v),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?z(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&z(this.promise,this._result))):E(this.promise,this._validationError())}function U(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;n&&"[object Promise]"===Object.prototype.toString.call(n.resolve())&&!n.cast||(t.Promise=pt)}var Z;Z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var G,H,X,Y=Z,W=0,Q=function(t,e){nt[W]=t,nt[W+1]=e,W+=2,2===W&&(H?H(p):X())},J="undefined"!=typeof window?window:void 0,$=J||{},K=$.MutationObserver||$.WebKitMutationObserver,tt="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);X=tt?u():K?f():et?h():void 0===J&&"function"==typeof e?m():d();var rt=g,it=y,ot=void 0,at=1,st=2,lt=new P,ut=new P,ct=j,ft=F,ht=R,dt=0,pt=q;q.all=ct,q.race=ft,q.resolve=it,q.reject=ht,q._setScheduler=s,q._setAsap=l,q._asap=Q,q.prototype={constructor:q,then:rt,"catch":function(t){return this.then(null,t)}};var mt=V;V.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},V.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ot&&t>n;n++)this._eachEntry(e[n],n)},V.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===it){var i=_(t);if(i===rt&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===pt){var o=new n(v);A(o,t,i),this._willSettleAt(o,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},V.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ot&&(this._remaining--,t===st?E(r,n):this._result[e]=n),0===this._remaining&&z(r,this._result)},V.prototype._willSettleAt=function(t,e){var n=this;L(t,void 0,function(t){n._settledAt(at,e,t)},function(t){n._settledAt(st,e,t)})};var gt=U,yt={Promise:pt,polyfill:gt};"function"==typeof t&&t.amd?t(function(){return yt}):"undefined"!=typeof n&&n.exports?n.exports=yt:"undefined"!=typeof this&&(this.ES6Promise=yt),gt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:9}],20:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;n>r;r++)if(e=t.charCodeAt(r),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],21:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,s=r+r,l=i+i,u=n*a,c=r*a,f=r*s,h=i*a,d=i*s,p=i*l,m=o*a,g=o*s,y=o*l;return t[0]=1-f-p,t[1]=c+y,t[2]=h-g,t[3]=0,t[4]=c-y,t[5]=1-u-p,t[6]=d+m,t[7]=0,t[8]=h+g,t[9]=d-m,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],22:[function(t,e,n){"use strict";function r(t){var e=t.layoutVertexArrayType;this.layoutVertexArray=new e;var n=t.elementArrayType;n&&(this.elementArray=new n);var r=t.elementArrayType2;r&&(this.elementArray2=new r),this.paintVertexArrays=i.mapObject(t.paintVertexArrayTypes,function(t){return new t})}var i=t("../util/util");e.exports=r,r.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,r.prototype.hasCapacityFor=function(t){return this.layoutVertexArray.length+t<=r.MAX_VERTEX_ARRAY_LENGTH},r.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},r.prototype.trim=function(){this.layoutVertexArray.trim(),this.elementArray&&this.elementArray.trim(),this.elementArray2&&this.elementArray2.trim();for(var t in this.paintVertexArrays)this.paintVertexArrays[t].trim()},r.prototype.serialize=function(){return{layoutVertexArray:this.layoutVertexArray.serialize(),elementArray:this.elementArray&&this.elementArray.serialize(),elementArray2:this.elementArray2&&this.elementArray2.serialize(),paintVertexArrays:i.mapObject(this.paintVertexArrays,function(t){return t.serialize()})}},r.prototype.getTransferables=function(t){t.push(this.layoutVertexArray.arrayBuffer),this.elementArray&&t.push(this.elementArray.arrayBuffer),this.elementArray2&&t.push(this.elementArray2.arrayBuffer);for(var e in this.paintVertexArrays)t.push(this.paintVertexArrays[e].arrayBuffer)}},{"../util/util":136}],23:[function(t,e,n){"use strict";function r(t){if(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layer=t.layer,this.childLayers=t.childLayers,this.type=this.layer.type,this.features=[],this.id=this.layer.id,this.index=t.index,this.sourceLayer=this.layer.sourceLayer,this.sourceLayerIndex=t.sourceLayerIndex,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,this.paintAttributes=i(this),t.arrays){var e=this.programInterfaces;this.bufferGroups=c.mapObject(t.arrays,function(n,r){var i=e[r],o=t.paintVertexArrayTypes[r];return n.map(function(t){return new u(t,{layoutVertexArrayType:i.layoutVertexArrayType.serialize(),elementArrayType:i.elementArrayType&&i.elementArrayType.serialize(),elementArrayType2:i.elementArrayType2&&i.elementArrayType2.serialize(),paintVertexArrayTypes:o})})})}}function i(t){var e={};for(var n in t.programInterfaces){for(var r=e[n]={},i=0;iS;S++)A.push(w[Math.min(k+S,w.length-1)]);m=["varying",u,f,x].join(" ")+";\n",y.vertexPragmas.define[x]=m+["uniform","lowp","float",_].join(" ")+";\n",y.fragmentPragmas.define[x]=m,y.uniforms.push(c.extend({},d,{name:_,getValue:a(d,k),components:1}));var T=d.components;if(1===T)y.attributes.push(c.extend({},d,{getValue:o(d,A),isFunction:!0,components:4*T})),y.vertexPragmas.define[x]+=["attribute",u,"vec4",v].join(" ")+";\n",y.vertexPragmas.initialize[x]=[x,"=","evaluate_zoom_function_1("+v+", "+_+")","/",d.multiplier.toFixed(1)].join(" ")+";\n";else{for(var z=[],E=0;4>E;E++)z.push(v+E),y.attributes.push(c.extend({},d,{getValue:o(d,[A[E]]),isFunction:!0,name:v+E})),y.vertexPragmas.define[x]+=["attribute",u,f,v+E].join(" ")+";\n";y.vertexPragmas.initialize[x]=[x," = ","evaluate_zoom_function_4("+z.join(", ")+", "+_+")","/",d.multiplier.toFixed(1)].join(" ")+";\n"}}}}}return e}function o(t,e){return function(n,r,i){if(1===e.length)return t.getValue(n,c.extend({},r,{zoom:e[0]}),i);for(var o=[],a=0;ax;x++)for(var b=f.get(x),_=0;y>_;_++){var w=y>1?p.name+_:p.name;b[w]=m[_]*g}}},r.VertexArrayType=function(t){return new f({members:t,alignment:4})},r.ElementArrayType=function(t){return new f({members:[{type:"Uint16",name:"vertices",components:t||3}]})}},{"../util/struct_array":134,"../util/util":136,"./array_group":22,"./bucket/circle_bucket":24,"./bucket/fill_bucket":25,"./bucket/line_bucket":26,"./bucket/symbol_bucket":27,"./buffer_group":29,"feature-filter":140}],24:[function(t,e,n){"use strict";function r(){i.apply(this,arguments)}var i=t("../bucket"),o=t("../../util/util"),a=t("../load_geometry"),s=i.EXTENT;e.exports=r,r.prototype=o.inherit(i,{}),r.prototype.addCircleVertex=function(t,e,n,r,i){return t.emplaceBack(2*e+(r+1)/2,2*n+(i+1)/2)},r.prototype.programInterfaces={circle:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType,paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,n){return t.getPaintValue("circle-color",e,n)},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,n){return[t.getPaintValue("circle-radius",e,n)]},multiplier:10,paintProperty:"circle-radius"},{name:"a_blur",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,n){return[t.getPaintValue("circle-blur",e,n)]},multiplier:10,paintProperty:"circle-blur"},{name:"a_opacity",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,n){return[t.getPaintValue("circle-opacity",e,n)]},multiplier:255,paintProperty:"circle-opacity"}]}},r.prototype.addFeature=function(t){for(var e={zoom:this.zoom},n=a(t),r=this.prepareArrayGroup("circle",0),i=r.layoutVertexArray.length,o=0;ou||u>=s||0>c||c>=s)){var f=this.prepareArrayGroup("circle",4),h=f.layoutVertexArray,d=this.addCircleVertex(h,u,c,-1,-1);this.addCircleVertex(h,u,c,1,-1),this.addCircleVertex(h,u,c,1,1),this.addCircleVertex(h,u,c,-1,1),f.elementArray.emplaceBack(d,d+1,d+2),f.elementArray.emplaceBack(d,d+3,d+2)}}this.populatePaintArrays("circle",e,t.properties,r,i)}},{"../../util/util":136,"../bucket":23,"../load_geometry":31}],25:[function(t,e,n){"use strict";function r(){i.apply(this,arguments)}var i=t("../bucket"),o=t("../../util/util"),a=t("../load_geometry"),s=t("earcut"),l=t("../../util/classify_rings"),u=500;e.exports=r,r.prototype=o.inherit(i,{}),r.prototype.programInterfaces={fill:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType(1),elementArrayType2:new i.ElementArrayType(2),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,n){return t.getPaintValue("fill-color",e,n)},multiplier:255,paintProperty:"fill-color"},{name:"a_outline_color",components:4,type:"Uint8",getValue:function(t,e,n){return t.getPaintValue("fill-outline-color",e,n)},multiplier:255,paintProperty:"fill-outline-color"},{name:"a_opacity",components:1,type:"Uint8",getValue:function(t,e,n){return[t.getPaintValue("fill-opacity",e,n)]},multiplier:255,paintProperty:"fill-opacity"}]}},r.prototype.addFeature=function(t){for(var e=a(t),n=l(e,u),r=this.prepareArrayGroup("fill",0),i=r.layoutVertexArray.length,o=0;o0&&o.push(i.length/2);for(var c=0;c=1&&r.elementArray2.emplaceBack(h-1,h),i.push(f.x),i.push(f.y)}}for(var d=s(i,o),p=0;po?-1:1)+1|(a*h&63)<<2,a*h>>6)},r.prototype.programInterfaces={line:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),elementArrayType:new i.ElementArrayType}},r.prototype.addFeature=function(t){for(var e=a(t,f),n=0;n2&&t[o-1].equals(t[o-2]);)o--;if(!(t.length<2)){"bevel"===e&&(r=1.05);var a=c*(s/(512*this.overscaling)),l=t[0],f=t[o-1],h=l.equals(f);if(this.prepareArrayGroup("line",10*o),2!==o||!h){this.distance=0;var d,p,m,g,y,v,x,b=n,_=h?"butt":n,w=!0;this.e1=this.e2=this.e3=-1,h&&(d=t[o-2],y=l.sub(d)._unit()._perp());for(var M=0;o>M;M++)if(m=h&&M===o-1?t[1]:t[M+1],!m||!t[M].equals(m)){y&&(g=y),d&&(p=d),d=t[M],y=m?m.sub(d)._unit()._perp():g,g=g||y;var k=g.add(y)._unit(),A=k.x*y.x+k.y*y.y,S=1/A,T=u>A&&p&&m;if(T&&M>0){var z=d.dist(p);if(z>2*a){var E=d.sub(d.sub(p)._mult(a/z)._round());this.distance+=E.dist(p),this.addCurrentVertex(E,this.distance,g.mult(1),0,0,!1),p=E}}var L=p&&m,I=L?e:m?b:_;if(L&&"round"===I&&(i>S?I="miter":2>=S&&(I="fakeround")),"miter"===I&&S>r&&(I="bevel"),"bevel"===I&&(S>2&&(I="flipbevel"),r>S&&(I="miter")),p&&(this.distance+=d.dist(p)),"miter"===I)k._mult(S),this.addCurrentVertex(d,this.distance,k,0,0,!1);else if("flipbevel"===I){if(S>100)k=y.clone();else{var P=g.x*y.y-g.y*y.x>0?-1:1,D=S*g.add(y).mag()/g.sub(y).mag();k._perp()._mult(D*P)}this.addCurrentVertex(d,this.distance,k,0,0,!1),this.addCurrentVertex(d,this.distance,k.mult(-1),0,0,!1)}else if("bevel"===I||"fakeround"===I){var C=g.x*y.y-g.y*y.x>0,O=-Math.sqrt(S*S-1);if(C?(x=0,v=O):(v=0,x=O),w||this.addCurrentVertex(d,this.distance,g,v,x,!1),"fakeround"===I){for(var j,F=Math.floor(8*(.5-(A-.5))),R=0;F>R;R++)j=y.mult((R+1)/(F+1))._add(g)._unit(),this.addPieSliceVertex(d,this.distance,j,C);this.addPieSliceVertex(d,this.distance,k,C);for(var N=F-1;N>=0;N--)j=g.mult((N+1)/(F+1))._add(y)._unit(),this.addPieSliceVertex(d,this.distance,j,C)}m&&this.addCurrentVertex(d,this.distance,y,-v,-x,!1)}else"butt"===I?(w||this.addCurrentVertex(d,this.distance,g,0,0,!1),m&&this.addCurrentVertex(d,this.distance,y,0,0,!1)):"square"===I?(w||(this.addCurrentVertex(d,this.distance,g,1,1,!1),this.e1=this.e2=-1),m&&this.addCurrentVertex(d,this.distance,y,-1,-1,!1)):"round"===I&&(w||(this.addCurrentVertex(d,this.distance,g,0,0,!1),this.addCurrentVertex(d,this.distance,g,1,1,!0),this.e1=this.e2=-1),m&&(this.addCurrentVertex(d,this.distance,y,-1,-1,!0),this.addCurrentVertex(d,this.distance,y,0,0,!1)));if(T&&o-1>M){var B=d.dist(m);if(B>2*a){var q=d.add(m.sub(d)._mult(a/B)._round());this.distance+=q.dist(d),this.addCurrentVertex(q,this.distance,y.mult(1),0,0,!1),d=q}}w=!1}}}},r.prototype.addCurrentVertex=function(t,e,n,r,i,o){var a,s=o?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1],u=l.layoutVertexArray,c=l.elementArray;a=n.clone(),r&&a._sub(n.perp()._mult(r)),this.e3=this.addLineVertex(u,t,a,s,0,r,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,a=n.mult(-1),i&&a._sub(n.perp()._mult(i)),this.e3=this.addLineVertex(u,t,a,s,1,-i,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>d/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,n,r,i,o))},r.prototype.addPieSliceVertex=function(t,e,n,r){var i=r?1:0;n=n.mult(r?-1:1);var o=this.arrayGroups.line[this.arrayGroups.line.length-1],a=o.layoutVertexArray,s=o.elementArray;this.e3=this.addLineVertex(a,t,n,0,i,0,e),this.e1>=0&&this.e2>=0&&s.emplaceBack(this.e1,this.e2,this.e3),r?this.e2=this.e3:this.e1=this.e3}},{"../../util/util":136,"../bucket":23,"../load_geometry":31}],27:[function(t,e,n){"use strict";function r(t){a.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.symbolQuadsArray=t.symbolQuadsArray,this.symbolInstancesArray=t.symbolInstancesArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,n,r,i,o,a,s,l,u,c){return t.emplaceBack(e,n,Math.round(64*r),Math.round(64*i),o/4,a/4,10*(u||0),c,10*(s||0),10*Math.min(l||25,25))}var o=t("point-geometry"),a=t("../bucket"),s=t("../../symbol/anchor"),l=t("../../symbol/get_anchors"),u=t("../../util/token"),c=t("../../symbol/quads"),f=t("../../symbol/shaping"),h=t("../../symbol/resolve_text"),d=t("../../symbol/mergelines"),p=t("../../symbol/clip_line"),m=t("../../util/util"),g=t("../load_geometry"),y=t("../../symbol/collision_feature"),v=f.shapeText,x=f.shapeIcon,b=c.getGlyphQuads,_=c.getIconQuads,w=a.EXTENT;e.exports=r,r.prototype=m.inherit(a,{}),r.prototype.serialize=function(){var t=a.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var M=new a.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_texture_pos",components:2,type:"Uint16"},{name:"a_data",components:4,type:"Uint8"}]),k=new a.ElementArrayType;r.prototype.addCollisionBoxVertex=function(t,e,n,r,i){return t.emplaceBack(e.x,e.y,Math.round(n.x),Math.round(n.y),10*r,10*i)},r.prototype.programInterfaces={glyph:{layoutVertexArrayType:M,elementArrayType:k},icon:{layoutVertexArrayType:M,elementArrayType:k},collisionBox:{layoutVertexArrayType:new a.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}])}},r.prototype.populateArrays=function(t,e,n){var r={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:r}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:r}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:r}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:r});var i=512*this.overscaling;this.tilePixelRatio=w/i,this.compareText={},this.iconsNeedLinear=!1,this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var o=this.layer.layout,a=this.features,s=this.textFeatures,l=.5,c=.5;switch(o["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(o["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":c=1;break;case"top":case"top-right":case"top-left":c=0}for(var f="right"===o["text-justify"]?1:"left"===o["text-justify"]?0:.5,h=24,p=o["text-line-height"]*h,y="line"!==o["symbol-placement"]?o["text-max-width"]*h:0,b=o["text-letter-spacing"]*h,_=[o["text-offset"][0]*h,o["text-offset"][1]*h],M=this.fontstack=o["text-font"].join(","),k=[],A=0;Az;z++){var L=S[z];if(!(e&&M&&this.anchorIsTooClose(e.text,k,L))){var I=!(L.x<0||L.x>w||L.y<0||L.y>w);if(!m||I){var P=I||_;this.addSymbolInstance(L,T,e,n,this.layer,P,this.symbolInstancesArray.length,this.collisionBoxArray,r.index,this.sourceLayerIndex,this.index,c,g,x,h,y,b,{zoom:this.zoom},r.properties)}}}}},r.prototype.anchorIsTooClose=function(t,e,n){var r=this.compareText;if(t in r){for(var i=r[t],o=i.length-1;o>=0;o--)if(n.dist(i[o])=x&&this.addSymbols("glyph",h.glyphQuadStartIndex,h.glyphQuadEndIndex,x,n["text-keep-upright"],i,t.angle)),g&&(t.insertCollisionFeature(p,b,n["icon-ignore-placement"]),r>=b&&this.addSymbols("icon",h.iconQuadStartIndex,h.iconQuadEndIndex,b,n["icon-keep-upright"],o,t.angle))}e&&this.addToDebugBuffers(t)},r.prototype.addSymbols=function(t,e,n,r,o,a,s){for(var l=this.prepareArrayGroup(t,4*(n-e)),u=l.elementArray,c=l.layoutVertexArray,f=this.zoom,h=Math.max(Math.log(r)/Math.LN2+f,0),d=e;n>d;d++){var p=this.symbolQuadsArray.get(d).SymbolQuad,m=(p.anchorAngle+s+Math.PI)%(2*Math.PI);if(!(o&&a&&(m<=Math.PI/2||m>3*Math.PI/2))){var g=p.tl,y=p.tr,v=p.bl,x=p.br,b=p.tex,_=p.anchorPoint,w=Math.max(f+Math.log(p.minScale)/Math.LN2,h),M=Math.min(f+Math.log(p.maxScale)/Math.LN2,25);if(!(w>=M)){w===h&&(w=0);var k=Math.round(p.glyphAngle/(2*Math.PI)*256),A=i(c,_.x,_.y,g.x,g.y,b.x,b.y,w,M,h,k);i(c,_.x,_.y,y.x,y.y,b.x+b.w,b.y,w,M,h,k),i(c,_.x,_.y,v.x,v.y,b.x,b.y+b.h,w,M,h,k),i(c,_.x,_.y,x.x,x.y,b.x+b.w,b.y+b.h,w,M,h,k),u.emplaceBack(A,A+1,A+2),u.emplaceBack(A+1,A+2,A+3)}}}},r.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var n=0;nl;l++){var u=s[0===l?"textCollisionFeature":"iconCollisionFeature"];if(u)for(var c=u.boxStartIndex;c0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,n,r,i){if(!e[0]&&!e[1])return t;e=u.convert(e),"viewport"===n&&e._rotate(-r);for(var o=[],a=0;an.max||f.yn.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return s}},{"../util/util":136,"./bucket":23}],32:[function(t,e,n){"use strict";function r(t,e,n){this.column=t,this.row=e,this.zoom=n}e.exports=r,r.prototype={clone:function(){return new r(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],33:[function(t,e,n){"use strict";function r(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}e.exports=r;var i=t("../util/util").wrap;r.prototype.wrap=function(){return new r(i(this.lng,-180,180),this.lat)},r.prototype.toArray=function(){return[this.lng,this.lat]},r.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t}},{"../util/util":136}],34:[function(t,e,n){"use strict";function r(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=r;var i=t("./lng_lat");r.prototype={extend:function(t){var e,n,o=this._sw,a=this._ne;if(t instanceof i)e=t,n=t;else{if(!(t instanceof r))return t?this.extend(i.convert(t)||r.convert(t)):this;if(e=t._sw,n=t._ne,!e||!n)return this}return o||a?(o.lng=Math.min(e.lng,o.lng),o.lat=Math.min(e.lat,o.lat),a.lng=Math.max(n.lng,a.lng),a.lat=Math.max(n.lat,a.lat)):(this._sw=new i(e.lng,e.lat),this._ne=new i(n.lng,n.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},r.convert=function(t){return!t||t instanceof r?t:new r(t)}},{"./lng_lat":33}],35:[function(t,e,n){"use strict";function r(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),o=t("point-geometry"),a=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),u=t("../source/tile_coord"),c=t("../data/bucket").EXTENT,f=t("gl-matrix"),h=f.vec4,d=f.mat4,p=f.mat2;e.exports=r,r.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new o(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcMatrices())},get zoom(){return this._zoom},set zoom(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._calcMatrices(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcMatrices(),this._constrain())},coveringZoomLevel:function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},coveringTiles:function(t){var e=this.coveringZoomLevel(t),n=e;if(et.maxzoom&&(e=t.maxzoom);var r=this,i=r.locationCoordinate(r.center)._zoomTo(e),a=new o(i.column-.5,i.row-.5);return u.cover(e,[r.pointCoordinate(new o(0,0))._zoomTo(e),r.pointCoordinate(new o(r.width,0))._zoomTo(e),r.pointCoordinate(new o(r.width,r.height))._zoomTo(e),r.pointCoordinate(new o(0,r.height))._zoomTo(e)],t.reparseOverscaled?n:e).sort(function(t,e){return a.dist(t)-a.dist(e)})},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcMatrices(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new o(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new o(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var n=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-n)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var n=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var n=this.locationCoordinate(t),r=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),o=r._sub(n);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(o))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,n=i.convert(t);return new a(this.lngX(n.lng)*e,this.latY(n.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=0,n=[t.x,t.y,0,1],r=[t.x,t.y,1,1];h.transformMat4(n,n,this.pixelMatrixInverse),h.transformMat4(r,r,this.pixelMatrixInverse);var i=n[3],o=r[3],s=n[0]/i,u=r[0]/o,c=n[1]/i,f=r[1]/o,d=n[2]/i,p=r[2]/o,m=d===p?0:(e-d)/(p-d),g=this.worldSize/this.zoomScale(this.tileZoom);return new a(l(s,u,m)/g,l(c,f,m)/g,this.tileZoom)},coordinatePoint:function(t){var e=this.worldSize/this.zoomScale(t.zoom),n=[t.column*e,t.row*e,0,1];return h.transformMat4(n,n,this.pixelMatrix),new o(n[0]/n[3],n[1]/n[3])},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof u&&(t=t.toCoordinate(e));var n=Math.min(t.zoom,e),r=this.worldSize/Math.pow(2,n),i=new Float64Array(16);return d.identity(i),d.translate(i,i,[t.column*r,t.row*r,0]),d.scale(i,i,[r/c,r/c,1]),d.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,n,r,i,a,s,l,u=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),e=this.latY(this.latRange[0]),i=e-th-d&&(l=t+d),h+d>e&&(l=e-d)}if(this.lngRange){var p=this.x,m=u.x/2;n>p-m&&(s=n+m),p+m>r&&(s=r-m)}void 0===s&&void 0===l||(this.center=this.unproject(new o(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=c,this._constraining=!1}},_calcMatrices:function(){if(this.height){var t=Math.atan(.5/this.altitude),e=Math.sin(t)*this.altitude/Math.sin(Math.PI/2-this._pitch-t),n=Math.cos(Math.PI/2-this._pitch)*e+this.altitude,r=new Float64Array(16);if(d.perspective(r,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,n),d.translate(r,r,[0,0,-this.altitude]),d.scale(r,r,[1,-1,1/this.height]),d.rotateX(r,r,this._pitch),d.rotateZ(r,r,this.angle),d.translate(r,r,[-this.x,-this.y,0]),this.projMatrix=r,r=d.create(),d.scale(r,r,[this.width/2,-this.height/2,1]),d.translate(r,r,[1,-1,0]),this.pixelMatrix=d.multiply(new Float64Array(16),r,this.projMatrix),r=d.invert(new Float64Array(16),this.pixelMatrix),!r)throw new Error("failed to invert matrix");this.pixelMatrixInverse=r}}}},{"../data/bucket":23,"../source/tile_coord":63,"../util/interpolate":130,"../util/util":136,"./coordinate":32,"./lng_lat":33,"gl-matrix":152,"point-geometry":194}],36:[function(t,e,n){"use strict";var r={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]};e.exports=function(t,e,n,i){i=i||1;var o,a,s,l,u,c,f,h,d=[];for(o=0,a=t.length;a>o;o++)if(u=r[t[o]]){for(h=null,s=0,l=u[1].length;l>s;s+=2)-1===u[1][s]&&-1===u[1][s+1]?h=null:(c=e+u[1][s]*i,f=n-u[1][s+1]*i,h&&d.push(h.x,h.y,c,f),h={x:c,y:f});e+=u[0]*i}return d}},{}],37:[function(t,e,n){"use strict";var r=e.exports={};r.version=t("../package.json").version,r.Map=t("./ui/map"),r.Control=t("./ui/control/control"),r.Navigation=t("./ui/control/navigation"),r.Geolocate=t("./ui/control/geolocate"),r.Attribution=t("./ui/control/attribution"),r.Popup=t("./ui/popup"),r.Marker=t("./ui/marker"),r.Style=t("./style/style"),r.LngLat=t("./geo/lng_lat"),r.LngLatBounds=t("./geo/lng_lat_bounds"),r.Point=t("point-geometry"),r.Evented=t("./util/evented"),r.util=t("./util/util"),r.supported=t("./util/browser").supported;var i=t("./util/ajax");r.util.getJSON=i.getJSON,r.util.getArrayBuffer=i.getArrayBuffer;var o=t("./util/config");r.config=o,Object.defineProperty(r,"accessToken",{get:function(){return o.ACCESS_TOKEN},set:function(t){o.ACCESS_TOKEN=t}})},{"../package.json":213,"./geo/lng_lat":33,"./geo/lng_lat_bounds":34,"./style/style":72,"./ui/control/attribution":103,"./ui/control/control":104,"./ui/control/geolocate":105,"./ui/control/navigation":106,"./ui/map":115,"./ui/marker":116,"./ui/popup":117,"./util/ajax":119,"./util/browser":120,"./util/config":125,"./util/evented":128,"./util/util":136,"point-geometry":194}],38:[function(t,e,n){"use strict";e.exports=function(t){for(var e={define:{},initialize:{}},n=0;n>16,_>>16),s.uniform2f(r.u_pixel_coord_lower,65535&b,65535&_)}s.uniformMatrix4fv(r.u_matrix,!1,t.transform.calculatePosMatrix(y)),s.drawArrays(s.TRIANGLE_STRIP,0,t.tileExtentBuffer.length)}s.stencilMask(0),s.stencilFunc(s.EQUAL,128,128)}var i=t("../source/pixels_to_tile_units"),o=t("./create_uniform_pragmas"),a=512;e.exports=r},{"../source/pixels_to_tile_units":57,"./create_uniform_pragmas":38}],40:[function(t,e,n){"use strict";function r(t,e,n,r){if(!t.isOpaquePass){var o=t.gl;t.setDepthSublayer(0),t.depthMask(!1),o.disable(o.STENCIL_TEST);for(var a=0;a>16,h>>16),a.uniform2f(o.u_pixel_coord_lower,65535&f,65535&h),a.activeTexture(a.TEXTURE0),i.spriteAtlas.bind(a,!0)}}var s=t("../source/pixels_to_tile_units");e.exports=r},{"../source/pixels_to_tile_units":57}],44:[function(t,e,n){"use strict";var r=t("../util/browser"),i=t("gl-matrix").mat2,o=t("../source/pixels_to_tile_units");e.exports=function(t,e,n,a){if(!t.isOpaquePass){t.setDepthSublayer(0),t.depthMask(!1);var s=t.gl;if(s.enable(s.STENCIL_TEST),!(n.paint["line-width"]<=0)){var l=1/r.devicePixelRatio,u=n.paint["line-blur"]+l,c=n.paint["line-color"],f=t.transform,h=i.create();i.scale(h,h,[1,Math.cos(f._pitch)]),i.rotate(h,h,t.transform.angle);var d,p,m,g,y,v=Math.sqrt(f.height*f.height/4*(1+f.altitude*f.altitude)),x=f.height/2*Math.tan(f._pitch),b=(v+x)/v-1,_=n.paint["line-dasharray"],w=n.paint["line-pattern"];if(_)d=t.useProgram("linesdfpattern"),s.uniform1f(d.u_linewidth,n.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,n.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform4fv(d.u_color,c),s.uniform1f(d.u_opacity,n.paint["line-opacity"]),p=t.lineAtlas.getDash(_.from,"round"===n.layout["line-cap"]),m=t.lineAtlas.getDash(_.to,"round"===n.layout["line-cap"]),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.lineAtlas.bind(s),s.uniform1f(d.u_tex_y_a,p.y),s.uniform1f(d.u_tex_y_b,m.y),s.uniform1f(d.u_mix,_.t),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-n.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,h);else if(w){if(g=t.spriteAtlas.getPosition(w.from,!0),y=t.spriteAtlas.getPosition(w.to,!0),!g||!y)return;d=t.useProgram("linepattern"),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.spriteAtlas.bind(s,!0),s.uniform1f(d.u_linewidth,n.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,n.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform2fv(d.u_pattern_tl_a,g.tl),s.uniform2fv(d.u_pattern_br_a,g.br),s.uniform2fv(d.u_pattern_tl_b,y.tl),s.uniform2fv(d.u_pattern_br_b,y.br),s.uniform1f(d.u_fade,w.t),s.uniform1f(d.u_opacity,n.paint["line-opacity"]),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-n.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,h)}else d=t.useProgram("line"),s.uniform1f(d.u_linewidth,n.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,n.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-n.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,h),s.uniform4fv(d.u_color,c),s.uniform1f(d.u_opacity,n.paint["line-opacity"]);for(var M=0;M0?1/(1-t):1+t}function s(t){return t>0?1-1/(1.001-t):-t}function l(t,e,n,r){var i=[1,0],o=n.paint["raster-fade-duration"];if(t.source&&o>0){var a=(new Date).getTime(),s=(a-t.timeAdded)/o,l=e?(a-e.timeAdded)/o:-1,c=r.coveringZoomLevel(t.source),f=e?Math.abs(e.coord.z-c)>Math.abs(t.coord.z-c):!1;!e||f?(i[0]=u.clamp(s,0,1),i[1]=1-i[0]):(i[0]=u.clamp(1-l,0,1),i[1]=1-i[0])}var h=n.paint["raster-opacity"];return i[0]*=h,i[1]*=h,i}var u=t("../util/util"),c=t("../util/struct_array");e.exports=r,r.RasterBoundsArray=new c({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":134,"../util/util":136}],46:[function(t,e,n){"use strict";function r(t,e,n,r){if(!t.isOpaquePass){var o=!(n.layout["text-allow-overlap"]||n.layout["icon-allow-overlap"]||n.layout["text-ignore-placement"]||n.layout["icon-ignore-placement"]),a=t.gl;o?a.disable(a.STENCIL_TEST):a.enable(a.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.DEPTH_TEST),i(t,e,n,r,!1,n.paint["icon-translate"],n.paint["icon-translate-anchor"],n.layout["icon-rotation-alignment"],n.layout["icon-rotation-alignment"],n.layout["icon-size"],n.paint["icon-halo-width"],n.paint["icon-halo-color"],n.paint["icon-halo-blur"],n.paint["icon-opacity"],n.paint["icon-color"]),i(t,e,n,r,!0,n.paint["text-translate"],n.paint["text-translate-anchor"],n.layout["text-rotation-alignment"],n.layout["text-pitch-alignment"],n.layout["text-size"],n.paint["text-halo-width"],n.paint["text-halo-color"],n.paint["text-halo-blur"],n.paint["text-opacity"],n.paint["text-color"]),a.enable(a.DEPTH_TEST),e.map.showCollisionBoxes&&s(t,e,n,r)}}function i(t,e,n,r,i,a,s,l,u,c,f,h,d,p,m){for(var g=0;gthis.previousZoom;n--)this.changeTimes[n]=e,this.changeOpacities[n]=this.opacities[n];for(n=0;256>n;n++){var r=e-this.changeTimes[n],i=r/this.fadeDuration*255;t>=n?this.opacities[n]=this.changeOpacities[n]+i:this.opacities[n]=this.changeOpacities[n]-i}this.changed=!0,this.previousZoom=t},r.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],48:[function(t,e,n){"use strict";function r(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}var i=t("../util/util");e.exports=r,r.prototype.setSprite=function(t){this.sprite=t},r.prototype.getDash=function(t,e){var n=t.join(",")+e;return this.positions[n]||(this.positions[n]=this.addDash(t,e)),this.positions[n]},r.prototype.addDash=function(t,e){var n=e?7:0,r=2*n+1,o=128;if(this.nextRow+r>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var a=0,s=0;s=f;f++)for(var h=this.nextRow+n+f,d=this.width*h,p=c?-t[t.length-1]:0,m=t[0],g=1,y=0;ym;)p=m,m+=t[g],c&&g===t.length-1&&(m+=t[0]),g++;var v,x=Math.abs(y-p*l),b=Math.abs(y-m*l),_=Math.min(x,b),w=g%2===1;if(e){var M=n?f/n*(u+1):0;if(w){var k=u-Math.abs(M);v=Math.sqrt(_*_+k*k)}else v=u-Math.sqrt(_*_+M*M)}else v=(w?1:-1)*_;this.data[3+4*(d+y)]=Math.max(0,Math.min(255,v+o))}var A={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:a};return this.nextRow+=r,this.dirty=!0,A},r.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,this.data))}},{"../util/util":136}],49:[function(t,e,n){"use strict";function r(t,e){this.gl=t,this.transform=e,this.reusableTextures={},this.preFbos={},this.frameHistory=new a,this.setup(),this.numSublayers=s.maxUnderzooming+s.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.lineWidthRange=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE)}var i=t("../util/browser"),o=t("gl-matrix").mat4,a=t("./frame_history"),s=t("../source/source_cache"),l=t("../data/bucket").EXTENT,u=t("../source/pixels_to_tile_units"),c=t("../util/util"),f=t("../util/struct_array"),h=t("../data/buffer"),d=t("./vertex_array_object"),p=t("./draw_raster").RasterBoundsArray,m=t("./create_uniform_pragmas");e.exports=r,c.extend(r.prototype,t("./painter/use_program")),r.prototype.resize=function(t,e){var n=this.gl;this.width=t*i.devicePixelRatio,this.height=e*i.devicePixelRatio,n.viewport(0,0,this.width,this.height)},r.prototype.setup=function(){var t=this.gl;t.verbose=!0,t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.enable(t.STENCIL_TEST),t.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),this._depthMask=!1,t.depthMask(!1);var e=this.PosArray=new f({members:[{name:"a_pos",type:"Int16",components:2}]}),n=new e;n.emplaceBack(0,0),n.emplaceBack(l,0),n.emplaceBack(0,l),n.emplaceBack(l,l),this.tileExtentBuffer=new h(n.serialize(),e.serialize(),h.BufferType.VERTEX),this.tileExtentVAO=new d,this.tileExtentPatternVAO=new d;var r=new e;r.emplaceBack(0,0),r.emplaceBack(l,0),r.emplaceBack(l,l),r.emplaceBack(0,l),r.emplaceBack(0,0),this.debugBuffer=new h(r.serialize(),e.serialize(),h.BufferType.VERTEX),this.debugVAO=new d;var i=new p;i.emplaceBack(0,0,0,0),i.emplaceBack(l,0,32767,0),i.emplaceBack(0,l,0,32767),i.emplaceBack(l,l,32767,32767),this.rasterBoundsBuffer=new h(i.serialize(),p.serialize(),h.BufferType.VERTEX),this.rasterBoundsVAO=new d},r.prototype.clearColor=function(){var t=this.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},r.prototype.clearStencil=function(){var t=this.gl;t.clearStencil(0),t.stencilMask(255),t.clear(t.STENCIL_BUFFER_BIT)},r.prototype.clearDepth=function(){var t=this.gl;t.clearDepth(1),this.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},r.prototype._renderTileClippingMasks=function(t){var e=this.gl;e.colorMask(!1,!1,!1,!1),this.depthMask(!1),e.disable(e.DEPTH_TEST),e.enable(e.STENCIL_TEST),e.stencilMask(248),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE);var n=1;this._tileClippingMaskIDs={};for(var r=0;r0?e.pop():null},r.prototype.lineWidth=function(t){this.gl.lineWidth(c.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},r.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);var n=8,r=1/n;e.blendColor(r,r,r,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":23,"../data/buffer":28,"../source/pixels_to_tile_units":57,"../source/source_cache":61,"../util/browser":120,"../util/struct_array":134,"../util/util":136,"./create_uniform_pragmas":38,"./draw_background":39,"./draw_circle":40,"./draw_debug":42,"./draw_fill":43,"./draw_line":44,"./draw_raster":45,"./draw_symbol":46,"./frame_history":47,"./painter/use_program":50,"./vertex_array_object":51,"gl-matrix":152}],50:[function(t,e,n){"use strict";function r(t,e){return t.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(t,n,r,i,o){return e[n][o].replace(/{type}/g,i).replace(/{precision}/g,r)})}var i=t("../../util/util"),o=t("mapbox-gl-shaders"),a=o.util;e.exports._createProgram=function(t,e,n,s){for(var l=this.gl,u=l.createProgram(),c=o[t],f="#define MAPBOX_GL_JS;\n",h=0;hy;y++){var v=l.getActiveAttrib(u,y);m[v.name]=l.getAttribLocation(u,v.name)}for(var x={},b=l.getProgramParameter(u,l.ACTIVE_UNIFORMS),_=0;b>_;_++){var w=l.getActiveUniform(u,_);x[w.name]=l.getUniformLocation(u,w.name)}return i.extend({program:u,definition:c,attributes:m,numAttributes:g},m,x)},e.exports._createProgramCached=function(t,e,n,r){this.cache=this.cache||{};var i=JSON.stringify({name:t,defines:e,vertexPragmas:n,fragmentPragmas:r});return this.cache[i]||(this.cache[i]=this._createProgram(t,e,n,r)),this.cache[i]},e.exports.useProgram=function(t,e,n,r){var i=this.gl;e=e||[],this._showOverdrawInspector&&(e=e.concat("OVERDRAW_INSPECTOR"));var o=this._createProgramCached(t,e,n,r),a=this.currentProgram;return a!==o&&(i.useProgram(o.program),this.currentProgram=o),o}},{"../../util/util":136,"mapbox-gl-shaders":164}],51:[function(t,e,n){"use strict";function r(){this.boundProgram=null,this.boundVertexBuffer=null,this.boundVertexBuffer2=null,this.boundElementBuffer=null,this.vao=null}e.exports=r,r.prototype.bind=function(t,e,n,r,i){void 0===t.extVertexArrayObject&&(t.extVertexArrayObject=t.getExtension("OES_vertex_array_object"));var o=!this.vao||this.boundProgram!==e||this.boundVertexBuffer!==n||this.boundVertexBuffer2!==i||this.boundElementBuffer!==r;!t.extVertexArrayObject||o?this.freshBind(t,e,n,r,i):t.extVertexArrayObject.bindVertexArrayOES(this.vao)},r.prototype.freshBind=function(t,e,n,r,i){var o,a=e.numAttributes;if(t.extVertexArrayObject)this.vao&&this.destroy(t),this.vao=t.extVertexArrayObject.createVertexArrayOES(),t.extVertexArrayObject.bindVertexArrayOES(this.vao),o=0,this.boundProgram=e,this.boundVertexBuffer=n,this.boundVertexBuffer2=i,this.boundElementBuffer=r;else{o=t.currentNumAttributes||0;for(var s=a;o>s;s++)t.disableVertexAttribArray(s)}for(var l=o;a>l;l++)t.enableVertexAttribArray(l);n.bind(t),n.setVertexAttribPointers(t,e),i&&(i.bind(t),i.setVertexAttribPointers(t,e)),r&&r.bind(t),t.currentNumAttributes=a},r.prototype.unbind=function(t){var e=t.extVertexArrayObject;e&&e.bindVertexArrayOES(null)},r.prototype.destroy=function(t){var e=t.extVertexArrayObject;e&&this.vao&&(e.deleteVertexArrayOES(this.vao),this.vao=null)}},{}],52:[function(t,e,n){"use strict";function r(t,e,n){e=e||{},this.id=t,this.dispatcher=n,this._data=e.data,void 0!==e.maxzoom&&(this.maxzoom=e.maxzoom),e.type&&(this.type=e.type);var r=s/this.tileSize;this.workerOptions=o.extend({source:this.id,cluster:e.cluster||!1,geojsonVtOptions:{buffer:(void 0!==e.buffer?e.buffer:128)*r,tolerance:(void 0!==e.tolerance?e.tolerance:.375)*r,extent:s,maxZoom:this.maxzoom},superclusterOptions:{maxZoom:Math.min(e.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:s,radius:(e.clusterRadius||50)*r,log:!1}},e.workerOptions),this._updateWorkerData(function(t){return t?void this.fire("error",{error:t}):void this.fire("load")}.bind(this))}var i=t("../util/evented"),o=t("../util/util"),a=t("resolve-url"),s=t("../data/bucket").EXTENT;e.exports=r,r.prototype=o.inherit(i,{type:"geojson",minzoom:0,maxzoom:18,tileSize:512,isTileClipped:!0,reparseOverscaled:!0,onAdd:function(t){this.map=t},setData:function(t){return this._data=t,this._updateWorkerData(function(t){return t?this.fire("error",{error:t}):void this.fire("change")}.bind(this)),this},_updateWorkerData:function(t){var e=o.extend({},this.workerOptions),n=this._data;"string"==typeof n?e.url="undefined"!=typeof window?a(window.location.href,n):n:e.data=JSON.stringify(n),this.workerID=this.dispatcher.send(this.type+".loadData",e,function(e){this._loaded=!0,t(e)}.bind(this))},loadTile:function(t,e){var n=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,r={type:this.type,uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:n,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load tile",r,function(n,r){return t.unloadVectorData(this.map.painter),t.aborted?void 0:n?e(n):(t.loadVectorData(r,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null))}.bind(this),this.workerID)},abortTile:function(t){t.aborted=!0},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},function(){},t.workerID)},serialize:function(){return{type:this.type,data:this._data}}})},{"../data/bucket":23,"../util/evented":128,"../util/util":136,"resolve-url":196}],53:[function(t,e,n){"use strict";function r(t,e,n){n&&(this.loadGeoJSON=n),f.call(this,t,e)}var i=t("../util/util"),o=t("../util/ajax"),a=t("geojson-rewind"),s=t("./geojson_wrapper"),l=t("vt-pbf"),u=t("supercluster"),c=t("geojson-vt"),f=t("./vector_tile_worker_source");e.exports=r,r.prototype=i.inherit(f,{_geoJSONIndexes:{},loadVectorData:function(t,e){var n=t.source,r=t.coord;if(!this._geoJSONIndexes[n])return e(null,null);var i=this._geoJSONIndexes[n].getTile(Math.min(r.z,t.maxZoom),r.x,r.y);if(!i)return e(null,null);var o=new s(i.features);o.name="_geojsonTileLayer";var a=l({layers:{_geojsonTileLayer:o}});0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),e(null,{tile:o,rawTileData:a.buffer})},loadData:function(t,e){var n=function(n,r){return n?e(n):"object"!=typeof r?e(new Error("Input data is not a valid GeoJSON object.")):(a(r,!0),void this._indexData(r,t,function(n,r){return n?e(n):(this._geoJSONIndexes[t.source]=r,void e(null))}.bind(this)))}.bind(this);this.loadGeoJSON(t,n)},loadGeoJSON:function(t,e){if(t.url)o.getJSON(t.url,e);else{if("string"!=typeof t.data)return e(new Error("Input data is not a valid GeoJSON object."));try{return e(null,JSON.parse(t.data))}catch(n){return e(new Error("Input data is not a valid GeoJSON object."))}}},_indexData:function(t,e,n){try{e.cluster?n(null,u(e.superclusterOptions).load(t.features)):n(null,c(t,e.geojsonVtOptions))}catch(r){return n(r)}}})},{"../util/ajax":119,"../util/util":136,"./geojson_wrapper":54,"./vector_tile_worker_source":65,"geojson-rewind":141,"geojson-vt":147,supercluster:198,"vt-pbf":208}],54:[function(t,e,n){"use strict";function r(t){this.features=t,this.length=t.length,this.extent=s}function i(t){if(this.type=t.type,1===t.type){this.rawGeometry=[];for(var e=0;ee)){var a=Math.pow(2,Math.min(o.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(o.coord.x/a)===t.x&&Math.floor(o.coord.y/a)===t.y)for(n[i]=!0,r=!0;o&&o.coord.z-1>t.z;){var s=o.coord.parent(this.maxzoom).id;o=this._tiles[s],o&&o.isRenderable()&&(delete n[i],n[s]=!0)}}}return r},findLoadedParent:function(t,e,n){for(var r=t.z-1;r>=e;r--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.isRenderable())return n[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),n[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=Math.ceil(t.width/t.tileSize)+1,n=Math.ceil(t.height/t.tileSize)+1,r=e*n,i=5;this._cache.setMaxSize(Math.floor(r*i))},update:function(t,e){if(this._sourceLoaded){var n,i,o;this.updateCacheSize(t);var a=(this.roundZoom?Math.round:Math.floor)(this.getZoom(t)),s=Math.max(a-r.maxOverzooming,this.minzoom),l=Math.max(a+r.maxUnderzooming,this.minzoom),c={},f=(new Date).getTime();this._coveredTiles={};var d=this.used?t.coveringTiles(this._source):[];for(n=0;nf-(e||0)&&(this.findLoadedChildren(i,l,c)&&(c[y]=!0),this.findLoadedParent(i,s,p))}var v;for(v in p)c[v]||(this._coveredTiles[v]=!0);for(v in p)c[v]=!0;var x=h.keysDifference(this._tiles,c);for(n=0;nthis.maxzoom?Math.pow(2,r-this.maxzoom):1;e=new s(n,this.tileSize*i,this.maxzoom),this.loadTile(e,this._tileLoaded.bind(this,e))}return e.uses++,this._tiles[t.id]=e,this.fire("tile.add",{tile:e}),this._source.fire("tile.add",{tile:e}),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this.fire("tile.remove",{tile:e}),this._source.fire("tile.remove",{tile:e}),e.uses>0||(e.isRenderable()?this._cache.add(e.coord.wrapped().id,e):(e.aborted=!0,this.abortTile(e),this.unloadTile(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},n=this.getIds(),r=1/0,o=1/0,a=-(1/0),s=-(1/0),l=t[0].zoom,c=0;c=0&&y[1].y>=0){for(var v=[],x=0;xr&&(r=-1*r-1);var i=1<0;o--)r=1<e.row){var n=t;t=e,e=n}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function a(t,e,n,r,i){var o=Math.max(n,Math.floor(e.y0)),a=Math.min(r,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx0,f=e.dx<0,h=o;a>h;h++){var d=l*Math.max(0,Math.min(t.dy,h+c-t.y0))+t.x0,p=u*Math.max(0,Math.min(e.dy,h+f-e.y0))+e.x0;i(Math.floor(p),Math.ceil(d),h)}}function s(t,e,n,r,i,s){var l,u=o(t,e),c=o(e,n),f=o(n,t);u.dy>c.dy&&(l=u,u=c,c=l),u.dy>f.dy&&(l=u,u=f,f=l),c.dy>f.dy&&(l=c,c=f,f=l),u.dy&&a(f,u,r,i,s),c.dy&&a(f,c,r,i,s)}var l=t("whoots-js"),u=t("../geo/coordinate");e.exports=r,r.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},r.prototype.toCoordinate=function(t){var e=Math.min(this.z,t),n=Math.pow(2,e),r=this.y,i=this.x+n*this.w;return new u(i,r,e)},r.fromID=function(t){var e=t%32,n=1<t?new r(this.z-1,this.x,this.y,this.w):new r(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},r.prototype.wrapped=function(){return new r(this.z,this.x,this.y,0)},r.prototype.children=function(t){if(this.z>=t)return[new r(this.z+1,this.x,this.y,this.w)];var e=this.z+1,n=2*this.x,i=2*this.y;return[new r(e,n,i,this.w),new r(e,n+1,i,this.w),new r(e,n,i+1,this.w),new r(e,n+1,i+1,this.w)]},r.cover=function(t,e,n){function i(t,e,i){var s,l,u;if(i>=0&&o>=i)for(s=t;e>s;s++)l=(s%o+o)%o,u=new r(n,l,i,Math.floor(s/o)),a[u.id]=u}var o=1<this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,i={url:s(t.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*r,source:this.id,overscaling:r,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?"loading"===t.state?t.reloadCallback=e:(i.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",i,n.bind(this),t.workerID)):t.workerID=this.dispatcher.send("load tile",i,n.bind(this))},abortTile:function(t){this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)}})},{"../util/evented":128,"../util/mapbox":133,"../util/util":136,"./load_tilejson":56}],65:[function(t,e,n){"use strict";function r(t,e,n){this.actor=t,this.styleLayers=e,n&&(this.loadVectorData=n),this.loading={},this.loaded={}}var i=t("../util/ajax"),o=t("vector-tile"),a=t("pbf"),s=t("./worker_tile");e.exports=r,r.prototype={loadTile:function(t,e){function n(t,n){return delete this.loading[r][i],t?e(t):n?(o.data=n.tile,o.parse(o.data,this.styleLayers.getLayerFamilies(),this.actor,n.rawTileData,e),this.loaded[r]=this.loaded[r]||{},void(this.loaded[r][i]=o)):e(null,null)}var r=t.source,i=t.uid;this.loading[r]||(this.loading[r]={});var o=this.loading[r][i]=new s(t);o.abort=this.loadVectorData(t,n.bind(this))},reloadTile:function(t,e){var n=this.loaded[t.source],r=t.uid;if(n&&n[r]){var i=n[r];i.parse(i.data,this.styleLayers.getLayerFamilies(),this.actor,t.rawTileData,e)}},abortTile:function(t){var e=this.loading[t.source],n=t.uid;e&&e[n]&&e[n].abort&&(e[n].abort(),delete e[n])},removeTile:function(t){var e=this.loaded[t.source],n=t.uid;e&&e[n]&&delete e[n]},loadVectorData:function(t,e){function n(t,n){if(t)return e(t);var r=new o.VectorTile(new a(new Uint8Array(n)));e(t,{tile:r,rawTileData:n})}var r=i.getArrayBuffer(t.url,n.bind(this));return function(){r.abort()}},redoPlacement:function(t,e){var n=this.loaded[t.source],r=this.loading[t.source],i=t.uid;if(n&&n[i]){var o=n[i],a=o.redoPlacement(t.angle,t.pitch,t.showCollisionBoxes);a.result&&e(null,a.result,a.transferables)}else r&&r[i]&&(r[i].angle=t.angle)}}},{"../util/ajax":119,"./worker_tile":68,pbf:192,"vector-tile":204}],66:[function(t,e,n){"use strict";function r(t,e){this.id=t,this.urls=e.urls,this.coordinates=e.coordinates,u.getVideo(e.urls,function(t,n){if(t)return this.fire("error",{error:t});this.video=n,this.video.loop=!0;var r;this.video.addEventListener("playing",function(){r=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(r)}.bind(this)),this.map&&(this.video.play(),this.setCoordinates(e.coordinates)),this.fire("load")}.bind(this))}var i=t("../util/util"),o=t("./tile_coord"),a=t("../geo/lng_lat"),s=t("point-geometry"),l=t("../util/evented"),u=t("../util/ajax"),c=t("../data/bucket").EXTENT,f=t("../render/draw_raster").RasterBoundsArray,h=t("../data/buffer"),d=t("../render/vertex_array_object");e.exports=r,r.prototype=i.inherit(l,{minzoom:0,maxzoom:22,tileSize:512,roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map||(this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},setCoordinates:function(t){this.coordinates=t;var e=this.map,n=t.map(function(t){return e.transform.locationCoordinate(a.convert(t)).zoomTo(0)}),r=this.centerCoord=i.getCoordinatesCenter(n);return r.column=Math.round(r.column),r.row=Math.round(r.row),this.minzoom=this.maxzoom=r.zoom,this._coord=new o(r.zoom,r.column,r.row),this._tileCoords=n.map(function(t){var e=t.zoomTo(r.zoom);return new s(Math.round((e.column-r.column)*c),Math.round((e.row-r.row)*c))}),this.fire("change"),this},_setTile:function(t){this._prepared=!1,this.tile=t;var e=32767,n=new f;n.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),n.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,e,0),n.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,e),n.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,e,e),this.tile.buckets={},this.tile.boundsBuffer=new h(n.serialize(),f.serialize(),h.BufferType.VERTEX),this.tile.boundsVAO=new d,this.tile.state="loaded"},prepare:function(){if(!(this.video.readyState<2)&&this.tile){var t=this.map.painter.gl;this._prepared?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this._prepared=!0,this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},loadTile:function(t,e){this._coord&&this._coord.toString()===t.coord.toString()?(this._setTile(t),e(null)):(t.state="errored",e(null))},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":23,"../data/buffer":28,"../geo/lng_lat":33,"../render/draw_raster":45,"../render/vertex_array_object":51,"../util/ajax":119,"../util/evented":128,"../util/util":136,"./tile_coord":63,"point-geometry":194}],67:[function(t,e,n){"use strict";function r(t){this.self=t,this.actor=new o(t,this);var e={getLayers:function(){return this.layers}.bind(this),getLayerFamilies:function(){return this.layerFamilies}.bind(this)};this.workerSources={vector:new l(this.actor,e),geojson:new u(this.actor,e)},this.self.registerWorkerSource=function(t,n){if(this.workerSources[t])throw new Error('Worker source with name "'+t+'" already registered.');this.workerSources[t]=new n(this.actor,e)}.bind(this)}function i(t){var e={};for(var n in t){var r=t[n],i=r.ref||r.id,o=t[i];o.layout&&"none"===o.layout.visibility||(e[i]=e[i]||[],n===i?e[i].unshift(r):e[i].push(r))}return e}var o=t("../util/actor"),a=t("../style/style_layer"),s=t("../util/util"),l=t("./vector_tile_worker_source"),u=t("./geojson_worker_source");e.exports=function(t){return new r(t)},s.extend(r.prototype,{"set layers":function(t){function e(t){var e=a.create(t,t.ref&&n.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),n.layers[e.id]=e}this.layers={};for(var n=this,r=[],o=0;o=0;e--)x(z,C[e]);b()}}function x(t,e){if(e.populateArrays(A,R,F),"symbol"!==e.type)for(var n=0;n=w.maxzoom||w.layout&&"none"===w.layout.visibility||t.layers&&!t.layers[w.sourceLayer]||(k=c.create({layer:w,index:I++,childLayers:e[P],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:T.encode(w.sourceLayer||"_geojsonTileLayer")}),k.createFilter(),E[w.id]=k,t.layers&&(M=w.sourceLayer,L[M]=L[M]||{},L[M][w.id]=k)));if(t.layers)for(M in L)1===w.version&&d.warnOnce('Vector tile source "'+this.source+'" layer "'+M+'" does not use vector tile spec v2 and therefore may have some rendering errors.'),w=t.layers[M],w&&y(w,L[M]);else y(t,E);var D=[],C=this.symbolBuckets=[],O=[];S.bucketLayerIDs={};for(var j in E)k=E[j],0!==k.features.length&&(S.bucketLayerIDs[k.index]=k.childLayers.map(s),D.push(k),"symbol"===k.type?C.push(k):O.push(k));var F={},R={},N=0;if(C.length>0){for(_=C.length-1;_>=0;_--)C[_].updateIcons(F),C[_].updateFont(R);for(var B in R)R[B]=Object.keys(R[B]).map(Number);F=Object.keys(F),n.send("get glyphs",{uid:this.uid,stacks:R},function(t,e){R=e,v(t)}),F.length?n.send("get icons",{icons:F},function(t,e){F=e,v(t)}):v()}for(_=O.length-1;_>=0;_--)x(this,O[_]);return 0===C.length?b():void 0},r.prototype.redoPlacement=function(t,e,n){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var r=new u(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(r,n);var c=r.serialize(),f=s.filter(i);return{result:{buckets:f.map(o),collisionTile:c.data},transferables:a(f).concat(c.transferables)}}},{"../data/bucket":23,"../data/feature_index":30,"../symbol/collision_box":88,"../symbol/collision_tile":90,"../symbol/symbol_instances":99,"../symbol/symbol_quads":100,"../util/dictionary_coder":126,"../util/util":136}],69:[function(t,e,n){"use strict";function r(){this.n=0,this.times=[]}e.exports=r,r.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},r.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},r.prototype.cancel=function(t){this.times=this.times.filter(function(e){return e.id!==t})}},{}],70:[function(t,e,n){"use strict";function r(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";a.getJSON(l(t,e,".json"),function(t,e){return t?void this.fire("error",{error:t}):(this.data=e,void(this.img&&this.fire("load")))}.bind(this)),a.getImage(l(t,e,".png"),function(t,e){if(t)return void this.fire("error",{error:t});for(var n=e.getData(),r=e.data=new Uint8Array(n.length),i=0;i1!==this.retina){var t=new r(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},i.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},r.prototype.getSpritePosition=function(t){if(!this.loaded())return new i;var e=this.data&&this.data[t];return e&&this.img?e:new i}},{"../util/ajax":119,"../util/browser":120,"../util/evented":128,"../util/mapbox":133}],71:[function(t,e,n){"use strict";var r=t("csscolorparser").parseCSSColor,i=t("../util/util"),o=t("./style_function"),a={};e.exports=function s(t){if(o.isFunctionDefinition(t))return i.extend({},t,{stops:t.stops.map(function(t){return[t[0],s(t[1])]})});if("string"==typeof t){if(!a[t]){var e=r(t);if(!e)throw new Error("Invalid color "+t);a[t]=[e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]]}return a[t]}throw new Error("Invalid color "+t)}},{"../util/util":136,"./style_function":74,csscolorparser:138}],72:[function(t,e,n){"use strict";function r(t,e,n){this.animationLoop=e||new m,this.dispatcher=new p(n||1,this),this.spriteAtlas=new l(1024,1024),this.lineAtlas=new u(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},c.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var r=function(t,e){if(t)return void this.fire("error",{error:t});if(!g.emitErrors(this,g(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var n=e.sources;for(var r in n)this.addSource(r,n[r]);e.sprite&&(this.sprite=new a(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?f.getJSON(h(t),r):d.frame(r.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var n in this._layers){var r=this._layers[n];r.source===e.id&&this._validateLayer(r)}})}var i=t("../util/evented"),o=t("./style_layer"),a=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),u=t("../render/line_atlas"),c=t("../util/util"),f=t("../util/ajax"),h=t("../util/mapbox").normalizeStyleURL,d=t("../util/browser"),p=t("../util/dispatcher"),m=t("./animation_loop"),g=t("./validate_style"),y=t("../source/source"),v=t("../source/query_features"),x=t("../source/source_cache"),b=t("./style_spec"),_=t("./style_function");e.exports=r,r.prototype=c.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&-1===e.vectorLayerIds.indexOf(t.sourceLayer)&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;if(Object.keys(this._updates.sources).length)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!this.sprite||this.sprite.loaded()},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var n=0;nMath.floor(t)&&(e.lastIntegerZoom=Math.floor(t+1),e.lastIntegerZoomTime=Date.now()),e.lastZoom=t},_checkLoaded:function(){if(!this._loaded)throw new Error("Style is not done loading")},update:function(t,e){if(!this._updates.changed)return this;if(this._updates.allLayers)this._groupLayers(),this._updateWorkerLayers();else{var n=Object.keys(this._updates.layers);n.length&&this._updateWorkerLayers(n)}var r,i=Object.keys(this._updates.sources);for(r=0;r=0;return r&&this._handleErrors(g.source,"sources."+t,e)?this:(e=new x(t,e,this.dispatcher),this.sources[t]=e,e.style=this,e.on("load",this._forwardSourceEvent).on("error",this._forwardSourceEvent).on("change",this._forwardSourceEvent).on("tile.add",this._forwardTileEvent).on("tile.load",this._forwardTileEvent).on("tile.error",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.add",{source:e}]),this._updates.changed=!0,this)},removeSource:function(t){if(this._checkLoaded(),void 0===this.sources[t])throw new Error("There is no source with this ID");var e=this.sources[t];return delete this.sources[t],delete this._updates.sources[t],e.off("load",this._forwardSourceEvent).off("error",this._forwardSourceEvent).off("change",this._forwardSourceEvent).off("tile.add",this._forwardTileEvent).off("tile.load",this._forwardTileEvent).off("tile.error",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.remove",{source:e}]),this._updates.changed=!0,this},getSource:function(t){return this.sources[t]&&this.sources[t].getSource()},addLayer:function(t,e){if(this._checkLoaded(),!(t instanceof o)){if(this._handleErrors(g.layer,"layers."+t.id,t,!1,{arrayIndex:-1}))return this;var n=t.ref&&this.getLayer(t.ref);t=o.create(t,n)}return this._validateLayer(t),t.on("error",this._forwardLayerEvent),this._layers[t.id]=t,this._order.splice(e?this._order.indexOf(e):1/0,0,t.id),this._updates.allLayers=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.events.push(["layer.add",{layer:t}]),this.updateClasses(t.id)},removeLayer:function(t){this._checkLoaded();var e=this._layers[t];if(void 0===e)throw new Error("There is no layer with this ID");for(var n in this._layers)this._layers[n].ref===t&&this.removeLayer(n);return e.off("error",this._forwardLayerEvent),delete this._layers[t],delete this._updates.layers[t],delete this._updates.paintProps[t],this._order.splice(this._order.indexOf(t),1),this._updates.allLayers=!0,this._updates.events.push(["layer.remove",{layer:e}]),this._updates.changed=!0,this},getLayer:function(t){return this._layers[t]},getReferentLayer:function(t){var e=this.getLayer(t);return e.ref&&(e=this.getLayer(e.ref)),e},setLayerZoomRange:function(t,e,n){this._checkLoaded();var r=this.getReferentLayer(t);return r.minzoom===e&&r.maxzoom===n?this:(null!=e&&(r.minzoom=e),null!=n&&(r.maxzoom=n),this._updateLayer(r))},setFilter:function(t,e){this._checkLoaded();var n=this.getReferentLayer(t);return null!==e&&this._handleErrors(g.filter,"layers."+n.id+".filter",e)?this:c.deepEqual(n.filter,e)?this:(n.filter=c.clone(e),this._updateLayer(n))},getFilter:function(t){return this.getReferentLayer(t).filter},setLayoutProperty:function(t,e,n){this._checkLoaded();var r=this.getReferentLayer(t);return c.deepEqual(r.getLayoutProperty(e),n)?this:(r.setLayoutProperty(e,n),this._updateLayer(r))},getLayoutProperty:function(t,e){return this.getReferentLayer(t).getLayoutProperty(e)},setPaintProperty:function(t,e,n,r){this._checkLoaded();var i=this.getLayer(t);if(c.deepEqual(i.getPaintProperty(e,r),n))return this;var o=i.isPaintValueFeatureConstant(e);i.setPaintProperty(e,n,r);var a=!(n&&_.isFunctionDefinition(n)&&"$zoom"!==n.property&&void 0!==n.property);return a&&o||(this._updates.layers[t]=!0,i.source&&(this._updates.sources[i.source]=!0)),this.updateClasses(t,e)},getPaintProperty:function(t,e,n){return this.getLayer(t).getPaintProperty(e,n)},updateClasses:function(t,e){if(this._updates.changed=!0,t){var n=this._updates.paintProps;n[t]||(n[t]={}),n[t][e||"all"]=!0}else this._updates.allPaintProps=!0;return this},serialize:function(){return c.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:c.mapObject(this.sources,function(t){return t.serialize()}),layers:this._order.map(function(t){return this._layers[t].serialize()},this)},function(t){return void 0!==t})},_updateLayer:function(t){return this._updates.layers[t.id]=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.changed=!0,this},_flattenRenderedFeatures:function(t){for(var e=[],n=this._order.length-1;n>=0;n--)for(var r=this._order[n],i=0;is.lastIntegerZoom?(r=u+(1-u)*c,f*=2,i=t({zoom:a-1},n),o=t({zoom:a},n)):(r=1-(1-c)*u,o=t({zoom:a},n),i=t({zoom:a+1},n),f/=2),void 0===i||void 0===o?void 0:{from:i,fromScale:f,to:o,toScale:h,t:r}}}var o=t("./style_function"),a=t("./parse_color"),s=t("../util/util");e.exports=r},{"../util/util":136,"./parse_color":71,"./style_function":74}],74:[function(t,e,n){"use strict";var r=t("mapbox-gl-function");n.interpolated=function(t){var e=r.interpolated(t),n=function(t,n){return e(t&&t.zoom,n||{})};return n.isFeatureConstant=e.isFeatureConstant,n.isZoomConstant=e.isZoomConstant,n},n["piecewise-constant"]=function(t){var e=r["piecewise-constant"](t),n=function(t,n){return e(t&&t.zoom,n||{})};return n.isFeatureConstant=e.isFeatureConstant,n.isZoomConstant=e.isZoomConstant,n},n.isFunctionDefinition=r.isFunctionDefinition},{"mapbox-gl-function":163}],75:[function(t,e,n){"use strict";function r(t,e){this.set(t,e)}function i(t){return t.value}var o=t("../util/util"),a=t("./style_transition"),s=t("./style_declaration"),l=t("./style_spec"),u=t("./validate_style"),c=t("./parse_color"),f=t("../util/evented");e.exports=r;var h="-transition";r.create=function(e,n){var r={background:t("./style_layer/background_style_layer"),circle:t("./style_layer/circle_style_layer"),fill:t("./style_layer/fill_style_layer"),line:t("./style_layer/line_style_layer"),raster:t("./style_layer/raster_style_layer"),symbol:t("./style_layer/symbol_style_layer")};return new r[(n||e).type](e,n)},r.prototype=o.inherit(f,{set:function(t,e){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(e||t).type,this.source=(e||t).source,this.sourceLayer=(e||t)["source-layer"],this.minzoom=(e||t).minzoom,this.maxzoom=(e||t).maxzoom,this.filter=(e||t).filter,this.paint={},this.layout={},this._paintSpecifications=l["paint_"+this.type],this._layoutSpecifications=l["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var n,r;for(var i in t){var o=i.match(/^paint(?:\.(.*))?$/);if(o){var a=o[1]||"";for(n in t[i])this.setPaintProperty(n,t[i][n],a)}}if(this.ref)this._layoutDeclarations=e._layoutDeclarations;else for(r in t.layout)this.setLayoutProperty(r,t.layout[r]);for(n in this._paintSpecifications)this.paint[n]=this.getPaintValue(n);for(r in this._layoutSpecifications)this._updateLayoutValue(r)},setLayoutProperty:function(t,e){if(null==e)delete this._layoutDeclarations[t];else{var n="layers."+this.id+".layout."+t;if(this._handleErrors(u.layoutProperty,n,t,e))return;this._layoutDeclarations[t]=new s(this._layoutSpecifications[t],e)}this._updateLayoutValue(t)},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,e,n){var r=this._layoutSpecifications[t],i=this._layoutDeclarations[t];return i?i.calculate(e,n):r.default},setPaintProperty:function(t,e,n){var r="layers."+this.id+(n?'["paint.'+n+'"].':".paint.")+t;if(o.endsWith(t,h))if(this._paintTransitionOptions[n||""]||(this._paintTransitionOptions[n||""]={}),null===e||void 0===e)delete this._paintTransitionOptions[n||""][t];else{if(this._handleErrors(u.paintProperty,r,t,e))return;this._paintTransitionOptions[n||""][t]=e}else if(this._paintDeclarations[n||""]||(this._paintDeclarations[n||""]={}),null===e||void 0===e)delete this._paintDeclarations[n||""][t];else{if(this._handleErrors(u.paintProperty,r,t,e))return;this._paintDeclarations[n||""][t]=new s(this._paintSpecifications[t],e)}},getPaintProperty:function(t,e){return e=e||"",o.endsWith(t,h)?this._paintTransitionOptions[e]&&this._paintTransitionOptions[e][t]:this._paintDeclarations[e]&&this._paintDeclarations[e][t]&&this._paintDeclarations[e][t].value},getPaintValue:function(t,e,n){var r=this._paintSpecifications[t],i=this._paintTransitions[t];return i?i.calculate(e,n):"color"===r.type&&r.default?c(r.default):r.default},getPaintValueStopZoomLevels:function(t){var e=this._paintTransitions[t];return e?e.declaration.stopZoomLevels:[]},getPaintInterpolationT:function(t,e){var n=this._paintTransitions[t];return n.declaration.calculateInterpolationT({zoom:e})},isPaintValueFeatureConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isFeatureConstant:!0},isLayoutValueFeatureConstant:function(t){var e=this._layoutDeclarations[t];return e?e.isFeatureConstant:!0},isPaintValueZoomConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isZoomConstant:!0},isHidden:function(t){return this.minzoom&&t=this.maxzoom?!0:"none"===this.layout.visibility?!0:0===this.paint[this.type+"-opacity"]},updatePaintTransitions:function(t,e,n,r){for(var i=o.extend({},this._paintDeclarations[""]),a=0;a-n/2;){if(a--,0>a)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;n/2>s;){var c=t[a-1],f=t[a],h=t[a+1];if(!h)return!1;var d=c.angleTo(f)-f.angleTo(h);for(d=Math.abs((d+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:d}),u+=d;s-l[0].distance>r;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=f.dist(h)}return!0}e.exports=r},{}],87:[function(t,e,n){"use strict";function r(t,e,n,r,o){for(var a=[],s=0;s=r&&h.x>=r||(f.x>=r?f=new i(r,f.y+(h.y-f.y)*((r-f.x)/(h.x-f.x)))._round():h.x>=r&&(h=new i(r,f.y+(h.y-f.y)*((r-f.x)/(h.x-f.x)))._round()),f.y>=o&&h.y>=o||(f.y>=o?f=new i(f.x+(h.x-f.x)*((o-f.y)/(h.y-f.y)),o)._round():h.y>=o&&(h=new i(f.x+(h.x-f.x)*((o-f.y)/(h.y-f.y)),o)._round()),l&&f.equals(l[l.length-1])||(l=[f],a.push(l)),l.push(h)))))}return a}var i=t("point-geometry");e.exports=r},{"point-geometry":194}],88:[function(t,e,n){"use strict";var r=t("../util/struct_array"),i=t("../util/util"),o=t("point-geometry"),a=e.exports=new r({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});i.extendAll(a.prototype.StructType.prototype,{get anchorPoint(){return new o(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":134,"../util/util":136,"point-geometry":194}],89:[function(t,e,n){"use strict";function r(t,e,n,r,i,o,a,s,l,u,c){var f=a.top*s-l,h=a.bottom*s+l,d=a.left*s-l,p=a.right*s+l;if(this.boxStartIndex=t.length,u){var m=h-f,g=p-d;if(m>0)if(m=Math.max(10*s,m),c){var y=e[n.segment+1].sub(e[n.segment])._unit()._mult(g),v=[n.sub(y),n.add(y)];this._addLineCollisionBoxes(t,v,n,0,g,m,r,i,o)}else this._addLineCollisionBoxes(t,e,n,n.segment,g,m,r,i,o)}else t.emplaceBack(n.x,n.y,d,f,p,h,1/0,r,i,o,0,0,0,0,0);this.boxEndIndex=t.length}e.exports=r,r.prototype._addLineCollisionBoxes=function(t,e,n,r,i,o,a,s,l){var u=o/2,c=Math.floor(i/u),f=-o/2,h=this.boxes,d=n,p=r+1,m=f;do{if(p--,0>p)return h;m-=e[p].dist(d),d=e[p]}while(m>-i/2);for(var g=e[p].dist(e[p+1]),y=0;c>y;y++){for(var v=-i/2+y*u;v>m+g;){if(m+=g,p++,p+1>=e.length)return h;g=e[p].dist(e[p+1])}var x=v-m,b=e[p],_=e[p+1],w=_.sub(b)._unit()._mult(x)._add(b)._round(),M=Math.max(Math.abs(v-f)-u/2,0),k=i/2/M;t.emplaceBack(w.x,w.y,-o/2,-o/2,o/2,o/2,k,a,s,l,0,0,0,0,0)}return h}},{}],90:[function(t,e,n){"use strict";function r(t,e,n){if("object"==typeof t){var r=t;n=e,t=r.angle,e=r.pitch,this.grid=new a(r.grid),this.ignoredGrid=new a(r.ignoredGrid)}else this.grid=new a(o,12,6),this.ignoredGrid=new a(o,12,0);this.angle=t,this.pitch=e;var i=Math.sin(t),s=Math.cos(t);if(this.rotationMatrix=[s,-i,i,s],this.reverseRotationMatrix=[s,i,-i,s],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=n,0===n.length){n.emplaceBack();var l=32767;n.emplaceBack(0,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),n.emplaceBack(o,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),n.emplaceBack(0,0,-l,0,l,0,l,0,0,0,0,0,0,0,0,0),n.emplaceBack(0,o,-l,0,l,0,l,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=n.get(0),this.edges=[n.get(1),n.get(2),n.get(3),n.get(4)]}var i=t("point-geometry"),o=t("../data/bucket").EXTENT,a=t("grid-index");e.exports=r,r.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},r.prototype.minScale=.25,r.prototype.maxScale=2,r.prototype.placeCollisionFeature=function(t,e,n){for(var r=this.collisionBoxArray,o=this.minScale,a=this.rotationMatrix,s=this.yStretch,l=t.boxStartIndex;l=this.maxScale)return o}if(n){var _;if(this.angle){var w=this.reverseRotationMatrix,M=new i(u.x1,u.y1).matMult(w),k=new i(u.x2,u.y1).matMult(w),A=new i(u.x1,u.y2).matMult(w),S=new i(u.x2,u.y2).matMult(w);_=this.tempCollisionBox,_.anchorPointX=u.anchorPoint.x,_.anchorPointY=u.anchorPoint.y,_.x1=Math.min(M.x,k.x,A.x,S.x),_.y1=Math.min(M.y,k.x,A.x,S.x),_.x2=Math.max(M.x,k.x,A.x,S.x),_.y2=Math.max(M.y,k.x,A.x,S.x),_.maxScale=u.maxScale}else _=u;for(var T=0;T=this.maxScale)return o}}}return o},r.prototype.queryRenderedSymbols=function(t,e,n,r,o){var a={},s=[],l=this.collisionBoxArray,u=this.rotationMatrix,c=new i(t,e)._matMult(u),f=this.tempCollisionBox;f.anchorX=c.x,f.anchorY=c.y,f.x1=0,f.y1=0,f.x2=n-t,f.y2=r-e,f.maxScale=o,o=f.maxScale;for(var h=[c.x+f.x1/o,c.y+f.y1/o*this.yStretch,c.x+f.x2/o,c.y+f.y2/o*this.yStretch],d=this.grid.query(h[0],h[1],h[2],h[3]),p=this.ignoredGrid.query(h[0],h[1],h[2],h[3]),m=0;m=o&&(a[v][x]=!0,s.push(d[g]))}}return s},r.prototype.getPlacementScale=function(t,e,n,r,i){var o=e.x-r.x,a=e.y-r.y,s=(i.x1-n.x2)/o,l=(i.x2-n.x1)/o,u=(i.y1-n.y2)*this.yStretch/a,c=(i.y2-n.y1)*this.yStretch/a;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(u)||isNaN(c))&&(u=c=1);var f=Math.min(Math.max(s,l),Math.max(u,c)),h=i.maxScale,d=n.maxScale;return f>h&&(f=h),f>d&&(f=d),f>t&&f>=i.placementScale&&(t=f),t},r.prototype.insertCollisionFeature=function(t,e,n){for(var r=n?this.ignoredGrid:this.grid,i=this.collisionBoxArray,o=t.boxStartIndex;oe-f*s&&(e=f*s+e/4);var d=2*a,p=h?e/2*l%e:(f/2+d)*s*l%e;return i(t,p,e,c,n,f*s,h,!1,u)}function i(t,e,n,r,l,u,c,f,h){for(var d=u/2,p=0,m=0;my+n;){y+=n;var k=(y-g)/w,A=o(b.x,_.x,k),S=o(b.y,_.y,k);if(A>=0&&h>A&&S>=0&&h>S&&y-d>=0&&p>=y+d){var T=new a(A,S,M,x)._round();r&&!s(t,T,u,r,l)||v.push(T)}}g+=w}return f||v.length||c||(v=i(t,g/2,n,r,l,u,c,!0,h)),v}var o=t("../util/interpolate"),a=t("../symbol/anchor"),s=t("./check_max_angle");e.exports=r},{"../symbol/anchor":85,"../util/interpolate":130,"./check_max_angle":86}],92:[function(t,e,n){"use strict";function r(){this.width=s,this.height=s,this.bin=new i(this.width,this.height),this.index={},this.ids={},this.data=new Uint8Array(this.width*this.height)}var i=t("shelf-pack"),o=t("../util/util"),a=4,s=128,l=2048;e.exports=r,r.prototype.getGlyphs=function(){var t,e,n,r={};for(var i in this.ids)t=i.split("#"),e=t[0],n=t[1],r[e]||(r[e]=[]),r[e].push(n);return r},r.prototype.getRects=function(){var t,e,n,r={};for(var i in this.ids)t=i.split("#"),e=t[0],n=t[1],r[e]||(r[e]={}),r[e][n]=this.index[i];return r},r.prototype.addGlyph=function(t,e,n,r){if(!n)return null;var i=e+"#"+n.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!n.bitmap)return null;var a=n.width+2*r,s=n.height+2*r,l=1,u=a+2*l,c=s+2*l;u+=4-u%4,c+=4-c%4;var f=this.bin.packOne(u,c);if(f||(this.resize(),f=this.bin.packOne(u,c)),!f)return o.warnOnce("glyph bitmap overflow"),null;this.index[i]=f,this.ids[i]=[t];for(var h=this.data,d=n.bitmap,p=0;s>p;p++)for(var m=this.width*(f.y+p+l)+f.x+l,g=a*p,y=0;a>y;y++)h[m+y]=d[g+y];return this.dirty=!0,f},r.prototype.resize=function(){var t=this.width,e=this.height;if(!(t>=l||e>=l)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=a,this.height*=a,this.bin.resize(this.width,this.height);for(var n=new ArrayBuffer(this.width*this.height),r=0;e>r;r++){var i=new Uint8Array(this.data.buffer,e*r,t),o=new Uint8Array(n,e*r*a,t);o.set(i)}this.data=new Uint8Array(n)}},r.prototype.bind=function(t){this.gl=t,this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,null))},r.prototype.updateTexture=function(t){this.bind(t),this.dirty&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data),this.dirty=!1)}},{"../util/util":136,"shelf-pack":197}],93:[function(t,e,n){"use strict";function r(t){this.url=t&&a(t),this.atlases={},this.stacks={},this.loading={}}function i(t,e,n){var r=1;this.advance=t.advance,this.left=t.left-n-r,this.top=t.top+n+r,this.rect=e}function o(t,e,n,r){return r=r||"abc",n.replace("{s}",r[t.length%r.length]).replace("{fontstack}",t).replace("{range}",e); +}var a=t("../util/mapbox").normalizeGlyphsURL,s=t("../util/ajax").getArrayBuffer,l=t("../util/glyphs"),u=t("../symbol/glyph_atlas"),c=t("pbf");e.exports=r,r.prototype.getSimpleGlyphs=function(t,e,n,r){void 0===this.stacks[t]&&(this.stacks[t]={}),void 0===this.atlases[t]&&(this.atlases[t]=new u);for(var o,a={},s=this.stacks[t],l=this.atlases[t],c=3,f={},h=0,d=0;d65535)return n("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var r=this.loading[t];if(r[e])r[e].push(n);else{r[e]=[n];var i=256*e+"-"+(256*e+255),a=o(t,i,this.url);s(a,function(t,n){for(var i=!t&&new l(new c(new Uint8Array(n))),o=0;on&&(o=!o),o&&i++;var u=new s(e.x,e.y),c=r[i],f=1/0;n=Math.abs(n);for(var h=l;;){var d=u.dist(c),p=n/d,m=Math.atan2(c.y-u.y,c.x-u.x);if(o||(m+=Math.PI),t.push({anchorPoint:u,offset:a?Math.PI:0,minScale:p,maxScale:f,angle:(m+2*Math.PI)%(2*Math.PI)}),h>=p)break;for(u=c;u.equals(c);)if(i+=o?1:-1,c=r[i],!c)return p;var g=c.sub(u)._unit();u=u.sub(g._mult(d)),f=p}return h}var s=t("point-geometry");e.exports={getIconQuads:i,getGlyphQuads:o,SymbolQuad:r};var l=.5},{"point-geometry":194}],96:[function(t,e,n){"use strict";function r(t,e,n){for(var r=[],o=0,a=t.length;a>o;o++){var s=i(t[o].properties,e["text-field"]);if(s){s=s.toString();var l=e["text-transform"];"uppercase"===l?s=s.toLocaleUpperCase():"lowercase"===l&&(s=s.toLocaleLowerCase());for(var u=0;ur&&null!==c){var b=y[c+1].x;g=Math.max(b,g);for(var _=c+1;v>=_;_++)y[_].y+=n,y[_].x-=b;if(a){var w=c;f[y[c].codePoint]&&w--,s(y,e,p,w,a)}p=c+1,c=null,d+=b,m++}h[x.codePoint]&&(c=v)}var M=y[y.length-1],k=M.x+e[M.codePoint].advance;g=Math.max(g,k);var A=(m+1)*n;s(y,e,p,y.length-1,a),l(y,a,i,o,g,n,m,u),t.top+=-o*A,t.bottom=t.top+A,t.left+=-i*g,t.right=t.left+g}function s(t,e,n,r,i){for(var o=e[t[r].codePoint].advance,a=(t[r].x+o)*i,s=n;r>=s;s++)t[s].x-=a}function l(t,e,n,r,i,o,a,s){for(var l=(e-n)*i+s[0],u=(-r*(a+1)+.5)*o+s[1],c=0;c=h;h++,d=((h+u)%u+r)*e+n,p+=o)for(f=-1;l>=f;f++)i[p+f]=t[d+(f+l)%l];else for(h=0;u>h;h++,d+=e,p+=o)for(f=0;l>f;f++)i[p+f]=t[d+f]}function o(t,e,n,r,i){this.rect=t,this.width=e,this.height=n,this.sdf=r,this.pixelRatio=i}var a=t("shelf-pack"),s=t("../util/browser"),l=t("../util/util");e.exports=r,r.prototype.allocateImage=function(t,e){t/=this.pixelRatio,e/=this.pixelRatio;var n=2,r=t+n+(4-(t+n)%4),i=e+n+(4-(e+n)%4),o=this.bin.packOne(r,i);return o?o:(l.warnOnce("SpriteAtlas out of space."),null)},r.prototype.getImage=function(t,e){if(this.images[t])return this.images[t];if(!this.sprite)return null;var n=this.sprite.getSpritePosition(t);if(!n.width||!n.height)return null;var r=this.allocateImage(n.width,n.height);if(!r)return null;var i=new o(r,n.width/n.pixelRatio,n.height/n.pixelRatio,n.sdf,n.pixelRatio/this.pixelRatio);return this.images[t]=i,this.copy(r,n,e),i},r.prototype.getPosition=function(t,e){var n=this.getImage(t,e),r=n&&n.rect;if(!r)return null;var i=n.width*n.pixelRatio,o=n.height*n.pixelRatio,a=1;return{size:[n.width,n.height],tl:[(r.x+a)/this.width,(r.y+a)/this.height],br:[(r.x+a+i)/this.width,(r.y+a+o)/this.height]}},r.prototype.allocate=function(){if(!this.data){var t=Math.floor(this.width*this.pixelRatio),e=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(t*e);for(var n=0;n1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},r.prototype.addIcons=function(t,e){for(var n=0;n1||(w?(clearTimeout(w),w=null,y("dblclick",e)):w=setTimeout(d,300))}function c(t){v("touchmove",t)}function f(t){v("touchend",t)}function h(t){v("touchcancel",t)}function d(){w=null}function p(t){var e=r.mousePos(x,t);e.equals(_)&&y("click",t)}function m(t){y("dblclick",t),t.preventDefault()}function g(t){b=t,t.preventDefault()}function y(e,n){var i=r.mousePos(x,n);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:n})}function v(e,n){var o=r.touchPos(x,n),a=o.reduce(function(t,e,n,r){return t.add(e.div(r.length))},new i(0,0));return t.fire(e,{lngLat:t.unproject(a),point:a,lngLats:o.map(function(e){return t.unproject(e)},this),points:o,originalEvent:n})}var x=t.getCanvasContainer(),b=null,_=null,w=null;for(var M in o)t[M]=new o[M](t,e),e.interactive&&e[M]&&t[M].enable();x.addEventListener("mouseout",n,!1),x.addEventListener("mousedown",a,!1),x.addEventListener("mouseup",s,!1),x.addEventListener("mousemove",l,!1),x.addEventListener("touchstart",u,!1),x.addEventListener("touchend",f,!1),x.addEventListener("touchmove",c,!1),x.addEventListener("touchcancel",h,!1),x.addEventListener("click",p,!1),x.addEventListener("dblclick",m,!1),x.addEventListener("contextmenu",g,!1)}},{"../util/dom":122,"./handler/box_zoom":107,"./handler/dblclick_zoom":108,"./handler/drag_pan":109,"./handler/drag_rotate":110,"./handler/keyboard":111,"./handler/scroll_zoom":112,"./handler/touch_zoom_rotate":113,"point-geometry":194}],102:[function(t,e,n){"use strict";var r=t("../util/util"),i=t("../util/interpolate"),o=t("../util/browser"),a=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),u=e.exports=function(){};r.extend(u.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,n){return this.panTo(this.transform.center,r.extend({offset:l.convert(t).mult(-1)},e),n),this},panTo:function(t,e,n){return this.easeTo(r.extend({center:t},e),n)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,n){return this.easeTo(r.extend({zoom:t},e),n)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,n){return this.easeTo(r.extend({bearing:t},e),n)},resetNorth:function(t,e){return this.rotateTo(0,r.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())180&&(c.center.lng>0&&m.lng<0?m.lng+=360:c.center.lng<0&&m.lng>0&&(m.lng-=360));var x=c.zoomScale(g-h),b=c.point,_="center"in t?c.project(m).sub(f.div(x)):b,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),A=k/x,S=_.sub(b).mag();if("minZoom"in t){var T=r.clamp(Math.min(t.minZoom,h,g),c.minZoom,c.maxZoom),z=k/c.zoomScale(T-h);M=Math.sqrt(z/S*2)}var E=M*M,L=n(0),I=function(t){return s(L)/s(L+M*t)},P=function(t){return k*((s(L)*u(L+M*t)-o(L))/E)/S},D=(n(1)-L)/M;if(Math.abs(S)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var C=k>A?-1:1;D=Math.abs(Math.log(A/k))/M,P=function(){return 0},I=function(t){return Math.exp(C*M*t)}}if("duration"in t)t.duration=+t.duration;else{var O="screenSpeed"in t?+t.screenSpeed/M:+t.speed;t.duration=1e3*D/O}return this.zooming=!0,d!==y&&(this.rotating=!0),p!==v&&(this.pitching=!0),this.fire("movestart",e),this.fire("zoomstart",e),this._ease(function(t){var n=t*D,r=P(n);c.zoom=h+c.scaleZoom(1/I(n)),c.center=c.unproject(b.add(_.sub(b).mult(r)),w),this.rotating&&(c.bearing=i(d,y,t)),this.pitching&&(c.pitch=i(p,v,t)),this.fire("move",e),this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){this.zooming=!1,this.rotating=!1,this.pitching=!1,this.fire("zoomend",e),this.fire("moveend",e)},t),this},isEasing:function(){return!!this._abortFn},stop:function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},_ease:function(t,e,n){this._finishFn=e,this._abortFn=o.timed(function(e){t.call(this,n.easing(e)),1===e&&this._finishEase()},n.animate===!1?0:n.duration,this)},_finishEase:function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},_normalizeBearing:function(t,e){t=r.wrap(t,-180,180);var n=Math.abs(t-e);return Math.abs(t-360-e)=0)return!1;return!0}),e.join(" | ")},r.prototype=a.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",n=this._container=o.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),n},_update:function(){this._map.style&&(this._container.innerHTML=r.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":122,"../../util/util":136,"./control":104}],104:[function(t,e,n){"use strict";function r(){}var i=t("../../util/util"),o=t("../../util/evented");e.exports=r,r.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var n=this.options.position,r=t._controlCorners[n];e.className+=" mapboxgl-ctrl",-1!==n.indexOf("bottom")?r.insertBefore(e,r.firstChild):r.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},i.extend(r.prototype,o)},{"../../util/evented":128,"../../util/util":136}],105:[function(t,e,n){"use strict";function r(t){s.setOptions(this,t)}var i=t("./control"),o=t("../../util/browser"),a=t("../../util/dom"),s=t("../../util/util");e.exports=r;var l={enableHighAccuracy:!1,timeout:6e3};r.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",n=this._container=a.create("div",e+"-group",t.getContainer());return o.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=a.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),n):n},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},_error:function(t){this.fire("error",t),this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":120,"../../util/dom":122,"../../util/util":136,"./control":104}],106:[function(t,e,n){"use strict";function r(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var o=t("./control"),a=t("../../util/dom"),s=t("../../util/util");e.exports=r,r.prototype=s.inherit(o,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",n=this._container=a.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=a.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),n},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(a.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),a.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var n=a.create("button",t,this._container);return n.type="button",n.addEventListener("click",function(){e()}),n},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":122,"../../util/util":136,"./control":104}],107:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../geo/lng_lat_bounds"),a=t("../../util/util");e.exports=r,r.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,n=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var r=Math.min(e.x,n.x),o=Math.max(e.x,n.x),a=Math.min(e.y,n.y),s=Math.max(e.y,n.y);i.setTransform(this._box,"translate("+r+"px,"+a+"px)"),this._box.style.width=o-r+"px",this._box.style.height=s-a+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,n=i.mousePos(this._el,t),r=new o(this._map.unproject(e),this._map.unproject(n));this._finish(),e.x===n.x&&e.y===n.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(r,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:r})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":34,"../../util/dom":122,"../../util/util":136}],108:[function(t,e,n){"use strict";function r(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=r,r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)}}},{}],109:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=r;var a=.3,s=o.bezier(0,0,a,1),l=1400,u=2500;r.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),n=this._map;n.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),n.transform.setLocationAtPoint(n.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),n=this._inertia;if(n.length<2)return void e();var r=n[n.length-1],i=n[0],o=r[1].sub(i[1]),c=(r[0]-i[0])/1e3;if(0===c||r[1].equals(i[1]))return void e();var f=o.mult(a/c),h=f.mag();h>l&&(h=l,f._unit()._mult(h));var d=h/(u*a),p=f.mult(-d/2);this._map.panBy(p,{duration:1e3*d,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var n=1,r=0;return"mousemove"===t.type?t.buttons&0===n:t.button!==r},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),n=160;t.length>0&&e-t[0][0]>n;)t.shift()}}},{"../../util/dom":122,"../../util/util":136}],110:[function(t,e,n){"use strict";function r(t,e){this._map=t,this._el=t.getCanvasContainer(),this._bearingSnap=e.bearingSnap,a.bindHandlers(this)}var i=t("../../util/dom"),o=t("point-geometry"),a=t("../../util/util");e.exports=r;var s=.25,l=a.bezier(0,0,s,1),u=180,c=720;r.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){ +document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),n=e.mag();200>n&&(this._center=this._startPos.add(new o(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var n=this._pos,r=i.mousePos(this._el,t),o=this._center,a=n.sub(o).angleWith(r.sub(o))/Math.PI*180,s=e.getBearing()-a,l=this._inertia,u=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,u[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=r}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,n=e.getBearing(),r=this._inertia,i=function(){Math.abs(n)d?-1:1,m=(a[0]-o[0])/1e3;if(0===d||0===m)return void i();var g=Math.abs(d*(s/m));g>u&&(g=u);var y=g/(c*s),v=p*g*(y/2);h+=v,Math.abs(e._normalizeBearing(h,0))1;var n=t.ctrlKey?1:2,r=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===n:t.button!==r},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),n=160;t.length>0&&e-t[0][0]>n;)t.shift()}}},{"../../util/dom":122,"../../util/util":136,"point-geometry":194}],111:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=r;var i=80,o=2,a=5;r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,n={originalEvent:t};if(!e.isEasing())switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),n);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),n);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-o},n):(t.preventDefault(),e.panBy([-i,0],n));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+o},n):(t.preventDefault(),e.panBy([i,0],n));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+a},n):(t.preventDefault(),e.panBy([0,-i],n));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-a,0)},n):(t.preventDefault(),e.panBy([0,i],n))}}}}},{}],112:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/browser"),a=t("../../util/util");e.exports=r;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=-1!==s.indexOf("firefox"),u=-1!==s.indexOf("safari")&&-1===s.indexOf("chrom");r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=o.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,u&&(e/=3));var n=o.now(),r=n-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=n,0!==e&&e%4.000244140625===0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(r*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var n=this._map,r=2/(1+Math.exp(-Math.abs(t/100)));0>t&&0!==r&&(r=1/r);var i=n.ease?n.ease.to:n.transform.scale,o=n.transform.scaleZoom(i*r);n.zoomTo(o,{duration:0,around:n.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":120,"../../util/dom":122,"../../util/util":136}],113:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=r;var a=.15,s=o.bezier(0,0,a,1),l=12,u=2.5,c=.15,f=4;r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),n=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(n),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),n=i.mousePos(this._el,t.touches[1]),r=e.add(n).div(2),o=e.sub(n),a=o.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*o.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var u={duration:0,around:l.unproject(r)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=l.transform.scaleZoom(this._startScale*a)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),a,r]),l.easeTo(u,{originalEvent:t})}else{var h=Math.abs(1-a)>c,d=Math.abs(s)>f;d?this._gestureIntent="rotate":h&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=o,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,n=this._map;if(e.length<2)return void n.snapToNorth({},{originalEvent:t});var r=e[e.length-1],i=e[0],o=n.transform.scaleZoom(this._startScale*r[1]),c=n.transform.scaleZoom(this._startScale*i[1]),f=o-c,h=(r[0]-i[0])/1e3,d=r[2];if(0===h||o===c)return void n.snapToNorth({},{originalEvent:t});var p=f*a/h;Math.abs(p)>u&&(p=p>0?u:-u);var m=1e3*Math.abs(p/(l*a)),g=o+p*m/2e3;0>g&&(g=0),n.easeTo({zoom:g,duration:m,easing:s,around:n.unproject(d)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),n=160;t.length>2&&e-t[0][0]>n;)t.shift()}}},{"../../util/dom":122,"../../util/util":136}],114:[function(t,e,n){"use strict";function r(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=r;var i=t("../util/util");r.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3?(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0):!1},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),n=this._map.getBearing(),r=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(r)+"/"+t.lng.toFixed(r)+(n?"/"+Math.round(10*n)/10:"");window.history.replaceState("","",i)}}},{"../util/util":136}],115:[function(t,e,n){"use strict";function r(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),o=t("../util/util"),a=t("../util/browser"),s=t("../util/browser").window,l=t("../util/evented"),u=t("../util/dom"),c=t("../style/style"),f=t("../style/animation_loop"),h=t("../render/painter"),d=t("../geo/transform"),p=t("./hash"),m=t("./bind_handlers"),g=t("./camera"),y=t("../geo/lng_lat"),v=t("../geo/lng_lat_bounds"),x=t("point-geometry"),b=t("./control/attribution"),_=0,w=20,M={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:_,maxZoom:w,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,workerCount:Math.max(a.hardwareConcurrency-1,1)},k=e.exports=function(t){if(t=o.extend({},M,t),t.workerCount<1)throw new Error("workerCount must an integer greater than or equal to 1.");this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._trackResize=t.trackResize,this._workerCount=t.workerCount,this._bearingSnap=t.bearingSnap,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new f,this.transform=new d(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),o.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowOnline","_onWindowResize","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof s&&(s.addEventListener("online",this._onWindowOnline,!1),s.addEventListener("resize",this._onWindowResize,!1)),m(this,t),this._hash=t.hash&&(new p).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new b(t.attributionControl));var e=this.fire.bind(this,"error");this.on("style.error",e),this.on("source.error",e),this.on("tile.error",e),this.on("layer.error",e)};o.extend(k.prototype,l),o.extend(k.prototype,g.prototype),o.extend(k.prototype,{addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var n=this._classes.indexOf(t);return 0>n||""===t?this:(this._classes.splice(n,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var n={},r=0;r=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new v(this.transform.pointLocation(new x(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new x(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new x(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=v.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?_:t,t>=_&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&w>=t)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+w+", inclusive")},project:function(t){return this.transform.locationPoint(y.convert(t))},unproject:function(t){return this.transform.pointLocation(x.convert(t))},queryRenderedFeatures:function(){function t(t){return t instanceof x||Array.isArray(t)}var e,n={};return 2===arguments.length?(e=arguments[0],n=arguments[1]):1===arguments.length&&t(arguments[0])?e=arguments[0]:1===arguments.length&&(n=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(e),n,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[x.convert([0,0]),x.convert([this.transform.width,this.transform.height])]);var e,n=t instanceof x||"number"==typeof t[0];if(n){var r=x.convert(t);e=[r]}else{var i=[x.convert(t[0]),x.convert(t[1])];e=[i[0],new x(i[1].x,i[0].y),i[1],new x(i[0].x,i[1].y),i[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement),this.off("pitch",this.style._redoPlacement)),t?(t instanceof c?this.style=t:this.style=new c(t,this.animationLoop,this._workerCount),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){return this.style?this.style.serialize():void 0},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},addSourceType:function(t,e,n){return this.style.addSourceType(t,e,n)},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,n){return this.style.setLayerZoomRange(t,e,n),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,n,r){return this.style.setPaintProperty(t,e,n,r),this._update(!0),this},getPaintProperty:function(t,e,n){return this.style.getPaintProperty(t,e,n)},setLayoutProperty:function(t,e,n){return this.style.setLayoutProperty(t,e,n),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=u.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var n=this._controlContainer=u.create("div","mapboxgl-control-container",t),r=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){r[t]=u.create("div","mapboxgl-ctrl-"+t,n)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});return t?void(this.painter=new h(t,this.transform)):void this.fire("error",{error:new Error("Failed to initialize WebGL")})},_contextLost:function(t){t.preventDefault(),this._frameId&&a.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return this._styleDirty||this._sourcesDirty?!1:!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){try{this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||!this.animationLoop.stopped())&&this._rerender()}catch(t){this.fire("error",{error:t})}return this},remove:function(){this._hash&&this._hash.remove(),a.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof s&&s.removeEventListener("resize",this._onWindowResize,!1);var t=this.painter.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),r(this._canvasContainer),r(this._controlContainer),this._container.classList.remove("mapboxgl-map")},_rerender:function(){this.style&&!this._frameId&&(this._frameId=a.frame(this._render))},_forwardStyleEvent:function(t){this.fire("style."+t.type,o.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowOnline:function(){this._update()},_onWindowResize:function(){this._trackResize&&this.stop().resize()._update()}}),o.extendAll(k.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":33,"../geo/lng_lat_bounds":34,"../geo/transform":35,"../render/painter":49,"../style/animation_loop":69,"../style/style":72,"../util/browser":120,"../util/canvas":121,"../util/dom":122,"../util/evented":128,"../util/util":136,"./bind_handlers":101,"./camera":102,"./control/attribution":103,"./hash":114,"point-geometry":194}],116:[function(t,e,n){"use strict";function r(t,e){t||(t=i.create("div")),t.classList.add("mapboxgl-marker"),this._el=t,this._offset=a.convert(e&&e.offset||[0,0]),this._update=this._update.bind(this)}e.exports=r;var i=t("../util/dom"),o=t("../geo/lng_lat"),a=t("point-geometry");r.prototype={addTo:function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._el),t.on("move",this._update),this._update(),this},remove:function(){this._map&&(this._map.off("move",this._update),this._map=null);var t=this._el.parentNode;return t&&t.removeChild(this._el),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=o.convert(t),this._update(),this},getElement:function(){return this._el},_update:function(){if(this._map){var t=this._map.project(this._lngLat)._add(this._offset);i.setTransform(this._el,"translate("+t.x+"px,"+t.y+"px)")}}}},{"../geo/lng_lat":33,"../util/dom":122,"point-geometry":194}],117:[function(t,e,n){"use strict";function r(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=r;var i=t("../util/util"),o=t("../util/evented"),a=t("../util/dom"),s=t("../geo/lng_lat");r.prototype=i.inherit(o,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire("close"),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,n=document.createDocumentFragment(),r=document.createElement("body");for(r.innerHTML=t;;){if(e=r.firstChild,!e)break;n.appendChild(e)}return this.setDOMContent(n)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=a.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=a.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=a.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=a.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var n=this._container.offsetWidth,r=this._container.offsetHeight;e=t.ythis._map.transform.height-r?["bottom"]:[],t.xthis._map.transform.width-n/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},o=this._container.classList;for(var s in i)o.remove("mapboxgl-popup-anchor-"+s);o.add("mapboxgl-popup-anchor-"+e),a.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":33,"../util/dom":122,"../util/evented":128,"../util/util":136}],118:[function(t,e,n){"use strict";function r(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=r,r.prototype.receive=function(t){function e(t,e,n){this.postMessage({type:"",id:String(i),error:t?String(t):null,data:e},n)}var n,r=t.data,i=r.id;if(""===r.type)n=this.callbacks[r.id],delete this.callbacks[r.id],n&&n(r.error||null,r.data);else if("undefined"!=typeof r.id&&this.parent[r.type])this.parent[r.type](r.data,e.bind(this));else if("undefined"!=typeof r.id&&this.parent.workerSources){var o=r.type.split(".");this.parent.workerSources[o[0]][o[1]](r.data,e.bind(this))}else this.parent[r.type](r.data)},r.prototype.send=function(t,e,n,r){var i=null;n&&(this.callbacks[i=this.callbackID++]=n),this.postMessage({type:t,id:String(i),data:e},r)},r.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],119:[function(t,e,n){"use strict";function r(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}n.getJSON=function(t,e){var n=new XMLHttpRequest;return n.open("GET",t,!0),n.setRequestHeader("Accept","application/json"),n.onerror=function(t){e(t)},n.onload=function(){if(n.status>=200&&n.status<300&&n.response){var t;try{t=JSON.parse(n.response)}catch(r){return e(r)}e(null,t)}else e(new Error(n.statusText))},n.send(),n},n.getArrayBuffer=function(t,e){var n=new XMLHttpRequest;return n.open("GET",t,!0),n.responseType="arraybuffer",n.onerror=function(t){e(t)},n.onload=function(){n.status>=200&&n.status<300&&n.response?e(null,n.response):e(new Error(n.statusText))},n.send(),n},n.getImage=function(t,e){return n.getArrayBuffer(t,function(t,n){if(t)return e(t);var r=new Image;r.onload=function(){e(null,r),(window.URL||window.webkitURL).revokeObjectURL(r.src)};var i=new Blob([new Uint8Array(n)],{type:"image/png"});return r.src=(window.URL||window.webkitURL).createObjectURL(i),r.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=r.width,t.height=r.height,e.drawImage(r,0,0),e.getImageData(0,0,r.width,r.height).data},r})},n.getVideo=function(t,e){var n=document.createElement("video");n.onloadstart=function(){e(null,n)};for(var i=0;i=s+r?t.call(i,1):(t.call(i,(l-s)/r),n.frame(o)))}if(!r)return t.call(i,1),null;var a=!1,s=e.exports.now();return n.frame(o),function(){a=!0}},n.supported=t("mapbox-gl-supported"),n.hardwareConcurrency=navigator.hardwareConcurrency||4,Object.defineProperty(n,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),n.supportsWebp=!1;var o=document.createElement("img");o.onload=function(){n.supportsWebp=!0},o.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",n.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-supported":190}],121:[function(t,e,n){"use strict";function r(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),o=t("mapbox-gl-supported");e.exports=r,r.prototype.resize=function(t,e){var n=window.devicePixelRatio||1;this.canvas.width=n*t,this.canvas.height=n*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},r.prototype.getWebGLContext=function(t){return t=i.extend({},t,o.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},r.prototype.getElement=function(){return this.canvas}},{"../util":136,"mapbox-gl-supported":190}],122:[function(t,e,n){"use strict";function r(t){for(var e=0;ei;a=i++)e=t[i],n=t[a],r+=(n.x-e.x)*(e.y+n.y);return r}var o=t("quickselect");e.exports=function(t,e){var n=t.length;if(1>=n)return[t];for(var a,s,l=[],u=0;n>u;u++){var c=i(t[u]); +0!==c&&(t[u].area=Math.abs(c),void 0===s&&(s=0>c),s===0>c?(a&&l.push(a),a=[t[u]]):a.push(t[u]))}if(a&&l.push(a),e>1)for(var f=0;fn;n++){var r=new a,i=new o(r,e);i.name="Worker "+n,this.actors.push(i)}}var i=t("./util"),o=t("./actor"),a=t("./web_worker");e.exports=r,r.prototype={broadcast:function(t,e,n){n=n||function(){},i.asyncAll(this.actors,function(n,r){n.send(t,e,r)},n)},send:function(t,e,n,r,i){return("number"!=typeof r||isNaN(r))&&(r=this.currentActor=(this.currentActor+1)%this.actors.length),this.actors[r].send(t,e,n,i),r},remove:function(){for(var t=0;t=0&&this._events[t].splice(n,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var n=function(r){this.off(t,n),e.call(this,r)}.bind(this);return this.on(t,n),this},fire:function(t,e){if(!this.listens(t))return r.endsWith(t,"error")&&console.error(e&&e.error||e||"Empty error event"),this;e=r.extend({},e),r.extend(e,{type:t,target:this});for(var n=this._events[t].slice(),i=0;i=3)for(var l=0;l1){if(s(t,e))return!0;for(var r=0;r(e.y-t.y)*(n.x-t.x)}function u(t,e,n,r){return l(t,n,r)!==l(e,n,r)&&l(t,e,n)!==l(t,e,r)}function c(t,e,n){var r=n*n;if(1===e.length)return t.distSqr(e[0])i?t.distSqr(e):i>1?t.distSqr(n):t.distSqr(n.sub(e)._mult(i)._add(e))}function h(t,e){for(var n,r,i,o=!1,a=0;ae.y!=i.y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(o=!o)}return o}function d(t,e){for(var n=!1,r=0,i=t.length-1;re.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n}e.exports={multiPolygonIntersectsBufferedMultiPoint:r,multiPolygonIntersectsMultiPolygon:i,multiPolygonIntersectsBufferedMultiLine:o}},{}],132:[function(t,e,n){"use strict";function r(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=r,r.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},r.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var n=this.get(this.order[0]);n&&this.onRemove(n)}return this},r.prototype.has=function(t){return t in this.data},r.prototype.keys=function(){return this.order},r.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},r.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],133:[function(t,e,n){"use strict";function r(t,e,n){if(n=n||a.ACCESS_TOKEN,!n&&a.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,a.API_URL+e),t+=-1!==t.indexOf("?")?"&access_token=":"?access_token=",a.REQUIRE_ACCESS_TOKEN){if("s"===n[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=n}return t}function i(t){return t?"?"+t:""}function o(t){return t.access_token&&"tk."===t.access_token.slice(0,3)?u.extend({},t,{access_token:a.ACCESS_TOKEN}):t}var a=t("./config"),s=t("./browser"),l=t("url"),u=t("./util");e.exports.normalizeStyleURL=function(t,e){var n=l.parse(t);return"mapbox:"!==n.protocol?t:r("mapbox:/"+n.pathname+i(n.query),"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){var n=l.parse(t);return"mapbox:"!==n.protocol?t:r(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var n=l.parse(t);if("mapbox:"!==n.protocol)return t;var o=n.pathname.split("/")[1];return r("mapbox://"+o+"/{fontstack}/{range}.pbf"+i(n.query),"/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,n,o){var a=l.parse(t);return"mapbox:"!==a.protocol?(a.pathname+=e+n,l.format(a)):r("mapbox:/"+a.pathname+"/sprite"+e+n+i(a.query),"/styles/v1/",o)},e.exports.normalizeTileURL=function(t,e,n){var r=l.parse(t,!0);if(!e)return t;var i=l.parse(e);if("mapbox:"!==i.protocol)return t;var a=s.supportsWebp?".webp":"$1",u=s.devicePixelRatio>=2||512===n?"@2x":"";return l.format({protocol:r.protocol,hostname:r.hostname,pathname:r.pathname.replace(/(\.(?:png|jpg)\d*)/,u+a),query:o(r.query)})}},{"./browser":120,"./config":125,"./util":136,url:14}],134:[function(t,e,n){"use strict";function r(t){function e(){h.apply(this,arguments)}function n(){d.apply(this,arguments),this.members=e.prototype.members}var r=JSON.stringify(t);if(m[r])return m[r];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(h.prototype);var s=0,u=0,p=["Uint8"];return e.prototype.members=t.members.map(function(n){n={name:n.name,type:n.type,components:n.components||1},p.indexOf(n.type)<0&&p.push(n.type);var r=a(n.type);u=Math.max(u,r),n.offset=s=o(s,Math.max(t.alignment,r));for(var i=0;ithis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},d.prototype._refreshViews=function(){for(var t=0;tr;r++){var i=this.get(r);n.push(i)}return n}},{}],135:[function(t,e,n){"use strict";function r(t,e){return e.replace(/{([^{}]+)}/g,function(e,n){return n in t?t[n]:""})}e.exports=r},{}],136:[function(t,e,n){"use strict";var r=t("unitbezier"),i=t("../geo/coordinate");n.easeCubicInOut=function(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(.5>t?n:3*(t-e)+n-.75)},n.bezier=function(t,e,n,i){var o=new r(t,e,n,i);return function(t){return o.solve(t)}},n.ease=n.bezier(.25,.1,.25,1),n.clamp=function(t,e,n){return Math.min(n,Math.max(e,t))},n.wrap=function(t,e,n){var r=n-e,i=((t-e)%r+r)%r+e;return i===e?n:i},n.coalesce=function(){for(var t=0;t=0)return!0;return!1};var a={};n.warnOnce=function(t){a[t]||("undefined"!=typeof console&&console.warn(t),a[t]=!0)}},{"../geo/coordinate":32,unitbezier:203}],137:[function(t,e,n){"use strict";function r(t,e,n,r){this._vectorTileFeature=t,t._z=e,t._x=n,t._y=r,this.properties=t.properties,null!=t.id&&(this.id=t.id)}e.exports=r,r.prototype={type:"Feature",get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},set geometry(t){this._geometry=t},toJSON:function(){var t={};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"toJSON"!==e&&(t[e]=this[e]);return t}}},{}],138:[function(t,e,n){function r(t){return t=Math.round(t),0>t?0:t>255?255:t}function i(t){return 0>t?0:t>1?1:t}function o(t){return r("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return i("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function s(t,e,n){return 0>n?n+=1:n>1&&(n-=1),1>6*n?t+(e-t)*n*6:1>2*n?e:2>3*n?t+(e-t)*(2/3-n)*6:t}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in u)return u[e].slice();if("#"===e[0]){if(4===e.length){var n=parseInt(e.substr(1),16);return n>=0&&4095>=n?[(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1]:null}if(7===e.length){var n=parseInt(e.substr(1),16);return n>=0&&16777215>=n?[(16711680&n)>>16,(65280&n)>>8,255&n,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(-1!==i&&l+1===e.length){var c=e.substr(0,i),f=e.substr(i+1,l-(i+1)).split(","),h=1;switch(c){case"rgba":if(4!==f.length)return null;h=a(f.pop());case"rgb":return 3!==f.length?null:[o(f[0]),o(f[1]),o(f[2]),h];case"hsla":if(4!==f.length)return null;h=a(f.pop());case"hsl":if(3!==f.length)return null;var d=(parseFloat(f[0])%360+360)%360/360,p=a(f[1]),m=a(f[2]),g=.5>=m?m*(p+1):m+p-m*p,y=2*m-g;return[r(255*s(y,g,d+1/3)),r(255*s(y,g,d)),r(255*s(y,g,d-1/3)),h];default:return null}}return null}var u={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{n.parseCSSColor=l}catch(c){}},{}],139:[function(t,e,n){"use strict";function r(t,e,n){n=n||2;var r=e&&e.length,o=r?e[0]*n:t.length,s=i(t,0,o,n,!0),l=[];if(!s)return l;var u,c,h,d,p,m,g;if(r&&(s=f(t,e,s,n)),t.length>80*n){u=h=t[0],c=d=t[1];for(var y=n;o>y;y+=n)p=t[y],m=t[y+1],u>p&&(u=p),c>m&&(c=m),p>h&&(h=p),m>d&&(d=m);g=Math.max(h-u,d-c)}return a(s,l,n,u,c,g),l}function i(t,e,n,r,i){var o,a;if(i===I(t,e,n,r)>0)for(o=e;n>o;o+=r)a=z(o,t[o],t[o+1],a);else for(o=n-r;o>=e;o-=r)a=z(o,t[o],t[o+1],a);return a&&w(a,a.next)&&(E(a),a=a.next),a}function o(t,e){if(!t)return t;e||(e=t);var n,r=t;do if(n=!1,r.steiner||!w(r,r.next)&&0!==_(r.prev,r,r.next))r=r.next;else{if(E(r),r=e=r.prev,r===r.next)return null;n=!0}while(n||r!==e);return e}function a(t,e,n,r,i,f,h){if(t){!h&&f&&m(t,r,i,f);for(var d,p,g=t;t.prev!==t.next;)if(d=t.prev,p=t.next,f?l(t,r,i,f):s(t))e.push(d.i/n),e.push(t.i/n),e.push(p.i/n),E(t),t=p.next,g=p.next;else if(t=p,t===g){h?1===h?(t=u(t,e,n),a(t,e,n,r,i,f,2)):2===h&&c(t,e,n,r,i,f):a(o(t),e,n,r,i,f,1);break}}}function s(t){var e=t.prev,n=t,r=t.next;if(_(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(x(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&_(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function l(t,e,n,r){var i=t.prev,o=t,a=t.next;if(_(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,f=y(s,l,e,n,r),h=y(u,c,e,n,r),d=t.nextZ;d&&d.z<=h;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=f;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function u(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!w(i,o)&&M(i,r,r.next,o)&&A(i,o)&&A(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),E(r),E(r.next),r=t=o),r=r.next}while(r!==t);return r}function c(t,e,n,r,i,s){var l=t;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&b(l,u)){var c=T(l,u);return l=o(l,l.next),c=o(c,c.next),a(l,e,n,r,i,s),void a(c,e,n,r,i,s)}u=u.next}l=l.next}while(l!==t)}function f(t,e,n,r){var a,s,l,u,c,f=[];for(a=0,s=e.length;s>a;a++)l=e[a]*r,u=s-1>a?e[a+1]*r:t.length,c=i(t,l,u,r,!1),c===c.next&&(c.steiner=!0),f.push(v(c));for(f.sort(h),a=0;a=r.next.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(i>=s&&s>a){if(a=s,s===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x=r.x&&r.x>=c&&x(f>o?i:a,o,c,f,f>o?a:i,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(i-r.x),(h>l||l===h&&r.x>n.x)&&A(r,t)&&(n=r,h=l)),r=r.next;return n}function m(t,e,n,r){var i=t;do null===i.z&&(i.z=y(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,g(i)}function g(t){var e,n,r,i,o,a,s,l,u=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,r=n,s=0,e=0;u>e&&(s++,r=r.nextZ,r);e++);for(l=u;s>0||l>0&&r;)0===s?(i=r,r=r.nextZ,l--):0!==l&&r?n.z<=r.z?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--):(i=n,n=n.nextZ,s--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,u*=2}while(a>1);return t}function y(t,e,n,r,i){return t=32767*(t-n)/i,e=32767*(e-r)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function v(t){var e=t,n=t;do e.x=0&&(t-a)*(r-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function b(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!k(t,e)&&A(t,e)&&A(e,t)&&S(t,e)}function _(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function w(t,e){return t.x===e.x&&t.y===e.y}function M(t,e,n,r){return w(t,e)&&w(n,r)||w(t,r)&&w(n,e)?!0:_(t,e,n)>0!=_(t,e,r)>0&&_(n,r,t)>0!=_(n,r,e)>0}function k(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&M(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function A(t,e){return _(t.prev,t,t.next)<0?_(t,e,t.next)>=0&&_(t,t.prev,e)>=0:_(t,e,t.prev)<0||_(t,t.next,e)<0}function S(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do n.y>o!=n.next.y>o&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function T(t,e){var n=new L(t.i,t.x,t.y),r=new L(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function z(t,e,n,r){var i=new L(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function E(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 L(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function I(t,e,n,r){for(var i=0,o=e,a=n-r;n>o;o+=r)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}e.exports=r,r.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,a=Math.abs(I(t,0,o,n));if(i)for(var s=0,l=e.length;l>s;s++){var u=e[s]*n,c=l-1>s?e[s+1]*n:t.length;a-=Math.abs(I(t,u,c,n))}var f=0;for(s=0;sa;a++)n.vertices.push(t[i][o][a]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n}},{}],140:[function(t,e,n){"use strict";function r(t){return new Function("f","var p = (f && f.properties || {}); return "+i(t))}function i(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";var n="=="===e?a(t[1],t[2],"===",!1):"!="===e?a(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?a(t[1],t[2],e,!0):"any"===e?s(t.slice(1),"||"):"all"===e?s(t.slice(1),"&&"):"none"===e?c(s(t.slice(1),"||")):"in"===e?l(t[1],t.slice(2)):"!in"===e?c(l(t[1],t.slice(2))):"has"===e?u(t[1]):"!has"===e?c(u([t[1]])):"true";return"("+n+")"}function o(t){return"$type"===t?"f.type":"$id"===t?"f.id":"p["+JSON.stringify(t)+"]"}function a(t,e,n,r){var i=o(t),a="$type"===t?h.indexOf(e):JSON.stringify(e);return(r?"typeof "+i+"=== typeof "+a+"&&":"")+i+n+a}function s(t,e){return t.map(i).join(e)}function l(t,e){"$type"===t&&(e=e.map(function(t){return h.indexOf(t)}));var n=JSON.stringify(e.sort(f)),r=o(t);return e.length<=200?n+".indexOf("+r+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+r+", "+n+",0,"+(e.length-1)+")"}function u(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function f(t,e){return e>t?-1:t>e?1:0}e.exports=r;var h=["Unknown","Point","LineString","Polygon"]},{}],141:[function(t,e,n){function r(t,e){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.map(i(r,e)),t;case"Feature":return t.geometry=r(t.geometry,e),t;case"Polygon":case"MultiPolygon":return o(t,e);default:return t}}function i(t,e){return function(n){return t(n,e)}}function o(t,e){return"Polygon"===t.type?t.coordinates=a(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(i(a,e))),t}function a(t,e){e=!!e,t[0]=s(t[0],!e);for(var n=1;n=0}var u=t("geojson-area");e.exports=r},{"geojson-area":142}],142:[function(t,e,n){function r(t){if("Polygon"===t.type)return i(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,n=0;n0){e+=Math.abs(o(t[0]));for(var n=1;n2){for(var n,r,i=0;i=n&&r>=c)return t;if(u>r||n>c)return null;for(var f=[],h=0;h=n&&r>=p)f.push(m);else if(!(d>r||n>p)){var v=1===y?i(g,n,r,a):o(g,n,r,a,l,3===y);v.length&&f.push(s(m.tags,y,v,m.id))}}return f.length?f:null}function i(t,e,n,r){for(var i=[],o=0;o=e&&n>=s&&i.push(a)}return i}function o(t,e,n,r,i,o){for(var s=[],l=0;lc;c++)u=p||m[c],p=m[c+1],h=d||u[r],d=p[r],e>h?d>n?(b.push(i(u,p,e),i(u,p,n)),o||(b=a(s,b,g,y,v))):d>=e&&b.push(i(u,p,e)):h>n?e>d?(b.push(i(u,p,n),i(u,p,e)),o||(b=a(s,b,g,y,v))):n>=d&&b.push(i(u,p,n)):(b.push(u),e>d?(b.push(i(u,p,e)),o||(b=a(s,b,g,y,v))):d>n&&(b.push(i(u,p,n)),o||(b=a(s,b,g,y,v))));u=m[x-1],h=u[r],h>=e&&n>=h&&b.push(u),f=b[b.length-1],o&&f&&(b[0][0]!==f[0]||b[0][1]!==f[1])&&b.push(b[0]),a(s,b,g,y,v)}return s}function a(t,e,n,r,i){return e.length&&(e.area=n,e.dist=r,void 0!==i&&(e.outer=i),t.push(e)),[]}e.exports=r;var s=t("./feature")},{"./feature":146}],145:[function(t,e,n){"use strict";function r(t,e){var n=[];if("FeatureCollection"===t.type)for(var r=0;rr?0:r>1?1:r,[n,r,0]}function s(t){for(var e,n,r=0,i=0,o=0;o1)return!1;var o=i.geometry[0].length;if(5!==o)return!1;for(var a=0;o>a;a++){var s=f.point(i.geometry[0][a],e,t.z2,t.x,t.y);if(s[0]!==-n&&s[0]!==e+n||s[1]!==-n&&s[1]!==e+n)return!1}return!0}e.exports=r;var c=t("./convert"),f=t("./transform"),h=t("./clip"),d=t("./wrap"),p=t("./tile");i.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},i.prototype.splitTile=function(t,e,n,r,i,l,c){for(var f=[t,e,n,r],d=this.options,m=d.debug,g=null;f.length;){r=f.pop(),n=f.pop(),e=f.pop(),t=f.pop();var y=1<1&&console.time("creation"),x=this.tiles[v]=p(t,y,n,r,b,e===d.maxZoom),this.tileCoords.push({z:e,x:n,y:r}),m)){m>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,r,x.numFeatures,x.numPoints,x.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(x.source=t,i){if(e===d.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,k,A,S,T,z,E=.5*d.buffer/d.extent,L=.5-E,I=.5+E,P=1+E;M=k=A=S=null,T=h(t,y,n-E,n+I,0,a,x.min[0],x.max[0]),z=h(t,y,n+L,n+P,0,a,x.min[0],x.max[0]),T&&(M=h(T,y,r-E,r+I,1,s,x.min[1],x.max[1]),k=h(T,y,r+L,r+P,1,s,x.min[1],x.max[1])),z&&(A=h(z,y,r-E,r+I,1,s,x.min[1],x.max[1]),S=h(z,y,r+L,r+P,1,s,x.min[1],x.max[1])),m>1&&console.timeEnd("clipping"),t.length&&(f.push(M||[],e+1,2*n,2*r),f.push(k||[],e+1,2*n,2*r+1),f.push(A||[],e+1,2*n+1,2*r),f.push(S||[],e+1,2*n+1,2*r+1))}else i&&(g=e)}return g},i.prototype.getTile=function(t,e,n){var r=this.options,i=r.extent,a=r.debug,s=1<1&&console.log("drilling down to z%d-%d-%d",t,e,n);for(var c,h=t,d=e,p=n;!c&&h>0;)h--,d=Math.floor(d/2),p=Math.floor(p/2),c=this.tiles[o(h,d,p)];if(!c||!c.source)return null;if(a>1&&console.log("found parent tile z%d-%d-%d",h,d,p),u(c,i,r.buffer))return f.tile(c,i);a>1&&console.time("drilling down");var m=this.splitTile(c.source,h,d,p,t,e,n);if(a>1&&console.timeEnd("drilling down"),null!==m){var g=1<n;n++)o=i(t[n],t[u],t[c]),o>r&&(a=n,r=o);r>s?(t[a][2]=r,f.push(u),f.push(a),u=a):(c=f.pop(),u=f.pop())}}function i(t,e,n){var r=e[0],i=e[1],o=n[0],a=n[1],s=t[0],l=t[1],u=o-r,c=a-i;if(0!==u||0!==c){var f=((s-r)*u+(l-i)*c)/(u*u+c*c);f>1?(r=o,i=a):f>0&&(r+=u*f,i+=c*f)}return u=s-r,c=l-i,u*u+c*c}e.exports=r},{}],149:[function(t,e,n){"use strict";function r(t,e,n,r,o,a){for(var s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:r,z2:e,transformed:!1,min:[2,1],max:[-1,0]},l=0;ls.max[0]&&(s.max[0]=c[0]),c[1]>s.max[1]&&(s.max[1]=c[1])}return s}function i(t,e,n,r){var i,a,s,l,u=e.geometry,c=e.type,f=[],h=n*n;if(1===c)for(i=0;ih)&&(d.push(l),t.numSimplified++),t.numPoints++;3===c&&o(d,s.outer),f.push(d)}else t.numPoints+=s.length;if(f.length){var p={geometry:f,type:c,tags:e.tags||null};null!==e.id&&(p.id=e.id),t.features.push(p)}}function o(t,e){var n=a(t);0>n===e&&t.reverse()}function a(t){for(var e,n,r=0,i=0,o=t.length,a=o-1;o>i;a=i++)e=t[i],n=t[a],r+=(n[0]-e[0])*(e[1]+n[1]);return r}e.exports=r},{}],150:[function(t,e,n){"use strict";function r(t,e){if(t.transformed)return t;var n,r,o,a=t.z2,s=t.x,l=t.y;for(n=0;n0?(r=2*Math.sqrt(n+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t},i.fromRotationTranslationScale=function(t,e,n,r){var i=e[0],o=e[1],a=e[2],s=e[3],l=i+i,u=o+o,c=a+a,f=i*l,h=i*u,d=i*c,p=o*u,m=o*c,g=a*c,y=s*l,v=s*u,x=s*c,b=r[0],_=r[1],w=r[2];return t[0]=(1-(p+g))*b,t[1]=(h+x)*b,t[2]=(d-v)*b,t[3]=0,t[4]=(h-x)*_,t[5]=(1-(f+g))*_,t[6]=(m+y)*_,t[7]=0,t[8]=(d+v)*w,t[9]=(m-y)*w,t[10]=(1-(f+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,n,r,i){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,f=s+s,h=o*u,d=o*c,p=o*f,m=a*c,g=a*f,y=s*f,v=l*u,x=l*c,b=l*f,_=r[0],w=r[1],M=r[2],k=i[0],A=i[1],S=i[2];return t[0]=(1-(m+y))*_,t[1]=(d+b)*_,t[2]=(p-x)*_,t[3]=0,t[4]=(d-b)*w,t[5]=(1-(h+y))*w,t[6]=(g+v)*w,t[7]=0,t[8]=(p+x)*M,t[9]=(g-v)*M,t[10]=(1-(h+m))*M,t[11]=0,t[12]=n[0]+k-(t[0]*k+t[4]*A+t[8]*S),t[13]=n[1]+A-(t[1]*k+t[5]*A+t[9]*S),t[14]=n[2]+S-(t[2]*k+t[6]*A+t[10]*S),t[15]=1,t},i.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,s=r+r,l=i+i,u=n*a,c=r*a,f=r*s,h=i*a,d=i*s,p=i*l,m=o*a,g=o*s,y=o*l;return t[0]=1-f-p,t[1]=c+y,t[2]=h-g,t[3]=0,t[4]=c-y,t[5]=1-u-p,t[6]=d+m,t[7]=0,t[8]=h+g,t[9]=d-m,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,n,r,i,o,a){var s=1/(n-e),l=1/(i-r),u=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*l,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t},i.perspective=function(t,e,n,r,i){var o=1/Math.tan(e/2),a=1/(r-i);return t[0]=o/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+r)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*r*a,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((a-s)*l*.5),t[9]=(i-o)*u*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},i.ortho=function(t,e,n,r,i,o,a){var s=1/(e-n),l=1/(r-i),u=1/(o-a);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*u,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*l,t[14]=(a+o)*u,t[15]=1,t},i.lookAt=function(t,e,n,o){var a,s,l,u,c,f,h,d,p,m,g=e[0],y=e[1],v=e[2],x=o[0],b=o[1],_=o[2],w=n[0],M=n[1],k=n[2];return Math.abs(g-w)l?(o.cross(t,e,i),o.length(t)<1e-6&&o.cross(t,n,i),o.normalize(t,t),s.setAxisAngle(r,t,Math.PI),r):l>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(o.cross(t,i,a),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+l,s.normalize(r,r))}}(),s.setAxes=function(){var t=i.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=a.clone,s.fromValues=a.fromValues,s.copy=a.copy,s.set=a.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,n){n=.5*n;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t},s.getAxisAngle=function(t,e){var n=2*Math.acos(e[3]),r=Math.sin(n/2);return 0!=r?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n},s.add=a.add,s.multiply=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=n[0],l=n[1],u=n[2],c=n[3];return t[0]=r*c+a*s+i*u-o*l,t[1]=i*c+a*l+o*s-r*u,t[2]=o*c+a*u+r*l-i*s,t[3]=a*c-r*s-i*l-o*u,t},s.mul=s.multiply,s.scale=a.scale,s.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l+a*s,t[1]=i*l+o*s,t[2]=o*l-i*s,t[3]=a*l-r*s,t},s.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l-o*s,t[1]=i*l+a*s,t[2]=o*l+r*s,t[3]=a*l-i*s,t},s.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l+i*s,t[1]=i*l-r*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t},s.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},s.dot=a.dot,s.lerp=a.lerp,s.slerp=function(t,e,n,r){var i,o,a,s,l,u=e[0],c=e[1],f=e[2],h=e[3],d=n[0],p=n[1],m=n[2],g=n[3];return o=u*d+c*p+f*m+h*g,0>o&&(o=-o,d=-d,p=-p,m=-m,g=-g),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-r)*i)/a,l=Math.sin(r*i)/a):(s=1-r,l=r),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*m,t[3]=s*h+l*g,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(n,r,i,o,a,l){return s.slerp(t,r,a,l),s.slerp(e,i,o,l),s.slerp(n,t,e,2*l*(1-l)),n}}(),s.invert=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o,s=a?1/a:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-i*s,t[3]=o*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=a.length,s.len=s.length,s.squaredLength=a.squaredLength,s.sqrLen=s.squaredLength,s.normalize=a.normalize,s.fromMat3=function(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*a+a]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*o+a]-e[3*a+o])*n,t[o]=(e[3*o+i]+e[3*i+o])*n,t[a]=(e[3*a+i]+e[3*i+a])*n}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=a.exactEquals,s.equals=a.equals,e.exports=s},{"./common.js":153,"./mat3.js":156,"./vec3.js":160,"./vec4.js":161}],159:[function(t,e,n){var r=t("./common.js"),i={};i.create=function(){var t=new r.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,n){return t[0]=e,t[1]=n,t},i.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},i.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},i.sub=i.subtract,i.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t},i.mul=i.multiply,i.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},i.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},i.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},i.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)},i.dist=i.distance,i.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},i.len=i.length,i.squaredLength=function(t){var e=t[0],n=t[1];return e*e+n*n},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},i.lerp=function(t,e,n,r){var i=e[0],o=e[1];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t},i.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},i.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},i.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},i.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,o,a){var s,l;for(n||(n=2),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;l>s;s+=n)t[0]=e[s],t[1]=e[s+1],o(t,t,a),e[s]=t[0],e[s+1]=t[1];return e}}(),i.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},i.equals=function(t,e){var n=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))},e.exports=i},{"./common.js":153}],160:[function(t,e,n){var r=t("./common.js"),i={};i.create=function(){var t=new r.ARRAY_TYPE(3);return t[0]=0,t[1]=0,t[2]=0,t},i.clone=function(t){var e=new r.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},i.fromValues=function(t,e,n){var i=new r.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=n,i},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},i.set=function(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t},i.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t},i.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t},i.sub=i.subtract,i.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t},i.mul=i.multiply,i.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},i.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t},i.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},i.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t},i.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t},i.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)},i.dist=i.distance,i.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},i.normalize=function(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],l=n[2];return t[0]=i*l-o*s,t[1]=o*a-r*l,t[2]=r*s-i*a,t},i.lerp=function(t,e,n,r){var i=e[0],o=e[1],a=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t},i.hermite=function(t,e,n,r,i,o){var a=o*o,s=a*(2*o-3)+1,l=a*(o-2)+o,u=a*(o-1),c=a*(3-2*o);return t[0]=e[0]*s+n[0]*l+r[0]*u+i[0]*c,t[1]=e[1]*s+n[1]*l+r[1]*u+i[1]*c,t[2]=e[2]*s+n[2]*l+r[2]*u+i[2]*c,t},i.bezier=function(t,e,n,r,i,o){var a=1-o,s=a*a,l=o*o,u=s*a,c=3*o*s,f=3*l*a,h=l*o;return t[0]=e[0]*u+n[0]*c+r[0]*f+i[0]*h,t[1]=e[1]*u+n[1]*c+r[1]*f+i[1]*h,t[2]=e[2]*u+n[2]*c+r[2]*f+i[2]*h,t},i.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI,i=2*r.RANDOM()-1,o=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*o,t[1]=Math.sin(n)*o,t[2]=i*e,t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/a,t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t},i.transformMat3=function(t,e,n){var r=e[0],i=e[1],o=e[2];return t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8],t},i.transformQuat=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],l=n[2],u=n[3],c=u*r+s*o-l*i,f=u*i+l*r-a*o,h=u*o+a*i-s*r,d=-a*r-s*i-l*o;return t[0]=c*u+d*-a+f*-l-h*-s,t[1]=f*u+d*-s+h*-a-c*-l,t[2]=h*u+d*-l+c*-s-f*-a,t},i.rotateX=function(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0],o[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),o[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},i.rotateY=function(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),o[1]=i[1],o[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},i.rotateZ=function(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),o[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),o[2]=i[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,o,a){var s,l;for(n||(n=3),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;l>s;s+=n)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}}(),i.angle=function(t,e){var n=i.fromValues(t[0],t[1],t[2]),r=i.fromValues(e[0],e[1],e[2]);i.normalize(n,n),i.normalize(r,r);var o=i.dot(n,r);return o>1?0:Math.acos(o)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var n=t[0],i=t[1],o=t[2],a=e[0],s=e[1],l=e[2];return Math.abs(n-a)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-s)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(o-l)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(l))},e.exports=i},{"./common.js":153}],161:[function(t,e,n){var r=t("./common.js"),i={};i.create=function(){var t=new r.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,n,i){var o=new r.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=n,o[3]=i,o},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},i.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},i.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t},i.sub=i.subtract,i.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},i.mul=i.multiply,i.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},i.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},i.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t},i.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+o*o)},i.dist=i.distance,i.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return n*n+r*r+i*i+o*o},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,n,r){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t[3]=s+r*(n[3]-s),t},i.random=function(t,e){return e=e||1,t[0]=r.RANDOM(),t[1]=r.RANDOM(),t[2]=r.RANDOM(),t[3]=r.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,t},i.transformQuat=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],l=n[2],u=n[3],c=u*r+s*o-l*i,f=u*i+l*r-a*o,h=u*o+a*i-s*r,d=-a*r-s*i-l*o;return t[0]=c*u+d*-a+f*-l-h*-s,t[1]=f*u+d*-s+h*-a-c*-l,t[2]=h*u+d*-l+c*-s-f*-a,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,o,a){var s,l;for(n||(n=4),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;l>s;s+=n)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}(),i.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var n=t[0],i=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=e[3];return Math.abs(n-s)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-c)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))},e.exports=i},{"./common.js":153}],162:[function(t,e,n){"use strict";function r(t,e,n){var r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],e=o[1],n=o[2],this.d=e+2*n;for(var a=0;a=t&&i>=e&&n>=o&&r>=o)return Array.prototype.slice.call(this.keys);var a=[],s={};return this._forEachCell(t,e,n,r,this._queryCell,a,s),a},r.prototype._queryCell=function(t,e,n,r,i,o,a){var s=this.cells[i];if(null!==s)for(var l=this.keys,u=this.bboxes,c=0;c=u[h+0]&&r>=u[h+1]?(a[f]=!0,o.push(l[f])):a[f]=!1}}},r.prototype._forEachCell=function(t,e,n,r,i,o,a){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(n),c=this._convertToCellCoord(r),f=s;u>=f;f++)for(var h=l;c>=h;h++){var d=this.d*h+f;if(i.call(this,t,e,n,r,d,o,a))return}},r.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},r.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,n=0,r=0;r=t.stops.length)break;if(e<=t.stops[r][0])break;r++}return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:s(e,n,t.stops[r-1][0],t.stops[r][0],t.stops[r-1][1],t.stops[r][1])}function s(t,e,n,r,i,o){return"function"==typeof i?function(){var a=i.apply(void 0,arguments),l=o.apply(void 0,arguments);return s(t,e,n,r,a,l)}:i.length?u(t,e,n,r,i,o):l(t,e,n,r,i,o)}function l(t,e,n,r,i,o){var a,s=r-n,l=t-n;return a=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-a)+o*a}function u(t,e,n,r,i,o){for(var a=[],s=0;s -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},collisionbox:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}},e.exports.util="float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"; +},{path:8}],165:[function(t,e,n){"use strict";function r(t,e){this.message=(t?t+": ":"")+i.apply(i,Array.prototype.slice.call(arguments,2)),null!==e&&void 0!==e&&e.__line__&&(this.line=e.__line__)}var i=t("util").format;e.exports=r},{util:17}],166:[function(t,e,n){"use strict";e.exports=function(t){for(var e=1;e7)return[new r(c,l,"constants have been deprecated as of v8")];if(!(l in h.constants))return[new r(c,l,'constant "%s" not found',l)];e=o({},e,{value:h.constants[l]})}return u.function&&"object"===i(l)?n(e):u.type&&s[u.type]?s[u.type](e):a(o({},e,{valueSpec:u.type?f[u.type]:u}))}},{"../error/validation_error":165,"../util/extend":166,"../util/get_type":167,"./validate_array":170,"./validate_boolean":171,"./validate_color":172,"./validate_constants":173,"./validate_enum":174,"./validate_filter":175,"./validate_function":176,"./validate_layer":178,"./validate_number":180,"./validate_object":181,"./validate_source":183,"./validate_string":184}],170:[function(t,e,n){"use strict";var r=t("../util/get_type"),i=t("./validate"),o=t("../error/validation_error");e.exports=function(t){var e=t.value,n=t.valueSpec,a=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==r(e))return[new o(l,e,"array expected, %s found",r(e))];if(n.length&&e.length!==n.length)return[new o(l,e,"array length %d expected, length %d found",n.length,e.length)];if(n["min-length"]&&e.length7)return n?[new r(e,n,"constants have been deprecated as of v8")]:[];var a=i(n);if("object"!==a)return[new r(e,n,"object expected, %s found",a)];var s=[];for(var l in n)"@"!==l[0]&&s.push(new r(e+"."+l,n[l],'constants must start with "@"'));return s}},{"../error/validation_error":165,"../util/get_type":167}],174:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,n=t.value,o=t.valueSpec,a=[];return-1===o.values.indexOf(i(n))&&a.push(new r(e,n,"expected one of [%s], %s found",o.values.join(", "),n)),a}},{"../error/validation_error":165,"../util/unbundle_jsonlint":168}],175:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("./validate_enum"),o=t("../util/get_type"),a=t("../util/unbundle_jsonlint");e.exports=function s(t){var e,n=t.value,l=t.key,u=t.styleSpec,c=[];if("array"!==o(n))return[new r(l,n,"array expected, %s found",o(n))];if(n.length<1)return[new r(l,n,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:n[0],valueSpec:u.filter_operator,style:t.style,styleSpec:t.styleSpec})),a(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"==n[1]&&c.push(new r(l,n,'"$type" cannot be use with operator "%s"',n[0]));case"==":case"!=":3!=n.length&&c.push(new r(l,n,'filter array for operator "%s" must have 3 elements',n[0]));case"in":case"!in":n.length>=2&&(e=o(n[1]),"string"!==e?c.push(new r(l+"[1]",n[1],"string expected, %s found",e)):"@"===n[1][0]&&c.push(new r(l+"[1]",n[1],"filter key cannot be a constant")));for(var f=2;f=8&&(h&&!t.valueSpec["property-function"]?p.push(new r(t.key,t.value,"property functions not supported")):d&&!t.valueSpec["zoom-function"]&&p.push(new r(t.key,t.value,"zoom functions not supported"))),p}},{"../error/validation_error":165,"../util/get_type":167,"./validate":169,"./validate_array":170,"./validate_number":180,"./validate_object":181}],177:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("./validate_string");e.exports=function(t){var e=t.value,n=t.key,o=i(t);return o.length?o:(-1===e.indexOf("{fontstack}")&&o.push(new r(n,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&o.push(new r(n,e,'"glyphs" url must include a "{range}" token')),o)}},{"../error/validation_error":165,"./validate_string":184}],178:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),o=t("./validate_object"),a=t("./validate_filter"),s=t("./validate_paint_property"),l=t("./validate_layout_property"),u=t("../util/extend");e.exports=function(t){var e=[],n=t.value,c=t.key,f=t.style,h=t.styleSpec;n.type||n.ref||e.push(new r(c,n,'either "type" or "ref" is required'));var d=i(n.type),p=i(n.ref);if(n.id)for(var m=0;mo.maximum?[new i(e,n,"%s is greater than the maximum value %s",n,o.maximum)]:[]}},{"../error/validation_error":165,"../util/get_type":167}],181:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("../util/get_type"),o=t("./validate");e.exports=function(t){var e=t.key,n=t.value,a=t.valueSpec,s=t.objectElementValidators||{},l=t.style,u=t.styleSpec,c=[],f=i(n);if("object"!==f)return[new r(e,n,"object expected, %s found",f)];for(var h in n){var d=h.split(".")[0],p=a&&(a[d]||a["*"]),m=s[d]||s["*"];p||m?c=c.concat((m||o)({key:(e?e+".":e)+h,value:n[h],valueSpec:p,style:l,styleSpec:u,object:n,objectKey:h})):""!==e&&1!==e.split(".").length&&c.push(new r(e,n[h],'unknown property "%s"',h))}for(d in a)a[d].required&&void 0===a[d].default&&void 0===n[d]&&c.push(new r(e,n,'missing required property "%s"',d));return c}},{"../error/validation_error":165,"../util/get_type":167,"./validate":169}],182:[function(t,e,n){"use strict";var r=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,n=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["paint_"+t.layerType],u=s.match(/^(.*)-transition$/);return u&&l[u[1]]&&l[u[1]].transition?r({key:e,value:a,valueSpec:o.transition,style:n,styleSpec:o}):t.valueSpec||l[s]?r({key:t.key,value:a,valueSpec:t.valueSpec||l[s],style:n,styleSpec:o}):[new i(e,a,'unknown property "%s"',s)]}},{"../error/validation_error":165,"./validate":169}],183:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),o=t("./validate_object"),a=t("./validate_enum");e.exports=function(t){var e=t.value,n=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new r(n,e,'"type" is required')];var u=i(e.type);switch(u){case"vector":case"raster":var c=[];if(c=c.concat(o({key:n,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var f in e)["type","url","tileSize"].indexOf(f)<0&&c.push(new r(n+"."+f,e[f],'a source with a "url" property may not include a "%s" property',f));return c;case"geojson":return o({key:n,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return o({key:n,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return o({key:n,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return a({key:n+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":165,"../util/unbundle_jsonlint":168,"./validate_enum":174,"./validate_object":181}],184:[function(t,e,n){"use strict";var r=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,n=t.key,o=r(e);return"string"!==o?[new i(n,e,"string expected, %s found",o)]:[]}},{"../error/validation_error":165,"../util/get_type":167}],185:[function(t,e,n){"use strict";function r(t,e){e=e||l;var n=[];return n=n.concat(s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:u}})),e.$version>7&&t.constants&&(n=n.concat(a({key:"constants",value:t.constants,style:t,styleSpec:e}))),i(n)}function i(t){return[].concat(t).sort(function(t,e){return t.line-e.line})}function o(t){return function(){return i(t.apply(this,arguments))}}var a=t("./validate/validate_constants"),s=t("./validate/validate"),l=t("../reference/latest.min"),u=t("./validate/validate_glyphs_url");r.source=o(t("./validate/validate_source")),r.layer=o(t("./validate/validate_layer")),r.filter=o(t("./validate/validate_filter")),r.paintProperty=o(t("./validate/validate_paint_property")),r.layoutProperty=o(t("./validate/validate_layout_property")),e.exports=r},{"../reference/latest.min":187,"./validate/validate":169,"./validate/validate_constants":173,"./validate/validate_filter":175,"./validate/validate_glyphs_url":177,"./validate/validate_layer":178,"./validate/validate_layout_property":179,"./validate/validate_paint_property":182,"./validate/validate_source":183}],186:[function(t,e,n){e.exports=t("./v8.json")},{"./v8.json":188}],187:[function(t,e,n){e.exports=t("./v8.min.json")},{"./v8.min.json":189}],188:[function(t,e,n){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8],doc:"Style specification version number. Must be 8.",example:8},name:{type:"string",doc:"A human-readable name for the style.",example:"Bright"},metadata:{type:"*",doc:"Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},center:{type:"array",value:"number",doc:"Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:[-73.9749,40.7736]},zoom:{type:"number",doc:"Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:12.5},bearing:{type:"number","default":0,period:360,units:"degrees",doc:"Default bearing, in degrees. The style bearing will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:29},pitch:{type:"number","default":0,units:"degrees",doc:"Default pitch, in degrees. Zero is perpendicular to the surface. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:50},sources:{required:!0,type:"sources",doc:"Data source specifications.",example:{"mapbox-streets":{type:"vector",url:"mapbox://mapbox.mapbox-streets-v6"}}},sprite:{type:"string",doc:"A base URL for retrieving the sprite image and metadata. The extensions `.png`, `.json` and scale factor `@2x.png` will be automatically appended. This property is required if any layer uses the 'sprite-image' layout property.",example:"mapbox://sprites/mapbox/bright-v8"},glyphs:{type:"string",doc:"A URL template for loading signed-distance-field glyph sets in PBF format. The URL must include `{fontstack}` and `{range}` tokens. This property is required if any layer uses the 'text-field' layout property.",example:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},transition:{type:"transition",doc:"A global transition definition to use as a default across properties.",example:{duration:300,delay:0}},layers:{required:!0,type:"array",value:"layer",doc:"Layers will be drawn in the order of this array.",example:[{id:"water",source:"mapbox-streets","source-layer":"water",type:"fill",paint:{"fill-color":"#00ffff"}}]}},sources:{"*":{type:"source",doc:"Specification of a data source. For vector and raster sources, either TileJSON or a URL to a TileJSON must be provided. For GeoJSON and video sources, a URL must be provided."}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"],doc:"The data type of the tile source."},url:{type:"string",doc:"A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://`."},tiles:{type:"array",value:"string",doc:"An array of one or more tile source URLs, as in the TileJSON spec."},minzoom:{type:"number","default":0,doc:"Minimum zoom level for which tiles are available, as in the TileJSON spec."},maxzoom:{type:"number","default":22,doc:"Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."},tileSize:{type:"number","default":512,units:"pixels",doc:"The minimum visual size to display tiles for this layer. Only configurable for raster layers."},"*":{type:"*",doc:"Other keys to configure the data source."}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"],doc:"The data type of the GeoJSON source."},data:{type:"*",doc:"A URL to a GeoJSON file, or inline GeoJSON."},maxzoom:{type:"number","default":14,doc:"Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."},buffer:{type:"number","default":64,doc:"Tile buffer size on each side (higher means fewer rendering artifacts near tile edges but slower performance)."},tolerance:{type:"number","default":3,doc:"Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance)."},cluster:{type:"boolean","default":!1,doc:"If the data is a collection of point features, setting this to true clusters the points by radius into groups."},clusterRadius:{type:"number","default":400,doc:"Radius of each cluster when clustering points, relative to 4096 tile."},clusterMaxZoom:{type:"number",doc:"Max zoom to cluster points on. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered)."}},source_video:{type:{required:!0,type:"enum",values:["video"],doc:"The data type of the video source."},urls:{required:!0,type:"array",value:"string",doc:"URLs to video content in order of preferred format."},coordinates:{required:!0,doc:"Corners of video specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},source_image:{type:{required:!0,type:"enum",values:["image"],doc:"The data type of the image source."},url:{required:!0,type:"string",doc:"URL that points to an image"},coordinates:{required:!0,doc:"Corners of image specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},layer:{id:{type:"string",doc:"Unique layer name.",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"],doc:"Rendering type of this layer."},metadata:{type:"*",doc:"Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},ref:{type:"string",doc:"References another layer to copy `type`, `source`, `source-layer`, `minzoom`, `maxzoom`, `filter`, and `layout` properties from. This allows the layers to share processing and be more efficient."},source:{type:"string",doc:"Name of a source description to be used for this layer."},"source-layer":{type:"string",doc:"Layer to use from a vector tile source. Required if the source supports multiple layers."},minzoom:{type:"number",minimum:0,maximum:22,doc:"The minimum zoom level on which the layer gets parsed and appears on."},maxzoom:{type:"number",minimum:0,maximum:22,doc:"The maximum zoom level on which the layer gets parsed and appears on."},interactive:{type:"boolean",doc:"Enable querying of feature data from this layer for interactivity.","default":!1},filter:{type:"filter",doc:"A expression specifying conditions on source features. Only features that match the filter are displayed."},layout:{type:"layout",doc:"Layout properties for the layer."},paint:{type:"paint",doc:"Default paint properties for this layer."},"paint.*":{type:"paint",doc:"Class-specific paint properties for this layer. The class name is the part after the first dot."}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["butt","round","square"],"default":"butt",doc:"The display of line endings.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-join":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["bevel","round","miter"],"default":"miter",doc:"The display of lines when joining.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-miter-limit":{type:"number","default":2,"function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Used to automatically convert miter joins to bevel joins for sharp angles.",requires:[{"line-join":"miter"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-round-limit":{type:"number","default":1.05,"function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Used to automatically convert round joins to miter joins for shallow angles.",requires:[{"line-join":"round"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["point","line"],"default":"point",doc:"Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",doc:"Distance between two symbol anchors.",requires:[{"symbol-placement":"line"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, the icon will be visible even if it collides with other previously drawn symbols.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, other symbols can be visible even if they collide with the icon.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-optional":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.",requires:["icon-image","text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"viewport",doc:"Orientation of icon when map is rotated.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Scale factor for icon. 1 is original size, 3 triples the size.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-text-fit":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!1,values:["none","both","width","height"],"default":"none",doc:"Position and scale an icon by the its corresponding text.",requires:["icon-image","text-field"],"sdk-support":{basic:{}}},"icon-text-fit-padding":{type:"array",value:"number",length:4,"default":[0,0,0,0],units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Size of padding area around the text-fit size in clockwise order: top, right, bottom, left.",requires:["icon-image","icon-text-fit","text-field"],"sdk-support":{basic:{}}},"icon-image":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,doc:"A string with {tokens} replaced, referencing the data property to pull from.",tokens:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"degrees",doc:"Rotates the icon clockwise.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",doc:"Size of the additional area around the icon bounding box used for detecting symbol collisions.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, the icon may be flipped to prevent it from being rendered upside-down.",requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-pitch-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Aligns text to the plane of the `viewport` or the `map` when the map is pitched. Matches `text-rotation-alignment` if unspecified.",requires:["text-field"],"sdk-support":{basic:{}}},"text-rotation-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"viewport",doc:"Orientation of text when map is rotated.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-field":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":"",tokens:!0,doc:"Value to use for a text label. Feature properties are specified using tokens like {field_name}.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-font":{type:"array",value:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":["Open Sans Regular","Arial Unicode MS Regular"],doc:"Font stack to use for displaying text.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Font size.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"The maximum line width for text wrapping.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Text leading value for multi-line text.", +requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Text tracking amount.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-justify":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["left","center","right"],"default":"center",doc:"Text justification options.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",doc:"Part of the text placed closest to the anchor.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Maximum angle change between adjacent characters.",requires:["text-field",{"symbol-placement":"line"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Rotates the text clockwise.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Size of the additional area around the text bounding box used for detecting symbol collisions.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-keep-upright":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!0,doc:"If true, the text may be flipped vertically to prevent it from being rendered upside-down.",requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-transform":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["none","uppercase","lowercase"],"default":"none",doc:"Specifies how to capitalize text, similar to the CSS `text-transform` property.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-offset":{type:"array",doc:"Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.",value:"number",units:"ems","function":"interpolated","zoom-function":!0,"property-function":!0,length:2,"default":[0,0],requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, the text will be visible even if it collides with other previously drawn symbols.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, other symbols can be visible even if they collide with the text.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-optional":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.",requires:["text-field","icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},filter:{type:"array",value:"*",doc:"A filter selects specific features from a layer."},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"],doc:"The filter operator."},geometry_type:{type:"enum",values:["Point","LineString","Polygon"],doc:"The geometry type for the filter to select."},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"],doc:"A color operation to apply."},"function":{stops:{type:"array",required:!0,doc:"An array of stops.",value:"function_stop"},base:{type:"number","default":1,minimum:0,doc:"The exponential base of the interpolation curve. It controls the rate at which the result increases. Higher values make the result increase more towards the high end of the range. With `1` the stops are interpolated linearly."},property:{type:"string",doc:"The name of a global property or feature property to use as the function input.","default":"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],doc:"The interpolation strategy to use in function evaluation.","default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2,doc:"Zoom level and value pair."},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!0,doc:"Whether or not the fill should be antialiased.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"fill-opacity":{type:"number","function":"interpolated","zoom-function":!0,"property-function":!0,"default":1,minimum:0,maximum:1,doc:"The opacity of the entire fill layer. In contrast to the fill-color, this value will also affect the 1px stroke around the fill, if the stroke is used.",transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"fill-color":{type:"color","default":"#000000",doc:"The color of the filled part of this layer. This color can be specified as rgba with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.19.0"}}},"fill-outline-color":{type:"color",doc:"The outline color of the fill. Matches the value of `fill-color` if unspecified.","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.19.0"}}},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"fill-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["fill-translate"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"fill-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0,doc:"Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},paint_line:{"line-opacity":{type:"number",doc:"The opacity at which the line will be drawn.","function":"interpolated","zoom-function":!0,"property-function":!0,"default":1,minimum:0,maximum:1,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-color":{type:"color",doc:"The color with which the line will be drawn.","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"line-pattern"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["line-translate"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Stroke thickness.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-gap-width":{type:"number","default":0,minimum:0,doc:"Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-offset":{type:"number","default":0,doc:'The line\'s offset perpendicular to its direction. Values may be positive or negative, where positive indicates "rightwards" (if you were moving in the direction of the line) and negative indicates "leftwards."',"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels","sdk-support":{basic:{js:"0.12.1",ios:"3.1.0",android:"3.0.0"}}},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Blur applied to the line, in pixels.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant","zoom-function":!0,"property-function":!0,doc:"Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0,doc:"Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Circle radius.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.18.0"}}},"circle-color":{type:"color","default":"#000000",doc:"The color of the circle.","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.18.0"}}},"circle-blur":{type:"number","default":0,doc:"Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.20.0"}}},"circle-opacity":{type:"number",doc:"The opacity at which the circle will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.20.0"}}},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"circle-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["circle-translate"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"circle-pitch-scale":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",doc:"Controls the scaling behavior of the circle when the map is pitched. The value `map` scales circles according to their apparent distance to the camera. The value `viewport` results in no pitch-related scaling.","sdk-support":{basic:{}}}},paint_symbol:{"icon-opacity":{doc:"The opacity at which the icon will be drawn.",type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,doc:"The color of the icon. This can only be used with sdf icons.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,doc:"The color of the icon's halo. Icon halos can only be used with sdf icons.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Distance of halo to the icon outline.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Fade out the halo towards the outside.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["icon-image","icon-translate"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-opacity":{type:"number",doc:"The opacity at which the text will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-color":{type:"color",doc:"The color with which the text will be drawn.","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,doc:"The color of the text's halo, which helps it stand out from backgrounds.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"The halo's fadeout distance towards the outside.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["text-field","text-translate"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},paint_raster:{"raster-opacity":{type:"number",doc:"The opacity at which the image will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated","zoom-function":!0,transition:!0,units:"degrees",doc:"Rotates hues around the color wheel.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-brightness-min":{type:"number","function":"interpolated","zoom-function":!0,doc:"Increase or reduce the brightness of the image. The value is the minimum brightness.","default":0,minimum:0,maximum:1,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-brightness-max":{type:"number","function":"interpolated","zoom-function":!0,doc:"Increase or reduce the brightness of the image. The value is the maximum brightness.","default":1,minimum:0,maximum:1,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-saturation":{type:"number",doc:"Increase or reduce the saturation of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-contrast":{type:"number",doc:"Increase or reduce the contrast of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated","zoom-function":!0,transition:!0,units:"milliseconds",doc:"Fade duration when a new tile is added.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},paint_background:{"background-color":{type:"color","default":"#000000",doc:"The color with which the background will be drawn.","function":"interpolated","zoom-function":!0,transition:!0,requires:[{"!":"background-pattern"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"background-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,transition:!0,doc:"Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,doc:"The opacity at which the background will be drawn.","function":"interpolated","zoom-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds",doc:"Time allotted for transitions to complete."},delay:{type:"number","default":0,minimum:0,units:"milliseconds",doc:"Length of time before a transition begins."}}}},{}],189:[function(t,e,n){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number","default":0,period:360,units:"degrees"},pitch:{type:"number","default":0,units:"degrees"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number","default":0},maxzoom:{type:"number","default":22},tileSize:{type:"number","default":512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number","default":14},buffer:{type:"number","default":64},tolerance:{type:"number","default":3},cluster:{type:"boolean","default":!1},clusterRadius:{type:"number","default":400},clusterMaxZoom:{type:"number"}},source_video:{type:{required:!0,type:"enum",values:["video"]},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:["image"]},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean","default":!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["butt","round","square"],"default":"butt"},"line-join":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["bevel","round","miter"],"default":"miter"},"line-miter-limit":{type:"number","default":2,"function":"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number","default":1.05,"function":"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"round"}]},visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["point","line"],"default":"point"},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["icon-image"]},"icon-optional":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"viewport",requires:["icon-image"]},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"icon-text-fit":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!1,values:["none","both","width","height"],"default":"none",requires:["icon-image","text-field"]},"icon-text-fit-padding":{type:"array",value:"number",length:4,"default":[0,0,0,0],units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image","icon-text-fit","text-field"]},"icon-image":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,tokens:!0},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"text-pitch-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],requires:["text-field"]},"text-rotation-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"viewport",requires:["text-field"]},"text-field":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":"",tokens:!0},"text-font":{type:"array",value:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-justify":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["left","center","right"],"default":"center",requires:["text-field"]},"text-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",requires:["text-field"]},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-keep-upright":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["none","uppercase","lowercase"],"default":"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems","function":"interpolated","zoom-function":!0,"property-function":!0,length:2,"default":[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["text-field"]},"text-optional":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["text-field","icon-image"]},visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},geometry_type:{type:"enum",values:["Point","LineString","Polygon"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},"function":{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number","default":1,minimum:0},property:{type:"string","default":"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],"default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!0},"fill-opacity":{type:"number","function":"interpolated","zoom-function":!0,"property-function":!0,"default":1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",requires:["fill-translate"]},"fill-pattern":{type:"string","function":"piecewise-constant", +"zoom-function":!0,"property-function":!0,transition:!0}},paint_line:{"line-opacity":{type:"number","function":"interpolated","zoom-function":!0,"property-function":!0,"default":1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",requires:["line-translate"]},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-gap-width":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-offset":{type:"number","default":0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant","zoom-function":!0,"property-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-blur":{type:"number","default":0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map"}},paint_symbol:{"icon-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated","zoom-function":!0,transition:!0,units:"degrees"},"raster-brightness-min":{type:"number","function":"interpolated","zoom-function":!0,"default":0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number","function":"interpolated","zoom-function":!0,"default":1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0},"raster-contrast":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated","zoom-function":!0,transition:!0,units:"milliseconds"}},paint_background:{"background-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,transition:!0},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds"},delay:{type:"number","default":0,minimum:0,units:"milliseconds"}}}},{}],190:[function(t,e,n){"use strict";function r(t){return!!(i()&&o()&&a()&&s()&&l()&&u()&&c()&&f(t&&t.failIfMajorPerformanceCaveat))}function i(){return"undefined"!=typeof window&&"undefined"!=typeof document}function o(){return Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray}function a(){return Function.prototype&&Function.prototype.bind}function s(){return Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions}function l(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function u(){return"Worker"in window}function c(){return"Uint8ClampedArray"in window}function f(t){return void 0===d[t]&&(d[t]=h(t)),d[t]}function h(t){var e=document.createElement("canvas"),n=Object.create(r.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,e.probablySupportsContext?e.probablySupportsContext("webgl",n)||e.probablySupportsContext("experimental-webgl",n):e.supportsContext?e.supportsContext("webgl",n)||e.supportsContext("experimental-webgl",n):e.getContext("webgl",n)||e.getContext("experimental-webgl",n)}"undefined"!=typeof e&&e.exports?e.exports=r:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=r);var d={};r.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],191:[function(t,e,n){"use strict";function r(t){var e;t&&t.length&&(e=t,t=e.length);var n=new Uint8Array(t||0);return e&&n.set(e),n.readUInt32LE=o.readUInt32LE,n.writeUInt32LE=o.writeUInt32LE,n.readInt32LE=o.readInt32LE,n.writeInt32LE=o.writeInt32LE,n.readFloatLE=o.readFloatLE,n.writeFloatLE=o.writeFloatLE,n.readDoubleLE=o.readDoubleLE,n.writeDoubleLE=o.writeDoubleLE,n.toString=o.toString,n.write=o.write,n.slice=o.slice,n.copy=o.copy,n._isBuffer=!0,n}function i(t){for(var e,n,r=t.length,i=[],o=0;r>o;o++){if(e=t.charCodeAt(o),e>55295&&57344>e){if(!n){e>56319||o+1===r?i.push(239,191,189):n=e;continue}if(56320>e){i.push(239,191,189),n=e;continue}e=n-55296<<10|e-56320|65536,n=null}else n&&(i.push(239,191,189),n=null);128>e?i.push(e):2048>e?i.push(e>>6|192,63&e|128):65536>e?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=r;var o,a,s,l=t("ieee754");o={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,n){var r="",i="";e=e||0,n=Math.min(this.length,n||this.length);for(var o=e;n>o;o++){var a=this[o];127>=a?(r+=decodeURIComponent(i)+String.fromCharCode(a),i=""):i+="%"+a.toString(16)}return r+=decodeURIComponent(i)},write:function(t,e){for(var n=t===a?s:i(t),r=0;rn)return t;if(n=r[e.pos++],t+=34359738368*(127&n),128>n)return t;if(n=r[e.pos++],t+=4398046511104*(127&n),128>n)return t;if(n=r[e.pos++],t+=562949953421312*(127&n),128>n)return t;if(n=r[e.pos++],t+=72057594037927940*(127&n),128>n)return t;if(n=r[e.pos++],t+=0x8000000000000000*(127&n),128>n)return t;throw new Error("Expected varint not more than 10 bytes")}function o(t,e){e.realloc(10);for(var n=e.pos+10;t>=1;){if(e.pos>=n)throw new Error("Given varint doesn't fit into 10 bytes");var r=255&t;e.buf[e.pos++]=r|(t>=128?128:0),t/=128}}function a(t,e,n){var r=16383>=e?1:2097151>=e?2:268435455>=e?3:Math.ceil(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function s(t,e){for(var n=0;n>3,o=this.pos;t(i,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*y;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*y;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,n=this.buf;return e=n[this.pos++],t=127&e,128>e?t:(e=n[this.pos++],t|=(127&e)<<7,128>e?t:(e=n[this.pos++],t|=(127&e)<<14,128>e?t:(e=n[this.pos++],t|=(127&e)<<21,128>e?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(x>e)return e;for(var n=this.pos-2;255===this.buf[n];)n--;t>n&&(n=t),e=0;for(var r=0;n-t+1>r;r++){var i=127&~this.buf[t+r];e+=4>r?i<<7*r:i*Math.pow(2,7*r)}return-e-1},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.buf.toString("utf8",this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.slice(this.pos,t);return this.pos=t,e},readPackedVarint:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos127;);else if(e===r.Bytes)this.pos=this.readVarint()+this.pos;else if(e===r.Fixed32)this.pos+=4;else{if(e!==r.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455?void o(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=t>>>7&127)))))},writeSVarint:function(t){this.writeVarint(0>t?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);var e=g.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;e>n;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var r=this.pos-n;r>=128&&a(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,r.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){this.writeMessage(t,s,e)},writePackedSVarint:function(t,e){this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){this.writeMessage(t,f,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,h,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedFixed64:function(t,e){this.writeMessage(t,p,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,m,e)},writeBytesField:function(t,e){this.writeTag(t,r.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,r.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,r.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,r.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":191}],193:[function(t,e,n){n.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,l=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,d=t[e+f];for(f+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+f],f+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+t[e+f],f+=h,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,r),o-=u}return(d?-1:1)*a*Math.pow(2,o-r)},n.write=function(t,e,n,r,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,m=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),e+=a+f>=1?h/l:h*Math.pow(2,1-f),e*l>=2&&(a++,l/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(e*l-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;t[n+d]=255&a,d+=p,a/=256,u-=8);t[n+d-p]|=128*m}},{}],194:[function(t,e,n){"use strict";function r(t,e){this.x=t,this.y=e}e.exports=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(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)},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,n=t.y-this.y;return e*e+n*n},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[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,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},_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),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t}},{}],195:[function(t,e,n){"use strict";function r(t,e,n,a,s){for(n=n||0,a=a||t.length-1,s=s||o;a>n;){if(a-n>600){var l=a-n+1,u=e-n+1,c=Math.log(l),f=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*f*(l-f)/l)*(0>u-l/2?-1:1),d=Math.max(n,Math.floor(e-u*f/l+h)),p=Math.min(a,Math.floor(e+(l-u)*f/l+h));r(t,e,d,p,s)}var m=t[e],g=n,y=a;for(i(t,n,e),s(t[a],m)>0&&i(t,n,a);y>g;){for(i(t,g,y),g++,y--;s(t[g],m)<0;)g++;for(;s(t[y],m)>0;)y--}0===s(t[n],m)?i(t,n,y):(y++,i(t,y,a)),e>=y&&(n=y+1),y>=e&&(a=y-1)}}function i(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function o(t,e){return e>t?-1:t>e?1:0}e.exports=r},{}],196:[function(e,n,r){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof r?n.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var n=document.getElementsByTagName("head")[0];n.insertBefore(e,n.firstChild);for(var r,i=document.createElement("a"),o=1;t>o;o++)i.href=arguments[o],r=i.href,e.href=r;return n.removeChild(e),r}return t})},{}],197:[function(e,n,r){!function(e,i){"object"==typeof r&&"undefined"!=typeof n?n.exports=i():"function"==typeof t&&t.amd?t(i):e.ShelfPack=i()}(this,function(){function t(t,e,n){n=n||{},this.w=t||64,this.h=e||64,this.autoResize=!!n.autoResize,this.shelves=[],this.stats={},this.count=function(t){this.stats[t]=(0|this.stats[t])+1}}function e(t,e,n){this.x=0,this.y=t,this.w=this.free=e,this.h=n}return t.prototype.pack=function(t,e){t=[].concat(t),e=e||{};for(var n,r,i,o=[],a=0;a0){for(var s=0,l=0,u=0;ur.h||t>r.free||n=c||t>c)&&(f=2*Math.max(t,c)),(c>l||n>l)&&(u=2*Math.max(n,l)),this.resize(f,u),this.packOne(t,n)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var n=0;nthis.free||e>this.h)return null;var n=this.x;return this.x+=t,this.free-=t,{x:n,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t})},{}],198:[function(t,e,n){"use strict";function r(t){return new i(t)}function i(t){this.options=d(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function o(t,e,n,r){return{x:t,y:e,zoom:1/0,id:r,numPoints:n}}function a(t,e){var n=t.geometry.coordinates;return o(u(n[0]),c(n[1]),1,e)}function s(t){return{type:"Feature",properties:l(t),geometry:{type:"Point",coordinates:[f(t.x),h(t.y)]}}}function l(t){var e=t.numPoints,n=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:n}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return 0>n?0:n>1?1:n}function f(t){return 360*(t-.5)}function h(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function d(t,e){for(var n in e)t[n]=e[n];return t}function p(t){return t.x}function m(t){return t.y}var g=t("kdbush");e.exports=r,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var n="prepare "+t.length+" points";e&&console.time(n),this.points=t;var r=t.map(a);e&&console.timeEnd(n);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var o=+Date.now();this.trees[i+1]=g(r,p,m,this.options.nodeSize,Float32Array),r=this._cluster(r,i),e&&console.log("z%d: %d clusters in %dms",i,r.length,+Date.now()-o)}return this.trees[this.options.minZoom]=g(r,p,m,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var n=this.trees[this._limitZoom(e)],r=n.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],o=0;o=h-d)for(var p=d;h>=p;p++)s=e[2*p],l=e[2*p+1],s>=n&&i>=s&&l>=r&&o>=l&&c.push(t[p]);else{var m=Math.floor((d+h)/2);s=e[2*m],l=e[2*m+1],s>=n&&i>=s&&l>=r&&o>=l&&c.push(t[m]);var g=(f+1)%2;(0===f?s>=n:l>=r)&&(u.push(d),u.push(m-1),u.push(g)),(0===f?i>=s:o>=l)&&(u.push(m+1),u.push(h),u.push(g))}}return c}e.exports=r},{}],201:[function(t,e,n){"use strict";function r(t,e,n,o,a,s){if(!(n>=a-o)){var l=Math.floor((o+a)/2);i(t,e,l,o,a,s%2),r(t,e,n,o,l-1,s+1),r(t,e,n,l+1,a,s+1)}}function i(t,e,n,r,a,s){for(;a>r;){if(a-r>600){var l=a-r+1,u=n-r+1,c=Math.log(l),f=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*f*(l-f)/l)*(0>u-l/2?-1:1),d=Math.max(r,Math.floor(n-u*f/l+h)),p=Math.min(a,Math.floor(n+(l-u)*f/l+h));i(t,e,n,d,p,s)}var m=e[2*n+s],g=r,y=a;for(o(t,e,r,n),e[2*a+s]>m&&o(t,e,r,a);y>g;){for(o(t,e,g,y),g++,y--;e[2*g+s]m;)y--}e[2*r+s]===m?o(t,e,r,y):(y++,o(t,e,y,a)),n>=y&&(r=y+1),y>=n&&(a=y-1)}}function o(t,e,n,r){a(t,n,r),a(e,2*n,2*r),a(e,2*n+1,2*r+1)}function a(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}e.exports=r},{}],202:[function(t,e,n){"use strict";function r(t,e,n,r,o,a){for(var s=[0,t.length-1,0],l=[],u=o*o;s.length;){var c=s.pop(),f=s.pop(),h=s.pop();if(a>=f-h)for(var d=h;f>=d;d++)i(e[2*d],e[2*d+1],n,r)<=u&&l.push(t[d]);else{var p=Math.floor((h+f)/2),m=e[2*p],g=e[2*p+1];i(m,g,n,r)<=u&&l.push(t[p]);var y=(c+1)%2;(0===c?m>=n-o:g>=r-o)&&(s.push(h),s.push(p-1),s.push(y)),(0===c?n+o>=m:r+o>=g)&&(s.push(p+1),s.push(f),s.push(y))}}return l}function i(t,e,n,r){var i=t-n,o=e-r;return i*i+o*o}e.exports=r},{}],203:[function(t,e,n){function r(t,e,n,r){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=n,this.p2y=r}e.exports=r,r.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},r.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},r.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},r.prototype.solveCurveX=function(t,e){"undefined"==typeof e&&(e=1e-6);var n,r,i,o,a;for(i=t,a=0;8>a;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)i)return n;if(i>r)return r;for(;r>n;){if(o=this.sampleCurveX(i),Math.abs(o-t)o?n=i:r=i,i=.5*(r-n)+n}return i},r.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],204:[function(t,e,n){e.exports.VectorTile=t("./lib/vectortile.js"),e.exports.VectorTileFeature=t("./lib/vectortilefeature.js"),e.exports.VectorTileLayer=t("./lib/vectortilelayer.js")},{"./lib/vectortile.js":205,"./lib/vectortilefeature.js":206,"./lib/vectortilelayer.js":207}],205:[function(t,e,n){"use strict";function r(t,e){this.layers=t.readFields(i,{},e)}function i(t,e,n){if(3===t){var r=new o(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}var o=t("./vectortilelayer");e.exports=r},{"./vectortilelayer":207}],206:[function(t,e,n){"use strict";function r(t,e,n,r,o){this.properties={},this.extent=n,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=o,t.readFields(i,this,e)}function i(t,e,n){1==t?e.id=n.readVarint():2==t?o(n,e):3==t?e.type=n.readVarint():4==t&&(e._geometry=n.pos)}function o(t,e){for(var n=t.readVarint()+t.pos;t.pos=e)return[t];for(var n,r,i=[],o=0;e>o;o++){var a=s(t[o]);0!==a&&(void 0===r&&(r=0>a),r===0>a?(n&&i.push(n),n=[t[o]]):n.push(t[o]))}return n&&i.push(n),i}function s(t){for(var e,n,r=0,i=0,o=t.length,a=o-1;o>i;a=i++)e=t[i],n=t[a],r+=(n.x-e.x)*(e.y+n.y);return r}var l=t("point-geometry");e.exports=r,r.types=["Unknown","Point","LineString","Polygon"],r.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,r=1,i=0,o=0,a=0,s=[];t.pos>3}if(i--,1===r||2===r)o+=t.readSVarint(),a+=t.readSVarint(),1===r&&(e&&s.push(e),e=[]),e.push(new l(o,a));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&s.push(e),s},r.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,o=0,a=1/0,s=-(1/0),l=1/0,u=-(1/0);t.pos>3}if(r--,1===n||2===n)i+=t.readSVarint(),o+=t.readSVarint(),a>i&&(a=i),i>s&&(s=i),l>o&&(l=o),o>u&&(u=o);else if(7!==n)throw new Error("unknown command "+n)}return[a,l,s,u]},r.prototype.toGeoJSON=function(t,e,n){function i(t){for(var e=0;e>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}var a=t("./vectortilefeature.js");e.exports=r,r.prototype.feature=function(t){if(0>t||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new a(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":206}],208:[function(t,e,n){function r(t){var e=[];for(var n in t.layers)e.push(o(t.layers[n]));var r=new c;return f.tile.write({layers:e},r),r.finish()}function i(t){var e={};for(var n in t)e[n]=new h(t[n].features),e[n].name=n;return r({layers:e})}function o(t){for(var e={name:t.name||"",version:t.version||1,extent:t.extent||4096,keys:[],values:[],features:[]},n={},r={},i=0;i>31}function l(t){for(var e=[],n=0,r=0,i=t.length,o=0;i>o;o++){var l=t[o];e.push(a(1,1));for(var u=0;ut?{sint_value:t}:{uint_value:t}:(t=JSON.stringify(t),e={string_value:t}),e.key=n+":"+t,e}var c=t("pbf"),f=t("./vector-tile-pb"),h=t("./lib/geojson_wrapper");e.exports=r,e.exports.fromVectorTileJs=r,e.exports.fromGeojsonVt=i,e.exports.GeoJSONWrapper=h},{"./lib/geojson_wrapper":209,"./vector-tile-pb":210,pbf:192}],209:[function(t,e,n){"use strict";function r(t){this.features=t,this.length=t.length}function i(t){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=4096}var o=t("point-geometry"),a=t("vector-tile").VectorTileFeature;e.exports=r,r.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;el;l++){var c=s[l],f=o[c].exports;if(f===t||f&&f.default===t){n=c;break}}if(!n){n=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var h={},l=0,u=s.length;u>l;l++){var c=s[l];h[c]=c}i[n]=[Function(["require","module","exports"],"("+t+")(self)"),h]}var d=Math.floor(Math.pow(16,8)*Math.random()).toString(16),p={};p[n]=n,i[d]=[Function(["require"],"var f = require("+a(n)+");(f.default ? f.default : f)(self);"),p];var m="("+r+")({"+Object.keys(i).map(function(t){return a(t)+":["+i[t][0]+","+a(i[t][1])+"]"}).join(",")+"},{},["+a(d)+"])",g=window.URL||window.webkitURL||window.mozURL||window.msURL,y=new Blob([m],{type:"text/javascript"});if(e&&e.bare)return y;var v=g.createObjectURL(y),x=new Worker(v);return x.objectURL=v,x}},{}],212:[function(e,n,r){!function(e,i){"object"==typeof r&&"undefined"!=typeof n?i(r):"function"==typeof t&&t.amd?t(["exports"],i):i(e.WhooTS=e.WhooTS||{})}(this,function(t){function e(t,e,r,i,o,a){a=a||{};var s=t+"?"+["bbox="+n(r,i,o),"format="+(a.format||"image/png"),"service="+(a.service||"WMS"),"version="+(a.version||"1.1.1"),"request="+(a.request||"GetMap"),"srs="+(a.srs||"EPSG:3857"),"width="+(a.width||256),"height="+(a.height||256),"layers="+e].join("&");return s}function n(t,e,n){e=Math.pow(2,n)-e-1;var i=r(256*t,256*e,n),o=r(256*(t+1),256*(e+1),n);return i[0]+","+i[1]+","+o[0]+","+o[1]}function r(t,e,n){var r=2*Math.PI*6378137/256/Math.pow(2,n),i=t*r-2*Math.PI*6378137/2,o=e*r-2*Math.PI*6378137/2;return[i,o]}t.getURL=e,t.getTileBBox=n,t.getMercCoords=r,Object.defineProperty(t,"__esModule",{value:!0})})},{}],213:[function(t,e,n){e.exports={name:"mapbox-gl",description:"A WebGL interactive maps library",version:"0.22.0",main:"js/mapbox-gl.js",license:"BSD-3-Clause",repository:{type:"git",url:"git://github.com/mapbox/mapbox-gl-js.git"},engines:{node:">=4.0.0"},dependencies:{csscolorparser:"^1.0.2",earcut:"^2.0.3","feature-filter":"^2.2.0","geojson-rewind":"^0.1.0","geojson-vt":"^2.4.0","gl-matrix":"^2.3.1","grid-index":"^1.0.0","mapbox-gl-function":"^1.2.1","mapbox-gl-shaders":"github:mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747","mapbox-gl-style-spec":"github:mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae","mapbox-gl-supported":"^1.2.0",pbf:"^1.3.2",pngjs:"^2.2.0","point-geometry":"^0.0.0",quickselect:"^1.0.0",request:"^2.39.0","resolve-url":"^0.2.1","shelf-pack":"^1.0.0",supercluster:"^2.0.1",unassertify:"^2.0.0",unitbezier:"^0.0.0","vector-tile":"^1.3.0","vt-pbf":"^2.0.2",webworkify:"^1.3.0","whoots-js":"^2.0.0"},devDependencies:{async:"^2.0.1","babel-preset-react":"^6.11.1",babelify:"^7.3.0",benchmark:"~2.1.0",browserify:"^13.0.0","browserify-middleware":"^7.0.0",clipboard:"^1.5.12","concat-stream":"1.5.1",coveralls:"^2.11.8",doctrine:"^1.2.1",documentation:"https://github.com/documentationjs/documentation/archive/bb41619c734e59ef3fbc3648610032efcfdaaace.tar.gz","documentation-theme-utils":"3.0.0",envify:"^3.4.0",eslint:"^2.5.3","eslint-config-mourner":"^2.0.0","eslint-plugin-html":"^1.5.1",express:"^4.13.4",gl:"^4.0.1",handlebars:"4.0.5","highlight.js":"9.3.0",istanbul:"^0.4.2","json-loader":"^0.5.4",lodash:"^4.13.1","mapbox-gl-test-suite":"github:mapbox/mapbox-gl-test-suite#1619d84e76ff3434becd51237720d370c7405ee5","memory-fs":"^0.3.0",minifyify:"^7.0.1",nyc:"6.4.0",proxyquire:"^1.7.9",react:"^15.3.0","react-dom":"^15.3.0",remark:"4.2.2","remark-html":"3.0.0",sinon:"^1.15.4",st:"^1.0.0",tap:"^5.7.0",through:"^2.3.7","transform-loader":"^0.2.3","unist-util-visit":"1.1.0",vinyl:"1.1.1","vinyl-fs":"2.4.3",watchify:"^3.2.2",webpack:"^1.13.1","webworkify-webpack":"^1.1.3"},browserify:{transform:["unassertify"]},browser:{"./js/util/ajax.js":"./js/util/browser/ajax.js","./js/util/browser.js":"./js/util/browser/browser.js","./js/util/canvas.js":"./js/util/browser/canvas.js","./js/util/dom.js":"./js/util/browser/dom.js","./js/util/web_worker.js":"./js/util/browser/web_worker.js"},scripts:{"build-dev":"browserify js/mapbox-gl.js --debug --ignore-transform unassertify --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js","build-docs":"documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/","build-min":"browserify js/mapbox-gl.js --debug --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js","//":"The 'build' script is invoked by publisher when publishing docs on the mb-pages branch",build:"npm run build-docs",lint:"eslint js test bench server.js docs/_posts/examples/*.html","open-changed-examples":"git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open","start-docs":"npm run build-min && npm run build-docs && jekyll serve -w",start:"node server.js","test-suite":"node test/render.test.js && node test/query.test.js",test:"npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js"},gitHead:"98461d3e2db6369cbcb66d70595e3032558fba9d",bugs:{url:"https://github.com/mapbox/mapbox-gl-js/issues"},homepage:"https://github.com/mapbox/mapbox-gl-js#readme",_id:"mapbox-gl@0.22.0",_shasum:"7fb1d70984dc7d8671abcd09ef6ab5fb98c0a310",_from:"mapbox-gl@latest",_npmVersion:"2.15.5",_nodeVersion:"4.4.5",_npmUser:{name:"lucaswoj",email:"lucas@lucaswoj.com"},dist:{shasum:"7fb1d70984dc7d8671abcd09ef6ab5fb98c0a310",tarball:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.0.tgz"},maintainers:[{name:"aaronlidman",email:"aaronlidman@gmail.com"},{name:"ajashton",email:"aj.ashton@gmail.com"},{name:"ansis",email:"ansis.brammanis@gmail.com"},{name:"bergwerkgis",email:"wb@bergwerk-gis.at"},{name:"bhousel",email:"bryan@mapbox.com"},{name:"bsudekum",email:"bobby@mapbox.com"},{name:"camilleanne",email:"camille@mapbox.com"},{name:"dnomadb",email:"damon@mapbox.com"},{name:"dthompson",email:"dthompson@gmail.com"},{name:"emilymcafee",email:"emily@mapbox.com"},{name:"flippmoke",email:"flippmoke@gmail.com"},{name:"freenerd",email:"spam@freenerd.de"},{name:"gretacb",email:"carol@mapbox.com"},{name:"ian29",email:"ian.villeda@gmail.com"},{name:"ianshward",email:"ian@mapbox.com"},{name:"ingalls",email:"nicholas.ingalls@gmail.com"},{name:"jfirebaugh",email:"john.firebaugh@gmail.com"},{name:"jrpruit1",email:"jake@jakepruitt.com"},{name:"karenzshea",email:"karen@mapbox.com"},{name:"kkaefer",email:"kkaefer@gmail.com"},{name:"lbud",email:"lauren@mapbox.com"},{name:"lucaswoj",email:"lucas@lucaswoj.com"},{name:"lxbarth",email:"alex@mapbox.com"},{name:"lyzidiamond",email:"lyzi@mapbox.com"},{name:"mapbox-admin",email:"accounts@mapbox.com"},{name:"mateov",email:"matt@mapbox.com"},{name:"mcwhittemore",email:"mcwhittemore@gmail.com"},{name:"miccolis",email:"jeff@miccolis.net"},{name:"mikemorris",email:"michael.patrick.morris@gmail.com"},{name:"morganherlocker",email:"morgan.herlocker@gmail.com"},{name:"mourner",email:"agafonkin@gmail.com"},{name:"nickidlugash",email:"nicki@mapbox.com"},{name:"rclark",email:"ryan.clark.j@gmail.com"},{name:"samanbb",email:"saman@mapbox.com"},{name:"sbma44",email:"tlee@mapbox.com"},{name:"scothis",email:"scothis@gmail.com"},{name:"sgillies",email:"sean@mapbox.com"},{name:"springmeyer",email:"dane@mapbox.com"},{name:"themarex",email:"patrick@mapbox.com"},{name:"tmcw",email:"tom@macwright.org"},{name:"tristen",email:"tristen.brown@gmail.com"},{name:"willwhite",email:"will@mapbox.com"},{name:"yhahn",email:"young@mapbox.com"}],_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/mapbox-gl-0.22.0.tgz_1471021366539_0.7491761057171971"},directories:{},_resolved:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.0.tgz"}},{}],214:[function(e,n,r){!function(){function e(t,n){if(t=t?t:"",n=n||{},t instanceof e)return t;if(!(this instanceof e))return new e(t,n);var i=r(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=q(100*this._a)/100,this._format=n.format||i.format,this._gradientType=n.gradientType,this._r<1&&(this._r=q(this._r)),this._g<1&&(this._g=q(this._g)),this._b<1&&(this._b=q(this._b)),this._ok=i.ok,this._tc_id=N++}function r(t){var e={r:0,g:0,b:0},n=1,r=!1,o=!1;return"string"==typeof t&&(t=O(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(e=i(t.r,t.g,t.b),r=!0,o="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=P(t.s),t.v=P(t.v),e=l(t.h,t.s,t.v),r=!0,o="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=P(t.s),t.l=P(t.l),e=a(t.h,t.s,t.l),r=!0,o="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=A(n),{ok:r,format:t.format||o,r:V(255,U(e.r,0)),g:V(255,U(e.g,0)),b:V(255,U(e.b,0)),a:n}}function i(t,e,n){return{r:255*S(t,255),g:255*S(e,255),b:255*S(n,255)}}function o(t,e,n){t=S(t,255),e=S(e,255),n=S(n,255);var r,i,o=U(t,e,n),a=V(t,e,n),s=(o+a)/2;if(o==a)r=i=0;else{var l=o-a;switch(i=s>.5?l/(2-o-a):l/(o+a),o){case t:r=(e-n)/l+(n>e?6:0);break;case e:r=(n-t)/l+2;break;case n:r=(t-e)/l+4}r/=6}return{h:r,s:i,l:s}}function a(t,e,n){function r(t,e,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?t+6*(e-t)*n:.5>n?e:2/3>n?t+(e-t)*(2/3-n)*6:t}var i,o,a;if(t=S(t,360),e=S(e,100),n=S(n,100),0===e)i=o=a=n;else{var s=.5>n?n*(1+e):n+e-n*e,l=2*n-s;i=r(l,s,t+1/3),o=r(l,s,t),a=r(l,s,t-1/3)}return{r:255*i,g:255*o,b:255*a}}function s(t,e,n){t=S(t,255),e=S(e,255),n=S(n,255);var r,i,o=U(t,e,n),a=V(t,e,n),s=o,l=o-a;if(i=0===o?0:l/o,o==a)r=0;else{switch(o){case t:r=(e-n)/l+(n>e?6:0);break;case e:r=(n-t)/l+2;break;case n:r=(t-e)/l+4}r/=6}return{h:r,s:i,v:s}}function l(t,e,n){t=6*S(t,360),e=S(e,100),n=S(n,100);var r=B.floor(t),i=t-r,o=n*(1-e),a=n*(1-i*e),s=n*(1-(1-i)*e),l=r%6,u=[n,a,o,o,s,n][l],c=[s,n,n,a,o,o][l],f=[o,o,s,n,n,a][l];return{r:255*u,g:255*c,b:255*f}}function u(t,e,n,r){var i=[I(q(t).toString(16)),I(q(e).toString(16)),I(q(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function c(t,e,n,r){var i=[I(D(r)),I(q(t).toString(16)),I(q(e).toString(16)),I(q(n).toString(16))];return i.join("")}function f(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.s-=n/100,r.s=T(r.s),e(r)}function h(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.s+=n/100,r.s=T(r.s),e(r)}function d(t){return e(t).desaturate(100)}function p(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.l+=n/100,r.l=T(r.l),e(r)}function m(t,n){n=0===n?0:n||10;var r=e(t).toRgb();return r.r=U(0,V(255,r.r-q(255*-(n/100)))),r.g=U(0,V(255,r.g-q(255*-(n/100)))),r.b=U(0,V(255,r.b-q(255*-(n/100)))),e(r)}function g(t,n){n=0===n?0:n||10;var r=e(t).toHsl();return r.l-=n/100,r.l=T(r.l),e(r)}function y(t,n){var r=e(t).toHsl(),i=(q(r.h)+n)%360;return r.h=0>i?360+i:i,e(r)}function v(t){var n=e(t).toHsl();return n.h=(n.h+180)%360,e(n)}function x(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+120)%360,s:n.s,l:n.l}),e({h:(r+240)%360,s:n.s,l:n.l})]}function b(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+90)%360,s:n.s,l:n.l}),e({h:(r+180)%360,s:n.s,l:n.l}),e({h:(r+270)%360,s:n.s,l:n.l})]}function _(t){var n=e(t).toHsl(),r=n.h;return[e(t),e({h:(r+72)%360,s:n.s,l:n.l}),e({h:(r+216)%360,s:n.s,l:n.l})]}function w(t,n,r){n=n||6,r=r||30;var i=e(t).toHsl(),o=360/r,a=[e(t)];for(i.h=(i.h-(o*n>>1)+720)%360;--n;)i.h=(i.h+o)%360,a.push(e(i));return a}function M(t,n){n=n||6;for(var r=e(t).toHsv(),i=r.h,o=r.s,a=r.v,s=[],l=1/n;n--;)s.push(e({h:i,s:o,v:a})),a=(a+l)%1;return s}function k(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function A(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function S(t,e){E(t)&&(t="100%");var n=L(t);return t=V(e,U(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),B.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function T(t){return V(1,U(0,t))}function z(t){return parseInt(t,16)}function E(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function L(t){return"string"==typeof t&&-1!=t.indexOf("%")}function I(t){return 1==t.length?"0"+t:""+t}function P(t){return 1>=t&&(t=100*t+"%"),t}function D(t){return Math.round(255*parseFloat(t)).toString(16)}function C(t){return z(t)/255}function O(t){t=t.replace(F,"").replace(R,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=X.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=X.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=X.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=X.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=X.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=X.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=X.hex8.exec(t))?{a:C(n[1]),r:z(n[2]),g:z(n[3]),b:z(n[4]),format:e?"name":"hex8"}:(n=X.hex6.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),format:e?"name":"hex"}:(n=X.hex3.exec(t))?{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function j(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var F=/^\s+/,R=/\s+$/,N=0,B=Math,q=B.round,V=B.min,U=B.max,Z=B.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,n,r,i,o,a=this.toRgb();return t=a.r/255,e=a.g/255,n=a.b/255,r=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),i=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),o=.03928>=n?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*i+.0722*o},setAlpha:function(t){return this._a=A(t),this._roundA=q(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=q(360*t.h),n=q(100*t.s),r=q(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=q(360*t.h),n=q(100*t.s),r=q(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return c(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:q(this._r),g:q(this._g),b:q(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+q(this._r)+", "+q(this._g)+", "+q(this._b)+")":"rgba("+q(this._r)+", "+q(this._g)+", "+q(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:q(100*S(this._r,255))+"%",g:q(100*S(this._g,255))+"%",b:q(100*S(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+q(100*S(this._r,255))+"%, "+q(100*S(this._g,255))+"%, "+q(100*S(this._b,255))+"%)":"rgba("+q(100*S(this._r,255))+"%, "+q(100*S(this._g,255))+"%, "+q(100*S(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:H[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+c(this._r,this._g,this._b,this._a),r=n,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=e(t);r=o.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,i=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(g,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(h,arguments)},greyscale:function(){return this._applyModification(d,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(v,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(x,arguments)},tetrad:function(){return this._applyCombination(b,arguments)}},e.fromRatio=function(t,n){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=P(t[i]));t=r}return e(t,n)},e.equals=function(t,n){return t&&n?e(t).toRgbString()==e(n).toRgbString():!1},e.random=function(){return e.fromRatio({r:Z(),g:Z(),b:Z()})},e.mix=function(t,n,r){r=0===r?0:r||50;var i,o=e(t).toRgb(),a=e(n).toRgb(),s=r/100,l=2*s-1,u=a.a-o.a;i=l*u==-1?l:(l+u)/(1+l*u),i=(i+1)/2;var c=1-i,f={r:a.r*i+o.r*c,g:a.g*i+o.g*c,b:a.b*i+o.b*c,a:a.a*s+o.a*(1-s)};return e(f)},e.readability=function(t,n){var r=e(t),i=e(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)},e.isReadable=function(t,n,r){var i,o,a=e.readability(t,n);switch(o=!1,i=j(r),i.level+i.size){case"AAsmall":case"AAAlarge":o=a>=4.5;break;case"AAlarge":o=a>=3;break;case"AAAsmall":o=a>=7}return o},e.mostReadable=function(t,n,r){var i,o,a,s,l=null,u=0;r=r||{},o=r.includeFallbackColors,a=r.level,s=r.size;for(var c=0;cu&&(u=i,l=e(n[c]));return e.isReadable(t,l,{level:a,size:s})||!o?l:(r.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],r))};var G=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},H=e.hexNames=k(G),X=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof n&&n.exports?n.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],215:[function(t,e,n){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],216:[function(t,e,n){"use strict";var r=t("./arrow_paths"),i=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),a=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:a({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":295,"../../plots/cartesian/constants":322,"../../plots/font_attributes":335,"./arrow_paths":215}],217:[function(t,e,n){"use strict";function r(t,e){function n(e,n){return u.coerce(t,r,g.layoutAttributes,e,n)}var r={};n("opacity"),n("align"),n("bgcolor");var i=n("bordercolor"),o=f.opacity(i);n("borderpad");var a=n("borderwidth"),s=n("showarrow");s&&(n("arrowcolor",o?r.bordercolor:f.defaultLine),n("arrowhead"),n("arrowsize"),n("arrowwidth",2*(o&&a||1)),n("ax"),n("ay"),n("axref"),n("ayref"),u.noneOrAll(t,r,["ax","ay"])),n("text",s?" ":"new text"),n("textangle"),u.coerceFont(n,"font",e.font);for(var l=["x","y"],h=0;2>h;h++){var d=l[h],p={_fullLayout:e},m=c.coerceRef(t,r,p,d),y=c.coerceARef(t,r,p,d),v=.5;if("paper"!==m){var x=c.getFromId(p,m);if(v=x.range[0]+v*(x.range[1]-x.range[0]),-1!==["date","category"].indexOf(x.type)&&"string"==typeof t[d]){var b;if("date"===x.type){if(b=u.dateTime2ms(t[d]),b!==!1&&(t[d]=b),y===m){var _=u.dateTime2ms(t["a"+d]);_!==!1&&(t["a"+d]=_)}}else(x._categories||[]).length&&(b=x._categories.indexOf(t[d]),-1!==b&&(t[d]=b))}}n(d,v),s||n(d+"anchor")}return u.noneOrAll(t,r,["x","y"]),r}function i(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=c.getFromId(t,e.xref),r=c.getFromId(t,e.yref);if(n||r){var i=(e._xsize||0)/2,o=e._xshift||0,a=(e._ysize||0)/2,s=e._yshift||0,l=i-o,u=i+o,f=a-s,h=a+s;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;l=Math.max(l,d),u=Math.max(u,d),f=Math.max(f,d),h=Math.max(h,d)}n&&n.autorange&&c.expand(n,[n.l2c(e.x)],{ppadplus:u,ppadminus:l}),r&&r.autorange&&c.expand(r,[r.l2c(e.y)],{ppadplus:h,ppadminus:f})}})}function o(t,e,n,r,i,o,a,s){var l=n-t,u=i-t,c=a-i,f=r-e,h=o-e,d=s-o,p=l*d-c*f;if(0===p)return null;var m=(u*d-c*h)/p,g=(u*f-l*h)/p;return 0>g||g>1||0>m||m>1?null:{ +x:t+l*m,y:e+f*m}}var a=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),f=t("../color"),h=t("../drawing"),d=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),m=t("../dragelement"),g=e.exports={};g.ARROWPATHS=t("./arrow_paths"),g.layoutAttributes=t("./attributes"),g.supplyLayoutDefaults=function(t,e){for(var n=t.annotations||[],i=e.annotations=[],o=0;ot?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var r=Y.select(".annotation-math-group"),i=!r.empty(),s=h.bBox((i?r:tt).node()),d=s.width,y=s.height,v=Math.round(d+2*J),x=Math.round(y+2*J);q._w=d,q._h=y;var b=!1;if(["x","y"].forEach(function(e){var r,i=q[e+"ref"]||e,o=c.getFromId(t,i),a=(G+("x"===e?0:90))*Math.PI/180,s=v*Math.abs(Math.cos(a))+x*Math.abs(Math.sin(a)),l=q[e+"anchor"];if(o){if(!o.autorange&&(q[e]-o.range[0])*(q[e]-o.range[1])>0&&(q["a"+e+"ref"]===i?(q["a"+e]-o.range[0])*(q["a"+e]-o.range[1])>0&&(b=!0):b=!0,b))return;Z[e]=o._offset+o.l2p(q[e]),r=.5}else r=q[e],"y"===e&&(r=1-r),Z[e]="x"===e?E.l+E.w*r:E.t+E.h*r;var u=0;q["a"+e+"ref"]===i?Z["aa"+e]=o._offset+o.l2p(q["a"+e]):(u=q.showarrow?q["a"+e]:s*n(r,l),Z[e]+=u),q["_"+e+"type"]=o&&o.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=u}),b)return void Y.remove();var w,M;q.showarrow&&(w=q.axref===q.xref?Z.x:u.constrain(Z.x-q.ax,1,_.width-1),M=q.ayref===q.yref?Z.y:u.constrain(Z.y-q.ay,1,_.height-1)),Z.x=u.constrain(Z.x,1,_.width-1),Z.y=u.constrain(Z.y,1,_.height-1);var k=J-s.top,A=J-s.left;i?r.select("svg").attr({x:J-1,y:J}):(tt.attr({x:A,y:k}),tt.selectAll("tspan.line").attr({y:k,x:A})),$.call(h.setRect,W/2,W/2,v-W,x-W);var S=0,T=0;S=q.axref===q.xref?Math.round(Z.aax-v/2):Math.round(Z.x-v/2),T=q.ayref===q.yref?Math.round(Z.aay-x/2):Math.round(Z.y-x/2),Y.call(u.setTranslate,S,T);var z="annotations["+e+"]",L=function(n,r){a.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?Z.aax+n:Z.x+n,s=q.ayref===q.yref?Z.aay+r:Z.y+r;var c=u.rotationXYMatrix(G,i,s),h=u.apply2DTransform(c),d=u.apply2DTransform2(c),p=$.attr("width")/2,y=$.attr("height")/2,v=[[i-p,s-y,i-p,s+y],[i-p,s+y,i+p,s+y],[i+p,s+y,i+p,s-y],[i+p,s-y,i-p,s-y]].map(d);if(!v.reduce(function(t,e){return t^!!o(w,M,w+1e6,M+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=o(i,s,w,M,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var x=q.arrowwidth,b=q.arrowcolor,_=H.append("g").style({opacity:f.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=_.append("path").attr("d","M"+i+","+s+"L"+w+","+M).style("stroke-width",x+"px").call(f.stroke,f.rgb(b));g.arrowhead(k,q.arrowhead,"end",q.arrowsize);var A=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-w)+","+(s-M),transform:"translate("+w+","+M+")"}).style("stroke-width",x+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var S,T,L;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate(Y);T=t.x,L=t.y,S={},V&&V.autorange&&(S[V._name+".autorange"]=!0),U&&U.autorange&&(S[U._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var n=h(T,L),r=n[0]+t,i=n[1]+e;Y.call(u.setTranslate,r,i),S[z+".x"]=V?q.x+t/V._m:(w+t-E.l)/E.w,S[z+".y"]=U?q.y+e/U._m:1-(M+e-E.t)/E.h,q.axref===q.xref&&(S[z+".ax"]=V?q.ax+t/V._m:(w+t-E.l)/E.w),q.ayref===q.yref&&(S[z+".ay"]=U?q.ay+e/U._m:1-(M+e-E.t)/E.h),X.attr({transform:"rotate("+G+","+r+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,S);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};q.showarrow&&L(0,0);var I=u.rotationXYMatrix(G,Z.x,Z.y),P=u.apply2DTransform(I);if(t._context.editable){var D,C,O;m.init({element:Y.node(),prepFn:function(){var t=u.getTranslate(Y);D=t.x,C=t.y,O={}},moveFn:function(t,e){Y.call(u.setTranslate,D+t,C+e);var n="pointer";if(q.showarrow)q.axref===q.xref?O[z+".ax"]=V.p2l(V.l2p(q.ax)+t):O[z+".ax"]=q.ax+t,q.ayref===q.yref?O[z+".ay"]=U.p2l(U.l2p(q.ay)+e):O[z+".ay"]=q.ay+e,L(t,e);else{if(V)O[z+".x"]=q.x+t/V._m;else{var r=q._xsize/E.w,i=q.x+q._xshift/E.w-r/2;O[z+".x"]=m.align(i+t/E.w,r,0,1,q.xanchor)}if(U)O[z+".y"]=q.y+e/U._m;else{var o=q._ysize/E.h,a=q.y-q._yshift/E.h-o/2;O[z+".y"]=m.align(a-e/E.h,o,0,1,q.yanchor)}V&&U||(n=m.getCursor(V?.5:O[z+".x"],U?.5:O[z+".y"],q.xanchor,q.yanchor))}var s=P(D,C),l=s[0]+t,c=s[1]+e;Y.call(u.setTranslate,D+t,C+e),X.attr({transform:"rotate("+G+","+l+","+c+")"}),p(Y,n)},doneFn:function(e){if(p(Y),e){l.relayout(t,O);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var x,b=t.layout,_=t._fullLayout;if(!s(e)||-1===e){if(!e&&Array.isArray(i))return b.annotations=i,g.supplyLayoutDefaults(b,_),void g.drawAll(t);if("remove"===i)return delete b.annotations,_.annotations=[],void g.drawAll(t);if(n&&"add"!==i){for(x=0;x<_.annotations.length;x++)g.draw(t,x,n,i);return}e=_.annotations.length,_.annotations.push({})}if(!n&&i){if("remove"===i){for(_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),_.annotations.splice(e,1),b.annotations.splice(e,1),x=e;x<_.annotations.length;x++)_._infolayer.selectAll('.annotation[data-index="'+(x+1)+'"]').attr("data-index",String(x)),g.draw(t,x);return}if("add"===i||u.isPlainObject(i)){_.annotations.splice(e,0,{});var w=u.isPlainObject(i)?u.extendFlat({},i):{text:"New text"};for(b.annotations?b.annotations.splice(e,0,w):b.annotations=[w],x=_.annotations.length-1;x>e;x--)_._infolayer.selectAll('.annotation[data-index="'+(x-1)+'"]').attr("data-index",String(x)),g.draw(t,x)}}_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var M=b.annotations[e],k=_.annotations[e];if(M){var A={xref:M.xref,yref:M.yref},S={};"string"==typeof n&&n?S[n]=i:u.isPlainObject(n)&&(S=n);var T=Object.keys(S);for(x=0;xx;x++){var I=L[x];if(void 0===S[I]&&void 0!==M[I]){var P=c.getFromId(t,c.coerceRef(A,{},t,I)),D=c.getFromId(t,c.coerceRef(M,{},t,I)),C=M[I],O=k["_"+I+"type"];if(void 0!==S[I+"ref"]){var j="auto"===M[I+"anchor"],F="x"===I?E.w:E.h,R=(k["_"+I+"size"]||0)/(2*F);if(P&&D)C=(C-P.range[0])/(P.range[1]-P.range[0]),C=D.range[0]+C*(D.range[1]-D.range[0]);else if(P){if(C=(C-P.range[0])/(P.range[1]-P.range[0]),C=P.domain[0]+C*(P.domain[1]-P.domain[0]),j){var N=C+R,B=C-R;2/3>C+B?C=B:C+N>4/3&&(C=N)}}else D&&(j&&(1/3>C?C+=R:C>2/3&&(C-=R)),C=(C-D.domain[0])/(D.domain[1]-D.domain[0]),C=D.range[0]+C*(D.range[1]-D.range[0]))}D&&D===P&&O&&("log"===O&&"log"!==D.type?C=Math.pow(10,C):"log"!==O&&"log"===D.type&&(C=C>0?Math.log(C)/Math.LN10:void 0)),M[I]=C}}var q=r(M,_);_.annotations[e]=q;var V=c.getFromId(t,q.xref),U=c.getFromId(t,q.yref),Z={x:0,y:0},G=+q.textangle||0,H=_._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:M,fullAnnotation:q})}),X=H.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),Y=X.append("g"),W=q.borderwidth,Q=q.borderpad,J=W+Q,$=Y.append("rect").attr("class","bg").style("stroke-width",W+"px").call(f.stroke,q.bordercolor).call(f.fill,q.bgcolor),K=q.font,tt=Y.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?tt.call(d.makeEditable,Y).call(y).on("edit",function(n){q.text=n,this.attr({"data-unformatted":q.text}),this.call(y);var r={};r["annotations["+e+"].text"]=q.text,V&&V.autorange&&(r[V._name+".autorange"]=!0),U&&U.autorange&&(r[U._name+".autorange"]=!0),l.relayout(t,r)}):tt.call(y),X.attr({transform:"rotate("+G+","+Z.x+","+Z.y+")"}).call(h.setPosition,Z.x,Z.y)}},g.arrowhead=function(t,e,n,r){s(r)||(r=1);var i=t.node(),o=g.ARROWPATHS[e||0];if(o){"string"==typeof n&&n||(n="end");var l,u,c,d,p=(h.getPx(t,"stroke-width")||1)*r,m=t.style("stroke")||f.defaultLine,y=t.style("stroke-opacity")||1,v=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=o.backoff*p;if("line"===i.nodeName){if(l={x:+t.attr("x1"),y:+t.attr("y1")},u={x:+t.attr("x2"),y:+t.attr("y2")},c=Math.atan2(l.y-u.y,l.x-u.x),d=c+Math.PI,b){var _=b*Math.cos(c),w=b*Math.sin(c);v&&(l.x-=_,l.y-=w,t.attr({x1:l.x,y1:l.y})),x&&(u.x+=_,u.y+=w,t.attr({x2:u.x,y2:u.y}))}}else if("path"===i.nodeName){var M=i.getTotalLength(),k="";if(v){var A=i.getPointAtLength(0),S=i.getPointAtLength(.1);c=Math.atan2(A.y-S.y,A.x-S.x),l=i.getPointAtLength(Math.min(b,M)),b&&(k="0px,"+b+"px,")}if(x){var T=i.getPointAtLength(M),z=i.getPointAtLength(M-.1);if(d=Math.atan2(T.y-z.y,T.x-z.x),u=i.getPointAtLength(Math.max(0,M-b)),b){var E=k?2*b:b;k+=M-E+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var L=function(n,r){e>5&&(r=0),a.select(i.parentElement).append("path").attr({"class":t.attr("class"),d:o.path,transform:"translate("+n.x+","+n.y+")rotate("+180*r/Math.PI+")scale("+p+")"}).style({fill:m,opacity:y,"stroke-width":0})};v&&L(l,c),x&&L(u,d)}},g.calcAutorange=function(t){var e=t._fullLayout,n=e.annotations;if(n.length&&t._fullData.length){var r={};n.forEach(function(t){r[t.xref]=!0,r[t.yref]=!0});var o=c.list(t).filter(function(t){return t.autorange&&r[t._id]});if(o.length)return u.syncOrAsync([g.drawAll,i],t)}}},{"../../lib":296,"../../lib/setcursor":305,"../../lib/svg_text_utils":307,"../../plotly":314,"../../plots/cartesian/axes":317,"../color":219,"../dragelement":240,"../drawing":242,"./arrow_paths":215,"./attributes":216,d3:18,"fast-isnumeric":20}],218:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],219:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===r.length;if(!i&&3!==r.length)return t;for(var a=0;a=0))return t;if(3===a)r[a]>1&&(r[a]=1);else if(r[a]>=1)return t}var s=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return i?"rgba("+s+", "+r[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),o=t("fast-isnumeric"),a=e.exports={},s=t("./attributes");a.defaults=s.defaults,a.defaultLine=s.defaultLine,a.lightLine=s.lightLine,a.background=s.background,a.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},a.rgb=function(t){return a.tinyRGB(i(t))},a.opacity=function(t){return t?i(t).getAlpha():0},a.addOpacity=function(t,e){var n=i(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},a.combine=function(t,e){var n=i(t).toRgb();if(1===n.a)return i(t).toRgbString();var r=i(e||a.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},s={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return i(s).toRgbString()},a.contrast=function(t,e,n){var r=i(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},a.stroke=function(t,e){var n=i(e);t.style({stroke:a.tinyRGB(n),"stroke-opacity":n.getAlpha()})},a.fill=function(t,e){var n=i(e);t.style({fill:a.tinyRGB(n),"fill-opacity":n.getAlpha()})},a.clean=function(t){if(t&&"object"==typeof t){var e,n,i,o,s=Object.keys(t);for(e=0;el&&(o[1]-=(at-l)/2)):n.node()&&!n.classed("js-placeholder")&&(at=h.bBox(e.node()).height),at){if(at+=5,"top"===b.titleside)$.domain[1]-=at/A.h,o[1]*=-1;else{$.domain[0]+=at/A.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),$.setScale()}}it.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(A.h*(1-$.domain[1]))+")");var f=it.select(".cbfills").selectAll("rect.cbfill").data(E);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?T[0]:(E[e]+E[e-1])/2,e===E.length-1?T[1]:(E[e]+E[e+1])/2].map($.c2p).map(Math.round);e!==E.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=I(t).replace("e-",""),a=i(o).toHexString();r.select(this).attr({x:H,width:Math.max(N,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:a})});var d=it.select(".cblines").selectAll("path.cbline").data(b.line.color&&b.line.width?z:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+H+","+(Math.round($.c2p(t))+b.line.width/2%1)+"h"+N).call(h.lineGroupStyle,b.line.width,L(t),b.line.dash)}),$._axislayer.selectAll("g."+$._id+"tick,path").remove(),$._pos=H+N+(b.outlinewidth||0)/2-("outside"===b.ticks?1:0),$.side="right",u.syncOrAsync([function(){return s.doTicks(t,$,!0)},function(){if(-1===["top","bottom"].indexOf(b.titleside)){var e=$.titlefont.size,n=$._offset+$._length/2,i=A.l+($.position||0)*A.w+("right"===$.side?10+e*($.showticklabels?1:.5):-10-e*($.showticklabels?.5:0));w("h"+$._id+"title",{avoid:{selection:r.select(t).selectAll("g."+$._id+"tick"),side:b.titleside,offsetLeft:A.l,offsetTop:A.t,maxShift:k.width},attributes:{x:i,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,n){var r,i=x();r=a.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:$,propName:r,traceIndex:i.index,dfltName:"colorscale",containerGroup:it.select(".cbtitle")},s="h"===e.charAt(0)?e.substr(1):"h"+e;it.selectAll("."+s+",."+s+"-math-group").remove(),p.draw(t,e,c(o,n||{}))}function M(){var n=N+b.outlinewidth/2+h.bBox($._axislayer.node()).width;if(j=ot.select("text"),j.node()&&!j.classed("js-placeholder")){var r,i=ot.select(".h"+$._id+"title-math-group").node();r=i&&-1!==["top","bottom"].indexOf(b.titleside)?h.bBox(i).width:h.bBox(ot.node()).right-H-A.l,n=Math.max(n,r)}var o=2*b.xpad+n+b.borderwidth+b.outlinewidth/2,s=W-Q;it.select(".cbbg").attr({x:H-b.xpad-(b.borderwidth+b.outlinewidth)/2,y:Q-Z,width:Math.max(o,2),height:Math.max(s+2*Z,2)}).call(d.fill,b.bgcolor).call(d.stroke,b.bordercolor).style({"stroke-width":b.borderwidth}),it.selectAll(".cboutline").attr({x:H,y:Q+b.ypad+("top"===b.titleside?at:0),width:Math.max(N,2),height:Math.max(s-2*b.ypad-at,2)}).call(d.stroke,b.outlinecolor).style({fill:"None","stroke-width":b.outlinewidth});var l=({center:.5,right:1}[b.xanchor]||0)*o;it.attr("transform","translate("+(A.l-l)+","+A.t+")"),a.autoMargin(t,e,{x:b.x,y:b.y,l:o*({right:1,center:.5}[b.xanchor]||0),r:o*({left:1,center:.5}[b.xanchor]||0),t:s*({bottom:1,middle:.5}[b.yanchor]||0),b:s*({top:1,middle:.5}[b.yanchor]||0)})}var k=t._fullLayout,A=k._size;if("function"!=typeof b.fillcolor&&"function"!=typeof b.line.color)return void k._infolayer.selectAll("g."+e).remove();var S,T=r.extent(("function"==typeof b.fillcolor?b.fillcolor:b.line.color).domain()),z=[],E=[],L="function"==typeof b.line.color?b.line.color:function(){return b.line.color},I="function"==typeof b.fillcolor?b.fillcolor:function(){return b.fillcolor},P=b.levels.end+b.levels.size/100,D=b.levels.size,C=1.001*T[0]-.001*T[1],O=1.001*T[1]-.001*T[0];for(S=b.levels.start;0>(S-P)*D;S+=D)S>C&&O>S&&z.push(S);if("function"==typeof b.fillcolor)if(b.filllevels)for(P=b.filllevels.end+b.filllevels.size/100,D=b.filllevels.size,S=b.filllevels.start;0>(S-P)*D;S+=D)S>T[0]&&S1){var rt=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));tt*=rt*u.roundUp(nt/rt,[2,5,10]),(Math.abs(b.levels.start)/b.levels.size+1e-6)%1<2e-6&&($.tick0=0)}$.dtick=tt}$.domain=[Y+G,Y+V-G],$.setScale();var it=k._infolayer.selectAll("g."+e).data([0]);it.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),it.attr("transform","translate("+Math.round(A.l)+","+Math.round(A.t)+")");var ot=it.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(A.l)+",-"+Math.round(A.t)+")");$._axislayer=it.select(".cbaxis");var at=0;if(-1!==["top","bottom"].indexOf(b.titleside)){var st,lt=A.l+(b.x+U)*A.w,ut=$.titlefont.size;st="top"===b.titleside?(1-(Y+V-G))*A.h+A.t+3+.75*ut:(1-(Y+G))*A.h+A.t-3-.25*ut,w($._id+"title",{attributes:{x:lt,y:st,"text-anchor":"start"}})}var ct=u.syncOrAsync([a.previousPromises,_,a.previousPromises,M],t);if(ct&&ct.then&&(t._promises||[]).push(ct),t._context.editable){var ft,ht,dt;l.init({element:it.node(),prepFn:function(){ft=it.attr("transform"),f(it)},moveFn:function(t,e){it.attr("transform",ft+" translate("+t+","+e+")"),ht=l.align(X+t/A.w,B,0,1,b.xanchor),dt=l.align(Y-e/A.h,V,0,1,b.yanchor);var n=l.getCursor(ht,dt,b.xanchor,b.yanchor);f(it,n)},doneFn:function(e){f(it),e&&void 0!==ht&&void 0!==dt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":dt},x().index)}})}return ct}function x(){var n,r,i=e.substr(2);for(n=0;nc*f?i.RdBu:c>=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=o(h)),s.colorscale=h)}},{"../../lib":296,"./flip_scale":230,"./scales":237}],227:[function(t,e,n){"use strict";var r=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},r.colorscale,{}),cauto:i({},r.zauto,{}),cmax:i({},r.zmax,{}),cmin:i({},r.zmin,{}),autocolorscale:i({},r.autocolorscale,{}),reversescale:i({},r.reversescale,{})}}},{"../../lib/extend":295,"./attributes":225,"./scales.js":237}],228:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":237}],229:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../../lib"),o=t("../colorbar/has_colorbar"),a=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,n,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,m=f?i.nestedProperty(e,d).get()||{}:e,g=p[h+"min"],y=p[h+"max"],v=p.colorscale,x=r(g)&&r(y)&&y>g;u(f+h+"auto",!x),u(f+h+"min"),u(f+h+"max");var b;void 0!==v&&(b=!s(v)),u(f+"autocolorscale",b);var _=u(f+"colorscale"),w=u(f+"reversescale");if(w&&(m.colorscale=l(_)),"marker.line."!==f){var M;f&&(M=o(p));var k=u(f+"showscale",M);k&&a(p,m,n)}}},{"../../lib":296,"../colorbar/defaults":221,"../colorbar/has_colorbar":223,"./flip_scale":230,"./is_valid_scale":234,"fast-isnumeric":20}],230:[function(t,e,n){"use strict";e.exports=function(t){for(var e,n=t.length,r=new Array(n),i=n-1,o=0;i>=0;i--,o++)e=t[i],r[o]=[1-e[0],e[1]];return r}},{}],231:[function(t,e,n){"use strict";var r=t("./scales"),i=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=i),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":228,"./is_valid_scale_array":235,"./scales":237}],232:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?i.nestedProperty(t,e).get()||{}:t,a=n.color,s=!1;if(Array.isArray(a))for(var l=0;lh;h++)l=t[h],c[h]=e+l[0]*(n-e),f[h]=i(l[1]).toRgb();var d=r.scale.linear().domain(c).interpolate(r.interpolateObject).range(f);return function(t){if(o(t)){var r=a.constrain(t,e,n),l=d(r);return i(l).toRgbString()}return i(t).isValid()?t:s.defaultLine}}},{"../../lib":296,"../color":219,d3:18,"fast-isnumeric":20,tinycolor2:214}],237:[function(t,e,n){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]] +}},{}],238:[function(t,e,n){"use strict";e.exports=function(t,e,n,r,i){var o=(t-n)/(r-n),a=o+e/(r-n),s=(o+a)/2;return"left"===i||"bottom"===i?o:"center"===i||"middle"===i?s:"right"===i||"top"===i?a:2/3-s>o?o:a>4/3-s?a:s}},{}],239:[function(t,e,n){"use strict";var r=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":296}],240:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),a=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,m._dragged=!1,m._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-m._mouseDownTimey&&(g=Math.max(g-1,1)),t.doneFn&&t.doneFn(m._dragged,g),!m._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),d.dispatchEvent(n)}return i(m),m._dragged=!1,a.pauseEvent(e)}var u,c,f,h,d,p,m=a.getPlotDiv(t.element)||{},g=1,y=s.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":296,"../../plotly":314,"../../plots/cartesian/constants":322,"./align":238,"./cursor":239,"./unhover":241}],241:[function(t,e,n){"use strict";var r=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,n)},i.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":294}],242:[function(t,e,n){"use strict";function r(t,e,n,r){var o=t[0]-e[0],a=t[1]-e[1],s=n[0]-e[0],l=n[1]-e[1],u=Math.pow(o*o+a*a,b/2),c=Math.pow(s*s+l*l,b/2),f=(c*c*o-u*u*s)*r,h=(c*c*a-u*u*l)*r,d=3*c*(u+c),p=3*u*(u+c);return[[i.round(e[0]+(d&&f/d),2),i.round(e[1]+(d&&h/d),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&h/p),2)]]}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../plots/plots"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),d=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},p.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},p.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},p.setRect=function(t,e,n,r,i){t.call(p.setPosition,e,n).call(p.setSize,r,i)},p.translatePoints=function(t,e,n){t.each(function(t){var r=t.xp||e.c2p(t.x),a=t.yp||n.c2p(t.y),s=i.select(this);o(r)&&o(a)?"text"===this.nodeName?s.attr("x",r).attr("y",a):s.attr("transform","translate("+r+","+a+")"):s.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):n||0},p.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},a=e||o.width||0,l=r||o.dash||"";i.select(this).call(s.stroke,n||o.color).call(p.dashLine,l,a)})},p.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=i.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(r){u.error(r,t),n.remove()}})};var m=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var g=p.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=g||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=n.line;if(a.traceIs(e,"symbols")){var o=d(e);t.attr("d",function(t){var r;r="various"===t.ms||"various"===n.size?3:h.isBubble(e)?o(t.ms):(n.size||6)/2,t.mrc=r;var i=p.symbolNumber(t.mx||n.symbol)||0,a=i%100;return t.om=i%200>=100,p.symbolFuncs[a](r)+(i>=200?y:"")}).style("opacity",function(t){return(t.mo+1||n.opacity+1)-1})}var l=(e._input||{}).marker||{},u=p.tryColorscale(n,l,""),c=p.tryColorscale(n,l,"line.");t.each(function(t){var e,o,a;t.so?(a=r.outlierwidth,o=r.outliercolor,e=n.outliercolor):(a=(t.mlw+1||r.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(r.color)?s.defaultLine:r.color,e="mc"in t?t.mcc=u(t.mc):Array.isArray(n.color)?s.defaultLine:n.color||"rgba(0,0,0,0)");var l=i.select(this);t.om?l.call(s.stroke,e).style({"stroke-width":(a||1)+"px",fill:"none"}):(l.style("stroke-width",a+"px").call(s.fill,e),a&&l.call(s.stroke,o))})}},p.tryColorscale=function(t,e,n){var r=u.nestedProperty(t,n+"color").get(),i=u.nestedProperty(t,n+"colorscale").get(),a=u.nestedProperty(t,n+"cauto").get(),s=u.nestedProperty(t,n+"cmin"),c=u.nestedProperty(t,n+"cmax"),f=s.get(),h=c.get();return i&&Array.isArray(r)?(!a&&o(f)&&o(h)||(f=1/0,h=-(1/0),r.forEach(function(t){o(t)&&(f>t&&(f=+t),t>h&&(h=+t))}),f>h&&(f=0,h=1),s.set(f),c.set(h),u.nestedProperty(e,n+"cmin").set(f),u.nestedProperty(e,n+"cmax").set(h)),l.makeScaleFunction(i,f,h)):u.identity};var v={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;p.textPointStyle=function(t,e){t.each(function(t){var n=i.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,s=-1!==a.indexOf("top")?"top":-1!==a.indexOf("bottom")?"bottom":"middle",l=-1!==a.indexOf("left")?"end":-1!==a.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,n.call(p.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(r).call(c.convertToTspans);var h=i.select(this.parentNode),d=n.selectAll("tspan.line"),m=((d[0].length||1)-1)*x+1,g=v[l]*f,y=.75*u+v[s]*f+(v[s]-1)*m*u/2;h.attr("transform","translate("+g+","+y+")"),m>1&&d.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,i="M"+t[0],o=[];for(n=1;nn;n++)a.push(r(t[n-1],t[n],t[n+1],e));for(a.push(r(t[o-1],t[o],t[0],e)),n=1;o>=n;n++)i+="C"+a[n-1][1]+" "+a[n][0]+" "+t[n];return i+="C"+a[o][1]+" "+a[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+i.round(e[0],2)+"V"+i.round(e[1],2)},vh:function(t,e){return"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},hvh:function(t,e){return"H"+i.round((t[0]+e[0])/2,2)+"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},vhv:function(t,e){return"V"+i.round((t[1]+e[1])/2,2)+"H"+i.round(e[0],2)+"V"+i.round(e[1],2)}},w=function(t,e){return"L"+i.round(e[0],2)+","+i.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var n="M"+i.round(t[0][0],2)+","+i.round(t[0][1],2),r=1;r=k&&(i.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),u.extendFlat({},l)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=i.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":289,"../../lib":296,"../../lib/svg_text_utils":307,"../../plots/plots":344,"../../traces/scatter/make_bubble_size_func":374,"../../traces/scatter/subtypes":379,"../color":219,"../colorscale":233,"./symbol_defs":243,d3:18,"fast-isnumeric":20}],243:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,i="l"+e+",-"+e,o="l-"+e+",-"+e,a="l-"+e+","+e;return"M0,"+e+n+i+o+i+o+a+o+a+n+a+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),i=r.round(-t,2),o=r.round(t*-.309,2),a=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+a+"H-"+n+"L-"+e+","+o+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+n+"V"+n+"L0,"+e+"L-"+i+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+i+"H"+n+"L"+e+",0L"+n+",-"+i+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),i=r.round(.951*e,2),o=r.round(.363*e,2),a=r.round(.588*e,2),s=r.round(-e,2),l=r.round(e*-.309,2),u=r.round(.118*e,2),c=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+l+"H"+i+"L"+o+","+u+"L"+a+","+c+"L0,"+f+"L-"+a+","+c+"L-"+o+","+u+"L-"+i+","+l+"H-"+n+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),i=r.round(.76*t,2);return"M-"+i+",0l-"+n+",-"+e+"h"+i+"l"+n+",-"+e+"l"+n+","+e+"h"+i+"l-"+n+","+e+"l"+n+","+e+"h-"+i+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),o=r.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+a+e+","+n+a+"0,-"+i+a+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),o=r.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+a+"-"+e+",-"+n+a+"0,"+i+a+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),i="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),i="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:18}],244:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],245:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},l=o.visible&&-1!==["linear","log"].indexOf(n.type),u=[];if(l){for(var c=s(o),f=0;fs;s++)a[s]={x:n[s],y:i[s]};return a[0].trace=t,r.calc({calcdata:[a],_fullLayout:e}),a},r.plot=t("./plot"),r.style=t("./style"),r.hoverInfo=function(t,e,n){(e.error_y||{}).visible&&(n.yerr=t.yh-t.y,e.error_y.symmetric||(n.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(n.xerr=t.xh-t.x,e.error_x.symmetric||(n.xerrneg=t.x-t.xs))}},{"./attributes":244,"./calc":245,"./defaults":247,"./plot":249,"./style":250}],249:[function(t,e,n){"use strict";function r(t,e,n){var r={x:e.c2p(t.x),y:n.c2p(t.y)};return void 0!==t.yh&&(r.yh=n.c2p(t.yh),r.ys=n.c2p(t.ys),o(r.ys)||(r.noYS=!0,r.ys=n.c2p(t.ys,!0))),void 0!==t.xh&&(r.xh=e.c2p(t.xh),r.xs=e.c2p(t.xs),o(r.xs)||(r.noXS=!0,r.xs=e.c2p(t.xs,!0))),r}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../lib"),s=t("../../traces/scatter/subtypes");e.exports=function(t,e){var n=e.x(),l=e.y();t.each(function(t){var e=t[0].trace,u=e.error_x||{},c=e.error_y||{},f=s.hasMarkers(e)&&e.marker.maxdisplayed>0;if(c.visible||u.visible){var h=i.select(this).selectAll("g.errorbar").data(a.identity);h.enter().append("g").classed("errorbar",!0),h.each(function(t){var e=i.select(this),a=r(t,n,l);if(!f||t.vis){var s;if(c.visible&&o(a.x)&&o(a.yh)&&o(a.ys)){var h=c.width;s="M"+(a.x-h)+","+a.yh+"h"+2*h+"m-"+h+",0V"+a.ys,a.noYS||(s+="m-"+h+",0h"+2*h),e.append("path").classed("yerror",!0).attr("d",s)}if(u.visible&&o(a.y)&&o(a.xh)&&o(a.xs)){var d=(u.copy_ystyle?c:u).width;s="M"+a.xh+","+(a.y-d)+"v"+2*d+"m0,-"+d+"H"+a.xs,a.noXS||(s+="m0,-"+d+"v"+2*d),e.append("path").classed("xerror",!0).attr("d",s)}}})}})}},{"../../lib":296,"../../traces/scatter/subtypes":379,d3:18,"fast-isnumeric":20}],250:[function(t,e,n){"use strict";var r=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},a=r.select(this);a.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(i.stroke,n.color),o.copy_ystyle&&(o=n),a.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(i.stroke,o.color)})}},{"../color":219,d3:18}],251:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":322}],252:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,a,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var s=0;2>s;s++){var l={_fullLayout:n},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,i=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],256:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":295,"../../plots/font_attributes":335,"../color/attributes":218}],257:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],258:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../plots/plots"),o=t("./attributes"),a=t("./helpers");e.exports=function(t,e,n){function s(t,e){return r.coerce(h,d,o,t,e)}for(var l,u,c,f,h=t.legend||{},d=e.legend={},p=0,m="normal",g=0;g1);if(v!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),r.coerceFont(s,"font",e.font),s("orientation"),"h"===d.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(l=0,c="left",u=1.1,f="bottom"):(l=0,c="left",u=-.1,f="top")}s("traceorder",m),a.isGrouped(e.legend)&&s("tracegroupgap"),s("x",l),s("xanchor",c),s("y",u),s("yanchor",f),r.noneOrAll(h,d,["x","y"])}}},{"../../lib":296,"../../plots/plots":344,"./attributes":256,"./helpers":261}],259:[function(t,e,n){"use strict";function r(t,e){function n(n){c.util.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],i=e._fullLayout,a=r.trace,s=h.traceIs(a,"pie"),l=a.index,u=s?r.label:a.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,i.legend.font).text(u),e._context.editable&&!s?f.call(c.util.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" "),c.restyle(e,"name",t,l)}):f.call(n)}function i(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,i,o=t.data()[0][0],a=e._fullData,s=o.trace,l=s.legendgroup,u=[];if(h.traceIs(s,"pie")){var f=o.label,d=n.indexOf(f);-1===d?n.push(f):n.splice(d,1),c.relayout(e,"hiddenlabels",n)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),d=h[0].length||1;n=l*d,r=c.node()&&p.bBox(c.node()).width;var m=l*(.3+(1-d)/2);c.attr("y",m),h.attr("y",m)}n=Math.max(n,16)+3,o.attr({x:0,y:-n/2,height:n}),i.height=n,i.width=r}function a(t,e,n){var r=t._fullLayout,i=r.legend,o=i.borderwidth,a=x.isGrouped(i);if(x.isVertical(i))a&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+i.height+n/2),i.height+=n,i.width=Math.max(i.width,r)}),i.width+=45+2*o,i.height+=10+2*o,a&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),n.selectAll(".legendtoggle").attr("width",(t._context.editable?0:i.width)+40),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height);else if(a){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;h>c;c++){var d=l[c].map(function(t){return t[0].width}),p=40+Math.max.apply(null,d);i.width+=i.tracegroupgap+p,s.push(i.width)}e.each(function(t,e){f.setTranslate(this,s[e],0)}),e.each(function(){var t=u.select(this),e=t.selectAll("g.traces"),n=0;e.each(function(t){var e=t[0],r=e.height;f.setTranslate(this,0,5+o+n+r/2),n+=r}),i.height=Math.max(i.height,n)}),i.height+=10+2*o,i.width+=2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}else{i.width=0,i.height=0;var m=0,g=0,y=0,v=0;n.each(function(t){y=Math.max(40+t[0].width,y)}),n.each(function(t){var e=t[0],n=y,a=i.tracegroupgap||5; +o+v+a+n>r.width-(r.margin.r+r.margin.l)&&(v=0,m+=g,i.height=i.height+g,g=0),f.setTranslate(this,o+v,5+o+e.height/2+m),i.width+=a+n,i.height=Math.max(i.height,e.height),v+=a+n,g=Math.max(e.height,g)}),i.width+=2*o,i.height+=10+2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}}function s(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center");var i="top";b.isBottomAnchor(n)?i="bottom":b.isMiddleAnchor(n)&&(i="middle"),h.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[i]||0),t:n.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center"),h.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../dragelement"),p=t("../drawing"),m=t("../color"),g=t("./constants"),y=t("./get_legend_data"),v=t("./style"),x=t("./helpers"),b=t("./anchor_utils");e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(f.setTranslate,0,e),T.call(p.setRect,R,t,g.scrollBarWidth,g.scrollBarHeight),k.select("rect").attr({y:x.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var x=n.legend,_=n.showlegend&&y(t.calcdata,x),w=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void h.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({"class":"legend","pointer-events":"all"});var k=n._topdefs.selectAll("#"+o).data([0]);k.enter().append("clipPath").attr("id",o).append("rect");var A=M.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(m.stroke,x.bordercolor),A.call(m.fill,x.bgcolor),A.style("stroke-width",x.borderwidth+"px");var S=M.selectAll("g.scrollbox").data([0]);S.enter().append("g").attr("class","scrollbox");var T=M.selectAll("rect.scrollbar").data([0]);T.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var z=S.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var E=z.selectAll("g.traces").data(f.identity);E.enter().append("g").attr("class","traces"),E.exit().remove(),E.call(v).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(i,t)});var L=0!==M.enter().size();L&&(a(t,z,E),s(t));var I=0,P=n.width,D=0,C=n.height;a(t,z,E),x.height>C?l(t):s(t);var O=n._size,j=O.l+O.w*x.x,F=O.t+O.h*(1-x.y);b.isRightAnchor(x)?j-=x.width:b.isCenterAnchor(x)&&(j-=x.width/2),b.isBottomAnchor(x)?F-=x.height:b.isMiddleAnchor(x)&&(F-=x.height/2);var R=x.width,N=O.w;R>N?(j=O.l,R=N):(j+R>P&&(j=P-R),I>j&&(j=I),R=Math.min(P-j,x.width));var B=x.height,q=O.h;B>q?(F=O.t,B=q):(F+B>C&&(F=C-B),D>F&&(F=D),B=Math.min(C-F,x.height)),f.setTranslate(M,j,F);var V,U,Z=B-g.scrollBarHeight-2*g.scrollBarMargin,G=x.height-B;if(x.height<=B||t._context.staticPlot)A.attr({width:R-x.borderwidth,height:B-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),f.setTranslate(S,0,0),k.select("rect").attr({width:R-2*x.borderwidth,height:B-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth}),S.call(p.setClipUrl,o);else{V=g.scrollBarMargin,U=S.attr("data-scroll")||0,A.attr({width:R-2*x.borderwidth+g.scrollBarWidth+g.scrollBarMargin,height:B-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),k.select("rect").attr({width:R-2*x.borderwidth+g.scrollBarWidth+g.scrollBarMargin,height:B-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth-U}),S.call(p.setClipUrl,o),L&&e(V,U),M.on("wheel",null),M.on("wheel",function(){U=f.constrain(S.attr("data-scroll")-u.event.deltaY/Z*G,-G,0),V=g.scrollBarMargin-U/G*Z,e(V,U),u.event.preventDefault()}),T.on(".drag",null),S.on(".drag",null);var H=u.behavior.drag().on("drag",function(){V=f.constrain(u.event.y-g.scrollBarHeight/2,g.scrollBarMargin,g.scrollBarMargin+Z),U=-(V-g.scrollBarMargin)/Z*G,e(V,U)});T.call(H),S.call(H)}if(t._context.editable){var X,Y,W,Q;M.classed("cursor-move",!0),d.init({element:M.node(),prepFn:function(){var t=f.getTranslate(M);W=t.x,Q=t.y},moveFn:function(t,e){var n=W+t,r=Q+e;f.setTranslate(M,n,r),X=d.align(n,0,O.l,O.l+O.w,x.xanchor),Y=d.align(r,0,O.t+O.h,O.t,x.yanchor)},doneFn:function(e){e&&void 0!==X&&void 0!==Y&&c.relayout(t,{"legend.x":X,"legend.y":Y})}})}}}},{"../../lib":296,"../../plotly":314,"../../plots/plots":344,"../color":219,"../dragelement":240,"../drawing":242,"./anchor_utils":255,"./constants":257,"./get_legend_data":260,"./helpers":261,"./style":263,d3:18}],260:[function(t,e,n){"use strict";var r=t("../../plots/plots"),i=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[n]]):s[t].push([n]);else{var r="~~i"+f;l.push(r),s[r]=[[n]],f++}}var o,a,s={},l=[],u=!1,c={},f=0;for(o=0;oo;o++)y=s[l[o]],v[o]=i.isReversed(e)?y.reverse():y;else{for(v=[new Array(x)],o=0;x>o;o++)y=s[l[o]][0],v[0][i.isReversed(e)?x-o-1:o]=y;x=1}return e._lgroupsLength=x,v}},{"../../plots/plots":344,"./helpers":261}],261:[function(t,e,n){"use strict";var r=t("../../plots/plots");n.legendGetsTrace=function(t){return t.visible&&r.traceIs(t,"showLegend")},n.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},n.isVertical=function(t){return"h"!==t.orientation},n.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":344}],262:[function(t,e,n){"use strict";var r=e.exports={};r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw"),r.style=t("./style")},{"./attributes":256,"./defaults":258,"./draw":259,"./style":263}],263:[function(t,e,n){"use strict";function r(t){var e=t[0].trace,n=e.visible&&e.fill&&"none"!==e.fill,r=d.hasLines(e),i=l.select(this).select(".legendfill").selectAll("path").data(n?[t]:[]);i.enter().append("path").classed("js-fill",!0),i.exit().remove(),i.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var o=l.select(this).select(".legendlines").selectAll("path").data(r?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(f.lineGroupStyle)}function i(t){function e(t,e,n){var r=u.nestedProperty(a,t).get(),i=Array.isArray(r)&&e?e(r):r;if(n){if(in[1])return n[1]}return i}function n(t){return t[0]}var r,i,o=t[0],a=o.trace,s=d.hasMarkers(a),c=d.hasText(a),h=d.hasLines(a);if(s||c||h){var p={},m={};s&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(m.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],i=u.minExtend(a,m)}var g=l.select(this).select("g.legendpoints"),y=g.selectAll("path.scatterpts").data(s?r:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(f.pointStyle,i),s&&(r[0].mrc=3);var v=g.selectAll("g.pointtext").data(c?r:[]);v.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),v.exit().remove(),v.selectAll("text").call(f.textPointStyle,i)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||r.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||n.color),e&&i.call(h.stroke,t.mlc||r.color)})}function a(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=l.select(this);r.style("stroke-width",n+"px").call(h.fill,t.fc||e.fillcolor),n&&r.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var l=t("d3"),u=t("../../lib"),c=t("../../plots/plots"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(a).each(s).each(r).each(i)}},{"../../lib":296,"../../plots/plots":344,"../../traces/pie/style_one":358,"../../traces/scatter/subtypes":379,"../color":219,"../drawing":242,d3:18}],264:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),i=n.getAttribute("data-val")||!0,o=t._fullLayout,a={};if("zoom"===r){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,h=(1-c)/2,d=u.Axes.list(t,null,!0),p=0;pv;v++){var x=s[v];h=y[x]={};for(var b=0;b1)return r(["resetViews","toggleHover"]),a(g,n);c&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),h&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var y=i(s),v=[];return((u||p)&&!y||m)&&(v=["zoom2d","pan2d"]),(u||m)&&o(l)&&(v.push("select2d"),v.push("lasso2d")),v.length&&r(v),!u&&!p||y||m||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):u?r(["hoverClosestCartesian","hoverCompareCartesian"]):d&&r(["hoverClosestPie"]),a(g,n)}function i(t){for(var e=l.Axes.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var m=i(e,n,l);c("x",m[0]),c("y",m[1]),o.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),o.coerceFont(c,"font",n.font);var g=c("bgcolor");c("activecolor",a.contrast(g,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":296,"../color":219,"./attributes":267,"./button_attributes":268,"./constants":269}],271:[function(t,e,n){"use strict";function r(t){for(var e=y.list(t,"x",!0),n=[],r=0;re){var n=e;e=t,t=n}s.setAttributes(w,{"data-min":t,"data-max":e}),s.setAttributes(D,{x:t,width:e-t}),s.setAttributes(A,{width:t}),s.setAttributes(S,{x:e,width:p-e}),s.setAttributes(T,{transform:"translate("+(t-g-1)+")"}),s.setAttributes(L,{transform:"translate("+e+")"})}var f=t._fullLayout,h=f._infolayer.selectAll("g.range-slider"),d=f.xaxis.rangeslider,p=f._size.w,m=(f.height-f.margin.b-f.margin.t)*d.thickness,g=2,y=Math.floor(d.borderwidth/2),v=f.margin.l,x=f.height-m-f.margin.b,b=0,_=p,w=document.createElementNS(a,"g");s.setAttributes(w,{"class":"range-slider","data-min":b,"data-max":_,"pointer-events":"all",transform:"translate("+v+","+x+")"});var M=document.createElementNS(a,"rect"),k=d.borderwidth%2===0?d.borderwidth:d.borderwidth-1;s.setAttributes(M,{fill:d.bgcolor,stroke:d.bordercolor,"stroke-width":d.borderwidth,height:m+k,width:p+k,transform:"translate(-"+y+", -"+y+")","shape-rendering":"crispEdges"});var A=document.createElementNS(a,"rect");s.setAttributes(A,{x:0,width:b,height:m,fill:"rgba(0,0,0,0.4)"});var S=document.createElementNS(a,"rect");s.setAttributes(S,{x:_,width:p-_,height:m,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(a,"g"),z=document.createElementNS(a,"rect"),E=document.createElementNS(a,"rect");s.setAttributes(T,{transform:"translate("+(b-g-1)+")"}),s.setAttributes(z,{width:10,height:m,x:-6,fill:"transparent",cursor:"col-resize"}),s.setAttributes(E,{width:g,height:m/2,y:m/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(T,[E,z]);var L=document.createElementNS(a,"g"),I=document.createElementNS(a,"rect"),P=document.createElementNS(a,"rect");s.setAttributes(L,{transform:"translate("+_+")"}),s.setAttributes(I,{width:10,height:m,x:-2,fill:"transparent",cursor:"col-resize"}),s.setAttributes(P,{width:g,height:m/2,y:m/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(L,[P,I]);var D=document.createElementNS(a,"rect");s.setAttributes(D,{x:b,width:_-b,height:m,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function n(t){var n,r,f=+t.clientX-o;switch(i){case D:w.style.cursor="ew-resize",n=+s+f,r=+l+f,c(n,r),u(e(n),e(r));break;case z:w.style.cursor="col-resize",n=+s+f,r=+l,c(n,r),u(e(n),e(r));break;case I:w.style.cursor="col-resize",n=+s,r=+l+f,c(n,r), +u(e(n),e(r));break;default:w.style.cursor="ew-resize",n=a,r=a+f,c(n,r),u(e(n),e(r))}}function r(){window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r),w.style.cursor="auto"}var i=t.target,o=t.clientX,a=o-w.getBoundingClientRect().left,s=w.getAttribute("data-min"),l=w.getAttribute("data-max");window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)}),d.range||(d.range=i.getAutoRange(f.xaxis));var C=l(t,p,m);s.appendChildren(w,[M,C,A,S,D,T,L]),n(f.xaxis.range[0],f.xaxis.range[1]),h.data([0]).enter().append(function(){return d.setRange=n,w})}},{"../../constants/xmlns_namespaces":289,"../../lib":296,"../../plotly":314,"../../plots/cartesian/axes":317,"./helpers":277,"./range_plot":279}],276:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("./attributes");e.exports=function(t,e,n,o){function a(t,e){return r.coerce(s,l,i,t,e)}if(t[n].rangeslider){var s=r.isPlainObject(t[n].rangeslider)?t[n].rangeslider:{},l=e[n].rangeslider={};if(a("bgcolor"),a("bordercolor"),a("borderwidth"),a("thickness"),a("visible"),a("range"),l.range&&!e[n].autorange){var u=l.range,c=e[n].range;u[0]=Math.min(u[0],c[0]),u[1]=Math.max(u[1],c[1])}else e[n]._needsExpand=!0;l.visible&&o.forEach(function(t){var n=e[t]||{};n.fixedrange=!0,e[t]=n})}}},{"../../lib":296,"./attributes":274}],277:[function(t,e,n){"use strict";n.setAttributes=function(t,e){for(var n in e)t.setAttribute(n,e[n])},n.appendChildren=function(t,e){for(var n=0;nl;l++){var u=s[l],c={_fullLayout:e},f=A.coerceRef(t,r,c,u);if("path"!==a){var h=.25,d=.75;if("paper"!==f){var p=A.getFromId(c,f),m=o(p);h=m(p.range[0]+h*(p.range[1]-p.range[0])),d=m(p.range[0]+d*(p.range[1]-p.range[0]))}n(u+"0",h),n(u+"1",d)}}return"path"===a?n("path"):k.noneOrAll(t,r,["x0","x1","y0","y1"]),r}function i(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function a(t,e){t.layout.shapes=e,L.supplyLayoutDefaults(t.layout,t._fullLayout),L.drawAll(t)}function s(t){delete t.layout.shapes,t._fullLayout.shapes=[],L.drawAll(t)}function l(t,e,n){for(var r=0;re;i--)d(t,i).selectAll('[data-index="'+(i-1)+'"]').attr("data-index",i),L.draw(t,i)}function f(t,e,n,a){function s(n){var r={"data-index":e,"fill-rule":"evenodd",d:x(t,L)},i=L.line.width?L.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",L.opacity).call(S.stroke,i).call(S.fill,L.fillcolor).call(T.dashLine,L.line.dash,L.line.width);I&&o.call(T.setClipUrl,"clip"+t._fullLayout._uid+I),t._context.editable&&h(t,o,L,e)}var l,u;d(t,e).selectAll('[data-index="'+e+'"]').remove();var c=t.layout.shapes[e];if(c){var f={xref:c.xref,yref:c.yref},m={};"string"==typeof n&&n?m[n]=a:k.isPlainObject(n)&&(m=n);var g=Object.keys(m);for(l=0;ll;l++){var b=v[l];if(void 0===m[b]&&void 0!==c[b]){var _,w=b.charAt(0),M=A.getFromId(t,A.coerceRef(f,{},t,w)),z=A.getFromId(t,A.coerceRef(c,{},t,w)),E=c[b];void 0!==m[w+"ref"]&&(M?(_=i(M)(E),E=(_-M.range[0])/(M.range[1]-M.range[0])):E=(E-z.domain[0])/(z.domain[1]-z.domain[0]),z?(_=z.range[0]+E*(z.range[1]-z.range[0]),E=o(z)(_)):E=M.domain[0]+E*(M.domain[1]-M.domain[0])),c[b]=E}}var L=r(c,t._fullLayout);t._fullLayout.shapes[e]=L;var I;if("below"!==L.layer)I=(L.xref+L.yref).replace(/paper/g,""),s(t._fullLayout._shapeUpperLayer);else if("paper"===L.xref&&"paper"===L.yref)I="",s(t._fullLayout._shapeLowerLayer);else{var P,D=t._fullLayout._plots||{},C=Object.keys(D);for(l=0,u=C.length;u>l;l++)P=D[C[l]],I=C[l],p(t,L,P)&&s(P.shapelayer)}}}function h(t,e,n,r){function i(t){var n=J.right-J.left,r=J.bottom-J.top,i=t.clientX-J.left,o=t.clientY-J.top,a=n>Y&&r>W&&!t.shiftKey?z.getCursor(i/n,1-o/r):"move";E(e,a),X=a.split("-")[0]}function o(e){q=A.getFromId(t,n.xref),V=A.getFromId(t,n.yref),U=y(t,q),Z=y(t,V,!0),G=v(t,q),H=v(t,V,!0);var o="shapes["+r+"]";"path"===n.type?(N=n.path,B=o+".path"):(c=U(n.x0),f=Z(n.y0),h=U(n.x1),d=Z(n.y1),p=o+".x0",m=o+".y0",_=o+".x1",w=o+".y1"),h>c?(T=c,D=o+".x0",F="x0",L=h,C=o+".x1",R="x1"):(T=h,D=o+".x1",F="x1",L=c,C=o+".x0",R="x0"),d>f?(k=f,I=o+".y0",O="y0",S=d,P=o+".y1",j="y1"):(k=d,I=o+".y1",O="y1",S=f,P=o+".y0",j="y0"),u={},i(e),Q.moveFn="move"===X?s:l}function a(n){E(e),n&&M.relayout(t,u)}function s(r,i){if("path"===n.type){var o=function(t){return G(U(t)+r)};q&&"date"===q.type&&(o=g(o));var a=function(t){return H(Z(t)+i)};V&&"date"===V.type&&(a=g(a)),n.path=b(N,o,a),u[B]=n.path}else u[p]=n.x0=G(c+r),u[m]=n.y0=H(f+i),u[_]=n.x1=G(h+r),u[w]=n.y1=H(d+i);e.attr("d",x(t,n))}function l(r,i){if("path"===n.type){var o=function(t){return G(U(t)+r)};q&&"date"===q.type&&(o=g(o));var a=function(t){return H(Z(t)+i)};V&&"date"===V.type&&(a=g(a)),n.path=b(N,o,a),u[B]=n.path}else{var s=~X.indexOf("n")?k+i:k,l=~X.indexOf("s")?S+i:S,c=~X.indexOf("w")?T+r:T,f=~X.indexOf("e")?L+r:L;l-s>W&&(u[I]=n[O]=H(s),u[P]=n[j]=H(l)),f-c>Y&&(u[D]=n[F]=G(c),u[C]=n[R]=G(f))}e.attr("d",x(t,n))}var u,c,f,h,d,p,m,_,w,k,S,T,L,I,P,D,C,O,j,F,R,N,B,q,V,U,Z,G,H,X,Y=10,W=10,Q={setCursor:i,element:e.node(),prepFn:o,doneFn:a},J=Q.element.getBoundingClientRect();z.init(Q)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):k.log("getShapeLayer: undefined shape: index",e),r}function p(t,e,n){var r=M.Axes.getFromId(t,n.id,"x")._id,i=M.Axes.getFromId(t,n.id,"y")._id,o="below"===e.layer,a=r===e.xref||i===e.yref,s=!!n.shapelayer;return o&&a&&s}function m(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function g(t){return function(e){return t(e).replace(" ","_")}}function y(t,e,n){var r,o=t._fullLayout._size;if(e){var a=i(e);r=function(t){return e._offset+e.l2p(a(t,!0))},"date"===e.type&&(r=m(r))}else r=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return r}function v(t,e,n){var r,i=t._fullLayout._size;if(e){var a=o(e);r=function(t){return a(e.p2l(t-e._offset))}}else r=n?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return r}function x(t,e){var n,r,o,a,s=e.type,l=A.getFromId(t,e.xref),u=A.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=i(l),r=function(t){return l._offset+l.l2p(n(t,!0))}):r=function(t){return c.l+c.w*t},u?(o=i(u),a=function(t){return u._offset+u.l2p(o(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===s)return l&&"date"===l.type&&(r=m(r)),u&&"date"===u.type&&(a=m(a)),L.convertPath(e.path,r,a);var f=r(e.x0),h=r(e.x1),d=a(e.y0),p=a(e.y1);if("line"===s)return"M"+f+","+d+"L"+h+","+p;if("rect"===s)return"M"+f+","+d+"H"+h+"V"+p+"H"+f+"Z";var g=(f+h)/2,y=(d+p)/2,v=Math.abs(g-f),x=Math.abs(y-d),b="A"+v+","+x,_=g+v+","+y,w=g+","+(y-x);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function b(t,e,n){return t.replace(I,function(t){var r=0,i=t.charAt(0),o=D[i],a=C[i],s=O[i],l=t.substr(1).replace(P,function(t){return r>=s?t:(o[r]?t=e(t):a[r]&&(t=n(t)),r++,t)});return i+l})}function _(t,e,n,r,i){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(n)];if(r){var a,s,l,u,c,f=1/0,h=-(1/0),d=r.match(I);for("date"===t.type&&(o=m(o)),a=0;ac&&(f=c),c>h&&(h=c)));return h>=f?[f,h]:void 0}}var w=t("fast-isnumeric"),M=t("../../plotly"),k=t("../../lib"),A=t("../../plots/cartesian/axes"),S=t("../color"),T=t("../drawing"),z=t("../dragelement"),E=t("../../lib/setcursor"),L=e.exports={};L.layoutAttributes=t("./attributes"),L.supplyLayoutDefaults=function(t,e){for(var n=t.shapes||[],i=e.shapes=[],o=0;os&&(t="X"),t});return r>s&&(l=l.replace(/[\s,]*X.*/,""),k.log("Ignoring extra params in segment "+t)),i+l})},L.calcAutorange=function(t){var e,n,r,i,o,a=t._fullLayout,s=a.shapes;if(s.length&&t._fullData.length)for(e=0;eh?n=h:(c.left-=x.offsetLeft,c.right-=x.offsetLeft,c.top-=x.offsetTop,c.bottom-=x.offsetTop,x.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(n=Math.max(n,a*(t[x.side]-c[o])+u))}),n=Math.min(h,n)),n>0||0>h){var d={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){T=0,z=!0,E=I,M._infolayer.select("."+e).attr({"data-unformatted":E}).text(E).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var m=n.propContainer,g=n.propName,y=n.traceIndex,v=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,M=t._fullLayout,k=m.titlefont.family,A=m.titlefont.size,S=m.titlefont.color,T=1,z=!1,E=m.title.trim();""===E&&(T=0),E.match(/Click to enter .+ title/)&&(T=.2,z=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var L=w.selectAll("text").data([0]);L.enter().append("text"),L.text(E).attr("class",e),L.attr({"data-unformatted":E}).call(f);var I="Click to enter "+v+" title";t._context.editable?(E||p(),L.call(c.makeEditable).on("edit",function(e){void 0!==y?o.restyle(t,g,e,y):o.relayout(t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):E&&!E.match(/Click to enter .+ title/)||L.remove(),L.classed("js-placeholder",z)}},{"../../lib":296,"../../lib/svg_text_utils":307,"../../plotly":314,"../../plots/plots":344,"../color":219,"../drawing":242,d3:18,"fast-isnumeric":20}],283:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat,a={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:a,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":295,"../../plots/font_attributes":335,"../color/attributes":218}],284:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],285:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,a,n,r)}var s=i(t,e),l=r("visible",s.length>0);l&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function i(t,e){function n(t,e){return o.coerce(r,i,u,t,e)}for(var r,i,a=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&y(t),0!==n.length){var u=l.selectAll("g."+S.headerGroupClassName).data(n,i);u.enter().append("g").classed(S.headerGroupClassName,!0);var c=l.selectAll("g."+S.buttonGroupClassName).data([0]);c.enter().append("g").classed(S.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(g).attr(S.menuIndexAttrName,"-1"),u.exit().each(function(e){v.select(this).remove(),c.call(g).attr(S.menuIndexAttrName,"-1"),b.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],289:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],290:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.16.3",n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=r.register,n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=r.Snapshot,n.PlotSchema=r.PlotSchema,n.Queue=r.Queue,n.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":311,"./plot_api/to_image":312,"./plot_api/validate":313,"./plotly":314,"./snapshot/download":352,d3:18}],291:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],292:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("tinycolor2"),o=t("./nested_property"),a=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)}},"boolean":{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,i){!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,i){t%1||!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var i="number"==typeof t;r.strict!==!0&&i?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){i(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(a(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n?!0:"string"!=typeof t?!1:!(t.substr(0,r)!==n||!s.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),o=0;o2)return!1;var l=a[0].split("-");if(l.length>3||3!==l.length&&a[1])return!1;if(4===l[0].length)n=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();n=((Number(l[0])-u+70)%100+200)%100+u-70}return s(n)?1===l.length?new Date(n,0,1).getTime():(r=Number(l[1])-1,l[1].length>2||!(r>=0&&11>=r)?!1:2===l.length?new Date(n,r,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(n,r,i).getTime(),a[1]?(l=a[1].split(":"),l.length>3?!1:(o=Number(l[0]),l[0].length>2||!(o>=0&&23>=o)?!1:(i+=36e5*o,1===l.length?i:(r=Number(l[1]),l[1].length>2||!(r>=0&&59>=r)?!1:(i+=6e4*r,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){if("undefined"==typeof a)return void l.error("d3 is not defined.");e||(e=0);var n=new Date(t),i=a.time.format("%Y-%m-%d")(n);return 7776e6>e?(i+=" "+r(n.getHours(),2),432e6>e&&(i+=":"+r(n.getMinutes(),2),108e5>e&&(i+=":"+r(n.getSeconds(),2),3e5>e&&(i+="."+r(n.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={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"]},c={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"]},f=a.time.format.utc,h={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){h[t].D.push(f(e)),["H","I","D"].forEach(function(n){u[n].forEach(function(r){var i=h[t][n];i.push(f(e+"~"+r)),i.push(f(r+"~"+e))})})})});var d=/[a-z]*/g,p=function(t){return t.substr(0,3)},m=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,y=/~?([ap])~?m(~|$)/,v=function(t,e){return e+"m "},x=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,M=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return k[e-1]},S=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){ +if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,p).replace(m,"").replace(g,"~").replace(y,v).replace(M,A).trim().replace(S,"");var e,n,r=null,a=i(t),s=o(t);e=h[a][s],n=e.length;for(var l=0;n>l&&!(r=e[l].parse(t));l++);if(!(r instanceof Date))return!1;var u=r.getTimezoneOffset();return r.setTime(r.getTime()+60*u*1e3),r}},{"../lib":296,d3:18,"fast-isnumeric":20}],294:[function(t,e,n){"use strict";var r=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof r)return t;var e=new r;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(n,r){"undefined"!=typeof jQuery&&jQuery(t).trigger(n,r),e.emit(n,r)},t},triggerHandler:function(t,e,n){var r,i;"undefined"!=typeof jQuery&&(r=jQuery(t).triggerHandler(e,n));var o=t._ev;if(!o)return r;var a=o._events[e];if(!a)return r;"function"==typeof a&&(a=[a]);for(var s=a.pop(),l=0;ly;y++){l=t[y];for(u in l)c=m[u],f=l[u],s&&a(f)?m[u]=f:e&&f&&(o(f)||(h=a(f)))?(h?(h=!1,d=c&&a(c)?c:[]):d=c&&o(c)?c:{},m[u]=i([d,f],e,n,s)):("undefined"!=typeof f||n)&&(m[u]=f)}return m}var o=t("./is_plain_object.js"),a=Array.isArray;n.extendFlat=function(){return i(arguments,!1,!1,!1)},n.extendDeep=function(){return i(arguments,!0,!1,!1)},n.extendDeepAll=function(){return i(arguments,!0,!0,!1)},n.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":297}],296:[function(t,e,n){"use strict";var r=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var o=t("./coerce");i.valObjects=o.valObjects,i.coerce=o.coerce,i.coerce2=o.coerce2,i.coerceFont=o.coerceFont,i.validate=o.validate;var a=t("./dates");i.dateTime2ms=a.dateTime2ms,i.isDateTime=a.isDateTime,i.ms2DateTime=a.ms2DateTime,i.parseDate=a.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var f=t("./loggers");i.log=f.log,i.warn=f.warn,i.error=f.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,n,r){n||(n="x"),r||(r="y");for(var o=0;on?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},i.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},i.identity=function(t){return t},i.randstr=function h(t,e,n){if(n||(n=16),void 0===e&&(e=24),0>=e)return"0";var r,i,o,a=Math.log(Math.pow(2,e))/Math.log(n),s="";for(r=2;a===1/0;r*=2)a=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var l=a-Math.floor(a);for(r=0;r-1||u!==1/0&&u>=Math.pow(2,e)?h(t,e,n):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var n,r,i,o,a=t.length,s=2*a,l=2*e-1,u=new Array(l),c=new Array(a);for(n=0;l>n;n++)u[n]=(1-Math.cos(Math.PI*(n+1)/e))/(2*e);for(n=0;a>n;n++){for(o=0,r=0;l>r;r++)i=n+r+1-e,-a>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=a&&(i=s-1-i),o+=t[i]*u[r];c[n]=o}return c},i.syncOrAsync=function(t,e,n){function r(){return i.syncOrAsync(t,e,n)}for(var o,a;t.length;)if(a=t.splice(0,1)[0],o=a(e),o&&o.then)return o.then(r).then(void 0,i.promiseError);return n&&n(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,n){if(t){var r,i,o=!1,a=!0;for(r=0;ri;i++)e[i][n]=t[i]},i.minExtend=function(t,e){var n={};"object"!=typeof e&&(e={});var r,o,a,s=3,l=Object.keys(t);for(r=0;r1?r+o[1]:"";if(i&&(o.length>1||a.length>4))for(;n.test(a);)a=a.replace(n,"$1"+i+"$2");return a+s}},{"./coerce":292,"./dates":293,"./extend":295,"./is_plain_object":297,"./loggers":298,"./matrix":299,"./nested_property":300,"./notifier":301,"./search":304,"./stats":306,d3:18}],297:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],298:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;er;r++)n[r]=new Array(e);return n},n.transposeRagged=function(t){var e,n,r=0,i=t.length;for(e=0;i>e;e++)r=Math.max(r,t[e].length);var o=new Array(r);for(e=0;r>e;e++)for(o[e]=new Array(i),n=0;i>n;n++)o[e][n]=t[n][e];return o},n.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var r,i,o=t.length;if(t[0].length)for(r=new Array(o),i=0;o>i;i++)r[i]=n.dot(t[i],e);else if(e[0].length){var a=n.transposeRagged(e);for(r=new Array(a.length),i=0;ii;i++)r+=t[i]*e[i];return r},n.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},n.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},n.rotationXYMatrix=function(t,e,r){return n.dot(n.dot(n.translationMatrix(e,r),n.rotationMatrix(t)),n.translationMatrix(-e,-r))},n.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var r=1===arguments.length?e[0]:[e[0],e[1]];return n.dot(t,[r[0],r[1],1]).slice(0,2)}},n.apply2DTransform2=function(t){var e=n.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],300:[function(t,e,n){"use strict";function r(t,e){return function(){var n,i,o,a,s,l=t;for(a=0;a=0;e--){if(r=t[e],a=!1,Array.isArray(r))for(n=r.length-1;n>=0;n--)u(r[n])?a?r[n]=void 0:r.pop():a=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),a=!1,n=o.length-1;n>=0;n--)u(r[o[n]])&&!i(r[o[n]],o[n])?delete r[o[n]]:a=!0;if(a)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,i,a,s=0,l=e.split(".");sn||n>o||a>r||r>s?!1:!e||!u(t)}function n(t,e){var n=t[0],l=t[1];if(i>n||n>o||a>l||l>s)return!1;var u,c,f,h,d,p=r.length,m=r[0][0],g=r[0][1],y=0;for(u=1;p>u;u++)if(c=m,f=g,m=r[u][0],g=r[u][1],h=Math.min(c,m),!(h>n||n>Math.max(c,m)||l>Math.max(f,g)))if(l=l&&n!==h&&y++}return y%2===1}var r=t.slice(),i=r[0][0],o=i,a=r[0][1],s=a;r.push(r[0]);for(var l=1;lo;o++)if(a=[t[o][0]-l[0],t[o][1]-l[1]],s=r(a,u),0>s||s>c||Math.abs(r(a,h))>i)return!0;return!1};i.filter=function(t,e){function n(n){t.push(n);var s=r.length,l=i;r.splice(a+1);for(var u=l+1;u1){var s=t.pop();n(s)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":299}],303:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},a.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},a.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},a.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;nt}function i(t,e){return e>=t}function o(t,e){return t>e}function a(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");n.findBin=function(t,e,n){if(s(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?n?r:i:n?a:o;h>f&&d++<100;)u=Math.floor((f+h)/2),c(e[u],t)?f=u+1:h=u;return d>90&&l.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,i=e[r]-e[0]||1,o=i/(r||1)/1e4,a=[e[0]],s=0;r>s;s++)e[s+1]>e[s]+o&&(i=Math.min(i,e[s+1]-e[s]),a.push(e[s+1]));return{vals:a,minDiff:i}},n.roundUp=function(t,e,n){for(var r,i=0,o=e.length-1,a=0,s=n?0:1,l=n?1:0,u=n?Math.ceil:Math.floor;o>i&&a++<100;)r=u((i+o)/2),e[r]<=t?i=r+s:o=r-l;return e[i]}},{"../lib":296,"fast-isnumeric":20}],305:[function(t,e,n){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],306:[function(t,e,n){"use strict";var r=t("fast-isnumeric");n.aggNums=function(t,e,i,o){var a,s;if(o||(o=i.length),r(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(o),a=0;o>a;a++)s[a]=n.aggNums(t,e,i[a]);i=s}for(a=0;o>a;a++)r(e)?r(i[a])&&(e=t(+e,+i[a])):e=i[a];return e},n.len=function(t){return n.aggNums(function(t){return t+1},0,t)},n.mean=function(t,e){return e||(e=n.len(t)),n.aggNums(function(t,e){return t+e},0,t)/e},n.variance=function(t,e,i){return e||(e=n.len(t)),r(i)||(i=n.mean(t,e)),n.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},n.stdev=function(t,e,r){return Math.sqrt(n.variance(t,e,r))},n.interp=function(t,e){if(!r(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":20}],307:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+h.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())h.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function a(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),i=m[r];if(void 0!==i){var o=e[1],a=e[3],s=a.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==a.substr(0,4).toLowerCase())return"";var u=a.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,-1===g.indexOf(c.protocol)?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))r.push(i);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),i="",a=r.length-1;a>=0;a--){var s=r[a].match(/<(\/?).*>/i);if(s&&"
"!==r[a]){s[1]||(i=r[a]);break}}i&&(e.splice(n+1,0,i),e.splice(n,0,""),o+=2)});var a=e.join(""),u=a.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,n){var r,i,o,a=n.horizontalAlign,s=n.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-r.height}:"middle"===s?function(){return l.top+(l.height-r.height)/2}:function(){return l.top},o="right"===a?function(){return l.right-r.width}:"center"===a?function(){return l.left+(l.width-r.width)/2}:function(){return l.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:o()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(h.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),c=t.appendSVG(a),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),a=u(i),s=t,l=!s.attr("data-notex")&&a.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var m=t.node();m&&m.removeAttribute;m=m.parentNode)m.removeAttribute("data-bb");if(l){var g=h.getPlotDiv(s.node());(g&&g._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};o(l[2],i,function(i,o,a){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return n(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),o&&o.node()&&l.node().insertBefore(o.node().cloneNode(!0),l.node().firstChild),l.attr({"class":p,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=r(l,"width"),h=r(l,"height"),m=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],g=parseInt(s.style("font-size"),10)||r(s,"height"),y=-g/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,y-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:y-h/2}):"a"===p[0]?l.attr({x:0,y:y}):l.attr({x:m,y:+s.attr("y")+y-h/2}),e&&e.call(s,u),t(u)})}))}else n();return t}};var m={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},g=["http:","https:","mailto:"],y=new RegExp("]*)?/?>","g"),v=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(y," ")},n.makeEditable=function(t,e,n){function r(){o(),a.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(a.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(h.getPlotDiv(a.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":a.style("font-family")||"Arial","font-size":a.style("font-size")||12,color:n.fill||a.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(a.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||a.attr("data-unformatted")).call(c(a,e,n)).on("blur",function(){a.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(a.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(a,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(a.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(a,this.textContent)):(s.input.call(a,this.textContent),f.select(this).call(c(a,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}n||(n={});var a=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),n.immediate?r():u.on("click",r),f.rebind(this,s,"on")}},{"../constants/string_mappings":288,"../constants/xmlns_namespaces":289,"../lib":296,d3:18}],308:[function(t,e,n){"use strict";function r(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function i(t){Array.isArray(t._promises)&&t._promises.length>0&&C.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),D.defaultConfig.setBackground(t,e)}function a(t,e){t._context||(t._context=C.extendFlat({},D.defaultConfig));var n=t._context;e&&(Object.keys(e).forEach(function(t){t in n&&("setBackground"===t&&"opaque"===e[t]?n[t]=o:n[t]=e[t])}),e.plot3dPixelRatio&&!n.plotGlPixelRatio&&(n.plotGlPixelRatio=n.plot3dPixelRatio)),n.staticPlot&&(n.editable=!1,n.autosizable=!1,n.scrollZoom=!1,n.doubleClick=!1,n.showTips=!1,n.showLink=!1,n.displayModeBar=!1)}function s(t,e,n){var r=L.select(t).selectAll(".plot-container").data([0]);r.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=r.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),n&&(t.layout=n),D.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(M(t,{}),t._fullLayout.autosize=n.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=D.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var o=t.framework.svg(),a=1,s=t._fullLayout.title;""!==s&&s||(a=0);var l="Click to enter title",u=function(){this.call(D.util.convertToTspans)},c=o.select(".title-group text").call(u);if(t._context.editable){c.attr({"data-unformatted":s}),s&&s!==l||(a=.2,c.attr({"data-unformatted":l}).text(l).style({opacity:a}).on("mouseover.opacity",function(){L.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){L.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(D.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(u),this.call(f)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(u)})};c.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),F.addLinks(t),Promise.resolve()}function l(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var r=D.Axes.list({_fullLayout:t});for(e=0;ee;e++){var a=t.annotations[e];a.ref&&("paper"===a.ref?(a.xref="paper",a.yref="paper"):"data"===a.ref&&(a.xref="x",a.yref="y"),delete a.ref),u(a,"xref"),u(a,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(C.warn("Shapes must be an array."),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var l=t.shapes[e];u(l,"xref"),u(l,"yref")}var c=t.legend;c&&(c.x>3?(c.x=1.02,c.xanchor="left"):c.x<-2&&(c.x=-.02,c.xanchor="right"),c.y>3?(c.y=1.02,c.yanchor="bottom"):c.y<-2&&(c.y=-.02,c.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=F.getSubplotIds(t,"gl3d");for(e=0;en;++n)x[n]=g[e]+y*v[2+4*n];d.camera={eye:{x:x[0],y:x[1],z:x[2]},center:{x:g[0],y:g[1],z:g[2]},up:{x:v[1],y:v[5],z:v[9]}},delete d.cameraposition}}return N.clean(t),t}function u(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=D.Axes.cleanId(n,r))}function c(t,e){for(var n=[],r=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),i=0;io&&(s=C.randstr(r),-1!==n.indexOf(s));o++);a.uid=C.randstr(r),r.push(a.uid)}if(n.push(a.uid),"histogramy"===a.type&&"xbins"in a&&!("ybins"in a)&&(a.ybins=a.xbins, +delete a.xbins),a.error_y&&"opacity"in a.error_y){var l=N.defaults,u=a.error_y.color||(F.traceIs(a,"bar")?N.defaultLine:l[i%l.length]);a.error_y.color=N.addOpacity(N.rgb(u),N.opacity(u)*a.error_y.opacity),delete a.error_y.opacity}if("bardir"in a&&("h"!==a.bardir||!F.traceIs(a,"bar")&&"histogram"!==a.type.substr(0,9)||(a.orientation="h",_(a)),delete a.bardir),"histogramy"===a.type&&_(a),"histogramx"!==a.type&&"histogramy"!==a.type||(a.type="histogram"),"scl"in a&&(a.colorscale=a.scl,delete a.scl),"reversescl"in a&&(a.reversescale=a.reversescl,delete a.reversescl),a.xaxis&&(a.xaxis=D.Axes.cleanId(a.xaxis,"x")),a.yaxis&&(a.yaxis=D.Axes.cleanId(a.yaxis,"y")),F.traceIs(a,"gl3d")&&a.scene&&(a.scene=F.subplotsRegistry.gl3d.cleanId(a.scene)),F.traceIs(a,"pie")||(Array.isArray(a.textposition)?a.textposition=a.textposition.map(f):a.textposition&&(a.textposition=f(a.textposition))),F.traceIs(a,"2dMap")&&("YIGnBu"===a.colorscale&&(a.colorscale="YlGnBu"),"YIOrRd"===a.colorscale&&(a.colorscale="YlOrRd")),F.traceIs(a,"markerColorscale")&&a.marker){var c=a.marker;"YIGnBu"===c.colorscale&&(c.colorscale="YlGnBu"),"YIOrRd"===c.colorscale&&(c.colorscale="YlOrRd")}if("surface"===a.type&&C.isPlainObject(a.contours)){var d=["x","y","z"];for(o=0;or?o.push(i+r):o.push(r);return o}function m(t,e,n){var r,i;for(r=0;r=t.data.length||i<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(i,r+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||0>i&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+n+" must be unique.")}}function g(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),m(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&m(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function y(t,e,n){var r,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&l0){var s=w(t._boundingBoxMargins),l=s.left+s.right,u=s.bottom+s.top,c=o._container.node().getBoundingClientRect(),f=1-2*a.frameMargins;i=Math.round(f*(c.width-l)),r=Math.round(f*(c.height-u))}else n=window.getComputedStyle(t),r=parseFloat(n.height)||o.height,i=parseFloat(n.width)||o.width;return Math.abs(o.width-i)>1||Math.abs(o.height-r)>1?(o.height=t.layout.height=r,o.width=t.layout.width=i):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),F.sanitizeMargins(o),e}function k(t){var e=L.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===n.autosize&&(M(t,{}),n.autosize=!0,t.layout.autosize=!0),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];L.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=C.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var i=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=i.append("g").classed("imagelayer",!0),n._shapeLowerLayer=i.append("g").classed("shapelayer",!0);var o=D.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),n._has("cartesian")&&S(t,o),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var a=n._paper.selectAll(".layer-subplot");n._imageSubplotLayer=a.selectAll(".imagelayer"),n._shapeSubplotLayer=a.selectAll(".shapelayer");var s=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=s.append("g").classed("imagelayer",!0),n._shapeUpperLayer=s.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var l=C.syncOrAsync([T,function(){return D.Axes.doTicks(t,"redraw")},R.init],t);return l&&l.then&&t._promises.push(l),l}function A(t,e){function n(e,n){return function(){return D.Axes.getFromId(t,e,n)}}for(var r,i,o=t._fullLayout._plots={},a=0;a0,_=D.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),M=w===_;b?t.framework===k&&!x&&M||(t.framework=k,k(t)):M?x&&k(t):(t.framework=k,k(t)),x&&D.Axes.saveRangeInitial(t);var A=t._fullLayout,S=!t.calcdata||t.calcdata.length!==(t.data||[]).length;S&&d(t);for(var z=0;zY.range[0]?[1,2]:[2,1]);else{var Q=Y.range[0],J=Y.range[1];"log"===R?(0>=Q&&0>=J&&o(G+".autorange",!0),0>=Q?Q=J/1e6:0>=J&&(J=Q/1e6),o(G+".range[0]",Math.log(Q)/Math.LN10),o(G+".range[1]",Math.log(J)/Math.LN10)):(o(G+".range[0]",Math.pow(10,Q)),o(G+".range[1]",Math.pow(10,J)))}else o(G+".autorange",!0)}if("reverse"===q)H.range?H.range.reverse():(o(G+".autorange",!0),H.range=[1,0]),X.autorange?w=!0:_=!0;else if("annotations"===O.parts[0]||"shapes"===O.parts[0]){var $=O.parts[1],K=O.parts[0],tt=m[K]||[],et=D[C.titleCase(K)],nt=tt[$]||{};2===O.parts.length&&("add"===y[I]||C.isPlainObject(y[I])?z[I]="remove":"remove"===y[I]?-1===$?(z[K]=tt,delete z[I]):z[I]=nt:C.log("???",y)),!a(nt,"x")&&!a(nt,"y")||C.containsAny(I,["color","opacity","align","dash"])||(w=!0),et.draw(t,$,O.parts.slice(2).join("."),y[I]),delete y[I]}else if("images"===O.parts[0]){var it=C.objectFromPath(I,R);C.extendDeepAll(t.layout,it),V.supplyLayoutDefaults(t.layout,t._fullLayout),V.draw(t)}else if("mapbox"===O.parts[0]&&"layers"===O.parts[1]){C.extendDeepAll(t.layout,C.objectFromPath(I,R));var ot=(t._fullLayout.mapbox||{}).layers||[];for(P=O.parts[2]+1-ot.length,p=0;P>p;p++)ot.push({});_=!0}else if("updatemenus"===O.parts[0]){C.extendDeepAll(t.layout,C.objectFromPath(I,R));var at=t._fullLayout.updatemenus||[];for(P=O.parts[2]+1-at.length,p=0;P>p;p++)at.push({});_=!0}else 0===O.parts[0].indexOf("scene")?_=!0:0===O.parts[0].indexOf("geo")?_=!0:0===O.parts[0].indexOf("ternary")?_=!0:!g._has("gl2d")||-1===I.indexOf("axis")&&"plot_bgcolor"!==O.parts[0]?"hiddenlabels"===I?w=!0:-1!==O.parts[0].indexOf("legend")?v=!0:-1!==I.indexOf("title")?x=!0:-1!==O.parts[0].indexOf("bgcolor")?b=!0:O.parts.length>1&&C.containsAny(O.parts[1],["tick","exponent","grid","zeroline"])?x=!0:-1!==I.indexOf(".linewidth")&&-1!==I.indexOf("axis")?x=b=!0:O.parts.length>1&&-1!==O.parts[1].indexOf("line")?b=!0:O.parts.length>1&&"mirror"===O.parts[1]?x=b=!0:"margin.pad"===I?x=b=!0:"margin"===O.parts[0]||"autorange"===O.parts[1]||"rangemode"===O.parts[1]||"type"===O.parts[1]||"domain"===O.parts[1]||I.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(I)?k=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(I)&&(_=!0):_=!0,O.set(R)}j.add(t,rt,[t,z],rt,[t,S]),y.autosize&&(y=M(t,y)),(y.height||y.width||y.autosize)&&(w=!0);var st=Object.keys(y),lt=[F.previousPromises];if(_||w)lt.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),D.plot(t,"",m)});else if(st.length&&(F.supplyDefaults(t), +g=t._fullLayout,v&<.push(function(){return U.draw(t),F.previousPromises(t)}),b&<.push(T),x&<.push(function(){return D.Axes.doTicks(t,"redraw"),E(t),F.previousPromises(t)}),k)){var ut;for(W(t),D.Fx.supplyLayoutDefaults(t.layout,g,t._fullData),D.Fx.init(t),ut=F.getSubplotIds(g,"gl3d"),p=0;p1)};u(n.width)&&u(n.height)||s(new Error("Height and width should be pixel values."));var c=r.clone(e,{format:"png",height:n.height,width:n.width}),f=c.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var h=r.getRedrawFunc(f);o.plot(f,c.data,c.layout,c.config).then(h).then(l).then(function(e){t(e)}).catch(function(t){s(t)})});return s}var i=t("fast-isnumeric"),o=t("../plotly"),a=t("../lib");e.exports=r},{"../lib":296,"../plotly":314,"../snapshot":354,"fast-isnumeric":20}],313:[function(t,e,n){"use strict";function r(t,e,n,i,o,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(a("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,g=n.length,y=0;g>y;y++){var v=n[y],x=["data",y];if(p(v)){var b=c[y],_=b.type,w=s.traces[_].attributes;w.type={valType:"enumerated",values:[_]},b.visible===!1&&v.visible!==!1&&l.push(a("invisible",x)),r(v,b,w,l,x);var M=v.transforms,k=b.transforms;if(M){m(M)||l.push(a("array",x,["transforms"])),x.push("transforms");for(var A=0;Au&&c>e&&(void 0===i[n]?o[f]=S.tickText(t,e):o[f]=s(t,e,String(i[n])),f++);return f=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function a(t,e){var n=t.match(q),r=new Date(e);if(n){var i=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return v.time.format(t.replace(q,o))(r)}return v.time.format(t)(r)}function s(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function l(t,e,n,r){var i,o=e.x,s=t._tickround,l=new Date(o),u="";n&&t.hoverformat?i=a(t.hoverformat,o):t.tickformat?i=a(t.tickformat,o):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=O(l):"m"===s?i=j(l):(o!==t._tmin||n||(u="
"+O(l)),"d"===s?i=F(l):"H"===s?i=R(l):(o!==t._tmin||n||(u="
"+F(l)+", "+O(l)),i=N(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=h(y(o/1e3,1),t,"none",n).substr(1)))))),e.text=i+u}function u(t,e,n,r,i){var o=t.dtick,a=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=h(Math.pow(10,a),t,i,r);else if(x(o)||"D"===o.charAt(0)&&y(a+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(a);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,a),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,y(a,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>a?.5:.25)))}}function c(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,r)}function h(t,e,n,r){var i=0>t,a=e._tickround,s=n||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat;if(r){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(c),a=(Number(c._tickround)||0)+4,l=c._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return v.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-a)/2;if("none"===s&&(l=0),t=Math.abs(t),f>t)t="0",i=!1;else{if(t+=f,l&&(t*=Math.pow(10,-l),a+=l),0===a)t=String(Math.floor(t));else if(0>a){t=String(Math.round(t)),t=t.substr(0,t.length+a);for(var h=a;0>h;h++)t+="0"}else{t=String(t);var d=t.indexOf(".")+1;d&&(t=t.substr(0,d+a).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(l&&"hide"!==s){var p;p=0>l?"\u2212"+-l:"power"!==s?"+"+l:String(l),"e"===s||("SI"===s||"B"===s)&&(l>12||-15>l)?t+="e"+p:"E"===s?t+="E"+p:"power"===s?t+="\xd710"+p+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var n,r,i=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},S.getAutoRange=function(t){var e,n=[],r=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=a,u=s,h=f/c);if(r===i){var p=r-1,m=r+1;n="tozero"===t.rangemode?0>r?[p,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,m)]:[p,m]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),n=[l.val-h*l.pad,u.val+h*u.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),d&&n.reverse(),n},S.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=S.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},S.saveRangeInitial=function(t,e){for(var n=S.list(t,"",!0),r=!1,i=0;ip&&(p=m/10),u=t.c2l(p),c=t.c2l(m),v&&(u=Math.min(0,u),c=Math.max(0,c)),r(u)){for(d=!0,a=0;a=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(a,1),a--);d&&t._min.push({val:u,pad:v&&0===u?0:h})}if(r(c)){for(d=!0,a=0;a=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(a,1),a--);d&&t._max.push({val:c,pad:v&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,a,s,l,u,c,f,h,d,p,m,g=e.length,y=n.padded?.05*t._length:0,v=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(o=0;6>o;o++)i(o);for(o=g-1;o>5;o--)i(o)}},S.autoBin=function(t,e,n,r){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),a=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:a+.5,size:1};var s;if(n)s=(a-o)/n;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,a]};S.autoTicks(f,s);var h,d=S.tickIncrement(S.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,m=0,g=0,y=0,v=0;vm&&(p>.3*b||i(o)||i(a))){var w=f.dtick/2;d+=o>d+w?w:-w}var M=1+Math.floor((a-d)/f.dtick);h=d+M*f.dtick}else for(h=d;a>=h;)h=S.tickIncrement(h,f.dtick);return{start:d,end:h,size:f.dtick}},S.calcTicks=function(t){if("array"===t.tickmode)return r(t);if("auto"===t.tickmode||!t.dtick){var e,n=t.nticks;n||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/e):(e="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/e,4,9)+1)),S.autoTicks(t,Math.abs(t.range[1]-t.range[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=S.tickFirst(t);var i=t.range[1]=s:s>=l)&&(a.push(l),!(a.length>1e3));l=S.tickIncrement(l,t.dtick,i));t._tmax=a[a.length-1];for(var u=new Array(a.length),c=0;c157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,n,E)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,L)):e>432e5?(t.dtick=i(e,864e5,P),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,L):e>3e4?t.dtick=i(e,6e4,I):e>500?t.dtick=i(e,1e3,I):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,E));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,n,E)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,E));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},S.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var i=e.charAt(0),o=r*Number(e.substr(1));if("M"===i){var a=new Date(t);return a.setMonth(a.getMonth()+o)}if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===i){var s="D2"===e?C:D,l=t+.01*r,u=_.roundUp(y(l,1),s,n);return Math.floor(l)+Math.log(v.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},S.tickFirst=function(t){var e=t.range[1]r:r>u;)u=S.tickIncrement(u,i,e);return u}if("L"===c)return Math.log(n((Math.pow(10,r)-o)/f)*f+o)/Math.LN10;if("D"===c){var h="D2"===i?C:D,d=_.roundUp(y(r,1),h,e);return Math.floor(r)+Math.log(v.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var O=v.time.format("%Y"),j=v.time.format("%b %Y"),F=v.time.format("%b %-d"),R=v.time.format("%b %-d %Hh"),N=v.time.format("%H:%M"),B=v.time.format(":%S"),q=/%(\d?)f/g;S.tickText=function(t,e,n){function r(r){var i;return void 0===r?!0:n?"none"===r:(i={first:t._tmin,last:t._tmax}[r],"all"!==r&&e!==i)}var i,o,a=s(t,e),h="array"===t.tickmode,d=n||h;if(h&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&en&&(k=90),i(c,k)}u._lastangle=k}return a(e),e+" done"}function l(){u._boundingBox=n.node().getBoundingClientRect()}var c=n.selectAll("g."+L).data(z,E);if(!u.showticklabels||!x(r))return c.remove(),void a(e);var f,h,p,y,b;"x"===g?(b="bottom"===B?1:-1,f=function(t){return t.dx+O*b},y=r+(C+D)*b,h=function(t){return t.dy+y+t.fontSize*("bottom"===B?1:-.5)},p=function(t){return x(t)&&0!==t&&180!==t?0>t*b?"end":"start":"middle"}):(b="right"===B?1:-1,h=function(t){return t.dy+t.fontSize/2-O*b},f=function(t){return t.dx+r+(C+D+(90===Math.abs(u.tickangle)?t.fontSize/2:0))*b},p=function(t){return x(t)&&90===Math.abs(t)?"middle":"right"===B?"start":"end"});var M=0,k=0,S=[];c.enter().append("g").classed(L,1).append("text").attr("text-anchor","middle").each(function(e){var n=v.select(this),r=t._promises.length;n.call(A.setPosition,f(e),h(e)).call(A.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans), +r=t._promises[r],r?S.push(t._promises.pop().then(function(){i(n,u.tickangle)})):i(n,u.tickangle)}),c.exit().remove(),c.each(function(t){M=Math.max(M,t.fontSize)}),i(c,u._lastangle||u.tickangle);var T=_.syncOrAsync([o,s,l]);return T&&T.then&&t._promises.push(T),T}function a(e){if(!n){var r,i,o,a,s=T.getFromId(t,e),l=v.select(t).selectAll("g."+e+"tick"),u={selection:l,side:s.side},f=e.charAt(0),h=t._fullLayout._size,d=1.5,p=s.titlefont.size;if(l.size()){var m=v.select(l.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);m&&(u.offsetLeft=+m[1],u.offsetTop=+m[2])}"x"===f?(i="free"===s.anchor?{_offset:h.t+(1-(s.position||0))*h.h,_length:0}:T.getFromId(t,s.anchor),o=s._offset+s._length/2,a=i._offset+("top"===s.side?-10-p*(d+(s.showticklabels?1:0)):i._length+10+p*(d+(s.showticklabels?1.5:.5))),s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(a+=(c.height-c.margin.b-c.margin.t)*s.rangeslider.thickness+s._boundingBox.height),u.side||(u.side="bottom")):(i="free"===s.anchor?{_offset:h.l+(s.position||0)*h.w,_length:0}:T.getFromId(t,s.anchor),a=s._offset+s._length/2,o=i._offset+("right"===s.side?i._length+10+p*(d+(s.showticklabels?1:.5)):-10-p*(d+(s.showticklabels?.5:0))),r={rotate:"-90",offset:0},u.side||(u.side="left")),M.draw(t,e+"title",{propContainer:s,propName:s._name+".title",dfltName:f.toUpperCase()+" axis",avoid:u,transform:r,attributes:{x:o,y:a,"text-anchor":"middle"}})}}function s(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:b.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[g]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===g}function l(e,n,i){var o=e.gridlayer,a=e.zerolinelayer,l=e["hidegrid"+g]?[]:V,c=u._gridpath||"M0,0"+("x"===g?"v":"h")+n._length,f=o.selectAll("path."+I).data(u.showgrid===!1?[]:l,E);if(f.enter().append("path").classed(I,1).classed("crisp",1).attr("d",c).each(function(t){u.zeroline&&("linear"===u.type||"-"===u.type)&&Math.abs(t.x)m;m++){var v=u.mirrors[a._id+h[m]];"ticks"!==v&&"labels"!==v||(f[m]=!0)}return void 0!==r[2]&&(f[2]=!0),f.forEach(function(t,e){var n=r[e],i=q[e];t&&x(n)&&(d+=p(n+D*i,i*u.ticklen))}),i(n,d),l(e,a,t),o(n,r[3])}}).filter(function(t){return t&&t.then});return Z.length?Promise.all(Z):0},S.swap=function(t,e){for(var n=d(t,e),r=0;r2*r}function c(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,i=0,o=0;o2*r}var f=t("fast-isnumeric"),h=t("tinycolor2").mix,d=t("../../lib"),p=t("../plots"),m=t("../../components/color/attributes").lightFraction,g=t("./layout_attributes"),y=t("./tick_value_defaults"),v=t("./tick_mark_defaults"),x=t("./tick_label_defaults"),b=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),M=t("./clean_datum"),k=t("./axis_ids");e.exports=function(t,e,n,i){function o(n,r){return d.coerce2(t,e,g,n,r)}var a=i.letter,s=i.font||{},l="Click to enter "+(i.title||a.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=k.name2id(i.name));var u=n("type");"-"===u&&(r(e,i.data),"-"===e.type?e.type="linear":u=t.type=e.type),_(e);var c=n("color"),p=c===t.color?c:s.color;n("title",l),d.coerceFont(n,"titlefont",{family:s.family,size:Math.round(1.2*s.size),color:p});var M=2===(t.range||[]).length&&f(t.range[0])&&f(t.range[1]),A=n("autorange",!M);A&&n("rangemode");var S=n("range",[-1,"x"===a?6:4]);S[0]===S[1]&&(e.range=[S[0]-1,S[0]+1]),d.noneOrAll(t.range,e.range,[0,1]),n("fixedrange"),y(t,e,n,u),x(t,e,n,u,i),v(t,e,n,i),b(t,e,n);var T=o("linecolor",c),z=o("linewidth"),E=n("showline",!!T||!!z);E||(delete e.linecolor,delete e.linewidth),(E||e.ticks)&&n("mirror");var L=o("gridcolor",h(c,i.bgColor,m).toRgbString()),I=o("gridwidth"),P=n("showgrid",i.showGrid||!!L||!!I);P||(delete e.gridcolor,delete e.gridwidth);var D=o("zerolinecolor",c),C=o("zerolinewidth"),O=n("zeroline",i.showGrid||!!D||!!C);return O||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===u?w(a,e.categoryorder,e.categoryarray,i.data):[],e}},{"../../components/color/attributes":218,"../../lib":296,"../plots":344,"./axis_ids":319,"./category_order_defaults":320,"./clean_datum":321,"./layout_attributes":326,"./ordered_categories":328,"./set_convert":331,"./tick_label_defaults":332,"./tick_mark_defaults":333,"./tick_value_defaults":334,"fast-isnumeric":20,tinycolor2:214}],319:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),i=/^[xyz]axis[0-9]*/,o=[],a=0;a0;o&&(r="array");var a=n("categoryorder",r);"array"===a&&n("categoryarray"),o||"array"!==a||(e.categoryorder="trace")}}},{}],321:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":296,"fast-isnumeric":20}],322:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],323:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],i=Math.abs(r-t.range[1-e]);return"date"===t.type?c.ms2DateTime(r,i):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(n)+"g")(r))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function a(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/setcursor"),m=t("../../components/dragelement"),g=t("./axes"),y=t("./select"),v=t("./constants"),x=!0;e.exports=function(t,e,n,s,b,_,w,M){function k(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+mt+")").attr("d",lt+"Z"),ht=dt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+mt+")").attr("d","M0,0Z"),T();for(var o=0;oi?(ct="",at.r=at.l,at.t=at.b,ht.attr("d","M0,0Z")):(at.t=0,at.b=U,ct="x",ht.attr("d","M"+(at.l-.5)+","+(ot-G-.5)+"h-3v"+(2*G+1)+"h3ZM"+(at.r+.5)+","+(ot-G-.5)+"h3v"+(2*G+1)+"h-3Z")):!J||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function E(t,e,n){var r,i,o;for(r=0;rzoom back out","long"),x=!1)))}function I(e,n){var i=1===(w+M).length;if(e)j();else if(2!==n||i){if(1===n&&i){var o=w?q[0]:B[0],a="s"===w||"w"===M?0:1,s=o._name+".range["+a+"]",l=r(o,a),c="left",h="middle";if(o.fixedrange)return;w?(h="n"===w?"top":"bottom","right"===o.side&&(c="right")):"e"===M&&(c="right"),et.call(f.makeEditable,null,{immediate:!0,background:R.paper_bgcolor,text:String(l),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var n="category"===o.type?o.c2l(e):o.d2l(e);void 0!==n&&u.relayout(t,s,n)})}}else O()}function P(e){function n(t,e,n){if(!t.fixedrange){A(t.range);var r=t.range,i=r[0]+(r[1]-r[0])*e;t.range=[i+(r[0]-i)*n,i+(r[1]-i)*n]}}if(t._context.scrollZoom||R._enablescrollzoom){var r=t.querySelector(".plotly");if(!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void c.log("Did not find wheel motion attributes: ",e);var o,a=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=gt[0]+gt[2]*l,f=(s.bottom-e.clientY)/s.height,h=gt[1]+gt[3]*(1-f);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function i(t,e,n){for(var i=1-e,o=0,a=0;a0;r--)n.push(e);return n}function i(t,e){for(var n=[],r=0;rS;S++){var T=o[S],z=d[T];if(z)k[S]=w.getFromId(t,z.xaxis._id),A[S]=w.getFromId(t,z.yaxis._id);else{var E=a[T]._subplot;k[S]=E.xaxis,A[S]=E.yaxis}}var L=e.hovermode||a.hovermode;if(-1===["x","y","closest"].indexOf(L)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var I,P,D,C,O,j,F,R,N,B,q,V,U=[],Z=[];if(Array.isArray(e))for(L="array",D=0;DG||G>X.width||0>H||H>X.height)return _.unhoverRaw(t,e)}else G="xpx"in e?e.xpx:k[0]._length/2,H="ypx"in e?e.ypx:A[0]._length/2;if(I="xval"in e?r(o,e.xval):i(k,G),P="yval"in e?r(o,e.yval):i(A,H),!m(I[0])||!m(P[0]))return g.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Y=1/0;for(C=0;C1||-1!==j.hoverinfo.indexOf("name")?j.name:void 0,index:!1,distance:Math.min(Y,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},V=U.length,"array"===R){var W=e[C];"pointNumber"in W?(q.index=W.pointNumber,R="closest"):(R="","xval"in W&&(N=W.xval,R="x"),"yval"in W&&(B=W.yval,R=R?"closest":"y"))}else N=I[F],B=P[F];if(j._module&&j._module.hoverPoints){var Q=j._module.hoverPoints(q,N,B,R);if(Q)for(var J,$=0;$V&&(U.splice(0,V),Y=U[0].distance)}if(0===U.length)return _.unhoverRaw(t,e);var K="y"===L&&Z.length>1;U.sort(function(t,e){return t.distance-e.distance});var tt=x.combine(a.plot_bgcolor||x.background,a.paper_bgcolor),et={hovermode:L,rotateLabels:K,bgColor:tt,container:a._hoverlayer,outerContainer:a._paperdiv},nt=u(U,et);c(U,K?"xa":"ya"),f(nt,K);var rt=t._hoverdata,it=[];for(D=0;D128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,n=c.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[i+"Label"]===m?r=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",u).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(v.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var h=e.select("text.name"),g=0;n&&n!==r?(h.style("fill",l).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(v.convertToTspans),h.selectAll("tspan.line").call(b.setPosition,0,0),g=h.node().getBoundingClientRect().width+2*P):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var y,M,T=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,E=t.ya._offset+(t.y0+t.y1)/2,L=Math.abs(t.x1-t.x0),D=Math.abs(t.y1-t.y0),C=T.width+I+P+g;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=g,t.offset=0,o?(t.pos=z,y=k>=E+D/2+C,M=E-D/2-C>=0,"top"!==t.idealAlign&&y||!M?y?(E+=D/2,t.anchor="start"):t.anchor="middle":(E-=D/2,t.anchor="end")):(t.pos=E,y=w>=z+L/2+C,M=z-L/2-C>=0,"left"!==t.idealAlign&&y||!M?y?(z+=L/2,t.anchor="start"):t.anchor="middle":(z-=L/2,t.anchor="end")),f.attr("text-anchor",t.anchor),g&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+E+")"+(o?"rotate("+S+")":""))}),E}function c(t,e){function n(t){var e=t[0],n=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;r=!1}if(!(.01>o)){if(-.01>i){for(s=t.length-1;s>=0;s--)t[s].dp-=o;r=!1}if(r){var u=0;for(a=0;ae.pmax&&u++;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos>e.pmax-1&&(l.del=!0,u--);for(a=0;a=u);a++)if(l=t[a],l.pos=0;s--)t[s].dp-=o;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var r,i,o,a,s,l,u,c=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?z:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&c<=t.length;){for(c++,r=!0,a=0;a.01&&p.pmin===m.pmin&&p.pmax===m.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(a+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(o=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=o;r=!1}else a++}f.forEach(n)}for(a=f.length-1;a>=0;a--){var g=f[a];for(s=g.length-1;s>=0;s--){var y=g[s],v=t[y.i];v.offset=y.dp,v.del=y.del}}}function f(t,e){t.each(function(t){var n=d.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,i=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],a=o*(I+P),s=a+o*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(a-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-L,l=t.offset*E),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*I+l)+","+(I+u)+"v"+(t.by/2-I)+"h"+r*t.bx+"v-"+t.by+"H"+(r*I+l)+"V"+(u-I)+"Z"),i.call(b.setPosition,a+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,s+o*P+l,u+t.ty0-t.by/2+P),n.select("rect").call(b.setRect,s+(o-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var i=n[r],o=t._hoverdata[r];if(i.curveNumber!==o.curveNumber||String(i.pointNumber)!==String(o.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),m=t("fast-isnumeric"),g=t("../../lib"),y=t("../../lib/events"),v=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,n){function r(n,r){return g.coerce(t,e,A.layoutAttributes,n,r)}r("dragmode");var i;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(n);i=o?"y":"x"}else i="closest";r("hovermode",i)},A.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+M.HOVERMINTIME?(a(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){a(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indext*e||0===t?M.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":219,"../../components/dragelement":240,"../../components/drawing":242,"../../lib":296,"../../lib/events":294,"../../lib/svg_text_utils":307,"./axes":317,"./constants":322,"./dragbox":323,d3:18,"fast-isnumeric":20,tinycolor2:214}],325:[function(t,e,n){"use strict";var r=t("../plots"),i=t("./constants");n.name="cartesian",n.attr=["xaxis","yaxis"],n.idRoot=["x","y"],n.idRegex=i.idRegex,n.attrRegex=i.attrRegex,n.attributes=t("./attributes"),n.plot=function(t){function e(t,e){for(var n=[],r=0;rf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":296,"fast-isnumeric":20}],330:[function(t,e,n){"use strict";function r(t){return t._id}var i=t("../../lib/polygon"),o=t("../../components/color"),a=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,n,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function d(t,e){return t-e}var p,m=i.gd._fullLayout._zoomlayer,g=i.element.getBoundingClientRect(),y=i.plotinfo.x()._offset,v=i.plotinfo.y()._offset,x=e-g.left,b=n-g.top,_=x,w=b,M="M"+x+","+b,k=i.xaxes[0]._length,A=i.yaxes[0]._length,S=i.xaxes.map(r),T=i.yaxes.map(r),z=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[x,b]],s.BENDPX));var E=m.selectAll("path.select-outline").data([1,2]);E.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+y+", "+v+")").attr("d",M+"Z");var L,I,P,D,C,O=m.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+y+", "+v+")").attr("d","M0,0Z"),j=[],F=i.gd,R=[];for(L=0;L0)return Math.log(e)/Math.LN10;if(0>=e&&n&&t.range&&2===t.range.length){var r=t.range[0],i=t.range[1];return.5*(r+i-3*c*Math.abs(r-i))}return a.BADNUM}function n(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):a.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?n:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var r=l.getFromId(t._gd,t.overlaying);t.domain=r.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)i(t.range[e])||(t.range[e]=i(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?r.round(t._b+t._m*e,2):a.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):a.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?o.ms2DateTime(t):a.BADNUM},t.d2c=function(t){return i(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!i(t.range[0])&&i(f[0])&&(t.range[0]=f[0]),!i(t.range[1])&&i(f[1])&&(t.range[1]=f[1])}catch(h){o.error(h,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var n=t._categories.indexOf(e);return-1===n?a.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,i,o;if(n in e)for(r=e[n],i=new Array(r.length),o=0;o0}function o(t){var e={},n={};switch(t.type){case"circle":s.extendFlat(n,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(n,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(n,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var r=t.symbol,i=l(r.textposition,r.iconsize);s.extendFlat(e,{"icon-image":r.icon+"-15","icon-size":r.iconsize/10,"text-field":r.text,"text-size":r.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(n,{"icon-color":t.color,"text-color":r.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:n}}function a(t){var e,n=t.sourcetype,r=t.source,i={type:n},o="string"==typeof r;return"geojson"===n?e="data":"vector"===n&&(e=o?"url":"tiles"),i[e]=r,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=r.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var n=a(t);e.addSource(this.idSource,n)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var n={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",n)}},u.updateStyle=function(t){var e=o(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,n){var i=new r(t,e);return i.update(n),i}},{"../../lib":296,"./convert_text_opts":338}],341:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../components/color").defaultLine,o=t("../font_attributes"),a=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},accesstoken:{valType:"string",noBlank:!0,strict:!0},style:{valType:"any",values:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],dflt:"basic"},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},layers:{_isLinkedToArray:!0,sourcetype:{valType:"enumerated",values:["geojson","vector"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},type:{valType:"enumerated",values:["circle","line","fill","symbol"],dflt:"circle"},below:{valType:"string",dflt:""},color:{valType:"color",dflt:i},opacity:{valType:"number",min:0,max:1,dflt:1},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2}},fill:{outlinecolor:{valType:"color",dflt:i}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},textfont:r.extendDeep({},o,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:r.extendFlat({},a,{arrayOk:!1})}}}},{"../../components/color":219,"../../lib":296,"../../traces/scatter/attributes":360,"../font_attributes":335}],342:[function(t,e,n){"use strict";function r(t,e,n){n("accesstoken"),n("style"),n("center.lon"),n("center.lat"),n("zoom"),n("bearing"),n("pitch"),i(t,e),e._input=t}function i(t,e){function n(t,e){return o.coerce(r,i,s.layers,t,e)}for(var r,i,a=t.layers||[],l=e.layers=[],u=0;u=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var a=n.select(".js-link-to-tool"),s=n.select(".js-link-spacer"),u=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&i(t,a),s.text(a.text()&&u.text()?" - ":"")},d.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=l.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=r.append("input").attr({type:"text",name:"data"});return i.node().value=d.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},d.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},i=t.layout||{},a=t._fullData||[],s=t._fullData=[],l=t.data||[];d.supplyLayoutGlobalDefaults(i,r),r._dataLength=l.length,d.supplyDataDefaults(l,s,r),r._has=d._hasPlotType.bind(r);var u=r._modules;for(e=0;eo&&(e=(n-1)/(i.l+i.r),i.l=Math.floor(e*i.l),i.r=Math.floor(e*i.r)),0>a&&(e=(r-1)/(i.t+i.b),i.t=Math.floor(e*i.t),i.b=Math.floor(e*i.b))}},d.autoMargin=function(t,e,n){var r=t._fullLayout;if(r._pushmargin||(r._pushmargin={}),r.margin.autoexpand!==!1){if(n){var i=void 0===n.pad?12:n.pad;n.l+n.r>.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+i},r:{val:n.x,size:n.r+i},b:{val:n.y,size:n.b+i},t:{val:n.y,size:n.t+i}}}else delete r._pushmargin[e];t._replotting||d.doAutoMargin(t)}},d.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),i=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),a=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;return e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:o},t:{val:1,size:a},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var n=l[t].l||{},r=l[t].b||{},c=n.val,f=n.size,h=r.val,d=r.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var n=l[t].r.val,r=l[t].r.size;if(n>c){var p=(f*n+(r-e.width)*c)/(n-c),m=(r*(1-c)+(f-e.width)*(1-n))/(n-c);p>=0&&m>=0&&p+m>i+o&&(i=p,o=m)}}if(u(d)&&l[t].t){var g=l[t].t.val,y=l[t].t.size;if(g>h){var v=(d*g+(y-e.height)*h)/(g-h),x=(y*(1-h)+(d-e.height)*(1-g))/(g-h);v>=0&&x>=0&&v+x>s+a&&(s=v,a=x)}}})})),n.l=Math.round(i),n.r=Math.round(o),n.t=Math.round(a),n.b=Math.round(s),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,t._replotting||"{}"===r||r===JSON.stringify(e._size)?void 0:c.plot(t)},d.graphJson=function(t,e,n,r,i){function o(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,r,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;i[e]=o(t[e])}return i}return Array.isArray(t)?t.map(o):t&&t.getTime?f.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&d.supplyDefaults(t);var a=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(a||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(l.layout=o(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===r?l:JSON.stringify(l)}},{"../components/color":219,"../lib":296,"../plotly":314,"./attributes":315,"./font_attributes":335,"./layout_attributes":336,d3:18,"fast-isnumeric":20}],345:[function(t,e,n){"use strict";var r=t("../../traces/scatter/attributes"),i=r.marker;e.exports={r:r.r,t:r.t,marker:{color:i.color,size:i.size,symbol:i.symbol,opacity:i.opacity}}},{"../../traces/scatter/attributes":360}],346:[function(t,e,n){"use strict";function r(t,e){var n={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,n)}var i=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,a=o({},i.domain,{});e.exports={radialaxis:r("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:a,orientation:{valType:"number"}}),angularaxis:r("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:a}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":295,"../cartesian/layout_attributes":326}],347:[function(t,e,n){var r=t("../../plotly"),i=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},a=r.Lib.extendDeepAll;o.Axis=function(){function t(t){n=t||n;var u=l.data,f=l.layout;return("string"==typeof n||n.nodeName)&&(n=i.select(n)),n.datum(u).each(function(t,n){function l(t,e){return s(t)%360+f.orientation}var u=t.slice();c={data:o.util.cloneJson(u),layout:o.util.cloneJson(f)};var h=0;u.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[h],h=(h+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:i.rgb(t.color).darker().toString()),c.data[e].color=t.color,c.data[e].strokeColor=t.strokeColor,c.data[e].strokeDash=t.strokeDash,c.data[e].strokeSize=t.strokeSize});var d=u.filter(function(t,e){var n=t.visible;return"undefined"==typeof n||n===!0}),p=!1,m=d.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var g=i.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(m),y=[],v=g.map(function(t,e){if("unstacked"===t.key)return t.values;var n=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,r){t.yStack=[n],y.push(n),n=o.util.sumArrays(t.r,n)}),t.values});d=i.merge(v)}d.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var x=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;x=Math.max(10,x);var b,_=[f.margin.left+x,f.margin.top+x];if(p){var w=i.max(o.util.sumArrays(o.util.arrayLast(d).r[0],o.util.arrayLast(y)));b=[0,w]}else b=i.extent(o.util.flattenArray(d.map(function(t,e){return t.r})));f.radialAxis.domain!=o.DATAEXTENT&&(b[0]=0),r=i.scale.linear().domain(f.radialAxis.domain!=o.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:b).range([0,x]),c.layout.radialAxis.domain=r.domain();var M,k=o.util.flattenArray(d.map(function(t,e){return t.t})),A="string"==typeof k[0];A&&(k=o.util.deduplicate(k),M=k.slice(),k=i.range(k.length),d=d.map(function(t,e){var n=t;return t.t=[k],p&&(n.yStack=t.yStack),n}));var S=d.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===d.length,T=null===f.needsEndSpacing?A||!S:f.needsEndSpacing,z=f.angularAxis.domain&&f.angularAxis.domain!=o.DATAEXTENT&&!A&&f.angularAxis.domain[0]>=0,E=z?f.angularAxis.domain:i.extent(k),L=Math.abs(k[1]-k[0]);S&&!A&&(L=0);var I=E.slice();T&&A&&(I[1]+=L);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(I[1]-I[0])/P);var D=f.angularAxis.ticksStep||(I[1]-I[0])/(P*(f.minorTicks+1));M&&(D=Math.max(Math.round(D),1)),I[2]||(I[2]=D);var C=i.range.apply(this,I);if(C=C.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=i.scale.linear().domain(I.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=T?L:0,e=i.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var O="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",j=(new DOMParser).parseFromString(O,"application/xml"),F=this.appendChild(this.ownerDocument.importNode(j.documentElement,!0));e=i.select(F)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var R,N=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){R=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var n=o.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:R,elements:V,reverseOrder:f.legend.reverseOrder})})();var U=R.node().getBBox();x=Math.min(f.width-U.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],r.range([0,x]),c.layout.radialAxis.domain=r.domain(),R.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else R=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),N.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Z=[(f.width-(f.margin.left+f.margin.right+2*x+(U?U.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Z[0]=Math.max(0,Z[0]),Z[1]=Math.max(0,Z[1]),e.select(".outer-group").attr("transform","translate("+Z+")"),f.title){var G=e.select("g.title-group text").style(q).text(f.title),H=G.node().getBBox();G.attr({x:_[0]-H.width/2,y:_[1]-x-20})}var X=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=X.selectAll("circle.grid-circle").data(r.ticks(5));Y.enter().append("circle").attr({"class":"grid-circle"}).style(B),Y.attr("r",r),Y.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=i.svg.axis().scale(r).ticks(5).tickSize(5);X.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(B),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var J=e.select(".angular.axis-group").selectAll("g.angular-tick").data(C),$=J.enter().append("g").classed("angular-tick",!0);J.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),J.exit().remove(),$.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),$.selectAll(".minor").style({stroke:f.minorTickColor}),J.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(q);var K=J.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=l(t,e),r=x+f.labelOffset,i=f.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-n+" "+r+" 0)":"radial"==i?270>n&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(180>=n&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":M?M[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=i.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));R.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(nt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),d[0]||et){var rt=[];d.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=s,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var it=i.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];it.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return a(o[n].defaultConfig(),t)});o[n]().config(r)()})}var at,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!A){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos(W).angle;dt.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;at=s.invert(r);var i=o.util.convertToCartesian(x+12,n+180);ct.text(o.util.round(at)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),st=r.invert(o.util.getMousePos(W).radius);var i=o.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(o.util.round(st)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var r=i.select(this),a=r.style("fill"),s="black",l=r.style("opacity")||1;if(r.attr({"data-opacity":l}),"none"!=a){r.attr({"data-fill":a}),s=i.hsl(a).darker().toString(),r.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-Z[0]-h.left,f.top+f.height/2-Z[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=r.style("stroke"),r.attr({"data-stroke":a}),s=i.hsl(a).darker().toString(),r.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=i.event.which?!1:void(i.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.hide();var n=i.select(this),r=n.attr("data-fill");r?n.style({fill:r,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),h}var e,n,r,s,l={data:[],layout:{}},u={},c={},f=i.dispatch("hover"),h={};return h.render=function(e){return t(e),this},h.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return r},h.angularScale=function(t){return s},h.svg=function(){return e},i.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:i.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},o.util._extend=function(t,e){for(var n in t)e[n]=t[n]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var n=e||6,r=i.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,i=t(r);return[e,i]});return r},o.util.dataFromEquation=function(t,e,n){var r=e||6,o=[],a=[];i.range(0,360+r,r).forEach(function(e,n){var r=e*Math.PI/180,i=t(r);o.push(e),a.push(i)});var s={t:o,r:a};return n&&(s.name=n),s},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return i.range(e).map(function(t,e){return n[e]||n[0]})},o.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=o.util.ensureArray(t[e],n)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},o.util.sumArrays=function(t,e){return i.zip(t,e).map(function(t,e){return i.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return-2===n},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),i=t*Math.sin(n);return[r,i]},o.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},o.util.getMousePos=function(t){var e=i.mouse(t.node()),n=e[0],r=e[1],o={};return o.x=n,o.y=r,o.pos=e,o.angle=180*(Math.atan2(r,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+r*r),o},o.util.duplicatesCount=function(t){for(var e,n={},r={},i=0,o=t.length;o>i;i++)e=t[i],e in n?(n[e]++,r[e]=n[e]):n[e]=1;return r},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,n,r){if(r){var i=n.slice();n=e,e=i}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,n,r){return"undefined"!=typeof t?(r===e.length-1&&delete t[n],t[n]):void 0},t),n.reduce(function(t,e,r){return"undefined"==typeof t[e]&&(t[e]={}),r===n.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=n[0].geometryConfig,e=t.container;"string"==typeof e&&(e=i.select(e)),e.datum(n).each(function(e,n){function r(e,n){var r=t.radialScale(e[1]),i=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:r,t:i}}function o(t){var e=t.r*Math.cos(t.t),n=t.r*Math.sin(t.t);return{x:e,y:n}}var a=!!e[0].data.yStack,l=e.map(function(t,e){return a?i.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):i.zip(t.data.t[0],t.data.r[0])}),u=t.angularScale,c=t.radialScale.domain()[0],f={};f.bar=function(n,r,o){var a=e[o].data,s=t.radialScale(n[1])-t.radialScale(0),l=t.radialScale(n[2]||0),c=a.barWidth;i.select(this).attr({"class":"mark bar",d:"M"+[[s+l,-c/2],[s+l,c/2],[l,c/2],[l,-c/2]].join("L")+"Z",transform:function(e,n){return"rotate("+(t.orientation+u(e[0]))+")"}})},f.dot=function(t,n,a){var s=t[2]?[t[0],t[1]+t[2]]:t,l=i.svg.symbol().size(e[a].data.dotSize).type(e[a].data.dotType)(t,n);i.select(this).attr({"class":"mark dot",d:l,transform:function(t,e){var n=o(r(s));return"translate("+[n.x,n.y]+")"}})};var h=i.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(n,r,o){var a=n[2]?l[o].map(function(t,e){return[t[0],t[1]+t[2]]}):l[o];if(i.select(this).each(f.dot).style({opacity:function(t,n){return+e[o].data.dotVisible},fill:g.stroke(n,r,o)}).attr({"class":"mark dot"}),!(r>0)){var s=i.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({"class":"line",d:h(a),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return g.fill(n,r,o)},"fill-opacity":0,stroke:function(t,e){return g.stroke(n,r,o)},"stroke-width":function(t,e){return g["stroke-width"](n,r,o)},"stroke-dasharray":function(t,e){return g["stroke-dasharray"](n,r,o)},opacity:function(t,e){return g.opacity(n,r,o)},display:function(t,e){return g.display(n,r,o)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,m=i.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,r){i.select(this).attr({"class":"mark arc",d:m,transform:function(e,n){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var g={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return s[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},y=i.select(this).selectAll("g.layer").data(l);y.enter().append("g").attr({"class":"layer"});var v=y.selectAll("path.mark").data(function(t,e){return t});v.enter().append("path").attr({"class":"mark"}),v.style(g).each(f[t.geometryType]),v.exit().remove(),y.exit().remove()})}var e,n=[o.PolyChart.defaultConfig()],r=i.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),a(n[e],o.PolyChart.defaultConfig()),a(n[e],t)}),this):n},t.getColorScale=function(){return e},i.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1, +index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:i.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var n=e.legendConfig,r=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var i=a({},n.elements[e]);return i.name=t,i.color=[].concat(n.elements[e].color)[r],i})}),o=i.merge(r);o=o.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(o=o.reverse());var s=n.container;("string"==typeof s||s.nodeName)&&(s=i.select(s));var l=o.map(function(t,e){return t.color}),u=n.fontSize,c=null==n.isContinuous?"number"==typeof o[0]:n.isContinuous,f=c?n.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var m=i.range(o.length),g=i.scale[c?"linear":"ordinal"]().domain(m).range(l),y=i.scale[c?"linear":"ordinal"]().domain(m)[c?"range":"rangePoints"]([0,f]),v=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=i.svg.symbolTypes.indexOf(t)?i.svg.symbol().type(t).size(n)():i.svg.symbol().type("square").size(n)()};if(c){var x=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=d.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[u/2,y(e)+u/2]+")"},d:function(t,e){var n=t.symbol;return v(n,u)},fill:function(t,e){return g(e)}}),b.exit().remove()}var _=i.svg.axis().scale(y).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?n.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),n=i.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},i.rebind(t,n,"on"),t},o.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},o.tooltipPanel=function(){var t,e,n,r={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=r.container.selectAll("g."+s).data([0]);var i=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return n=i.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=i.append("text").attr({dx:r.padding+l,dy:.3*+r.fontSize}),u};return u.text=function(o){var a=i.hsl(r.color).l,s=a>=.5?"#aaa":"white",c=a>=.5?"black":"white",f=o||"";e.style({fill:c,"font-size":r.fontSize+"px"}).text(f);var h=r.padding,d=e.node().getBBox(),p={fill:r.color,stroke:s,"stroke-width":"2px"},m=d.width+2*h+l,g=d.height+2*h;return n.attr({d:"M"+[[l,-g/2],[l,-g/4],[r.hasTick?0:l,0],[l,g/4],[l,g/2],[m,g/2],[m,-g/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-g/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u):void 0},u.hide=function(){return t?(t.style({display:"none"}),u):void 0},u.show=function(){return t?(t.style({display:"block"}),u):void 0},u.config=function(t){return a(r,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=a({},t),i=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var r=o.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var i=r.indexOf(t.geometry);-1!=i&&(n.data[e].groupId=i)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};i.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),n.layout=s}return n},t}},{"../../plotly":314,"./micropolar_manager":348,d3:18}],348:[function(t,e,n){"use strict";var r=t("../../plotly"),i=t("d3"),o=t("./undo_manager"),a=e.exports={},s=r.Lib.extendDeepAll;a.framework=function(t){function e(e,o){return o&&(f=o),i.select(i.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,u||(u=r.micropolar.Axis()),c=r.micropolar.adapter.plotly().convert(n),u.config(c).render(f),t.data=n.data,t.layout=n.layout,a.fillLayout(t),n}var n,l,u,c,f,h=new o;return e.isPolar=!0,e.svg=function(){return u.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return r.micropolar.adapter.plotly().convert(u.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:u.angularScale(),r:u.radialScale()}},e.setUndoPoint=function(){var t=this,e=r.micropolar.util.cloneJson(n);!function(e,n){h.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,l),l=r.micropolar.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},a.fillLayout=function(t){var e=i.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),a={width:800,height:600,paper_bgcolor:r.Color.background,_container:e,_paperdiv:n,_paper:o};t._fullLayout=s(a,t.layout)}},{"../../plotly":314,"./undo_manager":349,d3:18}],349:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,n=[],r=-1,i=!1;return{add:function(t){return i?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=n[r];return i?(t(i,"undo"),r-=1,e&&e(i.undo),this):this},redo:function(){var i=n[r+1];return i?(t(i,"redo"),r+=1,e&&e(i.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return rm;m++){var g=d[m];s=t[g]?t[g]:t[g]={},e[g]=l={},a("domain."+h,[m/p,(m+1)/p]),a("domain."+{x:"y",y:"x"}[h]),o.id=g,f(s,l,a,o)}}},{"../lib":296,"./plots":344}],351:[function(t,e,n){"use strict";function r(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function i(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),a=o.Lib.extendFlat,s=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,l=t.data,u=t.layout,c=s([],l),f=s({},u,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(n=0;np&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var m={padded:!0},g={padded:!0};if(a.hasMarkers(e)){if(n=e.marker,l=n.size,Array.isArray(l)){var y={type:"linear"};i.setConvert(y),l=y.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var v,x=1.6*(e.marker.sizeref||1);v="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},m.ppad=g.ppad=Array.isArray(l)?l.map(v):v(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(a.hasMarkers(e)||a.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(g.padded=!1):g.tozero=!0,i.expand(c,h,m),i.expand(f,d,g);var b=new Array(p);for(u=0;p>u;u++)b[u]=r(h[u])&&r(d[u])?{x:h[u],y:d[u]}:{x:!1,y:!1};return void 0!==typeof l&&o.mergeArray(l,b,"ms"),t.firstscatter=!1,b}},{"../../lib":296,"../../plots/cartesian/axes":317,"./colorscale_calc":364,"./subtypes":379,"fast-isnumeric":20}],362:[function(t,e,n){"use strict";e.exports=function(t){var e,n,r,i,o;for(e=0;e=0;i--)if(o=t[i],"scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}},{}],363:[function(t,e,n){"use strict";var r=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,u=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void a.autoMargin(t,c);var f=s(u.colorscale),h=u.color,d=u.cmin,p=u.cmax;i(d)||(d=o.aggNums(Math.min,null,h)),i(p)||(p=o.aggNums(Math.max,null,h));var m=e[0].t.cb=l(t,c);m.fillcolor(r.scale.linear().domain(f.map(function(t){return d+t[0]*(p-d)})).range(f.map(function(t){return t[1]}))).filllevels({start:d,end:p,size:(p-d)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":222,"../../components/colorscale/get_scale":231,"../../lib":296,"../../plots/plots":344,d3:18,"fast-isnumeric":20}],364:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&i(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&i(t,t.marker.color,"marker","c"),r(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":226,"../../components/colorscale/has_colorscale":232,"./subtypes":379}],365:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],366:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("./attributes"),o=t("./constants"),a=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function m(n,o){return r.coerce(t,e,i,n,o)}var g=s(t,e,m),y=gq!=D>=q&&(L=z[S-1][0],I=z[S][0],E=L+(I-L)*(q-P)/(D-P),F=Math.min(F,E),R=Math.max(R,E));F=Math.max(F,0),R=Math.min(R,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:F,x1:R,y0:q,y1:q,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":219,"../../components/errorbars":248,"../../lib":296,"../../plots/cartesian/constants":322,"../../plots/cartesian/graph_interact":324,"./get_trace_color":368}],370:[function(t,e,n){"use strict";var r={},i=t("./subtypes");r.hasLines=i.hasLines,r.hasMarkers=i.hasMarkers,r.hasText=i.hasText,r.isBubble=i.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":325,"./arrays_to_calcdata":359,"./attributes":360,"./calc":361,"./clean_data":362,"./colorbar":363,"./defaults":366,"./hover":369,"./plot":376,"./select":377,"./style":378,"./subtypes":379}],371:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,a){var s=(t.marker||{}).color;if(a("line.color",n),r(t,"line"))i(t,e,o,a,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||n;a("line.color",l)}a("line.width"),a("line.dash")}},{"../../components/colorscale/defaults":229,"../../components/colorscale/has_colorscale":232}],372:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=M.c2p(t[e].y);return n===z||r===z?!1:[n,r]}function i(t){var e=t[0]/w._length,n=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var a,s,l,u,c,f,h,d,p,m,g,y,v,x,b,_,w=e.xaxis,M=e.yaxis,k=e.connectGaps,A=e.baseTolerance,S=e.linear,T=[],z=r.BADNUM,E=.2,L=new Array(t.length),I=0;for(a=0;ai(f))break;l=f,v=m[0]*p[0]+m[1]*p[1],v>g?(g=v,u=f,d=!1):y>v&&(y=v,c=f,d=!0)}if(d?(L[I++]=u,l!==c&&(L[I++]=c)):(c!==s&&(L[I++]=c),l!==u&&(L[I++]=u)),L[I++]=l,a>=t.length||!f)break;L[I++]=f,s=f}}else L[I++]=u}T.push(L.slice(0,I))}return T}},{"../../plots/cartesian/axes":317}],373:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],374:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t){var e=t.marker,n=e.sizeref||1,i=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/n)}:function(t){return t/n};return function(t){var e=o(t/2);return r(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":20}],375:[function(t,e,n){"use strict";var r=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),a=t("./subtypes");e.exports=function(t,e,n,s,l){var u,c=a.isBubble(t),f=(t.line||{}).color;f&&(n=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",n),i(t,"marker")&&o(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?r.background:r.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&o(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":219,"../../components/colorscale/defaults":229,"../../components/colorscale/has_colorscale":232,"./subtypes":379}],376:[function(t,e,n){"use strict";function r(t,e,n){var r=e.x(),o=e.y(),a=i.extent(r.range.map(r.l2c)),s=i.extent(o.range.map(o.l2c));n.forEach(function(t,e){var r=t[0].trace;if(u.hasMarkers(r)){var i=r.marker.maxdisplayed; +if(0!==i){var o=t.filter(function(t){return t.x>=a[0]&&t.x<=a[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(o.length/i),c=0;n.forEach(function(t,n){var r=t[0].trace;u.hasMarkers(r)&&r.marker.maxdisplayed>0&&e>n&&c++});var f=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+f)%l)&&(t.vis=!0)})}}})}var i=t("d3"),o=t("../../lib"),a=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,n){function h(t){return t.filter(function(t){return t.vis})}r(t,e,n);var d=e.x(),p=e.y(),m=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(n);m.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),m.call(s.plot,e);var g,y,v,x,b="",_=[];m.each(function(t){var e=t[0].trace,n=e.line,r=i.select(this);if(e.visible===!0&&(y=e.fill.charAt(e.fill.length-1),"x"!==y&&"y"!==y&&(y=""),t[0].node3=r,c(t),u.hasLines(e)||"none"!==e.fill)){var o,s,h,m,w,M="",k="";g="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!b?r.append("path").classed("js-fill",!0):null,x&&(v=x.datum(t)),x=r.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(n.shape)?(h=a.steps(n.shape),m=a.steps(n.shape.split("").reverse().join(""))):h=m="spline"===n.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?a.smoothclosed(t.slice(1),n.smoothing):a.smoothopen(t,n.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return m(t.reverse())};var A,S=f(t,{xaxis:d,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(n.width||1,3)/4,linear:"linear"===n.shape}),T=e._polygons=new Array(S.length);for(A=0;A1&&r.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}g?z&&L&&(y?("y"===y?z[1]=L[1]=p.c2p(0,!0):"x"===y&&(z[0]=L[0]=d.c2p(0,!0)),g.attr("d",M+"L"+L+"L"+z+"Z")):g.attr("d",M+"Z")):"tonext"===e.fill.substr(0,6)&&M&&b&&("tonext"===e.fill?v.attr("d",M+"Z"+b+"Z"):v.attr("d",M+"L"+b.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),b=k,_=T}}}),m.selectAll("path:not([d])").remove(),m.append("g").attr("class","points").each(function(t){var e=t[0].trace,n=i.select(this),r=u.hasMarkers(e),s=u.hasText(e);!r&&!s||e.visible!==!0?n.remove():(r&&n.selectAll("path.point").data(e.marker.maxdisplayed?h:o.identity).enter().append("path").classed("point",!0).call(a.translatePoints,d,p),s&&n.selectAll("g").data(e.marker.maxdisplayed?h:o.identity).enter().append("g").append("text").call(a.translatePoints,d,p))})}},{"../../components/drawing":242,"../../components/errorbars":248,"../../lib":296,"../../lib/polygon":302,"./arrays_to_calcdata":359,"./line_points":372,"./subtypes":379,d3:18}],377:[function(t,e,n){"use strict";var r=t("./subtypes"),i=.2;e.exports=function(t,e){var n,o,a,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,m=!r.hasMarkers(h)&&!r.hasText(h);if(h.visible===!0&&!m){var g=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;nb;b++){var _=e.lon[b],w=e.lat[b];if(r(_)&&r(w)){var M={};if(x++,M.lonlat=[+_,+w],f){if(h){var k=c.color[b];M.mc=k,M.mcc=g(k)}if(d){var A=c.size[b];M.ms=A,M.mrc=y(A)}if(p){var S=c.symbol[b];M.mx="string"==typeof S?S:"circle"}}if(m){var T=e.text[b];M.tx="string"==typeof T?T:""}v.push(M)}else x>0&&(v[x-1].gapAfter=!0)}return v}},{"../../components/colorscale/has_colorscale":232,"../../components/colorscale/make_scale_function":236,"../../lib":296,"../scatter/colorscale_calc":364,"../scatter/make_bubble_size_func":374,"../scatter/subtypes":379,"fast-isnumeric":20}],385:[function(t,e,n){"use strict";function r(){return{geojson:i(),layout:{visibility:"none"},paint:{}}}function i(){return{type:"Point",coordinates:[]}}function o(t,e){if(1===e.length)return{type:"Polygon",coordinates:e};for(var n=new Array(e.length),r=0;r0&&(r.push(i),i=[])}return r.push(i),r}function h(t){return Array.isArray(t)?function(t){return t}:t?function(){return t}:d}function d(){return""}var p=t("../../lib"),m=t("../scatter/subtypes"),g=t("../../plots/mapbox/convert_text_opts"),y="circle-color",v="circle-radius";e.exports=function(t){var e=t[0].trace,n=e.visible===!0,i="none"!==e.fill,h=m.hasLines(e),d=m.hasMarkers(e),x=m.hasText(e),b=d&&"circle"===e.marker.symbol,_=d&&"circle"!==e.marker.symbol,w=r(),M=r(),k=r(),A=r(),S={fill:w,line:M,circle:k,symbol:A};if(!n)return S;var T;if((i||h)&&(T=f(t)),i&&(w.geojson=o(t,T),w.layout.visibility="visible",p.extendFlat(w.paint,{"fill-color":e.fillcolor})),h&&(M.geojson=a(t,T),M.layout.visibility="visible",p.extendFlat(M.paint,{"line-width":e.line.width,"line-color":e.line.color,"line-opacity":e.opacity})),b){var z={};z[y]={},z[v]={},k.geojson=s(t,z),k.layout.visibility="visible",p.extendFlat(k.paint,{"circle-opacity":e.opacity*e.marker.opacity,"circle-color":u(e,z),"circle-radius":c(e,z)})}if((_||x)&&(A.geojson=l(t),p.extendFlat(A.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),_&&(p.extendFlat(A.layout,{"icon-size":e.marker.size/10}),p.extendFlat(A.paint,{"icon-opacity":e.opacity*e.marker.opacity,"icon-color":e.marker.color})),x)){var E=(e.marker||{}).size,L=g(e.textposition,E);p.extendFlat(A.layout,{"text-size":e.textfont.size,"text-anchor":L.anchor,"text-offset":L.offset}),p.extendFlat(A.paint,{"text-color":e.textfont.color,"text-opacity":e.opacity})}return S}},{"../../lib":296,"../../plots/mapbox/convert_text_opts":338,"../scatter/subtypes":379}],386:[function(t,e,n){"use strict";function r(t,e,n){var r=n("lon")||[],i=n("lat")||[],o=Math.min(r.length,i.length);return o")}var i=t("../../plots/cartesian/graph_interact"),o=t("../scatter/get_trace_color");e.exports=function(t,e,n){function a(t){var e=t.lonlat,r=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],n])),o=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(r*r+i*i)-o,1-3/o)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya,f=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),h=360*f,d=e-h;if(i.getClosest(s,a,t),t.index!==!1){var p=s[t.index],m=p.lonlat,g=[m[0]+h,m[1]],y=u.c2p(g),v=c.c2p(g),x=p.mrc||1;return t.x0=y-x,t.x1=y+x,t.y0=v-x,t.y1=v+x,t.color=o(l,p),t.extraText=r(l,p),[t]}}},{"../../plots/cartesian/graph_interact":324,"../scatter/get_trace_color":368}],388:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("./calc"),r.hoverPoints=t("./hover"),r.plot=t("./plot"),r.moduleType="trace",r.name="scattermapbox",r.basePlotModule=t("../../plots/mapbox"),r.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],r.meta={},e.exports=r},{"../../plots/mapbox":339,"../scatter/colorbar":363,"./attributes":383,"./calc":384,"./defaults":386,"./hover":387,"./plot":389}],389:[function(t,e,n){"use strict";function r(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var o=t("./convert"),a=r.prototype;a.update=function(t){var e=this.mapbox,n=o(t);e.setOptions(this.idLayerFill,"setLayoutProperty",n.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",n.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",n.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",n.symbol.layout),i(n.fill)&&(e.setSourceData(this.idSourceFill,n.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",n.fill.paint)),i(n.line)&&(e.setSourceData(this.idSourceLine,n.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",n.line.paint)),i(n.circle)&&(e.setSourceData(this.idSourceCircle,n.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",n.circle.paint)),i(n.symbol)&&(e.setSourceData(this.idSourceSymbol,n.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",n.symbol.paint))},a.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var n=e[0].trace,i=new r(t,n.uid);return i.update(e),i}},{"./convert":385}]},{},[4])(4)}); \ No newline at end of file diff --git a/dist/plotly-with-meta.js b/dist/plotly-with-meta.js index af27c5ef49e..1d9ec1b39d1 100644 --- a/dist/plotly-with-meta.js +++ b/dist/plotly-with-meta.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.16.2 +* plotly.js v1.16.3 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -68,7 +68,7 @@ for(var selector in rules) { Plotly.Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/plotly":589}],2:[function(require,module,exports){ +},{"../src/plotly":612}],2:[function(require,module,exports){ 'use strict'; module.exports = { @@ -199,7 +199,7 @@ module.exports = { module.exports = require('../src/traces/bar'); -},{"../src/traces/bar":674}],4:[function(require,module,exports){ +},{"../src/traces/bar":697}],4:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -210,7 +210,7 @@ module.exports = require('../src/traces/bar'); module.exports = require('../src/traces/box'); -},{"../src/traces/box":685}],5:[function(require,module,exports){ +},{"../src/traces/box":708}],5:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -221,7 +221,7 @@ module.exports = require('../src/traces/box'); module.exports = require('../src/traces/choropleth'); -},{"../src/traces/choropleth":694}],6:[function(require,module,exports){ +},{"../src/traces/choropleth":717}],6:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -232,7 +232,7 @@ module.exports = require('../src/traces/choropleth'); module.exports = require('../src/traces/contour'); -},{"../src/traces/contour":701}],7:[function(require,module,exports){ +},{"../src/traces/contour":724}],7:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -243,7 +243,7 @@ module.exports = require('../src/traces/contour'); module.exports = require('../src/core'); -},{"../src/core":557}],8:[function(require,module,exports){ +},{"../src/core":580}],8:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -254,7 +254,7 @@ module.exports = require('../src/core'); module.exports = require('../src/traces/heatmap'); -},{"../src/traces/heatmap":713}],9:[function(require,module,exports){ +},{"../src/traces/heatmap":736}],9:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -265,7 +265,7 @@ module.exports = require('../src/traces/heatmap'); module.exports = require('../src/traces/histogram'); -},{"../src/traces/histogram":724}],10:[function(require,module,exports){ +},{"../src/traces/histogram":747}],10:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -276,7 +276,7 @@ module.exports = require('../src/traces/histogram'); module.exports = require('../src/traces/histogram2d'); -},{"../src/traces/histogram2d":729}],11:[function(require,module,exports){ +},{"../src/traces/histogram2d":752}],11:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -287,7 +287,7 @@ module.exports = require('../src/traces/histogram2d'); module.exports = require('../src/traces/histogram2dcontour'); -},{"../src/traces/histogram2dcontour":733}],12:[function(require,module,exports){ +},{"../src/traces/histogram2dcontour":756}],12:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -332,7 +332,7 @@ module.exports = Plotly; module.exports = require('../src/traces/mesh3d'); -},{"../src/traces/mesh3d":737}],14:[function(require,module,exports){ +},{"../src/traces/mesh3d":760}],14:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -343,7 +343,7 @@ module.exports = require('../src/traces/mesh3d'); module.exports = require('../src/traces/pie'); -},{"../src/traces/pie":743}],15:[function(require,module,exports){ +},{"../src/traces/pie":766}],15:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -354,7 +354,7 @@ module.exports = require('../src/traces/pie'); module.exports = require('../src/traces/scatter3d'); -},{"../src/traces/scatter3d":777}],16:[function(require,module,exports){ +},{"../src/traces/scatter3d":800}],16:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -365,7 +365,7 @@ module.exports = require('../src/traces/scatter3d'); module.exports = require('../src/traces/scattergeo'); -},{"../src/traces/scattergeo":781}],17:[function(require,module,exports){ +},{"../src/traces/scattergeo":804}],17:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -376,7 +376,7 @@ module.exports = require('../src/traces/scattergeo'); module.exports = require('../src/traces/scattergl'); -},{"../src/traces/scattergl":786}],18:[function(require,module,exports){ +},{"../src/traces/scattergl":809}],18:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -387,7 +387,7 @@ module.exports = require('../src/traces/scattergl'); module.exports = require('../src/traces/scattermapbox'); -},{"../src/traces/scattermapbox":792}],19:[function(require,module,exports){ +},{"../src/traces/scattermapbox":815}],19:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -398,7 +398,7 @@ module.exports = require('../src/traces/scattermapbox'); module.exports = require('../src/traces/scatterternary'); -},{"../src/traces/scatterternary":798}],20:[function(require,module,exports){ +},{"../src/traces/scatterternary":821}],20:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -409,7 +409,7 @@ module.exports = require('../src/traces/scatterternary'); module.exports = require('../src/traces/surface'); -},{"../src/traces/surface":807}],21:[function(require,module,exports){ +},{"../src/traces/surface":830}],21:[function(require,module,exports){ 'use strict' module.exports = createFilteredVector @@ -1096,7 +1096,7 @@ function createMatrixCameraController(options) { 0,0,0,1] return new MatrixCameraController(matrix) } -},{"binary-search-bounds":30,"gl-mat4/invert":143,"gl-mat4/lookAt":144,"gl-mat4/rotateX":148,"gl-mat4/rotateY":149,"gl-mat4/rotateZ":150,"gl-mat4/scale":151,"gl-mat4/translate":152,"gl-vec3/normalize":28,"mat4-interpolate":31}],30:[function(require,module,exports){ +},{"binary-search-bounds":30,"gl-mat4/invert":148,"gl-mat4/lookAt":149,"gl-mat4/rotateX":153,"gl-mat4/rotateY":154,"gl-mat4/rotateZ":155,"gl-mat4/scale":156,"gl-mat4/translate":157,"gl-vec3/normalize":28,"mat4-interpolate":31}],30:[function(require,module,exports){ arguments[4][22][0].apply(exports,arguments) },{"dup":22}],31:[function(require,module,exports){ var lerp = require('gl-vec3/lerp') @@ -1151,7 +1151,7 @@ function vec3(n) { function vec4() { return [0,0,0,1] } -},{"gl-mat4/determinant":139,"gl-vec3/lerp":27,"mat4-decompose":32,"mat4-recompose":34,"quat-slerp":35}],32:[function(require,module,exports){ +},{"gl-mat4/determinant":144,"gl-vec3/lerp":27,"mat4-decompose":32,"mat4-recompose":34,"quat-slerp":35}],32:[function(require,module,exports){ /*jshint unused:true*/ /* Input: matrix ; a 4x4 matrix @@ -1331,7 +1331,7 @@ function combine(out, a, b, scale1, scale2) { out[1] = a[1] * scale1 + b[1] * scale2 out[2] = a[2] * scale1 + b[2] * scale2 } -},{"./normalize":33,"gl-mat4/clone":137,"gl-mat4/create":138,"gl-mat4/determinant":139,"gl-mat4/invert":143,"gl-mat4/transpose":153,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/length":26,"gl-vec3/normalize":28}],33:[function(require,module,exports){ +},{"./normalize":33,"gl-mat4/clone":142,"gl-mat4/create":143,"gl-mat4/determinant":144,"gl-mat4/invert":148,"gl-mat4/transpose":158,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/length":26,"gl-vec3/normalize":28}],33:[function(require,module,exports){ module.exports = function normalize(out, mat) { var m44 = mat[15] // Cannot normalize. @@ -1403,7 +1403,7 @@ module.exports = function recomposeMat4(matrix, translation, scale, skew, perspe mat4.scale(matrix, matrix, scale) return matrix } -},{"gl-mat4/create":138,"gl-mat4/fromRotationTranslation":141,"gl-mat4/identity":142,"gl-mat4/multiply":145,"gl-mat4/scale":151,"gl-mat4/translate":152}],35:[function(require,module,exports){ +},{"gl-mat4/create":143,"gl-mat4/fromRotationTranslation":146,"gl-mat4/identity":147,"gl-mat4/multiply":150,"gl-mat4/scale":156,"gl-mat4/translate":157}],35:[function(require,module,exports){ module.exports = require('gl-quat/slerp') },{"gl-quat/slerp":36}],36:[function(require,module,exports){ module.exports = slerp @@ -1894,7 +1894,7 @@ function createOrbitController(options) { return result } -},{"./lib/quatFromFrame":37,"filtered-vector":21,"gl-mat4/fromQuat":140,"gl-mat4/invert":143,"gl-mat4/lookAt":144}],39:[function(require,module,exports){ +},{"./lib/quatFromFrame":37,"filtered-vector":21,"gl-mat4/fromQuat":145,"gl-mat4/invert":148,"gl-mat4/lookAt":149}],39:[function(require,module,exports){ 'use strict' module.exports = createTurntableController @@ -2467,7 +2467,7 @@ function createTurntableController(options) { theta, phi) } -},{"filtered-vector":21,"gl-mat4/invert":143,"gl-mat4/rotate":147,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/normalize":28}],40:[function(require,module,exports){ +},{"filtered-vector":21,"gl-mat4/invert":148,"gl-mat4/rotate":152,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/normalize":28}],40:[function(require,module,exports){ 'use strict' module.exports = createViewController @@ -2616,7 +2616,7 @@ function alphaComplex(alpha, points) { return circumradius(simplex) * alpha < 1 }) } -},{"circumradius":43,"delaunay-triangulate":120}],43:[function(require,module,exports){ +},{"circumradius":43,"delaunay-triangulate":125}],43:[function(require,module,exports){ module.exports = circumradius var circumcenter = require('circumcenter') @@ -2701,7 +2701,7 @@ function circumcenter(points) { circumcenter.barycenetric = barycentricCircumcenter module.exports = circumcenter -},{"dup":121,"robust-linear-solve":436}],45:[function(require,module,exports){ +},{"dup":126,"robust-linear-solve":459}],45:[function(require,module,exports){ 'use strict' module.exports = boundary @@ -2770,7 +2770,7 @@ function compareOrientedCells(a, b) { return compareCells(a, b) || parity(a) - parity(b) } -},{"cell-orientation":47,"compare-cell":107}],49:[function(require,module,exports){ +},{"cell-orientation":47,"compare-cell":112}],49:[function(require,module,exports){ 'use strict' var compareCell = require('compare-cell') @@ -2803,7 +2803,7 @@ function reduceCellComplex(cells) { return cells } -},{"cell-orientation":47,"compare-cell":107,"compare-oriented-cell":48}],50:[function(require,module,exports){ +},{"cell-orientation":47,"compare-cell":112,"compare-oriented-cell":48}],50:[function(require,module,exports){ 'use strict'; var arraytools = function () { @@ -3199,367 +3199,6 @@ exports.nextCombination = function(v) { },{}],52:[function(require,module,exports){ -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -// when used in node, this will actually load the util module we depend on -// versus loading the builtin util module as happens otherwise -// this is a bug in node module loading as far as I am concerned -var util = require('util/'); - -var pSlice = Array.prototype.slice; -var hasOwn = Object.prototype.hasOwnProperty; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } - else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = stackStartFunction.name; - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function replacer(key, value) { - if (util.isUndefined(value)) { - return '' + value; - } - if (util.isNumber(value) && !isFinite(value)) { - return value.toString(); - } - if (util.isFunction(value) || util.isRegExp(value)) { - return value.toString(); - } - return value; -} - -function truncate(s, n) { - if (util.isString(s)) { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} - -function getMessage(self) { - return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + - self.operator + ' ' + - truncate(JSON.stringify(self.expected, replacer), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (util.isBuffer(actual) && util.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if (!util.isObject(actual) && !util.isObject(expected)) { - return actual == expected; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b) { - if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) - return false; - // an identical 'prototype' property. - if (a.prototype !== b.prototype) return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) { - return a === b; - } - var aIsArgs = isArguments(a), - bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - var ka = objectKeys(a), - kb = objectKeys(b), - key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key])) return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } else if (actual instanceof expected) { - return true; - } else if (expected.call({}, actual) === true) { - return true; - } - - return false; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (util.isString(expected)) { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - if (!shouldThrow && expectedException(actual, expected)) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function(err) { if (err) {throw err;}}; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -},{"util/":62}],53:[function(require,module,exports){ (function (global){ /*! * The buffer module from node.js, for the browser. @@ -5025,7 +4664,7 @@ function blitBuffer (src, dst, offset, length) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"base64-js":54,"ieee754":55,"isarray":56}],54:[function(require,module,exports){ +},{"base64-js":53,"ieee754":54,"isarray":55}],53:[function(require,module,exports){ 'use strict' exports.toByteArray = toByteArray @@ -5141,7 +4780,7 @@ function fromByteArray (uint8) { return parts.join('') } -},{}],55:[function(require,module,exports){ +},{}],54:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 @@ -5227,14 +4866,14 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],56:[function(require,module,exports){ +},{}],55:[function(require,module,exports){ var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; -},{}],57:[function(require,module,exports){ +},{}],56:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -5534,7 +5173,7 @@ function isUndefined(arg) { return arg === void 0; } -},{}],58:[function(require,module,exports){ +},{}],57:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -5559,7 +5198,7 @@ if (typeof Object.create === 'function') { } } -},{}],59:[function(require,module,exports){ +},{}],58:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -5787,7 +5426,7 @@ var substr = 'ab'.substr(-1) === 'b' ; }).call(this,require('_process')) -},{"_process":60}],60:[function(require,module,exports){ +},{"_process":59}],59:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -5880,15 +5519,1483 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; +},{}],60:[function(require,module,exports){ +(function (global){ +/*! https://mths.be/punycode v1.4.0 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.3.2', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],61:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); } + +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + },{}],62:[function(require,module,exports){ -(function (process,global){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; + +},{}],63:[function(require,module,exports){ +'use strict'; + +exports.decode = exports.parse = require('./decode'); +exports.encode = exports.stringify = require('./encode'); + +},{"./decode":61,"./encode":62}],64:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var punycode = require('punycode'); +var util = require('./util'); + +exports.parse = urlParse; +exports.resolve = urlResolve; +exports.resolveObject = urlResolveObject; +exports.format = urlFormat; + +exports.Url = Url; + +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; +} + +// Reference: RFC 3986, RFC 1808, RFC 2396 + +// define these here so at least they only have to be +// compiled once on the first module load. +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = require('querystring'); + +function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) return url; + + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; +} + +Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + hostEnd = rest.length; + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) continue; + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) this.pathname = rest; + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; +}; + +// format a parsed object into a url string +function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) obj = urlParse(obj); + if (!(obj instanceof Url)) return Url.prototype.format.call(obj); + return obj.format(); +} + +Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') protocol += ':'; + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') hash = '#' + hash; + if (search && search.charAt(0) !== '?') search = '?' + search; + + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; +}; + +function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); +} + +Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); +}; + +function urlResolveObject(source, relative) { + if (!source) return relative; + return urlParse(source, false, true).resolveObject(relative); +} + +Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + result[rkey] = relative[rkey]; + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())); + if (!relative.host) relative.host = ''; + if (!relative.hostname) relative.hostname = ''; + if (relPath[0] !== '') relPath.unshift(''); + if (relPath.length < 2) relPath.unshift(''); + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') srcPath[0] = result.host; + else srcPath.unshift(result.host); + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') relPath[0] = relative.host; + else relPath.unshift(relative.host); + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; +}; + +Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) this.hostname = host; +}; + +},{"./util":65,"punycode":60,"querystring":63}],65:[function(require,module,exports){ +'use strict'; + +module.exports = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; + } +}; + +},{}],66:[function(require,module,exports){ +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} +},{}],67:[function(require,module,exports){ +(function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -6477,7 +7584,7 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":61,"_process":60,"inherits":58}],63:[function(require,module,exports){ +},{"./support/isBuffer":66,"_process":59,"inherits":57}],68:[function(require,module,exports){ 'use strict' var monotoneTriangulate = require('./lib/monotone') @@ -6561,7 +7668,7 @@ function cdt2d(points, edges, options) { } } -},{"./lib/delaunay":64,"./lib/filter":65,"./lib/monotone":66,"./lib/triangulation":67}],64:[function(require,module,exports){ +},{"./lib/delaunay":69,"./lib/filter":70,"./lib/monotone":71,"./lib/triangulation":72}],69:[function(require,module,exports){ 'use strict' var inCircle = require('robust-in-sphere')[4] @@ -6678,7 +7785,7 @@ function delaunayRefine(points, triangulation) { } } -},{"binary-search-bounds":68,"robust-in-sphere":69}],65:[function(require,module,exports){ +},{"binary-search-bounds":73,"robust-in-sphere":74}],70:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -6860,7 +7967,7 @@ function classifyFaces(triangulation, target, infinity) { return result } -},{"binary-search-bounds":68}],66:[function(require,module,exports){ +},{"binary-search-bounds":73}],71:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -7049,7 +8156,7 @@ function monotoneTriangulate(points, edges) { return cells } -},{"binary-search-bounds":68,"robust-orientation":439}],67:[function(require,module,exports){ +},{"binary-search-bounds":73,"robust-orientation":462}],72:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -7155,7 +8262,7 @@ function createTriangulation(numVerts, edges) { return new Triangulation(stars, edges) } -},{"binary-search-bounds":68}],68:[function(require,module,exports){ +},{"binary-search-bounds":73}],73:[function(require,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, earlyOut) { @@ -7209,7 +8316,7 @@ module.exports = { eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],69:[function(require,module,exports){ +},{}],74:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -7377,7 +8484,7 @@ function generateInSphereTest() { } generateInSphereTest() -},{"robust-scale":440,"robust-subtract":441,"robust-sum":442,"two-product":456}],70:[function(require,module,exports){ +},{"robust-scale":463,"robust-subtract":464,"robust-sum":465,"two-product":479}],75:[function(require,module,exports){ 'use strict' module.exports = cleanPSLG @@ -7739,7 +8846,7 @@ function cleanPSLG(points, edges, colors) { return modified } -},{"./lib/rat-seg-intersect":71,"big-rat":75,"big-rat/cmp":73,"big-rat/to-float":88,"box-intersect":89,"compare-cell":107,"nextafter":97,"rat-vec":99,"robust-segment-intersect":102,"union-find":103}],71:[function(require,module,exports){ +},{"./lib/rat-seg-intersect":76,"big-rat":80,"big-rat/cmp":78,"big-rat/to-float":93,"box-intersect":94,"compare-cell":112,"nextafter":102,"rat-vec":104,"robust-segment-intersect":107,"union-find":108}],76:[function(require,module,exports){ 'use strict' //TODO: Move this to a separate module @@ -7785,7 +8892,7 @@ function solveIntersection(a, b, c, d) { return rvAdd(a, rvMuls(ba, t)) } -},{"big-rat/div":74,"big-rat/mul":84,"big-rat/sign":86,"big-rat/sub":87,"big-rat/to-float":88,"rat-vec/add":98,"rat-vec/muls":100,"rat-vec/sub":101}],72:[function(require,module,exports){ +},{"big-rat/div":79,"big-rat/mul":89,"big-rat/sign":91,"big-rat/sub":92,"big-rat/to-float":93,"rat-vec/add":103,"rat-vec/muls":105,"rat-vec/sub":106}],77:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -7798,7 +8905,7 @@ function add(a, b) { a[1].mul(b[1])) } -},{"./lib/rationalize":82}],73:[function(require,module,exports){ +},{"./lib/rationalize":87}],78:[function(require,module,exports){ 'use strict' module.exports = cmp @@ -7807,7 +8914,7 @@ function cmp(a, b) { return a[0].mul(b[1]).cmp(b[0].mul(a[1])) } -},{}],74:[function(require,module,exports){ +},{}],79:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -7818,7 +8925,7 @@ function div(a, b) { return rationalize(a[0].mul(b[1]), a[1].mul(b[0])) } -},{"./lib/rationalize":82}],75:[function(require,module,exports){ +},{"./lib/rationalize":87}],80:[function(require,module,exports){ 'use strict' var isRat = require('./is-rat') @@ -7880,7 +8987,7 @@ function makeRational(numer, denom) { return rationalize(a, b) } -},{"./div":74,"./is-rat":76,"./lib/is-bn":80,"./lib/num-to-bn":81,"./lib/rationalize":82,"./lib/str-to-bn":83}],76:[function(require,module,exports){ +},{"./div":79,"./is-rat":81,"./lib/is-bn":85,"./lib/num-to-bn":86,"./lib/rationalize":87,"./lib/str-to-bn":88}],81:[function(require,module,exports){ 'use strict' var isBN = require('./lib/is-bn') @@ -7891,7 +8998,7 @@ function isRat(x) { return Array.isArray(x) && x.length === 2 && isBN(x[0]) && isBN(x[1]) } -},{"./lib/is-bn":80}],77:[function(require,module,exports){ +},{"./lib/is-bn":85}],82:[function(require,module,exports){ 'use strict' var bn = require('bn.js') @@ -7902,7 +9009,7 @@ function sign(x) { return x.cmp(new bn(0)) } -},{"bn.js":85}],78:[function(require,module,exports){ +},{"bn.js":90}],83:[function(require,module,exports){ 'use strict' module.exports = bn2num @@ -7926,7 +9033,7 @@ function bn2num(b) { return b.sign ? -out : out } -},{}],79:[function(require,module,exports){ +},{}],84:[function(require,module,exports){ 'use strict' var db = require('double-bits') @@ -7947,7 +9054,7 @@ function ctzNumber(x) { return h + 32 } -},{"bit-twiddle":51,"double-bits":96}],80:[function(require,module,exports){ +},{"bit-twiddle":51,"double-bits":101}],85:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -7960,7 +9067,7 @@ function isBN(x) { return x && typeof x === 'object' && Boolean(x.words) } -},{"bn.js":85}],81:[function(require,module,exports){ +},{"bn.js":90}],86:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -7977,7 +9084,7 @@ function num2bn(x) { } } -},{"bn.js":85,"double-bits":96}],82:[function(require,module,exports){ +},{"bn.js":90,"double-bits":101}],87:[function(require,module,exports){ 'use strict' var num2bn = require('./num-to-bn') @@ -8005,7 +9112,7 @@ function rationalize(numer, denom) { return [ numer, denom ] } -},{"./bn-sign":77,"./num-to-bn":81}],83:[function(require,module,exports){ +},{"./bn-sign":82,"./num-to-bn":86}],88:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -8016,7 +9123,7 @@ function str2BN(x) { return new BN(x) } -},{"bn.js":85}],84:[function(require,module,exports){ +},{"bn.js":90}],89:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -8027,7 +9134,7 @@ function mul(a, b) { return rationalize(a[0].mul(b[0]), a[1].mul(b[1])) } -},{"./lib/rationalize":82}],85:[function(require,module,exports){ +},{"./lib/rationalize":87}],90:[function(require,module,exports){ (function (module, exports) { 'use strict'; @@ -10347,7 +11454,7 @@ Mont.prototype.invm = function invm(a) { })(typeof module === 'undefined' || module, this); -},{}],86:[function(require,module,exports){ +},{}],91:[function(require,module,exports){ 'use strict' var bnsign = require('./lib/bn-sign') @@ -10358,7 +11465,7 @@ function sign(x) { return bnsign(x[0]) * bnsign(x[1]) } -},{"./lib/bn-sign":77}],87:[function(require,module,exports){ +},{"./lib/bn-sign":82}],92:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -10369,7 +11476,7 @@ function sub(a, b) { return rationalize(a[0].mul(b[1]).sub(a[1].mul(b[0])), a[1].mul(b[1])) } -},{"./lib/rationalize":82}],88:[function(require,module,exports){ +},{"./lib/rationalize":87}],93:[function(require,module,exports){ 'use strict' var bn2num = require('./lib/bn-to-num') @@ -10412,7 +11519,7 @@ function roundRat(f) { } } -},{"./lib/bn-to-num":78,"./lib/ctz":79}],89:[function(require,module,exports){ +},{"./lib/bn-to-num":83,"./lib/ctz":84}],94:[function(require,module,exports){ 'use strict' module.exports = boxIntersectWrapper @@ -10551,7 +11658,7 @@ function boxIntersectWrapper(arg0, arg1, arg2) { throw new Error('box-intersect: Invalid arguments') } } -},{"./lib/intersect":91,"./lib/sweep":95,"typedarray-pool":458}],90:[function(require,module,exports){ +},{"./lib/intersect":96,"./lib/sweep":100,"typedarray-pool":481}],95:[function(require,module,exports){ 'use strict' var DIMENSION = 'd' @@ -10696,7 +11803,7 @@ function bruteForcePlanner(full) { exports.partial = bruteForcePlanner(false) exports.full = bruteForcePlanner(true) -},{}],91:[function(require,module,exports){ +},{}],96:[function(require,module,exports){ 'use strict' module.exports = boxIntersectIter @@ -11191,7 +12298,7 @@ function boxIntersectIter( } } } -},{"./brute":90,"./median":92,"./partition":93,"./sweep":95,"bit-twiddle":51,"typedarray-pool":458}],92:[function(require,module,exports){ +},{"./brute":95,"./median":97,"./partition":98,"./sweep":100,"bit-twiddle":51,"typedarray-pool":481}],97:[function(require,module,exports){ 'use strict' module.exports = findMedian @@ -11334,7 +12441,7 @@ function findMedian(d, axis, start, end, boxes, ids) { start, mid, boxes, ids, boxes[elemSize*mid+axis]) } -},{"./partition":93}],93:[function(require,module,exports){ +},{"./partition":98}],98:[function(require,module,exports){ 'use strict' module.exports = genPartition @@ -11355,7 +12462,7 @@ function genPartition(predicate, args) { .replace('$', predicate)) return Function.apply(void 0, fargs) } -},{}],94:[function(require,module,exports){ +},{}],99:[function(require,module,exports){ 'use strict'; //This code is extracted from ndarray-sort @@ -11592,7 +12699,7 @@ function quickSort(left, right, data) { quickSort(less, great, data); } } -},{}],95:[function(require,module,exports){ +},{}],100:[function(require,module,exports){ 'use strict' module.exports = { @@ -12027,7 +13134,7 @@ red_loop: } } } -},{"./sort":94,"bit-twiddle":51,"typedarray-pool":458}],96:[function(require,module,exports){ +},{"./sort":99,"bit-twiddle":51,"typedarray-pool":481}],101:[function(require,module,exports){ (function (Buffer){ var hasTypedArrays = false if(typeof Float64Array !== "undefined") { @@ -12131,7 +13238,7 @@ module.exports.denormalized = function(n) { return !(hi & 0x7ff00000) } }).call(this,require("buffer").Buffer) -},{"buffer":53}],97:[function(require,module,exports){ +},{"buffer":52}],102:[function(require,module,exports){ "use strict" var doubleBits = require("double-bits") @@ -12174,7 +13281,7 @@ function nextafter(x, y) { } return doubleBits.pack(lo, hi) } -},{"double-bits":96}],98:[function(require,module,exports){ +},{"double-bits":101}],103:[function(require,module,exports){ 'use strict' var bnadd = require('big-rat/add') @@ -12190,7 +13297,7 @@ function add(a, b) { return r } -},{"big-rat/add":72}],99:[function(require,module,exports){ +},{"big-rat/add":77}],104:[function(require,module,exports){ 'use strict' module.exports = float2rat @@ -12205,7 +13312,7 @@ function float2rat(v) { return result } -},{"big-rat":75}],100:[function(require,module,exports){ +},{"big-rat":80}],105:[function(require,module,exports){ 'use strict' var rat = require('big-rat') @@ -12223,7 +13330,7 @@ function muls(a, x) { return r } -},{"big-rat":75,"big-rat/mul":84}],101:[function(require,module,exports){ +},{"big-rat":80,"big-rat/mul":89}],106:[function(require,module,exports){ 'use strict' var bnsub = require('big-rat/sub') @@ -12239,7 +13346,7 @@ function sub(a, b) { return r } -},{"big-rat/sub":87}],102:[function(require,module,exports){ +},{"big-rat/sub":92}],107:[function(require,module,exports){ "use strict" module.exports = segmentsIntersect @@ -12287,7 +13394,7 @@ function segmentsIntersect(a0, a1, b0, b1) { return true } -},{"robust-orientation":439}],103:[function(require,module,exports){ +},{"robust-orientation":462}],108:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -12350,7 +13457,7 @@ proto.link = function(x, y) { ++ranks[xr]; } } -},{}],104:[function(require,module,exports){ +},{}],109:[function(require,module,exports){ (function (Buffer){ var clone = (function() { 'use strict'; @@ -12514,10 +13621,10 @@ if (typeof module === 'object' && module.exports) { } }).call(this,require("buffer").Buffer) -},{"buffer":53}],105:[function(require,module,exports){ +},{"buffer":52}],110:[function(require,module,exports){ module.exports={"jet":[{"index":0,"rgb":[0,0,131]},{"index":0.125,"rgb":[0,60,170]},{"index":0.375,"rgb":[5,255,255]},{"index":0.625,"rgb":[255,255,0]},{"index":0.875,"rgb":[250,0,0]},{"index":1,"rgb":[128,0,0]}],"hsv":[{"index":0,"rgb":[255,0,0]},{"index":0.169,"rgb":[253,255,2]},{"index":0.173,"rgb":[247,255,2]},{"index":0.337,"rgb":[0,252,4]},{"index":0.341,"rgb":[0,252,10]},{"index":0.506,"rgb":[1,249,255]},{"index":0.671,"rgb":[2,0,253]},{"index":0.675,"rgb":[8,0,253]},{"index":0.839,"rgb":[255,0,251]},{"index":0.843,"rgb":[255,0,245]},{"index":1,"rgb":[255,0,6]}],"hot":[{"index":0,"rgb":[0,0,0]},{"index":0.3,"rgb":[230,0,0]},{"index":0.6,"rgb":[255,210,0]},{"index":1,"rgb":[255,255,255]}],"cool":[{"index":0,"rgb":[0,255,255]},{"index":1,"rgb":[255,0,255]}],"spring":[{"index":0,"rgb":[255,0,255]},{"index":1,"rgb":[255,255,0]}],"summer":[{"index":0,"rgb":[0,128,102]},{"index":1,"rgb":[255,255,102]}],"autumn":[{"index":0,"rgb":[255,0,0]},{"index":1,"rgb":[255,255,0]}],"winter":[{"index":0,"rgb":[0,0,255]},{"index":1,"rgb":[0,255,128]}],"bone":[{"index":0,"rgb":[0,0,0]},{"index":0.376,"rgb":[84,84,116]},{"index":0.753,"rgb":[169,200,200]},{"index":1,"rgb":[255,255,255]}],"copper":[{"index":0,"rgb":[0,0,0]},{"index":0.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":0.125,"rgb":[37,52,148]},{"index":0.25,"rgb":[34,94,168]},{"index":0.375,"rgb":[29,145,192]},{"index":0.5,"rgb":[65,182,196]},{"index":0.625,"rgb":[127,205,187]},{"index":0.75,"rgb":[199,233,180]},{"index":0.875,"rgb":[237,248,217]},{"index":1,"rgb":[255,255,217]}],"greens":[{"index":0,"rgb":[0,68,27]},{"index":0.125,"rgb":[0,109,44]},{"index":0.25,"rgb":[35,139,69]},{"index":0.375,"rgb":[65,171,93]},{"index":0.5,"rgb":[116,196,118]},{"index":0.625,"rgb":[161,217,155]},{"index":0.75,"rgb":[199,233,192]},{"index":0.875,"rgb":[229,245,224]},{"index":1,"rgb":[247,252,245]}],"yiorrd":[{"index":0,"rgb":[128,0,38]},{"index":0.125,"rgb":[189,0,38]},{"index":0.25,"rgb":[227,26,28]},{"index":0.375,"rgb":[252,78,42]},{"index":0.5,"rgb":[253,141,60]},{"index":0.625,"rgb":[254,178,76]},{"index":0.75,"rgb":[254,217,118]},{"index":0.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":0.35,"rgb":[106,137,247]},{"index":0.5,"rgb":[190,190,190]},{"index":0.6,"rgb":[220,170,132]},{"index":0.7,"rgb":[230,145,90]},{"index":1,"rgb":[178,10,28]}],"picnic":[{"index":0,"rgb":[0,0,255]},{"index":0.1,"rgb":[51,153,255]},{"index":0.2,"rgb":[102,204,255]},{"index":0.3,"rgb":[153,204,255]},{"index":0.4,"rgb":[204,204,255]},{"index":0.5,"rgb":[255,255,255]},{"index":0.6,"rgb":[255,204,255]},{"index":0.7,"rgb":[255,153,255]},{"index":0.8,"rgb":[255,102,204]},{"index":0.9,"rgb":[255,102,102]},{"index":1,"rgb":[255,0,0]}],"rainbow":[{"index":0,"rgb":[150,0,90]},{"index":0.125,"rgb":[0,0,200]},{"index":0.25,"rgb":[0,25,255]},{"index":0.375,"rgb":[0,152,255]},{"index":0.5,"rgb":[44,255,150]},{"index":0.625,"rgb":[151,255,0]},{"index":0.75,"rgb":[255,234,0]},{"index":0.875,"rgb":[255,111,0]},{"index":1,"rgb":[255,0,0]}],"portland":[{"index":0,"rgb":[12,51,131]},{"index":0.25,"rgb":[10,136,186]},{"index":0.5,"rgb":[242,211,56]},{"index":0.75,"rgb":[242,143,56]},{"index":1,"rgb":[217,30,30]}],"blackbody":[{"index":0,"rgb":[0,0,0]},{"index":0.2,"rgb":[230,0,0]},{"index":0.4,"rgb":[230,210,0]},{"index":0.7,"rgb":[255,255,255]},{"index":1,"rgb":[160,200,255]}],"earth":[{"index":0,"rgb":[0,0,130]},{"index":0.1,"rgb":[0,180,180]},{"index":0.2,"rgb":[40,210,40]},{"index":0.4,"rgb":[230,230,50]},{"index":0.6,"rgb":[120,70,20]},{"index":1,"rgb":[255,255,255]}],"electric":[{"index":0,"rgb":[0,0,0]},{"index":0.15,"rgb":[30,0,100]},{"index":0.4,"rgb":[120,0,100]},{"index":0.6,"rgb":[160,90,0]},{"index":0.8,"rgb":[230,200,0]},{"index":1,"rgb":[255,250,220]}], "alpha": [{"index":0, "rgb": [255,255,255,0]},{"index":0, "rgb": [255,255,255,1]}]}; -},{}],106:[function(require,module,exports){ +},{}],111:[function(require,module,exports){ /* * Ben Postlethwaite * January 2013 @@ -12653,7 +13760,7 @@ function rgbaStr (rgba) { return 'rgba(' + rgba.join(',') + ')'; } -},{"./colorScales":105,"arraytools":50,"clone":104}],107:[function(require,module,exports){ +},{"./colorScales":110,"arraytools":50,"clone":109}],112:[function(require,module,exports){ module.exports = compareCells var min = Math.min @@ -12709,7 +13816,7 @@ function compareCells(a, b) { } } -},{}],108:[function(require,module,exports){ +},{}],113:[function(require,module,exports){ "use strict" var convexHull1d = require('./lib/ch1d') @@ -12735,7 +13842,7 @@ function convexHull(points) { } return convexHullnd(points, d) } -},{"./lib/ch1d":109,"./lib/ch2d":110,"./lib/chnd":111}],109:[function(require,module,exports){ +},{"./lib/ch1d":114,"./lib/ch2d":115,"./lib/chnd":116}],114:[function(require,module,exports){ "use strict" module.exports = convexHull1d @@ -12759,7 +13866,7 @@ function convexHull1d(points) { return [[lo]] } } -},{}],110:[function(require,module,exports){ +},{}],115:[function(require,module,exports){ 'use strict' module.exports = convexHull2D @@ -12782,7 +13889,7 @@ function convexHull2D(points) { return edges } -},{"monotone-convex-hull-2d":113}],111:[function(require,module,exports){ +},{"monotone-convex-hull-2d":118}],116:[function(require,module,exports){ 'use strict' module.exports = convexHullnD @@ -12843,7 +13950,7 @@ function convexHullnD(points, d) { return invPermute(nhull, ah) } } -},{"affine-hull":112,"incremental-convex-hull":241}],112:[function(require,module,exports){ +},{"affine-hull":117,"incremental-convex-hull":246}],117:[function(require,module,exports){ 'use strict' module.exports = affineHull @@ -12895,7 +14002,7 @@ function affineHull(points) { } return index } -},{"robust-orientation":439}],113:[function(require,module,exports){ +},{"robust-orientation":462}],118:[function(require,module,exports){ 'use strict' module.exports = monotoneConvexHull2D @@ -12977,7 +14084,7 @@ function monotoneConvexHull2D(points) { //Return result return result } -},{"robust-orientation":439}],114:[function(require,module,exports){ +},{"robust-orientation":462}],119:[function(require,module,exports){ module.exports = { AFG: "afghan", ALA: "\\b\\wland", @@ -13236,7 +14343,7 @@ module.exports = { ZWE: "zimbabwe|^(?!.*northern).*rhodesia" }; -},{}],115:[function(require,module,exports){ +},{}],120:[function(require,module,exports){ "use strict" var createThunk = require("./lib/thunk.js") @@ -13347,7 +14454,7 @@ function compileCwise(user_args) { module.exports = compileCwise -},{"./lib/thunk.js":117}],116:[function(require,module,exports){ +},{"./lib/thunk.js":122}],121:[function(require,module,exports){ "use strict" var uniq = require("uniq") @@ -13703,7 +14810,7 @@ function generateCWiseOp(proc, typesig) { } module.exports = generateCWiseOp -},{"uniq":459}],117:[function(require,module,exports){ +},{"uniq":482}],122:[function(require,module,exports){ "use strict" // The function below is called when constructing a cwise function object, and does the following: @@ -13791,9 +14898,9 @@ function createThunk(proc) { module.exports = createThunk -},{"./compile.js":116}],118:[function(require,module,exports){ +},{"./compile.js":121}],123:[function(require,module,exports){ module.exports = require("cwise-compiler") -},{"cwise-compiler":115}],119:[function(require,module,exports){ +},{"cwise-compiler":120}],124:[function(require,module,exports){ !function() { var d3 = { version: "3.5.16" @@ -23348,7 +24455,7 @@ module.exports = require("cwise-compiler") }); if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; }(); -},{}],120:[function(require,module,exports){ +},{}],125:[function(require,module,exports){ "use strict" var ch = require("incremental-convex-hull") @@ -23508,7 +24615,7 @@ function triangulate(points, includePointAtInfinity) { return hull } -},{"incremental-convex-hull":241,"uniq":459}],121:[function(require,module,exports){ +},{"incremental-convex-hull":246,"uniq":482}],126:[function(require,module,exports){ "use strict" function dupe_array(count, value, i) { @@ -23558,7 +24665,7 @@ function dupe(count, value) { } module.exports = dupe -},{}],122:[function(require,module,exports){ +},{}],127:[function(require,module,exports){ (function (process,global){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. @@ -24516,7 +25623,7 @@ module.exports = dupe }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":60}],123:[function(require,module,exports){ +},{"_process":59}],128:[function(require,module,exports){ /** * inspired by is-number * but significantly simplified and sped up by ignoring number and string constructors @@ -24573,7 +25680,7 @@ module.exports = function(n) { return n - n < 1; }; -},{}],124:[function(require,module,exports){ +},{}],129:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -24727,7 +25834,7 @@ function createBuffer(gl, data, type, usage) { module.exports = createBuffer -},{"ndarray":433,"ndarray-ops":432,"typedarray-pool":458}],125:[function(require,module,exports){ +},{"ndarray":456,"ndarray-ops":455,"typedarray-pool":481}],130:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -24977,7 +26084,7 @@ function createError2D (plot, options) { return errorbars } -},{"./lib/shaders":126,"gl-buffer":124,"gl-shader":203,"typedarray-pool":458}],126:[function(require,module,exports){ +},{"./lib/shaders":131,"gl-buffer":129,"gl-shader":208,"typedarray-pool":481}],131:[function(require,module,exports){ module.exports = { @@ -24985,7 +26092,7 @@ module.exports = { fragment: "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n" } -},{}],127:[function(require,module,exports){ +},{}],132:[function(require,module,exports){ 'use strict' module.exports = createErrorBars @@ -25222,7 +26329,7 @@ function createErrorBars(options) { return result } -},{"./shaders/index":128,"gl-buffer":124,"gl-vao":232}],128:[function(require,module,exports){ +},{"./shaders/index":133,"gl-buffer":129,"gl-vao":237}],133:[function(require,module,exports){ 'use strict' @@ -25239,7 +26346,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":203}],129:[function(require,module,exports){ +},{"gl-shader":208}],134:[function(require,module,exports){ 'use strict' var createTexture = require('gl-texture2d') @@ -25706,7 +26813,7 @@ function createFBO(gl, width, height, options) { WEBGL_draw_buffers) } -},{"gl-texture2d":228}],130:[function(require,module,exports){ +},{"gl-texture2d":233}],135:[function(require,module,exports){ exports.lineVertex = "precision mediump float;\n#define GLSLIFY 1\n\nfloat inverse_1_0(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse_1_0(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse_1_0(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse_1_0(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\nvoid main() {\n vec2 dir = (matrix * vec3(d, 0)).xy;\n vec3 base = matrix * vec3(a, 1);\n vec2 n = 0.5 * width *\n normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(base.xy/base.z + n, 0, 1);\n}\n" @@ -25718,7 +26825,7 @@ exports.pickFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform exports.fillVertex = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 projectAxis;\nuniform float projectValue;\nuniform float depth;\n\nvoid main() {\n vec3 base = matrix * vec3(a, 1);\n vec2 p = base.xy / base.z;\n if(d.y < 0.0 || (d.y == 0.0 && d.x < 0.0)) {\n if(dot(p, projectAxis) < projectValue) {\n p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n }\n }\n gl_Position = vec4(p, depth, 1);\n}\n" exports.fillFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n" -},{}],131:[function(require,module,exports){ +},{}],136:[function(require,module,exports){ 'use strict' module.exports = createLinePlot @@ -26191,7 +27298,7 @@ function createLinePlot(plot, options) { return linePlot } -},{"./lib/shaders":130,"gl-buffer":124,"gl-shader":203,"gl-texture2d":228,"ndarray":433,"typedarray-pool":458}],132:[function(require,module,exports){ +},{"./lib/shaders":135,"gl-buffer":129,"gl-shader":208,"gl-texture2d":233,"ndarray":456,"typedarray-pool":481}],137:[function(require,module,exports){ var createShader = require('gl-shader') @@ -26215,7 +27322,7 @@ exports.createPickShader = function(gl) { return createShader(gl, vertSrc, pickFrag, null, ATTRIBUTES) } -},{"gl-shader":203}],133:[function(require,module,exports){ +},{"gl-shader":208}],138:[function(require,module,exports){ 'use strict' module.exports = createLinePlot @@ -26585,9 +27692,9 @@ function createLinePlot (options) { return linePlot } -},{"./lib/shaders":132,"binary-search-bounds":134,"gl-buffer":124,"gl-texture2d":228,"gl-vao":232,"glsl-read-float":135,"ndarray":433}],134:[function(require,module,exports){ +},{"./lib/shaders":137,"binary-search-bounds":139,"gl-buffer":129,"gl-texture2d":233,"gl-vao":237,"glsl-read-float":140,"ndarray":456}],139:[function(require,module,exports){ arguments[4][22][0].apply(exports,arguments) -},{"dup":22}],135:[function(require,module,exports){ +},{"dup":22}],140:[function(require,module,exports){ module.exports = decodeFloat var UINT8_VIEW = new Uint8Array(4) @@ -26601,7 +27708,7 @@ function decodeFloat(x, y, z, w) { return FLOAT_VIEW[0] } -},{}],136:[function(require,module,exports){ +},{}],141:[function(require,module,exports){ module.exports = invert /** @@ -26640,7 +27747,7 @@ function invert(out, a) { return out } -},{}],137:[function(require,module,exports){ +},{}],142:[function(require,module,exports){ module.exports = clone; /** @@ -26669,7 +27776,7 @@ function clone(a) { out[15] = a[15]; return out; }; -},{}],138:[function(require,module,exports){ +},{}],143:[function(require,module,exports){ module.exports = create; /** @@ -26697,7 +27804,7 @@ function create() { out[15] = 1; return out; }; -},{}],139:[function(require,module,exports){ +},{}],144:[function(require,module,exports){ module.exports = determinant; /** @@ -26728,7 +27835,7 @@ function determinant(a) { // Calculate the determinant return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; }; -},{}],140:[function(require,module,exports){ +},{}],145:[function(require,module,exports){ module.exports = fromQuat; /** @@ -26776,7 +27883,7 @@ function fromQuat(out, q) { return out; }; -},{}],141:[function(require,module,exports){ +},{}],146:[function(require,module,exports){ module.exports = fromRotationTranslation; /** @@ -26830,7 +27937,7 @@ function fromRotationTranslation(out, q, v) { return out; }; -},{}],142:[function(require,module,exports){ +},{}],147:[function(require,module,exports){ module.exports = identity; /** @@ -26858,7 +27965,7 @@ function identity(out) { out[15] = 1; return out; }; -},{}],143:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ module.exports = invert; /** @@ -26914,7 +28021,7 @@ function invert(out, a) { return out; }; -},{}],144:[function(require,module,exports){ +},{}],149:[function(require,module,exports){ var identity = require('./identity'); module.exports = lookAt; @@ -27005,7 +28112,7 @@ function lookAt(out, eye, center, up) { return out; }; -},{"./identity":142}],145:[function(require,module,exports){ +},{"./identity":147}],150:[function(require,module,exports){ module.exports = multiply; /** @@ -27048,7 +28155,7 @@ function multiply(out, a, b) { out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; return out; }; -},{}],146:[function(require,module,exports){ +},{}],151:[function(require,module,exports){ module.exports = perspective; /** @@ -27082,7 +28189,7 @@ function perspective(out, fovy, aspect, near, far) { out[15] = 0; return out; }; -},{}],147:[function(require,module,exports){ +},{}],152:[function(require,module,exports){ module.exports = rotate; /** @@ -27147,7 +28254,7 @@ function rotate(out, a, rad, axis) { } return out; }; -},{}],148:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ module.exports = rotateX; /** @@ -27192,7 +28299,7 @@ function rotateX(out, a, rad) { out[11] = a23 * c - a13 * s; return out; }; -},{}],149:[function(require,module,exports){ +},{}],154:[function(require,module,exports){ module.exports = rotateY; /** @@ -27237,7 +28344,7 @@ function rotateY(out, a, rad) { out[11] = a03 * s + a23 * c; return out; }; -},{}],150:[function(require,module,exports){ +},{}],155:[function(require,module,exports){ module.exports = rotateZ; /** @@ -27282,7 +28389,7 @@ function rotateZ(out, a, rad) { out[7] = a13 * c - a03 * s; return out; }; -},{}],151:[function(require,module,exports){ +},{}],156:[function(require,module,exports){ module.exports = scale; /** @@ -27314,7 +28421,7 @@ function scale(out, a, v) { out[15] = a[15]; return out; }; -},{}],152:[function(require,module,exports){ +},{}],157:[function(require,module,exports){ module.exports = translate; /** @@ -27353,7 +28460,7 @@ function translate(out, a, v) { return out; }; -},{}],153:[function(require,module,exports){ +},{}],158:[function(require,module,exports){ module.exports = transpose; /** @@ -27403,7 +28510,7 @@ function transpose(out, a) { return out; }; -},{}],154:[function(require,module,exports){ +},{}],159:[function(require,module,exports){ 'use strict' var barycentric = require('barycentric') @@ -27501,7 +28608,7 @@ function closestPointToPickLocation(simplex, pixelCoord, model, view, projection } return [closestIndex, interpolate(simplex, weights), weights] } -},{"barycentric":157,"polytope-closest-point/lib/closest_point_2d.js":159}],155:[function(require,module,exports){ +},{"barycentric":162,"polytope-closest-point/lib/closest_point_2d.js":164}],160:[function(require,module,exports){ var triVertSrc = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}" @@ -27570,7 +28677,7 @@ exports.contourShader = { ] } -},{}],156:[function(require,module,exports){ +},{}],161:[function(require,module,exports){ 'use strict' var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small @@ -28585,7 +29692,7 @@ function createSimplicialMesh(params) { module.exports = createSimplicialMesh -},{"./lib/closest-point":154,"./lib/shaders":155,"colormap":106,"gl-buffer":124,"gl-mat4/invert":143,"gl-mat4/multiply":145,"gl-shader":203,"gl-texture2d":228,"gl-vao":232,"ndarray":433,"normals":158,"simplicial-complex-contour":160,"typedarray-pool":458}],157:[function(require,module,exports){ +},{"./lib/closest-point":159,"./lib/shaders":160,"colormap":111,"gl-buffer":129,"gl-mat4/invert":148,"gl-mat4/multiply":150,"gl-shader":208,"gl-texture2d":233,"gl-vao":237,"ndarray":456,"normals":163,"simplicial-complex-contour":165,"typedarray-pool":481}],162:[function(require,module,exports){ 'use strict' module.exports = barycentric @@ -28633,7 +29740,7 @@ function barycentric(simplex, point) { } return y } -},{"robust-linear-solve":436}],158:[function(require,module,exports){ +},{"robust-linear-solve":459}],163:[function(require,module,exports){ var DEFAULT_NORMALS_EPSILON = 1e-6; var DEFAULT_FACE_EPSILON = 1e-6; @@ -28758,7 +29865,7 @@ exports.faceNormals = function(faces, positions, specifiedEpsilon) { -},{}],159:[function(require,module,exports){ +},{}],164:[function(require,module,exports){ //Optimized version for triangle closest point // Based on Eberly's WildMagick codes // http://www.geometrictools.com/LibMathematics/Distance/Distance.html @@ -28956,7 +30063,7 @@ function closestPoint2d(V0, V1, V2, point, result) { module.exports = closestPoint2d; -},{}],160:[function(require,module,exports){ +},{}],165:[function(require,module,exports){ 'use strict' module.exports = extractContour @@ -29119,7 +30226,7 @@ function extractContour(cells, values, level, d) { vertexWeights: uweights } } -},{"./lib/codegen":161,"ndarray":433,"ndarray-sort":164,"typedarray-pool":458}],161:[function(require,module,exports){ +},{"./lib/codegen":166,"ndarray":456,"ndarray-sort":169,"typedarray-pool":481}],166:[function(require,module,exports){ 'use strict' module.exports = getPolygonizer @@ -29216,7 +30323,7 @@ function getPolygonizer(d) { } return alg } -},{"marching-simplex-table":162,"typedarray-pool":458}],162:[function(require,module,exports){ +},{"marching-simplex-table":167,"typedarray-pool":481}],167:[function(require,module,exports){ 'use strict' module.exports = createTable @@ -29282,7 +30389,7 @@ function createTable(dimension) { } return result } -},{"convex-hull":108}],163:[function(require,module,exports){ +},{"convex-hull":113}],168:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -30011,7 +31118,7 @@ function compileSort(order, dtype) { } module.exports = compileSort -},{"typedarray-pool":458}],164:[function(require,module,exports){ +},{"typedarray-pool":481}],169:[function(require,module,exports){ "use strict" var compile = require("./lib/compile_sort.js") @@ -30031,7 +31138,7 @@ function sort(array) { } module.exports = sort -},{"./lib/compile_sort.js":163}],165:[function(require,module,exports){ +},{"./lib/compile_sort.js":168}],170:[function(require,module,exports){ 'use strict' module.exports = createBoxes @@ -30094,7 +31201,7 @@ function createBoxes(plot) { return new Boxes(plot, vbo, shader) } -},{"./shaders":168,"gl-buffer":124,"gl-shader":203}],166:[function(require,module,exports){ +},{"./shaders":173,"gl-buffer":129,"gl-shader":208}],171:[function(require,module,exports){ 'use strict' module.exports = createGrid @@ -30341,7 +31448,7 @@ function createGrid(plot) { return grid } -},{"./shaders":168,"binary-search-bounds":170,"gl-buffer":124,"gl-shader":203}],167:[function(require,module,exports){ +},{"./shaders":173,"binary-search-bounds":175,"gl-buffer":129,"gl-shader":208}],172:[function(require,module,exports){ 'use strict' module.exports = createLines @@ -30406,7 +31513,7 @@ function createLines(plot) { return lines } -},{"./shaders":168,"gl-buffer":124,"gl-shader":203}],168:[function(require,module,exports){ +},{"./shaders":173,"gl-buffer":129,"gl-shader":208}],173:[function(require,module,exports){ 'use strict' @@ -30424,7 +31531,7 @@ module.exports = { tickVert: "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n" } -},{}],169:[function(require,module,exports){ +},{}],174:[function(require,module,exports){ 'use strict' module.exports = createTextElements @@ -30699,9 +31806,9 @@ function createTextElements(plot) { return text } -},{"./shaders":168,"binary-search-bounds":170,"gl-buffer":124,"gl-shader":203,"text-cache":453}],170:[function(require,module,exports){ -arguments[4][68][0].apply(exports,arguments) -},{"dup":68}],171:[function(require,module,exports){ +},{"./shaders":173,"binary-search-bounds":175,"gl-buffer":129,"gl-shader":208,"text-cache":476}],175:[function(require,module,exports){ +arguments[4][73][0].apply(exports,arguments) +},{"dup":73}],176:[function(require,module,exports){ 'use strict' module.exports = createGLPlot2D @@ -31274,7 +32381,7 @@ function createGLPlot2D(options) { return plot } -},{"./lib/box":165,"./lib/grid":166,"./lib/line":167,"./lib/text":169,"gl-select-static":202}],172:[function(require,module,exports){ +},{"./lib/box":170,"./lib/grid":171,"./lib/line":172,"./lib/text":174,"gl-select-static":207}],177:[function(require,module,exports){ var createShader = require('gl-shader') @@ -31285,7 +32392,7 @@ module.exports = function(gl) { return createShader(gl, vertSrc, fragSrc, null, [ { name: 'position', type: 'vec2'}]) } -},{"gl-shader":203}],173:[function(require,module,exports){ +},{"gl-shader":208}],178:[function(require,module,exports){ 'use strict' module.exports = createCamera @@ -31494,7 +32601,7 @@ function createCamera(element, options) { return camera } -},{"3d-view":40,"mouse-change":421,"mouse-wheel":425,"right-now":435}],174:[function(require,module,exports){ +},{"3d-view":40,"mouse-change":444,"mouse-wheel":448,"right-now":458}],179:[function(require,module,exports){ // Copyright (C) 2011 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -32181,7 +33288,7 @@ function createCamera(element, options) { } })(); -},{}],175:[function(require,module,exports){ +},{}],180:[function(require,module,exports){ 'use strict' var weakMap = typeof WeakMap === 'undefined' ? require('weak-map') : WeakMap @@ -32211,7 +33318,7 @@ function createABigTriangle(gl) { module.exports = createABigTriangle -},{"gl-buffer":124,"gl-vao":232,"weak-map":174}],176:[function(require,module,exports){ +},{"gl-buffer":129,"gl-vao":237,"weak-map":179}],181:[function(require,module,exports){ 'use strict' module.exports = createAxes @@ -32734,7 +33841,7 @@ function createAxes(gl, options) { return axes } -},{"./lib/background.js":177,"./lib/cube.js":178,"./lib/lines.js":179,"./lib/text.js":181,"./lib/ticks.js":182}],177:[function(require,module,exports){ +},{"./lib/background.js":182,"./lib/cube.js":183,"./lib/lines.js":184,"./lib/text.js":186,"./lib/ticks.js":187}],182:[function(require,module,exports){ 'use strict' module.exports = createBackgroundCube @@ -32846,7 +33953,7 @@ function createBackgroundCube(gl) { return new BackgroundCube(gl, buffer, vao, shader) } -},{"./shaders":180,"gl-buffer":124,"gl-vao":232}],178:[function(require,module,exports){ +},{"./shaders":185,"gl-buffer":129,"gl-vao":237}],183:[function(require,module,exports){ "use strict" module.exports = getCubeEdges @@ -33087,7 +34194,7 @@ function getCubeEdges(model, view, projection, bounds) { //Return result return CUBE_RESULT } -},{"bit-twiddle":51,"gl-mat4/invert":143,"gl-mat4/multiply":145,"robust-orientation":439,"split-polygon":184}],179:[function(require,module,exports){ +},{"bit-twiddle":51,"gl-mat4/invert":148,"gl-mat4/multiply":150,"robust-orientation":462,"split-polygon":189}],184:[function(require,module,exports){ 'use strict' module.exports = createLines @@ -33293,7 +34400,7 @@ function createLines(gl, bounds, ticks) { return new Lines(gl, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset) } -},{"./shaders":180,"gl-buffer":124,"gl-vao":232}],180:[function(require,module,exports){ +},{"./shaders":185,"gl-buffer":129,"gl-vao":237}],185:[function(require,module,exports){ 'use strict' @@ -33324,7 +34431,7 @@ exports.bg = function(gl) { ]) } -},{"gl-shader":203}],181:[function(require,module,exports){ +},{"gl-shader":208}],186:[function(require,module,exports){ (function (process){ "use strict" @@ -33526,7 +34633,7 @@ function createTextSprites( } }).call(this,require('_process')) -},{"./shaders":180,"_process":60,"gl-buffer":124,"gl-vao":232,"vectorize-text":460}],182:[function(require,module,exports){ +},{"./shaders":185,"_process":59,"gl-buffer":129,"gl-vao":237,"vectorize-text":483}],187:[function(require,module,exports){ 'use strict' exports.create = defaultTicks @@ -33599,7 +34706,7 @@ function ticksEqual(ticksA, ticksB) { } return true } -},{}],183:[function(require,module,exports){ +},{}],188:[function(require,module,exports){ "use strict" module.exports = extractPlanes @@ -33616,7 +34723,7 @@ function extractPlanes(M, zNear, zFar) { [ zf*M[12] - M[8], zf*M[13] - M[9], zf*M[14] - M[10], zf*M[15] - M[11] ] ] } -},{}],184:[function(require,module,exports){ +},{}],189:[function(require,module,exports){ "use strict" var robustDot = require("robust-dot-product") @@ -33708,7 +34815,7 @@ function negative(points, plane) { } return neg } -},{"robust-dot-product":185,"robust-sum":442}],185:[function(require,module,exports){ +},{"robust-dot-product":190,"robust-sum":465}],190:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -33723,7 +34830,7 @@ function robustDotProduct(a, b) { } return r } -},{"robust-sum":442,"two-product":456}],186:[function(require,module,exports){ +},{"robust-sum":465,"two-product":479}],191:[function(require,module,exports){ "use strict" module.exports = axesProperties @@ -33865,7 +34972,7 @@ i_loop: return ranges } -},{"./lib/cube.js":178,"extract-frustum-planes":183,"gl-mat4/multiply":145,"gl-mat4/transpose":153,"gl-vec4/transformMat4":233,"split-polygon":184}],187:[function(require,module,exports){ +},{"./lib/cube.js":183,"extract-frustum-planes":188,"gl-mat4/multiply":150,"gl-mat4/transpose":158,"gl-vec4/transformMat4":238,"split-polygon":189}],192:[function(require,module,exports){ 'use strict' @@ -33882,7 +34989,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":203}],188:[function(require,module,exports){ +},{"gl-shader":208}],193:[function(require,module,exports){ 'use strict' var createBuffer = require('gl-buffer') @@ -34078,7 +35185,7 @@ function createSpikes(gl, options) { return spikes } -},{"./shaders/index":187,"gl-buffer":124,"gl-vao":232}],189:[function(require,module,exports){ +},{"./shaders/index":192,"gl-buffer":129,"gl-vao":237}],194:[function(require,module,exports){ 'use strict' module.exports = createScene @@ -34843,7 +35950,7 @@ function createScene(options) { return scene } -},{"./lib/shader":172,"3d-view-controls":173,"a-big-triangle":175,"gl-axes3d":176,"gl-axes3d/properties":186,"gl-fbo":129,"gl-mat4/perspective":146,"gl-select-static":202,"gl-spikes3d":188,"mouse-change":421}],190:[function(require,module,exports){ +},{"./lib/shader":177,"3d-view-controls":178,"a-big-triangle":180,"gl-axes3d":181,"gl-axes3d/properties":191,"gl-fbo":134,"gl-mat4/perspective":151,"gl-select-static":207,"gl-spikes3d":193,"mouse-change":444}],195:[function(require,module,exports){ 'use strict' @@ -34855,7 +35962,7 @@ module.exports = { pickFragment: "precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n" } -},{}],191:[function(require,module,exports){ +},{}],196:[function(require,module,exports){ 'use strict' module.exports = createFancyScatter2D @@ -35242,7 +36349,7 @@ function createFancyScatter2D(plot, options) { return scatter } -},{"./lib/shaders":190,"gl-buffer":124,"gl-shader":203,"text-cache":453,"typedarray-pool":458,"vectorize-text":460}],192:[function(require,module,exports){ +},{"./lib/shaders":195,"gl-buffer":129,"gl-shader":208,"text-cache":476,"typedarray-pool":481,"vectorize-text":483}],197:[function(require,module,exports){ exports.pointVertex = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute float weight;\n\nuniform mat3 matrix;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n fragWeight = mix(1.0, weight, useWeight);\n}\n" @@ -35250,9 +36357,9 @@ exports.pointFragment = "precision mediump float;\n#define GLSLIFY 1\n\nunif exports.pickVertex = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n" exports.pickFragment = "precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0*gl_PointCoord.xy-1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n" -},{}],193:[function(require,module,exports){ -arguments[4][68][0].apply(exports,arguments) -},{"dup":68}],194:[function(require,module,exports){ +},{}],198:[function(require,module,exports){ +arguments[4][73][0].apply(exports,arguments) +},{"dup":73}],199:[function(require,module,exports){ 'use strict' module.exports = sortLevels @@ -35550,7 +36657,7 @@ function quickSort(left, right, data_levels, data_points, data_ids, data_weights } } -},{}],195:[function(require,module,exports){ +},{}],200:[function(require,module,exports){ 'use strict' var pool = require('typedarray-pool') @@ -35690,7 +36797,7 @@ function snapPoints(points, ids, weights, bounds) { return lod } -},{"./lib/sort":194,"typedarray-pool":458}],196:[function(require,module,exports){ +},{"./lib/sort":199,"typedarray-pool":481}],201:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -35986,7 +37093,7 @@ function createScatter2D(plot, options) { return result } -},{"./lib/shader":192,"binary-search-bounds":193,"gl-buffer":124,"gl-shader":203,"snap-points-2d":195,"typedarray-pool":458}],197:[function(require,module,exports){ +},{"./lib/shader":197,"binary-search-bounds":198,"gl-buffer":129,"gl-shader":208,"snap-points-2d":200,"typedarray-pool":481}],202:[function(require,module,exports){ "use strict" var vectorizeText = require("vectorize-text") @@ -36032,7 +37139,7 @@ function getGlyph(symbol, font) { //Save cached symbol return fontCache[symbol] = [triSymbol, lineSymbol, bounds] } -},{"vectorize-text":460}],198:[function(require,module,exports){ +},{"vectorize-text":483}],203:[function(require,module,exports){ var createShaderWrapper = require('gl-shader') @@ -36109,7 +37216,7 @@ exports.createPickProject = function(gl) { return createShader(gl, pickProject) } -},{"gl-shader":203}],199:[function(require,module,exports){ +},{"gl-shader":208}],204:[function(require,module,exports){ 'use strict' var createBuffer = require('gl-buffer') @@ -36869,7 +37976,7 @@ function createPointCloud(options) { return pointCloud } -},{"./lib/glyphs":197,"./lib/shaders":198,"gl-buffer":124,"gl-mat4/multiply":145,"gl-vao":232,"typedarray-pool":458}],200:[function(require,module,exports){ +},{"./lib/glyphs":202,"./lib/shaders":203,"gl-buffer":129,"gl-mat4/multiply":150,"gl-vao":237,"typedarray-pool":481}],205:[function(require,module,exports){ 'use strict' @@ -36877,7 +37984,7 @@ function createPointCloud(options) { exports.boxVertex = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n" exports.boxFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n" -},{}],201:[function(require,module,exports){ +},{}],206:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -37003,7 +38110,7 @@ function createSelectBox(plot, options) { return selectBox } -},{"./lib/shaders":200,"gl-buffer":124,"gl-shader":203}],202:[function(require,module,exports){ +},{"./lib/shaders":205,"gl-buffer":129,"gl-shader":208}],207:[function(require,module,exports){ 'use strict' module.exports = createSelectBuffer @@ -37014,7 +38121,7 @@ var ndarray = require('ndarray') var nextPow2 = require('bit-twiddle').nextPow2 -var selectRange = require('cwise/lib/wrapper')({"args":["array",{"offset":[0,0,1],"array":0},{"offset":[0,0,2],"array":0},{"offset":[0,0,3],"array":0},"scalar","scalar","index"],"pre":{"body":"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}","args":[],"thisVars":["this_closestD2","this_closestX","this_closestY"],"localVars":[]},"body":{"body":"{if(255>_inline_49_arg0_||255>_inline_49_arg1_||255>_inline_49_arg2_||255>_inline_49_arg3_){var _inline_49_l=_inline_49_arg4_-_inline_49_arg6_[0],_inline_49_a=_inline_49_arg5_-_inline_49_arg6_[1],_inline_49_f=_inline_49_l*_inline_49_l+_inline_49_a*_inline_49_a;_inline_49_f_inline_55_arg0_||255>_inline_55_arg1_||255>_inline_55_arg2_||255>_inline_55_arg3_){var _inline_55_l=_inline_55_arg4_-_inline_55_arg6_[0],_inline_55_a=_inline_55_arg5_-_inline_55_arg6_[1],_inline_55_f=_inline_55_l*_inline_55_l+_inline_55_a*_inline_55_a;_inline_55_f * @@ -38232,7 +39339,7 @@ module.exports = function padLeft(str, num, ch) { ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":434}],213:[function(require,module,exports){ +},{"repeat-string":457}],218:[function(require,module,exports){ module.exports = { 0: 'NONE', 1: 'ONE', @@ -38532,14 +39639,14 @@ module.exports = { 37444: 'BROWSER_DEFAULT_WEBGL' } -},{}],214:[function(require,module,exports){ +},{}],219:[function(require,module,exports){ var gl10 = require('./1.0/numbers') module.exports = function lookupConstant (number) { return gl10[number] } -},{"./1.0/numbers":213}],215:[function(require,module,exports){ +},{"./1.0/numbers":218}],220:[function(require,module,exports){ var tokenize = require('glsl-tokenizer') var atob = require('atob-lite') @@ -38564,12 +39671,12 @@ function getName(src) { } } -},{"atob-lite":216,"glsl-tokenizer":240}],216:[function(require,module,exports){ +},{"atob-lite":221,"glsl-tokenizer":245}],221:[function(require,module,exports){ module.exports = function _atob(str) { return atob(str) } -},{}],217:[function(require,module,exports){ +},{}],222:[function(require,module,exports){ (function(window) { var re = { not_string: /[^s]/, @@ -38779,7 +39886,7 @@ module.exports = function _atob(str) { } })(typeof window === "undefined" ? this : window); -},{}],218:[function(require,module,exports){ +},{}],223:[function(require,module,exports){ var hiddenStore = require('./hidden-store.js'); module.exports = createStore; @@ -38800,7 +39907,7 @@ function createStore() { }; } -},{"./hidden-store.js":219}],219:[function(require,module,exports){ +},{"./hidden-store.js":224}],224:[function(require,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -38818,7 +39925,7 @@ function hiddenStore(obj, key) { return store; } -},{}],220:[function(require,module,exports){ +},{}],225:[function(require,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -38848,7 +39955,7 @@ function weakMap() { } } -},{"./create-store.js":218}],221:[function(require,module,exports){ +},{"./create-store.js":223}],226:[function(require,module,exports){ 'use strict' module.exports = createSpikes2D @@ -38936,7 +40043,7 @@ function createSpikes2D(plot, options) { return spikes } -},{}],222:[function(require,module,exports){ +},{}],227:[function(require,module,exports){ var createShader = require('gl-shader') @@ -38986,9 +40093,9 @@ exports.createPickContourShader = function (gl) { return shader } -},{"gl-shader":203}],223:[function(require,module,exports){ +},{"gl-shader":208}],228:[function(require,module,exports){ arguments[4][22][0].apply(exports,arguments) -},{"dup":22}],224:[function(require,module,exports){ +},{"dup":22}],229:[function(require,module,exports){ 'use strict' module.exports = gradient @@ -39286,7 +40393,7 @@ function gradient(out, inp, bc) { var cached = generateGradient(bc) return cached(out, inp) } -},{"cwise-compiler":115,"dup":121}],225:[function(require,module,exports){ +},{"cwise-compiler":120,"dup":126}],230:[function(require,module,exports){ "use strict" var ndarray = require("ndarray") @@ -39309,10 +40416,10 @@ module.exports = function convert(arr, result) { return result } -},{"./doConvert.js":226,"ndarray":433}],226:[function(require,module,exports){ +},{"./doConvert.js":231,"ndarray":456}],231:[function(require,module,exports){ module.exports=require('cwise-compiler')({"args":["array","scalar","index"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}","args":[{"name":"_inline_1_arg0_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) -},{"cwise-compiler":115}],227:[function(require,module,exports){ +},{"cwise-compiler":120}],232:[function(require,module,exports){ 'use strict' module.exports = createSurfacePlot @@ -40629,7 +41736,7 @@ function createSurfacePlot (params) { return surface } -},{"./lib/shaders":222,"binary-search-bounds":223,"bit-twiddle":51,"colormap":106,"gl-buffer":124,"gl-mat4/invert":143,"gl-mat4/multiply":145,"gl-texture2d":228,"gl-vao":232,"ndarray":433,"ndarray-gradient":224,"ndarray-ops":432,"ndarray-pack":225,"surface-nets":452,"typedarray-pool":458}],228:[function(require,module,exports){ +},{"./lib/shaders":227,"binary-search-bounds":228,"bit-twiddle":51,"colormap":111,"gl-buffer":129,"gl-mat4/invert":148,"gl-mat4/multiply":150,"gl-texture2d":233,"gl-vao":237,"ndarray":456,"ndarray-gradient":229,"ndarray-ops":455,"ndarray-pack":230,"surface-nets":475,"typedarray-pool":481}],233:[function(require,module,exports){ 'use strict' var ndarray = require('ndarray') @@ -41188,7 +42295,7 @@ function createTexture2D(gl) { throw new Error('gl-texture2d: Invalid arguments for texture2d constructor') } -},{"ndarray":433,"ndarray-ops":432,"typedarray-pool":458}],229:[function(require,module,exports){ +},{"ndarray":456,"ndarray-ops":455,"typedarray-pool":481}],234:[function(require,module,exports){ "use strict" function doBind(gl, elements, attributes) { @@ -41243,7 +42350,7 @@ function doBind(gl, elements, attributes) { } module.exports = doBind -},{}],230:[function(require,module,exports){ +},{}],235:[function(require,module,exports){ "use strict" var bindAttribs = require("./do-bind.js") @@ -41283,7 +42390,7 @@ function createVAOEmulated(gl) { } module.exports = createVAOEmulated -},{"./do-bind.js":229}],231:[function(require,module,exports){ +},{"./do-bind.js":234}],236:[function(require,module,exports){ "use strict" var bindAttribs = require("./do-bind.js") @@ -41371,7 +42478,7 @@ function createVAONative(gl, ext) { } module.exports = createVAONative -},{"./do-bind.js":229}],232:[function(require,module,exports){ +},{"./do-bind.js":234}],237:[function(require,module,exports){ "use strict" var createVAONative = require("./lib/vao-native.js") @@ -41391,7 +42498,7 @@ function createVAO(gl, attributes, elements, elementsType) { module.exports = createVAO -},{"./lib/vao-emulated.js":230,"./lib/vao-native.js":231}],233:[function(require,module,exports){ +},{"./lib/vao-emulated.js":235,"./lib/vao-native.js":236}],238:[function(require,module,exports){ module.exports = transformMat4 /** @@ -41411,7 +42518,7 @@ function transformMat4 (out, a, m) { return out } -},{}],234:[function(require,module,exports){ +},{}],239:[function(require,module,exports){ module.exports = tokenize var literals100 = require('./lib/literals') @@ -41775,7 +42882,7 @@ function tokenize(opt) { } } -},{"./lib/builtins":236,"./lib/builtins-300es":235,"./lib/literals":238,"./lib/literals-300es":237,"./lib/operators":239}],235:[function(require,module,exports){ +},{"./lib/builtins":241,"./lib/builtins-300es":240,"./lib/literals":243,"./lib/literals-300es":242,"./lib/operators":244}],240:[function(require,module,exports){ // 300es builtins/reserved words that were previously valid in v100 var v100 = require('./builtins') @@ -41846,7 +42953,7 @@ module.exports = v100.concat([ , 'textureProjGradOffset' ]) -},{"./builtins":236}],236:[function(require,module,exports){ +},{"./builtins":241}],241:[function(require,module,exports){ module.exports = [ // Keep this list sorted 'abs' @@ -41998,7 +43105,7 @@ module.exports = [ , 'textureCubeGradEXT' ] -},{}],237:[function(require,module,exports){ +},{}],242:[function(require,module,exports){ var v100 = require('./literals') module.exports = v100.slice().concat([ @@ -42088,7 +43195,7 @@ module.exports = v100.slice().concat([ , 'usampler2DMSArray' ]) -},{"./literals":238}],238:[function(require,module,exports){ +},{"./literals":243}],243:[function(require,module,exports){ module.exports = [ // current 'precision' @@ -42183,7 +43290,7 @@ module.exports = [ , 'using' ] -},{}],239:[function(require,module,exports){ +},{}],244:[function(require,module,exports){ module.exports = [ '<<=' , '>>=' @@ -42232,7 +43339,7 @@ module.exports = [ , '}' ] -},{}],240:[function(require,module,exports){ +},{}],245:[function(require,module,exports){ var tokenize = require('./index') module.exports = tokenizeString @@ -42247,7 +43354,7 @@ function tokenizeString(str, opt) { return tokens } -},{"./index":234}],241:[function(require,module,exports){ +},{"./index":239}],246:[function(require,module,exports){ "use strict" //High level idea: @@ -42694,11 +43801,11 @@ function incrementalConvexHull(points, randomSearch) { //Extract boundary cells return triangles.boundary() } -},{"robust-orientation":439,"simplicial-complex":244}],242:[function(require,module,exports){ +},{"robust-orientation":462,"simplicial-complex":249}],247:[function(require,module,exports){ arguments[4][51][0].apply(exports,arguments) -},{"dup":51}],243:[function(require,module,exports){ -arguments[4][103][0].apply(exports,arguments) -},{"dup":103}],244:[function(require,module,exports){ +},{"dup":51}],248:[function(require,module,exports){ +arguments[4][108][0].apply(exports,arguments) +},{"dup":108}],249:[function(require,module,exports){ "use strict"; "use restrict"; var bits = require("bit-twiddle") @@ -43042,7 +44149,7 @@ function connectedComponents(cells, vertex_count) { } exports.connectedComponents = connectedComponents -},{"bit-twiddle":242,"union-find":243}],245:[function(require,module,exports){ +},{"bit-twiddle":247,"union-find":248}],250:[function(require,module,exports){ "use strict" function iota(n) { @@ -43054,7 +44161,7 @@ function iota(n) { } module.exports = iota -},{}],246:[function(require,module,exports){ +},{}],251:[function(require,module,exports){ /** * Determine if an object is Buffer * @@ -43073,24 +44180,73 @@ module.exports = function (obj) { )) } -},{}],247:[function(require,module,exports){ +},{}],252:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +module.exports = ArrayGroup; +function ArrayGroup(arrayTypes) { + var LayoutVertexArrayType = arrayTypes.layoutVertexArrayType; + this.layoutVertexArray = new LayoutVertexArrayType(); + var ElementArrayType = arrayTypes.elementArrayType; + if (ElementArrayType) + this.elementArray = new ElementArrayType(); + var ElementArrayType2 = arrayTypes.elementArrayType2; + if (ElementArrayType2) + this.elementArray2 = new ElementArrayType2(); + this.paintVertexArrays = util.mapObject(arrayTypes.paintVertexArrayTypes, function (PaintVertexArrayType) { + return new PaintVertexArrayType(); + }); +} +ArrayGroup.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1; +ArrayGroup.prototype.hasCapacityFor = function (numVertices) { + return this.layoutVertexArray.length + numVertices <= ArrayGroup.MAX_VERTEX_ARRAY_LENGTH; +}; +ArrayGroup.prototype.isEmpty = function () { + return this.layoutVertexArray.length === 0; +}; +ArrayGroup.prototype.trim = function () { + this.layoutVertexArray.trim(); + if (this.elementArray) { + this.elementArray.trim(); + } + if (this.elementArray2) { + this.elementArray2.trim(); + } + for (var layerName in this.paintVertexArrays) { + this.paintVertexArrays[layerName].trim(); + } +}; +ArrayGroup.prototype.serialize = function () { + return { + layoutVertexArray: this.layoutVertexArray.serialize(), + elementArray: this.elementArray && this.elementArray.serialize(), + elementArray2: this.elementArray2 && this.elementArray2.serialize(), + paintVertexArrays: util.mapObject(this.paintVertexArrays, function (array) { + return array.serialize(); + }) + }; +}; +ArrayGroup.prototype.getTransferables = function (transferables) { + transferables.push(this.layoutVertexArray.arrayBuffer); + if (this.elementArray) { + transferables.push(this.elementArray.arrayBuffer); + } + if (this.elementArray2) { + transferables.push(this.elementArray2.arrayBuffer); + } + for (var layerName in this.paintVertexArrays) { + transferables.push(this.paintVertexArrays[layerName].arrayBuffer); + } +}; +},{"../util/util":366}],253:[function(require,module,exports){ 'use strict'; - var featureFilter = require('feature-filter'); -var Buffer = require('./buffer'); +var ArrayGroup = require('./array_group'); +var BufferGroup = require('./buffer_group'); var util = require('../util/util'); var StructArrayType = require('../util/struct_array'); -var VertexArrayObject = require('../render/vertex_array_object'); - module.exports = Bucket; - -/** - * Instantiate the appropriate subclass of `Bucket` for `options`. - * @private - * @param options See `Bucket` constructor options - * @returns {Bucket} - */ -Bucket.create = function(options) { +Bucket.create = function (options) { var Classes = { fill: require('./bucket/fill_bucket'), line: require('./bucket/line_bucket'), @@ -43099,47 +44255,12 @@ Bucket.create = function(options) { }; return new Classes[options.layer.type](options); }; - - -/** - * The maximum extent of a feature that can be safely stored in the buffer. - * In practice, all features are converted to this extent before being added. - * - * Positions are stored as signed 16bit integers. - * One bit is lost for signedness to support featuers extending past the left edge of the tile. - * One bit is lost because the line vertex buffer packs 1 bit of other data into the int. - * One bit is lost to support features extending past the extent on the right edge of the tile. - * This leaves us with 2^13 = 8192 - * - * @private - * @readonly - */ Bucket.EXTENT = 8192; - -/** - * The `Bucket` class is the single point of knowledge about turning vector - * tiles into WebGL buffers. - * - * `Bucket` is an abstract class. A subclass exists for each Mapbox GL - * style spec layer type. Because `Bucket` is an abstract class, - * instances should be created via the `Bucket.create` method. - * - * @class Bucket - * @private - * @param options - * @param {number} options.zoom Zoom level of the buffers being built. May be - * a fractional zoom level. - * @param options.layer A Mapbox GL style layer object - * @param {Object.} options.buffers The set of `Buffer`s being - * built for this tile. This object facilitates sharing of `Buffer`s be - between `Bucket`s. - */ function Bucket(options) { this.zoom = options.zoom; this.overscaling = options.overscaling; this.layer = options.layer; this.childLayers = options.childLayers; - this.type = this.layer.type; this.features = []; this.id = this.layer.id; @@ -43148,172 +44269,94 @@ function Bucket(options) { this.sourceLayerIndex = options.sourceLayerIndex; this.minZoom = this.layer.minzoom; this.maxZoom = this.layer.maxzoom; - this.paintAttributes = createPaintAttributes(this); - if (options.arrays) { - var childLayers = this.childLayers; - this.bufferGroups = util.mapObject(options.arrays, function(programArrayGroups, programName) { - return programArrayGroups.map(function(programArrayGroup) { - - var group = util.mapObject(programArrayGroup, function(arrays, layoutOrPaint) { - return util.mapObject(arrays, function(array, name) { - var arrayType = options.arrayTypes[programName][layoutOrPaint][name]; - var type = (arrayType.members.length && arrayType.members[0].name === 'vertices' ? Buffer.BufferType.ELEMENT : Buffer.BufferType.VERTEX); - return new Buffer(array, arrayType, type); - }); + var programInterfaces = this.programInterfaces; + this.bufferGroups = util.mapObject(options.arrays, function (programArrayGroups, programName) { + var programInterface = programInterfaces[programName]; + var paintVertexArrayTypes = options.paintVertexArrayTypes[programName]; + return programArrayGroups.map(function (arrayGroup) { + return new BufferGroup(arrayGroup, { + layoutVertexArrayType: programInterface.layoutVertexArrayType.serialize(), + elementArrayType: programInterface.elementArrayType && programInterface.elementArrayType.serialize(), + elementArrayType2: programInterface.elementArrayType2 && programInterface.elementArrayType2.serialize(), + paintVertexArrayTypes: paintVertexArrayTypes }); - - group.vaos = {}; - if (group.layout.element2) group.secondVaos = {}; - for (var l = 0; l < childLayers.length; l++) { - var layerName = childLayers[l].id; - group.vaos[layerName] = new VertexArrayObject(); - if (group.layout.element2) group.secondVaos[layerName] = new VertexArrayObject(); - } - - return group; }); }); } } - -/** - * Build the buffers! Features are set directly to the `features` property. - * @private - */ -Bucket.prototype.populateBuffers = function() { +Bucket.prototype.populateArrays = function () { this.createArrays(); this.recalculateStyleLayers(); - for (var i = 0; i < this.features.length; i++) { this.addFeature(this.features[i]); } - this.trimArrays(); }; - -/** - * Check if there is enough space available in the current element group for - * `vertexLength` vertices. If not, append a new elementGroup. Should be called - * by `populateBuffers` and its callees. - * @private - * @param {string} programName the name of the program associated with the buffer that will receive the vertices - * @param {number} vertexLength The number of vertices that will be inserted to the buffer. - */ -Bucket.prototype.makeRoomFor = function(programName, numVertices) { +Bucket.prototype.prepareArrayGroup = function (programName, numVertices) { var groups = this.arrayGroups[programName]; var currentGroup = groups.length && groups[groups.length - 1]; - - if (!currentGroup || currentGroup.layout.vertex.length + numVertices > 65535) { - - var arrayTypes = this.arrayTypes[programName]; - var VertexArrayType = arrayTypes.layout.vertex; - var ElementArrayType = arrayTypes.layout.element; - var ElementArrayType2 = arrayTypes.layout.element2; - - currentGroup = { - index: groups.length, - layout: {}, - paint: {} - }; - - currentGroup.layout.vertex = new VertexArrayType(); - if (ElementArrayType) currentGroup.layout.element = new ElementArrayType(); - if (ElementArrayType2) currentGroup.layout.element2 = new ElementArrayType2(); - - for (var i = 0; i < this.childLayers.length; i++) { - var layerName = this.childLayers[i].id; - var PaintVertexArrayType = arrayTypes.paint[layerName]; - currentGroup.paint[layerName] = new PaintVertexArrayType(); - } - + if (!currentGroup || !currentGroup.hasCapacityFor(numVertices)) { + currentGroup = new ArrayGroup({ + layoutVertexArrayType: this.programInterfaces[programName].layoutVertexArrayType, + elementArrayType: this.programInterfaces[programName].elementArrayType, + elementArrayType2: this.programInterfaces[programName].elementArrayType2, + paintVertexArrayTypes: this.paintVertexArrayTypes[programName] + }); + currentGroup.index = groups.length; groups.push(currentGroup); } - return currentGroup; }; - -/** - * Start using a new shared `buffers` object and recreate instances of `Buffer` - * as necessary. - * @private - */ -Bucket.prototype.createArrays = function() { +Bucket.prototype.createArrays = function () { this.arrayGroups = {}; - this.arrayTypes = {}; - + this.paintVertexArrayTypes = {}; for (var programName in this.programInterfaces) { - var programInterface = this.programInterfaces[programName]; - var programArrayTypes = this.arrayTypes[programName] = { layout: {}, paint: {} }; this.arrayGroups[programName] = []; - - if (programInterface.vertexBuffer) { - var VertexArrayType = new StructArrayType({ - members: this.programInterfaces[programName].layoutAttributes, - alignment: Buffer.VERTEX_ATTRIBUTE_ALIGNMENT - }); - - programArrayTypes.layout.vertex = VertexArrayType; - - var layerPaintAttributes = this.paintAttributes[programName]; - for (var layerName in layerPaintAttributes) { - var PaintVertexArrayType = new StructArrayType({ - members: layerPaintAttributes[layerName].attributes, - alignment: Buffer.VERTEX_ATTRIBUTE_ALIGNMENT - }); - - programArrayTypes.paint[layerName] = PaintVertexArrayType; - } - } - - if (programInterface.elementBuffer) { - var ElementArrayType = createElementBufferType(programInterface.elementBufferComponents); - programArrayTypes.layout.element = ElementArrayType; - } - - if (programInterface.elementBuffer2) { - var ElementArrayType2 = createElementBufferType(programInterface.elementBuffer2Components); - programArrayTypes.layout.element2 = ElementArrayType2; + var paintVertexArrayTypes = this.paintVertexArrayTypes[programName] = {}; + var layerPaintAttributes = this.paintAttributes[programName]; + for (var layerName in layerPaintAttributes) { + paintVertexArrayTypes[layerName] = new Bucket.VertexArrayType(layerPaintAttributes[layerName].attributes); } } }; - -Bucket.prototype.destroy = function(gl) { +Bucket.prototype.destroy = function (gl) { for (var programName in this.bufferGroups) { var programBufferGroups = this.bufferGroups[programName]; for (var i = 0; i < programBufferGroups.length; i++) { - var programBuffers = programBufferGroups[i]; - for (var paintBuffer in programBuffers.paint) { - programBuffers.paint[paintBuffer].destroy(gl); - } - for (var layoutBuffer in programBuffers.layout) { - programBuffers.layout[layoutBuffer].destroy(gl); - } - for (var j in programBuffers.vaos) { - programBuffers.vaos[j].destroy(gl); - } - for (var k in programBuffers.secondVaos) { - programBuffers.secondVaos[k].destroy(gl); - } + programBufferGroups[i].destroy(gl); } } - }; - -Bucket.prototype.trimArrays = function() { +Bucket.prototype.trimArrays = function () { + for (var programName in this.arrayGroups) { + var arrayGroups = this.arrayGroups[programName]; + for (var i = 0; i < arrayGroups.length; i++) { + arrayGroups[i].trim(); + } + } +}; +Bucket.prototype.isEmpty = function () { for (var programName in this.arrayGroups) { - var programArrays = this.arrayGroups[programName]; - for (var paintArray in programArrays.paint) { - programArrays.paint[paintArray].trim(); + var arrayGroups = this.arrayGroups[programName]; + for (var i = 0; i < arrayGroups.length; i++) { + if (!arrayGroups[i].isEmpty()) { + return false; + } } - for (var layoutArray in programArrays.layout) { - programArrays.layout[layoutArray].trim(); + } + return true; +}; +Bucket.prototype.getTransferables = function (transferables) { + for (var programName in this.arrayGroups) { + var arrayGroups = this.arrayGroups[programName]; + for (var i = 0; i < arrayGroups.length; i++) { + arrayGroups[i].getTransferables(transferables); } } }; - -Bucket.prototype.setUniforms = function(gl, programName, program, layer, globalProperties) { +Bucket.prototype.setUniforms = function (gl, programName, program, layer, globalProperties) { var uniforms = this.paintAttributes[programName][layer.id].uniforms; for (var i = 0; i < uniforms.length; i++) { var uniform = uniforms[i]; @@ -43321,79 +44364,60 @@ Bucket.prototype.setUniforms = function(gl, programName, program, layer, globalP gl['uniform' + uniform.components + 'fv'](uniformLocation, uniform.getValue(layer, globalProperties)); } }; - -Bucket.prototype.serialize = function() { +Bucket.prototype.serialize = function () { return { layerId: this.layer.id, zoom: this.zoom, - arrays: util.mapObject(this.arrayGroups, function(programArrayGroups) { - return programArrayGroups.map(function(arrayGroup) { - return util.mapObject(arrayGroup, function(arrays) { - return util.mapObject(arrays, function(array) { - return array.serialize(); - }); - }); + arrays: util.mapObject(this.arrayGroups, function (programArrayGroups) { + return programArrayGroups.map(function (arrayGroup) { + return arrayGroup.serialize(); }); }), - arrayTypes: util.mapObject(this.arrayTypes, function(programArrayTypes) { - return util.mapObject(programArrayTypes, function(arrayTypes) { - return util.mapObject(arrayTypes, function(arrayType) { - return arrayType.serialize(); - }); + paintVertexArrayTypes: util.mapObject(this.paintVertexArrayTypes, function (arrayTypes) { + return util.mapObject(arrayTypes, function (arrayType) { + return arrayType.serialize(); }); }), - - childLayerIds: this.childLayers.map(function(layer) { + childLayerIds: this.childLayers.map(function (layer) { return layer.id; }) }; }; - -Bucket.prototype.createFilter = function() { +Bucket.prototype.createFilter = function () { if (!this.filter) { this.filter = featureFilter(this.layer.filter); } }; - -var FAKE_ZOOM_HISTORY = { lastIntegerZoom: Infinity, lastIntegerZoomTime: 0, lastZoom: 0 }; -Bucket.prototype.recalculateStyleLayers = function() { +var FAKE_ZOOM_HISTORY = { + lastIntegerZoom: Infinity, + lastIntegerZoomTime: 0, + lastZoom: 0 +}; +Bucket.prototype.recalculateStyleLayers = function () { for (var i = 0; i < this.childLayers.length; i++) { this.childLayers[i].recalculate(this.zoom, FAKE_ZOOM_HISTORY); } }; - -Bucket.prototype.getProgramMacros = function(programInterface, layer) { - var macros = []; - var attributes = this.paintAttributes[programInterface][layer.id].attributes; - for (var i = 0; i < attributes.length; i++) { - var attribute = attributes[i]; - macros.push('ATTRIBUTE_' + (attribute.isFunction ? 'ZOOM_FUNCTION_' : '') + attribute.name.toUpperCase()); - } - return macros; -}; - -Bucket.prototype.addPaintAttributes = function(interfaceName, globalProperties, featureProperties, startGroup, startIndex) { +Bucket.prototype.populatePaintArrays = function (interfaceName, globalProperties, featureProperties, startGroup, startIndex) { for (var l = 0; l < this.childLayers.length; l++) { var layer = this.childLayers[l]; var groups = this.arrayGroups[interfaceName]; for (var g = startGroup.index; g < groups.length; g++) { var group = groups[g]; - var length = group.layout.vertex.length; - var vertexArray = group.paint[layer.id]; - vertexArray.resize(length); - + var length = group.layoutVertexArray.length; + var paintArray = group.paintVertexArrays[layer.id]; + paintArray.resize(length); var attributes = this.paintAttributes[interfaceName][layer.id].attributes; for (var m = 0; m < attributes.length; m++) { var attribute = attributes[m]; - var value = attribute.getValue(layer, globalProperties, featureProperties); var multiplier = attribute.multiplier || 1; var components = attribute.components || 1; - - for (var i = startIndex; i < length; i++) { - var vertex = vertexArray.get(i); + var start = g === startGroup.index ? startIndex : 0; + for (var i = start; i < length; i++) { + var vertex = paintArray.get(i); for (var c = 0; c < components; c++) { - var memberName = components > 1 ? (attribute.name + c) : attribute.name; + var memberName = components > 1 ? attribute.name + c : attribute.name; vertex[memberName] = value[c] * multiplier; } } @@ -43401,55 +44425,124 @@ Bucket.prototype.addPaintAttributes = function(interfaceName, globalProperties, } } }; - -function createElementBufferType(components) { +Bucket.VertexArrayType = function (members) { + return new StructArrayType({ + members: members, + alignment: 4 + }); +}; +Bucket.ElementArrayType = function (components) { return new StructArrayType({ members: [{ - type: Buffer.ELEMENT_ATTRIBUTE_TYPE, - name: 'vertices', - components: components || 3 - }] + type: 'Uint16', + name: 'vertices', + components: components || 3 + }] }); -} - +}; function createPaintAttributes(bucket) { var attributes = {}; for (var interfaceName in bucket.programInterfaces) { var layerPaintAttributes = attributes[interfaceName] = {}; - for (var c = 0; c < bucket.childLayers.length; c++) { var childLayer = bucket.childLayers[c]; - layerPaintAttributes[childLayer.id] = { attributes: [], uniforms: [] }; + layerPaintAttributes[childLayer.id] = { + attributes: [], + uniforms: [], + defines: [], + vertexPragmas: { + define: {}, + initialize: {} + }, + fragmentPragmas: { + define: {}, + initialize: {} + } + }; } - var interface_ = bucket.programInterfaces[interfaceName]; - if (!interface_.paintAttributes) continue; + if (!interface_.paintAttributes) + continue; + var attributePrecision = '{precision}'; + var attributeType = '{type}'; for (var i = 0; i < interface_.paintAttributes.length; i++) { var attribute = interface_.paintAttributes[i]; - + attribute.multiplier = attribute.multiplier || 1; for (var j = 0; j < bucket.childLayers.length; j++) { var layer = bucket.childLayers[j]; var paintAttributes = layerPaintAttributes[layer.id]; - + var attributeInputName = attribute.name; + var attributeInnerName = attribute.name.slice(2); + var attributeVaryingDefinition; + paintAttributes.fragmentPragmas.initialize[attributeInnerName] = ''; if (layer.isPaintValueFeatureConstant(attribute.paintProperty)) { paintAttributes.uniforms.push(attribute); + paintAttributes.fragmentPragmas.define[attributeInnerName] = paintAttributes.vertexPragmas.define[attributeInnerName] = [ + 'uniform', + attributePrecision, + attributeType, + attributeInputName + ].join(' ') + ';'; + paintAttributes.fragmentPragmas.initialize[attributeInnerName] = paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributePrecision, + attributeType, + attributeInnerName, + '=', + attributeInputName + ].join(' ') + ';\n'; } else if (layer.isPaintValueZoomConstant(attribute.paintProperty)) { - paintAttributes.attributes.push(attribute); + paintAttributes.attributes.push(util.extend({}, attribute, { name: attributeInputName })); + attributeVaryingDefinition = [ + 'varying', + attributePrecision, + attributeType, + attributeInnerName + ].join(' ') + ';\n'; + var attributeAttributeDefinition = [ + paintAttributes.fragmentPragmas.define[attributeInnerName], + 'attribute', + attributePrecision, + attributeType, + attributeInputName + ].join(' ') + ';\n'; + paintAttributes.fragmentPragmas.define[attributeInnerName] = attributeVaryingDefinition; + paintAttributes.vertexPragmas.define[attributeInnerName] = attributeVaryingDefinition + attributeAttributeDefinition; + paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributeInnerName, + '=', + attributeInputName, + '/', + attribute.multiplier.toFixed(1) + ].join(' ') + ';\n'; } else { - + var tName = 'u_' + attributeInputName.slice(2) + '_t'; var zoomLevels = layer.getPaintValueStopZoomLevels(attribute.paintProperty); - - // Pick the index of the first offset to add to the buffers. - // Find the four closest stops, ideally with two on each side of the zoom level. var numStops = 0; - while (numStops < zoomLevels.length && zoomLevels[numStops] < bucket.zoom) numStops++; + while (numStops < zoomLevels.length && zoomLevels[numStops] < bucket.zoom) + numStops++; var stopOffset = Math.max(0, Math.min(zoomLevels.length - 4, numStops - 2)); - var fourZoomLevels = []; for (var s = 0; s < 4; s++) { fourZoomLevels.push(zoomLevels[Math.min(stopOffset + s, zoomLevels.length - 1)]); } - + attributeVaryingDefinition = [ + 'varying', + attributePrecision, + attributeType, + attributeInnerName + ].join(' ') + ';\n'; + paintAttributes.vertexPragmas.define[attributeInnerName] = attributeVaryingDefinition + [ + 'uniform', + 'lowp', + 'float', + tName + ].join(' ') + ';\n'; + paintAttributes.fragmentPragmas.define[attributeInnerName] = attributeVaryingDefinition; + paintAttributes.uniforms.push(util.extend({}, attribute, { + name: tName, + getValue: createGetUniform(attribute, stopOffset), + components: 1 + })); var components = attribute.components; if (components === 1) { paintAttributes.attributes.push(util.extend({}, attribute, { @@ -43457,35 +44550,54 @@ function createPaintAttributes(bucket) { isFunction: true, components: components * 4 })); + paintAttributes.vertexPragmas.define[attributeInnerName] += [ + 'attribute', + attributePrecision, + 'vec4', + attributeInputName + ].join(' ') + ';\n'; + paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributeInnerName, + '=', + 'evaluate_zoom_function_1(' + attributeInputName + ', ' + tName + ')', + '/', + attribute.multiplier.toFixed(1) + ].join(' ') + ';\n'; } else { + var attributeInputNames = []; for (var k = 0; k < 4; k++) { + attributeInputNames.push(attributeInputName + k); paintAttributes.attributes.push(util.extend({}, attribute, { getValue: createFunctionGetValue(attribute, [fourZoomLevels[k]]), isFunction: true, - name: attribute.name + k + name: attributeInputName + k })); + paintAttributes.vertexPragmas.define[attributeInnerName] += [ + 'attribute', + attributePrecision, + attributeType, + attributeInputName + k + ].join(' ') + ';\n'; } + paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributeInnerName, + ' = ', + 'evaluate_zoom_function_4(' + attributeInputNames.join(', ') + ', ' + tName + ')', + '/', + attribute.multiplier.toFixed(1) + ].join(' ') + ';\n'; } - - paintAttributes.uniforms.push(util.extend({}, attribute, { - name: 'u_' + attribute.name.slice(2) + '_t', - getValue: createGetUniform(attribute, stopOffset), - components: 1 - })); } } } } return attributes; } - function createFunctionGetValue(attribute, stopZoomLevels) { - return function(layer, globalProperties, featureProperties) { + return function (layer, globalProperties, featureProperties) { if (stopZoomLevels.length === 1) { - // return one multi-component value like color0 return attribute.getValue(layer, util.extend({}, globalProperties, { zoom: stopZoomLevels[0] }), featureProperties); } else { - // pack multiple single-component values into a four component attribute var values = []; for (var z = 0; z < stopZoomLevels.length; z++) { var stopZoomLevel = stopZoomLevels[z]; @@ -43495,387 +44607,277 @@ function createFunctionGetValue(attribute, stopZoomLevels) { } }; } - function createGetUniform(attribute, stopOffset) { - return function(layer, globalProperties) { - // stopInterp indicates which stops need to be interpolated. - // If stopInterp is 3.5 then interpolate half way between stops 3 and 4. + return function (layer, globalProperties) { var stopInterp = layer.getPaintInterpolationT(attribute.paintProperty, globalProperties.zoom); - // We can only store four stop values in the buffers. stopOffset is the number of stops that come - // before the stops that were added to the buffers. return [Math.max(0, Math.min(4, stopInterp - stopOffset))]; }; } - -},{"../render/vertex_array_object":273,"../util/struct_array":347,"../util/util":349,"./bucket/circle_bucket":248,"./bucket/fill_bucket":249,"./bucket/line_bucket":250,"./bucket/symbol_bucket":251,"./buffer":252,"feature-filter":352}],248:[function(require,module,exports){ +},{"../util/struct_array":364,"../util/util":366,"./array_group":252,"./bucket/circle_bucket":254,"./bucket/fill_bucket":255,"./bucket/line_bucket":256,"./bucket/symbol_bucket":257,"./buffer_group":259,"feature-filter":370}],254:[function(require,module,exports){ 'use strict'; - var Bucket = require('../bucket'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); var EXTENT = Bucket.EXTENT; - module.exports = CircleBucket; - -/** - * Circles are represented by two triangles. - * - * Each corner has a pos that is the center of the circle and an extrusion - * vector that is where it points. - * @private - */ function CircleBucket() { Bucket.apply(this, arguments); } - CircleBucket.prototype = util.inherit(Bucket, {}); - -CircleBucket.prototype.addCircleVertex = function(vertexArray, x, y, extrudeX, extrudeY) { - return vertexArray.emplaceBack( - (x * 2) + ((extrudeX + 1) / 2), - (y * 2) + ((extrudeY + 1) / 2)); +CircleBucket.prototype.addCircleVertex = function (layoutVertexArray, x, y, extrudeX, extrudeY) { + return layoutVertexArray.emplaceBack(x * 2 + (extrudeX + 1) / 2, y * 2 + (extrudeY + 1) / 2); }; - CircleBucket.prototype.programInterfaces = { circle: { - vertexBuffer: true, - elementBuffer: true, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }], - paintAttributes: [{ - name: 'a_color', - components: 4, - type: 'Uint8', - getValue: function(layer, globalProperties, featureProperties) { - return util.premultiply(layer.getPaintValue("circle-color", globalProperties, featureProperties)); + layoutVertexArrayType: new Bucket.VertexArrayType([{ + name: 'a_pos', + components: 2, + type: 'Int16' + }]), + elementArrayType: new Bucket.ElementArrayType(), + paintAttributes: [ + { + name: 'a_color', + components: 4, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return layer.getPaintValue('circle-color', globalProperties, featureProperties); + }, + multiplier: 255, + paintProperty: 'circle-color' }, - multiplier: 255, - paintProperty: 'circle-color' - }, { - name: 'a_radius', - components: 1, - type: 'Uint16', - isLayerConstant: false, - getValue: function(layer, globalProperties, featureProperties) { - return [layer.getPaintValue("circle-radius", globalProperties, featureProperties)]; + { + name: 'a_radius', + components: 1, + type: 'Uint16', + isLayerConstant: false, + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('circle-radius', globalProperties, featureProperties)]; + }, + multiplier: 10, + paintProperty: 'circle-radius' + }, + { + name: 'a_blur', + components: 1, + type: 'Uint16', + isLayerConstant: false, + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('circle-blur', globalProperties, featureProperties)]; + }, + multiplier: 10, + paintProperty: 'circle-blur' }, - multiplier: 10, - paintProperty: 'circle-radius' - }] + { + name: 'a_opacity', + components: 1, + type: 'Uint16', + isLayerConstant: false, + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('circle-opacity', globalProperties, featureProperties)]; + }, + multiplier: 255, + paintProperty: 'circle-opacity' + } + ] } }; - -CircleBucket.prototype.addFeature = function(feature) { - var globalProperties = {zoom: this.zoom}; +CircleBucket.prototype.addFeature = function (feature) { + var globalProperties = { zoom: this.zoom }; var geometries = loadGeometry(feature); - - var startGroup = this.makeRoomFor('circle', 0); - var startIndex = startGroup.layout.vertex.length; - + var startGroup = this.prepareArrayGroup('circle', 0); + var startIndex = startGroup.layoutVertexArray.length; for (var j = 0; j < geometries.length; j++) { for (var k = 0; k < geometries[j].length; k++) { - var x = geometries[j][k].x; var y = geometries[j][k].y; - - // Do not include points that are outside the tile boundaries. - if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) continue; - - // this geometry will be of the Point type, and we'll derive - // two triangles from it. - // - // ┌─────────┐ - // │ 3 2 │ - // │ │ - // │ 0 1 │ - // └─────────┘ - - var group = this.makeRoomFor('circle', 4); - var vertexArray = group.layout.vertex; - - var index = this.addCircleVertex(vertexArray, x, y, -1, -1); - this.addCircleVertex(vertexArray, x, y, 1, -1); - this.addCircleVertex(vertexArray, x, y, 1, 1); - this.addCircleVertex(vertexArray, x, y, -1, 1); - - group.layout.element.emplaceBack(index, index + 1, index + 2); - group.layout.element.emplaceBack(index, index + 3, index + 2); + if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) + continue; + var group = this.prepareArrayGroup('circle', 4); + var layoutVertexArray = group.layoutVertexArray; + var index = this.addCircleVertex(layoutVertexArray, x, y, -1, -1); + this.addCircleVertex(layoutVertexArray, x, y, 1, -1); + this.addCircleVertex(layoutVertexArray, x, y, 1, 1); + this.addCircleVertex(layoutVertexArray, x, y, -1, 1); + group.elementArray.emplaceBack(index, index + 1, index + 2); + group.elementArray.emplaceBack(index, index + 3, index + 2); } } - - this.addPaintAttributes('circle', globalProperties, feature.properties, startGroup, startIndex); + this.populatePaintArrays('circle', globalProperties, feature.properties, startGroup, startIndex); }; - -},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],249:[function(require,module,exports){ +},{"../../util/util":366,"../bucket":253,"../load_geometry":261}],255:[function(require,module,exports){ 'use strict'; - var Bucket = require('../bucket'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); - +var earcut = require('earcut'); +var classifyRings = require('../../util/classify_rings'); +var EARCUT_MAX_RINGS = 500; module.exports = FillBucket; - function FillBucket() { Bucket.apply(this, arguments); } - FillBucket.prototype = util.inherit(Bucket, {}); - FillBucket.prototype.programInterfaces = { fill: { - vertexBuffer: true, - elementBuffer: true, - elementBuffer2: true, - elementBuffer2Components: 2, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }] + layoutVertexArrayType: new Bucket.VertexArrayType([{ + name: 'a_pos', + components: 2, + type: 'Int16' + }]), + elementArrayType: new Bucket.ElementArrayType(1), + elementArrayType2: new Bucket.ElementArrayType(2), + paintAttributes: [ + { + name: 'a_color', + components: 4, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return layer.getPaintValue('fill-color', globalProperties, featureProperties); + }, + multiplier: 255, + paintProperty: 'fill-color' + }, + { + name: 'a_outline_color', + components: 4, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return layer.getPaintValue('fill-outline-color', globalProperties, featureProperties); + }, + multiplier: 255, + paintProperty: 'fill-outline-color' + }, + { + name: 'a_opacity', + components: 1, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('fill-opacity', globalProperties, featureProperties)]; + }, + multiplier: 255, + paintProperty: 'fill-opacity' + } + ] } }; - -FillBucket.prototype.addFeature = function(feature) { +FillBucket.prototype.addFeature = function (feature) { var lines = loadGeometry(feature); - for (var i = 0; i < lines.length; i++) { - this.addFill(lines[i]); - } -}; - -FillBucket.prototype.addFill = function(vertices) { - if (vertices.length < 3) { - //console.warn('a fill must have at least three vertices'); - return; - } - - // Calculate the total number of vertices we're going to produce so that we - // can resize the buffer beforehand, or detect whether the current line - // won't fit into the buffer anymore. - // In order to be able to use the vertex buffer for drawing the antialiased - // outlines, we separate all polygon vertices with a degenerate (out-of- - // viewplane) vertex. - - var len = vertices.length; - - // Expand this geometry buffer to hold all the required vertices. - var group = this.makeRoomFor('fill', len + 1); - - // We're generating triangle fans, so we always start with the first coordinate in this polygon. - var firstIndex, prevIndex; - for (var i = 0; i < vertices.length; i++) { - var currentVertex = vertices[i]; - - var currentIndex = group.layout.vertex.emplaceBack(currentVertex.x, currentVertex.y); - if (i === 0) firstIndex = currentIndex; - - // Only add triangles that have distinct vertices. - if (i >= 2 && (currentVertex.x !== vertices[0].x || currentVertex.y !== vertices[0].y)) { - group.layout.element.emplaceBack(firstIndex, prevIndex, currentIndex); - } - - if (i >= 1) { - group.layout.element2.emplaceBack(prevIndex, currentIndex); - } - - prevIndex = currentIndex; - } -}; - -},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],250:[function(require,module,exports){ + var polygons = classifyRings(lines, EARCUT_MAX_RINGS); + var startGroup = this.prepareArrayGroup('fill', 0); + var startIndex = startGroup.layoutVertexArray.length; + for (var i = 0; i < polygons.length; i++) { + this.addPolygon(polygons[i]); + } + this.populatePaintArrays('fill', { zoom: this.zoom }, feature.properties, startGroup, startIndex); +}; +FillBucket.prototype.addPolygon = function (polygon) { + var numVertices = 0; + for (var k = 0; k < polygon.length; k++) { + numVertices += polygon[k].length; + } + var group = this.prepareArrayGroup('fill', numVertices); + var flattened = []; + var holeIndices = []; + var startIndex = group.layoutVertexArray.length; + for (var r = 0; r < polygon.length; r++) { + var ring = polygon[r]; + if (r > 0) + holeIndices.push(flattened.length / 2); + for (var v = 0; v < ring.length; v++) { + var vertex = ring[v]; + var index = group.layoutVertexArray.emplaceBack(vertex.x, vertex.y); + if (v >= 1) { + group.elementArray2.emplaceBack(index - 1, index); + } + flattened.push(vertex.x); + flattened.push(vertex.y); + } + } + var triangleIndices = earcut(flattened, holeIndices); + for (var i = 0; i < triangleIndices.length; i++) { + group.elementArray.emplaceBack(triangleIndices[i] + startIndex); + } +}; +},{"../../util/classify_rings":354,"../../util/util":366,"../bucket":253,"../load_geometry":261,"earcut":369}],256:[function(require,module,exports){ 'use strict'; - var Bucket = require('../bucket'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); var EXTENT = Bucket.EXTENT; - -// NOTE ON EXTRUDE SCALE: -// scale the extrusion vector so that the normal length is this value. -// contains the "texture" normals (-1..1). this is distinct from the extrude -// normals for line joins, because the x-value remains 0 for the texture -// normal array, while the extrude normal actually moves the vertex to create -// the acute/bevelled line join. var EXTRUDE_SCALE = 63; - -/* - * Sharp corners cause dashed lines to tilt because the distance along the line - * is the same at both the inner and outer corners. To improve the appearance of - * dashed lines we add extra points near sharp corners so that a smaller part - * of the line is tilted. - * - * COS_HALF_SHARP_CORNER controls how sharp a corner has to be for us to add an - * extra vertex. The default is 75 degrees. - * - * The newly created vertices are placed SHARP_CORNER_OFFSET pixels from the corner. - */ var COS_HALF_SHARP_CORNER = Math.cos(75 / 2 * (Math.PI / 180)); var SHARP_CORNER_OFFSET = 15; - -// The number of bits that is used to store the line distance in the buffer. -var LINE_DISTANCE_BUFFER_BITS = 14; - -// We don't have enough bits for the line distance as we'd like to have, so -// use this value to scale the line distance (in tile units) down to a smaller -// value. This lets us store longer distances while sacrificing precision. +var LINE_DISTANCE_BUFFER_BITS = 15; var LINE_DISTANCE_SCALE = 1 / 2; - -// The maximum line distance, in tile units, that fits in the buffer. -var MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS) / LINE_DISTANCE_SCALE; - - +var MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS - 1) / LINE_DISTANCE_SCALE; module.exports = LineBucket; - -/** - * @private - */ function LineBucket() { Bucket.apply(this, arguments); } - LineBucket.prototype = util.inherit(Bucket, {}); - -LineBucket.prototype.addLineVertex = function(vertexBuffer, point, extrude, tx, ty, dir, linesofar) { - return vertexBuffer.emplaceBack( - // a_pos - (point.x << 1) | tx, - (point.y << 1) | ty, - // a_data - // add 128 to store an byte in an unsigned byte - Math.round(EXTRUDE_SCALE * extrude.x) + 128, - Math.round(EXTRUDE_SCALE * extrude.y) + 128, - // Encode the -1/0/1 direction value into the first two bits of .z of a_data. - // Combine it with the lower 6 bits of `linesofar` (shifted by 2 bites to make - // room for the direction value). The upper 8 bits of `linesofar` are placed in - // the `w` component. `linesofar` is scaled down by `LINE_DISTANCE_SCALE` so that - // we can store longer distances while sacrificing precision. - ((dir === 0 ? 0 : (dir < 0 ? -1 : 1)) + 1) | (((linesofar * LINE_DISTANCE_SCALE) & 0x3F) << 2), - (linesofar * LINE_DISTANCE_SCALE) >> 6); +LineBucket.prototype.addLineVertex = function (layoutVertexBuffer, point, extrude, tx, ty, dir, linesofar) { + return layoutVertexBuffer.emplaceBack(point.x << 1 | tx, point.y << 1 | ty, Math.round(EXTRUDE_SCALE * extrude.x) + 128, Math.round(EXTRUDE_SCALE * extrude.y) + 128, (dir === 0 ? 0 : dir < 0 ? -1 : 1) + 1 | (linesofar * LINE_DISTANCE_SCALE & 63) << 2, linesofar * LINE_DISTANCE_SCALE >> 6); }; - LineBucket.prototype.programInterfaces = { line: { - vertexBuffer: true, - elementBuffer: true, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }, { - name: 'a_data', - components: 4, - type: 'Uint8' - }] + layoutVertexArrayType: new Bucket.VertexArrayType([ + { + name: 'a_pos', + components: 2, + type: 'Int16' + }, + { + name: 'a_data', + components: 4, + type: 'Uint8' + } + ]), + elementArrayType: new Bucket.ElementArrayType() } }; - -LineBucket.prototype.addFeature = function(feature) { - var lines = loadGeometry(feature); +LineBucket.prototype.addFeature = function (feature) { + var lines = loadGeometry(feature, LINE_DISTANCE_BUFFER_BITS); for (var i = 0; i < lines.length; i++) { - this.addLine( - lines[i], - this.layer.layout['line-join'], - this.layer.layout['line-cap'], - this.layer.layout['line-miter-limit'], - this.layer.layout['line-round-limit'] - ); + this.addLine(lines[i], this.layer.layout['line-join'], this.layer.layout['line-cap'], this.layer.layout['line-miter-limit'], this.layer.layout['line-round-limit']); } }; - -LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLimit) { - +LineBucket.prototype.addLine = function (vertices, join, cap, miterLimit, roundLimit) { var len = vertices.length; - // If the line has duplicate vertices at the end, adjust length to remove them. while (len > 2 && vertices[len - 1].equals(vertices[len - 2])) { len--; } - - if (vertices.length < 2) { - //console.warn('a line must have at least two vertices'); + if (vertices.length < 2) return; - } - - if (join === 'bevel') miterLimit = 1.05; - + if (join === 'bevel') + miterLimit = 1.05; var sharpCornerOffset = SHARP_CORNER_OFFSET * (EXTENT / (512 * this.overscaling)); - - var firstVertex = vertices[0], - lastVertex = vertices[len - 1], - closed = firstVertex.equals(lastVertex); - - // we could be more precise, but it would only save a negligible amount of space - this.makeRoomFor('line', len * 10); - - if (len === 2 && closed) { - // console.warn('a line may not have coincident points'); + var firstVertex = vertices[0], lastVertex = vertices[len - 1], closed = firstVertex.equals(lastVertex); + this.prepareArrayGroup('line', len * 10); + if (len === 2 && closed) return; - } - this.distance = 0; - - var beginCap = cap, - endCap = closed ? 'butt' : cap, - startOfLine = true, - currentVertex, prevVertex, nextVertex, prevNormal, nextNormal, offsetA, offsetB; - - // the last three vertices added + var beginCap = cap, endCap = closed ? 'butt' : cap, startOfLine = true, currentVertex, prevVertex, nextVertex, prevNormal, nextNormal, offsetA, offsetB; this.e1 = this.e2 = this.e3 = -1; - if (closed) { currentVertex = vertices[len - 2]; nextNormal = firstVertex.sub(currentVertex)._unit()._perp(); } - for (var i = 0; i < len; i++) { - - nextVertex = closed && i === len - 1 ? - vertices[1] : // if the line is closed, we treat the last vertex like the first - vertices[i + 1]; // just the next vertex - - // if two consecutive vertices exist, skip the current one - if (nextVertex && vertices[i].equals(nextVertex)) continue; - - if (nextNormal) prevNormal = nextNormal; - if (currentVertex) prevVertex = currentVertex; - + nextVertex = closed && i === len - 1 ? vertices[1] : vertices[i + 1]; + if (nextVertex && vertices[i].equals(nextVertex)) + continue; + if (nextNormal) + prevNormal = nextNormal; + if (currentVertex) + prevVertex = currentVertex; currentVertex = vertices[i]; - - // Calculate the normal towards the next vertex in this line. In case - // there is no next vertex, pretend that the line is continuing straight, - // meaning that we are just using the previous normal. nextNormal = nextVertex ? nextVertex.sub(currentVertex)._unit()._perp() : prevNormal; - - // If we still don't have a previous normal, this is the beginning of a - // non-closed line, so we're doing a straight "join". prevNormal = prevNormal || nextNormal; - - // Determine the normal of the join extrusion. It is the angle bisector - // of the segments between the previous line and the next line. var joinNormal = prevNormal.add(nextNormal)._unit(); - - /* joinNormal prevNormal - * ↖ ↑ - * .________. prevVertex - * | - * nextNormal ← | currentVertex - * | - * nextVertex ! - * - */ - - // Calculate the length of the miter (the ratio of the miter to the width). - // Find the cosine of the angle between the next and join normals - // using dot product. The inverse of that is the miter length. var cosHalfAngle = joinNormal.x * nextNormal.x + joinNormal.y * nextNormal.y; var miterLength = 1 / cosHalfAngle; - var isSharpCorner = cosHalfAngle < COS_HALF_SHARP_CORNER && prevVertex && nextVertex; - if (isSharpCorner && i > 0) { var prevSegmentLength = currentVertex.dist(prevVertex); if (prevSegmentLength > 2 * sharpCornerOffset) { @@ -43885,11 +44887,8 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi prevVertex = newPrevVertex; } } - - // The join if a middle vertex, otherwise the cap. var middleVertex = prevVertex && nextVertex; var currentJoin = middleVertex ? join : nextVertex ? beginCap : endCap; - if (middleVertex && currentJoin === 'round') { if (miterLength < roundLimit) { currentJoin = 'miter'; @@ -43897,36 +44896,23 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi currentJoin = 'fakeround'; } } - if (currentJoin === 'miter' && miterLength > miterLimit) { currentJoin = 'bevel'; } - if (currentJoin === 'bevel') { - // The maximum extrude length is 128 / 63 = 2 times the width of the line - // so if miterLength >= 2 we need to draw a different type of bevel where. - if (miterLength > 2) currentJoin = 'flipbevel'; - - // If the miterLength is really small and the line bevel wouldn't be visible, - // just draw a miter join to save a triangle. - if (miterLength < miterLimit) currentJoin = 'miter'; + if (miterLength > 2) + currentJoin = 'flipbevel'; + if (miterLength < miterLimit) + currentJoin = 'miter'; } - - // Calculate how far along the line the currentVertex is - if (prevVertex) this.distance += currentVertex.dist(prevVertex); - + if (prevVertex) + this.distance += currentVertex.dist(prevVertex); if (currentJoin === 'miter') { - joinNormal._mult(miterLength); this.addCurrentVertex(currentVertex, this.distance, joinNormal, 0, 0, false); - } else if (currentJoin === 'flipbevel') { - // miter is too big, flip the direction to make a beveled join - if (miterLength > 100) { - // Almost parallel lines joinNormal = nextNormal.clone(); - } else { var direction = prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x > 0 ? -1 : 1; var bevelLength = miterLength * prevNormal.add(nextNormal).mag() / prevNormal.sub(nextNormal).mag(); @@ -43934,9 +44920,8 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi } this.addCurrentVertex(currentVertex, this.distance, joinNormal, 0, 0, false); this.addCurrentVertex(currentVertex, this.distance, joinNormal.mult(-1), 0, 0, false); - } else if (currentJoin === 'bevel' || currentJoin === 'fakeround') { - var lineTurnsLeft = (prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x) > 0; + var lineTurnsLeft = prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x > 0; var offset = -Math.sqrt(miterLength * miterLength - 1); if (lineTurnsLeft) { offsetB = 0; @@ -43945,90 +44930,51 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi offsetA = 0; offsetB = offset; } - - // Close previous segment with a bevel if (!startOfLine) { this.addCurrentVertex(currentVertex, this.distance, prevNormal, offsetA, offsetB, false); } - if (currentJoin === 'fakeround') { - // The join angle is sharp enough that a round join would be visible. - // Bevel joins fill the gap between segments with a single pie slice triangle. - // Create a round join by adding multiple pie slices. The join isn't actually round, but - // it looks like it is at the sizes we render lines at. - - // Add more triangles for sharper angles. - // This math is just a good enough approximation. It isn't "correct". var n = Math.floor((0.5 - (cosHalfAngle - 0.5)) * 8); var approxFractionalJoinNormal; - for (var m = 0; m < n; m++) { approxFractionalJoinNormal = nextNormal.mult((m + 1) / (n + 1))._add(prevNormal)._unit(); this.addPieSliceVertex(currentVertex, this.distance, approxFractionalJoinNormal, lineTurnsLeft); } - this.addPieSliceVertex(currentVertex, this.distance, joinNormal, lineTurnsLeft); - for (var k = n - 1; k >= 0; k--) { approxFractionalJoinNormal = prevNormal.mult((k + 1) / (n + 1))._add(nextNormal)._unit(); this.addPieSliceVertex(currentVertex, this.distance, approxFractionalJoinNormal, lineTurnsLeft); } } - - // Start next segment if (nextVertex) { this.addCurrentVertex(currentVertex, this.distance, nextNormal, -offsetA, -offsetB, false); } - } else if (currentJoin === 'butt') { if (!startOfLine) { - // Close previous segment with a butt this.addCurrentVertex(currentVertex, this.distance, prevNormal, 0, 0, false); } - - // Start next segment with a butt if (nextVertex) { this.addCurrentVertex(currentVertex, this.distance, nextNormal, 0, 0, false); } - } else if (currentJoin === 'square') { - if (!startOfLine) { - // Close previous segment with a square cap this.addCurrentVertex(currentVertex, this.distance, prevNormal, 1, 1, false); - - // The segment is done. Unset vertices to disconnect segments. this.e1 = this.e2 = -1; } - - // Start next segment if (nextVertex) { this.addCurrentVertex(currentVertex, this.distance, nextNormal, -1, -1, false); } - } else if (currentJoin === 'round') { - if (!startOfLine) { - // Close previous segment with butt this.addCurrentVertex(currentVertex, this.distance, prevNormal, 0, 0, false); - - // Add round cap or linejoin at end of segment this.addCurrentVertex(currentVertex, this.distance, prevNormal, 1, 1, true); - - // The segment is done. Unset vertices to disconnect segments. this.e1 = this.e2 = -1; } - - - // Start next segment with a butt if (nextVertex) { - // Add round cap before first segment this.addCurrentVertex(currentVertex, this.distance, nextNormal, -1, -1, true); - this.addCurrentVertex(currentVertex, this.distance, nextNormal, 0, 0, false); } } - if (isSharpCorner && i < len - 1) { var nextSegmentLength = currentVertex.dist(nextVertex); if (nextSegmentLength > 2 * sharpCornerOffset) { @@ -44038,92 +44984,57 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi currentVertex = newCurrentVertex; } } - startOfLine = false; } - }; - -/** - * Add two vertices to the buffers. - * - * @param {Object} currentVertex the line vertex to add buffer vertices for - * @param {number} distance the distance from the beginning of the line to the vertex - * @param {number} endLeft extrude to shift the left vertex along the line - * @param {number} endRight extrude to shift the left vertex along the line - * @param {boolean} round whether this is a round cap - * @private - */ -LineBucket.prototype.addCurrentVertex = function(currentVertex, distance, normal, endLeft, endRight, round) { +LineBucket.prototype.addCurrentVertex = function (currentVertex, distance, normal, endLeft, endRight, round) { var tx = round ? 1 : 0; var extrude; - var layoutArrays = this.arrayGroups.line[this.arrayGroups.line.length - 1].layout; - var vertexArray = layoutArrays.vertex; - var elementArray = layoutArrays.element; - + var arrayGroup = this.arrayGroups.line[this.arrayGroups.line.length - 1]; + var layoutVertexArray = arrayGroup.layoutVertexArray; + var elementArray = arrayGroup.elementArray; extrude = normal.clone(); - if (endLeft) extrude._sub(normal.perp()._mult(endLeft)); - this.e3 = this.addLineVertex(vertexArray, currentVertex, extrude, tx, 0, endLeft, distance); + if (endLeft) + extrude._sub(normal.perp()._mult(endLeft)); + this.e3 = this.addLineVertex(layoutVertexArray, currentVertex, extrude, tx, 0, endLeft, distance); if (this.e1 >= 0 && this.e2 >= 0) { elementArray.emplaceBack(this.e1, this.e2, this.e3); } this.e1 = this.e2; this.e2 = this.e3; - extrude = normal.mult(-1); - if (endRight) extrude._sub(normal.perp()._mult(endRight)); - this.e3 = this.addLineVertex(vertexArray, currentVertex, extrude, tx, 1, -endRight, distance); + if (endRight) + extrude._sub(normal.perp()._mult(endRight)); + this.e3 = this.addLineVertex(layoutVertexArray, currentVertex, extrude, tx, 1, -endRight, distance); if (this.e1 >= 0 && this.e2 >= 0) { elementArray.emplaceBack(this.e1, this.e2, this.e3); } this.e1 = this.e2; this.e2 = this.e3; - - // There is a maximum "distance along the line" that we can store in the buffers. - // When we get close to the distance, reset it to zero and add the vertex again with - // a distance of zero. The max distance is determined by the number of bits we allocate - // to `linesofar`. if (distance > MAX_LINE_DISTANCE / 2) { this.distance = 0; this.addCurrentVertex(currentVertex, this.distance, normal, endLeft, endRight, round); } }; - -/** - * Add a single new vertex and a triangle using two previous vertices. - * This adds a pie slice triangle near a join to simulate round joins - * - * @param {Object} currentVertex the line vertex to add buffer vertices for - * @param {number} distance the distance from the beggining of the line to the vertex - * @param {Object} extrude the offset of the new vertex from the currentVertex - * @param {boolean} whether the line is turning left or right at this angle - * @private - */ -LineBucket.prototype.addPieSliceVertex = function(currentVertex, distance, extrude, lineTurnsLeft) { +LineBucket.prototype.addPieSliceVertex = function (currentVertex, distance, extrude, lineTurnsLeft) { var ty = lineTurnsLeft ? 1 : 0; extrude = extrude.mult(lineTurnsLeft ? -1 : 1); - var layoutArrays = this.arrayGroups.line[this.arrayGroups.line.length - 1].layout; - var vertexArray = layoutArrays.vertex; - var elementArray = layoutArrays.element; - - this.e3 = this.addLineVertex(vertexArray, currentVertex, extrude, 0, ty, 0, distance); - + var arrayGroup = this.arrayGroups.line[this.arrayGroups.line.length - 1]; + var layoutVertexArray = arrayGroup.layoutVertexArray; + var elementArray = arrayGroup.elementArray; + this.e3 = this.addLineVertex(layoutVertexArray, currentVertex, extrude, 0, ty, 0, distance); if (this.e1 >= 0 && this.e2 >= 0) { elementArray.emplaceBack(this.e1, this.e2, this.e3); } - if (lineTurnsLeft) { this.e2 = this.e3; } else { this.e1 = this.e3; } }; - -},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],251:[function(require,module,exports){ +},{"../../util/util":366,"../bucket":253,"../load_geometry":261}],257:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - var Bucket = require('../bucket'); var Anchor = require('../../symbol/anchor'); var getAnchors = require('../../symbol/get_anchors'); @@ -44136,32 +45047,27 @@ var clipLine = require('../../symbol/clip_line'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); var CollisionFeature = require('../../symbol/collision_feature'); - var shapeText = Shaping.shapeText; var shapeIcon = Shaping.shapeIcon; var getGlyphQuads = Quads.getGlyphQuads; var getIconQuads = Quads.getIconQuads; - var EXTENT = Bucket.EXTENT; - module.exports = SymbolBucket; - function SymbolBucket(options) { Bucket.apply(this, arguments); this.showCollisionBoxes = options.showCollisionBoxes; this.overscaling = options.overscaling; this.collisionBoxArray = options.collisionBoxArray; - + this.symbolQuadsArray = options.symbolQuadsArray; + this.symbolInstancesArray = options.symbolInstancesArray; this.sdfIcons = options.sdfIcons; this.iconsNeedLinear = options.iconsNeedLinear; this.adjustedTextSize = options.adjustedTextSize; this.adjustedIconSize = options.adjustedIconSize; this.fontstack = options.fontstack; } - SymbolBucket.prototype = util.inherit(Bucket, {}); - -SymbolBucket.prototype.serialize = function() { +SymbolBucket.prototype.serialize = function () { var serialized = Bucket.prototype.serialize.apply(this); serialized.sdfIcons = this.sdfIcons; serialized.iconsNeedLinear = this.iconsNeedLinear; @@ -44170,114 +45076,95 @@ SymbolBucket.prototype.serialize = function() { serialized.fontstack = this.fontstack; return serialized; }; - -var programAttributes = [{ - name: 'a_pos', - components: 2, - type: 'Int16' -}, { - name: 'a_offset', - components: 2, - type: 'Int16' -}, { - name: 'a_data1', - components: 4, - type: 'Uint8' -}, { - name: 'a_data2', - components: 2, - type: 'Uint8' -}]; - -function addVertex(array, x, y, ox, oy, tx, ty, minzoom, maxzoom, labelminzoom) { - return array.emplaceBack( - // pos - x, - y, - // offset - Math.round(ox * 64), // use 1/64 pixels for placement - Math.round(oy * 64), - // data1 - tx / 4, // tex - ty / 4, // tex - (labelminzoom || 0) * 10, // labelminzoom - 0, - // data2 - (minzoom || 0) * 10, // minzoom - Math.min(maxzoom || 25, 25) * 10); // minzoom +var layoutVertexArrayType = new Bucket.VertexArrayType([ + { + name: 'a_pos', + components: 2, + type: 'Int16' + }, + { + name: 'a_offset', + components: 2, + type: 'Int16' + }, + { + name: 'a_texture_pos', + components: 2, + type: 'Uint16' + }, + { + name: 'a_data', + components: 4, + type: 'Uint8' + } +]); +var elementArrayType = new Bucket.ElementArrayType(); +function addVertex(array, x, y, ox, oy, tx, ty, minzoom, maxzoom, labelminzoom, labelangle) { + return array.emplaceBack(x, y, Math.round(ox * 64), Math.round(oy * 64), tx / 4, ty / 4, (labelminzoom || 0) * 10, labelangle, (minzoom || 0) * 10, Math.min(maxzoom || 25, 25) * 10); } - -SymbolBucket.prototype.addCollisionBoxVertex = function(vertexArray, point, extrude, maxZoom, placementZoom) { - return vertexArray.emplaceBack( - // pos - point.x, - point.y, - // extrude - Math.round(extrude.x), - Math.round(extrude.y), - // data - maxZoom * 10, - placementZoom * 10); +SymbolBucket.prototype.addCollisionBoxVertex = function (layoutVertexArray, point, extrude, maxZoom, placementZoom) { + return layoutVertexArray.emplaceBack(point.x, point.y, Math.round(extrude.x), Math.round(extrude.y), maxZoom * 10, placementZoom * 10); }; - SymbolBucket.prototype.programInterfaces = { - glyph: { - vertexBuffer: true, - elementBuffer: true, - layoutAttributes: programAttributes + layoutVertexArrayType: layoutVertexArrayType, + elementArrayType: elementArrayType }, - icon: { - vertexBuffer: true, - elementBuffer: true, - layoutAttributes: programAttributes + layoutVertexArrayType: layoutVertexArrayType, + elementArrayType: elementArrayType }, - collisionBox: { - vertexBuffer: true, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }, { - name: 'a_extrude', - components: 2, - type: 'Int16' - }, { - name: 'a_data', - components: 2, - type: 'Uint8' - }] + layoutVertexArrayType: new Bucket.VertexArrayType([ + { + name: 'a_pos', + components: 2, + type: 'Int16' + }, + { + name: 'a_extrude', + components: 2, + type: 'Int16' + }, + { + name: 'a_data', + components: 2, + type: 'Uint8' + } + ]) } }; - -SymbolBucket.prototype.populateBuffers = function(collisionTile, stacks, icons) { - - // To reduce the number of labels that jump around when zooming we need - // to use a text-size value that is the same for all zoom levels. - // This calculates text-size at a high zoom level so that all tiles can - // use the same value when calculating anchor positions. - var zoomHistory = { lastIntegerZoom: Infinity, lastIntegerZoomTime: 0, lastZoom: 0 }; - this.adjustedTextMaxSize = this.layer.getLayoutValue('text-size', {zoom: 18, zoomHistory: zoomHistory}); - this.adjustedTextSize = this.layer.getLayoutValue('text-size', {zoom: this.zoom + 1, zoomHistory: zoomHistory}); - this.adjustedIconMaxSize = this.layer.getLayoutValue('icon-size', {zoom: 18, zoomHistory: zoomHistory}); - this.adjustedIconSize = this.layer.getLayoutValue('icon-size', {zoom: this.zoom + 1, zoomHistory: zoomHistory}); - +SymbolBucket.prototype.populateArrays = function (collisionTile, stacks, icons) { + var zoomHistory = { + lastIntegerZoom: Infinity, + lastIntegerZoomTime: 0, + lastZoom: 0 + }; + this.adjustedTextMaxSize = this.layer.getLayoutValue('text-size', { + zoom: 18, + zoomHistory: zoomHistory + }); + this.adjustedTextSize = this.layer.getLayoutValue('text-size', { + zoom: this.zoom + 1, + zoomHistory: zoomHistory + }); + this.adjustedIconMaxSize = this.layer.getLayoutValue('icon-size', { + zoom: 18, + zoomHistory: zoomHistory + }); + this.adjustedIconSize = this.layer.getLayoutValue('icon-size', { + zoom: this.zoom + 1, + zoomHistory: zoomHistory + }); var tileSize = 512 * this.overscaling; this.tilePixelRatio = EXTENT / tileSize; this.compareText = {}; - this.symbolInstances = []; this.iconsNeedLinear = false; - + this.symbolInstancesStartIndex = this.symbolInstancesArray.length; var layout = this.layer.layout; var features = this.features; var textFeatures = this.textFeatures; - - var horizontalAlign = 0.5, - verticalAlign = 0.5; - + var horizontalAlign = 0.5, verticalAlign = 0.5; switch (layout['text-anchor']) { case 'right': case 'top-right': @@ -44290,7 +45177,6 @@ SymbolBucket.prototype.populateBuffers = function(collisionTile, stacks, icons) horizontalAlign = 0; break; } - switch (layout['text-anchor']) { case 'bottom': case 'bottom-right': @@ -44303,155 +45189,93 @@ SymbolBucket.prototype.populateBuffers = function(collisionTile, stacks, icons) verticalAlign = 0; break; } - - var justify = layout['text-justify'] === 'right' ? 1 : - layout['text-justify'] === 'left' ? 0 : - 0.5; - + var justify = layout['text-justify'] === 'right' ? 1 : layout['text-justify'] === 'left' ? 0 : 0.5; var oneEm = 24; var lineHeight = layout['text-line-height'] * oneEm; var maxWidth = layout['symbol-placement'] !== 'line' ? layout['text-max-width'] * oneEm : 0; var spacing = layout['text-letter-spacing'] * oneEm; - var textOffset = [layout['text-offset'][0] * oneEm, layout['text-offset'][1] * oneEm]; + var textOffset = [ + layout['text-offset'][0] * oneEm, + layout['text-offset'][1] * oneEm + ]; var fontstack = this.fontstack = layout['text-font'].join(','); - var geometries = []; for (var g = 0; g < features.length; g++) { geometries.push(loadGeometry(features[g])); } - if (layout['symbol-placement'] === 'line') { - // Merge adjacent lines with the same text to improve labelling. - // It's better to place labels on one long line than on many short segments. var merged = mergeLines(features, textFeatures, geometries); - geometries = merged.geometries; features = merged.features; textFeatures = merged.textFeatures; } - var shapedText, shapedIcon; - for (var k = 0; k < features.length; k++) { - if (!geometries[k]) continue; - + if (!geometries[k]) + continue; if (textFeatures[k]) { - shapedText = shapeText(textFeatures[k], stacks[fontstack], maxWidth, - lineHeight, horizontalAlign, verticalAlign, justify, spacing, textOffset); + shapedText = shapeText(textFeatures[k], stacks[fontstack], maxWidth, lineHeight, horizontalAlign, verticalAlign, justify, spacing, textOffset); } else { shapedText = null; } - if (layout['icon-image']) { var iconName = resolveTokens(features[k].properties, layout['icon-image']); var image = icons[iconName]; shapedIcon = shapeIcon(image, layout); - if (image) { if (this.sdfIcons === undefined) { this.sdfIcons = image.sdf; } else if (this.sdfIcons !== image.sdf) { - console.warn('Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer'); + util.warnOnce('Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer'); } if (image.pixelRatio !== 1) { this.iconsNeedLinear = true; + } else if (layout['icon-rotate'] !== 0 || !this.layer.isLayoutValueFeatureConstant('icon-rotate')) { + this.iconsNeedLinear = true; } } } else { shapedIcon = null; } - if (shapedText || shapedIcon) { - this.addFeature(geometries[k], shapedText, shapedIcon, features[k].index); + this.addFeature(geometries[k], shapedText, shapedIcon, features[k]); } } - + this.symbolInstancesEndIndex = this.symbolInstancesArray.length; this.placeFeatures(collisionTile, this.showCollisionBoxes); - this.trimArrays(); }; - -SymbolBucket.prototype.addFeature = function(lines, shapedText, shapedIcon, featureIndex) { +SymbolBucket.prototype.addFeature = function (lines, shapedText, shapedIcon, feature) { var layout = this.layer.layout; - var glyphSize = 24; - - var fontScale = this.adjustedTextSize / glyphSize, - textMaxSize = this.adjustedTextMaxSize !== undefined ? this.adjustedTextMaxSize : this.adjustedTextSize, - textBoxScale = this.tilePixelRatio * fontScale, - textMaxBoxScale = this.tilePixelRatio * textMaxSize / glyphSize, - iconBoxScale = this.tilePixelRatio * this.adjustedIconSize, - symbolMinDistance = this.tilePixelRatio * layout['symbol-spacing'], - avoidEdges = layout['symbol-avoid-edges'], - textPadding = layout['text-padding'] * this.tilePixelRatio, - iconPadding = layout['icon-padding'] * this.tilePixelRatio, - textMaxAngle = layout['text-max-angle'] / 180 * Math.PI, - textAlongLine = layout['text-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', - iconAlongLine = layout['icon-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', - mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || - layout['text-ignore-placement'] || layout['icon-ignore-placement'], - isLine = layout['symbol-placement'] === 'line', - textRepeatDistance = symbolMinDistance / 2; - + var fontScale = this.adjustedTextSize / glyphSize, textMaxSize = this.adjustedTextMaxSize !== undefined ? this.adjustedTextMaxSize : this.adjustedTextSize, textBoxScale = this.tilePixelRatio * fontScale, textMaxBoxScale = this.tilePixelRatio * textMaxSize / glyphSize, iconBoxScale = this.tilePixelRatio * this.adjustedIconSize, symbolMinDistance = this.tilePixelRatio * layout['symbol-spacing'], avoidEdges = layout['symbol-avoid-edges'], textPadding = layout['text-padding'] * this.tilePixelRatio, iconPadding = layout['icon-padding'] * this.tilePixelRatio, textMaxAngle = layout['text-max-angle'] / 180 * Math.PI, textAlongLine = layout['text-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', iconAlongLine = layout['icon-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || layout['text-ignore-placement'] || layout['icon-ignore-placement'], isLine = layout['symbol-placement'] === 'line', textRepeatDistance = symbolMinDistance / 2; if (isLine) { lines = clipLine(lines, 0, 0, EXTENT, EXTENT); } - for (var i = 0; i < lines.length; i++) { var line = lines[i]; - - // Calculate the anchor points around which you want to place labels var anchors; if (isLine) { - anchors = getAnchors( - line, - symbolMinDistance, - textMaxAngle, - shapedText, - shapedIcon, - glyphSize, - textMaxBoxScale, - this.overscaling, - EXTENT - ); + anchors = getAnchors(line, symbolMinDistance, textMaxAngle, shapedText, shapedIcon, glyphSize, textMaxBoxScale, this.overscaling, EXTENT); } else { - anchors = [ new Anchor(line[0].x, line[0].y, 0) ]; + anchors = [new Anchor(line[0].x, line[0].y, 0)]; } - - // For each potential label, create the placement features used to check for collisions, and the quads use for rendering. for (var j = 0, len = anchors.length; j < len; j++) { var anchor = anchors[j]; - if (shapedText && isLine) { if (this.anchorIsTooClose(shapedText.text, textRepeatDistance, anchor)) { continue; } } - var inside = !(anchor.x < 0 || anchor.x > EXTENT || anchor.y < 0 || anchor.y > EXTENT); - - if (avoidEdges && !inside) continue; - - // Normally symbol layers are drawn across tile boundaries. Only symbols - // with their anchors within the tile boundaries are added to the buffers - // to prevent symbols from being drawn twice. - // - // Symbols in layers with overlap are sorted in the y direction so that - // symbols lower on the canvas are drawn on top of symbols near the top. - // To preserve this order across tile boundaries these symbols can't - // be drawn across tile boundaries. Instead they need to be included in - // the buffers for both tiles and clipped to tile boundaries at draw time. + if (avoidEdges && !inside) + continue; var addToBuffers = inside || mayOverlap; - - this.symbolInstances.push(new SymbolInstance(anchor, line, shapedText, shapedIcon, layout, - addToBuffers, this.symbolInstances.length, this.collisionBoxArray, featureIndex, this.sourceLayerIndex, this.index, - textBoxScale, textPadding, textAlongLine, - iconBoxScale, iconPadding, iconAlongLine)); + this.addSymbolInstance(anchor, line, shapedText, shapedIcon, this.layer, addToBuffers, this.symbolInstancesArray.length, this.collisionBoxArray, feature.index, this.sourceLayerIndex, this.index, textBoxScale, textPadding, textAlongLine, iconBoxScale, iconPadding, iconAlongLine, { zoom: this.zoom }, feature.properties); } } }; - -SymbolBucket.prototype.anchorIsTooClose = function(text, repeatDistance, anchor) { +SymbolBucket.prototype.anchorIsTooClose = function (text, repeatDistance, anchor) { var compareText = this.compareText; if (!(text in compareText)) { compareText[text] = []; @@ -44459,74 +45283,46 @@ SymbolBucket.prototype.anchorIsTooClose = function(text, repeatDistance, anchor) var otherAnchors = compareText[text]; for (var k = otherAnchors.length - 1; k >= 0; k--) { if (anchor.dist(otherAnchors[k]) < repeatDistance) { - // If it's within repeatDistance of one anchor, stop looking return true; } } } - // If anchor is not within repeatDistance of any other anchor, add to array compareText[text].push(anchor); return false; }; - -SymbolBucket.prototype.placeFeatures = function(collisionTile, showCollisionBoxes) { +SymbolBucket.prototype.placeFeatures = function (collisionTile, showCollisionBoxes) { this.recalculateStyleLayers(); - - // Calculate which labels can be shown and when they can be shown and - // create the bufers used for rendering. - this.createArrays(); - var layout = this.layer.layout; - var maxScale = collisionTile.maxScale; - var textAlongLine = layout['text-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line'; var iconAlongLine = layout['icon-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line'; - - var mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || - layout['text-ignore-placement'] || layout['icon-ignore-placement']; - - // Sort symbols by their y position on the canvas so that they lower symbols - // are drawn on top of higher symbols. - // Don't sort symbols that won't overlap because it isn't necessary and - // because it causes more labels to pop in and out when rotating. + var mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || layout['text-ignore-placement'] || layout['icon-ignore-placement']; if (mayOverlap) { + var symbolInstancesStructTypeArray = this.symbolInstancesArray.toArray(this.symbolInstancesStartIndex, this.symbolInstancesEndIndex); var angle = collisionTile.angle; - var sin = Math.sin(angle), - cos = Math.cos(angle); - - this.symbolInstances.sort(function(a, b) { - var aRotated = (sin * a.x + cos * a.y) | 0; - var bRotated = (sin * b.x + cos * b.y) | 0; - return (aRotated - bRotated) || (b.index - a.index); + var sin = Math.sin(angle), cos = Math.cos(angle); + this.sortedSymbolInstances = symbolInstancesStructTypeArray.sort(function (a, b) { + var aRotated = sin * a.anchorPointX + cos * a.anchorPointY | 0; + var bRotated = sin * b.anchorPointX + cos * b.anchorPointY | 0; + return aRotated - bRotated || b.index - a.index; }); } - - for (var p = 0; p < this.symbolInstances.length; p++) { - var symbolInstance = this.symbolInstances[p]; - var hasText = symbolInstance.hasText; - var hasIcon = symbolInstance.hasIcon; - - var iconWithoutText = layout['text-optional'] || !hasText, - textWithoutIcon = layout['icon-optional'] || !hasIcon; - - - // Calculate the scales at which the text and icon can be placed without collision. - - var glyphScale = hasText ? - collisionTile.placeCollisionFeature(symbolInstance.textCollisionFeature, - layout['text-allow-overlap'], layout['symbol-avoid-edges']) : - collisionTile.minScale; - - var iconScale = hasIcon ? - collisionTile.placeCollisionFeature(symbolInstance.iconCollisionFeature, - layout['icon-allow-overlap'], layout['symbol-avoid-edges']) : - collisionTile.minScale; - - - // Combine the scales for icons and text. - + for (var p = this.symbolInstancesStartIndex; p < this.symbolInstancesEndIndex; p++) { + var symbolInstance = this.sortedSymbolInstances ? this.sortedSymbolInstances[p - this.symbolInstancesStartIndex] : this.symbolInstancesArray.get(p); + var textCollisionFeature = { + boxStartIndex: symbolInstance.textBoxStartIndex, + boxEndIndex: symbolInstance.textBoxEndIndex + }; + var iconCollisionFeature = { + boxStartIndex: symbolInstance.iconBoxStartIndex, + boxEndIndex: symbolInstance.iconBoxEndIndex + }; + var hasText = !(symbolInstance.textBoxStartIndex === symbolInstance.textBoxEndIndex); + var hasIcon = !(symbolInstance.iconBoxStartIndex === symbolInstance.iconBoxEndIndex); + var iconWithoutText = layout['text-optional'] || !hasText, textWithoutIcon = layout['icon-optional'] || !hasIcon; + var glyphScale = hasText ? collisionTile.placeCollisionFeature(textCollisionFeature, layout['text-allow-overlap'], layout['symbol-avoid-edges']) : collisionTile.minScale; + var iconScale = hasIcon ? collisionTile.placeCollisionFeature(iconCollisionFeature, layout['icon-allow-overlap'], layout['symbol-avoid-edges']) : collisionTile.minScale; if (!iconWithoutText && !textWithoutIcon) { iconScale = glyphScale = Math.max(iconScale, glyphScale); } else if (!textWithoutIcon && glyphScale) { @@ -44534,170 +45330,137 @@ SymbolBucket.prototype.placeFeatures = function(collisionTile, showCollisionBoxe } else if (!iconWithoutText && iconScale) { iconScale = Math.max(iconScale, glyphScale); } - - - // Insert final placement into collision tree and add glyphs/icons to buffers - if (hasText) { - collisionTile.insertCollisionFeature(symbolInstance.textCollisionFeature, glyphScale, layout['text-ignore-placement']); + collisionTile.insertCollisionFeature(textCollisionFeature, glyphScale, layout['text-ignore-placement']); if (glyphScale <= maxScale) { - this.addSymbols('glyph', symbolInstance.glyphQuads, glyphScale, layout['text-keep-upright'], textAlongLine, collisionTile.angle); + this.addSymbols('glyph', symbolInstance.glyphQuadStartIndex, symbolInstance.glyphQuadEndIndex, glyphScale, layout['text-keep-upright'], textAlongLine, collisionTile.angle); } } - if (hasIcon) { - collisionTile.insertCollisionFeature(symbolInstance.iconCollisionFeature, iconScale, layout['icon-ignore-placement']); + collisionTile.insertCollisionFeature(iconCollisionFeature, iconScale, layout['icon-ignore-placement']); if (iconScale <= maxScale) { - this.addSymbols('icon', symbolInstance.iconQuads, iconScale, layout['icon-keep-upright'], iconAlongLine, collisionTile.angle); + this.addSymbols('icon', symbolInstance.iconQuadStartIndex, symbolInstance.iconQuadEndIndex, iconScale, layout['icon-keep-upright'], iconAlongLine, collisionTile.angle); } } - } - - if (showCollisionBoxes) this.addToDebugBuffers(collisionTile); + if (showCollisionBoxes) + this.addToDebugBuffers(collisionTile); }; - -SymbolBucket.prototype.addSymbols = function(programName, quads, scale, keepUpright, alongLine, placementAngle) { - - var group = this.makeRoomFor(programName, 4 * quads.length); - - var elementArray = group.layout.element; - var vertexArray = group.layout.vertex; - +SymbolBucket.prototype.addSymbols = function (programName, quadsStart, quadsEnd, scale, keepUpright, alongLine, placementAngle) { + var group = this.prepareArrayGroup(programName, 4 * (quadsEnd - quadsStart)); + var elementArray = group.elementArray; + var layoutVertexArray = group.layoutVertexArray; var zoom = this.zoom; var placementZoom = Math.max(Math.log(scale) / Math.LN2 + zoom, 0); - - for (var k = 0; k < quads.length; k++) { - - var symbol = quads[k], - angle = symbol.angle; - - // drop upside down versions of glyphs - var a = (angle + placementAngle + Math.PI) % (Math.PI * 2); - if (keepUpright && alongLine && (a <= Math.PI / 2 || a > Math.PI * 3 / 2)) continue; - - var tl = symbol.tl, - tr = symbol.tr, - bl = symbol.bl, - br = symbol.br, - tex = symbol.tex, - anchorPoint = symbol.anchorPoint, - - minZoom = Math.max(zoom + Math.log(symbol.minScale) / Math.LN2, placementZoom), - maxZoom = Math.min(zoom + Math.log(symbol.maxScale) / Math.LN2, 25); - - if (maxZoom <= minZoom) continue; - - // Lower min zoom so that while fading out the label it can be shown outside of collision-free zoom levels - if (minZoom === placementZoom) minZoom = 0; - - var index = addVertex(vertexArray, anchorPoint.x, anchorPoint.y, tl.x, tl.y, tex.x, tex.y, minZoom, maxZoom, placementZoom); - addVertex(vertexArray, anchorPoint.x, anchorPoint.y, tr.x, tr.y, tex.x + tex.w, tex.y, minZoom, maxZoom, placementZoom); - addVertex(vertexArray, anchorPoint.x, anchorPoint.y, bl.x, bl.y, tex.x, tex.y + tex.h, minZoom, maxZoom, placementZoom); - addVertex(vertexArray, anchorPoint.x, anchorPoint.y, br.x, br.y, tex.x + tex.w, tex.y + tex.h, minZoom, maxZoom, placementZoom); - + for (var k = quadsStart; k < quadsEnd; k++) { + var symbol = this.symbolQuadsArray.get(k).SymbolQuad; + var a = (symbol.anchorAngle + placementAngle + Math.PI) % (Math.PI * 2); + if (keepUpright && alongLine && (a <= Math.PI / 2 || a > Math.PI * 3 / 2)) + continue; + var tl = symbol.tl, tr = symbol.tr, bl = symbol.bl, br = symbol.br, tex = symbol.tex, anchorPoint = symbol.anchorPoint, minZoom = Math.max(zoom + Math.log(symbol.minScale) / Math.LN2, placementZoom), maxZoom = Math.min(zoom + Math.log(symbol.maxScale) / Math.LN2, 25); + if (maxZoom <= minZoom) + continue; + if (minZoom === placementZoom) + minZoom = 0; + var glyphAngle = Math.round(symbol.glyphAngle / (Math.PI * 2) * 256); + var index = addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, tl.x, tl.y, tex.x, tex.y, minZoom, maxZoom, placementZoom, glyphAngle); + addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, tr.x, tr.y, tex.x + tex.w, tex.y, minZoom, maxZoom, placementZoom, glyphAngle); + addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, bl.x, bl.y, tex.x, tex.y + tex.h, minZoom, maxZoom, placementZoom, glyphAngle); + addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, br.x, br.y, tex.x + tex.w, tex.y + tex.h, minZoom, maxZoom, placementZoom, glyphAngle); elementArray.emplaceBack(index, index + 1, index + 2); elementArray.emplaceBack(index + 1, index + 2, index + 3); } - }; - -SymbolBucket.prototype.updateIcons = function(icons) { +SymbolBucket.prototype.updateIcons = function (icons) { this.recalculateStyleLayers(); var iconValue = this.layer.layout['icon-image']; - if (!iconValue) return; - + if (!iconValue) + return; for (var i = 0; i < this.features.length; i++) { var iconName = resolveTokens(this.features[i].properties, iconValue); if (iconName) icons[iconName] = true; } }; - -SymbolBucket.prototype.updateFont = function(stacks) { +SymbolBucket.prototype.updateFont = function (stacks) { this.recalculateStyleLayers(); - var fontName = this.layer.layout['text-font'], - stack = stacks[fontName] = stacks[fontName] || {}; - + var fontName = this.layer.layout['text-font'], stack = stacks[fontName] = stacks[fontName] || {}; this.textFeatures = resolveText(this.features, this.layer.layout, stack); }; - -SymbolBucket.prototype.addToDebugBuffers = function(collisionTile) { - var group = this.makeRoomFor('collisionBox', 0); - var vertexArray = group.layout.vertex; +SymbolBucket.prototype.addToDebugBuffers = function (collisionTile) { + var group = this.prepareArrayGroup('collisionBox', 0); + var layoutVertexArray = group.layoutVertexArray; var angle = -collisionTile.angle; var yStretch = collisionTile.yStretch; - - for (var j = 0; j < this.symbolInstances.length; j++) { + for (var j = this.symbolInstancesStartIndex; j < this.symbolInstancesEndIndex; j++) { + var symbolInstance = this.symbolInstancesArray.get(j); + symbolInstance.textCollisionFeature = { + boxStartIndex: symbolInstance.textBoxStartIndex, + boxEndIndex: symbolInstance.textBoxEndIndex + }; + symbolInstance.iconCollisionFeature = { + boxStartIndex: symbolInstance.iconBoxStartIndex, + boxEndIndex: symbolInstance.iconBoxEndIndex + }; for (var i = 0; i < 2; i++) { - var feature = this.symbolInstances[j][i === 0 ? 'textCollisionFeature' : 'iconCollisionFeature']; - if (!feature) continue; - + var feature = symbolInstance[i === 0 ? 'textCollisionFeature' : 'iconCollisionFeature']; + if (!feature) + continue; for (var b = feature.boxStartIndex; b < feature.boxEndIndex; b++) { var box = this.collisionBoxArray.get(b); var anchorPoint = box.anchorPoint; - var tl = new Point(box.x1, box.y1 * yStretch)._rotate(angle); var tr = new Point(box.x2, box.y1 * yStretch)._rotate(angle); var bl = new Point(box.x1, box.y2 * yStretch)._rotate(angle); var br = new Point(box.x2, box.y2 * yStretch)._rotate(angle); - var maxZoom = Math.max(0, Math.min(25, this.zoom + Math.log(box.maxScale) / Math.LN2)); var placementZoom = Math.max(0, Math.min(25, this.zoom + Math.log(box.placementScale) / Math.LN2)); - - this.addCollisionBoxVertex(vertexArray, anchorPoint, tl, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, tr, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, tr, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, br, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, br, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, bl, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, bl, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, tl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tr, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tr, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, br, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, br, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, bl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, bl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tl, maxZoom, placementZoom); } } } }; - -function SymbolInstance(anchor, line, shapedText, shapedIcon, layout, addToBuffers, index, collisionBoxArray, featureIndex, sourceLayerIndex, bucketIndex, - textBoxScale, textPadding, textAlongLine, - iconBoxScale, iconPadding, iconAlongLine) { - - this.x = anchor.x; - this.y = anchor.y; - this.index = index; - this.hasText = !!shapedText; - this.hasIcon = !!shapedIcon; - - if (this.hasText) { - this.glyphQuads = addToBuffers ? getGlyphQuads(anchor, shapedText, textBoxScale, line, layout, textAlongLine) : []; - this.textCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, - shapedText, textBoxScale, textPadding, textAlongLine, false); +SymbolBucket.prototype.addSymbolInstance = function (anchor, line, shapedText, shapedIcon, layer, addToBuffers, index, collisionBoxArray, featureIndex, sourceLayerIndex, bucketIndex, textBoxScale, textPadding, textAlongLine, iconBoxScale, iconPadding, iconAlongLine, globalProperties, featureProperties) { + var glyphQuadStartIndex, glyphQuadEndIndex, iconQuadStartIndex, iconQuadEndIndex, textCollisionFeature, iconCollisionFeature, glyphQuads, iconQuads; + if (shapedText) { + glyphQuads = addToBuffers ? getGlyphQuads(anchor, shapedText, textBoxScale, line, layer, textAlongLine) : []; + textCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shapedText, textBoxScale, textPadding, textAlongLine, false); } - - if (this.hasIcon) { - this.iconQuads = addToBuffers ? getIconQuads(anchor, shapedIcon, iconBoxScale, line, layout, iconAlongLine) : []; - this.iconCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, - shapedIcon, iconBoxScale, iconPadding, iconAlongLine, true); + glyphQuadStartIndex = this.symbolQuadsArray.length; + if (glyphQuads && glyphQuads.length) { + for (var i = 0; i < glyphQuads.length; i++) { + this.addSymbolQuad(glyphQuads[i]); + } } -} - -},{"../../symbol/anchor":303,"../../symbol/clip_line":305,"../../symbol/collision_feature":307,"../../symbol/get_anchors":309,"../../symbol/mergelines":312,"../../symbol/quads":313,"../../symbol/resolve_text":314,"../../symbol/shaping":315,"../../util/token":348,"../../util/util":349,"../bucket":247,"../load_geometry":254,"point-geometry":404}],252:[function(require,module,exports){ + glyphQuadEndIndex = this.symbolQuadsArray.length; + var textBoxStartIndex = textCollisionFeature ? textCollisionFeature.boxStartIndex : this.collisionBoxArray.length; + var textBoxEndIndex = textCollisionFeature ? textCollisionFeature.boxEndIndex : this.collisionBoxArray.length; + if (shapedIcon) { + iconQuads = addToBuffers ? getIconQuads(anchor, shapedIcon, iconBoxScale, line, layer, iconAlongLine, shapedText, globalProperties, featureProperties) : []; + iconCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shapedIcon, iconBoxScale, iconPadding, iconAlongLine, true); + } + iconQuadStartIndex = this.symbolQuadsArray.length; + if (iconQuads && iconQuads.length === 1) { + this.addSymbolQuad(iconQuads[0]); + } + iconQuadEndIndex = this.symbolQuadsArray.length; + var iconBoxStartIndex = iconCollisionFeature ? iconCollisionFeature.boxStartIndex : this.collisionBoxArray.length; + var iconBoxEndIndex = iconCollisionFeature ? iconCollisionFeature.boxEndIndex : this.collisionBoxArray.length; + return this.symbolInstancesArray.emplaceBack(textBoxStartIndex, textBoxEndIndex, iconBoxStartIndex, iconBoxEndIndex, glyphQuadStartIndex, glyphQuadEndIndex, iconQuadStartIndex, iconQuadEndIndex, anchor.x, anchor.y, index); +}; +SymbolBucket.prototype.addSymbolQuad = function (symbolQuad) { + return this.symbolQuadsArray.emplaceBack(symbolQuad.anchorPoint.x, symbolQuad.anchorPoint.y, symbolQuad.tl.x, symbolQuad.tl.y, symbolQuad.tr.x, symbolQuad.tr.y, symbolQuad.bl.x, symbolQuad.bl.y, symbolQuad.br.x, symbolQuad.br.y, symbolQuad.tex.h, symbolQuad.tex.w, symbolQuad.tex.x, symbolQuad.tex.y, symbolQuad.anchorAngle, symbolQuad.glyphAngle, symbolQuad.maxScale, symbolQuad.minScale); +}; +},{"../../symbol/anchor":315,"../../symbol/clip_line":317,"../../symbol/collision_feature":319,"../../symbol/get_anchors":321,"../../symbol/mergelines":324,"../../symbol/quads":325,"../../symbol/resolve_text":326,"../../symbol/shaping":327,"../../util/token":365,"../../util/util":366,"../bucket":253,"../load_geometry":261,"point-geometry":424}],258:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); - module.exports = Buffer; - -/** - * The `Buffer` class turns a `StructArray` into a WebGL buffer. Each member of the StructArray's - * Struct type is converted to a WebGL atribute. - * - * @class Buffer - * @private - * @param {object} array A serialized StructArray. - * @param {object} arrayType A serialized StructArrayType. - * @param {BufferType} type - */ function Buffer(array, arrayType, type) { this.arrayBuffer = array.arrayBuffer; this.length = array.length; @@ -44706,102 +45469,86 @@ function Buffer(array, arrayType, type) { this.type = type; this.arrayType = arrayType; } - -/** - * Bind this buffer to a WebGL context. - * @private - * @param gl The WebGL context - */ -Buffer.prototype.bind = function(gl) { +Buffer.prototype.bind = function (gl) { var type = gl[this.type]; - if (!this.buffer) { this.buffer = gl.createBuffer(); gl.bindBuffer(type, this.buffer); gl.bufferData(type, this.arrayBuffer, gl.STATIC_DRAW); - - // dump array buffer once it's bound to gl this.arrayBuffer = null; } else { gl.bindBuffer(type, this.buffer); } }; - -/** - * @enum {string} AttributeType - * @private - * @readonly - */ var AttributeType = { - Int8: 'BYTE', - Uint8: 'UNSIGNED_BYTE', - Int16: 'SHORT', + Int8: 'BYTE', + Uint8: 'UNSIGNED_BYTE', + Int16: 'SHORT', Uint16: 'UNSIGNED_SHORT' }; - -/** - * Set the attribute pointers in a WebGL context - * @private - * @param gl The WebGL context - * @param program The active WebGL program - */ -Buffer.prototype.setVertexAttribPointers = function(gl, program) { +Buffer.prototype.setVertexAttribPointers = function (gl, program) { for (var j = 0; j < this.attributes.length; j++) { var member = this.attributes[j]; var attribIndex = program[member.name]; - assert(attribIndex !== undefined, 'array member "' + member.name + '" name does not match shader attribute name'); - - gl.vertexAttribPointer( - attribIndex, - member.components, - gl[AttributeType[member.type]], - false, - this.arrayType.bytesPerElement, - member.offset - ); + if (attribIndex !== undefined) { + gl.vertexAttribPointer(attribIndex, member.components, gl[AttributeType[member.type]], false, this.arrayType.bytesPerElement, member.offset); + } } }; - -/** - * Destroy the GL buffer bound to the given WebGL context - * @private - * @param gl The WebGL context - */ -Buffer.prototype.destroy = function(gl) { +Buffer.prototype.destroy = function (gl) { if (this.buffer) { gl.deleteBuffer(this.buffer); } }; - -/** - * @enum {string} BufferType - * @private - * @readonly - */ Buffer.BufferType = { VERTEX: 'ARRAY_BUFFER', ELEMENT: 'ELEMENT_ARRAY_BUFFER' }; - -/** - * An `BufferType.ELEMENT` buffer holds indicies of a corresponding `BufferType.VERTEX` buffer. - * These indicies are stored in the `BufferType.ELEMENT` buffer as `UNSIGNED_SHORT`s. - * - * @private - * @readonly - */ -Buffer.ELEMENT_ATTRIBUTE_TYPE = 'Uint16'; - -/** - * WebGL performs best if vertex attribute offsets are aligned to 4 byte boundaries. - * @private - * @readonly - */ -Buffer.VERTEX_ATTRIBUTE_ALIGNMENT = 4; - -},{"assert":52}],253:[function(require,module,exports){ +},{}],259:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var Buffer = require('./buffer'); +var VertexArrayObject = require('../render/vertex_array_object'); +module.exports = BufferGroup; +function BufferGroup(arrayGroup, arrayTypes) { + this.layoutVertexBuffer = new Buffer(arrayGroup.layoutVertexArray, arrayTypes.layoutVertexArrayType, Buffer.BufferType.VERTEX); + if (arrayGroup.elementArray) { + this.elementBuffer = new Buffer(arrayGroup.elementArray, arrayTypes.elementArrayType, Buffer.BufferType.ELEMENT); + } + var vaos = this.vaos = {}; + var secondVaos; + if (arrayGroup.elementArray2) { + this.elementBuffer2 = new Buffer(arrayGroup.elementArray2, arrayTypes.elementArrayType2, Buffer.BufferType.ELEMENT); + secondVaos = this.secondVaos = {}; + } + this.paintVertexBuffers = util.mapObject(arrayGroup.paintVertexArrays, function (array, name) { + vaos[name] = new VertexArrayObject(); + if (arrayGroup.elementArray2) { + secondVaos[name] = new VertexArrayObject(); + } + return new Buffer(array, arrayTypes.paintVertexArrayTypes[name], Buffer.BufferType.VERTEX); + }); +} +BufferGroup.prototype.destroy = function (gl) { + this.layoutVertexBuffer.destroy(gl); + if (this.elementBuffer) { + this.elementBuffer.destroy(gl); + } + if (this.elementBuffer2) { + this.elementBuffer2.destroy(gl); + } + for (var n in this.paintVertexBuffers) { + this.paintVertexBuffers[n].destroy(gl); + } + for (var j in this.vaos) { + this.vaos[j].destroy(gl); + } + for (var k in this.secondVaos) { + this.secondVaos[k].destroy(gl); + } +}; +},{"../render/vertex_array_object":281,"../util/util":366,"./buffer":258}],260:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); var loadGeometry = require('./load_geometry'); var EXTENT = require('./bucket').EXTENT; @@ -44813,25 +45560,27 @@ var vt = require('vector-tile'); var Protobuf = require('pbf'); var GeoJSONFeature = require('../util/vectortile_to_geojson'); var arraysIntersect = require('../util/util').arraysIntersect; - var intersection = require('../util/intersection_tests'); var multiPolygonIntersectsBufferedMultiPoint = intersection.multiPolygonIntersectsBufferedMultiPoint; var multiPolygonIntersectsMultiPolygon = intersection.multiPolygonIntersectsMultiPolygon; var multiPolygonIntersectsBufferedMultiLine = intersection.multiPolygonIntersectsBufferedMultiLine; - - var FeatureIndexArray = new StructArrayType({ members: [ - // the index of the feature in the original vectortile - { type: 'Uint32', name: 'featureIndex' }, - // the source layer the feature appears in - { type: 'Uint16', name: 'sourceLayerIndex' }, - // the bucket the feature appears in - { type: 'Uint16', name: 'bucketIndex' } - ]}); - + { + type: 'Uint32', + name: 'featureIndex' + }, + { + type: 'Uint16', + name: 'sourceLayerIndex' + }, + { + type: 'Uint16', + name: 'bucketIndex' + } + ] +}); module.exports = FeatureIndex; - function FeatureIndex(coord, overscaling, collisionTile) { if (coord.grid) { var serialized = coord; @@ -44853,18 +45602,18 @@ function FeatureIndex(coord, overscaling, collisionTile) { this.z = coord.z - Math.log(overscaling) / Math.LN2; this.setCollisionTile(collisionTile); } - -FeatureIndex.prototype.insert = function(feature, featureIndex, sourceLayerIndex, bucketIndex) { +FeatureIndex.prototype.insert = function (feature, featureIndex, sourceLayerIndex, bucketIndex) { var key = this.featureIndexArray.length; this.featureIndexArray.emplaceBack(featureIndex, sourceLayerIndex, bucketIndex); var geometry = loadGeometry(feature); - for (var r = 0; r < geometry.length; r++) { var ring = geometry[r]; - - // TODO: skip holes when we start using vector tile spec 2.0 - - var bbox = [Infinity, Infinity, -Infinity, -Infinity]; + var bbox = [ + Infinity, + Infinity, + -Infinity, + -Infinity + ]; for (var i = 0; i < ring.length; i++) { var p = ring[i]; bbox[0] = Math.min(bbox[0], p.x); @@ -44872,16 +45621,13 @@ FeatureIndex.prototype.insert = function(feature, featureIndex, sourceLayerIndex bbox[2] = Math.max(bbox[2], p.x); bbox[3] = Math.max(bbox[3], p.y); } - this.grid.insert(key, bbox[0], bbox[1], bbox[2], bbox[3]); } }; - -FeatureIndex.prototype.setCollisionTile = function(collisionTile) { +FeatureIndex.prototype.setCollisionTile = function (collisionTile) { this.collisionTile = collisionTile; }; - -FeatureIndex.prototype.serialize = function() { +FeatureIndex.prototype.serialize = function () { var data = { coord: this.coord, overscaling: this.overscaling, @@ -44891,35 +45637,26 @@ FeatureIndex.prototype.serialize = function() { }; return { data: data, - transferables: [data.grid, data.featureIndexArray.arrayBuffer] + transferables: [ + data.grid, + data.featureIndexArray.arrayBuffer + ] }; }; - function translateDistance(translate) { return Math.sqrt(translate[0] * translate[0] + translate[1] * translate[1]); } - -// Finds features in this tile at a particular position. -FeatureIndex.prototype.query = function(args, styleLayers) { +FeatureIndex.prototype.query = function (args, styleLayers) { if (!this.vtLayers) { this.vtLayers = new vt.VectorTile(new Protobuf(new Uint8Array(this.rawTileData))).layers; this.sourceLayerCoder = new DictionaryCoder(this.vtLayers ? Object.keys(this.vtLayers).sort() : ['_geojsonTileLayer']); } - var result = {}; - - var params = args.params || {}, - pixelsToTileUnits = EXTENT / args.tileSize / args.scale, - filter = featureFilter(params.filter); - - // Features are indexed their original geometries. The rendered geometries may - // be buffered, translated or offset. Figure out how much the search radius needs to be - // expanded by to include these features. + var params = args.params || {}, pixelsToTileUnits = EXTENT / args.tileSize / args.scale, filter = featureFilter(params.filter); var additionalRadius = 0; for (var id in styleLayers) { var styleLayer = styleLayers[id]; var paint = styleLayer.paint; - var styleLayerDistance = 0; if (styleLayer.type === 'line') { styleLayerDistance = getLineWidth(paint) / 2 + Math.abs(paint['line-offset']) + translateDistance(paint['line-translate']); @@ -44930,13 +45667,11 @@ FeatureIndex.prototype.query = function(args, styleLayers) { } additionalRadius = Math.max(additionalRadius, styleLayerDistance * pixelsToTileUnits); } - - var queryGeometry = args.queryGeometry.map(function(q) { - return q.map(function(p) { + var queryGeometry = args.queryGeometry.map(function (q) { + return q.map(function (p) { return new Point(p.x, p.y); }); }); - var minX = Infinity; var minY = Infinity; var maxX = -Infinity; @@ -44951,22 +45686,17 @@ FeatureIndex.prototype.query = function(args, styleLayers) { maxY = Math.max(maxY, p.y); } } - var matching = this.grid.query(minX - additionalRadius, minY - additionalRadius, maxX + additionalRadius, maxY + additionalRadius); matching.sort(topDownFeatureComparator); this.filterMatching(result, matching, this.featureIndexArray, queryGeometry, filter, params.layers, styleLayers, args.bearing, pixelsToTileUnits); - var matchingSymbols = this.collisionTile.queryRenderedSymbols(minX, minY, maxX, maxY, args.scale); matchingSymbols.sort(); this.filterMatching(result, matchingSymbols, this.collisionTile.collisionBoxArray, queryGeometry, filter, params.layers, styleLayers, args.bearing, pixelsToTileUnits); - return result; }; - function topDownFeatureComparator(a, b) { return b - a; } - function getLineWidth(paint) { if (paint['line-gap-width'] > 0) { return paint['line-gap-width'] + 2 * paint['line-width']; @@ -44974,76 +45704,57 @@ function getLineWidth(paint) { return paint['line-width']; } } - -FeatureIndex.prototype.filterMatching = function(result, matching, array, queryGeometry, filter, filterLayerIDs, styleLayers, bearing, pixelsToTileUnits) { +FeatureIndex.prototype.filterMatching = function (result, matching, array, queryGeometry, filter, filterLayerIDs, styleLayers, bearing, pixelsToTileUnits) { var previousIndex; for (var k = 0; k < matching.length; k++) { var index = matching[k]; - - // don't check the same feature more than once - if (index === previousIndex) continue; + if (index === previousIndex) + continue; previousIndex = index; - var match = array.get(index); - var layerIDs = this.bucketLayerIDs[match.bucketIndex]; - if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs)) continue; - + if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs)) + continue; var sourceLayerName = this.sourceLayerCoder.decode(match.sourceLayerIndex); var sourceLayer = this.vtLayers[sourceLayerName]; var feature = sourceLayer.feature(match.featureIndex); - - if (!filter(feature)) continue; - + if (!filter(feature)) + continue; var geometry = null; - for (var l = 0; l < layerIDs.length; l++) { var layerID = layerIDs[l]; - if (filterLayerIDs && filterLayerIDs.indexOf(layerID) < 0) { continue; } - var styleLayer = styleLayers[layerID]; - if (!styleLayer) continue; - + if (!styleLayer) + continue; var translatedPolygon; if (styleLayer.type !== 'symbol') { - // all symbols already match the style - - if (!geometry) geometry = loadGeometry(feature); - + if (!geometry) + geometry = loadGeometry(feature); var paint = styleLayer.paint; - if (styleLayer.type === 'line') { - translatedPolygon = translate(queryGeometry, - paint['line-translate'], paint['line-translate-anchor'], - bearing, pixelsToTileUnits); + translatedPolygon = translate(queryGeometry, paint['line-translate'], paint['line-translate-anchor'], bearing, pixelsToTileUnits); var halfWidth = getLineWidth(paint) / 2 * pixelsToTileUnits; if (paint['line-offset']) { geometry = offsetLine(geometry, paint['line-offset'] * pixelsToTileUnits); } - if (!multiPolygonIntersectsBufferedMultiLine(translatedPolygon, geometry, halfWidth)) continue; - + if (!multiPolygonIntersectsBufferedMultiLine(translatedPolygon, geometry, halfWidth)) + continue; } else if (styleLayer.type === 'fill') { - translatedPolygon = translate(queryGeometry, - paint['fill-translate'], paint['fill-translate-anchor'], - bearing, pixelsToTileUnits); - if (!multiPolygonIntersectsMultiPolygon(translatedPolygon, geometry)) continue; - + translatedPolygon = translate(queryGeometry, paint['fill-translate'], paint['fill-translate-anchor'], bearing, pixelsToTileUnits); + if (!multiPolygonIntersectsMultiPolygon(translatedPolygon, geometry)) + continue; } else if (styleLayer.type === 'circle') { - translatedPolygon = translate(queryGeometry, - paint['circle-translate'], paint['circle-translate-anchor'], - bearing, pixelsToTileUnits); + translatedPolygon = translate(queryGeometry, paint['circle-translate'], paint['circle-translate-anchor'], bearing, pixelsToTileUnits); var circleRadius = paint['circle-radius'] * pixelsToTileUnits; - if (!multiPolygonIntersectsBufferedMultiPoint(translatedPolygon, geometry, circleRadius)) continue; + if (!multiPolygonIntersectsBufferedMultiPoint(translatedPolygon, geometry, circleRadius)) + continue; } } - var geojsonFeature = new GeoJSONFeature(feature, this.z, this.x, this.y); - geojsonFeature.layer = styleLayer.serialize({ - includeRefProperties: true - }); + geojsonFeature.layer = styleLayer.serialize({ includeRefProperties: true }); var layerResult = result[layerID]; if (layerResult === undefined) { layerResult = result[layerID] = []; @@ -45052,18 +45763,14 @@ FeatureIndex.prototype.filterMatching = function(result, matching, array, queryG } } }; - function translate(queryGeometry, translate, translateAnchor, bearing, pixelsToTileUnits) { if (!translate[0] && !translate[1]) { return queryGeometry; } - translate = Point.convert(translate); - - if (translateAnchor === "viewport") { + if (translateAnchor === 'viewport') { translate._rotate(-bearing); } - var translated = []; for (var i = 0; i < queryGeometry.length; i++) { var ring = queryGeometry[i]; @@ -45075,7 +45782,6 @@ function translate(queryGeometry, translate, translateAnchor, bearing, pixelsToT } return translated; } - function offsetLine(rings, offset) { var newRings = []; var zero = new Point(0, 0); @@ -45089,160 +45795,81 @@ function offsetLine(rings, offset) { var aToB = i === 0 ? zero : b.sub(a)._unit()._perp(); var bToC = i === ring.length - 1 ? zero : c.sub(b)._unit()._perp(); var extrude = aToB._add(bToC)._unit(); - var cosHalfAngle = extrude.x * bToC.x + extrude.y * bToC.y; extrude._mult(1 / cosHalfAngle); - newRing.push(extrude._mult(offset)._add(b)); } newRings.push(newRing); } return newRings; } - -},{"../util/dictionary_coder":340,"../util/intersection_tests":344,"../util/struct_array":347,"../util/util":349,"../util/vectortile_to_geojson":350,"./bucket":247,"./load_geometry":254,"feature-filter":352,"grid-index":373,"pbf":402,"point-geometry":404,"vector-tile":413}],254:[function(require,module,exports){ +},{"../util/dictionary_coder":356,"../util/intersection_tests":361,"../util/struct_array":364,"../util/util":366,"../util/vectortile_to_geojson":367,"./bucket":253,"./load_geometry":261,"feature-filter":370,"grid-index":392,"pbf":422,"point-geometry":424,"vector-tile":434}],261:[function(require,module,exports){ 'use strict'; - +var util = require('../util/util'); var EXTENT = require('./bucket').EXTENT; -var EXTENT_MIN = EXTENT * -2; -var EXTENT_MAX = (EXTENT * 2) - 1; - -// only log a geometry warning once per context -var warned = false; - -/** - * Loads a geometry from a VectorTileFeature and scales it to the common extent - * used internally. - * @private - */ -module.exports = function loadGeometry(feature) { +function createBounds(bits) { + return { + min: -1 * Math.pow(2, bits - 1), + max: Math.pow(2, bits - 1) - 1 + }; +} +var boundsLookup = { + 15: createBounds(15), + 16: createBounds(16) +}; +module.exports = function loadGeometry(feature, bits) { + var bounds = boundsLookup[bits || 16]; var scale = EXTENT / feature.extent; var geometry = feature.loadGeometry(); for (var r = 0; r < geometry.length; r++) { var ring = geometry[r]; for (var p = 0; p < ring.length; p++) { var point = ring[p]; - // round here because mapbox-gl-native uses integers to represent - // points and we need to do the same to avoid renering differences. point.x = Math.round(point.x * scale); point.y = Math.round(point.y * scale); - if (warned === false && ( - point.x < EXTENT_MIN || - point.x > EXTENT_MAX || - point.y < EXTENT_MIN || - point.y > EXTENT_MAX)) { - console.warn('Geometry exceeds allowed extent, reduce your vector tile buffer size'); - warned = true; + if (point.x < bounds.min || point.x > bounds.max || point.y < bounds.min || point.y > bounds.max) { + util.warnOnce('Geometry exceeds allowed extent, reduce your vector tile buffer size'); } } } return geometry; }; - -},{"./bucket":247}],255:[function(require,module,exports){ +},{"../util/util":366,"./bucket":253}],262:[function(require,module,exports){ 'use strict'; - module.exports = Coordinate; - -/** - * A coordinate is a column, row, zoom combination, often used - * as the data component of a tile. - * - * @param {number} column - * @param {number} row - * @param {number} zoom - * @private - */ function Coordinate(column, row, zoom) { this.column = column; this.row = row; this.zoom = zoom; } - Coordinate.prototype = { - - /** - * Create a clone of this coordinate that can be mutated without - * changing the original coordinate - * - * @returns {Coordinate} clone - * @private - * var coord = new Coordinate(0, 0, 0); - * var c2 = coord.clone(); - * // since coord is cloned, modifying a property of c2 does - * // not modify it. - * c2.zoom = 2; - */ - clone: function() { + clone: function () { return new Coordinate(this.column, this.row, this.zoom); }, - - /** - * Zoom this coordinate to a given zoom level. This returns a new - * coordinate object, not mutating the old one. - * - * @param {number} zoom - * @returns {Coordinate} zoomed coordinate - * @private - * @example - * var coord = new Coordinate(0, 0, 0); - * var c2 = coord.zoomTo(1); - * c2 // equals new Coordinate(0, 0, 1); - */ - zoomTo: function(zoom) { return this.clone()._zoomTo(zoom); }, - - /** - * Subtract the column and row values of this coordinate from those - * of another coordinate. The other coordinat will be zoomed to the - * same level as `this` before the subtraction occurs - * - * @param {Coordinate} c other coordinate - * @returns {Coordinate} result - * @private - */ - sub: function(c) { return this.clone()._sub(c); }, - - _zoomTo: function(zoom) { + zoomTo: function (zoom) { + return this.clone()._zoomTo(zoom); + }, + sub: function (c) { + return this.clone()._sub(c); + }, + _zoomTo: function (zoom) { var scale = Math.pow(2, zoom - this.zoom); this.column *= scale; this.row *= scale; this.zoom = zoom; return this; }, - - _sub: function(c) { + _sub: function (c) { c = c.zoomTo(this.zoom); this.column -= c.column; this.row -= c.row; return this; } }; - -},{}],256:[function(require,module,exports){ +},{}],263:[function(require,module,exports){ 'use strict'; - module.exports = LngLat; - var wrap = require('../util/util').wrap; - -/** - * Create a longitude, latitude object from a given longitude and latitude pair in degrees. - * Mapbox GL uses Longitude, Latitude coordinate order to match GeoJSON. - * - * Note that any Mapbox GL method that accepts a `LngLat` object can also accept an - * `Array` and will perform an implicit conversion. The following lines are equivalent: - ``` - map.setCenter([-73.9749, 40.7736]); - map.setCenter( new mapboxgl.LngLat(-73.9749, 40.7736) ); - ``` - * - * @class LngLat - * @classdesc A representation of a longitude, latitude point, in degrees. - * @param {number} lng longitude - * @param {number} lat latitude - * @example - * var ll = new mapboxgl.LngLat(-73.9749, 40.7736); - */ function LngLat(lng, lat) { if (isNaN(lng) || isNaN(lat)) { throw new Error('Invalid LngLat object: (' + lng + ', ' + lat + ')'); @@ -45253,55 +45880,18 @@ function LngLat(lng, lat) { throw new Error('Invalid LngLat latitude value: must be between -90 and 90'); } } - -/** - * Return a new `LngLat` object whose longitude is wrapped to the range (-180, 180). - * - * @returns {LngLat} wrapped LngLat object - * @example - * var ll = new mapboxgl.LngLat(286.0251, 40.7736); - * var wrapped = ll.wrap(); - * wrapped.lng; // = -73.9749 - */ LngLat.prototype.wrap = function () { return new LngLat(wrap(this.lng, -180, 180), this.lat); }; - -/** - * Return a `LngLat` as an array - * - * @returns {array} [lng, lat] - * @example - * var ll = new mapboxgl.LngLat(-73.9749, 40.7736); - * ll.toArray(); // = [-73.9749, 40.7736] - */ LngLat.prototype.toArray = function () { - return [this.lng, this.lat]; + return [ + this.lng, + this.lat + ]; }; - -/** - * Return a `LngLat` as a string - * - * @returns {string} "LngLat(lng, lat)" - * @example - * var ll = new mapboxgl.LngLat(-73.9749, 40.7736); - * ll.toString(); // = "LngLat(-73.9749, 40.7736)" - */ LngLat.prototype.toString = function () { return 'LngLat(' + this.lng + ', ' + this.lat + ')'; }; - -/** - * Convert an array to a `LngLat` object, or return an existing `LngLat` object - * unchanged. - * - * @param {Array|LngLat} input `input` to convert - * @returns {LngLat} LngLat object or original input - * @example - * var arr = [-73.9749, 40.7736]; - * var ll = mapboxgl.LngLat.convert(arr); - * ll; // = LngLat {lng: -73.9749, lat: 40.7736} - */ LngLat.convert = function (input) { if (input instanceof LngLat) { return input; @@ -45311,215 +45901,107 @@ LngLat.convert = function (input) { } return input; }; - -},{"../util/util":349}],257:[function(require,module,exports){ +},{"../util/util":366}],264:[function(require,module,exports){ 'use strict'; - module.exports = LngLatBounds; - var LngLat = require('./lng_lat'); - -/** - * Creates a bounding box from the given pair of points. If parameteres are omitted, a `null` bounding box is created. - * - * @class LngLatBounds - * @classdesc A representation of rectangular box on the earth, defined by its southwest and northeast points in longitude and latitude. - * @param {LngLat} sw southwest - * @param {LngLat} ne northeast - * @example - * var sw = new mapboxgl.LngLat(-73.9876, 40.7661); - * var ne = new mapboxgl.LngLat(-73.9397, 40.8002); - * var llb = new mapboxgl.LngLatBounds(sw, ne); - */ function LngLatBounds(sw, ne) { if (!sw) { return; } else if (ne) { this.extend(sw).extend(ne); } else if (sw.length === 4) { - this.extend([sw[0], sw[1]]).extend([sw[2], sw[3]]); + this.extend([ + sw[0], + sw[1] + ]).extend([ + sw[2], + sw[3] + ]); } else { this.extend(sw[0]).extend(sw[1]); } } - LngLatBounds.prototype = { - - /** - * Extend the bounds to include a given LngLat or LngLatBounds. - * - * @param {LngLat|LngLatBounds} obj object to extend to - * @returns {LngLatBounds} `this` - */ - extend: function(obj) { - var sw = this._sw, - ne = this._ne, - sw2, ne2; - + extend: function (obj) { + var sw = this._sw, ne = this._ne, sw2, ne2; if (obj instanceof LngLat) { sw2 = obj; ne2 = obj; - } else if (obj instanceof LngLatBounds) { sw2 = obj._sw; ne2 = obj._ne; - - if (!sw2 || !ne2) return this; - + if (!sw2 || !ne2) + return this; } else { return obj ? this.extend(LngLat.convert(obj) || LngLatBounds.convert(obj)) : this; } - if (!sw && !ne) { this._sw = new LngLat(sw2.lng, sw2.lat); this._ne = new LngLat(ne2.lng, ne2.lat); - } else { sw.lng = Math.min(sw2.lng, sw.lng); sw.lat = Math.min(sw2.lat, sw.lat); ne.lng = Math.max(ne2.lng, ne.lng); ne.lat = Math.max(ne2.lat, ne.lat); } - return this; }, - - /** - * Get the point equidistant from this box's corners - * @returns {LngLat} centerpoint - * @example - * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); - * llb.getCenter(); // = LngLat {lng: -73.96365, lat: 40.78315} - */ - getCenter: function() { + getCenter: function () { return new LngLat((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2); }, - - /** - * Get southwest corner - * @returns {LngLat} southwest - */ - getSouthWest: function() { return this._sw; }, - - /** - * Get northeast corner - * @returns {LngLat} northeast - */ - getNorthEast: function() { return this._ne; }, - - /** - * Get northwest corner - * @returns {LngLat} northwest - */ - getNorthWest: function() { return new LngLat(this.getWest(), this.getNorth()); }, - - /** - * Get southeast corner - * @returns {LngLat} southeast - */ - getSouthEast: function() { return new LngLat(this.getEast(), this.getSouth()); }, - - /** - * Get west edge longitude - * @returns {number} west - */ - getWest: function() { return this._sw.lng; }, - - /** - * Get south edge latitude - * @returns {number} south - */ - getSouth: function() { return this._sw.lat; }, - - /** - * Get east edge longitude - * @returns {number} east - */ - getEast: function() { return this._ne.lng; }, - - /** - * Get north edge latitude - * @returns {number} north - */ - getNorth: function() { return this._ne.lat; }, - - /** - * Return a `LngLatBounds` as an array - * - * @returns {array} [lng, lat] - * @example - * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); - * llb.toArray(); // = [[-73.9876, 40.7661], [-73.9397, 40.8002]] - */ + getSouthWest: function () { + return this._sw; + }, + getNorthEast: function () { + return this._ne; + }, + getNorthWest: function () { + return new LngLat(this.getWest(), this.getNorth()); + }, + getSouthEast: function () { + return new LngLat(this.getEast(), this.getSouth()); + }, + getWest: function () { + return this._sw.lng; + }, + getSouth: function () { + return this._sw.lat; + }, + getEast: function () { + return this._ne.lng; + }, + getNorth: function () { + return this._ne.lat; + }, toArray: function () { - return [this._sw.toArray(), this._ne.toArray()]; + return [ + this._sw.toArray(), + this._ne.toArray() + ]; }, - - /** - * Return a `LngLatBounds` as a string - * - * @returns {string} "LngLatBounds(LngLat(lng, lat), LngLat(lng, lat))" - * @example - * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); - * llb.toString(); // = "LngLatBounds(LngLat(-73.9876, 40.7661), LngLat(-73.9397, 40.8002))" - */ toString: function () { return 'LngLatBounds(' + this._sw.toString() + ', ' + this._ne.toString() + ')'; } }; - -/** - * Convert an array to a `LngLatBounds` object, or return an existing - * `LngLatBounds` object unchanged. - * - * Calls `LngLat#convert` internally to convert arrays as `LngLat` values. - * - * @param {LngLatBounds|Array|Array>} input input to convert to a LngLatBounds - * @returns {LngLatBounds} LngLatBounds object or original input - * @example - * var arr = [[-73.9876, 40.7661], [-73.9397, 40.8002]]; - * var llb = mapboxgl.LngLatBounds.convert(arr); - * llb; // = LngLatBounds {_sw: LngLat {lng: -73.9876, lat: 40.7661}, _ne: LngLat {lng: -73.9397, lat: 40.8002}} - */ LngLatBounds.convert = function (input) { - if (!input || input instanceof LngLatBounds) return input; + if (!input || input instanceof LngLatBounds) + return input; return new LngLatBounds(input); }; - -},{"./lng_lat":256}],258:[function(require,module,exports){ +},{"./lng_lat":263}],265:[function(require,module,exports){ 'use strict'; - -var LngLat = require('./lng_lat'), - Point = require('point-geometry'), - Coordinate = require('./coordinate'), - wrap = require('../util/util').wrap, - interp = require('../util/interpolate'), - TileCoord = require('../source/tile_coord'), - EXTENT = require('../data/bucket').EXTENT, - glmatrix = require('gl-matrix'); - -var vec4 = glmatrix.vec4, - mat4 = glmatrix.mat4, - mat2 = glmatrix.mat2; - +var LngLat = require('./lng_lat'), Point = require('point-geometry'), Coordinate = require('./coordinate'), wrap = require('../util/util').wrap, interp = require('../util/interpolate'), TileCoord = require('../source/tile_coord'), EXTENT = require('../data/bucket').EXTENT, glmatrix = require('gl-matrix'); +var vec4 = glmatrix.vec4, mat4 = glmatrix.mat4, mat2 = glmatrix.mat2; module.exports = Transform; - -/** - * A single transform, generally used for a single tile to be - * scaled, rotated, and zoomed. - * - * @param {number} minZoom - * @param {number} maxZoom - * @private - */ function Transform(minZoom, maxZoom) { - this.tileSize = 512; // constant - + this.tileSize = 512; this._minZoom = minZoom || 0; this._maxZoom = maxZoom || 22; - - this.latRange = [-85.05113, 85.05113]; - + this.latRange = [ + -85.05113, + 85.05113 + ]; this.width = 0; this.height = 0; this._center = new LngLat(0, 0); @@ -45529,160 +46011,168 @@ function Transform(minZoom, maxZoom) { this._pitch = 0; this._unmodified = true; } - Transform.prototype = { - get minZoom() { return this._minZoom; }, + get minZoom() { + return this._minZoom; + }, set minZoom(zoom) { - if (this._minZoom === zoom) return; + if (this._minZoom === zoom) + return; this._minZoom = zoom; this.zoom = Math.max(this.zoom, zoom); }, - - get maxZoom() { return this._maxZoom; }, + get maxZoom() { + return this._maxZoom; + }, set maxZoom(zoom) { - if (this._maxZoom === zoom) return; + if (this._maxZoom === zoom) + return; this._maxZoom = zoom; this.zoom = Math.min(this.zoom, zoom); }, - get worldSize() { return this.tileSize * this.scale; }, - get centerPoint() { return this.size._div(2); }, - get size() { return new Point(this.width, this.height); }, - get bearing() { return -this.angle / Math.PI * 180; }, set bearing(bearing) { var b = -wrap(bearing, -180, 180) * Math.PI / 180; - if (this.angle === b) return; + if (this.angle === b) + return; this._unmodified = false; this.angle = b; - this._calcProjMatrix(); - - // 2x2 matrix for rotating points + this._calcMatrices(); this.rotationMatrix = mat2.create(); mat2.rotate(this.rotationMatrix, this.rotationMatrix, this.angle); }, - get pitch() { return this._pitch / Math.PI * 180; }, set pitch(pitch) { var p = Math.min(60, pitch) / 180 * Math.PI; - if (this._pitch === p) return; + if (this._pitch === p) + return; this._unmodified = false; this._pitch = p; - this._calcProjMatrix(); + this._calcMatrices(); }, - get altitude() { return this._altitude; }, set altitude(altitude) { var a = Math.max(0.75, altitude); - if (this._altitude === a) return; + if (this._altitude === a) + return; this._unmodified = false; this._altitude = a; - this._calcProjMatrix(); + this._calcMatrices(); + }, + get zoom() { + return this._zoom; }, - - get zoom() { return this._zoom; }, set zoom(zoom) { var z = Math.min(Math.max(zoom, this.minZoom), this.maxZoom); - if (this._zoom === z) return; + if (this._zoom === z) + return; this._unmodified = false; this._zoom = z; this.scale = this.zoomScale(z); this.tileZoom = Math.floor(z); this.zoomFraction = z - this.tileZoom; - this._calcProjMatrix(); + this._calcMatrices(); this._constrain(); }, - - get center() { return this._center; }, + get center() { + return this._center; + }, set center(center) { - if (center.lat === this._center.lat && center.lng === this._center.lng) return; + if (center.lat === this._center.lat && center.lng === this._center.lng) + return; this._unmodified = false; this._center = center; - this._calcProjMatrix(); + this._calcMatrices(); this._constrain(); }, - - resize: function(width, height) { + coveringZoomLevel: function (options) { + return (options.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / options.tileSize)); + }, + coveringTiles: function (options) { + var z = this.coveringZoomLevel(options); + var actualZ = z; + if (z < options.minzoom) + return []; + if (z > options.maxzoom) + z = options.maxzoom; + var tr = this, tileCenter = tr.locationCoordinate(tr.center)._zoomTo(z), centerPoint = new Point(tileCenter.column - 0.5, tileCenter.row - 0.5); + return TileCoord.cover(z, [ + tr.pointCoordinate(new Point(0, 0))._zoomTo(z), + tr.pointCoordinate(new Point(tr.width, 0))._zoomTo(z), + tr.pointCoordinate(new Point(tr.width, tr.height))._zoomTo(z), + tr.pointCoordinate(new Point(0, tr.height))._zoomTo(z) + ], options.reparseOverscaled ? actualZ : z).sort(function (a, b) { + return centerPoint.dist(a) - centerPoint.dist(b); + }); + }, + resize: function (width, height) { this.width = width; this.height = height; - - this.pixelsToGLUnits = [2 / width, -2 / height]; - this._calcProjMatrix(); + this.pixelsToGLUnits = [ + 2 / width, + -2 / height + ]; + this._calcMatrices(); this._constrain(); }, - - get unmodified() { return this._unmodified; }, - - zoomScale: function(zoom) { return Math.pow(2, zoom); }, - scaleZoom: function(scale) { return Math.log(scale) / Math.LN2; }, - - project: function(lnglat, worldSize) { - return new Point( - this.lngX(lnglat.lng, worldSize), - this.latY(lnglat.lat, worldSize)); + get unmodified() { + return this._unmodified; }, - - unproject: function(point, worldSize) { - return new LngLat( - this.xLng(point.x, worldSize), - this.yLat(point.y, worldSize)); + zoomScale: function (zoom) { + return Math.pow(2, zoom); }, - - get x() { return this.lngX(this.center.lng); }, - get y() { return this.latY(this.center.lat); }, - - get point() { return new Point(this.x, this.y); }, - - /** - * latitude to absolute x coord - * @param {number} lon - * @param {number} [worldSize=this.worldSize] - * @returns {number} pixel coordinate - * @private - */ - lngX: function(lng, worldSize) { + scaleZoom: function (scale) { + return Math.log(scale) / Math.LN2; + }, + project: function (lnglat, worldSize) { + return new Point(this.lngX(lnglat.lng, worldSize), this.latY(lnglat.lat, worldSize)); + }, + unproject: function (point, worldSize) { + return new LngLat(this.xLng(point.x, worldSize), this.yLat(point.y, worldSize)); + }, + get x() { + return this.lngX(this.center.lng); + }, + get y() { + return this.latY(this.center.lat); + }, + get point() { + return new Point(this.x, this.y); + }, + lngX: function (lng, worldSize) { return (180 + lng) * (worldSize || this.worldSize) / 360; }, - /** - * latitude to absolute y coord - * @param {number} lat - * @param {number} [worldSize=this.worldSize] - * @returns {number} pixel coordinate - * @private - */ - latY: function(lat, worldSize) { + latY: function (lat, worldSize) { var y = 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360)); return (180 - y) * (worldSize || this.worldSize) / 360; }, - - xLng: function(x, worldSize) { + xLng: function (x, worldSize) { return x * 360 / (worldSize || this.worldSize) - 180; }, - yLat: function(y, worldSize) { + yLat: function (y, worldSize) { var y2 = 180 - y * 360 / (worldSize || this.worldSize); return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90; }, - - panBy: function(offset) { + panBy: function (offset) { var point = this.centerPoint._add(offset); this.center = this.pointLocation(point); }, - - setLocationAtPoint: function(lnglat, point) { + setLocationAtPoint: function (lnglat, point) { var c = this.locationCoordinate(lnglat); var coordAtPoint = this.pointCoordinate(point); var coordCenter = this.pointCoordinate(this.centerPoint); @@ -45690,77 +46180,36 @@ Transform.prototype = { this._unmodified = false; this.center = this.coordinateLocation(coordCenter._sub(translate)); }, - - /** - * Given a location, return the screen point that corresponds to it - * @param {LngLat} lnglat location - * @returns {Point} screen point - * @private - */ - locationPoint: function(lnglat) { + locationPoint: function (lnglat) { return this.coordinatePoint(this.locationCoordinate(lnglat)); }, - - /** - * Given a point on screen, return its lnglat - * @param {Point} p screen point - * @returns {LngLat} lnglat location - * @private - */ - pointLocation: function(p) { + pointLocation: function (p) { return this.coordinateLocation(this.pointCoordinate(p)); }, - - /** - * Given a geographical lnglat, return an unrounded - * coordinate that represents it at this transform's zoom level and - * worldsize. - * @param {LngLat} lnglat - * @returns {Coordinate} - * @private - */ - locationCoordinate: function(lnglat) { - var k = this.zoomScale(this.tileZoom) / this.worldSize, - ll = LngLat.convert(lnglat); - - return new Coordinate( - this.lngX(ll.lng) * k, - this.latY(ll.lat) * k, - this.tileZoom); + locationCoordinate: function (lnglat) { + var k = this.zoomScale(this.tileZoom) / this.worldSize, ll = LngLat.convert(lnglat); + return new Coordinate(this.lngX(ll.lng) * k, this.latY(ll.lat) * k, this.tileZoom); }, - - /** - * Given a Coordinate, return its geographical position. - * @param {Coordinate} coord - * @returns {LngLat} lnglat - * @private - */ - coordinateLocation: function(coord) { + coordinateLocation: function (coord) { var worldSize = this.zoomScale(coord.zoom); - return new LngLat( - this.xLng(coord.column, worldSize), - this.yLat(coord.row, worldSize)); + return new LngLat(this.xLng(coord.column, worldSize), this.yLat(coord.row, worldSize)); }, - - pointCoordinate: function(p) { - + pointCoordinate: function (p) { var targetZ = 0; - - var matrix = this.coordinatePointMatrix(this.tileZoom); - mat4.invert(matrix, matrix); - - if (!matrix) throw new Error("failed to invert matrix"); - - // since we don't know the correct projected z value for the point, - // unproject two points to get a line and then find the point on that - // line with z=0 - - var coord0 = [p.x, p.y, 0, 1]; - var coord1 = [p.x, p.y, 1, 1]; - - vec4.transformMat4(coord0, coord0, matrix); - vec4.transformMat4(coord1, coord1, matrix); - + var coord0 = [ + p.x, + p.y, + 0, + 1 + ]; + var coord1 = [ + p.x, + p.y, + 1, + 1 + ]; + vec4.transformMat4(coord0, coord0, this.pixelMatrixInverse); + vec4.transformMat4(coord1, coord1, this.pixelMatrixInverse); var w0 = coord0[3]; var w1 = coord1[3]; var x0 = coord0[0] / w0; @@ -45769,371 +46218,3088 @@ Transform.prototype = { var y1 = coord1[1] / w1; var z0 = coord0[2] / w0; var z1 = coord1[2] / w1; - - var t = z0 === z1 ? 0 : (targetZ - z0) / (z1 - z0); - - return new Coordinate( - interp(x0, x1, t), - interp(y0, y1, t), - this.tileZoom); - }, - - /** - * Given a coordinate, return the screen point that corresponds to it - * @param {Coordinate} coord - * @returns {Point} screen point - * @private - */ - coordinatePoint: function(coord) { - var matrix = this.coordinatePointMatrix(coord.zoom); - var p = [coord.column, coord.row, 0, 1]; - vec4.transformMat4(p, p, matrix); + var scale = this.worldSize / this.zoomScale(this.tileZoom); + return new Coordinate(interp(x0, x1, t) / scale, interp(y0, y1, t) / scale, this.tileZoom); + }, + coordinatePoint: function (coord) { + var scale = this.worldSize / this.zoomScale(coord.zoom); + var p = [ + coord.column * scale, + coord.row * scale, + 0, + 1 + ]; + vec4.transformMat4(p, p, this.pixelMatrix); return new Point(p[0] / p[3], p[1] / p[3]); }, - - coordinatePointMatrix: function(z) { - var proj = mat4.copy(new Float64Array(16), this.projMatrix); - var scale = this.worldSize / this.zoomScale(z); - mat4.scale(proj, proj, [scale, scale, 1]); - mat4.multiply(proj, this.getPixelMatrix(), proj); - return proj; - }, - - /** - * converts gl coordinates -1..1 to pixels 0..width - * @returns {Object} matrix - * @private - */ - getPixelMatrix: function() { - var m = mat4.create(); - mat4.scale(m, m, [this.width / 2, -this.height / 2, 1]); - mat4.translate(m, m, [1, -1, 0]); - return m; - }, - - /** - * Calculate the posMatrix that, given a tile coordinate, would be used to display the tile on a map. - * @param {TileCoord|Coordinate} coord - * @param {Number} maxZoom maximum source zoom to account for overscaling - * @private - */ - calculatePosMatrix: function(coord, maxZoom) { - if (maxZoom === undefined) maxZoom = Infinity; - if (coord instanceof TileCoord) coord = coord.toCoordinate(maxZoom); - - // Initialize model-view matrix that converts from the tile coordinates to screen coordinates. - - // if z > maxzoom then the tile is actually a overscaled maxzoom tile, - // so calculate the matrix the maxzoom tile would use. + calculatePosMatrix: function (coord, maxZoom) { + if (maxZoom === undefined) + maxZoom = Infinity; + if (coord instanceof TileCoord) + coord = coord.toCoordinate(maxZoom); var z = Math.min(coord.zoom, maxZoom); - var scale = this.worldSize / Math.pow(2, z); var posMatrix = new Float64Array(16); - mat4.identity(posMatrix); - mat4.translate(posMatrix, posMatrix, [coord.column * scale, coord.row * scale, 0]); - mat4.scale(posMatrix, posMatrix, [ scale / EXTENT, scale / EXTENT, 1 ]); + mat4.translate(posMatrix, posMatrix, [ + coord.column * scale, + coord.row * scale, + 0 + ]); + mat4.scale(posMatrix, posMatrix, [ + scale / EXTENT, + scale / EXTENT, + 1 + ]); mat4.multiply(posMatrix, this.projMatrix, posMatrix); - return new Float32Array(posMatrix); }, - - _constrain: function() { - if (!this.center || !this.width || !this.height || this._constraining) return; - + _constrain: function () { + if (!this.center || !this.width || !this.height || this._constraining) + return; this._constraining = true; - - var minY, maxY, minX, maxX, sy, sx, x2, y2, - size = this.size, - unmodified = this._unmodified; - + var minY, maxY, minX, maxX, sy, sx, x2, y2, size = this.size, unmodified = this._unmodified; if (this.latRange) { minY = this.latY(this.latRange[1]); maxY = this.latY(this.latRange[0]); sy = maxY - minY < size.y ? size.y / (maxY - minY) : 0; } - if (this.lngRange) { minX = this.lngX(this.lngRange[0]); maxX = this.lngX(this.lngRange[1]); sx = maxX - minX < size.x ? size.x / (maxX - minX) : 0; } - - // how much the map should scale to fit the screen into given latitude/longitude ranges var s = Math.max(sx || 0, sy || 0); - if (s) { - this.center = this.unproject(new Point( - sx ? (maxX + minX) / 2 : this.x, - sy ? (maxY + minY) / 2 : this.y)); + this.center = this.unproject(new Point(sx ? (maxX + minX) / 2 : this.x, sy ? (maxY + minY) / 2 : this.y)); this.zoom += this.scaleZoom(s); this._unmodified = unmodified; this._constraining = false; return; } - if (this.latRange) { - var y = this.y, - h2 = size.y / 2; - - if (y - h2 < minY) y2 = minY + h2; - if (y + h2 > maxY) y2 = maxY - h2; + var y = this.y, h2 = size.y / 2; + if (y - h2 < minY) + y2 = minY + h2; + if (y + h2 > maxY) + y2 = maxY - h2; } - if (this.lngRange) { - var x = this.x, - w2 = size.x / 2; - - if (x - w2 < minX) x2 = minX + w2; - if (x + w2 > maxX) x2 = maxX - w2; + var x = this.x, w2 = size.x / 2; + if (x - w2 < minX) + x2 = minX + w2; + if (x + w2 > maxX) + x2 = maxX - w2; } - - // pan the map if the screen goes off the range if (x2 !== undefined || y2 !== undefined) { - this.center = this.unproject(new Point( - x2 !== undefined ? x2 : this.x, - y2 !== undefined ? y2 : this.y)); + this.center = this.unproject(new Point(x2 !== undefined ? x2 : this.x, y2 !== undefined ? y2 : this.y)); } - this._unmodified = unmodified; this._constraining = false; }, - - _calcProjMatrix: function() { - var m = new Float64Array(16); - - // Find the distance from the center point to the center top in altitude units using law of sines. + _calcMatrices: function () { + if (!this.height) + return; var halfFov = Math.atan(0.5 / this.altitude); var topHalfSurfaceDistance = Math.sin(halfFov) * this.altitude / Math.sin(Math.PI / 2 - this._pitch - halfFov); - - // Calculate z value of the farthest fragment that should be rendered. var farZ = Math.cos(Math.PI / 2 - this._pitch) * topHalfSurfaceDistance + this.altitude; - - mat4.perspective(m, 2 * Math.atan((this.height / 2) / this.altitude), this.width / this.height, 0.1, farZ); - - mat4.translate(m, m, [0, 0, -this.altitude]); - - // After the rotateX, z values are in pixel units. Convert them to - // altitude units. 1 altitude unit = the screen height. - mat4.scale(m, m, [1, -1, 1 / this.height]); - + var m = new Float64Array(16); + mat4.perspective(m, 2 * Math.atan(this.height / 2 / this.altitude), this.width / this.height, 0.1, farZ); + mat4.translate(m, m, [ + 0, + 0, + -this.altitude + ]); + mat4.scale(m, m, [ + 1, + -1, + 1 / this.height + ]); mat4.rotateX(m, m, this._pitch); mat4.rotateZ(m, m, this.angle); - mat4.translate(m, m, [-this.x, -this.y, 0]); - + mat4.translate(m, m, [ + -this.x, + -this.y, + 0 + ]); this.projMatrix = m; + m = mat4.create(); + mat4.scale(m, m, [ + this.width / 2, + -this.height / 2, + 1 + ]); + mat4.translate(m, m, [ + 1, + -1, + 0 + ]); + this.pixelMatrix = mat4.multiply(new Float64Array(16), m, this.projMatrix); + m = mat4.invert(new Float64Array(16), this.pixelMatrix); + if (!m) + throw new Error('failed to invert matrix'); + this.pixelMatrixInverse = m; } }; - -},{"../data/bucket":247,"../source/tile_coord":281,"../util/interpolate":343,"../util/util":349,"./coordinate":255,"./lng_lat":256,"gl-matrix":363,"point-geometry":404}],259:[function(require,module,exports){ +},{"../data/bucket":253,"../source/tile_coord":293,"../util/interpolate":360,"../util/util":366,"./coordinate":262,"./lng_lat":263,"gl-matrix":382,"point-geometry":424}],266:[function(require,module,exports){ 'use strict'; - -// Font data From Hershey Simplex Font -// http://paulbourke.net/dataformats/hershey/ var simplexFont = { - " ": [16, []], - "!": [10, [5, 21, 5, 7, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], - "\"": [16, [4, 21, 4, 14, -1, -1, 12, 21, 12, 14]], - "#": [21, [11, 25, 4, -7, -1, -1, 17, 25, 10, -7, -1, -1, 4, 12, 18, 12, -1, -1, 3, 6, 17, 6]], - "$": [20, [8, 25, 8, -4, -1, -1, 12, 25, 12, -4, -1, -1, 17, 18, 15, 20, 12, 21, 8, 21, 5, 20, 3, 18, 3, 16, 4, 14, 5, 13, 7, 12, 13, 10, 15, 9, 16, 8, 17, 6, 17, 3, 15, 1, 12, 0, 8, 0, 5, 1, 3, 3]], - "%": [24, [21, 21, 3, 0, -1, -1, 8, 21, 10, 19, 10, 17, 9, 15, 7, 14, 5, 14, 3, 16, 3, 18, 4, 20, 6, 21, 8, 21, 10, 20, 13, 19, 16, 19, 19, 20, 21, 21, -1, -1, 17, 7, 15, 6, 14, 4, 14, 2, 16, 0, 18, 0, 20, 1, 21, 3, 21, 5, 19, 7, 17, 7]], - "&": [26, [23, 12, 23, 13, 22, 14, 21, 14, 20, 13, 19, 11, 17, 6, 15, 3, 13, 1, 11, 0, 7, 0, 5, 1, 4, 2, 3, 4, 3, 6, 4, 8, 5, 9, 12, 13, 13, 14, 14, 16, 14, 18, 13, 20, 11, 21, 9, 20, 8, 18, 8, 16, 9, 13, 11, 10, 16, 3, 18, 1, 20, 0, 22, 0, 23, 1, 23, 2]], - "'": [10, [5, 19, 4, 20, 5, 21, 6, 20, 6, 18, 5, 16, 4, 15]], - "(": [14, [11, 25, 9, 23, 7, 20, 5, 16, 4, 11, 4, 7, 5, 2, 7, -2, 9, -5, 11, -7]], - ")": [14, [3, 25, 5, 23, 7, 20, 9, 16, 10, 11, 10, 7, 9, 2, 7, -2, 5, -5, 3, -7]], - "*": [16, [8, 21, 8, 9, -1, -1, 3, 18, 13, 12, -1, -1, 13, 18, 3, 12]], - "+": [26, [13, 18, 13, 0, -1, -1, 4, 9, 22, 9]], - ",": [10, [6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5, -3, 4, -4]], - "-": [26, [4, 9, 22, 9]], - ".": [10, [5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], - "/": [22, [20, 25, 2, -7]], - "0": [20, [9, 21, 6, 20, 4, 17, 3, 12, 3, 9, 4, 4, 6, 1, 9, 0, 11, 0, 14, 1, 16, 4, 17, 9, 17, 12, 16, 17, 14, 20, 11, 21, 9, 21]], - "1": [20, [6, 17, 8, 18, 11, 21, 11, 0]], - "2": [20, [4, 16, 4, 17, 5, 19, 6, 20, 8, 21, 12, 21, 14, 20, 15, 19, 16, 17, 16, 15, 15, 13, 13, 10, 3, 0, 17, 0]], - "3": [20, [5, 21, 16, 21, 10, 13, 13, 13, 15, 12, 16, 11, 17, 8, 17, 6, 16, 3, 14, 1, 11, 0, 8, 0, 5, 1, 4, 2, 3, 4]], - "4": [20, [13, 21, 3, 7, 18, 7, -1, -1, 13, 21, 13, 0]], - "5": [20, [15, 21, 5, 21, 4, 12, 5, 13, 8, 14, 11, 14, 14, 13, 16, 11, 17, 8, 17, 6, 16, 3, 14, 1, 11, 0, 8, 0, 5, 1, 4, 2, 3, 4]], - "6": [20, [16, 18, 15, 20, 12, 21, 10, 21, 7, 20, 5, 17, 4, 12, 4, 7, 5, 3, 7, 1, 10, 0, 11, 0, 14, 1, 16, 3, 17, 6, 17, 7, 16, 10, 14, 12, 11, 13, 10, 13, 7, 12, 5, 10, 4, 7]], - "7": [20, [17, 21, 7, 0, -1, -1, 3, 21, 17, 21]], - "8": [20, [8, 21, 5, 20, 4, 18, 4, 16, 5, 14, 7, 13, 11, 12, 14, 11, 16, 9, 17, 7, 17, 4, 16, 2, 15, 1, 12, 0, 8, 0, 5, 1, 4, 2, 3, 4, 3, 7, 4, 9, 6, 11, 9, 12, 13, 13, 15, 14, 16, 16, 16, 18, 15, 20, 12, 21, 8, 21]], - "9": [20, [16, 14, 15, 11, 13, 9, 10, 8, 9, 8, 6, 9, 4, 11, 3, 14, 3, 15, 4, 18, 6, 20, 9, 21, 10, 21, 13, 20, 15, 18, 16, 14, 16, 9, 15, 4, 13, 1, 10, 0, 8, 0, 5, 1, 4, 3]], - ":": [10, [5, 14, 4, 13, 5, 12, 6, 13, 5, 14, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], - ";": [10, [5, 14, 4, 13, 5, 12, 6, 13, 5, 14, -1, -1, 6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5, -3, 4, -4]], - "<": [24, [20, 18, 4, 9, 20, 0]], - "=": [26, [4, 12, 22, 12, -1, -1, 4, 6, 22, 6]], - ">": [24, [4, 18, 20, 9, 4, 0]], - "?": [18, [3, 16, 3, 17, 4, 19, 5, 20, 7, 21, 11, 21, 13, 20, 14, 19, 15, 17, 15, 15, 14, 13, 13, 12, 9, 10, 9, 7, -1, -1, 9, 2, 8, 1, 9, 0, 10, 1, 9, 2]], - "@": [27, [18, 13, 17, 15, 15, 16, 12, 16, 10, 15, 9, 14, 8, 11, 8, 8, 9, 6, 11, 5, 14, 5, 16, 6, 17, 8, -1, -1, 12, 16, 10, 14, 9, 11, 9, 8, 10, 6, 11, 5, -1, -1, 18, 16, 17, 8, 17, 6, 19, 5, 21, 5, 23, 7, 24, 10, 24, 12, 23, 15, 22, 17, 20, 19, 18, 20, 15, 21, 12, 21, 9, 20, 7, 19, 5, 17, 4, 15, 3, 12, 3, 9, 4, 6, 5, 4, 7, 2, 9, 1, 12, 0, 15, 0, 18, 1, 20, 2, 21, 3, -1, -1, 19, 16, 18, 8, 18, 6, 19, 5]], - "A": [18, [9, 21, 1, 0, -1, -1, 9, 21, 17, 0, -1, -1, 4, 7, 14, 7]], - "B": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 15, 17, 13, 16, 12, 13, 11, -1, -1, 4, 11, 13, 11, 16, 10, 17, 9, 18, 7, 18, 4, 17, 2, 16, 1, 13, 0, 4, 0]], - "C": [21, [18, 16, 17, 18, 15, 20, 13, 21, 9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5]], - "D": [21, [4, 21, 4, 0, -1, -1, 4, 21, 11, 21, 14, 20, 16, 18, 17, 16, 18, 13, 18, 8, 17, 5, 16, 3, 14, 1, 11, 0, 4, 0]], - "E": [19, [4, 21, 4, 0, -1, -1, 4, 21, 17, 21, -1, -1, 4, 11, 12, 11, -1, -1, 4, 0, 17, 0]], - "F": [18, [4, 21, 4, 0, -1, -1, 4, 21, 17, 21, -1, -1, 4, 11, 12, 11]], - "G": [21, [18, 16, 17, 18, 15, 20, 13, 21, 9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 18, 8, -1, -1, 13, 8, 18, 8]], - "H": [22, [4, 21, 4, 0, -1, -1, 18, 21, 18, 0, -1, -1, 4, 11, 18, 11]], - "I": [8, [4, 21, 4, 0]], - "J": [16, [12, 21, 12, 5, 11, 2, 10, 1, 8, 0, 6, 0, 4, 1, 3, 2, 2, 5, 2, 7]], - "K": [21, [4, 21, 4, 0, -1, -1, 18, 21, 4, 7, -1, -1, 9, 12, 18, 0]], - "L": [17, [4, 21, 4, 0, -1, -1, 4, 0, 16, 0]], - "M": [24, [4, 21, 4, 0, -1, -1, 4, 21, 12, 0, -1, -1, 20, 21, 12, 0, -1, -1, 20, 21, 20, 0]], - "N": [22, [4, 21, 4, 0, -1, -1, 4, 21, 18, 0, -1, -1, 18, 21, 18, 0]], - "O": [22, [9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 19, 8, 19, 13, 18, 16, 17, 18, 15, 20, 13, 21, 9, 21]], - "P": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 14, 17, 12, 16, 11, 13, 10, 4, 10]], - "Q": [22, [9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 19, 8, 19, 13, 18, 16, 17, 18, 15, 20, 13, 21, 9, 21, -1, -1, 12, 4, 18, -2]], - "R": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 15, 17, 13, 16, 12, 13, 11, 4, 11, -1, -1, 11, 11, 18, 0]], - "S": [20, [17, 18, 15, 20, 12, 21, 8, 21, 5, 20, 3, 18, 3, 16, 4, 14, 5, 13, 7, 12, 13, 10, 15, 9, 16, 8, 17, 6, 17, 3, 15, 1, 12, 0, 8, 0, 5, 1, 3, 3]], - "T": [16, [8, 21, 8, 0, -1, -1, 1, 21, 15, 21]], - "U": [22, [4, 21, 4, 6, 5, 3, 7, 1, 10, 0, 12, 0, 15, 1, 17, 3, 18, 6, 18, 21]], - "V": [18, [1, 21, 9, 0, -1, -1, 17, 21, 9, 0]], - "W": [24, [2, 21, 7, 0, -1, -1, 12, 21, 7, 0, -1, -1, 12, 21, 17, 0, -1, -1, 22, 21, 17, 0]], - "X": [20, [3, 21, 17, 0, -1, -1, 17, 21, 3, 0]], - "Y": [18, [1, 21, 9, 11, 9, 0, -1, -1, 17, 21, 9, 11]], - "Z": [20, [17, 21, 3, 0, -1, -1, 3, 21, 17, 21, -1, -1, 3, 0, 17, 0]], - "[": [14, [4, 25, 4, -7, -1, -1, 5, 25, 5, -7, -1, -1, 4, 25, 11, 25, -1, -1, 4, -7, 11, -7]], - "\\": [14, [0, 21, 14, -3]], - "]": [14, [9, 25, 9, -7, -1, -1, 10, 25, 10, -7, -1, -1, 3, 25, 10, 25, -1, -1, 3, -7, 10, -7]], - "^": [16, [6, 15, 8, 18, 10, 15, -1, -1, 3, 12, 8, 17, 13, 12, -1, -1, 8, 17, 8, 0]], - "_": [16, [0, -2, 16, -2]], - "`": [10, [6, 21, 5, 20, 4, 18, 4, 16, 5, 15, 6, 16, 5, 17]], - "a": [19, [15, 14, 15, 0, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "b": [19, [4, 21, 4, 0, -1, -1, 4, 11, 6, 13, 8, 14, 11, 14, 13, 13, 15, 11, 16, 8, 16, 6, 15, 3, 13, 1, 11, 0, 8, 0, 6, 1, 4, 3]], - "c": [18, [15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "d": [19, [15, 21, 15, 0, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "e": [18, [3, 8, 15, 8, 15, 10, 14, 12, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "f": [12, [10, 21, 8, 21, 6, 20, 5, 17, 5, 0, -1, -1, 2, 14, 9, 14]], - "g": [19, [15, 14, 15, -2, 14, -5, 13, -6, 11, -7, 8, -7, 6, -6, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "h": [19, [4, 21, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0]], - "i": [8, [3, 21, 4, 20, 5, 21, 4, 22, 3, 21, -1, -1, 4, 14, 4, 0]], - "j": [10, [5, 21, 6, 20, 7, 21, 6, 22, 5, 21, -1, -1, 6, 14, 6, -3, 5, -6, 3, -7, 1, -7]], - "k": [17, [4, 21, 4, 0, -1, -1, 14, 14, 4, 4, -1, -1, 8, 8, 15, 0]], - "l": [8, [4, 21, 4, 0]], - "m": [30, [4, 14, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0, -1, -1, 15, 10, 18, 13, 20, 14, 23, 14, 25, 13, 26, 10, 26, 0]], - "n": [19, [4, 14, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0]], - "o": [19, [8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3, 16, 6, 16, 8, 15, 11, 13, 13, 11, 14, 8, 14]], - "p": [19, [4, 14, 4, -7, -1, -1, 4, 11, 6, 13, 8, 14, 11, 14, 13, 13, 15, 11, 16, 8, 16, 6, 15, 3, 13, 1, 11, 0, 8, 0, 6, 1, 4, 3]], - "q": [19, [15, 14, 15, -7, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "r": [13, [4, 14, 4, 0, -1, -1, 4, 8, 5, 11, 7, 13, 9, 14, 12, 14]], - "s": [17, [14, 11, 13, 13, 10, 14, 7, 14, 4, 13, 3, 11, 4, 9, 6, 8, 11, 7, 13, 6, 14, 4, 14, 3, 13, 1, 10, 0, 7, 0, 4, 1, 3, 3]], - "t": [12, [5, 21, 5, 4, 6, 1, 8, 0, 10, 0, -1, -1, 2, 14, 9, 14]], - "u": [19, [4, 14, 4, 4, 5, 1, 7, 0, 10, 0, 12, 1, 15, 4, -1, -1, 15, 14, 15, 0]], - "v": [16, [2, 14, 8, 0, -1, -1, 14, 14, 8, 0]], - "w": [22, [3, 14, 7, 0, -1, -1, 11, 14, 7, 0, -1, -1, 11, 14, 15, 0, -1, -1, 19, 14, 15, 0]], - "x": [17, [3, 14, 14, 0, -1, -1, 14, 14, 3, 0]], - "y": [16, [2, 14, 8, 0, -1, -1, 14, 14, 8, 0, 6, -4, 4, -6, 2, -7, 1, -7]], - "z": [17, [14, 14, 3, 0, -1, -1, 3, 14, 14, 14, -1, -1, 3, 0, 14, 0]], - "{": [14, [9, 25, 7, 24, 6, 23, 5, 21, 5, 19, 6, 17, 7, 16, 8, 14, 8, 12, 6, 10, -1, -1, 7, 24, 6, 22, 6, 20, 7, 18, 8, 17, 9, 15, 9, 13, 8, 11, 4, 9, 8, 7, 9, 5, 9, 3, 8, 1, 7, 0, 6, -2, 6, -4, 7, -6, -1, -1, 6, 8, 8, 6, 8, 4, 7, 2, 6, 1, 5, -1, 5, -3, 6, -5, 7, -6, 9, -7]], - "|": [8, [4, 25, 4, -7]], - "}": [14, [5, 25, 7, 24, 8, 23, 9, 21, 9, 19, 8, 17, 7, 16, 6, 14, 6, 12, 8, 10, -1, -1, 7, 24, 8, 22, 8, 20, 7, 18, 6, 17, 5, 15, 5, 13, 6, 11, 10, 9, 6, 7, 5, 5, 5, 3, 6, 1, 7, 0, 8, -2, 8, -4, 7, -6, -1, -1, 8, 8, 6, 6, 6, 4, 7, 2, 8, 1, 9, -1, 9, -3, 8, -5, 7, -6, 5, -7]], - "~": [24, [3, 6, 3, 8, 4, 11, 6, 12, 8, 12, 10, 11, 14, 8, 16, 7, 18, 7, 20, 8, 21, 10, -1, -1, 3, 8, 4, 10, 6, 11, 8, 11, 10, 10, 14, 7, 16, 6, 18, 6, 20, 7, 21, 10, 21, 12]] + ' ': [ + 16, + [] + ], + '!': [ + 10, + [ + 5, + 21, + 5, + 7, + -1, + -1, + 5, + 2, + 4, + 1, + 5, + 0, + 6, + 1, + 5, + 2 + ] + ], + '"': [ + 16, + [ + 4, + 21, + 4, + 14, + -1, + -1, + 12, + 21, + 12, + 14 + ] + ], + '#': [ + 21, + [ + 11, + 25, + 4, + -7, + -1, + -1, + 17, + 25, + 10, + -7, + -1, + -1, + 4, + 12, + 18, + 12, + -1, + -1, + 3, + 6, + 17, + 6 + ] + ], + '$': [ + 20, + [ + 8, + 25, + 8, + -4, + -1, + -1, + 12, + 25, + 12, + -4, + -1, + -1, + 17, + 18, + 15, + 20, + 12, + 21, + 8, + 21, + 5, + 20, + 3, + 18, + 3, + 16, + 4, + 14, + 5, + 13, + 7, + 12, + 13, + 10, + 15, + 9, + 16, + 8, + 17, + 6, + 17, + 3, + 15, + 1, + 12, + 0, + 8, + 0, + 5, + 1, + 3, + 3 + ] + ], + '%': [ + 24, + [ + 21, + 21, + 3, + 0, + -1, + -1, + 8, + 21, + 10, + 19, + 10, + 17, + 9, + 15, + 7, + 14, + 5, + 14, + 3, + 16, + 3, + 18, + 4, + 20, + 6, + 21, + 8, + 21, + 10, + 20, + 13, + 19, + 16, + 19, + 19, + 20, + 21, + 21, + -1, + -1, + 17, + 7, + 15, + 6, + 14, + 4, + 14, + 2, + 16, + 0, + 18, + 0, + 20, + 1, + 21, + 3, + 21, + 5, + 19, + 7, + 17, + 7 + ] + ], + '&': [ + 26, + [ + 23, + 12, + 23, + 13, + 22, + 14, + 21, + 14, + 20, + 13, + 19, + 11, + 17, + 6, + 15, + 3, + 13, + 1, + 11, + 0, + 7, + 0, + 5, + 1, + 4, + 2, + 3, + 4, + 3, + 6, + 4, + 8, + 5, + 9, + 12, + 13, + 13, + 14, + 14, + 16, + 14, + 18, + 13, + 20, + 11, + 21, + 9, + 20, + 8, + 18, + 8, + 16, + 9, + 13, + 11, + 10, + 16, + 3, + 18, + 1, + 20, + 0, + 22, + 0, + 23, + 1, + 23, + 2 + ] + ], + '\'': [ + 10, + [ + 5, + 19, + 4, + 20, + 5, + 21, + 6, + 20, + 6, + 18, + 5, + 16, + 4, + 15 + ] + ], + '(': [ + 14, + [ + 11, + 25, + 9, + 23, + 7, + 20, + 5, + 16, + 4, + 11, + 4, + 7, + 5, + 2, + 7, + -2, + 9, + -5, + 11, + -7 + ] + ], + ')': [ + 14, + [ + 3, + 25, + 5, + 23, + 7, + 20, + 9, + 16, + 10, + 11, + 10, + 7, + 9, + 2, + 7, + -2, + 5, + -5, + 3, + -7 + ] + ], + '*': [ + 16, + [ + 8, + 21, + 8, + 9, + -1, + -1, + 3, + 18, + 13, + 12, + -1, + -1, + 13, + 18, + 3, + 12 + ] + ], + '+': [ + 26, + [ + 13, + 18, + 13, + 0, + -1, + -1, + 4, + 9, + 22, + 9 + ] + ], + ',': [ + 10, + [ + 6, + 1, + 5, + 0, + 4, + 1, + 5, + 2, + 6, + 1, + 6, + -1, + 5, + -3, + 4, + -4 + ] + ], + '-': [ + 26, + [ + 4, + 9, + 22, + 9 + ] + ], + '.': [ + 10, + [ + 5, + 2, + 4, + 1, + 5, + 0, + 6, + 1, + 5, + 2 + ] + ], + '/': [ + 22, + [ + 20, + 25, + 2, + -7 + ] + ], + '0': [ + 20, + [ + 9, + 21, + 6, + 20, + 4, + 17, + 3, + 12, + 3, + 9, + 4, + 4, + 6, + 1, + 9, + 0, + 11, + 0, + 14, + 1, + 16, + 4, + 17, + 9, + 17, + 12, + 16, + 17, + 14, + 20, + 11, + 21, + 9, + 21 + ] + ], + '1': [ + 20, + [ + 6, + 17, + 8, + 18, + 11, + 21, + 11, + 0 + ] + ], + '2': [ + 20, + [ + 4, + 16, + 4, + 17, + 5, + 19, + 6, + 20, + 8, + 21, + 12, + 21, + 14, + 20, + 15, + 19, + 16, + 17, + 16, + 15, + 15, + 13, + 13, + 10, + 3, + 0, + 17, + 0 + ] + ], + '3': [ + 20, + [ + 5, + 21, + 16, + 21, + 10, + 13, + 13, + 13, + 15, + 12, + 16, + 11, + 17, + 8, + 17, + 6, + 16, + 3, + 14, + 1, + 11, + 0, + 8, + 0, + 5, + 1, + 4, + 2, + 3, + 4 + ] + ], + '4': [ + 20, + [ + 13, + 21, + 3, + 7, + 18, + 7, + -1, + -1, + 13, + 21, + 13, + 0 + ] + ], + '5': [ + 20, + [ + 15, + 21, + 5, + 21, + 4, + 12, + 5, + 13, + 8, + 14, + 11, + 14, + 14, + 13, + 16, + 11, + 17, + 8, + 17, + 6, + 16, + 3, + 14, + 1, + 11, + 0, + 8, + 0, + 5, + 1, + 4, + 2, + 3, + 4 + ] + ], + '6': [ + 20, + [ + 16, + 18, + 15, + 20, + 12, + 21, + 10, + 21, + 7, + 20, + 5, + 17, + 4, + 12, + 4, + 7, + 5, + 3, + 7, + 1, + 10, + 0, + 11, + 0, + 14, + 1, + 16, + 3, + 17, + 6, + 17, + 7, + 16, + 10, + 14, + 12, + 11, + 13, + 10, + 13, + 7, + 12, + 5, + 10, + 4, + 7 + ] + ], + '7': [ + 20, + [ + 17, + 21, + 7, + 0, + -1, + -1, + 3, + 21, + 17, + 21 + ] + ], + '8': [ + 20, + [ + 8, + 21, + 5, + 20, + 4, + 18, + 4, + 16, + 5, + 14, + 7, + 13, + 11, + 12, + 14, + 11, + 16, + 9, + 17, + 7, + 17, + 4, + 16, + 2, + 15, + 1, + 12, + 0, + 8, + 0, + 5, + 1, + 4, + 2, + 3, + 4, + 3, + 7, + 4, + 9, + 6, + 11, + 9, + 12, + 13, + 13, + 15, + 14, + 16, + 16, + 16, + 18, + 15, + 20, + 12, + 21, + 8, + 21 + ] + ], + '9': [ + 20, + [ + 16, + 14, + 15, + 11, + 13, + 9, + 10, + 8, + 9, + 8, + 6, + 9, + 4, + 11, + 3, + 14, + 3, + 15, + 4, + 18, + 6, + 20, + 9, + 21, + 10, + 21, + 13, + 20, + 15, + 18, + 16, + 14, + 16, + 9, + 15, + 4, + 13, + 1, + 10, + 0, + 8, + 0, + 5, + 1, + 4, + 3 + ] + ], + ':': [ + 10, + [ + 5, + 14, + 4, + 13, + 5, + 12, + 6, + 13, + 5, + 14, + -1, + -1, + 5, + 2, + 4, + 1, + 5, + 0, + 6, + 1, + 5, + 2 + ] + ], + ';': [ + 10, + [ + 5, + 14, + 4, + 13, + 5, + 12, + 6, + 13, + 5, + 14, + -1, + -1, + 6, + 1, + 5, + 0, + 4, + 1, + 5, + 2, + 6, + 1, + 6, + -1, + 5, + -3, + 4, + -4 + ] + ], + '<': [ + 24, + [ + 20, + 18, + 4, + 9, + 20, + 0 + ] + ], + '=': [ + 26, + [ + 4, + 12, + 22, + 12, + -1, + -1, + 4, + 6, + 22, + 6 + ] + ], + '>': [ + 24, + [ + 4, + 18, + 20, + 9, + 4, + 0 + ] + ], + '?': [ + 18, + [ + 3, + 16, + 3, + 17, + 4, + 19, + 5, + 20, + 7, + 21, + 11, + 21, + 13, + 20, + 14, + 19, + 15, + 17, + 15, + 15, + 14, + 13, + 13, + 12, + 9, + 10, + 9, + 7, + -1, + -1, + 9, + 2, + 8, + 1, + 9, + 0, + 10, + 1, + 9, + 2 + ] + ], + '@': [ + 27, + [ + 18, + 13, + 17, + 15, + 15, + 16, + 12, + 16, + 10, + 15, + 9, + 14, + 8, + 11, + 8, + 8, + 9, + 6, + 11, + 5, + 14, + 5, + 16, + 6, + 17, + 8, + -1, + -1, + 12, + 16, + 10, + 14, + 9, + 11, + 9, + 8, + 10, + 6, + 11, + 5, + -1, + -1, + 18, + 16, + 17, + 8, + 17, + 6, + 19, + 5, + 21, + 5, + 23, + 7, + 24, + 10, + 24, + 12, + 23, + 15, + 22, + 17, + 20, + 19, + 18, + 20, + 15, + 21, + 12, + 21, + 9, + 20, + 7, + 19, + 5, + 17, + 4, + 15, + 3, + 12, + 3, + 9, + 4, + 6, + 5, + 4, + 7, + 2, + 9, + 1, + 12, + 0, + 15, + 0, + 18, + 1, + 20, + 2, + 21, + 3, + -1, + -1, + 19, + 16, + 18, + 8, + 18, + 6, + 19, + 5 + ] + ], + 'A': [ + 18, + [ + 9, + 21, + 1, + 0, + -1, + -1, + 9, + 21, + 17, + 0, + -1, + -1, + 4, + 7, + 14, + 7 + ] + ], + 'B': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 13, + 21, + 16, + 20, + 17, + 19, + 18, + 17, + 18, + 15, + 17, + 13, + 16, + 12, + 13, + 11, + -1, + -1, + 4, + 11, + 13, + 11, + 16, + 10, + 17, + 9, + 18, + 7, + 18, + 4, + 17, + 2, + 16, + 1, + 13, + 0, + 4, + 0 + ] + ], + 'C': [ + 21, + [ + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5 + ] + ], + 'D': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 11, + 21, + 14, + 20, + 16, + 18, + 17, + 16, + 18, + 13, + 18, + 8, + 17, + 5, + 16, + 3, + 14, + 1, + 11, + 0, + 4, + 0 + ] + ], + 'E': [ + 19, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 17, + 21, + -1, + -1, + 4, + 11, + 12, + 11, + -1, + -1, + 4, + 0, + 17, + 0 + ] + ], + 'F': [ + 18, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 17, + 21, + -1, + -1, + 4, + 11, + 12, + 11 + ] + ], + 'G': [ + 21, + [ + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5, + 18, + 8, + -1, + -1, + 13, + 8, + 18, + 8 + ] + ], + 'H': [ + 22, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 18, + 21, + 18, + 0, + -1, + -1, + 4, + 11, + 18, + 11 + ] + ], + 'I': [ + 8, + [ + 4, + 21, + 4, + 0 + ] + ], + 'J': [ + 16, + [ + 12, + 21, + 12, + 5, + 11, + 2, + 10, + 1, + 8, + 0, + 6, + 0, + 4, + 1, + 3, + 2, + 2, + 5, + 2, + 7 + ] + ], + 'K': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 18, + 21, + 4, + 7, + -1, + -1, + 9, + 12, + 18, + 0 + ] + ], + 'L': [ + 17, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 0, + 16, + 0 + ] + ], + 'M': [ + 24, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 12, + 0, + -1, + -1, + 20, + 21, + 12, + 0, + -1, + -1, + 20, + 21, + 20, + 0 + ] + ], + 'N': [ + 22, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 18, + 0, + -1, + -1, + 18, + 21, + 18, + 0 + ] + ], + 'O': [ + 22, + [ + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5, + 19, + 8, + 19, + 13, + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21 + ] + ], + 'P': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 13, + 21, + 16, + 20, + 17, + 19, + 18, + 17, + 18, + 14, + 17, + 12, + 16, + 11, + 13, + 10, + 4, + 10 + ] + ], + 'Q': [ + 22, + [ + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5, + 19, + 8, + 19, + 13, + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21, + -1, + -1, + 12, + 4, + 18, + -2 + ] + ], + 'R': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 13, + 21, + 16, + 20, + 17, + 19, + 18, + 17, + 18, + 15, + 17, + 13, + 16, + 12, + 13, + 11, + 4, + 11, + -1, + -1, + 11, + 11, + 18, + 0 + ] + ], + 'S': [ + 20, + [ + 17, + 18, + 15, + 20, + 12, + 21, + 8, + 21, + 5, + 20, + 3, + 18, + 3, + 16, + 4, + 14, + 5, + 13, + 7, + 12, + 13, + 10, + 15, + 9, + 16, + 8, + 17, + 6, + 17, + 3, + 15, + 1, + 12, + 0, + 8, + 0, + 5, + 1, + 3, + 3 + ] + ], + 'T': [ + 16, + [ + 8, + 21, + 8, + 0, + -1, + -1, + 1, + 21, + 15, + 21 + ] + ], + 'U': [ + 22, + [ + 4, + 21, + 4, + 6, + 5, + 3, + 7, + 1, + 10, + 0, + 12, + 0, + 15, + 1, + 17, + 3, + 18, + 6, + 18, + 21 + ] + ], + 'V': [ + 18, + [ + 1, + 21, + 9, + 0, + -1, + -1, + 17, + 21, + 9, + 0 + ] + ], + 'W': [ + 24, + [ + 2, + 21, + 7, + 0, + -1, + -1, + 12, + 21, + 7, + 0, + -1, + -1, + 12, + 21, + 17, + 0, + -1, + -1, + 22, + 21, + 17, + 0 + ] + ], + 'X': [ + 20, + [ + 3, + 21, + 17, + 0, + -1, + -1, + 17, + 21, + 3, + 0 + ] + ], + 'Y': [ + 18, + [ + 1, + 21, + 9, + 11, + 9, + 0, + -1, + -1, + 17, + 21, + 9, + 11 + ] + ], + 'Z': [ + 20, + [ + 17, + 21, + 3, + 0, + -1, + -1, + 3, + 21, + 17, + 21, + -1, + -1, + 3, + 0, + 17, + 0 + ] + ], + '[': [ + 14, + [ + 4, + 25, + 4, + -7, + -1, + -1, + 5, + 25, + 5, + -7, + -1, + -1, + 4, + 25, + 11, + 25, + -1, + -1, + 4, + -7, + 11, + -7 + ] + ], + '\\': [ + 14, + [ + 0, + 21, + 14, + -3 + ] + ], + ']': [ + 14, + [ + 9, + 25, + 9, + -7, + -1, + -1, + 10, + 25, + 10, + -7, + -1, + -1, + 3, + 25, + 10, + 25, + -1, + -1, + 3, + -7, + 10, + -7 + ] + ], + '^': [ + 16, + [ + 6, + 15, + 8, + 18, + 10, + 15, + -1, + -1, + 3, + 12, + 8, + 17, + 13, + 12, + -1, + -1, + 8, + 17, + 8, + 0 + ] + ], + '_': [ + 16, + [ + 0, + -2, + 16, + -2 + ] + ], + '`': [ + 10, + [ + 6, + 21, + 5, + 20, + 4, + 18, + 4, + 16, + 5, + 15, + 6, + 16, + 5, + 17 + ] + ], + 'a': [ + 19, + [ + 15, + 14, + 15, + 0, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'b': [ + 19, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 11, + 6, + 13, + 8, + 14, + 11, + 14, + 13, + 13, + 15, + 11, + 16, + 8, + 16, + 6, + 15, + 3, + 13, + 1, + 11, + 0, + 8, + 0, + 6, + 1, + 4, + 3 + ] + ], + 'c': [ + 18, + [ + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'd': [ + 19, + [ + 15, + 21, + 15, + 0, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'e': [ + 18, + [ + 3, + 8, + 15, + 8, + 15, + 10, + 14, + 12, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'f': [ + 12, + [ + 10, + 21, + 8, + 21, + 6, + 20, + 5, + 17, + 5, + 0, + -1, + -1, + 2, + 14, + 9, + 14 + ] + ], + 'g': [ + 19, + [ + 15, + 14, + 15, + -2, + 14, + -5, + 13, + -6, + 11, + -7, + 8, + -7, + 6, + -6, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'h': [ + 19, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 10, + 7, + 13, + 9, + 14, + 12, + 14, + 14, + 13, + 15, + 10, + 15, + 0 + ] + ], + 'i': [ + 8, + [ + 3, + 21, + 4, + 20, + 5, + 21, + 4, + 22, + 3, + 21, + -1, + -1, + 4, + 14, + 4, + 0 + ] + ], + 'j': [ + 10, + [ + 5, + 21, + 6, + 20, + 7, + 21, + 6, + 22, + 5, + 21, + -1, + -1, + 6, + 14, + 6, + -3, + 5, + -6, + 3, + -7, + 1, + -7 + ] + ], + 'k': [ + 17, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 14, + 14, + 4, + 4, + -1, + -1, + 8, + 8, + 15, + 0 + ] + ], + 'l': [ + 8, + [ + 4, + 21, + 4, + 0 + ] + ], + 'm': [ + 30, + [ + 4, + 14, + 4, + 0, + -1, + -1, + 4, + 10, + 7, + 13, + 9, + 14, + 12, + 14, + 14, + 13, + 15, + 10, + 15, + 0, + -1, + -1, + 15, + 10, + 18, + 13, + 20, + 14, + 23, + 14, + 25, + 13, + 26, + 10, + 26, + 0 + ] + ], + 'n': [ + 19, + [ + 4, + 14, + 4, + 0, + -1, + -1, + 4, + 10, + 7, + 13, + 9, + 14, + 12, + 14, + 14, + 13, + 15, + 10, + 15, + 0 + ] + ], + 'o': [ + 19, + [ + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3, + 16, + 6, + 16, + 8, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14 + ] + ], + 'p': [ + 19, + [ + 4, + 14, + 4, + -7, + -1, + -1, + 4, + 11, + 6, + 13, + 8, + 14, + 11, + 14, + 13, + 13, + 15, + 11, + 16, + 8, + 16, + 6, + 15, + 3, + 13, + 1, + 11, + 0, + 8, + 0, + 6, + 1, + 4, + 3 + ] + ], + 'q': [ + 19, + [ + 15, + 14, + 15, + -7, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'r': [ + 13, + [ + 4, + 14, + 4, + 0, + -1, + -1, + 4, + 8, + 5, + 11, + 7, + 13, + 9, + 14, + 12, + 14 + ] + ], + 's': [ + 17, + [ + 14, + 11, + 13, + 13, + 10, + 14, + 7, + 14, + 4, + 13, + 3, + 11, + 4, + 9, + 6, + 8, + 11, + 7, + 13, + 6, + 14, + 4, + 14, + 3, + 13, + 1, + 10, + 0, + 7, + 0, + 4, + 1, + 3, + 3 + ] + ], + 't': [ + 12, + [ + 5, + 21, + 5, + 4, + 6, + 1, + 8, + 0, + 10, + 0, + -1, + -1, + 2, + 14, + 9, + 14 + ] + ], + 'u': [ + 19, + [ + 4, + 14, + 4, + 4, + 5, + 1, + 7, + 0, + 10, + 0, + 12, + 1, + 15, + 4, + -1, + -1, + 15, + 14, + 15, + 0 + ] + ], + 'v': [ + 16, + [ + 2, + 14, + 8, + 0, + -1, + -1, + 14, + 14, + 8, + 0 + ] + ], + 'w': [ + 22, + [ + 3, + 14, + 7, + 0, + -1, + -1, + 11, + 14, + 7, + 0, + -1, + -1, + 11, + 14, + 15, + 0, + -1, + -1, + 19, + 14, + 15, + 0 + ] + ], + 'x': [ + 17, + [ + 3, + 14, + 14, + 0, + -1, + -1, + 14, + 14, + 3, + 0 + ] + ], + 'y': [ + 16, + [ + 2, + 14, + 8, + 0, + -1, + -1, + 14, + 14, + 8, + 0, + 6, + -4, + 4, + -6, + 2, + -7, + 1, + -7 + ] + ], + 'z': [ + 17, + [ + 14, + 14, + 3, + 0, + -1, + -1, + 3, + 14, + 14, + 14, + -1, + -1, + 3, + 0, + 14, + 0 + ] + ], + '{': [ + 14, + [ + 9, + 25, + 7, + 24, + 6, + 23, + 5, + 21, + 5, + 19, + 6, + 17, + 7, + 16, + 8, + 14, + 8, + 12, + 6, + 10, + -1, + -1, + 7, + 24, + 6, + 22, + 6, + 20, + 7, + 18, + 8, + 17, + 9, + 15, + 9, + 13, + 8, + 11, + 4, + 9, + 8, + 7, + 9, + 5, + 9, + 3, + 8, + 1, + 7, + 0, + 6, + -2, + 6, + -4, + 7, + -6, + -1, + -1, + 6, + 8, + 8, + 6, + 8, + 4, + 7, + 2, + 6, + 1, + 5, + -1, + 5, + -3, + 6, + -5, + 7, + -6, + 9, + -7 + ] + ], + '|': [ + 8, + [ + 4, + 25, + 4, + -7 + ] + ], + '}': [ + 14, + [ + 5, + 25, + 7, + 24, + 8, + 23, + 9, + 21, + 9, + 19, + 8, + 17, + 7, + 16, + 6, + 14, + 6, + 12, + 8, + 10, + -1, + -1, + 7, + 24, + 8, + 22, + 8, + 20, + 7, + 18, + 6, + 17, + 5, + 15, + 5, + 13, + 6, + 11, + 10, + 9, + 6, + 7, + 5, + 5, + 5, + 3, + 6, + 1, + 7, + 0, + 8, + -2, + 8, + -4, + 7, + -6, + -1, + -1, + 8, + 8, + 6, + 6, + 6, + 4, + 7, + 2, + 8, + 1, + 9, + -1, + 9, + -3, + 8, + -5, + 7, + -6, + 5, + -7 + ] + ], + '~': [ + 24, + [ + 3, + 6, + 3, + 8, + 4, + 11, + 6, + 12, + 8, + 12, + 10, + 11, + 14, + 8, + 16, + 7, + 18, + 7, + 20, + 8, + 21, + 10, + -1, + -1, + 3, + 8, + 4, + 10, + 6, + 11, + 8, + 11, + 10, + 10, + 14, + 7, + 16, + 6, + 18, + 6, + 20, + 7, + 21, + 10, + 21, + 12 + ] + ] }; - module.exports = function textVertices(text, left, baseline, scale) { scale = scale || 1; - - var strokes = [], - i, len, j, len2, glyph, x, y, prev; - + var strokes = [], i, len, j, len2, glyph, x, y, prev; for (i = 0, len = text.length; i < len; i++) { glyph = simplexFont[text[i]]; - if (!glyph) continue; + if (!glyph) + continue; prev = null; - for (j = 0, len2 = glyph[1].length; j < len2; j += 2) { if (glyph[1][j] === -1 && glyph[1][j + 1] === -1) { prev = null; - } else { x = left + glyph[1][j] * scale; y = baseline - glyph[1][j + 1] * scale; if (prev) { strokes.push(prev.x, prev.y, x, y); } - prev = {x: x, y: y}; + prev = { + x: x, + y: y + }; } } left += glyph[0] * scale; } - return strokes; }; - -},{}],260:[function(require,module,exports){ +},{}],267:[function(require,module,exports){ 'use strict'; - -/** - * mapboxgl is a A WebGL JavaScript interactive maps library that can render - * [Mapbox vector tiles](https://www.mapbox.com/blog/vector-tiles/). - * - * @module mapboxgl - * @summary WebGL JavaScript map library - */ - -// jshint -W079 var mapboxgl = module.exports = {}; - +mapboxgl.version = require('../package.json').version; mapboxgl.Map = require('./ui/map'); mapboxgl.Control = require('./ui/control/control'); mapboxgl.Navigation = require('./ui/control/navigation'); mapboxgl.Geolocate = require('./ui/control/geolocate'); mapboxgl.Attribution = require('./ui/control/attribution'); mapboxgl.Popup = require('./ui/popup'); - -mapboxgl.GeoJSONSource = require('./source/geojson_source'); -mapboxgl.VideoSource = require('./source/video_source'); -mapboxgl.ImageSource = require('./source/image_source'); - +mapboxgl.Marker = require('./ui/marker'); mapboxgl.Style = require('./style/style'); - mapboxgl.LngLat = require('./geo/lng_lat'); mapboxgl.LngLatBounds = require('./geo/lng_lat_bounds'); mapboxgl.Point = require('point-geometry'); - mapboxgl.Evented = require('./util/evented'); mapboxgl.util = require('./util/util'); - mapboxgl.supported = require('./util/browser').supported; - var ajax = require('./util/ajax'); mapboxgl.util.getJSON = ajax.getJSON; mapboxgl.util.getArrayBuffer = ajax.getArrayBuffer; - var config = require('./util/config'); mapboxgl.config = config; - Object.defineProperty(mapboxgl, 'accessToken', { - get: function() { return config.ACCESS_TOKEN; }, - set: function(token) { config.ACCESS_TOKEN = token; } + get: function () { + return config.ACCESS_TOKEN; + }, + set: function (token) { + config.ACCESS_TOKEN = token; + } }); - -},{"./geo/lng_lat":256,"./geo/lng_lat_bounds":257,"./source/geojson_source":274,"./source/image_source":276,"./source/video_source":284,"./style/style":290,"./ui/control/attribution":318,"./ui/control/control":319,"./ui/control/geolocate":320,"./ui/control/navigation":321,"./ui/map":331,"./ui/popup":332,"./util/ajax":334,"./util/browser":335,"./util/config":339,"./util/evented":341,"./util/util":349,"point-geometry":404}],261:[function(require,module,exports){ +},{"../package.json":443,"./geo/lng_lat":263,"./geo/lng_lat_bounds":264,"./style/style":302,"./ui/control/attribution":333,"./ui/control/control":334,"./ui/control/geolocate":335,"./ui/control/navigation":336,"./ui/map":345,"./ui/marker":346,"./ui/popup":347,"./util/ajax":349,"./util/browser":350,"./util/config":355,"./util/evented":358,"./util/util":366,"point-geometry":424}],268:[function(require,module,exports){ +'use strict'; +module.exports = function (uniforms) { + var pragmas = { + define: {}, + initialize: {} + }; + for (var i = 0; i < uniforms.length; i++) { + var uniform = uniforms[i]; + var type = '{precision} ' + (uniform.components === 1 ? 'float' : 'vec' + uniform.components); + pragmas.define[uniform.name.slice(2)] = 'uniform ' + type + ' ' + uniform.name + ';\n'; + pragmas.initialize[uniform.name.slice(2)] = type + ' ' + uniform.name.slice(2) + ' = ' + uniform.name + ';\n'; + } + return pragmas; +}; +},{}],269:[function(require,module,exports){ 'use strict'; - -var TilePyramid = require('../source/tile_pyramid'); -var pyramid = new TilePyramid({ tileSize: 512 }); -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - +var createUniformPragmas = require('./create_uniform_pragmas'); +var tileSize = 512; module.exports = drawBackground; - function drawBackground(painter, source, layer) { var gl = painter.gl; var transform = painter.transform; - var color = util.premultiply(layer.paint['background-color']); + var color = layer.paint['background-color']; var image = layer.paint['background-pattern']; var opacity = layer.paint['background-opacity']; var program; - var imagePosA = image ? painter.spriteAtlas.getPosition(image.from, true) : null; var imagePosB = image ? painter.spriteAtlas.getPosition(image.to, true) : null; - painter.setDepthSublayer(0); if (imagePosA && imagePosB) { - - if (painter.isOpaquePass) return; - - // Draw texture fill + if (painter.isOpaquePass) + return; program = painter.useProgram('pattern'); gl.uniform1i(program.u_image, 0); gl.uniform2fv(program.u_pattern_tl_a, imagePosA.tl); @@ -46141,196 +49307,150 @@ function drawBackground(painter, source, layer) { gl.uniform2fv(program.u_pattern_tl_b, imagePosB.tl); gl.uniform2fv(program.u_pattern_br_b, imagePosB.br); gl.uniform1f(program.u_opacity, opacity); - gl.uniform1f(program.u_mix, image.t); - + gl.uniform2fv(program.u_pattern_size_a, imagePosA.size); + gl.uniform2fv(program.u_pattern_size_b, imagePosB.size); + gl.uniform1f(program.u_scale_a, image.fromScale); + gl.uniform1f(program.u_scale_b, image.toScale); + gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); - painter.tileExtentPatternVAO.bind(gl, program, painter.tileExtentBuffer); } else { - // Draw filling rectangle. - if (painter.isOpaquePass !== (color[3] === 1)) return; - - program = painter.useProgram('fill'); + if (painter.isOpaquePass !== (color[3] === 1)) + return; + var pragmas = createUniformPragmas([ + { + name: 'u_color', + components: 4 + }, + { + name: 'u_opacity', + components: 1 + } + ]); + program = painter.useProgram('fill', [], pragmas, pragmas); gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, opacity); painter.tileExtentVAO.bind(gl, program, painter.tileExtentBuffer); } - gl.disable(gl.STENCIL_TEST); - - // We need to draw the background in tiles in order to use calculatePosMatrix - // which applies the projection matrix (transform.projMatrix). Otherwise - // the depth and stencil buffers get into a bad state. - // This can be refactored into a single draw call once earcut lands and - // we don't have so much going on in the stencil buffer. - var coords = pyramid.coveringTiles(transform); + var coords = transform.coveringTiles({ tileSize: tileSize }); for (var c = 0; c < coords.length; c++) { var coord = coords[c]; - var tileSize = 512; - // var pixelsToTileUnitsBound = pixelsToTileUnits.bind({coord:coord, tileSize: tileSize}); if (imagePosA && imagePosB) { - var imageSizeScaledA = [ - (imagePosA.size[0] * image.fromScale), - (imagePosA.size[1] * image.fromScale) - ]; - var imageSizeScaledB = [ - (imagePosB.size[0] * image.toScale), - (imagePosB.size[1] * image.toScale) - ]; - var tile = {coord:coord, tileSize: tileSize}; - - gl.uniform2fv(program.u_patternscale_a, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledA[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledA[1], painter.transform.tileZoom) - ]); - - gl.uniform2fv(program.u_patternscale_b, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledB[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledB[1], painter.transform.tileZoom) - ]); - var tileSizeAtNearestZoom = tileSize * Math.pow(2, painter.transform.tileZoom - coord.z); - - var offsetAx = ((tileSizeAtNearestZoom / imageSizeScaledA[0]) % 1) * (coord.x + coord.w * Math.pow(2, coord.z)); - var offsetAy = ((tileSizeAtNearestZoom / imageSizeScaledA[1]) % 1) * coord.y; - - var offsetBx = ((tileSizeAtNearestZoom / imageSizeScaledB[0]) % 1) * (coord.x + coord.w * Math.pow(2, coord.z)); - var offsetBy = ((tileSizeAtNearestZoom / imageSizeScaledB[1]) % 1) * coord.y; - - gl.uniform2fv(program.u_offset_a, [offsetAx, offsetAy]); - gl.uniform2fv(program.u_offset_b, [offsetBx, offsetBy]); + var tile = { + coord: coord, + tileSize: tileSize + }; + gl.uniform1f(program.u_tile_units_to_pixels, 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom)); + var tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom - tile.coord.z); + var pixelX = tileSizeAtNearestZoom * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); + var pixelY = tileSizeAtNearestZoom * tile.coord.y; + gl.uniform2f(program.u_pixel_coord_upper, pixelX >> 16, pixelY >> 16); + gl.uniform2f(program.u_pixel_coord_lower, pixelX & 65535, pixelY & 65535); } - gl.uniformMatrix4fv(program.u_matrix, false, painter.transform.calculatePosMatrix(coord)); gl.drawArrays(gl.TRIANGLE_STRIP, 0, painter.tileExtentBuffer.length); } - - gl.stencilMask(0x00); - gl.stencilFunc(gl.EQUAL, 0x80, 0x80); + gl.stencilMask(0); + gl.stencilFunc(gl.EQUAL, 128, 128); } - -},{"../source/pixels_to_tile_units":277,"../source/tile_pyramid":282,"../util/util":349}],262:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":287,"./create_uniform_pragmas":268}],270:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); - module.exports = drawCircles; - function drawCircles(painter, source, layer, coords) { - if (painter.isOpaquePass) return; - + if (painter.isOpaquePass) + return; var gl = painter.gl; - painter.setDepthSublayer(0); painter.depthMask(false); - - // Allow circles to be drawn across boundaries, so that - // large circles are not clipped to tiles gl.disable(gl.STENCIL_TEST); - for (var i = 0; i < coords.length; i++) { var coord = coords[i]; - var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bufferGroups = bucket.bufferGroups.circle; - if (!bufferGroups) continue; - - var program = painter.useProgram('circle', bucket.getProgramMacros('circle', layer)); - - gl.uniform2fv(program.u_extrude_scale, painter.transform.pixelsToGLUnits); - gl.uniform1f(program.u_blur, layer.paint['circle-blur']); + if (!bufferGroups) + continue; + var programOptions = bucket.paintAttributes.circle[layer.id]; + var program = painter.useProgram('circle', programOptions.defines, programOptions.vertexPragmas, programOptions.fragmentPragmas); + if (layer.paint['circle-pitch-scale'] === 'map') { + gl.uniform1i(program.u_scale_with_map, true); + gl.uniform2f(program.u_extrude_scale, painter.transform.pixelsToGLUnits[0] * painter.transform.altitude, painter.transform.pixelsToGLUnits[1] * painter.transform.altitude); + } else { + gl.uniform1i(program.u_scale_with_map, false); + gl.uniform2fv(program.u_extrude_scale, painter.transform.pixelsToGLUnits); + } gl.uniform1f(program.u_devicepixelratio, browser.devicePixelRatio); - gl.uniform1f(program.u_opacity, layer.paint['circle-opacity']); - - gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix( - coord.posMatrix, - tile, - layer.paint['circle-translate'], - layer.paint['circle-translate-anchor'] - )); - - bucket.setUniforms(gl, 'circle', program, layer, {zoom: painter.transform.zoom}); - + gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['circle-translate'], layer.paint['circle-translate-anchor'])); + bucket.setUniforms(gl, 'circle', program, layer, { zoom: painter.transform.zoom }); for (var k = 0; k < bufferGroups.length; k++) { var group = bufferGroups[k]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element, group.paint[layer.id]); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer, group.paintVertexBuffers[layer.id]); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } } - -},{"../util/browser":335}],263:[function(require,module,exports){ +},{"../util/browser":350}],271:[function(require,module,exports){ 'use strict'; - module.exports = drawCollisionDebug; - function drawCollisionDebug(painter, source, layer, coords) { var gl = painter.gl; gl.enable(gl.STENCIL_TEST); var program = painter.useProgram('collisionbox'); - for (var i = 0; i < coords.length; i++) { var coord = coords[i]; var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bufferGroups = bucket.bufferGroups.collisionBox; - - if (!bufferGroups || !bufferGroups.length) continue; + if (!bufferGroups || !bufferGroups.length) + continue; var group = bufferGroups[0]; - if (group.layout.vertex.length === 0) continue; - + if (group.layoutVertexBuffer.length === 0) + continue; gl.uniformMatrix4fv(program.u_matrix, false, coord.posMatrix); - painter.enableTileClippingMask(coord); - painter.lineWidth(1); gl.uniform1f(program.u_scale, Math.pow(2, painter.transform.zoom - tile.coord.z)); gl.uniform1f(program.u_zoom, painter.transform.zoom * 10); gl.uniform1f(program.u_maxzoom, (tile.coord.z + 1) * 10); - - group.vaos[layer.id].bind(gl, program, group.layout.vertex); - gl.drawArrays(gl.LINES, 0, group.layout.vertex.length); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer); + gl.drawArrays(gl.LINES, 0, group.layoutVertexBuffer.length); } } - -},{}],264:[function(require,module,exports){ +},{}],272:[function(require,module,exports){ 'use strict'; - var textVertices = require('../lib/debugtext'); var browser = require('../util/browser'); var mat4 = require('gl-matrix').mat4; var EXTENT = require('../data/bucket').EXTENT; var Buffer = require('../data/buffer'); var VertexArrayObject = require('./vertex_array_object'); - module.exports = drawDebug; - function drawDebug(painter, source, coords) { - if (painter.isOpaquePass) return; - if (!painter.options.debug) return; - + if (painter.isOpaquePass) + return; + if (!painter.options.debug) + return; for (var i = 0; i < coords.length; i++) { drawDebugTile(painter, source, coords[i]); } } - function drawDebugTile(painter, source, coord) { var gl = painter.gl; - gl.disable(gl.STENCIL_TEST); painter.lineWidth(1 * browser.devicePixelRatio); - var posMatrix = coord.posMatrix; var program = painter.useProgram('debug'); - gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); gl.uniform4f(program.u_color, 1, 0, 0, 1); painter.debugVAO.bind(gl, program, painter.debugBuffer); gl.drawArrays(gl.LINE_STRIP, 0, painter.debugBuffer.length); - var vertices = textVertices(coord.toString(), 50, 200, 5); var debugTextArray = new painter.PosArray(); for (var v = 0; v < vertices.length; v += 2) { @@ -46340,224 +49460,143 @@ function drawDebugTile(painter, source, coord) { var debugTextVAO = new VertexArrayObject(); debugTextVAO.bind(gl, program, debugTextBuffer); gl.uniform4f(program.u_color, 1, 1, 1, 1); - - // Draw the halo with multiple 1px lines instead of one wider line because - // the gl spec doesn't guarantee support for lines with width > 1. var tileSize = source.getTile(coord).tileSize; var onePixel = EXTENT / (Math.pow(2, painter.transform.zoom - coord.z) * tileSize); - var translations = [[-1, -1], [-1, 1], [1, -1], [1, 1]]; + var translations = [ + [ + -1, + -1 + ], + [ + -1, + 1 + ], + [ + 1, + -1 + ], + [ + 1, + 1 + ] + ]; for (var i = 0; i < translations.length; i++) { var translation = translations[i]; - gl.uniformMatrix4fv(program.u_matrix, false, mat4.translate([], posMatrix, [onePixel * translation[0], onePixel * translation[1], 0])); + gl.uniformMatrix4fv(program.u_matrix, false, mat4.translate([], posMatrix, [ + onePixel * translation[0], + onePixel * translation[1], + 0 + ])); gl.drawArrays(gl.LINES, 0, debugTextBuffer.length); } - gl.uniform4f(program.u_color, 0, 0, 0, 1); gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); gl.drawArrays(gl.LINES, 0, debugTextBuffer.length); } - -},{"../data/bucket":247,"../data/buffer":252,"../lib/debugtext":259,"../util/browser":335,"./vertex_array_object":273,"gl-matrix":363}],265:[function(require,module,exports){ +},{"../data/bucket":253,"../data/buffer":258,"../lib/debugtext":266,"../util/browser":350,"./vertex_array_object":281,"gl-matrix":382}],273:[function(require,module,exports){ 'use strict'; - -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - module.exports = draw; - function draw(painter, source, layer, coords) { var gl = painter.gl; gl.enable(gl.STENCIL_TEST); - - var color = util.premultiply(layer.paint['fill-color']); - var image = layer.paint['fill-pattern']; - var strokeColor = util.premultiply(layer.paint['fill-outline-color']); - var opacity = layer.paint['fill-opacity']; - - // Draw fill - if (image ? !painter.isOpaquePass : painter.isOpaquePass === (color[3] === 1 && opacity === 1)) { - // Once we switch to earcut drawing we can pull most of the WebGL setup - // outside of this coords loop. + var isOpaque; + if (layer.paint['fill-pattern']) { + isOpaque = false; + } else { + isOpaque = layer.isPaintValueFeatureConstant('fill-color') && layer.isPaintValueFeatureConstant('fill-opacity') && layer.paint['fill-color'][3] === 1 && layer.paint['fill-opacity'] === 1; + } + if (painter.isOpaquePass === isOpaque) { + painter.setDepthSublayer(1); for (var i = 0; i < coords.length; i++) { drawFill(painter, source, layer, coords[i]); } } - - // Draw stroke if (!painter.isOpaquePass && layer.paint['fill-antialias']) { - if (strokeColor || !layer.paint['fill-pattern']) { - var outlineProgram = painter.useProgram('outline'); - painter.lineWidth(2); - painter.depthMask(false); - - if (strokeColor) { - // If we defined a different color for the fill outline, we are - // going to ignore the bits in 0x07 and just care about the global - // clipping mask. + painter.lineWidth(2); + painter.depthMask(false); + var isOutlineColorDefined = layer.getPaintProperty('fill-outline-color'); + if (isOutlineColorDefined || !layer.paint['fill-pattern']) { + if (isOutlineColorDefined) { painter.setDepthSublayer(2); } else { - // Otherwise, we only want to drawFill the antialiased parts that are - // *outside* the current shape. This is important in case the fill - // or stroke color is translucent. If we wouldn't clip to outside - // the current shape, some pixels from the outline stroke overlapped - // the (non-antialiased) fill. painter.setDepthSublayer(0); } - gl.uniform2f(outlineProgram.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); - gl.uniform4fv(outlineProgram.u_color, strokeColor ? strokeColor : color); - gl.uniform1f(outlineProgram.u_opacity, opacity); - - for (var j = 0; j < coords.length; j++) { - drawStroke(painter, source, layer, coords[j]); - } } else { - var outlinePatternProgram = painter.useProgram('outlinepattern'); - painter.lineWidth(2); - painter.depthMask(false); - // Otherwise, we only want to drawFill the antialiased parts that are - // *outside* the current shape. This is important in case the fill - // or stroke color is translucent. If we wouldn't clip to outside - // the current shape, some pixels from the outline stroke overlapped - // the (non-antialiased) fill. painter.setDepthSublayer(0); - gl.uniform2f(outlinePatternProgram.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); - - for (var k = 0; k < coords.length; k++) { - drawStroke(painter, source, layer, coords[k]); - } } - + for (var j = 0; j < coords.length; j++) { + drawStroke(painter, source, layer, coords[j]); + } } } - function drawFill(painter, source, layer, coord) { var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) return; + if (!bucket) + return; var bufferGroups = bucket.bufferGroups.fill; - if (!bufferGroups) return; - + if (!bufferGroups) + return; var gl = painter.gl; - - var color = util.premultiply(layer.paint['fill-color']); var image = layer.paint['fill-pattern']; - var opacity = layer.paint['fill-opacity']; - - var posMatrix = coord.posMatrix; - var translatedPosMatrix = painter.translatePosMatrix(posMatrix, tile, layer.paint['fill-translate'], layer.paint['fill-translate-anchor']); - - // Draw the stencil mask. - painter.setDepthSublayer(1); - - // We're only drawFilling to the first seven bits (== support a maximum of - // 8 overlapping polygons in one place before we get rendering errors). - gl.stencilMask(0x07); - gl.clear(gl.STENCIL_BUFFER_BIT); - - // Draw front facing triangles. Wherever the 0x80 bit is 1, we are - // increasing the lower 7 bits by one if the triangle is a front-facing - // triangle. This means that all visible polygons should be in CCW - // orientation, while all holes (see below) are in CW orientation. - painter.enableTileClippingMask(coord); - - // When we do a nonzero fill, we count the number of times a pixel is - // covered by a counterclockwise polygon, and subtract the number of - // times it is "uncovered" by a clockwise polygon. - gl.stencilOpSeparate(gl.FRONT, gl.KEEP, gl.KEEP, gl.INCR_WRAP); - gl.stencilOpSeparate(gl.BACK, gl.KEEP, gl.KEEP, gl.DECR_WRAP); - - // When drawFilling a shape, we first drawFill all shapes to the stencil buffer - // and incrementing all areas where polygons are - gl.colorMask(false, false, false, false); - painter.depthMask(false); - - // Draw the actual triangle fan into the stencil buffer. - var fillProgram = painter.useProgram('fill'); - gl.uniformMatrix4fv(fillProgram.u_matrix, false, translatedPosMatrix); - - for (var i = 0; i < bufferGroups.length; i++) { - var group = bufferGroups[i]; - group.vaos[layer.id].bind(gl, fillProgram, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); - } - - // Now that we have the stencil mask in the stencil buffer, we can start - // writing to the color buffer. - gl.colorMask(true, true, true, true); - painter.depthMask(true); - - // From now on, we don't want to update the stencil buffer anymore. - gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); - gl.stencilMask(0x0); var program; - - if (image) { - // Draw texture fill + if (!image) { + var programOptions = bucket.paintAttributes.fill[layer.id]; + program = painter.useProgram('fill', programOptions.defines, programOptions.vertexPragmas, programOptions.fragmentPragmas); + bucket.setUniforms(gl, 'fill', program, layer, { zoom: painter.transform.zoom }); + } else { program = painter.useProgram('pattern'); - setPattern(image, opacity, tile, coord, painter, program); - + setPattern(image, layer.paint['fill-opacity'], tile, coord, painter, program); gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); - - painter.tileExtentPatternVAO.bind(gl, program, painter.tileExtentBuffer); - - } else { - // Draw filling rectangle. - program = painter.useProgram('fill'); - gl.uniform4fv(fillProgram.u_color, color); - gl.uniform1f(fillProgram.u_opacity, opacity); - painter.tileExtentVAO.bind(gl, program, painter.tileExtentBuffer); } - - gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); - - // Only draw regions that we marked - gl.stencilFunc(gl.NOTEQUAL, 0x0, 0x07); - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, painter.tileExtentBuffer.length); - - gl.stencilMask(0x00); + gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['fill-translate'], layer.paint['fill-translate-anchor'])); + painter.enableTileClippingMask(coord); + for (var i = 0; i < bufferGroups.length; i++) { + var group = bufferGroups[i]; + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer, group.paintVertexBuffers[layer.id]); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length, gl.UNSIGNED_SHORT, 0); + } } - function drawStroke(painter, source, layer, coord) { var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) return; - + if (!bucket) + return; var gl = painter.gl; var bufferGroups = bucket.bufferGroups.fill; - var image = layer.paint['fill-pattern']; var opacity = layer.paint['fill-opacity']; - var program = image ? painter.useProgram('outlinepattern') : painter.useProgram('outline'); - - gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix( - coord.posMatrix, - tile, - layer.paint['fill-translate'], - layer.paint['fill-translate-anchor'] - )); - - if (image) { setPattern(image, opacity, tile, coord, painter, program); } - + var isOutlineColorDefined = layer.getPaintProperty('fill-outline-color'); + var program; + if (image && !isOutlineColorDefined) { + program = painter.useProgram('outlinepattern'); + gl.uniform2f(program.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); + } else { + var programOptions = bucket.paintAttributes.fill[layer.id]; + program = painter.useProgram('outline', programOptions.defines, programOptions.vertexPragmas, programOptions.fragmentPragmas); + gl.uniform2f(program.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); + gl.uniform1f(program.u_opacity, opacity); + bucket.setUniforms(gl, 'fill', program, layer, { zoom: painter.transform.zoom }); + } + gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['fill-translate'], layer.paint['fill-translate-anchor'])); + if (image) { + setPattern(image, opacity, tile, coord, painter, program); + } painter.enableTileClippingMask(coord); - for (var k = 0; k < bufferGroups.length; k++) { var group = bufferGroups[k]; - group.secondVaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element2); - gl.drawElements(gl.LINES, group.layout.element2.length * 2, gl.UNSIGNED_SHORT, 0); + group.secondVaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer2, group.paintVertexBuffers[layer.id]); + gl.drawElements(gl.LINES, group.elementBuffer2.length * 2, gl.UNSIGNED_SHORT, 0); } } - - function setPattern(image, opacity, tile, coord, painter, program) { var gl = painter.gl; - var imagePosA = painter.spriteAtlas.getPosition(image.from, true); var imagePosB = painter.spriteAtlas.getPosition(image.to, true); - if (!imagePosA || !imagePosB) return; - - + if (!imagePosA || !imagePosB) + return; gl.uniform1i(program.u_image, 0); gl.uniform2fv(program.u_pattern_tl_a, imagePosA.tl); gl.uniform2fv(program.u_pattern_br_a, imagePosA.br); @@ -46565,142 +49604,80 @@ function setPattern(image, opacity, tile, coord, painter, program) { gl.uniform2fv(program.u_pattern_br_b, imagePosB.br); gl.uniform1f(program.u_opacity, opacity); gl.uniform1f(program.u_mix, image.t); - - var imageSizeScaledA = [ - (imagePosA.size[0] * image.fromScale), - (imagePosA.size[1] * image.fromScale) - ]; - var imageSizeScaledB = [ - (imagePosB.size[0] * image.toScale), - (imagePosB.size[1] * image.toScale) - ]; - - gl.uniform2fv(program.u_patternscale_a, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledA[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledA[1], painter.transform.tileZoom) - ]); - - gl.uniform2fv(program.u_patternscale_b, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledB[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledB[1], painter.transform.tileZoom) - ]); - + gl.uniform1f(program.u_tile_units_to_pixels, 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom)); + gl.uniform2fv(program.u_pattern_size_a, imagePosA.size); + gl.uniform2fv(program.u_pattern_size_b, imagePosB.size); + gl.uniform1f(program.u_scale_a, image.fromScale); + gl.uniform1f(program.u_scale_b, image.toScale); var tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom - tile.coord.z); - - // shift images to match at tile boundaries - var offsetAx = ((tileSizeAtNearestZoom / imageSizeScaledA[0]) % 1) * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); - var offsetAy = ((tileSizeAtNearestZoom / imageSizeScaledA[1]) % 1) * tile.coord.y; - - var offsetBx = ((tileSizeAtNearestZoom / imageSizeScaledB[0]) % 1) * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); - var offsetBy = ((tileSizeAtNearestZoom / imageSizeScaledB[1]) % 1) * tile.coord.y; - - gl.uniform2fv(program.u_offset_a, [offsetAx, offsetAy]); - gl.uniform2fv(program.u_offset_b, [offsetBx, offsetBy]); - + var pixelX = tileSizeAtNearestZoom * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); + var pixelY = tileSizeAtNearestZoom * tile.coord.y; + gl.uniform2f(program.u_pixel_coord_upper, pixelX >> 16, pixelY >> 16); + gl.uniform2f(program.u_pixel_coord_lower, pixelX & 65535, pixelY & 65535); gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); } - -},{"../source/pixels_to_tile_units":277,"../util/util":349}],266:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":287}],274:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); var mat2 = require('gl-matrix').mat2; -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - -/** - * Draw a line. Under the hood this will read elements from - * a tile, dash textures from a lineAtlas, and style properties from a layer. - * @param {Object} painter - * @param {Object} layer - * @param {Object} posMatrix - * @param {Tile} tile - * @returns {undefined} draws with the painter - * @private - */ module.exports = function drawLine(painter, source, layer, coords) { - if (painter.isOpaquePass) return; + if (painter.isOpaquePass) + return; painter.setDepthSublayer(0); painter.depthMask(false); - var gl = painter.gl; gl.enable(gl.STENCIL_TEST); - - // don't draw zero-width lines - if (layer.paint['line-width'] <= 0) return; - - // the distance over which the line edge fades out. - // Retina devices need a smaller distance to avoid aliasing. + if (layer.paint['line-width'] <= 0) + return; var antialiasing = 1 / browser.devicePixelRatio; - var blur = layer.paint['line-blur'] + antialiasing; - var edgeWidth = layer.paint['line-width'] / 2; - var inset = -1; - var offset = 0; - var shift = 0; - - if (layer.paint['line-gap-width'] > 0) { - inset = layer.paint['line-gap-width'] / 2 + antialiasing * 0.5; - edgeWidth = layer.paint['line-width']; - - // shift outer lines half a pixel towards the middle to eliminate the crack - offset = inset - antialiasing / 2; - } - - var outset = offset + edgeWidth + antialiasing / 2 + shift; - var color = util.premultiply(layer.paint['line-color']); - + var color = layer.paint['line-color']; var tr = painter.transform; - var antialiasingMatrix = mat2.create(); - mat2.scale(antialiasingMatrix, antialiasingMatrix, [1, Math.cos(tr._pitch)]); + mat2.scale(antialiasingMatrix, antialiasingMatrix, [ + 1, + Math.cos(tr._pitch) + ]); mat2.rotate(antialiasingMatrix, antialiasingMatrix, painter.transform.angle); - - // calculate how much longer the real world distance is at the top of the screen - // than at the middle of the screen. - var topedgelength = Math.sqrt(tr.height * tr.height / 4 * (1 + tr.altitude * tr.altitude)); + var topedgelength = Math.sqrt(tr.height * tr.height / 4 * (1 + tr.altitude * tr.altitude)); var x = tr.height / 2 * Math.tan(tr._pitch); var extra = (topedgelength + x) / topedgelength - 1; - var dasharray = layer.paint['line-dasharray']; var image = layer.paint['line-pattern']; var program, posA, posB, imagePosA, imagePosB; - if (dasharray) { program = painter.useProgram('linesdfpattern'); - - gl.uniform2fv(program.u_linewidth, [ outset, inset ]); + gl.uniform1f(program.u_linewidth, layer.paint['line-width'] / 2); + gl.uniform1f(program.u_gapwidth, layer.paint['line-gap-width'] / 2); + gl.uniform1f(program.u_antialiasing, antialiasing / 2); gl.uniform1f(program.u_blur, blur); gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, layer.paint['line-opacity']); - posA = painter.lineAtlas.getDash(dasharray.from, layer.layout['line-cap'] === 'round'); posB = painter.lineAtlas.getDash(dasharray.to, layer.layout['line-cap'] === 'round'); - gl.uniform1i(program.u_image, 0); gl.activeTexture(gl.TEXTURE0); painter.lineAtlas.bind(gl); - gl.uniform1f(program.u_tex_y_a, posA.y); gl.uniform1f(program.u_tex_y_b, posB.y); gl.uniform1f(program.u_mix, dasharray.t); gl.uniform1f(program.u_extra, extra); gl.uniform1f(program.u_offset, -layer.paint['line-offset']); gl.uniformMatrix2fv(program.u_antialiasingmatrix, false, antialiasingMatrix); - } else if (image) { imagePosA = painter.spriteAtlas.getPosition(image.from, true); imagePosB = painter.spriteAtlas.getPosition(image.to, true); - if (!imagePosA || !imagePosB) return; - + if (!imagePosA || !imagePosB) + return; program = painter.useProgram('linepattern'); - gl.uniform1i(program.u_image, 0); gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); - - gl.uniform2fv(program.u_linewidth, [ outset, inset ]); + gl.uniform1f(program.u_linewidth, layer.paint['line-width'] / 2); + gl.uniform1f(program.u_gapwidth, layer.paint['line-gap-width'] / 2); + gl.uniform1f(program.u_antialiasing, antialiasing / 2); gl.uniform1f(program.u_blur, blur); gl.uniform2fv(program.u_pattern_tl_a, imagePosA.tl); gl.uniform2fv(program.u_pattern_br_a, imagePosA.br); @@ -46711,11 +49688,11 @@ module.exports = function drawLine(painter, source, layer, coords) { gl.uniform1f(program.u_extra, extra); gl.uniform1f(program.u_offset, -layer.paint['line-offset']); gl.uniformMatrix2fv(program.u_antialiasingmatrix, false, antialiasingMatrix); - } else { program = painter.useProgram('line'); - - gl.uniform2fv(program.u_linewidth, [ outset, inset ]); + gl.uniform1f(program.u_linewidth, layer.paint['line-width'] / 2); + gl.uniform1f(program.u_gapwidth, layer.paint['line-gap-width'] / 2); + gl.uniform1f(program.u_antialiasing, antialiasing / 2); gl.uniform1f(program.u_blur, blur); gl.uniform1f(program.u_extra, extra); gl.uniform1f(program.u_offset, -layer.paint['line-offset']); @@ -46723,34 +49700,35 @@ module.exports = function drawLine(painter, source, layer, coords) { gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, layer.paint['line-opacity']); } - for (var k = 0; k < coords.length; k++) { var coord = coords[k]; var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bufferGroups = bucket.bufferGroups.line; - if (!bufferGroups) continue; - + if (!bufferGroups) + continue; painter.enableTileClippingMask(coord); - - // set uniforms that are different for each tile var posMatrix = painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['line-translate'], layer.paint['line-translate-anchor']); gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); - var ratio = 1 / pixelsToTileUnits(tile, 1, painter.transform.zoom); - if (dasharray) { var widthA = posA.width * dasharray.fromScale; var widthB = posB.width * dasharray.toScale; - var scaleA = [1 / pixelsToTileUnits(tile, widthA, painter.transform.tileZoom), -posA.height / 2]; - var scaleB = [1 / pixelsToTileUnits(tile, widthB, painter.transform.tileZoom), -posB.height / 2]; + var scaleA = [ + 1 / pixelsToTileUnits(tile, widthA, painter.transform.tileZoom), + -posA.height / 2 + ]; + var scaleB = [ + 1 / pixelsToTileUnits(tile, widthB, painter.transform.tileZoom), + -posB.height / 2 + ]; var gamma = painter.lineAtlas.width / (Math.min(widthA, widthB) * 256 * browser.devicePixelRatio) / 2; gl.uniform1f(program.u_ratio, ratio); gl.uniform2fv(program.u_patternscale_a, scaleA); gl.uniform2fv(program.u_patternscale_b, scaleB); gl.uniform1f(program.u_sdfgamma, gamma); - } else if (image) { gl.uniform1f(program.u_ratio, ratio); gl.uniform2fv(program.u_pattern_size_a, [ @@ -46761,110 +49739,93 @@ module.exports = function drawLine(painter, source, layer, coords) { pixelsToTileUnits(tile, imagePosB.size[0] * image.toScale, painter.transform.tileZoom), imagePosB.size[1] ]); - } else { gl.uniform1f(program.u_ratio, ratio); } - for (var i = 0; i < bufferGroups.length; i++) { var group = bufferGroups[i]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } - }; - -},{"../source/pixels_to_tile_units":277,"../util/browser":335,"../util/util":349,"gl-matrix":363}],267:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":287,"../util/browser":350,"gl-matrix":382}],275:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var StructArrayType = require('../util/struct_array'); - module.exports = drawRaster; - function drawRaster(painter, source, layer, coords) { - if (painter.isOpaquePass) return; - + if (painter.isOpaquePass) + return; var gl = painter.gl; - gl.enable(gl.DEPTH_TEST); painter.depthMask(true); - - // Change depth function to prevent double drawing in areas where tiles overlap. gl.depthFunc(gl.LESS); - var minTileZ = coords.length && coords[0].z; - for (var i = 0; i < coords.length; i++) { var coord = coords[i]; - // set the lower zoom level to sublayer 0, and higher zoom levels to higher sublayers painter.setDepthSublayer(coord.z - minTileZ); drawRasterTile(painter, source, layer, coord); } - gl.depthFunc(gl.LEQUAL); } - drawRaster.RasterBoundsArray = new StructArrayType({ members: [ - { name: 'a_pos', type: 'Int16', components: 2 }, - { name: 'a_texture_pos', type: 'Int16', components: 2 } + { + name: 'a_pos', + type: 'Int16', + components: 2 + }, + { + name: 'a_texture_pos', + type: 'Int16', + components: 2 + } ] }); - function drawRasterTile(painter, source, layer, coord) { - var gl = painter.gl; - gl.disable(gl.STENCIL_TEST); - var tile = source.getTile(coord); var posMatrix = painter.transform.calculatePosMatrix(coord, source.maxzoom); - var program = painter.useProgram('raster'); gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); - - // color parameters gl.uniform1f(program.u_brightness_low, layer.paint['raster-brightness-min']); gl.uniform1f(program.u_brightness_high, layer.paint['raster-brightness-max']); gl.uniform1f(program.u_saturation_factor, saturationFactor(layer.paint['raster-saturation'])); gl.uniform1f(program.u_contrast_factor, contrastFactor(layer.paint['raster-contrast'])); gl.uniform3fv(program.u_spin_weights, spinWeights(layer.paint['raster-hue-rotate'])); - - var parentTile = tile.source && tile.source._pyramid.findLoadedParent(coord, 0, {}), - opacities = getOpacities(tile, parentTile, layer, painter.transform); - + var parentTile = tile.source && tile.source.findLoadedParent(coord, 0, {}), opacities = getOpacities(tile, parentTile, layer, painter.transform); var parentScaleBy, parentTL; - gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, tile.texture); - + gl.activeTexture(gl.TEXTURE1); if (parentTile) { - gl.activeTexture(gl.TEXTURE1); gl.bindTexture(gl.TEXTURE_2D, parentTile.texture); - parentScaleBy = Math.pow(2, parentTile.coord.z - tile.coord.z); - parentTL = [tile.coord.x * parentScaleBy % 1, tile.coord.y * parentScaleBy % 1]; + parentTL = [ + tile.coord.x * parentScaleBy % 1, + tile.coord.y * parentScaleBy % 1 + ]; } else { + gl.bindTexture(gl.TEXTURE_2D, tile.texture); opacities[1] = 0; } - - // cross-fade parameters - gl.uniform2fv(program.u_tl_parent, parentTL || [0, 0]); + gl.uniform2fv(program.u_tl_parent, parentTL || [ + 0, + 0 + ]); gl.uniform1f(program.u_scale_parent, parentScaleBy || 1); gl.uniform1f(program.u_buffer_scale, 1); gl.uniform1f(program.u_opacity0, opacities[0]); gl.uniform1f(program.u_opacity1, opacities[1]); gl.uniform1i(program.u_image0, 0); gl.uniform1i(program.u_image1, 1); - var buffer = tile.boundsBuffer || painter.rasterBoundsBuffer; var vao = tile.boundsVAO || painter.rasterBoundsVAO; vao.bind(gl, program, buffer); gl.drawArrays(gl.TRIANGLE_STRIP, 0, buffer.length); } - function spinWeights(angle) { angle *= Math.PI / 180; var s = Math.sin(angle); @@ -46875,288 +49836,184 @@ function spinWeights(angle) { (Math.sqrt(3) * s - c + 1) / 3 ]; } - function contrastFactor(contrast) { - return contrast > 0 ? - 1 / (1 - contrast) : - 1 + contrast; + return contrast > 0 ? 1 / (1 - contrast) : 1 + contrast; } - function saturationFactor(saturation) { - return saturation > 0 ? - 1 - 1 / (1.001 - saturation) : - -saturation; + return saturation > 0 ? 1 - 1 / (1.001 - saturation) : -saturation; } - function getOpacities(tile, parentTile, layer, transform) { - var opacity = [1, 0]; + var opacity = [ + 1, + 0 + ]; var fadeDuration = layer.paint['raster-fade-duration']; - if (tile.source && fadeDuration > 0) { var now = new Date().getTime(); - var sinceTile = (now - tile.timeAdded) / fadeDuration; var sinceParent = parentTile ? (now - parentTile.timeAdded) / fadeDuration : -1; - - var idealZ = tile.source._pyramid.coveringZoomLevel(transform); + var idealZ = transform.coveringZoomLevel(tile.source); var parentFurther = parentTile ? Math.abs(parentTile.coord.z - idealZ) > Math.abs(tile.coord.z - idealZ) : false; - if (!parentTile || parentFurther) { - // if no parent or parent is older opacity[0] = util.clamp(sinceTile, 0, 1); opacity[1] = 1 - opacity[0]; } else { - // parent is younger, zooming out opacity[0] = util.clamp(1 - sinceParent, 0, 1); opacity[1] = 1 - opacity[0]; } } - var op = layer.paint['raster-opacity']; opacity[0] *= op; opacity[1] *= op; - return opacity; } - -},{"../util/struct_array":347,"../util/util":349}],268:[function(require,module,exports){ +},{"../util/struct_array":364,"../util/util":366}],276:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); var drawCollisionDebug = require('./draw_collision_debug'); -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - - module.exports = drawSymbols; - function drawSymbols(painter, source, layer, coords) { - if (painter.isOpaquePass) return; - - var drawAcrossEdges = !(layer.layout['text-allow-overlap'] || layer.layout['icon-allow-overlap'] || - layer.layout['text-ignore-placement'] || layer.layout['icon-ignore-placement']); - + if (painter.isOpaquePass) + return; + var drawAcrossEdges = !(layer.layout['text-allow-overlap'] || layer.layout['icon-allow-overlap'] || layer.layout['text-ignore-placement'] || layer.layout['icon-ignore-placement']); var gl = painter.gl; - - // Disable the stencil test so that labels aren't clipped to tile boundaries. - // - // Layers with features that may be drawn overlapping aren't clipped. These - // layers are sorted in the y direction, and to draw the correct ordering near - // tile edges the icons are included in both tiles and clipped when drawing. if (drawAcrossEdges) { gl.disable(gl.STENCIL_TEST); } else { gl.enable(gl.STENCIL_TEST); } - painter.setDepthSublayer(0); painter.depthMask(false); gl.disable(gl.DEPTH_TEST); - - drawLayerSymbols(painter, source, layer, coords, false, - layer.paint['icon-translate'], - layer.paint['icon-translate-anchor'], - layer.layout['icon-rotation-alignment'], - layer.layout['icon-size'], - layer.paint['icon-halo-width'], - layer.paint['icon-halo-color'], - layer.paint['icon-halo-blur'], - layer.paint['icon-opacity'], - layer.paint['icon-color']); - - drawLayerSymbols(painter, source, layer, coords, true, - layer.paint['text-translate'], - layer.paint['text-translate-anchor'], - layer.layout['text-rotation-alignment'], - layer.layout['text-size'], - layer.paint['text-halo-width'], - layer.paint['text-halo-color'], - layer.paint['text-halo-blur'], - layer.paint['text-opacity'], - layer.paint['text-color']); - + drawLayerSymbols(painter, source, layer, coords, false, layer.paint['icon-translate'], layer.paint['icon-translate-anchor'], layer.layout['icon-rotation-alignment'], layer.layout['icon-rotation-alignment'], layer.layout['icon-size'], layer.paint['icon-halo-width'], layer.paint['icon-halo-color'], layer.paint['icon-halo-blur'], layer.paint['icon-opacity'], layer.paint['icon-color']); + drawLayerSymbols(painter, source, layer, coords, true, layer.paint['text-translate'], layer.paint['text-translate-anchor'], layer.layout['text-rotation-alignment'], layer.layout['text-pitch-alignment'], layer.layout['text-size'], layer.paint['text-halo-width'], layer.paint['text-halo-color'], layer.paint['text-halo-blur'], layer.paint['text-opacity'], layer.paint['text-color']); gl.enable(gl.DEPTH_TEST); - - drawCollisionDebug(painter, source, layer, coords); + if (source.map.showCollisionBoxes) { + drawCollisionDebug(painter, source, layer, coords); + } } - -function drawLayerSymbols(painter, source, layer, coords, isText, - translate, - translateAnchor, - rotationAlignment, - size, - haloWidth, - haloColor, - haloBlur, - opacity, - color) { - - haloColor = util.premultiply(haloColor); - color = util.premultiply(color); - +function drawLayerSymbols(painter, source, layer, coords, isText, translate, translateAnchor, rotationAlignment, pitchAlignment, size, haloWidth, haloColor, haloBlur, opacity, color) { for (var j = 0; j < coords.length; j++) { var tile = source.getTile(coords[j]); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bothBufferGroups = bucket.bufferGroups; var bufferGroups = isText ? bothBufferGroups.glyph : bothBufferGroups.icon; - if (!bufferGroups.length) continue; - + if (!bufferGroups.length) + continue; painter.enableTileClippingMask(coords[j]); - drawSymbol(painter, layer, coords[j].posMatrix, tile, bucket, bufferGroups, isText, - isText || bucket.sdfIcons, !isText && bucket.iconsNeedLinear, - isText ? bucket.adjustedTextSize : bucket.adjustedIconSize, bucket.fontstack, - translate, - translateAnchor, - rotationAlignment, - size, - haloWidth, - haloColor, - haloBlur, - opacity, - color); - } -} - -function drawSymbol(painter, layer, posMatrix, tile, bucket, bufferGroups, isText, sdf, iconsNeedLinear, adjustedSize, fontstack, - translate, - translateAnchor, - rotationAlignment, - size, - haloWidth, - haloColor, - haloBlur, - opacity, - color) { + drawSymbol(painter, layer, coords[j].posMatrix, tile, bucket, bufferGroups, isText, isText || bucket.sdfIcons, !isText && bucket.iconsNeedLinear, isText ? bucket.adjustedTextSize : bucket.adjustedIconSize, bucket.fontstack, translate, translateAnchor, rotationAlignment, pitchAlignment, size, haloWidth, haloColor, haloBlur, opacity, color); + } +} +function drawSymbol(painter, layer, posMatrix, tile, bucket, bufferGroups, isText, sdf, iconsNeedLinear, adjustedSize, fontstack, translate, translateAnchor, rotationAlignment, pitchAlignment, size, haloWidth, haloColor, haloBlur, opacity, color) { var gl = painter.gl; var tr = painter.transform; - var alignedWithMap = rotationAlignment === 'map'; - + var rotateWithMap = rotationAlignment === 'map'; + var pitchWithMap = pitchAlignment === 'map'; var defaultSize = isText ? 24 : 1; var fontScale = size / defaultSize; - var extrudeScale, s, gammaScale; - if (alignedWithMap) { + if (pitchWithMap) { s = pixelsToTileUnits(tile, 1, painter.transform.zoom) * fontScale; gammaScale = 1 / Math.cos(tr._pitch); - extrudeScale = [s, s]; + extrudeScale = [ + s, + s + ]; } else { s = painter.transform.altitude * fontScale; gammaScale = 1; - extrudeScale = [ tr.pixelsToGLUnits[0] * s, tr.pixelsToGLUnits[1] * s]; + extrudeScale = [ + tr.pixelsToGLUnits[0] * s, + tr.pixelsToGLUnits[1] * s + ]; } - - // calculate how much longer the real world distance is at the top of the screen - // than at the middle of the screen. - var topedgelength = Math.sqrt(tr.height * tr.height / 4 * (1 + tr.altitude * tr.altitude)); - var x = tr.height / 2 * Math.tan(tr._pitch); - var extra = (topedgelength + x) / topedgelength - 1; - if (!isText && !painter.style.sprite.loaded()) return; - var program = painter.useProgram(sdf ? 'sdf' : 'icon'); gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(posMatrix, tile, translate, translateAnchor)); - gl.uniform1i(program.u_skewed, alignedWithMap); - gl.uniform1f(program.u_extra, extra); + gl.uniform1i(program.u_rotate_with_map, rotateWithMap); + gl.uniform1i(program.u_pitch_with_map, pitchWithMap); gl.uniform2fv(program.u_extrude_scale, extrudeScale); - gl.activeTexture(gl.TEXTURE0); gl.uniform1i(program.u_texture, 0); - if (isText) { - // use the fonstack used when parsing the tile, not the fontstack - // at the current zoom level (layout['text-font']). var glyphAtlas = fontstack && painter.glyphSource.getGlyphAtlas(fontstack); - if (!glyphAtlas) return; - + if (!glyphAtlas) + return; glyphAtlas.updateTexture(gl); gl.uniform2f(program.u_texsize, glyphAtlas.width / 4, glyphAtlas.height / 4); } else { var mapMoving = painter.options.rotating || painter.options.zooming; var iconScaled = fontScale !== 1 || browser.devicePixelRatio !== painter.spriteAtlas.pixelRatio || iconsNeedLinear; - var iconTransformed = alignedWithMap || painter.transform.pitch; + var iconTransformed = pitchWithMap || painter.transform.pitch; painter.spriteAtlas.bind(gl, sdf || mapMoving || iconScaled || iconTransformed); gl.uniform2f(program.u_texsize, painter.spriteAtlas.width / 4, painter.spriteAtlas.height / 4); } - - // adjust min/max zooms for variable font sizes var zoomAdjust = Math.log(size / adjustedSize) / Math.LN2 || 0; - gl.uniform1f(program.u_zoom, (painter.transform.zoom - zoomAdjust) * 10); // current zoom level - + gl.uniform1f(program.u_zoom, (painter.transform.zoom - zoomAdjust) * 10); gl.activeTexture(gl.TEXTURE1); painter.frameHistory.bind(gl); gl.uniform1i(program.u_fadetexture, 1); - var group; - if (sdf) { var sdfPx = 8; var blurOffset = 1.19; var haloOffset = 6; var gamma = 0.105 * defaultSize / size / browser.devicePixelRatio; - if (haloWidth) { - // Draw halo underneath the text. gl.uniform1f(program.u_gamma, (haloBlur * blurOffset / fontScale / sdfPx + gamma) * gammaScale); gl.uniform4fv(program.u_color, haloColor); gl.uniform1f(program.u_opacity, opacity); gl.uniform1f(program.u_buffer, (haloOffset - haloWidth / fontScale) / sdfPx); - for (var j = 0; j < bufferGroups.length; j++) { group = bufferGroups[j]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } - gl.uniform1f(program.u_gamma, gamma * gammaScale); gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, opacity); gl.uniform1f(program.u_buffer, (256 - 64) / 256); - + gl.uniform1f(program.u_pitch, tr.pitch / 360 * 2 * Math.PI); + gl.uniform1f(program.u_bearing, tr.bearing / 360 * 2 * Math.PI); + gl.uniform1f(program.u_aspect_ratio, tr.width / tr.height); for (var i = 0; i < bufferGroups.length; i++) { group = bufferGroups[i]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } - } else { gl.uniform1f(program.u_opacity, opacity); for (var k = 0; k < bufferGroups.length; k++) { group = bufferGroups[k]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } } - -},{"../source/pixels_to_tile_units":277,"../util/browser":335,"../util/util":349,"./draw_collision_debug":263}],269:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":287,"../util/browser":350,"./draw_collision_debug":271}],277:[function(require,module,exports){ 'use strict'; - module.exports = FrameHistory; - function FrameHistory() { this.changeTimes = new Float64Array(256); this.changeOpacities = new Uint8Array(256); this.opacities = new Uint8ClampedArray(256); this.array = new Uint8Array(this.opacities.buffer); - this.fadeDuration = 300; this.previousZoom = 0; this.firstFrame = true; } - -FrameHistory.prototype.record = function(zoom) { +FrameHistory.prototype.record = function (zoom) { var now = Date.now(); - if (this.firstFrame) { now = 0; this.firstFrame = false; } - zoom = Math.floor(zoom * 10); - var z; if (zoom < this.previousZoom) { for (z = zoom + 1; z <= this.previousZoom; z++) { @@ -47169,7 +50026,6 @@ FrameHistory.prototype.record = function(zoom) { this.changeOpacities[z] = this.opacities[z]; } } - for (z = 0; z < 256; z++) { var timeSince = now - this.changeTimes[z]; var opacityChange = timeSince / this.fadeDuration * 255; @@ -47179,12 +50035,10 @@ FrameHistory.prototype.record = function(zoom) { this.opacities[z] = this.changeOpacities[z] - opacityChange; } } - this.changed = true; this.previousZoom = zoom; }; - -FrameHistory.prototype.bind = function(gl) { +FrameHistory.prototype.bind = function (gl) { if (!this.texture) { this.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.texture); @@ -47193,7 +50047,6 @@ FrameHistory.prototype.bind = function(gl) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, 256, 1, 0, gl.ALPHA, gl.UNSIGNED_BYTE, this.array); - } else { gl.bindTexture(gl.TEXTURE_2D, this.texture); if (this.changed) { @@ -47202,105 +50055,64 @@ FrameHistory.prototype.bind = function(gl) { } } }; - -},{}],270:[function(require,module,exports){ +},{}],278:[function(require,module,exports){ 'use strict'; - +var util = require('../util/util'); module.exports = LineAtlas; - -/** - * A LineAtlas lets us reuse rendered dashed lines - * by writing many of them to a texture and then fetching their positions - * using .getDash. - * - * @param {number} width - * @param {number} height - * @private - */ function LineAtlas(width, height) { this.width = width; this.height = height; this.nextRow = 0; - this.bytes = 4; this.data = new Uint8Array(this.width * this.height * this.bytes); - this.positions = {}; } - -LineAtlas.prototype.setSprite = function(sprite) { +LineAtlas.prototype.setSprite = function (sprite) { this.sprite = sprite; }; - -/** - * Get or create a dash line pattern. - * - * @param {Array} dasharray - * @param {boolean} round whether to add circle caps in between dash segments - * @returns {Object} position of dash texture in { y, height, width } - * @private - */ -LineAtlas.prototype.getDash = function(dasharray, round) { - var key = dasharray.join(",") + round; - +LineAtlas.prototype.getDash = function (dasharray, round) { + var key = dasharray.join(',') + round; if (!this.positions[key]) { this.positions[key] = this.addDash(dasharray, round); } return this.positions[key]; }; - -LineAtlas.prototype.addDash = function(dasharray, round) { - +LineAtlas.prototype.addDash = function (dasharray, round) { var n = round ? 7 : 0; var height = 2 * n + 1; var offset = 128; - if (this.nextRow + height > this.height) { - console.warn('LineAtlas out of space'); + util.warnOnce('LineAtlas out of space'); return null; } - var length = 0; for (var i = 0; i < dasharray.length; i++) { length += dasharray[i]; } - var stretch = this.width / length; var halfWidth = stretch / 2; - - // If dasharray has an odd length, both the first and last parts - // are dashes and should be joined seamlessly. var oddLength = dasharray.length % 2 === 1; - for (var y = -n; y <= n; y++) { var row = this.nextRow + n + y; var index = this.width * row; - var left = oddLength ? -dasharray[dasharray.length - 1] : 0; var right = dasharray[0]; var partIndex = 1; - for (var x = 0; x < this.width; x++) { - while (right < x / stretch) { left = right; right = right + dasharray[partIndex]; - if (oddLength && partIndex === dasharray.length - 1) { right += dasharray[0]; } - partIndex++; } - var distLeft = Math.abs(x - left * stretch); var distRight = Math.abs(x - right * stretch); var dist = Math.min(distLeft, distRight); - var inside = (partIndex % 2) === 1; + var inside = partIndex % 2 === 1; var signedDistance; - if (round) { - // Add circle caps var distMiddle = n ? y / n * (halfWidth + 1) : 0; if (inside) { var distEdge = halfWidth - Math.abs(distMiddle); @@ -47311,24 +50123,19 @@ LineAtlas.prototype.addDash = function(dasharray, round) { } else { signedDistance = (inside ? 1 : -1) * dist; } - this.data[3 + (index + x) * 4] = Math.max(0, Math.min(255, signedDistance + offset)); } } - var pos = { y: (this.nextRow + n + 0.5) / this.height, height: 2 * n / this.height, width: length }; - this.nextRow += height; this.dirty = true; - return pos; }; - -LineAtlas.prototype.bind = function(gl) { +LineAtlas.prototype.bind = function (gl) { if (!this.texture) { this.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.texture); @@ -47337,24 +50144,20 @@ LineAtlas.prototype.bind = function(gl) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.data); - } else { gl.bindTexture(gl.TEXTURE_2D, this.texture); - if (this.dirty) { this.dirty = false; gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, this.height, gl.RGBA, gl.UNSIGNED_BYTE, this.data); } } }; - -},{}],271:[function(require,module,exports){ +},{"../util/util":366}],279:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); var mat4 = require('gl-matrix').mat4; var FrameHistory = require('./frame_history'); -var TilePyramid = require('../source/tile_pyramid'); +var SourceCache = require('../source/source_cache'); var EXTENT = require('../data/bucket').EXTENT; var pixelsToTileUnits = require('../source/pixels_to_tile_units'); var util = require('../util/util'); @@ -47362,71 +50165,43 @@ var StructArrayType = require('../util/struct_array'); var Buffer = require('../data/buffer'); var VertexArrayObject = require('./vertex_array_object'); var RasterBoundsArray = require('./draw_raster').RasterBoundsArray; - +var createUniformPragmas = require('./create_uniform_pragmas'); module.exports = Painter; - -/** - * Initialize a new painter object. - * - * @param {Canvas} gl an experimental-webgl drawing context - * @private - */ function Painter(gl, transform) { this.gl = gl; this.transform = transform; - this.reusableTextures = {}; this.preFbos = {}; - this.frameHistory = new FrameHistory(); - this.setup(); - - // Within each layer there are multiple distinct z-planes that can be drawn to. - // This is implemented using the WebGL depth buffer. - this.numSublayers = TilePyramid.maxUnderzooming + TilePyramid.maxOverzooming + 1; + this.numSublayers = SourceCache.maxUnderzooming + SourceCache.maxOverzooming + 1; this.depthEpsilon = 1 / Math.pow(2, 16); - this.lineWidthRange = gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE); } - util.extend(Painter.prototype, require('./painter/use_program')); - -/* - * Update the GL viewport, projection matrix, and transforms to compensate - * for a new width and height value. - */ -Painter.prototype.resize = function(width, height) { +Painter.prototype.resize = function (width, height) { var gl = this.gl; - this.width = width * browser.devicePixelRatio; this.height = height * browser.devicePixelRatio; gl.viewport(0, 0, this.width, this.height); - }; - -Painter.prototype.setup = function() { +Painter.prototype.setup = function () { var gl = this.gl; - gl.verbose = true; - - // We are blending the new pixels *behind* the existing pixels. That way we can - // draw front-to-back and use then stencil buffer to cull opaque pixels early. gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - gl.enable(gl.STENCIL_TEST); - gl.enable(gl.DEPTH_TEST); gl.depthFunc(gl.LEQUAL); - this._depthMask = false; gl.depthMask(false); - var PosArray = this.PosArray = new StructArrayType({ - members: [{ name: 'a_pos', type: 'Int16', components: 2 }] + members: [{ + name: 'a_pos', + type: 'Int16', + components: 2 + }] }); - var tileExtentArray = new PosArray(); tileExtentArray.emplaceBack(0, 0); tileExtentArray.emplaceBack(EXTENT, 0); @@ -47435,7 +50210,6 @@ Painter.prototype.setup = function() { this.tileExtentBuffer = new Buffer(tileExtentArray.serialize(), PosArray.serialize(), Buffer.BufferType.VERTEX); this.tileExtentVAO = new VertexArrayObject(); this.tileExtentPatternVAO = new VertexArrayObject(); - var debugArray = new PosArray(); debugArray.emplaceBack(0, 0); debugArray.emplaceBack(EXTENT, 0); @@ -47444,7 +50218,6 @@ Painter.prototype.setup = function() { debugArray.emplaceBack(0, 0); this.debugBuffer = new Buffer(debugArray.serialize(), PosArray.serialize(), Buffer.BufferType.VERTEX); this.debugVAO = new VertexArrayObject(); - var rasterBoundsArray = new RasterBoundsArray(); rasterBoundsArray.emplaceBack(0, 0, 0, 0); rasterBoundsArray.emplaceBack(EXTENT, 0, 32767, 0); @@ -47453,80 +50226,67 @@ Painter.prototype.setup = function() { this.rasterBoundsBuffer = new Buffer(rasterBoundsArray.serialize(), RasterBoundsArray.serialize(), Buffer.BufferType.VERTEX); this.rasterBoundsVAO = new VertexArrayObject(); }; - -/* - * Reset the color buffers of the drawing canvas. - */ -Painter.prototype.clearColor = function() { +Painter.prototype.clearColor = function () { var gl = this.gl; gl.clearColor(0, 0, 0, 0); gl.clear(gl.COLOR_BUFFER_BIT); }; - -/* - * Reset the drawing canvas by clearing the stencil buffer so that we can draw - * new tiles at the same location, while retaining previously drawn pixels. - */ -Painter.prototype.clearStencil = function() { +Painter.prototype.clearStencil = function () { var gl = this.gl; - gl.clearStencil(0x0); - gl.stencilMask(0xFF); + gl.clearStencil(0); + gl.stencilMask(255); gl.clear(gl.STENCIL_BUFFER_BIT); }; - -Painter.prototype.clearDepth = function() { +Painter.prototype.clearDepth = function () { var gl = this.gl; gl.clearDepth(1); this.depthMask(true); gl.clear(gl.DEPTH_BUFFER_BIT); }; - -Painter.prototype._renderTileClippingMasks = function(coords) { +Painter.prototype._renderTileClippingMasks = function (coords) { var gl = this.gl; gl.colorMask(false, false, false, false); this.depthMask(false); gl.disable(gl.DEPTH_TEST); gl.enable(gl.STENCIL_TEST); - - // Only write clipping IDs to the last 5 bits. The first three are used for drawing fills. - gl.stencilMask(0xF8); - // Tests will always pass, and ref value will be written to stencil buffer. + gl.stencilMask(248); gl.stencilOp(gl.KEEP, gl.KEEP, gl.REPLACE); - var idNext = 1; this._tileClippingMaskIDs = {}; for (var i = 0; i < coords.length; i++) { var coord = coords[i]; - var id = this._tileClippingMaskIDs[coord.id] = (idNext++) << 3; - - gl.stencilFunc(gl.ALWAYS, id, 0xF8); - - var program = this.useProgram('fill'); + var id = this._tileClippingMaskIDs[coord.id] = idNext++ << 3; + gl.stencilFunc(gl.ALWAYS, id, 248); + var pragmas = createUniformPragmas([ + { + name: 'u_color', + components: 4 + }, + { + name: 'u_opacity', + components: 1 + } + ]); + var program = this.useProgram('fill', [], pragmas, pragmas); gl.uniformMatrix4fv(program.u_matrix, false, coord.posMatrix); - - // Draw the clipping mask this.tileExtentVAO.bind(gl, program, this.tileExtentBuffer); gl.drawArrays(gl.TRIANGLE_STRIP, 0, this.tileExtentBuffer.length); } - - gl.stencilMask(0x00); + gl.stencilMask(0); gl.colorMask(true, true, true, true); this.depthMask(true); gl.enable(gl.DEPTH_TEST); }; - -Painter.prototype.enableTileClippingMask = function(coord) { +Painter.prototype.enableTileClippingMask = function (coord) { var gl = this.gl; - gl.stencilFunc(gl.EQUAL, this._tileClippingMaskIDs[coord.id], 0xF8); + gl.stencilFunc(gl.EQUAL, this._tileClippingMaskIDs[coord.id], 248); }; - -// Overridden by headless tests. -Painter.prototype.prepareBuffers = function() {}; -Painter.prototype.bindDefaultFramebuffer = function() { +Painter.prototype.prepareBuffers = function () { +}; +Painter.prototype.bindDefaultFramebuffer = function () { var gl = this.gl; gl.bindFramebuffer(gl.FRAMEBUFFER, null); }; - var draw = { symbol: require('./draw_symbol'), circle: require('./draw_circle'), @@ -47536,41 +50296,29 @@ var draw = { background: require('./draw_background'), debug: require('./draw_debug') }; - -Painter.prototype.render = function(style, options) { +Painter.prototype.render = function (style, options) { this.style = style; this.options = options; - this.lineAtlas = style.lineAtlas; - this.spriteAtlas = style.spriteAtlas; this.spriteAtlas.setSprite(style.sprite); - this.glyphSource = style.glyphSource; - this.frameHistory.record(this.transform.zoom); - this.prepareBuffers(); this.clearColor(); this.clearDepth(); - this.showOverdrawInspector(options.showOverdrawInspector); - this.depthRange = (style._order.length + 2) * this.numSublayers * this.depthEpsilon; - - this.renderPass({isOpaquePass: true}); - this.renderPass({isOpaquePass: false}); + this.renderPass({ isOpaquePass: true }); + this.renderPass({ isOpaquePass: false }); }; - -Painter.prototype.renderPass = function(options) { +Painter.prototype.renderPass = function (options) { var groups = this.style._groups; var isOpaquePass = options.isOpaquePass; this.currentLayer = isOpaquePass ? this.style._order.length : -1; - for (var i = 0; i < groups.length; i++) { var group = groups[isOpaquePass ? groups.length - 1 - i : i]; var source = this.style.sources[group.source]; - var j; var coords = []; if (source) { @@ -47579,12 +50327,12 @@ Painter.prototype.renderPass = function(options) { coords[j].posMatrix = this.transform.calculatePosMatrix(coords[j], source.maxzoom); } this.clearStencil(); - if (source.prepare) source.prepare(); + if (source.prepare) + source.prepare(); if (source.isTileClipped) { this._renderTileClippingMasks(coords); } } - if (isOpaquePass) { if (!this._showOverdrawInspector) { this.gl.disable(this.gl.BLEND); @@ -47595,42 +50343,38 @@ Painter.prototype.renderPass = function(options) { this.isOpaquePass = false; coords.reverse(); } - for (j = 0; j < group.length; j++) { var layer = group[isOpaquePass ? group.length - 1 - j : j]; this.currentLayer += isOpaquePass ? -1 : 1; this.renderLayer(this, source, layer, coords); } - if (source) { draw.debug(this, source, coords); } } }; - -Painter.prototype.depthMask = function(mask) { +Painter.prototype.depthMask = function (mask) { if (mask !== this._depthMask) { this._depthMask = mask; this.gl.depthMask(mask); } }; - -Painter.prototype.renderLayer = function(painter, source, layer, coords) { - if (layer.isHidden(this.transform.zoom)) return; - if (layer.type !== 'background' && !coords.length) return; +Painter.prototype.renderLayer = function (painter, source, layer, coords) { + if (layer.isHidden(this.transform.zoom)) + return; + if (layer.type !== 'background' && !coords.length) + return; this.id = layer.id; draw[layer.type](painter, source, layer, coords); }; - -Painter.prototype.setDepthSublayer = function(n) { +Painter.prototype.setDepthSublayer = function (n) { var farDepth = 1 - ((1 + this.currentLayer) * this.numSublayers + n) * this.depthEpsilon; var nearDepth = farDepth - 1 + this.depthRange; this.gl.depthRange(nearDepth, farDepth); }; - -Painter.prototype.translatePosMatrix = function(matrix, tile, translate, anchor) { - if (!translate[0] && !translate[1]) return matrix; - +Painter.prototype.translatePosMatrix = function (matrix, tile, translate, anchor) { + if (!translate[0] && !translate[1]) + return matrix; if (anchor === 'viewport') { var sinA = Math.sin(-this.transform.angle); var cosA = Math.cos(-this.transform.angle); @@ -47639,19 +50383,16 @@ Painter.prototype.translatePosMatrix = function(matrix, tile, translate, anchor) translate[0] * sinA + translate[1] * cosA ]; } - var translation = [ pixelsToTileUnits(tile, translate[0], this.transform.zoom), pixelsToTileUnits(tile, translate[1], this.transform.zoom), 0 ]; - var translatedMatrix = new Float32Array(16); mat4.translate(translatedMatrix, matrix, translation); return translatedMatrix; }; - -Painter.prototype.saveTexture = function(texture) { +Painter.prototype.saveTexture = function (texture) { var textures = this.reusableTextures[texture.size]; if (!textures) { this.reusableTextures[texture.size] = [texture]; @@ -47659,21 +50400,17 @@ Painter.prototype.saveTexture = function(texture) { textures.push(texture); } }; - - -Painter.prototype.getTexture = function(size) { +Painter.prototype.getTexture = function (size) { var textures = this.reusableTextures[size]; return textures && textures.length > 0 ? textures.pop() : null; }; - -Painter.prototype.lineWidth = function(width) { +Painter.prototype.lineWidth = function (width) { this.gl.lineWidth(util.clamp(width, this.lineWidthRange[0], this.lineWidthRange[1])); }; - -Painter.prototype.showOverdrawInspector = function(enabled) { - if (!enabled && !this._showOverdrawInspector) return; +Painter.prototype.showOverdrawInspector = function (enabled) { + if (!enabled && !this._showOverdrawInspector) + return; this._showOverdrawInspector = enabled; - var gl = this.gl; if (enabled) { gl.blendFunc(gl.CONSTANT_COLOR, gl.ONE); @@ -47686,112 +50423,40 @@ Painter.prototype.showOverdrawInspector = function(enabled) { gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); } }; - -},{"../data/bucket":247,"../data/buffer":252,"../source/pixels_to_tile_units":277,"../source/tile_pyramid":282,"../util/browser":335,"../util/struct_array":347,"../util/util":349,"./draw_background":261,"./draw_circle":262,"./draw_debug":264,"./draw_fill":265,"./draw_line":266,"./draw_raster":267,"./draw_symbol":268,"./frame_history":269,"./painter/use_program":272,"./vertex_array_object":273,"gl-matrix":363}],272:[function(require,module,exports){ +},{"../data/bucket":253,"../data/buffer":258,"../source/pixels_to_tile_units":287,"../source/source_cache":291,"../util/browser":350,"../util/struct_array":364,"../util/util":366,"./create_uniform_pragmas":268,"./draw_background":269,"./draw_circle":270,"./draw_debug":272,"./draw_fill":273,"./draw_line":274,"./draw_raster":275,"./draw_symbol":276,"./frame_history":277,"./painter/use_program":280,"./vertex_array_object":281,"gl-matrix":382}],280:[function(require,module,exports){ 'use strict'; - - -var path = require('path'); -var assert = require('assert'); var util = require('../../util/util'); - -// readFileSync calls must be written out long-form for brfs. -var definitions = { - debug: { - fragmentSource: "precision mediump float;\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n" - }, - fill: { - fragmentSource: "precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvoid main() {\n gl_FragColor = u_color * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n" - }, - circle: { - fragmentSource: "precision mediump float;\n\nuniform lowp float u_blur;\nuniform lowp float u_opacity;\n\nvarying lowp vec4 v_color;\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n float t = smoothstep(1.0 - max(u_blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = v_color * (1.0 - t) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#ifdef ATTRIBUTE_A_COLOR\nattribute lowp vec4 a_color;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\nuniform lowp float u_color_t;\nattribute lowp vec4 a_color0;\nattribute lowp vec4 a_color1;\nattribute lowp vec4 a_color2;\nattribute lowp vec4 a_color3;\n#else\nuniform lowp vec4 a_color;\n#endif\n\n#ifdef ATTRIBUTE_A_RADIUS\nattribute mediump float a_radius;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\nuniform lowp float u_radius_t;\nattribute mediump vec4 a_radius;\n#else\nuniform mediump float a_radius;\n#endif\n\nvarying vec2 v_extrude;\nvarying lowp vec4 v_color;\nvarying lowp float v_antialiasblur;\n\nfloat evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\n\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n\nvoid main(void) {\n\n#ifdef ATTRIBUTE_A_RADIUS\n mediump float radius = a_radius / 10.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\n mediump float radius = evaluate_zoom_function_1(a_radius, u_radius_t) / 10.0;\n#else\n mediump float radius = a_radius;\n#endif\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n // gl_Position is divided by gl_Position.w after this shader runs.\n // Multiply the extrude by it so that it isn't affected by it.\n gl_Position.xy += extrude * gl_Position.w;\n\n#ifdef ATTRIBUTE_A_COLOR\n v_color = a_color / 255.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\n v_color = evaluate_zoom_function_4(a_color0, a_color1, a_color2, a_color3, u_color_t) / 255.0;\n#else\n v_color = a_color;\n#endif\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n" - }, - line: { - fragmentSource: "precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" - }, - linepattern: { - fragmentSource: "precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform float u_point;\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_b.y);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos), texture2D(u_image, pos2), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 extrude = a_extrude * scale;\n mediump vec2 dist = u_linewidth.s * extrude;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" - }, - linesdfpattern: { - fragmentSource: "precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump vec2 u_linewidth;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" - }, - outline: { - fragmentSource: "precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" - }, - outlinepattern: { - fragmentSource: "precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" - }, - pattern: { - fragmentSource: "precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n}\n" - }, - raster: { - fragmentSource: "precision mediump float;\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n" - }, - icon: { - fragmentSource: "precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" - }, - sdf: { - fragmentSource: "precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - y * u_extra);\n v_gamma_scale = perspective_scale;\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" - }, - collisionbox: { - fragmentSource: "precision mediump float;\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n" - } -}; - -module.exports._createProgram = function(name, macros) { +var shaders = require('mapbox-gl-shaders'); +var utilSource = shaders.util; +module.exports._createProgram = function (name, defines, vertexPragmas, fragmentPragmas) { var gl = this.gl; var program = gl.createProgram(); - var definition = definitions[name]; - - var defines = ''; - if (macros) { - for (var m = 0; m < macros.length; m++) { - defines += '#define ' + macros[m] + '\n'; - } + var definition = shaders[name]; + var definesSource = '#define MAPBOX_GL_JS;\n'; + for (var j = 0; j < defines.length; j++) { + definesSource += '#define ' + defines[j] + ';\n'; } - var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); - gl.shaderSource(fragmentShader, defines + definition.fragmentSource); + gl.shaderSource(fragmentShader, applyPragmas(definesSource + definition.fragmentSource, fragmentPragmas)); gl.compileShader(fragmentShader); - assert(gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS), gl.getShaderInfoLog(fragmentShader)); gl.attachShader(program, fragmentShader); - var vertexShader = gl.createShader(gl.VERTEX_SHADER); - gl.shaderSource(vertexShader, defines + definition.vertexSource); + gl.shaderSource(vertexShader, applyPragmas(definesSource + utilSource + definition.vertexSource, vertexPragmas)); gl.compileShader(vertexShader); - assert(gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS), gl.getShaderInfoLog(vertexShader)); gl.attachShader(program, vertexShader); - gl.linkProgram(program); - assert(gl.getProgramParameter(program, gl.LINK_STATUS), gl.getProgramInfoLog(program)); - var attributes = {}; var numAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); for (var i = 0; i < numAttributes; i++) { var attribute = gl.getActiveAttrib(program, i); - attributes[attribute.name] = i; + attributes[attribute.name] = gl.getAttribLocation(program, attribute.name); } - var uniforms = {}; var numUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); for (var ui = 0; ui < numUniforms; ui++) { var uniform = gl.getActiveUniform(program, ui); uniforms[uniform.name] = gl.getUniformLocation(program, uniform.name); } - return util.extend({ program: program, definition: definition, @@ -47799,41 +50464,41 @@ module.exports._createProgram = function(name, macros) { numAttributes: numAttributes }, attributes, uniforms); }; - -module.exports._createProgramCached = function(name, macros) { +module.exports._createProgramCached = function (name, defines, vertexPragmas, fragmentPragmas) { this.cache = this.cache || {}; - if (this._showOverdrawInspector) { - macros = macros || []; - macros.push('OVERDRAW_INSPECTOR'); - } - var key = JSON.stringify({name: name, macros: macros}); + var key = JSON.stringify({ + name: name, + defines: defines, + vertexPragmas: vertexPragmas, + fragmentPragmas: fragmentPragmas + }); if (!this.cache[key]) { - this.cache[key] = this._createProgram(name, macros); + this.cache[key] = this._createProgram(name, defines, vertexPragmas, fragmentPragmas); } return this.cache[key]; }; - -module.exports.useProgram = function (nextProgramName, macros) { +module.exports.useProgram = function (nextProgramName, defines, vertexPragmas, fragmentPragmas) { var gl = this.gl; - - var nextProgram = this._createProgramCached(nextProgramName, macros); + defines = defines || []; + if (this._showOverdrawInspector) { + defines = defines.concat('OVERDRAW_INSPECTOR'); + } + var nextProgram = this._createProgramCached(nextProgramName, defines, vertexPragmas, fragmentPragmas); var previousProgram = this.currentProgram; - if (previousProgram !== nextProgram) { gl.useProgram(nextProgram.program); this.currentProgram = nextProgram; } - return nextProgram; }; - -},{"../../util/util":349,"assert":52,"path":59}],273:[function(require,module,exports){ +function applyPragmas(source, pragmas) { + return source.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, function (match, operation, precision, type, name) { + return pragmas[operation][name].replace(/{type}/g, type).replace(/{precision}/g, precision); + }); +} +},{"../../util/util":366,"mapbox-gl-shaders":394}],281:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); - module.exports = VertexArrayObject; - function VertexArrayObject() { this.boundProgram = null; this.boundVertexBuffer = null; @@ -47841,262 +50506,141 @@ function VertexArrayObject() { this.boundElementBuffer = null; this.vao = null; } - -var reported = false; - -VertexArrayObject.prototype.bind = function(gl, program, vertexBuffer, elementBuffer, vertexBuffer2) { - - var ext = gl.extVertexArrayObject; - if (ext === undefined) { - ext = gl.extVertexArrayObject = gl.getExtension("OES_vertex_array_object"); - } - - if (ext) { - if (!this.vao) this.vao = ext.createVertexArrayOES(); - ext.bindVertexArrayOES(this.vao); - } else if (!reported) { - console.warn('Not using VertexArrayObject extension.'); - reported = true; +VertexArrayObject.prototype.bind = function (gl, program, layoutVertexBuffer, elementBuffer, vertexBuffer2) { + if (gl.extVertexArrayObject === undefined) { + gl.extVertexArrayObject = gl.getExtension('OES_vertex_array_object'); } - - if (!this.boundProgram) { - - var numPrevAttributes = ext ? 0 : (gl.currentNumAttributes || 0); - var numNextAttributes = program.numAttributes; - var i; - - // Enable all attributes for the new program. - for (i = numPrevAttributes; i < numNextAttributes; i++) { - gl.enableVertexAttribArray(i); - } - - if (!ext) { - // Disable all attributes from the previous program that aren't used in - // the new program. Note: attribute indices are *not* program specific! - // WebGL breaks if you disable attribute 0. http://stackoverflow.com/questions/20305231 - assert(i > 0); - for (i = numNextAttributes; i < numPrevAttributes; i++) { - gl.disableVertexAttribArray(i); - } - gl.currentNumAttributes = numNextAttributes; - } - - vertexBuffer.bind(gl); - vertexBuffer.setVertexAttribPointers(gl, program); - if (vertexBuffer2) { - vertexBuffer2.bind(gl); - vertexBuffer2.setVertexAttribPointers(gl, program); - } - if (elementBuffer) { - elementBuffer.bind(gl); - } - - if (ext) { - // store the arguments so that we can verify them when the vao is bound again - this.boundProgram = program; - this.boundVertexBuffer = vertexBuffer; - this.boundVertexBuffer2 = vertexBuffer2; - this.boundElementBuffer = elementBuffer; - } - + var isFreshBindRequired = !this.vao || this.boundProgram !== program || this.boundVertexBuffer !== layoutVertexBuffer || this.boundVertexBuffer2 !== vertexBuffer2 || this.boundElementBuffer !== elementBuffer; + if (!gl.extVertexArrayObject || isFreshBindRequired) { + this.freshBind(gl, program, layoutVertexBuffer, elementBuffer, vertexBuffer2); } else { - // verify that bind was called with the same arguments - assert(this.boundProgram === program, 'trying to bind a VAO to a different shader'); - assert(this.boundVertexBuffer === vertexBuffer, 'trying to bind a VAO to a different vertex buffer'); - assert(this.boundVertexBuffer2 === vertexBuffer2, 'trying to bind a VAO to a different vertex buffer'); - assert(this.boundElementBuffer === elementBuffer, 'trying to bind a VAO to a different element buffer'); + gl.extVertexArrayObject.bindVertexArrayOES(this.vao); + } +}; +VertexArrayObject.prototype.freshBind = function (gl, program, layoutVertexBuffer, elementBuffer, vertexBuffer2) { + var numPrevAttributes; + var numNextAttributes = program.numAttributes; + if (gl.extVertexArrayObject) { + if (this.vao) + this.destroy(gl); + this.vao = gl.extVertexArrayObject.createVertexArrayOES(); + gl.extVertexArrayObject.bindVertexArrayOES(this.vao); + numPrevAttributes = 0; + this.boundProgram = program; + this.boundVertexBuffer = layoutVertexBuffer; + this.boundVertexBuffer2 = vertexBuffer2; + this.boundElementBuffer = elementBuffer; + } else { + numPrevAttributes = gl.currentNumAttributes || 0; + for (var i = numNextAttributes; i < numPrevAttributes; i++) { + gl.disableVertexAttribArray(i); + } + } + for (var j = numPrevAttributes; j < numNextAttributes; j++) { + gl.enableVertexAttribArray(j); + } + layoutVertexBuffer.bind(gl); + layoutVertexBuffer.setVertexAttribPointers(gl, program); + if (vertexBuffer2) { + vertexBuffer2.bind(gl); + vertexBuffer2.setVertexAttribPointers(gl, program); } + if (elementBuffer) { + elementBuffer.bind(gl); + } + gl.currentNumAttributes = numNextAttributes; }; - -VertexArrayObject.prototype.unbind = function(gl) { +VertexArrayObject.prototype.unbind = function (gl) { var ext = gl.extVertexArrayObject; if (ext) { ext.bindVertexArrayOES(null); } }; - -VertexArrayObject.prototype.destroy = function(gl) { +VertexArrayObject.prototype.destroy = function (gl) { var ext = gl.extVertexArrayObject; if (ext && this.vao) { ext.deleteVertexArrayOES(this.vao); this.vao = null; } -}; - -},{"assert":52}],274:[function(require,module,exports){ -'use strict'; - -var util = require('../util/util'); -var Evented = require('../util/evented'); -var TilePyramid = require('./tile_pyramid'); -var Source = require('./source'); -var urlResolve = require('resolve-url'); -var EXTENT = require('../data/bucket').EXTENT; - -module.exports = GeoJSONSource; - -/** - * Create a GeoJSON data source instance given an options object - * @class GeoJSONSource - * @param {Object} [options] - * @param {Object|string} options.data A GeoJSON data object or URL to it. The latter is preferable in case of large GeoJSON files. - * @param {number} [options.maxzoom=18] Maximum zoom to preserve detail at. - * @param {number} [options.buffer] Tile buffer on each side in pixels. - * @param {number} [options.tolerance] Simplification tolerance (higher means simpler) in pixels. - * @param {number} [options.cluster] If the data is a collection of point features, setting this to true clusters the points by radius into groups. - * @param {number} [options.clusterRadius=50] Radius of each cluster when clustering points, in pixels. - * @param {number} [options.clusterMaxZoom] Max zoom to cluster points on. Defaults to one zoom less than `maxzoom` (so that last zoom features are not clustered). - - * @example - * var sourceObj = new mapboxgl.GeoJSONSource({ - * data: { - * "type": "FeatureCollection", - * "features": [{ - * "type": "Feature", - * "geometry": { - * "type": "Point", - * "coordinates": [ - * -76.53063297271729, - * 39.18174077994108 - * ] - * } - * }] - * } - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -function GeoJSONSource(options) { - options = options || {}; - - this._data = options.data; - - if (options.maxzoom !== undefined) this.maxzoom = options.maxzoom; - - var scale = EXTENT / this.tileSize; - - this.geojsonVtOptions = { - buffer: (options.buffer !== undefined ? options.buffer : 128) * scale, - tolerance: (options.tolerance !== undefined ? options.tolerance : 0.375) * scale, - extent: EXTENT, - maxZoom: this.maxzoom - }; - - this.cluster = options.cluster || false; - this.superclusterOptions = { - maxZoom: Math.min(options.clusterMaxZoom, this.maxzoom - 1) || (this.maxzoom - 1), - extent: EXTENT, - radius: (options.clusterRadius || 50) * scale, - log: false - }; - - this._pyramid = new TilePyramid({ - tileSize: this.tileSize, - minzoom: this.minzoom, - maxzoom: this.maxzoom, - reparseOverscaled: true, - load: this._loadTile.bind(this), - abort: this._abortTile.bind(this), - unload: this._unloadTile.bind(this), - add: this._addTile.bind(this), - remove: this._removeTile.bind(this), - redoPlacement: this._redoTilePlacement.bind(this) - }); -} - -GeoJSONSource.prototype = util.inherit(Evented, /** @lends GeoJSONSource.prototype */{ - minzoom: 0, - maxzoom: 18, - tileSize: 512, - _dirty: true, - isTileClipped: true, - - /** - * Update source geojson data and rerender map - * - * @param {Object|string} data A GeoJSON data object or URL to it. The latter is preferable in case of large GeoJSON files. - * @returns {GeoJSONSource} this - */ - setData: function(data) { - this._data = data; - this._dirty = true; - - this.fire('change'); - - if (this.map) - this.update(this.map.transform); - - return this; - }, - - onAdd: function(map) { - this.map = map; - }, - - loaded: function() { - return this._loaded && this._pyramid.loaded(); - }, - - update: function(transform) { - if (this._dirty) { - this._updateData(); - } - - if (this._loaded) { - this._pyramid.update(this.used, transform); - } - }, - - reload: function() { - if (this._loaded) { - this._pyramid.reload(); +}; +},{}],282:[function(require,module,exports){ +'use strict'; +var Evented = require('../util/evented'); +var util = require('../util/util'); +var urlResolve = require('resolve-url'); +var EXTENT = require('../data/bucket').EXTENT; +module.exports = GeoJSONSource; +function GeoJSONSource(id, options, dispatcher) { + options = options || {}; + this.id = id; + this.dispatcher = dispatcher; + this._data = options.data; + if (options.maxzoom !== undefined) + this.maxzoom = options.maxzoom; + if (options.type) + this.type = options.type; + var scale = EXTENT / this.tileSize; + this.workerOptions = util.extend({ + source: this.id, + cluster: options.cluster || false, + geojsonVtOptions: { + buffer: (options.buffer !== undefined ? options.buffer : 128) * scale, + tolerance: (options.tolerance !== undefined ? options.tolerance : 0.375) * scale, + extent: EXTENT, + maxZoom: this.maxzoom + }, + superclusterOptions: { + maxZoom: Math.min(options.clusterMaxZoom, this.maxzoom - 1) || this.maxzoom - 1, + extent: EXTENT, + radius: (options.clusterRadius || 50) * scale, + log: false + } + }, options.workerOptions); + this._updateWorkerData(function done(err) { + if (err) { + this.fire('error', { error: err }); + return; } + this.fire('load'); + }.bind(this)); +} +GeoJSONSource.prototype = util.inherit(Evented, { + type: 'geojson', + minzoom: 0, + maxzoom: 18, + tileSize: 512, + isTileClipped: true, + reparseOverscaled: true, + onAdd: function (map) { + this.map = map; }, - - serialize: function() { - return { - type: 'geojson', - data: this._data - }; + setData: function (data) { + this._data = data; + this._updateWorkerData(function (err) { + if (err) { + return this.fire('error', { error: err }); + } + this.fire('change'); + }.bind(this)); + return this; }, - - getVisibleCoordinates: Source._getVisibleCoordinates, - getTile: Source._getTile, - - queryRenderedFeatures: Source._queryRenderedVectorFeatures, - querySourceFeatures: Source._querySourceFeatures, - - _updateData: function() { - this._dirty = false; - var options = { - tileSize: this.tileSize, - source: this.id, - geojsonVtOptions: this.geojsonVtOptions, - cluster: this.cluster, - superclusterOptions: this.superclusterOptions - }; - + _updateWorkerData: function (callback) { + var options = util.extend({}, this.workerOptions); var data = this._data; if (typeof data === 'string') { options.url = typeof window != 'undefined' ? urlResolve(window.location.href, data) : data; } else { options.data = JSON.stringify(data); } - this.workerID = this.dispatcher.send('parse geojson', options, function(err) { + this.workerID = this.dispatcher.send(this.type + '.loadData', options, function (err) { this._loaded = true; - if (err) { - this.fire('error', {error: err}); - } else { - this._pyramid.reload(); - this.fire('change'); - } - + callback(err); }.bind(this)); }, - - _loadTile: function(tile) { + loadTile: function (tile, callback) { var overscaling = tile.coord.z > this.maxzoom ? Math.pow(2, tile.coord.z - this.maxzoom) : 1; var params = { + type: this.type, uid: tile.uid, coord: tile.coord, zoom: tile.coord.z, @@ -48108,89 +50652,153 @@ GeoJSONSource.prototype = util.inherit(Evented, /** @lends GeoJSONSource.prototy pitch: this.map.transform.pitch, showCollisionBoxes: this.map.showCollisionBoxes }; - - tile.workerID = this.dispatcher.send('load geojson tile', params, function(err, data) { - + tile.workerID = this.dispatcher.send('load tile', params, function (err, data) { tile.unloadVectorData(this.map.painter); - if (tile.aborted) return; - if (err) { - this.fire('tile.error', {tile: tile}); - return; + return callback(err); } - tile.loadVectorData(data, this.map.style); - if (tile.redoWhenDone) { tile.redoWhenDone = false; tile.redoPlacement(this); } - - this.fire('tile.load', {tile: tile}); - + return callback(null); }.bind(this), this.workerID); }, - - _abortTile: function(tile) { + abortTile: function (tile) { tile.aborted = true; }, - - _addTile: function(tile) { - this.fire('tile.add', {tile: tile}); + unloadTile: function (tile) { + tile.unloadVectorData(this.map.painter); + this.dispatcher.send('remove tile', { + uid: tile.uid, + source: this.id + }, function () { + }, tile.workerID); }, - - _removeTile: function(tile) { - this.fire('tile.remove', {tile: tile}); + serialize: function () { + return { + type: this.type, + data: this._data + }; + } +}); +},{"../data/bucket":253,"../util/evented":358,"../util/util":366,"resolve-url":426}],283:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var ajax = require('../util/ajax'); +var rewind = require('geojson-rewind'); +var GeoJSONWrapper = require('./geojson_wrapper'); +var vtpbf = require('vt-pbf'); +var supercluster = require('supercluster'); +var geojsonvt = require('geojson-vt'); +var VectorTileWorkerSource = require('./vector_tile_worker_source'); +module.exports = GeoJSONWorkerSource; +function GeoJSONWorkerSource(actor, styleLayers, loadGeoJSON) { + if (loadGeoJSON) { + this.loadGeoJSON = loadGeoJSON; + } + VectorTileWorkerSource.call(this, actor, styleLayers); +} +GeoJSONWorkerSource.prototype = util.inherit(VectorTileWorkerSource, { + _geoJSONIndexes: {}, + loadVectorData: function (params, callback) { + var source = params.source, coord = params.coord; + if (!this._geoJSONIndexes[source]) + return callback(null, null); + var geoJSONTile = this._geoJSONIndexes[source].getTile(Math.min(coord.z, params.maxZoom), coord.x, coord.y); + if (geoJSONTile) { + var geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features); + geojsonWrapper.name = '_geojsonTileLayer'; + var pbf = vtpbf({ layers: { '_geojsonTileLayer': geojsonWrapper } }); + if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) { + pbf = new Uint8Array(pbf); + } + callback(null, { + tile: geojsonWrapper, + rawTileData: pbf.buffer + }); + } else { + return callback(null, null); + } }, - - _unloadTile: function(tile) { - tile.unloadVectorData(this.map.painter); - this.dispatcher.send('remove tile', { uid: tile.uid, source: this.id }, null, tile.workerID); + loadData: function (params, callback) { + var handleData = function (err, data) { + if (err) + return callback(err); + if (typeof data != 'object') { + return callback(new Error('Input data is not a valid GeoJSON object.')); + } + rewind(data, true); + this._indexData(data, params, function (err, indexed) { + if (err) { + return callback(err); + } + this._geoJSONIndexes[params.source] = indexed; + callback(null); + }.bind(this)); + }.bind(this); + this.loadGeoJSON(params, handleData); }, - - redoPlacement: Source.redoPlacement, - - _redoTilePlacement: function(tile) { - tile.redoPlacement(this); + loadGeoJSON: function (params, callback) { + if (params.url) { + ajax.getJSON(params.url, callback); + } else if (typeof params.data === 'string') { + try { + return callback(null, JSON.parse(params.data)); + } catch (e) { + return callback(new Error('Input data is not a valid GeoJSON object.')); + } + } else { + return callback(new Error('Input data is not a valid GeoJSON object.')); + } + }, + _indexData: function (data, params, callback) { + try { + if (params.cluster) { + callback(null, supercluster(params.superclusterOptions).load(data.features)); + } else { + callback(null, geojsonvt(data, params.geojsonVtOptions)); + } + } catch (err) { + return callback(err); + } } }); - -},{"../data/bucket":247,"../util/evented":341,"../util/util":349,"./source":279,"./tile_pyramid":282,"resolve-url":405}],275:[function(require,module,exports){ +},{"../util/ajax":349,"../util/util":366,"./geojson_wrapper":284,"./vector_tile_worker_source":295,"geojson-rewind":371,"geojson-vt":377,"supercluster":428,"vt-pbf":438}],284:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); var VectorTileFeature = require('vector-tile').VectorTileFeature; var EXTENT = require('../data/bucket').EXTENT; - module.exports = GeoJSONWrapper; - -// conform to vectortile api function GeoJSONWrapper(features) { this.features = features; this.length = features.length; this.extent = EXTENT; } - -GeoJSONWrapper.prototype.feature = function(i) { +GeoJSONWrapper.prototype.feature = function (i) { return new FeatureWrapper(this.features[i]); }; - function FeatureWrapper(feature) { this.type = feature.type; - this.rawGeometry = feature.type === 1 ? [feature.geometry] : feature.geometry; + if (feature.type === 1) { + this.rawGeometry = []; + for (var i = 0; i < feature.geometry.length; i++) { + this.rawGeometry.push([feature.geometry[i]]); + } + } else { + this.rawGeometry = feature.geometry; + } this.properties = feature.tags; this.extent = EXTENT; } - -FeatureWrapper.prototype.loadGeometry = function() { +FeatureWrapper.prototype.loadGeometry = function () { var rings = this.rawGeometry; this.geometry = []; - for (var i = 0; i < rings.length; i++) { - var ring = rings[i], - newRing = []; + var ring = rings[i], newRing = []; for (var j = 0; j < ring.length; j++) { newRing.push(new Point(ring[j][0], ring[j][1])); } @@ -48198,39 +50806,31 @@ FeatureWrapper.prototype.loadGeometry = function() { } return this.geometry; }; - -FeatureWrapper.prototype.bbox = function() { - if (!this.geometry) this.loadGeometry(); - - var rings = this.geometry, - x1 = Infinity, - x2 = -Infinity, - y1 = Infinity, - y2 = -Infinity; - +FeatureWrapper.prototype.bbox = function () { + if (!this.geometry) + this.loadGeometry(); + var rings = this.geometry, x1 = Infinity, x2 = -Infinity, y1 = Infinity, y2 = -Infinity; for (var i = 0; i < rings.length; i++) { var ring = rings[i]; - for (var j = 0; j < ring.length; j++) { var coord = ring[j]; - x1 = Math.min(x1, coord.x); x2 = Math.max(x2, coord.x); y1 = Math.min(y1, coord.y); y2 = Math.max(y2, coord.y); } } - - return [x1, y1, x2, y2]; + return [ + x1, + y1, + x2, + y2 + ]; }; - FeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON; - -},{"../data/bucket":247,"point-geometry":404,"vector-tile":413}],276:[function(require,module,exports){ +},{"../data/bucket":253,"point-geometry":424,"vector-tile":434}],285:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); -var Tile = require('./tile'); var TileCoord = require('./tile_coord'); var LngLat = require('../geo/lng_lat'); var Point = require('point-geometry'); @@ -48240,1035 +50840,463 @@ var EXTENT = require('../data/bucket').EXTENT; var RasterBoundsArray = require('../render/draw_raster').RasterBoundsArray; var Buffer = require('../data/buffer'); var VertexArrayObject = require('../render/vertex_array_object'); - module.exports = ImageSource; - -/** - * Create an Image source instance given an options object - * @class ImageSource - * @param {Object} [options] - * @param {string} options.url A string URL of an image file - * @param {Array} options.coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the image. Does not have to be a rectangle. - * @example - * var sourceObj = new mapboxgl.ImageSource({ - * url: 'https://www.mapbox.com/images/foo.png', - * coordinates: [ - * [-76.54335737228394, 39.18579907229748], - * [-76.52803659439087, 39.1838364847587], - * [-76.5295386314392, 39.17683392507606], - * [-76.54520273208618, 39.17876344106642] - * ] - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -function ImageSource(options) { - this.urls = options.urls; +function ImageSource(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + this.url = options.url; this.coordinates = options.coordinates; - - ajax.getImage(options.url, function(err, image) { - // @TODO handle errors via event. - if (err) return; - + ajax.getImage(options.url, function (err, image) { + if (err) + return this.fire('error', { error: err }); this.image = image; - - this.image.addEventListener('load', function() { + this.image.addEventListener('load', function () { this.map._rerender(); }.bind(this)); - this._loaded = true; - + this.fire('load'); if (this.map) { this.setCoordinates(options.coordinates); } }.bind(this)); } - -ImageSource.prototype = util.inherit(Evented, /** @lends ImageSource.prototype */ { - onAdd: function(map) { +ImageSource.prototype = util.inherit(Evented, { + minzoom: 0, + maxzoom: 22, + tileSize: 512, + onAdd: function (map) { this.map = map; if (this.image) { this.setCoordinates(this.coordinates); } }, - - /** - * Update image coordinates and rerender map - * - * @param {Array} coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the image. Does not have to be a rectangle. - * @returns {ImageSource} this - */ - setCoordinates: function(coordinates) { + setCoordinates: function (coordinates) { this.coordinates = coordinates; - - // Calculate which mercator tile is suitable for rendering the image in - // and create a buffer with the corner coordinates. These coordinates - // may be outside the tile, because raster tiles aren't clipped when rendering. - var map = this.map; - var cornerZ0Coords = coordinates.map(function(coord) { + var cornerZ0Coords = coordinates.map(function (coord) { return map.transform.locationCoordinate(LngLat.convert(coord)).zoomTo(0); }); - var centerCoord = this.centerCoord = util.getCoordinatesCenter(cornerZ0Coords); centerCoord.column = Math.round(centerCoord.column); centerCoord.row = Math.round(centerCoord.row); - - var tileCoords = cornerZ0Coords.map(function(coord) { + this.minzoom = this.maxzoom = centerCoord.zoom; + this._coord = new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row); + this._tileCoords = cornerZ0Coords.map(function (coord) { var zoomedCoord = coord.zoomTo(centerCoord.zoom); - return new Point( - Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), - Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); + return new Point(Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); }); - + this.fire('change'); + return this; + }, + _setTile: function (tile) { + this._prepared = false; + this.tile = tile; var maxInt16 = 32767; var array = new RasterBoundsArray(); - array.emplaceBack(tileCoords[0].x, tileCoords[0].y, 0, 0); - array.emplaceBack(tileCoords[1].x, tileCoords[1].y, maxInt16, 0); - array.emplaceBack(tileCoords[3].x, tileCoords[3].y, 0, maxInt16); - array.emplaceBack(tileCoords[2].x, tileCoords[2].y, maxInt16, maxInt16); - - this.tile = new Tile(new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row)); + array.emplaceBack(this._tileCoords[0].x, this._tileCoords[0].y, 0, 0); + array.emplaceBack(this._tileCoords[1].x, this._tileCoords[1].y, maxInt16, 0); + array.emplaceBack(this._tileCoords[3].x, this._tileCoords[3].y, 0, maxInt16); + array.emplaceBack(this._tileCoords[2].x, this._tileCoords[2].y, maxInt16, maxInt16); this.tile.buckets = {}; - this.tile.boundsBuffer = new Buffer(array.serialize(), RasterBoundsArray.serialize(), Buffer.BufferType.VERTEX); this.tile.boundsVAO = new VertexArrayObject(); - - this.fire('change'); - - return this; - }, - - loaded: function() { - return this.image && this.image.complete; + this.tile.state = 'loaded'; }, - - update: function() { - // noop - }, - - reload: function() { - // noop - }, - - prepare: function() { - if (!this._loaded || !this.loaded()) return; - + prepare: function () { + if (!this._loaded || !this.image || !this.image.complete) + return; + if (!this.tile) + return; var painter = this.map.painter; var gl = painter.gl; - - if (!this.tile.texture) { + if (!this._prepared) { this.tile.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this.image); - } else { - gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); - gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.image); - } - }, - - getVisibleCoordinates: function() { - if (this.tile) return [this.tile.coord]; - else return []; - }, - - getTile: function() { - return this.tile; - }, - - serialize: function() { - return { - type: 'image', - urls: this.urls, - coordinates: this.coordinates - }; - } -}); - -},{"../data/bucket":247,"../data/buffer":252,"../geo/lng_lat":256,"../render/draw_raster":267,"../render/vertex_array_object":273,"../util/ajax":334,"../util/evented":341,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],277:[function(require,module,exports){ -'use strict'; - -var Bucket = require('../data/bucket'); - -/** - * Converts a pixel value at a the given zoom level to tile units. - * - * The shaders mostly calculate everything in tile units so style - * properties need to be converted from pixels to tile units using this. - * - * For example, a translation by 30 pixels at zoom 6.5 will be a - * translation by pixelsToTileUnits(30, 6.5) tile units. - * - * @param {object} tile a {Tile object} will work well, but any object that follows the format {coord: {TileCord object}, tileSize: {number}} will work - * @param {number} pixelValue - * @param {number} z - * @returns {number} value in tile units - * @private - */ -module.exports = function(tile, pixelValue, z) { - return pixelValue * (Bucket.EXTENT / (tile.tileSize * Math.pow(2, z - tile.coord.z))); -}; - - -},{"../data/bucket":247}],278:[function(require,module,exports){ -'use strict'; - -var util = require('../util/util'); -var ajax = require('../util/ajax'); -var Evented = require('../util/evented'); -var Source = require('./source'); -var normalizeURL = require('../util/mapbox').normalizeTileURL; - -module.exports = RasterTileSource; - -function RasterTileSource(options) { - util.extend(this, util.pick(options, ['url', 'tileSize'])); - - Source._loadTileJSON.call(this, options); -} - -RasterTileSource.prototype = util.inherit(Evented, { - minzoom: 0, - maxzoom: 22, - roundZoom: true, - tileSize: 512, - _loaded: false, - - onAdd: function(map) { - this.map = map; - }, - - loaded: function() { - return this._pyramid && this._pyramid.loaded(); - }, - - update: function(transform) { - if (this._pyramid) { - this._pyramid.update(this.used, transform, this.map.style.rasterFadeDuration); - } - }, - - reload: function() { - // noop - }, - - serialize: function() { - return { - type: 'raster', - url: this.url, - tileSize: this.tileSize - }; - }, - - getVisibleCoordinates: Source._getVisibleCoordinates, - getTile: Source._getTile, - - _loadTile: function(tile) { - var url = normalizeURL(tile.coord.url(this.tiles), this.url, this.tileSize); - - tile.request = ajax.getImage(url, done.bind(this)); - - function done(err, img) { - delete tile.request; - - if (tile.aborted) - return; - - if (err) { - tile.errored = true; - this.fire('tile.error', {tile: tile, error: err}); - return; - } - - var gl = this.map.painter.gl; - tile.texture = this.map.painter.getTexture(img.width); - if (tile.texture) { - gl.bindTexture(gl.TEXTURE_2D, tile.texture); - gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, img); - } else { - tile.texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, tile.texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img); - tile.texture.size = img.width; - } - gl.generateMipmap(gl.TEXTURE_2D); - - tile.timeAdded = new Date().getTime(); - this.map.animationLoop.set(this.style.rasterFadeDuration); - - tile.source = this; - tile.loaded = true; - - this.fire('tile.load', {tile: tile}); - } - }, - - _abortTile: function(tile) { - tile.aborted = true; - - if (tile.request) { - tile.request.abort(); - delete tile.request; - } - }, - - _addTile: function(tile) { - this.fire('tile.add', {tile: tile}); - }, - - _removeTile: function(tile) { - this.fire('tile.remove', {tile: tile}); - }, - - _unloadTile: function(tile) { - if (tile.texture) this.map.painter.saveTexture(tile.texture); - } -}); - -},{"../util/ajax":334,"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./source":279}],279:[function(require,module,exports){ -'use strict'; - -var util = require('../util/util'); -var ajax = require('../util/ajax'); -var browser = require('../util/browser'); -var TilePyramid = require('./tile_pyramid'); -var normalizeURL = require('../util/mapbox').normalizeSourceURL; -var TileCoord = require('./tile_coord'); - -exports._loadTileJSON = function(options) { - var loaded = function(err, tileJSON) { - if (err) { - this.fire('error', {error: err}); - return; - } - - util.extend(this, util.pick(tileJSON, - ['tiles', 'minzoom', 'maxzoom', 'attribution'])); - - if (tileJSON.vector_layers) { - this.vectorLayers = tileJSON.vector_layers; - this.vectorLayerIds = this.vectorLayers.map(function(layer) { return layer.id; }); - } - - this._pyramid = new TilePyramid({ - tileSize: this.tileSize, - minzoom: this.minzoom, - maxzoom: this.maxzoom, - roundZoom: this.roundZoom, - reparseOverscaled: this.reparseOverscaled, - load: this._loadTile.bind(this), - abort: this._abortTile.bind(this), - unload: this._unloadTile.bind(this), - add: this._addTile.bind(this), - remove: this._removeTile.bind(this), - redoPlacement: this._redoTilePlacement ? this._redoTilePlacement.bind(this) : undefined - }); - - this.fire('load'); - }.bind(this); - - if (options.url) { - ajax.getJSON(normalizeURL(options.url), loaded); - } else { - browser.frame(loaded.bind(this, null, options)); - } -}; - -exports.redoPlacement = function() { - if (!this._pyramid) { - return; - } - - var ids = this._pyramid.orderedIDs(); - for (var i = 0; i < ids.length; i++) { - var tile = this._pyramid.getTile(ids[i]); - this._redoTilePlacement(tile); - } -}; - -exports._getTile = function(coord) { - return this._pyramid.getTile(coord.id); -}; - -exports._getVisibleCoordinates = function() { - if (!this._pyramid) return []; - else return this._pyramid.renderedIDs().map(TileCoord.fromID); -}; - -function sortTilesIn(a, b) { - var coordA = a.tile.coord; - var coordB = b.tile.coord; - return (coordA.z - coordB.z) || (coordA.y - coordB.y) || (coordA.x - coordB.x); -} - -function mergeRenderedFeatureLayers(tiles) { - var result = tiles[0] || {}; - for (var i = 1; i < tiles.length; i++) { - var tile = tiles[i]; - for (var layerID in tile) { - var tileFeatures = tile[layerID]; - var resultFeatures = result[layerID]; - if (resultFeatures === undefined) { - resultFeatures = result[layerID] = tileFeatures; - } else { - for (var f = 0; f < tileFeatures.length; f++) { - resultFeatures.push(tileFeatures[f]); - } - } - } - } - return result; -} - -exports._queryRenderedVectorFeatures = function(queryGeometry, params, zoom, bearing) { - if (!this._pyramid) - return {}; - - var tilesIn = this._pyramid.tilesIn(queryGeometry); - - tilesIn.sort(sortTilesIn); - - var styleLayers = this.map.style._layers; - - var renderedFeatureLayers = []; - for (var r = 0; r < tilesIn.length; r++) { - var tileIn = tilesIn[r]; - if (!tileIn.tile.featureIndex) continue; - - renderedFeatureLayers.push(tileIn.tile.featureIndex.query({ - queryGeometry: tileIn.queryGeometry, - scale: tileIn.scale, - tileSize: tileIn.tile.tileSize, - bearing: bearing, - params: params - }, styleLayers)); - } - return mergeRenderedFeatureLayers(renderedFeatureLayers); -}; - -exports._querySourceFeatures = function(params) { - if (!this._pyramid) { - return []; - } - - var pyramid = this._pyramid; - var tiles = pyramid.renderedIDs().map(function(id) { - return pyramid.getTile(id); - }); - - var result = []; - - var dataTiles = {}; - for (var i = 0; i < tiles.length; i++) { - var tile = tiles[i]; - var dataID = new TileCoord(Math.min(tile.sourceMaxZoom, tile.coord.z), tile.coord.x, tile.coord.y, 0).id; - if (!dataTiles[dataID]) { - dataTiles[dataID] = true; - tile.querySourceFeatures(result, params); - } - } - - return result; -}; - -/* - * Create a tiled data source instance given an options object - * - * @param {Object} options - * @param {string} options.type Either `raster` or `vector`. - * @param {string} options.url A tile source URL. This should either be `mapbox://{mapid}` or a full `http[s]` url that points to a TileJSON endpoint. - * @param {Array} options.tiles An array of tile sources. If `url` is not specified, `tiles` can be used instead to specify tile sources, as in the TileJSON spec. Other TileJSON keys such as `minzoom` and `maxzoom` can be specified in a source object if `tiles` is used. - * @param {string} options.id An optional `id` to assign to the source - * @param {number} [options.tileSize=512] Optional tile size (width and height in pixels, assuming tiles are square). This option is only configurable for raster sources - * @example - * var sourceObj = new mapboxgl.Source.create({ - * type: 'vector', - * url: 'mapbox://mapbox.mapbox-streets-v5' - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -exports.create = function(source) { - // This is not at file scope in order to avoid a circular require. - var sources = { - vector: require('./vector_tile_source'), - raster: require('./raster_tile_source'), - geojson: require('./geojson_source'), - video: require('./video_source'), - image: require('./image_source') - }; - - return exports.is(source) ? source : new sources[source.type](source); -}; - -exports.is = function(source) { - // This is not at file scope in order to avoid a circular require. - var sources = { - vector: require('./vector_tile_source'), - raster: require('./raster_tile_source'), - geojson: require('./geojson_source'), - video: require('./video_source'), - image: require('./image_source') - }; - - for (var type in sources) { - if (source instanceof sources[type]) { - return true; - } - } - - return false; -}; - -},{"../util/ajax":334,"../util/browser":335,"../util/mapbox":346,"../util/util":349,"./geojson_source":274,"./image_source":276,"./raster_tile_source":278,"./tile_coord":281,"./tile_pyramid":282,"./vector_tile_source":283,"./video_source":284}],280:[function(require,module,exports){ -'use strict'; - -var util = require('../util/util'); -var Bucket = require('../data/bucket'); -var FeatureIndex = require('../data/feature_index'); -var vt = require('vector-tile'); -var Protobuf = require('pbf'); -var GeoJSONFeature = require('../util/vectortile_to_geojson'); -var featureFilter = require('feature-filter'); -var CollisionTile = require('../symbol/collision_tile'); -var CollisionBoxArray = require('../symbol/collision_box'); - -module.exports = Tile; - -/** - * A tile object is the combination of a Coordinate, which defines - * its place, as well as a unique ID and data tracking for its content - * - * @param {Coordinate} coord - * @param {number} size - * @private - */ -function Tile(coord, size, sourceMaxZoom) { - this.coord = coord; - this.uid = util.uniqueId(); - this.loaded = false; // TODO rename loaded - this.isUnloaded = false; - this.uses = 0; - this.tileSize = size; - this.sourceMaxZoom = sourceMaxZoom; - this.buckets = {}; -} - -Tile.prototype = { - - /** - * Given a data object with a 'buffers' property, load it into - * this tile's elementGroups and buffers properties and set loaded - * to true. If the data is null, like in the case of an empty - * GeoJSON tile, no-op but still set loaded to true. - * @param {Object} data - * @returns {undefined} - * @private - */ - loadVectorData: function(data, style) { - this.loaded = true; - - // empty GeoJSON tile - if (!data) return; - - this.collisionBoxArray = new CollisionBoxArray(data.collisionBoxArray); - this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); - this.featureIndex = new FeatureIndex(data.featureIndex, data.rawTileData, this.collisionTile); - this.rawTileData = data.rawTileData; - this.buckets = unserializeBuckets(data.buckets, style); - }, - - /** - * given a data object and a GL painter, destroy and re-create - * all of its buffers. - * @param {Object} data - * @param {Object} painter - * @returns {undefined} - * @private - */ - reloadSymbolData: function(data, painter, style) { - if (this.isUnloaded) return; - - this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); - this.featureIndex.setCollisionTile(this.collisionTile); - - // Destroy and delete existing symbol buckets - for (var id in this.buckets) { - var bucket = this.buckets[id]; - if (bucket.type === 'symbol') { - bucket.destroy(painter.gl); - delete this.buckets[id]; - } - } - - // Add new symbol buckets - util.extend(this.buckets, unserializeBuckets(data.buckets, style)); - }, - - /** - * Make sure that this tile doesn't own any data within a given - * painter, so that it doesn't consume any memory or maintain - * any references to the painter. - * @param {Object} painter gl painter object - * @returns {undefined} - * @private - */ - unloadVectorData: function(painter) { - for (var id in this.buckets) { - var bucket = this.buckets[id]; - bucket.destroy(painter.gl); - } - - this.collisionBoxArray = null; - this.collisionTile = null; - this.featureIndex = null; - this.rawTileData = null; - this.buckets = null; - this.loaded = false; - this.isUnloaded = true; - }, - - redoPlacement: function(source) { - if (!this.loaded || this.redoingPlacement) { - this.redoWhenDone = true; - return; - } - - this.redoingPlacement = true; - - source.dispatcher.send('redo placement', { - uid: this.uid, - source: source.id, - angle: source.map.transform.angle, - pitch: source.map.transform.pitch, - showCollisionBoxes: source.map.showCollisionBoxes - }, done.bind(this), this.workerID); - - function done(_, data) { - this.reloadSymbolData(data, source.map.painter, source.map.style); - source.fire('tile.load', {tile: this}); - - this.redoingPlacement = false; - if (this.redoWhenDone) { - this.redoPlacement(source); - this.redoWhenDone = false; - } + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this.image); + } else { + gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.image); } }, - - getBucket: function(layer) { - return this.buckets && this.buckets[layer.ref || layer.id]; + loadTile: function (tile, callback) { + if (this._coord && this._coord.toString() === tile.coord.toString()) { + this._setTile(tile); + callback(null); + } else { + tile.state = 'errored'; + callback(null); + } }, - - querySourceFeatures: function(result, params) { - if (!this.rawTileData) return; - - if (!this.vtLayers) { - this.vtLayers = new vt.VectorTile(new Protobuf(new Uint8Array(this.rawTileData))).layers; + serialize: function () { + return { + type: 'image', + urls: this.url, + coordinates: this.coordinates + }; + } +}); +},{"../data/bucket":253,"../data/buffer":258,"../geo/lng_lat":263,"../render/draw_raster":275,"../render/vertex_array_object":281,"../util/ajax":349,"../util/evented":358,"../util/util":366,"./tile_coord":293,"point-geometry":424}],286:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var ajax = require('../util/ajax'); +var browser = require('../util/browser'); +var normalizeURL = require('../util/mapbox').normalizeSourceURL; +module.exports = function (options, callback) { + var loaded = function (err, tileJSON) { + if (err) { + return callback(err); } - - var layer = this.vtLayers._geojsonTileLayer || this.vtLayers[params.sourceLayer]; - - if (!layer) return; - - var filter = featureFilter(params.filter); - var coord = { z: this.coord.z, x: this.coord.x, y: this.coord.y }; - - for (var i = 0; i < layer.length; i++) { - var feature = layer.feature(i); - if (filter(feature)) { - var geojsonFeature = new GeoJSONFeature(feature, this.coord.z, this.coord.x, this.coord.y); - geojsonFeature.tile = coord; - result.push(geojsonFeature); - } + var result = util.pick(tileJSON, [ + 'tiles', + 'minzoom', + 'maxzoom', + 'attribution' + ]); + if (tileJSON.vector_layers) { + result.vectorLayers = tileJSON.vector_layers; + result.vectorLayerIds = result.vectorLayers.map(function (layer) { + return layer.id; + }); } + callback(null, result); + }; + if (options.url) { + ajax.getJSON(normalizeURL(options.url), loaded); + } else { + browser.frame(loaded.bind(null, null, options)); } }; - -function unserializeBuckets(input, style) { - var output = {}; - for (var i = 0; i < input.length; i++) { - var layer = style.getLayer(input[i].layerId); - if (!layer) continue; - - var bucket = Bucket.create(util.extend({ - layer: layer, - childLayers: input[i].childLayerIds - .map(style.getLayer.bind(style)) - .filter(function(layer) { return layer; }) - }, input[i])); - output[bucket.id] = bucket; - } - return output; -} - -},{"../data/bucket":247,"../data/feature_index":253,"../symbol/collision_box":306,"../symbol/collision_tile":308,"../util/util":349,"../util/vectortile_to_geojson":350,"feature-filter":352,"pbf":402,"vector-tile":413}],281:[function(require,module,exports){ +},{"../util/ajax":349,"../util/browser":350,"../util/mapbox":363,"../util/util":366}],287:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); -var Coordinate = require('../geo/coordinate'); - -module.exports = TileCoord; - -function TileCoord(z, x, y, w) { - assert(!isNaN(z) && z >= 0 && z % 1 === 0); - assert(!isNaN(x) && x >= 0 && x % 1 === 0); - assert(!isNaN(y) && y >= 0 && y % 1 === 0); - - if (isNaN(w)) w = 0; - - this.z = +z; - this.x = +x; - this.y = +y; - this.w = +w; - - // calculate id - w *= 2; - if (w < 0) w = w * -1 - 1; - var dim = 1 << this.z; - this.id = ((dim * dim * w + dim * this.y + this.x) * 32) + this.z; - - // for caching pos matrix calculation when rendering - this.posMatrix = null; -} - -TileCoord.prototype.toString = function() { - return this.z + "/" + this.x + "/" + this.y; -}; - -TileCoord.prototype.toCoordinate = function(sourceMaxZoom) { - var zoom = Math.min(this.z, sourceMaxZoom); - var tileScale = Math.pow(2, zoom); - var row = this.y; - var column = this.x + tileScale * this.w; - return new Coordinate(column, row, zoom); -}; - -// Parse a packed integer id into a TileCoord object -TileCoord.fromID = function(id) { - var z = id % 32, dim = 1 << z; - var xy = ((id - z) / 32); - var x = xy % dim, y = ((xy - x) / dim) % dim; - var w = Math.floor(xy / (dim * dim)); - if (w % 2 !== 0) w = w * -1 - 1; - w /= 2; - return new TileCoord(z, x, y, w); -}; - -// given a list of urls, choose a url template and return a tile URL -TileCoord.prototype.url = function(urls, sourceMaxZoom) { - return urls[(this.x + this.y) % urls.length] - .replace('{prefix}', (this.x % 16).toString(16) + (this.y % 16).toString(16)) - .replace('{z}', Math.min(this.z, sourceMaxZoom || this.z)) - .replace('{x}', this.x) - .replace('{y}', this.y); +var Bucket = require('../data/bucket'); +module.exports = function (tile, pixelValue, z) { + return pixelValue * (Bucket.EXTENT / (tile.tileSize * Math.pow(2, z - tile.coord.z))); }; - -// Return the coordinate of the parent tile -TileCoord.prototype.parent = function(sourceMaxZoom) { - if (this.z === 0) return null; - - // the id represents an overscaled tile, return the same coordinates with a lower z - if (this.z > sourceMaxZoom) { - return new TileCoord(this.z - 1, this.x, this.y, this.w); +},{"../data/bucket":253}],288:[function(require,module,exports){ +'use strict'; +var TileCoord = require('./tile_coord'); +exports.rendered = function (sourceCache, styleLayers, queryGeometry, params, zoom, bearing) { + var tilesIn = sourceCache.tilesIn(queryGeometry); + tilesIn.sort(sortTilesIn); + var renderedFeatureLayers = []; + for (var r = 0; r < tilesIn.length; r++) { + var tileIn = tilesIn[r]; + if (!tileIn.tile.featureIndex) + continue; + renderedFeatureLayers.push(tileIn.tile.featureIndex.query({ + queryGeometry: tileIn.queryGeometry, + scale: tileIn.scale, + tileSize: tileIn.tile.tileSize, + bearing: bearing, + params: params + }, styleLayers)); } - - return new TileCoord(this.z - 1, Math.floor(this.x / 2), Math.floor(this.y / 2), this.w); -}; - -TileCoord.prototype.wrapped = function() { - return new TileCoord(this.z, this.x, this.y, 0); + return mergeRenderedFeatureLayers(renderedFeatureLayers); }; - -// Return the coordinates of the tile's children -TileCoord.prototype.children = function(sourceMaxZoom) { - - if (this.z >= sourceMaxZoom) { - // return a single tile coord representing a an overscaled tile - return [new TileCoord(this.z + 1, this.x, this.y, this.w)]; +exports.source = function (sourceCache, params) { + var tiles = sourceCache.renderedIDs().map(function (id) { + return sourceCache.getTileByID(id); + }); + var result = []; + var dataTiles = {}; + for (var i = 0; i < tiles.length; i++) { + var tile = tiles[i]; + var dataID = new TileCoord(Math.min(tile.sourceMaxZoom, tile.coord.z), tile.coord.x, tile.coord.y, 0).id; + if (!dataTiles[dataID]) { + dataTiles[dataID] = true; + tile.querySourceFeatures(result, params); + } } - - var z = this.z + 1; - var x = this.x * 2; - var y = this.y * 2; - return [ - new TileCoord(z, x, y, this.w), - new TileCoord(z, x + 1, y, this.w), - new TileCoord(z, x, y + 1, this.w), - new TileCoord(z, x + 1, y + 1, this.w) - ]; + return result; }; - -// Taken from polymaps src/Layer.js -// https://github.com/simplegeo/polymaps/blob/master/src/Layer.js#L333-L383 - -function edge(a, b) { - if (a.row > b.row) { var t = a; a = b; b = t; } - return { - x0: a.column, - y0: a.row, - x1: b.column, - y1: b.row, - dx: b.column - a.column, - dy: b.row - a.row - }; +function sortTilesIn(a, b) { + var coordA = a.coord; + var coordB = b.coord; + return coordA.z - coordB.z || coordA.y - coordB.y || coordA.w - coordB.w || coordA.x - coordB.x; } - -function scanSpans(e0, e1, ymin, ymax, scanLine) { - var y0 = Math.max(ymin, Math.floor(e1.y0)); - var y1 = Math.min(ymax, Math.ceil(e1.y1)); - - // sort edges by x-coordinate - if ((e0.x0 === e1.x0 && e0.y0 === e1.y0) ? - (e0.x0 + e1.dy / e0.dy * e0.dx < e1.x1) : - (e0.x1 - e1.dy / e0.dy * e0.dx < e1.x0)) { - var t = e0; e0 = e1; e1 = t; - } - - // scan lines! - var m0 = e0.dx / e0.dy; - var m1 = e1.dx / e1.dy; - var d0 = e0.dx > 0; // use y + 1 to compute x0 - var d1 = e1.dx < 0; // use y + 1 to compute x1 - for (var y = y0; y < y1; y++) { - var x0 = m0 * Math.max(0, Math.min(e0.dy, y + d0 - e0.y0)) + e0.x0; - var x1 = m1 * Math.max(0, Math.min(e1.dy, y + d1 - e1.y0)) + e1.x0; - scanLine(Math.floor(x1), Math.ceil(x0), y); +function mergeRenderedFeatureLayers(tiles) { + var result = tiles[0] || {}; + for (var i = 1; i < tiles.length; i++) { + var tile = tiles[i]; + for (var layerID in tile) { + var tileFeatures = tile[layerID]; + var resultFeatures = result[layerID]; + if (resultFeatures === undefined) { + resultFeatures = result[layerID] = tileFeatures; + } else { + for (var f = 0; f < tileFeatures.length; f++) { + resultFeatures.push(tileFeatures[f]); + } + } + } } + return result; } - -function scanTriangle(a, b, c, ymin, ymax, scanLine) { - var ab = edge(a, b), - bc = edge(b, c), - ca = edge(c, a); - - var t; - - // sort edges by y-length - if (ab.dy > bc.dy) { t = ab; ab = bc; bc = t; } - if (ab.dy > ca.dy) { t = ab; ab = ca; ca = t; } - if (bc.dy > ca.dy) { t = bc; bc = ca; ca = t; } - - // scan span! scan span! - if (ab.dy) scanSpans(ca, ab, ymin, ymax, scanLine); - if (bc.dy) scanSpans(ca, bc, ymin, ymax, scanLine); +},{"./tile_coord":293}],289:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var ajax = require('../util/ajax'); +var Evented = require('../util/evented'); +var loadTileJSON = require('./load_tilejson'); +var normalizeURL = require('../util/mapbox').normalizeTileURL; +module.exports = RasterTileSource; +function RasterTileSource(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + util.extend(this, util.pick(options, [ + 'url', + 'scheme', + 'tileSize' + ])); + loadTileJSON(options, function (err, tileJSON) { + if (err) { + return this.fire('error', err); + } + util.extend(this, tileJSON); + this.fire('load'); + }.bind(this)); } - -TileCoord.cover = function(z, bounds, actualZ) { - var tiles = 1 << z; - var t = {}; - - function scanLine(x0, x1, y) { - var x, wx, coord; - if (y >= 0 && y <= tiles) { - for (x = x0; x < x1; x++) { - wx = (x % tiles + tiles) % tiles; - coord = new TileCoord(actualZ, wx, y, Math.floor(x / tiles)); - t[coord.id] = coord; +RasterTileSource.prototype = util.inherit(Evented, { + minzoom: 0, + maxzoom: 22, + roundZoom: true, + scheme: 'xyz', + tileSize: 512, + _loaded: false, + onAdd: function (map) { + this.map = map; + }, + serialize: function () { + return { + type: 'raster', + url: this.url, + tileSize: this.tileSize + }; + }, + loadTile: function (tile, callback) { + var url = normalizeURL(tile.coord.url(this.tiles, null, this.scheme), this.url, this.tileSize); + tile.request = ajax.getImage(url, done.bind(this)); + function done(err, img) { + delete tile.request; + if (tile.aborted) + return; + if (err) { + return callback(err); + } + var gl = this.map.painter.gl; + tile.texture = this.map.painter.getTexture(img.width); + if (tile.texture) { + gl.bindTexture(gl.TEXTURE_2D, tile.texture); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, img); + } else { + tile.texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tile.texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img); + tile.texture.size = img.width; } + gl.generateMipmap(gl.TEXTURE_2D); + this.map.animationLoop.set(this.map.style.rasterFadeDuration); + tile.state = 'loaded'; + callback(null); + } + }, + abortTile: function (tile) { + if (tile.request) { + tile.request.abort(); + delete tile.request; } + }, + unloadTile: function (tile) { + if (tile.texture) + this.map.painter.saveTexture(tile.texture); } - - // Divide the screen up in two triangles and scan each of them: - // +---/ - // | / | - // /---+ - scanTriangle(bounds[0], bounds[1], bounds[2], 0, tiles, scanLine); - scanTriangle(bounds[2], bounds[3], bounds[0], 0, tiles, scanLine); - - return Object.keys(t).map(function(id) { - return t[id]; - }); +}); +},{"../util/ajax":349,"../util/evented":358,"../util/mapbox":363,"../util/util":366,"./load_tilejson":286}],290:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var sourceTypes = { + 'vector': require('../source/vector_tile_source'), + 'raster': require('../source/raster_tile_source'), + 'geojson': require('../source/geojson_source'), + 'video': require('../source/video_source'), + 'image': require('../source/image_source') +}; +exports.create = function (id, source, dispatcher) { + source = new sourceTypes[source.type](id, source, dispatcher); + if (source.id !== id) { + throw new Error('Expected Source id to be ' + id + ' instead of ' + source.id); + } + util.bindAll([ + 'load', + 'abort', + 'unload', + 'serialize', + 'prepare' + ], source); + return source; }; - -},{"../geo/coordinate":255,"assert":52}],282:[function(require,module,exports){ +exports.getType = function (name) { + return sourceTypes[name]; +}; +exports.setType = function (name, type) { + sourceTypes[name] = type; +}; +},{"../source/geojson_source":282,"../source/image_source":285,"../source/raster_tile_source":289,"../source/vector_tile_source":294,"../source/video_source":296,"../util/util":366}],291:[function(require,module,exports){ 'use strict'; - +var Source = require('./source'); var Tile = require('./tile'); +var Evented = require('../util/evented'); var TileCoord = require('./tile_coord'); -var Point = require('point-geometry'); var Cache = require('../util/lru_cache'); var Coordinate = require('../geo/coordinate'); var util = require('../util/util'); var EXTENT = require('../data/bucket').EXTENT; - -module.exports = TilePyramid; - -/** - * A tile pyramid is a specialized cache and datastructure - * that contains tiles. It's used by sources to manage their - * data. - * - * @param {Object} options - * @param {number} options.tileSize - * @param {number} options.minzoom - * @param {number} options.maxzoom - * @private - */ -function TilePyramid(options) { - this.tileSize = options.tileSize; - this.minzoom = options.minzoom; - this.maxzoom = options.maxzoom; - this.roundZoom = options.roundZoom; - this.reparseOverscaled = options.reparseOverscaled; - - this._load = options.load; - this._abort = options.abort; - this._unload = options.unload; - this._add = options.add; - this._remove = options.remove; - this._redoPlacement = options.redoPlacement; - +module.exports = SourceCache; +function SourceCache(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + var source = this._source = Source.create(id, options, dispatcher).on('load', function () { + if (this.map && this._source.onAdd) { + this._source.onAdd(this.map); + } + this._sourceLoaded = true; + this.tileSize = source.tileSize; + this.minzoom = source.minzoom; + this.maxzoom = source.maxzoom; + this.roundZoom = source.roundZoom; + this.reparseOverscaled = source.reparseOverscaled; + this.isTileClipped = source.isTileClipped; + this.attribution = source.attribution; + this.vectorLayerIds = source.vectorLayerIds; + this.fire('load'); + }.bind(this)).on('error', function (e) { + this._sourceErrored = true; + this.fire('error', e); + }.bind(this)).on('change', function () { + this.reload(); + if (this.transform) { + this.update(this.transform, this.map && this.map.style.rasterFadeDuration); + } + this.fire('change'); + }.bind(this)); this._tiles = {}; - this._cache = new Cache(0, function(tile) { return this._unload(tile); }.bind(this)); - - this._filterRendered = this._filterRendered.bind(this); + this._cache = new Cache(0, this.unloadTile.bind(this)); + this._isIdRenderable = this._isIdRenderable.bind(this); } - - -TilePyramid.maxOverzooming = 10; -TilePyramid.maxUnderzooming = 3; - -TilePyramid.prototype = { - /** - * Confirm that every tracked tile is loaded. - * @returns {boolean} whether all tiles are loaded. - * @private - */ - loaded: function() { +SourceCache.maxOverzooming = 10; +SourceCache.maxUnderzooming = 3; +SourceCache.prototype = util.inherit(Evented, { + onAdd: function (map) { + this.map = map; + if (this._source && this._source.onAdd) { + this._source.onAdd(map); + } + }, + loaded: function () { + if (this._sourceErrored) { + return true; + } + if (!this._sourceLoaded) { + return false; + } for (var t in this._tiles) { - if (!this._tiles[t].loaded && !this._tiles[t].errored) + var tile = this._tiles[t]; + if (tile.state !== 'loaded' && tile.state !== 'errored') return false; } return true; }, - - /** - * Return all tile ids ordered with z-order, and cast to numbers - * @returns {Array} ids - * @private - */ - orderedIDs: function() { + getSource: function () { + return this._source; + }, + loadTile: function (tile, callback) { + return this._source.loadTile(tile, callback); + }, + unloadTile: function (tile) { + if (this._source.unloadTile) + return this._source.unloadTile(tile); + }, + abortTile: function (tile) { + if (this._source.abortTile) + return this._source.abortTile(tile); + }, + serialize: function () { + return this._source.serialize(); + }, + prepare: function () { + if (this._sourceLoaded && this._source.prepare) + return this._source.prepare(); + }, + getIds: function () { return Object.keys(this._tiles).map(Number).sort(compareKeyZoom); }, - - renderedIDs: function() { - return this.orderedIDs().filter(this._filterRendered); + getRenderableIds: function () { + return this.getIds().filter(this._isIdRenderable); }, - - _filterRendered: function(id) { - return this._tiles[id].loaded && !this._coveredTiles[id]; + _isIdRenderable: function (id) { + return this._tiles[id].isRenderable() && !this._coveredTiles[id]; }, - - reload: function() { + reload: function () { this._cache.reset(); for (var i in this._tiles) { - this._load(this._tiles[i]); + var tile = this._tiles[i]; + if (tile.state !== 'loading') { + tile.state = 'reloading'; + } + this.loadTile(this._tiles[i], this._tileLoaded.bind(this, this._tiles[i])); } }, - - /** - * Get a specific tile by id - * @param {string|number} id tile id - * @returns {Object} tile - * @private - */ - getTile: function(id) { - return this._tiles[id]; + _tileLoaded: function (tile, err) { + if (err) { + tile.state = 'errored'; + this.fire('tile.error', { + tile: tile, + error: err + }); + this._source.fire('tile.error', { + tile: tile, + error: err + }); + return; + } + tile.source = this; + tile.timeAdded = new Date().getTime(); + this.fire('tile.load', { tile: tile }); + this._source.fire('tile.load', { tile: tile }); }, - - /** - * get the zoom level adjusted for the difference in map and source tilesizes - * @param {Object} transform - * @returns {number} zoom level - * @private - */ - getZoom: function(transform) { - return transform.zoom + Math.log(transform.tileSize / this.tileSize) / Math.LN2; + getTile: function (coord) { + return this.getTileByID(coord.id); }, - - /** - * Return a zoom level that will cover all tiles in a given transform - * @param {Object} transform - * @returns {number} zoom level - * @private - */ - coveringZoomLevel: function(transform) { - return (this.roundZoom ? Math.round : Math.floor)(this.getZoom(transform)); + getTileByID: function (id) { + return this._tiles[id]; }, - - /** - * Given a transform, return all coordinates that could cover that - * transform for a covering zoom level. - * @param {Object} transform - * @returns {Array} tiles - * @private - */ - coveringTiles: function(transform) { - var z = this.coveringZoomLevel(transform); - var actualZ = z; - - if (z < this.minzoom) return []; - if (z > this.maxzoom) z = this.maxzoom; - - var tr = transform, - tileCenter = tr.locationCoordinate(tr.center)._zoomTo(z), - centerPoint = new Point(tileCenter.column - 0.5, tileCenter.row - 0.5); - - return TileCoord.cover(z, [ - tr.pointCoordinate(new Point(0, 0))._zoomTo(z), - tr.pointCoordinate(new Point(tr.width, 0))._zoomTo(z), - tr.pointCoordinate(new Point(tr.width, tr.height))._zoomTo(z), - tr.pointCoordinate(new Point(0, tr.height))._zoomTo(z) - ], this.reparseOverscaled ? actualZ : z).sort(function(a, b) { - return centerPoint.dist(a) - centerPoint.dist(b); - }); + getZoom: function (transform) { + return transform.zoom + transform.scaleZoom(transform.tileSize / this.tileSize); }, - - /** - * Recursively find children of the given tile (up to maxCoveringZoom) that are already loaded; - * adds found tiles to retain object; returns true if any child is found. - * - * @param {Coordinate} coord - * @param {number} maxCoveringZoom - * @param {boolean} retain - * @returns {boolean} whether the operation was complete - * @private - */ - findLoadedChildren: function(coord, maxCoveringZoom, retain) { + findLoadedChildren: function (coord, maxCoveringZoom, retain) { var found = false; - for (var id in this._tiles) { var tile = this._tiles[id]; - - // only consider loaded tiles on higher zoom levels (up to maxCoveringZoom) - if (retain[id] || !tile.loaded || tile.coord.z <= coord.z || tile.coord.z > maxCoveringZoom) continue; - - // disregard tiles that are not descendants of the given tile coordinate + if (retain[id] || !tile.isRenderable() || tile.coord.z <= coord.z || tile.coord.z > maxCoveringZoom) + continue; var z2 = Math.pow(2, Math.min(tile.coord.z, this.maxzoom) - Math.min(coord.z, this.maxzoom)); - if (Math.floor(tile.coord.x / z2) !== coord.x || - Math.floor(tile.coord.y / z2) !== coord.y) + if (Math.floor(tile.coord.x / z2) !== coord.x || Math.floor(tile.coord.y / z2) !== coord.y) continue; - - // found loaded child retain[id] = true; found = true; - - // loop through parents; retain the topmost loaded one if found while (tile && tile.coord.z - 1 > coord.z) { var parentId = tile.coord.parent(this.maxzoom).id; tile = this._tiles[parentId]; - - if (tile && tile.loaded) { + if (tile && tile.isRenderable()) { delete retain[id]; retain[parentId] = true; } @@ -49276,22 +51304,11 @@ TilePyramid.prototype = { } return found; }, - - /** - * Find a loaded parent of the given tile (up to minCoveringZoom); - * adds the found tile to retain object and returns the tile if found - * - * @param {Coordinate} coord - * @param {number} minCoveringZoom - * @param {boolean} retain - * @returns {Tile} tile object - * @private - */ - findLoadedParent: function(coord, minCoveringZoom, retain) { + findLoadedParent: function (coord, minCoveringZoom, retain) { for (var z = coord.z - 1; z >= minCoveringZoom; z--) { coord = coord.parent(this.maxzoom); var tile = this._tiles[coord.id]; - if (tile && tile.loaded) { + if (tile && tile.isRenderable()) { retain[coord.id] = true; return tile; } @@ -49302,192 +51319,121 @@ TilePyramid.prototype = { } } }, - - /** - * Resizes the tile cache based on the current viewport's size. - * - * Larger viewports use more tiles and need larger caches. Larger viewports - * are more likely to be found on devices with more memory and on pages where - * the map is more important. - * - * @private - */ - updateCacheSize: function(transform) { + updateCacheSize: function (transform) { var widthInTiles = Math.ceil(transform.width / transform.tileSize) + 1; var heightInTiles = Math.ceil(transform.height / transform.tileSize) + 1; var approxTilesInView = widthInTiles * heightInTiles; var commonZoomRange = 5; this._cache.setMaxSize(Math.floor(approxTilesInView * commonZoomRange)); }, - - /** - * Removes tiles that are outside the viewport and adds new tiles that - * are inside the viewport. - * @private - */ - update: function(used, transform, fadeDuration) { + update: function (transform, fadeDuration) { + if (!this._sourceLoaded) { + return; + } var i; var coord; var tile; - this.updateCacheSize(transform); - - // Determine the overzooming/underzooming amounts. var zoom = (this.roundZoom ? Math.round : Math.floor)(this.getZoom(transform)); - var minCoveringZoom = Math.max(zoom - TilePyramid.maxOverzooming, this.minzoom); - var maxCoveringZoom = Math.max(zoom + TilePyramid.maxUnderzooming, this.minzoom); - - // Retain is a list of tiles that we shouldn't delete, even if they are not - // the most ideal tile for the current viewport. This may include tiles like - // parent or child tiles that are *already* loaded. + var minCoveringZoom = Math.max(zoom - SourceCache.maxOverzooming, this.minzoom); + var maxCoveringZoom = Math.max(zoom + SourceCache.maxUnderzooming, this.minzoom); var retain = {}; var now = new Date().getTime(); - - // Covered is a list of retained tiles who's areas are full covered by other, - // better, retained tiles. They are not drawn separately. this._coveredTiles = {}; - - var required = used ? this.coveringTiles(transform) : []; + var required = this.used ? transform.coveringTiles(this._source) : []; for (i = 0; i < required.length; i++) { coord = required[i]; tile = this.addTile(coord); - retain[coord.id] = true; - - if (tile.loaded) + if (tile.isRenderable()) continue; - - // The tile we require is not yet loaded. - // Retain child or parent tiles that cover the same area. if (!this.findLoadedChildren(coord, maxCoveringZoom, retain)) { this.findLoadedParent(coord, minCoveringZoom, retain); } } - var parentsForFading = {}; - var ids = Object.keys(retain); for (var k = 0; k < ids.length; k++) { var id = ids[k]; coord = TileCoord.fromID(id); tile = this._tiles[id]; if (tile && tile.timeAdded > now - (fadeDuration || 0)) { - // This tile is still fading in. Find tiles to cross-fade with it. if (this.findLoadedChildren(coord, maxCoveringZoom, retain)) { retain[id] = true; } this.findLoadedParent(coord, minCoveringZoom, parentsForFading); } } - var fadedParent; for (fadedParent in parentsForFading) { if (!retain[fadedParent]) { - // If a tile is only needed for fading, mark it as covered so that it isn't rendered on it's own. this._coveredTiles[fadedParent] = true; } } for (fadedParent in parentsForFading) { retain[fadedParent] = true; } - - // Remove the tiles we don't need anymore. var remove = util.keysDifference(this._tiles, retain); for (i = 0; i < remove.length; i++) { this.removeTile(+remove[i]); } - this.transform = transform; }, - - /** - * Add a tile, given its coordinate, to the pyramid. - * @param {Coordinate} coord - * @returns {Coordinate} the coordinate. - * @private - */ - addTile: function(coord) { + addTile: function (coord) { var tile = this._tiles[coord.id]; if (tile) return tile; - var wrapped = coord.wrapped(); tile = this._tiles[wrapped.id]; - if (!tile) { tile = this._cache.get(wrapped.id); if (tile && this._redoPlacement) { this._redoPlacement(tile); } } - if (!tile) { var zoom = coord.z; var overscaling = zoom > this.maxzoom ? Math.pow(2, zoom - this.maxzoom) : 1; tile = new Tile(wrapped, this.tileSize * overscaling, this.maxzoom); - this._load(tile); + this.loadTile(tile, this._tileLoaded.bind(this, tile)); } - tile.uses++; this._tiles[coord.id] = tile; - this._add(tile, coord); - + this.fire('tile.add', { tile: tile }); + this._source.fire('tile.add', { tile: tile }); return tile; }, - - /** - * Remove a tile, given its id, from the pyramid - * @param {string|number} id tile id - * @returns {undefined} nothing - * @private - */ - removeTile: function(id) { + removeTile: function (id) { var tile = this._tiles[id]; if (!tile) return; - tile.uses--; delete this._tiles[id]; - this._remove(tile); - + this.fire('tile.remove', { tile: tile }); + this._source.fire('tile.remove', { tile: tile }); if (tile.uses > 0) return; - - if (tile.loaded) { + if (tile.isRenderable()) { this._cache.add(tile.coord.wrapped().id, tile); } else { - this._abort(tile); - this._unload(tile); + tile.aborted = true; + this.abortTile(tile); + this.unloadTile(tile); } }, - - /** - * Remove all tiles from this pyramid - * @private - */ - clearTiles: function() { + clearTiles: function () { for (var id in this._tiles) this.removeTile(id); this._cache.reset(); }, - - /** - * Search through our current tiles and attempt to find the tiles that - * cover the given bounds. - * @param {Array} queryGeometry coordinates of the corners of bounding rectangle - * @returns {Array} result items have {tile, minX, maxX, minY, maxY}, where min/max bounding values are the given bounds transformed in into the coordinate space of this tile. - * @private - */ - tilesIn: function(queryGeometry) { + tilesIn: function (queryGeometry) { var tileResults = {}; - var ids = this.orderedIDs(); - + var ids = this.getIds(); var minX = Infinity; var minY = Infinity; var maxX = -Infinity; var maxY = -Infinity; var z = queryGeometry[0].zoom; - for (var k = 0; k < queryGeometry.length; k++) { var p = queryGeometry[k]; minX = Math.min(minX, p.column); @@ -49495,129 +51441,390 @@ TilePyramid.prototype = { maxX = Math.max(maxX, p.column); maxY = Math.max(maxY, p.row); } - for (var i = 0; i < ids.length; i++) { var tile = this._tiles[ids[i]]; var coord = TileCoord.fromID(ids[i]); - var tileSpaceBounds = [ coordinateToTilePoint(coord, tile.sourceMaxZoom, new Coordinate(minX, minY, z)), coordinateToTilePoint(coord, tile.sourceMaxZoom, new Coordinate(maxX, maxY, z)) ]; - - if (tileSpaceBounds[0].x < EXTENT && tileSpaceBounds[0].y < EXTENT && - tileSpaceBounds[1].x >= 0 && tileSpaceBounds[1].y >= 0) { - + if (tileSpaceBounds[0].x < EXTENT && tileSpaceBounds[0].y < EXTENT && tileSpaceBounds[1].x >= 0 && tileSpaceBounds[1].y >= 0) { var tileSpaceQueryGeometry = []; for (var j = 0; j < queryGeometry.length; j++) { tileSpaceQueryGeometry.push(coordinateToTilePoint(coord, tile.sourceMaxZoom, queryGeometry[j])); } - var tileResult = tileResults[tile.coord.id]; if (tileResult === undefined) { tileResult = tileResults[tile.coord.id] = { tile: tile, + coord: coord, queryGeometry: [], scale: Math.pow(2, this.transform.zoom - tile.coord.z) }; } - - // Wrapped tiles share one tileResult object but can have multiple queryGeometry parts tileResult.queryGeometry.push(tileSpaceQueryGeometry); } } - - var results = []; - for (var t in tileResults) { - results.push(tileResults[t]); - } - return results; + var results = []; + for (var t in tileResults) { + results.push(tileResults[t]); + } + return results; + }, + redoPlacement: function () { + var ids = this.getIds(); + for (var i = 0; i < ids.length; i++) { + var tile = this.getTileByID(ids[i]); + tile.redoPlacement(this); + } + }, + getVisibleCoordinates: function () { + return this.getRenderableIds().map(TileCoord.fromID); + } +}); +function coordinateToTilePoint(tileCoord, sourceMaxZoom, coord) { + var zoomedCoord = coord.zoomTo(Math.min(tileCoord.z, sourceMaxZoom)); + return { + x: (zoomedCoord.column - (tileCoord.x + tileCoord.w * Math.pow(2, tileCoord.z))) * EXTENT, + y: (zoomedCoord.row - tileCoord.y) * EXTENT + }; +} +function compareKeyZoom(a, b) { + return a % 32 - b % 32; +} +},{"../data/bucket":253,"../geo/coordinate":262,"../util/evented":358,"../util/lru_cache":362,"../util/util":366,"./source":290,"./tile":292,"./tile_coord":293}],292:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var Bucket = require('../data/bucket'); +var FeatureIndex = require('../data/feature_index'); +var vt = require('vector-tile'); +var Protobuf = require('pbf'); +var GeoJSONFeature = require('../util/vectortile_to_geojson'); +var featureFilter = require('feature-filter'); +var CollisionTile = require('../symbol/collision_tile'); +var CollisionBoxArray = require('../symbol/collision_box'); +var SymbolInstancesArray = require('../symbol/symbol_instances'); +var SymbolQuadsArray = require('../symbol/symbol_quads'); +module.exports = Tile; +function Tile(coord, size, sourceMaxZoom) { + this.coord = coord; + this.uid = util.uniqueId(); + this.uses = 0; + this.tileSize = size; + this.sourceMaxZoom = sourceMaxZoom; + this.buckets = {}; + this.state = 'loading'; +} +Tile.prototype = { + loadVectorData: function (data, style) { + this.state = 'loaded'; + if (!data) + return; + this.collisionBoxArray = new CollisionBoxArray(data.collisionBoxArray); + this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); + this.symbolInstancesArray = new SymbolInstancesArray(data.symbolInstancesArray); + this.symbolQuadsArray = new SymbolQuadsArray(data.symbolQuadsArray); + this.featureIndex = new FeatureIndex(data.featureIndex, data.rawTileData, this.collisionTile); + this.rawTileData = data.rawTileData; + this.buckets = unserializeBuckets(data.buckets, style); + }, + reloadSymbolData: function (data, painter, style) { + if (this.state === 'unloaded') + return; + this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); + this.featureIndex.setCollisionTile(this.collisionTile); + for (var id in this.buckets) { + var bucket = this.buckets[id]; + if (bucket.type === 'symbol') { + bucket.destroy(painter.gl); + delete this.buckets[id]; + } + } + util.extend(this.buckets, unserializeBuckets(data.buckets, style)); + }, + unloadVectorData: function (painter) { + for (var id in this.buckets) { + var bucket = this.buckets[id]; + bucket.destroy(painter.gl); + } + this.collisionBoxArray = null; + this.symbolQuadsArray = null; + this.symbolInstancesArray = null; + this.collisionTile = null; + this.featureIndex = null; + this.rawTileData = null; + this.buckets = null; + this.state = 'unloaded'; + }, + redoPlacement: function (source) { + if (this.state !== 'loaded' || this.state === 'reloading') { + this.redoWhenDone = true; + return; + } + this.state = 'reloading'; + source.dispatcher.send('redo placement', { + uid: this.uid, + source: source.id, + angle: source.map.transform.angle, + pitch: source.map.transform.pitch, + showCollisionBoxes: source.map.showCollisionBoxes + }, done.bind(this), this.workerID); + function done(_, data) { + this.reloadSymbolData(data, source.map.painter, source.map.style); + source.fire('tile.load', { tile: this }); + this.state = 'loaded'; + if (this.redoWhenDone) { + this.redoPlacement(source); + this.redoWhenDone = false; + } + } + }, + getBucket: function (layer) { + return this.buckets && this.buckets[layer.ref || layer.id]; + }, + querySourceFeatures: function (result, params) { + if (!this.rawTileData) + return; + if (!this.vtLayers) { + this.vtLayers = new vt.VectorTile(new Protobuf(new Uint8Array(this.rawTileData))).layers; + } + var layer = this.vtLayers._geojsonTileLayer || this.vtLayers[params.sourceLayer]; + if (!layer) + return; + var filter = featureFilter(params.filter); + var coord = { + z: this.coord.z, + x: this.coord.x, + y: this.coord.y + }; + for (var i = 0; i < layer.length; i++) { + var feature = layer.feature(i); + if (filter(feature)) { + var geojsonFeature = new GeoJSONFeature(feature, this.coord.z, this.coord.x, this.coord.y); + geojsonFeature.tile = coord; + result.push(geojsonFeature); + } + } + }, + isRenderable: function () { + return this.state === 'loaded' || this.state === 'reloading'; } }; - -/** - * Convert a coordinate to a point in a tile's coordinate space. - * @param {Coordinate} tileCoord - * @param {Coordinate} coord - * @returns {Object} position - * @private - */ -function coordinateToTilePoint(tileCoord, sourceMaxZoom, coord) { - var zoomedCoord = coord.zoomTo(Math.min(tileCoord.z, sourceMaxZoom)); +function unserializeBuckets(input, style) { + if (!style) + return; + var output = {}; + for (var i = 0; i < input.length; i++) { + var layer = style.getLayer(input[i].layerId); + if (!layer) + continue; + var bucket = Bucket.create(util.extend({ + layer: layer, + childLayers: input[i].childLayerIds.map(style.getLayer.bind(style)).filter(function (layer) { + return layer; + }) + }, input[i])); + output[bucket.id] = bucket; + } + return output; +} +},{"../data/bucket":253,"../data/feature_index":260,"../symbol/collision_box":318,"../symbol/collision_tile":320,"../symbol/symbol_instances":329,"../symbol/symbol_quads":330,"../util/util":366,"../util/vectortile_to_geojson":367,"feature-filter":370,"pbf":422,"vector-tile":434}],293:[function(require,module,exports){ +'use strict'; +var WhooTS = require('whoots-js'); +var Coordinate = require('../geo/coordinate'); +module.exports = TileCoord; +function TileCoord(z, x, y, w) { + if (isNaN(w)) + w = 0; + this.z = +z; + this.x = +x; + this.y = +y; + this.w = +w; + w *= 2; + if (w < 0) + w = w * -1 - 1; + var dim = 1 << this.z; + this.id = (dim * dim * w + dim * this.y + this.x) * 32 + this.z; + this.posMatrix = null; +} +TileCoord.prototype.toString = function () { + return this.z + '/' + this.x + '/' + this.y; +}; +TileCoord.prototype.toCoordinate = function (sourceMaxZoom) { + var zoom = Math.min(this.z, sourceMaxZoom); + var tileScale = Math.pow(2, zoom); + var row = this.y; + var column = this.x + tileScale * this.w; + return new Coordinate(column, row, zoom); +}; +TileCoord.fromID = function (id) { + var z = id % 32, dim = 1 << z; + var xy = (id - z) / 32; + var x = xy % dim, y = (xy - x) / dim % dim; + var w = Math.floor(xy / (dim * dim)); + if (w % 2 !== 0) + w = w * -1 - 1; + w /= 2; + return new TileCoord(z, x, y, w); +}; +function getQuadkey(z, x, y) { + var quadkey = '', mask; + for (var i = z; i > 0; i--) { + mask = 1 << i - 1; + quadkey += (x & mask ? 1 : 0) + (y & mask ? 2 : 0); + } + return quadkey; +} +TileCoord.prototype.url = function (urls, sourceMaxZoom, scheme) { + var bbox = WhooTS.getTileBBox(this.x, this.y, this.z); + var quadkey = getQuadkey(this.z, this.x, this.y); + return urls[(this.x + this.y) % urls.length].replace('{prefix}', (this.x % 16).toString(16) + (this.y % 16).toString(16)).replace('{z}', Math.min(this.z, sourceMaxZoom || this.z)).replace('{x}', this.x).replace('{y}', scheme === 'tms' ? Math.pow(2, this.z) - this.y - 1 : this.y).replace('{quadkey}', quadkey).replace('{bbox-epsg-3857}', bbox); +}; +TileCoord.prototype.parent = function (sourceMaxZoom) { + if (this.z === 0) + return null; + if (this.z > sourceMaxZoom) { + return new TileCoord(this.z - 1, this.x, this.y, this.w); + } + return new TileCoord(this.z - 1, Math.floor(this.x / 2), Math.floor(this.y / 2), this.w); +}; +TileCoord.prototype.wrapped = function () { + return new TileCoord(this.z, this.x, this.y, 0); +}; +TileCoord.prototype.children = function (sourceMaxZoom) { + if (this.z >= sourceMaxZoom) { + return [new TileCoord(this.z + 1, this.x, this.y, this.w)]; + } + var z = this.z + 1; + var x = this.x * 2; + var y = this.y * 2; + return [ + new TileCoord(z, x, y, this.w), + new TileCoord(z, x + 1, y, this.w), + new TileCoord(z, x, y + 1, this.w), + new TileCoord(z, x + 1, y + 1, this.w) + ]; +}; +function edge(a, b) { + if (a.row > b.row) { + var t = a; + a = b; + b = t; + } return { - x: (zoomedCoord.column - (tileCoord.x + tileCoord.w * Math.pow(2, tileCoord.z))) * EXTENT, - y: (zoomedCoord.row - tileCoord.y) * EXTENT + x0: a.column, + y0: a.row, + x1: b.column, + y1: b.row, + dx: b.column - a.column, + dy: b.row - a.row }; - } - -function compareKeyZoom(a, b) { - return (a % 32) - (b % 32); +function scanSpans(e0, e1, ymin, ymax, scanLine) { + var y0 = Math.max(ymin, Math.floor(e1.y0)); + var y1 = Math.min(ymax, Math.ceil(e1.y1)); + if (e0.x0 === e1.x0 && e0.y0 === e1.y0 ? e0.x0 + e1.dy / e0.dy * e0.dx < e1.x1 : e0.x1 - e1.dy / e0.dy * e0.dx < e1.x0) { + var t = e0; + e0 = e1; + e1 = t; + } + var m0 = e0.dx / e0.dy; + var m1 = e1.dx / e1.dy; + var d0 = e0.dx > 0; + var d1 = e1.dx < 0; + for (var y = y0; y < y1; y++) { + var x0 = m0 * Math.max(0, Math.min(e0.dy, y + d0 - e0.y0)) + e0.x0; + var x1 = m1 * Math.max(0, Math.min(e1.dy, y + d1 - e1.y0)) + e1.x0; + scanLine(Math.floor(x1), Math.ceil(x0), y); + } } - -},{"../data/bucket":247,"../geo/coordinate":255,"../util/lru_cache":345,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],283:[function(require,module,exports){ +function scanTriangle(a, b, c, ymin, ymax, scanLine) { + var ab = edge(a, b), bc = edge(b, c), ca = edge(c, a); + var t; + if (ab.dy > bc.dy) { + t = ab; + ab = bc; + bc = t; + } + if (ab.dy > ca.dy) { + t = ab; + ab = ca; + ca = t; + } + if (bc.dy > ca.dy) { + t = bc; + bc = ca; + ca = t; + } + if (ab.dy) + scanSpans(ca, ab, ymin, ymax, scanLine); + if (bc.dy) + scanSpans(ca, bc, ymin, ymax, scanLine); +} +TileCoord.cover = function (z, bounds, actualZ) { + var tiles = 1 << z; + var t = {}; + function scanLine(x0, x1, y) { + var x, wx, coord; + if (y >= 0 && y <= tiles) { + for (x = x0; x < x1; x++) { + wx = (x % tiles + tiles) % tiles; + coord = new TileCoord(actualZ, wx, y, Math.floor(x / tiles)); + t[coord.id] = coord; + } + } + } + scanTriangle(bounds[0], bounds[1], bounds[2], 0, tiles, scanLine); + scanTriangle(bounds[2], bounds[3], bounds[0], 0, tiles, scanLine); + return Object.keys(t).map(function (id) { + return t[id]; + }); +}; +},{"../geo/coordinate":262,"whoots-js":442}],294:[function(require,module,exports){ 'use strict'; - -var util = require('../util/util'); var Evented = require('../util/evented'); -var Source = require('./source'); +var util = require('../util/util'); +var loadTileJSON = require('./load_tilejson'); var normalizeURL = require('../util/mapbox').normalizeTileURL; - module.exports = VectorTileSource; - -function VectorTileSource(options) { - util.extend(this, util.pick(options, ['url', 'tileSize'])); +function VectorTileSource(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + util.extend(this, util.pick(options, [ + 'url', + 'scheme', + 'tileSize' + ])); this._options = util.extend({ type: 'vector' }, options); - if (this.tileSize !== 512) { throw new Error('vector tile sources must have a tileSize of 512'); } - - Source._loadTileJSON.call(this, options); + loadTileJSON(options, function (err, tileJSON) { + if (err) { + this.fire('error', err); + return; + } + util.extend(this, tileJSON); + this.fire('load'); + }.bind(this)); } - VectorTileSource.prototype = util.inherit(Evented, { minzoom: 0, maxzoom: 22, + scheme: 'xyz', tileSize: 512, reparseOverscaled: true, - _loaded: false, isTileClipped: true, - - onAdd: function(map) { + onAdd: function (map) { this.map = map; }, - - loaded: function() { - return this._pyramid && this._pyramid.loaded(); - }, - - update: function(transform) { - if (this._pyramid) { - this._pyramid.update(this.used, transform); - } - }, - - reload: function() { - if (this._pyramid) { - this._pyramid.reload(); - } - }, - - serialize: function() { + serialize: function () { return util.extend({}, this._options); }, - - getVisibleCoordinates: Source._getVisibleCoordinates, - getTile: Source._getTile, - - queryRenderedFeatures: Source._queryRenderedVectorFeatures, - querySourceFeatures: Source._querySourceFeatures, - - _loadTile: function(tile) { + loadTile: function (tile, callback) { var overscaling = tile.coord.z > this.maxzoom ? Math.pow(2, tile.coord.z - this.maxzoom) : 1; var params = { - url: normalizeURL(tile.coord.url(this.tiles, this.maxzoom), this.url), + url: normalizeURL(tile.coord.url(this.tiles, this.maxzoom, this.scheme), this.url), uid: tile.uid, coord: tile.coord, zoom: tile.coord.z, @@ -49628,66 +51835,135 @@ VectorTileSource.prototype = util.inherit(Evented, { pitch: this.map.transform.pitch, showCollisionBoxes: this.map.showCollisionBoxes }; - if (tile.workerID) { - params.rawTileData = tile.rawTileData; - this.dispatcher.send('reload tile', params, this._tileLoaded.bind(this, tile), tile.workerID); + if (tile.state === 'loading') { + tile.reloadCallback = callback; + } else { + params.rawTileData = tile.rawTileData; + this.dispatcher.send('reload tile', params, done.bind(this), tile.workerID); + } } else { - tile.workerID = this.dispatcher.send('load tile', params, this._tileLoaded.bind(this, tile)); + tile.workerID = this.dispatcher.send('load tile', params, done.bind(this)); } - }, - - _tileLoaded: function(tile, err, data) { - if (tile.aborted) - return; - - if (err) { - tile.errored = true; - this.fire('tile.error', {tile: tile, error: err}); - return; + function done(err, data) { + if (tile.aborted) + return; + if (err) { + return callback(err); + } + tile.loadVectorData(data, this.map.style); + if (tile.redoWhenDone) { + tile.redoWhenDone = false; + tile.redoPlacement(this); + } + callback(null); + if (tile.reloadCallback) { + this.loadTile(tile, tile.reloadCallback); + tile.reloadCallback = null; + } } - - tile.loadVectorData(data, this.map.style); - - if (tile.redoWhenDone) { - tile.redoWhenDone = false; - tile.redoPlacement(this); + }, + abortTile: function (tile) { + this.dispatcher.send('abort tile', { + uid: tile.uid, + source: this.id + }, null, tile.workerID); + }, + unloadTile: function (tile) { + tile.unloadVectorData(this.map.painter); + this.dispatcher.send('remove tile', { + uid: tile.uid, + source: this.id + }, null, tile.workerID); + } +}); +},{"../util/evented":358,"../util/mapbox":363,"../util/util":366,"./load_tilejson":286}],295:[function(require,module,exports){ +'use strict'; +var ajax = require('../util/ajax'); +var vt = require('vector-tile'); +var Protobuf = require('pbf'); +var WorkerTile = require('./worker_tile'); +module.exports = VectorTileWorkerSource; +function VectorTileWorkerSource(actor, styleLayers, loadVectorData) { + this.actor = actor; + this.styleLayers = styleLayers; + if (loadVectorData) { + this.loadVectorData = loadVectorData; + } + this.loading = {}; + this.loaded = {}; +} +VectorTileWorkerSource.prototype = { + loadTile: function (params, callback) { + var source = params.source, uid = params.uid; + if (!this.loading[source]) + this.loading[source] = {}; + var tile = this.loading[source][uid] = new WorkerTile(params); + tile.abort = this.loadVectorData(params, done.bind(this)); + function done(err, data) { + delete this.loading[source][uid]; + if (err) + return callback(err); + if (!data) + return callback(null, null); + tile.data = data.tile; + tile.parse(tile.data, this.styleLayers.getLayerFamilies(), this.actor, data.rawTileData, callback); + this.loaded[source] = this.loaded[source] || {}; + this.loaded[source][uid] = tile; } - - this.fire('tile.load', {tile: tile}); - this.fire('tile.stats', data.bucketStats); }, - - _abortTile: function(tile) { - tile.aborted = true; - this.dispatcher.send('abort tile', { uid: tile.uid, source: this.id }, null, tile.workerID); + reloadTile: function (params, callback) { + var loaded = this.loaded[params.source], uid = params.uid; + if (loaded && loaded[uid]) { + var tile = loaded[uid]; + tile.parse(tile.data, this.styleLayers.getLayerFamilies(), this.actor, params.rawTileData, callback); + } }, - - _addTile: function(tile) { - this.fire('tile.add', {tile: tile}); + abortTile: function (params) { + var loading = this.loading[params.source], uid = params.uid; + if (loading && loading[uid] && loading[uid].abort) { + loading[uid].abort(); + delete loading[uid]; + } }, - - _removeTile: function(tile) { - this.fire('tile.remove', {tile: tile}); + removeTile: function (params) { + var loaded = this.loaded[params.source], uid = params.uid; + if (loaded && loaded[uid]) { + delete loaded[uid]; + } }, - - _unloadTile: function(tile) { - tile.unloadVectorData(this.map.painter); - this.dispatcher.send('remove tile', { uid: tile.uid, source: this.id }, null, tile.workerID); + loadVectorData: function (params, callback) { + var xhr = ajax.getArrayBuffer(params.url, done.bind(this)); + return function abort() { + xhr.abort(); + }; + function done(err, data) { + if (err) { + return callback(err); + } + var tile = new vt.VectorTile(new Protobuf(new Uint8Array(data))); + callback(err, { + tile: tile, + rawTileData: data + }); + } }, - - redoPlacement: Source.redoPlacement, - - _redoTilePlacement: function(tile) { - tile.redoPlacement(this); + redoPlacement: function (params, callback) { + var loaded = this.loaded[params.source], loading = this.loading[params.source], uid = params.uid; + if (loaded && loaded[uid]) { + var tile = loaded[uid]; + var result = tile.redoPlacement(params.angle, params.pitch, params.showCollisionBoxes); + if (result.result) { + callback(null, result.result, result.transferables); + } + } else if (loading && loading[uid]) { + loading[uid].angle = params.angle; + } } -}); - -},{"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./source":279}],284:[function(require,module,exports){ +}; +},{"../util/ajax":349,"./worker_tile":298,"pbf":422,"vector-tile":434}],296:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); -var Tile = require('./tile'); var TileCoord = require('./tile_coord'); var LngLat = require('../geo/lng_lat'); var Point = require('point-geometry'); @@ -49697,150 +51973,88 @@ var EXTENT = require('../data/bucket').EXTENT; var RasterBoundsArray = require('../render/draw_raster').RasterBoundsArray; var Buffer = require('../data/buffer'); var VertexArrayObject = require('../render/vertex_array_object'); - module.exports = VideoSource; - -/** - * Create a Video data source instance given an options object - * @class VideoSource - * @param {Object} [options] - * @param {Array} options.urls An array of URLs to video files - * @param {Array} options.coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the video. Does not have to be a rectangle. - * @example - * var sourceObj = new mapboxgl.VideoSource({ - * url: [ - * 'https://www.mapbox.com/videos/baltimore-smoke.mp4', - * 'https://www.mapbox.com/videos/baltimore-smoke.webm' - * ], - * coordinates: [ - * [-76.54335737228394, 39.18579907229748], - * [-76.52803659439087, 39.1838364847587], - * [-76.5295386314392, 39.17683392507606], - * [-76.54520273208618, 39.17876344106642] - * ] - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -function VideoSource(options) { +function VideoSource(id, options) { + this.id = id; this.urls = options.urls; this.coordinates = options.coordinates; - - ajax.getVideo(options.urls, function(err, video) { - // @TODO handle errors via event. - if (err) return; - + ajax.getVideo(options.urls, function (err, video) { + if (err) + return this.fire('error', { error: err }); this.video = video; this.video.loop = true; - var loopID; - - // start repainting when video starts playing - this.video.addEventListener('playing', function() { + this.video.addEventListener('playing', function () { loopID = this.map.style.animationLoop.set(Infinity); this.map._rerender(); }.bind(this)); - - // stop repainting when video stops - this.video.addEventListener('pause', function() { + this.video.addEventListener('pause', function () { this.map.style.animationLoop.cancel(loopID); }.bind(this)); - - this._loaded = true; - if (this.map) { this.video.play(); this.setCoordinates(options.coordinates); } + this.fire('load'); }.bind(this)); } - -VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype */{ +VideoSource.prototype = util.inherit(Evented, { + minzoom: 0, + maxzoom: 22, + tileSize: 512, roundZoom: true, - - /** - * Return the HTML video element. - * - * @returns {Object} - */ - getVideo: function() { + getVideo: function () { return this.video; }, - - onAdd: function(map) { + onAdd: function (map) { + if (this.map) + return; this.map = map; if (this.video) { this.video.play(); this.setCoordinates(this.coordinates); } }, - - /** - * Update video coordinates and rerender map - * - * @param {Array} coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the video. Does not have to be a rectangle. - * @returns {VideoSource} this - */ - setCoordinates: function(coordinates) { + setCoordinates: function (coordinates) { this.coordinates = coordinates; - - // Calculate which mercator tile is suitable for rendering the video in - // and create a buffer with the corner coordinates. These coordinates - // may be outside the tile, because raster tiles aren't clipped when rendering. - var map = this.map; - var cornerZ0Coords = coordinates.map(function(coord) { + var cornerZ0Coords = coordinates.map(function (coord) { return map.transform.locationCoordinate(LngLat.convert(coord)).zoomTo(0); }); - var centerCoord = this.centerCoord = util.getCoordinatesCenter(cornerZ0Coords); centerCoord.column = Math.round(centerCoord.column); centerCoord.row = Math.round(centerCoord.row); - - - var tileCoords = cornerZ0Coords.map(function(coord) { + this.minzoom = this.maxzoom = centerCoord.zoom; + this._coord = new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row); + this._tileCoords = cornerZ0Coords.map(function (coord) { var zoomedCoord = coord.zoomTo(centerCoord.zoom); - return new Point( - Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), - Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); + return new Point(Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); }); - + this.fire('change'); + return this; + }, + _setTile: function (tile) { + this._prepared = false; + this.tile = tile; var maxInt16 = 32767; var array = new RasterBoundsArray(); - array.emplaceBack(tileCoords[0].x, tileCoords[0].y, 0, 0); - array.emplaceBack(tileCoords[1].x, tileCoords[1].y, maxInt16, 0); - array.emplaceBack(tileCoords[3].x, tileCoords[3].y, 0, maxInt16); - array.emplaceBack(tileCoords[2].x, tileCoords[2].y, maxInt16, maxInt16); - - this.tile = new Tile(new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row)); + array.emplaceBack(this._tileCoords[0].x, this._tileCoords[0].y, 0, 0); + array.emplaceBack(this._tileCoords[1].x, this._tileCoords[1].y, maxInt16, 0); + array.emplaceBack(this._tileCoords[3].x, this._tileCoords[3].y, 0, maxInt16); + array.emplaceBack(this._tileCoords[2].x, this._tileCoords[2].y, maxInt16, maxInt16); this.tile.buckets = {}; - this.tile.boundsBuffer = new Buffer(array.serialize(), RasterBoundsArray.serialize(), Buffer.BufferType.VERTEX); this.tile.boundsVAO = new VertexArrayObject(); - - this.fire('change'); - - return this; - }, - - loaded: function() { - return this.video && this.video.readyState >= 2; - }, - - update: function() { - // noop - }, - - reload: function() { - // noop + this.tile.state = 'loaded'; }, - - prepare: function() { - if (!this._loaded) return; - if (this.video.readyState < 2) return; // not enough data for current position - + prepare: function () { + if (this.video.readyState < 2) + return; + if (!this.tile) + return; var gl = this.map.painter.gl; - if (!this.tile.texture) { + if (!this._prepared) { + this._prepared = true; this.tile.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); @@ -49852,20 +52066,18 @@ VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype * gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.video); } - this._currentTime = this.video.currentTime; }, - - getVisibleCoordinates: function() { - if (this.tile) return [this.tile.coord]; - else return []; - }, - - getTile: function() { - return this.tile; + loadTile: function (tile, callback) { + if (this._coord && this._coord.toString() === tile.coord.toString()) { + this._setTile(tile); + callback(null); + } else { + tile.state = 'errored'; + callback(null); + } }, - - serialize: function() { + serialize: function () { return { type: 'video', urls: this.urls, @@ -49873,43 +52085,42 @@ VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype * }; } }); - -},{"../data/bucket":247,"../data/buffer":252,"../geo/lng_lat":256,"../render/draw_raster":267,"../render/vertex_array_object":273,"../util/ajax":334,"../util/evented":341,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],285:[function(require,module,exports){ +},{"../data/bucket":253,"../data/buffer":258,"../geo/lng_lat":263,"../render/draw_raster":275,"../render/vertex_array_object":281,"../util/ajax":349,"../util/evented":358,"../util/util":366,"./tile_coord":293,"point-geometry":424}],297:[function(require,module,exports){ 'use strict'; - var Actor = require('../util/actor'); -var WorkerTile = require('./worker_tile'); var StyleLayer = require('../style/style_layer'); var util = require('../util/util'); -var ajax = require('../util/ajax'); -var vt = require('vector-tile'); -var Protobuf = require('pbf'); -var supercluster = require('supercluster'); - -var geojsonvt = require('geojson-vt'); -var rewind = require('geojson-rewind'); -var GeoJSONWrapper = require('./geojson_wrapper'); -var vtpbf = require('vt-pbf'); - -module.exports = function(self) { +var VectorTileWorkerSource = require('./vector_tile_worker_source'); +var GeoJSONWorkerSource = require('./geojson_worker_source'); +module.exports = function createWorker(self) { return new Worker(self); }; - function Worker(self) { this.self = self; this.actor = new Actor(self, this); - this.loading = {}; - - this.loaded = {}; - this.geoJSONIndexes = {}; + var styleLayers = { + getLayers: function () { + return this.layers; + }.bind(this), + getLayerFamilies: function () { + return this.layerFamilies; + }.bind(this) + }; + this.workerSources = { + vector: new VectorTileWorkerSource(this.actor, styleLayers), + geojson: new GeoJSONWorkerSource(this.actor, styleLayers) + }; + this.self.registerWorkerSource = function (name, WorkerSource) { + if (this.workerSources[name]) { + throw new Error('Worker source with name "' + name + '" already registered.'); + } + this.workerSources[name] = new WorkerSource(this.actor, styleLayers); + }.bind(this); } - util.extend(Worker.prototype, { - 'set layers': function(layers) { + 'set layers': function (layers) { this.layers = {}; var that = this; - - // Filter layers and create an id -> layer map var childLayerIndicies = []; for (var i = 0; i < layers.length; i++) { var layer = layers[i]; @@ -49921,41 +52132,30 @@ util.extend(Worker.prototype, { } } } - - // Create an instance of StyleLayer per layer for (var j = 0; j < childLayerIndicies.length; j++) { setLayer(layers[childLayerIndicies[j]]); } - function setLayer(serializedLayer) { - var styleLayer = StyleLayer.create( - serializedLayer, - serializedLayer.ref && that.layers[serializedLayer.ref] - ); - styleLayer.updatePaintTransitions({}, {transition: false}); + var styleLayer = StyleLayer.create(serializedLayer, serializedLayer.ref && that.layers[serializedLayer.ref]); + styleLayer.updatePaintTransitions({}, { transition: false }); that.layers[styleLayer.id] = styleLayer; } - this.layerFamilies = createLayerFamilies(this.layers); }, - - 'update layers': function(layers) { + 'update layers': function (layers) { var that = this; var id; var layer; - - // Update ref parents for (id in layers) { layer = layers[id]; - if (layer.ref) updateLayer(layer); + if (layer.ref) + updateLayer(layer); } - - // Update ref children for (id in layers) { layer = layers[id]; - if (!layer.ref) updateLayer(layer); + if (!layer.ref) + updateLayer(layer); } - function updateLayer(layer) { var refLayer = that.layers[layer.ref]; if (that.layers[layer.id]) { @@ -49963,151 +52163,47 @@ util.extend(Worker.prototype, { } else { that.layers[layer.id] = StyleLayer.create(layer, refLayer); } - that.layers[layer.id].updatePaintTransitions({}, {transition: false}); + that.layers[layer.id].updatePaintTransitions({}, { transition: false }); } - this.layerFamilies = createLayerFamilies(this.layers); }, - - 'load tile': function(params, callback) { - var source = params.source, - uid = params.uid; - - if (!this.loading[source]) - this.loading[source] = {}; - - - var tile = this.loading[source][uid] = new WorkerTile(params); - - tile.xhr = ajax.getArrayBuffer(params.url, done.bind(this)); - - function done(err, data) { - delete this.loading[source][uid]; - - if (err) return callback(err); - - tile.data = new vt.VectorTile(new Protobuf(new Uint8Array(data))); - tile.parse(tile.data, this.layerFamilies, this.actor, data, callback); - - this.loaded[source] = this.loaded[source] || {}; - this.loaded[source][uid] = tile; - } - }, - - 'reload tile': function(params, callback) { - var loaded = this.loaded[params.source], - uid = params.uid; - if (loaded && loaded[uid]) { - var tile = loaded[uid]; - tile.parse(tile.data, this.layerFamilies, this.actor, params.rawTileData, callback); - } + 'load tile': function (params, callback) { + var type = params.type || 'vector'; + this.workerSources[type].loadTile(params, callback); }, - - 'abort tile': function(params) { - var loading = this.loading[params.source], - uid = params.uid; - if (loading && loading[uid]) { - loading[uid].xhr.abort(); - delete loading[uid]; - } + 'reload tile': function (params, callback) { + var type = params.type || 'vector'; + this.workerSources[type].reloadTile(params, callback); }, - - 'remove tile': function(params) { - var loaded = this.loaded[params.source], - uid = params.uid; - if (loaded && loaded[uid]) { - delete loaded[uid]; - } + 'abort tile': function (params) { + var type = params.type || 'vector'; + this.workerSources[type].abortTile(params); }, - - 'redo placement': function(params, callback) { - var loaded = this.loaded[params.source], - loading = this.loading[params.source], - uid = params.uid; - - if (loaded && loaded[uid]) { - var tile = loaded[uid]; - var result = tile.redoPlacement(params.angle, params.pitch, params.showCollisionBoxes); - - if (result.result) { - callback(null, result.result, result.transferables); - } - - } else if (loading && loading[uid]) { - loading[uid].angle = params.angle; - } + 'remove tile': function (params) { + var type = params.type || 'vector'; + this.workerSources[type].removeTile(params); }, - - 'parse geojson': function(params, callback) { - var indexData = function(err, data) { - rewind(data, true); - if (err) return callback(err); - if (typeof data != 'object') { - return callback(new Error("Input data is not a valid GeoJSON object.")); - } - try { - this.geoJSONIndexes[params.source] = params.cluster ? - supercluster(params.superclusterOptions).load(data.features) : - geojsonvt(data, params.geojsonVtOptions); - } catch (err) { - return callback(err); - } - callback(null); - }.bind(this); - - // Not, because of same origin issues, urls must either include an - // explicit origin or absolute path. - // ie: /foo/bar.json or http://example.com/bar.json - // but not ../foo/bar.json - if (params.url) { - ajax.getJSON(params.url, indexData); - } else if (typeof params.data === 'string') { - indexData(null, JSON.parse(params.data)); - } else { - return callback(new Error("Input data is not a valid GeoJSON object.")); - } + 'redo placement': function (params, callback) { + var type = params.type || 'vector'; + this.workerSources[type].redoPlacement(params, callback); }, - - 'load geojson tile': function(params, callback) { - var source = params.source, - coord = params.coord; - - if (!this.geoJSONIndexes[source]) return callback(null, null); // we couldn't load the file - - // console.time('tile ' + coord.z + ' ' + coord.x + ' ' + coord.y); - - var geoJSONTile = this.geoJSONIndexes[source].getTile(Math.min(coord.z, params.maxZoom), coord.x, coord.y); - - // console.timeEnd('tile ' + coord.z + ' ' + coord.x + ' ' + coord.y); - - // if (!geoJSONTile) console.log('not found', this.geoJSONIndexes[source], coord); - - var tile = geoJSONTile ? new WorkerTile(params) : undefined; - - this.loaded[source] = this.loaded[source] || {}; - this.loaded[source][params.uid] = tile; - - if (geoJSONTile) { - var geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features); - geojsonWrapper.name = '_geojsonTileLayer'; - var rawTileData = vtpbf({ layers: { '_geojsonTileLayer': geojsonWrapper }}).buffer; - tile.parse(geojsonWrapper, this.layerFamilies, this.actor, rawTileData, callback); - } else { - return callback(null, null); // nothing in the given tile + 'load worker source': function (params, callback) { + try { + this.self.importScripts(params.url); + callback(); + } catch (e) { + callback(e); } } }); - function createLayerFamilies(layers) { var families = {}; - for (var layerId in layers) { var layer = layers[layerId]; var parentLayerId = layer.ref || layer.id; var parentLayer = layers[parentLayerId]; - - if (parentLayer.layout && parentLayer.layout.visibility === 'none') continue; - + if (parentLayer.layout && parentLayer.layout.visibility === 'none') + continue; families[parentLayerId] = families[parentLayerId] || []; if (layerId === parentLayerId) { families[parentLayerId].unshift(layer); @@ -50115,21 +52211,19 @@ function createLayerFamilies(layers) { families[parentLayerId].push(layer); } } - return families; } - -},{"../style/style_layer":293,"../util/actor":333,"../util/ajax":334,"../util/util":349,"./geojson_wrapper":275,"./worker_tile":286,"geojson-rewind":353,"geojson-vt":358,"pbf":402,"supercluster":407,"vector-tile":413,"vt-pbf":417}],286:[function(require,module,exports){ +},{"../style/style_layer":305,"../util/actor":348,"../util/util":366,"./geojson_worker_source":283,"./vector_tile_worker_source":295}],298:[function(require,module,exports){ 'use strict'; - var FeatureIndex = require('../data/feature_index'); var CollisionTile = require('../symbol/collision_tile'); var Bucket = require('../data/bucket'); var CollisionBoxArray = require('../symbol/collision_box'); var DictionaryCoder = require('../util/dictionary_coder'); - +var util = require('../util/util'); +var SymbolInstancesArray = require('../symbol/symbol_instances'); +var SymbolQuadsArray = require('../symbol/symbol_quads'); module.exports = WorkerTile; - function WorkerTile(params) { this.coord = params.coord; this.uid = params.uid; @@ -50141,19 +52235,15 @@ function WorkerTile(params) { this.pitch = params.pitch; this.showCollisionBoxes = params.showCollisionBoxes; } - -WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, callback) { - +WorkerTile.prototype.parse = function (data, layerFamilies, actor, rawTileData, callback) { this.status = 'parsing'; this.data = data; - this.collisionBoxArray = new CollisionBoxArray(); + this.symbolInstancesArray = new SymbolInstancesArray(); + this.symbolQuadsArray = new SymbolQuadsArray(); var collisionTile = new CollisionTile(this.angle, this.pitch, this.collisionBoxArray); var featureIndex = new FeatureIndex(this.coord, this.overscaling, collisionTile, data.layers); var sourceLayerCoder = new DictionaryCoder(data.layers ? Object.keys(data.layers).sort() : ['_geojsonTileLayer']); - - var stats = { _total: 0 }; - var tile = this; var bucketsById = {}; var bucketsBySourceLayer = {}; @@ -50161,19 +52251,21 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c var layer; var sourceLayerId; var bucket; - - // Map non-ref layers to buckets. var bucketIndex = 0; for (var layerId in layerFamilies) { layer = layerFamilies[layerId][0]; - - if (layer.source !== this.source) continue; - if (layer.ref) continue; - if (layer.minzoom && this.zoom < layer.minzoom) continue; - if (layer.maxzoom && this.zoom >= layer.maxzoom) continue; - if (layer.layout && layer.layout.visibility === 'none') continue; - if (data.layers && !data.layers[layer.sourceLayer]) continue; - + if (layer.source !== this.source) + continue; + if (layer.ref) + continue; + if (layer.minzoom && this.zoom < layer.minzoom) + continue; + if (layer.maxzoom && this.zoom >= layer.maxzoom) + continue; + if (layer.layout && layer.layout.visibility === 'none') + continue; + if (data.layers && !data.layers[layer.sourceLayer]) + continue; bucket = Bucket.create({ layer: layer, index: bucketIndex++, @@ -50182,31 +52274,31 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c overscaling: this.overscaling, showCollisionBoxes: this.showCollisionBoxes, collisionBoxArray: this.collisionBoxArray, + symbolQuadsArray: this.symbolQuadsArray, + symbolInstancesArray: this.symbolInstancesArray, sourceLayerIndex: sourceLayerCoder.encode(layer.sourceLayer || '_geojsonTileLayer') }); bucket.createFilter(); - bucketsById[layer.id] = bucket; - - if (data.layers) { // vectortile + if (data.layers) { sourceLayerId = layer.sourceLayer; bucketsBySourceLayer[sourceLayerId] = bucketsBySourceLayer[sourceLayerId] || {}; bucketsBySourceLayer[sourceLayerId][layer.id] = bucket; } } - - // read each layer, and sort its features into buckets - if (data.layers) { // vectortile + if (data.layers) { for (sourceLayerId in bucketsBySourceLayer) { + if (layer.version === 1) { + util.warnOnce('Vector tile source "' + this.source + '" layer "' + sourceLayerId + '" does not use vector tile spec v2 ' + 'and therefore may have some rendering errors.'); + } layer = data.layers[sourceLayerId]; if (layer) { sortLayerIntoBuckets(layer, bucketsBySourceLayer[sourceLayerId]); } } - } else { // geojson + } else { sortLayerIntoBuckets(data, bucketsById); } - function sortLayerIntoBuckets(layer, buckets) { for (var i = 0; i < layer.length; i++) { var feature = layer.feature(i); @@ -50217,52 +52309,40 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c } } } - - var buckets = [], - symbolBuckets = this.symbolBuckets = [], - otherBuckets = []; - + var buckets = [], symbolBuckets = this.symbolBuckets = [], otherBuckets = []; featureIndex.bucketLayerIDs = {}; - for (var id in bucketsById) { bucket = bucketsById[id]; - if (bucket.features.length === 0) continue; - + if (bucket.features.length === 0) + continue; featureIndex.bucketLayerIDs[bucket.index] = bucket.childLayers.map(getLayerId); - buckets.push(bucket); - if (bucket.type === 'symbol') symbolBuckets.push(bucket); else otherBuckets.push(bucket); } - var icons = {}; var stacks = {}; var deps = 0; - - if (symbolBuckets.length > 0) { - - // Get dependencies for symbol buckets for (i = symbolBuckets.length - 1; i >= 0; i--) { symbolBuckets[i].updateIcons(icons); symbolBuckets[i].updateFont(stacks); } - for (var fontName in stacks) { stacks[fontName] = Object.keys(stacks[fontName]).map(Number); } icons = Object.keys(icons); - - actor.send('get glyphs', {uid: this.uid, stacks: stacks}, function(err, newStacks) { + actor.send('get glyphs', { + uid: this.uid, + stacks: stacks + }, function (err, newStacks) { stacks = newStacks; gotDependency(err); }); - if (icons.length) { - actor.send('get icons', {icons: icons}, function(err, newIcons) { + actor.send('get icons', { icons: icons }, function (err, newIcons) { icons = newIcons; gotDependency(err); }); @@ -50270,91 +52350,69 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c gotDependency(); } } - - // immediately parse non-symbol buckets (they have no dependencies) for (i = otherBuckets.length - 1; i >= 0; i--) { parseBucket(this, otherBuckets[i]); } - if (symbolBuckets.length === 0) return done(); - function gotDependency(err) { - if (err) return callback(err); + if (err) + return callback(err); deps++; if (deps === 2) { - // all symbol bucket dependencies fetched; parse them in proper order for (var i = symbolBuckets.length - 1; i >= 0; i--) { parseBucket(tile, symbolBuckets[i]); } done(); } } - function parseBucket(tile, bucket) { - var now = Date.now(); - bucket.populateBuffers(collisionTile, stacks, icons); - var time = Date.now() - now; - - + bucket.populateArrays(collisionTile, stacks, icons); if (bucket.type !== 'symbol') { for (var i = 0; i < bucket.features.length; i++) { var feature = bucket.features[i]; featureIndex.insert(feature, feature.index, bucket.sourceLayerIndex, bucket.index); } } - bucket.features = null; - - stats._total += time; - stats[bucket.id] = (stats[bucket.id] || 0) + time; } - function done() { tile.status = 'done'; - if (tile.redoPlacementAfterDone) { tile.redoPlacement(tile.angle, tile.pitch, null); tile.redoPlacementAfterDone = false; } - var featureIndex_ = featureIndex.serialize(); var collisionTile_ = collisionTile.serialize(); var collisionBoxArray = tile.collisionBoxArray.serialize(); + var symbolInstancesArray = tile.symbolInstancesArray.serialize(); + var symbolQuadsArray = tile.symbolQuadsArray.serialize(); var transferables = [rawTileData].concat(featureIndex_.transferables).concat(collisionTile_.transferables); - - var nonEmptyBuckets = buckets.filter(isBucketEmpty); - + var nonEmptyBuckets = buckets.filter(isBucketNonEmpty); callback(null, { buckets: nonEmptyBuckets.map(serializeBucket), - bucketStats: stats, // TODO put this in a separate message? featureIndex: featureIndex_.data, collisionTile: collisionTile_.data, collisionBoxArray: collisionBoxArray, + symbolInstancesArray: symbolInstancesArray, + symbolQuadsArray: symbolQuadsArray, rawTileData: rawTileData }, getTransferables(nonEmptyBuckets).concat(transferables)); } }; - -WorkerTile.prototype.redoPlacement = function(angle, pitch, showCollisionBoxes) { +WorkerTile.prototype.redoPlacement = function (angle, pitch, showCollisionBoxes) { if (this.status !== 'done') { this.redoPlacementAfterDone = true; this.angle = angle; return {}; } - var collisionTile = new CollisionTile(angle, pitch, this.collisionBoxArray); - var buckets = this.symbolBuckets; - for (var i = buckets.length - 1; i >= 0; i--) { buckets[i].placeFeatures(collisionTile, showCollisionBoxes); } - var collisionTile_ = collisionTile.serialize(); - - var nonEmptyBuckets = buckets.filter(isBucketEmpty); - + var nonEmptyBuckets = buckets.filter(isBucketNonEmpty); return { result: { buckets: nonEmptyBuckets.map(serializeBucket), @@ -50363,116 +52421,72 @@ WorkerTile.prototype.redoPlacement = function(angle, pitch, showCollisionBoxes) transferables: getTransferables(nonEmptyBuckets).concat(collisionTile_.transferables) }; }; - -function isBucketEmpty(bucket) { - for (var programName in bucket.arrayGroups) { - var programArrayGroups = bucket.arrayGroups[programName]; - for (var k = 0; k < programArrayGroups.length; k++) { - var programArrayGroup = programArrayGroups[k]; - for (var layoutOrPaint in programArrayGroup) { - var arrays = programArrayGroup[layoutOrPaint]; - for (var bufferName in arrays) { - if (arrays[bufferName].length > 0) return true; - } - } - } - } - return false; +function isBucketNonEmpty(bucket) { + return !bucket.isEmpty(); } - function serializeBucket(bucket) { return bucket.serialize(); } - function getTransferables(buckets) { var transferables = []; for (var i in buckets) { - var bucket = buckets[i]; - for (var programName in bucket.arrayGroups) { - var programArrayGroups = bucket.arrayGroups[programName]; - for (var k = 0; k < programArrayGroups.length; k++) { - var programArrayGroup = programArrayGroups[k]; - for (var layoutOrPaint in programArrayGroup) { - var arrays = programArrayGroup[layoutOrPaint]; - for (var bufferName in arrays) { - transferables.push(arrays[bufferName].arrayBuffer); - } - } - } - } + buckets[i].getTransferables(transferables); } return transferables; } - function getLayerId(layer) { return layer.id; } - -},{"../data/bucket":247,"../data/feature_index":253,"../symbol/collision_box":306,"../symbol/collision_tile":308,"../util/dictionary_coder":340}],287:[function(require,module,exports){ +},{"../data/bucket":253,"../data/feature_index":260,"../symbol/collision_box":318,"../symbol/collision_tile":320,"../symbol/symbol_instances":329,"../symbol/symbol_quads":330,"../util/dictionary_coder":356,"../util/util":366}],299:[function(require,module,exports){ 'use strict'; - module.exports = AnimationLoop; - function AnimationLoop() { this.n = 0; this.times = []; } - -// Are all animations done? -AnimationLoop.prototype.stopped = function() { - this.times = this.times.filter(function(t) { - return t.time >= (new Date()).getTime(); +AnimationLoop.prototype.stopped = function () { + this.times = this.times.filter(function (t) { + return t.time >= new Date().getTime(); }); return !this.times.length; }; - -// Add a new animation that will run t milliseconds -// Returns an id that can be used to cancel it layer -AnimationLoop.prototype.set = function(t) { - this.times.push({ id: this.n, time: t + (new Date()).getTime() }); +AnimationLoop.prototype.set = function (t) { + this.times.push({ + id: this.n, + time: t + new Date().getTime() + }); return this.n++; }; - -// Cancel an animation -AnimationLoop.prototype.cancel = function(n) { - this.times = this.times.filter(function(t) { +AnimationLoop.prototype.cancel = function (n) { + this.times = this.times.filter(function (t) { return t.id !== n; }); }; - -},{}],288:[function(require,module,exports){ +},{}],300:[function(require,module,exports){ 'use strict'; - var Evented = require('../util/evented'); var ajax = require('../util/ajax'); var browser = require('../util/browser'); var normalizeURL = require('../util/mapbox').normalizeSpriteURL; - module.exports = ImageSprite; - function ImageSprite(base) { this.base = base; this.retina = browser.devicePixelRatio > 1; - var format = this.retina ? '@2x' : ''; - - ajax.getJSON(normalizeURL(base, format, '.json'), function(err, data) { + ajax.getJSON(normalizeURL(base, format, '.json'), function (err, data) { if (err) { - this.fire('error', {error: err}); + this.fire('error', { error: err }); return; } - this.data = data; - if (this.img) this.fire('load'); + if (this.img) + this.fire('load'); }.bind(this)); - - ajax.getImage(normalizeURL(base, format, '.png'), function(err, img) { + ajax.getImage(normalizeURL(base, format, '.png'), function (err, img) { if (err) { - this.fire('error', {error: err}); + this.fire('error', { error: err }); return; } - - // premultiply the sprite var data = img.getData(); var newdata = img.data = new Uint8Array(data.length); for (var i = 0; i < data.length; i += 4) { @@ -50482,96 +52496,82 @@ function ImageSprite(base) { newdata[i + 2] = data[i + 2] * alpha; newdata[i + 3] = data[i + 3]; } - this.img = img; - if (this.data) this.fire('load'); + if (this.data) + this.fire('load'); }.bind(this)); } - ImageSprite.prototype = Object.create(Evented); - -ImageSprite.prototype.toJSON = function() { +ImageSprite.prototype.toJSON = function () { return this.base; }; - -ImageSprite.prototype.loaded = function() { +ImageSprite.prototype.loaded = function () { return !!(this.data && this.img); }; - -ImageSprite.prototype.resize = function(/*gl*/) { +ImageSprite.prototype.resize = function () { if (browser.devicePixelRatio > 1 !== this.retina) { var newSprite = new ImageSprite(this.base); - newSprite.on('load', function() { + newSprite.on('load', function () { this.img = newSprite.img; this.data = newSprite.data; this.retina = newSprite.retina; }.bind(this)); } }; - -function SpritePosition() {} -SpritePosition.prototype = { x: 0, y: 0, width: 0, height: 0, pixelRatio: 1, sdf: false }; - -ImageSprite.prototype.getSpritePosition = function(name) { - if (!this.loaded()) return new SpritePosition(); - +function SpritePosition() { +} +SpritePosition.prototype = { + x: 0, + y: 0, + width: 0, + height: 0, + pixelRatio: 1, + sdf: false +}; +ImageSprite.prototype.getSpritePosition = function (name) { + if (!this.loaded()) + return new SpritePosition(); var pos = this.data && this.data[name]; - if (pos && this.img) return pos; - + if (pos && this.img) + return pos; return new SpritePosition(); }; - -},{"../util/ajax":334,"../util/browser":335,"../util/evented":341,"../util/mapbox":346}],289:[function(require,module,exports){ +},{"../util/ajax":349,"../util/browser":350,"../util/evented":358,"../util/mapbox":363}],301:[function(require,module,exports){ 'use strict'; - -var parseCSSColor = require('csscolorparser').parseCSSColor; +var parseColorString = require('csscolorparser').parseCSSColor; var util = require('../util/util'); - -var colorCache = {}; - -function parseColor(input) { - - if (colorCache[input]) { - return colorCache[input]; - - // RGBA array - } else if (Array.isArray(input)) { - return input; - - // GL function - } else if (input && input.stops) { +var StyleFunction = require('./style_function'); +var cache = {}; +module.exports = function parseColor(input) { + if (StyleFunction.isFunctionDefinition(input)) { return util.extend({}, input, { - stops: input.stops.map(parseFunctionStopColor) + stops: input.stops.map(function (stop) { + return [ + stop[0], + parseColor(stop[1]) + ]; + }) }); - - // Color string } else if (typeof input === 'string') { - var parsedColor = parseCSSColor(input); - if (!parsedColor) { throw new Error('Invalid color ' + input); } - - var output = colorDowngrade(parsedColor); - colorCache[input] = output; - return output; - + if (!cache[input]) { + var rgba = parseColorString(input); + if (!rgba) { + throw new Error('Invalid color ' + input); + } + cache[input] = [ + rgba[0] / 255 * rgba[3], + rgba[1] / 255 * rgba[3], + rgba[2] / 255 * rgba[3], + rgba[3] + ]; + } + return cache[input]; } else { throw new Error('Invalid color ' + input); } - -} - -function parseFunctionStopColor(stop) { - return [stop[0], parseColor(stop[1])]; -} - -function colorDowngrade(color) { - return [color[0] / 255, color[1] / 255, color[2] / 255, color[3] / 1]; -} - -module.exports = parseColor; - -},{"../util/util":349,"csscolorparser":351}],290:[function(require,module,exports){ +}; +},{"../util/util":366,"./style_function":304,"csscolorparser":368}],302:[function(require,module,exports){ 'use strict'; - var Evented = require('../util/evented'); var StyleLayer = require('./style_layer'); var ImageSprite = require('./image_sprite'); @@ -50586,67 +52586,56 @@ var Dispatcher = require('../util/dispatcher'); var AnimationLoop = require('./animation_loop'); var validateStyle = require('./validate_style'); var Source = require('../source/source'); +var QueryFeatures = require('../source/query_features'); +var SourceCache = require('../source/source_cache'); var styleSpec = require('./style_spec'); var StyleFunction = require('./style_function'); - module.exports = Style; - -function Style(stylesheet, animationLoop) { +function Style(stylesheet, animationLoop, workerCount) { this.animationLoop = animationLoop || new AnimationLoop(); - this.dispatcher = new Dispatcher(Math.max(browser.hardwareConcurrency - 1, 1), this); - this.spriteAtlas = new SpriteAtlas(512, 512); + this.dispatcher = new Dispatcher(workerCount || 1, this); + this.spriteAtlas = new SpriteAtlas(1024, 1024); this.lineAtlas = new LineAtlas(256, 512); - this._layers = {}; - this._order = []; + this._order = []; this._groups = []; this.sources = {}; this.zoomHistory = {}; - util.bindAll([ '_forwardSourceEvent', '_forwardTileEvent', '_forwardLayerEvent', '_redoPlacement' ], this); - this._resetUpdates(); - - var loaded = function(err, stylesheet) { + var stylesheetLoaded = function (err, stylesheet) { if (err) { - this.fire('error', {error: err}); + this.fire('error', { error: err }); return; } - - if (validateStyle.emitErrors(this, validateStyle(stylesheet))) return; - + if (validateStyle.emitErrors(this, validateStyle(stylesheet))) + return; this._loaded = true; this.stylesheet = stylesheet; - this.updateClasses(); - var sources = stylesheet.sources; for (var id in sources) { this.addSource(id, sources[id]); } - if (stylesheet.sprite) { this.sprite = new ImageSprite(stylesheet.sprite); this.sprite.on('load', this.fire.bind(this, 'change')); } - this.glyphSource = new GlyphSource(stylesheet.glyphs); this._resolve(); this.fire('load'); }.bind(this); - if (typeof stylesheet === 'string') { - ajax.getJSON(normalizeURL(stylesheet), loaded); + ajax.getJSON(normalizeURL(stylesheet), stylesheetLoaded); } else { - browser.frame(loaded.bind(this, null, stylesheet)); + browser.frame(stylesheetLoaded.bind(this, null, stylesheet)); } - - this.on('source.load', function(event) { + this.on('source.load', function (event) { var source = event.source; if (source && source.vectorLayerIds) { for (var layerId in this._layers) { @@ -50658,119 +52647,93 @@ function Style(stylesheet, animationLoop) { } }); } - Style.prototype = util.inherit(Evented, { _loaded: false, - - _validateLayer: function(layer) { + _validateLayer: function (layer) { var source = this.sources[layer.source]; - - if (!layer.sourceLayer) return; - if (!source) return; - if (!source.vectorLayerIds) return; - + if (!layer.sourceLayer) + return; + if (!source) + return; + if (!source.vectorLayerIds) + return; if (source.vectorLayerIds.indexOf(layer.sourceLayer) === -1) { - this.fire('error', { - error: new Error( - 'Source layer "' + layer.sourceLayer + '" ' + - 'does not exist on source "' + source.id + '" ' + - 'as specified by style layer "' + layer.id + '"' - ) - }); + this.fire('error', { error: new Error('Source layer "' + layer.sourceLayer + '" ' + 'does not exist on source "' + source.id + '" ' + 'as specified by style layer "' + layer.id + '"') }); } }, - - loaded: function() { + loaded: function () { if (!this._loaded) return false; - + if (Object.keys(this._updates.sources).length) + return false; for (var id in this.sources) if (!this.sources[id].loaded()) return false; - if (this.sprite && !this.sprite.loaded()) return false; - return true; }, - - _resolve: function() { + _resolve: function () { var layer, layerJSON; - this._layers = {}; - this._order = this.stylesheet.layers.map(function(layer) { + this._order = this.stylesheet.layers.map(function (layer) { return layer.id; }); - - // resolve all layers WITHOUT a ref for (var i = 0; i < this.stylesheet.layers.length; i++) { layerJSON = this.stylesheet.layers[i]; - if (layerJSON.ref) continue; + if (layerJSON.ref) + continue; layer = StyleLayer.create(layerJSON); this._layers[layer.id] = layer; layer.on('error', this._forwardLayerEvent); } - - // resolve all layers WITH a ref for (var j = 0; j < this.stylesheet.layers.length; j++) { layerJSON = this.stylesheet.layers[j]; - if (!layerJSON.ref) continue; + if (!layerJSON.ref) + continue; var refLayer = this.getLayer(layerJSON.ref); layer = StyleLayer.create(layerJSON, refLayer); this._layers[layer.id] = layer; layer.on('error', this._forwardLayerEvent); } - this._groupLayers(); this._updateWorkerLayers(); }, - - _groupLayers: function() { + _groupLayers: function () { var group; - this._groups = []; - - // Split into groups of consecutive top-level layers with the same source. for (var i = 0; i < this._order.length; ++i) { var layer = this._layers[this._order[i]]; - if (!group || layer.source !== group.source) { group = []; group.source = layer.source; this._groups.push(group); } - group.push(layer); } }, - - _updateWorkerLayers: function(ids) { + _updateWorkerLayers: function (ids) { this.dispatcher.broadcast(ids ? 'update layers' : 'set layers', this._serializeLayers(ids)); }, - - _serializeLayers: function(ids) { + _serializeLayers: function (ids) { ids = ids || this._order; var serialized = []; - var options = {includeRefProperties: true}; + var options = { includeRefProperties: true }; for (var i = 0; i < ids.length; i++) { serialized.push(this._layers[ids[i]].serialize(options)); } return serialized; }, - - _applyClasses: function(classes, options) { - if (!this._loaded) return; - + _applyClasses: function (classes, options) { + if (!this._loaded) + return; classes = classes || []; - options = options || {transition: true}; + options = options || { transition: true }; var transition = this.stylesheet.transition || {}; - var layers = this._updates.allPaintProps ? this._layers : this._updates.paintProps; - for (var id in layers) { var layer = this._layers[id]; var props = this._updates.paintProps[id]; - if (this._updates.allPaintProps || props.all) { layer.updatePaintTransitions(classes, options, transition, this.animationLoop); } else { @@ -50780,70 +52743,49 @@ Style.prototype = util.inherit(Evented, { } } }, - - _recalculate: function(z) { + _recalculate: function (z) { for (var sourceId in this.sources) this.sources[sourceId].used = false; - this._updateZoomHistory(z); - this.rasterFadeDuration = 300; for (var layerId in this._layers) { var layer = this._layers[layerId]; - layer.recalculate(z, this.zoomHistory); if (!layer.isHidden(z) && layer.source) { this.sources[layer.source].used = true; } } - var maxZoomTransitionDuration = 300; if (Math.floor(this.z) !== Math.floor(z)) { this.animationLoop.set(maxZoomTransitionDuration); } - this.z = z; this.fire('zoom'); }, - - _updateZoomHistory: function(z) { - + _updateZoomHistory: function (z) { var zh = this.zoomHistory; - if (zh.lastIntegerZoom === undefined) { - // first time zh.lastIntegerZoom = Math.floor(z); zh.lastIntegerZoomTime = 0; zh.lastZoom = z; } - - // check whether an integer zoom level as passed since the last frame - // and if yes, record it with the time. Used for transitioning patterns. if (Math.floor(zh.lastZoom) < Math.floor(z)) { zh.lastIntegerZoom = Math.floor(z); zh.lastIntegerZoomTime = Date.now(); - } else if (Math.floor(zh.lastZoom) > Math.floor(z)) { zh.lastIntegerZoom = Math.floor(z + 1); zh.lastIntegerZoomTime = Date.now(); } - zh.lastZoom = z; }, - _checkLoaded: function () { if (!this._loaded) { throw new Error('Style is not done loading'); } }, - - /** - * Apply queued style updates in a batch - * @private - */ - update: function(classes, options) { - if (!this._updates.changed) return this; - + update: function (classes, options) { + if (!this._updates.changed) + return this; if (this._updates.allLayers) { this._groupLayers(); this._updateWorkerLayers(); @@ -50853,30 +52795,23 @@ Style.prototype = util.inherit(Evented, { this._updateWorkerLayers(updatedIds); } } - var updatedSourceIds = Object.keys(this._updates.sources); var i; for (i = 0; i < updatedSourceIds.length; i++) { this._reloadSource(updatedSourceIds[i]); } - for (i = 0; i < this._updates.events.length; i++) { var args = this._updates.events[i]; this.fire(args[0], args[1]); } - this._applyClasses(classes, options); - if (this._updates.changed) { this.fire('change'); } - this._resetUpdates(); - return this; }, - - _resetUpdates: function() { + _resetUpdates: function () { this._updates = { events: [], layers: {}, @@ -50884,122 +52819,78 @@ Style.prototype = util.inherit(Evented, { paintProps: {} }; }, - - addSource: function(id, source) { + addSource: function (id, source) { this._checkLoaded(); if (this.sources[id] !== undefined) { throw new Error('There is already a source with this ID'); } - if (!Source.is(source) && this._handleErrors(validateStyle.source, 'sources.' + id, source)) return this; - - source = Source.create(source); + if (!source.type) { + throw new Error('The type property must be defined, but the only the following properties were given: ' + Object.keys(source) + '.'); + } + var builtIns = [ + 'vector', + 'raster', + 'geojson', + 'video', + 'image' + ]; + var shouldValidate = builtIns.indexOf(source.type) >= 0; + if (shouldValidate && this._handleErrors(validateStyle.source, 'sources.' + id, source)) + return this; + source = new SourceCache(id, source, this.dispatcher); this.sources[id] = source; - source.id = id; source.style = this; - source.dispatcher = this.dispatcher; - source - .on('load', this._forwardSourceEvent) - .on('error', this._forwardSourceEvent) - .on('change', this._forwardSourceEvent) - .on('tile.add', this._forwardTileEvent) - .on('tile.load', this._forwardTileEvent) - .on('tile.error', this._forwardTileEvent) - .on('tile.remove', this._forwardTileEvent) - .on('tile.stats', this._forwardTileEvent); - - this._updates.events.push(['source.add', {source: source}]); + source.on('load', this._forwardSourceEvent).on('error', this._forwardSourceEvent).on('change', this._forwardSourceEvent).on('tile.add', this._forwardTileEvent).on('tile.load', this._forwardTileEvent).on('tile.error', this._forwardTileEvent).on('tile.remove', this._forwardTileEvent).on('tile.stats', this._forwardTileEvent); + this._updates.events.push([ + 'source.add', + { source: source } + ]); this._updates.changed = true; - return this; }, - - /** - * Remove a source from this stylesheet, given its id. - * @param {string} id id of the source to remove - * @returns {Style} this style - * @throws {Error} if no source is found with the given ID - * @private - */ - removeSource: function(id) { + removeSource: function (id) { this._checkLoaded(); - if (this.sources[id] === undefined) { throw new Error('There is no source with this ID'); } var source = this.sources[id]; delete this.sources[id]; - source - .off('load', this._forwardSourceEvent) - .off('error', this._forwardSourceEvent) - .off('change', this._forwardSourceEvent) - .off('tile.add', this._forwardTileEvent) - .off('tile.load', this._forwardTileEvent) - .off('tile.error', this._forwardTileEvent) - .off('tile.remove', this._forwardTileEvent) - .off('tile.stats', this._forwardTileEvent); - - this._updates.events.push(['source.remove', {source: source}]); + delete this._updates.sources[id]; + source.off('load', this._forwardSourceEvent).off('error', this._forwardSourceEvent).off('change', this._forwardSourceEvent).off('tile.add', this._forwardTileEvent).off('tile.load', this._forwardTileEvent).off('tile.error', this._forwardTileEvent).off('tile.remove', this._forwardTileEvent).off('tile.stats', this._forwardTileEvent); + this._updates.events.push([ + 'source.remove', + { source: source } + ]); this._updates.changed = true; - return this; }, - - /** - * Get a source by id. - * @param {string} id id of the desired source - * @returns {Object} source - * @private - */ - getSource: function(id) { - return this.sources[id]; + getSource: function (id) { + return this.sources[id] && this.sources[id].getSource(); }, - - /** - * Add a layer to the map style. The layer will be inserted before the layer with - * ID `before`, or appended if `before` is omitted. - * @param {StyleLayer|Object} layer - * @param {string=} before ID of an existing layer to insert before - * @fires layer.add - * @returns {Style} `this` - * @private - */ - addLayer: function(layer, before) { + addLayer: function (layer, before) { this._checkLoaded(); - if (!(layer instanceof StyleLayer)) { - // this layer is not in the style.layers array, so we pass an impossible array index - if (this._handleErrors(validateStyle.layer, - 'layers.' + layer.id, layer, false, {arrayIndex: -1})) return this; - + if (this._handleErrors(validateStyle.layer, 'layers.' + layer.id, layer, false, { arrayIndex: -1 })) + return this; var refLayer = layer.ref && this.getLayer(layer.ref); layer = StyleLayer.create(layer, refLayer); } this._validateLayer(layer); - layer.on('error', this._forwardLayerEvent); - this._layers[layer.id] = layer; this._order.splice(before ? this._order.indexOf(before) : Infinity, 0, layer.id); - this._updates.allLayers = true; if (layer.source) { this._updates.sources[layer.source] = true; } - this._updates.events.push(['layer.add', {layer: layer}]); - + this._updates.events.push([ + 'layer.add', + { layer: layer } + ]); return this.updateClasses(layer.id); }, - - /** - * Remove a layer from this stylesheet, given its id. - * @param {string} id id of the layer to remove - * @returns {Style} this style - * @throws {Error} if no layer is found with the given ID - * @private - */ - removeLayer: function(id) { + removeLayer: function (id) { this._checkLoaded(); - var layer = this._layers[id]; if (layer === undefined) { throw new Error('There is no layer with this ID'); @@ -51009,53 +52900,34 @@ Style.prototype = util.inherit(Evented, { this.removeLayer(i); } } - layer.off('error', this._forwardLayerEvent); - delete this._layers[id]; + delete this._updates.layers[id]; + delete this._updates.paintProps[id]; this._order.splice(this._order.indexOf(id), 1); - this._updates.allLayers = true; - this._updates.events.push(['layer.remove', {layer: layer}]); + this._updates.events.push([ + 'layer.remove', + { layer: layer } + ]); this._updates.changed = true; - return this; }, - - /** - * Return the style layer object with the given `id`. - * - * @param {string} id - id of the desired layer - * @returns {?Object} a layer, if one with the given `id` exists - * @private - */ - getLayer: function(id) { + getLayer: function (id) { return this._layers[id]; }, - - /** - * If a layer has a `ref` property that makes it derive some values - * from another layer, return that referent layer. Otherwise, - * returns the layer itself. - * @param {string} id the layer's id - * @returns {Layer} the referent layer or the layer itself - * @private - */ - getReferentLayer: function(id) { + getReferentLayer: function (id) { var layer = this.getLayer(id); if (layer.ref) { layer = this.getLayer(layer.ref); } return layer; }, - - setLayerZoomRange: function(layerId, minzoom, maxzoom) { + setLayerZoomRange: function (layerId, minzoom, maxzoom) { this._checkLoaded(); - var layer = this.getReferentLayer(layerId); - - if (layer.minzoom === minzoom && layer.maxzoom === maxzoom) return this; - + if (layer.minzoom === minzoom && layer.maxzoom === maxzoom) + return this; if (minzoom != null) { layer.minzoom = minzoom; } @@ -51064,91 +52936,62 @@ Style.prototype = util.inherit(Evented, { } return this._updateLayer(layer); }, - - setFilter: function(layerId, filter) { + setFilter: function (layerId, filter) { this._checkLoaded(); - var layer = this.getReferentLayer(layerId); - - if (this._handleErrors(validateStyle.filter, 'layers.' + layer.id + '.filter', filter)) return this; - - if (util.deepEqual(layer.filter, filter)) return this; + if (filter !== null && this._handleErrors(validateStyle.filter, 'layers.' + layer.id + '.filter', filter)) + return this; + if (util.deepEqual(layer.filter, filter)) + return this; layer.filter = util.clone(filter); - return this._updateLayer(layer); }, - - /** - * Get a layer's filter object - * @param {string} layer the layer to inspect - * @returns {*} the layer's filter, if any - * @private - */ - getFilter: function(layer) { + getFilter: function (layer) { return this.getReferentLayer(layer).filter; }, - - setLayoutProperty: function(layerId, name, value) { + setLayoutProperty: function (layerId, name, value) { this._checkLoaded(); - var layer = this.getReferentLayer(layerId); - - if (util.deepEqual(layer.getLayoutProperty(name), value)) return this; - + if (util.deepEqual(layer.getLayoutProperty(name), value)) + return this; layer.setLayoutProperty(name, value); return this._updateLayer(layer); }, - - /** - * Get a layout property's value from a given layer - * @param {string} layer the layer to inspect - * @param {string} name the name of the layout property - * @returns {*} the property value - * @private - */ - getLayoutProperty: function(layer, name) { + getLayoutProperty: function (layer, name) { return this.getReferentLayer(layer).getLayoutProperty(name); }, - - setPaintProperty: function(layerId, name, value, klass) { + setPaintProperty: function (layerId, name, value, klass) { this._checkLoaded(); - var layer = this.getLayer(layerId); - - if (util.deepEqual(layer.getPaintProperty(name, klass), value)) return this; - + if (util.deepEqual(layer.getPaintProperty(name, klass), value)) + return this; var wasFeatureConstant = layer.isPaintValueFeatureConstant(name); layer.setPaintProperty(name, value, klass); - - var isFeatureConstant = !(StyleFunction.isFunctionDefinition(value) && value.property !== '$zoom' && value.property !== undefined); - + var isFeatureConstant = !(value && StyleFunction.isFunctionDefinition(value) && value.property !== '$zoom' && value.property !== undefined); if (!isFeatureConstant || !wasFeatureConstant) { this._updates.layers[layerId] = true; if (layer.source) { this._updates.sources[layer.source] = true; } } - return this.updateClasses(layerId, name); }, - - getPaintProperty: function(layer, name, klass) { + getPaintProperty: function (layer, name, klass) { return this.getLayer(layer).getPaintProperty(name, klass); }, - updateClasses: function (layerId, paintName) { this._updates.changed = true; if (!layerId) { this._updates.allPaintProps = true; } else { var props = this._updates.paintProps; - if (!props[layerId]) props[layerId] = {}; + if (!props[layerId]) + props[layerId] = {}; props[layerId][paintName || 'all'] = true; } return this; }, - - serialize: function() { + serialize: function () { return util.filterObject({ version: this.stylesheet.version, name: this.stylesheet.name, @@ -51160,15 +53003,16 @@ Style.prototype = util.inherit(Evented, { sprite: this.stylesheet.sprite, glyphs: this.stylesheet.glyphs, transition: this.stylesheet.transition, - sources: util.mapObject(this.sources, function(source) { + sources: util.mapObject(this.sources, function (source) { return source.serialize(); }), - layers: this._order.map(function(id) { + layers: this._order.map(function (id) { return this._layers[id].serialize(); }, this) - }, function(value) { return value !== undefined; }); + }, function (value) { + return value !== undefined; + }); }, - _updateLayer: function (layer) { this._updates.layers[layer.id] = true; if (layer.source) { @@ -51177,8 +53021,7 @@ Style.prototype = util.inherit(Evented, { this._updates.changed = true; return this; }, - - _flattenRenderedFeatures: function(sourceResults) { + _flattenRenderedFeatures: function (sourceResults) { var features = []; for (var l = this._order.length - 1; l >= 0; l--) { var layerID = this._order[l]; @@ -51193,31 +53036,48 @@ Style.prototype = util.inherit(Evented, { } return features; }, - - queryRenderedFeatures: function(queryGeometry, params, zoom, bearing) { + queryRenderedFeatures: function (queryGeometry, params, zoom, bearing) { if (params && params.filter) { this._handleErrors(validateStyle.filter, 'queryRenderedFeatures.filter', params.filter, true); } - + var includedSources = {}; + if (params && params.layers) { + for (var i = 0; i < params.layers.length; i++) { + var layerId = params.layers[i]; + includedSources[this._layers[layerId].source] = true; + } + } var sourceResults = []; for (var id in this.sources) { + if (params.layers && !includedSources[id]) + continue; var source = this.sources[id]; - if (source.queryRenderedFeatures) { - sourceResults.push(source.queryRenderedFeatures(queryGeometry, params, zoom, bearing)); - } + var results = QueryFeatures.rendered(source, this._layers, queryGeometry, params, zoom, bearing); + sourceResults.push(results); } return this._flattenRenderedFeatures(sourceResults); }, - - querySourceFeatures: function(sourceID, params) { + querySourceFeatures: function (sourceID, params) { if (params && params.filter) { this._handleErrors(validateStyle.filter, 'querySourceFeatures.filter', params.filter, true); } - var source = this.getSource(sourceID); - return source && source.querySourceFeatures ? source.querySourceFeatures(params) : []; + var source = this.sources[sourceID]; + return source ? QueryFeatures.source(source, params) : []; }, - - _handleErrors: function(validate, key, value, throws, props) { + addSourceType: function (name, SourceType, callback) { + if (Source.getType(name)) { + return callback(new Error('A source type called "' + name + '" already exists.')); + } + Source.setType(name, SourceType); + if (!SourceType.workerSourceURL) { + return callback(null, null); + } + this.dispatcher.broadcast('load worker source', { + name: name, + url: SourceType.workerSourceURL + }, callback); + }, + _handleErrors: function (validate, key, value, throws, props) { var action = throws ? validateStyle.throwErrors : validateStyle.emitErrors; var result = validate.call(validateStyle, util.extend({ key: key, @@ -51227,114 +53087,93 @@ Style.prototype = util.inherit(Evented, { }, props)); return action.call(validateStyle, this, result); }, - - _remove: function() { + _remove: function () { this.dispatcher.remove(); }, - - _reloadSource: function(id) { + _reloadSource: function (id) { this.sources[id].reload(); }, - - _updateSources: function(transform) { + _updateSources: function (transform) { for (var id in this.sources) { this.sources[id].update(transform); } }, - - _redoPlacement: function() { + _redoPlacement: function () { for (var id in this.sources) { - if (this.sources[id].redoPlacement) this.sources[id].redoPlacement(); + if (this.sources[id].redoPlacement) + this.sources[id].redoPlacement(); } }, - - _forwardSourceEvent: function(e) { - this.fire('source.' + e.type, util.extend({source: e.target}, e)); + _forwardSourceEvent: function (e) { + this.fire('source.' + e.type, util.extend({ source: e.target.getSource() }, e)); }, - - _forwardTileEvent: function(e) { - this.fire(e.type, util.extend({source: e.target}, e)); + _forwardTileEvent: function (e) { + this.fire(e.type, util.extend({ source: e.target }, e)); }, - - _forwardLayerEvent: function(e) { - this.fire('layer.' + e.type, util.extend({layer: {id: e.target.id}}, e)); + _forwardLayerEvent: function (e) { + this.fire('layer.' + e.type, util.extend({ layer: { id: e.target.id } }, e)); }, - - // Callbacks from web workers - - 'get sprite json': function(params, callback) { + 'get sprite json': function (params, callback) { var sprite = this.sprite; if (sprite.loaded()) { - callback(null, { sprite: sprite.data, retina: sprite.retina }); + callback(null, { + sprite: sprite.data, + retina: sprite.retina + }); } else { - sprite.on('load', function() { - callback(null, { sprite: sprite.data, retina: sprite.retina }); + sprite.on('load', function () { + callback(null, { + sprite: sprite.data, + retina: sprite.retina + }); }); } }, - - 'get icons': function(params, callback) { + 'get icons': function (params, callback) { var sprite = this.sprite; var spriteAtlas = this.spriteAtlas; if (sprite.loaded()) { spriteAtlas.setSprite(sprite); spriteAtlas.addIcons(params.icons, callback); } else { - sprite.on('load', function() { + sprite.on('load', function () { spriteAtlas.setSprite(sprite); spriteAtlas.addIcons(params.icons, callback); }); } }, - - 'get glyphs': function(params, callback) { - var stacks = params.stacks, - remaining = Object.keys(stacks).length, - allGlyphs = {}; - + 'get glyphs': function (params, callback) { + var stacks = params.stacks, remaining = Object.keys(stacks).length, allGlyphs = {}; for (var fontName in stacks) { this.glyphSource.getSimpleGlyphs(fontName, stacks[fontName], params.uid, done); } - function done(err, glyphs, fontName) { - if (err) console.error(err); - + if (err) + console.error(err); allGlyphs[fontName] = glyphs; remaining--; - if (remaining === 0) callback(null, allGlyphs); } } }); - -},{"../render/line_atlas":270,"../source/source":279,"../symbol/glyph_source":311,"../symbol/sprite_atlas":316,"../util/ajax":334,"../util/browser":335,"../util/dispatcher":337,"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./animation_loop":287,"./image_sprite":288,"./style_function":292,"./style_layer":293,"./style_spec":300,"./validate_style":302}],291:[function(require,module,exports){ +},{"../render/line_atlas":278,"../source/query_features":288,"../source/source":290,"../source/source_cache":291,"../symbol/glyph_source":323,"../symbol/sprite_atlas":328,"../util/ajax":349,"../util/browser":350,"../util/dispatcher":357,"../util/evented":358,"../util/mapbox":363,"../util/util":366,"./animation_loop":299,"./image_sprite":300,"./style_function":304,"./style_layer":305,"./style_spec":312,"./validate_style":314}],303:[function(require,module,exports){ 'use strict'; - var MapboxGLFunction = require('./style_function'); var parseColor = require('./parse_color'); var util = require('../util/util'); - module.exports = StyleDeclaration; - function StyleDeclaration(reference, value) { - this.type = reference.type; - this.transitionable = reference.transition; this.value = util.clone(value); - this.isFunction = !!value.stops; - - // immutable representation of value. used for comparison + this.isFunction = MapboxGLFunction.isFunctionDefinition(value); this.json = JSON.stringify(this.value); - - var parsedValue = this.type === 'color' ? parseColor(this.value) : value; + var parsedValue = reference.type === 'color' && this.value ? parseColor(this.value) : value; this.calculate = MapboxGLFunction[reference.function || 'piecewise-constant'](parsedValue); this.isFeatureConstant = this.calculate.isFeatureConstant; this.isZoomConstant = this.calculate.isZoomConstant; - if (reference.function === 'piecewise-constant' && reference.transition) { this.calculate = transitioned(this.calculate); } - if (!this.isFeatureConstant && !this.isZoomConstant) { this.stopZoomLevels = []; var interpolationAmountStops = []; @@ -51343,81 +53182,76 @@ function StyleDeclaration(reference, value) { var zoom = stops[i][0].zoom; if (this.stopZoomLevels.indexOf(zoom) < 0) { this.stopZoomLevels.push(zoom); - interpolationAmountStops.push([zoom, interpolationAmountStops.length]); + interpolationAmountStops.push([ + zoom, + interpolationAmountStops.length + ]); } } - this.calculateInterpolationT = MapboxGLFunction.interpolated({ stops: interpolationAmountStops, base: value.base }); } } - function transitioned(calculate) { - return function(globalProperties, featureProperties) { + return function (globalProperties, featureProperties) { var z = globalProperties.zoom; var zh = globalProperties.zoomHistory; var duration = globalProperties.duration; - var fraction = z % 1; var t = Math.min((Date.now() - zh.lastIntegerZoomTime) / duration, 1); var fromScale = 1; var toScale = 1; var mix, from, to; - if (z > zh.lastIntegerZoom) { mix = fraction + (1 - fraction) * t; fromScale *= 2; - from = calculate({zoom: z - 1}, featureProperties); - to = calculate({zoom: z}, featureProperties); + from = calculate({ zoom: z - 1 }, featureProperties); + to = calculate({ zoom: z }, featureProperties); } else { mix = 1 - (1 - t) * fraction; - to = calculate({zoom: z}, featureProperties); - from = calculate({zoom: z + 1}, featureProperties); + to = calculate({ zoom: z }, featureProperties); + from = calculate({ zoom: z + 1 }, featureProperties); fromScale /= 2; } - - return { - from: from, - fromScale: fromScale, - to: to, - toScale: toScale, - t: mix - }; + if (from === undefined || to === undefined) { + return undefined; + } else { + return { + from: from, + fromScale: fromScale, + to: to, + toScale: toScale, + t: mix + }; + } }; } - -},{"../util/util":349,"./parse_color":289,"./style_function":292}],292:[function(require,module,exports){ +},{"../util/util":366,"./parse_color":301,"./style_function":304}],304:[function(require,module,exports){ 'use strict'; - var MapboxGLFunction = require('mapbox-gl-function'); - -exports.interpolated = function(parameters) { +exports.interpolated = function (parameters) { var inner = MapboxGLFunction.interpolated(parameters); - var outer = function(globalProperties, featureProperties) { + var outer = function (globalProperties, featureProperties) { return inner(globalProperties && globalProperties.zoom, featureProperties || {}); }; outer.isFeatureConstant = inner.isFeatureConstant; outer.isZoomConstant = inner.isZoomConstant; return outer; }; - -exports['piecewise-constant'] = function(parameters) { +exports['piecewise-constant'] = function (parameters) { var inner = MapboxGLFunction['piecewise-constant'](parameters); - var outer = function(globalProperties, featureProperties) { + var outer = function (globalProperties, featureProperties) { return inner(globalProperties && globalProperties.zoom, featureProperties || {}); }; outer.isFeatureConstant = inner.isFeatureConstant; outer.isZoomConstant = inner.isZoomConstant; return outer; }; - exports.isFunctionDefinition = MapboxGLFunction.isFunctionDefinition; - -},{"mapbox-gl-function":374}],293:[function(require,module,exports){ +},{"mapbox-gl-function":393}],305:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var StyleTransition = require('./style_transition'); var StyleDeclaration = require('./style_declaration'); @@ -51425,12 +53259,9 @@ var styleSpec = require('./style_spec'); var validateStyle = require('./validate_style'); var parseColor = require('./parse_color'); var Evented = require('../util/evented'); - module.exports = StyleLayer; - var TRANSITION_SUFFIX = '-transition'; - -StyleLayer.create = function(layer, refLayer) { +StyleLayer.create = function (layer, refLayer) { var Classes = { background: require('./style_layer/background_style_layer'), circle: require('./style_layer/circle_style_layer'), @@ -51441,14 +53272,11 @@ StyleLayer.create = function(layer, refLayer) { }; return new Classes[(refLayer || layer).type](layer, refLayer); }; - function StyleLayer(layer, refLayer) { this.set(layer, refLayer); } - StyleLayer.prototype = util.inherit(Evented, { - - set: function(layer, refLayer) { + set: function (layer, refLayer) { this.id = layer.id; this.ref = layer.ref; this.metadata = layer.metadata; @@ -51458,22 +53286,16 @@ StyleLayer.prototype = util.inherit(Evented, { this.minzoom = (refLayer || layer).minzoom; this.maxzoom = (refLayer || layer).maxzoom; this.filter = (refLayer || layer).filter; - this.paint = {}; this.layout = {}; - this._paintSpecifications = styleSpec['paint_' + this.type]; this._layoutSpecifications = styleSpec['layout_' + this.type]; - - this._paintTransitions = {}; // {[propertyName]: StyleTransition} - this._paintTransitionOptions = {}; // {[className]: {[propertyName]: { duration:Number, delay:Number }}} - this._paintDeclarations = {}; // {[className]: {[propertyName]: StyleDeclaration}} - this._layoutDeclarations = {}; // {[propertyName]: StyleDeclaration} - this._layoutFunctions = {}; // {[propertyName]: Boolean} - + this._paintTransitions = {}; + this._paintTransitionOptions = {}; + this._paintDeclarations = {}; + this._layoutDeclarations = {}; + this._layoutFunctions = {}; var paintName, layoutName; - - // Resolve paint declarations for (var key in layer) { var match = key.match(/^paint(?:\.(.*))?$/); if (match) { @@ -51483,8 +53305,6 @@ StyleLayer.prototype = util.inherit(Evented, { } } } - - // Resolve layout declarations if (this.ref) { this._layoutDeclarations = refLayer._layoutDeclarations; } else { @@ -51492,8 +53312,6 @@ StyleLayer.prototype = util.inherit(Evented, { this.setLayoutProperty(layoutName, layer.layout[layoutName]); } } - - // set initial layout/paint values for (paintName in this._paintSpecifications) { this.paint[paintName] = this.getPaintValue(paintName); } @@ -51501,40 +53319,31 @@ StyleLayer.prototype = util.inherit(Evented, { this._updateLayoutValue(layoutName); } }, - - setLayoutProperty: function(name, value) { - + setLayoutProperty: function (name, value) { if (value == null) { delete this._layoutDeclarations[name]; } else { var key = 'layers.' + this.id + '.layout.' + name; - if (this._handleErrors(validateStyle.layoutProperty, key, name, value)) return; + if (this._handleErrors(validateStyle.layoutProperty, key, name, value)) + return; this._layoutDeclarations[name] = new StyleDeclaration(this._layoutSpecifications[name], value); } this._updateLayoutValue(name); }, - - getLayoutProperty: function(name) { - return ( - this._layoutDeclarations[name] && - this._layoutDeclarations[name].value - ); + getLayoutProperty: function (name) { + return this._layoutDeclarations[name] && this._layoutDeclarations[name].value; }, - - getLayoutValue: function(name, globalProperties, featureProperties) { + getLayoutValue: function (name, globalProperties, featureProperties) { var specification = this._layoutSpecifications[name]; var declaration = this._layoutDeclarations[name]; - if (declaration) { return declaration.calculate(globalProperties, featureProperties); } else { return specification.default; } }, - - setPaintProperty: function(name, value, klass) { + setPaintProperty: function (name, value, klass) { var validateStyleKey = 'layers.' + this.id + (klass ? '["paint.' + klass + '"].' : '.paint.') + name; - if (util.endsWith(name, TRANSITION_SUFFIX)) { if (!this._paintTransitionOptions[klass || '']) { this._paintTransitionOptions[klass || ''] = {}; @@ -51542,7 +53351,8 @@ StyleLayer.prototype = util.inherit(Evented, { if (value === null || value === undefined) { delete this._paintTransitionOptions[klass || ''][name]; } else { - if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) return; + if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) + return; this._paintTransitionOptions[klass || ''][name] = value; } } else { @@ -51552,32 +53362,23 @@ StyleLayer.prototype = util.inherit(Evented, { if (value === null || value === undefined) { delete this._paintDeclarations[klass || ''][name]; } else { - if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) return; + if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) + return; this._paintDeclarations[klass || ''][name] = new StyleDeclaration(this._paintSpecifications[name], value); } } }, - - getPaintProperty: function(name, klass) { + getPaintProperty: function (name, klass) { klass = klass || ''; if (util.endsWith(name, TRANSITION_SUFFIX)) { - return ( - this._paintTransitionOptions[klass] && - this._paintTransitionOptions[klass][name] - ); + return this._paintTransitionOptions[klass] && this._paintTransitionOptions[klass][name]; } else { - return ( - this._paintDeclarations[klass] && - this._paintDeclarations[klass][name] && - this._paintDeclarations[klass][name].value - ); + return this._paintDeclarations[klass] && this._paintDeclarations[klass][name] && this._paintDeclarations[klass][name].value; } }, - - getPaintValue: function(name, globalProperties, featureProperties) { + getPaintValue: function (name, globalProperties, featureProperties) { var specification = this._paintSpecifications[name]; var transition = this._paintTransitions[name]; - if (transition) { return transition.calculate(globalProperties, featureProperties); } else if (specification.type === 'color' && specification.default) { @@ -51586,8 +53387,7 @@ StyleLayer.prototype = util.inherit(Evented, { return specification.default; } }, - - getPaintValueStopZoomLevels: function(name) { + getPaintValueStopZoomLevels: function (name) { var transition = this._paintTransitions[name]; if (transition) { return transition.declaration.stopZoomLevels; @@ -51595,58 +53395,60 @@ StyleLayer.prototype = util.inherit(Evented, { return []; } }, - - getPaintInterpolationT: function(name, zoom) { + getPaintInterpolationT: function (name, zoom) { var transition = this._paintTransitions[name]; return transition.declaration.calculateInterpolationT({ zoom: zoom }); }, - - isPaintValueFeatureConstant: function(name) { + isPaintValueFeatureConstant: function (name) { var transition = this._paintTransitions[name]; - if (transition) { return transition.declaration.isFeatureConstant; } else { return true; } }, - - isPaintValueZoomConstant: function(name) { + isLayoutValueFeatureConstant: function (name) { + var declaration = this._layoutDeclarations[name]; + if (declaration) { + return declaration.isFeatureConstant; + } else { + return true; + } + }, + isPaintValueZoomConstant: function (name) { var transition = this._paintTransitions[name]; - if (transition) { return transition.declaration.isZoomConstant; } else { return true; } }, - - - isHidden: function(zoom) { - if (this.minzoom && zoom < this.minzoom) return true; - if (this.maxzoom && zoom >= this.maxzoom) return true; - if (this.layout['visibility'] === 'none') return true; - if (this.paint[this.type + '-opacity'] === 0) return true; + isHidden: function (zoom) { + if (this.minzoom && zoom < this.minzoom) + return true; + if (this.maxzoom && zoom >= this.maxzoom) + return true; + if (this.layout['visibility'] === 'none') + return true; + if (this.paint[this.type + '-opacity'] === 0) + return true; return false; }, - - updatePaintTransitions: function(classes, options, globalOptions, animationLoop) { + updatePaintTransitions: function (classes, options, globalOptions, animationLoop) { var declarations = util.extend({}, this._paintDeclarations['']); for (var i = 0; i < classes.length; i++) { util.extend(declarations, this._paintDeclarations[classes[i]]); } - var name; - for (name in declarations) { // apply new declarations + for (name in declarations) { this._applyPaintDeclaration(name, declarations[name], options, globalOptions, animationLoop); } for (name in this._paintTransitions) { - if (!(name in declarations)) // apply removed declarations + if (!(name in declarations)) this._applyPaintDeclaration(name, null, options, globalOptions, animationLoop); } }, - - updatePaintTransition: function(name, classes, options, globalOptions, animationLoop) { + updatePaintTransition: function (name, classes, options, globalOptions, animationLoop) { var declaration = this._paintDeclarations[''][name]; for (var i = 0; i < classes.length; i++) { var classPaintDeclarations = this._paintDeclarations[classes[i]]; @@ -51656,18 +53458,21 @@ StyleLayer.prototype = util.inherit(Evented, { } this._applyPaintDeclaration(name, declaration, options, globalOptions, animationLoop); }, - - // update all zoom-dependent layout/paint values - recalculate: function(zoom, zoomHistory) { + recalculate: function (zoom, zoomHistory) { for (var paintName in this._paintTransitions) { - this.paint[paintName] = this.getPaintValue(paintName, {zoom: zoom, zoomHistory: zoomHistory}); + this.paint[paintName] = this.getPaintValue(paintName, { + zoom: zoom, + zoomHistory: zoomHistory + }); } for (var layoutName in this._layoutFunctions) { - this.layout[layoutName] = this.getLayoutValue(layoutName, {zoom: zoom, zoomHistory: zoomHistory}); + this.layout[layoutName] = this.getLayoutValue(layoutName, { + zoom: zoom, + zoomHistory: zoomHistory + }); } }, - - serialize: function(options) { + serialize: function (options) { var output = { 'id': this.id, 'ref': this.ref, @@ -51675,13 +53480,11 @@ StyleLayer.prototype = util.inherit(Evented, { 'minzoom': this.minzoom, 'maxzoom': this.maxzoom }; - for (var klass in this._paintDeclarations) { var key = klass === '' ? 'paint' : 'paint.' + klass; output[key] = util.mapObject(this._paintDeclarations[klass], getDeclarationValue); } - - if (!this.ref || (options && options.includeRefProperties)) { + if (!this.ref || options && options.includeRefProperties) { util.extend(output, { 'type': this.type, 'source': this.source, @@ -51690,31 +53493,23 @@ StyleLayer.prototype = util.inherit(Evented, { 'layout': util.mapObject(this._layoutDeclarations, getDeclarationValue) }); } - - return util.filterObject(output, function(value, key) { + return util.filterObject(output, function (value, key) { return value !== undefined && !(key === 'layout' && !Object.keys(value).length); }); }, - - // set paint transition based on a given paint declaration _applyPaintDeclaration: function (name, declaration, options, globalOptions, animationLoop) { var oldTransition = options.transition ? this._paintTransitions[name] : undefined; - + var spec = this._paintSpecifications[name]; if (declaration === null || declaration === undefined) { - var spec = this._paintSpecifications[name]; declaration = new StyleDeclaration(spec, spec.default); } - - if (oldTransition && oldTransition.declaration.json === declaration.json) return; - + if (oldTransition && oldTransition.declaration.json === declaration.json) + return; var transitionOptions = util.extend({ duration: 300, delay: 0 }, globalOptions, this.getPaintProperty(name + TRANSITION_SUFFIX)); - - var newTransition = this._paintTransitions[name] = - new StyleTransition(declaration, oldTransition, transitionOptions); - + var newTransition = this._paintTransitions[name] = new StyleTransition(spec, declaration, oldTransition, transitionOptions); if (!newTransition.instant()) { newTransition.loopID = animationLoop.set(newTransition.endTime - Date.now()); } @@ -51722,11 +53517,8 @@ StyleLayer.prototype = util.inherit(Evented, { animationLoop.cancel(oldTransition.loopID); } }, - - // update layout value if it's constant, or mark it as zoom-dependent - _updateLayoutValue: function(name) { + _updateLayoutValue: function (name) { var declaration = this._layoutDeclarations[name]; - if (declaration && declaration.isFunction) { this._layoutFunctions[name] = true; } else { @@ -51734,244 +53526,206 @@ StyleLayer.prototype = util.inherit(Evented, { this.layout[name] = this.getLayoutValue(name); } }, - - _handleErrors: function(validate, key, name, value) { + _handleErrors: function (validate, key, name, value) { return validateStyle.emitErrors(this, validate.call(validateStyle, { key: key, layerType: this.type, objectKey: name, value: value, styleSpec: styleSpec, - // Workaround for https://github.com/mapbox/mapbox-gl-js/issues/2407 - style: {glyphs: true, sprite: true} + style: { + glyphs: true, + sprite: true + } })); } }); - function getDeclarationValue(declaration) { return declaration.value; } - -},{"../util/evented":341,"../util/util":349,"./parse_color":289,"./style_declaration":291,"./style_layer/background_style_layer":294,"./style_layer/circle_style_layer":295,"./style_layer/fill_style_layer":296,"./style_layer/line_style_layer":297,"./style_layer/raster_style_layer":298,"./style_layer/symbol_style_layer":299,"./style_spec":300,"./style_transition":301,"./validate_style":302}],294:[function(require,module,exports){ +},{"../util/evented":358,"../util/util":366,"./parse_color":301,"./style_declaration":303,"./style_layer/background_style_layer":306,"./style_layer/circle_style_layer":307,"./style_layer/fill_style_layer":308,"./style_layer/line_style_layer":309,"./style_layer/raster_style_layer":310,"./style_layer/symbol_style_layer":311,"./style_spec":312,"./style_transition":313,"./validate_style":314}],306:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function BackgroundStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = BackgroundStyleLayer; - BackgroundStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":349,"../style_layer":293}],295:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],307:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function CircleStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = CircleStyleLayer; - CircleStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":349,"../style_layer":293}],296:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],308:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function FillStyleLayer() { StyleLayer.apply(this, arguments); } - +FillStyleLayer.prototype = util.inherit(StyleLayer, { + getPaintValue: function (name, globalProperties, featureProperties) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.getPaintValue.call(this, 'fill-color', globalProperties, featureProperties); + } else { + return StyleLayer.prototype.getPaintValue.call(this, name, globalProperties, featureProperties); + } + }, + getPaintValueStopZoomLevels: function (name) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.getPaintValueStopZoomLevels.call(this, 'fill-color'); + } else { + return StyleLayer.prototype.getPaintValueStopZoomLevels.call(this, arguments); + } + }, + getPaintInterpolationT: function (name, zoom) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.getPaintInterpolationT.call(this, 'fill-color', zoom); + } else { + return StyleLayer.prototype.getPaintInterpolationT.call(this, name, zoom); + } + }, + isPaintValueFeatureConstant: function (name) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.isPaintValueFeatureConstant.call(this, 'fill-color'); + } else { + return StyleLayer.prototype.isPaintValueFeatureConstant.call(this, name); + } + }, + isPaintValueZoomConstant: function (name) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.isPaintValueZoomConstant.call(this, 'fill-color'); + } else { + return StyleLayer.prototype.isPaintValueZoomConstant.call(this, name); + } + } +}); module.exports = FillStyleLayer; - -FillStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":349,"../style_layer":293}],297:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],309:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function LineStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = LineStyleLayer; - LineStyleLayer.prototype = util.inherit(StyleLayer, { - - getPaintValue: function(name, globalProperties, featureProperties) { + getPaintValue: function (name, globalProperties, featureProperties) { var value = StyleLayer.prototype.getPaintValue.apply(this, arguments); - - // If the line is dashed, scale the dash lengths by the line - // width at the previous round zoom level. if (value && name === 'line-dasharray') { var flooredZoom = Math.floor(globalProperties.zoom); if (this._flooredZoom !== flooredZoom) { this._flooredZoom = flooredZoom; this._flooredLineWidth = this.getPaintValue('line-width', globalProperties, featureProperties); } - value.fromScale *= this._flooredLineWidth; value.toScale *= this._flooredLineWidth; } - return value; } }); - -},{"../../util/util":349,"../style_layer":293}],298:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],310:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function RasterStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = RasterStyleLayer; - RasterStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":349,"../style_layer":293}],299:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],311:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function SymbolStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = SymbolStyleLayer; - SymbolStyleLayer.prototype = util.inherit(StyleLayer, { - - isHidden: function() { - if (StyleLayer.prototype.isHidden.apply(this, arguments)) return true; - + isHidden: function () { + if (StyleLayer.prototype.isHidden.apply(this, arguments)) + return true; var isTextHidden = this.paint['text-opacity'] === 0 || !this.layout['text-field']; var isIconHidden = this.paint['icon-opacity'] === 0 || !this.layout['icon-image']; - if (isTextHidden && isIconHidden) return true; - + if (isTextHidden && isIconHidden) + return true; return false; }, - - getLayoutValue: function(name, globalProperties, featureProperties) { - if (name === 'text-rotation-alignment' && - this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && - !this.getLayoutProperty('text-rotation-alignment')) { + getLayoutValue: function (name, globalProperties, featureProperties) { + if (name === 'text-rotation-alignment' && this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && !this.getLayoutProperty('text-rotation-alignment')) { return 'map'; - } else if (name === 'icon-rotation-alignment' && - this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && - !this.getLayoutProperty('icon-rotation-alignment')) { + } else if (name === 'icon-rotation-alignment' && this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && !this.getLayoutProperty('icon-rotation-alignment')) { return 'map'; + } else if (name === 'text-pitch-alignment' && !this.getLayoutProperty('text-pitch-alignment')) { + return this.getLayoutValue('text-rotation-alignment'); } else { return StyleLayer.prototype.getLayoutValue.apply(this, arguments); } } - }); - -},{"../../util/util":349,"../style_layer":293}],300:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],312:[function(require,module,exports){ 'use strict'; - module.exports = require('mapbox-gl-style-spec/reference/latest'); - -},{"mapbox-gl-style-spec/reference/latest":397}],301:[function(require,module,exports){ +},{"mapbox-gl-style-spec/reference/latest":416}],313:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var interpolate = require('../util/interpolate'); - module.exports = StyleTransition; - -/* - * Represents a transition between two declarations - */ -function StyleTransition(declaration, oldTransition, value) { - +function StyleTransition(reference, declaration, oldTransition, value) { this.declaration = declaration; - this.startTime = this.endTime = (new Date()).getTime(); - - var type = declaration.type; - if ((type === 'string' || type === 'array') && declaration.transitionable) { + this.startTime = this.endTime = new Date().getTime(); + if (reference.function === 'piecewise-constant' && reference.transition) { this.interp = interpZoomTransitioned; } else { - this.interp = interpolate[type]; + this.interp = interpolate[reference.type]; } - this.oldTransition = oldTransition; this.duration = value.duration || 0; this.delay = value.delay || 0; - if (!this.instant()) { this.endTime = this.startTime + this.duration + this.delay; this.ease = util.easeCubicInOut; } - if (oldTransition && oldTransition.endTime <= this.startTime) { - // Old transition is done running, so we can - // delete its reference to its old transition. - delete oldTransition.oldTransition; } } - -StyleTransition.prototype.instant = function() { - return !this.oldTransition || !this.interp || (this.duration === 0 && this.delay === 0); +StyleTransition.prototype.instant = function () { + return !this.oldTransition || !this.interp || this.duration === 0 && this.delay === 0; }; - -/* - * Return the value of the transitioning property at zoom level `z` and optional time `t` - */ -StyleTransition.prototype.calculate = function(globalProperties, featureProperties) { - var value = this.declaration.calculate( - util.extend({}, globalProperties, {duration: this.duration}), - featureProperties - ); - - if (this.instant()) return value; - +StyleTransition.prototype.calculate = function (globalProperties, featureProperties) { + var value = this.declaration.calculate(util.extend({}, globalProperties, { duration: this.duration }), featureProperties); + if (this.instant()) + return value; var t = globalProperties.time || Date.now(); - if (t < this.endTime) { - var oldValue = this.oldTransition.calculate( - util.extend({}, globalProperties, {time: this.startTime}), - featureProperties - ); + var oldValue = this.oldTransition.calculate(util.extend({}, globalProperties, { time: this.startTime }), featureProperties); var eased = this.ease((t - this.startTime - this.delay) / this.duration); value = this.interp(oldValue, value, eased); } - return value; - }; - function interpZoomTransitioned(from, to, t) { - return { - from: from.to, - fromScale: from.toScale, - to: to.to, - toScale: to.toScale, - t: t - }; + if ((from && from.to) === undefined || (to && to.to) === undefined) { + return undefined; + } else { + return { + from: from.to, + fromScale: from.toScale, + to: to.to, + toScale: to.toScale, + t: t + }; + } } - -},{"../util/interpolate":343,"../util/util":349}],302:[function(require,module,exports){ +},{"../util/interpolate":360,"../util/util":366}],314:[function(require,module,exports){ 'use strict'; - module.exports = require('mapbox-gl-style-spec/lib/validate_style.min'); - module.exports.emitErrors = function throwErrors(emitter, errors) { if (errors && errors.length) { for (var i = 0; i < errors.length; i++) { @@ -51982,7 +53736,6 @@ module.exports.emitErrors = function throwErrors(emitter, errors) { return false; } }; - module.exports.throwErrors = function throwErrors(emitter, errors) { if (errors) { for (var i = 0; i < errors.length; i++) { @@ -51990,140 +53743,77 @@ module.exports.throwErrors = function throwErrors(emitter, errors) { } } }; - -},{"mapbox-gl-style-spec/lib/validate_style.min":396}],303:[function(require,module,exports){ +},{"mapbox-gl-style-spec/lib/validate_style.min":415}],315:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - module.exports = Anchor; - function Anchor(x, y, angle, segment) { this.x = x; this.y = y; this.angle = angle; - if (segment !== undefined) { this.segment = segment; } } - Anchor.prototype = Object.create(Point.prototype); - -Anchor.prototype.clone = function() { +Anchor.prototype.clone = function () { return new Anchor(this.x, this.y, this.angle, this.segment); }; - -},{"point-geometry":404}],304:[function(require,module,exports){ +},{"point-geometry":424}],316:[function(require,module,exports){ 'use strict'; - module.exports = checkMaxAngle; - -/** - * Labels placed around really sharp angles aren't readable. Check if any - * part of the potential label has a combined angle that is too big. - * - * @param {Array} line - * @param {Anchor} anchor The point on the line around which the label is anchored. - * @param {number} labelLength The length of the label in geometry units. - * @param {number} windowSize The check fails if the combined angles within a part of the line that is `windowSize` long is too big. - * @param {number} maxAngle The maximum combined angle that any window along the label is allowed to have. - * - * @returns {boolean} whether the label should be placed - * @private - */ function checkMaxAngle(line, anchor, labelLength, windowSize, maxAngle) { - - // horizontal labels always pass - if (anchor.segment === undefined) return true; - + if (anchor.segment === undefined) + return true; var p = anchor; var index = anchor.segment + 1; var anchorDistance = 0; - - // move backwards along the line to the first segment the label appears on while (anchorDistance > -labelLength / 2) { index--; - - // there isn't enough room for the label after the beginning of the line - if (index < 0) return false; - + if (index < 0) + return false; anchorDistance -= line[index].dist(p); p = line[index]; } - anchorDistance += line[index].dist(line[index + 1]); index++; - - // store recent corners and their total angle difference var recentCorners = []; var recentAngleDelta = 0; - - // move forwards by the length of the label and check angles along the way while (anchorDistance < labelLength / 2) { var prev = line[index - 1]; var current = line[index]; var next = line[index + 1]; - - // there isn't enough room for the label before the end of the line - if (!next) return false; - + if (!next) + return false; var angleDelta = prev.angleTo(current) - current.angleTo(next); - // restrict angle to -pi..pi range - angleDelta = Math.abs(((angleDelta + 3 * Math.PI) % (Math.PI * 2)) - Math.PI); - + angleDelta = Math.abs((angleDelta + 3 * Math.PI) % (Math.PI * 2) - Math.PI); recentCorners.push({ distance: anchorDistance, angleDelta: angleDelta }); recentAngleDelta += angleDelta; - - // remove corners that are far enough away from the list of recent anchors while (anchorDistance - recentCorners[0].distance > windowSize) { recentAngleDelta -= recentCorners.shift().angleDelta; } - - // the sum of angles within the window area exceeds the maximum allowed value. check fails. - if (recentAngleDelta > maxAngle) return false; - + if (recentAngleDelta > maxAngle) + return false; index++; anchorDistance += current.dist(next); } - - // no part of the line had an angle greater than the maximum allowed. check passes. return true; } - -},{}],305:[function(require,module,exports){ +},{}],317:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - module.exports = clipLine; - -/** - * Returns the part of a multiline that intersects with the provided rectangular box. - * - * @param {Array>} lines - * @param {number} x1 the left edge of the box - * @param {number} y1 the top edge of the box - * @param {number} x2 the right edge of the box - * @param {number} y2 the bottom edge of the box - * @returns {Array>} lines - * @private - */ function clipLine(lines, x1, y1, x2, y2) { var clippedLines = []; - for (var l = 0; l < lines.length; l++) { var line = lines[l]; var clippedLine; - for (var i = 0; i < line.length - 1; i++) { var p0 = line[i]; var p1 = line[i + 1]; - - if (p0.x < x1 && p1.x < x1) { continue; } else if (p0.x < x1) { @@ -52131,7 +53821,6 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.x < x1) { p1 = new Point(x1, p0.y + (p1.y - p0.y) * ((x1 - p0.x) / (p1.x - p0.x)))._round(); } - if (p0.y < y1 && p1.y < y1) { continue; } else if (p0.y < y1) { @@ -52139,7 +53828,6 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.y < y1) { p1 = new Point(p0.x + (p1.x - p0.x) * ((y1 - p0.y) / (p1.y - p0.y)), y1)._round(); } - if (p0.x >= x2 && p1.x >= x2) { continue; } else if (p0.x >= x2) { @@ -52147,7 +53835,6 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.x >= x2) { p1 = new Point(x2, p0.y + (p1.y - p0.y) * ((x2 - p0.x) / (p1.x - p0.x)))._round(); } - if (p0.y >= y2 && p1.y >= y2) { continue; } else if (p0.y >= y2) { @@ -52155,253 +53842,160 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.y >= y2) { p1 = new Point(p0.x + (p1.x - p0.x) * ((y2 - p0.y) / (p1.y - p0.y)), y2)._round(); } - if (!clippedLine || !p0.equals(clippedLine[clippedLine.length - 1])) { clippedLine = [p0]; clippedLines.push(clippedLine); } - clippedLine.push(p1); } } - return clippedLines; } - -},{"point-geometry":404}],306:[function(require,module,exports){ +},{"point-geometry":424}],318:[function(require,module,exports){ 'use strict'; - var StructArrayType = require('../util/struct_array'); var util = require('../util/util'); var Point = require('point-geometry'); - -/** - * A collision box represents an area of the map that that is covered by a - * label. CollisionFeature uses one or more of these collision boxes to - * represent all the area covered by a single label. They are used to - * prevent collisions between labels. - * - * A collision box actually represents a 3d volume. The first two dimensions, - * x and y, are specified with `anchor` along with `x1`, `y1`, `x2`, `y2`. - * The third dimension, zoom, is limited by `maxScale` which determines - * how far in the z dimensions the box extends. - * - * As you zoom in on a map, all points on the map get further and further apart - * but labels stay roughly the same size. Labels cover less real world area on - * the map at higher zoom levels than they do at lower zoom levels. This is why - * areas are are represented with an anchor point and offsets from that point - * instead of just using four absolute points. - * - * Line labels are represented by a set of these boxes spaced out along a line. - * When you zoom in, line labels cover less real world distance along the line - * than they used to. Collision boxes near the edges that used to cover label - * no longer do. If a box doesn't cover the label anymore it should be ignored - * when doing collision checks. `maxScale` is how much you can scale the map - * before the label isn't within the box anymore. - * For example - * lower zoom: - * https://cloud.githubusercontent.com/assets/1421652/8060094/4d975f76-0e91-11e5-84b1-4edeb30a5875.png - * slightly higher zoom: - * https://cloud.githubusercontent.com/assets/1421652/8060061/26ae1c38-0e91-11e5-8c5a-9f380bf29f0a.png - * In the zoomed in image the two grey boxes on either side don't cover the - * label anymore. Their maxScale is smaller than the current scale. - * - * - * @class CollisionBoxArray - * @private - */ - var CollisionBoxArray = module.exports = new StructArrayType({ members: [ - // the box is centered around the anchor point - { type: 'Int16', name: 'anchorPointX' }, - { type: 'Int16', name: 'anchorPointY' }, - - // distances to the edges from the anchor - { type: 'Int16', name: 'x1' }, - { type: 'Int16', name: 'y1' }, - { type: 'Int16', name: 'x2' }, - { type: 'Int16', name: 'y2' }, - - // the box is only valid for scales < maxScale. - // The box does not block other boxes at scales >= maxScale; - { type: 'Float32', name: 'maxScale' }, - - // the index of the feature in the original vectortile - { type: 'Uint32', name: 'featureIndex' }, - // the source layer the feature appears in - { type: 'Uint16', name: 'sourceLayerIndex' }, - // the bucket the feature appears in - { type: 'Uint16', name: 'bucketIndex' }, - - // rotated and scaled bbox used for indexing - { type: 'Int16', name: 'bbox0' }, - { type: 'Int16', name: 'bbox1' }, - { type: 'Int16', name: 'bbox2' }, - { type: 'Int16', name: 'bbox3' }, - - { type: 'Float32', name: 'placementScale' } - ]}); - + { + type: 'Int16', + name: 'anchorPointX' + }, + { + type: 'Int16', + name: 'anchorPointY' + }, + { + type: 'Int16', + name: 'x1' + }, + { + type: 'Int16', + name: 'y1' + }, + { + type: 'Int16', + name: 'x2' + }, + { + type: 'Int16', + name: 'y2' + }, + { + type: 'Float32', + name: 'maxScale' + }, + { + type: 'Uint32', + name: 'featureIndex' + }, + { + type: 'Uint16', + name: 'sourceLayerIndex' + }, + { + type: 'Uint16', + name: 'bucketIndex' + }, + { + type: 'Int16', + name: 'bbox0' + }, + { + type: 'Int16', + name: 'bbox1' + }, + { + type: 'Int16', + name: 'bbox2' + }, + { + type: 'Int16', + name: 'bbox3' + }, + { + type: 'Float32', + name: 'placementScale' + } + ] +}); util.extendAll(CollisionBoxArray.prototype.StructType.prototype, { get anchorPoint() { return new Point(this.anchorPointX, this.anchorPointY); } }); - -},{"../util/struct_array":347,"../util/util":349,"point-geometry":404}],307:[function(require,module,exports){ -'use strict'; - -module.exports = CollisionFeature; - -/** - * A CollisionFeature represents the area of the tile covered by a single label. - * It is used with CollisionTile to check if the label overlaps with any - * previous labels. A CollisionFeature is mostly just a set of CollisionBox - * objects. - * - * @class CollisionFeature - * @param {Array} line The geometry the label is placed on. - * @param {Anchor} anchor The point along the line around which the label is anchored. - * @param {VectorTileFeature} feature The VectorTileFeature that this CollisionFeature was created for. - * @param {Array} layerIDs The IDs of the layers that this CollisionFeature is a part of. - * @param {Object} shaped The text or icon shaping results. - * @param {number} boxScale A magic number used to convert from glyph metrics units to geometry units. - * @param {number} padding The amount of padding to add around the label edges. - * @param {boolean} alignLine Whether the label is aligned with the line or the viewport. - * - * @private - */ +},{"../util/struct_array":364,"../util/util":366,"point-geometry":424}],319:[function(require,module,exports){ +'use strict'; +module.exports = CollisionFeature; function CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shaped, boxScale, padding, alignLine, straight) { - var y1 = shaped.top * boxScale - padding; var y2 = shaped.bottom * boxScale + padding; var x1 = shaped.left * boxScale - padding; var x2 = shaped.right * boxScale + padding; - this.boxStartIndex = collisionBoxArray.length; - if (alignLine) { - var height = y2 - y1; var length = x2 - x1; - if (height > 0) { - // set minimum box height to avoid very many small labels height = Math.max(10 * boxScale, height); - if (straight) { - // used for icon labels that are aligned with the line, but don't curve along it var vector = line[anchor.segment + 1].sub(line[anchor.segment])._unit()._mult(length); - var straightLine = [anchor.sub(vector), anchor.add(vector)]; + var straightLine = [ + anchor.sub(vector), + anchor.add(vector) + ]; this._addLineCollisionBoxes(collisionBoxArray, straightLine, anchor, 0, length, height, featureIndex, sourceLayerIndex, bucketIndex); } else { - // used for text labels that curve along a line this._addLineCollisionBoxes(collisionBoxArray, line, anchor, anchor.segment, length, height, featureIndex, sourceLayerIndex, bucketIndex); } } - } else { - collisionBoxArray.emplaceBack(anchor.x, anchor.y, x1, y1, x2, y2, Infinity, featureIndex, sourceLayerIndex, bucketIndex, - 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(anchor.x, anchor.y, x1, y1, x2, y2, Infinity, featureIndex, sourceLayerIndex, bucketIndex, 0, 0, 0, 0, 0); } - this.boxEndIndex = collisionBoxArray.length; } - -/** - * Create a set of CollisionBox objects for a line. - * - * @param {Array} line - * @param {Anchor} anchor - * @param {number} labelLength The length of the label in geometry units. - * @param {Anchor} anchor The point along the line around which the label is anchored. - * @param {VectorTileFeature} feature The VectorTileFeature that this CollisionFeature was created for. - * @param {number} boxSize The size of the collision boxes that will be created. - * - * @private - */ -CollisionFeature.prototype._addLineCollisionBoxes = function(collisionBoxArray, line, anchor, segment, labelLength, boxSize, featureIndex, sourceLayerIndex, bucketIndex) { +CollisionFeature.prototype._addLineCollisionBoxes = function (collisionBoxArray, line, anchor, segment, labelLength, boxSize, featureIndex, sourceLayerIndex, bucketIndex) { var step = boxSize / 2; var nBoxes = Math.floor(labelLength / step); - - // offset the center of the first box by half a box so that the edge of the - // box is at the edge of the label. var firstBoxOffset = -boxSize / 2; - var bboxes = this.boxes; - var p = anchor; var index = segment + 1; var anchorDistance = firstBoxOffset; - - // move backwards along the line to the first segment the label appears on do { index--; - - // there isn't enough room for the label after the beginning of the line - // checkMaxAngle should have already caught this - if (index < 0) return bboxes; - + if (index < 0) + return bboxes; anchorDistance -= line[index].dist(p); p = line[index]; } while (anchorDistance > -labelLength / 2); - var segmentLength = line[index].dist(line[index + 1]); - for (var i = 0; i < nBoxes; i++) { - // the distance the box will be from the anchor var boxDistanceToAnchor = -labelLength / 2 + i * step; - - // the box is not on the current segment. Move to the next segment. while (anchorDistance + segmentLength < boxDistanceToAnchor) { anchorDistance += segmentLength; index++; - - // There isn't enough room before the end of the line. - if (index + 1 >= line.length) return bboxes; - + if (index + 1 >= line.length) + return bboxes; segmentLength = line[index].dist(line[index + 1]); } - - // the distance the box will be from the beginning of the segment var segmentBoxDistance = boxDistanceToAnchor - anchorDistance; - var p0 = line[index]; var p1 = line[index + 1]; var boxAnchorPoint = p1.sub(p0)._unit()._mult(segmentBoxDistance)._add(p0)._round(); - var distanceToInnerEdge = Math.max(Math.abs(boxDistanceToAnchor - firstBoxOffset) - step / 2, 0); var maxScale = labelLength / 2 / distanceToInnerEdge; - - collisionBoxArray.emplaceBack(boxAnchorPoint.x, boxAnchorPoint.y, - -boxSize / 2, -boxSize / 2, boxSize / 2, boxSize / 2, maxScale, - featureIndex, sourceLayerIndex, bucketIndex, - 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(boxAnchorPoint.x, boxAnchorPoint.y, -boxSize / 2, -boxSize / 2, boxSize / 2, boxSize / 2, maxScale, featureIndex, sourceLayerIndex, bucketIndex, 0, 0, 0, 0, 0); } - return bboxes; }; - -},{}],308:[function(require,module,exports){ +},{}],320:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); var EXTENT = require('../data/bucket').EXTENT; var Grid = require('grid-index'); - module.exports = CollisionTile; - -/** - * A collision tile used to prevent symbols from overlapping. It keep tracks of - * where previous symbols have been placed and is used to check if a new - * symbol overlaps with any previously added symbols. - * - * @class CollisionTile - * @param {number} angle - * @param {number} pitch - * @private - */ function CollisionTile(angle, pitch, collisionBoxArray) { if (typeof angle === 'object') { var serialized = angle; @@ -52414,48 +54008,32 @@ function CollisionTile(angle, pitch, collisionBoxArray) { this.grid = new Grid(EXTENT, 12, 6); this.ignoredGrid = new Grid(EXTENT, 12, 0); } - this.angle = angle; this.pitch = pitch; - - var sin = Math.sin(angle), - cos = Math.cos(angle); - this.rotationMatrix = [cos, -sin, sin, cos]; - this.reverseRotationMatrix = [cos, sin, -sin, cos]; - - // Stretch boxes in y direction to account for the map tilt. + var sin = Math.sin(angle), cos = Math.cos(angle); + this.rotationMatrix = [ + cos, + -sin, + sin, + cos + ]; + this.reverseRotationMatrix = [ + cos, + sin, + -sin, + cos + ]; this.yStretch = 1 / Math.cos(pitch / 180 * Math.PI); - - // The amount the map is squished depends on the y position. - // Sort of account for this by making all boxes a bit bigger. this.yStretch = Math.pow(this.yStretch, 1.3); - this.collisionBoxArray = collisionBoxArray; if (collisionBoxArray.length === 0) { - // the first collisionBoxArray is passed to a CollisionTile - - // tempCollisionBox collisionBoxArray.emplaceBack(); - var maxInt16 = 32767; - //left - collisionBoxArray.emplaceBack(0, 0, 0, -maxInt16, 0, maxInt16, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); - // right - collisionBoxArray.emplaceBack(EXTENT, 0, 0, -maxInt16, 0, maxInt16, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); - // top - collisionBoxArray.emplaceBack(0, 0, -maxInt16, 0, maxInt16, 0, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); - // bottom - collisionBoxArray.emplaceBack(0, EXTENT, -maxInt16, 0, maxInt16, 0, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); + collisionBoxArray.emplaceBack(0, 0, 0, -maxInt16, 0, maxInt16, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(EXTENT, 0, 0, -maxInt16, 0, maxInt16, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(0, 0, -maxInt16, 0, maxInt16, 0, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(0, EXTENT, -maxInt16, 0, maxInt16, 0, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); } - this.tempCollisionBox = collisionBoxArray.get(0); this.edges = [ collisionBoxArray.get(1), @@ -52464,8 +54042,7 @@ function CollisionTile(angle, pitch, collisionBoxArray) { collisionBoxArray.get(4) ]; } - -CollisionTile.prototype.serialize = function() { +CollisionTile.prototype.serialize = function () { var data = { angle: this.angle, pitch: this.pitch, @@ -52474,71 +54051,51 @@ CollisionTile.prototype.serialize = function() { }; return { data: data, - transferables: [data.grid, data.ignoredGrid] + transferables: [ + data.grid, + data.ignoredGrid + ] }; }; - CollisionTile.prototype.minScale = 0.25; CollisionTile.prototype.maxScale = 2; - - -/** - * Find the scale at which the collisionFeature can be shown without - * overlapping with other features. - * - * @param {CollisionFeature} collisionFeature - * @returns {number} placementScale - * @private - */ -CollisionTile.prototype.placeCollisionFeature = function(collisionFeature, allowOverlap, avoidEdges) { - +CollisionTile.prototype.placeCollisionFeature = function (collisionFeature, allowOverlap, avoidEdges) { var collisionBoxArray = this.collisionBoxArray; var minPlacementScale = this.minScale; var rotationMatrix = this.rotationMatrix; var yStretch = this.yStretch; - for (var b = collisionFeature.boxStartIndex; b < collisionFeature.boxEndIndex; b++) { - var box = collisionBoxArray.get(b); - var anchorPoint = box.anchorPoint._matMult(rotationMatrix); var x = anchorPoint.x; var y = anchorPoint.y; - var x1 = x + box.x1; var y1 = y + box.y1 * yStretch; var x2 = x + box.x2; var y2 = y + box.y2 * yStretch; - box.bbox0 = x1; box.bbox1 = y1; box.bbox2 = x2; box.bbox3 = y2; - if (!allowOverlap) { var blockingBoxes = this.grid.query(x1, y1, x2, y2); - for (var i = 0; i < blockingBoxes.length; i++) { var blocking = collisionBoxArray.get(blockingBoxes[i]); var blockingAnchorPoint = blocking.anchorPoint._matMult(rotationMatrix); - minPlacementScale = this.getPlacementScale(minPlacementScale, anchorPoint, box, blockingAnchorPoint, blocking); if (minPlacementScale >= this.maxScale) { return minPlacementScale; } } } - if (avoidEdges) { var rotatedCollisionBox; - if (this.angle) { var reverseRotationMatrix = this.reverseRotationMatrix; var tl = new Point(box.x1, box.y1).matMult(reverseRotationMatrix); var tr = new Point(box.x2, box.y1).matMult(reverseRotationMatrix); var bl = new Point(box.x1, box.y2).matMult(reverseRotationMatrix); var br = new Point(box.x2, box.y2).matMult(reverseRotationMatrix); - rotatedCollisionBox = this.tempCollisionBox; rotatedCollisionBox.anchorPointX = box.anchorPoint.x; rotatedCollisionBox.anchorPointY = box.anchorPoint.y; @@ -52550,7 +54107,6 @@ CollisionTile.prototype.placeCollisionFeature = function(collisionFeature, allow } else { rotatedCollisionBox = box; } - for (var k = 0; k < this.edges.length; k++) { var edgeBox = this.edges[k]; minPlacementScale = this.getPlacementScale(minPlacementScale, box.anchorPoint, rotatedCollisionBox, edgeBox.anchorPoint, edgeBox); @@ -52560,18 +54116,14 @@ CollisionTile.prototype.placeCollisionFeature = function(collisionFeature, allow } } } - return minPlacementScale; }; - -CollisionTile.prototype.queryRenderedSymbols = function(minX, minY, maxX, maxY, scale) { +CollisionTile.prototype.queryRenderedSymbols = function (minX, minY, maxX, maxY, scale) { var sourceLayerFeatures = {}; var result = []; - var collisionBoxArray = this.collisionBoxArray; var rotationMatrix = this.rotationMatrix; var anchorPoint = new Point(minX, minY)._matMult(rotationMatrix); - var queryBox = this.tempCollisionBox; queryBox.anchorX = anchorPoint.x; queryBox.anchorY = anchorPoint.y; @@ -52580,32 +54132,25 @@ CollisionTile.prototype.queryRenderedSymbols = function(minX, minY, maxX, maxY, queryBox.x2 = maxX - minX; queryBox.y2 = maxY - minY; queryBox.maxScale = scale; - - // maxScale is stored using a Float32. Convert `scale` to the stored Float32 value. scale = queryBox.maxScale; - var searchBox = [ anchorPoint.x + queryBox.x1 / scale, anchorPoint.y + queryBox.y1 / scale * this.yStretch, anchorPoint.x + queryBox.x2 / scale, anchorPoint.y + queryBox.y2 / scale * this.yStretch ]; - var blockingBoxKeys = this.grid.query(searchBox[0], searchBox[1], searchBox[2], searchBox[3]); var blockingBoxKeys2 = this.ignoredGrid.query(searchBox[0], searchBox[1], searchBox[2], searchBox[3]); for (var k = 0; k < blockingBoxKeys2.length; k++) { blockingBoxKeys.push(blockingBoxKeys2[k]); } - for (var i = 0; i < blockingBoxKeys.length; i++) { var blocking = collisionBoxArray.get(blockingBoxKeys[i]); - var sourceLayer = blocking.sourceLayerIndex; var featureIndex = blocking.featureIndex; if (sourceLayerFeatures[sourceLayer] === undefined) { sourceLayerFeatures[sourceLayer] = {}; } - if (!sourceLayerFeatures[sourceLayer][featureIndex]) { var blockingAnchorPoint = blocking.anchorPoint.matMult(rotationMatrix); var minPlacementScale = this.getPlacementScale(this.minScale, anchorPoint, queryBox, blockingAnchorPoint, blocking); @@ -52615,66 +54160,36 @@ CollisionTile.prototype.queryRenderedSymbols = function(minX, minY, maxX, maxY, } } } - return result; }; - -CollisionTile.prototype.getPlacementScale = function(minPlacementScale, anchorPoint, box, blockingAnchorPoint, blocking) { - - // Find the lowest scale at which the two boxes can fit side by side without overlapping. - // Original algorithm: +CollisionTile.prototype.getPlacementScale = function (minPlacementScale, anchorPoint, box, blockingAnchorPoint, blocking) { var anchorDiffX = anchorPoint.x - blockingAnchorPoint.x; var anchorDiffY = anchorPoint.y - blockingAnchorPoint.y; - var s1 = (blocking.x1 - box.x2) / anchorDiffX; // scale at which new box is to the left of old box - var s2 = (blocking.x2 - box.x1) / anchorDiffX; // scale at which new box is to the right of old box - var s3 = (blocking.y1 - box.y2) * this.yStretch / anchorDiffY; // scale at which new box is to the top of old box - var s4 = (blocking.y2 - box.y1) * this.yStretch / anchorDiffY; // scale at which new box is to the bottom of old box - - if (isNaN(s1) || isNaN(s2)) s1 = s2 = 1; - if (isNaN(s3) || isNaN(s4)) s3 = s4 = 1; - + var s1 = (blocking.x1 - box.x2) / anchorDiffX; + var s2 = (blocking.x2 - box.x1) / anchorDiffX; + var s3 = (blocking.y1 - box.y2) * this.yStretch / anchorDiffY; + var s4 = (blocking.y2 - box.y1) * this.yStretch / anchorDiffY; + if (isNaN(s1) || isNaN(s2)) + s1 = s2 = 1; + if (isNaN(s3) || isNaN(s4)) + s3 = s4 = 1; var collisionFreeScale = Math.min(Math.max(s1, s2), Math.max(s3, s4)); var blockingMaxScale = blocking.maxScale; var boxMaxScale = box.maxScale; - if (collisionFreeScale > blockingMaxScale) { - // After a box's maxScale the label has shrunk enough that the box is no longer needed to cover it, - // so unblock the new box at the scale that the old box disappears. collisionFreeScale = blockingMaxScale; } - if (collisionFreeScale > boxMaxScale) { - // If the box can only be shown after it is visible, then the box can never be shown. - // But the label can be shown after this box is not visible. collisionFreeScale = boxMaxScale; } - - if (collisionFreeScale > minPlacementScale && - collisionFreeScale >= blocking.placementScale) { - // If this collision occurs at a lower scale than previously found collisions - // and the collision occurs while the other label is visible - - // this this is the lowest scale at which the label won't collide with anything + if (collisionFreeScale > minPlacementScale && collisionFreeScale >= blocking.placementScale) { minPlacementScale = collisionFreeScale; } - return minPlacementScale; }; - - -/** - * Remember this collisionFeature and what scale it was placed at to block - * later features from overlapping with it. - * - * @param {CollisionFeature} collisionFeature - * @param {number} minPlacementScale - * @private - */ -CollisionTile.prototype.insertCollisionFeature = function(collisionFeature, minPlacementScale, ignorePlacement) { - +CollisionTile.prototype.insertCollisionFeature = function (collisionFeature, minPlacementScale, ignorePlacement) { var grid = ignorePlacement ? this.ignoredGrid : this.grid; var collisionBoxArray = this.collisionBoxArray; - for (var k = collisionFeature.boxStartIndex; k < collisionFeature.boxEndIndex; k++) { var box = collisionBoxArray.get(k); box.placementScale = minPlacementScale; @@ -52683,211 +54198,122 @@ CollisionTile.prototype.insertCollisionFeature = function(collisionFeature, minP } } }; - -},{"../data/bucket":247,"grid-index":373,"point-geometry":404}],309:[function(require,module,exports){ +},{"../data/bucket":253,"grid-index":392,"point-geometry":424}],321:[function(require,module,exports){ 'use strict'; - var interpolate = require('../util/interpolate'); var Anchor = require('../symbol/anchor'); var checkMaxAngle = require('./check_max_angle'); - module.exports = getAnchors; - function getAnchors(line, spacing, maxAngle, shapedText, shapedIcon, glyphSize, boxScale, overscaling, tileExtent) { - - // Resample a line to get anchor points for labels and check that each - // potential label passes text-max-angle check and has enough froom to fit - // on the line. - - var angleWindowSize = shapedText ? - 3 / 5 * glyphSize * boxScale : - 0; - - var labelLength = Math.max( - shapedText ? shapedText.right - shapedText.left : 0, - shapedIcon ? shapedIcon.right - shapedIcon.left : 0); - - // Is the line continued from outside the tile boundary? + var angleWindowSize = shapedText ? 3 / 5 * glyphSize * boxScale : 0; + var labelLength = Math.max(shapedText ? shapedText.right - shapedText.left : 0, shapedIcon ? shapedIcon.right - shapedIcon.left : 0); var isLineContinued = line[0].x === 0 || line[0].x === tileExtent || line[0].y === 0 || line[0].y === tileExtent; - - // Is the label long, relative to the spacing? - // If so, adjust the spacing so there is always a minimum space of `spacing / 4` between label edges. - if (spacing - labelLength * boxScale < spacing / 4) { + if (spacing - labelLength * boxScale < spacing / 4) { spacing = labelLength * boxScale + spacing / 4; } - - // Offset the first anchor by: - // Either half the label length plus a fixed extra offset if the line is not continued - // Or half the spacing if the line is continued. - - // For non-continued lines, add a bit of fixed extra offset to avoid collisions at T intersections. var fixedExtraOffset = glyphSize * 2; - - var offset = !isLineContinued ? - ((labelLength / 2 + fixedExtraOffset) * boxScale * overscaling) % spacing : - (spacing / 2 * overscaling) % spacing; - + var offset = !isLineContinued ? (labelLength / 2 + fixedExtraOffset) * boxScale * overscaling % spacing : spacing / 2 * overscaling % spacing; return resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength * boxScale, isLineContinued, false, tileExtent); } - - function resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, placeAtMiddle, tileExtent) { - var halfLabelLength = labelLength / 2; var lineLength = 0; for (var k = 0; k < line.length - 1; k++) { lineLength += line[k].dist(line[k + 1]); } - - var distance = 0, - markedDistance = offset - spacing; - + var distance = 0, markedDistance = offset - spacing; var anchors = []; - for (var i = 0; i < line.length - 1; i++) { - - var a = line[i], - b = line[i + 1]; - - var segmentDist = a.dist(b), - angle = b.angleTo(a); - + var a = line[i], b = line[i + 1]; + var segmentDist = a.dist(b), angle = b.angleTo(a); while (markedDistance + spacing < distance + segmentDist) { markedDistance += spacing; - - var t = (markedDistance - distance) / segmentDist, - x = interpolate(a.x, b.x, t), - y = interpolate(a.y, b.y, t); - - // Check that the point is within the tile boundaries and that - // the label would fit before the beginning and end of the line - // if placed at this point. - if (x >= 0 && x < tileExtent && y >= 0 && y < tileExtent && - markedDistance - halfLabelLength >= 0 && - markedDistance + halfLabelLength <= lineLength) { + var t = (markedDistance - distance) / segmentDist, x = interpolate(a.x, b.x, t), y = interpolate(a.y, b.y, t); + if (x >= 0 && x < tileExtent && y >= 0 && y < tileExtent && markedDistance - halfLabelLength >= 0 && markedDistance + halfLabelLength <= lineLength) { var anchor = new Anchor(x, y, angle, i)._round(); - if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) { anchors.push(anchor); } } } - distance += segmentDist; } - if (!placeAtMiddle && !anchors.length && !isLineContinued) { - // The first attempt at finding anchors at which labels can be placed failed. - // Try again, but this time just try placing one anchor at the middle of the line. - // This has the most effect for short lines in overscaled tiles, since the - // initial offset used in overscaled tiles is calculated to align labels with positions in - // parent tiles instead of placing the label as close to the beginning as possible. anchors = resample(line, distance / 2, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, true, tileExtent); } - return anchors; } - -},{"../symbol/anchor":303,"../util/interpolate":343,"./check_max_angle":304}],310:[function(require,module,exports){ +},{"../symbol/anchor":315,"../util/interpolate":360,"./check_max_angle":316}],322:[function(require,module,exports){ 'use strict'; - var ShelfPack = require('shelf-pack'); - +var util = require('../util/util'); +var SIZE_GROWTH_RATE = 4; +var DEFAULT_SIZE = 128; +var MAX_SIZE = 2048; module.exports = GlyphAtlas; -function GlyphAtlas(width, height) { - this.width = width; - this.height = height; - - this.bin = new ShelfPack(width, height); +function GlyphAtlas() { + this.width = DEFAULT_SIZE; + this.height = DEFAULT_SIZE; + this.bin = new ShelfPack(this.width, this.height); this.index = {}; this.ids = {}; - this.data = new Uint8Array(width * height); + this.data = new Uint8Array(this.width * this.height); } - -GlyphAtlas.prototype.getGlyphs = function() { - var glyphs = {}, - split, - name, - id; - +GlyphAtlas.prototype.getGlyphs = function () { + var glyphs = {}, split, name, id; for (var key in this.ids) { split = key.split('#'); name = split[0]; id = split[1]; - - if (!glyphs[name]) glyphs[name] = []; + if (!glyphs[name]) + glyphs[name] = []; glyphs[name].push(id); } - return glyphs; }; - -GlyphAtlas.prototype.getRects = function() { - var rects = {}, - split, - name, - id; - +GlyphAtlas.prototype.getRects = function () { + var rects = {}, split, name, id; for (var key in this.ids) { split = key.split('#'); name = split[0]; id = split[1]; - - if (!rects[name]) rects[name] = {}; + if (!rects[name]) + rects[name] = {}; rects[name][id] = this.index[key]; } - return rects; }; - - -GlyphAtlas.prototype.addGlyph = function(id, name, glyph, buffer) { - if (!glyph) { - // console.warn('missing glyph', code, String.fromCharCode(code)); +GlyphAtlas.prototype.addGlyph = function (id, name, glyph, buffer) { + if (!glyph) return null; - } - var key = name + "#" + glyph.id; - - // The glyph is already in this texture. + var key = name + '#' + glyph.id; if (this.index[key]) { if (this.ids[key].indexOf(id) < 0) { this.ids[key].push(id); } return this.index[key]; } - - // The glyph bitmap has zero width. if (!glyph.bitmap) { return null; } - var bufferedWidth = glyph.width + buffer * 2; var bufferedHeight = glyph.height + buffer * 2; - - // Add a 1px border around every image. var padding = 1; var packWidth = bufferedWidth + 2 * padding; var packHeight = bufferedHeight + 2 * padding; - - // Increase to next number divisible by 4, but at least 1. - // This is so we can scale down the texture coordinates and pack them - // into 2 bytes rather than 4 bytes. - packWidth += (4 - packWidth % 4); - packHeight += (4 - packHeight % 4); - + packWidth += 4 - packWidth % 4; + packHeight += 4 - packHeight % 4; var rect = this.bin.packOne(packWidth, packHeight); if (!rect) { this.resize(); rect = this.bin.packOne(packWidth, packHeight); } if (!rect) { - console.warn('glyph bitmap overflow'); + util.warnOnce('glyph bitmap overflow'); return null; } - this.index[key] = rect; this.ids[key] = [id]; - var target = this.data; var source = glyph.bitmap; for (var y = 0; y < bufferedHeight; y++) { @@ -52897,42 +54323,32 @@ GlyphAtlas.prototype.addGlyph = function(id, name, glyph, buffer) { target[y1 + x] = source[y2 + x]; } } - this.dirty = true; - return rect; }; - -GlyphAtlas.prototype.resize = function() { - var origw = this.width, - origh = this.height; - - // For now, don't grow the atlas beyond 1024x1024 because of how - // texture coords pack into unsigned byte in symbol bucket. - if (origw > 512 || origh > 512) return; - +GlyphAtlas.prototype.resize = function () { + var prevWidth = this.width; + var prevHeight = this.height; + if (prevWidth >= MAX_SIZE || prevHeight >= MAX_SIZE) + return; if (this.texture) { if (this.gl) { this.gl.deleteTexture(this.texture); } this.texture = null; } - - this.width *= 2; - this.height *= 2; + this.width *= SIZE_GROWTH_RATE; + this.height *= SIZE_GROWTH_RATE; this.bin.resize(this.width, this.height); - - var buf = new ArrayBuffer(this.width * this.height), - src, dst; - for (var i = 0; i < origh; i++) { - src = new Uint8Array(this.data.buffer, origh * i, origw); - dst = new Uint8Array(buf, origh * i * 2, origw); + var buf = new ArrayBuffer(this.width * this.height); + for (var i = 0; i < prevHeight; i++) { + var src = new Uint8Array(this.data.buffer, prevHeight * i, prevWidth); + var dst = new Uint8Array(buf, prevHeight * i * SIZE_GROWTH_RATE, prevWidth); dst.set(src); } this.data = new Uint8Array(buf); }; - -GlyphAtlas.prototype.bind = function(gl) { +GlyphAtlas.prototype.bind = function (gl) { this.gl = gl; if (!this.texture) { this.texture = gl.createTexture(); @@ -52942,73 +54358,53 @@ GlyphAtlas.prototype.bind = function(gl) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, this.width, this.height, 0, gl.ALPHA, gl.UNSIGNED_BYTE, null); - } else { gl.bindTexture(gl.TEXTURE_2D, this.texture); } }; - -GlyphAtlas.prototype.updateTexture = function(gl) { +GlyphAtlas.prototype.updateTexture = function (gl) { this.bind(gl); if (this.dirty) { gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, this.height, gl.ALPHA, gl.UNSIGNED_BYTE, this.data); this.dirty = false; } }; - -},{"shelf-pack":406}],311:[function(require,module,exports){ +},{"../util/util":366,"shelf-pack":427}],323:[function(require,module,exports){ 'use strict'; - var normalizeURL = require('../util/mapbox').normalizeGlyphsURL; var getArrayBuffer = require('../util/ajax').getArrayBuffer; var Glyphs = require('../util/glyphs'); var GlyphAtlas = require('../symbol/glyph_atlas'); var Protobuf = require('pbf'); - module.exports = GlyphSource; - -/** - * A glyph source has a URL from which to load new glyphs and manages - * GlyphAtlases in which to store glyphs used by the requested fontstacks - * and ranges. - * - * @param {string} url glyph template url - * @private - */ function GlyphSource(url) { this.url = url && normalizeURL(url); this.atlases = {}; this.stacks = {}; this.loading = {}; } - -GlyphSource.prototype.getSimpleGlyphs = function(fontstack, glyphIDs, uid, callback) { +GlyphSource.prototype.getSimpleGlyphs = function (fontstack, glyphIDs, uid, callback) { if (this.stacks[fontstack] === undefined) { this.stacks[fontstack] = {}; } if (this.atlases[fontstack] === undefined) { - this.atlases[fontstack] = new GlyphAtlas(128, 128); + this.atlases[fontstack] = new GlyphAtlas(); } - var glyphs = {}; var stack = this.stacks[fontstack]; var atlas = this.atlases[fontstack]; - - // the number of pixels the sdf bitmaps are padded by var buffer = 3; - var missing = {}; var remaining = 0; var range; - for (var i = 0; i < glyphIDs.length; i++) { var glyphID = glyphIDs[i]; range = Math.floor(glyphID / 256); - if (stack[range]) { var glyph = stack[range].glyphs[glyphID]; - var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); - if (glyph) glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); + var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); + if (glyph) + glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); } else { if (missing[range] === undefined) { missing[range] = []; @@ -53017,30 +54413,27 @@ GlyphSource.prototype.getSimpleGlyphs = function(fontstack, glyphIDs, uid, callb missing[range].push(glyphID); } } - - if (!remaining) callback(undefined, glyphs, fontstack); - - var onRangeLoaded = function(err, range, data) { - // TODO not be silent about errors + if (!remaining) + callback(undefined, glyphs, fontstack); + var onRangeLoaded = function (err, range, data) { if (!err) { var stack = this.stacks[fontstack][range] = data.stacks[0]; for (var i = 0; i < missing[range].length; i++) { var glyphID = missing[range][i]; var glyph = stack.glyphs[glyphID]; - var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); - if (glyph) glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); + var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); + if (glyph) + glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); } } remaining--; - if (!remaining) callback(undefined, glyphs, fontstack); + if (!remaining) + callback(undefined, glyphs, fontstack); }.bind(this); - for (var r in missing) { this.loadRange(fontstack, r, onRangeLoaded); } }; - -// A simplified representation of the glyph containing only the properties needed for shaping. function SimpleGlyph(glyph, rect, buffer) { var padding = 1; this.advance = glyph.advance; @@ -53048,24 +54441,20 @@ function SimpleGlyph(glyph, rect, buffer) { this.top = glyph.top + buffer + padding; this.rect = rect; } - -GlyphSource.prototype.loadRange = function(fontstack, range, callback) { - if (range * 256 > 65535) return callback('glyphs > 65535 not supported'); - +GlyphSource.prototype.loadRange = function (fontstack, range, callback) { + if (range * 256 > 65535) + return callback('glyphs > 65535 not supported'); if (this.loading[fontstack] === undefined) { this.loading[fontstack] = {}; } var loading = this.loading[fontstack]; - if (loading[range]) { loading[range].push(callback); } else { loading[range] = [callback]; - - var rangeName = (range * 256) + '-' + (range * 256 + 255); + var rangeName = range * 256 + '-' + (range * 256 + 255); var url = glyphUrl(fontstack, rangeName, this.url); - - getArrayBuffer(url, function(err, data) { + getArrayBuffer(url, function (err, data) { var glyphs = !err && new Glyphs(new Protobuf(new Uint8Array(data))); for (var i = 0; i < loading[range].length; i++) { loading[range][i](err, range, glyphs); @@ -53074,190 +54463,116 @@ GlyphSource.prototype.loadRange = function(fontstack, range, callback) { }); } }; - -GlyphSource.prototype.getGlyphAtlas = function(fontstack) { +GlyphSource.prototype.getGlyphAtlas = function (fontstack) { return this.atlases[fontstack]; }; - -/** - * Use CNAME sharding to load a specific glyph range over a randomized - * but consistent subdomain. - * @param {string} fontstack comma-joined fonts - * @param {string} range comma-joined range - * @param {url} url templated url - * @param {string} [subdomains=abc] subdomains as a string where each letter is one. - * @returns {string} a url to load that section of glyphs - * @private - */ function glyphUrl(fontstack, range, url, subdomains) { subdomains = subdomains || 'abc'; - - return url - .replace('{s}', subdomains[fontstack.length % subdomains.length]) - .replace('{fontstack}', fontstack) - .replace('{range}', range); + return url.replace('{s}', subdomains[fontstack.length % subdomains.length]).replace('{fontstack}', fontstack).replace('{range}', range); } - -},{"../symbol/glyph_atlas":310,"../util/ajax":334,"../util/glyphs":342,"../util/mapbox":346,"pbf":402}],312:[function(require,module,exports){ +},{"../symbol/glyph_atlas":322,"../util/ajax":349,"../util/glyphs":359,"../util/mapbox":363,"pbf":422}],324:[function(require,module,exports){ 'use strict'; - module.exports = function (features, textFeatures, geometries) { - - var leftIndex = {}, - rightIndex = {}, - mergedFeatures = [], - mergedGeom = [], - mergedTexts = [], - mergedIndex = 0, - k; - + var leftIndex = {}, rightIndex = {}, mergedFeatures = [], mergedGeom = [], mergedTexts = [], mergedIndex = 0, k; function add(k) { mergedFeatures.push(features[k]); mergedGeom.push(geometries[k]); mergedTexts.push(textFeatures[k]); mergedIndex++; } - function mergeFromRight(leftKey, rightKey, geom) { var i = rightIndex[leftKey]; delete rightIndex[leftKey]; rightIndex[rightKey] = i; - mergedGeom[i][0].pop(); mergedGeom[i][0] = mergedGeom[i][0].concat(geom[0]); return i; } - function mergeFromLeft(leftKey, rightKey, geom) { var i = leftIndex[rightKey]; delete leftIndex[rightKey]; leftIndex[leftKey] = i; - mergedGeom[i][0].shift(); mergedGeom[i][0] = geom[0].concat(mergedGeom[i][0]); return i; } - function getKey(text, geom, onRight) { var point = onRight ? geom[0][geom[0].length - 1] : geom[0][0]; return text + ':' + point.x + ':' + point.y; } - for (k = 0; k < features.length; k++) { - var geom = geometries[k], - text = textFeatures[k]; - + var geom = geometries[k], text = textFeatures[k]; if (!text) { add(k); continue; } - - var leftKey = getKey(text, geom), - rightKey = getKey(text, geom, true); - - if ((leftKey in rightIndex) && (rightKey in leftIndex) && (rightIndex[leftKey] !== leftIndex[rightKey])) { - // found lines with the same text adjacent to both ends of the current line, merge all three + var leftKey = getKey(text, geom), rightKey = getKey(text, geom, true); + if (leftKey in rightIndex && rightKey in leftIndex && rightIndex[leftKey] !== leftIndex[rightKey]) { var j = mergeFromLeft(leftKey, rightKey, geom); var i = mergeFromRight(leftKey, rightKey, mergedGeom[j]); - delete leftIndex[leftKey]; delete rightIndex[rightKey]; - rightIndex[getKey(text, mergedGeom[i], true)] = i; mergedGeom[j] = null; - } else if (leftKey in rightIndex) { - // found mergeable line adjacent to the start of the current line, merge mergeFromRight(leftKey, rightKey, geom); - } else if (rightKey in leftIndex) { - // found mergeable line adjacent to the end of the current line, merge mergeFromLeft(leftKey, rightKey, geom); - } else { - // no adjacent lines, add as a new item add(k); leftIndex[leftKey] = mergedIndex - 1; rightIndex[rightKey] = mergedIndex - 1; } } - return { features: mergedFeatures, textFeatures: mergedTexts, geometries: mergedGeom }; }; - -},{}],313:[function(require,module,exports){ +},{}],325:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - module.exports = { getIconQuads: getIconQuads, - getGlyphQuads: getGlyphQuads + getGlyphQuads: getGlyphQuads, + SymbolQuad: SymbolQuad }; - -var minScale = 0.5; // underscale by 1 zoom level - -/** - * A textured quad for rendering a single icon or glyph. - * - * The zoom range the glyph can be shown is defined by minScale and maxScale. - * - * @param {Point} anchorPoint the point the symbol is anchored around - * @param {Point} tl The offset of the top left corner from the anchor. - * @param {Point} tr The offset of the top right corner from the anchor. - * @param {Point} bl The offset of the bottom left corner from the anchor. - * @param {Point} br The offset of the bottom right corner from the anchor. - * @param {Object} tex The texture coordinates. - * @param {number} angle The angle of the label at it's center, not the angle of this quad. - * @param {number} minScale The minimum scale, relative to the tile's intended scale, that the glyph can be shown at. - * @param {number} maxScale The maximum scale, relative to the tile's intended scale, that the glyph can be shown at. - * - * @class SymbolQuad - * @private - */ -function SymbolQuad(anchorPoint, tl, tr, bl, br, tex, angle, minScale, maxScale) { +var minScale = 0.5; +function SymbolQuad(anchorPoint, tl, tr, bl, br, tex, anchorAngle, glyphAngle, minScale, maxScale) { this.anchorPoint = anchorPoint; this.tl = tl; this.tr = tr; this.bl = bl; this.br = br; this.tex = tex; - this.angle = angle; + this.anchorAngle = anchorAngle; + this.glyphAngle = glyphAngle; this.minScale = minScale; this.maxScale = maxScale; } - -/** - * Create the quads used for rendering an icon. - * - * @param {Anchor} anchor - * @param {PositionedIcon} shapedIcon - * @param {number} boxScale A magic number for converting glyph metric units to geometry units. - * @param {Array>} line - * @param {LayoutProperties} layout - * @param {boolean} alongLine Whether the icon should be placed along the line. - * @returns {Array} - * @private - */ -function getIconQuads(anchor, shapedIcon, boxScale, line, layout, alongLine) { - +function getIconQuads(anchor, shapedIcon, boxScale, line, layer, alongLine, shapedText, globalProperties, featureProperties) { var rect = shapedIcon.image.rect; - + var layout = layer.layout; var border = 1; var left = shapedIcon.left - border; var right = left + rect.w / shapedIcon.image.pixelRatio; var top = shapedIcon.top - border; var bottom = top + rect.h / shapedIcon.image.pixelRatio; - var tl = new Point(left, top); - var tr = new Point(right, top); - var br = new Point(right, bottom); - var bl = new Point(left, bottom); - - var angle = layout['icon-rotate'] * Math.PI / 180; + var tl, tr, br, bl; + if (layout['icon-text-fit'] !== 'none' && shapedText) { + var iconWidth = right - left, iconHeight = bottom - top, size = layout['text-size'] / 24, textLeft = shapedText.left * size, textRight = shapedText.right * size, textTop = shapedText.top * size, textBottom = shapedText.bottom * size, textWidth = textRight - textLeft, textHeight = textBottom - textTop, padT = layout['icon-text-fit-padding'][0], padR = layout['icon-text-fit-padding'][1], padB = layout['icon-text-fit-padding'][2], padL = layout['icon-text-fit-padding'][3], offsetY = layout['icon-text-fit'] === 'width' ? (textHeight - iconHeight) * 0.5 : 0, offsetX = layout['icon-text-fit'] === 'height' ? (textWidth - iconWidth) * 0.5 : 0, width = layout['icon-text-fit'] === 'width' || layout['icon-text-fit'] === 'both' ? textWidth : iconWidth, height = layout['icon-text-fit'] === 'height' || layout['icon-text-fit'] === 'both' ? textHeight : iconHeight; + tl = new Point(textLeft + offsetX - padL, textTop + offsetY - padT); + tr = new Point(textLeft + offsetX + padR + width, textTop + offsetY - padT); + br = new Point(textLeft + offsetX + padR + width, textTop + offsetY + padB + height); + bl = new Point(textLeft + offsetX - padL, textTop + offsetY + padB + height); + } else { + tl = new Point(left, top); + tr = new Point(right, top); + br = new Point(right, bottom); + bl = new Point(left, bottom); + } + var angle = layer.getLayoutValue('icon-rotate', globalProperties, featureProperties) * Math.PI / 180; if (alongLine) { var prev = line[anchor.segment]; if (anchor.y === prev.y && anchor.x === prev.x && anchor.segment + 1 < line.length) { @@ -53267,50 +54582,32 @@ function getIconQuads(anchor, shapedIcon, boxScale, line, layout, alongLine) { angle += Math.atan2(anchor.y - prev.y, anchor.x - prev.x); } } - if (angle) { - var sin = Math.sin(angle), - cos = Math.cos(angle), - matrix = [cos, -sin, sin, cos]; - + var sin = Math.sin(angle), cos = Math.cos(angle), matrix = [ + cos, + -sin, + sin, + cos + ]; tl = tl.matMult(matrix); tr = tr.matMult(matrix); bl = bl.matMult(matrix); br = br.matMult(matrix); } - - return [new SymbolQuad(new Point(anchor.x, anchor.y), tl, tr, bl, br, shapedIcon.image.rect, 0, minScale, Infinity)]; + return [new SymbolQuad(new Point(anchor.x, anchor.y), tl, tr, bl, br, shapedIcon.image.rect, 0, 0, minScale, Infinity)]; } - -/** - * Create the quads used for rendering a text label. - * - * @param {Anchor} anchor - * @param {Shaping} shaping - * @param {number} boxScale A magic number for converting from glyph metric units to geometry units. - * @param {Array>} line - * @param {LayoutProperties} layout - * @param {boolean} alongLine Whether the label should be placed along the line. - * @returns {Array} - * @private - */ -function getGlyphQuads(anchor, shaping, boxScale, line, layout, alongLine) { - - var textRotate = layout['text-rotate'] * Math.PI / 180; - var keepUpright = layout['text-keep-upright']; - +function getGlyphQuads(anchor, shaping, boxScale, line, layer, alongLine) { + var textRotate = layer.layout['text-rotate'] * Math.PI / 180; + var keepUpright = layer.layout['text-keep-upright']; var positionedGlyphs = shaping.positionedGlyphs; var quads = []; - for (var k = 0; k < positionedGlyphs.length; k++) { var positionedGlyph = positionedGlyphs[k]; var glyph = positionedGlyph.glyph; var rect = glyph.rect; - - if (!rect) continue; - + if (!rect) + continue; var centerX = (positionedGlyph.x + glyph.advance / 2) * boxScale; - var glyphInstances; var labelMinScale = minScale; if (alongLine) { @@ -53319,99 +54616,55 @@ function getGlyphQuads(anchor, shaping, boxScale, line, layout, alongLine) { if (keepUpright) { labelMinScale = Math.min(labelMinScale, getSegmentGlyphs(glyphInstances, anchor, centerX, line, anchor.segment, false)); } - } else { glyphInstances = [{ - anchorPoint: new Point(anchor.x, anchor.y), - offset: 0, - angle: 0, - maxScale: Infinity, - minScale: minScale - }]; + anchorPoint: new Point(anchor.x, anchor.y), + offset: 0, + angle: 0, + maxScale: Infinity, + minScale: minScale + }]; } - - var x1 = positionedGlyph.x + glyph.left, - y1 = positionedGlyph.y - glyph.top, - x2 = x1 + rect.w, - y2 = y1 + rect.h, - - otl = new Point(x1, y1), - otr = new Point(x2, y1), - obl = new Point(x1, y2), - obr = new Point(x2, y2); - + var x1 = positionedGlyph.x + glyph.left, y1 = positionedGlyph.y - glyph.top, x2 = x1 + rect.w, y2 = y1 + rect.h, otl = new Point(x1, y1), otr = new Point(x2, y1), obl = new Point(x1, y2), obr = new Point(x2, y2); for (var i = 0; i < glyphInstances.length; i++) { - - var instance = glyphInstances[i], - tl = otl, - tr = otr, - bl = obl, - br = obr, - angle = instance.angle + textRotate; - - if (angle) { - var sin = Math.sin(angle), - cos = Math.cos(angle), - matrix = [cos, -sin, sin, cos]; - + var instance = glyphInstances[i], tl = otl, tr = otr, bl = obl, br = obr; + if (textRotate) { + var sin = Math.sin(textRotate), cos = Math.cos(textRotate), matrix = [ + cos, + -sin, + sin, + cos + ]; tl = tl.matMult(matrix); tr = tr.matMult(matrix); bl = bl.matMult(matrix); br = br.matMult(matrix); } - - // Prevent label from extending past the end of the line var glyphMinScale = Math.max(instance.minScale, labelMinScale); - - var glyphAngle = (anchor.angle + textRotate + instance.offset + 2 * Math.PI) % (2 * Math.PI); - quads.push(new SymbolQuad(instance.anchorPoint, tl, tr, bl, br, rect, glyphAngle, glyphMinScale, instance.maxScale)); - + var anchorAngle = (anchor.angle + instance.offset + 2 * Math.PI) % (2 * Math.PI); + var glyphAngle = (instance.angle + instance.offset + 2 * Math.PI) % (2 * Math.PI); + quads.push(new SymbolQuad(instance.anchorPoint, tl, tr, bl, br, rect, anchorAngle, glyphAngle, glyphMinScale, instance.maxScale)); } } - return quads; } - -/** - * We can only render glyph quads that slide along a straight line. To draw - * curved lines we need an instance of a glyph for each segment it appears on. - * This creates all the instances of a glyph that are necessary to render a label. - * - * We need a - * @param {Array} glyphInstances An empty array that glyphInstances are added to. - * @param {Anchor} anchor - * @param {number} offset The glyph's offset from the center of the label. - * @param {Array} line - * @param {number} segment The index of the segment of the line on which the anchor exists. - * @param {boolean} forward If true get the glyphs that come later on the line, otherwise get the glyphs that come earlier. - * - * @returns {Array} glyphInstances - * @private - */ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { var upsideDown = !forward; - - if (offset < 0) forward = !forward; - - if (forward) segment++; - + if (offset < 0) + forward = !forward; + if (forward) + segment++; var newAnchorPoint = new Point(anchor.x, anchor.y); var end = line[segment]; var prevScale = Infinity; - offset = Math.abs(offset); - var placementScale = minScale; - while (true) { var distance = newAnchorPoint.dist(end); var scale = offset / distance; - - // Get the angle of the line segment var angle = Math.atan2(end.y - newAnchorPoint.y, end.x - newAnchorPoint.x); - if (!forward) angle += Math.PI; - if (upsideDown) angle += Math.PI; - + if (!forward) + angle += Math.PI; glyphs.push({ anchorPoint: newAnchorPoint, offset: upsideDown ? Math.PI : 0, @@ -53419,12 +54672,9 @@ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { maxScale: prevScale, angle: (angle + 2 * Math.PI) % (2 * Math.PI) }); - - if (scale <= placementScale) break; - + if (scale <= placementScale) + break; newAnchorPoint = end; - - // skip duplicate nodes while (newAnchorPoint.equals(end)) { segment += forward ? 1 : -1; end = line[segment]; @@ -53432,33 +54682,18 @@ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { return scale; } } - var unit = end.sub(newAnchorPoint)._unit(); newAnchorPoint = newAnchorPoint.sub(unit._mult(distance)); - prevScale = scale; } - return placementScale; } - -},{"point-geometry":404}],314:[function(require,module,exports){ +},{"point-geometry":424}],326:[function(require,module,exports){ 'use strict'; - var resolveTokens = require('../util/token'); - module.exports = resolveText; - -/** - * For an array of features determine what glyphs need to be loaded - * and apply any text preprocessing. The remaining users of text should - * use the `textFeatures` key returned by this function rather than accessing - * feature text directly. - * @private - */ function resolveText(features, layoutProperties, codepoints) { var textFeatures = []; - for (var i = 0, fl = features.length; i < fl; i++) { var text = resolveTokens(features[i].properties, layoutProperties['text-field']); if (!text) { @@ -53466,43 +54701,31 @@ function resolveText(features, layoutProperties, codepoints) { continue; } text = text.toString(); - var transform = layoutProperties['text-transform']; if (transform === 'uppercase') { text = text.toLocaleUpperCase(); } else if (transform === 'lowercase') { text = text.toLocaleLowerCase(); } - for (var j = 0; j < text.length; j++) { codepoints[text.charCodeAt(j)] = true; } - - // Track indexes of features with text. textFeatures[i] = text; } - return textFeatures; } - -},{"../util/token":348}],315:[function(require,module,exports){ +},{"../util/token":365}],327:[function(require,module,exports){ 'use strict'; - module.exports = { shapeText: shapeText, shapeIcon: shapeIcon }; - - -// The position of a glyph relative to the text's anchor point. function PositionedGlyph(codePoint, x, y, glyph) { this.codePoint = codePoint; this.x = x; this.y = y; this.glyph = glyph; } - -// A collection of positioned glyphs and some metadata function Shaping(positionedGlyphs, text, top, bottom, left, right) { this.positionedGlyphs = positionedGlyphs; this.text = text; @@ -53511,153 +54734,114 @@ function Shaping(positionedGlyphs, text, top, bottom, left, right) { this.left = left; this.right = right; } - function shapeText(text, glyphs, maxWidth, lineHeight, horizontalAlign, verticalAlign, justify, spacing, translate) { - var positionedGlyphs = []; var shaping = new Shaping(positionedGlyphs, text, translate[1], translate[1], translate[0], translate[0]); - - // the y offset *should* be part of the font metadata var yOffset = -17; - var x = 0; var y = yOffset; - for (var i = 0; i < text.length; i++) { var codePoint = text.charCodeAt(i); var glyph = glyphs[codePoint]; - - if (!glyph) continue; - + if (!glyph) + continue; positionedGlyphs.push(new PositionedGlyph(codePoint, x, y, glyph)); x += glyph.advance + spacing; } - - if (!positionedGlyphs.length) return false; - + if (!positionedGlyphs.length) + return false; linewrap(shaping, glyphs, lineHeight, maxWidth, horizontalAlign, verticalAlign, justify, translate); - return shaping; } - var invisible = { - 0x20: true, // space - 0x200b: true // zero-width space + 32: true, + 8203: true }; - var breakable = { - 0x20: true, // space - 0x26: true, // ampersand - 0x2b: true, // plus sign - 0x2d: true, // hyphen-minus - 0x2f: true, // solidus - 0xad: true, // soft hyphen - 0xb7: true, // middle dot - 0x200b: true, // zero-width space - 0x2010: true, // hyphen - 0x2013: true // en dash + 32: true, + 38: true, + 43: true, + 45: true, + 47: true, + 173: true, + 183: true, + 8203: true, + 8208: true, + 8211: true }; - function linewrap(shaping, glyphs, lineHeight, maxWidth, horizontalAlign, verticalAlign, justify, translate) { var lastSafeBreak = null; - var lengthBeforeCurrentLine = 0; var lineStartIndex = 0; var line = 0; - var maxLineLength = 0; - var positionedGlyphs = shaping.positionedGlyphs; - if (maxWidth) { for (var i = 0; i < positionedGlyphs.length; i++) { var positionedGlyph = positionedGlyphs[i]; - positionedGlyph.x -= lengthBeforeCurrentLine; positionedGlyph.y += lineHeight * line; - if (positionedGlyph.x > maxWidth && lastSafeBreak !== null) { - var lineLength = positionedGlyphs[lastSafeBreak + 1].x; maxLineLength = Math.max(lineLength, maxLineLength); - for (var k = lastSafeBreak + 1; k <= i; k++) { positionedGlyphs[k].y += lineHeight; positionedGlyphs[k].x -= lineLength; } - if (justify) { - // Collapse invisible characters. var lineEnd = lastSafeBreak; if (invisible[positionedGlyphs[lastSafeBreak].codePoint]) { lineEnd--; } - justifyLine(positionedGlyphs, glyphs, lineStartIndex, lineEnd, justify); } - lineStartIndex = lastSafeBreak + 1; lastSafeBreak = null; lengthBeforeCurrentLine += lineLength; line++; } - if (breakable[positionedGlyph.codePoint]) { lastSafeBreak = i; } } } - var lastPositionedGlyph = positionedGlyphs[positionedGlyphs.length - 1]; var lastLineLength = lastPositionedGlyph.x + glyphs[lastPositionedGlyph.codePoint].advance; maxLineLength = Math.max(maxLineLength, lastLineLength); - var height = (line + 1) * lineHeight; - justifyLine(positionedGlyphs, glyphs, lineStartIndex, positionedGlyphs.length - 1, justify); align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, line, translate); - - // Calculate the bounding box shaping.top += -verticalAlign * height; shaping.bottom = shaping.top + height; shaping.left += -horizontalAlign * maxLineLength; shaping.right = shaping.left + maxLineLength; } - function justifyLine(positionedGlyphs, glyphs, start, end, justify) { var lastAdvance = glyphs[positionedGlyphs[end].codePoint].advance; var lineIndent = (positionedGlyphs[end].x + lastAdvance) * justify; - for (var j = start; j <= end; j++) { positionedGlyphs[j].x -= lineIndent; } - } - function align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, line, translate) { var shiftX = (justify - horizontalAlign) * maxLineLength + translate[0]; var shiftY = (-verticalAlign * (line + 1) + 0.5) * lineHeight + translate[1]; - for (var j = 0; j < positionedGlyphs.length; j++) { positionedGlyphs[j].x += shiftX; positionedGlyphs[j].y += shiftY; } } - - function shapeIcon(image, layout) { - if (!image || !image.rect) return null; - + if (!image || !image.rect) + return null; var dx = layout['icon-offset'][0]; var dy = layout['icon-offset'][1]; var x1 = dx - image.width / 2; var x2 = x1 + image.width; var y1 = dy - image.height / 2; var y2 = y1 + image.height; - return new PositionedIcon(image, y1, y2, x1, x2); } - function PositionedIcon(image, top, bottom, left, right) { this.image = image; this.top = top; @@ -53665,41 +54849,34 @@ function PositionedIcon(image, top, bottom, left, right) { this.left = left; this.right = right; } - -},{}],316:[function(require,module,exports){ +},{}],328:[function(require,module,exports){ 'use strict'; - var ShelfPack = require('shelf-pack'); var browser = require('../util/browser'); - +var util = require('../util/util'); module.exports = SpriteAtlas; function SpriteAtlas(width, height) { this.width = width; this.height = height; - this.bin = new ShelfPack(width, height); this.images = {}; this.data = false; - this.texture = 0; // WebGL ID - this.filter = 0; // WebGL ID + this.texture = 0; + this.filter = 0; this.pixelRatio = 1; this.dirty = true; } - function copyBitmap(src, srcStride, srcX, srcY, dst, dstStride, dstX, dstY, width, height, wrap) { var srcI = srcY * srcStride + srcX; var dstI = dstY * dstStride + dstX; var x, y; - if (wrap) { - // add 1 pixel wrapped padding on each side of the image dstI -= dstStride; for (y = -1; y <= height; y++, srcI = ((y + height) % height + srcY) * srcStride + srcX, dstI += dstStride) { for (x = -1; x <= width; x++) { - dst[dstI + x] = src[srcI + ((x + width) % width)]; + dst[dstI + x] = src[srcI + (x + width) % width]; } } - } else { for (y = 0; y < height; y++, srcI += srcStride, dstI += dstStride) { for (x = 0; x < width; x++) { @@ -53708,79 +54885,64 @@ function copyBitmap(src, srcStride, srcX, srcY, dst, dstStride, dstX, dstY, widt } } } - -SpriteAtlas.prototype.allocateImage = function(pixelWidth, pixelHeight) { - +SpriteAtlas.prototype.allocateImage = function (pixelWidth, pixelHeight) { pixelWidth = pixelWidth / this.pixelRatio; pixelHeight = pixelHeight / this.pixelRatio; - - // Increase to next number divisible by 4, but at least 1. - // This is so we can scale down the texture coordinates and pack them - // into 2 bytes rather than 4 bytes. - // Pad icons to prevent them from polluting neighbours during linear interpolation var padding = 2; var packWidth = pixelWidth + padding + (4 - (pixelWidth + padding) % 4); - var packHeight = pixelHeight + padding + (4 - (pixelHeight + padding) % 4);// + 4; - + var packHeight = pixelHeight + padding + (4 - (pixelHeight + padding) % 4); var rect = this.bin.packOne(packWidth, packHeight); if (!rect) { - console.warn('SpriteAtlas out of space.'); + util.warnOnce('SpriteAtlas out of space.'); return null; } - return rect; }; - -SpriteAtlas.prototype.getImage = function(name, wrap) { +SpriteAtlas.prototype.getImage = function (name, wrap) { if (this.images[name]) { return this.images[name]; } - if (!this.sprite) { return null; } - var pos = this.sprite.getSpritePosition(name); if (!pos.width || !pos.height) { return null; } - var rect = this.allocateImage(pos.width, pos.height); if (!rect) { return null; } - var image = new AtlasImage(rect, pos.width / pos.pixelRatio, pos.height / pos.pixelRatio, pos.sdf, pos.pixelRatio / this.pixelRatio); this.images[name] = image; - this.copy(rect, pos, wrap); - return image; }; - - -// Return position of a repeating fill pattern. -SpriteAtlas.prototype.getPosition = function(name, repeating) { +SpriteAtlas.prototype.getPosition = function (name, repeating) { var image = this.getImage(name, repeating); var rect = image && image.rect; - if (!rect) { return null; } - var width = image.width * image.pixelRatio; var height = image.height * image.pixelRatio; var padding = 1; - return { - size: [image.width, image.height], - tl: [(rect.x + padding) / this.width, (rect.y + padding) / this.height], - br: [(rect.x + padding + width) / this.width, (rect.y + padding + height) / this.height] + size: [ + image.width, + image.height + ], + tl: [ + (rect.x + padding) / this.width, + (rect.y + padding) / this.height + ], + br: [ + (rect.x + padding + width) / this.width, + (rect.y + padding + height) / this.height + ] }; }; - - -SpriteAtlas.prototype.allocate = function() { +SpriteAtlas.prototype.allocate = function () { if (!this.data) { var w = Math.floor(this.width * this.pixelRatio); var h = Math.floor(this.height * this.pixelRatio); @@ -53790,528 +54952,474 @@ SpriteAtlas.prototype.allocate = function() { } } }; - - -SpriteAtlas.prototype.copy = function(dst, src, wrap) { - if (!this.sprite.img.data) return; - var srcImg = new Uint32Array(this.sprite.img.data.buffer); - - this.allocate(); - var dstImg = this.data; - - var padding = 1; - - copyBitmap( - /* source buffer */ srcImg, - /* source stride */ this.sprite.img.width, - /* source x */ src.x, - /* source y */ src.y, - /* dest buffer */ dstImg, - /* dest stride */ this.width * this.pixelRatio, - /* dest x */ (dst.x + padding) * this.pixelRatio, - /* dest y */ (dst.y + padding) * this.pixelRatio, - /* icon dimension */ src.width, - /* icon dimension */ src.height, - /* wrap */ wrap - ); - - this.dirty = true; -}; - -SpriteAtlas.prototype.setSprite = function(sprite) { - if (sprite) { - this.pixelRatio = browser.devicePixelRatio > 1 ? 2 : 1; - - if (this.canvas) { - this.canvas.width = this.width * this.pixelRatio; - this.canvas.height = this.height * this.pixelRatio; +SpriteAtlas.prototype.copy = function (dst, src, wrap) { + if (!this.sprite.img.data) + return; + var srcImg = new Uint32Array(this.sprite.img.data.buffer); + this.allocate(); + var dstImg = this.data; + var padding = 1; + copyBitmap(srcImg, this.sprite.img.width, src.x, src.y, dstImg, this.width * this.pixelRatio, (dst.x + padding) * this.pixelRatio, (dst.y + padding) * this.pixelRatio, src.width, src.height, wrap); + this.dirty = true; +}; +SpriteAtlas.prototype.setSprite = function (sprite) { + if (sprite) { + this.pixelRatio = browser.devicePixelRatio > 1 ? 2 : 1; + if (this.canvas) { + this.canvas.width = this.width * this.pixelRatio; + this.canvas.height = this.height * this.pixelRatio; + } + } + this.sprite = sprite; +}; +SpriteAtlas.prototype.addIcons = function (icons, callback) { + for (var i = 0; i < icons.length; i++) { + this.getImage(icons[i]); + } + callback(null, this.images); +}; +SpriteAtlas.prototype.bind = function (gl, linear) { + var first = false; + if (!this.texture) { + this.texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, this.texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + first = true; + } else { + gl.bindTexture(gl.TEXTURE_2D, this.texture); + } + var filterVal = linear ? gl.LINEAR : gl.NEAREST; + if (filterVal !== this.filter) { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filterVal); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filterVal); + this.filter = filterVal; + } + if (this.dirty) { + this.allocate(); + if (first) { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width * this.pixelRatio, this.height * this.pixelRatio, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(this.data.buffer)); + } else { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width * this.pixelRatio, this.height * this.pixelRatio, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(this.data.buffer)); + } + this.dirty = false; + } +}; +function AtlasImage(rect, width, height, sdf, pixelRatio) { + this.rect = rect; + this.width = width; + this.height = height; + this.sdf = sdf; + this.pixelRatio = pixelRatio; +} +},{"../util/browser":350,"../util/util":366,"shelf-pack":427}],329:[function(require,module,exports){ +'use strict'; +var StructArrayType = require('../util/struct_array'); +var util = require('../util/util'); +var Point = require('point-geometry'); +var SymbolInstancesArray = module.exports = new StructArrayType({ + members: [ + { + type: 'Uint16', + name: 'textBoxStartIndex' + }, + { + type: 'Uint16', + name: 'textBoxEndIndex' + }, + { + type: 'Uint16', + name: 'iconBoxStartIndex' + }, + { + type: 'Uint16', + name: 'iconBoxEndIndex' + }, + { + type: 'Uint16', + name: 'glyphQuadStartIndex' + }, + { + type: 'Uint16', + name: 'glyphQuadEndIndex' + }, + { + type: 'Uint16', + name: 'iconQuadStartIndex' + }, + { + type: 'Uint16', + name: 'iconQuadEndIndex' + }, + { + type: 'Int16', + name: 'anchorPointX' + }, + { + type: 'Int16', + name: 'anchorPointY' + }, + { + type: 'Int8', + name: 'index' + } + ] +}); +util.extendAll(SymbolInstancesArray.prototype.StructType.prototype, { + get anchorPoint() { + return new Point(this.anchorPointX, this.anchorPointY); + } +}); +},{"../util/struct_array":364,"../util/util":366,"point-geometry":424}],330:[function(require,module,exports){ +'use strict'; +var StructArrayType = require('../util/struct_array'); +var util = require('../util/util'); +var Point = require('point-geometry'); +var SymbolQuad = require('./quads').SymbolQuad; +var SymbolQuadsArray = module.exports = new StructArrayType({ + members: [ + { + type: 'Int16', + name: 'anchorPointX' + }, + { + type: 'Int16', + name: 'anchorPointY' + }, + { + type: 'Float32', + name: 'tlX' + }, + { + type: 'Float32', + name: 'tlY' + }, + { + type: 'Float32', + name: 'trX' + }, + { + type: 'Float32', + name: 'trY' + }, + { + type: 'Float32', + name: 'blX' + }, + { + type: 'Float32', + name: 'blY' + }, + { + type: 'Float32', + name: 'brX' + }, + { + type: 'Float32', + name: 'brY' + }, + { + type: 'Int16', + name: 'texH' + }, + { + type: 'Int16', + name: 'texW' + }, + { + type: 'Int16', + name: 'texX' + }, + { + type: 'Int16', + name: 'texY' + }, + { + type: 'Float32', + name: 'anchorAngle' + }, + { + type: 'Float32', + name: 'glyphAngle' + }, + { + type: 'Float32', + name: 'maxScale' + }, + { + type: 'Float32', + name: 'minScale' + } + ] +}); +util.extendAll(SymbolQuadsArray.prototype.StructType.prototype, { + get anchorPoint() { + return new Point(this.anchorPointX, this.anchorPointY); + }, + get SymbolQuad() { + return new SymbolQuad(this.anchorPoint, new Point(this.tlX, this.tlY), new Point(this.trX, this.trY), new Point(this.blX, this.blY), new Point(this.brX, this.brY), { + x: this.texX, + y: this.texY, + h: this.texH, + w: this.texW, + height: this.texH, + width: this.texW + }, this.anchorAngle, this.glyphAngle, this.minScale, this.maxScale); + } +}); +},{"../util/struct_array":364,"../util/util":366,"./quads":325,"point-geometry":424}],331:[function(require,module,exports){ +'use strict'; +var DOM = require('../util/dom'); +var Point = require('point-geometry'); +var handlers = { + scrollZoom: require('./handler/scroll_zoom'), + boxZoom: require('./handler/box_zoom'), + dragRotate: require('./handler/drag_rotate'), + dragPan: require('./handler/drag_pan'), + keyboard: require('./handler/keyboard'), + doubleClickZoom: require('./handler/dblclick_zoom'), + touchZoomRotate: require('./handler/touch_zoom_rotate') +}; +module.exports = function bindHandlers(map, options) { + var el = map.getCanvasContainer(); + var contextMenuEvent = null; + var startPos = null; + var tapped = null; + for (var name in handlers) { + map[name] = new handlers[name](map, options); + if (options.interactive && options[name]) { + map[name].enable(); + } + } + el.addEventListener('mouseout', onMouseOut, false); + el.addEventListener('mousedown', onMouseDown, false); + el.addEventListener('mouseup', onMouseUp, false); + el.addEventListener('mousemove', onMouseMove, false); + el.addEventListener('touchstart', onTouchStart, false); + el.addEventListener('touchend', onTouchEnd, false); + el.addEventListener('touchmove', onTouchMove, false); + el.addEventListener('touchcancel', onTouchCancel, false); + el.addEventListener('click', onClick, false); + el.addEventListener('dblclick', onDblClick, false); + el.addEventListener('contextmenu', onContextMenu, false); + function onMouseOut(e) { + fireMouseEvent('mouseout', e); + } + function onMouseDown(e) { + map.stop(); + startPos = DOM.mousePos(el, e); + fireMouseEvent('mousedown', e); + } + function onMouseUp(e) { + var rotating = map.dragRotate && map.dragRotate.isActive(); + if (contextMenuEvent && !rotating) { + fireMouseEvent('contextmenu', contextMenuEvent); } + contextMenuEvent = null; + fireMouseEvent('mouseup', e); } - this.sprite = sprite; -}; - -SpriteAtlas.prototype.addIcons = function(icons, callback) { - for (var i = 0; i < icons.length; i++) { - this.getImage(icons[i]); + function onMouseMove(e) { + if (map.dragPan && map.dragPan.isActive()) + return; + if (map.dragRotate && map.dragRotate.isActive()) + return; + var target = e.toElement || e.target; + while (target && target !== el) + target = target.parentNode; + if (target !== el) + return; + fireMouseEvent('mousemove', e); } - - callback(null, this.images); -}; - -SpriteAtlas.prototype.bind = function(gl, linear) { - var first = false; - if (!this.texture) { - this.texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, this.texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - first = true; - } else { - gl.bindTexture(gl.TEXTURE_2D, this.texture); + function onTouchStart(e) { + map.stop(); + fireTouchEvent('touchstart', e); + if (!e.touches || e.touches.length > 1) + return; + if (!tapped) { + tapped = setTimeout(onTouchTimeout, 300); + } else { + clearTimeout(tapped); + tapped = null; + fireMouseEvent('dblclick', e); + } } - - var filterVal = linear ? gl.LINEAR : gl.NEAREST; - if (filterVal !== this.filter) { - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filterVal); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filterVal); - this.filter = filterVal; + function onTouchMove(e) { + fireTouchEvent('touchmove', e); } - - if (this.dirty) { - this.allocate(); - - if (first) { - gl.texImage2D( - gl.TEXTURE_2D, // enum target - 0, // ind level - gl.RGBA, // ind internalformat - this.width * this.pixelRatio, // GLsizei width - this.height * this.pixelRatio, // GLsizei height - 0, // ind border - gl.RGBA, // enum format - gl.UNSIGNED_BYTE, // enum type - new Uint8Array(this.data.buffer) // Object data - ); - } else { - gl.texSubImage2D( - gl.TEXTURE_2D, // enum target - 0, // int level - 0, // int xoffset - 0, // int yoffset - this.width * this.pixelRatio, // long width - this.height * this.pixelRatio, // long height - gl.RGBA, // enum format - gl.UNSIGNED_BYTE, // enum type - new Uint8Array(this.data.buffer) // Object pixels - ); + function onTouchEnd(e) { + fireTouchEvent('touchend', e); + } + function onTouchCancel(e) { + fireTouchEvent('touchcancel', e); + } + function onTouchTimeout() { + tapped = null; + } + function onClick(e) { + var pos = DOM.mousePos(el, e); + if (pos.equals(startPos)) { + fireMouseEvent('click', e); } - - this.dirty = false; + } + function onDblClick(e) { + fireMouseEvent('dblclick', e); + e.preventDefault(); + } + function onContextMenu(e) { + contextMenuEvent = e; + e.preventDefault(); + } + function fireMouseEvent(type, e) { + var pos = DOM.mousePos(el, e); + return map.fire(type, { + lngLat: map.unproject(pos), + point: pos, + originalEvent: e + }); + } + function fireTouchEvent(type, e) { + var touches = DOM.touchPos(el, e); + var singular = touches.reduce(function (prev, curr, i, arr) { + return prev.add(curr.div(arr.length)); + }, new Point(0, 0)); + return map.fire(type, { + lngLat: map.unproject(singular), + point: singular, + lngLats: touches.map(function (t) { + return map.unproject(t); + }, this), + points: touches, + originalEvent: e + }); } }; - -function AtlasImage(rect, width, height, sdf, pixelRatio) { - this.rect = rect; - this.width = width; - this.height = height; - this.sdf = sdf; - this.pixelRatio = pixelRatio; -} - -},{"../util/browser":335,"shelf-pack":406}],317:[function(require,module,exports){ +},{"../util/dom":352,"./handler/box_zoom":337,"./handler/dblclick_zoom":338,"./handler/drag_pan":339,"./handler/drag_rotate":340,"./handler/keyboard":341,"./handler/scroll_zoom":342,"./handler/touch_zoom_rotate":343,"point-geometry":424}],332:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var interpolate = require('../util/interpolate'); var browser = require('../util/browser'); var LngLat = require('../geo/lng_lat'); var LngLatBounds = require('../geo/lng_lat_bounds'); var Point = require('point-geometry'); - -/** - * Options common to Map#jumpTo, Map#easeTo, and Map#flyTo, controlling the destination - * location, zoom level, bearing and pitch. All properties are options; unspecified - * options will default to the current value for that property. - * - * @typedef {Object} CameraOptions - * @property {LngLat} center Map center - * @property {number} zoom Map zoom level - * @property {number} bearing Map rotation bearing in degrees counter-clockwise from north - * @property {number} pitch Map angle in degrees at which the camera is looking at the ground - * @property {LngLat} around If zooming, the zoom center (defaults to map center) - */ - -/** - * Options common to map movement methods that involve animation, such as Map#panBy and - * Map#easeTo, controlling the duration of the animation and easing function. All properties - * are optional. - * - * @typedef {Object} AnimationOptions - * @property {number} duration Number in milliseconds - * @property {Function} easing - * @property {Array} offset point, origin of movement relative to map center - * @property {boolean} animate When set to false, no animation happens - */ - -var Camera = module.exports = function() {}; - -util.extend(Camera.prototype, /** @lends Map.prototype */{ - /** - * Get the current view geographical point. - * @returns {LngLat} - */ - getCenter: function() { return this.transform.center; }, - - /** - * Sets a map location. Equivalent to `jumpTo({center: center})`. - * - * @param {LngLat} center Map center to jump to - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - * @example - * map.setCenter([-74, 38]); - */ - setCenter: function(center, eventData) { - this.jumpTo({center: center}, eventData); +var Camera = module.exports = function () { +}; +util.extend(Camera.prototype, { + getCenter: function () { + return this.transform.center; + }, + setCenter: function (center, eventData) { + this.jumpTo({ center: center }, eventData); return this; }, - - /** - * Pan by a certain number of pixels - * - * @param {Array} offset [x, y] - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - panBy: function(offset, options, eventData) { - this.panTo(this.transform.center, - util.extend({offset: Point.convert(offset).mult(-1)}, options), eventData); + panBy: function (offset, options, eventData) { + this.panTo(this.transform.center, util.extend({ offset: Point.convert(offset).mult(-1) }, options), eventData); return this; }, - - /** - * Pan to a certain location with easing - * - * @param {LngLat} lnglat Location to pan to - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - panTo: function(lnglat, options, eventData) { - return this.easeTo(util.extend({ - center: lnglat - }, options), eventData); + panTo: function (lnglat, options, eventData) { + return this.easeTo(util.extend({ center: lnglat }, options), eventData); }, - - - /** - * Get the current zoom - * @returns {number} - */ - getZoom: function() { return this.transform.zoom; }, - - /** - * Sets a map zoom. Equivalent to `jumpTo({zoom: zoom})`. - * - * @param {number} zoom Map zoom level - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - * @example - * // zoom the map to 5 - * map.setZoom(5); - */ - setZoom: function(zoom, eventData) { - this.jumpTo({zoom: zoom}, eventData); + getZoom: function () { + return this.transform.zoom; + }, + setZoom: function (zoom, eventData) { + this.jumpTo({ zoom: zoom }, eventData); return this; }, - - /** - * Zooms to a certain zoom level with easing. - * - * @param {number} zoom - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - */ - zoomTo: function(zoom, options, eventData) { - return this.easeTo(util.extend({ - zoom: zoom - }, options), eventData); + zoomTo: function (zoom, options, eventData) { + return this.easeTo(util.extend({ zoom: zoom }, options), eventData); }, - - /** - * Zoom in by 1 level - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - */ - zoomIn: function(options, eventData) { + zoomIn: function (options, eventData) { this.zoomTo(this.getZoom() + 1, options, eventData); return this; }, - - /** - * Zoom out by 1 level - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - */ - zoomOut: function(options, eventData) { + zoomOut: function (options, eventData) { this.zoomTo(this.getZoom() - 1, options, eventData); return this; }, - - - /** - * Get the current bearing in degrees - * @returns {number} - */ - getBearing: function() { return this.transform.bearing; }, - - /** - * Sets a map rotation. Equivalent to `jumpTo({bearing: bearing})`. - * - * @param {number} bearing Map rotation bearing in degrees counter-clockwise from north - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - * @example - * // rotate the map to 90 degrees - * map.setBearing(90); - */ - setBearing: function(bearing, eventData) { - this.jumpTo({bearing: bearing}, eventData); + getBearing: function () { + return this.transform.bearing; + }, + setBearing: function (bearing, eventData) { + this.jumpTo({ bearing: bearing }, eventData); return this; }, - - /** - * Rotate bearing by a certain number of degrees with easing - * - * @param {number} bearing - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - rotateTo: function(bearing, options, eventData) { - return this.easeTo(util.extend({ - bearing: bearing - }, options), eventData); + rotateTo: function (bearing, options, eventData) { + return this.easeTo(util.extend({ bearing: bearing }, options), eventData); }, - - /** - * Sets map bearing to 0 (north) with easing - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - resetNorth: function(options, eventData) { - this.rotateTo(0, util.extend({duration: 1000}, options), eventData); + resetNorth: function (options, eventData) { + this.rotateTo(0, util.extend({ duration: 1000 }, options), eventData); return this; }, - - /** - * Animates map bearing to 0 (north) if it's already close to it. - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - snapToNorth: function(options, eventData) { - if (Math.abs(this.getBearing()) < this.options.bearingSnap) { + snapToNorth: function (options, eventData) { + if (Math.abs(this.getBearing()) < this._bearingSnap) { return this.resetNorth(options, eventData); } return this; }, - - /** - * Get the current angle in degrees - * @returns {number} - */ - getPitch: function() { return this.transform.pitch; }, - - /** - * Sets a map angle. Equivalent to `jumpTo({pitch: pitch})`. - * - * @param {number} pitch The angle at which the camera is looking at the ground - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - setPitch: function(pitch, eventData) { - this.jumpTo({pitch: pitch}, eventData); + getPitch: function () { + return this.transform.pitch; + }, + setPitch: function (pitch, eventData) { + this.jumpTo({ pitch: pitch }, eventData); return this; }, - - - /** - * Zoom to contain certain geographical bounds - * - * @param {LngLatBounds|Array>} bounds [[minLng, minLat], [maxLng, maxLat]] - * @param {Object} options - * @param {boolean} [options.linear] When true, the map transitions to the new camera using - * {@link #Map.easeTo}. When false, the map transitions using {@link #Map.flyTo}. See - * {@link #Map.flyTo} for information on options specific to that animation transition. - * @param {Function} options.easing - * @param {number} options.padding how much padding there is around the given bounds on each side in pixels - * @param {number} options.maxZoom The resulting zoom level will be at most - * this value. - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - fitBounds: function(bounds, options, eventData) { - + fitBounds: function (bounds, options, eventData) { options = util.extend({ padding: 0, - offset: [0, 0], + offset: [ + 0, + 0 + ], maxZoom: Infinity }, options); - bounds = LngLatBounds.convert(bounds); - - var offset = Point.convert(options.offset), - tr = this.transform, - nw = tr.project(bounds.getNorthWest()), - se = tr.project(bounds.getSouthEast()), - size = se.sub(nw), - scaleX = (tr.width - options.padding * 2 - Math.abs(offset.x) * 2) / size.x, - scaleY = (tr.height - options.padding * 2 - Math.abs(offset.y) * 2) / size.y; - + var offset = Point.convert(options.offset), tr = this.transform, nw = tr.project(bounds.getNorthWest()), se = tr.project(bounds.getSouthEast()), size = se.sub(nw), scaleX = (tr.width - options.padding * 2 - Math.abs(offset.x) * 2) / size.x, scaleY = (tr.height - options.padding * 2 - Math.abs(offset.y) * 2) / size.y; options.center = tr.unproject(nw.add(se).div(2)); options.zoom = Math.min(tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom); options.bearing = 0; - - return options.linear ? - this.easeTo(options, eventData) : - this.flyTo(options, eventData); + return options.linear ? this.easeTo(options, eventData) : this.flyTo(options, eventData); }, - - /** - * Change any combination of center, zoom, bearing, and pitch, without - * a transition. The map will retain the current values for any options - * not included in `options`. - * - * @param {CameraOptions} options map view options - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires rotate - * @fires pitch - * @fires zoomend - * @fires moveend - * @returns {Map} `this` - */ - jumpTo: function(options, eventData) { + jumpTo: function (options, eventData) { this.stop(); - - var tr = this.transform, - zoomChanged = false, - bearingChanged = false, - pitchChanged = false; - + var tr = this.transform, zoomChanged = false, bearingChanged = false, pitchChanged = false; if ('zoom' in options && tr.zoom !== +options.zoom) { zoomChanged = true; tr.zoom = +options.zoom; } - if ('center' in options) { tr.center = LngLat.convert(options.center); } - if ('bearing' in options && tr.bearing !== +options.bearing) { bearingChanged = true; tr.bearing = +options.bearing; } - if ('pitch' in options && tr.pitch !== +options.pitch) { pitchChanged = true; tr.pitch = +options.pitch; } - - this.fire('movestart', eventData) - .fire('move', eventData); - + this.fire('movestart', eventData).fire('move', eventData); if (zoomChanged) { - this.fire('zoomstart', eventData) - .fire('zoom', eventData) - .fire('zoomend', eventData); + this.fire('zoomstart', eventData).fire('zoom', eventData).fire('zoomend', eventData); } - if (bearingChanged) { this.fire('rotate', eventData); } - if (pitchChanged) { this.fire('pitch', eventData); } - return this.fire('moveend', eventData); }, - - /** - * Change any combination of center, zoom, bearing, and pitch, with a smooth animation - * between old and new values. The map will retain the current values for any options - * not included in `options`. - * - * @param {CameraOptions|AnimationOptions} options map view and animation options - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires rotate - * @fires pitch - * @fires zoomend - * @fires moveend - * @returns {Map} `this` - */ - easeTo: function(options, eventData) { + easeTo: function (options, eventData) { this.stop(); - options = util.extend({ - offset: [0, 0], + offset: [ + 0, + 0 + ], duration: 500, easing: util.ease }, options); - - var tr = this.transform, - offset = Point.convert(options.offset), - startZoom = this.getZoom(), - startBearing = this.getBearing(), - startPitch = this.getPitch(), - - zoom = 'zoom' in options ? +options.zoom : startZoom, - bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing, - pitch = 'pitch' in options ? +options.pitch : startPitch, - - toLngLat, - toPoint; - + var tr = this.transform, offset = Point.convert(options.offset), startZoom = this.getZoom(), startBearing = this.getBearing(), startPitch = this.getPitch(), zoom = 'zoom' in options ? +options.zoom : startZoom, bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing, pitch = 'pitch' in options ? +options.pitch : startPitch, toLngLat, toPoint; if ('center' in options) { toLngLat = LngLat.convert(options.center); toPoint = tr.centerPoint.add(offset); @@ -54322,39 +55430,30 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ toPoint = tr.centerPoint.add(offset); toLngLat = tr.pointLocation(toPoint); } - var fromPoint = tr.locationPoint(toLngLat); - - if (options.animate === false) options.duration = 0; - - this.zooming = (zoom !== startZoom); - this.rotating = (startBearing !== bearing); - this.pitching = (pitch !== startPitch); - + if (options.animate === false) + options.duration = 0; + this.zooming = zoom !== startZoom; + this.rotating = startBearing !== bearing; + this.pitching = pitch !== startPitch; if (!options.noMoveStart) { this.fire('movestart', eventData); } if (this.zooming) { this.fire('zoomstart', eventData); } - clearTimeout(this._onEaseEnd); - this._ease(function (k) { if (this.zooming) { tr.zoom = interpolate(startZoom, zoom, k); } - if (this.rotating) { tr.bearing = interpolate(startBearing, bearing, k); } - if (this.pitching) { tr.pitch = interpolate(startPitch, pitch, k); } - tr.setLocationAtPoint(toLngLat, fromPoint.add(toPoint.sub(fromPoint)._mult(k))); - this.fire('move', eventData); if (this.zooming) { this.fire('zoom', eventData); @@ -54365,106 +55464,41 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ if (this.pitching) { this.fire('pitch', eventData); } - }, function() { + }, function () { if (options.delayEndEvents) { this._onEaseEnd = setTimeout(this._easeToEnd.bind(this, eventData), options.delayEndEvents); } else { this._easeToEnd(eventData); } }.bind(this), options); - return this; }, - - _easeToEnd: function(eventData) { - if (this.zooming) { - this.fire('zoomend', eventData); - } - this.fire('moveend', eventData); - + _easeToEnd: function (eventData) { + var wasZooming = this.zooming; this.zooming = false; this.rotating = false; this.pitching = false; + if (wasZooming) { + this.fire('zoomend', eventData); + } + this.fire('moveend', eventData); }, - - /** - * Change any combination of center, zoom, bearing, and pitch, animated along a curve that - * evokes flight. The transition animation seamlessly incorporates zooming and panning to help - * the user find his or her bearings even after traversing a great distance. - * - * @param {CameraOptions|AnimationOptions} options map view and animation options - * @param {number} [options.curve=1.42] Relative amount of zooming that takes place along the - * flight path. A high value maximizes zooming for an exaggerated animation, while a low - * value minimizes zooming for something closer to {@link #Map.easeTo}. 1.42 is the average - * value selected by participants in the user study in - * [van Wijk (2003)](https://www.win.tue.nl/~vanwijk/zoompan.pdf). A value of - * `Math.pow(6, 0.25)` would be equivalent to the root mean squared average velocity. A - * value of 1 would produce a circular motion. - * @param {number} [options.minZoom] Zero-based zoom level at the peak of the flight path. If - * `options.curve` is specified, this option is ignored. - * @param {number} [options.speed=1.2] Average speed of the animation. A speed of 1.2 means that - * the map appears to move along the flight path by 1.2 times `options.curve` screenfuls every - * second. A _screenful_ is the visible span in pixels. It does not correspond to a fixed - * physical distance but rather varies by zoom level. - * @param {number} [options.screenSpeed] Average speed of the animation, measured in screenfuls - * per second, assuming a linear timing curve. If `options.speed` is specified, this option - * is ignored. - * @param {Function} [options.easing] Transition timing curve - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires rotate - * @fires pitch - * @fires zoomend - * @fires moveend - * @returns {this} - * @example - * // fly with default options to null island - * map.flyTo({center: [0, 0], zoom: 9}); - * // using flyTo options - * map.flyTo({ - * center: [0, 0], - * zoom: 9, - * speed: 0.2, - * curve: 1, - * easing: function(t) { - * return t; - * } - * }); - */ - flyTo: function(options, eventData) { - // This method implements an “optimal path” animation, as detailed in: - // - // Van Wijk, Jarke J.; Nuij, Wim A. A. “Smooth and efficient zooming and panning.” INFOVIS - // ’03. pp. 15–22. . - // - // Where applicable, local variable documentation begins with the associated variable or - // function in van Wijk (2003). - + flyTo: function (options, eventData) { this.stop(); - options = util.extend({ - offset: [0, 0], + offset: [ + 0, + 0 + ], speed: 1.2, curve: 1.42, easing: util.ease }, options); - - var tr = this.transform, - offset = Point.convert(options.offset), - startZoom = this.getZoom(), - startBearing = this.getBearing(), - startPitch = this.getPitch(); - + var tr = this.transform, offset = Point.convert(options.offset), startZoom = this.getZoom(), startBearing = this.getBearing(), startPitch = this.getPitch(); var center = 'center' in options ? LngLat.convert(options.center) : this.getCenter(); - var zoom = 'zoom' in options ? +options.zoom : startZoom; + var zoom = 'zoom' in options ? +options.zoom : startZoom; var bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing; var pitch = 'pitch' in options ? +options.pitch : startPitch; - - // If a path crossing the antimeridian would be shorter, extend the final coordinate so that - // interpolating between the two endpoints will cross it. if (Math.abs(tr.center.lng) + Math.abs(center.lng) > 180) { if (tr.center.lng > 0 && center.lng < 0) { center.lng += 360; @@ -54472,108 +55506,67 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ center.lng -= 360; } } - - var scale = tr.zoomScale(zoom - startZoom), - from = tr.point, - to = 'center' in options ? tr.project(center).sub(offset.div(scale)) : from; - - var startWorldSize = tr.worldSize, - rho = options.curve, - - // w₀: Initial visible span, measured in pixels at the initial scale. - w0 = Math.max(tr.width, tr.height), - // w₁: Final visible span, measured in pixels with respect to the initial scale. - w1 = w0 / scale, - // Length of the flight path as projected onto the ground plane, measured in pixels from - // the world image origin at the initial scale. - u1 = to.sub(from).mag(); - + var scale = tr.zoomScale(zoom - startZoom), from = tr.point, to = 'center' in options ? tr.project(center).sub(offset.div(scale)) : from; + var startWorldSize = tr.worldSize, rho = options.curve, w0 = Math.max(tr.width, tr.height), w1 = w0 / scale, u1 = to.sub(from).mag(); if ('minZoom' in options) { var minZoom = util.clamp(Math.min(options.minZoom, startZoom, zoom), tr.minZoom, tr.maxZoom); - // wm: Maximum visible span, measured in pixels with respect to the initial - // scale. var wMax = w0 / tr.zoomScale(minZoom - startZoom); rho = Math.sqrt(wMax / u1 * 2); } - - // ρ² var rho2 = rho * rho; - - /** - * rᵢ: Returns the zoom-out factor at one end of the animation. - * - * @param i 0 for the ascent or 1 for the descent. - * @private - */ function r(i) { var b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1); return Math.log(Math.sqrt(b * b + 1) - b); } - - function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; } - function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; } - function tanh(n) { return sinh(n) / cosh(n); } - - // r₀: Zoom-out factor during ascent. - var r0 = r(0), - /** - * w(s): Returns the visible span on the ground, measured in pixels with respect to the - * initial scale. - * - * Assumes an angular field of view of 2 arctan ½ ≈ 53°. - * @private - */ - w = function (s) { return (cosh(r0) / cosh(r0 + rho * s)); }, - /** - * u(s): Returns the distance along the flight path as projected onto the ground plane, - * measured in pixels from the world image origin at the initial scale. - * @private - */ - u = function (s) { return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1; }, - // S: Total length of the flight path, measured in ρ-screenfuls. - S = (r(1) - r0) / rho; - - // When u₀ = u₁, the optimal path doesn’t require both ascent and descent. + function sinh(n) { + return (Math.exp(n) - Math.exp(-n)) / 2; + } + function cosh(n) { + return (Math.exp(n) + Math.exp(-n)) / 2; + } + function tanh(n) { + return sinh(n) / cosh(n); + } + var r0 = r(0), w = function (s) { + return cosh(r0) / cosh(r0 + rho * s); + }, u = function (s) { + return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1; + }, S = (r(1) - r0) / rho; if (Math.abs(u1) < 0.000001) { - // Perform a more or less instantaneous transition if the path is too short. - if (Math.abs(w0 - w1) < 0.000001) return this.easeTo(options); - + if (Math.abs(w0 - w1) < 0.000001) + return this.easeTo(options); var k = w1 < w0 ? -1 : 1; S = Math.abs(Math.log(w1 / w0)) / rho; - - u = function() { return 0; }; - w = function(s) { return Math.exp(k * rho * s); }; + u = function () { + return 0; + }; + w = function (s) { + return Math.exp(k * rho * s); + }; } - if ('duration' in options) { options.duration = +options.duration; } else { var V = 'screenSpeed' in options ? +options.screenSpeed / rho : +options.speed; options.duration = 1000 * S / V; } - this.zooming = true; - if (startBearing !== bearing) this.rotating = true; - if (startPitch !== pitch) this.pitching = true; - + if (startBearing !== bearing) + this.rotating = true; + if (startPitch !== pitch) + this.pitching = true; this.fire('movestart', eventData); this.fire('zoomstart', eventData); - this._ease(function (k) { - // s: The distance traveled along the flight path, measured in ρ-screenfuls. - var s = k * S, - us = u(s); - + var s = k * S, us = u(s); tr.zoom = startZoom + tr.scaleZoom(1 / w(s)); tr.center = tr.unproject(from.add(to.sub(from).mult(us)), startWorldSize); - if (this.rotating) { tr.bearing = interpolate(startBearing, bearing, k); } if (this.pitching) { tr.pitch = interpolate(startPitch, pitch, k); } - this.fire('move', eventData); this.fire('zoom', eventData); if (this.rotating) { @@ -54582,35 +55575,26 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ if (this.pitching) { this.fire('pitch', eventData); } - }, function() { - this.fire('zoomend', eventData); - this.fire('moveend', eventData); + }, function () { this.zooming = false; this.rotating = false; this.pitching = false; + this.fire('zoomend', eventData); + this.fire('moveend', eventData); }, options); - return this; }, - - isEasing: function() { + isEasing: function () { return !!this._abortFn; }, - - /** - * Stop current animation - * - * @returns {Map} `this` - */ - stop: function() { + stop: function () { if (this._abortFn) { this._abortFn(); this._finishEase(); } return this; }, - - _ease: function(frame, finish, options) { + _ease: function (frame, finish, options) { this._finishFn = finish; this._abortFn = browser.timed(function (t) { frame.call(this, options.easing(t)); @@ -54619,166 +55603,102 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ } }, options.animate === false ? 0 : options.duration, this); }, - - _finishEase: function() { + _finishEase: function () { delete this._abortFn; - // The finish function might emit events which trigger new eases, which - // set a new _finishFn. Ensure we don't delete it unintentionally. var finish = this._finishFn; delete this._finishFn; finish.call(this); }, - - // convert bearing so that it's numerically close to the current one so that it interpolates properly - _normalizeBearing: function(bearing, currentBearing) { + _normalizeBearing: function (bearing, currentBearing) { bearing = util.wrap(bearing, -180, 180); var diff = Math.abs(bearing - currentBearing); - if (Math.abs(bearing - 360 - currentBearing) < diff) bearing -= 360; - if (Math.abs(bearing + 360 - currentBearing) < diff) bearing += 360; + if (Math.abs(bearing - 360 - currentBearing) < diff) + bearing -= 360; + if (Math.abs(bearing + 360 - currentBearing) < diff) + bearing += 360; return bearing; }, - - _updateEasing: function(duration, zoom, bezier) { + _updateEasing: function (duration, zoom, bezier) { var easing; - if (this.ease) { - var ease = this.ease, - t = (Date.now() - ease.start) / ease.duration, - speed = ease.easing(t + 0.01) - ease.easing(t), - - // Quick hack to make new bezier that is continuous with last - x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01, - y = Math.sqrt(0.27 * 0.27 - x * x); - + var ease = this.ease, t = (Date.now() - ease.start) / ease.duration, speed = ease.easing(t + 0.01) - ease.easing(t), x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01, y = Math.sqrt(0.27 * 0.27 - x * x); easing = util.bezier(x, y, 0.25, 1); } else { easing = bezier ? util.bezier.apply(util, bezier) : util.ease; } - - // store information on current easing this.ease = { - start: (new Date()).getTime(), + start: new Date().getTime(), to: Math.pow(2, zoom), duration: duration, easing: easing }; - return easing; } }); - -/** - * Pitch event. This event is emitted whenever the map's pitch changes. - * - * @event pitch - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../geo/lng_lat":256,"../geo/lng_lat_bounds":257,"../util/browser":335,"../util/interpolate":343,"../util/util":349,"point-geometry":404}],318:[function(require,module,exports){ +},{"../geo/lng_lat":263,"../geo/lng_lat_bounds":264,"../util/browser":350,"../util/interpolate":360,"../util/util":366,"point-geometry":424}],333:[function(require,module,exports){ 'use strict'; - var Control = require('./control'); var DOM = require('../../util/dom'); var util = require('../../util/util'); - module.exports = Attribution; - -/** - * Creates an attribution control - * @class Attribution - * @param {Object} [options] - * @param {string} [options.position='bottom-right'] A string indicating the control's position on the map. Options are `top-right`, `top-left`, `bottom-right`, `bottom-left` - * @example - * var map = new mapboxgl.Map({attributionControl: false}) - * .addControl(new mapboxgl.Attribution({position: 'top-left'})); - */ function Attribution(options) { util.setOptions(this, options); } - -Attribution.createAttributionString = function(sources) { +Attribution.createAttributionString = function (sources) { var attributions = []; - for (var id in sources) { var source = sources[id]; if (source.attribution && attributions.indexOf(source.attribution) < 0) { attributions.push(source.attribution); } } - - // remove any entries that are substrings of another entry. - // first sort by length so that substrings come first - attributions.sort(function (a, b) { return a.length - b.length; }); + attributions.sort(function (a, b) { + return a.length - b.length; + }); attributions = attributions.filter(function (attrib, i) { for (var j = i + 1; j < attributions.length; j++) { - if (attributions[j].indexOf(attrib) >= 0) { return false; } + if (attributions[j].indexOf(attrib) >= 0) { + return false; + } } return true; }); - return attributions.join(' | '); }; - Attribution.prototype = util.inherit(Control, { - options: { - position: 'bottom-right' - }, - - onAdd: function(map) { - var className = 'mapboxgl-ctrl-attrib', - container = this._container = DOM.create('div', className, map.getContainer()); - + options: { position: 'bottom-right' }, + onAdd: function (map) { + var className = 'mapboxgl-ctrl-attrib', container = this._container = DOM.create('div', className, map.getContainer()); this._update(); map.on('source.load', this._update.bind(this)); map.on('source.change', this._update.bind(this)); map.on('source.remove', this._update.bind(this)); map.on('moveend', this._updateEditLink.bind(this)); - return container; }, - - _update: function() { + _update: function () { if (this._map.style) { this._container.innerHTML = Attribution.createAttributionString(this._map.style.sources); } - this._editLink = this._container.getElementsByClassName('mapbox-improve-map')[0]; this._updateEditLink(); }, - - _updateEditLink: function() { + _updateEditLink: function () { if (this._editLink) { var center = this._map.getCenter(); - this._editLink.href = 'https://www.mapbox.com/map-feedback/#/' + - center.lng + '/' + center.lat + '/' + Math.round(this._map.getZoom() + 1); + this._editLink.href = 'https://www.mapbox.com/map-feedback/#/' + center.lng + '/' + center.lat + '/' + Math.round(this._map.getZoom() + 1); } } }); - -},{"../../util/dom":338,"../../util/util":349,"./control":319}],319:[function(require,module,exports){ +},{"../../util/dom":352,"../../util/util":366,"./control":334}],334:[function(require,module,exports){ 'use strict'; - +var util = require('../../util/util'); +var Evented = require('../../util/evented'); module.exports = Control; - -/** - * A base class for map-related interface elements. - * - * @class Control - */ -function Control() {} - +function Control() { +} Control.prototype = { - /** - * Add this control to the map, returning the control itself - * for chaining. This will insert the control's DOM element into - * the map's DOM element if the control has a `position` specified. - * - * @param {Map} map - * @returns {Control} `this` - */ - addTo: function(map) { + addTo: function (map) { this._map = map; var container = this._container = this.onAdd(map); if (this.options && this.options.position) { @@ -54791,200 +55711,146 @@ Control.prototype = { corner.appendChild(container); } } - return this; }, - - /** - * Remove this control from the map it has been added to. - * - * @returns {Control} `this` - */ - remove: function() { + remove: function () { this._container.parentNode.removeChild(this._container); - if (this.onRemove) this.onRemove(this._map); + if (this.onRemove) + this.onRemove(this._map); this._map = null; return this; } }; - -},{}],320:[function(require,module,exports){ +util.extend(Control.prototype, Evented); +},{"../../util/evented":358,"../../util/util":366}],335:[function(require,module,exports){ 'use strict'; - var Control = require('./control'); var browser = require('../../util/browser'); var DOM = require('../../util/dom'); var util = require('../../util/util'); - module.exports = Geolocate; - -var geoOptions = { enableHighAccuracy: false, timeout: 6000 /* 6sec */ }; - - -/** - * Creates a geolocation control - * @class Geolocate - * @param {Object} [options] - * @param {string} [options.position='top-right'] A string indicating the control's position on the map. Options are `top-right`, `top-left`, `bottom-right`, `bottom-left` - * @example - * map.addControl(new mapboxgl.Geolocate({position: 'top-left'})); // position is optional - */ +var geoOptions = { + enableHighAccuracy: false, + timeout: 6000 +}; function Geolocate(options) { util.setOptions(this, options); } - Geolocate.prototype = util.inherit(Control, { - options: { - position: 'top-right' - }, - - onAdd: function(map) { + options: { position: 'top-right' }, + onAdd: function (map) { var className = 'mapboxgl-ctrl'; - var container = this._container = DOM.create('div', className + '-group', map.getContainer()); - if (!browser.supportsGeolocation) return container; - + if (!browser.supportsGeolocation) + return container; this._container.addEventListener('contextmenu', this._onContextMenu.bind(this)); - - this._geolocateButton = DOM.create('button', (className + '-icon ' + className + '-geolocate'), this._container); + this._geolocateButton = DOM.create('button', className + '-icon ' + className + '-geolocate', this._container); + this._geolocateButton.type = 'button'; this._geolocateButton.addEventListener('click', this._onClickGeolocate.bind(this)); return container; }, - - _onContextMenu: function(e) { + _onContextMenu: function (e) { e.preventDefault(); }, - - _onClickGeolocate: function() { + _onClickGeolocate: function () { navigator.geolocation.getCurrentPosition(this._success.bind(this), this._error.bind(this), geoOptions); - - // This timeout ensures that we still call finish() even if - // the user declines to share their location in Firefox - this._timeoutId = setTimeout(this._finish.bind(this), 10000 /* 10sec */); + this._timeoutId = setTimeout(this._finish.bind(this), 10000); }, - - _success: function(position) { + _success: function (position) { this._map.jumpTo({ - center: [position.coords.longitude, position.coords.latitude], + center: [ + position.coords.longitude, + position.coords.latitude + ], zoom: 17, bearing: 0, pitch: 0 }); + this.fire('geolocate', position); this._finish(); }, - - _error: function() { + _error: function (error) { + this.fire('error', error); this._finish(); }, - - _finish: function() { - if (this._timeoutId) { clearTimeout(this._timeoutId); } + _finish: function () { + if (this._timeoutId) { + clearTimeout(this._timeoutId); + } this._timeoutId = undefined; } - }); - - -},{"../../util/browser":335,"../../util/dom":338,"../../util/util":349,"./control":319}],321:[function(require,module,exports){ +},{"../../util/browser":350,"../../util/dom":352,"../../util/util":366,"./control":334}],336:[function(require,module,exports){ 'use strict'; - var Control = require('./control'); var DOM = require('../../util/dom'); var util = require('../../util/util'); - module.exports = Navigation; - -/** - * Creates a navigation control with zoom buttons and a compass - * @class Navigation - * @param {Object} [options] - * @param {string} [options.position='top-right'] A string indicating the control's position on the map. Options are `top-right`, `top-left`, `bottom-right`, `bottom-left` - * @example - * map.addControl(new mapboxgl.Navigation({position: 'top-left'})); // position is optional - */ function Navigation(options) { util.setOptions(this, options); } - Navigation.prototype = util.inherit(Control, { - options: { - position: 'top-right' - }, - - onAdd: function(map) { + options: { position: 'top-right' }, + onAdd: function (map) { var className = 'mapboxgl-ctrl'; - var container = this._container = DOM.create('div', className + '-group', map.getContainer()); this._container.addEventListener('contextmenu', this._onContextMenu.bind(this)); - this._zoomInButton = this._createButton(className + '-icon ' + className + '-zoom-in', map.zoomIn.bind(map)); this._zoomOutButton = this._createButton(className + '-icon ' + className + '-zoom-out', map.zoomOut.bind(map)); this._compass = this._createButton(className + '-icon ' + className + '-compass', map.resetNorth.bind(map)); - this._compassArrow = DOM.create('div', 'arrow', this._compass); - this._compass.addEventListener('mousedown', this._onCompassDown.bind(this)); this._onCompassMove = this._onCompassMove.bind(this); this._onCompassUp = this._onCompassUp.bind(this); - map.on('rotate', this._rotateCompassArrow.bind(this)); this._rotateCompassArrow(); - this._el = map.getCanvasContainer(); - return container; }, - - _onContextMenu: function(e) { + _onContextMenu: function (e) { e.preventDefault(); }, - - _onCompassDown: function(e) { - if (e.button !== 0) return; - + _onCompassDown: function (e) { + if (e.button !== 0) + return; DOM.disableDrag(); document.addEventListener('mousemove', this._onCompassMove); document.addEventListener('mouseup', this._onCompassUp); - this._el.dispatchEvent(copyMouseEvent(e)); e.stopPropagation(); }, - - _onCompassMove: function(e) { - if (e.button !== 0) return; - + _onCompassMove: function (e) { + if (e.button !== 0) + return; this._el.dispatchEvent(copyMouseEvent(e)); e.stopPropagation(); }, - - _onCompassUp: function(e) { - if (e.button !== 0) return; - + _onCompassUp: function (e) { + if (e.button !== 0) + return; document.removeEventListener('mousemove', this._onCompassMove); document.removeEventListener('mouseup', this._onCompassUp); DOM.enableDrag(); - this._el.dispatchEvent(copyMouseEvent(e)); e.stopPropagation(); }, - - _createButton: function(className, fn) { + _createButton: function (className, fn) { var a = DOM.create('button', className, this._container); - a.addEventListener('click', function() { fn(); }); + a.type = 'button'; + a.addEventListener('click', function () { + fn(); + }); return a; }, - - _rotateCompassArrow: function() { - var rotate = 'rotate(' + (this._map.transform.angle * (180 / Math.PI)) + 'deg)'; + _rotateCompassArrow: function () { + var rotate = 'rotate(' + this._map.transform.angle * (180 / Math.PI) + 'deg)'; this._compassArrow.style.transform = rotate; } }); - - function copyMouseEvent(e) { return new MouseEvent(e.type, { - button: 2, // right click - buttons: 2, // right click + button: 2, + buttons: 2, bubbles: true, cancelable: true, detail: e.detail, @@ -55001,314 +55867,161 @@ function copyMouseEvent(e) { metaKey: e.metaKey }); } - - -},{"../../util/dom":338,"../../util/util":349,"./control":319}],322:[function(require,module,exports){ +},{"../../util/dom":352,"../../util/util":366,"./control":334}],337:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - LngLatBounds = require('../../geo/lng_lat_bounds'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), LngLatBounds = require('../../geo/lng_lat_bounds'), util = require('../../util/util'); module.exports = BoxZoomHandler; - -/** - * The `BoxZoomHandler` allows a user to zoom the map to fit a bounding box. - * The bounding box is defined by holding `shift` while dragging the cursor. - * @class BoxZoomHandler - */ function BoxZoomHandler(map) { this._map = map; this._el = map.getCanvasContainer(); this._container = map.getContainer(); - util.bindHandlers(this); } - BoxZoomHandler.prototype = { - _enabled: false, _active: false, - - /** - * Returns the current enabled/disabled state of the "box zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Returns true if the "box zoom" interaction is currently active, i.e. currently being used. - * @returns {boolean} active state - */ isActive: function () { return this._active; }, - - /** - * Enable the "box zoom" interaction. - * @example - * map.boxZoom.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('mousedown', this._onMouseDown, false); this._enabled = true; }, - - /** - * Disable the "box zoom" interaction. - * @example - * map.boxZoom.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('mousedown', this._onMouseDown); this._enabled = false; }, - _onMouseDown: function (e) { - if (!(e.shiftKey && e.button === 0)) return; - + if (!(e.shiftKey && e.button === 0)) + return; document.addEventListener('mousemove', this._onMouseMove, false); document.addEventListener('keydown', this._onKeyDown, false); document.addEventListener('mouseup', this._onMouseUp, false); - DOM.disableDrag(); this._startPos = DOM.mousePos(this._el, e); this._active = true; }, - _onMouseMove: function (e) { - var p0 = this._startPos, - p1 = DOM.mousePos(this._el, e); - + var p0 = this._startPos, p1 = DOM.mousePos(this._el, e); if (!this._box) { this._box = DOM.create('div', 'mapboxgl-boxzoom', this._container); this._container.classList.add('mapboxgl-crosshair'); this._fireEvent('boxzoomstart', e); } - - var minX = Math.min(p0.x, p1.x), - maxX = Math.max(p0.x, p1.x), - minY = Math.min(p0.y, p1.y), - maxY = Math.max(p0.y, p1.y); - + var minX = Math.min(p0.x, p1.x), maxX = Math.max(p0.x, p1.x), minY = Math.min(p0.y, p1.y), maxY = Math.max(p0.y, p1.y); DOM.setTransform(this._box, 'translate(' + minX + 'px,' + minY + 'px)'); - - this._box.style.width = (maxX - minX) + 'px'; - this._box.style.height = (maxY - minY) + 'px'; + this._box.style.width = maxX - minX + 'px'; + this._box.style.height = maxY - minY + 'px'; }, - _onMouseUp: function (e) { - if (e.button !== 0) return; - - var p0 = this._startPos, - p1 = DOM.mousePos(this._el, e), - bounds = new LngLatBounds(this._map.unproject(p0), this._map.unproject(p1)); - + if (e.button !== 0) + return; + var p0 = this._startPos, p1 = DOM.mousePos(this._el, e), bounds = new LngLatBounds(this._map.unproject(p0), this._map.unproject(p1)); this._finish(); - if (p0.x === p1.x && p0.y === p1.y) { this._fireEvent('boxzoomcancel', e); } else { - this._map - .fitBounds(bounds, {linear: true}) - .fire('boxzoomend', { originalEvent: e, boxZoomBounds: bounds }); + this._map.fitBounds(bounds, { linear: true }).fire('boxzoomend', { + originalEvent: e, + boxZoomBounds: bounds + }); } }, - _onKeyDown: function (e) { if (e.keyCode === 27) { this._finish(); this._fireEvent('boxzoomcancel', e); } }, - _finish: function () { this._active = false; - document.removeEventListener('mousemove', this._onMouseMove, false); document.removeEventListener('keydown', this._onKeyDown, false); document.removeEventListener('mouseup', this._onMouseUp, false); - this._container.classList.remove('mapboxgl-crosshair'); - if (this._box) { this._box.parentNode.removeChild(this._box); this._box = null; } - DOM.enableDrag(); }, - _fireEvent: function (type, e) { return this._map.fire(type, { originalEvent: e }); } }; - - -/** - * Boxzoom start event. This event is emitted at the start of a box zoom interaction. - * - * @event boxzoomstart - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Boxzoom end event. This event is emitted at the end of a box zoom interaction - * - * @event boxzoomend - * @memberof Map - * @instance - * @type {Object} - * @property {Event} originalEvent the original DOM event - * @property {LngLatBounds} boxZoomBounds the bounds of the box zoom target - */ - -/** - * Boxzoom cancel event. This event is emitted when the user cancels a box zoom interaction, - * or when the box zoom does not meet the minimum size threshold. - * - * @event boxzoomcancel - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../../geo/lng_lat_bounds":257,"../../util/dom":338,"../../util/util":349}],323:[function(require,module,exports){ +},{"../../geo/lng_lat_bounds":264,"../../util/dom":352,"../../util/util":366}],338:[function(require,module,exports){ 'use strict'; - module.exports = DoubleClickZoomHandler; - -/** - * The `DoubleClickZoomHandler` allows a user to zoom the map around point by - * double clicking. - * @class DoubleClickZoomHandler - */ function DoubleClickZoomHandler(map) { this._map = map; this._onDblClick = this._onDblClick.bind(this); } - DoubleClickZoomHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of the "double click to zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the "double click to zoom" interaction. - * @example - * map.doubleClickZoom.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._map.on('dblclick', this._onDblClick); this._enabled = true; }, - - /** - * Disable the "double click to zoom" interaction. - * @example - * map.doubleClickZoom.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._map.off('dblclick', this._onDblClick); this._enabled = false; }, - _onDblClick: function (e) { - this._map.zoomTo(this._map.getZoom() + - (e.originalEvent.shiftKey ? -1 : 1), {around: e.lngLat}); + this._map.zoomTo(this._map.getZoom() + (e.originalEvent.shiftKey ? -1 : 1), { around: e.lngLat }, e); } }; - -},{}],324:[function(require,module,exports){ +},{}],339:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), util = require('../../util/util'); module.exports = DragPanHandler; - -var inertiaLinearity = 0.3, - inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), - inertiaMaxSpeed = 1400, // px/s - inertiaDeceleration = 2500; // px/s^2 - - -/** - * The `DragPanHandler` allows a user to pan the map by clicking and dragging - * the cursor. - * @class DragPanHandler - */ +var inertiaLinearity = 0.3, inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), inertiaMaxSpeed = 1400, inertiaDeceleration = 2500; function DragPanHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - util.bindHandlers(this); } - DragPanHandler.prototype = { - _enabled: false, _active: false, - - /** - * Returns the current enabled/disabled state of the "drag to pan" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Returns true if the "drag to pan" interaction is currently active, i.e. currently being used. - * @returns {boolean} active state - */ isActive: function () { return this._active; }, - - /** - * Enable the "drag to pan" interaction. - * @example - * map.dragPan.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('mousedown', this._onDown); this._el.addEventListener('touchstart', this._onDown); this._enabled = true; }, - - /** - * Disable the "drag to pan" interaction. - * @example - * map.dragPan.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('mousedown', this._onDown); this._el.removeEventListener('touchstart', this._onDown); this._enabled = false; }, - _onDown: function (e) { - if (this._ignoreEvent(e)) return; - if (this.isActive()) return; - + if (this._ignoreEvent(e)) + return; + if (this.isActive()) + return; if (e.touches) { document.addEventListener('touchmove', this._onMove); document.addEventListener('touchend', this._onTouchEnd); @@ -55316,469 +56029,272 @@ DragPanHandler.prototype = { document.addEventListener('mousemove', this._onMove); document.addEventListener('mouseup', this._onMouseUp); } - this._active = false; this._startPos = this._pos = DOM.mousePos(this._el, e); - this._inertia = [[Date.now(), this._pos]]; + this._inertia = [[ + Date.now(), + this._pos + ]]; }, - _onMove: function (e) { - if (this._ignoreEvent(e)) return; - + if (this._ignoreEvent(e)) + return; if (!this.isActive()) { this._active = true; this._fireEvent('dragstart', e); this._fireEvent('movestart', e); } - - var pos = DOM.mousePos(this._el, e), - map = this._map; - + var pos = DOM.mousePos(this._el, e), map = this._map; map.stop(); this._drainInertiaBuffer(); - this._inertia.push([Date.now(), pos]); - + this._inertia.push([ + Date.now(), + pos + ]); map.transform.setLocationAtPoint(map.transform.pointLocation(this._pos), pos); - this._fireEvent('drag', e); this._fireEvent('move', e); - this._pos = pos; - e.preventDefault(); }, - _onUp: function (e) { - if (!this.isActive()) return; - + if (!this.isActive()) + return; this._active = false; this._fireEvent('dragend', e); this._drainInertiaBuffer(); - - var finish = function() { + var finish = function () { this._fireEvent('moveend', e); }.bind(this); - var inertia = this._inertia; if (inertia.length < 2) { finish(); return; } - - var last = inertia[inertia.length - 1], - first = inertia[0], - flingOffset = last[1].sub(first[1]), - flingDuration = (last[0] - first[0]) / 1000; - + var last = inertia[inertia.length - 1], first = inertia[0], flingOffset = last[1].sub(first[1]), flingDuration = (last[0] - first[0]) / 1000; if (flingDuration === 0 || last[1].equals(first[1])) { finish(); return; } - - // calculate px/s velocity & adjust for increased initial animation speed when easing out - var velocity = flingOffset.mult(inertiaLinearity / flingDuration), - speed = velocity.mag(); // px/s - + var velocity = flingOffset.mult(inertiaLinearity / flingDuration), speed = velocity.mag(); if (speed > inertiaMaxSpeed) { speed = inertiaMaxSpeed; velocity._unit()._mult(speed); } - - var duration = speed / (inertiaDeceleration * inertiaLinearity), - offset = velocity.mult(-duration / 2); - + var duration = speed / (inertiaDeceleration * inertiaLinearity), offset = velocity.mult(-duration / 2); this._map.panBy(offset, { duration: duration * 1000, easing: inertiaEasing, noMoveStart: true }, { originalEvent: e }); }, - _onMouseUp: function (e) { - if (this._ignoreEvent(e)) return; + if (this._ignoreEvent(e)) + return; this._onUp(e); document.removeEventListener('mousemove', this._onMove); document.removeEventListener('mouseup', this._onMouseUp); }, - _onTouchEnd: function (e) { - if (this._ignoreEvent(e)) return; + if (this._ignoreEvent(e)) + return; this._onUp(e); document.removeEventListener('touchmove', this._onMove); document.removeEventListener('touchend', this._onTouchEnd); }, - _fireEvent: function (type, e) { return this._map.fire(type, { originalEvent: e }); }, - _ignoreEvent: function (e) { var map = this._map; - - if (map.boxZoom && map.boxZoom.isActive()) return true; - if (map.dragRotate && map.dragRotate.isActive()) return true; + if (map.boxZoom && map.boxZoom.isActive()) + return true; + if (map.dragRotate && map.dragRotate.isActive()) + return true; if (e.touches) { - return (e.touches.length > 1); + return e.touches.length > 1; } else { - if (e.ctrlKey) return true; - var buttons = 1, // left button - button = 0; // left button - return (e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button); + if (e.ctrlKey) + return true; + var buttons = 1, button = 0; + return e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button; } }, - _drainInertiaBuffer: function () { - var inertia = this._inertia, - now = Date.now(), - cutoff = 160; // msec - - while (inertia.length > 0 && now - inertia[0][0] > cutoff) inertia.shift(); + var inertia = this._inertia, now = Date.now(), cutoff = 160; + while (inertia.length > 0 && now - inertia[0][0] > cutoff) + inertia.shift(); } }; - - -/** - * Drag start event. This event is emitted at the start of a user-initiated pan interaction. - * - * @event dragstart - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Drag event. This event is emitted repeatedly during a user-initiated pan interaction. - * - * @event drag - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Drag end event. This event is emitted at the end of a user-initiated pan interaction. - * - * @event dragend - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../../util/dom":338,"../../util/util":349}],325:[function(require,module,exports){ +},{"../../util/dom":352,"../../util/util":366}],340:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - Point = require('point-geometry'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), Point = require('point-geometry'), util = require('../../util/util'); module.exports = DragRotateHandler; - -var inertiaLinearity = 0.25, - inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), - inertiaMaxSpeed = 180, // deg/s - inertiaDeceleration = 720; // deg/s^2 - - -/** - * The `DragRotateHandler` allows a user to rotate the map by clicking and - * dragging the cursor while holding the right mouse button or the `ctrl` key. - * @class DragRotateHandler - */ -function DragRotateHandler(map) { +var inertiaLinearity = 0.25, inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), inertiaMaxSpeed = 180, inertiaDeceleration = 720; +function DragRotateHandler(map, options) { this._map = map; this._el = map.getCanvasContainer(); - + this._bearingSnap = options.bearingSnap; util.bindHandlers(this); } - DragRotateHandler.prototype = { - _enabled: false, _active: false, - - /** - * Returns the current enabled/disabled state of the "drag to rotate" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Returns true if the "drag to rotate" interaction is currently active, i.e. currently being used. - * @returns {boolean} active state - */ isActive: function () { return this._active; }, - - /** - * Enable the "drag to rotate" interaction. - * @example - * map.dragRotate.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('mousedown', this._onDown); this._enabled = true; }, - - /** - * Disable the "drag to rotate" interaction. - * @example - * map.dragRotate.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('mousedown', this._onDown); this._enabled = false; }, - _onDown: function (e) { - if (this._ignoreEvent(e)) return; - if (this.isActive()) return; - + if (this._ignoreEvent(e)) + return; + if (this.isActive()) + return; document.addEventListener('mousemove', this._onMove); document.addEventListener('mouseup', this._onUp); - this._active = false; - this._inertia = [[Date.now(), this._map.getBearing()]]; + this._inertia = [[ + Date.now(), + this._map.getBearing() + ]]; this._startPos = this._pos = DOM.mousePos(this._el, e); - this._center = this._map.transform.centerPoint; // Center of rotation - - // If the first click was too close to the center, move the center of rotation by 200 pixels - // in the direction of the click. - var startToCenter = this._startPos.sub(this._center), - startToCenterDist = startToCenter.mag(); - + this._center = this._map.transform.centerPoint; + var startToCenter = this._startPos.sub(this._center), startToCenterDist = startToCenter.mag(); if (startToCenterDist < 200) { this._center = this._startPos.add(new Point(-200, 0)._rotate(startToCenter.angle())); } - e.preventDefault(); }, - _onMove: function (e) { - if (this._ignoreEvent(e)) return; - + if (this._ignoreEvent(e)) + return; if (!this.isActive()) { this._active = true; this._fireEvent('rotatestart', e); this._fireEvent('movestart', e); } - var map = this._map; map.stop(); - - var p1 = this._pos, - p2 = DOM.mousePos(this._el, e), - center = this._center, - bearingDiff = p1.sub(center).angleWith(p2.sub(center)) / Math.PI * 180, - bearing = map.getBearing() - bearingDiff, - inertia = this._inertia, - last = inertia[inertia.length - 1]; - + var p1 = this._pos, p2 = DOM.mousePos(this._el, e), center = this._center, bearingDiff = p1.sub(center).angleWith(p2.sub(center)) / Math.PI * 180, bearing = map.getBearing() - bearingDiff, inertia = this._inertia, last = inertia[inertia.length - 1]; this._drainInertiaBuffer(); - inertia.push([Date.now(), map._normalizeBearing(bearing, last[1])]); - + inertia.push([ + Date.now(), + map._normalizeBearing(bearing, last[1]) + ]); map.transform.bearing = bearing; - this._fireEvent('rotate', e); this._fireEvent('move', e); - this._pos = p2; }, - _onUp: function (e) { - if (this._ignoreEvent(e)) return; + if (this._ignoreEvent(e)) + return; document.removeEventListener('mousemove', this._onMove); document.removeEventListener('mouseup', this._onUp); - - if (!this.isActive()) return; - + if (!this.isActive()) + return; this._active = false; this._fireEvent('rotateend', e); this._drainInertiaBuffer(); - - var map = this._map, - mapBearing = map.getBearing(), - inertia = this._inertia; - - var finish = function() { - if (Math.abs(mapBearing) < map.options.bearingSnap) { - map.resetNorth({noMoveStart: true}, { originalEvent: e }); + var map = this._map, mapBearing = map.getBearing(), inertia = this._inertia; + var finish = function () { + if (Math.abs(mapBearing) < this._bearingSnap) { + map.resetNorth({ noMoveStart: true }, { originalEvent: e }); } else { this._fireEvent('moveend', e); } }.bind(this); - if (inertia.length < 2) { finish(); return; } - - var first = inertia[0], - last = inertia[inertia.length - 1], - previous = inertia[inertia.length - 2], - bearing = map._normalizeBearing(mapBearing, previous[1]), - flingDiff = last[1] - first[1], - sign = flingDiff < 0 ? -1 : 1, - flingDuration = (last[0] - first[0]) / 1000; - + var first = inertia[0], last = inertia[inertia.length - 1], previous = inertia[inertia.length - 2], bearing = map._normalizeBearing(mapBearing, previous[1]), flingDiff = last[1] - first[1], sign = flingDiff < 0 ? -1 : 1, flingDuration = (last[0] - first[0]) / 1000; if (flingDiff === 0 || flingDuration === 0) { finish(); return; } - - var speed = Math.abs(flingDiff * (inertiaLinearity / flingDuration)); // deg/s + var speed = Math.abs(flingDiff * (inertiaLinearity / flingDuration)); if (speed > inertiaMaxSpeed) { speed = inertiaMaxSpeed; } - - var duration = speed / (inertiaDeceleration * inertiaLinearity), - offset = sign * speed * (duration / 2); - + var duration = speed / (inertiaDeceleration * inertiaLinearity), offset = sign * speed * (duration / 2); bearing += offset; - - if (Math.abs(map._normalizeBearing(bearing, 0)) < map.options.bearingSnap) { + if (Math.abs(map._normalizeBearing(bearing, 0)) < this._bearingSnap) { bearing = map._normalizeBearing(0, bearing); } - map.rotateTo(bearing, { duration: duration * 1000, easing: inertiaEasing, noMoveStart: true }, { originalEvent: e }); }, - _fireEvent: function (type, e) { return this._map.fire(type, { originalEvent: e }); }, - _ignoreEvent: function (e) { var map = this._map; - - if (map.boxZoom && map.boxZoom.isActive()) return true; - if (map.dragPan && map.dragPan.isActive()) return true; + if (map.boxZoom && map.boxZoom.isActive()) + return true; + if (map.dragPan && map.dragPan.isActive()) + return true; if (e.touches) { - return (e.touches.length > 1); + return e.touches.length > 1; } else { - var buttons = (e.ctrlKey ? 1 : 2), // ? ctrl+left button : right button - button = (e.ctrlKey ? 0 : 2); // ? ctrl+left button : right button - return (e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button); + var buttons = e.ctrlKey ? 1 : 2, button = e.ctrlKey ? 0 : 2; + return e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button; } }, - _drainInertiaBuffer: function () { - var inertia = this._inertia, - now = Date.now(), - cutoff = 160; //msec - + var inertia = this._inertia, now = Date.now(), cutoff = 160; while (inertia.length > 0 && now - inertia[0][0] > cutoff) inertia.shift(); } - }; - - -/** - * Rotate start event. This event is emitted at the start of a user-initiated rotate interaction. - * - * @event rotatestart - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Rotate event. This event is emitted repeatedly during a user-initiated rotate interaction. - * - * @event rotate - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Rotate end event. This event is emitted at the end of a user-initiated rotate interaction. - * - * @event rotateend - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../../util/dom":338,"../../util/util":349,"point-geometry":404}],326:[function(require,module,exports){ +},{"../../util/dom":352,"../../util/util":366,"point-geometry":424}],341:[function(require,module,exports){ 'use strict'; - module.exports = KeyboardHandler; - - -var panDelta = 80, - rotateDelta = 2, - pitchDelta = 5; - -/** - * The `KeyboardHandler` allows a user to zoom, rotate, and pan the map using - * following keyboard shortcuts: - * * `=` / `+`: increase zoom level by 1 - * * `Shift-=` / `Shift-+`: increase zoom level by 2 - * * `-`: decrease zoom level by 1 - * * `Shift--`: decrease zoom level by 2 - * * Arrow keys: pan by 80 pixels - * * `Shift+⇢`: increase rotation by 2 degrees - * * `Shift+⇠`: decrease rotation by 2 degrees - * * `Shift+⇡`: increase pitch by 5 degrees - * * `Shift+⇣`: decrease pitch by 5 degrees - * @class KeyboardHandler - */ +var panDelta = 80, rotateDelta = 2, pitchDelta = 5; function KeyboardHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - this._onKeyDown = this._onKeyDown.bind(this); } - KeyboardHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of keyboard interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the ability to interact with the map using keyboard input. - * @example - * map.keyboard.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('keydown', this._onKeyDown, false); this._enabled = true; }, - - /** - * Disable the ability to interact with the map using keyboard input. - * @example - * map.keyboard.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('keydown', this._onKeyDown); this._enabled = false; }, - _onKeyDown: function (e) { - if (e.altKey || e.ctrlKey || e.metaKey) return; - - var map = this._map, - eventData = { originalEvent: e }; - + if (e.altKey || e.ctrlKey || e.metaKey) + return; + var map = this._map, eventData = { originalEvent: e }; + if (map.isEasing()) + return; switch (e.keyCode) { case 61: case 107: @@ -55786,191 +56302,138 @@ KeyboardHandler.prototype = { case 187: map.zoomTo(Math.round(map.getZoom()) + (e.shiftKey ? 2 : 1), eventData); break; - case 189: case 109: case 173: map.zoomTo(Math.round(map.getZoom()) - (e.shiftKey ? 2 : 1), eventData); break; - case 37: if (e.shiftKey) { map.easeTo({ bearing: map.getBearing() - rotateDelta }, eventData); } else { e.preventDefault(); - map.panBy([-panDelta, 0], eventData); + map.panBy([ + -panDelta, + 0 + ], eventData); } break; - case 39: if (e.shiftKey) { map.easeTo({ bearing: map.getBearing() + rotateDelta }, eventData); } else { e.preventDefault(); - map.panBy([panDelta, 0], eventData); + map.panBy([ + panDelta, + 0 + ], eventData); } break; - case 38: if (e.shiftKey) { map.easeTo({ pitch: map.getPitch() + pitchDelta }, eventData); } else { e.preventDefault(); - map.panBy([0, -panDelta], eventData); + map.panBy([ + 0, + -panDelta + ], eventData); } break; - case 40: if (e.shiftKey) { map.easeTo({ pitch: Math.max(map.getPitch() - pitchDelta, 0) }, eventData); } else { e.preventDefault(); - map.panBy([0, panDelta], eventData); + map.panBy([ + 0, + panDelta + ], eventData); } break; } } }; - -},{}],327:[function(require,module,exports){ +},{}],342:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - browser = require('../../util/browser'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), browser = require('../../util/browser'), util = require('../../util/util'); module.exports = ScrollZoomHandler; - - -var ua = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase() : '', - firefox = ua.indexOf('firefox') !== -1, - safari = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') === -1; - - -/** - * The `ScrollZoomHandler` allows a user to zoom the map by scrolling. - * @class ScrollZoomHandler - */ +var ua = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase() : '', firefox = ua.indexOf('firefox') !== -1, safari = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') === -1; function ScrollZoomHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - util.bindHandlers(this); } - ScrollZoomHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of the "scroll to zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the "scroll to zoom" interaction. - * @example - * map.scrollZoom.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('wheel', this._onWheel, false); this._el.addEventListener('mousewheel', this._onWheel, false); this._enabled = true; }, - - /** - * Disable the "scroll to zoom" interaction. - * @example - * map.scrollZoom.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('wheel', this._onWheel); this._el.removeEventListener('mousewheel', this._onWheel); this._enabled = false; }, - _onWheel: function (e) { var value; - if (e.type === 'wheel') { value = e.deltaY; - // Firefox doubles the values on retina screens... - if (firefox && e.deltaMode === window.WheelEvent.DOM_DELTA_PIXEL) value /= browser.devicePixelRatio; - if (e.deltaMode === window.WheelEvent.DOM_DELTA_LINE) value *= 40; - + if (firefox && e.deltaMode === window.WheelEvent.DOM_DELTA_PIXEL) + value /= browser.devicePixelRatio; + if (e.deltaMode === window.WheelEvent.DOM_DELTA_LINE) + value *= 40; } else if (e.type === 'mousewheel') { value = -e.wheelDeltaY; - if (safari) value = value / 3; + if (safari) + value = value / 3; } - - var now = browser.now(), - timeDelta = now - (this._time || 0); - + var now = browser.now(), timeDelta = now - (this._time || 0); this._pos = DOM.mousePos(this._el, e); this._time = now; - - if (value !== 0 && (value % 4.000244140625) === 0) { - // This one is definitely a mouse wheel event. + if (value !== 0 && value % 4.000244140625 === 0) { this._type = 'wheel'; - // Normalize this value to match trackpad. value = Math.floor(value / 4); - } else if (value !== 0 && Math.abs(value) < 4) { - // This one is definitely a trackpad event because it is so small. this._type = 'trackpad'; - } else if (timeDelta > 400) { - // This is likely a new scroll action. this._type = null; this._lastValue = value; - - // Start a timeout in case this was a singular event, and dely it by up to 40ms. this._timeout = setTimeout(this._onTimeout, 40); - } else if (!this._type) { - // This is a repeating event, but we don't know the type of event just yet. - // If the delta per time is small, we assume it's a fast trackpad; otherwise we switch into wheel mode. - this._type = (Math.abs(timeDelta * value) < 200) ? 'trackpad' : 'wheel'; - - // Make sure our delayed event isn't fired again, because we accumulate - // the previous event (which was less than 40ms ago) into this event. + this._type = Math.abs(timeDelta * value) < 200 ? 'trackpad' : 'wheel'; if (this._timeout) { clearTimeout(this._timeout); this._timeout = null; value += this._lastValue; } } - - // Slow down zoom if shift key is held for more precise zooming - if (e.shiftKey && value) value = value / 4; - - // Only fire the callback if we actually know what type of scrolling device the user uses. - if (this._type) this._zoom(-value, e); - + if (e.shiftKey && value) + value = value / 4; + if (this._type) + this._zoom(-value, e); e.preventDefault(); }, - _onTimeout: function () { this._type = 'wheel'; this._zoom(-this._lastValue); }, - _zoom: function (delta, e) { - if (delta === 0) return; + if (delta === 0) + return; var map = this._map; - - // Scale by sigmoid of scroll wheel delta. var scale = 2 / (1 + Math.exp(-Math.abs(delta / 100))); - if (delta < 0 && scale !== 0) scale = 1 / scale; - - var fromScale = map.ease ? map.ease.to : map.transform.scale, - targetZoom = map.transform.scaleZoom(fromScale * scale); - + if (delta < 0 && scale !== 0) + scale = 1 / scale; + var fromScale = map.ease ? map.ease.to : map.transform.scale, targetZoom = map.transform.scaleZoom(fromScale * scale); map.zoomTo(targetZoom, { duration: 0, around: map.unproject(this._pos), @@ -55978,215 +56441,104 @@ ScrollZoomHandler.prototype = { }, { originalEvent: e }); } }; - - -/** - * Zoom start event. This event is emitted just before the map begins a transition from one - * zoom level to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event zoomstart - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Zoom event. This event is emitted repeatedly during animated transitions from one zoom level to - * another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event zoom - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Zoom end event. This event is emitted just after the map completes a transition from one - * zoom level to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event zoomend - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -},{"../../util/browser":335,"../../util/dom":338,"../../util/util":349}],328:[function(require,module,exports){ +},{"../../util/browser":350,"../../util/dom":352,"../../util/util":366}],343:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), util = require('../../util/util'); module.exports = TouchZoomRotateHandler; - -var inertiaLinearity = 0.15, - inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), - inertiaDeceleration = 12, // scale / s^2 - inertiaMaxSpeed = 2.5, // scale / s - significantScaleThreshold = 0.15, - significantRotateThreshold = 4; - - -/** - * The `TouchZoomRotateHandler` allows a user to zoom and rotate the map by - * pinching on a touchscreen. - * @class TouchZoomRotateHandler - */ +var inertiaLinearity = 0.15, inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), inertiaDeceleration = 12, inertiaMaxSpeed = 2.5, significantScaleThreshold = 0.15, significantRotateThreshold = 4; function TouchZoomRotateHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - util.bindHandlers(this); } - TouchZoomRotateHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of the "pinch to rotate and zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the "pinch to rotate and zoom" interaction. - * @example - * map.touchZoomRotate.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('touchstart', this._onStart, false); this._enabled = true; }, - - /** - * Disable the "pinch to rotate and zoom" interaction. - * @example - * map.touchZoomRotate.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('touchstart', this._onStart); this._enabled = false; }, - - /** - * Disable the "pinch to rotate" interaction, leaving the "pinch to zoom" - * interaction enabled. - * @example - * map.touchZoomRotate.disableRotation(); - */ - disableRotation: function() { + disableRotation: function () { this._rotationDisabled = true; }, - - /** - * Enable the "pinch to rotate" interaction, undoing a call to - * `disableRotation`. - * @example - * map.touchZoomRotate.enable(); - * map.touchZoomRotate.enableRotation(); - */ - enableRotation: function() { + enableRotation: function () { this._rotationDisabled = false; }, - _onStart: function (e) { - if (e.touches.length !== 2) return; - - var p0 = DOM.mousePos(this._el, e.touches[0]), - p1 = DOM.mousePos(this._el, e.touches[1]); - + if (e.touches.length !== 2) + return; + var p0 = DOM.mousePos(this._el, e.touches[0]), p1 = DOM.mousePos(this._el, e.touches[1]); this._startVec = p0.sub(p1); this._startScale = this._map.transform.scale; this._startBearing = this._map.transform.bearing; this._gestureIntent = undefined; this._inertia = []; - document.addEventListener('touchmove', this._onMove, false); document.addEventListener('touchend', this._onEnd, false); }, - _onMove: function (e) { - if (e.touches.length !== 2) return; - - var p0 = DOM.mousePos(this._el, e.touches[0]), - p1 = DOM.mousePos(this._el, e.touches[1]), - p = p0.add(p1).div(2), - vec = p0.sub(p1), - scale = vec.mag() / this._startVec.mag(), - bearing = this._rotationDisabled ? 0 : vec.angleWith(this._startVec) * 180 / Math.PI, - map = this._map; - - // Determine 'intent' by whichever threshold is surpassed first, - // then keep that state for the duration of this gesture. + if (e.touches.length !== 2) + return; + var p0 = DOM.mousePos(this._el, e.touches[0]), p1 = DOM.mousePos(this._el, e.touches[1]), p = p0.add(p1).div(2), vec = p0.sub(p1), scale = vec.mag() / this._startVec.mag(), bearing = this._rotationDisabled ? 0 : vec.angleWith(this._startVec) * 180 / Math.PI, map = this._map; if (!this._gestureIntent) { - var scalingSignificantly = (Math.abs(1 - scale) > significantScaleThreshold), - rotatingSignificantly = (Math.abs(bearing) > significantRotateThreshold); - + var scalingSignificantly = Math.abs(1 - scale) > significantScaleThreshold, rotatingSignificantly = Math.abs(bearing) > significantRotateThreshold; if (rotatingSignificantly) { this._gestureIntent = 'rotate'; } else if (scalingSignificantly) { this._gestureIntent = 'zoom'; } - if (this._gestureIntent) { this._startVec = vec; this._startScale = map.transform.scale; this._startBearing = map.transform.bearing; } - } else { - var param = { duration: 0, around: map.unproject(p) }; - + var param = { + duration: 0, + around: map.unproject(p) + }; if (this._gestureIntent === 'rotate') { param.bearing = this._startBearing + bearing; } if (this._gestureIntent === 'zoom' || this._gestureIntent === 'rotate') { param.zoom = map.transform.scaleZoom(this._startScale * scale); } - map.stop(); this._drainInertiaBuffer(); - this._inertia.push([Date.now(), scale, p]); - + this._inertia.push([ + Date.now(), + scale, + p + ]); map.easeTo(param, { originalEvent: e }); } - e.preventDefault(); }, - _onEnd: function (e) { document.removeEventListener('touchmove', this._onMove); document.removeEventListener('touchend', this._onEnd); this._drainInertiaBuffer(); - - var inertia = this._inertia, - map = this._map; - + var inertia = this._inertia, map = this._map; if (inertia.length < 2) { map.snapToNorth({}, { originalEvent: e }); return; } - - var last = inertia[inertia.length - 1], - first = inertia[0], - lastScale = map.transform.scaleZoom(this._startScale * last[1]), - firstScale = map.transform.scaleZoom(this._startScale * first[1]), - scaleOffset = lastScale - firstScale, - scaleDuration = (last[0] - first[0]) / 1000, - p = last[2]; - + var last = inertia[inertia.length - 1], first = inertia[0], lastScale = map.transform.scaleZoom(this._startScale * last[1]), firstScale = map.transform.scaleZoom(this._startScale * first[1]), scaleOffset = lastScale - firstScale, scaleDuration = (last[0] - first[0]) / 1000, p = last[2]; if (scaleDuration === 0 || lastScale === firstScale) { map.snapToNorth({}, { originalEvent: e }); return; } - - // calculate scale/s speed and adjust for increased initial animation speed when easing - var speed = scaleOffset * inertiaLinearity / scaleDuration; // scale/s - + var speed = scaleOffset * inertiaLinearity / scaleDuration; if (Math.abs(speed) > inertiaMaxSpeed) { if (speed > 0) { speed = inertiaMaxSpeed; @@ -56194,14 +56546,10 @@ TouchZoomRotateHandler.prototype = { speed = -inertiaMaxSpeed; } } - - var duration = Math.abs(speed / (inertiaDeceleration * inertiaLinearity)) * 1000, - targetScale = lastScale + speed * duration / 2000; - + var duration = Math.abs(speed / (inertiaDeceleration * inertiaLinearity)) * 1000, targetScale = lastScale + speed * duration / 2000; if (targetScale < 0) { targetScale = 0; } - map.easeTo({ zoom: targetScale, duration: duration, @@ -56209,68 +56557,43 @@ TouchZoomRotateHandler.prototype = { around: map.unproject(p) }, { originalEvent: e }); }, - - _drainInertiaBuffer: function() { - var inertia = this._inertia, - now = Date.now(), - cutoff = 160; // msec - - while (inertia.length > 2 && now - inertia[0][0] > cutoff) inertia.shift(); + _drainInertiaBuffer: function () { + var inertia = this._inertia, now = Date.now(), cutoff = 160; + while (inertia.length > 2 && now - inertia[0][0] > cutoff) + inertia.shift(); } }; - -},{"../../util/dom":338,"../../util/util":349}],329:[function(require,module,exports){ +},{"../../util/dom":352,"../../util/util":366}],344:[function(require,module,exports){ 'use strict'; - -/* - * Adds the map's position to its page's location hash. - * Passed as an option to the map object. - * - * @class mapboxgl.Hash - * @returns {Hash} `this` - */ module.exports = Hash; - var util = require('../util/util'); - function Hash() { util.bindAll([ '_onHashChange', '_updateHash' ], this); } - Hash.prototype = { - /* - * Map element to listen for coordinate changes - * - * @param {Object} map - * @returns {Hash} `this` - */ - addTo: function(map) { + addTo: function (map) { this._map = map; window.addEventListener('hashchange', this._onHashChange, false); this._map.on('moveend', this._updateHash); return this; }, - - /* - * Removes hash - * - * @returns {Popup} `this` - */ - remove: function() { + remove: function () { window.removeEventListener('hashchange', this._onHashChange, false); this._map.off('moveend', this._updateHash); delete this._map; return this; }, - - _onHashChange: function() { + _onHashChange: function () { var loc = location.hash.replace('#', '').split('/'); if (loc.length >= 3) { this._map.jumpTo({ - center: [+loc[2], +loc[1]], + center: [ + +loc[2], + +loc[1] + ], zoom: +loc[0], bearing: +(loc[3] || 0) }); @@ -56278,437 +56601,79 @@ Hash.prototype = { } return false; }, - - _updateHash: function() { - var center = this._map.getCenter(), - zoom = this._map.getZoom(), - bearing = this._map.getBearing(), - precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)), - - hash = '#' + (Math.round(zoom * 100) / 100) + - '/' + center.lat.toFixed(precision) + - '/' + center.lng.toFixed(precision) + - (bearing ? '/' + (Math.round(bearing * 10) / 10) : ''); - + _updateHash: function () { + var center = this._map.getCenter(), zoom = this._map.getZoom(), bearing = this._map.getBearing(), precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)), hash = '#' + Math.round(zoom * 100) / 100 + '/' + center.lat.toFixed(precision) + '/' + center.lng.toFixed(precision) + (bearing ? '/' + Math.round(bearing * 10) / 10 : ''); window.history.replaceState('', '', hash); } }; - -},{"../util/util":349}],330:[function(require,module,exports){ -'use strict'; - -var handlers = { - scrollZoom: require('./handler/scroll_zoom'), - boxZoom: require('./handler/box_zoom'), - dragRotate: require('./handler/drag_rotate'), - dragPan: require('./handler/drag_pan'), - keyboard: require('./handler/keyboard'), - doubleClickZoom: require('./handler/dblclick_zoom'), - touchZoomRotate: require('./handler/touch_zoom_rotate') -}; - -var DOM = require('../util/dom'), - util = require('../util/util'), - Point = require('point-geometry'); - -module.exports = Interaction; - -function Interaction(map) { - this._map = map; - this._el = map.getCanvasContainer(); - - for (var name in handlers) { - map[name] = new handlers[name](map); - } - - util.bindHandlers(this); -} - -Interaction.prototype = { - enable: function () { - var options = this._map.options, - el = this._el; - - for (var name in handlers) { - if (options[name]) this._map[name].enable(); - } - - el.addEventListener('mousedown', this._onMouseDown, false); - el.addEventListener('mouseup', this._onMouseUp, false); - el.addEventListener('mousemove', this._onMouseMove, false); - el.addEventListener('touchstart', this._onTouchStart, false); - el.addEventListener('touchend', this._onTouchEnd, false); - el.addEventListener('touchmove', this._onTouchMove, false); - el.addEventListener('touchcancel', this._onTouchCancel, false); - el.addEventListener('click', this._onClick, false); - el.addEventListener('dblclick', this._onDblClick, false); - el.addEventListener('contextmenu', this._onContextMenu, false); - }, - - disable: function () { - var options = this._map.options, - el = this._el; - - for (var name in handlers) { - if (options[name]) this._map[name].disable(); - } - - el.removeEventListener('mousedown', this._onMouseDown); - el.removeEventListener('mouseup', this._onMouseUp); - el.removeEventListener('mousemove', this._onMouseMove); - el.removeEventListener('touchstart', this._onTouchStart); - el.removeEventListener('touchend', this._onTouchEnd); - el.removeEventListener('touchmove', this._onTouchMove); - el.removeEventListener('touchcancel', this._onTouchCancel); - el.removeEventListener('click', this._onClick); - el.removeEventListener('dblclick', this._onDblClick); - el.removeEventListener('contextmenu', this._onContextMenu); - }, - - _onMouseDown: function (e) { - this._map.stop(); - this._startPos = DOM.mousePos(this._el, e); - this._fireMouseEvent('mousedown', e); - }, - - _onMouseUp: function (e) { - var map = this._map, - rotating = map.dragRotate && map.dragRotate.isActive(); - - if (this._contextMenuEvent && !rotating) { - this._fireMouseEvent('contextmenu', this._contextMenuEvent); - } - - this._contextMenuEvent = null; - this._fireMouseEvent('mouseup', e); - }, - - _onMouseMove: function (e) { - var map = this._map, - el = this._el; - - if (map.dragPan && map.dragPan.isActive()) return; - if (map.dragRotate && map.dragRotate.isActive()) return; - - var target = e.toElement || e.target; - while (target && target !== el) target = target.parentNode; - if (target !== el) return; - - this._fireMouseEvent('mousemove', e); - }, - - _onTouchStart: function (e) { - this._map.stop(); - this._fireTouchEvent('touchstart', e); - - if (!e.touches || e.touches.length > 1) return; - - if (!this._tapped) { - this._tapped = setTimeout(this._onTouchTimeout, 300); - - } else { - clearTimeout(this._tapped); - this._tapped = null; - this._fireMouseEvent('dblclick', e); - } - }, - - _onTouchMove: function (e) { - this._fireTouchEvent('touchmove', e); - }, - - _onTouchEnd: function (e) { - this._fireTouchEvent('touchend', e); - }, - - _onTouchCancel: function (e) { - this._fireTouchEvent('touchcancel', e); - }, - - _onTouchTimeout: function () { - this._tapped = null; - }, - - _onClick: function (e) { - var pos = DOM.mousePos(this._el, e); - - if (pos.equals(this._startPos)) { - this._fireMouseEvent('click', e); - } - }, - - _onDblClick: function (e) { - this._fireMouseEvent('dblclick', e); - e.preventDefault(); - }, - - _onContextMenu: function (e) { - this._contextMenuEvent = e; - e.preventDefault(); - }, - - _fireMouseEvent: function (type, e) { - var pos = DOM.mousePos(this._el, e); - - return this._map.fire(type, { - lngLat: this._map.unproject(pos), - point: pos, - originalEvent: e - }); - }, - - _fireTouchEvent: function (type, e) { - var touches = DOM.touchPos(this._el, e), - singular = touches.reduce(function (prev, curr, i, arr) { - return prev.add(curr.div(arr.length)); - }, new Point(0, 0)); - - return this._map.fire(type, { - lngLat: this._map.unproject(singular), - point: singular, - lngLats: touches.map(function(t) { return this._map.unproject(t); }, this), - points: touches, - originalEvent: e - }); - } -}; - - -/** - * When an event [fires]{@link #Evented.fire} as a result of a - * user interaction, the event will be called with an EventData - * object containing the original DOM event along with coordinates of - * the event target. - * - * @typedef {Object} EventData - * @property {Event} originalEvent The original DOM event - * @property {Point} point The pixel location of the event - * @property {LngLat} lngLat The geographic location of the event - * @example - * map.on('click', function(data) { - * var e = data && data.originalEvent; - * console.log('got click ' + (e ? 'button = ' + e.button : '')); - * }); - */ - -/** - * Mouse down event. - * - * @event mousedown - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [mousedown event](https://developer.mozilla.org/en-US/docs/Web/Events/mousedown) - */ - -/** - * Mouse up event. - * - * @event mouseup - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [mouseup event](https://developer.mozilla.org/en-US/docs/Web/Events/mouseup) - */ - -/** - * Mouse move event. - * - * @event mousemove - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [mousemouse event](https://developer.mozilla.org/en-US/docs/Web/Events/mousemove) - */ - -/** - * Touch start event. - * - * @event touchstart - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchstart event](https://developer.mozilla.org/en-US/docs/Web/Events/touchstart). - */ - -/** - * Touch end event. - * - * @event touchend - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchcancel event](https://developer.mozilla.org/en-US/docs/Web/Events/touchcancel). - */ - -/** - * Touch move event. - * - * @event touchmove - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchmove event](https://developer.mozilla.org/en-US/docs/Web/Events/touchmove). - */ - -/** - * Touch cancel event. - * - * @event touchcancel - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchcancel event](https://developer.mozilla.org/en-US/docs/Web/Events/touchcancel). - */ - -/** - * Click event. - * - * @event click - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [click event](https://developer.mozilla.org/en-US/docs/Web/Events/click) - */ - -/** - * Double click event. - * - * @event dblclick - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Context menu event. - * - * @event contextmenu - * @memberof Map - * @instance - * @property {EventData} data Original event data, if available - */ - -/** - * Load event. This event is emitted immediately after all necessary resources have been downloaded - * and the first visually complete rendering has occurred. - * - * @event load - * @memberof Map - * @instance - * @type {Object} - */ - -/** - * Move start event. This event is emitted just before the map begins a transition from one - * view to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event movestart - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Move event. This event is emitted repeatedly during animated transitions from one view to - * another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event move - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Move end event. This event is emitted just after the map completes a transition from one - * view to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event moveend - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -},{"../util/dom":338,"../util/util":349,"./handler/box_zoom":322,"./handler/dblclick_zoom":323,"./handler/drag_pan":324,"./handler/drag_rotate":325,"./handler/keyboard":326,"./handler/scroll_zoom":327,"./handler/touch_zoom_rotate":328,"point-geometry":404}],331:[function(require,module,exports){ +},{"../util/util":366}],345:[function(require,module,exports){ 'use strict'; - var Canvas = require('../util/canvas'); var util = require('../util/util'); var browser = require('../util/browser'); +var window = require('../util/browser').window; var Evented = require('../util/evented'); var DOM = require('../util/dom'); - var Style = require('../style/style'); var AnimationLoop = require('../style/animation_loop'); var Painter = require('../render/painter'); - var Transform = require('../geo/transform'); var Hash = require('./hash'); - -var Interaction = require('./interaction'); - +var bindHandlers = require('./bind_handlers'); var Camera = require('./camera'); var LngLat = require('../geo/lng_lat'); var LngLatBounds = require('../geo/lng_lat_bounds'); var Point = require('point-geometry'); var Attribution = require('./control/attribution'); - var defaultMinZoom = 0; var defaultMaxZoom = 20; - -/** - * Creates a map instance. This is usually the beginning of your map: - * you tell Mapbox GL JS where to put the map by specifying a `container` - * option, and the map's style with `style` and other attributes of the map, - * and in return Mapbox GL JS initializes the map on your page and returns - * a map variable that lets you programmatically call methods on the map. - * @class Map - * @param {Object} options - * @param {string|Element} options.container HTML element to initialize the map in (or element id as string) - * @param {number} [options.minZoom=0] Minimum zoom of the map - * @param {number} [options.maxZoom=20] Maximum zoom of the map - * @param {Object|string} [options.style] Map style. This must be an an object conforming to the schema described in the [style reference](https://mapbox.com/mapbox-gl-style-spec/), or a URL to a JSON style. To load a style from the Mapbox API, you can use a URL of the form `mapbox://styles/:owner/:style`, where `:owner` is your Mapbox account name and `:style` is the style ID. Or you can use one of the predefined Mapbox styles: - * * `mapbox://styles/mapbox/basic-v8` - Simple and flexible starting template. - * * `mapbox://styles/mapbox/bright-v8` - Template for complex custom basemaps. - * * `mapbox://styles/mapbox/streets-v8` - A ready-to-use basemap, perfect for minor customization or incorporating your own data. - * * `mapbox://styles/mapbox/light-v8` - Subtle light backdrop for data vizualizations. - * * `mapbox://styles/mapbox/dark-v8` - Subtle dark backdrop for data vizualizations. - * @param {boolean} [options.hash=false] If `true`, the map will track and update the page URL according to map position - * @param {boolean} [options.interactive=true] If `false`, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input - * @param {number} [options.bearingSnap=7] Snap to north threshold in degrees. - * @param {Array} [options.classes] Style class names with which to initialize the map - * @param {boolean} [options.attributionControl=true] If `true`, an attribution control will be added to the map. - * @param {boolean} [options.failIfMajorPerformanceCaveat=false] If `true`, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. - * @param {boolean} [options.preserveDrawingBuffer=false] If `true`, The maps canvas can be exported to a PNG using `map.getCanvas().toDataURL();`. This is false by default as a performance optimization. - * @param {LngLatBounds|Array>} [options.maxBounds] If set, the map is constrained to the given bounds. - * @param {boolean} [options.scrollZoom=true] If `true`, enable the "scroll to zoom" interaction (see `ScrollZoomHandler`) - * @param {boolean} [options.boxZoom=true] If `true`, enable the "box zoom" interaction (see `BoxZoomHandler`) - * @param {boolean} [options.dragRotate=true] If `true`, enable the "drag to rotate" interaction (see `DragRotateHandler`). - * @param {boolean} [options.dragPan=true] If `true`, enable the "drag to pan" interaction (see `DragPanHandler`). - * @param {boolean} [options.keyboard=true] If `true`, enable keyboard shortcuts (see `KeyboardHandler`). - * @param {boolean} [options.doubleClickZoom=true] If `true`, enable the "double click to zoom" interaction (see `DoubleClickZoomHandler`). - * @param {boolean} [options.touchZoomRotate=true] If `true`, enable the "pinch to rotate and zoom" interaction (see `TouchZoomRotateHandler`). - * @example - * var map = new mapboxgl.Map({ - * container: 'map', - * center: [-122.420679, 37.772537], - * zoom: 13, - * style: style_object, - * hash: true - * }); - */ -var Map = module.exports = function(options) { - - options = util.inherit(this.options, options); +var defaultOptions = { + center: [ + 0, + 0 + ], + zoom: 0, + bearing: 0, + pitch: 0, + minZoom: defaultMinZoom, + maxZoom: defaultMaxZoom, + interactive: true, + scrollZoom: true, + boxZoom: true, + dragRotate: true, + dragPan: true, + keyboard: true, + doubleClickZoom: true, + touchZoomRotate: true, + bearingSnap: 7, + hash: false, + attributionControl: true, + failIfMajorPerformanceCaveat: false, + preserveDrawingBuffer: false, + trackResize: true, + workerCount: Math.max(browser.hardwareConcurrency - 1, 1) +}; +var Map = module.exports = function (options) { + options = util.extend({}, defaultOptions, options); + if (options.workerCount < 1) { + throw new Error('workerCount must an integer greater than or equal to 1.'); + } this._interactive = options.interactive; this._failIfMajorPerformanceCaveat = options.failIfMajorPerformanceCaveat; this._preserveDrawingBuffer = options.preserveDrawingBuffer; - + this._trackResize = options.trackResize; + this._workerCount = options.workerCount; + this._bearingSnap = options.bearingSnap; if (typeof options.container === 'string') { this._container = document.getElementById(options.container); } else { this._container = options.container; } - this.animationLoop = new AnimationLoop(); this.transform = new Transform(options.minZoom, options.maxZoom); - if (options.maxBounds) { this.setMaxBounds(options.maxBounds); } - util.bindAll([ '_forwardStyleEvent', '_forwardSourceEvent', @@ -56719,230 +56684,122 @@ var Map = module.exports = function(options) { '_onSourceAdd', '_onSourceRemove', '_onSourceUpdate', + '_onWindowOnline', '_onWindowResize', - 'onError', '_update', '_render' ], this); - this._setupContainer(); this._setupPainter(); - this.on('move', this._update.bind(this, false)); this.on('zoom', this._update.bind(this, true)); - this.on('moveend', function() { - this.animationLoop.set(300); // text fading + this.on('moveend', function () { + this.animationLoop.set(300); this._rerender(); }.bind(this)); - - if (typeof window !== 'undefined') { - window.addEventListener('resize', this._onWindowResize, false); - } - - this.interaction = new Interaction(this); - - if (options.interactive) { - this.interaction.enable(); - } - - this._hash = options.hash && (new Hash()).addTo(this); - // don't set position from options if set through hash - if (!this._hash || !this._hash._onHashChange()) { - this.jumpTo(options); - } - - this.stacks = {}; - this._classes = []; - - this.resize(); - - if (options.classes) this.setClasses(options.classes); - if (options.style) this.setStyle(options.style); - if (options.attributionControl) this.addControl(new Attribution(options.attributionControl)); - - this.on('style.error', this.onError); - this.on('source.error', this.onError); - this.on('tile.error', this.onError); - this.on('layer.error', this.onError); -}; - -util.extend(Map.prototype, Evented); -util.extend(Map.prototype, Camera.prototype); -util.extend(Map.prototype, /** @lends Map.prototype */{ - - options: { - center: [0, 0], - zoom: 0, - bearing: 0, - pitch: 0, - - minZoom: defaultMinZoom, - maxZoom: defaultMaxZoom, - - interactive: true, - - scrollZoom: true, - boxZoom: true, - dragRotate: true, - dragPan: true, - keyboard: true, - doubleClickZoom: true, - touchZoomRotate: true, - - bearingSnap: 7, - - hash: false, - - attributionControl: true, - - failIfMajorPerformanceCaveat: false, - preserveDrawingBuffer: false - }, - - /** - * Adds a control to the map, calling `control.addTo(this)`. - * - * @param {Control} control - * @returns {Map} `this` - */ - addControl: function(control) { + if (typeof window !== 'undefined') { + window.addEventListener('online', this._onWindowOnline, false); + window.addEventListener('resize', this._onWindowResize, false); + } + bindHandlers(this, options); + this._hash = options.hash && new Hash().addTo(this); + if (!this._hash || !this._hash._onHashChange()) { + this.jumpTo({ + center: options.center, + zoom: options.zoom, + bearing: options.bearing, + pitch: options.pitch + }); + } + this.stacks = {}; + this._classes = []; + this.resize(); + if (options.classes) + this.setClasses(options.classes); + if (options.style) + this.setStyle(options.style); + if (options.attributionControl) + this.addControl(new Attribution(options.attributionControl)); + var fireError = this.fire.bind(this, 'error'); + this.on('style.error', fireError); + this.on('source.error', fireError); + this.on('tile.error', fireError); + this.on('layer.error', fireError); +}; +util.extend(Map.prototype, Evented); +util.extend(Map.prototype, Camera.prototype); +util.extend(Map.prototype, { + addControl: function (control) { control.addTo(this); return this; }, - - /** - * Adds a style class to a map. - * - * @param {string} klass name of style class - * @param {StyleOptions} [options] - * @fires change - * @returns {Map} `this` - */ - addClass: function(klass, options) { - if (this._classes.indexOf(klass) >= 0 || klass === '') return this; + addClass: function (klass, options) { + if (this._classes.indexOf(klass) >= 0 || klass === '') + return this; this._classes.push(klass); this._classOptions = options; - - if (this.style) this.style.updateClasses(); + if (this.style) + this.style.updateClasses(); return this._update(true); }, - - /** - * Removes a style class from a map. - * - * @param {string} klass name of style class - * @param {StyleOptions} [options] - * @fires change - * @returns {Map} `this` - */ - removeClass: function(klass, options) { + removeClass: function (klass, options) { var i = this._classes.indexOf(klass); - if (i < 0 || klass === '') return this; + if (i < 0 || klass === '') + return this; this._classes.splice(i, 1); this._classOptions = options; - - if (this.style) this.style.updateClasses(); + if (this.style) + this.style.updateClasses(); return this._update(true); }, - - /** - * Helper method to add more than one class. - * - * @param {Array} klasses An array of class names - * @param {StyleOptions} [options] - * @fires change - * @returns {Map} `this` - */ - setClasses: function(klasses, options) { + setClasses: function (klasses, options) { var uniqueClasses = {}; for (var i = 0; i < klasses.length; i++) { - if (klasses[i] !== '') uniqueClasses[klasses[i]] = true; + if (klasses[i] !== '') + uniqueClasses[klasses[i]] = true; } this._classes = Object.keys(uniqueClasses); this._classOptions = options; - - if (this.style) this.style.updateClasses(); + if (this.style) + this.style.updateClasses(); return this._update(true); }, - - /** - * Check whether a style class is active. - * - * @param {string} klass Name of style class - * @returns {boolean} - */ - hasClass: function(klass) { + hasClass: function (klass) { return this._classes.indexOf(klass) >= 0; }, - - /** - * Return an array of the current active style classes. - * - * @returns {boolean} - */ - getClasses: function() { + getClasses: function () { return this._classes; }, - - /** - * Detect the map's new width and height and resize it. Given - * the `container` of the map specified in the Map constructor, - * this reads the new width from the DOM: so this method is often - * called after the map's container is resized by another script - * or the map is shown after being initially hidden with CSS. - * - * @returns {Map} `this` - */ - resize: function() { + resize: function () { var width = 0, height = 0; - if (this._container) { width = this._container.offsetWidth || 400; height = this._container.offsetHeight || 300; } - this._canvas.resize(width, height); this.transform.resize(width, height); this.painter.resize(width, height); - - return this - .fire('movestart') - .fire('move') - .fire('resize') - .fire('moveend'); + return this.fire('movestart').fire('move').fire('resize').fire('moveend'); }, - - /** - * Get the map's geographical bounds. - * - * @returns {LngLatBounds} - */ - getBounds: function() { - var bounds = new LngLatBounds( - this.transform.pointLocation(new Point(0, 0)), - this.transform.pointLocation(this.transform.size)); - + getBounds: function () { + var bounds = new LngLatBounds(this.transform.pointLocation(new Point(0, 0)), this.transform.pointLocation(this.transform.size)); if (this.transform.angle || this.transform.pitch) { bounds.extend(this.transform.pointLocation(new Point(this.transform.size.x, 0))); bounds.extend(this.transform.pointLocation(new Point(0, this.transform.size.y))); } - return bounds; }, - - /** - * Set constraint on the map's geographical bounds. Pan or zoom operations that would result in - * displaying regions that fall outside of the bounds instead result in displaying the map at the - * closest point and/or zoom level of the requested operation that is within the max bounds. - * - * @param {LngLatBounds | Array> | null | undefined} lnglatbounds Desired max bounds of the map. If null or undefined, function removes any bounds constraints on the map. - * @returns {Map} `this` - */ setMaxBounds: function (lnglatbounds) { if (lnglatbounds) { var b = LngLatBounds.convert(lnglatbounds); - this.transform.lngRange = [b.getWest(), b.getEast()]; - this.transform.latRange = [b.getSouth(), b.getNorth()]; + this.transform.lngRange = [ + b.getWest(), + b.getEast() + ]; + this.transform.latRange = [ + b.getSouth(), + b.getNorth() + ]; this.transform._constrain(); this._update(); } else if (lnglatbounds === null || lnglatbounds === undefined) { @@ -56951,120 +56808,74 @@ util.extend(Map.prototype, /** @lends Map.prototype */{ this._update(); } return this; - }, - /** - * Set the map's minimum zoom level, and zooms map to that level if it is - * currently below it. If no parameter provided, unsets the current - * minimum zoom (sets it to 0) - * - * @param {number} minZoom Minimum zoom level. Must be between 0 and 20. - * @returns {Map} `this - */ - setMinZoom: function(minZoom) { - + setMinZoom: function (minZoom) { minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom; - if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) { this.transform.minZoom = minZoom; this._update(); - - if (this.getZoom() < minZoom) this.setZoom(minZoom); - + if (this.getZoom() < minZoom) + this.setZoom(minZoom); return this; - - } else throw new Error('minZoom must be between ' + defaultMinZoom + ' and the current maxZoom, inclusive'); + } else + throw new Error('minZoom must be between ' + defaultMinZoom + ' and the current maxZoom, inclusive'); }, - - /** - * Set the map's maximum zoom level, and zooms map to that level if it is - * currently above it. If no parameter provided, unsets the current - * maximum zoom (sets it to 20) - * @param {number} maxZoom Maximum zoom level. Must be between 0 and 20. - * @returns {Map} `this` - */ - setMaxZoom: function(maxZoom) { - + setMaxZoom: function (maxZoom) { maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom; - if (maxZoom >= this.transform.minZoom && maxZoom <= defaultMaxZoom) { this.transform.maxZoom = maxZoom; this._update(); - - if (this.getZoom() > maxZoom) this.setZoom(maxZoom); - + if (this.getZoom() > maxZoom) + this.setZoom(maxZoom); return this; - - } else throw new Error('maxZoom must be between the current minZoom and ' + defaultMaxZoom + ', inclusive'); + } else + throw new Error('maxZoom must be between the current minZoom and ' + defaultMaxZoom + ', inclusive'); }, - /** - * Get pixel coordinates relative to the map container, given a geographical - * location. - * - * @param {LngLat} lnglat - * @returns {Object} `x` and `y` coordinates - */ - project: function(lnglat) { + project: function (lnglat) { return this.transform.locationPoint(LngLat.convert(lnglat)); }, - - /** - * Get geographical coordinates, given pixel coordinates. - * - * @param {Array} point [x, y] pixel coordinates - * @returns {LngLat} - */ - unproject: function(point) { + unproject: function (point) { return this.transform.pointLocation(Point.convert(point)); }, - - /** - * Query rendered features within a point or rectangle. - * - * @param {Point|Array|Array|Array>} [pointOrBox] Either [x, y] pixel coordinates of a point, or [[x1, y1], [x2, y2]] pixel coordinates of opposite corners of bounding rectangle. Optional: use entire viewport if omitted. - * @param {Object} params - * @param {Array} [params.layers] Only query features from layers with these layer IDs. - * @param {Array} [params.filter] A mapbox-gl-style-spec filter. - * - * @returns {Array} features - An array of [GeoJSON](http://geojson.org/) features - * matching the query parameters. The GeoJSON properties of each feature are taken from - * the original source. Each feature object also contains a top-level `layer` - * property whose value is an object representing the style layer to which the - * feature belongs. Layout and paint properties in this object contain values - * which are fully evaluated for the given zoom level and feature. - * - * @example - * var features = map.queryRenderedFeatures([20, 35], { layers: ['my-layer-name'] }); - * - * @example - * var features = map.queryRenderedFeatures([[10, 20], [30, 50]], { layers: ['my-layer-name'] }); - */ - queryRenderedFeatures: function(pointOrBox, params) { - if (!(pointOrBox instanceof Point || Array.isArray(pointOrBox))) { - params = pointOrBox; - pointOrBox = undefined; + queryRenderedFeatures: function () { + var params = {}; + var geometry; + if (arguments.length === 2) { + geometry = arguments[0]; + params = arguments[1]; + } else if (arguments.length === 1 && isPointLike(arguments[0])) { + geometry = arguments[0]; + } else if (arguments.length === 1) { + params = arguments[0]; + } + return this.style.queryRenderedFeatures(this._makeQueryGeometry(geometry), params, this.transform.zoom, this.transform.angle); + function isPointLike(input) { + return input instanceof Point || Array.isArray(input); } - var queryGeometry = this._makeQueryGeometry(pointOrBox); - return this.style.queryRenderedFeatures(queryGeometry, params, this.transform.zoom, this.transform.angle); }, - - _makeQueryGeometry: function(pointOrBox) { + _makeQueryGeometry: function (pointOrBox) { if (pointOrBox === undefined) { - // bounds was omitted: use full viewport pointOrBox = [ - Point.convert([0, 0]), - Point.convert([this.transform.width, this.transform.height]) + Point.convert([ + 0, + 0 + ]), + Point.convert([ + this.transform.width, + this.transform.height + ]) ]; } - var queryGeometry; var isPoint = pointOrBox instanceof Point || typeof pointOrBox[0] === 'number'; - if (isPoint) { var point = Point.convert(pointOrBox); queryGeometry = [point]; } else { - var box = [Point.convert(pointOrBox[0]), Point.convert(pointOrBox[1])]; + var box = [ + Point.convert(pointOrBox[0]), + Point.convert(pointOrBox[1]) + ]; queryGeometry = [ box[0], new Point(box[1].x, box[0].y), @@ -57073,682 +56884,395 @@ util.extend(Map.prototype, /** @lends Map.prototype */{ box[0] ]; } - - queryGeometry = queryGeometry.map(function(p) { + queryGeometry = queryGeometry.map(function (p) { return this.transform.pointCoordinate(p); }.bind(this)); - return queryGeometry; }, - - /** - * Get data from vector tiles as an array of GeoJSON Features. - * - * @param {string} sourceID source ID - * @param {Object} params - * @param {string} [params.sourceLayer] The name of the vector tile layer to get features from. - * @param {Array} [params.filter] A mapbox-gl-style-spec filter. - * - * @returns {Array} features - An array of [GeoJSON](http://geojson.org/) features matching the query parameters. The GeoJSON properties of each feature are taken from the original source. Each feature object also contains a top-level `layer` property whose value is an object representing the style layer to which the feature belongs. Layout and paint properties in this object contain values which are fully evaluated for the given zoom level and feature. - */ - querySourceFeatures: function(sourceID, params) { + querySourceFeatures: function (sourceID, params) { return this.style.querySourceFeatures(sourceID, params); }, - - /** - * Replaces the map's style object with a new value. Unlike the `style` - * option in the Map constructor, this method only accepts an object - * of a new style, not a URL string. - * - * @param {Object} style A style object formatted as JSON - * @returns {Map} `this` - */ - setStyle: function(style) { + setStyle: function (style) { if (this.style) { - this.style - .off('load', this._onStyleLoad) - .off('error', this._forwardStyleEvent) - .off('change', this._onStyleChange) - .off('source.add', this._onSourceAdd) - .off('source.remove', this._onSourceRemove) - .off('source.load', this._onSourceUpdate) - .off('source.error', this._forwardSourceEvent) - .off('source.change', this._onSourceUpdate) - .off('layer.add', this._forwardLayerEvent) - .off('layer.remove', this._forwardLayerEvent) - .off('layer.error', this._forwardLayerEvent) - .off('tile.add', this._forwardTileEvent) - .off('tile.remove', this._forwardTileEvent) - .off('tile.load', this._update) - .off('tile.error', this._forwardTileEvent) - .off('tile.stats', this._forwardTileEvent) - ._remove(); - + this.style.off('load', this._onStyleLoad).off('error', this._forwardStyleEvent).off('change', this._onStyleChange).off('source.add', this._onSourceAdd).off('source.remove', this._onSourceRemove).off('source.load', this._onSourceUpdate).off('source.error', this._forwardSourceEvent).off('source.change', this._onSourceUpdate).off('layer.add', this._forwardLayerEvent).off('layer.remove', this._forwardLayerEvent).off('layer.error', this._forwardLayerEvent).off('tile.add', this._forwardTileEvent).off('tile.remove', this._forwardTileEvent).off('tile.load', this._update).off('tile.error', this._forwardTileEvent).off('tile.stats', this._forwardTileEvent)._remove(); this.off('rotate', this.style._redoPlacement); this.off('pitch', this.style._redoPlacement); } - if (!style) { this.style = null; return this; } else if (style instanceof Style) { this.style = style; } else { - this.style = new Style(style, this.animationLoop); - } - - this.style - .on('load', this._onStyleLoad) - .on('error', this._forwardStyleEvent) - .on('change', this._onStyleChange) - .on('source.add', this._onSourceAdd) - .on('source.remove', this._onSourceRemove) - .on('source.load', this._onSourceUpdate) - .on('source.error', this._forwardSourceEvent) - .on('source.change', this._onSourceUpdate) - .on('layer.add', this._forwardLayerEvent) - .on('layer.remove', this._forwardLayerEvent) - .on('layer.error', this._forwardLayerEvent) - .on('tile.add', this._forwardTileEvent) - .on('tile.remove', this._forwardTileEvent) - .on('tile.load', this._update) - .on('tile.error', this._forwardTileEvent) - .on('tile.stats', this._forwardTileEvent); - + this.style = new Style(style, this.animationLoop, this._workerCount); + } + this.style.on('load', this._onStyleLoad).on('error', this._forwardStyleEvent).on('change', this._onStyleChange).on('source.add', this._onSourceAdd).on('source.remove', this._onSourceRemove).on('source.load', this._onSourceUpdate).on('source.error', this._forwardSourceEvent).on('source.change', this._onSourceUpdate).on('layer.add', this._forwardLayerEvent).on('layer.remove', this._forwardLayerEvent).on('layer.error', this._forwardLayerEvent).on('tile.add', this._forwardTileEvent).on('tile.remove', this._forwardTileEvent).on('tile.load', this._update).on('tile.error', this._forwardTileEvent).on('tile.stats', this._forwardTileEvent); this.on('rotate', this.style._redoPlacement); this.on('pitch', this.style._redoPlacement); - return this; }, - - /** - * Get a style object that can be used to recreate the map's style. - * - * @returns {Object} style - */ - getStyle: function() { - return this.style.serialize(); + getStyle: function () { + if (this.style) { + return this.style.serialize(); + } }, - - /** - * Add a source to the map style. - * - * @param {string} id ID of the source. Must not be used by any existing source. - * @param {Object} source source specification, following the - * [Mapbox GL Style Reference](https://www.mapbox.com/mapbox-gl-style-spec/#sources) - * @fires source.add - * @returns {Map} `this` - */ - addSource: function(id, source) { + addSource: function (id, source) { this.style.addSource(id, source); this._update(true); return this; }, - - /** - * Remove an existing source from the map style. - * - * @param {string} id ID of the source to remove - * @fires source.remove - * @returns {Map} `this` - */ - removeSource: function(id) { + addSourceType: function (name, SourceType, callback) { + return this.style.addSourceType(name, SourceType, callback); + }, + removeSource: function (id) { this.style.removeSource(id); this._update(true); return this; }, - - /** - * Return the style source object with the given `id`. - * - * @param {string} id source ID - * @returns {Object} - */ - getSource: function(id) { + getSource: function (id) { return this.style.getSource(id); }, - - /** - * Add a layer to the map style. The layer will be inserted before the layer with - * ID `before`, or appended if `before` is omitted. - * @param {StyleLayer|Object} layer - * @param {string=} before ID of an existing layer to insert before - * @fires layer.add - * @returns {Map} `this` - */ - addLayer: function(layer, before) { + addLayer: function (layer, before) { this.style.addLayer(layer, before); this._update(true); return this; }, - - /** - * Remove the layer with the given `id` from the map. Any layers which refer to the - * specified layer via a `ref` property are also removed. - * - * @param {string} id layer id - * @throws {Error} if no layer with the given `id` exists - * @fires layer.remove - * @returns {Map} `this` - */ - removeLayer: function(id) { + removeLayer: function (id) { this.style.removeLayer(id); this._update(true); return this; }, - - /** - * Return the style layer object with the given `id`. - * - * @param {string} id layer id - * @returns {?Object} a layer, if one with the given `id` exists - */ - getLayer: function(id) { + getLayer: function (id) { return this.style.getLayer(id); }, - - /** - * Set the filter for a given style layer. - * - * @param {string} layer ID of a layer - * @param {Array} filter filter specification, as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#types-filter) - * @returns {Map} `this` - * @example - * map.setFilter('my-layer', ['==', 'name', 'USA']); - */ - setFilter: function(layer, filter) { + setFilter: function (layer, filter) { this.style.setFilter(layer, filter); this._update(true); return this; }, - - /** - * Set the zoom extent for a given style layer. - * - * @param {string} layerId ID of a layer - * @param {number} minzoom minimum zoom extent - * @param {number} maxzoom maximum zoom extent - * @returns {Map} `this` - * @example - * map.setLayerZoomRange('my-layer', 2, 5); - */ - setLayerZoomRange: function(layerId, minzoom, maxzoom) { + setLayerZoomRange: function (layerId, minzoom, maxzoom) { this.style.setLayerZoomRange(layerId, minzoom, maxzoom); this._update(true); return this; }, - - /** - * Get the filter for a given style layer. - * - * @param {string} layer ID of a layer - * @returns {Array} filter specification, as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#filter) - */ - getFilter: function(layer) { + getFilter: function (layer) { return this.style.getFilter(layer); }, - - /** - * Set the value of a paint property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a paint property - * @param {*} value value for the paint propery; must have the type appropriate for the property as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/) - * @param {string=} klass optional class specifier for the property - * @returns {Map} `this` - * @example - * map.setPaintProperty('my-layer', 'fill-color', '#faafee'); - */ - setPaintProperty: function(layer, name, value, klass) { + setPaintProperty: function (layer, name, value, klass) { this.style.setPaintProperty(layer, name, value, klass); this._update(true); return this; }, - - /** - * Get the value of a paint property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a paint property - * @param {string=} klass optional class specifier for the property - * @returns {*} value for the paint propery - */ - getPaintProperty: function(layer, name, klass) { + getPaintProperty: function (layer, name, klass) { return this.style.getPaintProperty(layer, name, klass); }, - - /** - * Set the value of a layout property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a layout property - * @param {*} value value for the layout propery; must have the type appropriate for the property as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/) - * @returns {Map} `this` - * @example - * map.setLayoutProperty('my-layer', 'visibility', 'none'); - */ - setLayoutProperty: function(layer, name, value) { + setLayoutProperty: function (layer, name, value) { this.style.setLayoutProperty(layer, name, value); this._update(true); return this; }, - - /** - * Get the value of a layout property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a layout property - * @param {string=} klass optional class specifier for the property - * @returns {*} value for the layout propery - */ - getLayoutProperty: function(layer, name) { + getLayoutProperty: function (layer, name) { return this.style.getLayoutProperty(layer, name); }, - - /** - * Get the Map's container as an HTML element - * @returns {HTMLElement} container - */ - getContainer: function() { + getContainer: function () { return this._container; }, - - /** - * Get the container for the map `canvas` element. - * - * If you want to add non-GL overlays to the map, you should append them to this element. This - * is the element to which event bindings for map interactivity such as panning and zooming are - * attached. It will receive bubbled events for child elements such as the `canvas`, but not for - * map controls. - * - * @returns {HTMLElement} container - */ - getCanvasContainer: function() { + getCanvasContainer: function () { return this._canvasContainer; }, - - /** - * Get the Map's canvas as an HTML canvas - * @returns {HTMLElement} canvas - */ - getCanvas: function() { + getCanvas: function () { return this._canvas.getElement(); }, - - _setupContainer: function() { + _setupContainer: function () { var container = this._container; container.classList.add('mapboxgl-map'); - var canvasContainer = this._canvasContainer = DOM.create('div', 'mapboxgl-canvas-container', container); if (this._interactive) { canvasContainer.classList.add('mapboxgl-interactive'); } this._canvas = new Canvas(this, canvasContainer); - var controlContainer = this._controlContainer = DOM.create('div', 'mapboxgl-control-container', container); var corners = this._controlCorners = {}; - ['top-left', 'top-right', 'bottom-left', 'bottom-right'].forEach(function (pos) { + [ + 'top-left', + 'top-right', + 'bottom-left', + 'bottom-right' + ].forEach(function (pos) { corners[pos] = DOM.create('div', 'mapboxgl-ctrl-' + pos, controlContainer); }); }, - - _setupPainter: function() { + _setupPainter: function () { var gl = this._canvas.getWebGLContext({ failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer }); - if (!gl) { - console.error('Failed to initialize WebGL'); + this.fire('error', { error: new Error('Failed to initialize WebGL') }); return; } - this.painter = new Painter(gl, this.transform); }, - - /** - * WebGL Context Lost event. - * - * @event webglcontextlost - * @memberof Map - * @instance - * @type {Object} - * @property {Event} originalEvent the original DOM event - */ - _contextLost: function(event) { + _contextLost: function (event) { event.preventDefault(); if (this._frameId) { browser.cancelFrame(this._frameId); } - this.fire("webglcontextlost", {originalEvent: event}); + this.fire('webglcontextlost', { originalEvent: event }); }, - - /** - * WebGL Context Restored event. - * - * @event webglcontextrestored - * @memberof Map - * @instance - * @type {Object} - */ - _contextRestored: function(event) { + _contextRestored: function (event) { this._setupPainter(); this.resize(); this._update(); - this.fire("webglcontextrestored", {originalEvent: event}); + this.fire('webglcontextrestored', { originalEvent: event }); }, - - /** - * Is this map fully loaded? If the style isn't loaded - * or it has a change to the sources or style that isn't - * propagated to its style, return false. - * - * @returns {boolean} whether the map is loaded - */ - loaded: function() { + loaded: function () { if (this._styleDirty || this._sourcesDirty) return false; if (!this.style || !this.style.loaded()) return false; return true; }, - - /** - * Update this map's style and sources, and re-render the map. - * - * @param {boolean} updateStyle mark the map's style for reprocessing as - * well as its sources - * @returns {Map} this - * @private - */ - _update: function(updateStyle) { - if (!this.style) return this; - + _update: function (updateStyle) { + if (!this.style) + return this; this._styleDirty = this._styleDirty || updateStyle; this._sourcesDirty = true; - this._rerender(); - return this; }, - - /** - * Call when a (re-)render of the map is required, e.g. when the - * user panned or zoomed,f or new data is available. - * @returns {Map} this - * @private - */ - _render: function() { - if (this.style && this._styleDirty) { - this._styleDirty = false; - this.style.update(this._classes, this._classOptions); - this._classOptions = null; - this.style._recalculate(this.transform.zoom); - } - - if (this.style && this._sourcesDirty) { - this._sourcesDirty = false; - this.style._updateSources(this.transform); - } - - this.painter.render(this.style, { - debug: this.showTileBoundaries, - showOverdrawInspector: this._showOverdrawInspector, - vertices: this.vertices, - rotating: this.rotating, - zooming: this.zooming - }); - - this.fire('render'); - - if (this.loaded() && !this._loaded) { - this._loaded = true; - this.fire('load'); - } - - this._frameId = null; - - if (!this.animationLoop.stopped()) { - this._styleDirty = true; - } - - if (this._sourcesDirty || this._repaint || !this.animationLoop.stopped()) { - this._rerender(); + _render: function () { + try { + if (this.style && this._styleDirty) { + this._styleDirty = false; + this.style.update(this._classes, this._classOptions); + this._classOptions = null; + this.style._recalculate(this.transform.zoom); + } + if (this.style && this._sourcesDirty) { + this._sourcesDirty = false; + this.style._updateSources(this.transform); + } + this.painter.render(this.style, { + debug: this.showTileBoundaries, + showOverdrawInspector: this._showOverdrawInspector, + vertices: this.vertices, + rotating: this.rotating, + zooming: this.zooming + }); + this.fire('render'); + if (this.loaded() && !this._loaded) { + this._loaded = true; + this.fire('load'); + } + this._frameId = null; + if (!this.animationLoop.stopped()) { + this._styleDirty = true; + } + if (this._sourcesDirty || this._repaint || !this.animationLoop.stopped()) { + this._rerender(); + } + } catch (error) { + this.fire('error', { error: error }); } - return this; }, - - /** - * Destroys the map's underlying resources, including web workers and DOM elements. Afterwards, - * you must not call any further methods on this Map instance. - * - * @returns {undefined} - */ - remove: function() { - if (this._hash) this._hash.remove(); + remove: function () { + if (this._hash) + this._hash.remove(); browser.cancelFrame(this._frameId); this.setStyle(null); if (typeof window !== 'undefined') { window.removeEventListener('resize', this._onWindowResize, false); } + var extension = this.painter.gl.getExtension('WEBGL_lose_context'); + if (extension) + extension.loseContext(); removeNode(this._canvasContainer); removeNode(this._controlContainer); this._container.classList.remove('mapboxgl-map'); }, - - /** - * A default error handler for `style.error`, `source.error`, `layer.error`, - * and `tile.error` events. - * It logs the error via `console.error`. - * - * @example - * // Disable the default error handler - * map.off('style.error', map.onError); - * map.off('source.error', map.onError); - * map.off('tile.error', map.onError); - * map.off('layer.error', map.onError); - */ - onError: function(e) { - console.error(e.error); - }, - - _rerender: function() { + _rerender: function () { if (this.style && !this._frameId) { this._frameId = browser.frame(this._render); } }, - - _forwardStyleEvent: function(e) { - this.fire('style.' + e.type, util.extend({style: e.target}, e)); + _forwardStyleEvent: function (e) { + this.fire('style.' + e.type, util.extend({ style: e.target }, e)); }, - - _forwardSourceEvent: function(e) { - this.fire(e.type, util.extend({style: e.target}, e)); + _forwardSourceEvent: function (e) { + this.fire(e.type, util.extend({ style: e.target }, e)); }, - - _forwardLayerEvent: function(e) { - this.fire(e.type, util.extend({style: e.target}, e)); + _forwardLayerEvent: function (e) { + this.fire(e.type, util.extend({ style: e.target }, e)); }, - - _forwardTileEvent: function(e) { - this.fire(e.type, util.extend({style: e.target}, e)); + _forwardTileEvent: function (e) { + this.fire(e.type, util.extend({ style: e.target }, e)); }, - - _onStyleLoad: function(e) { + _onStyleLoad: function (e) { if (this.transform.unmodified) { this.jumpTo(this.style.stylesheet); } - this.style.update(this._classes, {transition: false}); + this.style.update(this._classes, { transition: false }); this._forwardStyleEvent(e); }, - - _onStyleChange: function(e) { + _onStyleChange: function (e) { this._update(true); this._forwardStyleEvent(e); }, - - _onSourceAdd: function(e) { + _onSourceAdd: function (e) { var source = e.source; if (source.onAdd) source.onAdd(this); this._forwardSourceEvent(e); }, - - _onSourceRemove: function(e) { + _onSourceRemove: function (e) { var source = e.source; if (source.onRemove) source.onRemove(this); this._forwardSourceEvent(e); }, - - _onSourceUpdate: function(e) { + _onSourceUpdate: function (e) { this._update(); this._forwardSourceEvent(e); }, - - _onWindowResize: function() { - this.stop().resize()._update(); + _onWindowOnline: function () { + this._update(); + }, + _onWindowResize: function () { + if (this._trackResize) { + this.stop().resize()._update(); + } } }); - -util.extendAll(Map.prototype, /** @lends Map.prototype */{ - - /** - * Draw an outline around each rendered tile for debugging. - * - * @name showTileBoundaries - * @type {boolean} - */ +util.extendAll(Map.prototype, { _showTileBoundaries: false, - get showTileBoundaries() { return this._showTileBoundaries; }, + get showTileBoundaries() { + return this._showTileBoundaries; + }, set showTileBoundaries(value) { - if (this._showTileBoundaries === value) return; + if (this._showTileBoundaries === value) + return; this._showTileBoundaries = value; this._update(); }, - - /** - * Draw boxes around all symbols in the data source, showing which were - * rendered and which were hidden due to collisions with other symbols for - * style debugging. - * - * @name showCollisionBoxes - * @type {boolean} - */ _showCollisionBoxes: false, - get showCollisionBoxes() { return this._showCollisionBoxes; }, + get showCollisionBoxes() { + return this._showCollisionBoxes; + }, set showCollisionBoxes(value) { - if (this._showCollisionBoxes === value) return; + if (this._showCollisionBoxes === value) + return; this._showCollisionBoxes = value; this.style._redoPlacement(); }, - - /* - * Show how many times each fragment has been shaded. White fragments have - * been shaded 8 or more times. Black fragments have been shaded 0 times. - * - * @name showOverdraw - * @type {boolean} - */ _showOverdrawInspector: false, - get showOverdrawInspector() { return this._showOverdrawInspector; }, + get showOverdrawInspector() { + return this._showOverdrawInspector; + }, set showOverdrawInspector(value) { - if (this._showOverdrawInspector === value) return; + if (this._showOverdrawInspector === value) + return; this._showOverdrawInspector = value; this._update(); }, - - /** - * Enable continuous repaint to analyze performance. - * - * @name repaint - * @type {boolean} - */ _repaint: false, - get repaint() { return this._repaint; }, - set repaint(value) { this._repaint = value; this._update(); }, - - // show vertices + get repaint() { + return this._repaint; + }, + set repaint(value) { + this._repaint = value; + this._update(); + }, _vertices: false, - get vertices() { return this._vertices; }, - set vertices(value) { this._vertices = value; this._update(); } + get vertices() { + return this._vertices; + }, + set vertices(value) { + this._vertices = value; + this._update(); + } }); - function removeNode(node) { if (node.parentNode) { node.parentNode.removeChild(node); } } - -/** - * Options common to Map#addClass, Map#removeClass, and Map#setClasses, controlling - * whether or not to smoothly transition property changes triggered by the class change. - * - * @typedef {Object} StyleOptions - * @property {boolean} transition - */ - - /** - * This event is fired whenever the map is drawn to the screen because of - * - * - a change in map position, zoom, pitch, or bearing - * - a change to the map style - * - a change to a GeoJSON source - * - a vector tile, GeoJSON file, glyph, or sprite being loaded - * - * @event render - * @memberof Map - * @instance - */ - -},{"../geo/lng_lat":256,"../geo/lng_lat_bounds":257,"../geo/transform":258,"../render/painter":271,"../style/animation_loop":287,"../style/style":290,"../util/browser":335,"../util/canvas":336,"../util/dom":338,"../util/evented":341,"../util/util":349,"./camera":317,"./control/attribution":318,"./hash":329,"./interaction":330,"point-geometry":404}],332:[function(require,module,exports){ +},{"../geo/lng_lat":263,"../geo/lng_lat_bounds":264,"../geo/transform":265,"../render/painter":279,"../style/animation_loop":299,"../style/style":302,"../util/browser":350,"../util/canvas":351,"../util/dom":352,"../util/evented":358,"../util/util":366,"./bind_handlers":331,"./camera":332,"./control/attribution":333,"./hash":344,"point-geometry":424}],346:[function(require,module,exports){ +'use strict'; +module.exports = Marker; +var DOM = require('../util/dom'); +var LngLat = require('../geo/lng_lat'); +var Point = require('point-geometry'); +function Marker(element, options) { + if (!element) { + element = DOM.create('div'); + } + element.classList.add('mapboxgl-marker'); + this._el = element; + this._offset = Point.convert(options && options.offset || [ + 0, + 0 + ]); + this._update = this._update.bind(this); +} +Marker.prototype = { + addTo: function (map) { + this.remove(); + this._map = map; + map.getCanvasContainer().appendChild(this._el); + map.on('move', this._update); + this._update(); + return this; + }, + remove: function () { + if (this._map) { + this._map.off('move', this._update); + this._map = null; + } + var parent = this._el.parentNode; + if (parent) + parent.removeChild(this._el); + return this; + }, + getLngLat: function () { + return this._lngLat; + }, + setLngLat: function (lnglat) { + this._lngLat = LngLat.convert(lnglat); + this._update(); + return this; + }, + getElement: function () { + return this._el; + }, + _update: function () { + if (!this._map) + return; + var pos = this._map.project(this._lngLat)._add(this._offset); + DOM.setTransform(this._el, 'translate(' + pos.x + 'px,' + pos.y + 'px)'); + } +}; +},{"../geo/lng_lat":263,"../util/dom":352,"point-geometry":424}],347:[function(require,module,exports){ 'use strict'; - module.exports = Popup; - var util = require('../util/util'); var Evented = require('../util/evented'); var DOM = require('../util/dom'); var LngLat = require('../geo/lng_lat'); - -/** - * Creates a popup component - * @class Popup - * @param {Object} options - * @param {boolean} options.closeButton whether to show a close button in the - * top right corner of the popup. - * @param {boolean} options.closeOnClick whether to close the popup when the - * map is clicked. - * @param {string} options.anchor - One of "top", "bottom", "left", "right", "top-left", - * "top-right", "bottom-left", or "bottom-right", describing where the popup's anchor - * relative to the coordinate set via `setLngLat`. - * @example - * var tooltip = new mapboxgl.Popup() - * .setLngLat(e.lngLat) - * .setHTML("

Hello World!

") - * .addTo(map); - */ function Popup(options) { util.setOptions(this, options); util.bindAll([ '_update', - '_onClickClose'], - this); + '_onClickClose' + ], this); } - -Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ +Popup.prototype = util.inherit(Evented, { options: { closeButton: true, closeOnClick: true }, - - /** - * Attaches the popup to a map - * @param {Map} map - * @returns {Popup} `this` - */ - addTo: function(map) { + addTo: function (map) { this._map = map; this._map.on('move', this._update); if (this.options.closeOnClick) { @@ -57757,137 +57281,75 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ this._update(); return this; }, - - /** - * Removes the popup from a map - * @example - * var popup = new mapboxgl.Popup().addTo(map); - * popup.remove(); - * @returns {Popup} `this` - */ - remove: function() { + remove: function () { if (this._content && this._content.parentNode) { this._content.parentNode.removeChild(this._content); } - if (this._container) { this._container.parentNode.removeChild(this._container); delete this._container; } - if (this._map) { this._map.off('move', this._update); this._map.off('click', this._onClickClose); delete this._map; } - + this.fire('close'); return this; }, - - /** - * Get the popup's geographical location - * @returns {LngLat} - */ - getLngLat: function() { + getLngLat: function () { return this._lngLat; }, - - /** - * Set the popup's geographical position and move it. - * @param {LngLat} lnglat - * @returns {Popup} `this` - */ - setLngLat: function(lnglat) { + setLngLat: function (lnglat) { this._lngLat = LngLat.convert(lnglat); this._update(); return this; }, - - /** - * Fill a popup element with text only content. This creates a text node - * in the DOM, so it cannot end up appending raw HTML. Use this method - * if you want an added level of security against XSS if the popup - * content is user-provided. - * @param {string} text - * @returns {Popup} `this` - * @example - * var tooltip = new mapboxgl.Popup() - * .setLngLat(e.lngLat) - * .setText('Hello, world!') - * .addTo(map); - */ - setText: function(text) { + setText: function (text) { return this.setDOMContent(document.createTextNode(text)); }, - - /** - * Fill a popup element with HTML content, provided as a string. - * @param {string} html - * @returns {Popup} `this` - */ - setHTML: function(html) { + setHTML: function (html) { var frag = document.createDocumentFragment(); var temp = document.createElement('body'), child; temp.innerHTML = html; while (true) { child = temp.firstChild; - if (!child) break; + if (!child) + break; frag.appendChild(child); } - return this.setDOMContent(frag); }, - - /** - * Fill a popup element with DOM content - * @param {Node} htmlNode Popup content as a DOM node - * @returns {Popup} `this` - * @example - * // create an element with the popup content - * var div = document.createElement('div'); - * div.innerHTML = 'Hello, world!'; - * var tooltip = new mapboxgl.Popup() - * .setLngLat(e.lngLat) - * .setDOMContent(div) - * .addTo(map); - */ - setDOMContent: function(htmlNode) { + setDOMContent: function (htmlNode) { this._createContent(); this._content.appendChild(htmlNode); this._update(); return this; }, - - _createContent: function() { + _createContent: function () { if (this._content && this._content.parentNode) { this._content.parentNode.removeChild(this._content); } - this._content = DOM.create('div', 'mapboxgl-popup-content', this._container); - if (this.options.closeButton) { this._closeButton = DOM.create('button', 'mapboxgl-popup-close-button', this._content); + this._closeButton.type = 'button'; this._closeButton.innerHTML = '×'; this._closeButton.addEventListener('click', this._onClickClose); } }, - - _update: function() { - if (!this._map || !this._lngLat || !this._content) { return; } - + _update: function () { + if (!this._map || !this._lngLat || !this._content) { + return; + } if (!this._container) { this._container = DOM.create('div', 'mapboxgl-popup', this._map.getContainer()); - this._tip = DOM.create('div', 'mapboxgl-popup-tip', this._container); + this._tip = DOM.create('div', 'mapboxgl-popup-tip', this._container); this._container.appendChild(this._content); } - - var pos = this._map.project(this._lngLat).round(), - anchor = this.options.anchor; - + var pos = this._map.project(this._lngLat).round(), anchor = this.options.anchor; if (!anchor) { - var width = this._container.offsetWidth, - height = this._container.offsetHeight; - + var width = this._container.offsetWidth, height = this._container.offsetHeight; if (pos.y < height) { anchor = ['top']; } else if (pos.y > this._map.transform.height - height) { @@ -57895,20 +57357,17 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ } else { anchor = []; } - if (pos.x < width / 2) { anchor.push('left'); } else if (pos.x > this._map.transform.width - width / 2) { anchor.push('right'); } - if (anchor.length === 0) { anchor = 'bottom'; } else { anchor = anchor.join('-'); } } - var anchorTranslate = { 'top': 'translate(-50%,0)', 'top-left': 'translate(0,0)', @@ -57919,36 +57378,20 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ 'left': 'translate(0,-50%)', 'right': 'translate(-100%,-50%)' }; - var classList = this._container.classList; for (var key in anchorTranslate) { classList.remove('mapboxgl-popup-anchor-' + key); } classList.add('mapboxgl-popup-anchor-' + anchor); - DOM.setTransform(this._container, anchorTranslate[anchor] + ' translate(' + pos.x + 'px,' + pos.y + 'px)'); }, - - _onClickClose: function() { + _onClickClose: function () { this.remove(); } }); - -},{"../geo/lng_lat":256,"../util/dom":338,"../util/evented":341,"../util/util":349}],333:[function(require,module,exports){ +},{"../geo/lng_lat":263,"../util/dom":352,"../util/evented":358,"../util/util":366}],348:[function(require,module,exports){ 'use strict'; - module.exports = Actor; - -/** - * An implementation of the [Actor design pattern](http://en.wikipedia.org/wiki/Actor_model) - * that maintains the relationship between asynchronous tasks and the objects - * that spin them off - in this case, tasks like parsing parts of styles, - * owned by the styles - * - * @param {WebWorker} target - * @param {WebWorker} parent - * @private - */ function Actor(target, parent) { this.target = target; this.parent = parent; @@ -57957,59 +57400,53 @@ function Actor(target, parent) { this.receive = this.receive.bind(this); this.target.addEventListener('message', this.receive, false); } - -Actor.prototype.receive = function(message) { - var data = message.data, - callback; - +Actor.prototype.receive = function (message) { + var data = message.data, id = data.id, callback; if (data.type === '') { callback = this.callbacks[data.id]; delete this.callbacks[data.id]; - callback(data.error || null, data.data); - } else if (typeof data.id !== 'undefined') { - var id = data.id; - this.parent[data.type](data.data, function(err, data, buffers) { - this.postMessage({ - type: '', - id: String(id), - error: err ? String(err) : null, - data: data - }, buffers); - }.bind(this)); + if (callback) + callback(data.error || null, data.data); + } else if (typeof data.id !== 'undefined' && this.parent[data.type]) { + this.parent[data.type](data.data, done.bind(this)); + } else if (typeof data.id !== 'undefined' && this.parent.workerSources) { + var keys = data.type.split('.'); + this.parent.workerSources[keys[0]][keys[1]](data.data, done.bind(this)); } else { this.parent[data.type](data.data); } + function done(err, data, buffers) { + this.postMessage({ + type: '', + id: String(id), + error: err ? String(err) : null, + data: data + }, buffers); + } }; - -Actor.prototype.send = function(type, data, callback, buffers) { +Actor.prototype.send = function (type, data, callback, buffers) { var id = null; - if (callback) this.callbacks[id = this.callbackID++] = callback; - this.postMessage({ type: type, id: String(id), data: data }, buffers); + if (callback) + this.callbacks[id = this.callbackID++] = callback; + this.postMessage({ + type: type, + id: String(id), + data: data + }, buffers); }; - -/** - * Wrapped postMessage API that abstracts around IE's lack of - * `transferList` support. - * - * @param {Object} message - * @param {Object} transferList - * @private - */ -Actor.prototype.postMessage = function(message, transferList) { +Actor.prototype.postMessage = function (message, transferList) { this.target.postMessage(message, transferList); }; - -},{}],334:[function(require,module,exports){ +},{}],349:[function(require,module,exports){ 'use strict'; - -exports.getJSON = function(url, callback) { +exports.getJSON = function (url, callback) { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.setRequestHeader('Accept', 'application/json'); - xhr.onerror = function(e) { + xhr.onerror = function (e) { callback(e); }; - xhr.onload = function() { + xhr.onload = function () { if (xhr.status >= 200 && xhr.status < 300 && xhr.response) { var data; try { @@ -58025,15 +57462,14 @@ exports.getJSON = function(url, callback) { xhr.send(); return xhr; }; - -exports.getArrayBuffer = function(url, callback) { +exports.getArrayBuffer = function (url, callback) { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = 'arraybuffer'; - xhr.onerror = function(e) { + xhr.onerror = function (e) { callback(e); }; - xhr.onload = function() { + xhr.onload = function () { if (xhr.status >= 200 && xhr.status < 300 && xhr.response) { callback(null, xhr.response); } else { @@ -58043,24 +57479,23 @@ exports.getArrayBuffer = function(url, callback) { xhr.send(); return xhr; }; - function sameOrigin(url) { var a = document.createElement('a'); a.href = url; return a.protocol === document.location.protocol && a.host === document.location.host; } - -exports.getImage = function(url, callback) { - return exports.getArrayBuffer(url, function(err, imgData) { - if (err) return callback(err); +exports.getImage = function (url, callback) { + return exports.getArrayBuffer(url, function (err, imgData) { + if (err) + return callback(err); var img = new Image(); - img.onload = function() { + img.onload = function () { callback(null, img); (window.URL || window.webkitURL).revokeObjectURL(img.src); }; var blob = new Blob([new Uint8Array(imgData)], { type: 'image/png' }); img.src = (window.URL || window.webkitURL).createObjectURL(blob); - img.getData = function() { + img.getData = function () { var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); canvas.width = img.width; @@ -58071,10 +57506,9 @@ exports.getImage = function(url, callback) { return img; }); }; - -exports.getVideo = function(urls, callback) { +exports.getVideo = function (urls, callback) { var video = document.createElement('video'); - video.onloadstart = function() { + video.onloadstart = function () { callback(null, video); }; for (var i = 0; i < urls.length; i++) { @@ -58085,64 +57519,39 @@ exports.getVideo = function(urls, callback) { s.src = urls[i]; video.appendChild(s); } - video.getData = function() { return video; }; + video.getData = function () { + return video; + }; return video; }; - -},{}],335:[function(require,module,exports){ +},{}],350:[function(require,module,exports){ 'use strict'; - -/** - * Unlike js/util/browser.js, this code is written with the expectation - * of a browser environment with a global 'window' object - * @module browser - * @private - */ - -/** - * Provides a function that outputs milliseconds: either performance.now() - * or a fallback to Date.now() - */ -module.exports.now = (function() { - if (window.performance && - window.performance.now) { +exports.window = window; +module.exports.now = function () { + if (window.performance && window.performance.now) { return window.performance.now.bind(window.performance); } else { return Date.now.bind(Date); } -}()); - -var frame = window.requestAnimationFrame || - window.mozRequestAnimationFrame || - window.webkitRequestAnimationFrame || - window.msRequestAnimationFrame; - -exports.frame = function(fn) { +}(); +var frame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; +exports.frame = function (fn) { return frame(fn); }; - -var cancel = window.cancelAnimationFrame || - window.mozCancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.msCancelAnimationFrame; - -exports.cancelFrame = function(id) { +var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame; +exports.cancelFrame = function (id) { cancel(id); }; - exports.timed = function (fn, dur, ctx) { if (!dur) { fn.call(ctx, 1); return null; } - - var abort = false, - start = module.exports.now(); - + var abort = false, start = module.exports.now(); function tick(now) { - if (abort) return; + if (abort) + return; now = module.exports.now(); - if (now >= start + dur) { fn.call(ctx, 1); } else { @@ -58150,49 +57559,32 @@ exports.timed = function (fn, dur, ctx) { exports.frame(tick); } } - exports.frame(tick); - - return function() { abort = true; }; + return function () { + abort = true; + }; }; - -/** - * Test if the current browser supports Mapbox GL JS - * @param {Object} options - * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false` - * if the performance of Mapbox GL JS would be dramatically worse than - * expected (i.e. a software renderer would be used) - * @return {boolean} - */ -exports.supported = require('mapbox-gl-js-supported'); - -exports.hardwareConcurrency = navigator.hardwareConcurrency || 8; - +exports.supported = require('mapbox-gl-supported'); +exports.hardwareConcurrency = navigator.hardwareConcurrency || 4; Object.defineProperty(exports, 'devicePixelRatio', { - get: function() { return window.devicePixelRatio; } + get: function () { + return window.devicePixelRatio; + } }); - exports.supportsWebp = false; - var webpImgTest = document.createElement('img'); -webpImgTest.onload = function() { +webpImgTest.onload = function () { exports.supportsWebp = true; }; webpImgTest.src = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA='; - exports.supportsGeolocation = !!navigator.geolocation; - -},{"mapbox-gl-js-supported":375}],336:[function(require,module,exports){ +},{"mapbox-gl-supported":420}],351:[function(require,module,exports){ 'use strict'; - var util = require('../util'); -var isSupported = require('mapbox-gl-js-supported'); - +var isSupported = require('mapbox-gl-supported'); module.exports = Canvas; - function Canvas(parent, container) { this.canvas = document.createElement('canvas'); - if (parent && container) { this.canvas.style.position = 'absolute'; this.canvas.classList.add('mapboxgl-canvas'); @@ -58202,88 +57594,32 @@ function Canvas(parent, container) { container.appendChild(this.canvas); } } - -Canvas.prototype.resize = function(width, height) { +Canvas.prototype.resize = function (width, height) { var pixelRatio = window.devicePixelRatio || 1; - - // Request the required canvas size taking the pixelratio into account. this.canvas.width = pixelRatio * width; this.canvas.height = pixelRatio * height; - - // Maintain the same canvas size, potentially downscaling it for HiDPI displays this.canvas.style.width = width + 'px'; this.canvas.style.height = height + 'px'; }; - -Canvas.prototype.getWebGLContext = function(attributes) { +Canvas.prototype.getWebGLContext = function (attributes) { attributes = util.extend({}, attributes, isSupported.webGLContextAttributes); - - return this.canvas.getContext('webgl', attributes) || - this.canvas.getContext('experimental-webgl', attributes); + return this.canvas.getContext('webgl', attributes) || this.canvas.getContext('experimental-webgl', attributes); }; - -Canvas.prototype.getElement = function() { +Canvas.prototype.getElement = function () { return this.canvas; }; - -},{"../util":349,"mapbox-gl-js-supported":375}],337:[function(require,module,exports){ -'use strict'; - -var Actor = require('../actor'); -var WebWorkify = require('webworkify'); - -module.exports = Dispatcher; - -function Dispatcher(length, parent) { - this.actors = []; - this.currentActor = 0; - for (var i = 0; i < length; i++) { - var worker = new WebWorkify(require('../../source/worker')); - var actor = new Actor(worker, parent); - actor.name = "Worker " + i; - this.actors.push(actor); - } -} - -Dispatcher.prototype = { - broadcast: function(type, data) { - for (var i = 0; i < this.actors.length; i++) { - this.actors[i].send(type, data); - } - }, - - send: function(type, data, callback, targetID, buffers) { - if (typeof targetID !== 'number' || isNaN(targetID)) { - // Use round robin to send requests to web workers. - targetID = this.currentActor = (this.currentActor + 1) % this.actors.length; - } - - this.actors[targetID].send(type, data, callback, buffers); - return targetID; - }, - - remove: function() { - for (var i = 0; i < this.actors.length; i++) { - this.actors[i].target.terminate(); - } - this.actors = []; - } -}; - -},{"../../source/worker":285,"../actor":333,"webworkify":420}],338:[function(require,module,exports){ +},{"../util":366,"mapbox-gl-supported":420}],352:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - exports.create = function (tagName, className, container) { var el = document.createElement(tagName); - if (className) el.className = className; - if (container) container.appendChild(el); + if (className) + el.className = className; + if (container) + container.appendChild(el); return el; }; - var docStyle = document.documentElement.style; - function testProp(props) { for (var i = 0; i < props.length; i++) { if (props[i] in docStyle) { @@ -58291,9 +57627,12 @@ function testProp(props) { } } } - -var selectProp = testProp(['userSelect', 'MozUserSelect', 'WebkitUserSelect', 'msUserSelect']), - userSelect; +var selectProp = testProp([ + 'userSelect', + 'MozUserSelect', + 'WebkitUserSelect', + 'msUserSelect' + ]), userSelect; exports.disableDrag = function () { if (selectProp) { userSelect = docStyle[selectProp]; @@ -58305,61 +57644,98 @@ exports.enableDrag = function () { docStyle[selectProp] = userSelect; } }; - -var transformProp = testProp(['transform', 'WebkitTransform']); -exports.setTransform = function(el, value) { +var transformProp = testProp([ + 'transform', + 'WebkitTransform' +]); +exports.setTransform = function (el, value) { el.style[transformProp] = value; }; - -// Suppress the next click, but only if it's immediate. function suppressClick(e) { e.preventDefault(); e.stopPropagation(); window.removeEventListener('click', suppressClick, true); } -exports.suppressClick = function() { +exports.suppressClick = function () { window.addEventListener('click', suppressClick, true); - window.setTimeout(function() { + window.setTimeout(function () { window.removeEventListener('click', suppressClick, true); }, 0); }; - exports.mousePos = function (el, e) { var rect = el.getBoundingClientRect(); e = e.touches ? e.touches[0] : e; - return new Point( - e.clientX - rect.left - el.clientLeft, - e.clientY - rect.top - el.clientTop - ); + return new Point(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop); }; - exports.touchPos = function (el, e) { - var rect = el.getBoundingClientRect(), - points = []; + var rect = el.getBoundingClientRect(), points = []; for (var i = 0; i < e.touches.length; i++) { - points.push(new Point( - e.touches[i].clientX - rect.left - el.clientLeft, - e.touches[i].clientY - rect.top - el.clientTop - )); + points.push(new Point(e.touches[i].clientX - rect.left - el.clientLeft, e.touches[i].clientY - rect.top - el.clientTop)); + } + return points; +}; +},{"point-geometry":424}],353:[function(require,module,exports){ +'use strict'; +var WebWorkify = require('webworkify'); +module.exports = function () { + return new WebWorkify(require('../../source/worker')); +}; +},{"../../source/worker":297,"webworkify":441}],354:[function(require,module,exports){ +'use strict'; +var quickselect = require('quickselect'); +module.exports = function classifyRings(rings, maxRings) { + var len = rings.length; + if (len <= 1) + return [rings]; + var polygons = [], polygon, ccw; + for (var i = 0; i < len; i++) { + var area = calculateSignedArea(rings[i]); + if (area === 0) + continue; + rings[i].area = Math.abs(area); + if (ccw === undefined) + ccw = area < 0; + if (ccw === area < 0) { + if (polygon) + polygons.push(polygon); + polygon = [rings[i]]; + } else { + polygon.push(rings[i]); + } + } + if (polygon) + polygons.push(polygon); + if (maxRings > 1) { + for (var j = 0; j < polygons.length; j++) { + if (polygons[j].length <= maxRings) + continue; + quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas); + polygons[j] = polygons[j].slice(0, maxRings); + } + } + return polygons; +}; +function compareAreas(a, b) { + return b.area - a.area; +} +function calculateSignedArea(ring) { + var sum = 0; + for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) { + p1 = ring[i]; + p2 = ring[j]; + sum += (p2.x - p1.x) * (p1.y + p2.y); } - return points; -}; - -},{"point-geometry":404}],339:[function(require,module,exports){ + return sum; +} +},{"quickselect":425}],355:[function(require,module,exports){ 'use strict'; - module.exports = { API_URL: 'https://api.mapbox.com', REQUIRE_ACCESS_TOKEN: true }; - -},{}],340:[function(require,module,exports){ +},{}],356:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); - module.exports = DictionaryCoder; - function DictionaryCoder(strings) { this._stringToNumber = {}; this._numberToString = []; @@ -58369,59 +57745,67 @@ function DictionaryCoder(strings) { this._numberToString[i] = string; } } - -DictionaryCoder.prototype.encode = function(string) { - assert(string in this._stringToNumber); +DictionaryCoder.prototype.encode = function (string) { return this._stringToNumber[string]; }; - -DictionaryCoder.prototype.decode = function(n) { - assert(n < this._numberToString.length); +DictionaryCoder.prototype.decode = function (n) { return this._numberToString[n]; }; - -},{"assert":52}],341:[function(require,module,exports){ +},{}],357:[function(require,module,exports){ +'use strict'; +var util = require('./util'); +var Actor = require('./actor'); +var WebWorker = require('./web_worker'); +module.exports = Dispatcher; +function Dispatcher(length, parent) { + this.actors = []; + this.currentActor = 0; + for (var i = 0; i < length; i++) { + var worker = new WebWorker(); + var actor = new Actor(worker, parent); + actor.name = 'Worker ' + i; + this.actors.push(actor); + } +} +Dispatcher.prototype = { + broadcast: function (type, data, cb) { + cb = cb || function () { + }; + util.asyncAll(this.actors, function (actor, done) { + actor.send(type, data, done); + }, cb); + }, + send: function (type, data, callback, targetID, buffers) { + if (typeof targetID !== 'number' || isNaN(targetID)) { + targetID = this.currentActor = (this.currentActor + 1) % this.actors.length; + } + this.actors[targetID].send(type, data, callback, buffers); + return targetID; + }, + remove: function () { + for (var i = 0; i < this.actors.length; i++) { + this.actors[i].target.terminate(); + } + this.actors = []; + } +}; +},{"./actor":348,"./util":366,"./web_worker":353}],358:[function(require,module,exports){ 'use strict'; - var util = require('./util'); - -/** - * Methods mixed in to other classes for event capabilities. - * @mixin Evented - */ var Evented = { - - /** - * Subscribe to a specified event with a listener function the latter gets the data object that was passed to `fire` and additionally `target` and `type` properties - * - * @param {string} type Event type - * @param {Function} listener Function to be called when the event is fired - * @returns {Object} `this` - */ - on: function(type, listener) { + on: function (type, listener) { this._events = this._events || {}; this._events[type] = this._events[type] || []; this._events[type].push(listener); - return this; }, - - /** - * Remove a event listener - * - * @param {string} [type] Event type. If none is specified, remove all listeners - * @param {Function} [listener] Function to be called when the event is fired. If none is specified all listeners are removed - * @returns {Object} `this` - */ - off: function(type, listener) { + off: function (type, listener) { if (!type) { - // clear all listeners if no arguments specified delete this._events; return this; } - - if (!this.listens(type)) return this; - + if (!this.listens(type)) + return this; if (listener) { var idx = this._events[type].indexOf(listener); if (idx >= 0) { @@ -58433,123 +57817,91 @@ var Evented = { } else { delete this._events[type]; } - return this; }, - - /** - * Call a function once when an event has fired - * - * @param {string} type Event type. - * @param {Function} listener Function to be called once when the event is fired - * @returns {Object} `this` - */ - once: function(type, listener) { - var wrapper = function(data) { + once: function (type, listener) { + var wrapper = function (data) { this.off(type, wrapper); listener.call(this, data); }.bind(this); this.on(type, wrapper); return this; }, - - /** - * Fire event of a given string type with the given data object - * - * @param {string} type Event type - * @param {Object} [data] Optional data passed to the event receiver (e.g. {@link #EventData}) - * @returns {Object} `this` - */ - fire: function(type, data) { - if (!this.listens(type)) return this; - + fire: function (type, data) { + if (!this.listens(type)) { + if (util.endsWith(type, 'error')) { + console.error(data && data.error || data || 'Empty error event'); + } + return this; + } data = util.extend({}, data); - util.extend(data, {type: type, target: this}); - - // make sure adding/removing listeners inside other listeners won't cause infinite loop + util.extend(data, { + type: type, + target: this + }); var listeners = this._events[type].slice(); - for (var i = 0; i < listeners.length; i++) { listeners[i].call(this, data); } - return this; }, - - /** - * Check if an event is registered to a type - * @param {string} type Event type - * @returns {boolean} `true` if there is at least one registered listener for events of type `type` - */ - listens: function(type) { + listens: function (type) { return !!(this._events && this._events[type]); } }; - module.exports = Evented; - -},{"./util":349}],342:[function(require,module,exports){ +},{"./util":366}],359:[function(require,module,exports){ 'use strict'; - module.exports = Glyphs; - function Glyphs(pbf, end) { this.stacks = pbf.readFields(readFontstacks, [], end); } - function readFontstacks(tag, stacks, pbf) { if (tag === 1) { - var fontstack = pbf.readMessage(readFontstack, {glyphs: {}}); + var fontstack = pbf.readMessage(readFontstack, { glyphs: {} }); stacks.push(fontstack); } } - function readFontstack(tag, fontstack, pbf) { - if (tag === 1) fontstack.name = pbf.readString(); - else if (tag === 2) fontstack.range = pbf.readString(); + if (tag === 1) + fontstack.name = pbf.readString(); + else if (tag === 2) + fontstack.range = pbf.readString(); else if (tag === 3) { var glyph = pbf.readMessage(readGlyph, {}); fontstack.glyphs[glyph.id] = glyph; } } - function readGlyph(tag, glyph, pbf) { - if (tag === 1) glyph.id = pbf.readVarint(); - else if (tag === 2) glyph.bitmap = pbf.readBytes(); - else if (tag === 3) glyph.width = pbf.readVarint(); - else if (tag === 4) glyph.height = pbf.readVarint(); - else if (tag === 5) glyph.left = pbf.readSVarint(); - else if (tag === 6) glyph.top = pbf.readSVarint(); - else if (tag === 7) glyph.advance = pbf.readVarint(); + if (tag === 1) + glyph.id = pbf.readVarint(); + else if (tag === 2) + glyph.bitmap = pbf.readBytes(); + else if (tag === 3) + glyph.width = pbf.readVarint(); + else if (tag === 4) + glyph.height = pbf.readVarint(); + else if (tag === 5) + glyph.left = pbf.readSVarint(); + else if (tag === 6) + glyph.top = pbf.readSVarint(); + else if (tag === 7) + glyph.advance = pbf.readVarint(); } - -},{}],343:[function(require,module,exports){ +},{}],360:[function(require,module,exports){ 'use strict'; - module.exports = interpolate; - function interpolate(a, b, t) { - return (a * (1 - t)) + (b * t); + return a * (1 - t) + b * t; } - interpolate.number = interpolate; - -interpolate.vec2 = function(from, to, t) { +interpolate.vec2 = function (from, to, t) { return [ interpolate(from[0], to[0], t), interpolate(from[1], to[1], t) ]; }; - -/* - * Interpolate between two colors given as 4-element arrays. - * - * @param {Color} from - * @param {Color} to - * @param {number} t interpolation factor between 0 and 1 - * @returns {Color} interpolated color - */ -interpolate.color = function(from, to, t) { +interpolate.color = function (from, to, t) { return [ interpolate(from[0], to[0], t), interpolate(from[1], to[1], t), @@ -58557,22 +57909,18 @@ interpolate.color = function(from, to, t) { interpolate(from[3], to[3], t) ]; }; - -interpolate.array = function(from, to, t) { - return from.map(function(d, i) { +interpolate.array = function (from, to, t) { + return from.map(function (d, i) { return interpolate(d, to[i], t); }); }; - -},{}],344:[function(require,module,exports){ +},{}],361:[function(require,module,exports){ 'use strict'; - module.exports = { multiPolygonIntersectsBufferedMultiPoint: multiPolygonIntersectsBufferedMultiPoint, multiPolygonIntersectsMultiPolygon: multiPolygonIntersectsMultiPolygon, multiPolygonIntersectsBufferedMultiLine: multiPolygonIntersectsBufferedMultiLine }; - function multiPolygonIntersectsBufferedMultiPoint(multiPolygon, rings, radius) { for (var j = 0; j < multiPolygon.length; j++) { var polygon = multiPolygon[j]; @@ -58580,78 +57928,71 @@ function multiPolygonIntersectsBufferedMultiPoint(multiPolygon, rings, radius) { var ring = rings[i]; for (var k = 0; k < ring.length; k++) { var point = ring[k]; - if (polygonContainsPoint(polygon, point)) return true; - if (pointIntersectsBufferedLine(point, polygon, radius)) return true; + if (polygonContainsPoint(polygon, point)) + return true; + if (pointIntersectsBufferedLine(point, polygon, radius)) + return true; } } } return false; } - function multiPolygonIntersectsMultiPolygon(multiPolygonA, multiPolygonB) { - if (multiPolygonA.length === 1 && multiPolygonA[0].length === 1) { return multiPolygonContainsPoint(multiPolygonB, multiPolygonA[0][0]); } - for (var m = 0; m < multiPolygonB.length; m++) { var ring = multiPolygonB[m]; for (var n = 0; n < ring.length; n++) { - if (multiPolygonContainsPoint(multiPolygonA, ring[n])) return true; + if (multiPolygonContainsPoint(multiPolygonA, ring[n])) + return true; } } - for (var j = 0; j < multiPolygonA.length; j++) { var polygon = multiPolygonA[j]; for (var i = 0; i < polygon.length; i++) { - if (multiPolygonContainsPoint(multiPolygonB, polygon[i])) return true; + if (multiPolygonContainsPoint(multiPolygonB, polygon[i])) + return true; } - for (var k = 0; k < multiPolygonB.length; k++) { - if (lineIntersectsLine(polygon, multiPolygonB[k])) return true; + if (lineIntersectsLine(polygon, multiPolygonB[k])) + return true; } } - return false; } - function multiPolygonIntersectsBufferedMultiLine(multiPolygon, multiLine, radius) { for (var i = 0; i < multiLine.length; i++) { var line = multiLine[i]; - for (var j = 0; j < multiPolygon.length; j++) { var polygon = multiPolygon[j]; - if (polygon.length >= 3) { for (var k = 0; k < line.length; k++) { - if (polygonContainsPoint(polygon, line[k])) return true; + if (polygonContainsPoint(polygon, line[k])) + return true; } } - - if (lineIntersectsBufferedLine(polygon, line, radius)) return true; + if (lineIntersectsBufferedLine(polygon, line, radius)) + return true; } } return false; } - function lineIntersectsBufferedLine(lineA, lineB, radius) { - if (lineA.length > 1) { - if (lineIntersectsLine(lineA, lineB)) return true; - - // Check whether any point in either line is within radius of the other line + if (lineIntersectsLine(lineA, lineB)) + return true; for (var j = 0; j < lineB.length; j++) { - if (pointIntersectsBufferedLine(lineB[j], lineA, radius)) return true; + if (pointIntersectsBufferedLine(lineB[j], lineA, radius)) + return true; } } - for (var k = 0; k < lineA.length; k++) { - if (pointIntersectsBufferedLine(lineA[k], lineB, radius)) return true; + if (pointIntersectsBufferedLine(lineA[k], lineB, radius)) + return true; } - return false; } - function lineIntersectsLine(lineA, lineB) { for (var i = 0; i < lineA.length - 1; i++) { var a0 = lineA[i]; @@ -58659,292 +58000,205 @@ function lineIntersectsLine(lineA, lineB) { for (var j = 0; j < lineB.length - 1; j++) { var b0 = lineB[j]; var b1 = lineB[j + 1]; - if (lineSegmentIntersectsLineSegment(a0, a1, b0, b1)) return true; + if (lineSegmentIntersectsLineSegment(a0, a1, b0, b1)) + return true; } } return false; } - - -// http://bryceboe.com/2006/10/23/line-segment-intersection-algorithm/ function isCounterClockwise(a, b, c) { return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x); } - function lineSegmentIntersectsLineSegment(a0, a1, b0, b1) { - return isCounterClockwise(a0, b0, b1) !== isCounterClockwise(a1, b0, b1) && - isCounterClockwise(a0, a1, b0) !== isCounterClockwise(a0, a1, b1); + return isCounterClockwise(a0, b0, b1) !== isCounterClockwise(a1, b0, b1) && isCounterClockwise(a0, a1, b0) !== isCounterClockwise(a0, a1, b1); } - function pointIntersectsBufferedLine(p, line, radius) { var radiusSquared = radius * radius; - - if (line.length === 1) return p.distSqr(line[0]) < radiusSquared; - + if (line.length === 1) + return p.distSqr(line[0]) < radiusSquared; for (var i = 1; i < line.length; i++) { - // Find line segments that have a distance <= radius^2 to p - // In that case, we treat the line as "containing point p". var v = line[i - 1], w = line[i]; - if (distToSegmentSquared(p, v, w) < radiusSquared) return true; + if (distToSegmentSquared(p, v, w) < radiusSquared) + return true; } return false; } - -// Code from http://stackoverflow.com/a/1501725/331379. function distToSegmentSquared(p, v, w) { var l2 = v.distSqr(w); - if (l2 === 0) return p.distSqr(v); + if (l2 === 0) + return p.distSqr(v); var t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2; - if (t < 0) return p.distSqr(v); - if (t > 1) return p.distSqr(w); + if (t < 0) + return p.distSqr(v); + if (t > 1) + return p.distSqr(w); return p.distSqr(w.sub(v)._mult(t)._add(v)); } - -// point in polygon ray casting algorithm function multiPolygonContainsPoint(rings, p) { - var c = false, - ring, p1, p2; - + var c = false, ring, p1, p2; for (var k = 0; k < rings.length; k++) { ring = rings[k]; for (var i = 0, j = ring.length - 1; i < ring.length; j = i++) { p1 = ring[i]; p2 = ring[j]; - if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) { + if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) { c = !c; } } } return c; } - function polygonContainsPoint(ring, p) { var c = false; for (var i = 0, j = ring.length - 1; i < ring.length; j = i++) { var p1 = ring[i]; var p2 = ring[j]; - if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) { + if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) { c = !c; } } return c; } - -},{}],345:[function(require,module,exports){ +},{}],362:[function(require,module,exports){ 'use strict'; - module.exports = LRUCache; - -/** - * A [least-recently-used cache](http://en.wikipedia.org/wiki/Cache_algorithms) - * with hash lookup made possible by keeping a list of keys in parallel to - * an array of dictionary of values - * - * @param {number} max number of permitted values - * @param {Function} onRemove callback called with items when they expire - * @private - */ function LRUCache(max, onRemove) { this.max = max; this.onRemove = onRemove; this.reset(); } - -/** - * Clear the cache - * - * @returns {LRUCache} this cache - * @private - */ -LRUCache.prototype.reset = function() { +LRUCache.prototype.reset = function () { for (var key in this.data) { this.onRemove(this.data[key]); } - this.data = {}; this.order = []; - return this; }; - -/** - * Add a key, value combination to the cache, trimming its size if this pushes - * it over max length. - * - * @param {string} key lookup key for the item - * @param {*} data any value - * - * @returns {LRUCache} this cache - * @private - */ -LRUCache.prototype.add = function(key, data) { - +LRUCache.prototype.add = function (key, data) { if (this.has(key)) { this.order.splice(this.order.indexOf(key), 1); this.data[key] = data; this.order.push(key); - } else { this.data[key] = data; this.order.push(key); - if (this.order.length > this.max) { var removedData = this.get(this.order[0]); - if (removedData) this.onRemove(removedData); + if (removedData) + this.onRemove(removedData); } } - return this; }; - -/** - * Determine whether the value attached to `key` is present - * - * @param {string} key the key to be looked-up - * @returns {boolean} whether the cache has this value - * @private - */ -LRUCache.prototype.has = function(key) { +LRUCache.prototype.has = function (key) { return key in this.data; }; - -/** - * List all keys in the cache - * - * @returns {Array} an array of keys in this cache. - * @private - */ -LRUCache.prototype.keys = function() { +LRUCache.prototype.keys = function () { return this.order; }; - -/** - * Get the value attached to a specific key. If the key is not found, - * returns `null` - * - * @param {string} key the key to look up - * @returns {*} the data, or null if it isn't found - * @private - */ -LRUCache.prototype.get = function(key) { - if (!this.has(key)) { return null; } - +LRUCache.prototype.get = function (key) { + if (!this.has(key)) { + return null; + } var data = this.data[key]; - delete this.data[key]; this.order.splice(this.order.indexOf(key), 1); - return data; }; - -/** - * Change the max size of the cache. - * - * @param {number} max the max size of the cache - * @returns {LRUCache} this cache - * @private - */ -LRUCache.prototype.setMaxSize = function(max) { +LRUCache.prototype.setMaxSize = function (max) { this.max = max; - while (this.order.length > this.max) { var removedData = this.get(this.order[0]); - if (removedData) this.onRemove(removedData); + if (removedData) + this.onRemove(removedData); } - return this; }; - -},{}],346:[function(require,module,exports){ +},{}],363:[function(require,module,exports){ 'use strict'; - var config = require('./config'); var browser = require('./browser'); - +var URL = require('url'); +var util = require('./util'); function normalizeURL(url, pathPrefix, accessToken) { accessToken = accessToken || config.ACCESS_TOKEN; - if (!accessToken && config.REQUIRE_ACCESS_TOKEN) { - throw new Error('An API access token is required to use Mapbox GL. ' + - 'See https://www.mapbox.com/developers/api/#access-tokens'); + throw new Error('An API access token is required to use Mapbox GL. ' + 'See https://www.mapbox.com/developers/api/#access-tokens'); } - url = url.replace(/^mapbox:\/\//, config.API_URL + pathPrefix); url += url.indexOf('?') !== -1 ? '&access_token=' : '?access_token='; - if (config.REQUIRE_ACCESS_TOKEN) { if (accessToken[0] === 's') { - throw new Error('Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). ' + - 'See https://www.mapbox.com/developers/api/#access-tokens'); + throw new Error('Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). ' + 'See https://www.mapbox.com/developers/api/#access-tokens'); } - url += accessToken; } - return url; } - -module.exports.normalizeStyleURL = function(url, accessToken) { - if (!url.match(/^mapbox:\/\/styles\//)) +module.exports.normalizeStyleURL = function (url, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { return url; - - var split = url.split('/'); - var user = split[3]; - var style = split[4]; - var draft = split[5] ? '/draft' : ''; - return normalizeURL('mapbox://' + user + '/' + style + draft, '/styles/v1/', accessToken); + } else { + return normalizeURL('mapbox:/' + urlObject.pathname + formatQuery(urlObject.query), '/styles/v1/', accessToken); + } }; - -module.exports.normalizeSourceURL = function(url, accessToken) { - if (!url.match(/^mapbox:\/\//)) +module.exports.normalizeSourceURL = function (url, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { return url; - - // TileJSON requests need a secure flag appended to their URLs so - // that the server knows to send SSL-ified resource references. - return normalizeURL(url + '.json', '/v4/', accessToken) + '&secure'; + } else { + return normalizeURL(url + '.json', '/v4/', accessToken) + '&secure'; + } }; - -module.exports.normalizeGlyphsURL = function(url, accessToken) { - if (!url.match(/^mapbox:\/\//)) +module.exports.normalizeGlyphsURL = function (url, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { return url; - - var user = url.split('/')[3]; - return normalizeURL('mapbox://' + user + '/{fontstack}/{range}.pbf', '/fonts/v1/', accessToken); -}; - -module.exports.normalizeSpriteURL = function(url, format, ext, accessToken) { - if (!url.match(/^mapbox:\/\/sprites\//)) - return url + format + ext; - - var split = url.split('/'); - var user = split[3]; - var style = split[4]; - var draft = split[5] ? '/draft' : ''; - return normalizeURL('mapbox://' + user + '/' + style + draft + '/sprite' + format + ext, '/styles/v1/', accessToken); + } else { + var user = urlObject.pathname.split('/')[1]; + return normalizeURL('mapbox://' + user + '/{fontstack}/{range}.pbf' + formatQuery(urlObject.query), '/fonts/v1/', accessToken); + } }; - -module.exports.normalizeTileURL = function(url, sourceUrl, tileSize) { - if (!sourceUrl || !sourceUrl.match(/^mapbox:\/\//)) - return url; - - // The v4 mapbox tile API supports 512x512 image tiles only when @2x - // is appended to the tile URL. If `tileSize: 512` is specified for - // a Mapbox raster source force the @2x suffix even if a non hidpi - // device. - url = url.replace(/([?&]access_token=)tk\.[^&]+/, '$1' + config.ACCESS_TOKEN); - var extension = browser.supportsWebp ? 'webp' : '$1'; - return url.replace(/\.((?:png|jpg)\d*)(?=$|\?)/, browser.devicePixelRatio >= 2 || tileSize === 512 ? '@2x.' + extension : '.' + extension); +module.exports.normalizeSpriteURL = function (url, format, extension, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { + urlObject.pathname += format + extension; + return URL.format(urlObject); + } else { + return normalizeURL('mapbox:/' + urlObject.pathname + '/sprite' + format + extension + formatQuery(urlObject.query), '/styles/v1/', accessToken); + } +}; +module.exports.normalizeTileURL = function (tileURL, sourceURL, tileSize) { + var tileURLObject = URL.parse(tileURL, true); + if (!sourceURL) + return tileURL; + var sourceURLObject = URL.parse(sourceURL); + if (sourceURLObject.protocol !== 'mapbox:') + return tileURL; + var extension = browser.supportsWebp ? '.webp' : '$1'; + var resolution = browser.devicePixelRatio >= 2 || tileSize === 512 ? '@2x' : ''; + return URL.format({ + protocol: tileURLObject.protocol, + hostname: tileURLObject.hostname, + pathname: tileURLObject.pathname.replace(/(\.(?:png|jpg)\d*)/, resolution + extension), + query: replaceTempAccessToken(tileURLObject.query) + }); }; - -},{"./browser":335,"./config":339}],347:[function(require,module,exports){ +function formatQuery(query) { + return query ? '?' + query : ''; +} +function replaceTempAccessToken(query) { + if (query.access_token && query.access_token.slice(0, 3) === 'tk.') { + return util.extend({}, query, { 'access_token': config.ACCESS_TOKEN }); + } else { + return query; + } +} +},{"./browser":350,"./config":355,"./util":366,"url":64}],364:[function(require,module,exports){ 'use strict'; - -// Note: all "sizes" are measured in bytes - -var assert = require('assert'); - module.exports = StructArrayType; - var viewTypes = { 'Int8': Int8Array, 'Uint8': Uint8Array, @@ -58956,126 +58210,56 @@ var viewTypes = { 'Float32': Float32Array, 'Float64': Float64Array }; - -/** - * @typedef StructMember - * @private - * @property {string} name - * @property {string} type - * @property {number} components - */ - var structArrayTypeCache = {}; - -/** - * `StructArrayType` is used to create new `StructArray` types. - * - * `StructArray` provides an abstraction over `ArrayBuffer` and `TypedArray` making it behave like - * an array of typed structs. A StructArray is comprised of elements. Each element has a set of - * members that are defined when the `StructArrayType` is created. - * - * StructArrays useful for creating large arrays that: - * - can be transferred from workers as a Transferable object - * - can be copied cheaply - * - use less memory for lower-precision members - * - can be used as buffers in WebGL. - * - * @class StructArrayType - * @param {Array.} - * @param options - * @param {number} options.alignment Use `4` to align members to 4 byte boundaries. Default is 1. - * - * @example - * - * var PointArrayType = new StructArrayType({ - * members: [ - * { type: 'Int16', name: 'x' }, - * { type: 'Int16', name: 'y' } - * ]}); - * - * var pointArray = new PointArrayType(); - * pointArray.emplaceBack(10, 15); - * pointArray.emplaceBack(20, 35); - * - * point = pointArray.get(0); - * assert(point.x === 10); - * assert(point.y === 15); - * - * @private - */ function StructArrayType(options) { - var key = JSON.stringify(options); if (structArrayTypeCache[key]) { return structArrayTypeCache[key]; } - - if (options.alignment === undefined) options.alignment = 1; - + if (options.alignment === undefined) + options.alignment = 1; function StructType() { Struct.apply(this, arguments); } - StructType.prototype = Object.create(Struct.prototype); - var offset = 0; var maxSize = 0; var usedTypes = ['Uint8']; - - StructType.prototype.members = options.members.map(function(member) { + StructType.prototype.members = options.members.map(function (member) { member = { name: member.name, type: member.type, components: member.components || 1 }; - - assert(member.name.length); - assert(member.type in viewTypes); - - if (usedTypes.indexOf(member.type) < 0) usedTypes.push(member.type); - + if (usedTypes.indexOf(member.type) < 0) + usedTypes.push(member.type); var typeSize = sizeOf(member.type); maxSize = Math.max(maxSize, typeSize); member.offset = offset = align(offset, Math.max(options.alignment, typeSize)); - for (var c = 0; c < member.components; c++) { Object.defineProperty(StructType.prototype, member.name + (member.components === 1 ? '' : c), { get: createGetter(member, c), set: createSetter(member, c) }); } - offset += typeSize * member.components; - return member; }); - StructType.prototype.alignment = options.alignment; StructType.prototype.size = align(offset, Math.max(maxSize, options.alignment)); - function StructArrayType() { StructArray.apply(this, arguments); this.members = StructType.prototype.members; } - StructArrayType.serialize = serializeStructArrayType; - StructArrayType.prototype = Object.create(StructArray.prototype); StructArrayType.prototype.StructType = StructType; StructArrayType.prototype.bytesPerElement = StructType.prototype.size; StructArrayType.prototype.emplaceBack = createEmplaceBack(StructType.prototype.members, StructType.prototype.size); StructArrayType.prototype._usedTypes = usedTypes; - - structArrayTypeCache[key] = StructArrayType; - return StructArrayType; } - -/** - * Serialize the StructArray type. This serializes the *type* not an instance of the type. - * @private - */ function serializeStructArrayType() { return { members: this.prototype.StructType.prototype.members, @@ -59083,42 +58267,26 @@ function serializeStructArrayType() { bytesPerElement: this.prototype.bytesPerElement }; } - - function align(offset, size) { return Math.ceil(offset / size) * size; } - function sizeOf(type) { return viewTypes[type].BYTES_PER_ELEMENT; } - function getArrayViewName(type) { return type.toLowerCase(); } - - -/* - * > I saw major perf gains by shortening the source of these generated methods (i.e. renaming - * > elementIndex to i) (likely due to v8 inlining heuristics). - * - lucaswoj - */ function createEmplaceBack(members, bytesPerElement) { var usedTypeSizes = []; var argNames = []; - var body = '' + - 'var i = this.length;\n' + - 'this.resize(this.length + 1);\n'; - + var body = '' + 'var i = this.length;\n' + 'this.resize(this.length + 1);\n'; for (var m = 0; m < members.length; m++) { var member = members[m]; var size = sizeOf(member.type); - if (usedTypeSizes.indexOf(size) < 0) { usedTypeSizes.push(size); body += 'var o' + size.toFixed(0) + ' = i * ' + (bytesPerElement / size).toFixed(0) + ';\n'; } - for (var c = 0; c < member.components; c++) { var argName = 'v' + argNames.length; var index = 'o' + size.toFixed(0) + ' + ' + (member.offset / size + c).toFixed(0); @@ -59126,34 +58294,21 @@ function createEmplaceBack(members, bytesPerElement) { argNames.push(argName); } } - body += 'return i;'; - return new Function(argNames, body); } - function createMemberComponentString(member, component) { var elementOffset = 'this._pos' + sizeOf(member.type).toFixed(0); var componentOffset = (member.offset / sizeOf(member.type) + component).toFixed(0); var index = elementOffset + ' + ' + componentOffset; return 'this._structArray.' + getArrayViewName(member.type) + '[' + index + ']'; - } - function createGetter(member, c) { return new Function([], 'return ' + createMemberComponentString(member, c) + ';'); } - function createSetter(member, c) { return new Function(['x'], createMemberComponentString(member, c) + ' = x;'); } - -/** - * @class Struct - * @param {StructArray} structArray The StructArray the struct is stored in - * @param {number} index The index of the struct in the StructArray. - * @private - */ function Struct(structArray, index) { this._structArray = structArray; this._pos1 = index * this.size; @@ -59161,269 +58316,120 @@ function Struct(structArray, index) { this._pos4 = this._pos1 / 4; this._pos8 = this._pos1 / 8; } - -/** - * @class StructArray - * The StructArray class is inherited by the custom StructArrayType classes created with - * `new StructArrayType(members, options)`. - * @private - */ function StructArray(serialized) { if (serialized !== undefined) { - // Create from an serialized StructArray this.arrayBuffer = serialized.arrayBuffer; this.length = serialized.length; this.capacity = this.arrayBuffer.byteLength / this.bytesPerElement; this._refreshViews(); - - // Create a new StructArray } else { this.capacity = -1; this.resize(0); } } - -/** - * @property {number} - * @private - * @readonly - */ StructArray.prototype.DEFAULT_CAPACITY = 128; - -/** - * @property {number} - * @private - * @readonly - */ StructArray.prototype.RESIZE_MULTIPLIER = 5; - -/** - * Serialize this StructArray instance - * @private - */ -StructArray.prototype.serialize = function() { +StructArray.prototype.serialize = function () { this.trim(); return { length: this.length, arrayBuffer: this.arrayBuffer }; }; - -/** - * Return the Struct at the given location in the array. - * @private - * @param {number} index The index of the element. - */ -StructArray.prototype.get = function(index) { +StructArray.prototype.get = function (index) { return new this.StructType(this, index); }; - -/** - * Resize the array to discard unused capacity. - * @private - */ -StructArray.prototype.trim = function() { +StructArray.prototype.trim = function () { if (this.length !== this.capacity) { this.capacity = this.length; this.arrayBuffer = this.arrayBuffer.slice(0, this.length * this.bytesPerElement); this._refreshViews(); } }; - -/** - * Resize the array. - * If `n` is greater than the current length then additional elements with undefined values are added. - * If `n` is less than the current length then the array will be reduced to the first `n` elements. - * @param {number} n The new size of the array. - */ -StructArray.prototype.resize = function(n) { +StructArray.prototype.resize = function (n) { this.length = n; if (n > this.capacity) { this.capacity = Math.max(n, Math.floor(this.capacity * this.RESIZE_MULTIPLIER), this.DEFAULT_CAPACITY); this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement); - var oldUint8Array = this.uint8; this._refreshViews(); - if (oldUint8Array) this.uint8.set(oldUint8Array); + if (oldUint8Array) + this.uint8.set(oldUint8Array); } }; - -/** - * Create TypedArray views for the current ArrayBuffer. - * @private - */ -StructArray.prototype._refreshViews = function() { +StructArray.prototype._refreshViews = function () { for (var t = 0; t < this._usedTypes.length; t++) { var type = this._usedTypes[t]; this[getArrayViewName(type)] = new viewTypes[type](this.arrayBuffer); } }; - -},{"assert":52}],348:[function(require,module,exports){ +StructArray.prototype.toArray = function (startIndex, endIndex) { + var array = []; + for (var i = startIndex; i < endIndex; i++) { + var struct = this.get(i); + array.push(struct); + } + return array; +}; +},{}],365:[function(require,module,exports){ 'use strict'; - module.exports = resolveTokens; - -/** - * Replace tokens in a string template with values in an object - * - * @param {Object} properties a key/value relationship between tokens and replacements - * @param {string} text the template string - * @returns {string} the template with tokens replaced - * @private - */ function resolveTokens(properties, text) { - return text.replace(/{([^{}()\[\]<>$=:;.,^]+)}/g, function(match, key) { + return text.replace(/{([^{}]+)}/g, function (match, key) { return key in properties ? properties[key] : ''; }); } - -},{}],349:[function(require,module,exports){ +},{}],366:[function(require,module,exports){ 'use strict'; - var UnitBezier = require('unitbezier'); var Coordinate = require('../geo/coordinate'); - -/** - * Given a value `t` that varies between 0 and 1, return - * an interpolation function that eases between 0 and 1 in a pleasing - * cubic in-out fashion. - * - * @param {number} t input - * @returns {number} input - * @private - */ exports.easeCubicInOut = function (t) { - if (t <= 0) return 0; - if (t >= 1) return 1; - var t2 = t * t, - t3 = t2 * t; + if (t <= 0) + return 0; + if (t >= 1) + return 1; + var t2 = t * t, t3 = t2 * t; return 4 * (t < 0.5 ? t3 : 3 * (t - t2) + t3 - 0.75); }; - -/** - * Given given (x, y), (x1, y1) control points for a bezier curve, - * return a function that interpolates along that curve. - * - * @param {number} p1x control point 1 x coordinate - * @param {number} p1y control point 1 y coordinate - * @param {number} p2x control point 2 x coordinate - * @param {number} p2y control point 2 y coordinate - * @returns {Function} interpolator: receives number value, returns - * number value. - * @private - */ -exports.bezier = function(p1x, p1y, p2x, p2y) { +exports.bezier = function (p1x, p1y, p2x, p2y) { var bezier = new UnitBezier(p1x, p1y, p2x, p2y); - return function(t) { + return function (t) { return bezier.solve(t); }; }; - -/** - * A default bezier-curve powered easing function with - * control points (0.25, 0.1) and (0.25, 1) - * - * @param {number} t - * @returns {number} output - * @private - */ exports.ease = exports.bezier(0.25, 0.1, 0.25, 1); - -/** - * Given a four-element array of numbers that represents a color in - * RGBA, return a version for which the RGB components are multiplied - * by the A (alpha) component - * - * @param {Array} color color array - * @returns {Array} premultiplied color array - * @private - */ -exports.premultiply = function (color) { - if (!color) return null; - var opacity = color[3]; - return [ - color[0] * opacity, - color[1] * opacity, - color[2] * opacity, - opacity - ]; -}; - -/** - * constrain n to the given range via min + max - * - * @param {number} n value - * @param {number} min the minimum value to be returned - * @param {number} max the maximum value to be returned - * @returns {number} the clamped value - * @private - */ exports.clamp = function (n, min, max) { return Math.min(max, Math.max(min, n)); }; - -/* - * constrain n to the given range, excluding the minimum, via modular arithmetic - * @param {number} n value - * @param {number} min the minimum value to be returned, exclusive - * @param {number} max the maximum value to be returned, inclusive - * @returns {number} constrained number - * @private - */ exports.wrap = function (n, min, max) { var d = max - min; var w = ((n - min) % d + d) % d + min; - return (w === min) ? max : w; + return w === min ? max : w; }; - -/* - * return the first non-null and non-undefined argument to this function. - * @returns {*} argument - * @private - */ -exports.coalesce = function() { +exports.coalesce = function () { for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (arg !== null && arg !== undefined) return arg; } }; - -/* - * Call an asynchronous function on an array of arguments, - * calling `callback` with the completed results of all calls. - * - * @param {Array<*>} array input to each call of the async function. - * @param {Function} fn an async function with signature (data, callback) - * @param {Function} callback a callback run after all async work is done. - * called with an array, containing the results of each async call. - * @returns {undefined} - * @private - */ exports.asyncAll = function (array, fn, callback) { - if (!array.length) { return callback(null, []); } + if (!array.length) { + return callback(null, []); + } var remaining = array.length; var results = new Array(array.length); var error = null; array.forEach(function (item, i) { fn(item, function (err, result) { - if (err) error = err; + if (err) + error = err; results[i] = result; - if (--remaining === 0) callback(error, results); + if (--remaining === 0) + callback(error, results); }); }); }; - -/* - * Compute the difference between the keys in one object and the keys - * in another object. - * - * @param {Object} obj - * @param {Object} other - * @returns {Array} keys difference - * @private - */ exports.keysDifference = function (obj, other) { var difference = []; for (var i in obj) { @@ -59433,17 +58439,6 @@ exports.keysDifference = function (obj, other) { } return difference; }; - -/** - * Given a destination object and optionally many source objects, - * copy all properties from the source objects into the destination. - * The last source object given overrides properties from previous - * source objects. - * @param {Object} dest destination object - * @param {...Object} sources sources from which properties are pulled - * @returns {Object} dest - * @private - */ exports.extend = function (dest) { for (var i = 1; i < arguments.length; i++) { var src = arguments[i]; @@ -59453,52 +58448,17 @@ exports.extend = function (dest) { } return dest; }; - -/** - * Extend a destination object with all properties of the src object, - * using defineProperty instead of simple assignment. - * @param {Object} dest - * @param {Object} src - * @returns {Object} dest - * @private - */ exports.extendAll = function (dest, src) { for (var i in src) { Object.defineProperty(dest, i, Object.getOwnPropertyDescriptor(src, i)); } return dest; }; - -/** - * Extend a parent's prototype with all properties in a properties - * object. - * - * @param {Object} parent - * @param {Object} props - * @returns {Object} - * @private - */ exports.inherit = function (parent, props) { - var parentProto = typeof parent === 'function' ? parent.prototype : parent, - proto = Object.create(parentProto); + var parentProto = typeof parent === 'function' ? parent.prototype : parent, proto = Object.create(parentProto); exports.extendAll(proto, props); return proto; }; - -/** - * Given an object and a number of properties as strings, return version - * of that object with only those properties. - * - * @param {Object} src the object - * @param {Array} properties an array of property names chosen - * to appear on the resulting object. - * @returns {Object} object with limited properties. - * @example - * var foo = { name: 'Charlie', age: 10 }; - * var justName = pick(foo, ['name']); - * // justName = { name: 'Charlie' } - * @private - */ exports.pick = function (src, properties) { var result = {}; for (var i = 0; i < properties.length; i++) { @@ -59509,96 +58469,36 @@ exports.pick = function (src, properties) { } return result; }; - var id = 1; - -/** - * Return a unique numeric id, starting at 1 and incrementing with - * each call. - * - * @returns {number} unique numeric id. - * @private - */ exports.uniqueId = function () { return id++; }; - -/** - * Create a version of `fn` that is only called `time` milliseconds - * after its last invocation - * - * @param {Function} fn the function to be debounced - * @param {number} time millseconds after which the function will be invoked - * @returns {Function} debounced function - * @private - */ -exports.debounce = function(fn, time) { +exports.debounce = function (fn, time) { var timer, args; - - return function() { + return function () { args = arguments; clearTimeout(timer); - - timer = setTimeout(function() { + timer = setTimeout(function () { fn.apply(null, args); }, time); }; }; - -/** - * Given an array of member function names as strings, replace all of them - * with bound versions that will always refer to `context` as `this`. This - * is useful for classes where otherwise event bindings would reassign - * `this` to the evented object or some other value: this lets you ensure - * the `this` value always. - * - * @param {Array} fns list of member function names - * @param {*} context the context value - * @returns {undefined} changes functions in-place - * @example - * function MyClass() { - * bindAll(['ontimer'], this); - * this.name = 'Tom'; - * } - * MyClass.prototype.ontimer = function() { - * alert(this.name); - * }; - * var myClass = new MyClass(); - * setTimeout(myClass.ontimer, 100); - * @private - */ -exports.bindAll = function(fns, context) { - fns.forEach(function(fn) { +exports.bindAll = function (fns, context) { + fns.forEach(function (fn) { + if (!context[fn]) { + return; + } context[fn] = context[fn].bind(context); }); }; - -/** - * Given a class, bind all of the methods that look like handlers: that - * begin with _on, and bind them to the class. - * - * @param {Object} context an object with methods - * @private - */ -exports.bindHandlers = function(context) { +exports.bindHandlers = function (context) { for (var i in context) { if (typeof context[i] === 'function' && i.indexOf('_on') === 0) { context[i] = context[i].bind(context); } } }; - -/** - * Set the 'options' property on `obj` with properties - * from the `options` argument. Properties in the `options` - * object will override existing properties. - * - * @param {Object} obj destination object - * @param {Object} options object of override options - * @returns {Object} derived options object. - * @private - */ -exports.setOptions = function(obj, options) { +exports.setOptions = function (obj, options) { if (!obj.hasOwnProperty('options')) { obj.options = obj.options ? Object.create(obj.options) : {}; } @@ -59607,79 +58507,36 @@ exports.setOptions = function(obj, options) { } return obj.options; }; - -/** - * Given a list of coordinates, get their center as a coordinate. - * @param {Array} coords - * @returns {Coordinate} centerpoint - * @private - */ -exports.getCoordinatesCenter = function(coords) { +exports.getCoordinatesCenter = function (coords) { var minX = Infinity; var minY = Infinity; var maxX = -Infinity; var maxY = -Infinity; - for (var i = 0; i < coords.length; i++) { minX = Math.min(minX, coords[i].column); minY = Math.min(minY, coords[i].row); maxX = Math.max(maxX, coords[i].column); maxY = Math.max(maxY, coords[i].row); } - var dx = maxX - minX; var dy = maxY - minY; var dMax = Math.max(dx, dy); - return new Coordinate((minX + maxX) / 2, (minY + maxY) / 2, 0) - .zoomTo(Math.floor(-Math.log(dMax) / Math.LN2)); + return new Coordinate((minX + maxX) / 2, (minY + maxY) / 2, 0).zoomTo(Math.floor(-Math.log(dMax) / Math.LN2)); }; - -/** - * Determine if a string ends with a particular substring - * @param {string} string - * @param {string} suffix - * @returns {boolean} - * @private - */ -exports.endsWith = function(string, suffix) { +exports.endsWith = function (string, suffix) { return string.indexOf(suffix, string.length - suffix.length) !== -1; }; - -/** - * Determine if a string starts with a particular substring - * @param {string} string - * @param {string} prefix - * @returns {boolean} - * @private - */ -exports.startsWith = function(string, prefix) { +exports.startsWith = function (string, prefix) { return string.indexOf(prefix) === 0; }; - -/** - * Create an object by mapping all the values of an existing object while - * preserving their keys. - * @param {Object} input - * @param {Function} iterator - * @returns {Object} - * @private - */ -exports.mapObject = function(input, iterator, context) { +exports.mapObject = function (input, iterator, context) { var output = {}; for (var key in input) { output[key] = iterator.call(context || this, input[key], key, input); } return output; }; - -/** - * Create an object by filtering out values of an existing object - * @param {Object} input - * @param {Function} iterator - * @returns {Object} - * @private - */ -exports.filterObject = function(input, iterator, context) { +exports.filterObject = function (input, iterator, context) { var output = {}; for (var key in input) { if (iterator.call(context || this, input[key], key, input)) { @@ -59688,41 +58545,30 @@ exports.filterObject = function(input, iterator, context) { } return output; }; - -/** - * Deeply compares two object literals. - * @param {Object} obj1 - * @param {Object} obj2 - * @returns {boolean} - * @private - */ exports.deepEqual = function deepEqual(a, b) { if (Array.isArray(a)) { - if (!Array.isArray(b) || a.length !== b.length) return false; + if (!Array.isArray(b) || a.length !== b.length) + return false; for (var i = 0; i < a.length; i++) { - if (!deepEqual(a[i], b[i])) return false; + if (!deepEqual(a[i], b[i])) + return false; } return true; } - if (typeof a === 'object') { - if (!(typeof b === 'object')) return false; + if (typeof a === 'object' && a !== null && b !== null) { + if (!(typeof b === 'object')) + return false; var keys = Object.keys(a); - if (keys.length !== Object.keys(b).length) return false; + if (keys.length !== Object.keys(b).length) + return false; for (var key in a) { - if (!deepEqual(a[key], b[key])) return false; + if (!deepEqual(a[key], b[key])) + return false; } return true; } return a === b; }; - -/** - * Deeply clones two objects. - * @param {Object} obj1 - * @param {Object} obj2 - * @returns {boolean} - * @private - */ exports.clone = function deepEqual(input) { if (Array.isArray(input)) { return input.map(exports.clone); @@ -59732,108 +58578,56 @@ exports.clone = function deepEqual(input) { return input; } }; - -/** - * Check if two arrays have at least one common element. - * @param {Array} a - * @param {Array} b - * @returns {boolean} - * @private - */ -exports.arraysIntersect = function(a, b) { +exports.arraysIntersect = function (a, b) { for (var l = 0; l < a.length; l++) { - if (b.indexOf(a[l]) >= 0) return true; + if (b.indexOf(a[l]) >= 0) + return true; } return false; }; - -},{"../geo/coordinate":255,"unitbezier":412}],350:[function(require,module,exports){ +var warnOnceHistory = {}; +exports.warnOnce = function (message) { + if (!warnOnceHistory[message]) { + if (typeof console !== 'undefined') + console.warn(message); + warnOnceHistory[message] = true; + } +}; +},{"../geo/coordinate":262,"unitbezier":433}],367:[function(require,module,exports){ 'use strict'; - -var VectorTileFeature = require('vector-tile').VectorTileFeature; - module.exports = Feature; - function Feature(vectorTileFeature, z, x, y) { this._vectorTileFeature = vectorTileFeature; vectorTileFeature._z = z; vectorTileFeature._x = x; vectorTileFeature._y = y; - this.properties = vectorTileFeature.properties; - - if (vectorTileFeature._id) { - this.id = vectorTileFeature._id; + if (vectorTileFeature.id != null) { + this.id = vectorTileFeature.id; } } - Feature.prototype = { - type: "Feature", - + type: 'Feature', get geometry() { if (this._geometry === undefined) { - var feature = this._vectorTileFeature; - var coords = projectCoords( - feature.loadGeometry(), - feature.extent, - feature._z, feature._x, feature._y); - - var type = VectorTileFeature.types[feature.type]; - - if (type === 'Point' && coords.length === 1) { - coords = coords[0][0]; - } else if (type === 'Point') { - coords = coords[0]; - type = 'MultiPoint'; - } else if (type === 'LineString' && coords.length === 1) { - coords = coords[0]; - } else if (type === 'LineString') { - type = 'MultiLineString'; - } - - this._geometry = { - type: type, - coordinates: coords - }; - - this._vectorTileFeature = null; + this._geometry = this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x, this._vectorTileFeature._y, this._vectorTileFeature._z).geometry; } return this._geometry; }, - set geometry(g) { this._geometry = g; }, - - toJSON: function() { + toJSON: function () { var json = {}; for (var i in this) { - if (i === '_geometry' || i === '_vectorTileFeature') continue; + if (i === '_geometry' || i === '_vectorTileFeature' || i === 'toJSON') + continue; json[i] = this[i]; } return json; } }; - -function projectCoords(coords, extent, z, x, y) { - var size = extent * Math.pow(2, z), - x0 = extent * x, - y0 = extent * y; - for (var i = 0; i < coords.length; i++) { - var line = coords[i]; - for (var j = 0; j < line.length; j++) { - var p = line[j]; - var y2 = 180 - (p.y + y0) * 360 / size; - line[j] = [ - (p.x + x0) * 360 / size - 180, - 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90 - ]; - } - } - return coords; -} - -},{"vector-tile":413}],351:[function(require,module,exports){ +},{}],368:[function(require,module,exports){ // (c) Dean McNamee , 2012. // // https://github.com/deanm/css-color-parser-js @@ -60035,7 +58829,653 @@ function parseCSSColor(css_str) { try { exports.parseCSSColor = parseCSSColor } catch(e) { } -},{}],352:[function(require,module,exports){ +},{}],369:[function(require,module,exports){ +'use strict'; + +module.exports = earcut; + +function earcut(data, holeIndices, dim) { + + dim = dim || 2; + + var hasHoles = holeIndices && holeIndices.length, + outerLen = hasHoles ? holeIndices[0] * dim : data.length, + outerNode = linkedList(data, 0, outerLen, dim, true), + triangles = []; + + if (!outerNode) return triangles; + + var minX, minY, maxX, maxY, x, y, size; + + if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); + + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (data.length > 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; + + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) minX = x; + if (y < minY) minY = y; + if (x > maxX) maxX = x; + if (y > maxY) maxY = y; + } + + // minX, minY and size are later used to transform coords into integers for z-order calculation + size = Math.max(maxX - minX, maxY - minY); + } + + earcutLinked(outerNode, triangles, dim, minX, minY, size); + + return triangles; +} + +// create a circular doubly linked list from polygon points in the specified winding order +function linkedList(data, start, end, dim, clockwise) { + var i, last; + + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); + } else { + for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); + } + + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } + + return last; +} + +// eliminate colinear or duplicate points +function filterPoints(start, end) { + if (!start) return start; + if (!end) end = start; + + var p = start, + again; + do { + again = false; + + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) return null; + again = true; + + } else { + p = p.next; + } + } while (again || p !== end); + + return end; +} + +// main ear slicing loop which triangulates a polygon (given as a linked list) +function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { + if (!ear) return; + + // interlink polygon nodes in z-order + if (!pass && size) indexCurve(ear, minX, minY, size); + + var stop = ear, + prev, next; + + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; + + if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim); + triangles.push(ear.i / dim); + triangles.push(next.i / dim); + + removeNode(ear); + + // skipping the next vertice leads to less sliver triangles + ear = next.next; + stop = next.next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); + + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(ear, triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, size, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, size); + } + + break; + } + } +} + +// check whether a polygon node forms a valid ear with adjacent nodes +function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // now make sure we don't have other points inside the potential ear + var p = ear.next.next; + + while (p !== ear.prev) { + if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.next; + } + + return true; +} + +function isEarHashed(ear, minX, minY, size) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // triangle bbox; min & max are calculated like this for speed + var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), + minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), + maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), + maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); + + // z-order range for the current triangle bbox; + var minZ = zOrder(minTX, minTY, minX, minY, size), + maxZ = zOrder(maxTX, maxTY, minX, minY, size); + + // first look for points inside the triangle in increasing z-order + var p = ear.nextZ; + + while (p && p.z <= maxZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.nextZ; + } + + // then look for points in decreasing z-order + p = ear.prevZ; + + while (p && p.z >= minZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + } + + return true; +} + +// go through all polygon nodes and cure small local self-intersections +function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; + + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + + triangles.push(a.i / dim); + triangles.push(p.i / dim); + triangles.push(b.i / dim); + + // remove two nodes involved + removeNode(p); + removeNode(p.next); + + p = start = b; + } + p = p.next; + } while (p !== start); + + return p; +} + +// try splitting polygon into two and triangulate them independently +function splitEarcut(start, triangles, dim, minX, minY, size) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); + + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, size); + earcutLinked(c, triangles, dim, minX, minY, size); + return; + } + b = b.next; + } + a = a.next; + } while (a !== start); +} + +// link every hole into the outer loop, producing a single-ring polygon without holes +function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; + + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) list.steiner = true; + queue.push(getLeftmost(list)); + } + + queue.sort(compareX); + + // process holes from left to right + for (i = 0; i < queue.length; i++) { + eliminateHole(queue[i], outerNode); + outerNode = filterPoints(outerNode, outerNode.next); + } + + return outerNode; +} + +function compareX(a, b) { + return a.x - b.x; +} + +// find a bridge between vertices that connects hole with an outer ring and and link it +function eliminateHole(hole, outerNode) { + outerNode = findHoleBridge(hole, outerNode); + if (outerNode) { + var b = splitPolygon(outerNode, hole); + filterPoints(b, b.next); + } +} + +// David Eberly's algorithm for finding a bridge between hole and outer polygon +function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; + + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + if (x === hx) { + if (hy === p.y) return p; + if (hy === p.next.y) return p.next; + } + m = p.x < p.next.x ? p : p.next; + } + } + p = p.next; + } while (p !== outerNode); + + if (!m) return null; + + if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint + + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point + + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; + + p = m.next; + + while (p !== stop) { + if (hx >= p.x && p.x >= mx && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { + + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential + + if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { + m = p; + tanMin = tan; + } + } + + p = p.next; + } + + return m; +} + +// interlink polygon nodes in z-order +function indexCurve(start, minX, minY, size) { + var p = start; + do { + if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); + + p.prevZ.nextZ = null; + p.prevZ = null; + + sortLinked(p); +} + +// Simon Tatham's linked list merge sort algorithm +// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html +function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; + + do { + p = list; + list = null; + tail = null; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) break; + } + + qSize = inSize; + + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize === 0) { + e = q; + q = q.nextZ; + qSize--; + } else if (qSize === 0 || !q) { + e = p; + p = p.nextZ; + pSize--; + } else if (p.z <= q.z) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) tail.nextZ = e; + else list = e; + + e.prevZ = tail; + tail = e; + } + + p = q; + } + + tail.nextZ = null; + inSize *= 2; + + } while (numMerges > 1); + + return list; +} + +// z-order of a point given coords and size of the data bounding box +function zOrder(x, y, minX, minY, size) { + // coords are transformed into non-negative 15-bit integer range + x = 32767 * (x - minX) / size; + y = 32767 * (y - minY) / size; + + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); +} + +// find the leftmost node of a polygon ring +function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x) leftmost = p; + p = p.next; + } while (p !== start); + + return leftmost; +} + +// check if a point lies within a convex triangle +function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && + (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && + (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; +} + +// check if a diagonal between two polygon nodes is valid (lies in polygon interior) +function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && + locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); +} + +// signed area of a triangle +function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); +} + +// check if two points are equal +function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; +} + +// check if two segments intersect +function intersects(p1, q1, p2, q2) { + if ((equals(p1, q1) && equals(p2, q2)) || + (equals(p1, q2) && equals(p2, q1))) return true; + return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && + area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; +} + +// check if a polygon diagonal intersects any polygon segments +function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) return true; + p = p.next; + } while (p !== a); + + return false; +} + +// check if a polygon diagonal is locally inside the polygon +function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; +} + +// check if the middle point of a polygon diagonal is inside the polygon +function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + inside = !inside; + p = p.next; + } while (p !== a); + + return inside; +} + +// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; +// if one belongs to the outer ring and another to a hole, it merges it into a single ring +function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; + + a.next = b; + b.prev = a; + + a2.next = an; + an.prev = a2; + + b2.next = a2; + a2.prev = b2; + + bp.next = b2; + b2.prev = bp; + + return b2; +} + +// create a node and optionally link it with previous one (in a circular doubly linked list) +function insertNode(i, x, y, last) { + var p = new Node(i, x, y); + + if (!last) { + p.prev = p; + p.next = p; + + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; +} + +function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) p.prevZ.nextZ = p.nextZ; + if (p.nextZ) p.nextZ.prevZ = p.prevZ; +} + +function Node(i, x, y) { + // vertice index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertice nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = null; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; +} + +// return a percentage difference between the polygon area and its triangulation area; +// used to verify correctness of triangulation +earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); + } + } + + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } + + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); +}; + +function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; +} + +// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts +earcut.flatten = function (data) { + var dim = data[0][0].length, + result = {vertices: [], holes: [], dimensions: dim}, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); + } + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); + } + } + return result; +}; + +},{}],370:[function(require,module,exports){ 'use strict'; module.exports = createFilter; @@ -60077,7 +59517,9 @@ function compile(filter) { } function compilePropertyReference(property) { - return property === '$type' ? 'f.type' : 'p[' + JSON.stringify(property) + ']'; + return property === '$type' ? 'f.type' : + property === '$id' ? 'f.id' : + 'p[' + JSON.stringify(property) + ']'; } function compileComparisonOp(property, value, op, checkType) { @@ -60117,7 +59559,7 @@ function compare(a, b) { return a < b ? -1 : a > b ? 1 : 0; } -},{}],353:[function(require,module,exports){ +},{}],371:[function(require,module,exports){ var geojsonArea = require('geojson-area'); module.exports = rewind; @@ -60168,7 +59610,7 @@ function cw(_) { return geojsonArea.ring(_) >= 0; } -},{"geojson-area":354}],354:[function(require,module,exports){ +},{"geojson-area":372}],372:[function(require,module,exports){ var wgs84 = require('wgs84'); module.exports.geometry = geometry; @@ -60234,16 +59676,18 @@ function rad(_) { return _ * Math.PI / 180; } -},{"wgs84":355}],355:[function(require,module,exports){ +},{"wgs84":373}],373:[function(require,module,exports){ module.exports.RADIUS = 6378137; module.exports.FLATTENING = 1/298.257223563; module.exports.POLAR_RADIUS = 6356752.3142; -},{}],356:[function(require,module,exports){ +},{}],374:[function(require,module,exports){ 'use strict'; module.exports = clip; +var createFeature = require('./feature'); + /* clip features between two axis-parallel lines: * | | * ___|___ | / @@ -60283,13 +59727,7 @@ function clip(features, scale, k1, k2, axis, intersect, minAll, maxAll) { if (slices.length) { // if a feature got clipped, it will likely get clipped on the next zoom level as well, // so there's no need to recalculate bboxes - clipped.push({ - geometry: slices, - type: type, - tags: features[i].tags || null, - min: feature.min, - max: feature.max - }); + clipped.push(createFeature(feature.tags, type, slices, feature.id)); } } @@ -60320,6 +59758,7 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { points = geometry[i], area = points.area, dist = points.dist, + outer = points.outer, len = points.length, a, j, last; @@ -60335,7 +59774,7 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if ((bk > k2)) { // ---|-----|--> slice.push(intersect(a, b, k1), intersect(a, b, k2)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } else if (bk >= k1) slice.push(intersect(a, b, k1)); // ---|--> | @@ -60343,7 +59782,7 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if ((bk < k1)) { // <--|-----|--- slice.push(intersect(a, b, k2), intersect(a, b, k1)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } else if (bk <= k2) slice.push(intersect(a, b, k2)); // | <--|--- @@ -60353,11 +59792,11 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if (bk < k1) { // <--|--- | slice.push(intersect(a, b, k1)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } else if (bk > k2) { // | ---|--> slice.push(intersect(a, b, k2)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } // | --> | } @@ -60374,30 +59813,32 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if (closed && last && (slice[0][0] !== last[0] || slice[0][1] !== last[1])) slice.push(slice[0]); // add the final slice - newSlice(slices, slice, area, dist); + newSlice(slices, slice, area, dist, outer); } return slices; } -function newSlice(slices, slice, area, dist) { +function newSlice(slices, slice, area, dist, outer) { if (slice.length) { // we don't recalculate the area/length of the unclipped geometry because the case where it goes // below the visibility threshold as a result of clipping is rare, so we avoid doing unnecessary work slice.area = area; slice.dist = dist; + if (outer !== undefined) slice.outer = outer; slices.push(slice); } return []; } -},{}],357:[function(require,module,exports){ +},{"./feature":376}],375:[function(require,module,exports){ 'use strict'; module.exports = convert; var simplify = require('./simplify'); +var createFeature = require('./feature'); // converts GeoJSON feature into an intermediate projected JSON vector format with simplification data @@ -60419,36 +59860,46 @@ function convert(data, tolerance) { } function convertFeature(features, feature, tolerance) { + if (feature.geometry === null) { + // ignore features with null geometry + return; + } + var geom = feature.geometry, type = geom.type, coords = geom.coordinates, tags = feature.properties, - i, j, rings; + id = feature.id, + i, j, rings, projectedRing; if (type === 'Point') { - features.push(create(tags, 1, [projectPoint(coords)])); + features.push(createFeature(tags, 1, [projectPoint(coords)], id)); } else if (type === 'MultiPoint') { - features.push(create(tags, 1, project(coords))); + features.push(createFeature(tags, 1, project(coords), id)); } else if (type === 'LineString') { - features.push(create(tags, 2, [project(coords, tolerance)])); + features.push(createFeature(tags, 2, [project(coords, tolerance)], id)); } else if (type === 'MultiLineString' || type === 'Polygon') { rings = []; for (i = 0; i < coords.length; i++) { - rings.push(project(coords[i], tolerance)); + projectedRing = project(coords[i], tolerance); + if (type === 'Polygon') projectedRing.outer = (i === 0); + rings.push(projectedRing); } - features.push(create(tags, type === 'Polygon' ? 3 : 2, rings)); + features.push(createFeature(tags, type === 'Polygon' ? 3 : 2, rings, id)); } else if (type === 'MultiPolygon') { rings = []; for (i = 0; i < coords.length; i++) { for (j = 0; j < coords[i].length; j++) { - rings.push(project(coords[i][j], tolerance)); + projectedRing = project(coords[i][j], tolerance); + projectedRing.outer = (j === 0); + rings.push(projectedRing); } } - features.push(create(tags, 3, rings)); + features.push(createFeature(tags, 3, rings, id)); } else if (type === 'GeometryCollection') { for (i = 0; i < geom.geometries.length; i++) { @@ -60463,18 +59914,6 @@ function convertFeature(features, feature, tolerance) { } } -function create(tags, type, geometry) { - var feature = { - geometry: geometry, - type: type, - tags: tags || null, - min: [2, 1], // initial bbox values; - max: [-1, 0] // note that coords are usually in [0..1] range - }; - calcBBox(feature); - return feature; -} - function project(lonlats, tolerance) { var projected = []; for (var i = 0; i < lonlats.length; i++) { @@ -60492,7 +59931,7 @@ function projectPoint(p) { x = (p[0] / 360 + 0.5), y = (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI); - y = y < -1 ? -1 : + y = y < 0 ? 0 : y > 1 ? 1 : y; return [x, y, 0]; @@ -60516,14 +59955,37 @@ function calcSize(points) { points.dist = dist; } +},{"./feature":376,"./simplify":378}],376:[function(require,module,exports){ +'use strict'; + +module.exports = createFeature; + +function createFeature(tags, type, geom, id) { + var feature = { + id: id || null, + type: type, + geometry: geom, + tags: tags || null, + min: [Infinity, Infinity], // initial bbox values + max: [-Infinity, -Infinity] + }; + calcBBox(feature); + return feature; +} + // calculate the feature bounding box for faster clipping later function calcBBox(feature) { var geometry = feature.geometry, min = feature.min, max = feature.max; - if (feature.type === 1) calcRingBBox(min, max, geometry); - else for (var i = 0; i < geometry.length; i++) calcRingBBox(min, max, geometry[i]); + if (feature.type === 1) { + calcRingBBox(min, max, geometry); + } else { + for (var i = 0; i < geometry.length; i++) { + calcRingBBox(min, max, geometry[i]); + } + } return feature; } @@ -60538,7 +60000,7 @@ function calcRingBBox(min, max, points) { } } -},{"./simplify":359}],358:[function(require,module,exports){ +},{}],377:[function(require,module,exports){ 'use strict'; module.exports = geojsonvt; @@ -60688,10 +60150,12 @@ GeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) { if (debug > 1) console.timeEnd('clipping'); - if (tl) stack.push(tl, z + 1, x * 2, y * 2); - if (bl) stack.push(bl, z + 1, x * 2, y * 2 + 1); - if (tr) stack.push(tr, z + 1, x * 2 + 1, y * 2); - if (br) stack.push(br, z + 1, x * 2 + 1, y * 2 + 1); + if (features.length) { + stack.push(tl || [], z + 1, x * 2, y * 2); + stack.push(bl || [], z + 1, x * 2, y * 2 + 1); + stack.push(tr || [], z + 1, x * 2 + 1, y * 2); + stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1); + } } return solid; @@ -60780,7 +60244,7 @@ function isClippedSquare(tile, extent, buffer) { return true; } -},{"./clip":356,"./convert":357,"./tile":360,"./transform":361,"./wrap":362}],359:[function(require,module,exports){ +},{"./clip":374,"./convert":375,"./tile":379,"./transform":380,"./wrap":381}],378:[function(require,module,exports){ 'use strict'; module.exports = simplify; @@ -60856,7 +60320,7 @@ function getSqSegDist(p, a, b) { return dx * dx + dy * dy; } -},{}],360:[function(require,module,exports){ +},{}],379:[function(require,module,exports){ 'use strict'; module.exports = createTile; @@ -60930,20 +60394,41 @@ function addFeature(tile, feature, tolerance, noSimplify) { tile.numPoints++; } + if (type === 3) rewind(simplifiedRing, ring.outer); + simplified.push(simplifiedRing); } } if (simplified.length) { - tile.features.push({ + var tileFeature = { geometry: simplified, type: type, tags: feature.tags || null - }); + }; + if (feature.id !== null) { + tileFeature.id = feature.id; + } + tile.features.push(tileFeature); } } -},{}],361:[function(require,module,exports){ +function rewind(ring, clockwise) { + var area = signedArea(ring); + if (area < 0 === clockwise) ring.reverse(); +} + +function signedArea(ring) { + var sum = 0; + for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) { + p1 = ring[i]; + p2 = ring[j]; + sum += (p2[0] - p1[0]) * (p1[1] + p2[1]); + } + return sum; +} + +},{}],380:[function(require,module,exports){ 'use strict'; exports.tile = transformTile; @@ -60986,10 +60471,11 @@ function transformPoint(p, extent, z2, tx, ty) { return [x, y]; } -},{}],362:[function(require,module,exports){ +},{}],381:[function(require,module,exports){ 'use strict'; var clip = require('./clip'); +var createFeature = require('./feature'); module.exports = wrap; @@ -60999,7 +60485,7 @@ function wrap(features, buffer, intersectX) { right = clip(features, 1, 1 - buffer, 2 + buffer, 0, intersectX, -1, 2); // right world copy if (left || right) { - merged = clip(features, 1, -buffer, 1 + buffer, 0, intersectX, -1, 2); // center world copy + merged = clip(features, 1, -buffer, 1 + buffer, 0, intersectX, -1, 2) || []; // center world copy if (left) merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center if (right) merged = merged.concat(shiftFeatureCoords(right, -1)); // merge right into center @@ -61026,13 +60512,7 @@ function shiftFeatureCoords(features, offset) { } } - newFeatures.push({ - geometry: newGeometry, - type: type, - tags: feature.tags, - min: [feature.min[0] + offset, feature.min[1]], - max: [feature.max[0] + offset, feature.max[1]] - }); + newFeatures.push(createFeature(feature.tags, type, newGeometry, feature.id)); } return newFeatures; @@ -61049,7 +60529,7 @@ function shiftCoords(points, offset) { return newPoints; } -},{"./clip":356}],363:[function(require,module,exports){ +},{"./clip":374,"./feature":376}],382:[function(require,module,exports){ /** * @fileoverview gl-matrix - High performance matrix and vector operations * @author Brandon Jones @@ -61087,7 +60567,7 @@ exports.quat = require("./gl-matrix/quat.js"); exports.vec2 = require("./gl-matrix/vec2.js"); exports.vec3 = require("./gl-matrix/vec3.js"); exports.vec4 = require("./gl-matrix/vec4.js"); -},{"./gl-matrix/common.js":364,"./gl-matrix/mat2.js":365,"./gl-matrix/mat2d.js":366,"./gl-matrix/mat3.js":367,"./gl-matrix/mat4.js":368,"./gl-matrix/quat.js":369,"./gl-matrix/vec2.js":370,"./gl-matrix/vec3.js":371,"./gl-matrix/vec4.js":372}],364:[function(require,module,exports){ +},{"./gl-matrix/common.js":383,"./gl-matrix/mat2.js":384,"./gl-matrix/mat2d.js":385,"./gl-matrix/mat3.js":386,"./gl-matrix/mat4.js":387,"./gl-matrix/quat.js":388,"./gl-matrix/vec2.js":389,"./gl-matrix/vec3.js":390,"./gl-matrix/vec4.js":391}],383:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -61159,7 +60639,7 @@ glMatrix.equals = function(a, b) { module.exports = glMatrix; -},{}],365:[function(require,module,exports){ +},{}],384:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -61597,7 +61077,7 @@ mat2.multiplyScalarAndAdd = function(out, a, b, scale) { module.exports = mat2; -},{"./common.js":364}],366:[function(require,module,exports){ +},{"./common.js":383}],385:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -62068,7 +61548,7 @@ mat2d.equals = function (a, b) { module.exports = mat2d; -},{"./common.js":364}],367:[function(require,module,exports){ +},{"./common.js":383}],386:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -62816,7 +62296,7 @@ mat3.equals = function (a, b) { module.exports = mat3; -},{"./common.js":364}],368:[function(require,module,exports){ +},{"./common.js":383}],387:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -64954,7 +64434,7 @@ mat4.equals = function (a, b) { module.exports = mat4; -},{"./common.js":364}],369:[function(require,module,exports){ +},{"./common.js":383}],388:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -65556,7 +65036,7 @@ quat.equals = vec4.equals; module.exports = quat; -},{"./common.js":364,"./mat3.js":367,"./vec3.js":371,"./vec4.js":372}],370:[function(require,module,exports){ +},{"./common.js":383,"./mat3.js":386,"./vec3.js":390,"./vec4.js":391}],389:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -66145,7 +65625,7 @@ vec2.equals = function (a, b) { module.exports = vec2; -},{"./common.js":364}],371:[function(require,module,exports){ +},{"./common.js":383}],390:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -66924,7 +66404,7 @@ vec3.equals = function (a, b) { module.exports = vec3; -},{"./common.js":364}],372:[function(require,module,exports){ +},{"./common.js":383}],391:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -67535,7 +67015,7 @@ vec4.equals = function (a, b) { module.exports = vec4; -},{"./common.js":364}],373:[function(require,module,exports){ +},{"./common.js":383}],392:[function(require,module,exports){ 'use strict'; module.exports = GridIndex; @@ -67609,7 +67089,10 @@ GridIndex.prototype.query = function(x1, y1, x2, y2) { var min = this.min; var max = this.max; if (x1 <= min && y1 <= min && max <= x2 && max <= y2) { - return this.keys.slice(); + // We use `Array#slice` because `this.keys` may be a `Int32Array` and + // some browsers (Safari and IE) do not support `TypedArray#slice` + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice#Browser_compatibility + return Array.prototype.slice.call(this.keys); } else { var result = []; @@ -67694,7 +67177,7 @@ GridIndex.prototype.toArrayBuffer = function() { return array.buffer; }; -},{}],374:[function(require,module,exports){ +},{}],393:[function(require,module,exports){ 'use strict'; function createFunction(parameters, defaultType) { @@ -67861,131 +67344,69 @@ module.exports['piecewise-constant'] = function(parameters) { return createFunction(parameters, 'interval'); }; -},{}],375:[function(require,module,exports){ -'use strict'; - -if (typeof module !== 'undefined' && module.exports) { - module.exports = isSupported; -} else if (window) { - window.mapboxgl = window.mapboxgl || {}; - window.mapboxgl.supported = isSupported; -} - -/** - * Test whether the current browser supports Mapbox GL JS - * @param {Object} options - * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false` - * if the performance of Mapbox GL JS would be dramatically worse than - * expected (i.e. a software renderer is would be used) - * @return {boolean} - */ -function isSupported(options) { - return !!( - isBrowser() && - isArraySupported() && - isFunctionSupported() && - isObjectSupported() && - isJSONSupported() && - isWorkerSupported() && - isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat) - ); -} - -function isBrowser() { - return typeof window !== 'undefined' && typeof document !== 'undefined'; -} - -function isArraySupported() { - return ( - Array.prototype && - Array.prototype.every && - Array.prototype.filter && - Array.prototype.forEach && - Array.prototype.indexOf && - Array.prototype.lastIndexOf && - Array.prototype.map && - Array.prototype.some && - Array.prototype.reduce && - Array.prototype.reduceRight && - Array.isArray - ); -} - -function isFunctionSupported() { - return Function.prototype && Function.prototype.bind; -} - -function isObjectSupported() { - return ( - Object.keys && - Object.create && - Object.getPrototypeOf && - Object.getOwnPropertyNames && - Object.isSealed && - Object.isFrozen && - Object.isExtensible && - Object.getOwnPropertyDescriptor && - Object.defineProperty && - Object.defineProperties && - Object.seal && - Object.freeze && - Object.preventExtensions - ); -} - -function isJSONSupported() { - return 'JSON' in window && 'parse' in JSON && 'stringify' in JSON; -} - -function isWorkerSupported() { - return 'Worker' in window; -} - -var isWebGLSupportedCache = {}; -function isWebGLSupportedCached(failIfMajorPerformanceCaveat) { - - if (isWebGLSupportedCache[failIfMajorPerformanceCaveat] === undefined) { - isWebGLSupportedCache[failIfMajorPerformanceCaveat] = isWebGLSupported(failIfMajorPerformanceCaveat); - } +},{}],394:[function(require,module,exports){ - return isWebGLSupportedCache[failIfMajorPerformanceCaveat]; -} +var path = require('path'); -isSupported.webGLContextAttributes = { - antialias: false, - alpha: true, - stencil: true, - depth: true +// readFileSync calls must be written out long-form for brfs. +module.exports = { + debug: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n" + }, + fill: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n" + }, + circle: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n float t = smoothstep(1.0 - max(blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = color * (1.0 - t) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform bool u_scale_with_map;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main(void) {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize mediump float radius\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n if (u_scale_with_map) {\n gl_Position.xy += extrude;\n } else {\n gl_Position.xy += extrude * gl_Position.w;\n }\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n" + }, + line: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_linewidth;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\nuniform mediump float u_blur;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" + }, + linepattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" + }, + linesdfpattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" + }, + outline: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" + }, + outlinepattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" + }, + pattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n" + }, + raster: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n" + }, + icon: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" + }, + sdf: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" + }, + collisionbox: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n" + } }; -function isWebGLSupported(failIfMajorPerformanceCaveat) { - - var canvas = document.createElement('canvas'); - - var attributes = Object.create(isSupported.webGLContextAttributes); - attributes.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat; - - if (canvas.probablySupportsContext) { - return ( - canvas.probablySupportsContext('webgl', attributes) || - canvas.probablySupportsContext('experimental-webgl', attributes) - ); - - } else if (canvas.supportsContext) { - return ( - canvas.supportsContext('webgl', attributes) || - canvas.supportsContext('experimental-webgl', attributes) - ); - - } else { - return ( - canvas.getContext('webgl', attributes) || - canvas.getContext('experimental-webgl', attributes) - ); - } -} +module.exports.util = "float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"; -},{}],376:[function(require,module,exports){ +},{"path":58}],395:[function(require,module,exports){ 'use strict'; var format = require('util').format; @@ -68003,7 +67424,7 @@ function ValidationError(key, value /*, message, ...*/) { module.exports = ValidationError; -},{"util":62}],377:[function(require,module,exports){ +},{"util":67}],396:[function(require,module,exports){ 'use strict'; module.exports = function (output) { @@ -68016,7 +67437,7 @@ module.exports = function (output) { return output; }; -},{}],378:[function(require,module,exports){ +},{}],397:[function(require,module,exports){ 'use strict'; module.exports = function getType(val) { @@ -68035,7 +67456,7 @@ module.exports = function getType(val) { } }; -},{}],379:[function(require,module,exports){ +},{}],398:[function(require,module,exports){ 'use strict'; // Turn jsonlint-lines-primitives objects into primitive objects @@ -68047,7 +67468,7 @@ module.exports = function unbundle(value) { } }; -},{}],380:[function(require,module,exports){ +},{}],399:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68114,7 +67535,7 @@ module.exports = function validate(options) { } }; -},{"../error/validation_error":376,"../util/extend":377,"../util/get_type":378,"./validate_array":381,"./validate_boolean":382,"./validate_color":383,"./validate_constants":384,"./validate_enum":385,"./validate_filter":386,"./validate_function":387,"./validate_layer":389,"./validate_number":391,"./validate_object":392,"./validate_source":394,"./validate_string":395}],381:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/extend":396,"../util/get_type":397,"./validate_array":400,"./validate_boolean":401,"./validate_color":402,"./validate_constants":403,"./validate_enum":404,"./validate_filter":405,"./validate_function":406,"./validate_layer":408,"./validate_number":410,"./validate_object":411,"./validate_source":413,"./validate_string":414}],400:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -68168,7 +67589,7 @@ module.exports = function validateArray(options) { return errors; }; -},{"../error/validation_error":376,"../util/get_type":378,"./validate":380}],382:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397,"./validate":399}],401:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -68186,7 +67607,7 @@ module.exports = function validateBoolean(options) { return []; }; -},{"../error/validation_error":376,"../util/get_type":378}],383:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397}],402:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68209,7 +67630,7 @@ module.exports = function validateColor(options) { return []; }; -},{"../error/validation_error":376,"../util/get_type":378,"csscolorparser":351}],384:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397,"csscolorparser":368}],403:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68243,7 +67664,7 @@ module.exports = function validateConstants(options) { }; -},{"../error/validation_error":376,"../util/get_type":378}],385:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397}],404:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68261,7 +67682,7 @@ module.exports = function validateEnum(options) { return errors; }; -},{"../error/validation_error":376,"../util/unbundle_jsonlint":379}],386:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/unbundle_jsonlint":398}],405:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68366,7 +67787,7 @@ module.exports = function validateFilter(options) { return errors; }; -},{"../error/validation_error":376,"../util/get_type":378,"../util/unbundle_jsonlint":379,"./validate_enum":385}],387:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397,"../util/unbundle_jsonlint":398,"./validate_enum":404}],406:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68377,12 +67798,13 @@ var validateArray = require('./validate_array'); var validateNumber = require('./validate_number'); module.exports = function validateFunction(options) { - var originalValueSpec = options.valueSpec; - var originalValue = options.value; - + var functionValueSpec = options.valueSpec; var stopKeyType; - return validateObject({ + var isPropertyFunction = options.value.property !== undefined || stopKeyType === 'object'; + var isZoomFunction = options.value.property === undefined || stopKeyType === 'object'; + + var errors = validateObject({ key: options.key, value: options.value, valueSpec: options.styleSpec.function, @@ -68391,6 +67813,16 @@ module.exports = function validateFunction(options) { objectElementValidators: { stops: validateFunctionStops } }); + if (options.styleSpec.$version >= 8) { + if (isPropertyFunction && !options.valueSpec['property-function']) { + errors.push(new ValidationError(options.key, options.value, 'property functions not supported')); + } else if (isZoomFunction && !options.valueSpec['zoom-function']) { + errors.push(new ValidationError(options.key, options.value, 'zoom functions not supported')); + } + } + + return errors; + function validateFunctionStops(options) { var errors = []; var value = options.value; @@ -68446,7 +67878,6 @@ module.exports = function validateFunction(options) { objectElementValidators: { zoom: validateNumber, value: validateValue } })); } else { - var isZoomFunction = !originalValue.property; errors = errors.concat((isZoomFunction ? validateNumber : validateValue)({ key: key + '[0]', value: value[0], @@ -68459,13 +67890,13 @@ module.exports = function validateFunction(options) { errors = errors.concat(validate({ key: key + '[1]', value: value[1], - valueSpec: originalValueSpec, + valueSpec: functionValueSpec, style: options.style, styleSpec: options.styleSpec })); if (getType(value[0]) === 'number') { - if (originalValueSpec.function === 'piecewise-constant' && value[0] % 1 !== 0) { + if (functionValueSpec.function === 'piecewise-constant' && value[0] % 1 !== 0) { errors.push(new ValidationError(key + '[0]', value[0], 'zoom level for piecewise-constant functions must be an integer')); } @@ -68490,7 +67921,7 @@ module.exports = function validateFunction(options) { }; -},{"../error/validation_error":376,"../util/get_type":378,"./validate":380,"./validate_array":381,"./validate_number":391,"./validate_object":392}],388:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397,"./validate":399,"./validate_array":400,"./validate_number":410,"./validate_object":411}],407:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68514,7 +67945,7 @@ module.exports = function(options) { return errors; }; -},{"../error/validation_error":376,"./validate_string":395}],389:[function(require,module,exports){ +},{"../error/validation_error":395,"./validate_string":414}],408:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68572,7 +68003,7 @@ module.exports = function validateLayer(options) { if (!layer.source) { errors.push(new ValidationError(key, layer, 'missing required property "source"')); } else { - var source = style.sources[layer.source]; + var source = style.sources && style.sources[layer.source]; if (!source) { errors.push(new ValidationError(key, layer.source, 'source "%s" not found', layer.source)); } else if (source.type == 'vector' && type == 'raster') { @@ -68627,7 +68058,7 @@ module.exports = function validateLayer(options) { return errors; }; -},{"../error/validation_error":376,"../util/extend":377,"../util/unbundle_jsonlint":379,"./validate_filter":386,"./validate_layout_property":390,"./validate_object":392,"./validate_paint_property":393}],390:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/extend":396,"../util/unbundle_jsonlint":398,"./validate_filter":405,"./validate_layout_property":409,"./validate_object":411,"./validate_paint_property":412}],409:[function(require,module,exports){ 'use strict'; var validate = require('./validate'); @@ -68666,7 +68097,7 @@ module.exports = function validateLayoutProperty(options) { }; -},{"../error/validation_error":376,"./validate":380}],391:[function(require,module,exports){ +},{"../error/validation_error":395,"./validate":399}],410:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -68693,7 +68124,7 @@ module.exports = function validateNumber(options) { return []; }; -},{"../error/validation_error":376,"../util/get_type":378}],392:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397}],411:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68746,7 +68177,7 @@ module.exports = function validateObject(options) { return errors; }; -},{"../error/validation_error":376,"../util/get_type":378,"./validate":380}],393:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397,"./validate":399}],412:[function(require,module,exports){ 'use strict'; var validate = require('./validate'); @@ -68786,7 +68217,7 @@ module.exports = function validatePaintProperty(options) { }; -},{"../error/validation_error":376,"./validate":380}],394:[function(require,module,exports){ +},{"../error/validation_error":395,"./validate":399}],413:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68863,7 +68294,7 @@ module.exports = function validateSource(options) { } }; -},{"../error/validation_error":376,"../util/unbundle_jsonlint":379,"./validate_enum":385,"./validate_object":392}],395:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/unbundle_jsonlint":398,"./validate_enum":404,"./validate_object":411}],414:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -68881,7 +68312,7 @@ module.exports = function validateString(options) { return []; }; -},{"../error/validation_error":376,"../util/get_type":378}],396:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397}],415:[function(require,module,exports){ 'use strict'; var validateConstants = require('./validate/validate_constants'); @@ -68951,13 +68382,13 @@ function wrapCleanErrors(inner) { module.exports = validateStyleMin; -},{"../reference/latest.min":398,"./validate/validate":380,"./validate/validate_constants":384,"./validate/validate_filter":386,"./validate/validate_glyphs_url":388,"./validate/validate_layer":389,"./validate/validate_layout_property":390,"./validate/validate_paint_property":393,"./validate/validate_source":394}],397:[function(require,module,exports){ +},{"../reference/latest.min":417,"./validate/validate":399,"./validate/validate_constants":403,"./validate/validate_filter":405,"./validate/validate_glyphs_url":407,"./validate/validate_layer":408,"./validate/validate_layout_property":409,"./validate/validate_paint_property":412,"./validate/validate_source":413}],416:[function(require,module,exports){ module.exports = require('./v8.json'); -},{"./v8.json":399}],398:[function(require,module,exports){ +},{"./v8.json":418}],417:[function(require,module,exports){ module.exports = require('./v8.min.json'); -},{"./v8.min.json":400}],399:[function(require,module,exports){ +},{"./v8.min.json":419}],418:[function(require,module,exports){ module.exports={ "$version": 8, "$root": { @@ -68965,7 +68396,7 @@ module.exports={ "required": true, "type": "enum", "values": [8], - "doc": "Stylesheet version number. Must be 8.", + "doc": "Style specification version number. Must be 8.", "example": 8 }, "name": { @@ -69280,155 +68711,279 @@ module.exports={ "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_fill": { "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_circle": { "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_line": { "line-cap": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "butt", "round", "square" ], "default": "butt", - "doc": "The display of line endings." + "doc": "The display of line endings.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-join": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "bevel", "round", "miter" ], "default": "miter", - "doc": "The display of lines when joining." + "doc": "The display of lines when joining.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-miter-limit": { "type": "number", "default": 2, "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Used to automatically convert miter joins to bevel joins for sharp angles.", "requires": [ { "line-join": "miter" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-round-limit": { "type": "number", "default": 1.05, "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Used to automatically convert round joins to miter joins for shallow angles.", "requires": [ { "line-join": "round" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_symbol": { "symbol-placement": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "point", "line" ], "default": "point", - "doc": "Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons." + "doc": "Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "symbol-spacing": { "type": "number", "default": 250, "minimum": 1, "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "pixels", "doc": "Distance between two symbol anchors.", "requires": [ { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "symbol-avoid-edges": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, - "doc": "If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer." + "doc": "If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-allow-overlap": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, the icon will be visible even if it collides with other previously drawn symbols.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-ignore-placement": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, other symbols can be visible even if they collide with the icon.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-optional": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.", "requires": [ "icon-image", "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-rotation-alignment": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -69437,49 +68992,141 @@ module.exports={ "doc": "Orientation of icon when map is rotated.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-size": { "type": "number", "default": 1, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Scale factor for icon. 1 is original size, 3 triples the size.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } + }, + "icon-text-fit": { + "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": false, + "values": [ + "none", + "both", + "width", + "height" + ], + "default": "none", + "doc": "Position and scale an icon by the its corresponding text.", + "requires": [ + "icon-image", + "text-field" + ], + "sdk-support": { + "basic": { + } + } + }, + "icon-text-fit-padding": { + "type": "array", + "value": "number", + "length": 4, + "default": [ + 0, + 0, + 0, + 0 + ], + "units": "pixels", + "function": "interpolated", + "zoom-function": true, + "property-function": true, + "doc": "Size of padding area around the text-fit size in clockwise order: top, right, bottom, left.", + "requires": [ + "icon-image", + "icon-text-fit", + "text-field" + ], + "sdk-support": { + "basic": { + } + } }, "icon-image": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "doc": "A string with {tokens} replaced, referencing the data property to pull from.", - "tokens": true + "tokens": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-rotate": { "type": "number", "default": 0, "period": 360, "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "degrees", "doc": "Rotates the icon clockwise.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-padding": { "type": "number", "default": 2, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "pixels", "doc": "Size of the additional area around the icon bounding box used for detecting symbol collisions.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-keep-upright": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, the icon may be flipped to prevent it from being rendered upside-down.", "requires": [ @@ -69490,7 +69137,14 @@ module.exports={ { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-offset": { "type": "array", @@ -69501,14 +69155,43 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } + }, + "text-pitch-alignment": { + "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, + "values": [ + "map", + "viewport" + ], + "doc": "Aligns text to the plane of the `viewport` or the `map` when the map is pitched. Matches `text-rotation-alignment` if unspecified.", + "requires": [ + "text-field" + ], + "sdk-support": { + "basic": { + } + } }, "text-rotation-alignment": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -69517,24 +69200,49 @@ module.exports={ "doc": "Orientation of text when map is rotated.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-field": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": "", "tokens": true, - "doc": "Value to use for a text label. Feature properties are specified using tokens like {field_name}." + "doc": "Value to use for a text label. Feature properties are specified using tokens like {field_name}.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-font": { "type": "array", "value": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": ["Open Sans Regular", "Arial Unicode MS Regular"], "doc": "Font stack to use for displaying text.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-size": { "type": "number", @@ -69542,10 +69250,19 @@ module.exports={ "minimum": 0, "units": "pixels", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Font size.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-max-width": { "type": "number", @@ -69553,34 +69270,63 @@ module.exports={ "minimum": 0, "units": "em", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "The maximum line width for text wrapping.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-line-height": { "type": "number", "default": 1.2, "units": "em", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Text leading value for multi-line text.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-letter-spacing": { "type": "number", "default": 0, "units": "em", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Text tracking amount.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-justify": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "left", "center", @@ -69590,11 +69336,20 @@ module.exports={ "doc": "Text justification options.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "center", "left", @@ -69610,20 +69365,36 @@ module.exports={ "doc": "Part of the text placed closest to the anchor.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-max-angle": { "type": "number", "default": 45, "units": "degrees", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Maximum angle change between adjacent characters.", "requires": [ "text-field", { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-rotate": { "type": "number", @@ -69631,10 +69402,19 @@ module.exports={ "period": 360, "units": "degrees", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Rotates the text clockwise.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-padding": { "type": "number", @@ -69642,14 +69422,25 @@ module.exports={ "minimum": 0, "units": "pixels", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Size of the additional area around the text bounding box used for detecting symbol collisions.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-keep-upright": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": true, "doc": "If true, the text may be flipped vertically to prevent it from being rendered upside-down.", "requires": [ @@ -69660,11 +69451,20 @@ module.exports={ { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-transform": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "none", "uppercase", @@ -69674,7 +69474,14 @@ module.exports={ "doc": "Specifies how to capitalize text, similar to the CSS `text-transform` property.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-offset": { "type": "array", @@ -69682,6 +69489,8 @@ module.exports={ "value": "number", "units": "ems", "function": "interpolated", + "zoom-function": true, + "property-function": true, "length": 2, "default": [ 0, @@ -69689,57 +69498,107 @@ module.exports={ ], "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-allow-overlap": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, the text will be visible even if it collides with other previously drawn symbols.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-ignore-placement": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, other symbols can be visible even if they collide with the text.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-optional": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.", "requires": [ "text-field", "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_raster": { "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "filter": { @@ -69838,34 +69697,66 @@ module.exports={ "fill-antialias": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": true, - "doc": "Whether or not the fill should be antialiased." + "doc": "Whether or not the fill should be antialiased.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-opacity": { "type": "number", "function": "interpolated", + "zoom-function": true, + "property-function": true, "default": 1, "minimum": 0, "maximum": 1, - "doc": "The opacity given to the fill color.", - "transition": true + "doc": "The opacity of the entire fill layer. In contrast to the fill-color, this value will also affect the 1px stroke around the fill, if the stroke is used.", + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-color": { "type": "color", "default": "#000000", - "doc": "The color of the fill.", + "doc": "The color of the filled part of this layer. This color can be specified as rgba with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { "!": "fill-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.19.0" + } + } }, "fill-outline-color": { "type": "color", "doc": "The outline color of the fill. Matches the value of `fill-color` if unspecified.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { @@ -69874,7 +69765,17 @@ module.exports={ { "fill-antialias": true } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.19.0" + } + } }, "fill-translate": { "type": "array", @@ -69885,13 +69786,24 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively." + "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -69900,13 +69812,29 @@ module.exports={ "default": "map", "requires": [ "fill-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-pattern": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "transition": true, - "doc": "Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)." + "doc": "Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_line": { @@ -69914,22 +69842,40 @@ module.exports={ "type": "number", "doc": "The opacity at which the line will be drawn.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "default": 1, "minimum": 0, "maximum": 1, - "transition": true + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-color": { "type": "color", "doc": "The color with which the line will be drawn.", "default": "#000000", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { "!": "line-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-translate": { "type": "array", @@ -69940,13 +69886,24 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively." + "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -69955,16 +69912,32 @@ module.exports={ "default": "map", "requires": [ "line-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-width": { "type": "number", "default": 1, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "Stroke thickness." + "doc": "Stroke thickness.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-gap-width": { "type": "number", @@ -69972,30 +69945,59 @@ module.exports={ "minimum": 0, "doc": "Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, - "units": "pixels" + "units": "pixels", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-offset": { "type": "number", "default": 0, "doc": "The line's offset perpendicular to its direction. Values may be positive or negative, where positive indicates \"rightwards\" (if you were moving in the direction of the line) and negative indicates \"leftwards.\"", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, - "units": "pixels" + "units": "pixels", + "sdk-support": { + "basic": { + "js": "0.12.1", + "ios": "3.1.0", + "android": "3.0.0" + } + } }, "line-blur": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "Blur applied to the line, in pixels." + "doc": "Blur applied to the line, in pixels.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-dasharray": { "type": "array", "value": "number", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "doc": "Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.", "minimum": 0, "transition": true, @@ -70004,13 +70006,29 @@ module.exports={ { "!": "line-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-pattern": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "transition": true, - "doc": "Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512)." + "doc": "Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_circle": { @@ -70019,23 +70037,59 @@ module.exports={ "default": 5, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "Circle radius." + "doc": "Circle radius.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.18.0" + } + } }, "circle-color": { "type": "color", "default": "#000000", "doc": "The color of the circle.", "function": "interpolated", - "transition": true + "zoom-function": true, + "property-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.18.0" + } + } }, "circle-blur": { "type": "number", "default": 0, "doc": "Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.", "function": "interpolated", - "transition": true + "zoom-function": true, + "property-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.20.0" + } + } }, "circle-opacity": { "type": "number", @@ -70044,7 +70098,19 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "property-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.20.0" + } + } }, "circle-translate": { "type": "array", @@ -70052,13 +70118,24 @@ module.exports={ "length": 2, "default": [0, 0], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively." + "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "circle-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -70067,7 +70144,30 @@ module.exports={ "default": "map", "requires": [ "circle-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } + }, + "circle-pitch-scale": { + "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, + "values": [ + "map", + "viewport" + ], + "default": "map", + "doc": "Controls the scaling behavior of the circle when the map is pitched. The value `map` scales circles according to their apparent distance to the camera. The value `viewport` results in no pitch-related scaling.", + "sdk-support": { + "basic": { + } + } } }, "paint_symbol": { @@ -70078,54 +70178,99 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-color": { "type": "color", "default": "#000000", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the icon. This can only be used with sdf icons.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-halo-color": { "type": "color", "default": "rgba(0, 0, 0, 0)", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the icon's halo. Icon halos can only be used with sdf icons.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-halo-width": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance of halo to the icon outline.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-halo-blur": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Fade out the halo towards the outside.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-translate": { "type": "array", @@ -70136,16 +70281,27 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -70155,7 +70311,14 @@ module.exports={ "requires": [ "icon-image", "icon-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-opacity": { "type": "number", @@ -70164,54 +70327,99 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-color": { "type": "color", "doc": "The color with which the text will be drawn.", "default": "#000000", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-halo-color": { "type": "color", "default": "rgba(0, 0, 0, 0)", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the text's halo, which helps it stand out from backgrounds.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-halo-width": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-halo-blur": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "The halo's fadeout distance towards the outside.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-translate": { "type": "array", @@ -70222,16 +70430,27 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -70241,7 +70460,14 @@ module.exports={ "requires": [ "text-field", "text-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_raster": { @@ -70252,34 +70478,66 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-hue-rotate": { "type": "number", "default": 0, "period": 360, "function": "interpolated", + "zoom-function": true, "transition": true, "units": "degrees", - "doc": "Rotates hues around the color wheel." + "doc": "Rotates hues around the color wheel.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-brightness-min": { "type": "number", "function": "interpolated", + "zoom-function": true, "doc": "Increase or reduce the brightness of the image. The value is the minimum brightness.", "default": 0, "minimum": 0, "maximum": 1, - "transition": true + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-brightness-max": { "type": "number", "function": "interpolated", + "zoom-function": true, "doc": "Increase or reduce the brightness of the image. The value is the maximum brightness.", "default": 1, "minimum": 0, "maximum": 1, - "transition": true + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-saturation": { "type": "number", @@ -70288,7 +70546,15 @@ module.exports={ "minimum": -1, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-contrast": { "type": "number", @@ -70297,16 +70563,32 @@ module.exports={ "minimum": -1, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-fade-duration": { "type": "number", "default": 300, "minimum": 0, "function": "interpolated", + "zoom-function": true, "transition": true, "units": "milliseconds", - "doc": "Fade duration when a new tile is added." + "doc": "Fade duration when a new tile is added.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_background": { @@ -70315,18 +70597,34 @@ module.exports={ "default": "#000000", "doc": "The color with which the background will be drawn.", "function": "interpolated", + "zoom-function": true, "transition": true, "requires": [ { "!": "background-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "background-pattern": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, "transition": true, - "doc": "Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)." + "doc": "Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "background-opacity": { "type": "number", @@ -70335,7 +70633,15 @@ module.exports={ "maximum": 1, "doc": "The opacity at which the background will be drawn.", "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "transition": { @@ -70356,9 +70662,140 @@ module.exports={ } } -},{}],400:[function(require,module,exports){ -module.exports={"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"type":"enum","values":["vector","raster"]},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":["geojson"]},"data":{"type":"*"},"maxzoom":{"type":"number","default":14},"buffer":{"type":"number","default":64},"tolerance":{"type":"number","default":3},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":400},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":["video"]},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":["image"]},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":["fill","line","symbol","circle","raster","background"]},"metadata":{"type":"*"},"ref":{"type":"string"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":22},"maxzoom":{"type":"number","minimum":0,"maximum":22},"interactive":{"type":"boolean","default":false},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"paint.*":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],"layout_background":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","values":["butt","round","square"],"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","values":["bevel","round","miter"],"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","requires":[{"line-join":"round"}]},"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","values":["point","line"],"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"viewport","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","requires":["icon-image"]},"icon-image":{"type":"string","function":"piecewise-constant","tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","requires":["icon-image"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"viewport","requires":["text-field"]},"text-field":{"type":"string","function":"piecewise-constant","default":"","tokens":true},"text-font":{"type":"array","value":"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"]},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","function":"interpolated","requires":["text-field"]},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"em","function":"interpolated","requires":["text-field"]},"text-line-height":{"type":"number","default":1.2,"units":"em","function":"interpolated","requires":["text-field"]},"text-letter-spacing":{"type":"number","default":0,"units":"em","function":"interpolated","requires":["text-field"]},"text-justify":{"type":"enum","function":"piecewise-constant","values":["left","center","right"],"default":"center","requires":["text-field"]},"text-anchor":{"type":"enum","function":"piecewise-constant","values":["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center","requires":["text-field"]},"text-max-angle":{"type":"number","default":45,"units":"degrees","function":"interpolated","requires":["text-field",{"symbol-placement":"line"}]},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","function":"interpolated","requires":["text-field"]},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","function":"interpolated","requires":["text-field"]},"text-keep-upright":{"type":"boolean","function":"piecewise-constant","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{"type":"enum","function":"piecewise-constant","values":["none","uppercase","lowercase"],"default":"none","requires":["text-field"]},"text-offset":{"type":"array","value":"number","units":"ems","function":"interpolated","length":2,"default":[0,0],"requires":["text-field"]},"text-allow-overlap":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["text-field"]},"text-ignore-placement":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["text-field"]},"text-optional":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["text-field","icon-image"]},"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_raster":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"filter":{"type":"array","value":"*"},"filter_operator":{"type":"enum","values":["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},"geometry_type":{"type":"enum","values":["Point","LineString","Polygon"]},"color_operation":{"type":"enum","values":["lighten","saturate","spin","fade","mix"]},"function":{"stops":{"type":"array","required":true,"value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":["exponential","interval","categorical"],"default":"exponential"}},"function_stop":{"type":"array","minimum":0,"maximum":22,"value":["number","color"],"length":2},"paint":["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],"paint_fill":{"fill-antialias":{"type":"boolean","function":"piecewise-constant","default":true},"fill-opacity":{"type":"number","function":"interpolated","default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","transition":true}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["circle-translate"]}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["text-field","text-translate"]}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} -},{}],401:[function(require,module,exports){ +},{}],419:[function(require,module,exports){ +module.exports={"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"type":"enum","values":["vector","raster"]},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":["geojson"]},"data":{"type":"*"},"maxzoom":{"type":"number","default":14},"buffer":{"type":"number","default":64},"tolerance":{"type":"number","default":3},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":400},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":["video"]},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":["image"]},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":["fill","line","symbol","circle","raster","background"]},"metadata":{"type":"*"},"ref":{"type":"string"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":22},"maxzoom":{"type":"number","minimum":0,"maximum":22},"interactive":{"type":"boolean","default":false},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"paint.*":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],"layout_background":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["butt","round","square"],"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["bevel","round","miter"],"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"round"}]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["point","line"],"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"viewport","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"icon-text-fit":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":false,"values":["none","both","width","height"],"default":"none","requires":["icon-image","text-field"]},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image","icon-text-fit","text-field"]},"icon-image":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"property-function":true,"units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"text-pitch-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"requires":["text-field"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"viewport","requires":["text-field"]},"text-field":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":"","tokens":true},"text-font":{"type":"array","value":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"]},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-line-height":{"type":"number","default":1.2,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-letter-spacing":{"type":"number","default":0,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-justify":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["left","center","right"],"default":"center","requires":["text-field"]},"text-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center","requires":["text-field"]},"text-max-angle":{"type":"number","default":45,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field",{"symbol-placement":"line"}]},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["none","uppercase","lowercase"],"default":"none","requires":["text-field"]},"text-offset":{"type":"array","value":"number","units":"ems","function":"interpolated","zoom-function":true,"property-function":true,"length":2,"default":[0,0],"requires":["text-field"]},"text-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field","icon-image"]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_raster":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"filter":{"type":"array","value":"*"},"filter_operator":{"type":"enum","values":["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},"geometry_type":{"type":"enum","values":["Point","LineString","Polygon"]},"color_operation":{"type":"enum","values":["lighten","saturate","spin","fade","mix"]},"function":{"stops":{"type":"array","required":true,"value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":["exponential","interval","categorical"],"default":"exponential"}},"function_stop":{"type":"array","minimum":0,"maximum":22,"value":["number","color"],"length":2},"paint":["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],"paint_fill":{"fill-antialias":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":true},"fill-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","zoom-function":true,"property-function":true,"minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["circle-translate"]},"circle-pitch-scale":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["text-field","text-translate"]}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","zoom-function":true,"default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","zoom-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","zoom-function":true,"transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} +},{}],420:[function(require,module,exports){ +'use strict'; + +if (typeof module !== 'undefined' && module.exports) { + module.exports = isSupported; +} else if (window) { + window.mapboxgl = window.mapboxgl || {}; + window.mapboxgl.supported = isSupported; +} + +/** + * Test whether the current browser supports Mapbox GL JS + * @param {Object} options + * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false` + * if the performance of Mapbox GL JS would be dramatically worse than + * expected (i.e. a software renderer is would be used) + * @return {boolean} + */ +function isSupported(options) { + return !!( + isBrowser() && + isArraySupported() && + isFunctionSupported() && + isObjectSupported() && + isJSONSupported() && + isWorkerSupported() && + isUint8ClampedArraySupported() && + isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat) + ); +} + +function isBrowser() { + return typeof window !== 'undefined' && typeof document !== 'undefined'; +} + +function isArraySupported() { + return ( + Array.prototype && + Array.prototype.every && + Array.prototype.filter && + Array.prototype.forEach && + Array.prototype.indexOf && + Array.prototype.lastIndexOf && + Array.prototype.map && + Array.prototype.some && + Array.prototype.reduce && + Array.prototype.reduceRight && + Array.isArray + ); +} + +function isFunctionSupported() { + return Function.prototype && Function.prototype.bind; +} + +function isObjectSupported() { + return ( + Object.keys && + Object.create && + Object.getPrototypeOf && + Object.getOwnPropertyNames && + Object.isSealed && + Object.isFrozen && + Object.isExtensible && + Object.getOwnPropertyDescriptor && + Object.defineProperty && + Object.defineProperties && + Object.seal && + Object.freeze && + Object.preventExtensions + ); +} + +function isJSONSupported() { + return 'JSON' in window && 'parse' in JSON && 'stringify' in JSON; +} + +function isWorkerSupported() { + return 'Worker' in window; +} + +// IE11 only supports `Uint8ClampedArray` as of version +// [KB2929437](https://support.microsoft.com/en-us/kb/2929437) +function isUint8ClampedArraySupported() { + return 'Uint8ClampedArray' in window; +} + +var isWebGLSupportedCache = {}; +function isWebGLSupportedCached(failIfMajorPerformanceCaveat) { + + if (isWebGLSupportedCache[failIfMajorPerformanceCaveat] === undefined) { + isWebGLSupportedCache[failIfMajorPerformanceCaveat] = isWebGLSupported(failIfMajorPerformanceCaveat); + } + + return isWebGLSupportedCache[failIfMajorPerformanceCaveat]; +} + +isSupported.webGLContextAttributes = { + antialias: false, + alpha: true, + stencil: true, + depth: true +}; + +function isWebGLSupported(failIfMajorPerformanceCaveat) { + + var canvas = document.createElement('canvas'); + + var attributes = Object.create(isSupported.webGLContextAttributes); + attributes.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat; + + if (canvas.probablySupportsContext) { + return ( + canvas.probablySupportsContext('webgl', attributes) || + canvas.probablySupportsContext('experimental-webgl', attributes) + ); + + } else if (canvas.supportsContext) { + return ( + canvas.supportsContext('webgl', attributes) || + canvas.supportsContext('experimental-webgl', attributes) + ); + + } else { + return ( + canvas.getContext('webgl', attributes) || + canvas.getContext('experimental-webgl', attributes) + ); + } +} + +},{}],421:[function(require,module,exports){ 'use strict'; // lightweight Buffer shim for pbf browser build @@ -70519,7 +70956,7 @@ function encodeString(str) { return bytes; } -},{"ieee754":403}],402:[function(require,module,exports){ +},{"ieee754":423}],422:[function(require,module,exports){ (function (global){ 'use strict'; @@ -70945,9 +71382,9 @@ function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pb function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./buffer":401}],403:[function(require,module,exports){ -arguments[4][55][0].apply(exports,arguments) -},{"dup":55}],404:[function(require,module,exports){ +},{"./buffer":421}],423:[function(require,module,exports){ +arguments[4][54][0].apply(exports,arguments) +},{"dup":54}],424:[function(require,module,exports){ 'use strict'; module.exports = Point; @@ -71080,7 +71517,69 @@ Point.convert = function (a) { return a; }; -},{}],405:[function(require,module,exports){ +},{}],425:[function(require,module,exports){ +'use strict'; + +module.exports = partialSort; + +// Floyd-Rivest selection algorithm: +// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right]; +// The k-th element will have the (k - left + 1)th smallest value in [left, right] + +function partialSort(arr, k, left, right, compare) { + left = left || 0; + right = right || (arr.length - 1); + compare = compare || defaultCompare; + + while (right > left) { + if (right - left > 600) { + var n = right - left + 1; + var m = k - left + 1; + var z = Math.log(n); + var s = 0.5 * Math.exp(2 * z / 3); + var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); + var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); + var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); + partialSort(arr, k, newLeft, newRight, compare); + } + + var t = arr[k]; + var i = left; + var j = right; + + swap(arr, left, k); + if (compare(arr[right], t) > 0) swap(arr, left, right); + + while (i < j) { + swap(arr, i, j); + i++; + j--; + while (compare(arr[i], t) < 0) i++; + while (compare(arr[j], t) > 0) j--; + } + + if (compare(arr[left], t) === 0) swap(arr, left, j); + else { + j++; + swap(arr, j, right); + } + + if (j <= k) left = j + 1; + if (k <= j) right = j - 1; + } +} + +function swap(arr, i, j) { + var tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; +} + +function defaultCompare(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +} + +},{}],426:[function(require,module,exports){ // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) @@ -71129,11 +71628,12 @@ void (function(root, factory) { })); -},{}],406:[function(require,module,exports){ -'use strict'; - -module.exports = ShelfPack; - +},{}],427:[function(require,module,exports){ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.ShelfPack = factory()); +}(this, function () { /** * Create a new ShelfPack bin allocator. @@ -71199,6 +71699,23 @@ ShelfPack.prototype.pack = function(bins, options) { } } + // Shrink the width/height of the sprite to the bare minimum. + // Since shelf-pack doubles first width, then height when running out of shelf space + // this can result in fairly large unused space both in width and height if that happens + // towards the end of bin packing. + if (this.shelves.length > 0) { + var w2 = 0; + var h2 = 0; + + for (var j = 0; j < this.shelves.length; j++) { + var shelf = this.shelves[j]; + h2 += shelf.h; + w2 = Math.max(shelf.w - shelf.free, w2); + } + + this.resize(w2, h2); + } + return results; }; @@ -71292,7 +71809,6 @@ ShelfPack.prototype.clear = function() { /** * Resize the sprite. - * The resize will fail if the requested dimensions are smaller than the current sprite dimensions. * * @param {number} w Requested new sprite width * @param {number} h Requested new sprite height @@ -71301,10 +71817,6 @@ ShelfPack.prototype.clear = function() { * sprite.resize(256, 256); */ ShelfPack.prototype.resize = function(w, h) { - if (w < this.w || h < this.h) { - return false; - } - this.w = w; this.h = h; for (var i = 0; i < this.shelves.length; i++) { @@ -71355,7 +71867,6 @@ Shelf.prototype.alloc = function(w, h) { /** * Resize the shelf. - * The resize will fail if the requested width is smaller than the current shelf width. * * @private * @param {number} w Requested new width of the shelf @@ -71364,15 +71875,15 @@ Shelf.prototype.alloc = function(w, h) { * shelf.resize(512); */ Shelf.prototype.resize = function(w) { - if (w < this.w) { - return false; - } this.free += (w - this.w); this.w = w; return true; }; -},{}],407:[function(require,module,exports){ +return ShelfPack; + +})); +},{}],428:[function(require,module,exports){ 'use strict'; var kdbush = require('kdbush'); @@ -71587,7 +72098,7 @@ function getY(p) { return p.y; } -},{"kdbush":408}],408:[function(require,module,exports){ +},{"kdbush":429}],429:[function(require,module,exports){ 'use strict'; var sort = require('./sort'); @@ -71633,7 +72144,7 @@ KDBush.prototype = { function defaultGetX(p) { return p[0]; } function defaultGetY(p) { return p[1]; } -},{"./range":409,"./sort":410,"./within":411}],409:[function(require,module,exports){ +},{"./range":430,"./sort":431,"./within":432}],430:[function(require,module,exports){ 'use strict'; module.exports = range; @@ -71681,7 +72192,7 @@ function range(ids, coords, minX, minY, maxX, maxY, nodeSize) { return result; } -},{}],410:[function(require,module,exports){ +},{}],431:[function(require,module,exports){ 'use strict'; module.exports = sortKD; @@ -71749,7 +72260,7 @@ function swap(arr, i, j) { arr[j] = tmp; } -},{}],411:[function(require,module,exports){ +},{}],432:[function(require,module,exports){ 'use strict'; module.exports = within; @@ -71801,7 +72312,7 @@ function sqDist(ax, ay, bx, by) { return dx * dx + dy * dy; } -},{}],412:[function(require,module,exports){ +},{}],433:[function(require,module,exports){ /* * Copyright (C) 2008 Apple Inc. All Rights Reserved. * @@ -71908,12 +72419,12 @@ UnitBezier.prototype.solve = function(x, epsilon) { return this.sampleCurveY(this.solveCurveX(x, epsilon)); }; -},{}],413:[function(require,module,exports){ +},{}],434:[function(require,module,exports){ module.exports.VectorTile = require('./lib/vectortile.js'); module.exports.VectorTileFeature = require('./lib/vectortilefeature.js'); module.exports.VectorTileLayer = require('./lib/vectortilelayer.js'); -},{"./lib/vectortile.js":414,"./lib/vectortilefeature.js":415,"./lib/vectortilelayer.js":416}],414:[function(require,module,exports){ +},{"./lib/vectortile.js":435,"./lib/vectortilefeature.js":436,"./lib/vectortilelayer.js":437}],435:[function(require,module,exports){ 'use strict'; var VectorTileLayer = require('./vectortilelayer'); @@ -71932,7 +72443,7 @@ function readTile(tag, layers, pbf) { } -},{"./vectortilelayer":416}],415:[function(require,module,exports){ +},{"./vectortilelayer":437}],436:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -71955,7 +72466,7 @@ function VectorTileFeature(pbf, end, extent, keys, values) { } function readFeature(tag, feature, pbf) { - if (tag == 1) feature._id = pbf.readVarint(); + if (tag == 1) feature.id = pbf.readVarint(); else if (tag == 2) readTag(pbf, feature); else if (tag == 3) feature.type = pbf.readVarint(); else if (tag == 4) feature._geometry = pbf.pos; @@ -72120,8 +72631,8 @@ VectorTileFeature.prototype.toGeoJSON = function(x, y, z) { properties: this.properties }; - if ('_id' in this) { - result.id = this._id; + if ('id' in this) { + result.id = this.id; } return result; @@ -72167,7 +72678,7 @@ function signedArea(ring) { return sum; } -},{"point-geometry":404}],416:[function(require,module,exports){ +},{"point-geometry":424}],437:[function(require,module,exports){ 'use strict'; var VectorTileFeature = require('./vectortilefeature.js'); @@ -72230,7 +72741,7 @@ VectorTileLayer.prototype.feature = function(i) { return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values); }; -},{"./vectortilefeature.js":415}],417:[function(require,module,exports){ +},{"./vectortilefeature.js":436}],438:[function(require,module,exports){ var Pbf = require('pbf') var vtpb = require('./vector-tile-pb') var GeoJSONWrapper = require('./lib/geojson_wrapper') @@ -72370,22 +72881,23 @@ function wrapValue (value) { } else if (type === 'boolean') { result = { bool_value: value } } else if (type === 'number') { - if (value !== (value | 0)) { - result = { float_value: value } + if (value % 1 !== 0) { + result = { double_value: value } } else if (value < 0) { result = { sint_value: value } } else { result = { uint_value: value } } } else { - result = { string_value: '' + value } + value = JSON.stringify(value) + result = { string_value: value } } result.key = type + ':' + value return result } -},{"./lib/geojson_wrapper":418,"./vector-tile-pb":419,"pbf":402}],418:[function(require,module,exports){ +},{"./lib/geojson_wrapper":439,"./vector-tile-pb":440,"pbf":422}],439:[function(require,module,exports){ 'use strict' var Point = require('point-geometry') @@ -72404,6 +72916,7 @@ GeoJSONWrapper.prototype.feature = function (i) { } function FeatureWrapper (feature) { + this.id = typeof feature.id === 'number' ? feature.id : undefined this.type = feature.type this.rawGeometry = feature.type === 1 ? [feature.geometry] : feature.geometry this.properties = feature.tags @@ -72452,7 +72965,7 @@ FeatureWrapper.prototype.bbox = function () { FeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON -},{"point-geometry":404,"vector-tile":413}],419:[function(require,module,exports){ +},{"point-geometry":424,"vector-tile":434}],440:[function(require,module,exports){ 'use strict'; // tile ======================================== @@ -72558,7 +73071,7 @@ function writeLayer(layer, pbf) { if (layer.extent !== undefined) pbf.writeVarintField(5, layer.extent); } -},{}],420:[function(require,module,exports){ +},{}],441:[function(require,module,exports){ var bundleFn = arguments[3]; var sources = arguments[4]; var cache = arguments[5]; @@ -72623,13 +73136,412 @@ module.exports = function (fn, options) { if (options && options.bare) { return blob; } var workerUrl = URL.createObjectURL(blob); var worker = new Worker(workerUrl); - if (typeof URL.revokeObjectURL == "function") { - URL.revokeObjectURL(workerUrl); - } + worker.objectURL = workerUrl; return worker; }; -},{}],421:[function(require,module,exports){ +},{}],442:[function(require,module,exports){ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.WhooTS = global.WhooTS || {}))); +}(this, function (exports) { + +/** + * getURL + * + * @param {String} baseUrl Base url of the WMS server + * @param {String} layer Layer name + * @param {Number} x Tile coordinate x + * @param {Number} y Tile coordinate y + * @param {Number} z Tile zoom + * @param {Object} [options] + * @param {String} [options.format='image/png'] + * @param {String} [options.service='WMS'] + * @param {String} [options.version='1.1.1'] + * @param {String} [options.request='GetMap'] + * @param {String} [options.srs='EPSG:3857'] + * @param {Number} [options.width='256'] + * @param {Number} [options.height='256'] + * @returns {String} url + * @example + * var baseUrl = 'http://geodata.state.nj.us/imagerywms/Natural2015'; + * var layer = 'Natural2015'; + * var url = whoots.getURL(baseUrl, layer, 154308, 197167, 19); + */ +function getURL(baseUrl, layer, x, y, z, options) { + options = options || {}; + + var url = baseUrl + '?' + [ + 'bbox=' + getTileBBox(x, y, z), + 'format=' + (options.format || 'image/png'), + 'service=' + (options.service || 'WMS'), + 'version=' + (options.version || '1.1.1'), + 'request=' + (options.request || 'GetMap'), + 'srs=' + (options.srs || 'EPSG:3857'), + 'width=' + (options.width || 256), + 'height=' + (options.height || 256), + 'layers=' + layer + ].join('&'); + + return url; +} + + +/** + * getTileBBox + * + * @param {Number} x Tile coordinate x + * @param {Number} y Tile coordinate y + * @param {Number} z Tile zoom + * @returns {String} String of the bounding box + */ +function getTileBBox(x, y, z) { + // for Google/OSM tile scheme we need to alter the y + y = (Math.pow(2, z) - y - 1); + + var min = getMercCoords(x * 256, y * 256, z), + max = getMercCoords((x + 1) * 256, (y + 1) * 256, z); + + return min[0] + ',' + min[1] + ',' + max[0] + ',' + max[1]; +} + + +/** + * getMercCoords + * + * @param {Number} x Pixel coordinate x + * @param {Number} y Pixel coordinate y + * @param {Number} z Tile zoom + * @returns {Array} [x, y] + */ +function getMercCoords(x, y, z) { + var resolution = (2 * Math.PI * 6378137 / 256) / Math.pow(2, z), + merc_x = (x * resolution - 2 * Math.PI * 6378137 / 2.0), + merc_y = (y * resolution - 2 * Math.PI * 6378137 / 2.0); + + return [merc_x, merc_y]; +} + +exports.getURL = getURL; +exports.getTileBBox = getTileBBox; +exports.getMercCoords = getMercCoords; + +Object.defineProperty(exports, '__esModule', { value: true }); + +})); +},{}],443:[function(require,module,exports){ +module.exports={ + "name": "mapbox-gl", + "description": "A WebGL interactive maps library", + "version": "0.22.0", + "main": "js/mapbox-gl.js", + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "git://github.com/mapbox/mapbox-gl-js.git" + }, + "engines": { + "node": ">=4.0.0" + }, + "dependencies": { + "csscolorparser": "^1.0.2", + "earcut": "^2.0.3", + "feature-filter": "^2.2.0", + "geojson-rewind": "^0.1.0", + "geojson-vt": "^2.4.0", + "gl-matrix": "^2.3.1", + "grid-index": "^1.0.0", + "mapbox-gl-function": "^1.2.1", + "mapbox-gl-shaders": "github:mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747", + "mapbox-gl-style-spec": "github:mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae", + "mapbox-gl-supported": "^1.2.0", + "pbf": "^1.3.2", + "pngjs": "^2.2.0", + "point-geometry": "^0.0.0", + "quickselect": "^1.0.0", + "request": "^2.39.0", + "resolve-url": "^0.2.1", + "shelf-pack": "^1.0.0", + "supercluster": "^2.0.1", + "unassertify": "^2.0.0", + "unitbezier": "^0.0.0", + "vector-tile": "^1.3.0", + "vt-pbf": "^2.0.2", + "webworkify": "^1.3.0", + "whoots-js": "^2.0.0" + }, + "devDependencies": { + "async": "^2.0.1", + "babel-preset-react": "^6.11.1", + "babelify": "^7.3.0", + "benchmark": "~2.1.0", + "browserify": "^13.0.0", + "browserify-middleware": "^7.0.0", + "clipboard": "^1.5.12", + "concat-stream": "1.5.1", + "coveralls": "^2.11.8", + "doctrine": "^1.2.1", + "documentation": "https://github.com/documentationjs/documentation/archive/bb41619c734e59ef3fbc3648610032efcfdaaace.tar.gz", + "documentation-theme-utils": "3.0.0", + "envify": "^3.4.0", + "eslint": "^2.5.3", + "eslint-config-mourner": "^2.0.0", + "eslint-plugin-html": "^1.5.1", + "express": "^4.13.4", + "gl": "^4.0.1", + "handlebars": "4.0.5", + "highlight.js": "9.3.0", + "istanbul": "^0.4.2", + "json-loader": "^0.5.4", + "lodash": "^4.13.1", + "mapbox-gl-test-suite": "github:mapbox/mapbox-gl-test-suite#1619d84e76ff3434becd51237720d370c7405ee5", + "memory-fs": "^0.3.0", + "minifyify": "^7.0.1", + "nyc": "6.4.0", + "proxyquire": "^1.7.9", + "react": "^15.3.0", + "react-dom": "^15.3.0", + "remark": "4.2.2", + "remark-html": "3.0.0", + "sinon": "^1.15.4", + "st": "^1.0.0", + "tap": "^5.7.0", + "through": "^2.3.7", + "transform-loader": "^0.2.3", + "unist-util-visit": "1.1.0", + "vinyl": "1.1.1", + "vinyl-fs": "2.4.3", + "watchify": "^3.2.2", + "webpack": "^1.13.1", + "webworkify-webpack": "^1.1.3" + }, + "browserify": { + "transform": [ + "unassertify" + ] + }, + "browser": { + "./js/util/ajax.js": "./js/util/browser/ajax.js", + "./js/util/browser.js": "./js/util/browser/browser.js", + "./js/util/canvas.js": "./js/util/browser/canvas.js", + "./js/util/dom.js": "./js/util/browser/dom.js", + "./js/util/web_worker.js": "./js/util/browser/web_worker.js" + }, + "scripts": { + "build-dev": "browserify js/mapbox-gl.js --debug --ignore-transform unassertify --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js", + "build-docs": "documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/", + "build-min": "browserify js/mapbox-gl.js --debug --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js", + "//": "The 'build' script is invoked by publisher when publishing docs on the mb-pages branch", + "build": "npm run build-docs", + "lint": "eslint js test bench server.js docs/_posts/examples/*.html", + "open-changed-examples": "git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open", + "start-docs": "npm run build-min && npm run build-docs && jekyll serve -w", + "start": "node server.js", + "test-suite": "node test/render.test.js && node test/query.test.js", + "test": "npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js" + }, + "gitHead": "98461d3e2db6369cbcb66d70595e3032558fba9d", + "bugs": { + "url": "https://github.com/mapbox/mapbox-gl-js/issues" + }, + "homepage": "https://github.com/mapbox/mapbox-gl-js#readme", + "_id": "mapbox-gl@0.22.0", + "_shasum": "7fb1d70984dc7d8671abcd09ef6ab5fb98c0a310", + "_from": "mapbox-gl@latest", + "_npmVersion": "2.15.5", + "_nodeVersion": "4.4.5", + "_npmUser": { + "name": "lucaswoj", + "email": "lucas@lucaswoj.com" + }, + "dist": { + "shasum": "7fb1d70984dc7d8671abcd09ef6ab5fb98c0a310", + "tarball": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.0.tgz" + }, + "maintainers": [ + { + "name": "aaronlidman", + "email": "aaronlidman@gmail.com" + }, + { + "name": "ajashton", + "email": "aj.ashton@gmail.com" + }, + { + "name": "ansis", + "email": "ansis.brammanis@gmail.com" + }, + { + "name": "bergwerkgis", + "email": "wb@bergwerk-gis.at" + }, + { + "name": "bhousel", + "email": "bryan@mapbox.com" + }, + { + "name": "bsudekum", + "email": "bobby@mapbox.com" + }, + { + "name": "camilleanne", + "email": "camille@mapbox.com" + }, + { + "name": "dnomadb", + "email": "damon@mapbox.com" + }, + { + "name": "dthompson", + "email": "dthompson@gmail.com" + }, + { + "name": "emilymcafee", + "email": "emily@mapbox.com" + }, + { + "name": "flippmoke", + "email": "flippmoke@gmail.com" + }, + { + "name": "freenerd", + "email": "spam@freenerd.de" + }, + { + "name": "gretacb", + "email": "carol@mapbox.com" + }, + { + "name": "ian29", + "email": "ian.villeda@gmail.com" + }, + { + "name": "ianshward", + "email": "ian@mapbox.com" + }, + { + "name": "ingalls", + "email": "nicholas.ingalls@gmail.com" + }, + { + "name": "jfirebaugh", + "email": "john.firebaugh@gmail.com" + }, + { + "name": "jrpruit1", + "email": "jake@jakepruitt.com" + }, + { + "name": "karenzshea", + "email": "karen@mapbox.com" + }, + { + "name": "kkaefer", + "email": "kkaefer@gmail.com" + }, + { + "name": "lbud", + "email": "lauren@mapbox.com" + }, + { + "name": "lucaswoj", + "email": "lucas@lucaswoj.com" + }, + { + "name": "lxbarth", + "email": "alex@mapbox.com" + }, + { + "name": "lyzidiamond", + "email": "lyzi@mapbox.com" + }, + { + "name": "mapbox-admin", + "email": "accounts@mapbox.com" + }, + { + "name": "mateov", + "email": "matt@mapbox.com" + }, + { + "name": "mcwhittemore", + "email": "mcwhittemore@gmail.com" + }, + { + "name": "miccolis", + "email": "jeff@miccolis.net" + }, + { + "name": "mikemorris", + "email": "michael.patrick.morris@gmail.com" + }, + { + "name": "morganherlocker", + "email": "morgan.herlocker@gmail.com" + }, + { + "name": "mourner", + "email": "agafonkin@gmail.com" + }, + { + "name": "nickidlugash", + "email": "nicki@mapbox.com" + }, + { + "name": "rclark", + "email": "ryan.clark.j@gmail.com" + }, + { + "name": "samanbb", + "email": "saman@mapbox.com" + }, + { + "name": "sbma44", + "email": "tlee@mapbox.com" + }, + { + "name": "scothis", + "email": "scothis@gmail.com" + }, + { + "name": "sgillies", + "email": "sean@mapbox.com" + }, + { + "name": "springmeyer", + "email": "dane@mapbox.com" + }, + { + "name": "themarex", + "email": "patrick@mapbox.com" + }, + { + "name": "tmcw", + "email": "tom@macwright.org" + }, + { + "name": "tristen", + "email": "tristen.brown@gmail.com" + }, + { + "name": "willwhite", + "email": "will@mapbox.com" + }, + { + "name": "yhahn", + "email": "young@mapbox.com" + } + ], + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/mapbox-gl-0.22.0.tgz_1471021366539_0.7491761057171971" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.0.tgz" +} + +},{}],444:[function(require,module,exports){ 'use strict' module.exports = mouseListen @@ -72838,7 +73750,7 @@ function mouseListen(element, callback) { return result } -},{"mouse-event":422}],422:[function(require,module,exports){ +},{"mouse-event":445}],445:[function(require,module,exports){ 'use strict' function mouseButtons(ev) { @@ -72900,7 +73812,7 @@ function mouseRelativeY(ev) { } exports.y = mouseRelativeY -},{}],423:[function(require,module,exports){ +},{}],446:[function(require,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -72911,7 +73823,7 @@ module.exports = function parseUnit(str, out) { out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],424:[function(require,module,exports){ +},{}],447:[function(require,module,exports){ 'use strict' var parseUnit = require('parse-unit') @@ -72972,7 +73884,7 @@ function toPX(str, element) { } return 1 } -},{"parse-unit":423}],425:[function(require,module,exports){ +},{"parse-unit":446}],448:[function(require,module,exports){ 'use strict' var toPX = require('to-px') @@ -73014,19 +73926,19 @@ function mouseWheelListen(element, callback, noScroll) { return listener } -},{"to-px":424}],426:[function(require,module,exports){ +},{"to-px":447}],449:[function(require,module,exports){ "use strict" -var fill = require('cwise/lib/wrapper')({"args":["index","array","scalar"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{_inline_4_arg1_=_inline_4_arg2_.apply(void 0,_inline_4_arg0_)}","args":[{"name":"_inline_4_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_4_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_4_arg2_","lvalue":false,"rvalue":true,"count":1}],"thisVars":[],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"cwise","blockSize":64}) +var fill = require('cwise/lib/wrapper')({"args":["index","array","scalar"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{_inline_7_arg1_=_inline_7_arg2_.apply(void 0,_inline_7_arg0_)}","args":[{"name":"_inline_7_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_7_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_7_arg2_","lvalue":false,"rvalue":true,"count":1}],"thisVars":[],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"cwise","blockSize":64}) module.exports = function(array, f) { fill(array, f) return array } -},{"cwise/lib/wrapper":118}],427:[function(require,module,exports){ +},{"cwise/lib/wrapper":123}],450:[function(require,module,exports){ 'use strict' module.exports = invert @@ -73057,7 +73969,7 @@ function invert(out, M) { } return out } -},{"gl-mat2/invert":428,"gl-mat3/invert":136,"gl-mat4/invert":143}],428:[function(require,module,exports){ +},{"gl-mat2/invert":451,"gl-mat3/invert":141,"gl-mat4/invert":148}],451:[function(require,module,exports){ module.exports = invert /** @@ -73086,7 +73998,7 @@ function invert(out, a) { return out } -},{}],429:[function(require,module,exports){ +},{}],452:[function(require,module,exports){ "use strict" function interp1d(arr, x) { @@ -73197,19 +74109,19 @@ module.exports.d1 = interp1d module.exports.d2 = interp2d module.exports.d3 = interp3d -},{}],430:[function(require,module,exports){ +},{}],453:[function(require,module,exports){ 'use strict' var interp = require('ndarray-linear-interpolate') -var do_warp = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=new Array(_inline_21_arg4_)}","args":[{"name":"_inline_21_arg0_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg1_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg2_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg3_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_22_arg2_(this_warped,_inline_22_arg0_),_inline_22_arg1_=_inline_22_arg3_.apply(void 0,this_warped)}","args":[{"name":"_inline_22_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_22_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_22_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_22_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_22_arg4_","lvalue":false,"rvalue":false,"count":0}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warpND","blockSize":64}) +var do_warp = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=new Array(_inline_33_arg4_)}","args":[{"name":"_inline_33_arg0_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg1_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg2_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg3_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_34_arg2_(this_warped,_inline_34_arg0_),_inline_34_arg1_=_inline_34_arg3_.apply(void 0,this_warped)}","args":[{"name":"_inline_34_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_34_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_34_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_34_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_34_arg4_","lvalue":false,"rvalue":false,"count":0}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warpND","blockSize":64}) -var do_warp_1 = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=[0]}","args":[],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_25_arg2_(this_warped,_inline_25_arg0_),_inline_25_arg1_=_inline_25_arg3_(_inline_25_arg4_,this_warped[0])}","args":[{"name":"_inline_25_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_25_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_25_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_25_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_25_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp1D","blockSize":64}) +var do_warp_1 = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=[0]}","args":[],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_37_arg2_(this_warped,_inline_37_arg0_),_inline_37_arg1_=_inline_37_arg3_(_inline_37_arg4_,this_warped[0])}","args":[{"name":"_inline_37_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_37_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_37_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_37_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_37_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp1D","blockSize":64}) -var do_warp_2 = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=[0,0]}","args":[],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_28_arg2_(this_warped,_inline_28_arg0_),_inline_28_arg1_=_inline_28_arg3_(_inline_28_arg4_,this_warped[0],this_warped[1])}","args":[{"name":"_inline_28_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_28_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_28_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_28_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_28_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp2D","blockSize":64}) +var do_warp_2 = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=[0,0]}","args":[],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_40_arg2_(this_warped,_inline_40_arg0_),_inline_40_arg1_=_inline_40_arg3_(_inline_40_arg4_,this_warped[0],this_warped[1])}","args":[{"name":"_inline_40_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_40_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_40_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_40_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_40_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp2D","blockSize":64}) -var do_warp_3 = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=[0,0,0]}","args":[],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_31_arg2_(this_warped,_inline_31_arg0_),_inline_31_arg1_=_inline_31_arg3_(_inline_31_arg4_,this_warped[0],this_warped[1],this_warped[2])}","args":[{"name":"_inline_31_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_31_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_31_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_31_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_31_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp3D","blockSize":64}) +var do_warp_3 = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=[0,0,0]}","args":[],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_43_arg2_(this_warped,_inline_43_arg0_),_inline_43_arg1_=_inline_43_arg3_(_inline_43_arg4_,this_warped[0],this_warped[1],this_warped[2])}","args":[{"name":"_inline_43_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_43_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_43_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_43_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_43_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp3D","blockSize":64}) module.exports = function warp(dest, src, func) { switch(src.shape.length) { @@ -73229,7 +74141,7 @@ module.exports = function warp(dest, src, func) { return dest } -},{"cwise/lib/wrapper":118,"ndarray-linear-interpolate":429}],431:[function(require,module,exports){ +},{"cwise/lib/wrapper":123,"ndarray-linear-interpolate":452}],454:[function(require,module,exports){ 'use strict' var warp = require('ndarray-warp') @@ -73259,7 +74171,7 @@ function applyHomography(dest, src, Xi) { }) return dest } -},{"gl-matrix-invert":427,"ndarray-warp":430}],432:[function(require,module,exports){ +},{"gl-matrix-invert":450,"ndarray-warp":453}],455:[function(require,module,exports){ "use strict" var compile = require("cwise-compiler") @@ -73722,7 +74634,7 @@ exports.equals = compile({ -},{"cwise-compiler":115}],433:[function(require,module,exports){ +},{"cwise-compiler":120}],456:[function(require,module,exports){ var iota = require("iota-array") var isBuffer = require("is-buffer") @@ -74067,7 +74979,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":245,"is-buffer":246}],434:[function(require,module,exports){ +},{"iota-array":250,"is-buffer":251}],457:[function(require,module,exports){ /*! * repeat-string * @@ -74137,7 +75049,7 @@ function repeat(str, num) { } -},{}],435:[function(require,module,exports){ +},{}],458:[function(require,module,exports){ (function (global){ module.exports = global.performance && @@ -74148,7 +75060,7 @@ module.exports = } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],436:[function(require,module,exports){ +},{}],459:[function(require,module,exports){ "use strict" var determinant = require("robust-determinant") @@ -74220,7 +75132,7 @@ function generateDispatch() { } generateDispatch() -},{"robust-determinant":438}],437:[function(require,module,exports){ +},{"robust-determinant":461}],460:[function(require,module,exports){ "use strict" module.exports = compressExpansion @@ -74255,7 +75167,7 @@ function compressExpansion(e) { e.length = top return e } -},{}],438:[function(require,module,exports){ +},{}],461:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -74359,7 +75271,7 @@ return robustDeterminant") } generateDispatch() -},{"robust-compress":437,"robust-scale":440,"robust-sum":442,"two-product":456}],439:[function(require,module,exports){ +},{"robust-compress":460,"robust-scale":463,"robust-sum":465,"two-product":479}],462:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -74550,7 +75462,7 @@ function generateOrientationProc() { } generateOrientationProc() -},{"robust-scale":440,"robust-subtract":441,"robust-sum":442,"two-product":456}],440:[function(require,module,exports){ +},{"robust-scale":463,"robust-subtract":464,"robust-sum":465,"two-product":479}],463:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -74601,7 +75513,7 @@ function scaleLinearExpansion(e, scale) { g.length = count return g } -},{"two-product":456,"two-sum":457}],441:[function(require,module,exports){ +},{"two-product":479,"two-sum":480}],464:[function(require,module,exports){ "use strict" module.exports = robustSubtract @@ -74758,7 +75670,7 @@ function robustSubtract(e, f) { g.length = count return g } -},{}],442:[function(require,module,exports){ +},{}],465:[function(require,module,exports){ "use strict" module.exports = linearExpansionSum @@ -74915,7 +75827,7 @@ function linearExpansionSum(e, f) { g.length = count return g } -},{}],443:[function(require,module,exports){ +},{}],466:[function(require,module,exports){ 'use strict' module.exports = toSuperScript @@ -74970,7 +75882,7 @@ function toSuperScript(x) { }).join('') } -},{}],444:[function(require,module,exports){ +},{}],467:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -75386,7 +76298,7 @@ function createSurfaceExtractor(args) { order, typesig) } -},{"typedarray-pool":458}],445:[function(require,module,exports){ +},{"typedarray-pool":481}],468:[function(require,module,exports){ // transliterated from the python snippet here: // http://en.wikipedia.org/wiki/Lanczos_approximation @@ -75455,7 +76367,7 @@ module.exports = function gamma (z) { module.exports.log = lngamma; -},{}],446:[function(require,module,exports){ +},{}],469:[function(require,module,exports){ "use strict" module.exports = permutationSign @@ -75507,7 +76419,7 @@ function permutationSign(p) { return sgn } } -},{"typedarray-pool":458}],447:[function(require,module,exports){ +},{"typedarray-pool":481}],470:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -75594,7 +76506,7 @@ function unrank(n, r, p) { exports.rank = rank exports.unrank = unrank -},{"invert-permutation":448,"typedarray-pool":458}],448:[function(require,module,exports){ +},{"invert-permutation":471,"typedarray-pool":481}],471:[function(require,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -75606,7 +76518,7 @@ function invertPermutation(pi, result) { } module.exports = invertPermutation -},{}],449:[function(require,module,exports){ +},{}],472:[function(require,module,exports){ "use strict" module.exports = triangulateCube @@ -75640,7 +76552,7 @@ function triangulateCube(dimension) { } return result } -},{"gamma":445,"permutation-parity":446,"permutation-rank":447}],450:[function(require,module,exports){ +},{"gamma":468,"permutation-parity":469,"permutation-rank":470}],473:[function(require,module,exports){ module.exports = require('cwise-compiler')({ args: ['array', { offset: [1], @@ -75692,7 +76604,7 @@ module.exports = require('cwise-compiler')({ funcName: 'zeroCrossings' }) -},{"cwise-compiler":115}],451:[function(require,module,exports){ +},{"cwise-compiler":120}],474:[function(require,module,exports){ "use strict" module.exports = findZeroCrossings @@ -75705,7 +76617,7 @@ function findZeroCrossings(array, level) { core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":450}],452:[function(require,module,exports){ +},{"./lib/zc-core":473}],475:[function(require,module,exports){ "use strict" module.exports = surfaceNets @@ -75913,7 +76825,7 @@ function surfaceNets(array,level) { } return proc(array,level) } -},{"ndarray-extract-contour":444,"triangulate-hypercube":449,"zero-crossings":451}],453:[function(require,module,exports){ +},{"ndarray-extract-contour":467,"triangulate-hypercube":472,"zero-crossings":474}],476:[function(require,module,exports){ (function (process){ 'use strict' @@ -76002,7 +76914,7 @@ function textGet(font, text) { } }).call(this,require('_process')) -},{"_process":60,"vectorize-text":460}],454:[function(require,module,exports){ +},{"_process":59,"vectorize-text":483}],477:[function(require,module,exports){ // TinyColor v1.3.0 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -77170,7 +78082,7 @@ else { })(); -},{}],455:[function(require,module,exports){ +},{}],478:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -77719,7 +78631,7 @@ else { exports.presimplify = presimplify; })); -},{}],456:[function(require,module,exports){ +},{}],479:[function(require,module,exports){ "use strict" module.exports = twoProduct @@ -77753,7 +78665,7 @@ function twoProduct(a, b, result) { return [ y, x ] } -},{}],457:[function(require,module,exports){ +},{}],480:[function(require,module,exports){ "use strict" module.exports = fastTwoSum @@ -77771,7 +78683,7 @@ function fastTwoSum(a, b, result) { } return [ar+br, x] } -},{}],458:[function(require,module,exports){ +},{}],481:[function(require,module,exports){ (function (global,Buffer){ 'use strict' @@ -77988,7 +78900,7 @@ exports.clearCache = function clearCache() { } } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"bit-twiddle":51,"buffer":53,"dup":121}],459:[function(require,module,exports){ +},{"bit-twiddle":51,"buffer":52,"dup":126}],482:[function(require,module,exports){ "use strict" function unique_pred(list, compare) { @@ -78047,7 +78959,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],460:[function(require,module,exports){ +},{}],483:[function(require,module,exports){ "use strict" module.exports = createText @@ -78074,7 +78986,7 @@ function createText(str, options) { options) } -},{"./lib/vtext":461}],461:[function(require,module,exports){ +},{"./lib/vtext":484}],484:[function(require,module,exports){ "use strict" module.exports = vectorizeText @@ -78280,7 +79192,7 @@ function vectorizeText(str, canvas, context, options) { return processPixels(pixels, options, size) } -},{"cdt2d":63,"clean-pslg":70,"ndarray":433,"planar-graph-to-polyline":474,"simplify-planar-graph":478,"surface-nets":452}],462:[function(require,module,exports){ +},{"cdt2d":68,"clean-pslg":75,"ndarray":456,"planar-graph-to-polyline":497,"simplify-planar-graph":501,"surface-nets":475}],485:[function(require,module,exports){ 'use strict' module.exports = trimLeaves @@ -78336,7 +79248,7 @@ function trimLeaves(edges, positions) { return [ nedges, npositions ] } -},{"edges-to-adjacency-list":463}],463:[function(require,module,exports){ +},{"edges-to-adjacency-list":486}],486:[function(require,module,exports){ "use strict" module.exports = edgeToAdjacency @@ -78370,7 +79282,7 @@ function edgeToAdjacency(edges, numVertices) { } return adj } -},{"uniq":459}],464:[function(require,module,exports){ +},{"uniq":482}],487:[function(require,module,exports){ "use strict" module.exports = planarDual @@ -78501,7 +79413,7 @@ function planarDual(cells, positions) { //Combine paths and loops together return cycles } -},{"compare-angle":465}],465:[function(require,module,exports){ +},{"compare-angle":488}],488:[function(require,module,exports){ "use strict" module.exports = compareAngle @@ -78587,7 +79499,7 @@ function compareAngle(a, b, c, d) { } } } -},{"robust-orientation":439,"robust-product":466,"robust-sum":442,"signum":467,"two-sum":457}],466:[function(require,module,exports){ +},{"robust-orientation":462,"robust-product":489,"robust-sum":465,"signum":490,"two-sum":480}],489:[function(require,module,exports){ "use strict" var robustSum = require("robust-sum") @@ -78617,7 +79529,7 @@ function robustProduct(a, b) { } return r } -},{"robust-scale":440,"robust-sum":442}],467:[function(require,module,exports){ +},{"robust-scale":463,"robust-sum":465}],490:[function(require,module,exports){ "use strict" module.exports = function signum(x) { @@ -78625,9 +79537,9 @@ module.exports = function signum(x) { if(x > 0) { return 1 } return 0.0 } -},{}],468:[function(require,module,exports){ +},{}],491:[function(require,module,exports){ arguments[4][22][0].apply(exports,arguments) -},{"dup":22}],469:[function(require,module,exports){ +},{"dup":22}],492:[function(require,module,exports){ "use strict" var bounds = require("binary-search-bounds") @@ -78994,7 +79906,7 @@ function createWrapper(intervals) { return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":468}],470:[function(require,module,exports){ +},{"binary-search-bounds":491}],493:[function(require,module,exports){ "use strict" module.exports = orderSegments @@ -79090,7 +80002,7 @@ function orderSegments(b, a) { } return ar[0] - br[0] } -},{"robust-orientation":439}],471:[function(require,module,exports){ +},{"robust-orientation":462}],494:[function(require,module,exports){ "use strict" module.exports = createRBTree @@ -80087,7 +80999,7 @@ function defaultCompare(a, b) { function createRBTree(compare) { return new RedBlackTree(compare || defaultCompare, null) } -},{}],472:[function(require,module,exports){ +},{}],495:[function(require,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -80318,7 +81230,7 @@ function createSlabDecomposition(segments) { } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":470,"binary-search-bounds":468,"functional-red-black-tree":471,"robust-orientation":439}],473:[function(require,module,exports){ +},{"./lib/order-segments":493,"binary-search-bounds":491,"functional-red-black-tree":494,"robust-orientation":462}],496:[function(require,module,exports){ module.exports = preprocessPolygon var orient = require('robust-orientation')[3] @@ -80470,7 +81382,7 @@ function preprocessPolygon(loops) { testSlab) } } -},{"binary-search-bounds":468,"interval-tree-1d":469,"robust-orientation":439,"slab-decomposition":472}],474:[function(require,module,exports){ +},{"binary-search-bounds":491,"interval-tree-1d":492,"robust-orientation":462,"slab-decomposition":495}],497:[function(require,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -80675,9 +81587,9 @@ function planarGraphToPolyline(edges, positions) { return result } -},{"./lib/trim-leaves":462,"edges-to-adjacency-list":463,"planar-dual":464,"point-in-big-polygon":473,"robust-sum":442,"two-product":456,"uniq":459}],475:[function(require,module,exports){ +},{"./lib/trim-leaves":485,"edges-to-adjacency-list":486,"planar-dual":487,"point-in-big-polygon":496,"robust-sum":465,"two-product":479,"uniq":482}],498:[function(require,module,exports){ arguments[4][51][0].apply(exports,arguments) -},{"dup":51}],476:[function(require,module,exports){ +},{"dup":51}],499:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -80734,9 +81646,9 @@ UnionFind.prototype.link = function(x, y) { } -},{}],477:[function(require,module,exports){ -arguments[4][244][0].apply(exports,arguments) -},{"bit-twiddle":475,"dup":244,"union-find":476}],478:[function(require,module,exports){ +},{}],500:[function(require,module,exports){ +arguments[4][249][0].apply(exports,arguments) +},{"bit-twiddle":498,"dup":249,"union-find":499}],501:[function(require,module,exports){ "use strict" module.exports = simplifyPolygon @@ -81008,7 +81920,7 @@ function simplifyPolygon(cells, positions, minArea) { edges: ncells } } -},{"robust-orientation":439,"simplicial-complex":477}],479:[function(require,module,exports){ +},{"robust-orientation":462,"simplicial-complex":500}],502:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81070,7 +81982,7 @@ module.exports = [ } ]; -},{}],480:[function(require,module,exports){ +},{}],503:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81361,7 +82273,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/cartesian/constants":597,"../../plots/font_attributes":610,"./arrow_paths":479}],481:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/cartesian/constants":620,"../../plots/font_attributes":633,"./arrow_paths":502}],504:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82370,7 +83282,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":568,"../../lib/setcursor":577,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/cartesian/axes":592,"../color":483,"../dragelement":504,"../drawing":506,"./arrow_paths":479,"./attributes":480,"d3":119,"fast-isnumeric":123}],482:[function(require,module,exports){ +},{"../../lib":591,"../../lib/setcursor":600,"../../lib/svg_text_utils":604,"../../plotly":612,"../../plots/cartesian/axes":615,"../color":506,"../dragelement":527,"../drawing":529,"./arrow_paths":502,"./attributes":503,"d3":124,"fast-isnumeric":128}],505:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82410,7 +83322,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],483:[function(require,module,exports){ +},{}],506:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82564,7 +83476,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":482,"fast-isnumeric":123,"tinycolor2":454}],484:[function(require,module,exports){ +},{"./attributes":505,"fast-isnumeric":128,"tinycolor2":477}],507:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82759,7 +83671,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/cartesian/layout_attributes":601,"../../plots/font_attributes":610}],485:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/cartesian/layout_attributes":624,"../../plots/font_attributes":633}],508:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82826,7 +83738,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":568,"../../plots/cartesian/tick_label_defaults":607,"../../plots/cartesian/tick_mark_defaults":608,"../../plots/cartesian/tick_value_defaults":609,"./attributes":484}],486:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/tick_label_defaults":630,"../../plots/cartesian/tick_mark_defaults":631,"../../plots/cartesian/tick_value_defaults":632,"./attributes":507}],509:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83456,7 +84368,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":568,"../../lib/extend":563,"../../lib/setcursor":577,"../../plotly":589,"../../plots/cartesian/axes":592,"../../plots/cartesian/axis_defaults":593,"../../plots/cartesian/layout_attributes":601,"../../plots/cartesian/position_defaults":604,"../../plots/plots":648,"../color":483,"../dragelement":504,"../drawing":506,"../titles":546,"./attributes":484,"d3":119,"tinycolor2":454}],487:[function(require,module,exports){ +},{"../../lib":591,"../../lib/extend":586,"../../lib/setcursor":600,"../../plotly":612,"../../plots/cartesian/axes":615,"../../plots/cartesian/axis_defaults":616,"../../plots/cartesian/layout_attributes":624,"../../plots/cartesian/position_defaults":627,"../../plots/plots":671,"../color":506,"../dragelement":527,"../drawing":529,"../titles":569,"./attributes":507,"d3":124,"tinycolor2":477}],510:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83475,7 +84387,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":568}],488:[function(require,module,exports){ +},{"../../lib":591}],511:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83496,7 +84408,7 @@ exports.draw = require('./draw'); exports.hasColorbar = require('./has_colorbar'); -},{"./attributes":484,"./defaults":485,"./draw":486,"./has_colorbar":487}],489:[function(require,module,exports){ +},{"./attributes":507,"./defaults":508,"./draw":509,"./has_colorbar":510}],512:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83569,7 +84481,7 @@ module.exports = { } }; -},{}],490:[function(require,module,exports){ +},{}],513:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83635,7 +84547,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":568,"./flip_scale":494,"./scales":501}],491:[function(require,module,exports){ +},{"../../lib":591,"./flip_scale":517,"./scales":524}],514:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83725,7 +84637,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":563,"./attributes":489,"./scales.js":501}],492:[function(require,module,exports){ +},{"../../lib/extend":586,"./attributes":512,"./scales.js":524}],515:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83741,7 +84653,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":501}],493:[function(require,module,exports){ +},{"./scales":524}],516:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83805,7 +84717,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":568,"../colorbar/defaults":485,"../colorbar/has_colorbar":487,"./flip_scale":494,"./is_valid_scale":498,"fast-isnumeric":123}],494:[function(require,module,exports){ +},{"../../lib":591,"../colorbar/defaults":508,"../colorbar/has_colorbar":510,"./flip_scale":517,"./is_valid_scale":521,"fast-isnumeric":128}],517:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83830,7 +84742,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],495:[function(require,module,exports){ +},{}],518:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83870,7 +84782,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":492,"./is_valid_scale_array":499,"./scales":501}],496:[function(require,module,exports){ +},{"./default_scale":515,"./is_valid_scale_array":522,"./scales":524}],519:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83916,7 +84828,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":568,"./is_valid_scale":498,"fast-isnumeric":123}],497:[function(require,module,exports){ +},{"../../lib":591,"./is_valid_scale":521,"fast-isnumeric":128}],520:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83948,7 +84860,7 @@ exports.flipScale = require('./flip_scale'); exports.makeScaleFunction = require('./make_scale_function'); -},{"./attributes":489,"./calc":490,"./default_scale":492,"./defaults":493,"./flip_scale":494,"./get_scale":495,"./has_colorscale":496,"./is_valid_scale":498,"./make_scale_function":500,"./scales":501}],498:[function(require,module,exports){ +},{"./attributes":512,"./calc":513,"./default_scale":515,"./defaults":516,"./flip_scale":517,"./get_scale":518,"./has_colorscale":519,"./is_valid_scale":521,"./make_scale_function":523,"./scales":524}],521:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83969,7 +84881,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":499,"./scales":501}],499:[function(require,module,exports){ +},{"./is_valid_scale_array":522,"./scales":524}],522:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84006,7 +84918,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":454}],500:[function(require,module,exports){ +},{"tinycolor2":477}],523:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84055,7 +84967,7 @@ module.exports = function makeScaleFunction(scl, cmin, cmax) { }; }; -},{"../../lib":568,"../color":483,"d3":119,"fast-isnumeric":123,"tinycolor2":454}],501:[function(require,module,exports){ +},{"../../lib":591,"../color":506,"d3":124,"fast-isnumeric":128,"tinycolor2":477}],524:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84186,7 +85098,7 @@ module.exports = { ] }; -},{}],502:[function(require,module,exports){ +},{}],525:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84219,7 +85131,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],503:[function(require,module,exports){ +},{}],526:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84257,7 +85169,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":568}],504:[function(require,module,exports){ +},{"../../lib":591}],527:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84442,7 +85354,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":568,"../../plotly":589,"../../plots/cartesian/constants":597,"./align":502,"./cursor":503,"./unhover":505}],505:[function(require,module,exports){ +},{"../../lib":591,"../../plotly":612,"../../plots/cartesian/constants":620,"./align":525,"./cursor":526,"./unhover":528}],528:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84493,7 +85405,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":562}],506:[function(require,module,exports){ +},{"../../lib/events":585}],529:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85057,7 +85969,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../../lib/svg_text_utils":581,"../../plots/plots":648,"../../traces/scatter/make_bubble_size_func":764,"../../traces/scatter/subtypes":769,"../color":483,"../colorscale":497,"./symbol_defs":507,"d3":119,"fast-isnumeric":123}],507:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../../lib":591,"../../lib/svg_text_utils":604,"../../plots/plots":671,"../../traces/scatter/make_bubble_size_func":787,"../../traces/scatter/subtypes":792,"../color":506,"../colorscale":520,"./symbol_defs":530,"d3":124,"fast-isnumeric":128}],530:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85533,7 +86445,7 @@ module.exports = { } }; -},{"d3":119}],508:[function(require,module,exports){ +},{"d3":124}],531:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85675,7 +86587,7 @@ module.exports = { } }; -},{}],509:[function(require,module,exports){ +},{}],532:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85738,7 +86650,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":592,"../../plots/plots":648,"./compute_error":510,"fast-isnumeric":123}],510:[function(require,module,exports){ +},{"../../plots/cartesian/axes":615,"../../plots/plots":671,"./compute_error":533,"fast-isnumeric":128}],533:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85834,7 +86746,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],511:[function(require,module,exports){ +},{}],534:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85911,7 +86823,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":568,"../../plots/plots":648,"./attributes":508,"fast-isnumeric":123}],512:[function(require,module,exports){ +},{"../../lib":591,"../../plots/plots":671,"./attributes":531,"fast-isnumeric":128}],535:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85970,7 +86882,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":508,"./calc":509,"./defaults":511,"./plot":513,"./style":514}],513:[function(require,module,exports){ +},{"./attributes":531,"./calc":532,"./defaults":534,"./plot":536,"./style":537}],536:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86091,7 +87003,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../lib":568,"../../traces/scatter/subtypes":769,"d3":119,"fast-isnumeric":123}],514:[function(require,module,exports){ +},{"../../lib":591,"../../traces/scatter/subtypes":792,"d3":124,"fast-isnumeric":128}],537:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86128,7 +87040,7 @@ module.exports = function style(traces) { }); }; -},{"../color":483,"d3":119}],515:[function(require,module,exports){ +},{"../color":506,"d3":124}],538:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86288,7 +87200,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":597}],516:[function(require,module,exports){ +},{"../../plots/cartesian/constants":620}],539:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86354,7 +87266,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":568,"../../plots/cartesian/axes":592,"./attributes":515}],517:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"./attributes":538}],540:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86368,6 +87280,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = require('d3'); var Drawing = require('../drawing'); var Axes = require('../../plots/cartesian/axes'); +var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -86409,9 +87322,10 @@ module.exports = function draw(gd) { // Images must be converted to dataURL's for exporting. function setImage(d) { - var thisImage = d3.select(this); + thisImage.attr('xmlns', xmlnsNamespaces.svg); + var imagePromise = new Promise(function(resolve) { var img = new Image(); @@ -86449,7 +87363,6 @@ module.exports = function draw(gd) { } function applyAttributes(d) { - var thisImage = d3.select(this); // Axes if specified @@ -86497,7 +87410,9 @@ module.exports = function draw(gd) { yId = yref ? yref._id : '', clipAxes = xId + yId; - thisImage.call(Drawing.setClipUrl, 'clip' + fullLayout._uid + clipAxes); + if(clipAxes) { + thisImage.call(Drawing.setClipUrl, 'clip' + fullLayout._uid + clipAxes); + } } @@ -86527,7 +87442,7 @@ module.exports = function draw(gd) { imagesAbove.each(applyAttributes); }; -},{"../../plots/cartesian/axes":592,"../drawing":506,"d3":119}],518:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../../plots/cartesian/axes":615,"../drawing":529,"d3":124}],541:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86550,7 +87465,7 @@ module.exports = { supplyLayoutDefaults: supplyLayoutDefaults }; -},{"./attributes":515,"./defaults":516,"./draw":517}],519:[function(require,module,exports){ +},{"./attributes":538,"./defaults":539,"./draw":540}],542:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86599,7 +87514,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],520:[function(require,module,exports){ +},{}],543:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86714,7 +87629,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482}],521:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/font_attributes":633,"../color/attributes":505}],544:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86732,7 +87647,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],522:[function(require,module,exports){ +},{}],545:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86824,7 +87739,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":568,"../../plots/plots":648,"./attributes":520,"./helpers":525}],523:[function(require,module,exports){ +},{"../../lib":591,"../../plots/plots":671,"./attributes":543,"./helpers":548}],546:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87497,7 +88412,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":568,"../../plotly":589,"../../plots/plots":648,"../color":483,"../dragelement":504,"../drawing":506,"./anchor_utils":519,"./constants":521,"./get_legend_data":524,"./helpers":525,"./style":527,"d3":119}],524:[function(require,module,exports){ +},{"../../lib":591,"../../plotly":612,"../../plots/plots":671,"../color":506,"../dragelement":527,"../drawing":529,"./anchor_utils":542,"./constants":544,"./get_legend_data":547,"./helpers":548,"./style":550,"d3":124}],547:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87603,7 +88518,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../plots/plots":648,"./helpers":525}],525:[function(require,module,exports){ +},{"../../plots/plots":671,"./helpers":548}],548:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87634,7 +88549,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../plots/plots":648}],526:[function(require,module,exports){ +},{"../../plots/plots":671}],549:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87657,7 +88572,7 @@ legend.draw = require('./draw'); legend.style = require('./style'); -},{"./attributes":520,"./defaults":522,"./draw":523,"./style":527}],527:[function(require,module,exports){ +},{"./attributes":543,"./defaults":545,"./draw":546,"./style":550}],550:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87879,7 +88794,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":568,"../../plots/plots":648,"../../traces/pie/style_one":748,"../../traces/scatter/subtypes":769,"../color":483,"../drawing":506,"d3":119}],528:[function(require,module,exports){ +},{"../../lib":591,"../../plots/plots":671,"../../traces/pie/style_one":771,"../../traces/scatter/subtypes":792,"../color":506,"../drawing":529,"d3":124}],551:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88387,7 +89302,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":568,"../../plotly":589,"../../snapshot/download":663}],529:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":591,"../../plotly":612,"../../snapshot/download":686}],552:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88677,7 +89592,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":568,"d3":119}],530:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":591,"d3":124}],553:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88905,7 +89820,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plotly":589,"../../traces/scatter/subtypes":769,"./":529,"./buttons":528}],531:[function(require,module,exports){ +},{"../../plotly":612,"../../traces/scatter/subtypes":792,"./":552,"./buttons":551}],554:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89009,7 +89924,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482,"./button_attributes":532}],532:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/font_attributes":633,"../color/attributes":505,"./button_attributes":555}],555:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89065,7 +89980,7 @@ module.exports = { } }; -},{}],533:[function(require,module,exports){ +},{}],556:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89094,7 +90009,7 @@ module.exports = { darkAmount: 10 }; -},{}],534:[function(require,module,exports){ +},{}],557:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89180,13 +90095,14 @@ function getPosDflt(containerOut, layout, counterAxes) { var posY = 0; for(var i = 0; i < anchoredList.length; i++) { - posY = Math.max(layout[anchoredList[i]].domain[1], posY); + var domain = layout[anchoredList[i]].domain; + if(domain) posY = Math.max(domain[1], posY); } return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":568,"../color":483,"./attributes":531,"./button_attributes":532,"./constants":533}],535:[function(require,module,exports){ +},{"../../lib":591,"../color":506,"./attributes":554,"./button_attributes":555,"./constants":556}],558:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89461,7 +90377,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/cartesian/axis_ids":594,"../../plots/plots":648,"../color":483,"../drawing":506,"../legend/anchor_utils":519,"./constants":533,"./get_update_object":536,"d3":119}],536:[function(require,module,exports){ +},{"../../lib/svg_text_utils":604,"../../plotly":612,"../../plots/cartesian/axis_ids":617,"../../plots/plots":671,"../color":506,"../drawing":529,"../legend/anchor_utils":542,"./constants":556,"./get_update_object":559,"d3":124}],559:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89519,7 +90435,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":119}],537:[function(require,module,exports){ +},{"d3":124}],560:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89537,7 +90453,7 @@ exports.supplyLayoutDefaults = require('./defaults'); exports.draw = require('./draw'); -},{"./attributes":531,"./defaults":534,"./draw":535}],538:[function(require,module,exports){ +},{"./attributes":554,"./defaults":557,"./draw":558}],561:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89608,7 +90524,7 @@ module.exports = { } }; -},{"../color/attributes":482}],539:[function(require,module,exports){ +},{"../color/attributes":505}],562:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89904,7 +90820,7 @@ module.exports = function createSlider(gd) { }); }; -},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../../plotly":589,"../../plots/cartesian/axes":592,"./helpers":541,"./range_plot":543}],540:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../../lib":591,"../../plotly":612,"../../plots/cartesian/axes":615,"./helpers":564,"./range_plot":566}],563:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89957,7 +90873,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, axName, coun } }; -},{"../../lib":568,"./attributes":538}],541:[function(require,module,exports){ +},{"../../lib":591,"./attributes":561}],564:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89983,7 +90899,7 @@ exports.appendChildren = function appendChildren(el, children) { } }; -},{}],542:[function(require,module,exports){ +},{}],565:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90040,7 +90956,7 @@ function draw(gd) { }); } -},{"../../plots/plots":648,"./create_slider":539,"./defaults":540}],543:[function(require,module,exports){ +},{"../../plots/plots":671,"./create_slider":562,"./defaults":563}],566:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90221,7 +91137,7 @@ function makeScatter(trace, pointPairs, w, h) { return [line, markers, fill]; } -},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../drawing":506,"../drawing/symbol_defs":507,"./helpers":541,"d3":119}],544:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../../lib":591,"../drawing":529,"../drawing/symbol_defs":530,"./helpers":564,"d3":124}],567:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90379,7 +91295,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../traces/scatter/attributes":750,"../annotations/attributes":480}],545:[function(require,module,exports){ +},{"../../lib/extend":586,"../../traces/scatter/attributes":773,"../annotations/attributes":503}],568:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91169,7 +92085,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":568,"../../lib/setcursor":577,"../../plotly":589,"../../plots/cartesian/axes":592,"../color":483,"../dragelement":504,"../drawing":506,"./attributes":544,"fast-isnumeric":123}],546:[function(require,module,exports){ +},{"../../lib":591,"../../lib/setcursor":600,"../../plotly":612,"../../plots/cartesian/axes":615,"../color":506,"../dragelement":527,"../drawing":529,"./attributes":567,"fast-isnumeric":128}],569:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91399,7 +92315,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":568,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/plots":648,"../color":483,"../drawing":506,"d3":119,"fast-isnumeric":123}],547:[function(require,module,exports){ +},{"../../lib":591,"../../lib/svg_text_utils":604,"../../plotly":612,"../../plots/plots":671,"../color":506,"../drawing":529,"d3":124,"fast-isnumeric":128}],570:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91535,7 +92451,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482}],548:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/font_attributes":633,"../color/attributes":505}],571:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91610,7 +92526,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],549:[function(require,module,exports){ +},{}],572:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91706,7 +92622,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":568,"./attributes":547,"./constants":548}],550:[function(require,module,exports){ +},{"../../lib":591,"./attributes":570,"./constants":571}],573:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92165,7 +93081,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":568,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/plots":648,"../color":483,"../drawing":506,"../legend/anchor_utils":519,"./constants":548,"d3":119}],551:[function(require,module,exports){ +},{"../../lib":591,"../../lib/svg_text_utils":604,"../../plotly":612,"../../plots/plots":671,"../color":506,"../drawing":529,"../legend/anchor_utils":542,"./constants":571,"d3":124}],574:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92183,7 +93099,7 @@ exports.supplyLayoutDefaults = require('./defaults'); exports.draw = require('./draw'); -},{"./attributes":547,"./defaults":549,"./draw":550}],552:[function(require,module,exports){ +},{"./attributes":570,"./defaults":572,"./draw":573}],575:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92204,7 +93120,7 @@ module.exports = { longdashdot: [8, 1, 1, 1] }; -},{}],553:[function(require,module,exports){ +},{}],576:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92225,7 +93141,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],554:[function(require,module,exports){ +},{}],577:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92248,7 +93164,7 @@ module.exports = { x: '❌' }; -},{}],555:[function(require,module,exports){ +},{}],578:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92286,7 +93202,7 @@ module.exports = { }; -},{}],556:[function(require,module,exports){ +},{}],579:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92310,7 +93226,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],557:[function(require,module,exports){ +},{}],580:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92328,7 +93244,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.16.2'; +exports.version = '1.16.3'; // plot api exports.plot = Plotly.plot; @@ -92361,7 +93277,7 @@ exports.Queue = Plotly.Queue; // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/ploticon":2,"./plot_api/set_plot_config":586,"./plot_api/to_image":587,"./plot_api/validate":588,"./plotly":589,"./snapshot/download":663,"d3":119}],558:[function(require,module,exports){ +},{"../build/ploticon":2,"./plot_api/set_plot_config":609,"./plot_api/to_image":610,"./plot_api/validate":611,"./plotly":612,"./snapshot/download":686,"d3":124}],581:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92394,7 +93310,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],559:[function(require,module,exports){ +},{}],582:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92411,7 +93327,7 @@ module.exports = function arrayToCalcItem(traceAttr, calcItem, calcAttr, i) { if(Array.isArray(traceAttr)) calcItem[calcAttr] = traceAttr[i]; }; -},{}],560:[function(require,module,exports){ +},{}],583:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92770,7 +93686,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":495,"../components/colorscale/scales":501,"./nested_property":572,"fast-isnumeric":123,"tinycolor2":454}],561:[function(require,module,exports){ +},{"../components/colorscale/get_scale":518,"../components/colorscale/scales":524,"./nested_property":595,"fast-isnumeric":128,"tinycolor2":477}],584:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93109,7 +94025,7 @@ exports.parseDate = function(v) { return out; }; -},{"../lib":568,"d3":119,"fast-isnumeric":123}],562:[function(require,module,exports){ +},{"../lib":591,"d3":124,"fast-isnumeric":128}],585:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93243,7 +94159,7 @@ var Events = { module.exports = Events; -},{"events":57}],563:[function(require,module,exports){ +},{"events":56}],586:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93357,7 +94273,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":569}],564:[function(require,module,exports){ +},{"./is_plain_object.js":592}],587:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93381,7 +94297,7 @@ module.exports = function filterVisible(dataIn) { return dataOut; }; -},{}],565:[function(require,module,exports){ +},{}],588:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93440,7 +94356,7 @@ function countryNameToISO3(countryName) { Lib.warn('Unrecognized country name: ' + countryName + '.'); } -},{"../lib":568,"country-regex":114}],566:[function(require,module,exports){ +},{"../lib":591,"country-regex":119}],589:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93519,7 +94435,7 @@ function formatColor(containerIn, opacityIn, len) { module.exports = formatColor; -},{"../components/color/attributes":482,"../components/colorscale/make_scale_function":500,"./str2rgbarray":580,"fast-isnumeric":123,"tinycolor2":454}],567:[function(require,module,exports){ +},{"../components/color/attributes":505,"../components/colorscale/make_scale_function":523,"./str2rgbarray":603,"fast-isnumeric":128,"tinycolor2":477}],590:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93588,7 +94504,7 @@ function convertHTMLToUnicode(html) { module.exports = convertHTMLToUnicode; -},{"../constants/string_mappings":555,"superscript-text":443}],568:[function(require,module,exports){ +},{"../constants/string_mappings":578,"superscript-text":466}],591:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94208,7 +95124,7 @@ lib.numSeparate = function(value, separators) { return x1 + x2; }; -},{"./coerce":560,"./dates":561,"./extend":563,"./is_plain_object":569,"./loggers":570,"./matrix":571,"./nested_property":572,"./notifier":573,"./search":576,"./stats":579,"d3":119}],569:[function(require,module,exports){ +},{"./coerce":583,"./dates":584,"./extend":586,"./is_plain_object":592,"./loggers":593,"./matrix":594,"./nested_property":595,"./notifier":596,"./search":599,"./stats":602,"d3":124}],592:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94237,7 +95153,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],570:[function(require,module,exports){ +},{}],593:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94304,7 +95220,7 @@ loggers.error = function() { }; /* eslint-enable no-console */ -},{"../plot_api/plot_config":584}],571:[function(require,module,exports){ +},{"../plot_api/plot_config":607}],594:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94414,7 +95330,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],572:[function(require,module,exports){ +},{}],595:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94670,7 +95586,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"fast-isnumeric":123}],573:[function(require,module,exports){ +},{"fast-isnumeric":128}],596:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94747,7 +95663,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":119,"fast-isnumeric":123}],574:[function(require,module,exports){ +},{"d3":124,"fast-isnumeric":128}],597:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94987,7 +95903,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":571}],575:[function(require,module,exports){ +},{"./matrix":594}],598:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95198,7 +96114,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":568,"../plot_api/plot_config":584}],576:[function(require,module,exports){ +},{"../lib":591,"../plot_api/plot_config":607}],599:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95310,7 +96226,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"../lib":568,"fast-isnumeric":123}],577:[function(require,module,exports){ +},{"../lib":591,"fast-isnumeric":128}],600:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95333,7 +96249,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],578:[function(require,module,exports){ +},{}],601:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95382,7 +96298,7 @@ module.exports = function showWebGlMsg(scene) { return false; }; -},{"../components/color":483}],579:[function(require,module,exports){ +},{"../components/color":506}],602:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95478,7 +96394,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":123}],580:[function(require,module,exports){ +},{"fast-isnumeric":128}],603:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95500,7 +96416,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"arraytools":50,"tinycolor2":454}],581:[function(require,module,exports){ +},{"arraytools":50,"tinycolor2":477}],604:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96027,7 +96943,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":555,"../constants/xmlns_namespaces":556,"../lib":568,"d3":119}],582:[function(require,module,exports){ +},{"../constants/string_mappings":578,"../constants/xmlns_namespaces":579,"../lib":591,"d3":124}],605:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96063,7 +96979,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":611,"topojson":455}],583:[function(require,module,exports){ +},{"../plots/geo/constants":634,"topojson":478}],606:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99178,7 +100094,7 @@ function drawMainTitle(gd) { }); } -},{"../components/color":483,"../components/drawing":506,"../components/errorbars":512,"../components/images":518,"../components/legend":526,"../components/modebar/manage":530,"../components/rangeselector":537,"../components/rangeslider":542,"../components/shapes":545,"../components/titles":546,"../components/updatemenus":551,"../constants/xmlns_namespaces":556,"../lib":568,"../lib/events":562,"../lib/queue":575,"../plotly":589,"../plots/cartesian/graph_interact":599,"../plots/plots":648,"d3":119,"fast-isnumeric":123,"gl-mat4/fromQuat":140}],584:[function(require,module,exports){ +},{"../components/color":506,"../components/drawing":529,"../components/errorbars":535,"../components/images":541,"../components/legend":549,"../components/modebar/manage":553,"../components/rangeselector":560,"../components/rangeslider":565,"../components/shapes":568,"../components/titles":569,"../components/updatemenus":574,"../constants/xmlns_namespaces":579,"../lib":591,"../lib/events":585,"../lib/queue":598,"../plotly":612,"../plots/cartesian/graph_interact":622,"../plots/plots":671,"d3":124,"fast-isnumeric":128,"gl-mat4/fromQuat":145}],607:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99287,7 +100203,7 @@ function defaultSetBackground(gd, bgColor) { catch(e) { Lib.error(e); } } -},{"../lib":568}],585:[function(require,module,exports){ +},{"../lib":591}],608:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99630,7 +100546,7 @@ function handleLinkedToArray(layoutAttributes) { PlotSchema.crawl(layoutAttributes, callback); } -},{"../lib":568,"../plotly":589,"../plots/plots":648,"../plots/polar/area_attributes":649,"../plots/polar/axis_attributes":650}],586:[function(require,module,exports){ +},{"../lib":591,"../plotly":612,"../plots/plots":671,"../plots/polar/area_attributes":672,"../plots/polar/axis_attributes":673}],609:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99656,7 +100572,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":568,"../plotly":589}],587:[function(require,module,exports){ +},{"../lib":591,"../plotly":612}],610:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99769,7 +100685,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":568,"../plotly":589,"../snapshot":665,"fast-isnumeric":123}],588:[function(require,module,exports){ +},{"../lib":591,"../plotly":612,"../snapshot":688,"fast-isnumeric":128}],611:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100139,7 +101055,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":568,"../plots/plots":648,"./plot_schema":585}],589:[function(require,module,exports){ +},{"../lib":591,"../plots/plots":671,"./plot_schema":608}],612:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100257,7 +101173,7 @@ exports.PlotSchema = require('./plot_api/plot_schema'); // imaging routines exports.Snapshot = require('./snapshot'); -},{"../build/plotcss":1,"./components/annotations":481,"./components/color":483,"./components/colorbar":488,"./components/colorscale":497,"./components/drawing":506,"./components/errorbars":512,"./components/images":518,"./components/legend":526,"./components/modebar":529,"./components/shapes":545,"./components/updatemenus":551,"./fonts/mathjax_config":558,"./lib":568,"./lib/queue":575,"./lib/svg_text_utils":581,"./plot_api/plot_api":583,"./plot_api/plot_config":584,"./plot_api/plot_schema":585,"./plots/cartesian/axes":592,"./plots/cartesian/graph_interact":599,"./plots/plots":648,"./plots/polar/micropolar":651,"./snapshot":665,"./traces/scatter":760,"es6-promise":122}],590:[function(require,module,exports){ +},{"../build/plotcss":1,"./components/annotations":504,"./components/color":506,"./components/colorbar":511,"./components/colorscale":520,"./components/drawing":529,"./components/errorbars":535,"./components/images":541,"./components/legend":549,"./components/modebar":552,"./components/shapes":568,"./components/updatemenus":574,"./fonts/mathjax_config":581,"./lib":591,"./lib/queue":598,"./lib/svg_text_utils":604,"./plot_api/plot_api":606,"./plot_api/plot_config":607,"./plot_api/plot_schema":608,"./plots/cartesian/axes":615,"./plots/cartesian/graph_interact":622,"./plots/plots":671,"./plots/polar/micropolar":674,"./snapshot":688,"./traces/scatter":783,"es6-promise":127}],613:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100361,7 +101277,7 @@ module.exports = { } }; -},{}],591:[function(require,module,exports){ +},{}],614:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100400,7 +101316,7 @@ module.exports = { } }; -},{}],592:[function(require,module,exports){ +},{}],615:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102424,7 +103340,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":483,"../../components/drawing":506,"../../components/titles":546,"../../lib":568,"../../lib/svg_text_utils":581,"../../plotly":589,"./axis_ids":594,"./layout_attributes":601,"./layout_defaults":602,"./set_convert":606,"d3":119,"fast-isnumeric":123}],593:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"../../components/titles":569,"../../lib":591,"../../lib/svg_text_utils":604,"../../plotly":612,"./axis_ids":617,"./layout_attributes":624,"./layout_defaults":625,"./set_convert":629,"d3":124,"fast-isnumeric":128}],616:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102707,7 +103623,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../components/color/attributes":482,"../../lib":568,"../plots":648,"./axis_ids":594,"./category_order_defaults":595,"./clean_datum":596,"./layout_attributes":601,"./ordered_categories":603,"./set_convert":606,"./tick_label_defaults":607,"./tick_mark_defaults":608,"./tick_value_defaults":609,"fast-isnumeric":123,"tinycolor2":454}],594:[function(require,module,exports){ +},{"../../components/color/attributes":505,"../../lib":591,"../plots":671,"./axis_ids":617,"./category_order_defaults":618,"./clean_datum":619,"./layout_attributes":624,"./ordered_categories":626,"./set_convert":629,"./tick_label_defaults":630,"./tick_mark_defaults":631,"./tick_value_defaults":632,"fast-isnumeric":128,"tinycolor2":477}],617:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102828,7 +103744,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":568,"../plots":648,"./constants":597}],595:[function(require,module,exports){ +},{"../../lib":591,"../plots":671,"./constants":620}],618:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102862,7 +103778,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],596:[function(require,module,exports){ +},{}],619:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102901,7 +103817,7 @@ module.exports = function cleanDatum(c) { return c; }; -},{"../../lib":568,"fast-isnumeric":123}],597:[function(require,module,exports){ +},{"../../lib":591,"fast-isnumeric":128}],620:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102979,7 +103895,7 @@ module.exports = { REDRAWDELAY: 50 }; -},{}],598:[function(require,module,exports){ +},{}],621:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -103668,7 +104584,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../lib":568,"../../lib/setcursor":577,"../../lib/svg_text_utils":581,"../../plotly":589,"./axes":592,"./constants":597,"./select":605,"d3":119,"tinycolor2":454}],599:[function(require,module,exports){ +},{"../../components/color":506,"../../components/dragelement":527,"../../components/drawing":529,"../../lib":591,"../../lib/setcursor":600,"../../lib/svg_text_utils":604,"../../plotly":612,"./axes":615,"./constants":620,"./select":628,"d3":124,"tinycolor2":477}],622:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105015,7 +105931,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../lib":568,"../../lib/events":562,"../../lib/svg_text_utils":581,"./axes":592,"./constants":597,"./dragbox":598,"d3":119,"fast-isnumeric":123,"tinycolor2":454}],600:[function(require,module,exports){ +},{"../../components/color":506,"../../components/dragelement":527,"../../components/drawing":529,"../../lib":591,"../../lib/events":585,"../../lib/svg_text_utils":604,"./axes":615,"./constants":620,"./dragbox":621,"d3":124,"fast-isnumeric":128,"tinycolor2":477}],623:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105102,7 +106018,7 @@ exports.plot = function(gd) { } }; -},{"../plots":648,"./attributes":591,"./constants":597}],601:[function(require,module,exports){ +},{"../plots":671,"./attributes":614,"./constants":620}],624:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105617,7 +106533,7 @@ module.exports = { } }; -},{"../../components/color/attributes":482,"../../components/rangeselector/attributes":531,"../../components/rangeslider/attributes":538,"../../lib/extend":563,"../font_attributes":610,"./constants":597}],602:[function(require,module,exports){ +},{"../../components/color/attributes":505,"../../components/rangeselector/attributes":554,"../../components/rangeslider/attributes":561,"../../lib/extend":586,"../font_attributes":633,"./constants":620}],625:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105790,7 +106706,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":483,"../../components/rangeselector":537,"../../components/rangeslider":542,"../../lib":568,"../plots":648,"./axis_defaults":593,"./axis_ids":594,"./constants":597,"./layout_attributes":601,"./position_defaults":604}],603:[function(require,module,exports){ +},{"../../components/color":506,"../../components/rangeselector":560,"../../components/rangeslider":565,"../../lib":591,"../plots":671,"./axis_defaults":616,"./axis_ids":617,"./constants":620,"./layout_attributes":624,"./position_defaults":627}],626:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105834,7 +106750,7 @@ function flattenUniqueSort(axisLetter, sortFunction, data) { insertionIndex = bisector(categoryArray, category); // skip loop on already encountered values - if(insertionIndex < categoryArray.length - 1 && categoryArray[insertionIndex] === category) continue; + if(insertionIndex < categoryArray.length && categoryArray[insertionIndex] === category) continue; // insert value categoryArray.splice(insertionIndex, 0, category); @@ -105869,7 +106785,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":119}],604:[function(require,module,exports){ +},{"d3":124}],627:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105934,7 +106850,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":568,"fast-isnumeric":123}],605:[function(require,module,exports){ +},{"../../lib":591,"fast-isnumeric":128}],628:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106134,7 +107050,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":483,"../../lib/polygon":574,"./axes":592,"./constants":597}],606:[function(require,module,exports){ +},{"../../components/color":506,"../../lib/polygon":597,"./axes":615,"./constants":620}],629:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106378,7 +107294,7 @@ module.exports = function setConvert(ax) { ax._forceTick0 = null; }; -},{"../../lib":568,"./axis_ids":594,"./clean_datum":596,"./constants":597,"d3":119,"fast-isnumeric":123}],607:[function(require,module,exports){ +},{"../../lib":591,"./axis_ids":617,"./clean_datum":619,"./constants":620,"d3":124,"fast-isnumeric":128}],630:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106461,7 +107377,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":568}],608:[function(require,module,exports){ +},{"../../lib":591}],631:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106494,7 +107410,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":568,"./layout_attributes":601}],609:[function(require,module,exports){ +},{"../../lib":591,"./layout_attributes":624}],632:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106535,7 +107451,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":123}],610:[function(require,module,exports){ +},{"fast-isnumeric":128}],633:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106577,7 +107493,7 @@ module.exports = { } }; -},{}],611:[function(require,module,exports){ +},{}],634:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106735,7 +107651,7 @@ params.layerNameToAdjective = { // base layers drawn over choropleth params.baseLayersOverChoropleth = ['rivers', 'lakes']; -},{}],612:[function(require,module,exports){ +},{}],635:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107229,7 +108145,7 @@ function createMockAxis(fullLayout) { return mockAxis; } -},{"../../components/color":483,"../../components/drawing":506,"../../constants/xmlns_namespaces":556,"../../lib/filter_visible":564,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"./constants":611,"./projections":619,"./set_scale":620,"./zoom":621,"./zoom_reset":622,"d3":119,"topojson":455}],613:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"../../constants/xmlns_namespaces":579,"../../lib/filter_visible":587,"../../lib/topojson_utils":605,"../../plots/cartesian/axes":615,"./constants":634,"./projections":642,"./set_scale":643,"./zoom":644,"./zoom_reset":645,"d3":124,"topojson":478}],636:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107335,7 +108251,7 @@ exports.toSVG = function(gd) { } }; -},{"../../plots/plots":648,"./geo":612,"./layout/attributes":614,"./layout/defaults":617,"./layout/layout_attributes":618}],614:[function(require,module,exports){ +},{"../../plots/plots":671,"./geo":635,"./layout/attributes":637,"./layout/defaults":640,"./layout/layout_attributes":641}],637:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107363,7 +108279,7 @@ module.exports = { } }; -},{}],615:[function(require,module,exports){ +},{}],638:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107426,7 +108342,7 @@ module.exports = { } }; -},{"../../../components/color/attributes":482}],616:[function(require,module,exports){ +},{"../../../components/color/attributes":505}],639:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107500,7 +108416,7 @@ module.exports = function supplyGeoAxisLayoutDefaults(geoLayoutIn, geoLayoutOut) } }; -},{"../../../lib":568,"../constants":611,"./axis_attributes":615}],617:[function(require,module,exports){ +},{"../../../lib":591,"../constants":634,"./axis_attributes":638}],640:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107619,7 +108535,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce) { ]; } -},{"../../subplot_defaults":654,"../constants":611,"./axis_defaults":616,"./layout_attributes":618}],618:[function(require,module,exports){ +},{"../../subplot_defaults":677,"../constants":634,"./axis_defaults":639,"./layout_attributes":641}],641:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107878,7 +108794,7 @@ module.exports = { lataxis: geoAxesAttrs }; -},{"../../../components/color/attributes":482,"../constants":611,"./axis_attributes":615}],619:[function(require,module,exports){ +},{"../../../components/color/attributes":505,"../constants":634,"./axis_attributes":638}],642:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108324,7 +109240,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],620:[function(require,module,exports){ +},{}],643:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108475,7 +109391,7 @@ function getBounds(projection, rangeBox) { return d3.geo.path().projection(projection).bounds(rangeBox); } -},{"./constants":611,"d3":119}],621:[function(require,module,exports){ +},{"./constants":634,"d3":124}],644:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108902,7 +109818,7 @@ function d3_eventDispatch(target) { return dispatch; } -},{"d3":119}],622:[function(require,module,exports){ +},{"d3":124}],645:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108937,7 +109853,7 @@ function createGeoZoomReset(geo, geoLayout) { module.exports = createGeoZoomReset; -},{"../cartesian/graph_interact":599}],623:[function(require,module,exports){ +},{"../cartesian/graph_interact":622}],646:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108972,6 +109888,11 @@ function createCamera(scene) { plot = scene.glplot, result = new Camera2D(element, plot); + function unSetAutoRange() { + scene.xaxis.autorange = false; + scene.yaxis.autorange = false; + } + result.mouseListener = mouseChange(element, function(buttons, x, y) { var xrange = scene.xaxis.range, yrange = scene.yaxis.range, @@ -109024,7 +109945,7 @@ function createCamera(scene) { else if(result.boxEnabled) { updateRange(xrange, result.boxStart[0], result.boxEnd[0]); updateRange(yrange, result.boxStart[1], result.boxEnd[1]); - + unSetAutoRange(); result.boxEnabled = false; } break; @@ -109044,7 +109965,7 @@ function createCamera(scene) { yrange[1] += dy; result.lastInputTime = Date.now(); - + unSetAutoRange(); scene.cameraChanged(); } break; @@ -109082,6 +110003,7 @@ function createCamera(scene) { yrange[1] = (yrange[1] - cy) * scale + cy; result.lastInputTime = Date.now(); + unSetAutoRange(); scene.cameraChanged(); break; } @@ -109092,7 +110014,7 @@ function createCamera(scene) { return result; } -},{"mouse-change":421,"mouse-wheel":425}],624:[function(require,module,exports){ +},{"mouse-change":444,"mouse-wheel":448}],647:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109335,7 +110257,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/html2unicode":567,"../../lib/str2rgbarray":580,"../../plotly":589}],625:[function(require,module,exports){ +},{"../../lib/html2unicode":590,"../../lib/str2rgbarray":603,"../../plotly":612}],648:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109447,7 +110369,7 @@ exports.toSVG = function(gd) { } }; -},{"../../constants/xmlns_namespaces":556,"../cartesian/attributes":591,"../plots":648,"./scene2d":626}],626:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../cartesian/attributes":614,"../plots":671,"./scene2d":649}],649:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109725,7 +110647,9 @@ var relayoutCallback = function(scene) { yrange = scene.yaxis.range; // Update the layout on the DIV + scene.graphDiv.layout.xaxis.autorange = scene.xaxis.autorange; scene.graphDiv.layout.xaxis.range = xrange.slice(0); + scene.graphDiv.layout.yaxis.autorange = scene.yaxis.autorange; scene.graphDiv.layout.yaxis.range = yrange.slice(0); // Make a meaningful value to be passed on to the possible 'plotly_relayout' subscriber(s) @@ -109760,7 +110684,6 @@ proto.cameraChanged = function() { }; proto.destroy = function() { - var traces = this.traces; if(traces) { @@ -109784,10 +110707,9 @@ proto.plot = function(fullData, calcData, fullLayout) { var glplot = this.glplot, pixelRatio = this.pixelRatio; - var i, j, trace; - this.fullLayout = fullLayout; this.updateAxes(fullLayout); + this.updateTraces(fullData, calcData); var width = fullLayout.width, height = fullLayout.height, @@ -109801,34 +110723,6 @@ proto.plot = function(fullData, calcData, fullLayout) { canvas.height = pixelHeight; } - // update traces - for(i = 0; i < fullData.length; ++i) { - var fullTrace = fullData[i], - calcTrace = calcData[i]; - trace = this.traces[fullTrace.uid]; - - if(trace) trace.update(fullTrace, calcTrace); - else { - trace = fullTrace._module.plot(this, fullTrace, calcTrace); - } - - this.traces[fullTrace.uid] = trace; - } - - // remove empty traces - var traceIds = Object.keys(this.traces); - - trace_id_loop: - for(i = 0; i < traceIds.length; ++i) { - for(j = 0; j < calcData.length; ++j) { - if(calcData[j][0].trace.uid === traceIds[i]) continue trace_id_loop; - } - - trace = this.traces[traceIds[i]]; - trace.dispose(); - delete this.traces[traceIds[i]]; - } - var options = this.glplotOptions; options.merge(fullLayout); options.screenBox = [0, 0, width, height]; @@ -109854,16 +110748,18 @@ proto.plot = function(fullData, calcData, fullLayout) { bounds[0] = bounds[1] = Infinity; bounds[2] = bounds[3] = -Infinity; - traceIds = Object.keys(this.traces); + var traceIds = Object.keys(this.traces); + var ax, i; + for(i = 0; i < traceIds.length; ++i) { - trace = this.traces[traceIds[i]]; + var traceObj = this.traces[traceIds[i]]; + for(var k = 0; k < 2; ++k) { - bounds[k] = Math.min(bounds[k], trace.bounds[k]); - bounds[k + 2] = Math.max(bounds[k + 2], trace.bounds[k + 2]); + bounds[k] = Math.min(bounds[k], traceObj.bounds[k]); + bounds[k + 2] = Math.max(bounds[k + 2], traceObj.bounds[k + 2]); } } - var ax; for(i = 0; i < 2; ++i) { if(bounds[i] > bounds[i + 2]) { bounds[i] = -1; @@ -109889,6 +110785,43 @@ proto.plot = function(fullData, calcData, fullLayout) { this.glplot.draw(); }; +proto.updateTraces = function(fullData, calcData) { + var traceIds = Object.keys(this.traces); + var i, j, fullTrace; + + // remove empty traces + trace_id_loop: + for(i = 0; i < traceIds.length; i++) { + var oldUid = traceIds[i], + oldTrace = this.traces[oldUid]; + + for(j = 0; j < fullData.length; j++) { + fullTrace = fullData[j]; + + if(fullTrace.uid === oldUid && fullTrace.type === oldTrace.type) { + continue trace_id_loop; + } + } + + oldTrace.dispose(); + delete this.traces[oldUid]; + } + + // update / create trace objects + for(i = 0; i < fullData.length; i++) { + fullTrace = fullData[i]; + + var calcTrace = calcData[i], + traceObj = this.traces[fullTrace.uid]; + + if(traceObj) traceObj.update(fullTrace, calcTrace); + else { + traceObj = fullTrace._module.plot(this, fullTrace, calcTrace); + this.traces[fullTrace.uid] = traceObj; + } + } +}; + proto.draw = function() { if(this.stopped) return; @@ -109996,7 +110929,7 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../lib/html2unicode":567,"../../lib/show_no_webgl_msg":578,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"./camera":623,"./convert":624,"gl-plot2d":171,"gl-select-box":201,"gl-spikes2d":221}],627:[function(require,module,exports){ +},{"../../lib/html2unicode":590,"../../lib/show_no_webgl_msg":601,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622,"./camera":646,"./convert":647,"gl-plot2d":176,"gl-select-box":206,"gl-spikes2d":226}],650:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110239,7 +111172,7 @@ function createCamera(element, options) { return camera; } -},{"3d-view":40,"mouse-change":421,"mouse-wheel":425,"right-now":435}],628:[function(require,module,exports){ +},{"3d-view":40,"mouse-change":444,"mouse-wheel":448,"right-now":458}],651:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110373,7 +111306,7 @@ function initAxes(gd, sceneLayout) { } } -},{"../../constants/xmlns_namespaces":556,"../plots":648,"./layout/attributes":629,"./layout/defaults":633,"./layout/layout_attributes":634,"./scene":638,"./set_convert":639}],629:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../plots":671,"./layout/attributes":652,"./layout/defaults":656,"./layout/layout_attributes":657,"./scene":661,"./set_convert":662}],652:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110401,7 +111334,7 @@ module.exports = { } }; -},{}],630:[function(require,module,exports){ +},{}],653:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110517,7 +111450,7 @@ module.exports = { zerolinewidth: axesAttrs.zerolinewidth }; -},{"../../../components/color":483,"../../../lib/extend":563,"../../cartesian/layout_attributes":601}],631:[function(require,module,exports){ +},{"../../../components/color":506,"../../../lib/extend":586,"../../cartesian/layout_attributes":624}],654:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110586,7 +111519,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":568,"../../cartesian/axis_defaults":593,"./axis_attributes":630,"tinycolor2":454}],632:[function(require,module,exports){ +},{"../../../lib":591,"../../cartesian/axis_defaults":616,"./axis_attributes":653,"tinycolor2":477}],655:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110742,7 +111675,7 @@ function createAxesOptions(plotlyOptions) { module.exports = createAxesOptions; -},{"../../../lib/html2unicode":567,"../../../lib/str2rgbarray":580,"arraytools":50}],633:[function(require,module,exports){ +},{"../../../lib/html2unicode":590,"../../../lib/str2rgbarray":603,"arraytools":50}],656:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110849,7 +111782,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":483,"../../subplot_defaults":654,"./axis_defaults":631,"./layout_attributes":634}],634:[function(require,module,exports){ +},{"../../../components/color":506,"../../subplot_defaults":677,"./axis_defaults":654,"./layout_attributes":657}],657:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111019,7 +111952,7 @@ module.exports = { } }; -},{"../../../lib/extend":563,"./axis_attributes":630}],635:[function(require,module,exports){ +},{"../../../lib/extend":586,"./axis_attributes":653}],658:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111065,7 +111998,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":580}],636:[function(require,module,exports){ +},{"../../../lib/str2rgbarray":603}],659:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111160,7 +112093,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib/html2unicode":567,"../../../plotly":589}],637:[function(require,module,exports){ +},{"../../../lib/html2unicode":590,"../../../plotly":612}],660:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111194,7 +112127,7 @@ function project(camera, v) { module.exports = project; -},{}],638:[function(require,module,exports){ +},{}],661:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111924,7 +112857,7 @@ proto.toImage = function(format) { module.exports = Scene; -},{"../../lib":568,"../../lib/show_no_webgl_msg":578,"../../lib/str2rgbarray":580,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../../plots/plots":648,"./camera":627,"./layout/convert":632,"./layout/spikes":635,"./layout/tick_marks":636,"./project":637,"./set_convert":639,"gl-plot3d":189}],639:[function(require,module,exports){ +},{"../../lib":591,"../../lib/show_no_webgl_msg":601,"../../lib/str2rgbarray":603,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622,"../../plots/plots":671,"./camera":650,"./layout/convert":655,"./layout/spikes":658,"./layout/tick_marks":659,"./project":660,"./set_convert":662,"gl-plot3d":194}],662:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111946,7 +112879,7 @@ module.exports = function setConvert(containerOut) { containerOut.setScale = noop; }; -},{"../cartesian/axes":592}],640:[function(require,module,exports){ +},{"../cartesian/axes":615}],663:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112138,7 +113071,7 @@ module.exports = { } }; -},{"../components/color/attributes":482,"../plotly":589,"./font_attributes":610}],641:[function(require,module,exports){ +},{"../components/color/attributes":505,"../plotly":612,"./font_attributes":633}],664:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112168,7 +113101,7 @@ module.exports = { mapOnErrorMsg: 'Mapbox error.' }; -},{}],642:[function(require,module,exports){ +},{}],665:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112242,7 +113175,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":568}],643:[function(require,module,exports){ +},{"../../lib":591}],666:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112400,7 +113333,7 @@ function findAccessToken(gd, mapboxIds) { return accessToken; } -},{"../../constants/xmlns_namespaces":556,"../plots":648,"./constants":641,"./layout_attributes":645,"./layout_defaults":646,"./mapbox":647,"mapbox-gl":260}],644:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../plots":671,"./constants":664,"./layout_attributes":668,"./layout_defaults":669,"./mapbox":670,"mapbox-gl":267}],667:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112625,7 +113558,7 @@ module.exports = function createMapboxLayer(mapbox, index, opts) { return mapboxLayer; }; -},{"../../lib":568,"./convert_text_opts":642}],645:[function(require,module,exports){ +},{"../../lib":591,"./convert_text_opts":665}],668:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112892,7 +113825,7 @@ module.exports = { }; -},{"../../components/color":483,"../../lib":568,"../../traces/scatter/attributes":750,"../font_attributes":610}],646:[function(require,module,exports){ +},{"../../components/color":506,"../../lib":591,"../../traces/scatter/attributes":773,"../font_attributes":633}],669:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112988,7 +113921,7 @@ function handleLayerDefaults(containerIn, containerOut) { } } -},{"../../lib":568,"../subplot_defaults":654,"./layout_attributes":645}],647:[function(require,module,exports){ +},{"../../lib":591,"../subplot_defaults":677,"./layout_attributes":668}],670:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113349,16 +114282,24 @@ proto.toImage = function() { // convenience wrapper to create blank GeoJSON sources // and avoid 'invalid GeoJSON' errors -proto.createGeoJSONSource = function() { +proto.initSource = function(idSource) { var blank = { - type: 'Feature', - geometry: { - type: 'Point', - coordinates: [] + type: 'geojson', + data: { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [] + } } }; - return new mapboxgl.GeoJSONSource({data: blank}); + return this.map.addSource(idSource, blank); +}; + +// convenience wrapper to set data of GeoJSON sources +proto.setSourceData = function(idSource, data) { + this.map.getSource(idSource).setData(data); }; // convenience wrapper to create set multiple layer @@ -113426,7 +114367,7 @@ function convertCenter(center) { return [center.lon, center.lat]; } -},{"../../lib":568,"../cartesian/graph_interact":599,"./constants":641,"./layers":644,"./layout_attributes":645,"mapbox-gl":260}],648:[function(require,module,exports){ +},{"../../lib":591,"../cartesian/graph_interact":622,"./constants":664,"./layers":667,"./layout_attributes":668,"mapbox-gl":267}],671:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114617,7 +115558,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { return (output === 'object') ? obj : JSON.stringify(obj); }; -},{"../components/color":483,"../lib":568,"../plotly":589,"./attributes":590,"./font_attributes":610,"./layout_attributes":640,"d3":119,"fast-isnumeric":123}],649:[function(require,module,exports){ +},{"../components/color":506,"../lib":591,"../plotly":612,"./attributes":613,"./font_attributes":633,"./layout_attributes":663,"d3":124,"fast-isnumeric":128}],672:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114642,7 +115583,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":750}],650:[function(require,module,exports){ +},{"../../traces/scatter/attributes":773}],673:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114792,7 +115733,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../cartesian/layout_attributes":601}],651:[function(require,module,exports){ +},{"../../lib/extend":586,"../cartesian/layout_attributes":624}],674:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116215,7 +117156,7 @@ var extendDeepAll = Plotly.Lib.extendDeepAll; return exports; }; -},{"../../plotly":589,"./micropolar_manager":652,"d3":119}],652:[function(require,module,exports){ +},{"../../plotly":612,"./micropolar_manager":675,"d3":124}],675:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116298,7 +117239,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../plotly":589,"./undo_manager":653,"d3":119}],653:[function(require,module,exports){ +},{"../../plotly":612,"./undo_manager":676,"d3":124}],676:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116364,7 +117305,7 @@ module.exports = function UndoManager() { }; }; -},{}],654:[function(require,module,exports){ +},{}],677:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116439,7 +117380,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":568,"./plots":648}],655:[function(require,module,exports){ +},{"../lib":591,"./plots":671}],678:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116513,7 +117454,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":648,"./layout/attributes":656,"./layout/defaults":659,"./layout/layout_attributes":660,"./ternary":661}],656:[function(require,module,exports){ +},{"../../plots/plots":671,"./layout/attributes":679,"./layout/defaults":682,"./layout/layout_attributes":683,"./ternary":684}],679:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116539,7 +117480,7 @@ module.exports = { } }; -},{}],657:[function(require,module,exports){ +},{}],680:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116603,7 +117544,7 @@ module.exports = { } }; -},{"../../../lib/extend":563,"../../cartesian/layout_attributes":601}],658:[function(require,module,exports){ +},{"../../../lib/extend":586,"../../cartesian/layout_attributes":624}],681:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116687,7 +117628,7 @@ module.exports = function supplyLayoutDefaults(containerIn, containerOut, option } }; -},{"../../../lib":568,"../../cartesian/tick_label_defaults":607,"../../cartesian/tick_mark_defaults":608,"../../cartesian/tick_value_defaults":609,"./axis_attributes":657,"tinycolor2":454}],659:[function(require,module,exports){ +},{"../../../lib":591,"../../cartesian/tick_label_defaults":630,"../../cartesian/tick_mark_defaults":631,"../../cartesian/tick_value_defaults":632,"./axis_attributes":680,"tinycolor2":477}],682:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116750,7 +117691,7 @@ function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, option } } -},{"../../../components/color":483,"../../subplot_defaults":654,"./axis_defaults":658,"./layout_attributes":660}],660:[function(require,module,exports){ +},{"../../../components/color":506,"../../subplot_defaults":677,"./axis_defaults":681,"./layout_attributes":683}],683:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116815,7 +117756,7 @@ module.exports = { caxis: ternaryAxesAttrs }; -},{"../../../components/color/attributes":482,"./axis_attributes":657}],661:[function(require,module,exports){ +},{"../../../components/color/attributes":505,"./axis_attributes":680}],684:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117505,7 +118446,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../components/titles":546,"../../lib":568,"../../lib/extend":563,"../../lib/filter_visible":564,"../../plotly":589,"../cartesian/axes":592,"../cartesian/constants":597,"../cartesian/graph_interact":599,"../cartesian/select":605,"../cartesian/set_convert":606,"d3":119,"tinycolor2":454}],662:[function(require,module,exports){ +},{"../../components/color":506,"../../components/dragelement":527,"../../components/drawing":529,"../../components/titles":569,"../../lib":591,"../../lib/extend":586,"../../lib/filter_visible":587,"../../plotly":612,"../cartesian/axes":615,"../cartesian/constants":620,"../cartesian/graph_interact":622,"../cartesian/select":628,"../cartesian/set_convert":629,"d3":124,"tinycolor2":477}],685:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117661,7 +118602,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../plotly":589}],663:[function(require,module,exports){ +},{"../plotly":612}],686:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117727,7 +118668,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":568,"../plot_api/to_image":587,"./filesaver":664}],664:[function(require,module,exports){ +},{"../lib":591,"../plot_api/to_image":610,"./filesaver":687}],687:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117795,7 +118736,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],665:[function(require,module,exports){ +},{}],688:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117840,7 +118781,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":662,"./download":663,"./svgtoimg":666,"./toimage":667,"./tosvg":668}],666:[function(require,module,exports){ +},{"./cloneplot":685,"./download":686,"./svgtoimg":689,"./toimage":690,"./tosvg":691}],689:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117971,7 +118912,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":568,"events":57}],667:[function(require,module,exports){ +},{"../lib":591,"events":56}],690:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118050,7 +118991,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":568,"../plotly":589,"events":57}],668:[function(require,module,exports){ +},{"../lib":591,"../plotly":612,"events":56}],691:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118162,7 +119103,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":483,"../components/drawing":506,"../constants/xmlns_namespaces":556,"../lib/svg_text_utils":581,"d3":119}],669:[function(require,module,exports){ +},{"../components/color":506,"../components/drawing":529,"../constants/xmlns_namespaces":579,"../lib/svg_text_utils":604,"d3":124}],692:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118190,7 +119131,7 @@ module.exports = function arraysToCalcdata(cd) { mergeArray(markerLine.width, cd, 'mlw'); }; -},{"../../lib":568}],670:[function(require,module,exports){ +},{"../../lib":591}],693:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118262,7 +119203,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../scatter/attributes":750}],671:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../lib/extend":586,"../scatter/attributes":773}],694:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118327,7 +119268,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":490,"../../components/colorscale/has_colorscale":496,"../../plots/cartesian/axes":592,"fast-isnumeric":123}],672:[function(require,module,exports){ +},{"../../components/colorscale/calc":513,"../../components/colorscale/has_colorscale":519,"../../plots/cartesian/axes":615,"fast-isnumeric":128}],695:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118369,7 +119310,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":483,"../../components/errorbars/defaults":511,"../../lib":568,"../bar/style_defaults":680,"../scatter/xy_defaults":771,"./attributes":670}],673:[function(require,module,exports){ +},{"../../components/color":506,"../../components/errorbars/defaults":534,"../../lib":591,"../bar/style_defaults":703,"../scatter/xy_defaults":794,"./attributes":693}],696:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118460,7 +119401,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":483,"../../components/errorbars":512,"../../plots/cartesian/graph_interact":599}],674:[function(require,module,exports){ +},{"../../components/color":506,"../../components/errorbars":535,"../../plots/cartesian/graph_interact":622}],697:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118501,7 +119442,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":600,"../scatter/colorbar":753,"./arrays_to_calcdata":669,"./attributes":670,"./calc":671,"./defaults":672,"./hover":673,"./layout_attributes":675,"./layout_defaults":676,"./plot":677,"./set_positions":678,"./style":679}],675:[function(require,module,exports){ +},{"../../plots/cartesian":623,"../scatter/colorbar":776,"./arrays_to_calcdata":692,"./attributes":693,"./calc":694,"./defaults":695,"./hover":696,"./layout_attributes":698,"./layout_defaults":699,"./plot":700,"./set_positions":701,"./style":702}],698:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118566,7 +119507,7 @@ module.exports = { } }; -},{}],676:[function(require,module,exports){ +},{}],699:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118624,7 +119565,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648,"./layout_attributes":675}],677:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/plots":671,"./layout_attributes":698}],700:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118736,7 +119677,7 @@ module.exports = function plot(gd, plotinfo, cdbar) { }; -},{"../../components/color":483,"../../components/errorbars":512,"../../lib":568,"./arrays_to_calcdata":669,"d3":119,"fast-isnumeric":123}],678:[function(require,module,exports){ +},{"../../components/color":506,"../../components/errorbars":535,"../../lib":591,"./arrays_to_calcdata":692,"d3":124,"fast-isnumeric":128}],701:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118967,7 +119908,7 @@ module.exports = function setPositions(gd, plotinfo) { }); }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648,"fast-isnumeric":123}],679:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/plots":671,"fast-isnumeric":128}],702:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119046,7 +119987,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/color":483,"../../components/drawing":506,"../../components/errorbars":512,"d3":119}],680:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"../../components/errorbars":535,"d3":124}],703:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119083,7 +120024,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":483,"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496}],681:[function(require,module,exports){ +},{"../../components/color":506,"../../components/colorscale/defaults":516,"../../components/colorscale/has_colorscale":519}],704:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119261,7 +120202,7 @@ module.exports = { fillcolor: scatterAttrs.fillcolor }; -},{"../../components/color/attributes":482,"../../lib/extend":563,"../scatter/attributes":750}],682:[function(require,module,exports){ +},{"../../components/color/attributes":505,"../../lib/extend":586,"../scatter/attributes":773}],705:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119410,7 +120351,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"fast-isnumeric":123}],683:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"fast-isnumeric":128}],706:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119479,7 +120420,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { } }; -},{"../../components/color":483,"../../lib":568,"./attributes":681}],684:[function(require,module,exports){ +},{"../../components/color":506,"../../lib":591,"./attributes":704}],707:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119588,7 +120529,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return closeData; }; -},{"../../components/color":483,"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599}],685:[function(require,module,exports){ +},{"../../components/color":506,"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622}],708:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119634,7 +120575,7 @@ Box.meta = { module.exports = Box; -},{"../../plots/cartesian":600,"./attributes":681,"./calc":682,"./defaults":683,"./hover":684,"./layout_attributes":686,"./layout_defaults":687,"./plot":688,"./set_positions":689,"./style":690}],686:[function(require,module,exports){ +},{"../../plots/cartesian":623,"./attributes":704,"./calc":705,"./defaults":706,"./hover":707,"./layout_attributes":709,"./layout_defaults":710,"./plot":711,"./set_positions":712,"./style":713}],709:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119685,7 +120626,7 @@ module.exports = { } }; -},{}],687:[function(require,module,exports){ +},{}],710:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119719,7 +120660,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { coerce('boxgroupgap'); }; -},{"../../lib":568,"../../plots/plots":648,"./layout_attributes":686}],688:[function(require,module,exports){ +},{"../../lib":591,"../../plots/plots":671,"./layout_attributes":709}],711:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119946,7 +120887,7 @@ module.exports = function plot(gd, plotinfo, cdbox) { }); }; -},{"../../components/drawing":506,"../../lib":568,"d3":119}],689:[function(require,module,exports){ +},{"../../components/drawing":529,"../../lib":591,"d3":124}],712:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120039,7 +120980,7 @@ module.exports = function setPositions(gd, plotinfo) { } }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648}],690:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/plots":671}],713:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120078,7 +121019,7 @@ module.exports = function style(gd) { }); }; -},{"../../components/color":483,"../../components/drawing":506,"d3":119}],691:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"d3":124}],714:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120129,7 +121070,7 @@ module.exports = extendFlat({}, { colorscaleAttrs ); -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../../plots/attributes":590,"../scattergeo/attributes":778}],692:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../../plots/attributes":613,"../scattergeo/attributes":801}],715:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120148,7 +121089,7 @@ module.exports = function calc(gd, trace) { colorscaleCalc(trace, trace.z, '', 'z'); }; -},{"../../components/colorscale/calc":490}],693:[function(require,module,exports){ +},{"../../components/colorscale/calc":513}],716:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120203,7 +121144,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hoverinfo', (layout._dataLength === 1) ? 'location+z+text' : undefined); }; -},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":691}],694:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":714}],717:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120238,7 +121179,7 @@ Choropleth.meta = { module.exports = Choropleth; -},{"../../plots/geo":613,"../heatmap/colorbar":708,"./attributes":691,"./calc":692,"./defaults":693,"./plot":695}],695:[function(require,module,exports){ +},{"../../plots/geo":636,"../heatmap/colorbar":731,"./attributes":714,"./calc":715,"./defaults":716,"./plot":718}],718:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120459,7 +121400,7 @@ function makeEventDataFunc(trace) { }; } -},{"../../components/color":483,"../../components/colorscale/get_scale":495,"../../components/colorscale/make_scale_function":500,"../../components/drawing":506,"../../lib/array_to_calc_item":559,"../../lib/geo_location_utils":565,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../../plots/geo/constants":611,"./attributes":691,"d3":119}],696:[function(require,module,exports){ +},{"../../components/color":506,"../../components/colorscale/get_scale":518,"../../components/colorscale/make_scale_function":523,"../../components/drawing":529,"../../lib/array_to_calc_item":582,"../../lib/geo_location_utils":588,"../../lib/topojson_utils":605,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622,"../../plots/geo/constants":634,"./attributes":714,"d3":124}],719:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120585,7 +121526,7 @@ module.exports = extendFlat({}, {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} ); -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../heatmap/attributes":706,"../scatter/attributes":750}],697:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../heatmap/attributes":729,"../scatter/attributes":773}],720:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120638,7 +121579,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":592,"../heatmap/calc":707}],698:[function(require,module,exports){ +},{"../../plots/cartesian/axes":615,"../heatmap/calc":730}],721:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120699,7 +121640,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":486,"../../plots/plots":648,"./make_color_map":702}],699:[function(require,module,exports){ +},{"../../components/colorbar/draw":509,"../../plots/plots":671,"./make_color_map":725}],722:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120743,7 +121684,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":568,"../contour/style_defaults":705,"../heatmap/has_columns":711,"../heatmap/xyz_defaults":717,"./attributes":696}],700:[function(require,module,exports){ +},{"../../lib":591,"../contour/style_defaults":728,"../heatmap/has_columns":734,"../heatmap/xyz_defaults":740,"./attributes":719}],723:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120762,7 +121703,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return heatmapHoverPoints(pointData, xval, yval, hovermode, true); }; -},{"../heatmap/hover":712}],701:[function(require,module,exports){ +},{"../heatmap/hover":735}],724:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120803,7 +121744,7 @@ Contour.meta = { module.exports = Contour; -},{"../../plots/cartesian":600,"./attributes":696,"./calc":697,"./colorbar":698,"./defaults":699,"./hover":700,"./plot":703,"./style":704}],702:[function(require,module,exports){ +},{"../../plots/cartesian":623,"./attributes":719,"./calc":720,"./colorbar":721,"./defaults":722,"./hover":723,"./plot":726,"./style":727}],725:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120883,7 +121824,7 @@ module.exports = function makeColorMap(trace) { return colorMap; }; -},{"../../components/colorscale/get_scale":495,"d3":119}],703:[function(require,module,exports){ +},{"../../components/colorscale/get_scale":518,"d3":124}],726:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121593,7 +122534,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/drawing":506,"../../lib":568,"../heatmap/plot":715,"d3":119}],704:[function(require,module,exports){ +},{"../../components/drawing":529,"../../lib":591,"../heatmap/plot":738,"d3":124}],727:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121650,7 +122591,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":506,"../heatmap/style":716,"./make_color_map":702,"d3":119}],705:[function(require,module,exports){ +},{"../../components/drawing":529,"../heatmap/style":739,"./make_color_map":725,"d3":124}],728:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121686,7 +122627,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout) } }; -},{"../../components/colorscale/defaults":493}],706:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516}],729:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121774,7 +122715,7 @@ module.exports = extendFlat({}, {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} ); -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../scatter/attributes":750}],707:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../scatter/attributes":773}],730:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121806,6 +122747,7 @@ module.exports = function calc(gd, trace) { ya = Axes.getFromId(gd, trace.yaxis || 'y'), isContour = Plots.traceIs(trace, 'contour'), isHist = Plots.traceIs(trace, 'histogram'), + isGL2D = Plots.traceIs(trace, 'gl2d'), zsmooth = isContour ? 'best' : trace.zsmooth, x, x0, @@ -121889,8 +122831,11 @@ module.exports = function calc(gd, trace) { yIn = trace.ytype === 'scaled' ? '' : trace.y, yArray = makeBoundArray(trace, yIn, y0, dy, z.length, ya); - Axes.expand(xa, xArray); - Axes.expand(ya, yArray); + // handled in gl2d convert step + if(!isGL2D) { + Axes.expand(xa, xArray); + Axes.expand(ya, yArray); + } var cd0 = {x: xArray, y: yArray, z: z}; @@ -122220,7 +123165,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../components/colorscale/calc":490,"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648,"../histogram2d/calc":727,"./convert_column_xyz":709,"./has_columns":711,"./max_row_length":714,"fast-isnumeric":123}],708:[function(require,module,exports){ +},{"../../components/colorscale/calc":513,"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/plots":671,"../histogram2d/calc":750,"./convert_column_xyz":732,"./has_columns":734,"./max_row_length":737,"fast-isnumeric":128}],731:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122266,7 +123211,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,"d3":119,"fast-isnumeric":123}],709:[function(require,module,exports){ +},{"../../components/colorbar/draw":509,"../../components/colorscale/get_scale":518,"../../lib":591,"../../plots/plots":671,"d3":124,"fast-isnumeric":128}],732:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122323,7 +123268,7 @@ module.exports = function convertColumnXYZ(trace, xa, ya) { if(hasColumnText) trace.text = text; }; -},{"../../lib":568}],710:[function(require,module,exports){ +},{"../../lib":591}],733:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122361,7 +123306,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":706,"./has_columns":711,"./xyz_defaults":717}],711:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":729,"./has_columns":734,"./xyz_defaults":740}],734:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122377,7 +123322,7 @@ module.exports = function(trace) { return !Array.isArray(trace.z[0]); }; -},{}],712:[function(require,module,exports){ +},{}],735:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122495,7 +123440,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour) })]; }; -},{"../../lib":568,"../../plots/cartesian/constants":597,"../../plots/cartesian/graph_interact":599}],713:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/constants":620,"../../plots/cartesian/graph_interact":622}],736:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122550,7 +123495,7 @@ Heatmap.meta = { module.exports = Heatmap; -},{"../../plots/cartesian":600,"./attributes":706,"./calc":707,"./colorbar":708,"./defaults":710,"./hover":712,"./plot":715,"./style":716}],714:[function(require,module,exports){ +},{"../../plots/cartesian":623,"./attributes":729,"./calc":730,"./colorbar":731,"./defaults":733,"./hover":735,"./plot":738,"./style":739}],737:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122572,7 +123517,7 @@ module.exports = function maxRowLength(z) { return len; }; -},{}],715:[function(require,module,exports){ +},{}],738:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122971,7 +123916,7 @@ function plotOne(gd, plotinfo, cd) { image3.exit().remove(); } -},{"../../components/colorscale/get_scale":495,"../../constants/xmlns_namespaces":556,"../../lib":568,"../../plots/plots":648,"./max_row_length":714,"d3":119,"tinycolor2":454}],716:[function(require,module,exports){ +},{"../../components/colorscale/get_scale":518,"../../constants/xmlns_namespaces":579,"../../lib":591,"../../plots/plots":671,"./max_row_length":737,"d3":124,"tinycolor2":477}],739:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122992,7 +123937,7 @@ module.exports = function style(gd) { }); }; -},{"d3":119}],717:[function(require,module,exports){ +},{"d3":124}],740:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123081,7 +124026,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"./has_columns":711,"fast-isnumeric":123}],718:[function(require,module,exports){ +},{"./has_columns":734,"fast-isnumeric":128}],741:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123248,7 +124193,7 @@ function makeBinsAttr(axLetter) { }; } -},{"../bar/attributes":670}],719:[function(require,module,exports){ +},{"../bar/attributes":693}],742:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123274,7 +124219,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],720:[function(require,module,exports){ +},{}],743:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123304,7 +124249,7 @@ module.exports = function handleBinDefaults(traceIn, traceOut, coerce, binDirect return traceOut; }; -},{}],721:[function(require,module,exports){ +},{}],744:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123378,7 +124323,7 @@ module.exports = { } }; -},{"fast-isnumeric":123}],722:[function(require,module,exports){ +},{"fast-isnumeric":128}],745:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123508,7 +124453,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"./average":719,"./bin_functions":721,"./norm_functions":725,"fast-isnumeric":123}],723:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"./average":742,"./bin_functions":744,"./norm_functions":748,"fast-isnumeric":128}],746:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123560,7 +124505,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":483,"../../components/errorbars/defaults":511,"../../lib":568,"../bar/style_defaults":680,"./attributes":718,"./bin_defaults":720}],724:[function(require,module,exports){ +},{"../../components/color":506,"../../components/errorbars/defaults":534,"../../lib":591,"../bar/style_defaults":703,"./attributes":741,"./bin_defaults":743}],747:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123615,7 +124560,7 @@ Histogram.meta = { module.exports = Histogram; -},{"../../plots/cartesian":600,"../bar/hover":673,"../bar/layout_attributes":675,"../bar/layout_defaults":676,"../bar/plot":677,"../bar/set_positions":678,"../bar/style":679,"../scatter/colorbar":753,"./attributes":718,"./calc":722,"./defaults":723}],725:[function(require,module,exports){ +},{"../../plots/cartesian":623,"../bar/hover":696,"../bar/layout_attributes":698,"../bar/layout_defaults":699,"../bar/plot":700,"../bar/set_positions":701,"../bar/style":702,"../scatter/colorbar":776,"./attributes":741,"./calc":745,"./defaults":746}],748:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123650,7 +124595,7 @@ module.exports = { } }; -},{}],726:[function(require,module,exports){ +},{}],749:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123702,7 +124647,7 @@ module.exports = extendFlat({}, {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} ); -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../heatmap/attributes":706,"../histogram/attributes":718}],727:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../heatmap/attributes":729,"../histogram/attributes":741}],750:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123868,7 +124813,7 @@ module.exports = function calc(gd, trace) { }; }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"../histogram/average":719,"../histogram/bin_functions":721,"../histogram/norm_functions":725}],728:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"../histogram/average":742,"../histogram/bin_functions":744,"../histogram/norm_functions":748}],751:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123901,7 +124846,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, layout) { ); }; -},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":726,"./sample_defaults":730}],729:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":749,"./sample_defaults":753}],752:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123941,7 +124886,7 @@ Histogram2D.meta = { module.exports = Histogram2D; -},{"../../plots/cartesian":600,"../heatmap/calc":707,"../heatmap/colorbar":708,"../heatmap/hover":712,"../heatmap/plot":715,"../heatmap/style":716,"./attributes":726,"./defaults":728}],730:[function(require,module,exports){ +},{"../../plots/cartesian":623,"../heatmap/calc":730,"../heatmap/colorbar":731,"../heatmap/hover":735,"../heatmap/plot":738,"../heatmap/style":739,"./attributes":749,"./defaults":751}],753:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123977,7 +124922,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce) { handleBinDefaults(traceIn, traceOut, coerce, binDirections); }; -},{"../histogram/bin_defaults":720}],731:[function(require,module,exports){ +},{"../histogram/bin_defaults":743}],754:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124021,7 +124966,7 @@ module.exports = extendFlat({}, { colorscaleAttrs ); -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../contour/attributes":696,"../histogram2d/attributes":726}],732:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../contour/attributes":719,"../histogram2d/attributes":749}],755:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124057,7 +125002,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":568,"../contour/style_defaults":705,"../histogram2d/sample_defaults":730,"./attributes":731}],733:[function(require,module,exports){ +},{"../../lib":591,"../contour/style_defaults":728,"../histogram2d/sample_defaults":753,"./attributes":754}],756:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124097,7 +125042,7 @@ Histogram2dContour.meta = { module.exports = Histogram2dContour; -},{"../../plots/cartesian":600,"../contour/calc":697,"../contour/colorbar":698,"../contour/hover":700,"../contour/plot":703,"../contour/style":704,"./attributes":731,"./defaults":732}],734:[function(require,module,exports){ +},{"../../plots/cartesian":623,"../contour/calc":720,"../contour/colorbar":721,"../contour/hover":723,"../contour/plot":726,"../contour/style":727,"./attributes":754,"./defaults":755}],757:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124296,7 +125241,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../surface/attributes":802}],735:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../surface/attributes":825}],758:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124458,7 +125403,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../lib/str2rgbarray":580,"alpha-shape":41,"convex-hull":108,"delaunay-triangulate":120,"gl-mesh3d":156,"tinycolor2":454}],736:[function(require,module,exports){ +},{"../../lib/str2rgbarray":603,"alpha-shape":41,"convex-hull":113,"delaunay-triangulate":125,"gl-mesh3d":161,"tinycolor2":477}],759:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124555,7 +125500,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/colorbar/defaults":485,"../../lib":568,"./attributes":734}],737:[function(require,module,exports){ +},{"../../components/colorbar/defaults":508,"../../lib":591,"./attributes":757}],760:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124591,7 +125536,7 @@ Mesh3D.meta = { module.exports = Mesh3D; -},{"../../plots/gl3d":628,"../heatmap/colorbar":708,"./attributes":734,"./convert":735,"./defaults":736}],738:[function(require,module,exports){ +},{"../../plots/gl3d":651,"../heatmap/colorbar":731,"./attributes":757,"./convert":758,"./defaults":759}],761:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124855,7 +125800,7 @@ module.exports = { } }; -},{"../../components/color/attributes":482,"../../lib/extend":563,"../../plots/attributes":590,"../../plots/font_attributes":610}],739:[function(require,module,exports){ +},{"../../components/color/attributes":505,"../../lib/extend":586,"../../plots/attributes":613,"../../plots/font_attributes":633}],762:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124902,7 +125847,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../plots/plots":648}],740:[function(require,module,exports){ +},{"../../plots/plots":671}],763:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125054,7 +125999,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":483,"./helpers":742,"fast-isnumeric":123,"tinycolor2":454}],741:[function(require,module,exports){ +},{"../../components/color":506,"./helpers":765,"fast-isnumeric":128,"tinycolor2":477}],764:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125138,7 +126083,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":568,"./attributes":738}],742:[function(require,module,exports){ +},{"../../lib":591,"./attributes":761}],765:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125167,7 +126112,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":568}],743:[function(require,module,exports){ +},{"../../lib":591}],766:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125203,7 +126148,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":738,"./base_plot":739,"./calc":740,"./defaults":741,"./layout_attributes":744,"./layout_defaults":745,"./plot":746,"./style":747,"./style_one":748}],744:[function(require,module,exports){ +},{"./attributes":761,"./base_plot":762,"./calc":763,"./defaults":764,"./layout_attributes":767,"./layout_defaults":768,"./plot":769,"./style":770,"./style_one":771}],767:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125223,7 +126168,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],745:[function(require,module,exports){ +},{}],768:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125245,7 +126190,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":568,"./layout_attributes":744}],746:[function(require,module,exports){ +},{"../../lib":591,"./layout_attributes":767}],769:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125940,7 +126885,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":483,"../../components/drawing":506,"../../lib/svg_text_utils":581,"../../plots/cartesian/graph_interact":599,"./helpers":742,"d3":119}],747:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"../../lib/svg_text_utils":604,"../../plots/cartesian/graph_interact":622,"./helpers":765,"d3":124}],770:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125969,7 +126914,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":748,"d3":119}],748:[function(require,module,exports){ +},{"./style_one":771,"d3":124}],771:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125996,7 +126941,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":483}],749:[function(require,module,exports){ +},{"../../components/color":506}],772:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126034,7 +126979,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":568}],750:[function(require,module,exports){ +},{"../../lib":591}],773:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126384,7 +127329,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../components/drawing":506,"../../lib/extend":563,"./constants":755}],751:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../components/drawing":529,"../../lib/extend":586,"./constants":778}],774:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126511,7 +127456,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"./colorscale_calc":754,"./subtypes":769,"fast-isnumeric":123}],752:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"./colorscale_calc":777,"./subtypes":792,"fast-isnumeric":128}],775:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126552,7 +127497,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],753:[function(require,module,exports){ +},{}],776:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126605,7 +127550,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,"d3":119,"fast-isnumeric":123}],754:[function(require,module,exports){ +},{"../../components/colorbar/draw":509,"../../components/colorscale/get_scale":518,"../../lib":591,"../../plots/plots":671,"d3":124,"fast-isnumeric":128}],777:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126638,7 +127583,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":490,"../../components/colorscale/has_colorscale":496,"./subtypes":769}],755:[function(require,module,exports){ +},{"../../components/colorscale/calc":513,"../../components/colorscale/has_colorscale":519,"./subtypes":792}],778:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126654,7 +127599,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],756:[function(require,module,exports){ +},{}],779:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126732,7 +127677,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":511,"../../lib":568,"./attributes":750,"./constants":755,"./fillcolor_defaults":757,"./line_defaults":761,"./line_shape_defaults":763,"./marker_defaults":765,"./subtypes":769,"./text_defaults":770,"./xy_defaults":771}],757:[function(require,module,exports){ +},{"../../components/errorbars/defaults":534,"../../lib":591,"./attributes":773,"./constants":778,"./fillcolor_defaults":780,"./line_defaults":784,"./line_shape_defaults":786,"./marker_defaults":788,"./subtypes":792,"./text_defaults":793,"./xy_defaults":794}],780:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126771,7 +127716,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":483}],758:[function(require,module,exports){ +},{"../../components/color":506}],781:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126824,7 +127769,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":483,"./subtypes":769}],759:[function(require,module,exports){ +},{"../../components/color":506,"./subtypes":792}],782:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126993,7 +127938,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":483,"../../components/errorbars":512,"../../lib":568,"../../plots/cartesian/constants":597,"../../plots/cartesian/graph_interact":599,"./get_trace_color":758}],760:[function(require,module,exports){ +},{"../../components/color":506,"../../components/errorbars":535,"../../lib":591,"../../plots/cartesian/constants":620,"../../plots/cartesian/graph_interact":622,"./get_trace_color":781}],783:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127042,7 +127987,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":600,"./arrays_to_calcdata":749,"./attributes":750,"./calc":751,"./clean_data":752,"./colorbar":753,"./defaults":756,"./hover":759,"./plot":766,"./select":767,"./style":768,"./subtypes":769}],761:[function(require,module,exports){ +},{"../../plots/cartesian":623,"./arrays_to_calcdata":772,"./attributes":773,"./calc":774,"./clean_data":775,"./colorbar":776,"./defaults":779,"./hover":782,"./plot":789,"./select":790,"./style":791,"./subtypes":792}],784:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127075,7 +128020,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496}],762:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516,"../../components/colorscale/has_colorscale":519}],785:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127244,7 +128189,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":592}],763:[function(require,module,exports){ +},{"../../plots/cartesian/axes":615}],786:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127263,7 +128208,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],764:[function(require,module,exports){ +},{}],787:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127305,7 +128250,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":123}],765:[function(require,module,exports){ +},{"fast-isnumeric":128}],788:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127365,7 +128310,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":483,"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496,"./subtypes":769}],766:[function(require,module,exports){ +},{"../../components/color":506,"../../components/colorscale/defaults":516,"../../components/colorscale/has_colorscale":519,"./subtypes":792}],789:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127658,7 +128603,7 @@ function selectMarkers(gd, plotinfo, cdscatter) { }); } -},{"../../components/drawing":506,"../../components/errorbars":512,"../../lib":568,"../../lib/polygon":574,"./arrays_to_calcdata":749,"./line_points":762,"./subtypes":769,"d3":119}],767:[function(require,module,exports){ +},{"../../components/drawing":529,"../../components/errorbars":535,"../../lib":591,"../../lib/polygon":597,"./arrays_to_calcdata":772,"./line_points":785,"./subtypes":792,"d3":124}],790:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127729,7 +128674,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":769}],768:[function(require,module,exports){ +},{"./subtypes":792}],791:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127771,7 +128716,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":506,"../../components/errorbars":512,"d3":119}],769:[function(require,module,exports){ +},{"../../components/drawing":529,"../../components/errorbars":535,"d3":124}],792:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127807,7 +128752,7 @@ module.exports = { } }; -},{"../../lib":568}],770:[function(require,module,exports){ +},{"../../lib":591}],793:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127828,7 +128773,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":568}],771:[function(require,module,exports){ +},{"../../lib":591}],794:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127873,7 +128818,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return len; }; -},{}],772:[function(require,module,exports){ +},{}],795:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128030,7 +128975,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../constants/gl_markers":554,"../../lib/extend":563,"../scatter/attributes":750}],773:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../constants/gl_markers":577,"../../lib/extend":586,"../scatter/attributes":773}],796:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128059,7 +129004,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":749,"../scatter/colorscale_calc":754}],774:[function(require,module,exports){ +},{"../scatter/arrays_to_calcdata":772,"../scatter/colorscale_calc":777}],797:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128130,7 +129075,7 @@ function calculateErrors(data, scaleFactor) { module.exports = calculateErrors; -},{"../../components/errorbars/compute_error":510}],775:[function(require,module,exports){ +},{"../../components/errorbars/compute_error":533}],798:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128589,7 +129534,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../constants/gl3d_dashes":553,"../../constants/gl_markers":554,"../../lib":568,"../../lib/gl_format_color":566,"../../lib/str2rgbarray":580,"../scatter/make_bubble_size_func":764,"./calc_errors":774,"delaunay-triangulate":120,"gl-error3d":127,"gl-line3d":133,"gl-mesh3d":156,"gl-scatter3d":199}],776:[function(require,module,exports){ +},{"../../constants/gl3d_dashes":576,"../../constants/gl_markers":577,"../../lib":591,"../../lib/gl_format_color":589,"../../lib/str2rgbarray":603,"../scatter/make_bubble_size_func":787,"./calc_errors":797,"delaunay-triangulate":125,"gl-error3d":132,"gl-line3d":138,"gl-mesh3d":161,"gl-scatter3d":204}],799:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128674,7 +129619,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../components/errorbars/defaults":511,"../../lib":568,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":772}],777:[function(require,module,exports){ +},{"../../components/errorbars/defaults":534,"../../lib":591,"../scatter/line_defaults":784,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/text_defaults":793,"./attributes":795}],800:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128712,7 +129657,7 @@ Scatter3D.meta = { module.exports = Scatter3D; -},{"../../constants/gl_markers":554,"../../plots/gl3d":628,"../scatter/colorbar":753,"./attributes":772,"./calc":773,"./convert":775,"./defaults":776}],778:[function(require,module,exports){ +},{"../../constants/gl_markers":577,"../../plots/gl3d":651,"../scatter/colorbar":776,"./attributes":795,"./calc":796,"./convert":798,"./defaults":799}],801:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128801,7 +129746,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../../plots/attributes":590,"../scatter/attributes":750}],779:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../lib/extend":586,"../../plots/attributes":613,"../scatter/attributes":773}],802:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128824,7 +129769,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/colorscale_calc":754}],780:[function(require,module,exports){ +},{"../scatter/colorscale_calc":777}],803:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128897,7 +129842,7 @@ function handleLonLatLocDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":568,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":778}],781:[function(require,module,exports){ +},{"../../lib":591,"../scatter/line_defaults":784,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/text_defaults":793,"./attributes":801}],804:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128932,7 +129877,7 @@ ScatterGeo.meta = { module.exports = ScatterGeo; -},{"../../plots/geo":613,"../scatter/colorbar":753,"./attributes":778,"./calc":779,"./defaults":780,"./plot":782}],782:[function(require,module,exports){ +},{"../../plots/geo":636,"../scatter/colorbar":776,"./attributes":801,"./calc":802,"./defaults":803,"./plot":805}],805:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129232,7 +130177,7 @@ function makeEventDataFunc(trace) { }; } -},{"../../components/color":483,"../../components/drawing":506,"../../lib/array_to_calc_item":559,"../../lib/geo_location_utils":565,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../scatter/subtypes":769,"./attributes":778,"d3":119}],783:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"../../lib/array_to_calc_item":582,"../../lib/geo_location_utils":588,"../../lib/topojson_utils":605,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622,"../scatter/subtypes":792,"./attributes":801,"d3":124}],806:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129322,7 +130267,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../constants/gl2d_dashes":552,"../../constants/gl_markers":554,"../../lib/extend":563,"../scatter/attributes":750}],784:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../constants/gl2d_dashes":575,"../../constants/gl_markers":577,"../../lib/extend":586,"../scatter/attributes":773}],807:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129357,6 +130302,7 @@ var AXES = ['xaxis', 'yaxis']; function LineWithMarkers(scene, uid) { this.scene = scene; this.uid = uid; + this.type = 'scattergl'; this.pickXData = []; this.pickYData = []; @@ -129914,7 +130860,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../components/errorbars":512,"../../constants/gl2d_dashes":552,"../../constants/gl_markers":554,"../../lib":568,"../../lib/gl_format_color":566,"../../lib/str2rgbarray":580,"../../plots/cartesian/axes":592,"../scatter/get_trace_color":758,"../scatter/make_bubble_size_func":764,"../scatter/subtypes":769,"fast-isnumeric":123,"gl-error2d":125,"gl-line2d":131,"gl-scatter2d":196,"gl-scatter2d-fancy":191}],785:[function(require,module,exports){ +},{"../../components/errorbars":535,"../../constants/gl2d_dashes":575,"../../constants/gl_markers":577,"../../lib":591,"../../lib/gl_format_color":589,"../../lib/str2rgbarray":603,"../../plots/cartesian/axes":615,"../scatter/get_trace_color":781,"../scatter/make_bubble_size_func":787,"../scatter/subtypes":792,"fast-isnumeric":128,"gl-error2d":130,"gl-line2d":136,"gl-scatter2d":201,"gl-scatter2d-fancy":196}],808:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129971,7 +130917,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":511,"../../lib":568,"../scatter/constants":755,"../scatter/fillcolor_defaults":757,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/xy_defaults":771,"./attributes":783}],786:[function(require,module,exports){ +},{"../../components/errorbars/defaults":534,"../../lib":591,"../scatter/constants":778,"../scatter/fillcolor_defaults":780,"../scatter/line_defaults":784,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/xy_defaults":794,"./attributes":806}],809:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130007,7 +130953,7 @@ ScatterGl.meta = { module.exports = ScatterGl; -},{"../../plots/gl2d":625,"../scatter/colorbar":753,"../scatter3d/calc":773,"./attributes":783,"./convert":784,"./defaults":785}],787:[function(require,module,exports){ +},{"../../plots/gl2d":648,"../scatter/colorbar":776,"../scatter3d/calc":796,"./attributes":806,"./convert":807,"./defaults":808}],810:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130127,7 +131073,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/attributes":590,"../../plots/mapbox/layout_attributes":645,"../scatter/attributes":750,"../scattergeo/attributes":778}],788:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/attributes":613,"../../plots/mapbox/layout_attributes":668,"../scatter/attributes":773,"../scattergeo/attributes":801}],811:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130224,7 +131170,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale/has_colorscale":496,"../../components/colorscale/make_scale_function":500,"../../lib":568,"../scatter/colorscale_calc":754,"../scatter/make_bubble_size_func":764,"../scatter/subtypes":769,"fast-isnumeric":123}],789:[function(require,module,exports){ +},{"../../components/colorscale/has_colorscale":519,"../../components/colorscale/make_scale_function":523,"../../lib":591,"../scatter/colorscale_calc":777,"../scatter/make_bubble_size_func":787,"../scatter/subtypes":792,"fast-isnumeric":128}],812:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130374,9 +131320,21 @@ function makeBlankGeoJSON() { } function makeFillGeoJSON(_, coords) { + if(coords.length === 1) { + return { + type: 'Polygon', + coordinates: coords + }; + } + + var _coords = new Array(coords.length); + for(var i = 0; i < coords.length; i++) { + _coords[i] = [coords[i]]; + } + return { - type: 'Polygon', - coordinates: coords + type: 'MultiPolygon', + coordinates: _coords }; } @@ -130575,7 +131533,7 @@ function getFillFunc(attr) { function blankFillFunc() { return ''; } -},{"../../lib":568,"../../plots/mapbox/convert_text_opts":642,"../scatter/subtypes":769}],790:[function(require,module,exports){ +},{"../../lib":591,"../../plots/mapbox/convert_text_opts":665,"../scatter/subtypes":792}],813:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130663,7 +131621,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":568,"../scatter/attributes":750,"../scatter/fillcolor_defaults":757,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":787}],791:[function(require,module,exports){ +},{"../../lib":591,"../scatter/attributes":773,"../scatter/fillcolor_defaults":780,"../scatter/line_defaults":784,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/text_defaults":793,"./attributes":810}],814:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130756,7 +131714,7 @@ function getExtraText(trace, di) { return text.join('
'); } -},{"../../plots/cartesian/graph_interact":599,"../scatter/get_trace_color":758}],792:[function(require,module,exports){ +},{"../../plots/cartesian/graph_interact":622,"../scatter/get_trace_color":781}],815:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130792,7 +131750,7 @@ ScatterMapbox.meta = { module.exports = ScatterMapbox; -},{"../../plots/mapbox":643,"../scatter/colorbar":753,"./attributes":787,"./calc":788,"./defaults":790,"./hover":791,"./plot":793}],793:[function(require,module,exports){ +},{"../../plots/mapbox":666,"../scatter/colorbar":776,"./attributes":810,"./calc":811,"./defaults":813,"./hover":814,"./plot":816}],816:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130823,17 +131781,10 @@ function ScatterMapbox(mapbox, uid) { this.idLayerCircle = uid + '-layer-circle'; this.idLayerSymbol = uid + '-layer-symbol'; - this.sourceFill = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceFill, this.sourceFill); - - this.sourceLine = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceLine, this.sourceLine); - - this.sourceCircle = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceCircle, this.sourceCircle); - - this.sourceSymbol = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceSymbol, this.sourceSymbol); + this.mapbox.initSource(this.idSourceFill); + this.mapbox.initSource(this.idSourceLine); + this.mapbox.initSource(this.idSourceCircle); + this.mapbox.initSource(this.idSourceSymbol); this.map.addLayer({ id: this.idLayerFill, @@ -130868,7 +131819,6 @@ var proto = ScatterMapbox.prototype; proto.update = function update(calcTrace) { var mapbox = this.mapbox; - var opts = convert(calcTrace); mapbox.setOptions(this.idLayerFill, 'setLayoutProperty', opts.fill.layout); @@ -130877,22 +131827,22 @@ proto.update = function update(calcTrace) { mapbox.setOptions(this.idLayerSymbol, 'setLayoutProperty', opts.symbol.layout); if(isVisible(opts.fill)) { - this.sourceFill.setData(opts.fill.geojson); + mapbox.setSourceData(this.idSourceFill, opts.fill.geojson); mapbox.setOptions(this.idLayerFill, 'setPaintProperty', opts.fill.paint); } if(isVisible(opts.line)) { - this.sourceLine.setData(opts.line.geojson); + mapbox.setSourceData(this.idSourceLine, opts.line.geojson); mapbox.setOptions(this.idLayerLine, 'setPaintProperty', opts.line.paint); } if(isVisible(opts.circle)) { - this.sourceCircle.setData(opts.circle.geojson); + mapbox.setSourceData(this.idSourceCircle, opts.circle.geojson); mapbox.setOptions(this.idLayerCircle, 'setPaintProperty', opts.circle.paint); } if(isVisible(opts.symbol)) { - this.sourceSymbol.setData(opts.symbol.geojson); + mapbox.setSourceData(this.idSourceSymbol, opts.symbol.geojson); mapbox.setOptions(this.idLayerSymbol, 'setPaintProperty', opts.symbol.paint); } }; @@ -130924,7 +131874,7 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { return scatterMapbox; }; -},{"./convert":789}],794:[function(require,module,exports){ +},{"./convert":812}],817:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131050,7 +132000,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../../plots/attributes":590,"../scatter/attributes":750}],795:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../lib/extend":586,"../../plots/attributes":613,"../scatter/attributes":773}],818:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131149,7 +132099,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"../scatter/colorscale_calc":754,"../scatter/subtypes":769,"fast-isnumeric":123}],796:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"../scatter/colorscale_calc":777,"../scatter/subtypes":792,"fast-isnumeric":128}],819:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131254,7 +132204,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hoveron', dfltHoverOn.join('+') || 'points'); }; -},{"../../lib":568,"../scatter/constants":755,"../scatter/fillcolor_defaults":757,"../scatter/line_defaults":761,"../scatter/line_shape_defaults":763,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":794}],797:[function(require,module,exports){ +},{"../../lib":591,"../scatter/constants":778,"../scatter/fillcolor_defaults":780,"../scatter/line_defaults":784,"../scatter/line_shape_defaults":786,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/text_defaults":793,"./attributes":817}],820:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131325,7 +132275,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../../plots/cartesian/axes":592,"../scatter/hover":759}],798:[function(require,module,exports){ +},{"../../plots/cartesian/axes":615,"../scatter/hover":782}],821:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131361,7 +132311,7 @@ ScatterTernary.meta = { module.exports = ScatterTernary; -},{"../../plots/ternary":655,"../scatter/colorbar":753,"./attributes":794,"./calc":795,"./defaults":796,"./hover":797,"./plot":799,"./select":800,"./style":801}],799:[function(require,module,exports){ +},{"../../plots/ternary":678,"../scatter/colorbar":776,"./attributes":817,"./calc":818,"./defaults":819,"./hover":820,"./plot":822,"./select":823,"./style":824}],822:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131407,7 +132357,7 @@ module.exports = function plot(ternary, data) { scatterPlot(ternary.graphDiv, plotinfo, calcdata); }; -},{"../scatter/plot":766}],800:[function(require,module,exports){ +},{"../scatter/plot":789}],823:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131442,7 +132392,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"../scatter/select":767}],801:[function(require,module,exports){ +},{"../scatter/select":790}],824:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131471,7 +132421,7 @@ module.exports = function style(gd) { scatterStyle(gd); }; -},{"../scatter/style":768}],802:[function(require,module,exports){ +},{"../scatter/style":791}],825:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131719,7 +132669,7 @@ module.exports = { } }; -},{"../../components/color":483,"../../components/colorscale/attributes":489,"../../lib/extend":563}],803:[function(require,module,exports){ +},{"../../components/color":506,"../../components/colorscale/attributes":512,"../../lib/extend":586}],826:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131743,7 +132693,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":490}],804:[function(require,module,exports){ +},{"../../components/colorscale/calc":513}],827:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131790,7 +132740,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,"d3":119,"fast-isnumeric":123}],805:[function(require,module,exports){ +},{"../../components/colorbar/draw":509,"../../components/colorscale/get_scale":518,"../../lib":591,"../../plots/plots":671,"d3":124,"fast-isnumeric":128}],828:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132153,7 +133103,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../lib/str2rgbarray":580,"gl-surface3d":227,"ndarray":433,"ndarray-fill":426,"ndarray-homography":431,"ndarray-ops":432,"tinycolor2":454}],806:[function(require,module,exports){ +},{"../../lib/str2rgbarray":603,"gl-surface3d":232,"ndarray":456,"ndarray-fill":449,"ndarray-homography":454,"ndarray-ops":455,"tinycolor2":477}],829:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132270,7 +133220,7 @@ function mapLegacy(traceIn, oldAttr, newAttr) { } } -},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":802}],807:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":825}],830:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132313,5 +133263,5 @@ Surface.meta = { module.exports = Surface; -},{"../../plots/gl3d":628,"./attributes":802,"./calc":803,"./colorbar":804,"./convert":805,"./defaults":806}]},{},[12])(12) +},{"../../plots/gl3d":651,"./attributes":825,"./calc":826,"./colorbar":827,"./convert":828,"./defaults":829}]},{},[12])(12) }); \ No newline at end of file diff --git a/dist/plotly.js b/dist/plotly.js index 3f0036cfa1c..02f54a1a08d 100644 --- a/dist/plotly.js +++ b/dist/plotly.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.16.2 +* plotly.js v1.16.3 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -68,7 +68,7 @@ for(var selector in rules) { Plotly.Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/plotly":589}],2:[function(require,module,exports){ +},{"../src/plotly":612}],2:[function(require,module,exports){ 'use strict'; module.exports = { @@ -199,7 +199,7 @@ module.exports = { module.exports = require('../src/traces/bar'); -},{"../src/traces/bar":674}],4:[function(require,module,exports){ +},{"../src/traces/bar":697}],4:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -210,7 +210,7 @@ module.exports = require('../src/traces/bar'); module.exports = require('../src/traces/box'); -},{"../src/traces/box":685}],5:[function(require,module,exports){ +},{"../src/traces/box":708}],5:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -221,7 +221,7 @@ module.exports = require('../src/traces/box'); module.exports = require('../src/traces/choropleth'); -},{"../src/traces/choropleth":694}],6:[function(require,module,exports){ +},{"../src/traces/choropleth":717}],6:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -232,7 +232,7 @@ module.exports = require('../src/traces/choropleth'); module.exports = require('../src/traces/contour'); -},{"../src/traces/contour":701}],7:[function(require,module,exports){ +},{"../src/traces/contour":724}],7:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -243,7 +243,7 @@ module.exports = require('../src/traces/contour'); module.exports = require('../src/core'); -},{"../src/core":557}],8:[function(require,module,exports){ +},{"../src/core":580}],8:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -254,7 +254,7 @@ module.exports = require('../src/core'); module.exports = require('../src/traces/heatmap'); -},{"../src/traces/heatmap":713}],9:[function(require,module,exports){ +},{"../src/traces/heatmap":736}],9:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -265,7 +265,7 @@ module.exports = require('../src/traces/heatmap'); module.exports = require('../src/traces/histogram'); -},{"../src/traces/histogram":724}],10:[function(require,module,exports){ +},{"../src/traces/histogram":747}],10:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -276,7 +276,7 @@ module.exports = require('../src/traces/histogram'); module.exports = require('../src/traces/histogram2d'); -},{"../src/traces/histogram2d":729}],11:[function(require,module,exports){ +},{"../src/traces/histogram2d":752}],11:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -287,7 +287,7 @@ module.exports = require('../src/traces/histogram2d'); module.exports = require('../src/traces/histogram2dcontour'); -},{"../src/traces/histogram2dcontour":733}],12:[function(require,module,exports){ +},{"../src/traces/histogram2dcontour":756}],12:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -332,7 +332,7 @@ module.exports = Plotly; module.exports = require('../src/traces/mesh3d'); -},{"../src/traces/mesh3d":737}],14:[function(require,module,exports){ +},{"../src/traces/mesh3d":760}],14:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -343,7 +343,7 @@ module.exports = require('../src/traces/mesh3d'); module.exports = require('../src/traces/pie'); -},{"../src/traces/pie":743}],15:[function(require,module,exports){ +},{"../src/traces/pie":766}],15:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -354,7 +354,7 @@ module.exports = require('../src/traces/pie'); module.exports = require('../src/traces/scatter3d'); -},{"../src/traces/scatter3d":777}],16:[function(require,module,exports){ +},{"../src/traces/scatter3d":800}],16:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -365,7 +365,7 @@ module.exports = require('../src/traces/scatter3d'); module.exports = require('../src/traces/scattergeo'); -},{"../src/traces/scattergeo":781}],17:[function(require,module,exports){ +},{"../src/traces/scattergeo":804}],17:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -376,7 +376,7 @@ module.exports = require('../src/traces/scattergeo'); module.exports = require('../src/traces/scattergl'); -},{"../src/traces/scattergl":786}],18:[function(require,module,exports){ +},{"../src/traces/scattergl":809}],18:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -387,7 +387,7 @@ module.exports = require('../src/traces/scattergl'); module.exports = require('../src/traces/scattermapbox'); -},{"../src/traces/scattermapbox":792}],19:[function(require,module,exports){ +},{"../src/traces/scattermapbox":815}],19:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -398,7 +398,7 @@ module.exports = require('../src/traces/scattermapbox'); module.exports = require('../src/traces/scatterternary'); -},{"../src/traces/scatterternary":798}],20:[function(require,module,exports){ +},{"../src/traces/scatterternary":821}],20:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -409,7 +409,7 @@ module.exports = require('../src/traces/scatterternary'); module.exports = require('../src/traces/surface'); -},{"../src/traces/surface":807}],21:[function(require,module,exports){ +},{"../src/traces/surface":830}],21:[function(require,module,exports){ 'use strict' module.exports = createFilteredVector @@ -1096,7 +1096,7 @@ function createMatrixCameraController(options) { 0,0,0,1] return new MatrixCameraController(matrix) } -},{"binary-search-bounds":30,"gl-mat4/invert":143,"gl-mat4/lookAt":144,"gl-mat4/rotateX":148,"gl-mat4/rotateY":149,"gl-mat4/rotateZ":150,"gl-mat4/scale":151,"gl-mat4/translate":152,"gl-vec3/normalize":28,"mat4-interpolate":31}],30:[function(require,module,exports){ +},{"binary-search-bounds":30,"gl-mat4/invert":148,"gl-mat4/lookAt":149,"gl-mat4/rotateX":153,"gl-mat4/rotateY":154,"gl-mat4/rotateZ":155,"gl-mat4/scale":156,"gl-mat4/translate":157,"gl-vec3/normalize":28,"mat4-interpolate":31}],30:[function(require,module,exports){ arguments[4][22][0].apply(exports,arguments) },{"dup":22}],31:[function(require,module,exports){ var lerp = require('gl-vec3/lerp') @@ -1151,7 +1151,7 @@ function vec3(n) { function vec4() { return [0,0,0,1] } -},{"gl-mat4/determinant":139,"gl-vec3/lerp":27,"mat4-decompose":32,"mat4-recompose":34,"quat-slerp":35}],32:[function(require,module,exports){ +},{"gl-mat4/determinant":144,"gl-vec3/lerp":27,"mat4-decompose":32,"mat4-recompose":34,"quat-slerp":35}],32:[function(require,module,exports){ /*jshint unused:true*/ /* Input: matrix ; a 4x4 matrix @@ -1331,7 +1331,7 @@ function combine(out, a, b, scale1, scale2) { out[1] = a[1] * scale1 + b[1] * scale2 out[2] = a[2] * scale1 + b[2] * scale2 } -},{"./normalize":33,"gl-mat4/clone":137,"gl-mat4/create":138,"gl-mat4/determinant":139,"gl-mat4/invert":143,"gl-mat4/transpose":153,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/length":26,"gl-vec3/normalize":28}],33:[function(require,module,exports){ +},{"./normalize":33,"gl-mat4/clone":142,"gl-mat4/create":143,"gl-mat4/determinant":144,"gl-mat4/invert":148,"gl-mat4/transpose":158,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/length":26,"gl-vec3/normalize":28}],33:[function(require,module,exports){ module.exports = function normalize(out, mat) { var m44 = mat[15] // Cannot normalize. @@ -1403,7 +1403,7 @@ module.exports = function recomposeMat4(matrix, translation, scale, skew, perspe mat4.scale(matrix, matrix, scale) return matrix } -},{"gl-mat4/create":138,"gl-mat4/fromRotationTranslation":141,"gl-mat4/identity":142,"gl-mat4/multiply":145,"gl-mat4/scale":151,"gl-mat4/translate":152}],35:[function(require,module,exports){ +},{"gl-mat4/create":143,"gl-mat4/fromRotationTranslation":146,"gl-mat4/identity":147,"gl-mat4/multiply":150,"gl-mat4/scale":156,"gl-mat4/translate":157}],35:[function(require,module,exports){ module.exports = require('gl-quat/slerp') },{"gl-quat/slerp":36}],36:[function(require,module,exports){ module.exports = slerp @@ -1894,7 +1894,7 @@ function createOrbitController(options) { return result } -},{"./lib/quatFromFrame":37,"filtered-vector":21,"gl-mat4/fromQuat":140,"gl-mat4/invert":143,"gl-mat4/lookAt":144}],39:[function(require,module,exports){ +},{"./lib/quatFromFrame":37,"filtered-vector":21,"gl-mat4/fromQuat":145,"gl-mat4/invert":148,"gl-mat4/lookAt":149}],39:[function(require,module,exports){ 'use strict' module.exports = createTurntableController @@ -2467,7 +2467,7 @@ function createTurntableController(options) { theta, phi) } -},{"filtered-vector":21,"gl-mat4/invert":143,"gl-mat4/rotate":147,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/normalize":28}],40:[function(require,module,exports){ +},{"filtered-vector":21,"gl-mat4/invert":148,"gl-mat4/rotate":152,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/normalize":28}],40:[function(require,module,exports){ 'use strict' module.exports = createViewController @@ -2616,7 +2616,7 @@ function alphaComplex(alpha, points) { return circumradius(simplex) * alpha < 1 }) } -},{"circumradius":43,"delaunay-triangulate":120}],43:[function(require,module,exports){ +},{"circumradius":43,"delaunay-triangulate":125}],43:[function(require,module,exports){ module.exports = circumradius var circumcenter = require('circumcenter') @@ -2701,7 +2701,7 @@ function circumcenter(points) { circumcenter.barycenetric = barycentricCircumcenter module.exports = circumcenter -},{"dup":121,"robust-linear-solve":436}],45:[function(require,module,exports){ +},{"dup":126,"robust-linear-solve":459}],45:[function(require,module,exports){ 'use strict' module.exports = boundary @@ -2770,7 +2770,7 @@ function compareOrientedCells(a, b) { return compareCells(a, b) || parity(a) - parity(b) } -},{"cell-orientation":47,"compare-cell":107}],49:[function(require,module,exports){ +},{"cell-orientation":47,"compare-cell":112}],49:[function(require,module,exports){ 'use strict' var compareCell = require('compare-cell') @@ -2803,7 +2803,7 @@ function reduceCellComplex(cells) { return cells } -},{"cell-orientation":47,"compare-cell":107,"compare-oriented-cell":48}],50:[function(require,module,exports){ +},{"cell-orientation":47,"compare-cell":112,"compare-oriented-cell":48}],50:[function(require,module,exports){ 'use strict'; var arraytools = function () { @@ -3199,367 +3199,6 @@ exports.nextCombination = function(v) { },{}],52:[function(require,module,exports){ -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -// when used in node, this will actually load the util module we depend on -// versus loading the builtin util module as happens otherwise -// this is a bug in node module loading as far as I am concerned -var util = require('util/'); - -var pSlice = Array.prototype.slice; -var hasOwn = Object.prototype.hasOwnProperty; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } - else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = stackStartFunction.name; - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function replacer(key, value) { - if (util.isUndefined(value)) { - return '' + value; - } - if (util.isNumber(value) && !isFinite(value)) { - return value.toString(); - } - if (util.isFunction(value) || util.isRegExp(value)) { - return value.toString(); - } - return value; -} - -function truncate(s, n) { - if (util.isString(s)) { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} - -function getMessage(self) { - return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + - self.operator + ' ' + - truncate(JSON.stringify(self.expected, replacer), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (util.isBuffer(actual) && util.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if (!util.isObject(actual) && !util.isObject(expected)) { - return actual == expected; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b) { - if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) - return false; - // an identical 'prototype' property. - if (a.prototype !== b.prototype) return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) { - return a === b; - } - var aIsArgs = isArguments(a), - bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - var ka = objectKeys(a), - kb = objectKeys(b), - key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key])) return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } else if (actual instanceof expected) { - return true; - } else if (expected.call({}, actual) === true) { - return true; - } - - return false; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (util.isString(expected)) { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - if (!shouldThrow && expectedException(actual, expected)) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function(err) { if (err) {throw err;}}; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -},{"util/":62}],53:[function(require,module,exports){ (function (global){ /*! * The buffer module from node.js, for the browser. @@ -5025,7 +4664,7 @@ function blitBuffer (src, dst, offset, length) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"base64-js":54,"ieee754":55,"isarray":56}],54:[function(require,module,exports){ +},{"base64-js":53,"ieee754":54,"isarray":55}],53:[function(require,module,exports){ 'use strict' exports.toByteArray = toByteArray @@ -5141,7 +4780,7 @@ function fromByteArray (uint8) { return parts.join('') } -},{}],55:[function(require,module,exports){ +},{}],54:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 @@ -5227,14 +4866,14 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],56:[function(require,module,exports){ +},{}],55:[function(require,module,exports){ var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; -},{}],57:[function(require,module,exports){ +},{}],56:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -5534,7 +5173,7 @@ function isUndefined(arg) { return arg === void 0; } -},{}],58:[function(require,module,exports){ +},{}],57:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -5559,7 +5198,7 @@ if (typeof Object.create === 'function') { } } -},{}],59:[function(require,module,exports){ +},{}],58:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -5787,7 +5426,7 @@ var substr = 'ab'.substr(-1) === 'b' ; }).call(this,require('_process')) -},{"_process":60}],60:[function(require,module,exports){ +},{"_process":59}],59:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -5880,15 +5519,1483 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; +},{}],60:[function(require,module,exports){ +(function (global){ +/*! https://mths.be/punycode v1.4.0 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.3.2', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],61:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); } + +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + },{}],62:[function(require,module,exports){ -(function (process,global){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; + +},{}],63:[function(require,module,exports){ +'use strict'; + +exports.decode = exports.parse = require('./decode'); +exports.encode = exports.stringify = require('./encode'); + +},{"./decode":61,"./encode":62}],64:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var punycode = require('punycode'); +var util = require('./util'); + +exports.parse = urlParse; +exports.resolve = urlResolve; +exports.resolveObject = urlResolveObject; +exports.format = urlFormat; + +exports.Url = Url; + +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; +} + +// Reference: RFC 3986, RFC 1808, RFC 2396 + +// define these here so at least they only have to be +// compiled once on the first module load. +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = require('querystring'); + +function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) return url; + + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; +} + +Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + hostEnd = rest.length; + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) continue; + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) this.pathname = rest; + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; +}; + +// format a parsed object into a url string +function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) obj = urlParse(obj); + if (!(obj instanceof Url)) return Url.prototype.format.call(obj); + return obj.format(); +} + +Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') protocol += ':'; + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') hash = '#' + hash; + if (search && search.charAt(0) !== '?') search = '?' + search; + + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; +}; + +function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); +} + +Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); +}; + +function urlResolveObject(source, relative) { + if (!source) return relative; + return urlParse(source, false, true).resolveObject(relative); +} + +Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + result[rkey] = relative[rkey]; + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())); + if (!relative.host) relative.host = ''; + if (!relative.hostname) relative.hostname = ''; + if (relPath[0] !== '') relPath.unshift(''); + if (relPath.length < 2) relPath.unshift(''); + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') srcPath[0] = result.host; + else srcPath.unshift(result.host); + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') relPath[0] = relative.host; + else relPath.unshift(relative.host); + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; +}; + +Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) this.hostname = host; +}; + +},{"./util":65,"punycode":60,"querystring":63}],65:[function(require,module,exports){ +'use strict'; + +module.exports = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; + } +}; + +},{}],66:[function(require,module,exports){ +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} +},{}],67:[function(require,module,exports){ +(function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -6477,7 +7584,7 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":61,"_process":60,"inherits":58}],63:[function(require,module,exports){ +},{"./support/isBuffer":66,"_process":59,"inherits":57}],68:[function(require,module,exports){ 'use strict' var monotoneTriangulate = require('./lib/monotone') @@ -6561,7 +7668,7 @@ function cdt2d(points, edges, options) { } } -},{"./lib/delaunay":64,"./lib/filter":65,"./lib/monotone":66,"./lib/triangulation":67}],64:[function(require,module,exports){ +},{"./lib/delaunay":69,"./lib/filter":70,"./lib/monotone":71,"./lib/triangulation":72}],69:[function(require,module,exports){ 'use strict' var inCircle = require('robust-in-sphere')[4] @@ -6678,7 +7785,7 @@ function delaunayRefine(points, triangulation) { } } -},{"binary-search-bounds":68,"robust-in-sphere":69}],65:[function(require,module,exports){ +},{"binary-search-bounds":73,"robust-in-sphere":74}],70:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -6860,7 +7967,7 @@ function classifyFaces(triangulation, target, infinity) { return result } -},{"binary-search-bounds":68}],66:[function(require,module,exports){ +},{"binary-search-bounds":73}],71:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -7049,7 +8156,7 @@ function monotoneTriangulate(points, edges) { return cells } -},{"binary-search-bounds":68,"robust-orientation":439}],67:[function(require,module,exports){ +},{"binary-search-bounds":73,"robust-orientation":462}],72:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -7155,7 +8262,7 @@ function createTriangulation(numVerts, edges) { return new Triangulation(stars, edges) } -},{"binary-search-bounds":68}],68:[function(require,module,exports){ +},{"binary-search-bounds":73}],73:[function(require,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, earlyOut) { @@ -7209,7 +8316,7 @@ module.exports = { eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],69:[function(require,module,exports){ +},{}],74:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -7377,7 +8484,7 @@ function generateInSphereTest() { } generateInSphereTest() -},{"robust-scale":440,"robust-subtract":441,"robust-sum":442,"two-product":456}],70:[function(require,module,exports){ +},{"robust-scale":463,"robust-subtract":464,"robust-sum":465,"two-product":479}],75:[function(require,module,exports){ 'use strict' module.exports = cleanPSLG @@ -7739,7 +8846,7 @@ function cleanPSLG(points, edges, colors) { return modified } -},{"./lib/rat-seg-intersect":71,"big-rat":75,"big-rat/cmp":73,"big-rat/to-float":88,"box-intersect":89,"compare-cell":107,"nextafter":97,"rat-vec":99,"robust-segment-intersect":102,"union-find":103}],71:[function(require,module,exports){ +},{"./lib/rat-seg-intersect":76,"big-rat":80,"big-rat/cmp":78,"big-rat/to-float":93,"box-intersect":94,"compare-cell":112,"nextafter":102,"rat-vec":104,"robust-segment-intersect":107,"union-find":108}],76:[function(require,module,exports){ 'use strict' //TODO: Move this to a separate module @@ -7785,7 +8892,7 @@ function solveIntersection(a, b, c, d) { return rvAdd(a, rvMuls(ba, t)) } -},{"big-rat/div":74,"big-rat/mul":84,"big-rat/sign":86,"big-rat/sub":87,"big-rat/to-float":88,"rat-vec/add":98,"rat-vec/muls":100,"rat-vec/sub":101}],72:[function(require,module,exports){ +},{"big-rat/div":79,"big-rat/mul":89,"big-rat/sign":91,"big-rat/sub":92,"big-rat/to-float":93,"rat-vec/add":103,"rat-vec/muls":105,"rat-vec/sub":106}],77:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -7798,7 +8905,7 @@ function add(a, b) { a[1].mul(b[1])) } -},{"./lib/rationalize":82}],73:[function(require,module,exports){ +},{"./lib/rationalize":87}],78:[function(require,module,exports){ 'use strict' module.exports = cmp @@ -7807,7 +8914,7 @@ function cmp(a, b) { return a[0].mul(b[1]).cmp(b[0].mul(a[1])) } -},{}],74:[function(require,module,exports){ +},{}],79:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -7818,7 +8925,7 @@ function div(a, b) { return rationalize(a[0].mul(b[1]), a[1].mul(b[0])) } -},{"./lib/rationalize":82}],75:[function(require,module,exports){ +},{"./lib/rationalize":87}],80:[function(require,module,exports){ 'use strict' var isRat = require('./is-rat') @@ -7880,7 +8987,7 @@ function makeRational(numer, denom) { return rationalize(a, b) } -},{"./div":74,"./is-rat":76,"./lib/is-bn":80,"./lib/num-to-bn":81,"./lib/rationalize":82,"./lib/str-to-bn":83}],76:[function(require,module,exports){ +},{"./div":79,"./is-rat":81,"./lib/is-bn":85,"./lib/num-to-bn":86,"./lib/rationalize":87,"./lib/str-to-bn":88}],81:[function(require,module,exports){ 'use strict' var isBN = require('./lib/is-bn') @@ -7891,7 +8998,7 @@ function isRat(x) { return Array.isArray(x) && x.length === 2 && isBN(x[0]) && isBN(x[1]) } -},{"./lib/is-bn":80}],77:[function(require,module,exports){ +},{"./lib/is-bn":85}],82:[function(require,module,exports){ 'use strict' var bn = require('bn.js') @@ -7902,7 +9009,7 @@ function sign(x) { return x.cmp(new bn(0)) } -},{"bn.js":85}],78:[function(require,module,exports){ +},{"bn.js":90}],83:[function(require,module,exports){ 'use strict' module.exports = bn2num @@ -7926,7 +9033,7 @@ function bn2num(b) { return b.sign ? -out : out } -},{}],79:[function(require,module,exports){ +},{}],84:[function(require,module,exports){ 'use strict' var db = require('double-bits') @@ -7947,7 +9054,7 @@ function ctzNumber(x) { return h + 32 } -},{"bit-twiddle":51,"double-bits":96}],80:[function(require,module,exports){ +},{"bit-twiddle":51,"double-bits":101}],85:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -7960,7 +9067,7 @@ function isBN(x) { return x && typeof x === 'object' && Boolean(x.words) } -},{"bn.js":85}],81:[function(require,module,exports){ +},{"bn.js":90}],86:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -7977,7 +9084,7 @@ function num2bn(x) { } } -},{"bn.js":85,"double-bits":96}],82:[function(require,module,exports){ +},{"bn.js":90,"double-bits":101}],87:[function(require,module,exports){ 'use strict' var num2bn = require('./num-to-bn') @@ -8005,7 +9112,7 @@ function rationalize(numer, denom) { return [ numer, denom ] } -},{"./bn-sign":77,"./num-to-bn":81}],83:[function(require,module,exports){ +},{"./bn-sign":82,"./num-to-bn":86}],88:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -8016,7 +9123,7 @@ function str2BN(x) { return new BN(x) } -},{"bn.js":85}],84:[function(require,module,exports){ +},{"bn.js":90}],89:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -8027,7 +9134,7 @@ function mul(a, b) { return rationalize(a[0].mul(b[0]), a[1].mul(b[1])) } -},{"./lib/rationalize":82}],85:[function(require,module,exports){ +},{"./lib/rationalize":87}],90:[function(require,module,exports){ (function (module, exports) { 'use strict'; @@ -10347,7 +11454,7 @@ Mont.prototype.invm = function invm(a) { })(typeof module === 'undefined' || module, this); -},{}],86:[function(require,module,exports){ +},{}],91:[function(require,module,exports){ 'use strict' var bnsign = require('./lib/bn-sign') @@ -10358,7 +11465,7 @@ function sign(x) { return bnsign(x[0]) * bnsign(x[1]) } -},{"./lib/bn-sign":77}],87:[function(require,module,exports){ +},{"./lib/bn-sign":82}],92:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -10369,7 +11476,7 @@ function sub(a, b) { return rationalize(a[0].mul(b[1]).sub(a[1].mul(b[0])), a[1].mul(b[1])) } -},{"./lib/rationalize":82}],88:[function(require,module,exports){ +},{"./lib/rationalize":87}],93:[function(require,module,exports){ 'use strict' var bn2num = require('./lib/bn-to-num') @@ -10412,7 +11519,7 @@ function roundRat(f) { } } -},{"./lib/bn-to-num":78,"./lib/ctz":79}],89:[function(require,module,exports){ +},{"./lib/bn-to-num":83,"./lib/ctz":84}],94:[function(require,module,exports){ 'use strict' module.exports = boxIntersectWrapper @@ -10551,7 +11658,7 @@ function boxIntersectWrapper(arg0, arg1, arg2) { throw new Error('box-intersect: Invalid arguments') } } -},{"./lib/intersect":91,"./lib/sweep":95,"typedarray-pool":458}],90:[function(require,module,exports){ +},{"./lib/intersect":96,"./lib/sweep":100,"typedarray-pool":481}],95:[function(require,module,exports){ 'use strict' var DIMENSION = 'd' @@ -10696,7 +11803,7 @@ function bruteForcePlanner(full) { exports.partial = bruteForcePlanner(false) exports.full = bruteForcePlanner(true) -},{}],91:[function(require,module,exports){ +},{}],96:[function(require,module,exports){ 'use strict' module.exports = boxIntersectIter @@ -11191,7 +12298,7 @@ function boxIntersectIter( } } } -},{"./brute":90,"./median":92,"./partition":93,"./sweep":95,"bit-twiddle":51,"typedarray-pool":458}],92:[function(require,module,exports){ +},{"./brute":95,"./median":97,"./partition":98,"./sweep":100,"bit-twiddle":51,"typedarray-pool":481}],97:[function(require,module,exports){ 'use strict' module.exports = findMedian @@ -11334,7 +12441,7 @@ function findMedian(d, axis, start, end, boxes, ids) { start, mid, boxes, ids, boxes[elemSize*mid+axis]) } -},{"./partition":93}],93:[function(require,module,exports){ +},{"./partition":98}],98:[function(require,module,exports){ 'use strict' module.exports = genPartition @@ -11355,7 +12462,7 @@ function genPartition(predicate, args) { .replace('$', predicate)) return Function.apply(void 0, fargs) } -},{}],94:[function(require,module,exports){ +},{}],99:[function(require,module,exports){ 'use strict'; //This code is extracted from ndarray-sort @@ -11592,7 +12699,7 @@ function quickSort(left, right, data) { quickSort(less, great, data); } } -},{}],95:[function(require,module,exports){ +},{}],100:[function(require,module,exports){ 'use strict' module.exports = { @@ -12027,7 +13134,7 @@ red_loop: } } } -},{"./sort":94,"bit-twiddle":51,"typedarray-pool":458}],96:[function(require,module,exports){ +},{"./sort":99,"bit-twiddle":51,"typedarray-pool":481}],101:[function(require,module,exports){ (function (Buffer){ var hasTypedArrays = false if(typeof Float64Array !== "undefined") { @@ -12131,7 +13238,7 @@ module.exports.denormalized = function(n) { return !(hi & 0x7ff00000) } }).call(this,require("buffer").Buffer) -},{"buffer":53}],97:[function(require,module,exports){ +},{"buffer":52}],102:[function(require,module,exports){ "use strict" var doubleBits = require("double-bits") @@ -12174,7 +13281,7 @@ function nextafter(x, y) { } return doubleBits.pack(lo, hi) } -},{"double-bits":96}],98:[function(require,module,exports){ +},{"double-bits":101}],103:[function(require,module,exports){ 'use strict' var bnadd = require('big-rat/add') @@ -12190,7 +13297,7 @@ function add(a, b) { return r } -},{"big-rat/add":72}],99:[function(require,module,exports){ +},{"big-rat/add":77}],104:[function(require,module,exports){ 'use strict' module.exports = float2rat @@ -12205,7 +13312,7 @@ function float2rat(v) { return result } -},{"big-rat":75}],100:[function(require,module,exports){ +},{"big-rat":80}],105:[function(require,module,exports){ 'use strict' var rat = require('big-rat') @@ -12223,7 +13330,7 @@ function muls(a, x) { return r } -},{"big-rat":75,"big-rat/mul":84}],101:[function(require,module,exports){ +},{"big-rat":80,"big-rat/mul":89}],106:[function(require,module,exports){ 'use strict' var bnsub = require('big-rat/sub') @@ -12239,7 +13346,7 @@ function sub(a, b) { return r } -},{"big-rat/sub":87}],102:[function(require,module,exports){ +},{"big-rat/sub":92}],107:[function(require,module,exports){ "use strict" module.exports = segmentsIntersect @@ -12287,7 +13394,7 @@ function segmentsIntersect(a0, a1, b0, b1) { return true } -},{"robust-orientation":439}],103:[function(require,module,exports){ +},{"robust-orientation":462}],108:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -12350,7 +13457,7 @@ proto.link = function(x, y) { ++ranks[xr]; } } -},{}],104:[function(require,module,exports){ +},{}],109:[function(require,module,exports){ (function (Buffer){ var clone = (function() { 'use strict'; @@ -12514,10 +13621,10 @@ if (typeof module === 'object' && module.exports) { } }).call(this,require("buffer").Buffer) -},{"buffer":53}],105:[function(require,module,exports){ +},{"buffer":52}],110:[function(require,module,exports){ module.exports={"jet":[{"index":0,"rgb":[0,0,131]},{"index":0.125,"rgb":[0,60,170]},{"index":0.375,"rgb":[5,255,255]},{"index":0.625,"rgb":[255,255,0]},{"index":0.875,"rgb":[250,0,0]},{"index":1,"rgb":[128,0,0]}],"hsv":[{"index":0,"rgb":[255,0,0]},{"index":0.169,"rgb":[253,255,2]},{"index":0.173,"rgb":[247,255,2]},{"index":0.337,"rgb":[0,252,4]},{"index":0.341,"rgb":[0,252,10]},{"index":0.506,"rgb":[1,249,255]},{"index":0.671,"rgb":[2,0,253]},{"index":0.675,"rgb":[8,0,253]},{"index":0.839,"rgb":[255,0,251]},{"index":0.843,"rgb":[255,0,245]},{"index":1,"rgb":[255,0,6]}],"hot":[{"index":0,"rgb":[0,0,0]},{"index":0.3,"rgb":[230,0,0]},{"index":0.6,"rgb":[255,210,0]},{"index":1,"rgb":[255,255,255]}],"cool":[{"index":0,"rgb":[0,255,255]},{"index":1,"rgb":[255,0,255]}],"spring":[{"index":0,"rgb":[255,0,255]},{"index":1,"rgb":[255,255,0]}],"summer":[{"index":0,"rgb":[0,128,102]},{"index":1,"rgb":[255,255,102]}],"autumn":[{"index":0,"rgb":[255,0,0]},{"index":1,"rgb":[255,255,0]}],"winter":[{"index":0,"rgb":[0,0,255]},{"index":1,"rgb":[0,255,128]}],"bone":[{"index":0,"rgb":[0,0,0]},{"index":0.376,"rgb":[84,84,116]},{"index":0.753,"rgb":[169,200,200]},{"index":1,"rgb":[255,255,255]}],"copper":[{"index":0,"rgb":[0,0,0]},{"index":0.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":0.125,"rgb":[37,52,148]},{"index":0.25,"rgb":[34,94,168]},{"index":0.375,"rgb":[29,145,192]},{"index":0.5,"rgb":[65,182,196]},{"index":0.625,"rgb":[127,205,187]},{"index":0.75,"rgb":[199,233,180]},{"index":0.875,"rgb":[237,248,217]},{"index":1,"rgb":[255,255,217]}],"greens":[{"index":0,"rgb":[0,68,27]},{"index":0.125,"rgb":[0,109,44]},{"index":0.25,"rgb":[35,139,69]},{"index":0.375,"rgb":[65,171,93]},{"index":0.5,"rgb":[116,196,118]},{"index":0.625,"rgb":[161,217,155]},{"index":0.75,"rgb":[199,233,192]},{"index":0.875,"rgb":[229,245,224]},{"index":1,"rgb":[247,252,245]}],"yiorrd":[{"index":0,"rgb":[128,0,38]},{"index":0.125,"rgb":[189,0,38]},{"index":0.25,"rgb":[227,26,28]},{"index":0.375,"rgb":[252,78,42]},{"index":0.5,"rgb":[253,141,60]},{"index":0.625,"rgb":[254,178,76]},{"index":0.75,"rgb":[254,217,118]},{"index":0.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":0.35,"rgb":[106,137,247]},{"index":0.5,"rgb":[190,190,190]},{"index":0.6,"rgb":[220,170,132]},{"index":0.7,"rgb":[230,145,90]},{"index":1,"rgb":[178,10,28]}],"picnic":[{"index":0,"rgb":[0,0,255]},{"index":0.1,"rgb":[51,153,255]},{"index":0.2,"rgb":[102,204,255]},{"index":0.3,"rgb":[153,204,255]},{"index":0.4,"rgb":[204,204,255]},{"index":0.5,"rgb":[255,255,255]},{"index":0.6,"rgb":[255,204,255]},{"index":0.7,"rgb":[255,153,255]},{"index":0.8,"rgb":[255,102,204]},{"index":0.9,"rgb":[255,102,102]},{"index":1,"rgb":[255,0,0]}],"rainbow":[{"index":0,"rgb":[150,0,90]},{"index":0.125,"rgb":[0,0,200]},{"index":0.25,"rgb":[0,25,255]},{"index":0.375,"rgb":[0,152,255]},{"index":0.5,"rgb":[44,255,150]},{"index":0.625,"rgb":[151,255,0]},{"index":0.75,"rgb":[255,234,0]},{"index":0.875,"rgb":[255,111,0]},{"index":1,"rgb":[255,0,0]}],"portland":[{"index":0,"rgb":[12,51,131]},{"index":0.25,"rgb":[10,136,186]},{"index":0.5,"rgb":[242,211,56]},{"index":0.75,"rgb":[242,143,56]},{"index":1,"rgb":[217,30,30]}],"blackbody":[{"index":0,"rgb":[0,0,0]},{"index":0.2,"rgb":[230,0,0]},{"index":0.4,"rgb":[230,210,0]},{"index":0.7,"rgb":[255,255,255]},{"index":1,"rgb":[160,200,255]}],"earth":[{"index":0,"rgb":[0,0,130]},{"index":0.1,"rgb":[0,180,180]},{"index":0.2,"rgb":[40,210,40]},{"index":0.4,"rgb":[230,230,50]},{"index":0.6,"rgb":[120,70,20]},{"index":1,"rgb":[255,255,255]}],"electric":[{"index":0,"rgb":[0,0,0]},{"index":0.15,"rgb":[30,0,100]},{"index":0.4,"rgb":[120,0,100]},{"index":0.6,"rgb":[160,90,0]},{"index":0.8,"rgb":[230,200,0]},{"index":1,"rgb":[255,250,220]}], "alpha": [{"index":0, "rgb": [255,255,255,0]},{"index":0, "rgb": [255,255,255,1]}]}; -},{}],106:[function(require,module,exports){ +},{}],111:[function(require,module,exports){ /* * Ben Postlethwaite * January 2013 @@ -12653,7 +13760,7 @@ function rgbaStr (rgba) { return 'rgba(' + rgba.join(',') + ')'; } -},{"./colorScales":105,"arraytools":50,"clone":104}],107:[function(require,module,exports){ +},{"./colorScales":110,"arraytools":50,"clone":109}],112:[function(require,module,exports){ module.exports = compareCells var min = Math.min @@ -12709,7 +13816,7 @@ function compareCells(a, b) { } } -},{}],108:[function(require,module,exports){ +},{}],113:[function(require,module,exports){ "use strict" var convexHull1d = require('./lib/ch1d') @@ -12735,7 +13842,7 @@ function convexHull(points) { } return convexHullnd(points, d) } -},{"./lib/ch1d":109,"./lib/ch2d":110,"./lib/chnd":111}],109:[function(require,module,exports){ +},{"./lib/ch1d":114,"./lib/ch2d":115,"./lib/chnd":116}],114:[function(require,module,exports){ "use strict" module.exports = convexHull1d @@ -12759,7 +13866,7 @@ function convexHull1d(points) { return [[lo]] } } -},{}],110:[function(require,module,exports){ +},{}],115:[function(require,module,exports){ 'use strict' module.exports = convexHull2D @@ -12782,7 +13889,7 @@ function convexHull2D(points) { return edges } -},{"monotone-convex-hull-2d":113}],111:[function(require,module,exports){ +},{"monotone-convex-hull-2d":118}],116:[function(require,module,exports){ 'use strict' module.exports = convexHullnD @@ -12843,7 +13950,7 @@ function convexHullnD(points, d) { return invPermute(nhull, ah) } } -},{"affine-hull":112,"incremental-convex-hull":241}],112:[function(require,module,exports){ +},{"affine-hull":117,"incremental-convex-hull":246}],117:[function(require,module,exports){ 'use strict' module.exports = affineHull @@ -12895,7 +14002,7 @@ function affineHull(points) { } return index } -},{"robust-orientation":439}],113:[function(require,module,exports){ +},{"robust-orientation":462}],118:[function(require,module,exports){ 'use strict' module.exports = monotoneConvexHull2D @@ -12977,7 +14084,7 @@ function monotoneConvexHull2D(points) { //Return result return result } -},{"robust-orientation":439}],114:[function(require,module,exports){ +},{"robust-orientation":462}],119:[function(require,module,exports){ module.exports = { AFG: "afghan", ALA: "\\b\\wland", @@ -13236,7 +14343,7 @@ module.exports = { ZWE: "zimbabwe|^(?!.*northern).*rhodesia" }; -},{}],115:[function(require,module,exports){ +},{}],120:[function(require,module,exports){ "use strict" var createThunk = require("./lib/thunk.js") @@ -13347,7 +14454,7 @@ function compileCwise(user_args) { module.exports = compileCwise -},{"./lib/thunk.js":117}],116:[function(require,module,exports){ +},{"./lib/thunk.js":122}],121:[function(require,module,exports){ "use strict" var uniq = require("uniq") @@ -13703,7 +14810,7 @@ function generateCWiseOp(proc, typesig) { } module.exports = generateCWiseOp -},{"uniq":459}],117:[function(require,module,exports){ +},{"uniq":482}],122:[function(require,module,exports){ "use strict" // The function below is called when constructing a cwise function object, and does the following: @@ -13791,9 +14898,9 @@ function createThunk(proc) { module.exports = createThunk -},{"./compile.js":116}],118:[function(require,module,exports){ +},{"./compile.js":121}],123:[function(require,module,exports){ module.exports = require("cwise-compiler") -},{"cwise-compiler":115}],119:[function(require,module,exports){ +},{"cwise-compiler":120}],124:[function(require,module,exports){ !function() { var d3 = { version: "3.5.16" @@ -23348,7 +24455,7 @@ module.exports = require("cwise-compiler") }); if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; }(); -},{}],120:[function(require,module,exports){ +},{}],125:[function(require,module,exports){ "use strict" var ch = require("incremental-convex-hull") @@ -23508,7 +24615,7 @@ function triangulate(points, includePointAtInfinity) { return hull } -},{"incremental-convex-hull":241,"uniq":459}],121:[function(require,module,exports){ +},{"incremental-convex-hull":246,"uniq":482}],126:[function(require,module,exports){ "use strict" function dupe_array(count, value, i) { @@ -23558,7 +24665,7 @@ function dupe(count, value) { } module.exports = dupe -},{}],122:[function(require,module,exports){ +},{}],127:[function(require,module,exports){ (function (process,global){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. @@ -24516,7 +25623,7 @@ module.exports = dupe }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":60}],123:[function(require,module,exports){ +},{"_process":59}],128:[function(require,module,exports){ /** * inspired by is-number * but significantly simplified and sped up by ignoring number and string constructors @@ -24573,7 +25680,7 @@ module.exports = function(n) { return n - n < 1; }; -},{}],124:[function(require,module,exports){ +},{}],129:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -24727,7 +25834,7 @@ function createBuffer(gl, data, type, usage) { module.exports = createBuffer -},{"ndarray":433,"ndarray-ops":432,"typedarray-pool":458}],125:[function(require,module,exports){ +},{"ndarray":456,"ndarray-ops":455,"typedarray-pool":481}],130:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -24977,7 +26084,7 @@ function createError2D (plot, options) { return errorbars } -},{"./lib/shaders":126,"gl-buffer":124,"gl-shader":203,"typedarray-pool":458}],126:[function(require,module,exports){ +},{"./lib/shaders":131,"gl-buffer":129,"gl-shader":208,"typedarray-pool":481}],131:[function(require,module,exports){ module.exports = { @@ -24985,7 +26092,7 @@ module.exports = { fragment: "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n" } -},{}],127:[function(require,module,exports){ +},{}],132:[function(require,module,exports){ 'use strict' module.exports = createErrorBars @@ -25222,7 +26329,7 @@ function createErrorBars(options) { return result } -},{"./shaders/index":128,"gl-buffer":124,"gl-vao":232}],128:[function(require,module,exports){ +},{"./shaders/index":133,"gl-buffer":129,"gl-vao":237}],133:[function(require,module,exports){ 'use strict' @@ -25239,7 +26346,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":203}],129:[function(require,module,exports){ +},{"gl-shader":208}],134:[function(require,module,exports){ 'use strict' var createTexture = require('gl-texture2d') @@ -25706,7 +26813,7 @@ function createFBO(gl, width, height, options) { WEBGL_draw_buffers) } -},{"gl-texture2d":228}],130:[function(require,module,exports){ +},{"gl-texture2d":233}],135:[function(require,module,exports){ exports.lineVertex = "precision mediump float;\n#define GLSLIFY 1\n\nfloat inverse_1_0(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse_1_0(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse_1_0(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse_1_0(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\nvoid main() {\n vec2 dir = (matrix * vec3(d, 0)).xy;\n vec3 base = matrix * vec3(a, 1);\n vec2 n = 0.5 * width *\n normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(base.xy/base.z + n, 0, 1);\n}\n" @@ -25718,7 +26825,7 @@ exports.pickFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform exports.fillVertex = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 projectAxis;\nuniform float projectValue;\nuniform float depth;\n\nvoid main() {\n vec3 base = matrix * vec3(a, 1);\n vec2 p = base.xy / base.z;\n if(d.y < 0.0 || (d.y == 0.0 && d.x < 0.0)) {\n if(dot(p, projectAxis) < projectValue) {\n p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n }\n }\n gl_Position = vec4(p, depth, 1);\n}\n" exports.fillFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n" -},{}],131:[function(require,module,exports){ +},{}],136:[function(require,module,exports){ 'use strict' module.exports = createLinePlot @@ -26191,7 +27298,7 @@ function createLinePlot(plot, options) { return linePlot } -},{"./lib/shaders":130,"gl-buffer":124,"gl-shader":203,"gl-texture2d":228,"ndarray":433,"typedarray-pool":458}],132:[function(require,module,exports){ +},{"./lib/shaders":135,"gl-buffer":129,"gl-shader":208,"gl-texture2d":233,"ndarray":456,"typedarray-pool":481}],137:[function(require,module,exports){ var createShader = require('gl-shader') @@ -26215,7 +27322,7 @@ exports.createPickShader = function(gl) { return createShader(gl, vertSrc, pickFrag, null, ATTRIBUTES) } -},{"gl-shader":203}],133:[function(require,module,exports){ +},{"gl-shader":208}],138:[function(require,module,exports){ 'use strict' module.exports = createLinePlot @@ -26585,9 +27692,9 @@ function createLinePlot (options) { return linePlot } -},{"./lib/shaders":132,"binary-search-bounds":134,"gl-buffer":124,"gl-texture2d":228,"gl-vao":232,"glsl-read-float":135,"ndarray":433}],134:[function(require,module,exports){ +},{"./lib/shaders":137,"binary-search-bounds":139,"gl-buffer":129,"gl-texture2d":233,"gl-vao":237,"glsl-read-float":140,"ndarray":456}],139:[function(require,module,exports){ arguments[4][22][0].apply(exports,arguments) -},{"dup":22}],135:[function(require,module,exports){ +},{"dup":22}],140:[function(require,module,exports){ module.exports = decodeFloat var UINT8_VIEW = new Uint8Array(4) @@ -26601,7 +27708,7 @@ function decodeFloat(x, y, z, w) { return FLOAT_VIEW[0] } -},{}],136:[function(require,module,exports){ +},{}],141:[function(require,module,exports){ module.exports = invert /** @@ -26640,7 +27747,7 @@ function invert(out, a) { return out } -},{}],137:[function(require,module,exports){ +},{}],142:[function(require,module,exports){ module.exports = clone; /** @@ -26669,7 +27776,7 @@ function clone(a) { out[15] = a[15]; return out; }; -},{}],138:[function(require,module,exports){ +},{}],143:[function(require,module,exports){ module.exports = create; /** @@ -26697,7 +27804,7 @@ function create() { out[15] = 1; return out; }; -},{}],139:[function(require,module,exports){ +},{}],144:[function(require,module,exports){ module.exports = determinant; /** @@ -26728,7 +27835,7 @@ function determinant(a) { // Calculate the determinant return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; }; -},{}],140:[function(require,module,exports){ +},{}],145:[function(require,module,exports){ module.exports = fromQuat; /** @@ -26776,7 +27883,7 @@ function fromQuat(out, q) { return out; }; -},{}],141:[function(require,module,exports){ +},{}],146:[function(require,module,exports){ module.exports = fromRotationTranslation; /** @@ -26830,7 +27937,7 @@ function fromRotationTranslation(out, q, v) { return out; }; -},{}],142:[function(require,module,exports){ +},{}],147:[function(require,module,exports){ module.exports = identity; /** @@ -26858,7 +27965,7 @@ function identity(out) { out[15] = 1; return out; }; -},{}],143:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ module.exports = invert; /** @@ -26914,7 +28021,7 @@ function invert(out, a) { return out; }; -},{}],144:[function(require,module,exports){ +},{}],149:[function(require,module,exports){ var identity = require('./identity'); module.exports = lookAt; @@ -27005,7 +28112,7 @@ function lookAt(out, eye, center, up) { return out; }; -},{"./identity":142}],145:[function(require,module,exports){ +},{"./identity":147}],150:[function(require,module,exports){ module.exports = multiply; /** @@ -27048,7 +28155,7 @@ function multiply(out, a, b) { out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; return out; }; -},{}],146:[function(require,module,exports){ +},{}],151:[function(require,module,exports){ module.exports = perspective; /** @@ -27082,7 +28189,7 @@ function perspective(out, fovy, aspect, near, far) { out[15] = 0; return out; }; -},{}],147:[function(require,module,exports){ +},{}],152:[function(require,module,exports){ module.exports = rotate; /** @@ -27147,7 +28254,7 @@ function rotate(out, a, rad, axis) { } return out; }; -},{}],148:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ module.exports = rotateX; /** @@ -27192,7 +28299,7 @@ function rotateX(out, a, rad) { out[11] = a23 * c - a13 * s; return out; }; -},{}],149:[function(require,module,exports){ +},{}],154:[function(require,module,exports){ module.exports = rotateY; /** @@ -27237,7 +28344,7 @@ function rotateY(out, a, rad) { out[11] = a03 * s + a23 * c; return out; }; -},{}],150:[function(require,module,exports){ +},{}],155:[function(require,module,exports){ module.exports = rotateZ; /** @@ -27282,7 +28389,7 @@ function rotateZ(out, a, rad) { out[7] = a13 * c - a03 * s; return out; }; -},{}],151:[function(require,module,exports){ +},{}],156:[function(require,module,exports){ module.exports = scale; /** @@ -27314,7 +28421,7 @@ function scale(out, a, v) { out[15] = a[15]; return out; }; -},{}],152:[function(require,module,exports){ +},{}],157:[function(require,module,exports){ module.exports = translate; /** @@ -27353,7 +28460,7 @@ function translate(out, a, v) { return out; }; -},{}],153:[function(require,module,exports){ +},{}],158:[function(require,module,exports){ module.exports = transpose; /** @@ -27403,7 +28510,7 @@ function transpose(out, a) { return out; }; -},{}],154:[function(require,module,exports){ +},{}],159:[function(require,module,exports){ 'use strict' var barycentric = require('barycentric') @@ -27501,7 +28608,7 @@ function closestPointToPickLocation(simplex, pixelCoord, model, view, projection } return [closestIndex, interpolate(simplex, weights), weights] } -},{"barycentric":157,"polytope-closest-point/lib/closest_point_2d.js":159}],155:[function(require,module,exports){ +},{"barycentric":162,"polytope-closest-point/lib/closest_point_2d.js":164}],160:[function(require,module,exports){ var triVertSrc = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}" @@ -27570,7 +28677,7 @@ exports.contourShader = { ] } -},{}],156:[function(require,module,exports){ +},{}],161:[function(require,module,exports){ 'use strict' var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small @@ -28585,7 +29692,7 @@ function createSimplicialMesh(params) { module.exports = createSimplicialMesh -},{"./lib/closest-point":154,"./lib/shaders":155,"colormap":106,"gl-buffer":124,"gl-mat4/invert":143,"gl-mat4/multiply":145,"gl-shader":203,"gl-texture2d":228,"gl-vao":232,"ndarray":433,"normals":158,"simplicial-complex-contour":160,"typedarray-pool":458}],157:[function(require,module,exports){ +},{"./lib/closest-point":159,"./lib/shaders":160,"colormap":111,"gl-buffer":129,"gl-mat4/invert":148,"gl-mat4/multiply":150,"gl-shader":208,"gl-texture2d":233,"gl-vao":237,"ndarray":456,"normals":163,"simplicial-complex-contour":165,"typedarray-pool":481}],162:[function(require,module,exports){ 'use strict' module.exports = barycentric @@ -28633,7 +29740,7 @@ function barycentric(simplex, point) { } return y } -},{"robust-linear-solve":436}],158:[function(require,module,exports){ +},{"robust-linear-solve":459}],163:[function(require,module,exports){ var DEFAULT_NORMALS_EPSILON = 1e-6; var DEFAULT_FACE_EPSILON = 1e-6; @@ -28758,7 +29865,7 @@ exports.faceNormals = function(faces, positions, specifiedEpsilon) { -},{}],159:[function(require,module,exports){ +},{}],164:[function(require,module,exports){ //Optimized version for triangle closest point // Based on Eberly's WildMagick codes // http://www.geometrictools.com/LibMathematics/Distance/Distance.html @@ -28956,7 +30063,7 @@ function closestPoint2d(V0, V1, V2, point, result) { module.exports = closestPoint2d; -},{}],160:[function(require,module,exports){ +},{}],165:[function(require,module,exports){ 'use strict' module.exports = extractContour @@ -29119,7 +30226,7 @@ function extractContour(cells, values, level, d) { vertexWeights: uweights } } -},{"./lib/codegen":161,"ndarray":433,"ndarray-sort":164,"typedarray-pool":458}],161:[function(require,module,exports){ +},{"./lib/codegen":166,"ndarray":456,"ndarray-sort":169,"typedarray-pool":481}],166:[function(require,module,exports){ 'use strict' module.exports = getPolygonizer @@ -29216,7 +30323,7 @@ function getPolygonizer(d) { } return alg } -},{"marching-simplex-table":162,"typedarray-pool":458}],162:[function(require,module,exports){ +},{"marching-simplex-table":167,"typedarray-pool":481}],167:[function(require,module,exports){ 'use strict' module.exports = createTable @@ -29282,7 +30389,7 @@ function createTable(dimension) { } return result } -},{"convex-hull":108}],163:[function(require,module,exports){ +},{"convex-hull":113}],168:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -30011,7 +31118,7 @@ function compileSort(order, dtype) { } module.exports = compileSort -},{"typedarray-pool":458}],164:[function(require,module,exports){ +},{"typedarray-pool":481}],169:[function(require,module,exports){ "use strict" var compile = require("./lib/compile_sort.js") @@ -30031,7 +31138,7 @@ function sort(array) { } module.exports = sort -},{"./lib/compile_sort.js":163}],165:[function(require,module,exports){ +},{"./lib/compile_sort.js":168}],170:[function(require,module,exports){ 'use strict' module.exports = createBoxes @@ -30094,7 +31201,7 @@ function createBoxes(plot) { return new Boxes(plot, vbo, shader) } -},{"./shaders":168,"gl-buffer":124,"gl-shader":203}],166:[function(require,module,exports){ +},{"./shaders":173,"gl-buffer":129,"gl-shader":208}],171:[function(require,module,exports){ 'use strict' module.exports = createGrid @@ -30341,7 +31448,7 @@ function createGrid(plot) { return grid } -},{"./shaders":168,"binary-search-bounds":170,"gl-buffer":124,"gl-shader":203}],167:[function(require,module,exports){ +},{"./shaders":173,"binary-search-bounds":175,"gl-buffer":129,"gl-shader":208}],172:[function(require,module,exports){ 'use strict' module.exports = createLines @@ -30406,7 +31513,7 @@ function createLines(plot) { return lines } -},{"./shaders":168,"gl-buffer":124,"gl-shader":203}],168:[function(require,module,exports){ +},{"./shaders":173,"gl-buffer":129,"gl-shader":208}],173:[function(require,module,exports){ 'use strict' @@ -30424,7 +31531,7 @@ module.exports = { tickVert: "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n" } -},{}],169:[function(require,module,exports){ +},{}],174:[function(require,module,exports){ 'use strict' module.exports = createTextElements @@ -30699,9 +31806,9 @@ function createTextElements(plot) { return text } -},{"./shaders":168,"binary-search-bounds":170,"gl-buffer":124,"gl-shader":203,"text-cache":453}],170:[function(require,module,exports){ -arguments[4][68][0].apply(exports,arguments) -},{"dup":68}],171:[function(require,module,exports){ +},{"./shaders":173,"binary-search-bounds":175,"gl-buffer":129,"gl-shader":208,"text-cache":476}],175:[function(require,module,exports){ +arguments[4][73][0].apply(exports,arguments) +},{"dup":73}],176:[function(require,module,exports){ 'use strict' module.exports = createGLPlot2D @@ -31274,7 +32381,7 @@ function createGLPlot2D(options) { return plot } -},{"./lib/box":165,"./lib/grid":166,"./lib/line":167,"./lib/text":169,"gl-select-static":202}],172:[function(require,module,exports){ +},{"./lib/box":170,"./lib/grid":171,"./lib/line":172,"./lib/text":174,"gl-select-static":207}],177:[function(require,module,exports){ var createShader = require('gl-shader') @@ -31285,7 +32392,7 @@ module.exports = function(gl) { return createShader(gl, vertSrc, fragSrc, null, [ { name: 'position', type: 'vec2'}]) } -},{"gl-shader":203}],173:[function(require,module,exports){ +},{"gl-shader":208}],178:[function(require,module,exports){ 'use strict' module.exports = createCamera @@ -31494,7 +32601,7 @@ function createCamera(element, options) { return camera } -},{"3d-view":40,"mouse-change":421,"mouse-wheel":425,"right-now":435}],174:[function(require,module,exports){ +},{"3d-view":40,"mouse-change":444,"mouse-wheel":448,"right-now":458}],179:[function(require,module,exports){ // Copyright (C) 2011 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -32181,7 +33288,7 @@ function createCamera(element, options) { } })(); -},{}],175:[function(require,module,exports){ +},{}],180:[function(require,module,exports){ 'use strict' var weakMap = typeof WeakMap === 'undefined' ? require('weak-map') : WeakMap @@ -32211,7 +33318,7 @@ function createABigTriangle(gl) { module.exports = createABigTriangle -},{"gl-buffer":124,"gl-vao":232,"weak-map":174}],176:[function(require,module,exports){ +},{"gl-buffer":129,"gl-vao":237,"weak-map":179}],181:[function(require,module,exports){ 'use strict' module.exports = createAxes @@ -32734,7 +33841,7 @@ function createAxes(gl, options) { return axes } -},{"./lib/background.js":177,"./lib/cube.js":178,"./lib/lines.js":179,"./lib/text.js":181,"./lib/ticks.js":182}],177:[function(require,module,exports){ +},{"./lib/background.js":182,"./lib/cube.js":183,"./lib/lines.js":184,"./lib/text.js":186,"./lib/ticks.js":187}],182:[function(require,module,exports){ 'use strict' module.exports = createBackgroundCube @@ -32846,7 +33953,7 @@ function createBackgroundCube(gl) { return new BackgroundCube(gl, buffer, vao, shader) } -},{"./shaders":180,"gl-buffer":124,"gl-vao":232}],178:[function(require,module,exports){ +},{"./shaders":185,"gl-buffer":129,"gl-vao":237}],183:[function(require,module,exports){ "use strict" module.exports = getCubeEdges @@ -33087,7 +34194,7 @@ function getCubeEdges(model, view, projection, bounds) { //Return result return CUBE_RESULT } -},{"bit-twiddle":51,"gl-mat4/invert":143,"gl-mat4/multiply":145,"robust-orientation":439,"split-polygon":184}],179:[function(require,module,exports){ +},{"bit-twiddle":51,"gl-mat4/invert":148,"gl-mat4/multiply":150,"robust-orientation":462,"split-polygon":189}],184:[function(require,module,exports){ 'use strict' module.exports = createLines @@ -33293,7 +34400,7 @@ function createLines(gl, bounds, ticks) { return new Lines(gl, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset) } -},{"./shaders":180,"gl-buffer":124,"gl-vao":232}],180:[function(require,module,exports){ +},{"./shaders":185,"gl-buffer":129,"gl-vao":237}],185:[function(require,module,exports){ 'use strict' @@ -33324,7 +34431,7 @@ exports.bg = function(gl) { ]) } -},{"gl-shader":203}],181:[function(require,module,exports){ +},{"gl-shader":208}],186:[function(require,module,exports){ (function (process){ "use strict" @@ -33526,7 +34633,7 @@ function createTextSprites( } }).call(this,require('_process')) -},{"./shaders":180,"_process":60,"gl-buffer":124,"gl-vao":232,"vectorize-text":460}],182:[function(require,module,exports){ +},{"./shaders":185,"_process":59,"gl-buffer":129,"gl-vao":237,"vectorize-text":483}],187:[function(require,module,exports){ 'use strict' exports.create = defaultTicks @@ -33599,7 +34706,7 @@ function ticksEqual(ticksA, ticksB) { } return true } -},{}],183:[function(require,module,exports){ +},{}],188:[function(require,module,exports){ "use strict" module.exports = extractPlanes @@ -33616,7 +34723,7 @@ function extractPlanes(M, zNear, zFar) { [ zf*M[12] - M[8], zf*M[13] - M[9], zf*M[14] - M[10], zf*M[15] - M[11] ] ] } -},{}],184:[function(require,module,exports){ +},{}],189:[function(require,module,exports){ "use strict" var robustDot = require("robust-dot-product") @@ -33708,7 +34815,7 @@ function negative(points, plane) { } return neg } -},{"robust-dot-product":185,"robust-sum":442}],185:[function(require,module,exports){ +},{"robust-dot-product":190,"robust-sum":465}],190:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -33723,7 +34830,7 @@ function robustDotProduct(a, b) { } return r } -},{"robust-sum":442,"two-product":456}],186:[function(require,module,exports){ +},{"robust-sum":465,"two-product":479}],191:[function(require,module,exports){ "use strict" module.exports = axesProperties @@ -33865,7 +34972,7 @@ i_loop: return ranges } -},{"./lib/cube.js":178,"extract-frustum-planes":183,"gl-mat4/multiply":145,"gl-mat4/transpose":153,"gl-vec4/transformMat4":233,"split-polygon":184}],187:[function(require,module,exports){ +},{"./lib/cube.js":183,"extract-frustum-planes":188,"gl-mat4/multiply":150,"gl-mat4/transpose":158,"gl-vec4/transformMat4":238,"split-polygon":189}],192:[function(require,module,exports){ 'use strict' @@ -33882,7 +34989,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":203}],188:[function(require,module,exports){ +},{"gl-shader":208}],193:[function(require,module,exports){ 'use strict' var createBuffer = require('gl-buffer') @@ -34078,7 +35185,7 @@ function createSpikes(gl, options) { return spikes } -},{"./shaders/index":187,"gl-buffer":124,"gl-vao":232}],189:[function(require,module,exports){ +},{"./shaders/index":192,"gl-buffer":129,"gl-vao":237}],194:[function(require,module,exports){ 'use strict' module.exports = createScene @@ -34843,7 +35950,7 @@ function createScene(options) { return scene } -},{"./lib/shader":172,"3d-view-controls":173,"a-big-triangle":175,"gl-axes3d":176,"gl-axes3d/properties":186,"gl-fbo":129,"gl-mat4/perspective":146,"gl-select-static":202,"gl-spikes3d":188,"mouse-change":421}],190:[function(require,module,exports){ +},{"./lib/shader":177,"3d-view-controls":178,"a-big-triangle":180,"gl-axes3d":181,"gl-axes3d/properties":191,"gl-fbo":134,"gl-mat4/perspective":151,"gl-select-static":207,"gl-spikes3d":193,"mouse-change":444}],195:[function(require,module,exports){ 'use strict' @@ -34855,7 +35962,7 @@ module.exports = { pickFragment: "precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n" } -},{}],191:[function(require,module,exports){ +},{}],196:[function(require,module,exports){ 'use strict' module.exports = createFancyScatter2D @@ -35242,7 +36349,7 @@ function createFancyScatter2D(plot, options) { return scatter } -},{"./lib/shaders":190,"gl-buffer":124,"gl-shader":203,"text-cache":453,"typedarray-pool":458,"vectorize-text":460}],192:[function(require,module,exports){ +},{"./lib/shaders":195,"gl-buffer":129,"gl-shader":208,"text-cache":476,"typedarray-pool":481,"vectorize-text":483}],197:[function(require,module,exports){ exports.pointVertex = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute float weight;\n\nuniform mat3 matrix;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n fragWeight = mix(1.0, weight, useWeight);\n}\n" @@ -35250,9 +36357,9 @@ exports.pointFragment = "precision mediump float;\n#define GLSLIFY 1\n\nunif exports.pickVertex = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n" exports.pickFragment = "precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0*gl_PointCoord.xy-1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n" -},{}],193:[function(require,module,exports){ -arguments[4][68][0].apply(exports,arguments) -},{"dup":68}],194:[function(require,module,exports){ +},{}],198:[function(require,module,exports){ +arguments[4][73][0].apply(exports,arguments) +},{"dup":73}],199:[function(require,module,exports){ 'use strict' module.exports = sortLevels @@ -35550,7 +36657,7 @@ function quickSort(left, right, data_levels, data_points, data_ids, data_weights } } -},{}],195:[function(require,module,exports){ +},{}],200:[function(require,module,exports){ 'use strict' var pool = require('typedarray-pool') @@ -35690,7 +36797,7 @@ function snapPoints(points, ids, weights, bounds) { return lod } -},{"./lib/sort":194,"typedarray-pool":458}],196:[function(require,module,exports){ +},{"./lib/sort":199,"typedarray-pool":481}],201:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -35986,7 +37093,7 @@ function createScatter2D(plot, options) { return result } -},{"./lib/shader":192,"binary-search-bounds":193,"gl-buffer":124,"gl-shader":203,"snap-points-2d":195,"typedarray-pool":458}],197:[function(require,module,exports){ +},{"./lib/shader":197,"binary-search-bounds":198,"gl-buffer":129,"gl-shader":208,"snap-points-2d":200,"typedarray-pool":481}],202:[function(require,module,exports){ "use strict" var vectorizeText = require("vectorize-text") @@ -36032,7 +37139,7 @@ function getGlyph(symbol, font) { //Save cached symbol return fontCache[symbol] = [triSymbol, lineSymbol, bounds] } -},{"vectorize-text":460}],198:[function(require,module,exports){ +},{"vectorize-text":483}],203:[function(require,module,exports){ var createShaderWrapper = require('gl-shader') @@ -36109,7 +37216,7 @@ exports.createPickProject = function(gl) { return createShader(gl, pickProject) } -},{"gl-shader":203}],199:[function(require,module,exports){ +},{"gl-shader":208}],204:[function(require,module,exports){ 'use strict' var createBuffer = require('gl-buffer') @@ -36869,7 +37976,7 @@ function createPointCloud(options) { return pointCloud } -},{"./lib/glyphs":197,"./lib/shaders":198,"gl-buffer":124,"gl-mat4/multiply":145,"gl-vao":232,"typedarray-pool":458}],200:[function(require,module,exports){ +},{"./lib/glyphs":202,"./lib/shaders":203,"gl-buffer":129,"gl-mat4/multiply":150,"gl-vao":237,"typedarray-pool":481}],205:[function(require,module,exports){ 'use strict' @@ -36877,7 +37984,7 @@ function createPointCloud(options) { exports.boxVertex = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n" exports.boxFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n" -},{}],201:[function(require,module,exports){ +},{}],206:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -37003,7 +38110,7 @@ function createSelectBox(plot, options) { return selectBox } -},{"./lib/shaders":200,"gl-buffer":124,"gl-shader":203}],202:[function(require,module,exports){ +},{"./lib/shaders":205,"gl-buffer":129,"gl-shader":208}],207:[function(require,module,exports){ 'use strict' module.exports = createSelectBuffer @@ -37158,7 +38265,7 @@ function createSelectBuffer(gl, shape) { return new SelectBuffer(gl, fbo, buffer) } -},{"bit-twiddle":51,"cwise/lib/wrapper":118,"gl-fbo":129,"ndarray":433,"typedarray-pool":458}],203:[function(require,module,exports){ +},{"bit-twiddle":51,"cwise/lib/wrapper":123,"gl-fbo":134,"ndarray":456,"typedarray-pool":481}],208:[function(require,module,exports){ 'use strict' var createUniformWrapper = require('./lib/create-uniforms') @@ -37394,7 +38501,7 @@ function createShader( module.exports = createShader -},{"./lib/GLError":204,"./lib/create-attributes":205,"./lib/create-uniforms":206,"./lib/reflect":207,"./lib/runtime-reflect":208,"./lib/shader-cache":209}],204:[function(require,module,exports){ +},{"./lib/GLError":209,"./lib/create-attributes":210,"./lib/create-uniforms":211,"./lib/reflect":212,"./lib/runtime-reflect":213,"./lib/shader-cache":214}],209:[function(require,module,exports){ function GLError (rawError, shortMessage, longMessage) { this.shortMessage = shortMessage || '' this.longMessage = longMessage || '' @@ -37409,7 +38516,7 @@ GLError.prototype.name = 'GLError' GLError.prototype.constructor = GLError module.exports = GLError -},{}],205:[function(require,module,exports){ +},{}],210:[function(require,module,exports){ 'use strict' module.exports = createAttributeWrapper @@ -37674,7 +38781,7 @@ function createAttributeWrapper( return obj } -},{"./GLError":204}],206:[function(require,module,exports){ +},{"./GLError":209}],211:[function(require,module,exports){ 'use strict' var coallesceUniforms = require('./reflect') @@ -37867,7 +38974,7 @@ function createUniformWrapper(gl, wrapper, uniforms, locations) { } } -},{"./GLError":204,"./reflect":207}],207:[function(require,module,exports){ +},{"./GLError":209,"./reflect":212}],212:[function(require,module,exports){ 'use strict' module.exports = makeReflectTypes @@ -37925,7 +39032,7 @@ function makeReflectTypes(uniforms, useIndex) { } return obj } -},{}],208:[function(require,module,exports){ +},{}],213:[function(require,module,exports){ 'use strict' exports.uniforms = runtimeUniforms @@ -38005,7 +39112,7 @@ function runtimeAttributes(gl, program) { return result } -},{}],209:[function(require,module,exports){ +},{}],214:[function(require,module,exports){ 'use strict' exports.shader = getShaderReference @@ -38143,7 +39250,7 @@ function createProgram(gl, vref, fref, attribs, locations) { return getCache(gl).getProgram(vref, fref, attribs, locations) } -},{"./GLError":204,"gl-format-compiler-error":210,"weakmap-shim":220}],210:[function(require,module,exports){ +},{"./GLError":209,"gl-format-compiler-error":215,"weakmap-shim":225}],215:[function(require,module,exports){ var sprintf = require('sprintf-js').sprintf; var glConstants = require('gl-constants/lookup'); @@ -38198,7 +39305,7 @@ function formatCompilerError(errLog, src, type) { } -},{"add-line-numbers":211,"gl-constants/lookup":214,"glsl-shader-name":215,"sprintf-js":217}],211:[function(require,module,exports){ +},{"add-line-numbers":216,"gl-constants/lookup":219,"glsl-shader-name":220,"sprintf-js":222}],216:[function(require,module,exports){ var padLeft = require('pad-left') module.exports = addLineNumbers @@ -38216,7 +39323,7 @@ function addLineNumbers (string, start, delim) { }).join('\n') } -},{"pad-left":212}],212:[function(require,module,exports){ +},{"pad-left":217}],217:[function(require,module,exports){ /*! * pad-left * @@ -38232,7 +39339,7 @@ module.exports = function padLeft(str, num, ch) { ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":434}],213:[function(require,module,exports){ +},{"repeat-string":457}],218:[function(require,module,exports){ module.exports = { 0: 'NONE', 1: 'ONE', @@ -38532,14 +39639,14 @@ module.exports = { 37444: 'BROWSER_DEFAULT_WEBGL' } -},{}],214:[function(require,module,exports){ +},{}],219:[function(require,module,exports){ var gl10 = require('./1.0/numbers') module.exports = function lookupConstant (number) { return gl10[number] } -},{"./1.0/numbers":213}],215:[function(require,module,exports){ +},{"./1.0/numbers":218}],220:[function(require,module,exports){ var tokenize = require('glsl-tokenizer') var atob = require('atob-lite') @@ -38564,12 +39671,12 @@ function getName(src) { } } -},{"atob-lite":216,"glsl-tokenizer":240}],216:[function(require,module,exports){ +},{"atob-lite":221,"glsl-tokenizer":245}],221:[function(require,module,exports){ module.exports = function _atob(str) { return atob(str) } -},{}],217:[function(require,module,exports){ +},{}],222:[function(require,module,exports){ (function(window) { var re = { not_string: /[^s]/, @@ -38779,7 +39886,7 @@ module.exports = function _atob(str) { } })(typeof window === "undefined" ? this : window); -},{}],218:[function(require,module,exports){ +},{}],223:[function(require,module,exports){ var hiddenStore = require('./hidden-store.js'); module.exports = createStore; @@ -38800,7 +39907,7 @@ function createStore() { }; } -},{"./hidden-store.js":219}],219:[function(require,module,exports){ +},{"./hidden-store.js":224}],224:[function(require,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -38818,7 +39925,7 @@ function hiddenStore(obj, key) { return store; } -},{}],220:[function(require,module,exports){ +},{}],225:[function(require,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -38848,7 +39955,7 @@ function weakMap() { } } -},{"./create-store.js":218}],221:[function(require,module,exports){ +},{"./create-store.js":223}],226:[function(require,module,exports){ 'use strict' module.exports = createSpikes2D @@ -38936,7 +40043,7 @@ function createSpikes2D(plot, options) { return spikes } -},{}],222:[function(require,module,exports){ +},{}],227:[function(require,module,exports){ var createShader = require('gl-shader') @@ -38986,9 +40093,9 @@ exports.createPickContourShader = function (gl) { return shader } -},{"gl-shader":203}],223:[function(require,module,exports){ +},{"gl-shader":208}],228:[function(require,module,exports){ arguments[4][22][0].apply(exports,arguments) -},{"dup":22}],224:[function(require,module,exports){ +},{"dup":22}],229:[function(require,module,exports){ 'use strict' module.exports = gradient @@ -39286,7 +40393,7 @@ function gradient(out, inp, bc) { var cached = generateGradient(bc) return cached(out, inp) } -},{"cwise-compiler":115,"dup":121}],225:[function(require,module,exports){ +},{"cwise-compiler":120,"dup":126}],230:[function(require,module,exports){ "use strict" var ndarray = require("ndarray") @@ -39309,10 +40416,10 @@ module.exports = function convert(arr, result) { return result } -},{"./doConvert.js":226,"ndarray":433}],226:[function(require,module,exports){ +},{"./doConvert.js":231,"ndarray":456}],231:[function(require,module,exports){ module.exports=require('cwise-compiler')({"args":["array","scalar","index"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}","args":[{"name":"_inline_1_arg0_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) -},{"cwise-compiler":115}],227:[function(require,module,exports){ +},{"cwise-compiler":120}],232:[function(require,module,exports){ 'use strict' module.exports = createSurfacePlot @@ -40629,7 +41736,7 @@ function createSurfacePlot (params) { return surface } -},{"./lib/shaders":222,"binary-search-bounds":223,"bit-twiddle":51,"colormap":106,"gl-buffer":124,"gl-mat4/invert":143,"gl-mat4/multiply":145,"gl-texture2d":228,"gl-vao":232,"ndarray":433,"ndarray-gradient":224,"ndarray-ops":432,"ndarray-pack":225,"surface-nets":452,"typedarray-pool":458}],228:[function(require,module,exports){ +},{"./lib/shaders":227,"binary-search-bounds":228,"bit-twiddle":51,"colormap":111,"gl-buffer":129,"gl-mat4/invert":148,"gl-mat4/multiply":150,"gl-texture2d":233,"gl-vao":237,"ndarray":456,"ndarray-gradient":229,"ndarray-ops":455,"ndarray-pack":230,"surface-nets":475,"typedarray-pool":481}],233:[function(require,module,exports){ 'use strict' var ndarray = require('ndarray') @@ -41188,7 +42295,7 @@ function createTexture2D(gl) { throw new Error('gl-texture2d: Invalid arguments for texture2d constructor') } -},{"ndarray":433,"ndarray-ops":432,"typedarray-pool":458}],229:[function(require,module,exports){ +},{"ndarray":456,"ndarray-ops":455,"typedarray-pool":481}],234:[function(require,module,exports){ "use strict" function doBind(gl, elements, attributes) { @@ -41243,7 +42350,7 @@ function doBind(gl, elements, attributes) { } module.exports = doBind -},{}],230:[function(require,module,exports){ +},{}],235:[function(require,module,exports){ "use strict" var bindAttribs = require("./do-bind.js") @@ -41283,7 +42390,7 @@ function createVAOEmulated(gl) { } module.exports = createVAOEmulated -},{"./do-bind.js":229}],231:[function(require,module,exports){ +},{"./do-bind.js":234}],236:[function(require,module,exports){ "use strict" var bindAttribs = require("./do-bind.js") @@ -41371,7 +42478,7 @@ function createVAONative(gl, ext) { } module.exports = createVAONative -},{"./do-bind.js":229}],232:[function(require,module,exports){ +},{"./do-bind.js":234}],237:[function(require,module,exports){ "use strict" var createVAONative = require("./lib/vao-native.js") @@ -41391,7 +42498,7 @@ function createVAO(gl, attributes, elements, elementsType) { module.exports = createVAO -},{"./lib/vao-emulated.js":230,"./lib/vao-native.js":231}],233:[function(require,module,exports){ +},{"./lib/vao-emulated.js":235,"./lib/vao-native.js":236}],238:[function(require,module,exports){ module.exports = transformMat4 /** @@ -41411,7 +42518,7 @@ function transformMat4 (out, a, m) { return out } -},{}],234:[function(require,module,exports){ +},{}],239:[function(require,module,exports){ module.exports = tokenize var literals100 = require('./lib/literals') @@ -41775,7 +42882,7 @@ function tokenize(opt) { } } -},{"./lib/builtins":236,"./lib/builtins-300es":235,"./lib/literals":238,"./lib/literals-300es":237,"./lib/operators":239}],235:[function(require,module,exports){ +},{"./lib/builtins":241,"./lib/builtins-300es":240,"./lib/literals":243,"./lib/literals-300es":242,"./lib/operators":244}],240:[function(require,module,exports){ // 300es builtins/reserved words that were previously valid in v100 var v100 = require('./builtins') @@ -41846,7 +42953,7 @@ module.exports = v100.concat([ , 'textureProjGradOffset' ]) -},{"./builtins":236}],236:[function(require,module,exports){ +},{"./builtins":241}],241:[function(require,module,exports){ module.exports = [ // Keep this list sorted 'abs' @@ -41998,7 +43105,7 @@ module.exports = [ , 'textureCubeGradEXT' ] -},{}],237:[function(require,module,exports){ +},{}],242:[function(require,module,exports){ var v100 = require('./literals') module.exports = v100.slice().concat([ @@ -42088,7 +43195,7 @@ module.exports = v100.slice().concat([ , 'usampler2DMSArray' ]) -},{"./literals":238}],238:[function(require,module,exports){ +},{"./literals":243}],243:[function(require,module,exports){ module.exports = [ // current 'precision' @@ -42183,7 +43290,7 @@ module.exports = [ , 'using' ] -},{}],239:[function(require,module,exports){ +},{}],244:[function(require,module,exports){ module.exports = [ '<<=' , '>>=' @@ -42232,7 +43339,7 @@ module.exports = [ , '}' ] -},{}],240:[function(require,module,exports){ +},{}],245:[function(require,module,exports){ var tokenize = require('./index') module.exports = tokenizeString @@ -42247,7 +43354,7 @@ function tokenizeString(str, opt) { return tokens } -},{"./index":234}],241:[function(require,module,exports){ +},{"./index":239}],246:[function(require,module,exports){ "use strict" //High level idea: @@ -42694,11 +43801,11 @@ function incrementalConvexHull(points, randomSearch) { //Extract boundary cells return triangles.boundary() } -},{"robust-orientation":439,"simplicial-complex":244}],242:[function(require,module,exports){ +},{"robust-orientation":462,"simplicial-complex":249}],247:[function(require,module,exports){ arguments[4][51][0].apply(exports,arguments) -},{"dup":51}],243:[function(require,module,exports){ -arguments[4][103][0].apply(exports,arguments) -},{"dup":103}],244:[function(require,module,exports){ +},{"dup":51}],248:[function(require,module,exports){ +arguments[4][108][0].apply(exports,arguments) +},{"dup":108}],249:[function(require,module,exports){ "use strict"; "use restrict"; var bits = require("bit-twiddle") @@ -43042,7 +44149,7 @@ function connectedComponents(cells, vertex_count) { } exports.connectedComponents = connectedComponents -},{"bit-twiddle":242,"union-find":243}],245:[function(require,module,exports){ +},{"bit-twiddle":247,"union-find":248}],250:[function(require,module,exports){ "use strict" function iota(n) { @@ -43054,7 +44161,7 @@ function iota(n) { } module.exports = iota -},{}],246:[function(require,module,exports){ +},{}],251:[function(require,module,exports){ /** * Determine if an object is Buffer * @@ -43073,24 +44180,73 @@ module.exports = function (obj) { )) } -},{}],247:[function(require,module,exports){ +},{}],252:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +module.exports = ArrayGroup; +function ArrayGroup(arrayTypes) { + var LayoutVertexArrayType = arrayTypes.layoutVertexArrayType; + this.layoutVertexArray = new LayoutVertexArrayType(); + var ElementArrayType = arrayTypes.elementArrayType; + if (ElementArrayType) + this.elementArray = new ElementArrayType(); + var ElementArrayType2 = arrayTypes.elementArrayType2; + if (ElementArrayType2) + this.elementArray2 = new ElementArrayType2(); + this.paintVertexArrays = util.mapObject(arrayTypes.paintVertexArrayTypes, function (PaintVertexArrayType) { + return new PaintVertexArrayType(); + }); +} +ArrayGroup.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1; +ArrayGroup.prototype.hasCapacityFor = function (numVertices) { + return this.layoutVertexArray.length + numVertices <= ArrayGroup.MAX_VERTEX_ARRAY_LENGTH; +}; +ArrayGroup.prototype.isEmpty = function () { + return this.layoutVertexArray.length === 0; +}; +ArrayGroup.prototype.trim = function () { + this.layoutVertexArray.trim(); + if (this.elementArray) { + this.elementArray.trim(); + } + if (this.elementArray2) { + this.elementArray2.trim(); + } + for (var layerName in this.paintVertexArrays) { + this.paintVertexArrays[layerName].trim(); + } +}; +ArrayGroup.prototype.serialize = function () { + return { + layoutVertexArray: this.layoutVertexArray.serialize(), + elementArray: this.elementArray && this.elementArray.serialize(), + elementArray2: this.elementArray2 && this.elementArray2.serialize(), + paintVertexArrays: util.mapObject(this.paintVertexArrays, function (array) { + return array.serialize(); + }) + }; +}; +ArrayGroup.prototype.getTransferables = function (transferables) { + transferables.push(this.layoutVertexArray.arrayBuffer); + if (this.elementArray) { + transferables.push(this.elementArray.arrayBuffer); + } + if (this.elementArray2) { + transferables.push(this.elementArray2.arrayBuffer); + } + for (var layerName in this.paintVertexArrays) { + transferables.push(this.paintVertexArrays[layerName].arrayBuffer); + } +}; +},{"../util/util":366}],253:[function(require,module,exports){ 'use strict'; - var featureFilter = require('feature-filter'); -var Buffer = require('./buffer'); +var ArrayGroup = require('./array_group'); +var BufferGroup = require('./buffer_group'); var util = require('../util/util'); var StructArrayType = require('../util/struct_array'); -var VertexArrayObject = require('../render/vertex_array_object'); - module.exports = Bucket; - -/** - * Instantiate the appropriate subclass of `Bucket` for `options`. - * @private - * @param options See `Bucket` constructor options - * @returns {Bucket} - */ -Bucket.create = function(options) { +Bucket.create = function (options) { var Classes = { fill: require('./bucket/fill_bucket'), line: require('./bucket/line_bucket'), @@ -43099,47 +44255,12 @@ Bucket.create = function(options) { }; return new Classes[options.layer.type](options); }; - - -/** - * The maximum extent of a feature that can be safely stored in the buffer. - * In practice, all features are converted to this extent before being added. - * - * Positions are stored as signed 16bit integers. - * One bit is lost for signedness to support featuers extending past the left edge of the tile. - * One bit is lost because the line vertex buffer packs 1 bit of other data into the int. - * One bit is lost to support features extending past the extent on the right edge of the tile. - * This leaves us with 2^13 = 8192 - * - * @private - * @readonly - */ Bucket.EXTENT = 8192; - -/** - * The `Bucket` class is the single point of knowledge about turning vector - * tiles into WebGL buffers. - * - * `Bucket` is an abstract class. A subclass exists for each Mapbox GL - * style spec layer type. Because `Bucket` is an abstract class, - * instances should be created via the `Bucket.create` method. - * - * @class Bucket - * @private - * @param options - * @param {number} options.zoom Zoom level of the buffers being built. May be - * a fractional zoom level. - * @param options.layer A Mapbox GL style layer object - * @param {Object.} options.buffers The set of `Buffer`s being - * built for this tile. This object facilitates sharing of `Buffer`s be - between `Bucket`s. - */ function Bucket(options) { this.zoom = options.zoom; this.overscaling = options.overscaling; this.layer = options.layer; this.childLayers = options.childLayers; - this.type = this.layer.type; this.features = []; this.id = this.layer.id; @@ -43148,172 +44269,94 @@ function Bucket(options) { this.sourceLayerIndex = options.sourceLayerIndex; this.minZoom = this.layer.minzoom; this.maxZoom = this.layer.maxzoom; - this.paintAttributes = createPaintAttributes(this); - if (options.arrays) { - var childLayers = this.childLayers; - this.bufferGroups = util.mapObject(options.arrays, function(programArrayGroups, programName) { - return programArrayGroups.map(function(programArrayGroup) { - - var group = util.mapObject(programArrayGroup, function(arrays, layoutOrPaint) { - return util.mapObject(arrays, function(array, name) { - var arrayType = options.arrayTypes[programName][layoutOrPaint][name]; - var type = (arrayType.members.length && arrayType.members[0].name === 'vertices' ? Buffer.BufferType.ELEMENT : Buffer.BufferType.VERTEX); - return new Buffer(array, arrayType, type); - }); + var programInterfaces = this.programInterfaces; + this.bufferGroups = util.mapObject(options.arrays, function (programArrayGroups, programName) { + var programInterface = programInterfaces[programName]; + var paintVertexArrayTypes = options.paintVertexArrayTypes[programName]; + return programArrayGroups.map(function (arrayGroup) { + return new BufferGroup(arrayGroup, { + layoutVertexArrayType: programInterface.layoutVertexArrayType.serialize(), + elementArrayType: programInterface.elementArrayType && programInterface.elementArrayType.serialize(), + elementArrayType2: programInterface.elementArrayType2 && programInterface.elementArrayType2.serialize(), + paintVertexArrayTypes: paintVertexArrayTypes }); - - group.vaos = {}; - if (group.layout.element2) group.secondVaos = {}; - for (var l = 0; l < childLayers.length; l++) { - var layerName = childLayers[l].id; - group.vaos[layerName] = new VertexArrayObject(); - if (group.layout.element2) group.secondVaos[layerName] = new VertexArrayObject(); - } - - return group; }); }); } } - -/** - * Build the buffers! Features are set directly to the `features` property. - * @private - */ -Bucket.prototype.populateBuffers = function() { +Bucket.prototype.populateArrays = function () { this.createArrays(); this.recalculateStyleLayers(); - for (var i = 0; i < this.features.length; i++) { this.addFeature(this.features[i]); } - this.trimArrays(); }; - -/** - * Check if there is enough space available in the current element group for - * `vertexLength` vertices. If not, append a new elementGroup. Should be called - * by `populateBuffers` and its callees. - * @private - * @param {string} programName the name of the program associated with the buffer that will receive the vertices - * @param {number} vertexLength The number of vertices that will be inserted to the buffer. - */ -Bucket.prototype.makeRoomFor = function(programName, numVertices) { +Bucket.prototype.prepareArrayGroup = function (programName, numVertices) { var groups = this.arrayGroups[programName]; var currentGroup = groups.length && groups[groups.length - 1]; - - if (!currentGroup || currentGroup.layout.vertex.length + numVertices > 65535) { - - var arrayTypes = this.arrayTypes[programName]; - var VertexArrayType = arrayTypes.layout.vertex; - var ElementArrayType = arrayTypes.layout.element; - var ElementArrayType2 = arrayTypes.layout.element2; - - currentGroup = { - index: groups.length, - layout: {}, - paint: {} - }; - - currentGroup.layout.vertex = new VertexArrayType(); - if (ElementArrayType) currentGroup.layout.element = new ElementArrayType(); - if (ElementArrayType2) currentGroup.layout.element2 = new ElementArrayType2(); - - for (var i = 0; i < this.childLayers.length; i++) { - var layerName = this.childLayers[i].id; - var PaintVertexArrayType = arrayTypes.paint[layerName]; - currentGroup.paint[layerName] = new PaintVertexArrayType(); - } - + if (!currentGroup || !currentGroup.hasCapacityFor(numVertices)) { + currentGroup = new ArrayGroup({ + layoutVertexArrayType: this.programInterfaces[programName].layoutVertexArrayType, + elementArrayType: this.programInterfaces[programName].elementArrayType, + elementArrayType2: this.programInterfaces[programName].elementArrayType2, + paintVertexArrayTypes: this.paintVertexArrayTypes[programName] + }); + currentGroup.index = groups.length; groups.push(currentGroup); } - return currentGroup; }; - -/** - * Start using a new shared `buffers` object and recreate instances of `Buffer` - * as necessary. - * @private - */ -Bucket.prototype.createArrays = function() { +Bucket.prototype.createArrays = function () { this.arrayGroups = {}; - this.arrayTypes = {}; - + this.paintVertexArrayTypes = {}; for (var programName in this.programInterfaces) { - var programInterface = this.programInterfaces[programName]; - var programArrayTypes = this.arrayTypes[programName] = { layout: {}, paint: {} }; this.arrayGroups[programName] = []; - - if (programInterface.vertexBuffer) { - var VertexArrayType = new StructArrayType({ - members: this.programInterfaces[programName].layoutAttributes, - alignment: Buffer.VERTEX_ATTRIBUTE_ALIGNMENT - }); - - programArrayTypes.layout.vertex = VertexArrayType; - - var layerPaintAttributes = this.paintAttributes[programName]; - for (var layerName in layerPaintAttributes) { - var PaintVertexArrayType = new StructArrayType({ - members: layerPaintAttributes[layerName].attributes, - alignment: Buffer.VERTEX_ATTRIBUTE_ALIGNMENT - }); - - programArrayTypes.paint[layerName] = PaintVertexArrayType; - } - } - - if (programInterface.elementBuffer) { - var ElementArrayType = createElementBufferType(programInterface.elementBufferComponents); - programArrayTypes.layout.element = ElementArrayType; - } - - if (programInterface.elementBuffer2) { - var ElementArrayType2 = createElementBufferType(programInterface.elementBuffer2Components); - programArrayTypes.layout.element2 = ElementArrayType2; + var paintVertexArrayTypes = this.paintVertexArrayTypes[programName] = {}; + var layerPaintAttributes = this.paintAttributes[programName]; + for (var layerName in layerPaintAttributes) { + paintVertexArrayTypes[layerName] = new Bucket.VertexArrayType(layerPaintAttributes[layerName].attributes); } } }; - -Bucket.prototype.destroy = function(gl) { +Bucket.prototype.destroy = function (gl) { for (var programName in this.bufferGroups) { var programBufferGroups = this.bufferGroups[programName]; for (var i = 0; i < programBufferGroups.length; i++) { - var programBuffers = programBufferGroups[i]; - for (var paintBuffer in programBuffers.paint) { - programBuffers.paint[paintBuffer].destroy(gl); - } - for (var layoutBuffer in programBuffers.layout) { - programBuffers.layout[layoutBuffer].destroy(gl); - } - for (var j in programBuffers.vaos) { - programBuffers.vaos[j].destroy(gl); - } - for (var k in programBuffers.secondVaos) { - programBuffers.secondVaos[k].destroy(gl); - } + programBufferGroups[i].destroy(gl); } } - }; - -Bucket.prototype.trimArrays = function() { +Bucket.prototype.trimArrays = function () { + for (var programName in this.arrayGroups) { + var arrayGroups = this.arrayGroups[programName]; + for (var i = 0; i < arrayGroups.length; i++) { + arrayGroups[i].trim(); + } + } +}; +Bucket.prototype.isEmpty = function () { for (var programName in this.arrayGroups) { - var programArrays = this.arrayGroups[programName]; - for (var paintArray in programArrays.paint) { - programArrays.paint[paintArray].trim(); + var arrayGroups = this.arrayGroups[programName]; + for (var i = 0; i < arrayGroups.length; i++) { + if (!arrayGroups[i].isEmpty()) { + return false; + } } - for (var layoutArray in programArrays.layout) { - programArrays.layout[layoutArray].trim(); + } + return true; +}; +Bucket.prototype.getTransferables = function (transferables) { + for (var programName in this.arrayGroups) { + var arrayGroups = this.arrayGroups[programName]; + for (var i = 0; i < arrayGroups.length; i++) { + arrayGroups[i].getTransferables(transferables); } } }; - -Bucket.prototype.setUniforms = function(gl, programName, program, layer, globalProperties) { +Bucket.prototype.setUniforms = function (gl, programName, program, layer, globalProperties) { var uniforms = this.paintAttributes[programName][layer.id].uniforms; for (var i = 0; i < uniforms.length; i++) { var uniform = uniforms[i]; @@ -43321,79 +44364,60 @@ Bucket.prototype.setUniforms = function(gl, programName, program, layer, globalP gl['uniform' + uniform.components + 'fv'](uniformLocation, uniform.getValue(layer, globalProperties)); } }; - -Bucket.prototype.serialize = function() { +Bucket.prototype.serialize = function () { return { layerId: this.layer.id, zoom: this.zoom, - arrays: util.mapObject(this.arrayGroups, function(programArrayGroups) { - return programArrayGroups.map(function(arrayGroup) { - return util.mapObject(arrayGroup, function(arrays) { - return util.mapObject(arrays, function(array) { - return array.serialize(); - }); - }); + arrays: util.mapObject(this.arrayGroups, function (programArrayGroups) { + return programArrayGroups.map(function (arrayGroup) { + return arrayGroup.serialize(); }); }), - arrayTypes: util.mapObject(this.arrayTypes, function(programArrayTypes) { - return util.mapObject(programArrayTypes, function(arrayTypes) { - return util.mapObject(arrayTypes, function(arrayType) { - return arrayType.serialize(); - }); + paintVertexArrayTypes: util.mapObject(this.paintVertexArrayTypes, function (arrayTypes) { + return util.mapObject(arrayTypes, function (arrayType) { + return arrayType.serialize(); }); }), - - childLayerIds: this.childLayers.map(function(layer) { + childLayerIds: this.childLayers.map(function (layer) { return layer.id; }) }; }; - -Bucket.prototype.createFilter = function() { +Bucket.prototype.createFilter = function () { if (!this.filter) { this.filter = featureFilter(this.layer.filter); } }; - -var FAKE_ZOOM_HISTORY = { lastIntegerZoom: Infinity, lastIntegerZoomTime: 0, lastZoom: 0 }; -Bucket.prototype.recalculateStyleLayers = function() { +var FAKE_ZOOM_HISTORY = { + lastIntegerZoom: Infinity, + lastIntegerZoomTime: 0, + lastZoom: 0 +}; +Bucket.prototype.recalculateStyleLayers = function () { for (var i = 0; i < this.childLayers.length; i++) { this.childLayers[i].recalculate(this.zoom, FAKE_ZOOM_HISTORY); } }; - -Bucket.prototype.getProgramMacros = function(programInterface, layer) { - var macros = []; - var attributes = this.paintAttributes[programInterface][layer.id].attributes; - for (var i = 0; i < attributes.length; i++) { - var attribute = attributes[i]; - macros.push('ATTRIBUTE_' + (attribute.isFunction ? 'ZOOM_FUNCTION_' : '') + attribute.name.toUpperCase()); - } - return macros; -}; - -Bucket.prototype.addPaintAttributes = function(interfaceName, globalProperties, featureProperties, startGroup, startIndex) { +Bucket.prototype.populatePaintArrays = function (interfaceName, globalProperties, featureProperties, startGroup, startIndex) { for (var l = 0; l < this.childLayers.length; l++) { var layer = this.childLayers[l]; var groups = this.arrayGroups[interfaceName]; for (var g = startGroup.index; g < groups.length; g++) { var group = groups[g]; - var length = group.layout.vertex.length; - var vertexArray = group.paint[layer.id]; - vertexArray.resize(length); - + var length = group.layoutVertexArray.length; + var paintArray = group.paintVertexArrays[layer.id]; + paintArray.resize(length); var attributes = this.paintAttributes[interfaceName][layer.id].attributes; for (var m = 0; m < attributes.length; m++) { var attribute = attributes[m]; - var value = attribute.getValue(layer, globalProperties, featureProperties); var multiplier = attribute.multiplier || 1; var components = attribute.components || 1; - - for (var i = startIndex; i < length; i++) { - var vertex = vertexArray.get(i); + var start = g === startGroup.index ? startIndex : 0; + for (var i = start; i < length; i++) { + var vertex = paintArray.get(i); for (var c = 0; c < components; c++) { - var memberName = components > 1 ? (attribute.name + c) : attribute.name; + var memberName = components > 1 ? attribute.name + c : attribute.name; vertex[memberName] = value[c] * multiplier; } } @@ -43401,55 +44425,124 @@ Bucket.prototype.addPaintAttributes = function(interfaceName, globalProperties, } } }; - -function createElementBufferType(components) { +Bucket.VertexArrayType = function (members) { + return new StructArrayType({ + members: members, + alignment: 4 + }); +}; +Bucket.ElementArrayType = function (components) { return new StructArrayType({ members: [{ - type: Buffer.ELEMENT_ATTRIBUTE_TYPE, - name: 'vertices', - components: components || 3 - }] + type: 'Uint16', + name: 'vertices', + components: components || 3 + }] }); -} - +}; function createPaintAttributes(bucket) { var attributes = {}; for (var interfaceName in bucket.programInterfaces) { var layerPaintAttributes = attributes[interfaceName] = {}; - for (var c = 0; c < bucket.childLayers.length; c++) { var childLayer = bucket.childLayers[c]; - layerPaintAttributes[childLayer.id] = { attributes: [], uniforms: [] }; + layerPaintAttributes[childLayer.id] = { + attributes: [], + uniforms: [], + defines: [], + vertexPragmas: { + define: {}, + initialize: {} + }, + fragmentPragmas: { + define: {}, + initialize: {} + } + }; } - var interface_ = bucket.programInterfaces[interfaceName]; - if (!interface_.paintAttributes) continue; + if (!interface_.paintAttributes) + continue; + var attributePrecision = '{precision}'; + var attributeType = '{type}'; for (var i = 0; i < interface_.paintAttributes.length; i++) { var attribute = interface_.paintAttributes[i]; - + attribute.multiplier = attribute.multiplier || 1; for (var j = 0; j < bucket.childLayers.length; j++) { var layer = bucket.childLayers[j]; var paintAttributes = layerPaintAttributes[layer.id]; - + var attributeInputName = attribute.name; + var attributeInnerName = attribute.name.slice(2); + var attributeVaryingDefinition; + paintAttributes.fragmentPragmas.initialize[attributeInnerName] = ''; if (layer.isPaintValueFeatureConstant(attribute.paintProperty)) { paintAttributes.uniforms.push(attribute); + paintAttributes.fragmentPragmas.define[attributeInnerName] = paintAttributes.vertexPragmas.define[attributeInnerName] = [ + 'uniform', + attributePrecision, + attributeType, + attributeInputName + ].join(' ') + ';'; + paintAttributes.fragmentPragmas.initialize[attributeInnerName] = paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributePrecision, + attributeType, + attributeInnerName, + '=', + attributeInputName + ].join(' ') + ';\n'; } else if (layer.isPaintValueZoomConstant(attribute.paintProperty)) { - paintAttributes.attributes.push(attribute); + paintAttributes.attributes.push(util.extend({}, attribute, { name: attributeInputName })); + attributeVaryingDefinition = [ + 'varying', + attributePrecision, + attributeType, + attributeInnerName + ].join(' ') + ';\n'; + var attributeAttributeDefinition = [ + paintAttributes.fragmentPragmas.define[attributeInnerName], + 'attribute', + attributePrecision, + attributeType, + attributeInputName + ].join(' ') + ';\n'; + paintAttributes.fragmentPragmas.define[attributeInnerName] = attributeVaryingDefinition; + paintAttributes.vertexPragmas.define[attributeInnerName] = attributeVaryingDefinition + attributeAttributeDefinition; + paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributeInnerName, + '=', + attributeInputName, + '/', + attribute.multiplier.toFixed(1) + ].join(' ') + ';\n'; } else { - + var tName = 'u_' + attributeInputName.slice(2) + '_t'; var zoomLevels = layer.getPaintValueStopZoomLevels(attribute.paintProperty); - - // Pick the index of the first offset to add to the buffers. - // Find the four closest stops, ideally with two on each side of the zoom level. var numStops = 0; - while (numStops < zoomLevels.length && zoomLevels[numStops] < bucket.zoom) numStops++; + while (numStops < zoomLevels.length && zoomLevels[numStops] < bucket.zoom) + numStops++; var stopOffset = Math.max(0, Math.min(zoomLevels.length - 4, numStops - 2)); - var fourZoomLevels = []; for (var s = 0; s < 4; s++) { fourZoomLevels.push(zoomLevels[Math.min(stopOffset + s, zoomLevels.length - 1)]); } - + attributeVaryingDefinition = [ + 'varying', + attributePrecision, + attributeType, + attributeInnerName + ].join(' ') + ';\n'; + paintAttributes.vertexPragmas.define[attributeInnerName] = attributeVaryingDefinition + [ + 'uniform', + 'lowp', + 'float', + tName + ].join(' ') + ';\n'; + paintAttributes.fragmentPragmas.define[attributeInnerName] = attributeVaryingDefinition; + paintAttributes.uniforms.push(util.extend({}, attribute, { + name: tName, + getValue: createGetUniform(attribute, stopOffset), + components: 1 + })); var components = attribute.components; if (components === 1) { paintAttributes.attributes.push(util.extend({}, attribute, { @@ -43457,35 +44550,54 @@ function createPaintAttributes(bucket) { isFunction: true, components: components * 4 })); + paintAttributes.vertexPragmas.define[attributeInnerName] += [ + 'attribute', + attributePrecision, + 'vec4', + attributeInputName + ].join(' ') + ';\n'; + paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributeInnerName, + '=', + 'evaluate_zoom_function_1(' + attributeInputName + ', ' + tName + ')', + '/', + attribute.multiplier.toFixed(1) + ].join(' ') + ';\n'; } else { + var attributeInputNames = []; for (var k = 0; k < 4; k++) { + attributeInputNames.push(attributeInputName + k); paintAttributes.attributes.push(util.extend({}, attribute, { getValue: createFunctionGetValue(attribute, [fourZoomLevels[k]]), isFunction: true, - name: attribute.name + k + name: attributeInputName + k })); + paintAttributes.vertexPragmas.define[attributeInnerName] += [ + 'attribute', + attributePrecision, + attributeType, + attributeInputName + k + ].join(' ') + ';\n'; } + paintAttributes.vertexPragmas.initialize[attributeInnerName] = [ + attributeInnerName, + ' = ', + 'evaluate_zoom_function_4(' + attributeInputNames.join(', ') + ', ' + tName + ')', + '/', + attribute.multiplier.toFixed(1) + ].join(' ') + ';\n'; } - - paintAttributes.uniforms.push(util.extend({}, attribute, { - name: 'u_' + attribute.name.slice(2) + '_t', - getValue: createGetUniform(attribute, stopOffset), - components: 1 - })); } } } } return attributes; } - function createFunctionGetValue(attribute, stopZoomLevels) { - return function(layer, globalProperties, featureProperties) { + return function (layer, globalProperties, featureProperties) { if (stopZoomLevels.length === 1) { - // return one multi-component value like color0 return attribute.getValue(layer, util.extend({}, globalProperties, { zoom: stopZoomLevels[0] }), featureProperties); } else { - // pack multiple single-component values into a four component attribute var values = []; for (var z = 0; z < stopZoomLevels.length; z++) { var stopZoomLevel = stopZoomLevels[z]; @@ -43495,387 +44607,277 @@ function createFunctionGetValue(attribute, stopZoomLevels) { } }; } - function createGetUniform(attribute, stopOffset) { - return function(layer, globalProperties) { - // stopInterp indicates which stops need to be interpolated. - // If stopInterp is 3.5 then interpolate half way between stops 3 and 4. + return function (layer, globalProperties) { var stopInterp = layer.getPaintInterpolationT(attribute.paintProperty, globalProperties.zoom); - // We can only store four stop values in the buffers. stopOffset is the number of stops that come - // before the stops that were added to the buffers. return [Math.max(0, Math.min(4, stopInterp - stopOffset))]; }; } - -},{"../render/vertex_array_object":273,"../util/struct_array":347,"../util/util":349,"./bucket/circle_bucket":248,"./bucket/fill_bucket":249,"./bucket/line_bucket":250,"./bucket/symbol_bucket":251,"./buffer":252,"feature-filter":352}],248:[function(require,module,exports){ +},{"../util/struct_array":364,"../util/util":366,"./array_group":252,"./bucket/circle_bucket":254,"./bucket/fill_bucket":255,"./bucket/line_bucket":256,"./bucket/symbol_bucket":257,"./buffer_group":259,"feature-filter":370}],254:[function(require,module,exports){ 'use strict'; - var Bucket = require('../bucket'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); var EXTENT = Bucket.EXTENT; - module.exports = CircleBucket; - -/** - * Circles are represented by two triangles. - * - * Each corner has a pos that is the center of the circle and an extrusion - * vector that is where it points. - * @private - */ function CircleBucket() { Bucket.apply(this, arguments); } - CircleBucket.prototype = util.inherit(Bucket, {}); - -CircleBucket.prototype.addCircleVertex = function(vertexArray, x, y, extrudeX, extrudeY) { - return vertexArray.emplaceBack( - (x * 2) + ((extrudeX + 1) / 2), - (y * 2) + ((extrudeY + 1) / 2)); +CircleBucket.prototype.addCircleVertex = function (layoutVertexArray, x, y, extrudeX, extrudeY) { + return layoutVertexArray.emplaceBack(x * 2 + (extrudeX + 1) / 2, y * 2 + (extrudeY + 1) / 2); }; - CircleBucket.prototype.programInterfaces = { circle: { - vertexBuffer: true, - elementBuffer: true, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }], - paintAttributes: [{ - name: 'a_color', - components: 4, - type: 'Uint8', - getValue: function(layer, globalProperties, featureProperties) { - return util.premultiply(layer.getPaintValue("circle-color", globalProperties, featureProperties)); + layoutVertexArrayType: new Bucket.VertexArrayType([{ + name: 'a_pos', + components: 2, + type: 'Int16' + }]), + elementArrayType: new Bucket.ElementArrayType(), + paintAttributes: [ + { + name: 'a_color', + components: 4, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return layer.getPaintValue('circle-color', globalProperties, featureProperties); + }, + multiplier: 255, + paintProperty: 'circle-color' }, - multiplier: 255, - paintProperty: 'circle-color' - }, { - name: 'a_radius', - components: 1, - type: 'Uint16', - isLayerConstant: false, - getValue: function(layer, globalProperties, featureProperties) { - return [layer.getPaintValue("circle-radius", globalProperties, featureProperties)]; + { + name: 'a_radius', + components: 1, + type: 'Uint16', + isLayerConstant: false, + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('circle-radius', globalProperties, featureProperties)]; + }, + multiplier: 10, + paintProperty: 'circle-radius' + }, + { + name: 'a_blur', + components: 1, + type: 'Uint16', + isLayerConstant: false, + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('circle-blur', globalProperties, featureProperties)]; + }, + multiplier: 10, + paintProperty: 'circle-blur' }, - multiplier: 10, - paintProperty: 'circle-radius' - }] + { + name: 'a_opacity', + components: 1, + type: 'Uint16', + isLayerConstant: false, + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('circle-opacity', globalProperties, featureProperties)]; + }, + multiplier: 255, + paintProperty: 'circle-opacity' + } + ] } }; - -CircleBucket.prototype.addFeature = function(feature) { - var globalProperties = {zoom: this.zoom}; +CircleBucket.prototype.addFeature = function (feature) { + var globalProperties = { zoom: this.zoom }; var geometries = loadGeometry(feature); - - var startGroup = this.makeRoomFor('circle', 0); - var startIndex = startGroup.layout.vertex.length; - + var startGroup = this.prepareArrayGroup('circle', 0); + var startIndex = startGroup.layoutVertexArray.length; for (var j = 0; j < geometries.length; j++) { for (var k = 0; k < geometries[j].length; k++) { - var x = geometries[j][k].x; var y = geometries[j][k].y; - - // Do not include points that are outside the tile boundaries. - if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) continue; - - // this geometry will be of the Point type, and we'll derive - // two triangles from it. - // - // ┌─────────┐ - // │ 3 2 │ - // │ │ - // │ 0 1 │ - // └─────────┘ - - var group = this.makeRoomFor('circle', 4); - var vertexArray = group.layout.vertex; - - var index = this.addCircleVertex(vertexArray, x, y, -1, -1); - this.addCircleVertex(vertexArray, x, y, 1, -1); - this.addCircleVertex(vertexArray, x, y, 1, 1); - this.addCircleVertex(vertexArray, x, y, -1, 1); - - group.layout.element.emplaceBack(index, index + 1, index + 2); - group.layout.element.emplaceBack(index, index + 3, index + 2); + if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) + continue; + var group = this.prepareArrayGroup('circle', 4); + var layoutVertexArray = group.layoutVertexArray; + var index = this.addCircleVertex(layoutVertexArray, x, y, -1, -1); + this.addCircleVertex(layoutVertexArray, x, y, 1, -1); + this.addCircleVertex(layoutVertexArray, x, y, 1, 1); + this.addCircleVertex(layoutVertexArray, x, y, -1, 1); + group.elementArray.emplaceBack(index, index + 1, index + 2); + group.elementArray.emplaceBack(index, index + 3, index + 2); } } - - this.addPaintAttributes('circle', globalProperties, feature.properties, startGroup, startIndex); + this.populatePaintArrays('circle', globalProperties, feature.properties, startGroup, startIndex); }; - -},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],249:[function(require,module,exports){ +},{"../../util/util":366,"../bucket":253,"../load_geometry":261}],255:[function(require,module,exports){ 'use strict'; - var Bucket = require('../bucket'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); - +var earcut = require('earcut'); +var classifyRings = require('../../util/classify_rings'); +var EARCUT_MAX_RINGS = 500; module.exports = FillBucket; - function FillBucket() { Bucket.apply(this, arguments); } - FillBucket.prototype = util.inherit(Bucket, {}); - FillBucket.prototype.programInterfaces = { fill: { - vertexBuffer: true, - elementBuffer: true, - elementBuffer2: true, - elementBuffer2Components: 2, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }] + layoutVertexArrayType: new Bucket.VertexArrayType([{ + name: 'a_pos', + components: 2, + type: 'Int16' + }]), + elementArrayType: new Bucket.ElementArrayType(1), + elementArrayType2: new Bucket.ElementArrayType(2), + paintAttributes: [ + { + name: 'a_color', + components: 4, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return layer.getPaintValue('fill-color', globalProperties, featureProperties); + }, + multiplier: 255, + paintProperty: 'fill-color' + }, + { + name: 'a_outline_color', + components: 4, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return layer.getPaintValue('fill-outline-color', globalProperties, featureProperties); + }, + multiplier: 255, + paintProperty: 'fill-outline-color' + }, + { + name: 'a_opacity', + components: 1, + type: 'Uint8', + getValue: function (layer, globalProperties, featureProperties) { + return [layer.getPaintValue('fill-opacity', globalProperties, featureProperties)]; + }, + multiplier: 255, + paintProperty: 'fill-opacity' + } + ] } }; - -FillBucket.prototype.addFeature = function(feature) { +FillBucket.prototype.addFeature = function (feature) { var lines = loadGeometry(feature); - for (var i = 0; i < lines.length; i++) { - this.addFill(lines[i]); - } -}; - -FillBucket.prototype.addFill = function(vertices) { - if (vertices.length < 3) { - //console.warn('a fill must have at least three vertices'); - return; - } - - // Calculate the total number of vertices we're going to produce so that we - // can resize the buffer beforehand, or detect whether the current line - // won't fit into the buffer anymore. - // In order to be able to use the vertex buffer for drawing the antialiased - // outlines, we separate all polygon vertices with a degenerate (out-of- - // viewplane) vertex. - - var len = vertices.length; - - // Expand this geometry buffer to hold all the required vertices. - var group = this.makeRoomFor('fill', len + 1); - - // We're generating triangle fans, so we always start with the first coordinate in this polygon. - var firstIndex, prevIndex; - for (var i = 0; i < vertices.length; i++) { - var currentVertex = vertices[i]; - - var currentIndex = group.layout.vertex.emplaceBack(currentVertex.x, currentVertex.y); - if (i === 0) firstIndex = currentIndex; - - // Only add triangles that have distinct vertices. - if (i >= 2 && (currentVertex.x !== vertices[0].x || currentVertex.y !== vertices[0].y)) { - group.layout.element.emplaceBack(firstIndex, prevIndex, currentIndex); - } - - if (i >= 1) { - group.layout.element2.emplaceBack(prevIndex, currentIndex); - } - - prevIndex = currentIndex; - } -}; - -},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],250:[function(require,module,exports){ + var polygons = classifyRings(lines, EARCUT_MAX_RINGS); + var startGroup = this.prepareArrayGroup('fill', 0); + var startIndex = startGroup.layoutVertexArray.length; + for (var i = 0; i < polygons.length; i++) { + this.addPolygon(polygons[i]); + } + this.populatePaintArrays('fill', { zoom: this.zoom }, feature.properties, startGroup, startIndex); +}; +FillBucket.prototype.addPolygon = function (polygon) { + var numVertices = 0; + for (var k = 0; k < polygon.length; k++) { + numVertices += polygon[k].length; + } + var group = this.prepareArrayGroup('fill', numVertices); + var flattened = []; + var holeIndices = []; + var startIndex = group.layoutVertexArray.length; + for (var r = 0; r < polygon.length; r++) { + var ring = polygon[r]; + if (r > 0) + holeIndices.push(flattened.length / 2); + for (var v = 0; v < ring.length; v++) { + var vertex = ring[v]; + var index = group.layoutVertexArray.emplaceBack(vertex.x, vertex.y); + if (v >= 1) { + group.elementArray2.emplaceBack(index - 1, index); + } + flattened.push(vertex.x); + flattened.push(vertex.y); + } + } + var triangleIndices = earcut(flattened, holeIndices); + for (var i = 0; i < triangleIndices.length; i++) { + group.elementArray.emplaceBack(triangleIndices[i] + startIndex); + } +}; +},{"../../util/classify_rings":354,"../../util/util":366,"../bucket":253,"../load_geometry":261,"earcut":369}],256:[function(require,module,exports){ 'use strict'; - var Bucket = require('../bucket'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); var EXTENT = Bucket.EXTENT; - -// NOTE ON EXTRUDE SCALE: -// scale the extrusion vector so that the normal length is this value. -// contains the "texture" normals (-1..1). this is distinct from the extrude -// normals for line joins, because the x-value remains 0 for the texture -// normal array, while the extrude normal actually moves the vertex to create -// the acute/bevelled line join. var EXTRUDE_SCALE = 63; - -/* - * Sharp corners cause dashed lines to tilt because the distance along the line - * is the same at both the inner and outer corners. To improve the appearance of - * dashed lines we add extra points near sharp corners so that a smaller part - * of the line is tilted. - * - * COS_HALF_SHARP_CORNER controls how sharp a corner has to be for us to add an - * extra vertex. The default is 75 degrees. - * - * The newly created vertices are placed SHARP_CORNER_OFFSET pixels from the corner. - */ var COS_HALF_SHARP_CORNER = Math.cos(75 / 2 * (Math.PI / 180)); var SHARP_CORNER_OFFSET = 15; - -// The number of bits that is used to store the line distance in the buffer. -var LINE_DISTANCE_BUFFER_BITS = 14; - -// We don't have enough bits for the line distance as we'd like to have, so -// use this value to scale the line distance (in tile units) down to a smaller -// value. This lets us store longer distances while sacrificing precision. +var LINE_DISTANCE_BUFFER_BITS = 15; var LINE_DISTANCE_SCALE = 1 / 2; - -// The maximum line distance, in tile units, that fits in the buffer. -var MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS) / LINE_DISTANCE_SCALE; - - +var MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS - 1) / LINE_DISTANCE_SCALE; module.exports = LineBucket; - -/** - * @private - */ function LineBucket() { Bucket.apply(this, arguments); } - LineBucket.prototype = util.inherit(Bucket, {}); - -LineBucket.prototype.addLineVertex = function(vertexBuffer, point, extrude, tx, ty, dir, linesofar) { - return vertexBuffer.emplaceBack( - // a_pos - (point.x << 1) | tx, - (point.y << 1) | ty, - // a_data - // add 128 to store an byte in an unsigned byte - Math.round(EXTRUDE_SCALE * extrude.x) + 128, - Math.round(EXTRUDE_SCALE * extrude.y) + 128, - // Encode the -1/0/1 direction value into the first two bits of .z of a_data. - // Combine it with the lower 6 bits of `linesofar` (shifted by 2 bites to make - // room for the direction value). The upper 8 bits of `linesofar` are placed in - // the `w` component. `linesofar` is scaled down by `LINE_DISTANCE_SCALE` so that - // we can store longer distances while sacrificing precision. - ((dir === 0 ? 0 : (dir < 0 ? -1 : 1)) + 1) | (((linesofar * LINE_DISTANCE_SCALE) & 0x3F) << 2), - (linesofar * LINE_DISTANCE_SCALE) >> 6); +LineBucket.prototype.addLineVertex = function (layoutVertexBuffer, point, extrude, tx, ty, dir, linesofar) { + return layoutVertexBuffer.emplaceBack(point.x << 1 | tx, point.y << 1 | ty, Math.round(EXTRUDE_SCALE * extrude.x) + 128, Math.round(EXTRUDE_SCALE * extrude.y) + 128, (dir === 0 ? 0 : dir < 0 ? -1 : 1) + 1 | (linesofar * LINE_DISTANCE_SCALE & 63) << 2, linesofar * LINE_DISTANCE_SCALE >> 6); }; - LineBucket.prototype.programInterfaces = { line: { - vertexBuffer: true, - elementBuffer: true, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }, { - name: 'a_data', - components: 4, - type: 'Uint8' - }] + layoutVertexArrayType: new Bucket.VertexArrayType([ + { + name: 'a_pos', + components: 2, + type: 'Int16' + }, + { + name: 'a_data', + components: 4, + type: 'Uint8' + } + ]), + elementArrayType: new Bucket.ElementArrayType() } }; - -LineBucket.prototype.addFeature = function(feature) { - var lines = loadGeometry(feature); +LineBucket.prototype.addFeature = function (feature) { + var lines = loadGeometry(feature, LINE_DISTANCE_BUFFER_BITS); for (var i = 0; i < lines.length; i++) { - this.addLine( - lines[i], - this.layer.layout['line-join'], - this.layer.layout['line-cap'], - this.layer.layout['line-miter-limit'], - this.layer.layout['line-round-limit'] - ); + this.addLine(lines[i], this.layer.layout['line-join'], this.layer.layout['line-cap'], this.layer.layout['line-miter-limit'], this.layer.layout['line-round-limit']); } }; - -LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLimit) { - +LineBucket.prototype.addLine = function (vertices, join, cap, miterLimit, roundLimit) { var len = vertices.length; - // If the line has duplicate vertices at the end, adjust length to remove them. while (len > 2 && vertices[len - 1].equals(vertices[len - 2])) { len--; } - - if (vertices.length < 2) { - //console.warn('a line must have at least two vertices'); + if (vertices.length < 2) return; - } - - if (join === 'bevel') miterLimit = 1.05; - + if (join === 'bevel') + miterLimit = 1.05; var sharpCornerOffset = SHARP_CORNER_OFFSET * (EXTENT / (512 * this.overscaling)); - - var firstVertex = vertices[0], - lastVertex = vertices[len - 1], - closed = firstVertex.equals(lastVertex); - - // we could be more precise, but it would only save a negligible amount of space - this.makeRoomFor('line', len * 10); - - if (len === 2 && closed) { - // console.warn('a line may not have coincident points'); + var firstVertex = vertices[0], lastVertex = vertices[len - 1], closed = firstVertex.equals(lastVertex); + this.prepareArrayGroup('line', len * 10); + if (len === 2 && closed) return; - } - this.distance = 0; - - var beginCap = cap, - endCap = closed ? 'butt' : cap, - startOfLine = true, - currentVertex, prevVertex, nextVertex, prevNormal, nextNormal, offsetA, offsetB; - - // the last three vertices added + var beginCap = cap, endCap = closed ? 'butt' : cap, startOfLine = true, currentVertex, prevVertex, nextVertex, prevNormal, nextNormal, offsetA, offsetB; this.e1 = this.e2 = this.e3 = -1; - if (closed) { currentVertex = vertices[len - 2]; nextNormal = firstVertex.sub(currentVertex)._unit()._perp(); } - for (var i = 0; i < len; i++) { - - nextVertex = closed && i === len - 1 ? - vertices[1] : // if the line is closed, we treat the last vertex like the first - vertices[i + 1]; // just the next vertex - - // if two consecutive vertices exist, skip the current one - if (nextVertex && vertices[i].equals(nextVertex)) continue; - - if (nextNormal) prevNormal = nextNormal; - if (currentVertex) prevVertex = currentVertex; - + nextVertex = closed && i === len - 1 ? vertices[1] : vertices[i + 1]; + if (nextVertex && vertices[i].equals(nextVertex)) + continue; + if (nextNormal) + prevNormal = nextNormal; + if (currentVertex) + prevVertex = currentVertex; currentVertex = vertices[i]; - - // Calculate the normal towards the next vertex in this line. In case - // there is no next vertex, pretend that the line is continuing straight, - // meaning that we are just using the previous normal. nextNormal = nextVertex ? nextVertex.sub(currentVertex)._unit()._perp() : prevNormal; - - // If we still don't have a previous normal, this is the beginning of a - // non-closed line, so we're doing a straight "join". prevNormal = prevNormal || nextNormal; - - // Determine the normal of the join extrusion. It is the angle bisector - // of the segments between the previous line and the next line. var joinNormal = prevNormal.add(nextNormal)._unit(); - - /* joinNormal prevNormal - * ↖ ↑ - * .________. prevVertex - * | - * nextNormal ← | currentVertex - * | - * nextVertex ! - * - */ - - // Calculate the length of the miter (the ratio of the miter to the width). - // Find the cosine of the angle between the next and join normals - // using dot product. The inverse of that is the miter length. var cosHalfAngle = joinNormal.x * nextNormal.x + joinNormal.y * nextNormal.y; var miterLength = 1 / cosHalfAngle; - var isSharpCorner = cosHalfAngle < COS_HALF_SHARP_CORNER && prevVertex && nextVertex; - if (isSharpCorner && i > 0) { var prevSegmentLength = currentVertex.dist(prevVertex); if (prevSegmentLength > 2 * sharpCornerOffset) { @@ -43885,11 +44887,8 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi prevVertex = newPrevVertex; } } - - // The join if a middle vertex, otherwise the cap. var middleVertex = prevVertex && nextVertex; var currentJoin = middleVertex ? join : nextVertex ? beginCap : endCap; - if (middleVertex && currentJoin === 'round') { if (miterLength < roundLimit) { currentJoin = 'miter'; @@ -43897,36 +44896,23 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi currentJoin = 'fakeround'; } } - if (currentJoin === 'miter' && miterLength > miterLimit) { currentJoin = 'bevel'; } - if (currentJoin === 'bevel') { - // The maximum extrude length is 128 / 63 = 2 times the width of the line - // so if miterLength >= 2 we need to draw a different type of bevel where. - if (miterLength > 2) currentJoin = 'flipbevel'; - - // If the miterLength is really small and the line bevel wouldn't be visible, - // just draw a miter join to save a triangle. - if (miterLength < miterLimit) currentJoin = 'miter'; + if (miterLength > 2) + currentJoin = 'flipbevel'; + if (miterLength < miterLimit) + currentJoin = 'miter'; } - - // Calculate how far along the line the currentVertex is - if (prevVertex) this.distance += currentVertex.dist(prevVertex); - + if (prevVertex) + this.distance += currentVertex.dist(prevVertex); if (currentJoin === 'miter') { - joinNormal._mult(miterLength); this.addCurrentVertex(currentVertex, this.distance, joinNormal, 0, 0, false); - } else if (currentJoin === 'flipbevel') { - // miter is too big, flip the direction to make a beveled join - if (miterLength > 100) { - // Almost parallel lines joinNormal = nextNormal.clone(); - } else { var direction = prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x > 0 ? -1 : 1; var bevelLength = miterLength * prevNormal.add(nextNormal).mag() / prevNormal.sub(nextNormal).mag(); @@ -43934,9 +44920,8 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi } this.addCurrentVertex(currentVertex, this.distance, joinNormal, 0, 0, false); this.addCurrentVertex(currentVertex, this.distance, joinNormal.mult(-1), 0, 0, false); - } else if (currentJoin === 'bevel' || currentJoin === 'fakeround') { - var lineTurnsLeft = (prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x) > 0; + var lineTurnsLeft = prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x > 0; var offset = -Math.sqrt(miterLength * miterLength - 1); if (lineTurnsLeft) { offsetB = 0; @@ -43945,90 +44930,51 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi offsetA = 0; offsetB = offset; } - - // Close previous segment with a bevel if (!startOfLine) { this.addCurrentVertex(currentVertex, this.distance, prevNormal, offsetA, offsetB, false); } - if (currentJoin === 'fakeround') { - // The join angle is sharp enough that a round join would be visible. - // Bevel joins fill the gap between segments with a single pie slice triangle. - // Create a round join by adding multiple pie slices. The join isn't actually round, but - // it looks like it is at the sizes we render lines at. - - // Add more triangles for sharper angles. - // This math is just a good enough approximation. It isn't "correct". var n = Math.floor((0.5 - (cosHalfAngle - 0.5)) * 8); var approxFractionalJoinNormal; - for (var m = 0; m < n; m++) { approxFractionalJoinNormal = nextNormal.mult((m + 1) / (n + 1))._add(prevNormal)._unit(); this.addPieSliceVertex(currentVertex, this.distance, approxFractionalJoinNormal, lineTurnsLeft); } - this.addPieSliceVertex(currentVertex, this.distance, joinNormal, lineTurnsLeft); - for (var k = n - 1; k >= 0; k--) { approxFractionalJoinNormal = prevNormal.mult((k + 1) / (n + 1))._add(nextNormal)._unit(); this.addPieSliceVertex(currentVertex, this.distance, approxFractionalJoinNormal, lineTurnsLeft); } } - - // Start next segment if (nextVertex) { this.addCurrentVertex(currentVertex, this.distance, nextNormal, -offsetA, -offsetB, false); } - } else if (currentJoin === 'butt') { if (!startOfLine) { - // Close previous segment with a butt this.addCurrentVertex(currentVertex, this.distance, prevNormal, 0, 0, false); } - - // Start next segment with a butt if (nextVertex) { this.addCurrentVertex(currentVertex, this.distance, nextNormal, 0, 0, false); } - } else if (currentJoin === 'square') { - if (!startOfLine) { - // Close previous segment with a square cap this.addCurrentVertex(currentVertex, this.distance, prevNormal, 1, 1, false); - - // The segment is done. Unset vertices to disconnect segments. this.e1 = this.e2 = -1; } - - // Start next segment if (nextVertex) { this.addCurrentVertex(currentVertex, this.distance, nextNormal, -1, -1, false); } - } else if (currentJoin === 'round') { - if (!startOfLine) { - // Close previous segment with butt this.addCurrentVertex(currentVertex, this.distance, prevNormal, 0, 0, false); - - // Add round cap or linejoin at end of segment this.addCurrentVertex(currentVertex, this.distance, prevNormal, 1, 1, true); - - // The segment is done. Unset vertices to disconnect segments. this.e1 = this.e2 = -1; } - - - // Start next segment with a butt if (nextVertex) { - // Add round cap before first segment this.addCurrentVertex(currentVertex, this.distance, nextNormal, -1, -1, true); - this.addCurrentVertex(currentVertex, this.distance, nextNormal, 0, 0, false); } } - if (isSharpCorner && i < len - 1) { var nextSegmentLength = currentVertex.dist(nextVertex); if (nextSegmentLength > 2 * sharpCornerOffset) { @@ -44038,92 +44984,57 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi currentVertex = newCurrentVertex; } } - startOfLine = false; } - }; - -/** - * Add two vertices to the buffers. - * - * @param {Object} currentVertex the line vertex to add buffer vertices for - * @param {number} distance the distance from the beginning of the line to the vertex - * @param {number} endLeft extrude to shift the left vertex along the line - * @param {number} endRight extrude to shift the left vertex along the line - * @param {boolean} round whether this is a round cap - * @private - */ -LineBucket.prototype.addCurrentVertex = function(currentVertex, distance, normal, endLeft, endRight, round) { +LineBucket.prototype.addCurrentVertex = function (currentVertex, distance, normal, endLeft, endRight, round) { var tx = round ? 1 : 0; var extrude; - var layoutArrays = this.arrayGroups.line[this.arrayGroups.line.length - 1].layout; - var vertexArray = layoutArrays.vertex; - var elementArray = layoutArrays.element; - + var arrayGroup = this.arrayGroups.line[this.arrayGroups.line.length - 1]; + var layoutVertexArray = arrayGroup.layoutVertexArray; + var elementArray = arrayGroup.elementArray; extrude = normal.clone(); - if (endLeft) extrude._sub(normal.perp()._mult(endLeft)); - this.e3 = this.addLineVertex(vertexArray, currentVertex, extrude, tx, 0, endLeft, distance); + if (endLeft) + extrude._sub(normal.perp()._mult(endLeft)); + this.e3 = this.addLineVertex(layoutVertexArray, currentVertex, extrude, tx, 0, endLeft, distance); if (this.e1 >= 0 && this.e2 >= 0) { elementArray.emplaceBack(this.e1, this.e2, this.e3); } this.e1 = this.e2; this.e2 = this.e3; - extrude = normal.mult(-1); - if (endRight) extrude._sub(normal.perp()._mult(endRight)); - this.e3 = this.addLineVertex(vertexArray, currentVertex, extrude, tx, 1, -endRight, distance); + if (endRight) + extrude._sub(normal.perp()._mult(endRight)); + this.e3 = this.addLineVertex(layoutVertexArray, currentVertex, extrude, tx, 1, -endRight, distance); if (this.e1 >= 0 && this.e2 >= 0) { elementArray.emplaceBack(this.e1, this.e2, this.e3); } this.e1 = this.e2; this.e2 = this.e3; - - // There is a maximum "distance along the line" that we can store in the buffers. - // When we get close to the distance, reset it to zero and add the vertex again with - // a distance of zero. The max distance is determined by the number of bits we allocate - // to `linesofar`. if (distance > MAX_LINE_DISTANCE / 2) { this.distance = 0; this.addCurrentVertex(currentVertex, this.distance, normal, endLeft, endRight, round); } }; - -/** - * Add a single new vertex and a triangle using two previous vertices. - * This adds a pie slice triangle near a join to simulate round joins - * - * @param {Object} currentVertex the line vertex to add buffer vertices for - * @param {number} distance the distance from the beggining of the line to the vertex - * @param {Object} extrude the offset of the new vertex from the currentVertex - * @param {boolean} whether the line is turning left or right at this angle - * @private - */ -LineBucket.prototype.addPieSliceVertex = function(currentVertex, distance, extrude, lineTurnsLeft) { +LineBucket.prototype.addPieSliceVertex = function (currentVertex, distance, extrude, lineTurnsLeft) { var ty = lineTurnsLeft ? 1 : 0; extrude = extrude.mult(lineTurnsLeft ? -1 : 1); - var layoutArrays = this.arrayGroups.line[this.arrayGroups.line.length - 1].layout; - var vertexArray = layoutArrays.vertex; - var elementArray = layoutArrays.element; - - this.e3 = this.addLineVertex(vertexArray, currentVertex, extrude, 0, ty, 0, distance); - + var arrayGroup = this.arrayGroups.line[this.arrayGroups.line.length - 1]; + var layoutVertexArray = arrayGroup.layoutVertexArray; + var elementArray = arrayGroup.elementArray; + this.e3 = this.addLineVertex(layoutVertexArray, currentVertex, extrude, 0, ty, 0, distance); if (this.e1 >= 0 && this.e2 >= 0) { elementArray.emplaceBack(this.e1, this.e2, this.e3); } - if (lineTurnsLeft) { this.e2 = this.e3; } else { this.e1 = this.e3; } }; - -},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],251:[function(require,module,exports){ +},{"../../util/util":366,"../bucket":253,"../load_geometry":261}],257:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - var Bucket = require('../bucket'); var Anchor = require('../../symbol/anchor'); var getAnchors = require('../../symbol/get_anchors'); @@ -44136,32 +45047,27 @@ var clipLine = require('../../symbol/clip_line'); var util = require('../../util/util'); var loadGeometry = require('../load_geometry'); var CollisionFeature = require('../../symbol/collision_feature'); - var shapeText = Shaping.shapeText; var shapeIcon = Shaping.shapeIcon; var getGlyphQuads = Quads.getGlyphQuads; var getIconQuads = Quads.getIconQuads; - var EXTENT = Bucket.EXTENT; - module.exports = SymbolBucket; - function SymbolBucket(options) { Bucket.apply(this, arguments); this.showCollisionBoxes = options.showCollisionBoxes; this.overscaling = options.overscaling; this.collisionBoxArray = options.collisionBoxArray; - + this.symbolQuadsArray = options.symbolQuadsArray; + this.symbolInstancesArray = options.symbolInstancesArray; this.sdfIcons = options.sdfIcons; this.iconsNeedLinear = options.iconsNeedLinear; this.adjustedTextSize = options.adjustedTextSize; this.adjustedIconSize = options.adjustedIconSize; this.fontstack = options.fontstack; } - SymbolBucket.prototype = util.inherit(Bucket, {}); - -SymbolBucket.prototype.serialize = function() { +SymbolBucket.prototype.serialize = function () { var serialized = Bucket.prototype.serialize.apply(this); serialized.sdfIcons = this.sdfIcons; serialized.iconsNeedLinear = this.iconsNeedLinear; @@ -44170,114 +45076,95 @@ SymbolBucket.prototype.serialize = function() { serialized.fontstack = this.fontstack; return serialized; }; - -var programAttributes = [{ - name: 'a_pos', - components: 2, - type: 'Int16' -}, { - name: 'a_offset', - components: 2, - type: 'Int16' -}, { - name: 'a_data1', - components: 4, - type: 'Uint8' -}, { - name: 'a_data2', - components: 2, - type: 'Uint8' -}]; - -function addVertex(array, x, y, ox, oy, tx, ty, minzoom, maxzoom, labelminzoom) { - return array.emplaceBack( - // pos - x, - y, - // offset - Math.round(ox * 64), // use 1/64 pixels for placement - Math.round(oy * 64), - // data1 - tx / 4, // tex - ty / 4, // tex - (labelminzoom || 0) * 10, // labelminzoom - 0, - // data2 - (minzoom || 0) * 10, // minzoom - Math.min(maxzoom || 25, 25) * 10); // minzoom +var layoutVertexArrayType = new Bucket.VertexArrayType([ + { + name: 'a_pos', + components: 2, + type: 'Int16' + }, + { + name: 'a_offset', + components: 2, + type: 'Int16' + }, + { + name: 'a_texture_pos', + components: 2, + type: 'Uint16' + }, + { + name: 'a_data', + components: 4, + type: 'Uint8' + } +]); +var elementArrayType = new Bucket.ElementArrayType(); +function addVertex(array, x, y, ox, oy, tx, ty, minzoom, maxzoom, labelminzoom, labelangle) { + return array.emplaceBack(x, y, Math.round(ox * 64), Math.round(oy * 64), tx / 4, ty / 4, (labelminzoom || 0) * 10, labelangle, (minzoom || 0) * 10, Math.min(maxzoom || 25, 25) * 10); } - -SymbolBucket.prototype.addCollisionBoxVertex = function(vertexArray, point, extrude, maxZoom, placementZoom) { - return vertexArray.emplaceBack( - // pos - point.x, - point.y, - // extrude - Math.round(extrude.x), - Math.round(extrude.y), - // data - maxZoom * 10, - placementZoom * 10); +SymbolBucket.prototype.addCollisionBoxVertex = function (layoutVertexArray, point, extrude, maxZoom, placementZoom) { + return layoutVertexArray.emplaceBack(point.x, point.y, Math.round(extrude.x), Math.round(extrude.y), maxZoom * 10, placementZoom * 10); }; - SymbolBucket.prototype.programInterfaces = { - glyph: { - vertexBuffer: true, - elementBuffer: true, - layoutAttributes: programAttributes + layoutVertexArrayType: layoutVertexArrayType, + elementArrayType: elementArrayType }, - icon: { - vertexBuffer: true, - elementBuffer: true, - layoutAttributes: programAttributes + layoutVertexArrayType: layoutVertexArrayType, + elementArrayType: elementArrayType }, - collisionBox: { - vertexBuffer: true, - - layoutAttributes: [{ - name: 'a_pos', - components: 2, - type: 'Int16' - }, { - name: 'a_extrude', - components: 2, - type: 'Int16' - }, { - name: 'a_data', - components: 2, - type: 'Uint8' - }] + layoutVertexArrayType: new Bucket.VertexArrayType([ + { + name: 'a_pos', + components: 2, + type: 'Int16' + }, + { + name: 'a_extrude', + components: 2, + type: 'Int16' + }, + { + name: 'a_data', + components: 2, + type: 'Uint8' + } + ]) } }; - -SymbolBucket.prototype.populateBuffers = function(collisionTile, stacks, icons) { - - // To reduce the number of labels that jump around when zooming we need - // to use a text-size value that is the same for all zoom levels. - // This calculates text-size at a high zoom level so that all tiles can - // use the same value when calculating anchor positions. - var zoomHistory = { lastIntegerZoom: Infinity, lastIntegerZoomTime: 0, lastZoom: 0 }; - this.adjustedTextMaxSize = this.layer.getLayoutValue('text-size', {zoom: 18, zoomHistory: zoomHistory}); - this.adjustedTextSize = this.layer.getLayoutValue('text-size', {zoom: this.zoom + 1, zoomHistory: zoomHistory}); - this.adjustedIconMaxSize = this.layer.getLayoutValue('icon-size', {zoom: 18, zoomHistory: zoomHistory}); - this.adjustedIconSize = this.layer.getLayoutValue('icon-size', {zoom: this.zoom + 1, zoomHistory: zoomHistory}); - +SymbolBucket.prototype.populateArrays = function (collisionTile, stacks, icons) { + var zoomHistory = { + lastIntegerZoom: Infinity, + lastIntegerZoomTime: 0, + lastZoom: 0 + }; + this.adjustedTextMaxSize = this.layer.getLayoutValue('text-size', { + zoom: 18, + zoomHistory: zoomHistory + }); + this.adjustedTextSize = this.layer.getLayoutValue('text-size', { + zoom: this.zoom + 1, + zoomHistory: zoomHistory + }); + this.adjustedIconMaxSize = this.layer.getLayoutValue('icon-size', { + zoom: 18, + zoomHistory: zoomHistory + }); + this.adjustedIconSize = this.layer.getLayoutValue('icon-size', { + zoom: this.zoom + 1, + zoomHistory: zoomHistory + }); var tileSize = 512 * this.overscaling; this.tilePixelRatio = EXTENT / tileSize; this.compareText = {}; - this.symbolInstances = []; this.iconsNeedLinear = false; - + this.symbolInstancesStartIndex = this.symbolInstancesArray.length; var layout = this.layer.layout; var features = this.features; var textFeatures = this.textFeatures; - - var horizontalAlign = 0.5, - verticalAlign = 0.5; - + var horizontalAlign = 0.5, verticalAlign = 0.5; switch (layout['text-anchor']) { case 'right': case 'top-right': @@ -44290,7 +45177,6 @@ SymbolBucket.prototype.populateBuffers = function(collisionTile, stacks, icons) horizontalAlign = 0; break; } - switch (layout['text-anchor']) { case 'bottom': case 'bottom-right': @@ -44303,155 +45189,93 @@ SymbolBucket.prototype.populateBuffers = function(collisionTile, stacks, icons) verticalAlign = 0; break; } - - var justify = layout['text-justify'] === 'right' ? 1 : - layout['text-justify'] === 'left' ? 0 : - 0.5; - + var justify = layout['text-justify'] === 'right' ? 1 : layout['text-justify'] === 'left' ? 0 : 0.5; var oneEm = 24; var lineHeight = layout['text-line-height'] * oneEm; var maxWidth = layout['symbol-placement'] !== 'line' ? layout['text-max-width'] * oneEm : 0; var spacing = layout['text-letter-spacing'] * oneEm; - var textOffset = [layout['text-offset'][0] * oneEm, layout['text-offset'][1] * oneEm]; + var textOffset = [ + layout['text-offset'][0] * oneEm, + layout['text-offset'][1] * oneEm + ]; var fontstack = this.fontstack = layout['text-font'].join(','); - var geometries = []; for (var g = 0; g < features.length; g++) { geometries.push(loadGeometry(features[g])); } - if (layout['symbol-placement'] === 'line') { - // Merge adjacent lines with the same text to improve labelling. - // It's better to place labels on one long line than on many short segments. var merged = mergeLines(features, textFeatures, geometries); - geometries = merged.geometries; features = merged.features; textFeatures = merged.textFeatures; } - var shapedText, shapedIcon; - for (var k = 0; k < features.length; k++) { - if (!geometries[k]) continue; - + if (!geometries[k]) + continue; if (textFeatures[k]) { - shapedText = shapeText(textFeatures[k], stacks[fontstack], maxWidth, - lineHeight, horizontalAlign, verticalAlign, justify, spacing, textOffset); + shapedText = shapeText(textFeatures[k], stacks[fontstack], maxWidth, lineHeight, horizontalAlign, verticalAlign, justify, spacing, textOffset); } else { shapedText = null; } - if (layout['icon-image']) { var iconName = resolveTokens(features[k].properties, layout['icon-image']); var image = icons[iconName]; shapedIcon = shapeIcon(image, layout); - if (image) { if (this.sdfIcons === undefined) { this.sdfIcons = image.sdf; } else if (this.sdfIcons !== image.sdf) { - console.warn('Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer'); + util.warnOnce('Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer'); } if (image.pixelRatio !== 1) { this.iconsNeedLinear = true; + } else if (layout['icon-rotate'] !== 0 || !this.layer.isLayoutValueFeatureConstant('icon-rotate')) { + this.iconsNeedLinear = true; } } } else { shapedIcon = null; } - if (shapedText || shapedIcon) { - this.addFeature(geometries[k], shapedText, shapedIcon, features[k].index); + this.addFeature(geometries[k], shapedText, shapedIcon, features[k]); } } - + this.symbolInstancesEndIndex = this.symbolInstancesArray.length; this.placeFeatures(collisionTile, this.showCollisionBoxes); - this.trimArrays(); }; - -SymbolBucket.prototype.addFeature = function(lines, shapedText, shapedIcon, featureIndex) { +SymbolBucket.prototype.addFeature = function (lines, shapedText, shapedIcon, feature) { var layout = this.layer.layout; - var glyphSize = 24; - - var fontScale = this.adjustedTextSize / glyphSize, - textMaxSize = this.adjustedTextMaxSize !== undefined ? this.adjustedTextMaxSize : this.adjustedTextSize, - textBoxScale = this.tilePixelRatio * fontScale, - textMaxBoxScale = this.tilePixelRatio * textMaxSize / glyphSize, - iconBoxScale = this.tilePixelRatio * this.adjustedIconSize, - symbolMinDistance = this.tilePixelRatio * layout['symbol-spacing'], - avoidEdges = layout['symbol-avoid-edges'], - textPadding = layout['text-padding'] * this.tilePixelRatio, - iconPadding = layout['icon-padding'] * this.tilePixelRatio, - textMaxAngle = layout['text-max-angle'] / 180 * Math.PI, - textAlongLine = layout['text-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', - iconAlongLine = layout['icon-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', - mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || - layout['text-ignore-placement'] || layout['icon-ignore-placement'], - isLine = layout['symbol-placement'] === 'line', - textRepeatDistance = symbolMinDistance / 2; - + var fontScale = this.adjustedTextSize / glyphSize, textMaxSize = this.adjustedTextMaxSize !== undefined ? this.adjustedTextMaxSize : this.adjustedTextSize, textBoxScale = this.tilePixelRatio * fontScale, textMaxBoxScale = this.tilePixelRatio * textMaxSize / glyphSize, iconBoxScale = this.tilePixelRatio * this.adjustedIconSize, symbolMinDistance = this.tilePixelRatio * layout['symbol-spacing'], avoidEdges = layout['symbol-avoid-edges'], textPadding = layout['text-padding'] * this.tilePixelRatio, iconPadding = layout['icon-padding'] * this.tilePixelRatio, textMaxAngle = layout['text-max-angle'] / 180 * Math.PI, textAlongLine = layout['text-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', iconAlongLine = layout['icon-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line', mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || layout['text-ignore-placement'] || layout['icon-ignore-placement'], isLine = layout['symbol-placement'] === 'line', textRepeatDistance = symbolMinDistance / 2; if (isLine) { lines = clipLine(lines, 0, 0, EXTENT, EXTENT); } - for (var i = 0; i < lines.length; i++) { var line = lines[i]; - - // Calculate the anchor points around which you want to place labels var anchors; if (isLine) { - anchors = getAnchors( - line, - symbolMinDistance, - textMaxAngle, - shapedText, - shapedIcon, - glyphSize, - textMaxBoxScale, - this.overscaling, - EXTENT - ); + anchors = getAnchors(line, symbolMinDistance, textMaxAngle, shapedText, shapedIcon, glyphSize, textMaxBoxScale, this.overscaling, EXTENT); } else { - anchors = [ new Anchor(line[0].x, line[0].y, 0) ]; + anchors = [new Anchor(line[0].x, line[0].y, 0)]; } - - // For each potential label, create the placement features used to check for collisions, and the quads use for rendering. for (var j = 0, len = anchors.length; j < len; j++) { var anchor = anchors[j]; - if (shapedText && isLine) { if (this.anchorIsTooClose(shapedText.text, textRepeatDistance, anchor)) { continue; } } - var inside = !(anchor.x < 0 || anchor.x > EXTENT || anchor.y < 0 || anchor.y > EXTENT); - - if (avoidEdges && !inside) continue; - - // Normally symbol layers are drawn across tile boundaries. Only symbols - // with their anchors within the tile boundaries are added to the buffers - // to prevent symbols from being drawn twice. - // - // Symbols in layers with overlap are sorted in the y direction so that - // symbols lower on the canvas are drawn on top of symbols near the top. - // To preserve this order across tile boundaries these symbols can't - // be drawn across tile boundaries. Instead they need to be included in - // the buffers for both tiles and clipped to tile boundaries at draw time. + if (avoidEdges && !inside) + continue; var addToBuffers = inside || mayOverlap; - - this.symbolInstances.push(new SymbolInstance(anchor, line, shapedText, shapedIcon, layout, - addToBuffers, this.symbolInstances.length, this.collisionBoxArray, featureIndex, this.sourceLayerIndex, this.index, - textBoxScale, textPadding, textAlongLine, - iconBoxScale, iconPadding, iconAlongLine)); + this.addSymbolInstance(anchor, line, shapedText, shapedIcon, this.layer, addToBuffers, this.symbolInstancesArray.length, this.collisionBoxArray, feature.index, this.sourceLayerIndex, this.index, textBoxScale, textPadding, textAlongLine, iconBoxScale, iconPadding, iconAlongLine, { zoom: this.zoom }, feature.properties); } } }; - -SymbolBucket.prototype.anchorIsTooClose = function(text, repeatDistance, anchor) { +SymbolBucket.prototype.anchorIsTooClose = function (text, repeatDistance, anchor) { var compareText = this.compareText; if (!(text in compareText)) { compareText[text] = []; @@ -44459,74 +45283,46 @@ SymbolBucket.prototype.anchorIsTooClose = function(text, repeatDistance, anchor) var otherAnchors = compareText[text]; for (var k = otherAnchors.length - 1; k >= 0; k--) { if (anchor.dist(otherAnchors[k]) < repeatDistance) { - // If it's within repeatDistance of one anchor, stop looking return true; } } } - // If anchor is not within repeatDistance of any other anchor, add to array compareText[text].push(anchor); return false; }; - -SymbolBucket.prototype.placeFeatures = function(collisionTile, showCollisionBoxes) { +SymbolBucket.prototype.placeFeatures = function (collisionTile, showCollisionBoxes) { this.recalculateStyleLayers(); - - // Calculate which labels can be shown and when they can be shown and - // create the bufers used for rendering. - this.createArrays(); - var layout = this.layer.layout; - var maxScale = collisionTile.maxScale; - var textAlongLine = layout['text-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line'; var iconAlongLine = layout['icon-rotation-alignment'] === 'map' && layout['symbol-placement'] === 'line'; - - var mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || - layout['text-ignore-placement'] || layout['icon-ignore-placement']; - - // Sort symbols by their y position on the canvas so that they lower symbols - // are drawn on top of higher symbols. - // Don't sort symbols that won't overlap because it isn't necessary and - // because it causes more labels to pop in and out when rotating. + var mayOverlap = layout['text-allow-overlap'] || layout['icon-allow-overlap'] || layout['text-ignore-placement'] || layout['icon-ignore-placement']; if (mayOverlap) { + var symbolInstancesStructTypeArray = this.symbolInstancesArray.toArray(this.symbolInstancesStartIndex, this.symbolInstancesEndIndex); var angle = collisionTile.angle; - var sin = Math.sin(angle), - cos = Math.cos(angle); - - this.symbolInstances.sort(function(a, b) { - var aRotated = (sin * a.x + cos * a.y) | 0; - var bRotated = (sin * b.x + cos * b.y) | 0; - return (aRotated - bRotated) || (b.index - a.index); + var sin = Math.sin(angle), cos = Math.cos(angle); + this.sortedSymbolInstances = symbolInstancesStructTypeArray.sort(function (a, b) { + var aRotated = sin * a.anchorPointX + cos * a.anchorPointY | 0; + var bRotated = sin * b.anchorPointX + cos * b.anchorPointY | 0; + return aRotated - bRotated || b.index - a.index; }); } - - for (var p = 0; p < this.symbolInstances.length; p++) { - var symbolInstance = this.symbolInstances[p]; - var hasText = symbolInstance.hasText; - var hasIcon = symbolInstance.hasIcon; - - var iconWithoutText = layout['text-optional'] || !hasText, - textWithoutIcon = layout['icon-optional'] || !hasIcon; - - - // Calculate the scales at which the text and icon can be placed without collision. - - var glyphScale = hasText ? - collisionTile.placeCollisionFeature(symbolInstance.textCollisionFeature, - layout['text-allow-overlap'], layout['symbol-avoid-edges']) : - collisionTile.minScale; - - var iconScale = hasIcon ? - collisionTile.placeCollisionFeature(symbolInstance.iconCollisionFeature, - layout['icon-allow-overlap'], layout['symbol-avoid-edges']) : - collisionTile.minScale; - - - // Combine the scales for icons and text. - + for (var p = this.symbolInstancesStartIndex; p < this.symbolInstancesEndIndex; p++) { + var symbolInstance = this.sortedSymbolInstances ? this.sortedSymbolInstances[p - this.symbolInstancesStartIndex] : this.symbolInstancesArray.get(p); + var textCollisionFeature = { + boxStartIndex: symbolInstance.textBoxStartIndex, + boxEndIndex: symbolInstance.textBoxEndIndex + }; + var iconCollisionFeature = { + boxStartIndex: symbolInstance.iconBoxStartIndex, + boxEndIndex: symbolInstance.iconBoxEndIndex + }; + var hasText = !(symbolInstance.textBoxStartIndex === symbolInstance.textBoxEndIndex); + var hasIcon = !(symbolInstance.iconBoxStartIndex === symbolInstance.iconBoxEndIndex); + var iconWithoutText = layout['text-optional'] || !hasText, textWithoutIcon = layout['icon-optional'] || !hasIcon; + var glyphScale = hasText ? collisionTile.placeCollisionFeature(textCollisionFeature, layout['text-allow-overlap'], layout['symbol-avoid-edges']) : collisionTile.minScale; + var iconScale = hasIcon ? collisionTile.placeCollisionFeature(iconCollisionFeature, layout['icon-allow-overlap'], layout['symbol-avoid-edges']) : collisionTile.minScale; if (!iconWithoutText && !textWithoutIcon) { iconScale = glyphScale = Math.max(iconScale, glyphScale); } else if (!textWithoutIcon && glyphScale) { @@ -44534,170 +45330,137 @@ SymbolBucket.prototype.placeFeatures = function(collisionTile, showCollisionBoxe } else if (!iconWithoutText && iconScale) { iconScale = Math.max(iconScale, glyphScale); } - - - // Insert final placement into collision tree and add glyphs/icons to buffers - if (hasText) { - collisionTile.insertCollisionFeature(symbolInstance.textCollisionFeature, glyphScale, layout['text-ignore-placement']); + collisionTile.insertCollisionFeature(textCollisionFeature, glyphScale, layout['text-ignore-placement']); if (glyphScale <= maxScale) { - this.addSymbols('glyph', symbolInstance.glyphQuads, glyphScale, layout['text-keep-upright'], textAlongLine, collisionTile.angle); + this.addSymbols('glyph', symbolInstance.glyphQuadStartIndex, symbolInstance.glyphQuadEndIndex, glyphScale, layout['text-keep-upright'], textAlongLine, collisionTile.angle); } } - if (hasIcon) { - collisionTile.insertCollisionFeature(symbolInstance.iconCollisionFeature, iconScale, layout['icon-ignore-placement']); + collisionTile.insertCollisionFeature(iconCollisionFeature, iconScale, layout['icon-ignore-placement']); if (iconScale <= maxScale) { - this.addSymbols('icon', symbolInstance.iconQuads, iconScale, layout['icon-keep-upright'], iconAlongLine, collisionTile.angle); + this.addSymbols('icon', symbolInstance.iconQuadStartIndex, symbolInstance.iconQuadEndIndex, iconScale, layout['icon-keep-upright'], iconAlongLine, collisionTile.angle); } } - } - - if (showCollisionBoxes) this.addToDebugBuffers(collisionTile); + if (showCollisionBoxes) + this.addToDebugBuffers(collisionTile); }; - -SymbolBucket.prototype.addSymbols = function(programName, quads, scale, keepUpright, alongLine, placementAngle) { - - var group = this.makeRoomFor(programName, 4 * quads.length); - - var elementArray = group.layout.element; - var vertexArray = group.layout.vertex; - +SymbolBucket.prototype.addSymbols = function (programName, quadsStart, quadsEnd, scale, keepUpright, alongLine, placementAngle) { + var group = this.prepareArrayGroup(programName, 4 * (quadsEnd - quadsStart)); + var elementArray = group.elementArray; + var layoutVertexArray = group.layoutVertexArray; var zoom = this.zoom; var placementZoom = Math.max(Math.log(scale) / Math.LN2 + zoom, 0); - - for (var k = 0; k < quads.length; k++) { - - var symbol = quads[k], - angle = symbol.angle; - - // drop upside down versions of glyphs - var a = (angle + placementAngle + Math.PI) % (Math.PI * 2); - if (keepUpright && alongLine && (a <= Math.PI / 2 || a > Math.PI * 3 / 2)) continue; - - var tl = symbol.tl, - tr = symbol.tr, - bl = symbol.bl, - br = symbol.br, - tex = symbol.tex, - anchorPoint = symbol.anchorPoint, - - minZoom = Math.max(zoom + Math.log(symbol.minScale) / Math.LN2, placementZoom), - maxZoom = Math.min(zoom + Math.log(symbol.maxScale) / Math.LN2, 25); - - if (maxZoom <= minZoom) continue; - - // Lower min zoom so that while fading out the label it can be shown outside of collision-free zoom levels - if (minZoom === placementZoom) minZoom = 0; - - var index = addVertex(vertexArray, anchorPoint.x, anchorPoint.y, tl.x, tl.y, tex.x, tex.y, minZoom, maxZoom, placementZoom); - addVertex(vertexArray, anchorPoint.x, anchorPoint.y, tr.x, tr.y, tex.x + tex.w, tex.y, minZoom, maxZoom, placementZoom); - addVertex(vertexArray, anchorPoint.x, anchorPoint.y, bl.x, bl.y, tex.x, tex.y + tex.h, minZoom, maxZoom, placementZoom); - addVertex(vertexArray, anchorPoint.x, anchorPoint.y, br.x, br.y, tex.x + tex.w, tex.y + tex.h, minZoom, maxZoom, placementZoom); - + for (var k = quadsStart; k < quadsEnd; k++) { + var symbol = this.symbolQuadsArray.get(k).SymbolQuad; + var a = (symbol.anchorAngle + placementAngle + Math.PI) % (Math.PI * 2); + if (keepUpright && alongLine && (a <= Math.PI / 2 || a > Math.PI * 3 / 2)) + continue; + var tl = symbol.tl, tr = symbol.tr, bl = symbol.bl, br = symbol.br, tex = symbol.tex, anchorPoint = symbol.anchorPoint, minZoom = Math.max(zoom + Math.log(symbol.minScale) / Math.LN2, placementZoom), maxZoom = Math.min(zoom + Math.log(symbol.maxScale) / Math.LN2, 25); + if (maxZoom <= minZoom) + continue; + if (minZoom === placementZoom) + minZoom = 0; + var glyphAngle = Math.round(symbol.glyphAngle / (Math.PI * 2) * 256); + var index = addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, tl.x, tl.y, tex.x, tex.y, minZoom, maxZoom, placementZoom, glyphAngle); + addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, tr.x, tr.y, tex.x + tex.w, tex.y, minZoom, maxZoom, placementZoom, glyphAngle); + addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, bl.x, bl.y, tex.x, tex.y + tex.h, minZoom, maxZoom, placementZoom, glyphAngle); + addVertex(layoutVertexArray, anchorPoint.x, anchorPoint.y, br.x, br.y, tex.x + tex.w, tex.y + tex.h, minZoom, maxZoom, placementZoom, glyphAngle); elementArray.emplaceBack(index, index + 1, index + 2); elementArray.emplaceBack(index + 1, index + 2, index + 3); } - }; - -SymbolBucket.prototype.updateIcons = function(icons) { +SymbolBucket.prototype.updateIcons = function (icons) { this.recalculateStyleLayers(); var iconValue = this.layer.layout['icon-image']; - if (!iconValue) return; - + if (!iconValue) + return; for (var i = 0; i < this.features.length; i++) { var iconName = resolveTokens(this.features[i].properties, iconValue); if (iconName) icons[iconName] = true; } }; - -SymbolBucket.prototype.updateFont = function(stacks) { +SymbolBucket.prototype.updateFont = function (stacks) { this.recalculateStyleLayers(); - var fontName = this.layer.layout['text-font'], - stack = stacks[fontName] = stacks[fontName] || {}; - + var fontName = this.layer.layout['text-font'], stack = stacks[fontName] = stacks[fontName] || {}; this.textFeatures = resolveText(this.features, this.layer.layout, stack); }; - -SymbolBucket.prototype.addToDebugBuffers = function(collisionTile) { - var group = this.makeRoomFor('collisionBox', 0); - var vertexArray = group.layout.vertex; +SymbolBucket.prototype.addToDebugBuffers = function (collisionTile) { + var group = this.prepareArrayGroup('collisionBox', 0); + var layoutVertexArray = group.layoutVertexArray; var angle = -collisionTile.angle; var yStretch = collisionTile.yStretch; - - for (var j = 0; j < this.symbolInstances.length; j++) { + for (var j = this.symbolInstancesStartIndex; j < this.symbolInstancesEndIndex; j++) { + var symbolInstance = this.symbolInstancesArray.get(j); + symbolInstance.textCollisionFeature = { + boxStartIndex: symbolInstance.textBoxStartIndex, + boxEndIndex: symbolInstance.textBoxEndIndex + }; + symbolInstance.iconCollisionFeature = { + boxStartIndex: symbolInstance.iconBoxStartIndex, + boxEndIndex: symbolInstance.iconBoxEndIndex + }; for (var i = 0; i < 2; i++) { - var feature = this.symbolInstances[j][i === 0 ? 'textCollisionFeature' : 'iconCollisionFeature']; - if (!feature) continue; - + var feature = symbolInstance[i === 0 ? 'textCollisionFeature' : 'iconCollisionFeature']; + if (!feature) + continue; for (var b = feature.boxStartIndex; b < feature.boxEndIndex; b++) { var box = this.collisionBoxArray.get(b); var anchorPoint = box.anchorPoint; - var tl = new Point(box.x1, box.y1 * yStretch)._rotate(angle); var tr = new Point(box.x2, box.y1 * yStretch)._rotate(angle); var bl = new Point(box.x1, box.y2 * yStretch)._rotate(angle); var br = new Point(box.x2, box.y2 * yStretch)._rotate(angle); - var maxZoom = Math.max(0, Math.min(25, this.zoom + Math.log(box.maxScale) / Math.LN2)); var placementZoom = Math.max(0, Math.min(25, this.zoom + Math.log(box.placementScale) / Math.LN2)); - - this.addCollisionBoxVertex(vertexArray, anchorPoint, tl, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, tr, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, tr, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, br, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, br, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, bl, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, bl, maxZoom, placementZoom); - this.addCollisionBoxVertex(vertexArray, anchorPoint, tl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tr, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tr, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, br, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, br, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, bl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, bl, maxZoom, placementZoom); + this.addCollisionBoxVertex(layoutVertexArray, anchorPoint, tl, maxZoom, placementZoom); } } } }; - -function SymbolInstance(anchor, line, shapedText, shapedIcon, layout, addToBuffers, index, collisionBoxArray, featureIndex, sourceLayerIndex, bucketIndex, - textBoxScale, textPadding, textAlongLine, - iconBoxScale, iconPadding, iconAlongLine) { - - this.x = anchor.x; - this.y = anchor.y; - this.index = index; - this.hasText = !!shapedText; - this.hasIcon = !!shapedIcon; - - if (this.hasText) { - this.glyphQuads = addToBuffers ? getGlyphQuads(anchor, shapedText, textBoxScale, line, layout, textAlongLine) : []; - this.textCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, - shapedText, textBoxScale, textPadding, textAlongLine, false); +SymbolBucket.prototype.addSymbolInstance = function (anchor, line, shapedText, shapedIcon, layer, addToBuffers, index, collisionBoxArray, featureIndex, sourceLayerIndex, bucketIndex, textBoxScale, textPadding, textAlongLine, iconBoxScale, iconPadding, iconAlongLine, globalProperties, featureProperties) { + var glyphQuadStartIndex, glyphQuadEndIndex, iconQuadStartIndex, iconQuadEndIndex, textCollisionFeature, iconCollisionFeature, glyphQuads, iconQuads; + if (shapedText) { + glyphQuads = addToBuffers ? getGlyphQuads(anchor, shapedText, textBoxScale, line, layer, textAlongLine) : []; + textCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shapedText, textBoxScale, textPadding, textAlongLine, false); } - - if (this.hasIcon) { - this.iconQuads = addToBuffers ? getIconQuads(anchor, shapedIcon, iconBoxScale, line, layout, iconAlongLine) : []; - this.iconCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, - shapedIcon, iconBoxScale, iconPadding, iconAlongLine, true); + glyphQuadStartIndex = this.symbolQuadsArray.length; + if (glyphQuads && glyphQuads.length) { + for (var i = 0; i < glyphQuads.length; i++) { + this.addSymbolQuad(glyphQuads[i]); + } } -} - -},{"../../symbol/anchor":303,"../../symbol/clip_line":305,"../../symbol/collision_feature":307,"../../symbol/get_anchors":309,"../../symbol/mergelines":312,"../../symbol/quads":313,"../../symbol/resolve_text":314,"../../symbol/shaping":315,"../../util/token":348,"../../util/util":349,"../bucket":247,"../load_geometry":254,"point-geometry":404}],252:[function(require,module,exports){ + glyphQuadEndIndex = this.symbolQuadsArray.length; + var textBoxStartIndex = textCollisionFeature ? textCollisionFeature.boxStartIndex : this.collisionBoxArray.length; + var textBoxEndIndex = textCollisionFeature ? textCollisionFeature.boxEndIndex : this.collisionBoxArray.length; + if (shapedIcon) { + iconQuads = addToBuffers ? getIconQuads(anchor, shapedIcon, iconBoxScale, line, layer, iconAlongLine, shapedText, globalProperties, featureProperties) : []; + iconCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shapedIcon, iconBoxScale, iconPadding, iconAlongLine, true); + } + iconQuadStartIndex = this.symbolQuadsArray.length; + if (iconQuads && iconQuads.length === 1) { + this.addSymbolQuad(iconQuads[0]); + } + iconQuadEndIndex = this.symbolQuadsArray.length; + var iconBoxStartIndex = iconCollisionFeature ? iconCollisionFeature.boxStartIndex : this.collisionBoxArray.length; + var iconBoxEndIndex = iconCollisionFeature ? iconCollisionFeature.boxEndIndex : this.collisionBoxArray.length; + return this.symbolInstancesArray.emplaceBack(textBoxStartIndex, textBoxEndIndex, iconBoxStartIndex, iconBoxEndIndex, glyphQuadStartIndex, glyphQuadEndIndex, iconQuadStartIndex, iconQuadEndIndex, anchor.x, anchor.y, index); +}; +SymbolBucket.prototype.addSymbolQuad = function (symbolQuad) { + return this.symbolQuadsArray.emplaceBack(symbolQuad.anchorPoint.x, symbolQuad.anchorPoint.y, symbolQuad.tl.x, symbolQuad.tl.y, symbolQuad.tr.x, symbolQuad.tr.y, symbolQuad.bl.x, symbolQuad.bl.y, symbolQuad.br.x, symbolQuad.br.y, symbolQuad.tex.h, symbolQuad.tex.w, symbolQuad.tex.x, symbolQuad.tex.y, symbolQuad.anchorAngle, symbolQuad.glyphAngle, symbolQuad.maxScale, symbolQuad.minScale); +}; +},{"../../symbol/anchor":315,"../../symbol/clip_line":317,"../../symbol/collision_feature":319,"../../symbol/get_anchors":321,"../../symbol/mergelines":324,"../../symbol/quads":325,"../../symbol/resolve_text":326,"../../symbol/shaping":327,"../../util/token":365,"../../util/util":366,"../bucket":253,"../load_geometry":261,"point-geometry":424}],258:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); - module.exports = Buffer; - -/** - * The `Buffer` class turns a `StructArray` into a WebGL buffer. Each member of the StructArray's - * Struct type is converted to a WebGL atribute. - * - * @class Buffer - * @private - * @param {object} array A serialized StructArray. - * @param {object} arrayType A serialized StructArrayType. - * @param {BufferType} type - */ function Buffer(array, arrayType, type) { this.arrayBuffer = array.arrayBuffer; this.length = array.length; @@ -44706,102 +45469,86 @@ function Buffer(array, arrayType, type) { this.type = type; this.arrayType = arrayType; } - -/** - * Bind this buffer to a WebGL context. - * @private - * @param gl The WebGL context - */ -Buffer.prototype.bind = function(gl) { +Buffer.prototype.bind = function (gl) { var type = gl[this.type]; - if (!this.buffer) { this.buffer = gl.createBuffer(); gl.bindBuffer(type, this.buffer); gl.bufferData(type, this.arrayBuffer, gl.STATIC_DRAW); - - // dump array buffer once it's bound to gl this.arrayBuffer = null; } else { gl.bindBuffer(type, this.buffer); } }; - -/** - * @enum {string} AttributeType - * @private - * @readonly - */ var AttributeType = { - Int8: 'BYTE', - Uint8: 'UNSIGNED_BYTE', - Int16: 'SHORT', + Int8: 'BYTE', + Uint8: 'UNSIGNED_BYTE', + Int16: 'SHORT', Uint16: 'UNSIGNED_SHORT' }; - -/** - * Set the attribute pointers in a WebGL context - * @private - * @param gl The WebGL context - * @param program The active WebGL program - */ -Buffer.prototype.setVertexAttribPointers = function(gl, program) { +Buffer.prototype.setVertexAttribPointers = function (gl, program) { for (var j = 0; j < this.attributes.length; j++) { var member = this.attributes[j]; var attribIndex = program[member.name]; - assert(attribIndex !== undefined, 'array member "' + member.name + '" name does not match shader attribute name'); - - gl.vertexAttribPointer( - attribIndex, - member.components, - gl[AttributeType[member.type]], - false, - this.arrayType.bytesPerElement, - member.offset - ); + if (attribIndex !== undefined) { + gl.vertexAttribPointer(attribIndex, member.components, gl[AttributeType[member.type]], false, this.arrayType.bytesPerElement, member.offset); + } } }; - -/** - * Destroy the GL buffer bound to the given WebGL context - * @private - * @param gl The WebGL context - */ -Buffer.prototype.destroy = function(gl) { +Buffer.prototype.destroy = function (gl) { if (this.buffer) { gl.deleteBuffer(this.buffer); } }; - -/** - * @enum {string} BufferType - * @private - * @readonly - */ Buffer.BufferType = { VERTEX: 'ARRAY_BUFFER', ELEMENT: 'ELEMENT_ARRAY_BUFFER' }; - -/** - * An `BufferType.ELEMENT` buffer holds indicies of a corresponding `BufferType.VERTEX` buffer. - * These indicies are stored in the `BufferType.ELEMENT` buffer as `UNSIGNED_SHORT`s. - * - * @private - * @readonly - */ -Buffer.ELEMENT_ATTRIBUTE_TYPE = 'Uint16'; - -/** - * WebGL performs best if vertex attribute offsets are aligned to 4 byte boundaries. - * @private - * @readonly - */ -Buffer.VERTEX_ATTRIBUTE_ALIGNMENT = 4; - -},{"assert":52}],253:[function(require,module,exports){ +},{}],259:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var Buffer = require('./buffer'); +var VertexArrayObject = require('../render/vertex_array_object'); +module.exports = BufferGroup; +function BufferGroup(arrayGroup, arrayTypes) { + this.layoutVertexBuffer = new Buffer(arrayGroup.layoutVertexArray, arrayTypes.layoutVertexArrayType, Buffer.BufferType.VERTEX); + if (arrayGroup.elementArray) { + this.elementBuffer = new Buffer(arrayGroup.elementArray, arrayTypes.elementArrayType, Buffer.BufferType.ELEMENT); + } + var vaos = this.vaos = {}; + var secondVaos; + if (arrayGroup.elementArray2) { + this.elementBuffer2 = new Buffer(arrayGroup.elementArray2, arrayTypes.elementArrayType2, Buffer.BufferType.ELEMENT); + secondVaos = this.secondVaos = {}; + } + this.paintVertexBuffers = util.mapObject(arrayGroup.paintVertexArrays, function (array, name) { + vaos[name] = new VertexArrayObject(); + if (arrayGroup.elementArray2) { + secondVaos[name] = new VertexArrayObject(); + } + return new Buffer(array, arrayTypes.paintVertexArrayTypes[name], Buffer.BufferType.VERTEX); + }); +} +BufferGroup.prototype.destroy = function (gl) { + this.layoutVertexBuffer.destroy(gl); + if (this.elementBuffer) { + this.elementBuffer.destroy(gl); + } + if (this.elementBuffer2) { + this.elementBuffer2.destroy(gl); + } + for (var n in this.paintVertexBuffers) { + this.paintVertexBuffers[n].destroy(gl); + } + for (var j in this.vaos) { + this.vaos[j].destroy(gl); + } + for (var k in this.secondVaos) { + this.secondVaos[k].destroy(gl); + } +}; +},{"../render/vertex_array_object":281,"../util/util":366,"./buffer":258}],260:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); var loadGeometry = require('./load_geometry'); var EXTENT = require('./bucket').EXTENT; @@ -44813,25 +45560,27 @@ var vt = require('vector-tile'); var Protobuf = require('pbf'); var GeoJSONFeature = require('../util/vectortile_to_geojson'); var arraysIntersect = require('../util/util').arraysIntersect; - var intersection = require('../util/intersection_tests'); var multiPolygonIntersectsBufferedMultiPoint = intersection.multiPolygonIntersectsBufferedMultiPoint; var multiPolygonIntersectsMultiPolygon = intersection.multiPolygonIntersectsMultiPolygon; var multiPolygonIntersectsBufferedMultiLine = intersection.multiPolygonIntersectsBufferedMultiLine; - - var FeatureIndexArray = new StructArrayType({ members: [ - // the index of the feature in the original vectortile - { type: 'Uint32', name: 'featureIndex' }, - // the source layer the feature appears in - { type: 'Uint16', name: 'sourceLayerIndex' }, - // the bucket the feature appears in - { type: 'Uint16', name: 'bucketIndex' } - ]}); - + { + type: 'Uint32', + name: 'featureIndex' + }, + { + type: 'Uint16', + name: 'sourceLayerIndex' + }, + { + type: 'Uint16', + name: 'bucketIndex' + } + ] +}); module.exports = FeatureIndex; - function FeatureIndex(coord, overscaling, collisionTile) { if (coord.grid) { var serialized = coord; @@ -44853,18 +45602,18 @@ function FeatureIndex(coord, overscaling, collisionTile) { this.z = coord.z - Math.log(overscaling) / Math.LN2; this.setCollisionTile(collisionTile); } - -FeatureIndex.prototype.insert = function(feature, featureIndex, sourceLayerIndex, bucketIndex) { +FeatureIndex.prototype.insert = function (feature, featureIndex, sourceLayerIndex, bucketIndex) { var key = this.featureIndexArray.length; this.featureIndexArray.emplaceBack(featureIndex, sourceLayerIndex, bucketIndex); var geometry = loadGeometry(feature); - for (var r = 0; r < geometry.length; r++) { var ring = geometry[r]; - - // TODO: skip holes when we start using vector tile spec 2.0 - - var bbox = [Infinity, Infinity, -Infinity, -Infinity]; + var bbox = [ + Infinity, + Infinity, + -Infinity, + -Infinity + ]; for (var i = 0; i < ring.length; i++) { var p = ring[i]; bbox[0] = Math.min(bbox[0], p.x); @@ -44872,16 +45621,13 @@ FeatureIndex.prototype.insert = function(feature, featureIndex, sourceLayerIndex bbox[2] = Math.max(bbox[2], p.x); bbox[3] = Math.max(bbox[3], p.y); } - this.grid.insert(key, bbox[0], bbox[1], bbox[2], bbox[3]); } }; - -FeatureIndex.prototype.setCollisionTile = function(collisionTile) { +FeatureIndex.prototype.setCollisionTile = function (collisionTile) { this.collisionTile = collisionTile; }; - -FeatureIndex.prototype.serialize = function() { +FeatureIndex.prototype.serialize = function () { var data = { coord: this.coord, overscaling: this.overscaling, @@ -44891,35 +45637,26 @@ FeatureIndex.prototype.serialize = function() { }; return { data: data, - transferables: [data.grid, data.featureIndexArray.arrayBuffer] + transferables: [ + data.grid, + data.featureIndexArray.arrayBuffer + ] }; }; - function translateDistance(translate) { return Math.sqrt(translate[0] * translate[0] + translate[1] * translate[1]); } - -// Finds features in this tile at a particular position. -FeatureIndex.prototype.query = function(args, styleLayers) { +FeatureIndex.prototype.query = function (args, styleLayers) { if (!this.vtLayers) { this.vtLayers = new vt.VectorTile(new Protobuf(new Uint8Array(this.rawTileData))).layers; this.sourceLayerCoder = new DictionaryCoder(this.vtLayers ? Object.keys(this.vtLayers).sort() : ['_geojsonTileLayer']); } - var result = {}; - - var params = args.params || {}, - pixelsToTileUnits = EXTENT / args.tileSize / args.scale, - filter = featureFilter(params.filter); - - // Features are indexed their original geometries. The rendered geometries may - // be buffered, translated or offset. Figure out how much the search radius needs to be - // expanded by to include these features. + var params = args.params || {}, pixelsToTileUnits = EXTENT / args.tileSize / args.scale, filter = featureFilter(params.filter); var additionalRadius = 0; for (var id in styleLayers) { var styleLayer = styleLayers[id]; var paint = styleLayer.paint; - var styleLayerDistance = 0; if (styleLayer.type === 'line') { styleLayerDistance = getLineWidth(paint) / 2 + Math.abs(paint['line-offset']) + translateDistance(paint['line-translate']); @@ -44930,13 +45667,11 @@ FeatureIndex.prototype.query = function(args, styleLayers) { } additionalRadius = Math.max(additionalRadius, styleLayerDistance * pixelsToTileUnits); } - - var queryGeometry = args.queryGeometry.map(function(q) { - return q.map(function(p) { + var queryGeometry = args.queryGeometry.map(function (q) { + return q.map(function (p) { return new Point(p.x, p.y); }); }); - var minX = Infinity; var minY = Infinity; var maxX = -Infinity; @@ -44951,22 +45686,17 @@ FeatureIndex.prototype.query = function(args, styleLayers) { maxY = Math.max(maxY, p.y); } } - var matching = this.grid.query(minX - additionalRadius, minY - additionalRadius, maxX + additionalRadius, maxY + additionalRadius); matching.sort(topDownFeatureComparator); this.filterMatching(result, matching, this.featureIndexArray, queryGeometry, filter, params.layers, styleLayers, args.bearing, pixelsToTileUnits); - var matchingSymbols = this.collisionTile.queryRenderedSymbols(minX, minY, maxX, maxY, args.scale); matchingSymbols.sort(); this.filterMatching(result, matchingSymbols, this.collisionTile.collisionBoxArray, queryGeometry, filter, params.layers, styleLayers, args.bearing, pixelsToTileUnits); - return result; }; - function topDownFeatureComparator(a, b) { return b - a; } - function getLineWidth(paint) { if (paint['line-gap-width'] > 0) { return paint['line-gap-width'] + 2 * paint['line-width']; @@ -44974,76 +45704,57 @@ function getLineWidth(paint) { return paint['line-width']; } } - -FeatureIndex.prototype.filterMatching = function(result, matching, array, queryGeometry, filter, filterLayerIDs, styleLayers, bearing, pixelsToTileUnits) { +FeatureIndex.prototype.filterMatching = function (result, matching, array, queryGeometry, filter, filterLayerIDs, styleLayers, bearing, pixelsToTileUnits) { var previousIndex; for (var k = 0; k < matching.length; k++) { var index = matching[k]; - - // don't check the same feature more than once - if (index === previousIndex) continue; + if (index === previousIndex) + continue; previousIndex = index; - var match = array.get(index); - var layerIDs = this.bucketLayerIDs[match.bucketIndex]; - if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs)) continue; - + if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs)) + continue; var sourceLayerName = this.sourceLayerCoder.decode(match.sourceLayerIndex); var sourceLayer = this.vtLayers[sourceLayerName]; var feature = sourceLayer.feature(match.featureIndex); - - if (!filter(feature)) continue; - + if (!filter(feature)) + continue; var geometry = null; - for (var l = 0; l < layerIDs.length; l++) { var layerID = layerIDs[l]; - if (filterLayerIDs && filterLayerIDs.indexOf(layerID) < 0) { continue; } - var styleLayer = styleLayers[layerID]; - if (!styleLayer) continue; - + if (!styleLayer) + continue; var translatedPolygon; if (styleLayer.type !== 'symbol') { - // all symbols already match the style - - if (!geometry) geometry = loadGeometry(feature); - + if (!geometry) + geometry = loadGeometry(feature); var paint = styleLayer.paint; - if (styleLayer.type === 'line') { - translatedPolygon = translate(queryGeometry, - paint['line-translate'], paint['line-translate-anchor'], - bearing, pixelsToTileUnits); + translatedPolygon = translate(queryGeometry, paint['line-translate'], paint['line-translate-anchor'], bearing, pixelsToTileUnits); var halfWidth = getLineWidth(paint) / 2 * pixelsToTileUnits; if (paint['line-offset']) { geometry = offsetLine(geometry, paint['line-offset'] * pixelsToTileUnits); } - if (!multiPolygonIntersectsBufferedMultiLine(translatedPolygon, geometry, halfWidth)) continue; - + if (!multiPolygonIntersectsBufferedMultiLine(translatedPolygon, geometry, halfWidth)) + continue; } else if (styleLayer.type === 'fill') { - translatedPolygon = translate(queryGeometry, - paint['fill-translate'], paint['fill-translate-anchor'], - bearing, pixelsToTileUnits); - if (!multiPolygonIntersectsMultiPolygon(translatedPolygon, geometry)) continue; - + translatedPolygon = translate(queryGeometry, paint['fill-translate'], paint['fill-translate-anchor'], bearing, pixelsToTileUnits); + if (!multiPolygonIntersectsMultiPolygon(translatedPolygon, geometry)) + continue; } else if (styleLayer.type === 'circle') { - translatedPolygon = translate(queryGeometry, - paint['circle-translate'], paint['circle-translate-anchor'], - bearing, pixelsToTileUnits); + translatedPolygon = translate(queryGeometry, paint['circle-translate'], paint['circle-translate-anchor'], bearing, pixelsToTileUnits); var circleRadius = paint['circle-radius'] * pixelsToTileUnits; - if (!multiPolygonIntersectsBufferedMultiPoint(translatedPolygon, geometry, circleRadius)) continue; + if (!multiPolygonIntersectsBufferedMultiPoint(translatedPolygon, geometry, circleRadius)) + continue; } } - var geojsonFeature = new GeoJSONFeature(feature, this.z, this.x, this.y); - geojsonFeature.layer = styleLayer.serialize({ - includeRefProperties: true - }); + geojsonFeature.layer = styleLayer.serialize({ includeRefProperties: true }); var layerResult = result[layerID]; if (layerResult === undefined) { layerResult = result[layerID] = []; @@ -45052,18 +45763,14 @@ FeatureIndex.prototype.filterMatching = function(result, matching, array, queryG } } }; - function translate(queryGeometry, translate, translateAnchor, bearing, pixelsToTileUnits) { if (!translate[0] && !translate[1]) { return queryGeometry; } - translate = Point.convert(translate); - - if (translateAnchor === "viewport") { + if (translateAnchor === 'viewport') { translate._rotate(-bearing); } - var translated = []; for (var i = 0; i < queryGeometry.length; i++) { var ring = queryGeometry[i]; @@ -45075,7 +45782,6 @@ function translate(queryGeometry, translate, translateAnchor, bearing, pixelsToT } return translated; } - function offsetLine(rings, offset) { var newRings = []; var zero = new Point(0, 0); @@ -45089,160 +45795,81 @@ function offsetLine(rings, offset) { var aToB = i === 0 ? zero : b.sub(a)._unit()._perp(); var bToC = i === ring.length - 1 ? zero : c.sub(b)._unit()._perp(); var extrude = aToB._add(bToC)._unit(); - var cosHalfAngle = extrude.x * bToC.x + extrude.y * bToC.y; extrude._mult(1 / cosHalfAngle); - newRing.push(extrude._mult(offset)._add(b)); } newRings.push(newRing); } return newRings; } - -},{"../util/dictionary_coder":340,"../util/intersection_tests":344,"../util/struct_array":347,"../util/util":349,"../util/vectortile_to_geojson":350,"./bucket":247,"./load_geometry":254,"feature-filter":352,"grid-index":373,"pbf":402,"point-geometry":404,"vector-tile":413}],254:[function(require,module,exports){ +},{"../util/dictionary_coder":356,"../util/intersection_tests":361,"../util/struct_array":364,"../util/util":366,"../util/vectortile_to_geojson":367,"./bucket":253,"./load_geometry":261,"feature-filter":370,"grid-index":392,"pbf":422,"point-geometry":424,"vector-tile":434}],261:[function(require,module,exports){ 'use strict'; - +var util = require('../util/util'); var EXTENT = require('./bucket').EXTENT; -var EXTENT_MIN = EXTENT * -2; -var EXTENT_MAX = (EXTENT * 2) - 1; - -// only log a geometry warning once per context -var warned = false; - -/** - * Loads a geometry from a VectorTileFeature and scales it to the common extent - * used internally. - * @private - */ -module.exports = function loadGeometry(feature) { +function createBounds(bits) { + return { + min: -1 * Math.pow(2, bits - 1), + max: Math.pow(2, bits - 1) - 1 + }; +} +var boundsLookup = { + 15: createBounds(15), + 16: createBounds(16) +}; +module.exports = function loadGeometry(feature, bits) { + var bounds = boundsLookup[bits || 16]; var scale = EXTENT / feature.extent; var geometry = feature.loadGeometry(); for (var r = 0; r < geometry.length; r++) { var ring = geometry[r]; for (var p = 0; p < ring.length; p++) { var point = ring[p]; - // round here because mapbox-gl-native uses integers to represent - // points and we need to do the same to avoid renering differences. point.x = Math.round(point.x * scale); point.y = Math.round(point.y * scale); - if (warned === false && ( - point.x < EXTENT_MIN || - point.x > EXTENT_MAX || - point.y < EXTENT_MIN || - point.y > EXTENT_MAX)) { - console.warn('Geometry exceeds allowed extent, reduce your vector tile buffer size'); - warned = true; + if (point.x < bounds.min || point.x > bounds.max || point.y < bounds.min || point.y > bounds.max) { + util.warnOnce('Geometry exceeds allowed extent, reduce your vector tile buffer size'); } } } return geometry; }; - -},{"./bucket":247}],255:[function(require,module,exports){ +},{"../util/util":366,"./bucket":253}],262:[function(require,module,exports){ 'use strict'; - module.exports = Coordinate; - -/** - * A coordinate is a column, row, zoom combination, often used - * as the data component of a tile. - * - * @param {number} column - * @param {number} row - * @param {number} zoom - * @private - */ function Coordinate(column, row, zoom) { this.column = column; this.row = row; this.zoom = zoom; } - Coordinate.prototype = { - - /** - * Create a clone of this coordinate that can be mutated without - * changing the original coordinate - * - * @returns {Coordinate} clone - * @private - * var coord = new Coordinate(0, 0, 0); - * var c2 = coord.clone(); - * // since coord is cloned, modifying a property of c2 does - * // not modify it. - * c2.zoom = 2; - */ - clone: function() { + clone: function () { return new Coordinate(this.column, this.row, this.zoom); }, - - /** - * Zoom this coordinate to a given zoom level. This returns a new - * coordinate object, not mutating the old one. - * - * @param {number} zoom - * @returns {Coordinate} zoomed coordinate - * @private - * @example - * var coord = new Coordinate(0, 0, 0); - * var c2 = coord.zoomTo(1); - * c2 // equals new Coordinate(0, 0, 1); - */ - zoomTo: function(zoom) { return this.clone()._zoomTo(zoom); }, - - /** - * Subtract the column and row values of this coordinate from those - * of another coordinate. The other coordinat will be zoomed to the - * same level as `this` before the subtraction occurs - * - * @param {Coordinate} c other coordinate - * @returns {Coordinate} result - * @private - */ - sub: function(c) { return this.clone()._sub(c); }, - - _zoomTo: function(zoom) { + zoomTo: function (zoom) { + return this.clone()._zoomTo(zoom); + }, + sub: function (c) { + return this.clone()._sub(c); + }, + _zoomTo: function (zoom) { var scale = Math.pow(2, zoom - this.zoom); this.column *= scale; this.row *= scale; this.zoom = zoom; return this; }, - - _sub: function(c) { + _sub: function (c) { c = c.zoomTo(this.zoom); this.column -= c.column; this.row -= c.row; return this; } }; - -},{}],256:[function(require,module,exports){ +},{}],263:[function(require,module,exports){ 'use strict'; - module.exports = LngLat; - var wrap = require('../util/util').wrap; - -/** - * Create a longitude, latitude object from a given longitude and latitude pair in degrees. - * Mapbox GL uses Longitude, Latitude coordinate order to match GeoJSON. - * - * Note that any Mapbox GL method that accepts a `LngLat` object can also accept an - * `Array` and will perform an implicit conversion. The following lines are equivalent: - ``` - map.setCenter([-73.9749, 40.7736]); - map.setCenter( new mapboxgl.LngLat(-73.9749, 40.7736) ); - ``` - * - * @class LngLat - * @classdesc A representation of a longitude, latitude point, in degrees. - * @param {number} lng longitude - * @param {number} lat latitude - * @example - * var ll = new mapboxgl.LngLat(-73.9749, 40.7736); - */ function LngLat(lng, lat) { if (isNaN(lng) || isNaN(lat)) { throw new Error('Invalid LngLat object: (' + lng + ', ' + lat + ')'); @@ -45253,55 +45880,18 @@ function LngLat(lng, lat) { throw new Error('Invalid LngLat latitude value: must be between -90 and 90'); } } - -/** - * Return a new `LngLat` object whose longitude is wrapped to the range (-180, 180). - * - * @returns {LngLat} wrapped LngLat object - * @example - * var ll = new mapboxgl.LngLat(286.0251, 40.7736); - * var wrapped = ll.wrap(); - * wrapped.lng; // = -73.9749 - */ LngLat.prototype.wrap = function () { return new LngLat(wrap(this.lng, -180, 180), this.lat); }; - -/** - * Return a `LngLat` as an array - * - * @returns {array} [lng, lat] - * @example - * var ll = new mapboxgl.LngLat(-73.9749, 40.7736); - * ll.toArray(); // = [-73.9749, 40.7736] - */ LngLat.prototype.toArray = function () { - return [this.lng, this.lat]; + return [ + this.lng, + this.lat + ]; }; - -/** - * Return a `LngLat` as a string - * - * @returns {string} "LngLat(lng, lat)" - * @example - * var ll = new mapboxgl.LngLat(-73.9749, 40.7736); - * ll.toString(); // = "LngLat(-73.9749, 40.7736)" - */ LngLat.prototype.toString = function () { return 'LngLat(' + this.lng + ', ' + this.lat + ')'; }; - -/** - * Convert an array to a `LngLat` object, or return an existing `LngLat` object - * unchanged. - * - * @param {Array|LngLat} input `input` to convert - * @returns {LngLat} LngLat object or original input - * @example - * var arr = [-73.9749, 40.7736]; - * var ll = mapboxgl.LngLat.convert(arr); - * ll; // = LngLat {lng: -73.9749, lat: 40.7736} - */ LngLat.convert = function (input) { if (input instanceof LngLat) { return input; @@ -45311,215 +45901,107 @@ LngLat.convert = function (input) { } return input; }; - -},{"../util/util":349}],257:[function(require,module,exports){ +},{"../util/util":366}],264:[function(require,module,exports){ 'use strict'; - module.exports = LngLatBounds; - var LngLat = require('./lng_lat'); - -/** - * Creates a bounding box from the given pair of points. If parameteres are omitted, a `null` bounding box is created. - * - * @class LngLatBounds - * @classdesc A representation of rectangular box on the earth, defined by its southwest and northeast points in longitude and latitude. - * @param {LngLat} sw southwest - * @param {LngLat} ne northeast - * @example - * var sw = new mapboxgl.LngLat(-73.9876, 40.7661); - * var ne = new mapboxgl.LngLat(-73.9397, 40.8002); - * var llb = new mapboxgl.LngLatBounds(sw, ne); - */ function LngLatBounds(sw, ne) { if (!sw) { return; } else if (ne) { this.extend(sw).extend(ne); } else if (sw.length === 4) { - this.extend([sw[0], sw[1]]).extend([sw[2], sw[3]]); + this.extend([ + sw[0], + sw[1] + ]).extend([ + sw[2], + sw[3] + ]); } else { this.extend(sw[0]).extend(sw[1]); } } - LngLatBounds.prototype = { - - /** - * Extend the bounds to include a given LngLat or LngLatBounds. - * - * @param {LngLat|LngLatBounds} obj object to extend to - * @returns {LngLatBounds} `this` - */ - extend: function(obj) { - var sw = this._sw, - ne = this._ne, - sw2, ne2; - + extend: function (obj) { + var sw = this._sw, ne = this._ne, sw2, ne2; if (obj instanceof LngLat) { sw2 = obj; ne2 = obj; - } else if (obj instanceof LngLatBounds) { sw2 = obj._sw; ne2 = obj._ne; - - if (!sw2 || !ne2) return this; - + if (!sw2 || !ne2) + return this; } else { return obj ? this.extend(LngLat.convert(obj) || LngLatBounds.convert(obj)) : this; } - if (!sw && !ne) { this._sw = new LngLat(sw2.lng, sw2.lat); this._ne = new LngLat(ne2.lng, ne2.lat); - } else { sw.lng = Math.min(sw2.lng, sw.lng); sw.lat = Math.min(sw2.lat, sw.lat); ne.lng = Math.max(ne2.lng, ne.lng); ne.lat = Math.max(ne2.lat, ne.lat); } - return this; }, - - /** - * Get the point equidistant from this box's corners - * @returns {LngLat} centerpoint - * @example - * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); - * llb.getCenter(); // = LngLat {lng: -73.96365, lat: 40.78315} - */ - getCenter: function() { + getCenter: function () { return new LngLat((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2); }, - - /** - * Get southwest corner - * @returns {LngLat} southwest - */ - getSouthWest: function() { return this._sw; }, - - /** - * Get northeast corner - * @returns {LngLat} northeast - */ - getNorthEast: function() { return this._ne; }, - - /** - * Get northwest corner - * @returns {LngLat} northwest - */ - getNorthWest: function() { return new LngLat(this.getWest(), this.getNorth()); }, - - /** - * Get southeast corner - * @returns {LngLat} southeast - */ - getSouthEast: function() { return new LngLat(this.getEast(), this.getSouth()); }, - - /** - * Get west edge longitude - * @returns {number} west - */ - getWest: function() { return this._sw.lng; }, - - /** - * Get south edge latitude - * @returns {number} south - */ - getSouth: function() { return this._sw.lat; }, - - /** - * Get east edge longitude - * @returns {number} east - */ - getEast: function() { return this._ne.lng; }, - - /** - * Get north edge latitude - * @returns {number} north - */ - getNorth: function() { return this._ne.lat; }, - - /** - * Return a `LngLatBounds` as an array - * - * @returns {array} [lng, lat] - * @example - * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); - * llb.toArray(); // = [[-73.9876, 40.7661], [-73.9397, 40.8002]] - */ + getSouthWest: function () { + return this._sw; + }, + getNorthEast: function () { + return this._ne; + }, + getNorthWest: function () { + return new LngLat(this.getWest(), this.getNorth()); + }, + getSouthEast: function () { + return new LngLat(this.getEast(), this.getSouth()); + }, + getWest: function () { + return this._sw.lng; + }, + getSouth: function () { + return this._sw.lat; + }, + getEast: function () { + return this._ne.lng; + }, + getNorth: function () { + return this._ne.lat; + }, toArray: function () { - return [this._sw.toArray(), this._ne.toArray()]; + return [ + this._sw.toArray(), + this._ne.toArray() + ]; }, - - /** - * Return a `LngLatBounds` as a string - * - * @returns {string} "LngLatBounds(LngLat(lng, lat), LngLat(lng, lat))" - * @example - * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); - * llb.toString(); // = "LngLatBounds(LngLat(-73.9876, 40.7661), LngLat(-73.9397, 40.8002))" - */ toString: function () { return 'LngLatBounds(' + this._sw.toString() + ', ' + this._ne.toString() + ')'; } }; - -/** - * Convert an array to a `LngLatBounds` object, or return an existing - * `LngLatBounds` object unchanged. - * - * Calls `LngLat#convert` internally to convert arrays as `LngLat` values. - * - * @param {LngLatBounds|Array|Array>} input input to convert to a LngLatBounds - * @returns {LngLatBounds} LngLatBounds object or original input - * @example - * var arr = [[-73.9876, 40.7661], [-73.9397, 40.8002]]; - * var llb = mapboxgl.LngLatBounds.convert(arr); - * llb; // = LngLatBounds {_sw: LngLat {lng: -73.9876, lat: 40.7661}, _ne: LngLat {lng: -73.9397, lat: 40.8002}} - */ LngLatBounds.convert = function (input) { - if (!input || input instanceof LngLatBounds) return input; + if (!input || input instanceof LngLatBounds) + return input; return new LngLatBounds(input); }; - -},{"./lng_lat":256}],258:[function(require,module,exports){ +},{"./lng_lat":263}],265:[function(require,module,exports){ 'use strict'; - -var LngLat = require('./lng_lat'), - Point = require('point-geometry'), - Coordinate = require('./coordinate'), - wrap = require('../util/util').wrap, - interp = require('../util/interpolate'), - TileCoord = require('../source/tile_coord'), - EXTENT = require('../data/bucket').EXTENT, - glmatrix = require('gl-matrix'); - -var vec4 = glmatrix.vec4, - mat4 = glmatrix.mat4, - mat2 = glmatrix.mat2; - +var LngLat = require('./lng_lat'), Point = require('point-geometry'), Coordinate = require('./coordinate'), wrap = require('../util/util').wrap, interp = require('../util/interpolate'), TileCoord = require('../source/tile_coord'), EXTENT = require('../data/bucket').EXTENT, glmatrix = require('gl-matrix'); +var vec4 = glmatrix.vec4, mat4 = glmatrix.mat4, mat2 = glmatrix.mat2; module.exports = Transform; - -/** - * A single transform, generally used for a single tile to be - * scaled, rotated, and zoomed. - * - * @param {number} minZoom - * @param {number} maxZoom - * @private - */ function Transform(minZoom, maxZoom) { - this.tileSize = 512; // constant - + this.tileSize = 512; this._minZoom = minZoom || 0; this._maxZoom = maxZoom || 22; - - this.latRange = [-85.05113, 85.05113]; - + this.latRange = [ + -85.05113, + 85.05113 + ]; this.width = 0; this.height = 0; this._center = new LngLat(0, 0); @@ -45529,160 +46011,168 @@ function Transform(minZoom, maxZoom) { this._pitch = 0; this._unmodified = true; } - Transform.prototype = { - get minZoom() { return this._minZoom; }, + get minZoom() { + return this._minZoom; + }, set minZoom(zoom) { - if (this._minZoom === zoom) return; + if (this._minZoom === zoom) + return; this._minZoom = zoom; this.zoom = Math.max(this.zoom, zoom); }, - - get maxZoom() { return this._maxZoom; }, + get maxZoom() { + return this._maxZoom; + }, set maxZoom(zoom) { - if (this._maxZoom === zoom) return; + if (this._maxZoom === zoom) + return; this._maxZoom = zoom; this.zoom = Math.min(this.zoom, zoom); }, - get worldSize() { return this.tileSize * this.scale; }, - get centerPoint() { return this.size._div(2); }, - get size() { return new Point(this.width, this.height); }, - get bearing() { return -this.angle / Math.PI * 180; }, set bearing(bearing) { var b = -wrap(bearing, -180, 180) * Math.PI / 180; - if (this.angle === b) return; + if (this.angle === b) + return; this._unmodified = false; this.angle = b; - this._calcProjMatrix(); - - // 2x2 matrix for rotating points + this._calcMatrices(); this.rotationMatrix = mat2.create(); mat2.rotate(this.rotationMatrix, this.rotationMatrix, this.angle); }, - get pitch() { return this._pitch / Math.PI * 180; }, set pitch(pitch) { var p = Math.min(60, pitch) / 180 * Math.PI; - if (this._pitch === p) return; + if (this._pitch === p) + return; this._unmodified = false; this._pitch = p; - this._calcProjMatrix(); + this._calcMatrices(); }, - get altitude() { return this._altitude; }, set altitude(altitude) { var a = Math.max(0.75, altitude); - if (this._altitude === a) return; + if (this._altitude === a) + return; this._unmodified = false; this._altitude = a; - this._calcProjMatrix(); + this._calcMatrices(); + }, + get zoom() { + return this._zoom; }, - - get zoom() { return this._zoom; }, set zoom(zoom) { var z = Math.min(Math.max(zoom, this.minZoom), this.maxZoom); - if (this._zoom === z) return; + if (this._zoom === z) + return; this._unmodified = false; this._zoom = z; this.scale = this.zoomScale(z); this.tileZoom = Math.floor(z); this.zoomFraction = z - this.tileZoom; - this._calcProjMatrix(); + this._calcMatrices(); this._constrain(); }, - - get center() { return this._center; }, + get center() { + return this._center; + }, set center(center) { - if (center.lat === this._center.lat && center.lng === this._center.lng) return; + if (center.lat === this._center.lat && center.lng === this._center.lng) + return; this._unmodified = false; this._center = center; - this._calcProjMatrix(); + this._calcMatrices(); this._constrain(); }, - - resize: function(width, height) { + coveringZoomLevel: function (options) { + return (options.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / options.tileSize)); + }, + coveringTiles: function (options) { + var z = this.coveringZoomLevel(options); + var actualZ = z; + if (z < options.minzoom) + return []; + if (z > options.maxzoom) + z = options.maxzoom; + var tr = this, tileCenter = tr.locationCoordinate(tr.center)._zoomTo(z), centerPoint = new Point(tileCenter.column - 0.5, tileCenter.row - 0.5); + return TileCoord.cover(z, [ + tr.pointCoordinate(new Point(0, 0))._zoomTo(z), + tr.pointCoordinate(new Point(tr.width, 0))._zoomTo(z), + tr.pointCoordinate(new Point(tr.width, tr.height))._zoomTo(z), + tr.pointCoordinate(new Point(0, tr.height))._zoomTo(z) + ], options.reparseOverscaled ? actualZ : z).sort(function (a, b) { + return centerPoint.dist(a) - centerPoint.dist(b); + }); + }, + resize: function (width, height) { this.width = width; this.height = height; - - this.pixelsToGLUnits = [2 / width, -2 / height]; - this._calcProjMatrix(); + this.pixelsToGLUnits = [ + 2 / width, + -2 / height + ]; + this._calcMatrices(); this._constrain(); }, - - get unmodified() { return this._unmodified; }, - - zoomScale: function(zoom) { return Math.pow(2, zoom); }, - scaleZoom: function(scale) { return Math.log(scale) / Math.LN2; }, - - project: function(lnglat, worldSize) { - return new Point( - this.lngX(lnglat.lng, worldSize), - this.latY(lnglat.lat, worldSize)); + get unmodified() { + return this._unmodified; }, - - unproject: function(point, worldSize) { - return new LngLat( - this.xLng(point.x, worldSize), - this.yLat(point.y, worldSize)); + zoomScale: function (zoom) { + return Math.pow(2, zoom); }, - - get x() { return this.lngX(this.center.lng); }, - get y() { return this.latY(this.center.lat); }, - - get point() { return new Point(this.x, this.y); }, - - /** - * latitude to absolute x coord - * @param {number} lon - * @param {number} [worldSize=this.worldSize] - * @returns {number} pixel coordinate - * @private - */ - lngX: function(lng, worldSize) { + scaleZoom: function (scale) { + return Math.log(scale) / Math.LN2; + }, + project: function (lnglat, worldSize) { + return new Point(this.lngX(lnglat.lng, worldSize), this.latY(lnglat.lat, worldSize)); + }, + unproject: function (point, worldSize) { + return new LngLat(this.xLng(point.x, worldSize), this.yLat(point.y, worldSize)); + }, + get x() { + return this.lngX(this.center.lng); + }, + get y() { + return this.latY(this.center.lat); + }, + get point() { + return new Point(this.x, this.y); + }, + lngX: function (lng, worldSize) { return (180 + lng) * (worldSize || this.worldSize) / 360; }, - /** - * latitude to absolute y coord - * @param {number} lat - * @param {number} [worldSize=this.worldSize] - * @returns {number} pixel coordinate - * @private - */ - latY: function(lat, worldSize) { + latY: function (lat, worldSize) { var y = 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360)); return (180 - y) * (worldSize || this.worldSize) / 360; }, - - xLng: function(x, worldSize) { + xLng: function (x, worldSize) { return x * 360 / (worldSize || this.worldSize) - 180; }, - yLat: function(y, worldSize) { + yLat: function (y, worldSize) { var y2 = 180 - y * 360 / (worldSize || this.worldSize); return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90; }, - - panBy: function(offset) { + panBy: function (offset) { var point = this.centerPoint._add(offset); this.center = this.pointLocation(point); }, - - setLocationAtPoint: function(lnglat, point) { + setLocationAtPoint: function (lnglat, point) { var c = this.locationCoordinate(lnglat); var coordAtPoint = this.pointCoordinate(point); var coordCenter = this.pointCoordinate(this.centerPoint); @@ -45690,77 +46180,36 @@ Transform.prototype = { this._unmodified = false; this.center = this.coordinateLocation(coordCenter._sub(translate)); }, - - /** - * Given a location, return the screen point that corresponds to it - * @param {LngLat} lnglat location - * @returns {Point} screen point - * @private - */ - locationPoint: function(lnglat) { + locationPoint: function (lnglat) { return this.coordinatePoint(this.locationCoordinate(lnglat)); }, - - /** - * Given a point on screen, return its lnglat - * @param {Point} p screen point - * @returns {LngLat} lnglat location - * @private - */ - pointLocation: function(p) { + pointLocation: function (p) { return this.coordinateLocation(this.pointCoordinate(p)); }, - - /** - * Given a geographical lnglat, return an unrounded - * coordinate that represents it at this transform's zoom level and - * worldsize. - * @param {LngLat} lnglat - * @returns {Coordinate} - * @private - */ - locationCoordinate: function(lnglat) { - var k = this.zoomScale(this.tileZoom) / this.worldSize, - ll = LngLat.convert(lnglat); - - return new Coordinate( - this.lngX(ll.lng) * k, - this.latY(ll.lat) * k, - this.tileZoom); + locationCoordinate: function (lnglat) { + var k = this.zoomScale(this.tileZoom) / this.worldSize, ll = LngLat.convert(lnglat); + return new Coordinate(this.lngX(ll.lng) * k, this.latY(ll.lat) * k, this.tileZoom); }, - - /** - * Given a Coordinate, return its geographical position. - * @param {Coordinate} coord - * @returns {LngLat} lnglat - * @private - */ - coordinateLocation: function(coord) { + coordinateLocation: function (coord) { var worldSize = this.zoomScale(coord.zoom); - return new LngLat( - this.xLng(coord.column, worldSize), - this.yLat(coord.row, worldSize)); + return new LngLat(this.xLng(coord.column, worldSize), this.yLat(coord.row, worldSize)); }, - - pointCoordinate: function(p) { - + pointCoordinate: function (p) { var targetZ = 0; - - var matrix = this.coordinatePointMatrix(this.tileZoom); - mat4.invert(matrix, matrix); - - if (!matrix) throw new Error("failed to invert matrix"); - - // since we don't know the correct projected z value for the point, - // unproject two points to get a line and then find the point on that - // line with z=0 - - var coord0 = [p.x, p.y, 0, 1]; - var coord1 = [p.x, p.y, 1, 1]; - - vec4.transformMat4(coord0, coord0, matrix); - vec4.transformMat4(coord1, coord1, matrix); - + var coord0 = [ + p.x, + p.y, + 0, + 1 + ]; + var coord1 = [ + p.x, + p.y, + 1, + 1 + ]; + vec4.transformMat4(coord0, coord0, this.pixelMatrixInverse); + vec4.transformMat4(coord1, coord1, this.pixelMatrixInverse); var w0 = coord0[3]; var w1 = coord1[3]; var x0 = coord0[0] / w0; @@ -45769,371 +46218,3088 @@ Transform.prototype = { var y1 = coord1[1] / w1; var z0 = coord0[2] / w0; var z1 = coord1[2] / w1; - - var t = z0 === z1 ? 0 : (targetZ - z0) / (z1 - z0); - - return new Coordinate( - interp(x0, x1, t), - interp(y0, y1, t), - this.tileZoom); - }, - - /** - * Given a coordinate, return the screen point that corresponds to it - * @param {Coordinate} coord - * @returns {Point} screen point - * @private - */ - coordinatePoint: function(coord) { - var matrix = this.coordinatePointMatrix(coord.zoom); - var p = [coord.column, coord.row, 0, 1]; - vec4.transformMat4(p, p, matrix); + var scale = this.worldSize / this.zoomScale(this.tileZoom); + return new Coordinate(interp(x0, x1, t) / scale, interp(y0, y1, t) / scale, this.tileZoom); + }, + coordinatePoint: function (coord) { + var scale = this.worldSize / this.zoomScale(coord.zoom); + var p = [ + coord.column * scale, + coord.row * scale, + 0, + 1 + ]; + vec4.transformMat4(p, p, this.pixelMatrix); return new Point(p[0] / p[3], p[1] / p[3]); }, - - coordinatePointMatrix: function(z) { - var proj = mat4.copy(new Float64Array(16), this.projMatrix); - var scale = this.worldSize / this.zoomScale(z); - mat4.scale(proj, proj, [scale, scale, 1]); - mat4.multiply(proj, this.getPixelMatrix(), proj); - return proj; - }, - - /** - * converts gl coordinates -1..1 to pixels 0..width - * @returns {Object} matrix - * @private - */ - getPixelMatrix: function() { - var m = mat4.create(); - mat4.scale(m, m, [this.width / 2, -this.height / 2, 1]); - mat4.translate(m, m, [1, -1, 0]); - return m; - }, - - /** - * Calculate the posMatrix that, given a tile coordinate, would be used to display the tile on a map. - * @param {TileCoord|Coordinate} coord - * @param {Number} maxZoom maximum source zoom to account for overscaling - * @private - */ - calculatePosMatrix: function(coord, maxZoom) { - if (maxZoom === undefined) maxZoom = Infinity; - if (coord instanceof TileCoord) coord = coord.toCoordinate(maxZoom); - - // Initialize model-view matrix that converts from the tile coordinates to screen coordinates. - - // if z > maxzoom then the tile is actually a overscaled maxzoom tile, - // so calculate the matrix the maxzoom tile would use. + calculatePosMatrix: function (coord, maxZoom) { + if (maxZoom === undefined) + maxZoom = Infinity; + if (coord instanceof TileCoord) + coord = coord.toCoordinate(maxZoom); var z = Math.min(coord.zoom, maxZoom); - var scale = this.worldSize / Math.pow(2, z); var posMatrix = new Float64Array(16); - mat4.identity(posMatrix); - mat4.translate(posMatrix, posMatrix, [coord.column * scale, coord.row * scale, 0]); - mat4.scale(posMatrix, posMatrix, [ scale / EXTENT, scale / EXTENT, 1 ]); + mat4.translate(posMatrix, posMatrix, [ + coord.column * scale, + coord.row * scale, + 0 + ]); + mat4.scale(posMatrix, posMatrix, [ + scale / EXTENT, + scale / EXTENT, + 1 + ]); mat4.multiply(posMatrix, this.projMatrix, posMatrix); - return new Float32Array(posMatrix); }, - - _constrain: function() { - if (!this.center || !this.width || !this.height || this._constraining) return; - + _constrain: function () { + if (!this.center || !this.width || !this.height || this._constraining) + return; this._constraining = true; - - var minY, maxY, minX, maxX, sy, sx, x2, y2, - size = this.size, - unmodified = this._unmodified; - + var minY, maxY, minX, maxX, sy, sx, x2, y2, size = this.size, unmodified = this._unmodified; if (this.latRange) { minY = this.latY(this.latRange[1]); maxY = this.latY(this.latRange[0]); sy = maxY - minY < size.y ? size.y / (maxY - minY) : 0; } - if (this.lngRange) { minX = this.lngX(this.lngRange[0]); maxX = this.lngX(this.lngRange[1]); sx = maxX - minX < size.x ? size.x / (maxX - minX) : 0; } - - // how much the map should scale to fit the screen into given latitude/longitude ranges var s = Math.max(sx || 0, sy || 0); - if (s) { - this.center = this.unproject(new Point( - sx ? (maxX + minX) / 2 : this.x, - sy ? (maxY + minY) / 2 : this.y)); + this.center = this.unproject(new Point(sx ? (maxX + minX) / 2 : this.x, sy ? (maxY + minY) / 2 : this.y)); this.zoom += this.scaleZoom(s); this._unmodified = unmodified; this._constraining = false; return; } - if (this.latRange) { - var y = this.y, - h2 = size.y / 2; - - if (y - h2 < minY) y2 = minY + h2; - if (y + h2 > maxY) y2 = maxY - h2; + var y = this.y, h2 = size.y / 2; + if (y - h2 < minY) + y2 = minY + h2; + if (y + h2 > maxY) + y2 = maxY - h2; } - if (this.lngRange) { - var x = this.x, - w2 = size.x / 2; - - if (x - w2 < minX) x2 = minX + w2; - if (x + w2 > maxX) x2 = maxX - w2; + var x = this.x, w2 = size.x / 2; + if (x - w2 < minX) + x2 = minX + w2; + if (x + w2 > maxX) + x2 = maxX - w2; } - - // pan the map if the screen goes off the range if (x2 !== undefined || y2 !== undefined) { - this.center = this.unproject(new Point( - x2 !== undefined ? x2 : this.x, - y2 !== undefined ? y2 : this.y)); + this.center = this.unproject(new Point(x2 !== undefined ? x2 : this.x, y2 !== undefined ? y2 : this.y)); } - this._unmodified = unmodified; this._constraining = false; }, - - _calcProjMatrix: function() { - var m = new Float64Array(16); - - // Find the distance from the center point to the center top in altitude units using law of sines. + _calcMatrices: function () { + if (!this.height) + return; var halfFov = Math.atan(0.5 / this.altitude); var topHalfSurfaceDistance = Math.sin(halfFov) * this.altitude / Math.sin(Math.PI / 2 - this._pitch - halfFov); - - // Calculate z value of the farthest fragment that should be rendered. var farZ = Math.cos(Math.PI / 2 - this._pitch) * topHalfSurfaceDistance + this.altitude; - - mat4.perspective(m, 2 * Math.atan((this.height / 2) / this.altitude), this.width / this.height, 0.1, farZ); - - mat4.translate(m, m, [0, 0, -this.altitude]); - - // After the rotateX, z values are in pixel units. Convert them to - // altitude units. 1 altitude unit = the screen height. - mat4.scale(m, m, [1, -1, 1 / this.height]); - + var m = new Float64Array(16); + mat4.perspective(m, 2 * Math.atan(this.height / 2 / this.altitude), this.width / this.height, 0.1, farZ); + mat4.translate(m, m, [ + 0, + 0, + -this.altitude + ]); + mat4.scale(m, m, [ + 1, + -1, + 1 / this.height + ]); mat4.rotateX(m, m, this._pitch); mat4.rotateZ(m, m, this.angle); - mat4.translate(m, m, [-this.x, -this.y, 0]); - + mat4.translate(m, m, [ + -this.x, + -this.y, + 0 + ]); this.projMatrix = m; + m = mat4.create(); + mat4.scale(m, m, [ + this.width / 2, + -this.height / 2, + 1 + ]); + mat4.translate(m, m, [ + 1, + -1, + 0 + ]); + this.pixelMatrix = mat4.multiply(new Float64Array(16), m, this.projMatrix); + m = mat4.invert(new Float64Array(16), this.pixelMatrix); + if (!m) + throw new Error('failed to invert matrix'); + this.pixelMatrixInverse = m; } }; - -},{"../data/bucket":247,"../source/tile_coord":281,"../util/interpolate":343,"../util/util":349,"./coordinate":255,"./lng_lat":256,"gl-matrix":363,"point-geometry":404}],259:[function(require,module,exports){ +},{"../data/bucket":253,"../source/tile_coord":293,"../util/interpolate":360,"../util/util":366,"./coordinate":262,"./lng_lat":263,"gl-matrix":382,"point-geometry":424}],266:[function(require,module,exports){ 'use strict'; - -// Font data From Hershey Simplex Font -// http://paulbourke.net/dataformats/hershey/ var simplexFont = { - " ": [16, []], - "!": [10, [5, 21, 5, 7, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], - "\"": [16, [4, 21, 4, 14, -1, -1, 12, 21, 12, 14]], - "#": [21, [11, 25, 4, -7, -1, -1, 17, 25, 10, -7, -1, -1, 4, 12, 18, 12, -1, -1, 3, 6, 17, 6]], - "$": [20, [8, 25, 8, -4, -1, -1, 12, 25, 12, -4, -1, -1, 17, 18, 15, 20, 12, 21, 8, 21, 5, 20, 3, 18, 3, 16, 4, 14, 5, 13, 7, 12, 13, 10, 15, 9, 16, 8, 17, 6, 17, 3, 15, 1, 12, 0, 8, 0, 5, 1, 3, 3]], - "%": [24, [21, 21, 3, 0, -1, -1, 8, 21, 10, 19, 10, 17, 9, 15, 7, 14, 5, 14, 3, 16, 3, 18, 4, 20, 6, 21, 8, 21, 10, 20, 13, 19, 16, 19, 19, 20, 21, 21, -1, -1, 17, 7, 15, 6, 14, 4, 14, 2, 16, 0, 18, 0, 20, 1, 21, 3, 21, 5, 19, 7, 17, 7]], - "&": [26, [23, 12, 23, 13, 22, 14, 21, 14, 20, 13, 19, 11, 17, 6, 15, 3, 13, 1, 11, 0, 7, 0, 5, 1, 4, 2, 3, 4, 3, 6, 4, 8, 5, 9, 12, 13, 13, 14, 14, 16, 14, 18, 13, 20, 11, 21, 9, 20, 8, 18, 8, 16, 9, 13, 11, 10, 16, 3, 18, 1, 20, 0, 22, 0, 23, 1, 23, 2]], - "'": [10, [5, 19, 4, 20, 5, 21, 6, 20, 6, 18, 5, 16, 4, 15]], - "(": [14, [11, 25, 9, 23, 7, 20, 5, 16, 4, 11, 4, 7, 5, 2, 7, -2, 9, -5, 11, -7]], - ")": [14, [3, 25, 5, 23, 7, 20, 9, 16, 10, 11, 10, 7, 9, 2, 7, -2, 5, -5, 3, -7]], - "*": [16, [8, 21, 8, 9, -1, -1, 3, 18, 13, 12, -1, -1, 13, 18, 3, 12]], - "+": [26, [13, 18, 13, 0, -1, -1, 4, 9, 22, 9]], - ",": [10, [6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5, -3, 4, -4]], - "-": [26, [4, 9, 22, 9]], - ".": [10, [5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], - "/": [22, [20, 25, 2, -7]], - "0": [20, [9, 21, 6, 20, 4, 17, 3, 12, 3, 9, 4, 4, 6, 1, 9, 0, 11, 0, 14, 1, 16, 4, 17, 9, 17, 12, 16, 17, 14, 20, 11, 21, 9, 21]], - "1": [20, [6, 17, 8, 18, 11, 21, 11, 0]], - "2": [20, [4, 16, 4, 17, 5, 19, 6, 20, 8, 21, 12, 21, 14, 20, 15, 19, 16, 17, 16, 15, 15, 13, 13, 10, 3, 0, 17, 0]], - "3": [20, [5, 21, 16, 21, 10, 13, 13, 13, 15, 12, 16, 11, 17, 8, 17, 6, 16, 3, 14, 1, 11, 0, 8, 0, 5, 1, 4, 2, 3, 4]], - "4": [20, [13, 21, 3, 7, 18, 7, -1, -1, 13, 21, 13, 0]], - "5": [20, [15, 21, 5, 21, 4, 12, 5, 13, 8, 14, 11, 14, 14, 13, 16, 11, 17, 8, 17, 6, 16, 3, 14, 1, 11, 0, 8, 0, 5, 1, 4, 2, 3, 4]], - "6": [20, [16, 18, 15, 20, 12, 21, 10, 21, 7, 20, 5, 17, 4, 12, 4, 7, 5, 3, 7, 1, 10, 0, 11, 0, 14, 1, 16, 3, 17, 6, 17, 7, 16, 10, 14, 12, 11, 13, 10, 13, 7, 12, 5, 10, 4, 7]], - "7": [20, [17, 21, 7, 0, -1, -1, 3, 21, 17, 21]], - "8": [20, [8, 21, 5, 20, 4, 18, 4, 16, 5, 14, 7, 13, 11, 12, 14, 11, 16, 9, 17, 7, 17, 4, 16, 2, 15, 1, 12, 0, 8, 0, 5, 1, 4, 2, 3, 4, 3, 7, 4, 9, 6, 11, 9, 12, 13, 13, 15, 14, 16, 16, 16, 18, 15, 20, 12, 21, 8, 21]], - "9": [20, [16, 14, 15, 11, 13, 9, 10, 8, 9, 8, 6, 9, 4, 11, 3, 14, 3, 15, 4, 18, 6, 20, 9, 21, 10, 21, 13, 20, 15, 18, 16, 14, 16, 9, 15, 4, 13, 1, 10, 0, 8, 0, 5, 1, 4, 3]], - ":": [10, [5, 14, 4, 13, 5, 12, 6, 13, 5, 14, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], - ";": [10, [5, 14, 4, 13, 5, 12, 6, 13, 5, 14, -1, -1, 6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5, -3, 4, -4]], - "<": [24, [20, 18, 4, 9, 20, 0]], - "=": [26, [4, 12, 22, 12, -1, -1, 4, 6, 22, 6]], - ">": [24, [4, 18, 20, 9, 4, 0]], - "?": [18, [3, 16, 3, 17, 4, 19, 5, 20, 7, 21, 11, 21, 13, 20, 14, 19, 15, 17, 15, 15, 14, 13, 13, 12, 9, 10, 9, 7, -1, -1, 9, 2, 8, 1, 9, 0, 10, 1, 9, 2]], - "@": [27, [18, 13, 17, 15, 15, 16, 12, 16, 10, 15, 9, 14, 8, 11, 8, 8, 9, 6, 11, 5, 14, 5, 16, 6, 17, 8, -1, -1, 12, 16, 10, 14, 9, 11, 9, 8, 10, 6, 11, 5, -1, -1, 18, 16, 17, 8, 17, 6, 19, 5, 21, 5, 23, 7, 24, 10, 24, 12, 23, 15, 22, 17, 20, 19, 18, 20, 15, 21, 12, 21, 9, 20, 7, 19, 5, 17, 4, 15, 3, 12, 3, 9, 4, 6, 5, 4, 7, 2, 9, 1, 12, 0, 15, 0, 18, 1, 20, 2, 21, 3, -1, -1, 19, 16, 18, 8, 18, 6, 19, 5]], - "A": [18, [9, 21, 1, 0, -1, -1, 9, 21, 17, 0, -1, -1, 4, 7, 14, 7]], - "B": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 15, 17, 13, 16, 12, 13, 11, -1, -1, 4, 11, 13, 11, 16, 10, 17, 9, 18, 7, 18, 4, 17, 2, 16, 1, 13, 0, 4, 0]], - "C": [21, [18, 16, 17, 18, 15, 20, 13, 21, 9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5]], - "D": [21, [4, 21, 4, 0, -1, -1, 4, 21, 11, 21, 14, 20, 16, 18, 17, 16, 18, 13, 18, 8, 17, 5, 16, 3, 14, 1, 11, 0, 4, 0]], - "E": [19, [4, 21, 4, 0, -1, -1, 4, 21, 17, 21, -1, -1, 4, 11, 12, 11, -1, -1, 4, 0, 17, 0]], - "F": [18, [4, 21, 4, 0, -1, -1, 4, 21, 17, 21, -1, -1, 4, 11, 12, 11]], - "G": [21, [18, 16, 17, 18, 15, 20, 13, 21, 9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 18, 8, -1, -1, 13, 8, 18, 8]], - "H": [22, [4, 21, 4, 0, -1, -1, 18, 21, 18, 0, -1, -1, 4, 11, 18, 11]], - "I": [8, [4, 21, 4, 0]], - "J": [16, [12, 21, 12, 5, 11, 2, 10, 1, 8, 0, 6, 0, 4, 1, 3, 2, 2, 5, 2, 7]], - "K": [21, [4, 21, 4, 0, -1, -1, 18, 21, 4, 7, -1, -1, 9, 12, 18, 0]], - "L": [17, [4, 21, 4, 0, -1, -1, 4, 0, 16, 0]], - "M": [24, [4, 21, 4, 0, -1, -1, 4, 21, 12, 0, -1, -1, 20, 21, 12, 0, -1, -1, 20, 21, 20, 0]], - "N": [22, [4, 21, 4, 0, -1, -1, 4, 21, 18, 0, -1, -1, 18, 21, 18, 0]], - "O": [22, [9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 19, 8, 19, 13, 18, 16, 17, 18, 15, 20, 13, 21, 9, 21]], - "P": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 14, 17, 12, 16, 11, 13, 10, 4, 10]], - "Q": [22, [9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 19, 8, 19, 13, 18, 16, 17, 18, 15, 20, 13, 21, 9, 21, -1, -1, 12, 4, 18, -2]], - "R": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 15, 17, 13, 16, 12, 13, 11, 4, 11, -1, -1, 11, 11, 18, 0]], - "S": [20, [17, 18, 15, 20, 12, 21, 8, 21, 5, 20, 3, 18, 3, 16, 4, 14, 5, 13, 7, 12, 13, 10, 15, 9, 16, 8, 17, 6, 17, 3, 15, 1, 12, 0, 8, 0, 5, 1, 3, 3]], - "T": [16, [8, 21, 8, 0, -1, -1, 1, 21, 15, 21]], - "U": [22, [4, 21, 4, 6, 5, 3, 7, 1, 10, 0, 12, 0, 15, 1, 17, 3, 18, 6, 18, 21]], - "V": [18, [1, 21, 9, 0, -1, -1, 17, 21, 9, 0]], - "W": [24, [2, 21, 7, 0, -1, -1, 12, 21, 7, 0, -1, -1, 12, 21, 17, 0, -1, -1, 22, 21, 17, 0]], - "X": [20, [3, 21, 17, 0, -1, -1, 17, 21, 3, 0]], - "Y": [18, [1, 21, 9, 11, 9, 0, -1, -1, 17, 21, 9, 11]], - "Z": [20, [17, 21, 3, 0, -1, -1, 3, 21, 17, 21, -1, -1, 3, 0, 17, 0]], - "[": [14, [4, 25, 4, -7, -1, -1, 5, 25, 5, -7, -1, -1, 4, 25, 11, 25, -1, -1, 4, -7, 11, -7]], - "\\": [14, [0, 21, 14, -3]], - "]": [14, [9, 25, 9, -7, -1, -1, 10, 25, 10, -7, -1, -1, 3, 25, 10, 25, -1, -1, 3, -7, 10, -7]], - "^": [16, [6, 15, 8, 18, 10, 15, -1, -1, 3, 12, 8, 17, 13, 12, -1, -1, 8, 17, 8, 0]], - "_": [16, [0, -2, 16, -2]], - "`": [10, [6, 21, 5, 20, 4, 18, 4, 16, 5, 15, 6, 16, 5, 17]], - "a": [19, [15, 14, 15, 0, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "b": [19, [4, 21, 4, 0, -1, -1, 4, 11, 6, 13, 8, 14, 11, 14, 13, 13, 15, 11, 16, 8, 16, 6, 15, 3, 13, 1, 11, 0, 8, 0, 6, 1, 4, 3]], - "c": [18, [15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "d": [19, [15, 21, 15, 0, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "e": [18, [3, 8, 15, 8, 15, 10, 14, 12, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "f": [12, [10, 21, 8, 21, 6, 20, 5, 17, 5, 0, -1, -1, 2, 14, 9, 14]], - "g": [19, [15, 14, 15, -2, 14, -5, 13, -6, 11, -7, 8, -7, 6, -6, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "h": [19, [4, 21, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0]], - "i": [8, [3, 21, 4, 20, 5, 21, 4, 22, 3, 21, -1, -1, 4, 14, 4, 0]], - "j": [10, [5, 21, 6, 20, 7, 21, 6, 22, 5, 21, -1, -1, 6, 14, 6, -3, 5, -6, 3, -7, 1, -7]], - "k": [17, [4, 21, 4, 0, -1, -1, 14, 14, 4, 4, -1, -1, 8, 8, 15, 0]], - "l": [8, [4, 21, 4, 0]], - "m": [30, [4, 14, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0, -1, -1, 15, 10, 18, 13, 20, 14, 23, 14, 25, 13, 26, 10, 26, 0]], - "n": [19, [4, 14, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0]], - "o": [19, [8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3, 16, 6, 16, 8, 15, 11, 13, 13, 11, 14, 8, 14]], - "p": [19, [4, 14, 4, -7, -1, -1, 4, 11, 6, 13, 8, 14, 11, 14, 13, 13, 15, 11, 16, 8, 16, 6, 15, 3, 13, 1, 11, 0, 8, 0, 6, 1, 4, 3]], - "q": [19, [15, 14, 15, -7, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], - "r": [13, [4, 14, 4, 0, -1, -1, 4, 8, 5, 11, 7, 13, 9, 14, 12, 14]], - "s": [17, [14, 11, 13, 13, 10, 14, 7, 14, 4, 13, 3, 11, 4, 9, 6, 8, 11, 7, 13, 6, 14, 4, 14, 3, 13, 1, 10, 0, 7, 0, 4, 1, 3, 3]], - "t": [12, [5, 21, 5, 4, 6, 1, 8, 0, 10, 0, -1, -1, 2, 14, 9, 14]], - "u": [19, [4, 14, 4, 4, 5, 1, 7, 0, 10, 0, 12, 1, 15, 4, -1, -1, 15, 14, 15, 0]], - "v": [16, [2, 14, 8, 0, -1, -1, 14, 14, 8, 0]], - "w": [22, [3, 14, 7, 0, -1, -1, 11, 14, 7, 0, -1, -1, 11, 14, 15, 0, -1, -1, 19, 14, 15, 0]], - "x": [17, [3, 14, 14, 0, -1, -1, 14, 14, 3, 0]], - "y": [16, [2, 14, 8, 0, -1, -1, 14, 14, 8, 0, 6, -4, 4, -6, 2, -7, 1, -7]], - "z": [17, [14, 14, 3, 0, -1, -1, 3, 14, 14, 14, -1, -1, 3, 0, 14, 0]], - "{": [14, [9, 25, 7, 24, 6, 23, 5, 21, 5, 19, 6, 17, 7, 16, 8, 14, 8, 12, 6, 10, -1, -1, 7, 24, 6, 22, 6, 20, 7, 18, 8, 17, 9, 15, 9, 13, 8, 11, 4, 9, 8, 7, 9, 5, 9, 3, 8, 1, 7, 0, 6, -2, 6, -4, 7, -6, -1, -1, 6, 8, 8, 6, 8, 4, 7, 2, 6, 1, 5, -1, 5, -3, 6, -5, 7, -6, 9, -7]], - "|": [8, [4, 25, 4, -7]], - "}": [14, [5, 25, 7, 24, 8, 23, 9, 21, 9, 19, 8, 17, 7, 16, 6, 14, 6, 12, 8, 10, -1, -1, 7, 24, 8, 22, 8, 20, 7, 18, 6, 17, 5, 15, 5, 13, 6, 11, 10, 9, 6, 7, 5, 5, 5, 3, 6, 1, 7, 0, 8, -2, 8, -4, 7, -6, -1, -1, 8, 8, 6, 6, 6, 4, 7, 2, 8, 1, 9, -1, 9, -3, 8, -5, 7, -6, 5, -7]], - "~": [24, [3, 6, 3, 8, 4, 11, 6, 12, 8, 12, 10, 11, 14, 8, 16, 7, 18, 7, 20, 8, 21, 10, -1, -1, 3, 8, 4, 10, 6, 11, 8, 11, 10, 10, 14, 7, 16, 6, 18, 6, 20, 7, 21, 10, 21, 12]] + ' ': [ + 16, + [] + ], + '!': [ + 10, + [ + 5, + 21, + 5, + 7, + -1, + -1, + 5, + 2, + 4, + 1, + 5, + 0, + 6, + 1, + 5, + 2 + ] + ], + '"': [ + 16, + [ + 4, + 21, + 4, + 14, + -1, + -1, + 12, + 21, + 12, + 14 + ] + ], + '#': [ + 21, + [ + 11, + 25, + 4, + -7, + -1, + -1, + 17, + 25, + 10, + -7, + -1, + -1, + 4, + 12, + 18, + 12, + -1, + -1, + 3, + 6, + 17, + 6 + ] + ], + '$': [ + 20, + [ + 8, + 25, + 8, + -4, + -1, + -1, + 12, + 25, + 12, + -4, + -1, + -1, + 17, + 18, + 15, + 20, + 12, + 21, + 8, + 21, + 5, + 20, + 3, + 18, + 3, + 16, + 4, + 14, + 5, + 13, + 7, + 12, + 13, + 10, + 15, + 9, + 16, + 8, + 17, + 6, + 17, + 3, + 15, + 1, + 12, + 0, + 8, + 0, + 5, + 1, + 3, + 3 + ] + ], + '%': [ + 24, + [ + 21, + 21, + 3, + 0, + -1, + -1, + 8, + 21, + 10, + 19, + 10, + 17, + 9, + 15, + 7, + 14, + 5, + 14, + 3, + 16, + 3, + 18, + 4, + 20, + 6, + 21, + 8, + 21, + 10, + 20, + 13, + 19, + 16, + 19, + 19, + 20, + 21, + 21, + -1, + -1, + 17, + 7, + 15, + 6, + 14, + 4, + 14, + 2, + 16, + 0, + 18, + 0, + 20, + 1, + 21, + 3, + 21, + 5, + 19, + 7, + 17, + 7 + ] + ], + '&': [ + 26, + [ + 23, + 12, + 23, + 13, + 22, + 14, + 21, + 14, + 20, + 13, + 19, + 11, + 17, + 6, + 15, + 3, + 13, + 1, + 11, + 0, + 7, + 0, + 5, + 1, + 4, + 2, + 3, + 4, + 3, + 6, + 4, + 8, + 5, + 9, + 12, + 13, + 13, + 14, + 14, + 16, + 14, + 18, + 13, + 20, + 11, + 21, + 9, + 20, + 8, + 18, + 8, + 16, + 9, + 13, + 11, + 10, + 16, + 3, + 18, + 1, + 20, + 0, + 22, + 0, + 23, + 1, + 23, + 2 + ] + ], + '\'': [ + 10, + [ + 5, + 19, + 4, + 20, + 5, + 21, + 6, + 20, + 6, + 18, + 5, + 16, + 4, + 15 + ] + ], + '(': [ + 14, + [ + 11, + 25, + 9, + 23, + 7, + 20, + 5, + 16, + 4, + 11, + 4, + 7, + 5, + 2, + 7, + -2, + 9, + -5, + 11, + -7 + ] + ], + ')': [ + 14, + [ + 3, + 25, + 5, + 23, + 7, + 20, + 9, + 16, + 10, + 11, + 10, + 7, + 9, + 2, + 7, + -2, + 5, + -5, + 3, + -7 + ] + ], + '*': [ + 16, + [ + 8, + 21, + 8, + 9, + -1, + -1, + 3, + 18, + 13, + 12, + -1, + -1, + 13, + 18, + 3, + 12 + ] + ], + '+': [ + 26, + [ + 13, + 18, + 13, + 0, + -1, + -1, + 4, + 9, + 22, + 9 + ] + ], + ',': [ + 10, + [ + 6, + 1, + 5, + 0, + 4, + 1, + 5, + 2, + 6, + 1, + 6, + -1, + 5, + -3, + 4, + -4 + ] + ], + '-': [ + 26, + [ + 4, + 9, + 22, + 9 + ] + ], + '.': [ + 10, + [ + 5, + 2, + 4, + 1, + 5, + 0, + 6, + 1, + 5, + 2 + ] + ], + '/': [ + 22, + [ + 20, + 25, + 2, + -7 + ] + ], + '0': [ + 20, + [ + 9, + 21, + 6, + 20, + 4, + 17, + 3, + 12, + 3, + 9, + 4, + 4, + 6, + 1, + 9, + 0, + 11, + 0, + 14, + 1, + 16, + 4, + 17, + 9, + 17, + 12, + 16, + 17, + 14, + 20, + 11, + 21, + 9, + 21 + ] + ], + '1': [ + 20, + [ + 6, + 17, + 8, + 18, + 11, + 21, + 11, + 0 + ] + ], + '2': [ + 20, + [ + 4, + 16, + 4, + 17, + 5, + 19, + 6, + 20, + 8, + 21, + 12, + 21, + 14, + 20, + 15, + 19, + 16, + 17, + 16, + 15, + 15, + 13, + 13, + 10, + 3, + 0, + 17, + 0 + ] + ], + '3': [ + 20, + [ + 5, + 21, + 16, + 21, + 10, + 13, + 13, + 13, + 15, + 12, + 16, + 11, + 17, + 8, + 17, + 6, + 16, + 3, + 14, + 1, + 11, + 0, + 8, + 0, + 5, + 1, + 4, + 2, + 3, + 4 + ] + ], + '4': [ + 20, + [ + 13, + 21, + 3, + 7, + 18, + 7, + -1, + -1, + 13, + 21, + 13, + 0 + ] + ], + '5': [ + 20, + [ + 15, + 21, + 5, + 21, + 4, + 12, + 5, + 13, + 8, + 14, + 11, + 14, + 14, + 13, + 16, + 11, + 17, + 8, + 17, + 6, + 16, + 3, + 14, + 1, + 11, + 0, + 8, + 0, + 5, + 1, + 4, + 2, + 3, + 4 + ] + ], + '6': [ + 20, + [ + 16, + 18, + 15, + 20, + 12, + 21, + 10, + 21, + 7, + 20, + 5, + 17, + 4, + 12, + 4, + 7, + 5, + 3, + 7, + 1, + 10, + 0, + 11, + 0, + 14, + 1, + 16, + 3, + 17, + 6, + 17, + 7, + 16, + 10, + 14, + 12, + 11, + 13, + 10, + 13, + 7, + 12, + 5, + 10, + 4, + 7 + ] + ], + '7': [ + 20, + [ + 17, + 21, + 7, + 0, + -1, + -1, + 3, + 21, + 17, + 21 + ] + ], + '8': [ + 20, + [ + 8, + 21, + 5, + 20, + 4, + 18, + 4, + 16, + 5, + 14, + 7, + 13, + 11, + 12, + 14, + 11, + 16, + 9, + 17, + 7, + 17, + 4, + 16, + 2, + 15, + 1, + 12, + 0, + 8, + 0, + 5, + 1, + 4, + 2, + 3, + 4, + 3, + 7, + 4, + 9, + 6, + 11, + 9, + 12, + 13, + 13, + 15, + 14, + 16, + 16, + 16, + 18, + 15, + 20, + 12, + 21, + 8, + 21 + ] + ], + '9': [ + 20, + [ + 16, + 14, + 15, + 11, + 13, + 9, + 10, + 8, + 9, + 8, + 6, + 9, + 4, + 11, + 3, + 14, + 3, + 15, + 4, + 18, + 6, + 20, + 9, + 21, + 10, + 21, + 13, + 20, + 15, + 18, + 16, + 14, + 16, + 9, + 15, + 4, + 13, + 1, + 10, + 0, + 8, + 0, + 5, + 1, + 4, + 3 + ] + ], + ':': [ + 10, + [ + 5, + 14, + 4, + 13, + 5, + 12, + 6, + 13, + 5, + 14, + -1, + -1, + 5, + 2, + 4, + 1, + 5, + 0, + 6, + 1, + 5, + 2 + ] + ], + ';': [ + 10, + [ + 5, + 14, + 4, + 13, + 5, + 12, + 6, + 13, + 5, + 14, + -1, + -1, + 6, + 1, + 5, + 0, + 4, + 1, + 5, + 2, + 6, + 1, + 6, + -1, + 5, + -3, + 4, + -4 + ] + ], + '<': [ + 24, + [ + 20, + 18, + 4, + 9, + 20, + 0 + ] + ], + '=': [ + 26, + [ + 4, + 12, + 22, + 12, + -1, + -1, + 4, + 6, + 22, + 6 + ] + ], + '>': [ + 24, + [ + 4, + 18, + 20, + 9, + 4, + 0 + ] + ], + '?': [ + 18, + [ + 3, + 16, + 3, + 17, + 4, + 19, + 5, + 20, + 7, + 21, + 11, + 21, + 13, + 20, + 14, + 19, + 15, + 17, + 15, + 15, + 14, + 13, + 13, + 12, + 9, + 10, + 9, + 7, + -1, + -1, + 9, + 2, + 8, + 1, + 9, + 0, + 10, + 1, + 9, + 2 + ] + ], + '@': [ + 27, + [ + 18, + 13, + 17, + 15, + 15, + 16, + 12, + 16, + 10, + 15, + 9, + 14, + 8, + 11, + 8, + 8, + 9, + 6, + 11, + 5, + 14, + 5, + 16, + 6, + 17, + 8, + -1, + -1, + 12, + 16, + 10, + 14, + 9, + 11, + 9, + 8, + 10, + 6, + 11, + 5, + -1, + -1, + 18, + 16, + 17, + 8, + 17, + 6, + 19, + 5, + 21, + 5, + 23, + 7, + 24, + 10, + 24, + 12, + 23, + 15, + 22, + 17, + 20, + 19, + 18, + 20, + 15, + 21, + 12, + 21, + 9, + 20, + 7, + 19, + 5, + 17, + 4, + 15, + 3, + 12, + 3, + 9, + 4, + 6, + 5, + 4, + 7, + 2, + 9, + 1, + 12, + 0, + 15, + 0, + 18, + 1, + 20, + 2, + 21, + 3, + -1, + -1, + 19, + 16, + 18, + 8, + 18, + 6, + 19, + 5 + ] + ], + 'A': [ + 18, + [ + 9, + 21, + 1, + 0, + -1, + -1, + 9, + 21, + 17, + 0, + -1, + -1, + 4, + 7, + 14, + 7 + ] + ], + 'B': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 13, + 21, + 16, + 20, + 17, + 19, + 18, + 17, + 18, + 15, + 17, + 13, + 16, + 12, + 13, + 11, + -1, + -1, + 4, + 11, + 13, + 11, + 16, + 10, + 17, + 9, + 18, + 7, + 18, + 4, + 17, + 2, + 16, + 1, + 13, + 0, + 4, + 0 + ] + ], + 'C': [ + 21, + [ + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5 + ] + ], + 'D': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 11, + 21, + 14, + 20, + 16, + 18, + 17, + 16, + 18, + 13, + 18, + 8, + 17, + 5, + 16, + 3, + 14, + 1, + 11, + 0, + 4, + 0 + ] + ], + 'E': [ + 19, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 17, + 21, + -1, + -1, + 4, + 11, + 12, + 11, + -1, + -1, + 4, + 0, + 17, + 0 + ] + ], + 'F': [ + 18, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 17, + 21, + -1, + -1, + 4, + 11, + 12, + 11 + ] + ], + 'G': [ + 21, + [ + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5, + 18, + 8, + -1, + -1, + 13, + 8, + 18, + 8 + ] + ], + 'H': [ + 22, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 18, + 21, + 18, + 0, + -1, + -1, + 4, + 11, + 18, + 11 + ] + ], + 'I': [ + 8, + [ + 4, + 21, + 4, + 0 + ] + ], + 'J': [ + 16, + [ + 12, + 21, + 12, + 5, + 11, + 2, + 10, + 1, + 8, + 0, + 6, + 0, + 4, + 1, + 3, + 2, + 2, + 5, + 2, + 7 + ] + ], + 'K': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 18, + 21, + 4, + 7, + -1, + -1, + 9, + 12, + 18, + 0 + ] + ], + 'L': [ + 17, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 0, + 16, + 0 + ] + ], + 'M': [ + 24, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 12, + 0, + -1, + -1, + 20, + 21, + 12, + 0, + -1, + -1, + 20, + 21, + 20, + 0 + ] + ], + 'N': [ + 22, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 18, + 0, + -1, + -1, + 18, + 21, + 18, + 0 + ] + ], + 'O': [ + 22, + [ + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5, + 19, + 8, + 19, + 13, + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21 + ] + ], + 'P': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 13, + 21, + 16, + 20, + 17, + 19, + 18, + 17, + 18, + 14, + 17, + 12, + 16, + 11, + 13, + 10, + 4, + 10 + ] + ], + 'Q': [ + 22, + [ + 9, + 21, + 7, + 20, + 5, + 18, + 4, + 16, + 3, + 13, + 3, + 8, + 4, + 5, + 5, + 3, + 7, + 1, + 9, + 0, + 13, + 0, + 15, + 1, + 17, + 3, + 18, + 5, + 19, + 8, + 19, + 13, + 18, + 16, + 17, + 18, + 15, + 20, + 13, + 21, + 9, + 21, + -1, + -1, + 12, + 4, + 18, + -2 + ] + ], + 'R': [ + 21, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 21, + 13, + 21, + 16, + 20, + 17, + 19, + 18, + 17, + 18, + 15, + 17, + 13, + 16, + 12, + 13, + 11, + 4, + 11, + -1, + -1, + 11, + 11, + 18, + 0 + ] + ], + 'S': [ + 20, + [ + 17, + 18, + 15, + 20, + 12, + 21, + 8, + 21, + 5, + 20, + 3, + 18, + 3, + 16, + 4, + 14, + 5, + 13, + 7, + 12, + 13, + 10, + 15, + 9, + 16, + 8, + 17, + 6, + 17, + 3, + 15, + 1, + 12, + 0, + 8, + 0, + 5, + 1, + 3, + 3 + ] + ], + 'T': [ + 16, + [ + 8, + 21, + 8, + 0, + -1, + -1, + 1, + 21, + 15, + 21 + ] + ], + 'U': [ + 22, + [ + 4, + 21, + 4, + 6, + 5, + 3, + 7, + 1, + 10, + 0, + 12, + 0, + 15, + 1, + 17, + 3, + 18, + 6, + 18, + 21 + ] + ], + 'V': [ + 18, + [ + 1, + 21, + 9, + 0, + -1, + -1, + 17, + 21, + 9, + 0 + ] + ], + 'W': [ + 24, + [ + 2, + 21, + 7, + 0, + -1, + -1, + 12, + 21, + 7, + 0, + -1, + -1, + 12, + 21, + 17, + 0, + -1, + -1, + 22, + 21, + 17, + 0 + ] + ], + 'X': [ + 20, + [ + 3, + 21, + 17, + 0, + -1, + -1, + 17, + 21, + 3, + 0 + ] + ], + 'Y': [ + 18, + [ + 1, + 21, + 9, + 11, + 9, + 0, + -1, + -1, + 17, + 21, + 9, + 11 + ] + ], + 'Z': [ + 20, + [ + 17, + 21, + 3, + 0, + -1, + -1, + 3, + 21, + 17, + 21, + -1, + -1, + 3, + 0, + 17, + 0 + ] + ], + '[': [ + 14, + [ + 4, + 25, + 4, + -7, + -1, + -1, + 5, + 25, + 5, + -7, + -1, + -1, + 4, + 25, + 11, + 25, + -1, + -1, + 4, + -7, + 11, + -7 + ] + ], + '\\': [ + 14, + [ + 0, + 21, + 14, + -3 + ] + ], + ']': [ + 14, + [ + 9, + 25, + 9, + -7, + -1, + -1, + 10, + 25, + 10, + -7, + -1, + -1, + 3, + 25, + 10, + 25, + -1, + -1, + 3, + -7, + 10, + -7 + ] + ], + '^': [ + 16, + [ + 6, + 15, + 8, + 18, + 10, + 15, + -1, + -1, + 3, + 12, + 8, + 17, + 13, + 12, + -1, + -1, + 8, + 17, + 8, + 0 + ] + ], + '_': [ + 16, + [ + 0, + -2, + 16, + -2 + ] + ], + '`': [ + 10, + [ + 6, + 21, + 5, + 20, + 4, + 18, + 4, + 16, + 5, + 15, + 6, + 16, + 5, + 17 + ] + ], + 'a': [ + 19, + [ + 15, + 14, + 15, + 0, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'b': [ + 19, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 11, + 6, + 13, + 8, + 14, + 11, + 14, + 13, + 13, + 15, + 11, + 16, + 8, + 16, + 6, + 15, + 3, + 13, + 1, + 11, + 0, + 8, + 0, + 6, + 1, + 4, + 3 + ] + ], + 'c': [ + 18, + [ + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'd': [ + 19, + [ + 15, + 21, + 15, + 0, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'e': [ + 18, + [ + 3, + 8, + 15, + 8, + 15, + 10, + 14, + 12, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'f': [ + 12, + [ + 10, + 21, + 8, + 21, + 6, + 20, + 5, + 17, + 5, + 0, + -1, + -1, + 2, + 14, + 9, + 14 + ] + ], + 'g': [ + 19, + [ + 15, + 14, + 15, + -2, + 14, + -5, + 13, + -6, + 11, + -7, + 8, + -7, + 6, + -6, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'h': [ + 19, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 4, + 10, + 7, + 13, + 9, + 14, + 12, + 14, + 14, + 13, + 15, + 10, + 15, + 0 + ] + ], + 'i': [ + 8, + [ + 3, + 21, + 4, + 20, + 5, + 21, + 4, + 22, + 3, + 21, + -1, + -1, + 4, + 14, + 4, + 0 + ] + ], + 'j': [ + 10, + [ + 5, + 21, + 6, + 20, + 7, + 21, + 6, + 22, + 5, + 21, + -1, + -1, + 6, + 14, + 6, + -3, + 5, + -6, + 3, + -7, + 1, + -7 + ] + ], + 'k': [ + 17, + [ + 4, + 21, + 4, + 0, + -1, + -1, + 14, + 14, + 4, + 4, + -1, + -1, + 8, + 8, + 15, + 0 + ] + ], + 'l': [ + 8, + [ + 4, + 21, + 4, + 0 + ] + ], + 'm': [ + 30, + [ + 4, + 14, + 4, + 0, + -1, + -1, + 4, + 10, + 7, + 13, + 9, + 14, + 12, + 14, + 14, + 13, + 15, + 10, + 15, + 0, + -1, + -1, + 15, + 10, + 18, + 13, + 20, + 14, + 23, + 14, + 25, + 13, + 26, + 10, + 26, + 0 + ] + ], + 'n': [ + 19, + [ + 4, + 14, + 4, + 0, + -1, + -1, + 4, + 10, + 7, + 13, + 9, + 14, + 12, + 14, + 14, + 13, + 15, + 10, + 15, + 0 + ] + ], + 'o': [ + 19, + [ + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3, + 16, + 6, + 16, + 8, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14 + ] + ], + 'p': [ + 19, + [ + 4, + 14, + 4, + -7, + -1, + -1, + 4, + 11, + 6, + 13, + 8, + 14, + 11, + 14, + 13, + 13, + 15, + 11, + 16, + 8, + 16, + 6, + 15, + 3, + 13, + 1, + 11, + 0, + 8, + 0, + 6, + 1, + 4, + 3 + ] + ], + 'q': [ + 19, + [ + 15, + 14, + 15, + -7, + -1, + -1, + 15, + 11, + 13, + 13, + 11, + 14, + 8, + 14, + 6, + 13, + 4, + 11, + 3, + 8, + 3, + 6, + 4, + 3, + 6, + 1, + 8, + 0, + 11, + 0, + 13, + 1, + 15, + 3 + ] + ], + 'r': [ + 13, + [ + 4, + 14, + 4, + 0, + -1, + -1, + 4, + 8, + 5, + 11, + 7, + 13, + 9, + 14, + 12, + 14 + ] + ], + 's': [ + 17, + [ + 14, + 11, + 13, + 13, + 10, + 14, + 7, + 14, + 4, + 13, + 3, + 11, + 4, + 9, + 6, + 8, + 11, + 7, + 13, + 6, + 14, + 4, + 14, + 3, + 13, + 1, + 10, + 0, + 7, + 0, + 4, + 1, + 3, + 3 + ] + ], + 't': [ + 12, + [ + 5, + 21, + 5, + 4, + 6, + 1, + 8, + 0, + 10, + 0, + -1, + -1, + 2, + 14, + 9, + 14 + ] + ], + 'u': [ + 19, + [ + 4, + 14, + 4, + 4, + 5, + 1, + 7, + 0, + 10, + 0, + 12, + 1, + 15, + 4, + -1, + -1, + 15, + 14, + 15, + 0 + ] + ], + 'v': [ + 16, + [ + 2, + 14, + 8, + 0, + -1, + -1, + 14, + 14, + 8, + 0 + ] + ], + 'w': [ + 22, + [ + 3, + 14, + 7, + 0, + -1, + -1, + 11, + 14, + 7, + 0, + -1, + -1, + 11, + 14, + 15, + 0, + -1, + -1, + 19, + 14, + 15, + 0 + ] + ], + 'x': [ + 17, + [ + 3, + 14, + 14, + 0, + -1, + -1, + 14, + 14, + 3, + 0 + ] + ], + 'y': [ + 16, + [ + 2, + 14, + 8, + 0, + -1, + -1, + 14, + 14, + 8, + 0, + 6, + -4, + 4, + -6, + 2, + -7, + 1, + -7 + ] + ], + 'z': [ + 17, + [ + 14, + 14, + 3, + 0, + -1, + -1, + 3, + 14, + 14, + 14, + -1, + -1, + 3, + 0, + 14, + 0 + ] + ], + '{': [ + 14, + [ + 9, + 25, + 7, + 24, + 6, + 23, + 5, + 21, + 5, + 19, + 6, + 17, + 7, + 16, + 8, + 14, + 8, + 12, + 6, + 10, + -1, + -1, + 7, + 24, + 6, + 22, + 6, + 20, + 7, + 18, + 8, + 17, + 9, + 15, + 9, + 13, + 8, + 11, + 4, + 9, + 8, + 7, + 9, + 5, + 9, + 3, + 8, + 1, + 7, + 0, + 6, + -2, + 6, + -4, + 7, + -6, + -1, + -1, + 6, + 8, + 8, + 6, + 8, + 4, + 7, + 2, + 6, + 1, + 5, + -1, + 5, + -3, + 6, + -5, + 7, + -6, + 9, + -7 + ] + ], + '|': [ + 8, + [ + 4, + 25, + 4, + -7 + ] + ], + '}': [ + 14, + [ + 5, + 25, + 7, + 24, + 8, + 23, + 9, + 21, + 9, + 19, + 8, + 17, + 7, + 16, + 6, + 14, + 6, + 12, + 8, + 10, + -1, + -1, + 7, + 24, + 8, + 22, + 8, + 20, + 7, + 18, + 6, + 17, + 5, + 15, + 5, + 13, + 6, + 11, + 10, + 9, + 6, + 7, + 5, + 5, + 5, + 3, + 6, + 1, + 7, + 0, + 8, + -2, + 8, + -4, + 7, + -6, + -1, + -1, + 8, + 8, + 6, + 6, + 6, + 4, + 7, + 2, + 8, + 1, + 9, + -1, + 9, + -3, + 8, + -5, + 7, + -6, + 5, + -7 + ] + ], + '~': [ + 24, + [ + 3, + 6, + 3, + 8, + 4, + 11, + 6, + 12, + 8, + 12, + 10, + 11, + 14, + 8, + 16, + 7, + 18, + 7, + 20, + 8, + 21, + 10, + -1, + -1, + 3, + 8, + 4, + 10, + 6, + 11, + 8, + 11, + 10, + 10, + 14, + 7, + 16, + 6, + 18, + 6, + 20, + 7, + 21, + 10, + 21, + 12 + ] + ] }; - module.exports = function textVertices(text, left, baseline, scale) { scale = scale || 1; - - var strokes = [], - i, len, j, len2, glyph, x, y, prev; - + var strokes = [], i, len, j, len2, glyph, x, y, prev; for (i = 0, len = text.length; i < len; i++) { glyph = simplexFont[text[i]]; - if (!glyph) continue; + if (!glyph) + continue; prev = null; - for (j = 0, len2 = glyph[1].length; j < len2; j += 2) { if (glyph[1][j] === -1 && glyph[1][j + 1] === -1) { prev = null; - } else { x = left + glyph[1][j] * scale; y = baseline - glyph[1][j + 1] * scale; if (prev) { strokes.push(prev.x, prev.y, x, y); } - prev = {x: x, y: y}; + prev = { + x: x, + y: y + }; } } left += glyph[0] * scale; } - return strokes; }; - -},{}],260:[function(require,module,exports){ +},{}],267:[function(require,module,exports){ 'use strict'; - -/** - * mapboxgl is a A WebGL JavaScript interactive maps library that can render - * [Mapbox vector tiles](https://www.mapbox.com/blog/vector-tiles/). - * - * @module mapboxgl - * @summary WebGL JavaScript map library - */ - -// jshint -W079 var mapboxgl = module.exports = {}; - +mapboxgl.version = require('../package.json').version; mapboxgl.Map = require('./ui/map'); mapboxgl.Control = require('./ui/control/control'); mapboxgl.Navigation = require('./ui/control/navigation'); mapboxgl.Geolocate = require('./ui/control/geolocate'); mapboxgl.Attribution = require('./ui/control/attribution'); mapboxgl.Popup = require('./ui/popup'); - -mapboxgl.GeoJSONSource = require('./source/geojson_source'); -mapboxgl.VideoSource = require('./source/video_source'); -mapboxgl.ImageSource = require('./source/image_source'); - +mapboxgl.Marker = require('./ui/marker'); mapboxgl.Style = require('./style/style'); - mapboxgl.LngLat = require('./geo/lng_lat'); mapboxgl.LngLatBounds = require('./geo/lng_lat_bounds'); mapboxgl.Point = require('point-geometry'); - mapboxgl.Evented = require('./util/evented'); mapboxgl.util = require('./util/util'); - mapboxgl.supported = require('./util/browser').supported; - var ajax = require('./util/ajax'); mapboxgl.util.getJSON = ajax.getJSON; mapboxgl.util.getArrayBuffer = ajax.getArrayBuffer; - var config = require('./util/config'); mapboxgl.config = config; - Object.defineProperty(mapboxgl, 'accessToken', { - get: function() { return config.ACCESS_TOKEN; }, - set: function(token) { config.ACCESS_TOKEN = token; } + get: function () { + return config.ACCESS_TOKEN; + }, + set: function (token) { + config.ACCESS_TOKEN = token; + } }); - -},{"./geo/lng_lat":256,"./geo/lng_lat_bounds":257,"./source/geojson_source":274,"./source/image_source":276,"./source/video_source":284,"./style/style":290,"./ui/control/attribution":318,"./ui/control/control":319,"./ui/control/geolocate":320,"./ui/control/navigation":321,"./ui/map":331,"./ui/popup":332,"./util/ajax":334,"./util/browser":335,"./util/config":339,"./util/evented":341,"./util/util":349,"point-geometry":404}],261:[function(require,module,exports){ +},{"../package.json":443,"./geo/lng_lat":263,"./geo/lng_lat_bounds":264,"./style/style":302,"./ui/control/attribution":333,"./ui/control/control":334,"./ui/control/geolocate":335,"./ui/control/navigation":336,"./ui/map":345,"./ui/marker":346,"./ui/popup":347,"./util/ajax":349,"./util/browser":350,"./util/config":355,"./util/evented":358,"./util/util":366,"point-geometry":424}],268:[function(require,module,exports){ +'use strict'; +module.exports = function (uniforms) { + var pragmas = { + define: {}, + initialize: {} + }; + for (var i = 0; i < uniforms.length; i++) { + var uniform = uniforms[i]; + var type = '{precision} ' + (uniform.components === 1 ? 'float' : 'vec' + uniform.components); + pragmas.define[uniform.name.slice(2)] = 'uniform ' + type + ' ' + uniform.name + ';\n'; + pragmas.initialize[uniform.name.slice(2)] = type + ' ' + uniform.name.slice(2) + ' = ' + uniform.name + ';\n'; + } + return pragmas; +}; +},{}],269:[function(require,module,exports){ 'use strict'; - -var TilePyramid = require('../source/tile_pyramid'); -var pyramid = new TilePyramid({ tileSize: 512 }); -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - +var createUniformPragmas = require('./create_uniform_pragmas'); +var tileSize = 512; module.exports = drawBackground; - function drawBackground(painter, source, layer) { var gl = painter.gl; var transform = painter.transform; - var color = util.premultiply(layer.paint['background-color']); + var color = layer.paint['background-color']; var image = layer.paint['background-pattern']; var opacity = layer.paint['background-opacity']; var program; - var imagePosA = image ? painter.spriteAtlas.getPosition(image.from, true) : null; var imagePosB = image ? painter.spriteAtlas.getPosition(image.to, true) : null; - painter.setDepthSublayer(0); if (imagePosA && imagePosB) { - - if (painter.isOpaquePass) return; - - // Draw texture fill + if (painter.isOpaquePass) + return; program = painter.useProgram('pattern'); gl.uniform1i(program.u_image, 0); gl.uniform2fv(program.u_pattern_tl_a, imagePosA.tl); @@ -46141,196 +49307,150 @@ function drawBackground(painter, source, layer) { gl.uniform2fv(program.u_pattern_tl_b, imagePosB.tl); gl.uniform2fv(program.u_pattern_br_b, imagePosB.br); gl.uniform1f(program.u_opacity, opacity); - gl.uniform1f(program.u_mix, image.t); - + gl.uniform2fv(program.u_pattern_size_a, imagePosA.size); + gl.uniform2fv(program.u_pattern_size_b, imagePosB.size); + gl.uniform1f(program.u_scale_a, image.fromScale); + gl.uniform1f(program.u_scale_b, image.toScale); + gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); - painter.tileExtentPatternVAO.bind(gl, program, painter.tileExtentBuffer); } else { - // Draw filling rectangle. - if (painter.isOpaquePass !== (color[3] === 1)) return; - - program = painter.useProgram('fill'); + if (painter.isOpaquePass !== (color[3] === 1)) + return; + var pragmas = createUniformPragmas([ + { + name: 'u_color', + components: 4 + }, + { + name: 'u_opacity', + components: 1 + } + ]); + program = painter.useProgram('fill', [], pragmas, pragmas); gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, opacity); painter.tileExtentVAO.bind(gl, program, painter.tileExtentBuffer); } - gl.disable(gl.STENCIL_TEST); - - // We need to draw the background in tiles in order to use calculatePosMatrix - // which applies the projection matrix (transform.projMatrix). Otherwise - // the depth and stencil buffers get into a bad state. - // This can be refactored into a single draw call once earcut lands and - // we don't have so much going on in the stencil buffer. - var coords = pyramid.coveringTiles(transform); + var coords = transform.coveringTiles({ tileSize: tileSize }); for (var c = 0; c < coords.length; c++) { var coord = coords[c]; - var tileSize = 512; - // var pixelsToTileUnitsBound = pixelsToTileUnits.bind({coord:coord, tileSize: tileSize}); if (imagePosA && imagePosB) { - var imageSizeScaledA = [ - (imagePosA.size[0] * image.fromScale), - (imagePosA.size[1] * image.fromScale) - ]; - var imageSizeScaledB = [ - (imagePosB.size[0] * image.toScale), - (imagePosB.size[1] * image.toScale) - ]; - var tile = {coord:coord, tileSize: tileSize}; - - gl.uniform2fv(program.u_patternscale_a, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledA[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledA[1], painter.transform.tileZoom) - ]); - - gl.uniform2fv(program.u_patternscale_b, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledB[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledB[1], painter.transform.tileZoom) - ]); - var tileSizeAtNearestZoom = tileSize * Math.pow(2, painter.transform.tileZoom - coord.z); - - var offsetAx = ((tileSizeAtNearestZoom / imageSizeScaledA[0]) % 1) * (coord.x + coord.w * Math.pow(2, coord.z)); - var offsetAy = ((tileSizeAtNearestZoom / imageSizeScaledA[1]) % 1) * coord.y; - - var offsetBx = ((tileSizeAtNearestZoom / imageSizeScaledB[0]) % 1) * (coord.x + coord.w * Math.pow(2, coord.z)); - var offsetBy = ((tileSizeAtNearestZoom / imageSizeScaledB[1]) % 1) * coord.y; - - gl.uniform2fv(program.u_offset_a, [offsetAx, offsetAy]); - gl.uniform2fv(program.u_offset_b, [offsetBx, offsetBy]); + var tile = { + coord: coord, + tileSize: tileSize + }; + gl.uniform1f(program.u_tile_units_to_pixels, 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom)); + var tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom - tile.coord.z); + var pixelX = tileSizeAtNearestZoom * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); + var pixelY = tileSizeAtNearestZoom * tile.coord.y; + gl.uniform2f(program.u_pixel_coord_upper, pixelX >> 16, pixelY >> 16); + gl.uniform2f(program.u_pixel_coord_lower, pixelX & 65535, pixelY & 65535); } - gl.uniformMatrix4fv(program.u_matrix, false, painter.transform.calculatePosMatrix(coord)); gl.drawArrays(gl.TRIANGLE_STRIP, 0, painter.tileExtentBuffer.length); } - - gl.stencilMask(0x00); - gl.stencilFunc(gl.EQUAL, 0x80, 0x80); + gl.stencilMask(0); + gl.stencilFunc(gl.EQUAL, 128, 128); } - -},{"../source/pixels_to_tile_units":277,"../source/tile_pyramid":282,"../util/util":349}],262:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":287,"./create_uniform_pragmas":268}],270:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); - module.exports = drawCircles; - function drawCircles(painter, source, layer, coords) { - if (painter.isOpaquePass) return; - + if (painter.isOpaquePass) + return; var gl = painter.gl; - painter.setDepthSublayer(0); painter.depthMask(false); - - // Allow circles to be drawn across boundaries, so that - // large circles are not clipped to tiles gl.disable(gl.STENCIL_TEST); - for (var i = 0; i < coords.length; i++) { var coord = coords[i]; - var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bufferGroups = bucket.bufferGroups.circle; - if (!bufferGroups) continue; - - var program = painter.useProgram('circle', bucket.getProgramMacros('circle', layer)); - - gl.uniform2fv(program.u_extrude_scale, painter.transform.pixelsToGLUnits); - gl.uniform1f(program.u_blur, layer.paint['circle-blur']); + if (!bufferGroups) + continue; + var programOptions = bucket.paintAttributes.circle[layer.id]; + var program = painter.useProgram('circle', programOptions.defines, programOptions.vertexPragmas, programOptions.fragmentPragmas); + if (layer.paint['circle-pitch-scale'] === 'map') { + gl.uniform1i(program.u_scale_with_map, true); + gl.uniform2f(program.u_extrude_scale, painter.transform.pixelsToGLUnits[0] * painter.transform.altitude, painter.transform.pixelsToGLUnits[1] * painter.transform.altitude); + } else { + gl.uniform1i(program.u_scale_with_map, false); + gl.uniform2fv(program.u_extrude_scale, painter.transform.pixelsToGLUnits); + } gl.uniform1f(program.u_devicepixelratio, browser.devicePixelRatio); - gl.uniform1f(program.u_opacity, layer.paint['circle-opacity']); - - gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix( - coord.posMatrix, - tile, - layer.paint['circle-translate'], - layer.paint['circle-translate-anchor'] - )); - - bucket.setUniforms(gl, 'circle', program, layer, {zoom: painter.transform.zoom}); - + gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['circle-translate'], layer.paint['circle-translate-anchor'])); + bucket.setUniforms(gl, 'circle', program, layer, { zoom: painter.transform.zoom }); for (var k = 0; k < bufferGroups.length; k++) { var group = bufferGroups[k]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element, group.paint[layer.id]); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer, group.paintVertexBuffers[layer.id]); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } } - -},{"../util/browser":335}],263:[function(require,module,exports){ +},{"../util/browser":350}],271:[function(require,module,exports){ 'use strict'; - module.exports = drawCollisionDebug; - function drawCollisionDebug(painter, source, layer, coords) { var gl = painter.gl; gl.enable(gl.STENCIL_TEST); var program = painter.useProgram('collisionbox'); - for (var i = 0; i < coords.length; i++) { var coord = coords[i]; var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bufferGroups = bucket.bufferGroups.collisionBox; - - if (!bufferGroups || !bufferGroups.length) continue; + if (!bufferGroups || !bufferGroups.length) + continue; var group = bufferGroups[0]; - if (group.layout.vertex.length === 0) continue; - + if (group.layoutVertexBuffer.length === 0) + continue; gl.uniformMatrix4fv(program.u_matrix, false, coord.posMatrix); - painter.enableTileClippingMask(coord); - painter.lineWidth(1); gl.uniform1f(program.u_scale, Math.pow(2, painter.transform.zoom - tile.coord.z)); gl.uniform1f(program.u_zoom, painter.transform.zoom * 10); gl.uniform1f(program.u_maxzoom, (tile.coord.z + 1) * 10); - - group.vaos[layer.id].bind(gl, program, group.layout.vertex); - gl.drawArrays(gl.LINES, 0, group.layout.vertex.length); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer); + gl.drawArrays(gl.LINES, 0, group.layoutVertexBuffer.length); } } - -},{}],264:[function(require,module,exports){ +},{}],272:[function(require,module,exports){ 'use strict'; - var textVertices = require('../lib/debugtext'); var browser = require('../util/browser'); var mat4 = require('gl-matrix').mat4; var EXTENT = require('../data/bucket').EXTENT; var Buffer = require('../data/buffer'); var VertexArrayObject = require('./vertex_array_object'); - module.exports = drawDebug; - function drawDebug(painter, source, coords) { - if (painter.isOpaquePass) return; - if (!painter.options.debug) return; - + if (painter.isOpaquePass) + return; + if (!painter.options.debug) + return; for (var i = 0; i < coords.length; i++) { drawDebugTile(painter, source, coords[i]); } } - function drawDebugTile(painter, source, coord) { var gl = painter.gl; - gl.disable(gl.STENCIL_TEST); painter.lineWidth(1 * browser.devicePixelRatio); - var posMatrix = coord.posMatrix; var program = painter.useProgram('debug'); - gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); gl.uniform4f(program.u_color, 1, 0, 0, 1); painter.debugVAO.bind(gl, program, painter.debugBuffer); gl.drawArrays(gl.LINE_STRIP, 0, painter.debugBuffer.length); - var vertices = textVertices(coord.toString(), 50, 200, 5); var debugTextArray = new painter.PosArray(); for (var v = 0; v < vertices.length; v += 2) { @@ -46340,224 +49460,143 @@ function drawDebugTile(painter, source, coord) { var debugTextVAO = new VertexArrayObject(); debugTextVAO.bind(gl, program, debugTextBuffer); gl.uniform4f(program.u_color, 1, 1, 1, 1); - - // Draw the halo with multiple 1px lines instead of one wider line because - // the gl spec doesn't guarantee support for lines with width > 1. var tileSize = source.getTile(coord).tileSize; var onePixel = EXTENT / (Math.pow(2, painter.transform.zoom - coord.z) * tileSize); - var translations = [[-1, -1], [-1, 1], [1, -1], [1, 1]]; + var translations = [ + [ + -1, + -1 + ], + [ + -1, + 1 + ], + [ + 1, + -1 + ], + [ + 1, + 1 + ] + ]; for (var i = 0; i < translations.length; i++) { var translation = translations[i]; - gl.uniformMatrix4fv(program.u_matrix, false, mat4.translate([], posMatrix, [onePixel * translation[0], onePixel * translation[1], 0])); + gl.uniformMatrix4fv(program.u_matrix, false, mat4.translate([], posMatrix, [ + onePixel * translation[0], + onePixel * translation[1], + 0 + ])); gl.drawArrays(gl.LINES, 0, debugTextBuffer.length); } - gl.uniform4f(program.u_color, 0, 0, 0, 1); gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); gl.drawArrays(gl.LINES, 0, debugTextBuffer.length); } - -},{"../data/bucket":247,"../data/buffer":252,"../lib/debugtext":259,"../util/browser":335,"./vertex_array_object":273,"gl-matrix":363}],265:[function(require,module,exports){ +},{"../data/bucket":253,"../data/buffer":258,"../lib/debugtext":266,"../util/browser":350,"./vertex_array_object":281,"gl-matrix":382}],273:[function(require,module,exports){ 'use strict'; - -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - module.exports = draw; - function draw(painter, source, layer, coords) { var gl = painter.gl; gl.enable(gl.STENCIL_TEST); - - var color = util.premultiply(layer.paint['fill-color']); - var image = layer.paint['fill-pattern']; - var strokeColor = util.premultiply(layer.paint['fill-outline-color']); - var opacity = layer.paint['fill-opacity']; - - // Draw fill - if (image ? !painter.isOpaquePass : painter.isOpaquePass === (color[3] === 1 && opacity === 1)) { - // Once we switch to earcut drawing we can pull most of the WebGL setup - // outside of this coords loop. + var isOpaque; + if (layer.paint['fill-pattern']) { + isOpaque = false; + } else { + isOpaque = layer.isPaintValueFeatureConstant('fill-color') && layer.isPaintValueFeatureConstant('fill-opacity') && layer.paint['fill-color'][3] === 1 && layer.paint['fill-opacity'] === 1; + } + if (painter.isOpaquePass === isOpaque) { + painter.setDepthSublayer(1); for (var i = 0; i < coords.length; i++) { drawFill(painter, source, layer, coords[i]); } } - - // Draw stroke if (!painter.isOpaquePass && layer.paint['fill-antialias']) { - if (strokeColor || !layer.paint['fill-pattern']) { - var outlineProgram = painter.useProgram('outline'); - painter.lineWidth(2); - painter.depthMask(false); - - if (strokeColor) { - // If we defined a different color for the fill outline, we are - // going to ignore the bits in 0x07 and just care about the global - // clipping mask. + painter.lineWidth(2); + painter.depthMask(false); + var isOutlineColorDefined = layer.getPaintProperty('fill-outline-color'); + if (isOutlineColorDefined || !layer.paint['fill-pattern']) { + if (isOutlineColorDefined) { painter.setDepthSublayer(2); } else { - // Otherwise, we only want to drawFill the antialiased parts that are - // *outside* the current shape. This is important in case the fill - // or stroke color is translucent. If we wouldn't clip to outside - // the current shape, some pixels from the outline stroke overlapped - // the (non-antialiased) fill. painter.setDepthSublayer(0); } - gl.uniform2f(outlineProgram.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); - gl.uniform4fv(outlineProgram.u_color, strokeColor ? strokeColor : color); - gl.uniform1f(outlineProgram.u_opacity, opacity); - - for (var j = 0; j < coords.length; j++) { - drawStroke(painter, source, layer, coords[j]); - } } else { - var outlinePatternProgram = painter.useProgram('outlinepattern'); - painter.lineWidth(2); - painter.depthMask(false); - // Otherwise, we only want to drawFill the antialiased parts that are - // *outside* the current shape. This is important in case the fill - // or stroke color is translucent. If we wouldn't clip to outside - // the current shape, some pixels from the outline stroke overlapped - // the (non-antialiased) fill. painter.setDepthSublayer(0); - gl.uniform2f(outlinePatternProgram.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); - - for (var k = 0; k < coords.length; k++) { - drawStroke(painter, source, layer, coords[k]); - } } - + for (var j = 0; j < coords.length; j++) { + drawStroke(painter, source, layer, coords[j]); + } } } - function drawFill(painter, source, layer, coord) { var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) return; + if (!bucket) + return; var bufferGroups = bucket.bufferGroups.fill; - if (!bufferGroups) return; - + if (!bufferGroups) + return; var gl = painter.gl; - - var color = util.premultiply(layer.paint['fill-color']); var image = layer.paint['fill-pattern']; - var opacity = layer.paint['fill-opacity']; - - var posMatrix = coord.posMatrix; - var translatedPosMatrix = painter.translatePosMatrix(posMatrix, tile, layer.paint['fill-translate'], layer.paint['fill-translate-anchor']); - - // Draw the stencil mask. - painter.setDepthSublayer(1); - - // We're only drawFilling to the first seven bits (== support a maximum of - // 8 overlapping polygons in one place before we get rendering errors). - gl.stencilMask(0x07); - gl.clear(gl.STENCIL_BUFFER_BIT); - - // Draw front facing triangles. Wherever the 0x80 bit is 1, we are - // increasing the lower 7 bits by one if the triangle is a front-facing - // triangle. This means that all visible polygons should be in CCW - // orientation, while all holes (see below) are in CW orientation. - painter.enableTileClippingMask(coord); - - // When we do a nonzero fill, we count the number of times a pixel is - // covered by a counterclockwise polygon, and subtract the number of - // times it is "uncovered" by a clockwise polygon. - gl.stencilOpSeparate(gl.FRONT, gl.KEEP, gl.KEEP, gl.INCR_WRAP); - gl.stencilOpSeparate(gl.BACK, gl.KEEP, gl.KEEP, gl.DECR_WRAP); - - // When drawFilling a shape, we first drawFill all shapes to the stencil buffer - // and incrementing all areas where polygons are - gl.colorMask(false, false, false, false); - painter.depthMask(false); - - // Draw the actual triangle fan into the stencil buffer. - var fillProgram = painter.useProgram('fill'); - gl.uniformMatrix4fv(fillProgram.u_matrix, false, translatedPosMatrix); - - for (var i = 0; i < bufferGroups.length; i++) { - var group = bufferGroups[i]; - group.vaos[layer.id].bind(gl, fillProgram, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); - } - - // Now that we have the stencil mask in the stencil buffer, we can start - // writing to the color buffer. - gl.colorMask(true, true, true, true); - painter.depthMask(true); - - // From now on, we don't want to update the stencil buffer anymore. - gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); - gl.stencilMask(0x0); var program; - - if (image) { - // Draw texture fill + if (!image) { + var programOptions = bucket.paintAttributes.fill[layer.id]; + program = painter.useProgram('fill', programOptions.defines, programOptions.vertexPragmas, programOptions.fragmentPragmas); + bucket.setUniforms(gl, 'fill', program, layer, { zoom: painter.transform.zoom }); + } else { program = painter.useProgram('pattern'); - setPattern(image, opacity, tile, coord, painter, program); - + setPattern(image, layer.paint['fill-opacity'], tile, coord, painter, program); gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); - - painter.tileExtentPatternVAO.bind(gl, program, painter.tileExtentBuffer); - - } else { - // Draw filling rectangle. - program = painter.useProgram('fill'); - gl.uniform4fv(fillProgram.u_color, color); - gl.uniform1f(fillProgram.u_opacity, opacity); - painter.tileExtentVAO.bind(gl, program, painter.tileExtentBuffer); } - - gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); - - // Only draw regions that we marked - gl.stencilFunc(gl.NOTEQUAL, 0x0, 0x07); - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, painter.tileExtentBuffer.length); - - gl.stencilMask(0x00); + gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['fill-translate'], layer.paint['fill-translate-anchor'])); + painter.enableTileClippingMask(coord); + for (var i = 0; i < bufferGroups.length; i++) { + var group = bufferGroups[i]; + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer, group.paintVertexBuffers[layer.id]); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length, gl.UNSIGNED_SHORT, 0); + } } - function drawStroke(painter, source, layer, coord) { var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) return; - + if (!bucket) + return; var gl = painter.gl; var bufferGroups = bucket.bufferGroups.fill; - var image = layer.paint['fill-pattern']; var opacity = layer.paint['fill-opacity']; - var program = image ? painter.useProgram('outlinepattern') : painter.useProgram('outline'); - - gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix( - coord.posMatrix, - tile, - layer.paint['fill-translate'], - layer.paint['fill-translate-anchor'] - )); - - if (image) { setPattern(image, opacity, tile, coord, painter, program); } - + var isOutlineColorDefined = layer.getPaintProperty('fill-outline-color'); + var program; + if (image && !isOutlineColorDefined) { + program = painter.useProgram('outlinepattern'); + gl.uniform2f(program.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); + } else { + var programOptions = bucket.paintAttributes.fill[layer.id]; + program = painter.useProgram('outline', programOptions.defines, programOptions.vertexPragmas, programOptions.fragmentPragmas); + gl.uniform2f(program.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight); + gl.uniform1f(program.u_opacity, opacity); + bucket.setUniforms(gl, 'fill', program, layer, { zoom: painter.transform.zoom }); + } + gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['fill-translate'], layer.paint['fill-translate-anchor'])); + if (image) { + setPattern(image, opacity, tile, coord, painter, program); + } painter.enableTileClippingMask(coord); - for (var k = 0; k < bufferGroups.length; k++) { var group = bufferGroups[k]; - group.secondVaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element2); - gl.drawElements(gl.LINES, group.layout.element2.length * 2, gl.UNSIGNED_SHORT, 0); + group.secondVaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer2, group.paintVertexBuffers[layer.id]); + gl.drawElements(gl.LINES, group.elementBuffer2.length * 2, gl.UNSIGNED_SHORT, 0); } } - - function setPattern(image, opacity, tile, coord, painter, program) { var gl = painter.gl; - var imagePosA = painter.spriteAtlas.getPosition(image.from, true); var imagePosB = painter.spriteAtlas.getPosition(image.to, true); - if (!imagePosA || !imagePosB) return; - - + if (!imagePosA || !imagePosB) + return; gl.uniform1i(program.u_image, 0); gl.uniform2fv(program.u_pattern_tl_a, imagePosA.tl); gl.uniform2fv(program.u_pattern_br_a, imagePosA.br); @@ -46565,142 +49604,80 @@ function setPattern(image, opacity, tile, coord, painter, program) { gl.uniform2fv(program.u_pattern_br_b, imagePosB.br); gl.uniform1f(program.u_opacity, opacity); gl.uniform1f(program.u_mix, image.t); - - var imageSizeScaledA = [ - (imagePosA.size[0] * image.fromScale), - (imagePosA.size[1] * image.fromScale) - ]; - var imageSizeScaledB = [ - (imagePosB.size[0] * image.toScale), - (imagePosB.size[1] * image.toScale) - ]; - - gl.uniform2fv(program.u_patternscale_a, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledA[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledA[1], painter.transform.tileZoom) - ]); - - gl.uniform2fv(program.u_patternscale_b, [ - 1 / pixelsToTileUnits(tile, imageSizeScaledB[0], painter.transform.tileZoom), - 1 / pixelsToTileUnits(tile, imageSizeScaledB[1], painter.transform.tileZoom) - ]); - + gl.uniform1f(program.u_tile_units_to_pixels, 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom)); + gl.uniform2fv(program.u_pattern_size_a, imagePosA.size); + gl.uniform2fv(program.u_pattern_size_b, imagePosB.size); + gl.uniform1f(program.u_scale_a, image.fromScale); + gl.uniform1f(program.u_scale_b, image.toScale); var tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom - tile.coord.z); - - // shift images to match at tile boundaries - var offsetAx = ((tileSizeAtNearestZoom / imageSizeScaledA[0]) % 1) * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); - var offsetAy = ((tileSizeAtNearestZoom / imageSizeScaledA[1]) % 1) * tile.coord.y; - - var offsetBx = ((tileSizeAtNearestZoom / imageSizeScaledB[0]) % 1) * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); - var offsetBy = ((tileSizeAtNearestZoom / imageSizeScaledB[1]) % 1) * tile.coord.y; - - gl.uniform2fv(program.u_offset_a, [offsetAx, offsetAy]); - gl.uniform2fv(program.u_offset_b, [offsetBx, offsetBy]); - + var pixelX = tileSizeAtNearestZoom * (tile.coord.x + coord.w * Math.pow(2, tile.coord.z)); + var pixelY = tileSizeAtNearestZoom * tile.coord.y; + gl.uniform2f(program.u_pixel_coord_upper, pixelX >> 16, pixelY >> 16); + gl.uniform2f(program.u_pixel_coord_lower, pixelX & 65535, pixelY & 65535); gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); } - -},{"../source/pixels_to_tile_units":277,"../util/util":349}],266:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":287}],274:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); var mat2 = require('gl-matrix').mat2; -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - -/** - * Draw a line. Under the hood this will read elements from - * a tile, dash textures from a lineAtlas, and style properties from a layer. - * @param {Object} painter - * @param {Object} layer - * @param {Object} posMatrix - * @param {Tile} tile - * @returns {undefined} draws with the painter - * @private - */ module.exports = function drawLine(painter, source, layer, coords) { - if (painter.isOpaquePass) return; + if (painter.isOpaquePass) + return; painter.setDepthSublayer(0); painter.depthMask(false); - var gl = painter.gl; gl.enable(gl.STENCIL_TEST); - - // don't draw zero-width lines - if (layer.paint['line-width'] <= 0) return; - - // the distance over which the line edge fades out. - // Retina devices need a smaller distance to avoid aliasing. + if (layer.paint['line-width'] <= 0) + return; var antialiasing = 1 / browser.devicePixelRatio; - var blur = layer.paint['line-blur'] + antialiasing; - var edgeWidth = layer.paint['line-width'] / 2; - var inset = -1; - var offset = 0; - var shift = 0; - - if (layer.paint['line-gap-width'] > 0) { - inset = layer.paint['line-gap-width'] / 2 + antialiasing * 0.5; - edgeWidth = layer.paint['line-width']; - - // shift outer lines half a pixel towards the middle to eliminate the crack - offset = inset - antialiasing / 2; - } - - var outset = offset + edgeWidth + antialiasing / 2 + shift; - var color = util.premultiply(layer.paint['line-color']); - + var color = layer.paint['line-color']; var tr = painter.transform; - var antialiasingMatrix = mat2.create(); - mat2.scale(antialiasingMatrix, antialiasingMatrix, [1, Math.cos(tr._pitch)]); + mat2.scale(antialiasingMatrix, antialiasingMatrix, [ + 1, + Math.cos(tr._pitch) + ]); mat2.rotate(antialiasingMatrix, antialiasingMatrix, painter.transform.angle); - - // calculate how much longer the real world distance is at the top of the screen - // than at the middle of the screen. - var topedgelength = Math.sqrt(tr.height * tr.height / 4 * (1 + tr.altitude * tr.altitude)); + var topedgelength = Math.sqrt(tr.height * tr.height / 4 * (1 + tr.altitude * tr.altitude)); var x = tr.height / 2 * Math.tan(tr._pitch); var extra = (topedgelength + x) / topedgelength - 1; - var dasharray = layer.paint['line-dasharray']; var image = layer.paint['line-pattern']; var program, posA, posB, imagePosA, imagePosB; - if (dasharray) { program = painter.useProgram('linesdfpattern'); - - gl.uniform2fv(program.u_linewidth, [ outset, inset ]); + gl.uniform1f(program.u_linewidth, layer.paint['line-width'] / 2); + gl.uniform1f(program.u_gapwidth, layer.paint['line-gap-width'] / 2); + gl.uniform1f(program.u_antialiasing, antialiasing / 2); gl.uniform1f(program.u_blur, blur); gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, layer.paint['line-opacity']); - posA = painter.lineAtlas.getDash(dasharray.from, layer.layout['line-cap'] === 'round'); posB = painter.lineAtlas.getDash(dasharray.to, layer.layout['line-cap'] === 'round'); - gl.uniform1i(program.u_image, 0); gl.activeTexture(gl.TEXTURE0); painter.lineAtlas.bind(gl); - gl.uniform1f(program.u_tex_y_a, posA.y); gl.uniform1f(program.u_tex_y_b, posB.y); gl.uniform1f(program.u_mix, dasharray.t); gl.uniform1f(program.u_extra, extra); gl.uniform1f(program.u_offset, -layer.paint['line-offset']); gl.uniformMatrix2fv(program.u_antialiasingmatrix, false, antialiasingMatrix); - } else if (image) { imagePosA = painter.spriteAtlas.getPosition(image.from, true); imagePosB = painter.spriteAtlas.getPosition(image.to, true); - if (!imagePosA || !imagePosB) return; - + if (!imagePosA || !imagePosB) + return; program = painter.useProgram('linepattern'); - gl.uniform1i(program.u_image, 0); gl.activeTexture(gl.TEXTURE0); painter.spriteAtlas.bind(gl, true); - - gl.uniform2fv(program.u_linewidth, [ outset, inset ]); + gl.uniform1f(program.u_linewidth, layer.paint['line-width'] / 2); + gl.uniform1f(program.u_gapwidth, layer.paint['line-gap-width'] / 2); + gl.uniform1f(program.u_antialiasing, antialiasing / 2); gl.uniform1f(program.u_blur, blur); gl.uniform2fv(program.u_pattern_tl_a, imagePosA.tl); gl.uniform2fv(program.u_pattern_br_a, imagePosA.br); @@ -46711,11 +49688,11 @@ module.exports = function drawLine(painter, source, layer, coords) { gl.uniform1f(program.u_extra, extra); gl.uniform1f(program.u_offset, -layer.paint['line-offset']); gl.uniformMatrix2fv(program.u_antialiasingmatrix, false, antialiasingMatrix); - } else { program = painter.useProgram('line'); - - gl.uniform2fv(program.u_linewidth, [ outset, inset ]); + gl.uniform1f(program.u_linewidth, layer.paint['line-width'] / 2); + gl.uniform1f(program.u_gapwidth, layer.paint['line-gap-width'] / 2); + gl.uniform1f(program.u_antialiasing, antialiasing / 2); gl.uniform1f(program.u_blur, blur); gl.uniform1f(program.u_extra, extra); gl.uniform1f(program.u_offset, -layer.paint['line-offset']); @@ -46723,34 +49700,35 @@ module.exports = function drawLine(painter, source, layer, coords) { gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, layer.paint['line-opacity']); } - for (var k = 0; k < coords.length; k++) { var coord = coords[k]; var tile = source.getTile(coord); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bufferGroups = bucket.bufferGroups.line; - if (!bufferGroups) continue; - + if (!bufferGroups) + continue; painter.enableTileClippingMask(coord); - - // set uniforms that are different for each tile var posMatrix = painter.translatePosMatrix(coord.posMatrix, tile, layer.paint['line-translate'], layer.paint['line-translate-anchor']); gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); - var ratio = 1 / pixelsToTileUnits(tile, 1, painter.transform.zoom); - if (dasharray) { var widthA = posA.width * dasharray.fromScale; var widthB = posB.width * dasharray.toScale; - var scaleA = [1 / pixelsToTileUnits(tile, widthA, painter.transform.tileZoom), -posA.height / 2]; - var scaleB = [1 / pixelsToTileUnits(tile, widthB, painter.transform.tileZoom), -posB.height / 2]; + var scaleA = [ + 1 / pixelsToTileUnits(tile, widthA, painter.transform.tileZoom), + -posA.height / 2 + ]; + var scaleB = [ + 1 / pixelsToTileUnits(tile, widthB, painter.transform.tileZoom), + -posB.height / 2 + ]; var gamma = painter.lineAtlas.width / (Math.min(widthA, widthB) * 256 * browser.devicePixelRatio) / 2; gl.uniform1f(program.u_ratio, ratio); gl.uniform2fv(program.u_patternscale_a, scaleA); gl.uniform2fv(program.u_patternscale_b, scaleB); gl.uniform1f(program.u_sdfgamma, gamma); - } else if (image) { gl.uniform1f(program.u_ratio, ratio); gl.uniform2fv(program.u_pattern_size_a, [ @@ -46761,110 +49739,93 @@ module.exports = function drawLine(painter, source, layer, coords) { pixelsToTileUnits(tile, imagePosB.size[0] * image.toScale, painter.transform.tileZoom), imagePosB.size[1] ]); - } else { gl.uniform1f(program.u_ratio, ratio); } - for (var i = 0; i < bufferGroups.length; i++) { var group = bufferGroups[i]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } - }; - -},{"../source/pixels_to_tile_units":277,"../util/browser":335,"../util/util":349,"gl-matrix":363}],267:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":287,"../util/browser":350,"gl-matrix":382}],275:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var StructArrayType = require('../util/struct_array'); - module.exports = drawRaster; - function drawRaster(painter, source, layer, coords) { - if (painter.isOpaquePass) return; - + if (painter.isOpaquePass) + return; var gl = painter.gl; - gl.enable(gl.DEPTH_TEST); painter.depthMask(true); - - // Change depth function to prevent double drawing in areas where tiles overlap. gl.depthFunc(gl.LESS); - var minTileZ = coords.length && coords[0].z; - for (var i = 0; i < coords.length; i++) { var coord = coords[i]; - // set the lower zoom level to sublayer 0, and higher zoom levels to higher sublayers painter.setDepthSublayer(coord.z - minTileZ); drawRasterTile(painter, source, layer, coord); } - gl.depthFunc(gl.LEQUAL); } - drawRaster.RasterBoundsArray = new StructArrayType({ members: [ - { name: 'a_pos', type: 'Int16', components: 2 }, - { name: 'a_texture_pos', type: 'Int16', components: 2 } + { + name: 'a_pos', + type: 'Int16', + components: 2 + }, + { + name: 'a_texture_pos', + type: 'Int16', + components: 2 + } ] }); - function drawRasterTile(painter, source, layer, coord) { - var gl = painter.gl; - gl.disable(gl.STENCIL_TEST); - var tile = source.getTile(coord); var posMatrix = painter.transform.calculatePosMatrix(coord, source.maxzoom); - var program = painter.useProgram('raster'); gl.uniformMatrix4fv(program.u_matrix, false, posMatrix); - - // color parameters gl.uniform1f(program.u_brightness_low, layer.paint['raster-brightness-min']); gl.uniform1f(program.u_brightness_high, layer.paint['raster-brightness-max']); gl.uniform1f(program.u_saturation_factor, saturationFactor(layer.paint['raster-saturation'])); gl.uniform1f(program.u_contrast_factor, contrastFactor(layer.paint['raster-contrast'])); gl.uniform3fv(program.u_spin_weights, spinWeights(layer.paint['raster-hue-rotate'])); - - var parentTile = tile.source && tile.source._pyramid.findLoadedParent(coord, 0, {}), - opacities = getOpacities(tile, parentTile, layer, painter.transform); - + var parentTile = tile.source && tile.source.findLoadedParent(coord, 0, {}), opacities = getOpacities(tile, parentTile, layer, painter.transform); var parentScaleBy, parentTL; - gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, tile.texture); - + gl.activeTexture(gl.TEXTURE1); if (parentTile) { - gl.activeTexture(gl.TEXTURE1); gl.bindTexture(gl.TEXTURE_2D, parentTile.texture); - parentScaleBy = Math.pow(2, parentTile.coord.z - tile.coord.z); - parentTL = [tile.coord.x * parentScaleBy % 1, tile.coord.y * parentScaleBy % 1]; + parentTL = [ + tile.coord.x * parentScaleBy % 1, + tile.coord.y * parentScaleBy % 1 + ]; } else { + gl.bindTexture(gl.TEXTURE_2D, tile.texture); opacities[1] = 0; } - - // cross-fade parameters - gl.uniform2fv(program.u_tl_parent, parentTL || [0, 0]); + gl.uniform2fv(program.u_tl_parent, parentTL || [ + 0, + 0 + ]); gl.uniform1f(program.u_scale_parent, parentScaleBy || 1); gl.uniform1f(program.u_buffer_scale, 1); gl.uniform1f(program.u_opacity0, opacities[0]); gl.uniform1f(program.u_opacity1, opacities[1]); gl.uniform1i(program.u_image0, 0); gl.uniform1i(program.u_image1, 1); - var buffer = tile.boundsBuffer || painter.rasterBoundsBuffer; var vao = tile.boundsVAO || painter.rasterBoundsVAO; vao.bind(gl, program, buffer); gl.drawArrays(gl.TRIANGLE_STRIP, 0, buffer.length); } - function spinWeights(angle) { angle *= Math.PI / 180; var s = Math.sin(angle); @@ -46875,288 +49836,184 @@ function spinWeights(angle) { (Math.sqrt(3) * s - c + 1) / 3 ]; } - function contrastFactor(contrast) { - return contrast > 0 ? - 1 / (1 - contrast) : - 1 + contrast; + return contrast > 0 ? 1 / (1 - contrast) : 1 + contrast; } - function saturationFactor(saturation) { - return saturation > 0 ? - 1 - 1 / (1.001 - saturation) : - -saturation; + return saturation > 0 ? 1 - 1 / (1.001 - saturation) : -saturation; } - function getOpacities(tile, parentTile, layer, transform) { - var opacity = [1, 0]; + var opacity = [ + 1, + 0 + ]; var fadeDuration = layer.paint['raster-fade-duration']; - if (tile.source && fadeDuration > 0) { var now = new Date().getTime(); - var sinceTile = (now - tile.timeAdded) / fadeDuration; var sinceParent = parentTile ? (now - parentTile.timeAdded) / fadeDuration : -1; - - var idealZ = tile.source._pyramid.coveringZoomLevel(transform); + var idealZ = transform.coveringZoomLevel(tile.source); var parentFurther = parentTile ? Math.abs(parentTile.coord.z - idealZ) > Math.abs(tile.coord.z - idealZ) : false; - if (!parentTile || parentFurther) { - // if no parent or parent is older opacity[0] = util.clamp(sinceTile, 0, 1); opacity[1] = 1 - opacity[0]; } else { - // parent is younger, zooming out opacity[0] = util.clamp(1 - sinceParent, 0, 1); opacity[1] = 1 - opacity[0]; } } - var op = layer.paint['raster-opacity']; opacity[0] *= op; opacity[1] *= op; - return opacity; } - -},{"../util/struct_array":347,"../util/util":349}],268:[function(require,module,exports){ +},{"../util/struct_array":364,"../util/util":366}],276:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); var drawCollisionDebug = require('./draw_collision_debug'); -var util = require('../util/util'); var pixelsToTileUnits = require('../source/pixels_to_tile_units'); - - module.exports = drawSymbols; - function drawSymbols(painter, source, layer, coords) { - if (painter.isOpaquePass) return; - - var drawAcrossEdges = !(layer.layout['text-allow-overlap'] || layer.layout['icon-allow-overlap'] || - layer.layout['text-ignore-placement'] || layer.layout['icon-ignore-placement']); - + if (painter.isOpaquePass) + return; + var drawAcrossEdges = !(layer.layout['text-allow-overlap'] || layer.layout['icon-allow-overlap'] || layer.layout['text-ignore-placement'] || layer.layout['icon-ignore-placement']); var gl = painter.gl; - - // Disable the stencil test so that labels aren't clipped to tile boundaries. - // - // Layers with features that may be drawn overlapping aren't clipped. These - // layers are sorted in the y direction, and to draw the correct ordering near - // tile edges the icons are included in both tiles and clipped when drawing. if (drawAcrossEdges) { gl.disable(gl.STENCIL_TEST); } else { gl.enable(gl.STENCIL_TEST); } - painter.setDepthSublayer(0); painter.depthMask(false); gl.disable(gl.DEPTH_TEST); - - drawLayerSymbols(painter, source, layer, coords, false, - layer.paint['icon-translate'], - layer.paint['icon-translate-anchor'], - layer.layout['icon-rotation-alignment'], - layer.layout['icon-size'], - layer.paint['icon-halo-width'], - layer.paint['icon-halo-color'], - layer.paint['icon-halo-blur'], - layer.paint['icon-opacity'], - layer.paint['icon-color']); - - drawLayerSymbols(painter, source, layer, coords, true, - layer.paint['text-translate'], - layer.paint['text-translate-anchor'], - layer.layout['text-rotation-alignment'], - layer.layout['text-size'], - layer.paint['text-halo-width'], - layer.paint['text-halo-color'], - layer.paint['text-halo-blur'], - layer.paint['text-opacity'], - layer.paint['text-color']); - + drawLayerSymbols(painter, source, layer, coords, false, layer.paint['icon-translate'], layer.paint['icon-translate-anchor'], layer.layout['icon-rotation-alignment'], layer.layout['icon-rotation-alignment'], layer.layout['icon-size'], layer.paint['icon-halo-width'], layer.paint['icon-halo-color'], layer.paint['icon-halo-blur'], layer.paint['icon-opacity'], layer.paint['icon-color']); + drawLayerSymbols(painter, source, layer, coords, true, layer.paint['text-translate'], layer.paint['text-translate-anchor'], layer.layout['text-rotation-alignment'], layer.layout['text-pitch-alignment'], layer.layout['text-size'], layer.paint['text-halo-width'], layer.paint['text-halo-color'], layer.paint['text-halo-blur'], layer.paint['text-opacity'], layer.paint['text-color']); gl.enable(gl.DEPTH_TEST); - - drawCollisionDebug(painter, source, layer, coords); + if (source.map.showCollisionBoxes) { + drawCollisionDebug(painter, source, layer, coords); + } } - -function drawLayerSymbols(painter, source, layer, coords, isText, - translate, - translateAnchor, - rotationAlignment, - size, - haloWidth, - haloColor, - haloBlur, - opacity, - color) { - - haloColor = util.premultiply(haloColor); - color = util.premultiply(color); - +function drawLayerSymbols(painter, source, layer, coords, isText, translate, translateAnchor, rotationAlignment, pitchAlignment, size, haloWidth, haloColor, haloBlur, opacity, color) { for (var j = 0; j < coords.length; j++) { var tile = source.getTile(coords[j]); var bucket = tile.getBucket(layer); - if (!bucket) continue; + if (!bucket) + continue; var bothBufferGroups = bucket.bufferGroups; var bufferGroups = isText ? bothBufferGroups.glyph : bothBufferGroups.icon; - if (!bufferGroups.length) continue; - + if (!bufferGroups.length) + continue; painter.enableTileClippingMask(coords[j]); - drawSymbol(painter, layer, coords[j].posMatrix, tile, bucket, bufferGroups, isText, - isText || bucket.sdfIcons, !isText && bucket.iconsNeedLinear, - isText ? bucket.adjustedTextSize : bucket.adjustedIconSize, bucket.fontstack, - translate, - translateAnchor, - rotationAlignment, - size, - haloWidth, - haloColor, - haloBlur, - opacity, - color); - } -} - -function drawSymbol(painter, layer, posMatrix, tile, bucket, bufferGroups, isText, sdf, iconsNeedLinear, adjustedSize, fontstack, - translate, - translateAnchor, - rotationAlignment, - size, - haloWidth, - haloColor, - haloBlur, - opacity, - color) { + drawSymbol(painter, layer, coords[j].posMatrix, tile, bucket, bufferGroups, isText, isText || bucket.sdfIcons, !isText && bucket.iconsNeedLinear, isText ? bucket.adjustedTextSize : bucket.adjustedIconSize, bucket.fontstack, translate, translateAnchor, rotationAlignment, pitchAlignment, size, haloWidth, haloColor, haloBlur, opacity, color); + } +} +function drawSymbol(painter, layer, posMatrix, tile, bucket, bufferGroups, isText, sdf, iconsNeedLinear, adjustedSize, fontstack, translate, translateAnchor, rotationAlignment, pitchAlignment, size, haloWidth, haloColor, haloBlur, opacity, color) { var gl = painter.gl; var tr = painter.transform; - var alignedWithMap = rotationAlignment === 'map'; - + var rotateWithMap = rotationAlignment === 'map'; + var pitchWithMap = pitchAlignment === 'map'; var defaultSize = isText ? 24 : 1; var fontScale = size / defaultSize; - var extrudeScale, s, gammaScale; - if (alignedWithMap) { + if (pitchWithMap) { s = pixelsToTileUnits(tile, 1, painter.transform.zoom) * fontScale; gammaScale = 1 / Math.cos(tr._pitch); - extrudeScale = [s, s]; + extrudeScale = [ + s, + s + ]; } else { s = painter.transform.altitude * fontScale; gammaScale = 1; - extrudeScale = [ tr.pixelsToGLUnits[0] * s, tr.pixelsToGLUnits[1] * s]; + extrudeScale = [ + tr.pixelsToGLUnits[0] * s, + tr.pixelsToGLUnits[1] * s + ]; } - - // calculate how much longer the real world distance is at the top of the screen - // than at the middle of the screen. - var topedgelength = Math.sqrt(tr.height * tr.height / 4 * (1 + tr.altitude * tr.altitude)); - var x = tr.height / 2 * Math.tan(tr._pitch); - var extra = (topedgelength + x) / topedgelength - 1; - if (!isText && !painter.style.sprite.loaded()) return; - var program = painter.useProgram(sdf ? 'sdf' : 'icon'); gl.uniformMatrix4fv(program.u_matrix, false, painter.translatePosMatrix(posMatrix, tile, translate, translateAnchor)); - gl.uniform1i(program.u_skewed, alignedWithMap); - gl.uniform1f(program.u_extra, extra); + gl.uniform1i(program.u_rotate_with_map, rotateWithMap); + gl.uniform1i(program.u_pitch_with_map, pitchWithMap); gl.uniform2fv(program.u_extrude_scale, extrudeScale); - gl.activeTexture(gl.TEXTURE0); gl.uniform1i(program.u_texture, 0); - if (isText) { - // use the fonstack used when parsing the tile, not the fontstack - // at the current zoom level (layout['text-font']). var glyphAtlas = fontstack && painter.glyphSource.getGlyphAtlas(fontstack); - if (!glyphAtlas) return; - + if (!glyphAtlas) + return; glyphAtlas.updateTexture(gl); gl.uniform2f(program.u_texsize, glyphAtlas.width / 4, glyphAtlas.height / 4); } else { var mapMoving = painter.options.rotating || painter.options.zooming; var iconScaled = fontScale !== 1 || browser.devicePixelRatio !== painter.spriteAtlas.pixelRatio || iconsNeedLinear; - var iconTransformed = alignedWithMap || painter.transform.pitch; + var iconTransformed = pitchWithMap || painter.transform.pitch; painter.spriteAtlas.bind(gl, sdf || mapMoving || iconScaled || iconTransformed); gl.uniform2f(program.u_texsize, painter.spriteAtlas.width / 4, painter.spriteAtlas.height / 4); } - - // adjust min/max zooms for variable font sizes var zoomAdjust = Math.log(size / adjustedSize) / Math.LN2 || 0; - gl.uniform1f(program.u_zoom, (painter.transform.zoom - zoomAdjust) * 10); // current zoom level - + gl.uniform1f(program.u_zoom, (painter.transform.zoom - zoomAdjust) * 10); gl.activeTexture(gl.TEXTURE1); painter.frameHistory.bind(gl); gl.uniform1i(program.u_fadetexture, 1); - var group; - if (sdf) { var sdfPx = 8; var blurOffset = 1.19; var haloOffset = 6; var gamma = 0.105 * defaultSize / size / browser.devicePixelRatio; - if (haloWidth) { - // Draw halo underneath the text. gl.uniform1f(program.u_gamma, (haloBlur * blurOffset / fontScale / sdfPx + gamma) * gammaScale); gl.uniform4fv(program.u_color, haloColor); gl.uniform1f(program.u_opacity, opacity); gl.uniform1f(program.u_buffer, (haloOffset - haloWidth / fontScale) / sdfPx); - for (var j = 0; j < bufferGroups.length; j++) { group = bufferGroups[j]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } - gl.uniform1f(program.u_gamma, gamma * gammaScale); gl.uniform4fv(program.u_color, color); gl.uniform1f(program.u_opacity, opacity); gl.uniform1f(program.u_buffer, (256 - 64) / 256); - + gl.uniform1f(program.u_pitch, tr.pitch / 360 * 2 * Math.PI); + gl.uniform1f(program.u_bearing, tr.bearing / 360 * 2 * Math.PI); + gl.uniform1f(program.u_aspect_ratio, tr.width / tr.height); for (var i = 0; i < bufferGroups.length; i++) { group = bufferGroups[i]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } - } else { gl.uniform1f(program.u_opacity, opacity); for (var k = 0; k < bufferGroups.length; k++) { group = bufferGroups[k]; - group.vaos[layer.id].bind(gl, program, group.layout.vertex, group.layout.element); - gl.drawElements(gl.TRIANGLES, group.layout.element.length * 3, gl.UNSIGNED_SHORT, 0); + group.vaos[layer.id].bind(gl, program, group.layoutVertexBuffer, group.elementBuffer); + gl.drawElements(gl.TRIANGLES, group.elementBuffer.length * 3, gl.UNSIGNED_SHORT, 0); } } } - -},{"../source/pixels_to_tile_units":277,"../util/browser":335,"../util/util":349,"./draw_collision_debug":263}],269:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":287,"../util/browser":350,"./draw_collision_debug":271}],277:[function(require,module,exports){ 'use strict'; - module.exports = FrameHistory; - function FrameHistory() { this.changeTimes = new Float64Array(256); this.changeOpacities = new Uint8Array(256); this.opacities = new Uint8ClampedArray(256); this.array = new Uint8Array(this.opacities.buffer); - this.fadeDuration = 300; this.previousZoom = 0; this.firstFrame = true; } - -FrameHistory.prototype.record = function(zoom) { +FrameHistory.prototype.record = function (zoom) { var now = Date.now(); - if (this.firstFrame) { now = 0; this.firstFrame = false; } - zoom = Math.floor(zoom * 10); - var z; if (zoom < this.previousZoom) { for (z = zoom + 1; z <= this.previousZoom; z++) { @@ -47169,7 +50026,6 @@ FrameHistory.prototype.record = function(zoom) { this.changeOpacities[z] = this.opacities[z]; } } - for (z = 0; z < 256; z++) { var timeSince = now - this.changeTimes[z]; var opacityChange = timeSince / this.fadeDuration * 255; @@ -47179,12 +50035,10 @@ FrameHistory.prototype.record = function(zoom) { this.opacities[z] = this.changeOpacities[z] - opacityChange; } } - this.changed = true; this.previousZoom = zoom; }; - -FrameHistory.prototype.bind = function(gl) { +FrameHistory.prototype.bind = function (gl) { if (!this.texture) { this.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.texture); @@ -47193,7 +50047,6 @@ FrameHistory.prototype.bind = function(gl) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, 256, 1, 0, gl.ALPHA, gl.UNSIGNED_BYTE, this.array); - } else { gl.bindTexture(gl.TEXTURE_2D, this.texture); if (this.changed) { @@ -47202,105 +50055,64 @@ FrameHistory.prototype.bind = function(gl) { } } }; - -},{}],270:[function(require,module,exports){ +},{}],278:[function(require,module,exports){ 'use strict'; - +var util = require('../util/util'); module.exports = LineAtlas; - -/** - * A LineAtlas lets us reuse rendered dashed lines - * by writing many of them to a texture and then fetching their positions - * using .getDash. - * - * @param {number} width - * @param {number} height - * @private - */ function LineAtlas(width, height) { this.width = width; this.height = height; this.nextRow = 0; - this.bytes = 4; this.data = new Uint8Array(this.width * this.height * this.bytes); - this.positions = {}; } - -LineAtlas.prototype.setSprite = function(sprite) { +LineAtlas.prototype.setSprite = function (sprite) { this.sprite = sprite; }; - -/** - * Get or create a dash line pattern. - * - * @param {Array} dasharray - * @param {boolean} round whether to add circle caps in between dash segments - * @returns {Object} position of dash texture in { y, height, width } - * @private - */ -LineAtlas.prototype.getDash = function(dasharray, round) { - var key = dasharray.join(",") + round; - +LineAtlas.prototype.getDash = function (dasharray, round) { + var key = dasharray.join(',') + round; if (!this.positions[key]) { this.positions[key] = this.addDash(dasharray, round); } return this.positions[key]; }; - -LineAtlas.prototype.addDash = function(dasharray, round) { - +LineAtlas.prototype.addDash = function (dasharray, round) { var n = round ? 7 : 0; var height = 2 * n + 1; var offset = 128; - if (this.nextRow + height > this.height) { - console.warn('LineAtlas out of space'); + util.warnOnce('LineAtlas out of space'); return null; } - var length = 0; for (var i = 0; i < dasharray.length; i++) { length += dasharray[i]; } - var stretch = this.width / length; var halfWidth = stretch / 2; - - // If dasharray has an odd length, both the first and last parts - // are dashes and should be joined seamlessly. var oddLength = dasharray.length % 2 === 1; - for (var y = -n; y <= n; y++) { var row = this.nextRow + n + y; var index = this.width * row; - var left = oddLength ? -dasharray[dasharray.length - 1] : 0; var right = dasharray[0]; var partIndex = 1; - for (var x = 0; x < this.width; x++) { - while (right < x / stretch) { left = right; right = right + dasharray[partIndex]; - if (oddLength && partIndex === dasharray.length - 1) { right += dasharray[0]; } - partIndex++; } - var distLeft = Math.abs(x - left * stretch); var distRight = Math.abs(x - right * stretch); var dist = Math.min(distLeft, distRight); - var inside = (partIndex % 2) === 1; + var inside = partIndex % 2 === 1; var signedDistance; - if (round) { - // Add circle caps var distMiddle = n ? y / n * (halfWidth + 1) : 0; if (inside) { var distEdge = halfWidth - Math.abs(distMiddle); @@ -47311,24 +50123,19 @@ LineAtlas.prototype.addDash = function(dasharray, round) { } else { signedDistance = (inside ? 1 : -1) * dist; } - this.data[3 + (index + x) * 4] = Math.max(0, Math.min(255, signedDistance + offset)); } } - var pos = { y: (this.nextRow + n + 0.5) / this.height, height: 2 * n / this.height, width: length }; - this.nextRow += height; this.dirty = true; - return pos; }; - -LineAtlas.prototype.bind = function(gl) { +LineAtlas.prototype.bind = function (gl) { if (!this.texture) { this.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.texture); @@ -47337,24 +50144,20 @@ LineAtlas.prototype.bind = function(gl) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.data); - } else { gl.bindTexture(gl.TEXTURE_2D, this.texture); - if (this.dirty) { this.dirty = false; gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, this.height, gl.RGBA, gl.UNSIGNED_BYTE, this.data); } } }; - -},{}],271:[function(require,module,exports){ +},{"../util/util":366}],279:[function(require,module,exports){ 'use strict'; - var browser = require('../util/browser'); var mat4 = require('gl-matrix').mat4; var FrameHistory = require('./frame_history'); -var TilePyramid = require('../source/tile_pyramid'); +var SourceCache = require('../source/source_cache'); var EXTENT = require('../data/bucket').EXTENT; var pixelsToTileUnits = require('../source/pixels_to_tile_units'); var util = require('../util/util'); @@ -47362,71 +50165,43 @@ var StructArrayType = require('../util/struct_array'); var Buffer = require('../data/buffer'); var VertexArrayObject = require('./vertex_array_object'); var RasterBoundsArray = require('./draw_raster').RasterBoundsArray; - +var createUniformPragmas = require('./create_uniform_pragmas'); module.exports = Painter; - -/** - * Initialize a new painter object. - * - * @param {Canvas} gl an experimental-webgl drawing context - * @private - */ function Painter(gl, transform) { this.gl = gl; this.transform = transform; - this.reusableTextures = {}; this.preFbos = {}; - this.frameHistory = new FrameHistory(); - this.setup(); - - // Within each layer there are multiple distinct z-planes that can be drawn to. - // This is implemented using the WebGL depth buffer. - this.numSublayers = TilePyramid.maxUnderzooming + TilePyramid.maxOverzooming + 1; + this.numSublayers = SourceCache.maxUnderzooming + SourceCache.maxOverzooming + 1; this.depthEpsilon = 1 / Math.pow(2, 16); - this.lineWidthRange = gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE); } - util.extend(Painter.prototype, require('./painter/use_program')); - -/* - * Update the GL viewport, projection matrix, and transforms to compensate - * for a new width and height value. - */ -Painter.prototype.resize = function(width, height) { +Painter.prototype.resize = function (width, height) { var gl = this.gl; - this.width = width * browser.devicePixelRatio; this.height = height * browser.devicePixelRatio; gl.viewport(0, 0, this.width, this.height); - }; - -Painter.prototype.setup = function() { +Painter.prototype.setup = function () { var gl = this.gl; - gl.verbose = true; - - // We are blending the new pixels *behind* the existing pixels. That way we can - // draw front-to-back and use then stencil buffer to cull opaque pixels early. gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - gl.enable(gl.STENCIL_TEST); - gl.enable(gl.DEPTH_TEST); gl.depthFunc(gl.LEQUAL); - this._depthMask = false; gl.depthMask(false); - var PosArray = this.PosArray = new StructArrayType({ - members: [{ name: 'a_pos', type: 'Int16', components: 2 }] + members: [{ + name: 'a_pos', + type: 'Int16', + components: 2 + }] }); - var tileExtentArray = new PosArray(); tileExtentArray.emplaceBack(0, 0); tileExtentArray.emplaceBack(EXTENT, 0); @@ -47435,7 +50210,6 @@ Painter.prototype.setup = function() { this.tileExtentBuffer = new Buffer(tileExtentArray.serialize(), PosArray.serialize(), Buffer.BufferType.VERTEX); this.tileExtentVAO = new VertexArrayObject(); this.tileExtentPatternVAO = new VertexArrayObject(); - var debugArray = new PosArray(); debugArray.emplaceBack(0, 0); debugArray.emplaceBack(EXTENT, 0); @@ -47444,7 +50218,6 @@ Painter.prototype.setup = function() { debugArray.emplaceBack(0, 0); this.debugBuffer = new Buffer(debugArray.serialize(), PosArray.serialize(), Buffer.BufferType.VERTEX); this.debugVAO = new VertexArrayObject(); - var rasterBoundsArray = new RasterBoundsArray(); rasterBoundsArray.emplaceBack(0, 0, 0, 0); rasterBoundsArray.emplaceBack(EXTENT, 0, 32767, 0); @@ -47453,80 +50226,67 @@ Painter.prototype.setup = function() { this.rasterBoundsBuffer = new Buffer(rasterBoundsArray.serialize(), RasterBoundsArray.serialize(), Buffer.BufferType.VERTEX); this.rasterBoundsVAO = new VertexArrayObject(); }; - -/* - * Reset the color buffers of the drawing canvas. - */ -Painter.prototype.clearColor = function() { +Painter.prototype.clearColor = function () { var gl = this.gl; gl.clearColor(0, 0, 0, 0); gl.clear(gl.COLOR_BUFFER_BIT); }; - -/* - * Reset the drawing canvas by clearing the stencil buffer so that we can draw - * new tiles at the same location, while retaining previously drawn pixels. - */ -Painter.prototype.clearStencil = function() { +Painter.prototype.clearStencil = function () { var gl = this.gl; - gl.clearStencil(0x0); - gl.stencilMask(0xFF); + gl.clearStencil(0); + gl.stencilMask(255); gl.clear(gl.STENCIL_BUFFER_BIT); }; - -Painter.prototype.clearDepth = function() { +Painter.prototype.clearDepth = function () { var gl = this.gl; gl.clearDepth(1); this.depthMask(true); gl.clear(gl.DEPTH_BUFFER_BIT); }; - -Painter.prototype._renderTileClippingMasks = function(coords) { +Painter.prototype._renderTileClippingMasks = function (coords) { var gl = this.gl; gl.colorMask(false, false, false, false); this.depthMask(false); gl.disable(gl.DEPTH_TEST); gl.enable(gl.STENCIL_TEST); - - // Only write clipping IDs to the last 5 bits. The first three are used for drawing fills. - gl.stencilMask(0xF8); - // Tests will always pass, and ref value will be written to stencil buffer. + gl.stencilMask(248); gl.stencilOp(gl.KEEP, gl.KEEP, gl.REPLACE); - var idNext = 1; this._tileClippingMaskIDs = {}; for (var i = 0; i < coords.length; i++) { var coord = coords[i]; - var id = this._tileClippingMaskIDs[coord.id] = (idNext++) << 3; - - gl.stencilFunc(gl.ALWAYS, id, 0xF8); - - var program = this.useProgram('fill'); + var id = this._tileClippingMaskIDs[coord.id] = idNext++ << 3; + gl.stencilFunc(gl.ALWAYS, id, 248); + var pragmas = createUniformPragmas([ + { + name: 'u_color', + components: 4 + }, + { + name: 'u_opacity', + components: 1 + } + ]); + var program = this.useProgram('fill', [], pragmas, pragmas); gl.uniformMatrix4fv(program.u_matrix, false, coord.posMatrix); - - // Draw the clipping mask this.tileExtentVAO.bind(gl, program, this.tileExtentBuffer); gl.drawArrays(gl.TRIANGLE_STRIP, 0, this.tileExtentBuffer.length); } - - gl.stencilMask(0x00); + gl.stencilMask(0); gl.colorMask(true, true, true, true); this.depthMask(true); gl.enable(gl.DEPTH_TEST); }; - -Painter.prototype.enableTileClippingMask = function(coord) { +Painter.prototype.enableTileClippingMask = function (coord) { var gl = this.gl; - gl.stencilFunc(gl.EQUAL, this._tileClippingMaskIDs[coord.id], 0xF8); + gl.stencilFunc(gl.EQUAL, this._tileClippingMaskIDs[coord.id], 248); }; - -// Overridden by headless tests. -Painter.prototype.prepareBuffers = function() {}; -Painter.prototype.bindDefaultFramebuffer = function() { +Painter.prototype.prepareBuffers = function () { +}; +Painter.prototype.bindDefaultFramebuffer = function () { var gl = this.gl; gl.bindFramebuffer(gl.FRAMEBUFFER, null); }; - var draw = { symbol: require('./draw_symbol'), circle: require('./draw_circle'), @@ -47536,41 +50296,29 @@ var draw = { background: require('./draw_background'), debug: require('./draw_debug') }; - -Painter.prototype.render = function(style, options) { +Painter.prototype.render = function (style, options) { this.style = style; this.options = options; - this.lineAtlas = style.lineAtlas; - this.spriteAtlas = style.spriteAtlas; this.spriteAtlas.setSprite(style.sprite); - this.glyphSource = style.glyphSource; - this.frameHistory.record(this.transform.zoom); - this.prepareBuffers(); this.clearColor(); this.clearDepth(); - this.showOverdrawInspector(options.showOverdrawInspector); - this.depthRange = (style._order.length + 2) * this.numSublayers * this.depthEpsilon; - - this.renderPass({isOpaquePass: true}); - this.renderPass({isOpaquePass: false}); + this.renderPass({ isOpaquePass: true }); + this.renderPass({ isOpaquePass: false }); }; - -Painter.prototype.renderPass = function(options) { +Painter.prototype.renderPass = function (options) { var groups = this.style._groups; var isOpaquePass = options.isOpaquePass; this.currentLayer = isOpaquePass ? this.style._order.length : -1; - for (var i = 0; i < groups.length; i++) { var group = groups[isOpaquePass ? groups.length - 1 - i : i]; var source = this.style.sources[group.source]; - var j; var coords = []; if (source) { @@ -47579,12 +50327,12 @@ Painter.prototype.renderPass = function(options) { coords[j].posMatrix = this.transform.calculatePosMatrix(coords[j], source.maxzoom); } this.clearStencil(); - if (source.prepare) source.prepare(); + if (source.prepare) + source.prepare(); if (source.isTileClipped) { this._renderTileClippingMasks(coords); } } - if (isOpaquePass) { if (!this._showOverdrawInspector) { this.gl.disable(this.gl.BLEND); @@ -47595,42 +50343,38 @@ Painter.prototype.renderPass = function(options) { this.isOpaquePass = false; coords.reverse(); } - for (j = 0; j < group.length; j++) { var layer = group[isOpaquePass ? group.length - 1 - j : j]; this.currentLayer += isOpaquePass ? -1 : 1; this.renderLayer(this, source, layer, coords); } - if (source) { draw.debug(this, source, coords); } } }; - -Painter.prototype.depthMask = function(mask) { +Painter.prototype.depthMask = function (mask) { if (mask !== this._depthMask) { this._depthMask = mask; this.gl.depthMask(mask); } }; - -Painter.prototype.renderLayer = function(painter, source, layer, coords) { - if (layer.isHidden(this.transform.zoom)) return; - if (layer.type !== 'background' && !coords.length) return; +Painter.prototype.renderLayer = function (painter, source, layer, coords) { + if (layer.isHidden(this.transform.zoom)) + return; + if (layer.type !== 'background' && !coords.length) + return; this.id = layer.id; draw[layer.type](painter, source, layer, coords); }; - -Painter.prototype.setDepthSublayer = function(n) { +Painter.prototype.setDepthSublayer = function (n) { var farDepth = 1 - ((1 + this.currentLayer) * this.numSublayers + n) * this.depthEpsilon; var nearDepth = farDepth - 1 + this.depthRange; this.gl.depthRange(nearDepth, farDepth); }; - -Painter.prototype.translatePosMatrix = function(matrix, tile, translate, anchor) { - if (!translate[0] && !translate[1]) return matrix; - +Painter.prototype.translatePosMatrix = function (matrix, tile, translate, anchor) { + if (!translate[0] && !translate[1]) + return matrix; if (anchor === 'viewport') { var sinA = Math.sin(-this.transform.angle); var cosA = Math.cos(-this.transform.angle); @@ -47639,19 +50383,16 @@ Painter.prototype.translatePosMatrix = function(matrix, tile, translate, anchor) translate[0] * sinA + translate[1] * cosA ]; } - var translation = [ pixelsToTileUnits(tile, translate[0], this.transform.zoom), pixelsToTileUnits(tile, translate[1], this.transform.zoom), 0 ]; - var translatedMatrix = new Float32Array(16); mat4.translate(translatedMatrix, matrix, translation); return translatedMatrix; }; - -Painter.prototype.saveTexture = function(texture) { +Painter.prototype.saveTexture = function (texture) { var textures = this.reusableTextures[texture.size]; if (!textures) { this.reusableTextures[texture.size] = [texture]; @@ -47659,21 +50400,17 @@ Painter.prototype.saveTexture = function(texture) { textures.push(texture); } }; - - -Painter.prototype.getTexture = function(size) { +Painter.prototype.getTexture = function (size) { var textures = this.reusableTextures[size]; return textures && textures.length > 0 ? textures.pop() : null; }; - -Painter.prototype.lineWidth = function(width) { +Painter.prototype.lineWidth = function (width) { this.gl.lineWidth(util.clamp(width, this.lineWidthRange[0], this.lineWidthRange[1])); }; - -Painter.prototype.showOverdrawInspector = function(enabled) { - if (!enabled && !this._showOverdrawInspector) return; +Painter.prototype.showOverdrawInspector = function (enabled) { + if (!enabled && !this._showOverdrawInspector) + return; this._showOverdrawInspector = enabled; - var gl = this.gl; if (enabled) { gl.blendFunc(gl.CONSTANT_COLOR, gl.ONE); @@ -47686,112 +50423,40 @@ Painter.prototype.showOverdrawInspector = function(enabled) { gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); } }; - -},{"../data/bucket":247,"../data/buffer":252,"../source/pixels_to_tile_units":277,"../source/tile_pyramid":282,"../util/browser":335,"../util/struct_array":347,"../util/util":349,"./draw_background":261,"./draw_circle":262,"./draw_debug":264,"./draw_fill":265,"./draw_line":266,"./draw_raster":267,"./draw_symbol":268,"./frame_history":269,"./painter/use_program":272,"./vertex_array_object":273,"gl-matrix":363}],272:[function(require,module,exports){ +},{"../data/bucket":253,"../data/buffer":258,"../source/pixels_to_tile_units":287,"../source/source_cache":291,"../util/browser":350,"../util/struct_array":364,"../util/util":366,"./create_uniform_pragmas":268,"./draw_background":269,"./draw_circle":270,"./draw_debug":272,"./draw_fill":273,"./draw_line":274,"./draw_raster":275,"./draw_symbol":276,"./frame_history":277,"./painter/use_program":280,"./vertex_array_object":281,"gl-matrix":382}],280:[function(require,module,exports){ 'use strict'; - - -var path = require('path'); -var assert = require('assert'); var util = require('../../util/util'); - -// readFileSync calls must be written out long-form for brfs. -var definitions = { - debug: { - fragmentSource: "precision mediump float;\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n" - }, - fill: { - fragmentSource: "precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvoid main() {\n gl_FragColor = u_color * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n" - }, - circle: { - fragmentSource: "precision mediump float;\n\nuniform lowp float u_blur;\nuniform lowp float u_opacity;\n\nvarying lowp vec4 v_color;\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n float t = smoothstep(1.0 - max(u_blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = v_color * (1.0 - t) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#ifdef ATTRIBUTE_A_COLOR\nattribute lowp vec4 a_color;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\nuniform lowp float u_color_t;\nattribute lowp vec4 a_color0;\nattribute lowp vec4 a_color1;\nattribute lowp vec4 a_color2;\nattribute lowp vec4 a_color3;\n#else\nuniform lowp vec4 a_color;\n#endif\n\n#ifdef ATTRIBUTE_A_RADIUS\nattribute mediump float a_radius;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\nuniform lowp float u_radius_t;\nattribute mediump vec4 a_radius;\n#else\nuniform mediump float a_radius;\n#endif\n\nvarying vec2 v_extrude;\nvarying lowp vec4 v_color;\nvarying lowp float v_antialiasblur;\n\nfloat evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\n\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n\nvoid main(void) {\n\n#ifdef ATTRIBUTE_A_RADIUS\n mediump float radius = a_radius / 10.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\n mediump float radius = evaluate_zoom_function_1(a_radius, u_radius_t) / 10.0;\n#else\n mediump float radius = a_radius;\n#endif\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n // gl_Position is divided by gl_Position.w after this shader runs.\n // Multiply the extrude by it so that it isn't affected by it.\n gl_Position.xy += extrude * gl_Position.w;\n\n#ifdef ATTRIBUTE_A_COLOR\n v_color = a_color / 255.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\n v_color = evaluate_zoom_function_4(a_color0, a_color1, a_color2, a_color3, u_color_t) / 255.0;\n#else\n v_color = a_color;\n#endif\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n" - }, - line: { - fragmentSource: "precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" - }, - linepattern: { - fragmentSource: "precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform float u_point;\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_b.y);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos), texture2D(u_image, pos2), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 extrude = a_extrude * scale;\n mediump vec2 dist = u_linewidth.s * extrude;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" - }, - linesdfpattern: { - fragmentSource: "precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump vec2 u_linewidth;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" - }, - outline: { - fragmentSource: "precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" - }, - outlinepattern: { - fragmentSource: "precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" - }, - pattern: { - fragmentSource: "precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n}\n" - }, - raster: { - fragmentSource: "precision mediump float;\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n" - }, - icon: { - fragmentSource: "precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" - }, - sdf: { - fragmentSource: "precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - y * u_extra);\n v_gamma_scale = perspective_scale;\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" - }, - collisionbox: { - fragmentSource: "precision mediump float;\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n", - vertexSource: "precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n" - } -}; - -module.exports._createProgram = function(name, macros) { +var shaders = require('mapbox-gl-shaders'); +var utilSource = shaders.util; +module.exports._createProgram = function (name, defines, vertexPragmas, fragmentPragmas) { var gl = this.gl; var program = gl.createProgram(); - var definition = definitions[name]; - - var defines = ''; - if (macros) { - for (var m = 0; m < macros.length; m++) { - defines += '#define ' + macros[m] + '\n'; - } + var definition = shaders[name]; + var definesSource = '#define MAPBOX_GL_JS;\n'; + for (var j = 0; j < defines.length; j++) { + definesSource += '#define ' + defines[j] + ';\n'; } - var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); - gl.shaderSource(fragmentShader, defines + definition.fragmentSource); + gl.shaderSource(fragmentShader, applyPragmas(definesSource + definition.fragmentSource, fragmentPragmas)); gl.compileShader(fragmentShader); - assert(gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS), gl.getShaderInfoLog(fragmentShader)); gl.attachShader(program, fragmentShader); - var vertexShader = gl.createShader(gl.VERTEX_SHADER); - gl.shaderSource(vertexShader, defines + definition.vertexSource); + gl.shaderSource(vertexShader, applyPragmas(definesSource + utilSource + definition.vertexSource, vertexPragmas)); gl.compileShader(vertexShader); - assert(gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS), gl.getShaderInfoLog(vertexShader)); gl.attachShader(program, vertexShader); - gl.linkProgram(program); - assert(gl.getProgramParameter(program, gl.LINK_STATUS), gl.getProgramInfoLog(program)); - var attributes = {}; var numAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); for (var i = 0; i < numAttributes; i++) { var attribute = gl.getActiveAttrib(program, i); - attributes[attribute.name] = i; + attributes[attribute.name] = gl.getAttribLocation(program, attribute.name); } - var uniforms = {}; var numUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); for (var ui = 0; ui < numUniforms; ui++) { var uniform = gl.getActiveUniform(program, ui); uniforms[uniform.name] = gl.getUniformLocation(program, uniform.name); } - return util.extend({ program: program, definition: definition, @@ -47799,41 +50464,41 @@ module.exports._createProgram = function(name, macros) { numAttributes: numAttributes }, attributes, uniforms); }; - -module.exports._createProgramCached = function(name, macros) { +module.exports._createProgramCached = function (name, defines, vertexPragmas, fragmentPragmas) { this.cache = this.cache || {}; - if (this._showOverdrawInspector) { - macros = macros || []; - macros.push('OVERDRAW_INSPECTOR'); - } - var key = JSON.stringify({name: name, macros: macros}); + var key = JSON.stringify({ + name: name, + defines: defines, + vertexPragmas: vertexPragmas, + fragmentPragmas: fragmentPragmas + }); if (!this.cache[key]) { - this.cache[key] = this._createProgram(name, macros); + this.cache[key] = this._createProgram(name, defines, vertexPragmas, fragmentPragmas); } return this.cache[key]; }; - -module.exports.useProgram = function (nextProgramName, macros) { +module.exports.useProgram = function (nextProgramName, defines, vertexPragmas, fragmentPragmas) { var gl = this.gl; - - var nextProgram = this._createProgramCached(nextProgramName, macros); + defines = defines || []; + if (this._showOverdrawInspector) { + defines = defines.concat('OVERDRAW_INSPECTOR'); + } + var nextProgram = this._createProgramCached(nextProgramName, defines, vertexPragmas, fragmentPragmas); var previousProgram = this.currentProgram; - if (previousProgram !== nextProgram) { gl.useProgram(nextProgram.program); this.currentProgram = nextProgram; } - return nextProgram; }; - -},{"../../util/util":349,"assert":52,"path":59}],273:[function(require,module,exports){ +function applyPragmas(source, pragmas) { + return source.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, function (match, operation, precision, type, name) { + return pragmas[operation][name].replace(/{type}/g, type).replace(/{precision}/g, precision); + }); +} +},{"../../util/util":366,"mapbox-gl-shaders":394}],281:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); - module.exports = VertexArrayObject; - function VertexArrayObject() { this.boundProgram = null; this.boundVertexBuffer = null; @@ -47841,262 +50506,141 @@ function VertexArrayObject() { this.boundElementBuffer = null; this.vao = null; } - -var reported = false; - -VertexArrayObject.prototype.bind = function(gl, program, vertexBuffer, elementBuffer, vertexBuffer2) { - - var ext = gl.extVertexArrayObject; - if (ext === undefined) { - ext = gl.extVertexArrayObject = gl.getExtension("OES_vertex_array_object"); - } - - if (ext) { - if (!this.vao) this.vao = ext.createVertexArrayOES(); - ext.bindVertexArrayOES(this.vao); - } else if (!reported) { - console.warn('Not using VertexArrayObject extension.'); - reported = true; +VertexArrayObject.prototype.bind = function (gl, program, layoutVertexBuffer, elementBuffer, vertexBuffer2) { + if (gl.extVertexArrayObject === undefined) { + gl.extVertexArrayObject = gl.getExtension('OES_vertex_array_object'); } - - if (!this.boundProgram) { - - var numPrevAttributes = ext ? 0 : (gl.currentNumAttributes || 0); - var numNextAttributes = program.numAttributes; - var i; - - // Enable all attributes for the new program. - for (i = numPrevAttributes; i < numNextAttributes; i++) { - gl.enableVertexAttribArray(i); - } - - if (!ext) { - // Disable all attributes from the previous program that aren't used in - // the new program. Note: attribute indices are *not* program specific! - // WebGL breaks if you disable attribute 0. http://stackoverflow.com/questions/20305231 - assert(i > 0); - for (i = numNextAttributes; i < numPrevAttributes; i++) { - gl.disableVertexAttribArray(i); - } - gl.currentNumAttributes = numNextAttributes; - } - - vertexBuffer.bind(gl); - vertexBuffer.setVertexAttribPointers(gl, program); - if (vertexBuffer2) { - vertexBuffer2.bind(gl); - vertexBuffer2.setVertexAttribPointers(gl, program); - } - if (elementBuffer) { - elementBuffer.bind(gl); - } - - if (ext) { - // store the arguments so that we can verify them when the vao is bound again - this.boundProgram = program; - this.boundVertexBuffer = vertexBuffer; - this.boundVertexBuffer2 = vertexBuffer2; - this.boundElementBuffer = elementBuffer; - } - + var isFreshBindRequired = !this.vao || this.boundProgram !== program || this.boundVertexBuffer !== layoutVertexBuffer || this.boundVertexBuffer2 !== vertexBuffer2 || this.boundElementBuffer !== elementBuffer; + if (!gl.extVertexArrayObject || isFreshBindRequired) { + this.freshBind(gl, program, layoutVertexBuffer, elementBuffer, vertexBuffer2); } else { - // verify that bind was called with the same arguments - assert(this.boundProgram === program, 'trying to bind a VAO to a different shader'); - assert(this.boundVertexBuffer === vertexBuffer, 'trying to bind a VAO to a different vertex buffer'); - assert(this.boundVertexBuffer2 === vertexBuffer2, 'trying to bind a VAO to a different vertex buffer'); - assert(this.boundElementBuffer === elementBuffer, 'trying to bind a VAO to a different element buffer'); + gl.extVertexArrayObject.bindVertexArrayOES(this.vao); + } +}; +VertexArrayObject.prototype.freshBind = function (gl, program, layoutVertexBuffer, elementBuffer, vertexBuffer2) { + var numPrevAttributes; + var numNextAttributes = program.numAttributes; + if (gl.extVertexArrayObject) { + if (this.vao) + this.destroy(gl); + this.vao = gl.extVertexArrayObject.createVertexArrayOES(); + gl.extVertexArrayObject.bindVertexArrayOES(this.vao); + numPrevAttributes = 0; + this.boundProgram = program; + this.boundVertexBuffer = layoutVertexBuffer; + this.boundVertexBuffer2 = vertexBuffer2; + this.boundElementBuffer = elementBuffer; + } else { + numPrevAttributes = gl.currentNumAttributes || 0; + for (var i = numNextAttributes; i < numPrevAttributes; i++) { + gl.disableVertexAttribArray(i); + } + } + for (var j = numPrevAttributes; j < numNextAttributes; j++) { + gl.enableVertexAttribArray(j); + } + layoutVertexBuffer.bind(gl); + layoutVertexBuffer.setVertexAttribPointers(gl, program); + if (vertexBuffer2) { + vertexBuffer2.bind(gl); + vertexBuffer2.setVertexAttribPointers(gl, program); } + if (elementBuffer) { + elementBuffer.bind(gl); + } + gl.currentNumAttributes = numNextAttributes; }; - -VertexArrayObject.prototype.unbind = function(gl) { +VertexArrayObject.prototype.unbind = function (gl) { var ext = gl.extVertexArrayObject; if (ext) { ext.bindVertexArrayOES(null); } }; - -VertexArrayObject.prototype.destroy = function(gl) { +VertexArrayObject.prototype.destroy = function (gl) { var ext = gl.extVertexArrayObject; if (ext && this.vao) { ext.deleteVertexArrayOES(this.vao); this.vao = null; } -}; - -},{"assert":52}],274:[function(require,module,exports){ -'use strict'; - -var util = require('../util/util'); -var Evented = require('../util/evented'); -var TilePyramid = require('./tile_pyramid'); -var Source = require('./source'); -var urlResolve = require('resolve-url'); -var EXTENT = require('../data/bucket').EXTENT; - -module.exports = GeoJSONSource; - -/** - * Create a GeoJSON data source instance given an options object - * @class GeoJSONSource - * @param {Object} [options] - * @param {Object|string} options.data A GeoJSON data object or URL to it. The latter is preferable in case of large GeoJSON files. - * @param {number} [options.maxzoom=18] Maximum zoom to preserve detail at. - * @param {number} [options.buffer] Tile buffer on each side in pixels. - * @param {number} [options.tolerance] Simplification tolerance (higher means simpler) in pixels. - * @param {number} [options.cluster] If the data is a collection of point features, setting this to true clusters the points by radius into groups. - * @param {number} [options.clusterRadius=50] Radius of each cluster when clustering points, in pixels. - * @param {number} [options.clusterMaxZoom] Max zoom to cluster points on. Defaults to one zoom less than `maxzoom` (so that last zoom features are not clustered). - - * @example - * var sourceObj = new mapboxgl.GeoJSONSource({ - * data: { - * "type": "FeatureCollection", - * "features": [{ - * "type": "Feature", - * "geometry": { - * "type": "Point", - * "coordinates": [ - * -76.53063297271729, - * 39.18174077994108 - * ] - * } - * }] - * } - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -function GeoJSONSource(options) { - options = options || {}; - - this._data = options.data; - - if (options.maxzoom !== undefined) this.maxzoom = options.maxzoom; - - var scale = EXTENT / this.tileSize; - - this.geojsonVtOptions = { - buffer: (options.buffer !== undefined ? options.buffer : 128) * scale, - tolerance: (options.tolerance !== undefined ? options.tolerance : 0.375) * scale, - extent: EXTENT, - maxZoom: this.maxzoom - }; - - this.cluster = options.cluster || false; - this.superclusterOptions = { - maxZoom: Math.min(options.clusterMaxZoom, this.maxzoom - 1) || (this.maxzoom - 1), - extent: EXTENT, - radius: (options.clusterRadius || 50) * scale, - log: false - }; - - this._pyramid = new TilePyramid({ - tileSize: this.tileSize, - minzoom: this.minzoom, - maxzoom: this.maxzoom, - reparseOverscaled: true, - load: this._loadTile.bind(this), - abort: this._abortTile.bind(this), - unload: this._unloadTile.bind(this), - add: this._addTile.bind(this), - remove: this._removeTile.bind(this), - redoPlacement: this._redoTilePlacement.bind(this) - }); -} - -GeoJSONSource.prototype = util.inherit(Evented, /** @lends GeoJSONSource.prototype */{ - minzoom: 0, - maxzoom: 18, - tileSize: 512, - _dirty: true, - isTileClipped: true, - - /** - * Update source geojson data and rerender map - * - * @param {Object|string} data A GeoJSON data object or URL to it. The latter is preferable in case of large GeoJSON files. - * @returns {GeoJSONSource} this - */ - setData: function(data) { - this._data = data; - this._dirty = true; - - this.fire('change'); - - if (this.map) - this.update(this.map.transform); - - return this; - }, - - onAdd: function(map) { - this.map = map; - }, - - loaded: function() { - return this._loaded && this._pyramid.loaded(); - }, - - update: function(transform) { - if (this._dirty) { - this._updateData(); - } - - if (this._loaded) { - this._pyramid.update(this.used, transform); - } - }, - - reload: function() { - if (this._loaded) { - this._pyramid.reload(); +}; +},{}],282:[function(require,module,exports){ +'use strict'; +var Evented = require('../util/evented'); +var util = require('../util/util'); +var urlResolve = require('resolve-url'); +var EXTENT = require('../data/bucket').EXTENT; +module.exports = GeoJSONSource; +function GeoJSONSource(id, options, dispatcher) { + options = options || {}; + this.id = id; + this.dispatcher = dispatcher; + this._data = options.data; + if (options.maxzoom !== undefined) + this.maxzoom = options.maxzoom; + if (options.type) + this.type = options.type; + var scale = EXTENT / this.tileSize; + this.workerOptions = util.extend({ + source: this.id, + cluster: options.cluster || false, + geojsonVtOptions: { + buffer: (options.buffer !== undefined ? options.buffer : 128) * scale, + tolerance: (options.tolerance !== undefined ? options.tolerance : 0.375) * scale, + extent: EXTENT, + maxZoom: this.maxzoom + }, + superclusterOptions: { + maxZoom: Math.min(options.clusterMaxZoom, this.maxzoom - 1) || this.maxzoom - 1, + extent: EXTENT, + radius: (options.clusterRadius || 50) * scale, + log: false + } + }, options.workerOptions); + this._updateWorkerData(function done(err) { + if (err) { + this.fire('error', { error: err }); + return; } + this.fire('load'); + }.bind(this)); +} +GeoJSONSource.prototype = util.inherit(Evented, { + type: 'geojson', + minzoom: 0, + maxzoom: 18, + tileSize: 512, + isTileClipped: true, + reparseOverscaled: true, + onAdd: function (map) { + this.map = map; }, - - serialize: function() { - return { - type: 'geojson', - data: this._data - }; + setData: function (data) { + this._data = data; + this._updateWorkerData(function (err) { + if (err) { + return this.fire('error', { error: err }); + } + this.fire('change'); + }.bind(this)); + return this; }, - - getVisibleCoordinates: Source._getVisibleCoordinates, - getTile: Source._getTile, - - queryRenderedFeatures: Source._queryRenderedVectorFeatures, - querySourceFeatures: Source._querySourceFeatures, - - _updateData: function() { - this._dirty = false; - var options = { - tileSize: this.tileSize, - source: this.id, - geojsonVtOptions: this.geojsonVtOptions, - cluster: this.cluster, - superclusterOptions: this.superclusterOptions - }; - + _updateWorkerData: function (callback) { + var options = util.extend({}, this.workerOptions); var data = this._data; if (typeof data === 'string') { options.url = typeof window != 'undefined' ? urlResolve(window.location.href, data) : data; } else { options.data = JSON.stringify(data); } - this.workerID = this.dispatcher.send('parse geojson', options, function(err) { + this.workerID = this.dispatcher.send(this.type + '.loadData', options, function (err) { this._loaded = true; - if (err) { - this.fire('error', {error: err}); - } else { - this._pyramid.reload(); - this.fire('change'); - } - + callback(err); }.bind(this)); }, - - _loadTile: function(tile) { + loadTile: function (tile, callback) { var overscaling = tile.coord.z > this.maxzoom ? Math.pow(2, tile.coord.z - this.maxzoom) : 1; var params = { + type: this.type, uid: tile.uid, coord: tile.coord, zoom: tile.coord.z, @@ -48108,89 +50652,153 @@ GeoJSONSource.prototype = util.inherit(Evented, /** @lends GeoJSONSource.prototy pitch: this.map.transform.pitch, showCollisionBoxes: this.map.showCollisionBoxes }; - - tile.workerID = this.dispatcher.send('load geojson tile', params, function(err, data) { - + tile.workerID = this.dispatcher.send('load tile', params, function (err, data) { tile.unloadVectorData(this.map.painter); - if (tile.aborted) return; - if (err) { - this.fire('tile.error', {tile: tile}); - return; + return callback(err); } - tile.loadVectorData(data, this.map.style); - if (tile.redoWhenDone) { tile.redoWhenDone = false; tile.redoPlacement(this); } - - this.fire('tile.load', {tile: tile}); - + return callback(null); }.bind(this), this.workerID); }, - - _abortTile: function(tile) { + abortTile: function (tile) { tile.aborted = true; }, - - _addTile: function(tile) { - this.fire('tile.add', {tile: tile}); + unloadTile: function (tile) { + tile.unloadVectorData(this.map.painter); + this.dispatcher.send('remove tile', { + uid: tile.uid, + source: this.id + }, function () { + }, tile.workerID); }, - - _removeTile: function(tile) { - this.fire('tile.remove', {tile: tile}); + serialize: function () { + return { + type: this.type, + data: this._data + }; + } +}); +},{"../data/bucket":253,"../util/evented":358,"../util/util":366,"resolve-url":426}],283:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var ajax = require('../util/ajax'); +var rewind = require('geojson-rewind'); +var GeoJSONWrapper = require('./geojson_wrapper'); +var vtpbf = require('vt-pbf'); +var supercluster = require('supercluster'); +var geojsonvt = require('geojson-vt'); +var VectorTileWorkerSource = require('./vector_tile_worker_source'); +module.exports = GeoJSONWorkerSource; +function GeoJSONWorkerSource(actor, styleLayers, loadGeoJSON) { + if (loadGeoJSON) { + this.loadGeoJSON = loadGeoJSON; + } + VectorTileWorkerSource.call(this, actor, styleLayers); +} +GeoJSONWorkerSource.prototype = util.inherit(VectorTileWorkerSource, { + _geoJSONIndexes: {}, + loadVectorData: function (params, callback) { + var source = params.source, coord = params.coord; + if (!this._geoJSONIndexes[source]) + return callback(null, null); + var geoJSONTile = this._geoJSONIndexes[source].getTile(Math.min(coord.z, params.maxZoom), coord.x, coord.y); + if (geoJSONTile) { + var geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features); + geojsonWrapper.name = '_geojsonTileLayer'; + var pbf = vtpbf({ layers: { '_geojsonTileLayer': geojsonWrapper } }); + if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) { + pbf = new Uint8Array(pbf); + } + callback(null, { + tile: geojsonWrapper, + rawTileData: pbf.buffer + }); + } else { + return callback(null, null); + } }, - - _unloadTile: function(tile) { - tile.unloadVectorData(this.map.painter); - this.dispatcher.send('remove tile', { uid: tile.uid, source: this.id }, null, tile.workerID); + loadData: function (params, callback) { + var handleData = function (err, data) { + if (err) + return callback(err); + if (typeof data != 'object') { + return callback(new Error('Input data is not a valid GeoJSON object.')); + } + rewind(data, true); + this._indexData(data, params, function (err, indexed) { + if (err) { + return callback(err); + } + this._geoJSONIndexes[params.source] = indexed; + callback(null); + }.bind(this)); + }.bind(this); + this.loadGeoJSON(params, handleData); }, - - redoPlacement: Source.redoPlacement, - - _redoTilePlacement: function(tile) { - tile.redoPlacement(this); + loadGeoJSON: function (params, callback) { + if (params.url) { + ajax.getJSON(params.url, callback); + } else if (typeof params.data === 'string') { + try { + return callback(null, JSON.parse(params.data)); + } catch (e) { + return callback(new Error('Input data is not a valid GeoJSON object.')); + } + } else { + return callback(new Error('Input data is not a valid GeoJSON object.')); + } + }, + _indexData: function (data, params, callback) { + try { + if (params.cluster) { + callback(null, supercluster(params.superclusterOptions).load(data.features)); + } else { + callback(null, geojsonvt(data, params.geojsonVtOptions)); + } + } catch (err) { + return callback(err); + } } }); - -},{"../data/bucket":247,"../util/evented":341,"../util/util":349,"./source":279,"./tile_pyramid":282,"resolve-url":405}],275:[function(require,module,exports){ +},{"../util/ajax":349,"../util/util":366,"./geojson_wrapper":284,"./vector_tile_worker_source":295,"geojson-rewind":371,"geojson-vt":377,"supercluster":428,"vt-pbf":438}],284:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); var VectorTileFeature = require('vector-tile').VectorTileFeature; var EXTENT = require('../data/bucket').EXTENT; - module.exports = GeoJSONWrapper; - -// conform to vectortile api function GeoJSONWrapper(features) { this.features = features; this.length = features.length; this.extent = EXTENT; } - -GeoJSONWrapper.prototype.feature = function(i) { +GeoJSONWrapper.prototype.feature = function (i) { return new FeatureWrapper(this.features[i]); }; - function FeatureWrapper(feature) { this.type = feature.type; - this.rawGeometry = feature.type === 1 ? [feature.geometry] : feature.geometry; + if (feature.type === 1) { + this.rawGeometry = []; + for (var i = 0; i < feature.geometry.length; i++) { + this.rawGeometry.push([feature.geometry[i]]); + } + } else { + this.rawGeometry = feature.geometry; + } this.properties = feature.tags; this.extent = EXTENT; } - -FeatureWrapper.prototype.loadGeometry = function() { +FeatureWrapper.prototype.loadGeometry = function () { var rings = this.rawGeometry; this.geometry = []; - for (var i = 0; i < rings.length; i++) { - var ring = rings[i], - newRing = []; + var ring = rings[i], newRing = []; for (var j = 0; j < ring.length; j++) { newRing.push(new Point(ring[j][0], ring[j][1])); } @@ -48198,39 +50806,31 @@ FeatureWrapper.prototype.loadGeometry = function() { } return this.geometry; }; - -FeatureWrapper.prototype.bbox = function() { - if (!this.geometry) this.loadGeometry(); - - var rings = this.geometry, - x1 = Infinity, - x2 = -Infinity, - y1 = Infinity, - y2 = -Infinity; - +FeatureWrapper.prototype.bbox = function () { + if (!this.geometry) + this.loadGeometry(); + var rings = this.geometry, x1 = Infinity, x2 = -Infinity, y1 = Infinity, y2 = -Infinity; for (var i = 0; i < rings.length; i++) { var ring = rings[i]; - for (var j = 0; j < ring.length; j++) { var coord = ring[j]; - x1 = Math.min(x1, coord.x); x2 = Math.max(x2, coord.x); y1 = Math.min(y1, coord.y); y2 = Math.max(y2, coord.y); } } - - return [x1, y1, x2, y2]; + return [ + x1, + y1, + x2, + y2 + ]; }; - FeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON; - -},{"../data/bucket":247,"point-geometry":404,"vector-tile":413}],276:[function(require,module,exports){ +},{"../data/bucket":253,"point-geometry":424,"vector-tile":434}],285:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); -var Tile = require('./tile'); var TileCoord = require('./tile_coord'); var LngLat = require('../geo/lng_lat'); var Point = require('point-geometry'); @@ -48240,1035 +50840,463 @@ var EXTENT = require('../data/bucket').EXTENT; var RasterBoundsArray = require('../render/draw_raster').RasterBoundsArray; var Buffer = require('../data/buffer'); var VertexArrayObject = require('../render/vertex_array_object'); - module.exports = ImageSource; - -/** - * Create an Image source instance given an options object - * @class ImageSource - * @param {Object} [options] - * @param {string} options.url A string URL of an image file - * @param {Array} options.coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the image. Does not have to be a rectangle. - * @example - * var sourceObj = new mapboxgl.ImageSource({ - * url: 'https://www.mapbox.com/images/foo.png', - * coordinates: [ - * [-76.54335737228394, 39.18579907229748], - * [-76.52803659439087, 39.1838364847587], - * [-76.5295386314392, 39.17683392507606], - * [-76.54520273208618, 39.17876344106642] - * ] - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -function ImageSource(options) { - this.urls = options.urls; +function ImageSource(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + this.url = options.url; this.coordinates = options.coordinates; - - ajax.getImage(options.url, function(err, image) { - // @TODO handle errors via event. - if (err) return; - + ajax.getImage(options.url, function (err, image) { + if (err) + return this.fire('error', { error: err }); this.image = image; - - this.image.addEventListener('load', function() { + this.image.addEventListener('load', function () { this.map._rerender(); }.bind(this)); - this._loaded = true; - + this.fire('load'); if (this.map) { this.setCoordinates(options.coordinates); } }.bind(this)); } - -ImageSource.prototype = util.inherit(Evented, /** @lends ImageSource.prototype */ { - onAdd: function(map) { +ImageSource.prototype = util.inherit(Evented, { + minzoom: 0, + maxzoom: 22, + tileSize: 512, + onAdd: function (map) { this.map = map; if (this.image) { this.setCoordinates(this.coordinates); } }, - - /** - * Update image coordinates and rerender map - * - * @param {Array} coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the image. Does not have to be a rectangle. - * @returns {ImageSource} this - */ - setCoordinates: function(coordinates) { + setCoordinates: function (coordinates) { this.coordinates = coordinates; - - // Calculate which mercator tile is suitable for rendering the image in - // and create a buffer with the corner coordinates. These coordinates - // may be outside the tile, because raster tiles aren't clipped when rendering. - var map = this.map; - var cornerZ0Coords = coordinates.map(function(coord) { + var cornerZ0Coords = coordinates.map(function (coord) { return map.transform.locationCoordinate(LngLat.convert(coord)).zoomTo(0); }); - var centerCoord = this.centerCoord = util.getCoordinatesCenter(cornerZ0Coords); centerCoord.column = Math.round(centerCoord.column); centerCoord.row = Math.round(centerCoord.row); - - var tileCoords = cornerZ0Coords.map(function(coord) { + this.minzoom = this.maxzoom = centerCoord.zoom; + this._coord = new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row); + this._tileCoords = cornerZ0Coords.map(function (coord) { var zoomedCoord = coord.zoomTo(centerCoord.zoom); - return new Point( - Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), - Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); + return new Point(Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); }); - + this.fire('change'); + return this; + }, + _setTile: function (tile) { + this._prepared = false; + this.tile = tile; var maxInt16 = 32767; var array = new RasterBoundsArray(); - array.emplaceBack(tileCoords[0].x, tileCoords[0].y, 0, 0); - array.emplaceBack(tileCoords[1].x, tileCoords[1].y, maxInt16, 0); - array.emplaceBack(tileCoords[3].x, tileCoords[3].y, 0, maxInt16); - array.emplaceBack(tileCoords[2].x, tileCoords[2].y, maxInt16, maxInt16); - - this.tile = new Tile(new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row)); + array.emplaceBack(this._tileCoords[0].x, this._tileCoords[0].y, 0, 0); + array.emplaceBack(this._tileCoords[1].x, this._tileCoords[1].y, maxInt16, 0); + array.emplaceBack(this._tileCoords[3].x, this._tileCoords[3].y, 0, maxInt16); + array.emplaceBack(this._tileCoords[2].x, this._tileCoords[2].y, maxInt16, maxInt16); this.tile.buckets = {}; - this.tile.boundsBuffer = new Buffer(array.serialize(), RasterBoundsArray.serialize(), Buffer.BufferType.VERTEX); this.tile.boundsVAO = new VertexArrayObject(); - - this.fire('change'); - - return this; - }, - - loaded: function() { - return this.image && this.image.complete; + this.tile.state = 'loaded'; }, - - update: function() { - // noop - }, - - reload: function() { - // noop - }, - - prepare: function() { - if (!this._loaded || !this.loaded()) return; - + prepare: function () { + if (!this._loaded || !this.image || !this.image.complete) + return; + if (!this.tile) + return; var painter = this.map.painter; var gl = painter.gl; - - if (!this.tile.texture) { + if (!this._prepared) { this.tile.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this.image); - } else { - gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); - gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.image); - } - }, - - getVisibleCoordinates: function() { - if (this.tile) return [this.tile.coord]; - else return []; - }, - - getTile: function() { - return this.tile; - }, - - serialize: function() { - return { - type: 'image', - urls: this.urls, - coordinates: this.coordinates - }; - } -}); - -},{"../data/bucket":247,"../data/buffer":252,"../geo/lng_lat":256,"../render/draw_raster":267,"../render/vertex_array_object":273,"../util/ajax":334,"../util/evented":341,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],277:[function(require,module,exports){ -'use strict'; - -var Bucket = require('../data/bucket'); - -/** - * Converts a pixel value at a the given zoom level to tile units. - * - * The shaders mostly calculate everything in tile units so style - * properties need to be converted from pixels to tile units using this. - * - * For example, a translation by 30 pixels at zoom 6.5 will be a - * translation by pixelsToTileUnits(30, 6.5) tile units. - * - * @param {object} tile a {Tile object} will work well, but any object that follows the format {coord: {TileCord object}, tileSize: {number}} will work - * @param {number} pixelValue - * @param {number} z - * @returns {number} value in tile units - * @private - */ -module.exports = function(tile, pixelValue, z) { - return pixelValue * (Bucket.EXTENT / (tile.tileSize * Math.pow(2, z - tile.coord.z))); -}; - - -},{"../data/bucket":247}],278:[function(require,module,exports){ -'use strict'; - -var util = require('../util/util'); -var ajax = require('../util/ajax'); -var Evented = require('../util/evented'); -var Source = require('./source'); -var normalizeURL = require('../util/mapbox').normalizeTileURL; - -module.exports = RasterTileSource; - -function RasterTileSource(options) { - util.extend(this, util.pick(options, ['url', 'tileSize'])); - - Source._loadTileJSON.call(this, options); -} - -RasterTileSource.prototype = util.inherit(Evented, { - minzoom: 0, - maxzoom: 22, - roundZoom: true, - tileSize: 512, - _loaded: false, - - onAdd: function(map) { - this.map = map; - }, - - loaded: function() { - return this._pyramid && this._pyramid.loaded(); - }, - - update: function(transform) { - if (this._pyramid) { - this._pyramid.update(this.used, transform, this.map.style.rasterFadeDuration); - } - }, - - reload: function() { - // noop - }, - - serialize: function() { - return { - type: 'raster', - url: this.url, - tileSize: this.tileSize - }; - }, - - getVisibleCoordinates: Source._getVisibleCoordinates, - getTile: Source._getTile, - - _loadTile: function(tile) { - var url = normalizeURL(tile.coord.url(this.tiles), this.url, this.tileSize); - - tile.request = ajax.getImage(url, done.bind(this)); - - function done(err, img) { - delete tile.request; - - if (tile.aborted) - return; - - if (err) { - tile.errored = true; - this.fire('tile.error', {tile: tile, error: err}); - return; - } - - var gl = this.map.painter.gl; - tile.texture = this.map.painter.getTexture(img.width); - if (tile.texture) { - gl.bindTexture(gl.TEXTURE_2D, tile.texture); - gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, img); - } else { - tile.texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, tile.texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img); - tile.texture.size = img.width; - } - gl.generateMipmap(gl.TEXTURE_2D); - - tile.timeAdded = new Date().getTime(); - this.map.animationLoop.set(this.style.rasterFadeDuration); - - tile.source = this; - tile.loaded = true; - - this.fire('tile.load', {tile: tile}); - } - }, - - _abortTile: function(tile) { - tile.aborted = true; - - if (tile.request) { - tile.request.abort(); - delete tile.request; - } - }, - - _addTile: function(tile) { - this.fire('tile.add', {tile: tile}); - }, - - _removeTile: function(tile) { - this.fire('tile.remove', {tile: tile}); - }, - - _unloadTile: function(tile) { - if (tile.texture) this.map.painter.saveTexture(tile.texture); - } -}); - -},{"../util/ajax":334,"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./source":279}],279:[function(require,module,exports){ -'use strict'; - -var util = require('../util/util'); -var ajax = require('../util/ajax'); -var browser = require('../util/browser'); -var TilePyramid = require('./tile_pyramid'); -var normalizeURL = require('../util/mapbox').normalizeSourceURL; -var TileCoord = require('./tile_coord'); - -exports._loadTileJSON = function(options) { - var loaded = function(err, tileJSON) { - if (err) { - this.fire('error', {error: err}); - return; - } - - util.extend(this, util.pick(tileJSON, - ['tiles', 'minzoom', 'maxzoom', 'attribution'])); - - if (tileJSON.vector_layers) { - this.vectorLayers = tileJSON.vector_layers; - this.vectorLayerIds = this.vectorLayers.map(function(layer) { return layer.id; }); - } - - this._pyramid = new TilePyramid({ - tileSize: this.tileSize, - minzoom: this.minzoom, - maxzoom: this.maxzoom, - roundZoom: this.roundZoom, - reparseOverscaled: this.reparseOverscaled, - load: this._loadTile.bind(this), - abort: this._abortTile.bind(this), - unload: this._unloadTile.bind(this), - add: this._addTile.bind(this), - remove: this._removeTile.bind(this), - redoPlacement: this._redoTilePlacement ? this._redoTilePlacement.bind(this) : undefined - }); - - this.fire('load'); - }.bind(this); - - if (options.url) { - ajax.getJSON(normalizeURL(options.url), loaded); - } else { - browser.frame(loaded.bind(this, null, options)); - } -}; - -exports.redoPlacement = function() { - if (!this._pyramid) { - return; - } - - var ids = this._pyramid.orderedIDs(); - for (var i = 0; i < ids.length; i++) { - var tile = this._pyramid.getTile(ids[i]); - this._redoTilePlacement(tile); - } -}; - -exports._getTile = function(coord) { - return this._pyramid.getTile(coord.id); -}; - -exports._getVisibleCoordinates = function() { - if (!this._pyramid) return []; - else return this._pyramid.renderedIDs().map(TileCoord.fromID); -}; - -function sortTilesIn(a, b) { - var coordA = a.tile.coord; - var coordB = b.tile.coord; - return (coordA.z - coordB.z) || (coordA.y - coordB.y) || (coordA.x - coordB.x); -} - -function mergeRenderedFeatureLayers(tiles) { - var result = tiles[0] || {}; - for (var i = 1; i < tiles.length; i++) { - var tile = tiles[i]; - for (var layerID in tile) { - var tileFeatures = tile[layerID]; - var resultFeatures = result[layerID]; - if (resultFeatures === undefined) { - resultFeatures = result[layerID] = tileFeatures; - } else { - for (var f = 0; f < tileFeatures.length; f++) { - resultFeatures.push(tileFeatures[f]); - } - } - } - } - return result; -} - -exports._queryRenderedVectorFeatures = function(queryGeometry, params, zoom, bearing) { - if (!this._pyramid) - return {}; - - var tilesIn = this._pyramid.tilesIn(queryGeometry); - - tilesIn.sort(sortTilesIn); - - var styleLayers = this.map.style._layers; - - var renderedFeatureLayers = []; - for (var r = 0; r < tilesIn.length; r++) { - var tileIn = tilesIn[r]; - if (!tileIn.tile.featureIndex) continue; - - renderedFeatureLayers.push(tileIn.tile.featureIndex.query({ - queryGeometry: tileIn.queryGeometry, - scale: tileIn.scale, - tileSize: tileIn.tile.tileSize, - bearing: bearing, - params: params - }, styleLayers)); - } - return mergeRenderedFeatureLayers(renderedFeatureLayers); -}; - -exports._querySourceFeatures = function(params) { - if (!this._pyramid) { - return []; - } - - var pyramid = this._pyramid; - var tiles = pyramid.renderedIDs().map(function(id) { - return pyramid.getTile(id); - }); - - var result = []; - - var dataTiles = {}; - for (var i = 0; i < tiles.length; i++) { - var tile = tiles[i]; - var dataID = new TileCoord(Math.min(tile.sourceMaxZoom, tile.coord.z), tile.coord.x, tile.coord.y, 0).id; - if (!dataTiles[dataID]) { - dataTiles[dataID] = true; - tile.querySourceFeatures(result, params); - } - } - - return result; -}; - -/* - * Create a tiled data source instance given an options object - * - * @param {Object} options - * @param {string} options.type Either `raster` or `vector`. - * @param {string} options.url A tile source URL. This should either be `mapbox://{mapid}` or a full `http[s]` url that points to a TileJSON endpoint. - * @param {Array} options.tiles An array of tile sources. If `url` is not specified, `tiles` can be used instead to specify tile sources, as in the TileJSON spec. Other TileJSON keys such as `minzoom` and `maxzoom` can be specified in a source object if `tiles` is used. - * @param {string} options.id An optional `id` to assign to the source - * @param {number} [options.tileSize=512] Optional tile size (width and height in pixels, assuming tiles are square). This option is only configurable for raster sources - * @example - * var sourceObj = new mapboxgl.Source.create({ - * type: 'vector', - * url: 'mapbox://mapbox.mapbox-streets-v5' - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -exports.create = function(source) { - // This is not at file scope in order to avoid a circular require. - var sources = { - vector: require('./vector_tile_source'), - raster: require('./raster_tile_source'), - geojson: require('./geojson_source'), - video: require('./video_source'), - image: require('./image_source') - }; - - return exports.is(source) ? source : new sources[source.type](source); -}; - -exports.is = function(source) { - // This is not at file scope in order to avoid a circular require. - var sources = { - vector: require('./vector_tile_source'), - raster: require('./raster_tile_source'), - geojson: require('./geojson_source'), - video: require('./video_source'), - image: require('./image_source') - }; - - for (var type in sources) { - if (source instanceof sources[type]) { - return true; - } - } - - return false; -}; - -},{"../util/ajax":334,"../util/browser":335,"../util/mapbox":346,"../util/util":349,"./geojson_source":274,"./image_source":276,"./raster_tile_source":278,"./tile_coord":281,"./tile_pyramid":282,"./vector_tile_source":283,"./video_source":284}],280:[function(require,module,exports){ -'use strict'; - -var util = require('../util/util'); -var Bucket = require('../data/bucket'); -var FeatureIndex = require('../data/feature_index'); -var vt = require('vector-tile'); -var Protobuf = require('pbf'); -var GeoJSONFeature = require('../util/vectortile_to_geojson'); -var featureFilter = require('feature-filter'); -var CollisionTile = require('../symbol/collision_tile'); -var CollisionBoxArray = require('../symbol/collision_box'); - -module.exports = Tile; - -/** - * A tile object is the combination of a Coordinate, which defines - * its place, as well as a unique ID and data tracking for its content - * - * @param {Coordinate} coord - * @param {number} size - * @private - */ -function Tile(coord, size, sourceMaxZoom) { - this.coord = coord; - this.uid = util.uniqueId(); - this.loaded = false; // TODO rename loaded - this.isUnloaded = false; - this.uses = 0; - this.tileSize = size; - this.sourceMaxZoom = sourceMaxZoom; - this.buckets = {}; -} - -Tile.prototype = { - - /** - * Given a data object with a 'buffers' property, load it into - * this tile's elementGroups and buffers properties and set loaded - * to true. If the data is null, like in the case of an empty - * GeoJSON tile, no-op but still set loaded to true. - * @param {Object} data - * @returns {undefined} - * @private - */ - loadVectorData: function(data, style) { - this.loaded = true; - - // empty GeoJSON tile - if (!data) return; - - this.collisionBoxArray = new CollisionBoxArray(data.collisionBoxArray); - this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); - this.featureIndex = new FeatureIndex(data.featureIndex, data.rawTileData, this.collisionTile); - this.rawTileData = data.rawTileData; - this.buckets = unserializeBuckets(data.buckets, style); - }, - - /** - * given a data object and a GL painter, destroy and re-create - * all of its buffers. - * @param {Object} data - * @param {Object} painter - * @returns {undefined} - * @private - */ - reloadSymbolData: function(data, painter, style) { - if (this.isUnloaded) return; - - this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); - this.featureIndex.setCollisionTile(this.collisionTile); - - // Destroy and delete existing symbol buckets - for (var id in this.buckets) { - var bucket = this.buckets[id]; - if (bucket.type === 'symbol') { - bucket.destroy(painter.gl); - delete this.buckets[id]; - } - } - - // Add new symbol buckets - util.extend(this.buckets, unserializeBuckets(data.buckets, style)); - }, - - /** - * Make sure that this tile doesn't own any data within a given - * painter, so that it doesn't consume any memory or maintain - * any references to the painter. - * @param {Object} painter gl painter object - * @returns {undefined} - * @private - */ - unloadVectorData: function(painter) { - for (var id in this.buckets) { - var bucket = this.buckets[id]; - bucket.destroy(painter.gl); - } - - this.collisionBoxArray = null; - this.collisionTile = null; - this.featureIndex = null; - this.rawTileData = null; - this.buckets = null; - this.loaded = false; - this.isUnloaded = true; - }, - - redoPlacement: function(source) { - if (!this.loaded || this.redoingPlacement) { - this.redoWhenDone = true; - return; - } - - this.redoingPlacement = true; - - source.dispatcher.send('redo placement', { - uid: this.uid, - source: source.id, - angle: source.map.transform.angle, - pitch: source.map.transform.pitch, - showCollisionBoxes: source.map.showCollisionBoxes - }, done.bind(this), this.workerID); - - function done(_, data) { - this.reloadSymbolData(data, source.map.painter, source.map.style); - source.fire('tile.load', {tile: this}); - - this.redoingPlacement = false; - if (this.redoWhenDone) { - this.redoPlacement(source); - this.redoWhenDone = false; - } + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this.image); + } else { + gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.image); } }, - - getBucket: function(layer) { - return this.buckets && this.buckets[layer.ref || layer.id]; + loadTile: function (tile, callback) { + if (this._coord && this._coord.toString() === tile.coord.toString()) { + this._setTile(tile); + callback(null); + } else { + tile.state = 'errored'; + callback(null); + } }, - - querySourceFeatures: function(result, params) { - if (!this.rawTileData) return; - - if (!this.vtLayers) { - this.vtLayers = new vt.VectorTile(new Protobuf(new Uint8Array(this.rawTileData))).layers; + serialize: function () { + return { + type: 'image', + urls: this.url, + coordinates: this.coordinates + }; + } +}); +},{"../data/bucket":253,"../data/buffer":258,"../geo/lng_lat":263,"../render/draw_raster":275,"../render/vertex_array_object":281,"../util/ajax":349,"../util/evented":358,"../util/util":366,"./tile_coord":293,"point-geometry":424}],286:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var ajax = require('../util/ajax'); +var browser = require('../util/browser'); +var normalizeURL = require('../util/mapbox').normalizeSourceURL; +module.exports = function (options, callback) { + var loaded = function (err, tileJSON) { + if (err) { + return callback(err); } - - var layer = this.vtLayers._geojsonTileLayer || this.vtLayers[params.sourceLayer]; - - if (!layer) return; - - var filter = featureFilter(params.filter); - var coord = { z: this.coord.z, x: this.coord.x, y: this.coord.y }; - - for (var i = 0; i < layer.length; i++) { - var feature = layer.feature(i); - if (filter(feature)) { - var geojsonFeature = new GeoJSONFeature(feature, this.coord.z, this.coord.x, this.coord.y); - geojsonFeature.tile = coord; - result.push(geojsonFeature); - } + var result = util.pick(tileJSON, [ + 'tiles', + 'minzoom', + 'maxzoom', + 'attribution' + ]); + if (tileJSON.vector_layers) { + result.vectorLayers = tileJSON.vector_layers; + result.vectorLayerIds = result.vectorLayers.map(function (layer) { + return layer.id; + }); } + callback(null, result); + }; + if (options.url) { + ajax.getJSON(normalizeURL(options.url), loaded); + } else { + browser.frame(loaded.bind(null, null, options)); } }; - -function unserializeBuckets(input, style) { - var output = {}; - for (var i = 0; i < input.length; i++) { - var layer = style.getLayer(input[i].layerId); - if (!layer) continue; - - var bucket = Bucket.create(util.extend({ - layer: layer, - childLayers: input[i].childLayerIds - .map(style.getLayer.bind(style)) - .filter(function(layer) { return layer; }) - }, input[i])); - output[bucket.id] = bucket; - } - return output; -} - -},{"../data/bucket":247,"../data/feature_index":253,"../symbol/collision_box":306,"../symbol/collision_tile":308,"../util/util":349,"../util/vectortile_to_geojson":350,"feature-filter":352,"pbf":402,"vector-tile":413}],281:[function(require,module,exports){ +},{"../util/ajax":349,"../util/browser":350,"../util/mapbox":363,"../util/util":366}],287:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); -var Coordinate = require('../geo/coordinate'); - -module.exports = TileCoord; - -function TileCoord(z, x, y, w) { - assert(!isNaN(z) && z >= 0 && z % 1 === 0); - assert(!isNaN(x) && x >= 0 && x % 1 === 0); - assert(!isNaN(y) && y >= 0 && y % 1 === 0); - - if (isNaN(w)) w = 0; - - this.z = +z; - this.x = +x; - this.y = +y; - this.w = +w; - - // calculate id - w *= 2; - if (w < 0) w = w * -1 - 1; - var dim = 1 << this.z; - this.id = ((dim * dim * w + dim * this.y + this.x) * 32) + this.z; - - // for caching pos matrix calculation when rendering - this.posMatrix = null; -} - -TileCoord.prototype.toString = function() { - return this.z + "/" + this.x + "/" + this.y; -}; - -TileCoord.prototype.toCoordinate = function(sourceMaxZoom) { - var zoom = Math.min(this.z, sourceMaxZoom); - var tileScale = Math.pow(2, zoom); - var row = this.y; - var column = this.x + tileScale * this.w; - return new Coordinate(column, row, zoom); -}; - -// Parse a packed integer id into a TileCoord object -TileCoord.fromID = function(id) { - var z = id % 32, dim = 1 << z; - var xy = ((id - z) / 32); - var x = xy % dim, y = ((xy - x) / dim) % dim; - var w = Math.floor(xy / (dim * dim)); - if (w % 2 !== 0) w = w * -1 - 1; - w /= 2; - return new TileCoord(z, x, y, w); -}; - -// given a list of urls, choose a url template and return a tile URL -TileCoord.prototype.url = function(urls, sourceMaxZoom) { - return urls[(this.x + this.y) % urls.length] - .replace('{prefix}', (this.x % 16).toString(16) + (this.y % 16).toString(16)) - .replace('{z}', Math.min(this.z, sourceMaxZoom || this.z)) - .replace('{x}', this.x) - .replace('{y}', this.y); +var Bucket = require('../data/bucket'); +module.exports = function (tile, pixelValue, z) { + return pixelValue * (Bucket.EXTENT / (tile.tileSize * Math.pow(2, z - tile.coord.z))); }; - -// Return the coordinate of the parent tile -TileCoord.prototype.parent = function(sourceMaxZoom) { - if (this.z === 0) return null; - - // the id represents an overscaled tile, return the same coordinates with a lower z - if (this.z > sourceMaxZoom) { - return new TileCoord(this.z - 1, this.x, this.y, this.w); +},{"../data/bucket":253}],288:[function(require,module,exports){ +'use strict'; +var TileCoord = require('./tile_coord'); +exports.rendered = function (sourceCache, styleLayers, queryGeometry, params, zoom, bearing) { + var tilesIn = sourceCache.tilesIn(queryGeometry); + tilesIn.sort(sortTilesIn); + var renderedFeatureLayers = []; + for (var r = 0; r < tilesIn.length; r++) { + var tileIn = tilesIn[r]; + if (!tileIn.tile.featureIndex) + continue; + renderedFeatureLayers.push(tileIn.tile.featureIndex.query({ + queryGeometry: tileIn.queryGeometry, + scale: tileIn.scale, + tileSize: tileIn.tile.tileSize, + bearing: bearing, + params: params + }, styleLayers)); } - - return new TileCoord(this.z - 1, Math.floor(this.x / 2), Math.floor(this.y / 2), this.w); -}; - -TileCoord.prototype.wrapped = function() { - return new TileCoord(this.z, this.x, this.y, 0); + return mergeRenderedFeatureLayers(renderedFeatureLayers); }; - -// Return the coordinates of the tile's children -TileCoord.prototype.children = function(sourceMaxZoom) { - - if (this.z >= sourceMaxZoom) { - // return a single tile coord representing a an overscaled tile - return [new TileCoord(this.z + 1, this.x, this.y, this.w)]; +exports.source = function (sourceCache, params) { + var tiles = sourceCache.renderedIDs().map(function (id) { + return sourceCache.getTileByID(id); + }); + var result = []; + var dataTiles = {}; + for (var i = 0; i < tiles.length; i++) { + var tile = tiles[i]; + var dataID = new TileCoord(Math.min(tile.sourceMaxZoom, tile.coord.z), tile.coord.x, tile.coord.y, 0).id; + if (!dataTiles[dataID]) { + dataTiles[dataID] = true; + tile.querySourceFeatures(result, params); + } } - - var z = this.z + 1; - var x = this.x * 2; - var y = this.y * 2; - return [ - new TileCoord(z, x, y, this.w), - new TileCoord(z, x + 1, y, this.w), - new TileCoord(z, x, y + 1, this.w), - new TileCoord(z, x + 1, y + 1, this.w) - ]; + return result; }; - -// Taken from polymaps src/Layer.js -// https://github.com/simplegeo/polymaps/blob/master/src/Layer.js#L333-L383 - -function edge(a, b) { - if (a.row > b.row) { var t = a; a = b; b = t; } - return { - x0: a.column, - y0: a.row, - x1: b.column, - y1: b.row, - dx: b.column - a.column, - dy: b.row - a.row - }; +function sortTilesIn(a, b) { + var coordA = a.coord; + var coordB = b.coord; + return coordA.z - coordB.z || coordA.y - coordB.y || coordA.w - coordB.w || coordA.x - coordB.x; } - -function scanSpans(e0, e1, ymin, ymax, scanLine) { - var y0 = Math.max(ymin, Math.floor(e1.y0)); - var y1 = Math.min(ymax, Math.ceil(e1.y1)); - - // sort edges by x-coordinate - if ((e0.x0 === e1.x0 && e0.y0 === e1.y0) ? - (e0.x0 + e1.dy / e0.dy * e0.dx < e1.x1) : - (e0.x1 - e1.dy / e0.dy * e0.dx < e1.x0)) { - var t = e0; e0 = e1; e1 = t; - } - - // scan lines! - var m0 = e0.dx / e0.dy; - var m1 = e1.dx / e1.dy; - var d0 = e0.dx > 0; // use y + 1 to compute x0 - var d1 = e1.dx < 0; // use y + 1 to compute x1 - for (var y = y0; y < y1; y++) { - var x0 = m0 * Math.max(0, Math.min(e0.dy, y + d0 - e0.y0)) + e0.x0; - var x1 = m1 * Math.max(0, Math.min(e1.dy, y + d1 - e1.y0)) + e1.x0; - scanLine(Math.floor(x1), Math.ceil(x0), y); +function mergeRenderedFeatureLayers(tiles) { + var result = tiles[0] || {}; + for (var i = 1; i < tiles.length; i++) { + var tile = tiles[i]; + for (var layerID in tile) { + var tileFeatures = tile[layerID]; + var resultFeatures = result[layerID]; + if (resultFeatures === undefined) { + resultFeatures = result[layerID] = tileFeatures; + } else { + for (var f = 0; f < tileFeatures.length; f++) { + resultFeatures.push(tileFeatures[f]); + } + } + } } + return result; } - -function scanTriangle(a, b, c, ymin, ymax, scanLine) { - var ab = edge(a, b), - bc = edge(b, c), - ca = edge(c, a); - - var t; - - // sort edges by y-length - if (ab.dy > bc.dy) { t = ab; ab = bc; bc = t; } - if (ab.dy > ca.dy) { t = ab; ab = ca; ca = t; } - if (bc.dy > ca.dy) { t = bc; bc = ca; ca = t; } - - // scan span! scan span! - if (ab.dy) scanSpans(ca, ab, ymin, ymax, scanLine); - if (bc.dy) scanSpans(ca, bc, ymin, ymax, scanLine); +},{"./tile_coord":293}],289:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var ajax = require('../util/ajax'); +var Evented = require('../util/evented'); +var loadTileJSON = require('./load_tilejson'); +var normalizeURL = require('../util/mapbox').normalizeTileURL; +module.exports = RasterTileSource; +function RasterTileSource(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + util.extend(this, util.pick(options, [ + 'url', + 'scheme', + 'tileSize' + ])); + loadTileJSON(options, function (err, tileJSON) { + if (err) { + return this.fire('error', err); + } + util.extend(this, tileJSON); + this.fire('load'); + }.bind(this)); } - -TileCoord.cover = function(z, bounds, actualZ) { - var tiles = 1 << z; - var t = {}; - - function scanLine(x0, x1, y) { - var x, wx, coord; - if (y >= 0 && y <= tiles) { - for (x = x0; x < x1; x++) { - wx = (x % tiles + tiles) % tiles; - coord = new TileCoord(actualZ, wx, y, Math.floor(x / tiles)); - t[coord.id] = coord; +RasterTileSource.prototype = util.inherit(Evented, { + minzoom: 0, + maxzoom: 22, + roundZoom: true, + scheme: 'xyz', + tileSize: 512, + _loaded: false, + onAdd: function (map) { + this.map = map; + }, + serialize: function () { + return { + type: 'raster', + url: this.url, + tileSize: this.tileSize + }; + }, + loadTile: function (tile, callback) { + var url = normalizeURL(tile.coord.url(this.tiles, null, this.scheme), this.url, this.tileSize); + tile.request = ajax.getImage(url, done.bind(this)); + function done(err, img) { + delete tile.request; + if (tile.aborted) + return; + if (err) { + return callback(err); + } + var gl = this.map.painter.gl; + tile.texture = this.map.painter.getTexture(img.width); + if (tile.texture) { + gl.bindTexture(gl.TEXTURE_2D, tile.texture); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, img); + } else { + tile.texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tile.texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img); + tile.texture.size = img.width; } + gl.generateMipmap(gl.TEXTURE_2D); + this.map.animationLoop.set(this.map.style.rasterFadeDuration); + tile.state = 'loaded'; + callback(null); + } + }, + abortTile: function (tile) { + if (tile.request) { + tile.request.abort(); + delete tile.request; } + }, + unloadTile: function (tile) { + if (tile.texture) + this.map.painter.saveTexture(tile.texture); } - - // Divide the screen up in two triangles and scan each of them: - // +---/ - // | / | - // /---+ - scanTriangle(bounds[0], bounds[1], bounds[2], 0, tiles, scanLine); - scanTriangle(bounds[2], bounds[3], bounds[0], 0, tiles, scanLine); - - return Object.keys(t).map(function(id) { - return t[id]; - }); +}); +},{"../util/ajax":349,"../util/evented":358,"../util/mapbox":363,"../util/util":366,"./load_tilejson":286}],290:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var sourceTypes = { + 'vector': require('../source/vector_tile_source'), + 'raster': require('../source/raster_tile_source'), + 'geojson': require('../source/geojson_source'), + 'video': require('../source/video_source'), + 'image': require('../source/image_source') +}; +exports.create = function (id, source, dispatcher) { + source = new sourceTypes[source.type](id, source, dispatcher); + if (source.id !== id) { + throw new Error('Expected Source id to be ' + id + ' instead of ' + source.id); + } + util.bindAll([ + 'load', + 'abort', + 'unload', + 'serialize', + 'prepare' + ], source); + return source; }; - -},{"../geo/coordinate":255,"assert":52}],282:[function(require,module,exports){ +exports.getType = function (name) { + return sourceTypes[name]; +}; +exports.setType = function (name, type) { + sourceTypes[name] = type; +}; +},{"../source/geojson_source":282,"../source/image_source":285,"../source/raster_tile_source":289,"../source/vector_tile_source":294,"../source/video_source":296,"../util/util":366}],291:[function(require,module,exports){ 'use strict'; - +var Source = require('./source'); var Tile = require('./tile'); +var Evented = require('../util/evented'); var TileCoord = require('./tile_coord'); -var Point = require('point-geometry'); var Cache = require('../util/lru_cache'); var Coordinate = require('../geo/coordinate'); var util = require('../util/util'); var EXTENT = require('../data/bucket').EXTENT; - -module.exports = TilePyramid; - -/** - * A tile pyramid is a specialized cache and datastructure - * that contains tiles. It's used by sources to manage their - * data. - * - * @param {Object} options - * @param {number} options.tileSize - * @param {number} options.minzoom - * @param {number} options.maxzoom - * @private - */ -function TilePyramid(options) { - this.tileSize = options.tileSize; - this.minzoom = options.minzoom; - this.maxzoom = options.maxzoom; - this.roundZoom = options.roundZoom; - this.reparseOverscaled = options.reparseOverscaled; - - this._load = options.load; - this._abort = options.abort; - this._unload = options.unload; - this._add = options.add; - this._remove = options.remove; - this._redoPlacement = options.redoPlacement; - +module.exports = SourceCache; +function SourceCache(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + var source = this._source = Source.create(id, options, dispatcher).on('load', function () { + if (this.map && this._source.onAdd) { + this._source.onAdd(this.map); + } + this._sourceLoaded = true; + this.tileSize = source.tileSize; + this.minzoom = source.minzoom; + this.maxzoom = source.maxzoom; + this.roundZoom = source.roundZoom; + this.reparseOverscaled = source.reparseOverscaled; + this.isTileClipped = source.isTileClipped; + this.attribution = source.attribution; + this.vectorLayerIds = source.vectorLayerIds; + this.fire('load'); + }.bind(this)).on('error', function (e) { + this._sourceErrored = true; + this.fire('error', e); + }.bind(this)).on('change', function () { + this.reload(); + if (this.transform) { + this.update(this.transform, this.map && this.map.style.rasterFadeDuration); + } + this.fire('change'); + }.bind(this)); this._tiles = {}; - this._cache = new Cache(0, function(tile) { return this._unload(tile); }.bind(this)); - - this._filterRendered = this._filterRendered.bind(this); + this._cache = new Cache(0, this.unloadTile.bind(this)); + this._isIdRenderable = this._isIdRenderable.bind(this); } - - -TilePyramid.maxOverzooming = 10; -TilePyramid.maxUnderzooming = 3; - -TilePyramid.prototype = { - /** - * Confirm that every tracked tile is loaded. - * @returns {boolean} whether all tiles are loaded. - * @private - */ - loaded: function() { +SourceCache.maxOverzooming = 10; +SourceCache.maxUnderzooming = 3; +SourceCache.prototype = util.inherit(Evented, { + onAdd: function (map) { + this.map = map; + if (this._source && this._source.onAdd) { + this._source.onAdd(map); + } + }, + loaded: function () { + if (this._sourceErrored) { + return true; + } + if (!this._sourceLoaded) { + return false; + } for (var t in this._tiles) { - if (!this._tiles[t].loaded && !this._tiles[t].errored) + var tile = this._tiles[t]; + if (tile.state !== 'loaded' && tile.state !== 'errored') return false; } return true; }, - - /** - * Return all tile ids ordered with z-order, and cast to numbers - * @returns {Array} ids - * @private - */ - orderedIDs: function() { + getSource: function () { + return this._source; + }, + loadTile: function (tile, callback) { + return this._source.loadTile(tile, callback); + }, + unloadTile: function (tile) { + if (this._source.unloadTile) + return this._source.unloadTile(tile); + }, + abortTile: function (tile) { + if (this._source.abortTile) + return this._source.abortTile(tile); + }, + serialize: function () { + return this._source.serialize(); + }, + prepare: function () { + if (this._sourceLoaded && this._source.prepare) + return this._source.prepare(); + }, + getIds: function () { return Object.keys(this._tiles).map(Number).sort(compareKeyZoom); }, - - renderedIDs: function() { - return this.orderedIDs().filter(this._filterRendered); + getRenderableIds: function () { + return this.getIds().filter(this._isIdRenderable); }, - - _filterRendered: function(id) { - return this._tiles[id].loaded && !this._coveredTiles[id]; + _isIdRenderable: function (id) { + return this._tiles[id].isRenderable() && !this._coveredTiles[id]; }, - - reload: function() { + reload: function () { this._cache.reset(); for (var i in this._tiles) { - this._load(this._tiles[i]); + var tile = this._tiles[i]; + if (tile.state !== 'loading') { + tile.state = 'reloading'; + } + this.loadTile(this._tiles[i], this._tileLoaded.bind(this, this._tiles[i])); } }, - - /** - * Get a specific tile by id - * @param {string|number} id tile id - * @returns {Object} tile - * @private - */ - getTile: function(id) { - return this._tiles[id]; + _tileLoaded: function (tile, err) { + if (err) { + tile.state = 'errored'; + this.fire('tile.error', { + tile: tile, + error: err + }); + this._source.fire('tile.error', { + tile: tile, + error: err + }); + return; + } + tile.source = this; + tile.timeAdded = new Date().getTime(); + this.fire('tile.load', { tile: tile }); + this._source.fire('tile.load', { tile: tile }); }, - - /** - * get the zoom level adjusted for the difference in map and source tilesizes - * @param {Object} transform - * @returns {number} zoom level - * @private - */ - getZoom: function(transform) { - return transform.zoom + Math.log(transform.tileSize / this.tileSize) / Math.LN2; + getTile: function (coord) { + return this.getTileByID(coord.id); }, - - /** - * Return a zoom level that will cover all tiles in a given transform - * @param {Object} transform - * @returns {number} zoom level - * @private - */ - coveringZoomLevel: function(transform) { - return (this.roundZoom ? Math.round : Math.floor)(this.getZoom(transform)); + getTileByID: function (id) { + return this._tiles[id]; }, - - /** - * Given a transform, return all coordinates that could cover that - * transform for a covering zoom level. - * @param {Object} transform - * @returns {Array} tiles - * @private - */ - coveringTiles: function(transform) { - var z = this.coveringZoomLevel(transform); - var actualZ = z; - - if (z < this.minzoom) return []; - if (z > this.maxzoom) z = this.maxzoom; - - var tr = transform, - tileCenter = tr.locationCoordinate(tr.center)._zoomTo(z), - centerPoint = new Point(tileCenter.column - 0.5, tileCenter.row - 0.5); - - return TileCoord.cover(z, [ - tr.pointCoordinate(new Point(0, 0))._zoomTo(z), - tr.pointCoordinate(new Point(tr.width, 0))._zoomTo(z), - tr.pointCoordinate(new Point(tr.width, tr.height))._zoomTo(z), - tr.pointCoordinate(new Point(0, tr.height))._zoomTo(z) - ], this.reparseOverscaled ? actualZ : z).sort(function(a, b) { - return centerPoint.dist(a) - centerPoint.dist(b); - }); + getZoom: function (transform) { + return transform.zoom + transform.scaleZoom(transform.tileSize / this.tileSize); }, - - /** - * Recursively find children of the given tile (up to maxCoveringZoom) that are already loaded; - * adds found tiles to retain object; returns true if any child is found. - * - * @param {Coordinate} coord - * @param {number} maxCoveringZoom - * @param {boolean} retain - * @returns {boolean} whether the operation was complete - * @private - */ - findLoadedChildren: function(coord, maxCoveringZoom, retain) { + findLoadedChildren: function (coord, maxCoveringZoom, retain) { var found = false; - for (var id in this._tiles) { var tile = this._tiles[id]; - - // only consider loaded tiles on higher zoom levels (up to maxCoveringZoom) - if (retain[id] || !tile.loaded || tile.coord.z <= coord.z || tile.coord.z > maxCoveringZoom) continue; - - // disregard tiles that are not descendants of the given tile coordinate + if (retain[id] || !tile.isRenderable() || tile.coord.z <= coord.z || tile.coord.z > maxCoveringZoom) + continue; var z2 = Math.pow(2, Math.min(tile.coord.z, this.maxzoom) - Math.min(coord.z, this.maxzoom)); - if (Math.floor(tile.coord.x / z2) !== coord.x || - Math.floor(tile.coord.y / z2) !== coord.y) + if (Math.floor(tile.coord.x / z2) !== coord.x || Math.floor(tile.coord.y / z2) !== coord.y) continue; - - // found loaded child retain[id] = true; found = true; - - // loop through parents; retain the topmost loaded one if found while (tile && tile.coord.z - 1 > coord.z) { var parentId = tile.coord.parent(this.maxzoom).id; tile = this._tiles[parentId]; - - if (tile && tile.loaded) { + if (tile && tile.isRenderable()) { delete retain[id]; retain[parentId] = true; } @@ -49276,22 +51304,11 @@ TilePyramid.prototype = { } return found; }, - - /** - * Find a loaded parent of the given tile (up to minCoveringZoom); - * adds the found tile to retain object and returns the tile if found - * - * @param {Coordinate} coord - * @param {number} minCoveringZoom - * @param {boolean} retain - * @returns {Tile} tile object - * @private - */ - findLoadedParent: function(coord, minCoveringZoom, retain) { + findLoadedParent: function (coord, minCoveringZoom, retain) { for (var z = coord.z - 1; z >= minCoveringZoom; z--) { coord = coord.parent(this.maxzoom); var tile = this._tiles[coord.id]; - if (tile && tile.loaded) { + if (tile && tile.isRenderable()) { retain[coord.id] = true; return tile; } @@ -49302,192 +51319,121 @@ TilePyramid.prototype = { } } }, - - /** - * Resizes the tile cache based on the current viewport's size. - * - * Larger viewports use more tiles and need larger caches. Larger viewports - * are more likely to be found on devices with more memory and on pages where - * the map is more important. - * - * @private - */ - updateCacheSize: function(transform) { + updateCacheSize: function (transform) { var widthInTiles = Math.ceil(transform.width / transform.tileSize) + 1; var heightInTiles = Math.ceil(transform.height / transform.tileSize) + 1; var approxTilesInView = widthInTiles * heightInTiles; var commonZoomRange = 5; this._cache.setMaxSize(Math.floor(approxTilesInView * commonZoomRange)); }, - - /** - * Removes tiles that are outside the viewport and adds new tiles that - * are inside the viewport. - * @private - */ - update: function(used, transform, fadeDuration) { + update: function (transform, fadeDuration) { + if (!this._sourceLoaded) { + return; + } var i; var coord; var tile; - this.updateCacheSize(transform); - - // Determine the overzooming/underzooming amounts. var zoom = (this.roundZoom ? Math.round : Math.floor)(this.getZoom(transform)); - var minCoveringZoom = Math.max(zoom - TilePyramid.maxOverzooming, this.minzoom); - var maxCoveringZoom = Math.max(zoom + TilePyramid.maxUnderzooming, this.minzoom); - - // Retain is a list of tiles that we shouldn't delete, even if they are not - // the most ideal tile for the current viewport. This may include tiles like - // parent or child tiles that are *already* loaded. + var minCoveringZoom = Math.max(zoom - SourceCache.maxOverzooming, this.minzoom); + var maxCoveringZoom = Math.max(zoom + SourceCache.maxUnderzooming, this.minzoom); var retain = {}; var now = new Date().getTime(); - - // Covered is a list of retained tiles who's areas are full covered by other, - // better, retained tiles. They are not drawn separately. this._coveredTiles = {}; - - var required = used ? this.coveringTiles(transform) : []; + var required = this.used ? transform.coveringTiles(this._source) : []; for (i = 0; i < required.length; i++) { coord = required[i]; tile = this.addTile(coord); - retain[coord.id] = true; - - if (tile.loaded) + if (tile.isRenderable()) continue; - - // The tile we require is not yet loaded. - // Retain child or parent tiles that cover the same area. if (!this.findLoadedChildren(coord, maxCoveringZoom, retain)) { this.findLoadedParent(coord, minCoveringZoom, retain); } } - var parentsForFading = {}; - var ids = Object.keys(retain); for (var k = 0; k < ids.length; k++) { var id = ids[k]; coord = TileCoord.fromID(id); tile = this._tiles[id]; if (tile && tile.timeAdded > now - (fadeDuration || 0)) { - // This tile is still fading in. Find tiles to cross-fade with it. if (this.findLoadedChildren(coord, maxCoveringZoom, retain)) { retain[id] = true; } this.findLoadedParent(coord, minCoveringZoom, parentsForFading); } } - var fadedParent; for (fadedParent in parentsForFading) { if (!retain[fadedParent]) { - // If a tile is only needed for fading, mark it as covered so that it isn't rendered on it's own. this._coveredTiles[fadedParent] = true; } } for (fadedParent in parentsForFading) { retain[fadedParent] = true; } - - // Remove the tiles we don't need anymore. var remove = util.keysDifference(this._tiles, retain); for (i = 0; i < remove.length; i++) { this.removeTile(+remove[i]); } - this.transform = transform; }, - - /** - * Add a tile, given its coordinate, to the pyramid. - * @param {Coordinate} coord - * @returns {Coordinate} the coordinate. - * @private - */ - addTile: function(coord) { + addTile: function (coord) { var tile = this._tiles[coord.id]; if (tile) return tile; - var wrapped = coord.wrapped(); tile = this._tiles[wrapped.id]; - if (!tile) { tile = this._cache.get(wrapped.id); if (tile && this._redoPlacement) { this._redoPlacement(tile); } } - if (!tile) { var zoom = coord.z; var overscaling = zoom > this.maxzoom ? Math.pow(2, zoom - this.maxzoom) : 1; tile = new Tile(wrapped, this.tileSize * overscaling, this.maxzoom); - this._load(tile); + this.loadTile(tile, this._tileLoaded.bind(this, tile)); } - tile.uses++; this._tiles[coord.id] = tile; - this._add(tile, coord); - + this.fire('tile.add', { tile: tile }); + this._source.fire('tile.add', { tile: tile }); return tile; }, - - /** - * Remove a tile, given its id, from the pyramid - * @param {string|number} id tile id - * @returns {undefined} nothing - * @private - */ - removeTile: function(id) { + removeTile: function (id) { var tile = this._tiles[id]; if (!tile) return; - tile.uses--; delete this._tiles[id]; - this._remove(tile); - + this.fire('tile.remove', { tile: tile }); + this._source.fire('tile.remove', { tile: tile }); if (tile.uses > 0) return; - - if (tile.loaded) { + if (tile.isRenderable()) { this._cache.add(tile.coord.wrapped().id, tile); } else { - this._abort(tile); - this._unload(tile); + tile.aborted = true; + this.abortTile(tile); + this.unloadTile(tile); } }, - - /** - * Remove all tiles from this pyramid - * @private - */ - clearTiles: function() { + clearTiles: function () { for (var id in this._tiles) this.removeTile(id); this._cache.reset(); }, - - /** - * Search through our current tiles and attempt to find the tiles that - * cover the given bounds. - * @param {Array} queryGeometry coordinates of the corners of bounding rectangle - * @returns {Array} result items have {tile, minX, maxX, minY, maxY}, where min/max bounding values are the given bounds transformed in into the coordinate space of this tile. - * @private - */ - tilesIn: function(queryGeometry) { + tilesIn: function (queryGeometry) { var tileResults = {}; - var ids = this.orderedIDs(); - + var ids = this.getIds(); var minX = Infinity; var minY = Infinity; var maxX = -Infinity; var maxY = -Infinity; var z = queryGeometry[0].zoom; - for (var k = 0; k < queryGeometry.length; k++) { var p = queryGeometry[k]; minX = Math.min(minX, p.column); @@ -49495,129 +51441,390 @@ TilePyramid.prototype = { maxX = Math.max(maxX, p.column); maxY = Math.max(maxY, p.row); } - for (var i = 0; i < ids.length; i++) { var tile = this._tiles[ids[i]]; var coord = TileCoord.fromID(ids[i]); - var tileSpaceBounds = [ coordinateToTilePoint(coord, tile.sourceMaxZoom, new Coordinate(minX, minY, z)), coordinateToTilePoint(coord, tile.sourceMaxZoom, new Coordinate(maxX, maxY, z)) ]; - - if (tileSpaceBounds[0].x < EXTENT && tileSpaceBounds[0].y < EXTENT && - tileSpaceBounds[1].x >= 0 && tileSpaceBounds[1].y >= 0) { - + if (tileSpaceBounds[0].x < EXTENT && tileSpaceBounds[0].y < EXTENT && tileSpaceBounds[1].x >= 0 && tileSpaceBounds[1].y >= 0) { var tileSpaceQueryGeometry = []; for (var j = 0; j < queryGeometry.length; j++) { tileSpaceQueryGeometry.push(coordinateToTilePoint(coord, tile.sourceMaxZoom, queryGeometry[j])); } - var tileResult = tileResults[tile.coord.id]; if (tileResult === undefined) { tileResult = tileResults[tile.coord.id] = { tile: tile, + coord: coord, queryGeometry: [], scale: Math.pow(2, this.transform.zoom - tile.coord.z) }; } - - // Wrapped tiles share one tileResult object but can have multiple queryGeometry parts tileResult.queryGeometry.push(tileSpaceQueryGeometry); } } - - var results = []; - for (var t in tileResults) { - results.push(tileResults[t]); - } - return results; + var results = []; + for (var t in tileResults) { + results.push(tileResults[t]); + } + return results; + }, + redoPlacement: function () { + var ids = this.getIds(); + for (var i = 0; i < ids.length; i++) { + var tile = this.getTileByID(ids[i]); + tile.redoPlacement(this); + } + }, + getVisibleCoordinates: function () { + return this.getRenderableIds().map(TileCoord.fromID); + } +}); +function coordinateToTilePoint(tileCoord, sourceMaxZoom, coord) { + var zoomedCoord = coord.zoomTo(Math.min(tileCoord.z, sourceMaxZoom)); + return { + x: (zoomedCoord.column - (tileCoord.x + tileCoord.w * Math.pow(2, tileCoord.z))) * EXTENT, + y: (zoomedCoord.row - tileCoord.y) * EXTENT + }; +} +function compareKeyZoom(a, b) { + return a % 32 - b % 32; +} +},{"../data/bucket":253,"../geo/coordinate":262,"../util/evented":358,"../util/lru_cache":362,"../util/util":366,"./source":290,"./tile":292,"./tile_coord":293}],292:[function(require,module,exports){ +'use strict'; +var util = require('../util/util'); +var Bucket = require('../data/bucket'); +var FeatureIndex = require('../data/feature_index'); +var vt = require('vector-tile'); +var Protobuf = require('pbf'); +var GeoJSONFeature = require('../util/vectortile_to_geojson'); +var featureFilter = require('feature-filter'); +var CollisionTile = require('../symbol/collision_tile'); +var CollisionBoxArray = require('../symbol/collision_box'); +var SymbolInstancesArray = require('../symbol/symbol_instances'); +var SymbolQuadsArray = require('../symbol/symbol_quads'); +module.exports = Tile; +function Tile(coord, size, sourceMaxZoom) { + this.coord = coord; + this.uid = util.uniqueId(); + this.uses = 0; + this.tileSize = size; + this.sourceMaxZoom = sourceMaxZoom; + this.buckets = {}; + this.state = 'loading'; +} +Tile.prototype = { + loadVectorData: function (data, style) { + this.state = 'loaded'; + if (!data) + return; + this.collisionBoxArray = new CollisionBoxArray(data.collisionBoxArray); + this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); + this.symbolInstancesArray = new SymbolInstancesArray(data.symbolInstancesArray); + this.symbolQuadsArray = new SymbolQuadsArray(data.symbolQuadsArray); + this.featureIndex = new FeatureIndex(data.featureIndex, data.rawTileData, this.collisionTile); + this.rawTileData = data.rawTileData; + this.buckets = unserializeBuckets(data.buckets, style); + }, + reloadSymbolData: function (data, painter, style) { + if (this.state === 'unloaded') + return; + this.collisionTile = new CollisionTile(data.collisionTile, this.collisionBoxArray); + this.featureIndex.setCollisionTile(this.collisionTile); + for (var id in this.buckets) { + var bucket = this.buckets[id]; + if (bucket.type === 'symbol') { + bucket.destroy(painter.gl); + delete this.buckets[id]; + } + } + util.extend(this.buckets, unserializeBuckets(data.buckets, style)); + }, + unloadVectorData: function (painter) { + for (var id in this.buckets) { + var bucket = this.buckets[id]; + bucket.destroy(painter.gl); + } + this.collisionBoxArray = null; + this.symbolQuadsArray = null; + this.symbolInstancesArray = null; + this.collisionTile = null; + this.featureIndex = null; + this.rawTileData = null; + this.buckets = null; + this.state = 'unloaded'; + }, + redoPlacement: function (source) { + if (this.state !== 'loaded' || this.state === 'reloading') { + this.redoWhenDone = true; + return; + } + this.state = 'reloading'; + source.dispatcher.send('redo placement', { + uid: this.uid, + source: source.id, + angle: source.map.transform.angle, + pitch: source.map.transform.pitch, + showCollisionBoxes: source.map.showCollisionBoxes + }, done.bind(this), this.workerID); + function done(_, data) { + this.reloadSymbolData(data, source.map.painter, source.map.style); + source.fire('tile.load', { tile: this }); + this.state = 'loaded'; + if (this.redoWhenDone) { + this.redoPlacement(source); + this.redoWhenDone = false; + } + } + }, + getBucket: function (layer) { + return this.buckets && this.buckets[layer.ref || layer.id]; + }, + querySourceFeatures: function (result, params) { + if (!this.rawTileData) + return; + if (!this.vtLayers) { + this.vtLayers = new vt.VectorTile(new Protobuf(new Uint8Array(this.rawTileData))).layers; + } + var layer = this.vtLayers._geojsonTileLayer || this.vtLayers[params.sourceLayer]; + if (!layer) + return; + var filter = featureFilter(params.filter); + var coord = { + z: this.coord.z, + x: this.coord.x, + y: this.coord.y + }; + for (var i = 0; i < layer.length; i++) { + var feature = layer.feature(i); + if (filter(feature)) { + var geojsonFeature = new GeoJSONFeature(feature, this.coord.z, this.coord.x, this.coord.y); + geojsonFeature.tile = coord; + result.push(geojsonFeature); + } + } + }, + isRenderable: function () { + return this.state === 'loaded' || this.state === 'reloading'; } }; - -/** - * Convert a coordinate to a point in a tile's coordinate space. - * @param {Coordinate} tileCoord - * @param {Coordinate} coord - * @returns {Object} position - * @private - */ -function coordinateToTilePoint(tileCoord, sourceMaxZoom, coord) { - var zoomedCoord = coord.zoomTo(Math.min(tileCoord.z, sourceMaxZoom)); +function unserializeBuckets(input, style) { + if (!style) + return; + var output = {}; + for (var i = 0; i < input.length; i++) { + var layer = style.getLayer(input[i].layerId); + if (!layer) + continue; + var bucket = Bucket.create(util.extend({ + layer: layer, + childLayers: input[i].childLayerIds.map(style.getLayer.bind(style)).filter(function (layer) { + return layer; + }) + }, input[i])); + output[bucket.id] = bucket; + } + return output; +} +},{"../data/bucket":253,"../data/feature_index":260,"../symbol/collision_box":318,"../symbol/collision_tile":320,"../symbol/symbol_instances":329,"../symbol/symbol_quads":330,"../util/util":366,"../util/vectortile_to_geojson":367,"feature-filter":370,"pbf":422,"vector-tile":434}],293:[function(require,module,exports){ +'use strict'; +var WhooTS = require('whoots-js'); +var Coordinate = require('../geo/coordinate'); +module.exports = TileCoord; +function TileCoord(z, x, y, w) { + if (isNaN(w)) + w = 0; + this.z = +z; + this.x = +x; + this.y = +y; + this.w = +w; + w *= 2; + if (w < 0) + w = w * -1 - 1; + var dim = 1 << this.z; + this.id = (dim * dim * w + dim * this.y + this.x) * 32 + this.z; + this.posMatrix = null; +} +TileCoord.prototype.toString = function () { + return this.z + '/' + this.x + '/' + this.y; +}; +TileCoord.prototype.toCoordinate = function (sourceMaxZoom) { + var zoom = Math.min(this.z, sourceMaxZoom); + var tileScale = Math.pow(2, zoom); + var row = this.y; + var column = this.x + tileScale * this.w; + return new Coordinate(column, row, zoom); +}; +TileCoord.fromID = function (id) { + var z = id % 32, dim = 1 << z; + var xy = (id - z) / 32; + var x = xy % dim, y = (xy - x) / dim % dim; + var w = Math.floor(xy / (dim * dim)); + if (w % 2 !== 0) + w = w * -1 - 1; + w /= 2; + return new TileCoord(z, x, y, w); +}; +function getQuadkey(z, x, y) { + var quadkey = '', mask; + for (var i = z; i > 0; i--) { + mask = 1 << i - 1; + quadkey += (x & mask ? 1 : 0) + (y & mask ? 2 : 0); + } + return quadkey; +} +TileCoord.prototype.url = function (urls, sourceMaxZoom, scheme) { + var bbox = WhooTS.getTileBBox(this.x, this.y, this.z); + var quadkey = getQuadkey(this.z, this.x, this.y); + return urls[(this.x + this.y) % urls.length].replace('{prefix}', (this.x % 16).toString(16) + (this.y % 16).toString(16)).replace('{z}', Math.min(this.z, sourceMaxZoom || this.z)).replace('{x}', this.x).replace('{y}', scheme === 'tms' ? Math.pow(2, this.z) - this.y - 1 : this.y).replace('{quadkey}', quadkey).replace('{bbox-epsg-3857}', bbox); +}; +TileCoord.prototype.parent = function (sourceMaxZoom) { + if (this.z === 0) + return null; + if (this.z > sourceMaxZoom) { + return new TileCoord(this.z - 1, this.x, this.y, this.w); + } + return new TileCoord(this.z - 1, Math.floor(this.x / 2), Math.floor(this.y / 2), this.w); +}; +TileCoord.prototype.wrapped = function () { + return new TileCoord(this.z, this.x, this.y, 0); +}; +TileCoord.prototype.children = function (sourceMaxZoom) { + if (this.z >= sourceMaxZoom) { + return [new TileCoord(this.z + 1, this.x, this.y, this.w)]; + } + var z = this.z + 1; + var x = this.x * 2; + var y = this.y * 2; + return [ + new TileCoord(z, x, y, this.w), + new TileCoord(z, x + 1, y, this.w), + new TileCoord(z, x, y + 1, this.w), + new TileCoord(z, x + 1, y + 1, this.w) + ]; +}; +function edge(a, b) { + if (a.row > b.row) { + var t = a; + a = b; + b = t; + } return { - x: (zoomedCoord.column - (tileCoord.x + tileCoord.w * Math.pow(2, tileCoord.z))) * EXTENT, - y: (zoomedCoord.row - tileCoord.y) * EXTENT + x0: a.column, + y0: a.row, + x1: b.column, + y1: b.row, + dx: b.column - a.column, + dy: b.row - a.row }; - } - -function compareKeyZoom(a, b) { - return (a % 32) - (b % 32); +function scanSpans(e0, e1, ymin, ymax, scanLine) { + var y0 = Math.max(ymin, Math.floor(e1.y0)); + var y1 = Math.min(ymax, Math.ceil(e1.y1)); + if (e0.x0 === e1.x0 && e0.y0 === e1.y0 ? e0.x0 + e1.dy / e0.dy * e0.dx < e1.x1 : e0.x1 - e1.dy / e0.dy * e0.dx < e1.x0) { + var t = e0; + e0 = e1; + e1 = t; + } + var m0 = e0.dx / e0.dy; + var m1 = e1.dx / e1.dy; + var d0 = e0.dx > 0; + var d1 = e1.dx < 0; + for (var y = y0; y < y1; y++) { + var x0 = m0 * Math.max(0, Math.min(e0.dy, y + d0 - e0.y0)) + e0.x0; + var x1 = m1 * Math.max(0, Math.min(e1.dy, y + d1 - e1.y0)) + e1.x0; + scanLine(Math.floor(x1), Math.ceil(x0), y); + } } - -},{"../data/bucket":247,"../geo/coordinate":255,"../util/lru_cache":345,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],283:[function(require,module,exports){ +function scanTriangle(a, b, c, ymin, ymax, scanLine) { + var ab = edge(a, b), bc = edge(b, c), ca = edge(c, a); + var t; + if (ab.dy > bc.dy) { + t = ab; + ab = bc; + bc = t; + } + if (ab.dy > ca.dy) { + t = ab; + ab = ca; + ca = t; + } + if (bc.dy > ca.dy) { + t = bc; + bc = ca; + ca = t; + } + if (ab.dy) + scanSpans(ca, ab, ymin, ymax, scanLine); + if (bc.dy) + scanSpans(ca, bc, ymin, ymax, scanLine); +} +TileCoord.cover = function (z, bounds, actualZ) { + var tiles = 1 << z; + var t = {}; + function scanLine(x0, x1, y) { + var x, wx, coord; + if (y >= 0 && y <= tiles) { + for (x = x0; x < x1; x++) { + wx = (x % tiles + tiles) % tiles; + coord = new TileCoord(actualZ, wx, y, Math.floor(x / tiles)); + t[coord.id] = coord; + } + } + } + scanTriangle(bounds[0], bounds[1], bounds[2], 0, tiles, scanLine); + scanTriangle(bounds[2], bounds[3], bounds[0], 0, tiles, scanLine); + return Object.keys(t).map(function (id) { + return t[id]; + }); +}; +},{"../geo/coordinate":262,"whoots-js":442}],294:[function(require,module,exports){ 'use strict'; - -var util = require('../util/util'); var Evented = require('../util/evented'); -var Source = require('./source'); +var util = require('../util/util'); +var loadTileJSON = require('./load_tilejson'); var normalizeURL = require('../util/mapbox').normalizeTileURL; - module.exports = VectorTileSource; - -function VectorTileSource(options) { - util.extend(this, util.pick(options, ['url', 'tileSize'])); +function VectorTileSource(id, options, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + util.extend(this, util.pick(options, [ + 'url', + 'scheme', + 'tileSize' + ])); this._options = util.extend({ type: 'vector' }, options); - if (this.tileSize !== 512) { throw new Error('vector tile sources must have a tileSize of 512'); } - - Source._loadTileJSON.call(this, options); + loadTileJSON(options, function (err, tileJSON) { + if (err) { + this.fire('error', err); + return; + } + util.extend(this, tileJSON); + this.fire('load'); + }.bind(this)); } - VectorTileSource.prototype = util.inherit(Evented, { minzoom: 0, maxzoom: 22, + scheme: 'xyz', tileSize: 512, reparseOverscaled: true, - _loaded: false, isTileClipped: true, - - onAdd: function(map) { + onAdd: function (map) { this.map = map; }, - - loaded: function() { - return this._pyramid && this._pyramid.loaded(); - }, - - update: function(transform) { - if (this._pyramid) { - this._pyramid.update(this.used, transform); - } - }, - - reload: function() { - if (this._pyramid) { - this._pyramid.reload(); - } - }, - - serialize: function() { + serialize: function () { return util.extend({}, this._options); }, - - getVisibleCoordinates: Source._getVisibleCoordinates, - getTile: Source._getTile, - - queryRenderedFeatures: Source._queryRenderedVectorFeatures, - querySourceFeatures: Source._querySourceFeatures, - - _loadTile: function(tile) { + loadTile: function (tile, callback) { var overscaling = tile.coord.z > this.maxzoom ? Math.pow(2, tile.coord.z - this.maxzoom) : 1; var params = { - url: normalizeURL(tile.coord.url(this.tiles, this.maxzoom), this.url), + url: normalizeURL(tile.coord.url(this.tiles, this.maxzoom, this.scheme), this.url), uid: tile.uid, coord: tile.coord, zoom: tile.coord.z, @@ -49628,66 +51835,135 @@ VectorTileSource.prototype = util.inherit(Evented, { pitch: this.map.transform.pitch, showCollisionBoxes: this.map.showCollisionBoxes }; - if (tile.workerID) { - params.rawTileData = tile.rawTileData; - this.dispatcher.send('reload tile', params, this._tileLoaded.bind(this, tile), tile.workerID); + if (tile.state === 'loading') { + tile.reloadCallback = callback; + } else { + params.rawTileData = tile.rawTileData; + this.dispatcher.send('reload tile', params, done.bind(this), tile.workerID); + } } else { - tile.workerID = this.dispatcher.send('load tile', params, this._tileLoaded.bind(this, tile)); + tile.workerID = this.dispatcher.send('load tile', params, done.bind(this)); } - }, - - _tileLoaded: function(tile, err, data) { - if (tile.aborted) - return; - - if (err) { - tile.errored = true; - this.fire('tile.error', {tile: tile, error: err}); - return; + function done(err, data) { + if (tile.aborted) + return; + if (err) { + return callback(err); + } + tile.loadVectorData(data, this.map.style); + if (tile.redoWhenDone) { + tile.redoWhenDone = false; + tile.redoPlacement(this); + } + callback(null); + if (tile.reloadCallback) { + this.loadTile(tile, tile.reloadCallback); + tile.reloadCallback = null; + } } - - tile.loadVectorData(data, this.map.style); - - if (tile.redoWhenDone) { - tile.redoWhenDone = false; - tile.redoPlacement(this); + }, + abortTile: function (tile) { + this.dispatcher.send('abort tile', { + uid: tile.uid, + source: this.id + }, null, tile.workerID); + }, + unloadTile: function (tile) { + tile.unloadVectorData(this.map.painter); + this.dispatcher.send('remove tile', { + uid: tile.uid, + source: this.id + }, null, tile.workerID); + } +}); +},{"../util/evented":358,"../util/mapbox":363,"../util/util":366,"./load_tilejson":286}],295:[function(require,module,exports){ +'use strict'; +var ajax = require('../util/ajax'); +var vt = require('vector-tile'); +var Protobuf = require('pbf'); +var WorkerTile = require('./worker_tile'); +module.exports = VectorTileWorkerSource; +function VectorTileWorkerSource(actor, styleLayers, loadVectorData) { + this.actor = actor; + this.styleLayers = styleLayers; + if (loadVectorData) { + this.loadVectorData = loadVectorData; + } + this.loading = {}; + this.loaded = {}; +} +VectorTileWorkerSource.prototype = { + loadTile: function (params, callback) { + var source = params.source, uid = params.uid; + if (!this.loading[source]) + this.loading[source] = {}; + var tile = this.loading[source][uid] = new WorkerTile(params); + tile.abort = this.loadVectorData(params, done.bind(this)); + function done(err, data) { + delete this.loading[source][uid]; + if (err) + return callback(err); + if (!data) + return callback(null, null); + tile.data = data.tile; + tile.parse(tile.data, this.styleLayers.getLayerFamilies(), this.actor, data.rawTileData, callback); + this.loaded[source] = this.loaded[source] || {}; + this.loaded[source][uid] = tile; } - - this.fire('tile.load', {tile: tile}); - this.fire('tile.stats', data.bucketStats); }, - - _abortTile: function(tile) { - tile.aborted = true; - this.dispatcher.send('abort tile', { uid: tile.uid, source: this.id }, null, tile.workerID); + reloadTile: function (params, callback) { + var loaded = this.loaded[params.source], uid = params.uid; + if (loaded && loaded[uid]) { + var tile = loaded[uid]; + tile.parse(tile.data, this.styleLayers.getLayerFamilies(), this.actor, params.rawTileData, callback); + } }, - - _addTile: function(tile) { - this.fire('tile.add', {tile: tile}); + abortTile: function (params) { + var loading = this.loading[params.source], uid = params.uid; + if (loading && loading[uid] && loading[uid].abort) { + loading[uid].abort(); + delete loading[uid]; + } }, - - _removeTile: function(tile) { - this.fire('tile.remove', {tile: tile}); + removeTile: function (params) { + var loaded = this.loaded[params.source], uid = params.uid; + if (loaded && loaded[uid]) { + delete loaded[uid]; + } }, - - _unloadTile: function(tile) { - tile.unloadVectorData(this.map.painter); - this.dispatcher.send('remove tile', { uid: tile.uid, source: this.id }, null, tile.workerID); + loadVectorData: function (params, callback) { + var xhr = ajax.getArrayBuffer(params.url, done.bind(this)); + return function abort() { + xhr.abort(); + }; + function done(err, data) { + if (err) { + return callback(err); + } + var tile = new vt.VectorTile(new Protobuf(new Uint8Array(data))); + callback(err, { + tile: tile, + rawTileData: data + }); + } }, - - redoPlacement: Source.redoPlacement, - - _redoTilePlacement: function(tile) { - tile.redoPlacement(this); + redoPlacement: function (params, callback) { + var loaded = this.loaded[params.source], loading = this.loading[params.source], uid = params.uid; + if (loaded && loaded[uid]) { + var tile = loaded[uid]; + var result = tile.redoPlacement(params.angle, params.pitch, params.showCollisionBoxes); + if (result.result) { + callback(null, result.result, result.transferables); + } + } else if (loading && loading[uid]) { + loading[uid].angle = params.angle; + } } -}); - -},{"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./source":279}],284:[function(require,module,exports){ +}; +},{"../util/ajax":349,"./worker_tile":298,"pbf":422,"vector-tile":434}],296:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); -var Tile = require('./tile'); var TileCoord = require('./tile_coord'); var LngLat = require('../geo/lng_lat'); var Point = require('point-geometry'); @@ -49697,150 +51973,88 @@ var EXTENT = require('../data/bucket').EXTENT; var RasterBoundsArray = require('../render/draw_raster').RasterBoundsArray; var Buffer = require('../data/buffer'); var VertexArrayObject = require('../render/vertex_array_object'); - module.exports = VideoSource; - -/** - * Create a Video data source instance given an options object - * @class VideoSource - * @param {Object} [options] - * @param {Array} options.urls An array of URLs to video files - * @param {Array} options.coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the video. Does not have to be a rectangle. - * @example - * var sourceObj = new mapboxgl.VideoSource({ - * url: [ - * 'https://www.mapbox.com/videos/baltimore-smoke.mp4', - * 'https://www.mapbox.com/videos/baltimore-smoke.webm' - * ], - * coordinates: [ - * [-76.54335737228394, 39.18579907229748], - * [-76.52803659439087, 39.1838364847587], - * [-76.5295386314392, 39.17683392507606], - * [-76.54520273208618, 39.17876344106642] - * ] - * }); - * map.addSource('some id', sourceObj); // add - * map.removeSource('some id'); // remove - */ -function VideoSource(options) { +function VideoSource(id, options) { + this.id = id; this.urls = options.urls; this.coordinates = options.coordinates; - - ajax.getVideo(options.urls, function(err, video) { - // @TODO handle errors via event. - if (err) return; - + ajax.getVideo(options.urls, function (err, video) { + if (err) + return this.fire('error', { error: err }); this.video = video; this.video.loop = true; - var loopID; - - // start repainting when video starts playing - this.video.addEventListener('playing', function() { + this.video.addEventListener('playing', function () { loopID = this.map.style.animationLoop.set(Infinity); this.map._rerender(); }.bind(this)); - - // stop repainting when video stops - this.video.addEventListener('pause', function() { + this.video.addEventListener('pause', function () { this.map.style.animationLoop.cancel(loopID); }.bind(this)); - - this._loaded = true; - if (this.map) { this.video.play(); this.setCoordinates(options.coordinates); } + this.fire('load'); }.bind(this)); } - -VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype */{ +VideoSource.prototype = util.inherit(Evented, { + minzoom: 0, + maxzoom: 22, + tileSize: 512, roundZoom: true, - - /** - * Return the HTML video element. - * - * @returns {Object} - */ - getVideo: function() { + getVideo: function () { return this.video; }, - - onAdd: function(map) { + onAdd: function (map) { + if (this.map) + return; this.map = map; if (this.video) { this.video.play(); this.setCoordinates(this.coordinates); } }, - - /** - * Update video coordinates and rerender map - * - * @param {Array} coordinates Four geographical [lng, lat] coordinates in clockwise order defining the corners (starting with top left) of the video. Does not have to be a rectangle. - * @returns {VideoSource} this - */ - setCoordinates: function(coordinates) { + setCoordinates: function (coordinates) { this.coordinates = coordinates; - - // Calculate which mercator tile is suitable for rendering the video in - // and create a buffer with the corner coordinates. These coordinates - // may be outside the tile, because raster tiles aren't clipped when rendering. - var map = this.map; - var cornerZ0Coords = coordinates.map(function(coord) { + var cornerZ0Coords = coordinates.map(function (coord) { return map.transform.locationCoordinate(LngLat.convert(coord)).zoomTo(0); }); - var centerCoord = this.centerCoord = util.getCoordinatesCenter(cornerZ0Coords); centerCoord.column = Math.round(centerCoord.column); centerCoord.row = Math.round(centerCoord.row); - - - var tileCoords = cornerZ0Coords.map(function(coord) { + this.minzoom = this.maxzoom = centerCoord.zoom; + this._coord = new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row); + this._tileCoords = cornerZ0Coords.map(function (coord) { var zoomedCoord = coord.zoomTo(centerCoord.zoom); - return new Point( - Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), - Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); + return new Point(Math.round((zoomedCoord.column - centerCoord.column) * EXTENT), Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)); }); - + this.fire('change'); + return this; + }, + _setTile: function (tile) { + this._prepared = false; + this.tile = tile; var maxInt16 = 32767; var array = new RasterBoundsArray(); - array.emplaceBack(tileCoords[0].x, tileCoords[0].y, 0, 0); - array.emplaceBack(tileCoords[1].x, tileCoords[1].y, maxInt16, 0); - array.emplaceBack(tileCoords[3].x, tileCoords[3].y, 0, maxInt16); - array.emplaceBack(tileCoords[2].x, tileCoords[2].y, maxInt16, maxInt16); - - this.tile = new Tile(new TileCoord(centerCoord.zoom, centerCoord.column, centerCoord.row)); + array.emplaceBack(this._tileCoords[0].x, this._tileCoords[0].y, 0, 0); + array.emplaceBack(this._tileCoords[1].x, this._tileCoords[1].y, maxInt16, 0); + array.emplaceBack(this._tileCoords[3].x, this._tileCoords[3].y, 0, maxInt16); + array.emplaceBack(this._tileCoords[2].x, this._tileCoords[2].y, maxInt16, maxInt16); this.tile.buckets = {}; - this.tile.boundsBuffer = new Buffer(array.serialize(), RasterBoundsArray.serialize(), Buffer.BufferType.VERTEX); this.tile.boundsVAO = new VertexArrayObject(); - - this.fire('change'); - - return this; - }, - - loaded: function() { - return this.video && this.video.readyState >= 2; - }, - - update: function() { - // noop - }, - - reload: function() { - // noop + this.tile.state = 'loaded'; }, - - prepare: function() { - if (!this._loaded) return; - if (this.video.readyState < 2) return; // not enough data for current position - + prepare: function () { + if (this.video.readyState < 2) + return; + if (!this.tile) + return; var gl = this.map.painter.gl; - if (!this.tile.texture) { + if (!this._prepared) { + this._prepared = true; this.tile.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); @@ -49852,20 +52066,18 @@ VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype * gl.bindTexture(gl.TEXTURE_2D, this.tile.texture); gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.video); } - this._currentTime = this.video.currentTime; }, - - getVisibleCoordinates: function() { - if (this.tile) return [this.tile.coord]; - else return []; - }, - - getTile: function() { - return this.tile; + loadTile: function (tile, callback) { + if (this._coord && this._coord.toString() === tile.coord.toString()) { + this._setTile(tile); + callback(null); + } else { + tile.state = 'errored'; + callback(null); + } }, - - serialize: function() { + serialize: function () { return { type: 'video', urls: this.urls, @@ -49873,43 +52085,42 @@ VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype * }; } }); - -},{"../data/bucket":247,"../data/buffer":252,"../geo/lng_lat":256,"../render/draw_raster":267,"../render/vertex_array_object":273,"../util/ajax":334,"../util/evented":341,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],285:[function(require,module,exports){ +},{"../data/bucket":253,"../data/buffer":258,"../geo/lng_lat":263,"../render/draw_raster":275,"../render/vertex_array_object":281,"../util/ajax":349,"../util/evented":358,"../util/util":366,"./tile_coord":293,"point-geometry":424}],297:[function(require,module,exports){ 'use strict'; - var Actor = require('../util/actor'); -var WorkerTile = require('./worker_tile'); var StyleLayer = require('../style/style_layer'); var util = require('../util/util'); -var ajax = require('../util/ajax'); -var vt = require('vector-tile'); -var Protobuf = require('pbf'); -var supercluster = require('supercluster'); - -var geojsonvt = require('geojson-vt'); -var rewind = require('geojson-rewind'); -var GeoJSONWrapper = require('./geojson_wrapper'); -var vtpbf = require('vt-pbf'); - -module.exports = function(self) { +var VectorTileWorkerSource = require('./vector_tile_worker_source'); +var GeoJSONWorkerSource = require('./geojson_worker_source'); +module.exports = function createWorker(self) { return new Worker(self); }; - function Worker(self) { this.self = self; this.actor = new Actor(self, this); - this.loading = {}; - - this.loaded = {}; - this.geoJSONIndexes = {}; + var styleLayers = { + getLayers: function () { + return this.layers; + }.bind(this), + getLayerFamilies: function () { + return this.layerFamilies; + }.bind(this) + }; + this.workerSources = { + vector: new VectorTileWorkerSource(this.actor, styleLayers), + geojson: new GeoJSONWorkerSource(this.actor, styleLayers) + }; + this.self.registerWorkerSource = function (name, WorkerSource) { + if (this.workerSources[name]) { + throw new Error('Worker source with name "' + name + '" already registered.'); + } + this.workerSources[name] = new WorkerSource(this.actor, styleLayers); + }.bind(this); } - util.extend(Worker.prototype, { - 'set layers': function(layers) { + 'set layers': function (layers) { this.layers = {}; var that = this; - - // Filter layers and create an id -> layer map var childLayerIndicies = []; for (var i = 0; i < layers.length; i++) { var layer = layers[i]; @@ -49921,41 +52132,30 @@ util.extend(Worker.prototype, { } } } - - // Create an instance of StyleLayer per layer for (var j = 0; j < childLayerIndicies.length; j++) { setLayer(layers[childLayerIndicies[j]]); } - function setLayer(serializedLayer) { - var styleLayer = StyleLayer.create( - serializedLayer, - serializedLayer.ref && that.layers[serializedLayer.ref] - ); - styleLayer.updatePaintTransitions({}, {transition: false}); + var styleLayer = StyleLayer.create(serializedLayer, serializedLayer.ref && that.layers[serializedLayer.ref]); + styleLayer.updatePaintTransitions({}, { transition: false }); that.layers[styleLayer.id] = styleLayer; } - this.layerFamilies = createLayerFamilies(this.layers); }, - - 'update layers': function(layers) { + 'update layers': function (layers) { var that = this; var id; var layer; - - // Update ref parents for (id in layers) { layer = layers[id]; - if (layer.ref) updateLayer(layer); + if (layer.ref) + updateLayer(layer); } - - // Update ref children for (id in layers) { layer = layers[id]; - if (!layer.ref) updateLayer(layer); + if (!layer.ref) + updateLayer(layer); } - function updateLayer(layer) { var refLayer = that.layers[layer.ref]; if (that.layers[layer.id]) { @@ -49963,151 +52163,47 @@ util.extend(Worker.prototype, { } else { that.layers[layer.id] = StyleLayer.create(layer, refLayer); } - that.layers[layer.id].updatePaintTransitions({}, {transition: false}); + that.layers[layer.id].updatePaintTransitions({}, { transition: false }); } - this.layerFamilies = createLayerFamilies(this.layers); }, - - 'load tile': function(params, callback) { - var source = params.source, - uid = params.uid; - - if (!this.loading[source]) - this.loading[source] = {}; - - - var tile = this.loading[source][uid] = new WorkerTile(params); - - tile.xhr = ajax.getArrayBuffer(params.url, done.bind(this)); - - function done(err, data) { - delete this.loading[source][uid]; - - if (err) return callback(err); - - tile.data = new vt.VectorTile(new Protobuf(new Uint8Array(data))); - tile.parse(tile.data, this.layerFamilies, this.actor, data, callback); - - this.loaded[source] = this.loaded[source] || {}; - this.loaded[source][uid] = tile; - } - }, - - 'reload tile': function(params, callback) { - var loaded = this.loaded[params.source], - uid = params.uid; - if (loaded && loaded[uid]) { - var tile = loaded[uid]; - tile.parse(tile.data, this.layerFamilies, this.actor, params.rawTileData, callback); - } + 'load tile': function (params, callback) { + var type = params.type || 'vector'; + this.workerSources[type].loadTile(params, callback); }, - - 'abort tile': function(params) { - var loading = this.loading[params.source], - uid = params.uid; - if (loading && loading[uid]) { - loading[uid].xhr.abort(); - delete loading[uid]; - } + 'reload tile': function (params, callback) { + var type = params.type || 'vector'; + this.workerSources[type].reloadTile(params, callback); }, - - 'remove tile': function(params) { - var loaded = this.loaded[params.source], - uid = params.uid; - if (loaded && loaded[uid]) { - delete loaded[uid]; - } + 'abort tile': function (params) { + var type = params.type || 'vector'; + this.workerSources[type].abortTile(params); }, - - 'redo placement': function(params, callback) { - var loaded = this.loaded[params.source], - loading = this.loading[params.source], - uid = params.uid; - - if (loaded && loaded[uid]) { - var tile = loaded[uid]; - var result = tile.redoPlacement(params.angle, params.pitch, params.showCollisionBoxes); - - if (result.result) { - callback(null, result.result, result.transferables); - } - - } else if (loading && loading[uid]) { - loading[uid].angle = params.angle; - } + 'remove tile': function (params) { + var type = params.type || 'vector'; + this.workerSources[type].removeTile(params); }, - - 'parse geojson': function(params, callback) { - var indexData = function(err, data) { - rewind(data, true); - if (err) return callback(err); - if (typeof data != 'object') { - return callback(new Error("Input data is not a valid GeoJSON object.")); - } - try { - this.geoJSONIndexes[params.source] = params.cluster ? - supercluster(params.superclusterOptions).load(data.features) : - geojsonvt(data, params.geojsonVtOptions); - } catch (err) { - return callback(err); - } - callback(null); - }.bind(this); - - // Not, because of same origin issues, urls must either include an - // explicit origin or absolute path. - // ie: /foo/bar.json or http://example.com/bar.json - // but not ../foo/bar.json - if (params.url) { - ajax.getJSON(params.url, indexData); - } else if (typeof params.data === 'string') { - indexData(null, JSON.parse(params.data)); - } else { - return callback(new Error("Input data is not a valid GeoJSON object.")); - } + 'redo placement': function (params, callback) { + var type = params.type || 'vector'; + this.workerSources[type].redoPlacement(params, callback); }, - - 'load geojson tile': function(params, callback) { - var source = params.source, - coord = params.coord; - - if (!this.geoJSONIndexes[source]) return callback(null, null); // we couldn't load the file - - // console.time('tile ' + coord.z + ' ' + coord.x + ' ' + coord.y); - - var geoJSONTile = this.geoJSONIndexes[source].getTile(Math.min(coord.z, params.maxZoom), coord.x, coord.y); - - // console.timeEnd('tile ' + coord.z + ' ' + coord.x + ' ' + coord.y); - - // if (!geoJSONTile) console.log('not found', this.geoJSONIndexes[source], coord); - - var tile = geoJSONTile ? new WorkerTile(params) : undefined; - - this.loaded[source] = this.loaded[source] || {}; - this.loaded[source][params.uid] = tile; - - if (geoJSONTile) { - var geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features); - geojsonWrapper.name = '_geojsonTileLayer'; - var rawTileData = vtpbf({ layers: { '_geojsonTileLayer': geojsonWrapper }}).buffer; - tile.parse(geojsonWrapper, this.layerFamilies, this.actor, rawTileData, callback); - } else { - return callback(null, null); // nothing in the given tile + 'load worker source': function (params, callback) { + try { + this.self.importScripts(params.url); + callback(); + } catch (e) { + callback(e); } } }); - function createLayerFamilies(layers) { var families = {}; - for (var layerId in layers) { var layer = layers[layerId]; var parentLayerId = layer.ref || layer.id; var parentLayer = layers[parentLayerId]; - - if (parentLayer.layout && parentLayer.layout.visibility === 'none') continue; - + if (parentLayer.layout && parentLayer.layout.visibility === 'none') + continue; families[parentLayerId] = families[parentLayerId] || []; if (layerId === parentLayerId) { families[parentLayerId].unshift(layer); @@ -50115,21 +52211,19 @@ function createLayerFamilies(layers) { families[parentLayerId].push(layer); } } - return families; } - -},{"../style/style_layer":293,"../util/actor":333,"../util/ajax":334,"../util/util":349,"./geojson_wrapper":275,"./worker_tile":286,"geojson-rewind":353,"geojson-vt":358,"pbf":402,"supercluster":407,"vector-tile":413,"vt-pbf":417}],286:[function(require,module,exports){ +},{"../style/style_layer":305,"../util/actor":348,"../util/util":366,"./geojson_worker_source":283,"./vector_tile_worker_source":295}],298:[function(require,module,exports){ 'use strict'; - var FeatureIndex = require('../data/feature_index'); var CollisionTile = require('../symbol/collision_tile'); var Bucket = require('../data/bucket'); var CollisionBoxArray = require('../symbol/collision_box'); var DictionaryCoder = require('../util/dictionary_coder'); - +var util = require('../util/util'); +var SymbolInstancesArray = require('../symbol/symbol_instances'); +var SymbolQuadsArray = require('../symbol/symbol_quads'); module.exports = WorkerTile; - function WorkerTile(params) { this.coord = params.coord; this.uid = params.uid; @@ -50141,19 +52235,15 @@ function WorkerTile(params) { this.pitch = params.pitch; this.showCollisionBoxes = params.showCollisionBoxes; } - -WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, callback) { - +WorkerTile.prototype.parse = function (data, layerFamilies, actor, rawTileData, callback) { this.status = 'parsing'; this.data = data; - this.collisionBoxArray = new CollisionBoxArray(); + this.symbolInstancesArray = new SymbolInstancesArray(); + this.symbolQuadsArray = new SymbolQuadsArray(); var collisionTile = new CollisionTile(this.angle, this.pitch, this.collisionBoxArray); var featureIndex = new FeatureIndex(this.coord, this.overscaling, collisionTile, data.layers); var sourceLayerCoder = new DictionaryCoder(data.layers ? Object.keys(data.layers).sort() : ['_geojsonTileLayer']); - - var stats = { _total: 0 }; - var tile = this; var bucketsById = {}; var bucketsBySourceLayer = {}; @@ -50161,19 +52251,21 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c var layer; var sourceLayerId; var bucket; - - // Map non-ref layers to buckets. var bucketIndex = 0; for (var layerId in layerFamilies) { layer = layerFamilies[layerId][0]; - - if (layer.source !== this.source) continue; - if (layer.ref) continue; - if (layer.minzoom && this.zoom < layer.minzoom) continue; - if (layer.maxzoom && this.zoom >= layer.maxzoom) continue; - if (layer.layout && layer.layout.visibility === 'none') continue; - if (data.layers && !data.layers[layer.sourceLayer]) continue; - + if (layer.source !== this.source) + continue; + if (layer.ref) + continue; + if (layer.minzoom && this.zoom < layer.minzoom) + continue; + if (layer.maxzoom && this.zoom >= layer.maxzoom) + continue; + if (layer.layout && layer.layout.visibility === 'none') + continue; + if (data.layers && !data.layers[layer.sourceLayer]) + continue; bucket = Bucket.create({ layer: layer, index: bucketIndex++, @@ -50182,31 +52274,31 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c overscaling: this.overscaling, showCollisionBoxes: this.showCollisionBoxes, collisionBoxArray: this.collisionBoxArray, + symbolQuadsArray: this.symbolQuadsArray, + symbolInstancesArray: this.symbolInstancesArray, sourceLayerIndex: sourceLayerCoder.encode(layer.sourceLayer || '_geojsonTileLayer') }); bucket.createFilter(); - bucketsById[layer.id] = bucket; - - if (data.layers) { // vectortile + if (data.layers) { sourceLayerId = layer.sourceLayer; bucketsBySourceLayer[sourceLayerId] = bucketsBySourceLayer[sourceLayerId] || {}; bucketsBySourceLayer[sourceLayerId][layer.id] = bucket; } } - - // read each layer, and sort its features into buckets - if (data.layers) { // vectortile + if (data.layers) { for (sourceLayerId in bucketsBySourceLayer) { + if (layer.version === 1) { + util.warnOnce('Vector tile source "' + this.source + '" layer "' + sourceLayerId + '" does not use vector tile spec v2 ' + 'and therefore may have some rendering errors.'); + } layer = data.layers[sourceLayerId]; if (layer) { sortLayerIntoBuckets(layer, bucketsBySourceLayer[sourceLayerId]); } } - } else { // geojson + } else { sortLayerIntoBuckets(data, bucketsById); } - function sortLayerIntoBuckets(layer, buckets) { for (var i = 0; i < layer.length; i++) { var feature = layer.feature(i); @@ -50217,52 +52309,40 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c } } } - - var buckets = [], - symbolBuckets = this.symbolBuckets = [], - otherBuckets = []; - + var buckets = [], symbolBuckets = this.symbolBuckets = [], otherBuckets = []; featureIndex.bucketLayerIDs = {}; - for (var id in bucketsById) { bucket = bucketsById[id]; - if (bucket.features.length === 0) continue; - + if (bucket.features.length === 0) + continue; featureIndex.bucketLayerIDs[bucket.index] = bucket.childLayers.map(getLayerId); - buckets.push(bucket); - if (bucket.type === 'symbol') symbolBuckets.push(bucket); else otherBuckets.push(bucket); } - var icons = {}; var stacks = {}; var deps = 0; - - if (symbolBuckets.length > 0) { - - // Get dependencies for symbol buckets for (i = symbolBuckets.length - 1; i >= 0; i--) { symbolBuckets[i].updateIcons(icons); symbolBuckets[i].updateFont(stacks); } - for (var fontName in stacks) { stacks[fontName] = Object.keys(stacks[fontName]).map(Number); } icons = Object.keys(icons); - - actor.send('get glyphs', {uid: this.uid, stacks: stacks}, function(err, newStacks) { + actor.send('get glyphs', { + uid: this.uid, + stacks: stacks + }, function (err, newStacks) { stacks = newStacks; gotDependency(err); }); - if (icons.length) { - actor.send('get icons', {icons: icons}, function(err, newIcons) { + actor.send('get icons', { icons: icons }, function (err, newIcons) { icons = newIcons; gotDependency(err); }); @@ -50270,91 +52350,69 @@ WorkerTile.prototype.parse = function(data, layerFamilies, actor, rawTileData, c gotDependency(); } } - - // immediately parse non-symbol buckets (they have no dependencies) for (i = otherBuckets.length - 1; i >= 0; i--) { parseBucket(this, otherBuckets[i]); } - if (symbolBuckets.length === 0) return done(); - function gotDependency(err) { - if (err) return callback(err); + if (err) + return callback(err); deps++; if (deps === 2) { - // all symbol bucket dependencies fetched; parse them in proper order for (var i = symbolBuckets.length - 1; i >= 0; i--) { parseBucket(tile, symbolBuckets[i]); } done(); } } - function parseBucket(tile, bucket) { - var now = Date.now(); - bucket.populateBuffers(collisionTile, stacks, icons); - var time = Date.now() - now; - - + bucket.populateArrays(collisionTile, stacks, icons); if (bucket.type !== 'symbol') { for (var i = 0; i < bucket.features.length; i++) { var feature = bucket.features[i]; featureIndex.insert(feature, feature.index, bucket.sourceLayerIndex, bucket.index); } } - bucket.features = null; - - stats._total += time; - stats[bucket.id] = (stats[bucket.id] || 0) + time; } - function done() { tile.status = 'done'; - if (tile.redoPlacementAfterDone) { tile.redoPlacement(tile.angle, tile.pitch, null); tile.redoPlacementAfterDone = false; } - var featureIndex_ = featureIndex.serialize(); var collisionTile_ = collisionTile.serialize(); var collisionBoxArray = tile.collisionBoxArray.serialize(); + var symbolInstancesArray = tile.symbolInstancesArray.serialize(); + var symbolQuadsArray = tile.symbolQuadsArray.serialize(); var transferables = [rawTileData].concat(featureIndex_.transferables).concat(collisionTile_.transferables); - - var nonEmptyBuckets = buckets.filter(isBucketEmpty); - + var nonEmptyBuckets = buckets.filter(isBucketNonEmpty); callback(null, { buckets: nonEmptyBuckets.map(serializeBucket), - bucketStats: stats, // TODO put this in a separate message? featureIndex: featureIndex_.data, collisionTile: collisionTile_.data, collisionBoxArray: collisionBoxArray, + symbolInstancesArray: symbolInstancesArray, + symbolQuadsArray: symbolQuadsArray, rawTileData: rawTileData }, getTransferables(nonEmptyBuckets).concat(transferables)); } }; - -WorkerTile.prototype.redoPlacement = function(angle, pitch, showCollisionBoxes) { +WorkerTile.prototype.redoPlacement = function (angle, pitch, showCollisionBoxes) { if (this.status !== 'done') { this.redoPlacementAfterDone = true; this.angle = angle; return {}; } - var collisionTile = new CollisionTile(angle, pitch, this.collisionBoxArray); - var buckets = this.symbolBuckets; - for (var i = buckets.length - 1; i >= 0; i--) { buckets[i].placeFeatures(collisionTile, showCollisionBoxes); } - var collisionTile_ = collisionTile.serialize(); - - var nonEmptyBuckets = buckets.filter(isBucketEmpty); - + var nonEmptyBuckets = buckets.filter(isBucketNonEmpty); return { result: { buckets: nonEmptyBuckets.map(serializeBucket), @@ -50363,116 +52421,72 @@ WorkerTile.prototype.redoPlacement = function(angle, pitch, showCollisionBoxes) transferables: getTransferables(nonEmptyBuckets).concat(collisionTile_.transferables) }; }; - -function isBucketEmpty(bucket) { - for (var programName in bucket.arrayGroups) { - var programArrayGroups = bucket.arrayGroups[programName]; - for (var k = 0; k < programArrayGroups.length; k++) { - var programArrayGroup = programArrayGroups[k]; - for (var layoutOrPaint in programArrayGroup) { - var arrays = programArrayGroup[layoutOrPaint]; - for (var bufferName in arrays) { - if (arrays[bufferName].length > 0) return true; - } - } - } - } - return false; +function isBucketNonEmpty(bucket) { + return !bucket.isEmpty(); } - function serializeBucket(bucket) { return bucket.serialize(); } - function getTransferables(buckets) { var transferables = []; for (var i in buckets) { - var bucket = buckets[i]; - for (var programName in bucket.arrayGroups) { - var programArrayGroups = bucket.arrayGroups[programName]; - for (var k = 0; k < programArrayGroups.length; k++) { - var programArrayGroup = programArrayGroups[k]; - for (var layoutOrPaint in programArrayGroup) { - var arrays = programArrayGroup[layoutOrPaint]; - for (var bufferName in arrays) { - transferables.push(arrays[bufferName].arrayBuffer); - } - } - } - } + buckets[i].getTransferables(transferables); } return transferables; } - function getLayerId(layer) { return layer.id; } - -},{"../data/bucket":247,"../data/feature_index":253,"../symbol/collision_box":306,"../symbol/collision_tile":308,"../util/dictionary_coder":340}],287:[function(require,module,exports){ +},{"../data/bucket":253,"../data/feature_index":260,"../symbol/collision_box":318,"../symbol/collision_tile":320,"../symbol/symbol_instances":329,"../symbol/symbol_quads":330,"../util/dictionary_coder":356,"../util/util":366}],299:[function(require,module,exports){ 'use strict'; - module.exports = AnimationLoop; - function AnimationLoop() { this.n = 0; this.times = []; } - -// Are all animations done? -AnimationLoop.prototype.stopped = function() { - this.times = this.times.filter(function(t) { - return t.time >= (new Date()).getTime(); +AnimationLoop.prototype.stopped = function () { + this.times = this.times.filter(function (t) { + return t.time >= new Date().getTime(); }); return !this.times.length; }; - -// Add a new animation that will run t milliseconds -// Returns an id that can be used to cancel it layer -AnimationLoop.prototype.set = function(t) { - this.times.push({ id: this.n, time: t + (new Date()).getTime() }); +AnimationLoop.prototype.set = function (t) { + this.times.push({ + id: this.n, + time: t + new Date().getTime() + }); return this.n++; }; - -// Cancel an animation -AnimationLoop.prototype.cancel = function(n) { - this.times = this.times.filter(function(t) { +AnimationLoop.prototype.cancel = function (n) { + this.times = this.times.filter(function (t) { return t.id !== n; }); }; - -},{}],288:[function(require,module,exports){ +},{}],300:[function(require,module,exports){ 'use strict'; - var Evented = require('../util/evented'); var ajax = require('../util/ajax'); var browser = require('../util/browser'); var normalizeURL = require('../util/mapbox').normalizeSpriteURL; - module.exports = ImageSprite; - function ImageSprite(base) { this.base = base; this.retina = browser.devicePixelRatio > 1; - var format = this.retina ? '@2x' : ''; - - ajax.getJSON(normalizeURL(base, format, '.json'), function(err, data) { + ajax.getJSON(normalizeURL(base, format, '.json'), function (err, data) { if (err) { - this.fire('error', {error: err}); + this.fire('error', { error: err }); return; } - this.data = data; - if (this.img) this.fire('load'); + if (this.img) + this.fire('load'); }.bind(this)); - - ajax.getImage(normalizeURL(base, format, '.png'), function(err, img) { + ajax.getImage(normalizeURL(base, format, '.png'), function (err, img) { if (err) { - this.fire('error', {error: err}); + this.fire('error', { error: err }); return; } - - // premultiply the sprite var data = img.getData(); var newdata = img.data = new Uint8Array(data.length); for (var i = 0; i < data.length; i += 4) { @@ -50482,96 +52496,82 @@ function ImageSprite(base) { newdata[i + 2] = data[i + 2] * alpha; newdata[i + 3] = data[i + 3]; } - this.img = img; - if (this.data) this.fire('load'); + if (this.data) + this.fire('load'); }.bind(this)); } - ImageSprite.prototype = Object.create(Evented); - -ImageSprite.prototype.toJSON = function() { +ImageSprite.prototype.toJSON = function () { return this.base; }; - -ImageSprite.prototype.loaded = function() { +ImageSprite.prototype.loaded = function () { return !!(this.data && this.img); }; - -ImageSprite.prototype.resize = function(/*gl*/) { +ImageSprite.prototype.resize = function () { if (browser.devicePixelRatio > 1 !== this.retina) { var newSprite = new ImageSprite(this.base); - newSprite.on('load', function() { + newSprite.on('load', function () { this.img = newSprite.img; this.data = newSprite.data; this.retina = newSprite.retina; }.bind(this)); } }; - -function SpritePosition() {} -SpritePosition.prototype = { x: 0, y: 0, width: 0, height: 0, pixelRatio: 1, sdf: false }; - -ImageSprite.prototype.getSpritePosition = function(name) { - if (!this.loaded()) return new SpritePosition(); - +function SpritePosition() { +} +SpritePosition.prototype = { + x: 0, + y: 0, + width: 0, + height: 0, + pixelRatio: 1, + sdf: false +}; +ImageSprite.prototype.getSpritePosition = function (name) { + if (!this.loaded()) + return new SpritePosition(); var pos = this.data && this.data[name]; - if (pos && this.img) return pos; - + if (pos && this.img) + return pos; return new SpritePosition(); }; - -},{"../util/ajax":334,"../util/browser":335,"../util/evented":341,"../util/mapbox":346}],289:[function(require,module,exports){ +},{"../util/ajax":349,"../util/browser":350,"../util/evented":358,"../util/mapbox":363}],301:[function(require,module,exports){ 'use strict'; - -var parseCSSColor = require('csscolorparser').parseCSSColor; +var parseColorString = require('csscolorparser').parseCSSColor; var util = require('../util/util'); - -var colorCache = {}; - -function parseColor(input) { - - if (colorCache[input]) { - return colorCache[input]; - - // RGBA array - } else if (Array.isArray(input)) { - return input; - - // GL function - } else if (input && input.stops) { +var StyleFunction = require('./style_function'); +var cache = {}; +module.exports = function parseColor(input) { + if (StyleFunction.isFunctionDefinition(input)) { return util.extend({}, input, { - stops: input.stops.map(parseFunctionStopColor) + stops: input.stops.map(function (stop) { + return [ + stop[0], + parseColor(stop[1]) + ]; + }) }); - - // Color string } else if (typeof input === 'string') { - var parsedColor = parseCSSColor(input); - if (!parsedColor) { throw new Error('Invalid color ' + input); } - - var output = colorDowngrade(parsedColor); - colorCache[input] = output; - return output; - + if (!cache[input]) { + var rgba = parseColorString(input); + if (!rgba) { + throw new Error('Invalid color ' + input); + } + cache[input] = [ + rgba[0] / 255 * rgba[3], + rgba[1] / 255 * rgba[3], + rgba[2] / 255 * rgba[3], + rgba[3] + ]; + } + return cache[input]; } else { throw new Error('Invalid color ' + input); } - -} - -function parseFunctionStopColor(stop) { - return [stop[0], parseColor(stop[1])]; -} - -function colorDowngrade(color) { - return [color[0] / 255, color[1] / 255, color[2] / 255, color[3] / 1]; -} - -module.exports = parseColor; - -},{"../util/util":349,"csscolorparser":351}],290:[function(require,module,exports){ +}; +},{"../util/util":366,"./style_function":304,"csscolorparser":368}],302:[function(require,module,exports){ 'use strict'; - var Evented = require('../util/evented'); var StyleLayer = require('./style_layer'); var ImageSprite = require('./image_sprite'); @@ -50586,67 +52586,56 @@ var Dispatcher = require('../util/dispatcher'); var AnimationLoop = require('./animation_loop'); var validateStyle = require('./validate_style'); var Source = require('../source/source'); +var QueryFeatures = require('../source/query_features'); +var SourceCache = require('../source/source_cache'); var styleSpec = require('./style_spec'); var StyleFunction = require('./style_function'); - module.exports = Style; - -function Style(stylesheet, animationLoop) { +function Style(stylesheet, animationLoop, workerCount) { this.animationLoop = animationLoop || new AnimationLoop(); - this.dispatcher = new Dispatcher(Math.max(browser.hardwareConcurrency - 1, 1), this); - this.spriteAtlas = new SpriteAtlas(512, 512); + this.dispatcher = new Dispatcher(workerCount || 1, this); + this.spriteAtlas = new SpriteAtlas(1024, 1024); this.lineAtlas = new LineAtlas(256, 512); - this._layers = {}; - this._order = []; + this._order = []; this._groups = []; this.sources = {}; this.zoomHistory = {}; - util.bindAll([ '_forwardSourceEvent', '_forwardTileEvent', '_forwardLayerEvent', '_redoPlacement' ], this); - this._resetUpdates(); - - var loaded = function(err, stylesheet) { + var stylesheetLoaded = function (err, stylesheet) { if (err) { - this.fire('error', {error: err}); + this.fire('error', { error: err }); return; } - - if (validateStyle.emitErrors(this, validateStyle(stylesheet))) return; - + if (validateStyle.emitErrors(this, validateStyle(stylesheet))) + return; this._loaded = true; this.stylesheet = stylesheet; - this.updateClasses(); - var sources = stylesheet.sources; for (var id in sources) { this.addSource(id, sources[id]); } - if (stylesheet.sprite) { this.sprite = new ImageSprite(stylesheet.sprite); this.sprite.on('load', this.fire.bind(this, 'change')); } - this.glyphSource = new GlyphSource(stylesheet.glyphs); this._resolve(); this.fire('load'); }.bind(this); - if (typeof stylesheet === 'string') { - ajax.getJSON(normalizeURL(stylesheet), loaded); + ajax.getJSON(normalizeURL(stylesheet), stylesheetLoaded); } else { - browser.frame(loaded.bind(this, null, stylesheet)); + browser.frame(stylesheetLoaded.bind(this, null, stylesheet)); } - - this.on('source.load', function(event) { + this.on('source.load', function (event) { var source = event.source; if (source && source.vectorLayerIds) { for (var layerId in this._layers) { @@ -50658,119 +52647,93 @@ function Style(stylesheet, animationLoop) { } }); } - Style.prototype = util.inherit(Evented, { _loaded: false, - - _validateLayer: function(layer) { + _validateLayer: function (layer) { var source = this.sources[layer.source]; - - if (!layer.sourceLayer) return; - if (!source) return; - if (!source.vectorLayerIds) return; - + if (!layer.sourceLayer) + return; + if (!source) + return; + if (!source.vectorLayerIds) + return; if (source.vectorLayerIds.indexOf(layer.sourceLayer) === -1) { - this.fire('error', { - error: new Error( - 'Source layer "' + layer.sourceLayer + '" ' + - 'does not exist on source "' + source.id + '" ' + - 'as specified by style layer "' + layer.id + '"' - ) - }); + this.fire('error', { error: new Error('Source layer "' + layer.sourceLayer + '" ' + 'does not exist on source "' + source.id + '" ' + 'as specified by style layer "' + layer.id + '"') }); } }, - - loaded: function() { + loaded: function () { if (!this._loaded) return false; - + if (Object.keys(this._updates.sources).length) + return false; for (var id in this.sources) if (!this.sources[id].loaded()) return false; - if (this.sprite && !this.sprite.loaded()) return false; - return true; }, - - _resolve: function() { + _resolve: function () { var layer, layerJSON; - this._layers = {}; - this._order = this.stylesheet.layers.map(function(layer) { + this._order = this.stylesheet.layers.map(function (layer) { return layer.id; }); - - // resolve all layers WITHOUT a ref for (var i = 0; i < this.stylesheet.layers.length; i++) { layerJSON = this.stylesheet.layers[i]; - if (layerJSON.ref) continue; + if (layerJSON.ref) + continue; layer = StyleLayer.create(layerJSON); this._layers[layer.id] = layer; layer.on('error', this._forwardLayerEvent); } - - // resolve all layers WITH a ref for (var j = 0; j < this.stylesheet.layers.length; j++) { layerJSON = this.stylesheet.layers[j]; - if (!layerJSON.ref) continue; + if (!layerJSON.ref) + continue; var refLayer = this.getLayer(layerJSON.ref); layer = StyleLayer.create(layerJSON, refLayer); this._layers[layer.id] = layer; layer.on('error', this._forwardLayerEvent); } - this._groupLayers(); this._updateWorkerLayers(); }, - - _groupLayers: function() { + _groupLayers: function () { var group; - this._groups = []; - - // Split into groups of consecutive top-level layers with the same source. for (var i = 0; i < this._order.length; ++i) { var layer = this._layers[this._order[i]]; - if (!group || layer.source !== group.source) { group = []; group.source = layer.source; this._groups.push(group); } - group.push(layer); } }, - - _updateWorkerLayers: function(ids) { + _updateWorkerLayers: function (ids) { this.dispatcher.broadcast(ids ? 'update layers' : 'set layers', this._serializeLayers(ids)); }, - - _serializeLayers: function(ids) { + _serializeLayers: function (ids) { ids = ids || this._order; var serialized = []; - var options = {includeRefProperties: true}; + var options = { includeRefProperties: true }; for (var i = 0; i < ids.length; i++) { serialized.push(this._layers[ids[i]].serialize(options)); } return serialized; }, - - _applyClasses: function(classes, options) { - if (!this._loaded) return; - + _applyClasses: function (classes, options) { + if (!this._loaded) + return; classes = classes || []; - options = options || {transition: true}; + options = options || { transition: true }; var transition = this.stylesheet.transition || {}; - var layers = this._updates.allPaintProps ? this._layers : this._updates.paintProps; - for (var id in layers) { var layer = this._layers[id]; var props = this._updates.paintProps[id]; - if (this._updates.allPaintProps || props.all) { layer.updatePaintTransitions(classes, options, transition, this.animationLoop); } else { @@ -50780,70 +52743,49 @@ Style.prototype = util.inherit(Evented, { } } }, - - _recalculate: function(z) { + _recalculate: function (z) { for (var sourceId in this.sources) this.sources[sourceId].used = false; - this._updateZoomHistory(z); - this.rasterFadeDuration = 300; for (var layerId in this._layers) { var layer = this._layers[layerId]; - layer.recalculate(z, this.zoomHistory); if (!layer.isHidden(z) && layer.source) { this.sources[layer.source].used = true; } } - var maxZoomTransitionDuration = 300; if (Math.floor(this.z) !== Math.floor(z)) { this.animationLoop.set(maxZoomTransitionDuration); } - this.z = z; this.fire('zoom'); }, - - _updateZoomHistory: function(z) { - + _updateZoomHistory: function (z) { var zh = this.zoomHistory; - if (zh.lastIntegerZoom === undefined) { - // first time zh.lastIntegerZoom = Math.floor(z); zh.lastIntegerZoomTime = 0; zh.lastZoom = z; } - - // check whether an integer zoom level as passed since the last frame - // and if yes, record it with the time. Used for transitioning patterns. if (Math.floor(zh.lastZoom) < Math.floor(z)) { zh.lastIntegerZoom = Math.floor(z); zh.lastIntegerZoomTime = Date.now(); - } else if (Math.floor(zh.lastZoom) > Math.floor(z)) { zh.lastIntegerZoom = Math.floor(z + 1); zh.lastIntegerZoomTime = Date.now(); } - zh.lastZoom = z; }, - _checkLoaded: function () { if (!this._loaded) { throw new Error('Style is not done loading'); } }, - - /** - * Apply queued style updates in a batch - * @private - */ - update: function(classes, options) { - if (!this._updates.changed) return this; - + update: function (classes, options) { + if (!this._updates.changed) + return this; if (this._updates.allLayers) { this._groupLayers(); this._updateWorkerLayers(); @@ -50853,30 +52795,23 @@ Style.prototype = util.inherit(Evented, { this._updateWorkerLayers(updatedIds); } } - var updatedSourceIds = Object.keys(this._updates.sources); var i; for (i = 0; i < updatedSourceIds.length; i++) { this._reloadSource(updatedSourceIds[i]); } - for (i = 0; i < this._updates.events.length; i++) { var args = this._updates.events[i]; this.fire(args[0], args[1]); } - this._applyClasses(classes, options); - if (this._updates.changed) { this.fire('change'); } - this._resetUpdates(); - return this; }, - - _resetUpdates: function() { + _resetUpdates: function () { this._updates = { events: [], layers: {}, @@ -50884,122 +52819,78 @@ Style.prototype = util.inherit(Evented, { paintProps: {} }; }, - - addSource: function(id, source) { + addSource: function (id, source) { this._checkLoaded(); if (this.sources[id] !== undefined) { throw new Error('There is already a source with this ID'); } - if (!Source.is(source) && this._handleErrors(validateStyle.source, 'sources.' + id, source)) return this; - - source = Source.create(source); + if (!source.type) { + throw new Error('The type property must be defined, but the only the following properties were given: ' + Object.keys(source) + '.'); + } + var builtIns = [ + 'vector', + 'raster', + 'geojson', + 'video', + 'image' + ]; + var shouldValidate = builtIns.indexOf(source.type) >= 0; + if (shouldValidate && this._handleErrors(validateStyle.source, 'sources.' + id, source)) + return this; + source = new SourceCache(id, source, this.dispatcher); this.sources[id] = source; - source.id = id; source.style = this; - source.dispatcher = this.dispatcher; - source - .on('load', this._forwardSourceEvent) - .on('error', this._forwardSourceEvent) - .on('change', this._forwardSourceEvent) - .on('tile.add', this._forwardTileEvent) - .on('tile.load', this._forwardTileEvent) - .on('tile.error', this._forwardTileEvent) - .on('tile.remove', this._forwardTileEvent) - .on('tile.stats', this._forwardTileEvent); - - this._updates.events.push(['source.add', {source: source}]); + source.on('load', this._forwardSourceEvent).on('error', this._forwardSourceEvent).on('change', this._forwardSourceEvent).on('tile.add', this._forwardTileEvent).on('tile.load', this._forwardTileEvent).on('tile.error', this._forwardTileEvent).on('tile.remove', this._forwardTileEvent).on('tile.stats', this._forwardTileEvent); + this._updates.events.push([ + 'source.add', + { source: source } + ]); this._updates.changed = true; - return this; }, - - /** - * Remove a source from this stylesheet, given its id. - * @param {string} id id of the source to remove - * @returns {Style} this style - * @throws {Error} if no source is found with the given ID - * @private - */ - removeSource: function(id) { + removeSource: function (id) { this._checkLoaded(); - if (this.sources[id] === undefined) { throw new Error('There is no source with this ID'); } var source = this.sources[id]; delete this.sources[id]; - source - .off('load', this._forwardSourceEvent) - .off('error', this._forwardSourceEvent) - .off('change', this._forwardSourceEvent) - .off('tile.add', this._forwardTileEvent) - .off('tile.load', this._forwardTileEvent) - .off('tile.error', this._forwardTileEvent) - .off('tile.remove', this._forwardTileEvent) - .off('tile.stats', this._forwardTileEvent); - - this._updates.events.push(['source.remove', {source: source}]); + delete this._updates.sources[id]; + source.off('load', this._forwardSourceEvent).off('error', this._forwardSourceEvent).off('change', this._forwardSourceEvent).off('tile.add', this._forwardTileEvent).off('tile.load', this._forwardTileEvent).off('tile.error', this._forwardTileEvent).off('tile.remove', this._forwardTileEvent).off('tile.stats', this._forwardTileEvent); + this._updates.events.push([ + 'source.remove', + { source: source } + ]); this._updates.changed = true; - return this; }, - - /** - * Get a source by id. - * @param {string} id id of the desired source - * @returns {Object} source - * @private - */ - getSource: function(id) { - return this.sources[id]; + getSource: function (id) { + return this.sources[id] && this.sources[id].getSource(); }, - - /** - * Add a layer to the map style. The layer will be inserted before the layer with - * ID `before`, or appended if `before` is omitted. - * @param {StyleLayer|Object} layer - * @param {string=} before ID of an existing layer to insert before - * @fires layer.add - * @returns {Style} `this` - * @private - */ - addLayer: function(layer, before) { + addLayer: function (layer, before) { this._checkLoaded(); - if (!(layer instanceof StyleLayer)) { - // this layer is not in the style.layers array, so we pass an impossible array index - if (this._handleErrors(validateStyle.layer, - 'layers.' + layer.id, layer, false, {arrayIndex: -1})) return this; - + if (this._handleErrors(validateStyle.layer, 'layers.' + layer.id, layer, false, { arrayIndex: -1 })) + return this; var refLayer = layer.ref && this.getLayer(layer.ref); layer = StyleLayer.create(layer, refLayer); } this._validateLayer(layer); - layer.on('error', this._forwardLayerEvent); - this._layers[layer.id] = layer; this._order.splice(before ? this._order.indexOf(before) : Infinity, 0, layer.id); - this._updates.allLayers = true; if (layer.source) { this._updates.sources[layer.source] = true; } - this._updates.events.push(['layer.add', {layer: layer}]); - + this._updates.events.push([ + 'layer.add', + { layer: layer } + ]); return this.updateClasses(layer.id); }, - - /** - * Remove a layer from this stylesheet, given its id. - * @param {string} id id of the layer to remove - * @returns {Style} this style - * @throws {Error} if no layer is found with the given ID - * @private - */ - removeLayer: function(id) { + removeLayer: function (id) { this._checkLoaded(); - var layer = this._layers[id]; if (layer === undefined) { throw new Error('There is no layer with this ID'); @@ -51009,53 +52900,34 @@ Style.prototype = util.inherit(Evented, { this.removeLayer(i); } } - layer.off('error', this._forwardLayerEvent); - delete this._layers[id]; + delete this._updates.layers[id]; + delete this._updates.paintProps[id]; this._order.splice(this._order.indexOf(id), 1); - this._updates.allLayers = true; - this._updates.events.push(['layer.remove', {layer: layer}]); + this._updates.events.push([ + 'layer.remove', + { layer: layer } + ]); this._updates.changed = true; - return this; }, - - /** - * Return the style layer object with the given `id`. - * - * @param {string} id - id of the desired layer - * @returns {?Object} a layer, if one with the given `id` exists - * @private - */ - getLayer: function(id) { + getLayer: function (id) { return this._layers[id]; }, - - /** - * If a layer has a `ref` property that makes it derive some values - * from another layer, return that referent layer. Otherwise, - * returns the layer itself. - * @param {string} id the layer's id - * @returns {Layer} the referent layer or the layer itself - * @private - */ - getReferentLayer: function(id) { + getReferentLayer: function (id) { var layer = this.getLayer(id); if (layer.ref) { layer = this.getLayer(layer.ref); } return layer; }, - - setLayerZoomRange: function(layerId, minzoom, maxzoom) { + setLayerZoomRange: function (layerId, minzoom, maxzoom) { this._checkLoaded(); - var layer = this.getReferentLayer(layerId); - - if (layer.minzoom === minzoom && layer.maxzoom === maxzoom) return this; - + if (layer.minzoom === minzoom && layer.maxzoom === maxzoom) + return this; if (minzoom != null) { layer.minzoom = minzoom; } @@ -51064,91 +52936,62 @@ Style.prototype = util.inherit(Evented, { } return this._updateLayer(layer); }, - - setFilter: function(layerId, filter) { + setFilter: function (layerId, filter) { this._checkLoaded(); - var layer = this.getReferentLayer(layerId); - - if (this._handleErrors(validateStyle.filter, 'layers.' + layer.id + '.filter', filter)) return this; - - if (util.deepEqual(layer.filter, filter)) return this; + if (filter !== null && this._handleErrors(validateStyle.filter, 'layers.' + layer.id + '.filter', filter)) + return this; + if (util.deepEqual(layer.filter, filter)) + return this; layer.filter = util.clone(filter); - return this._updateLayer(layer); }, - - /** - * Get a layer's filter object - * @param {string} layer the layer to inspect - * @returns {*} the layer's filter, if any - * @private - */ - getFilter: function(layer) { + getFilter: function (layer) { return this.getReferentLayer(layer).filter; }, - - setLayoutProperty: function(layerId, name, value) { + setLayoutProperty: function (layerId, name, value) { this._checkLoaded(); - var layer = this.getReferentLayer(layerId); - - if (util.deepEqual(layer.getLayoutProperty(name), value)) return this; - + if (util.deepEqual(layer.getLayoutProperty(name), value)) + return this; layer.setLayoutProperty(name, value); return this._updateLayer(layer); }, - - /** - * Get a layout property's value from a given layer - * @param {string} layer the layer to inspect - * @param {string} name the name of the layout property - * @returns {*} the property value - * @private - */ - getLayoutProperty: function(layer, name) { + getLayoutProperty: function (layer, name) { return this.getReferentLayer(layer).getLayoutProperty(name); }, - - setPaintProperty: function(layerId, name, value, klass) { + setPaintProperty: function (layerId, name, value, klass) { this._checkLoaded(); - var layer = this.getLayer(layerId); - - if (util.deepEqual(layer.getPaintProperty(name, klass), value)) return this; - + if (util.deepEqual(layer.getPaintProperty(name, klass), value)) + return this; var wasFeatureConstant = layer.isPaintValueFeatureConstant(name); layer.setPaintProperty(name, value, klass); - - var isFeatureConstant = !(StyleFunction.isFunctionDefinition(value) && value.property !== '$zoom' && value.property !== undefined); - + var isFeatureConstant = !(value && StyleFunction.isFunctionDefinition(value) && value.property !== '$zoom' && value.property !== undefined); if (!isFeatureConstant || !wasFeatureConstant) { this._updates.layers[layerId] = true; if (layer.source) { this._updates.sources[layer.source] = true; } } - return this.updateClasses(layerId, name); }, - - getPaintProperty: function(layer, name, klass) { + getPaintProperty: function (layer, name, klass) { return this.getLayer(layer).getPaintProperty(name, klass); }, - updateClasses: function (layerId, paintName) { this._updates.changed = true; if (!layerId) { this._updates.allPaintProps = true; } else { var props = this._updates.paintProps; - if (!props[layerId]) props[layerId] = {}; + if (!props[layerId]) + props[layerId] = {}; props[layerId][paintName || 'all'] = true; } return this; }, - - serialize: function() { + serialize: function () { return util.filterObject({ version: this.stylesheet.version, name: this.stylesheet.name, @@ -51160,15 +53003,16 @@ Style.prototype = util.inherit(Evented, { sprite: this.stylesheet.sprite, glyphs: this.stylesheet.glyphs, transition: this.stylesheet.transition, - sources: util.mapObject(this.sources, function(source) { + sources: util.mapObject(this.sources, function (source) { return source.serialize(); }), - layers: this._order.map(function(id) { + layers: this._order.map(function (id) { return this._layers[id].serialize(); }, this) - }, function(value) { return value !== undefined; }); + }, function (value) { + return value !== undefined; + }); }, - _updateLayer: function (layer) { this._updates.layers[layer.id] = true; if (layer.source) { @@ -51177,8 +53021,7 @@ Style.prototype = util.inherit(Evented, { this._updates.changed = true; return this; }, - - _flattenRenderedFeatures: function(sourceResults) { + _flattenRenderedFeatures: function (sourceResults) { var features = []; for (var l = this._order.length - 1; l >= 0; l--) { var layerID = this._order[l]; @@ -51193,31 +53036,48 @@ Style.prototype = util.inherit(Evented, { } return features; }, - - queryRenderedFeatures: function(queryGeometry, params, zoom, bearing) { + queryRenderedFeatures: function (queryGeometry, params, zoom, bearing) { if (params && params.filter) { this._handleErrors(validateStyle.filter, 'queryRenderedFeatures.filter', params.filter, true); } - + var includedSources = {}; + if (params && params.layers) { + for (var i = 0; i < params.layers.length; i++) { + var layerId = params.layers[i]; + includedSources[this._layers[layerId].source] = true; + } + } var sourceResults = []; for (var id in this.sources) { + if (params.layers && !includedSources[id]) + continue; var source = this.sources[id]; - if (source.queryRenderedFeatures) { - sourceResults.push(source.queryRenderedFeatures(queryGeometry, params, zoom, bearing)); - } + var results = QueryFeatures.rendered(source, this._layers, queryGeometry, params, zoom, bearing); + sourceResults.push(results); } return this._flattenRenderedFeatures(sourceResults); }, - - querySourceFeatures: function(sourceID, params) { + querySourceFeatures: function (sourceID, params) { if (params && params.filter) { this._handleErrors(validateStyle.filter, 'querySourceFeatures.filter', params.filter, true); } - var source = this.getSource(sourceID); - return source && source.querySourceFeatures ? source.querySourceFeatures(params) : []; + var source = this.sources[sourceID]; + return source ? QueryFeatures.source(source, params) : []; }, - - _handleErrors: function(validate, key, value, throws, props) { + addSourceType: function (name, SourceType, callback) { + if (Source.getType(name)) { + return callback(new Error('A source type called "' + name + '" already exists.')); + } + Source.setType(name, SourceType); + if (!SourceType.workerSourceURL) { + return callback(null, null); + } + this.dispatcher.broadcast('load worker source', { + name: name, + url: SourceType.workerSourceURL + }, callback); + }, + _handleErrors: function (validate, key, value, throws, props) { var action = throws ? validateStyle.throwErrors : validateStyle.emitErrors; var result = validate.call(validateStyle, util.extend({ key: key, @@ -51227,114 +53087,93 @@ Style.prototype = util.inherit(Evented, { }, props)); return action.call(validateStyle, this, result); }, - - _remove: function() { + _remove: function () { this.dispatcher.remove(); }, - - _reloadSource: function(id) { + _reloadSource: function (id) { this.sources[id].reload(); }, - - _updateSources: function(transform) { + _updateSources: function (transform) { for (var id in this.sources) { this.sources[id].update(transform); } }, - - _redoPlacement: function() { + _redoPlacement: function () { for (var id in this.sources) { - if (this.sources[id].redoPlacement) this.sources[id].redoPlacement(); + if (this.sources[id].redoPlacement) + this.sources[id].redoPlacement(); } }, - - _forwardSourceEvent: function(e) { - this.fire('source.' + e.type, util.extend({source: e.target}, e)); + _forwardSourceEvent: function (e) { + this.fire('source.' + e.type, util.extend({ source: e.target.getSource() }, e)); }, - - _forwardTileEvent: function(e) { - this.fire(e.type, util.extend({source: e.target}, e)); + _forwardTileEvent: function (e) { + this.fire(e.type, util.extend({ source: e.target }, e)); }, - - _forwardLayerEvent: function(e) { - this.fire('layer.' + e.type, util.extend({layer: {id: e.target.id}}, e)); + _forwardLayerEvent: function (e) { + this.fire('layer.' + e.type, util.extend({ layer: { id: e.target.id } }, e)); }, - - // Callbacks from web workers - - 'get sprite json': function(params, callback) { + 'get sprite json': function (params, callback) { var sprite = this.sprite; if (sprite.loaded()) { - callback(null, { sprite: sprite.data, retina: sprite.retina }); + callback(null, { + sprite: sprite.data, + retina: sprite.retina + }); } else { - sprite.on('load', function() { - callback(null, { sprite: sprite.data, retina: sprite.retina }); + sprite.on('load', function () { + callback(null, { + sprite: sprite.data, + retina: sprite.retina + }); }); } }, - - 'get icons': function(params, callback) { + 'get icons': function (params, callback) { var sprite = this.sprite; var spriteAtlas = this.spriteAtlas; if (sprite.loaded()) { spriteAtlas.setSprite(sprite); spriteAtlas.addIcons(params.icons, callback); } else { - sprite.on('load', function() { + sprite.on('load', function () { spriteAtlas.setSprite(sprite); spriteAtlas.addIcons(params.icons, callback); }); } }, - - 'get glyphs': function(params, callback) { - var stacks = params.stacks, - remaining = Object.keys(stacks).length, - allGlyphs = {}; - + 'get glyphs': function (params, callback) { + var stacks = params.stacks, remaining = Object.keys(stacks).length, allGlyphs = {}; for (var fontName in stacks) { this.glyphSource.getSimpleGlyphs(fontName, stacks[fontName], params.uid, done); } - function done(err, glyphs, fontName) { - if (err) console.error(err); - + if (err) + console.error(err); allGlyphs[fontName] = glyphs; remaining--; - if (remaining === 0) callback(null, allGlyphs); } } }); - -},{"../render/line_atlas":270,"../source/source":279,"../symbol/glyph_source":311,"../symbol/sprite_atlas":316,"../util/ajax":334,"../util/browser":335,"../util/dispatcher":337,"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./animation_loop":287,"./image_sprite":288,"./style_function":292,"./style_layer":293,"./style_spec":300,"./validate_style":302}],291:[function(require,module,exports){ +},{"../render/line_atlas":278,"../source/query_features":288,"../source/source":290,"../source/source_cache":291,"../symbol/glyph_source":323,"../symbol/sprite_atlas":328,"../util/ajax":349,"../util/browser":350,"../util/dispatcher":357,"../util/evented":358,"../util/mapbox":363,"../util/util":366,"./animation_loop":299,"./image_sprite":300,"./style_function":304,"./style_layer":305,"./style_spec":312,"./validate_style":314}],303:[function(require,module,exports){ 'use strict'; - var MapboxGLFunction = require('./style_function'); var parseColor = require('./parse_color'); var util = require('../util/util'); - module.exports = StyleDeclaration; - function StyleDeclaration(reference, value) { - this.type = reference.type; - this.transitionable = reference.transition; this.value = util.clone(value); - this.isFunction = !!value.stops; - - // immutable representation of value. used for comparison + this.isFunction = MapboxGLFunction.isFunctionDefinition(value); this.json = JSON.stringify(this.value); - - var parsedValue = this.type === 'color' ? parseColor(this.value) : value; + var parsedValue = reference.type === 'color' && this.value ? parseColor(this.value) : value; this.calculate = MapboxGLFunction[reference.function || 'piecewise-constant'](parsedValue); this.isFeatureConstant = this.calculate.isFeatureConstant; this.isZoomConstant = this.calculate.isZoomConstant; - if (reference.function === 'piecewise-constant' && reference.transition) { this.calculate = transitioned(this.calculate); } - if (!this.isFeatureConstant && !this.isZoomConstant) { this.stopZoomLevels = []; var interpolationAmountStops = []; @@ -51343,81 +53182,76 @@ function StyleDeclaration(reference, value) { var zoom = stops[i][0].zoom; if (this.stopZoomLevels.indexOf(zoom) < 0) { this.stopZoomLevels.push(zoom); - interpolationAmountStops.push([zoom, interpolationAmountStops.length]); + interpolationAmountStops.push([ + zoom, + interpolationAmountStops.length + ]); } } - this.calculateInterpolationT = MapboxGLFunction.interpolated({ stops: interpolationAmountStops, base: value.base }); } } - function transitioned(calculate) { - return function(globalProperties, featureProperties) { + return function (globalProperties, featureProperties) { var z = globalProperties.zoom; var zh = globalProperties.zoomHistory; var duration = globalProperties.duration; - var fraction = z % 1; var t = Math.min((Date.now() - zh.lastIntegerZoomTime) / duration, 1); var fromScale = 1; var toScale = 1; var mix, from, to; - if (z > zh.lastIntegerZoom) { mix = fraction + (1 - fraction) * t; fromScale *= 2; - from = calculate({zoom: z - 1}, featureProperties); - to = calculate({zoom: z}, featureProperties); + from = calculate({ zoom: z - 1 }, featureProperties); + to = calculate({ zoom: z }, featureProperties); } else { mix = 1 - (1 - t) * fraction; - to = calculate({zoom: z}, featureProperties); - from = calculate({zoom: z + 1}, featureProperties); + to = calculate({ zoom: z }, featureProperties); + from = calculate({ zoom: z + 1 }, featureProperties); fromScale /= 2; } - - return { - from: from, - fromScale: fromScale, - to: to, - toScale: toScale, - t: mix - }; + if (from === undefined || to === undefined) { + return undefined; + } else { + return { + from: from, + fromScale: fromScale, + to: to, + toScale: toScale, + t: mix + }; + } }; } - -},{"../util/util":349,"./parse_color":289,"./style_function":292}],292:[function(require,module,exports){ +},{"../util/util":366,"./parse_color":301,"./style_function":304}],304:[function(require,module,exports){ 'use strict'; - var MapboxGLFunction = require('mapbox-gl-function'); - -exports.interpolated = function(parameters) { +exports.interpolated = function (parameters) { var inner = MapboxGLFunction.interpolated(parameters); - var outer = function(globalProperties, featureProperties) { + var outer = function (globalProperties, featureProperties) { return inner(globalProperties && globalProperties.zoom, featureProperties || {}); }; outer.isFeatureConstant = inner.isFeatureConstant; outer.isZoomConstant = inner.isZoomConstant; return outer; }; - -exports['piecewise-constant'] = function(parameters) { +exports['piecewise-constant'] = function (parameters) { var inner = MapboxGLFunction['piecewise-constant'](parameters); - var outer = function(globalProperties, featureProperties) { + var outer = function (globalProperties, featureProperties) { return inner(globalProperties && globalProperties.zoom, featureProperties || {}); }; outer.isFeatureConstant = inner.isFeatureConstant; outer.isZoomConstant = inner.isZoomConstant; return outer; }; - exports.isFunctionDefinition = MapboxGLFunction.isFunctionDefinition; - -},{"mapbox-gl-function":374}],293:[function(require,module,exports){ +},{"mapbox-gl-function":393}],305:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var StyleTransition = require('./style_transition'); var StyleDeclaration = require('./style_declaration'); @@ -51425,12 +53259,9 @@ var styleSpec = require('./style_spec'); var validateStyle = require('./validate_style'); var parseColor = require('./parse_color'); var Evented = require('../util/evented'); - module.exports = StyleLayer; - var TRANSITION_SUFFIX = '-transition'; - -StyleLayer.create = function(layer, refLayer) { +StyleLayer.create = function (layer, refLayer) { var Classes = { background: require('./style_layer/background_style_layer'), circle: require('./style_layer/circle_style_layer'), @@ -51441,14 +53272,11 @@ StyleLayer.create = function(layer, refLayer) { }; return new Classes[(refLayer || layer).type](layer, refLayer); }; - function StyleLayer(layer, refLayer) { this.set(layer, refLayer); } - StyleLayer.prototype = util.inherit(Evented, { - - set: function(layer, refLayer) { + set: function (layer, refLayer) { this.id = layer.id; this.ref = layer.ref; this.metadata = layer.metadata; @@ -51458,22 +53286,16 @@ StyleLayer.prototype = util.inherit(Evented, { this.minzoom = (refLayer || layer).minzoom; this.maxzoom = (refLayer || layer).maxzoom; this.filter = (refLayer || layer).filter; - this.paint = {}; this.layout = {}; - this._paintSpecifications = styleSpec['paint_' + this.type]; this._layoutSpecifications = styleSpec['layout_' + this.type]; - - this._paintTransitions = {}; // {[propertyName]: StyleTransition} - this._paintTransitionOptions = {}; // {[className]: {[propertyName]: { duration:Number, delay:Number }}} - this._paintDeclarations = {}; // {[className]: {[propertyName]: StyleDeclaration}} - this._layoutDeclarations = {}; // {[propertyName]: StyleDeclaration} - this._layoutFunctions = {}; // {[propertyName]: Boolean} - + this._paintTransitions = {}; + this._paintTransitionOptions = {}; + this._paintDeclarations = {}; + this._layoutDeclarations = {}; + this._layoutFunctions = {}; var paintName, layoutName; - - // Resolve paint declarations for (var key in layer) { var match = key.match(/^paint(?:\.(.*))?$/); if (match) { @@ -51483,8 +53305,6 @@ StyleLayer.prototype = util.inherit(Evented, { } } } - - // Resolve layout declarations if (this.ref) { this._layoutDeclarations = refLayer._layoutDeclarations; } else { @@ -51492,8 +53312,6 @@ StyleLayer.prototype = util.inherit(Evented, { this.setLayoutProperty(layoutName, layer.layout[layoutName]); } } - - // set initial layout/paint values for (paintName in this._paintSpecifications) { this.paint[paintName] = this.getPaintValue(paintName); } @@ -51501,40 +53319,31 @@ StyleLayer.prototype = util.inherit(Evented, { this._updateLayoutValue(layoutName); } }, - - setLayoutProperty: function(name, value) { - + setLayoutProperty: function (name, value) { if (value == null) { delete this._layoutDeclarations[name]; } else { var key = 'layers.' + this.id + '.layout.' + name; - if (this._handleErrors(validateStyle.layoutProperty, key, name, value)) return; + if (this._handleErrors(validateStyle.layoutProperty, key, name, value)) + return; this._layoutDeclarations[name] = new StyleDeclaration(this._layoutSpecifications[name], value); } this._updateLayoutValue(name); }, - - getLayoutProperty: function(name) { - return ( - this._layoutDeclarations[name] && - this._layoutDeclarations[name].value - ); + getLayoutProperty: function (name) { + return this._layoutDeclarations[name] && this._layoutDeclarations[name].value; }, - - getLayoutValue: function(name, globalProperties, featureProperties) { + getLayoutValue: function (name, globalProperties, featureProperties) { var specification = this._layoutSpecifications[name]; var declaration = this._layoutDeclarations[name]; - if (declaration) { return declaration.calculate(globalProperties, featureProperties); } else { return specification.default; } }, - - setPaintProperty: function(name, value, klass) { + setPaintProperty: function (name, value, klass) { var validateStyleKey = 'layers.' + this.id + (klass ? '["paint.' + klass + '"].' : '.paint.') + name; - if (util.endsWith(name, TRANSITION_SUFFIX)) { if (!this._paintTransitionOptions[klass || '']) { this._paintTransitionOptions[klass || ''] = {}; @@ -51542,7 +53351,8 @@ StyleLayer.prototype = util.inherit(Evented, { if (value === null || value === undefined) { delete this._paintTransitionOptions[klass || ''][name]; } else { - if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) return; + if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) + return; this._paintTransitionOptions[klass || ''][name] = value; } } else { @@ -51552,32 +53362,23 @@ StyleLayer.prototype = util.inherit(Evented, { if (value === null || value === undefined) { delete this._paintDeclarations[klass || ''][name]; } else { - if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) return; + if (this._handleErrors(validateStyle.paintProperty, validateStyleKey, name, value)) + return; this._paintDeclarations[klass || ''][name] = new StyleDeclaration(this._paintSpecifications[name], value); } } }, - - getPaintProperty: function(name, klass) { + getPaintProperty: function (name, klass) { klass = klass || ''; if (util.endsWith(name, TRANSITION_SUFFIX)) { - return ( - this._paintTransitionOptions[klass] && - this._paintTransitionOptions[klass][name] - ); + return this._paintTransitionOptions[klass] && this._paintTransitionOptions[klass][name]; } else { - return ( - this._paintDeclarations[klass] && - this._paintDeclarations[klass][name] && - this._paintDeclarations[klass][name].value - ); + return this._paintDeclarations[klass] && this._paintDeclarations[klass][name] && this._paintDeclarations[klass][name].value; } }, - - getPaintValue: function(name, globalProperties, featureProperties) { + getPaintValue: function (name, globalProperties, featureProperties) { var specification = this._paintSpecifications[name]; var transition = this._paintTransitions[name]; - if (transition) { return transition.calculate(globalProperties, featureProperties); } else if (specification.type === 'color' && specification.default) { @@ -51586,8 +53387,7 @@ StyleLayer.prototype = util.inherit(Evented, { return specification.default; } }, - - getPaintValueStopZoomLevels: function(name) { + getPaintValueStopZoomLevels: function (name) { var transition = this._paintTransitions[name]; if (transition) { return transition.declaration.stopZoomLevels; @@ -51595,58 +53395,60 @@ StyleLayer.prototype = util.inherit(Evented, { return []; } }, - - getPaintInterpolationT: function(name, zoom) { + getPaintInterpolationT: function (name, zoom) { var transition = this._paintTransitions[name]; return transition.declaration.calculateInterpolationT({ zoom: zoom }); }, - - isPaintValueFeatureConstant: function(name) { + isPaintValueFeatureConstant: function (name) { var transition = this._paintTransitions[name]; - if (transition) { return transition.declaration.isFeatureConstant; } else { return true; } }, - - isPaintValueZoomConstant: function(name) { + isLayoutValueFeatureConstant: function (name) { + var declaration = this._layoutDeclarations[name]; + if (declaration) { + return declaration.isFeatureConstant; + } else { + return true; + } + }, + isPaintValueZoomConstant: function (name) { var transition = this._paintTransitions[name]; - if (transition) { return transition.declaration.isZoomConstant; } else { return true; } }, - - - isHidden: function(zoom) { - if (this.minzoom && zoom < this.minzoom) return true; - if (this.maxzoom && zoom >= this.maxzoom) return true; - if (this.layout['visibility'] === 'none') return true; - if (this.paint[this.type + '-opacity'] === 0) return true; + isHidden: function (zoom) { + if (this.minzoom && zoom < this.minzoom) + return true; + if (this.maxzoom && zoom >= this.maxzoom) + return true; + if (this.layout['visibility'] === 'none') + return true; + if (this.paint[this.type + '-opacity'] === 0) + return true; return false; }, - - updatePaintTransitions: function(classes, options, globalOptions, animationLoop) { + updatePaintTransitions: function (classes, options, globalOptions, animationLoop) { var declarations = util.extend({}, this._paintDeclarations['']); for (var i = 0; i < classes.length; i++) { util.extend(declarations, this._paintDeclarations[classes[i]]); } - var name; - for (name in declarations) { // apply new declarations + for (name in declarations) { this._applyPaintDeclaration(name, declarations[name], options, globalOptions, animationLoop); } for (name in this._paintTransitions) { - if (!(name in declarations)) // apply removed declarations + if (!(name in declarations)) this._applyPaintDeclaration(name, null, options, globalOptions, animationLoop); } }, - - updatePaintTransition: function(name, classes, options, globalOptions, animationLoop) { + updatePaintTransition: function (name, classes, options, globalOptions, animationLoop) { var declaration = this._paintDeclarations[''][name]; for (var i = 0; i < classes.length; i++) { var classPaintDeclarations = this._paintDeclarations[classes[i]]; @@ -51656,18 +53458,21 @@ StyleLayer.prototype = util.inherit(Evented, { } this._applyPaintDeclaration(name, declaration, options, globalOptions, animationLoop); }, - - // update all zoom-dependent layout/paint values - recalculate: function(zoom, zoomHistory) { + recalculate: function (zoom, zoomHistory) { for (var paintName in this._paintTransitions) { - this.paint[paintName] = this.getPaintValue(paintName, {zoom: zoom, zoomHistory: zoomHistory}); + this.paint[paintName] = this.getPaintValue(paintName, { + zoom: zoom, + zoomHistory: zoomHistory + }); } for (var layoutName in this._layoutFunctions) { - this.layout[layoutName] = this.getLayoutValue(layoutName, {zoom: zoom, zoomHistory: zoomHistory}); + this.layout[layoutName] = this.getLayoutValue(layoutName, { + zoom: zoom, + zoomHistory: zoomHistory + }); } }, - - serialize: function(options) { + serialize: function (options) { var output = { 'id': this.id, 'ref': this.ref, @@ -51675,13 +53480,11 @@ StyleLayer.prototype = util.inherit(Evented, { 'minzoom': this.minzoom, 'maxzoom': this.maxzoom }; - for (var klass in this._paintDeclarations) { var key = klass === '' ? 'paint' : 'paint.' + klass; output[key] = util.mapObject(this._paintDeclarations[klass], getDeclarationValue); } - - if (!this.ref || (options && options.includeRefProperties)) { + if (!this.ref || options && options.includeRefProperties) { util.extend(output, { 'type': this.type, 'source': this.source, @@ -51690,31 +53493,23 @@ StyleLayer.prototype = util.inherit(Evented, { 'layout': util.mapObject(this._layoutDeclarations, getDeclarationValue) }); } - - return util.filterObject(output, function(value, key) { + return util.filterObject(output, function (value, key) { return value !== undefined && !(key === 'layout' && !Object.keys(value).length); }); }, - - // set paint transition based on a given paint declaration _applyPaintDeclaration: function (name, declaration, options, globalOptions, animationLoop) { var oldTransition = options.transition ? this._paintTransitions[name] : undefined; - + var spec = this._paintSpecifications[name]; if (declaration === null || declaration === undefined) { - var spec = this._paintSpecifications[name]; declaration = new StyleDeclaration(spec, spec.default); } - - if (oldTransition && oldTransition.declaration.json === declaration.json) return; - + if (oldTransition && oldTransition.declaration.json === declaration.json) + return; var transitionOptions = util.extend({ duration: 300, delay: 0 }, globalOptions, this.getPaintProperty(name + TRANSITION_SUFFIX)); - - var newTransition = this._paintTransitions[name] = - new StyleTransition(declaration, oldTransition, transitionOptions); - + var newTransition = this._paintTransitions[name] = new StyleTransition(spec, declaration, oldTransition, transitionOptions); if (!newTransition.instant()) { newTransition.loopID = animationLoop.set(newTransition.endTime - Date.now()); } @@ -51722,11 +53517,8 @@ StyleLayer.prototype = util.inherit(Evented, { animationLoop.cancel(oldTransition.loopID); } }, - - // update layout value if it's constant, or mark it as zoom-dependent - _updateLayoutValue: function(name) { + _updateLayoutValue: function (name) { var declaration = this._layoutDeclarations[name]; - if (declaration && declaration.isFunction) { this._layoutFunctions[name] = true; } else { @@ -51734,244 +53526,206 @@ StyleLayer.prototype = util.inherit(Evented, { this.layout[name] = this.getLayoutValue(name); } }, - - _handleErrors: function(validate, key, name, value) { + _handleErrors: function (validate, key, name, value) { return validateStyle.emitErrors(this, validate.call(validateStyle, { key: key, layerType: this.type, objectKey: name, value: value, styleSpec: styleSpec, - // Workaround for https://github.com/mapbox/mapbox-gl-js/issues/2407 - style: {glyphs: true, sprite: true} + style: { + glyphs: true, + sprite: true + } })); } }); - function getDeclarationValue(declaration) { return declaration.value; } - -},{"../util/evented":341,"../util/util":349,"./parse_color":289,"./style_declaration":291,"./style_layer/background_style_layer":294,"./style_layer/circle_style_layer":295,"./style_layer/fill_style_layer":296,"./style_layer/line_style_layer":297,"./style_layer/raster_style_layer":298,"./style_layer/symbol_style_layer":299,"./style_spec":300,"./style_transition":301,"./validate_style":302}],294:[function(require,module,exports){ +},{"../util/evented":358,"../util/util":366,"./parse_color":301,"./style_declaration":303,"./style_layer/background_style_layer":306,"./style_layer/circle_style_layer":307,"./style_layer/fill_style_layer":308,"./style_layer/line_style_layer":309,"./style_layer/raster_style_layer":310,"./style_layer/symbol_style_layer":311,"./style_spec":312,"./style_transition":313,"./validate_style":314}],306:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function BackgroundStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = BackgroundStyleLayer; - BackgroundStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":349,"../style_layer":293}],295:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],307:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function CircleStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = CircleStyleLayer; - CircleStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":349,"../style_layer":293}],296:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],308:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function FillStyleLayer() { StyleLayer.apply(this, arguments); } - +FillStyleLayer.prototype = util.inherit(StyleLayer, { + getPaintValue: function (name, globalProperties, featureProperties) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.getPaintValue.call(this, 'fill-color', globalProperties, featureProperties); + } else { + return StyleLayer.prototype.getPaintValue.call(this, name, globalProperties, featureProperties); + } + }, + getPaintValueStopZoomLevels: function (name) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.getPaintValueStopZoomLevels.call(this, 'fill-color'); + } else { + return StyleLayer.prototype.getPaintValueStopZoomLevels.call(this, arguments); + } + }, + getPaintInterpolationT: function (name, zoom) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.getPaintInterpolationT.call(this, 'fill-color', zoom); + } else { + return StyleLayer.prototype.getPaintInterpolationT.call(this, name, zoom); + } + }, + isPaintValueFeatureConstant: function (name) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.isPaintValueFeatureConstant.call(this, 'fill-color'); + } else { + return StyleLayer.prototype.isPaintValueFeatureConstant.call(this, name); + } + }, + isPaintValueZoomConstant: function (name) { + if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) { + return StyleLayer.prototype.isPaintValueZoomConstant.call(this, 'fill-color'); + } else { + return StyleLayer.prototype.isPaintValueZoomConstant.call(this, name); + } + } +}); module.exports = FillStyleLayer; - -FillStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":349,"../style_layer":293}],297:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],309:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function LineStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = LineStyleLayer; - LineStyleLayer.prototype = util.inherit(StyleLayer, { - - getPaintValue: function(name, globalProperties, featureProperties) { + getPaintValue: function (name, globalProperties, featureProperties) { var value = StyleLayer.prototype.getPaintValue.apply(this, arguments); - - // If the line is dashed, scale the dash lengths by the line - // width at the previous round zoom level. if (value && name === 'line-dasharray') { var flooredZoom = Math.floor(globalProperties.zoom); if (this._flooredZoom !== flooredZoom) { this._flooredZoom = flooredZoom; this._flooredLineWidth = this.getPaintValue('line-width', globalProperties, featureProperties); } - value.fromScale *= this._flooredLineWidth; value.toScale *= this._flooredLineWidth; } - return value; } }); - -},{"../../util/util":349,"../style_layer":293}],298:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],310:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function RasterStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = RasterStyleLayer; - RasterStyleLayer.prototype = util.inherit(StyleLayer, {}); - -},{"../../util/util":349,"../style_layer":293}],299:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],311:[function(require,module,exports){ 'use strict'; - var util = require('../../util/util'); var StyleLayer = require('../style_layer'); - function SymbolStyleLayer() { StyleLayer.apply(this, arguments); } - module.exports = SymbolStyleLayer; - SymbolStyleLayer.prototype = util.inherit(StyleLayer, { - - isHidden: function() { - if (StyleLayer.prototype.isHidden.apply(this, arguments)) return true; - + isHidden: function () { + if (StyleLayer.prototype.isHidden.apply(this, arguments)) + return true; var isTextHidden = this.paint['text-opacity'] === 0 || !this.layout['text-field']; var isIconHidden = this.paint['icon-opacity'] === 0 || !this.layout['icon-image']; - if (isTextHidden && isIconHidden) return true; - + if (isTextHidden && isIconHidden) + return true; return false; }, - - getLayoutValue: function(name, globalProperties, featureProperties) { - if (name === 'text-rotation-alignment' && - this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && - !this.getLayoutProperty('text-rotation-alignment')) { + getLayoutValue: function (name, globalProperties, featureProperties) { + if (name === 'text-rotation-alignment' && this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && !this.getLayoutProperty('text-rotation-alignment')) { return 'map'; - } else if (name === 'icon-rotation-alignment' && - this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && - !this.getLayoutProperty('icon-rotation-alignment')) { + } else if (name === 'icon-rotation-alignment' && this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' && !this.getLayoutProperty('icon-rotation-alignment')) { return 'map'; + } else if (name === 'text-pitch-alignment' && !this.getLayoutProperty('text-pitch-alignment')) { + return this.getLayoutValue('text-rotation-alignment'); } else { return StyleLayer.prototype.getLayoutValue.apply(this, arguments); } } - }); - -},{"../../util/util":349,"../style_layer":293}],300:[function(require,module,exports){ +},{"../../util/util":366,"../style_layer":305}],312:[function(require,module,exports){ 'use strict'; - module.exports = require('mapbox-gl-style-spec/reference/latest'); - -},{"mapbox-gl-style-spec/reference/latest":397}],301:[function(require,module,exports){ +},{"mapbox-gl-style-spec/reference/latest":416}],313:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var interpolate = require('../util/interpolate'); - module.exports = StyleTransition; - -/* - * Represents a transition between two declarations - */ -function StyleTransition(declaration, oldTransition, value) { - +function StyleTransition(reference, declaration, oldTransition, value) { this.declaration = declaration; - this.startTime = this.endTime = (new Date()).getTime(); - - var type = declaration.type; - if ((type === 'string' || type === 'array') && declaration.transitionable) { + this.startTime = this.endTime = new Date().getTime(); + if (reference.function === 'piecewise-constant' && reference.transition) { this.interp = interpZoomTransitioned; } else { - this.interp = interpolate[type]; + this.interp = interpolate[reference.type]; } - this.oldTransition = oldTransition; this.duration = value.duration || 0; this.delay = value.delay || 0; - if (!this.instant()) { this.endTime = this.startTime + this.duration + this.delay; this.ease = util.easeCubicInOut; } - if (oldTransition && oldTransition.endTime <= this.startTime) { - // Old transition is done running, so we can - // delete its reference to its old transition. - delete oldTransition.oldTransition; } } - -StyleTransition.prototype.instant = function() { - return !this.oldTransition || !this.interp || (this.duration === 0 && this.delay === 0); +StyleTransition.prototype.instant = function () { + return !this.oldTransition || !this.interp || this.duration === 0 && this.delay === 0; }; - -/* - * Return the value of the transitioning property at zoom level `z` and optional time `t` - */ -StyleTransition.prototype.calculate = function(globalProperties, featureProperties) { - var value = this.declaration.calculate( - util.extend({}, globalProperties, {duration: this.duration}), - featureProperties - ); - - if (this.instant()) return value; - +StyleTransition.prototype.calculate = function (globalProperties, featureProperties) { + var value = this.declaration.calculate(util.extend({}, globalProperties, { duration: this.duration }), featureProperties); + if (this.instant()) + return value; var t = globalProperties.time || Date.now(); - if (t < this.endTime) { - var oldValue = this.oldTransition.calculate( - util.extend({}, globalProperties, {time: this.startTime}), - featureProperties - ); + var oldValue = this.oldTransition.calculate(util.extend({}, globalProperties, { time: this.startTime }), featureProperties); var eased = this.ease((t - this.startTime - this.delay) / this.duration); value = this.interp(oldValue, value, eased); } - return value; - }; - function interpZoomTransitioned(from, to, t) { - return { - from: from.to, - fromScale: from.toScale, - to: to.to, - toScale: to.toScale, - t: t - }; + if ((from && from.to) === undefined || (to && to.to) === undefined) { + return undefined; + } else { + return { + from: from.to, + fromScale: from.toScale, + to: to.to, + toScale: to.toScale, + t: t + }; + } } - -},{"../util/interpolate":343,"../util/util":349}],302:[function(require,module,exports){ +},{"../util/interpolate":360,"../util/util":366}],314:[function(require,module,exports){ 'use strict'; - module.exports = require('mapbox-gl-style-spec/lib/validate_style.min'); - module.exports.emitErrors = function throwErrors(emitter, errors) { if (errors && errors.length) { for (var i = 0; i < errors.length; i++) { @@ -51982,7 +53736,6 @@ module.exports.emitErrors = function throwErrors(emitter, errors) { return false; } }; - module.exports.throwErrors = function throwErrors(emitter, errors) { if (errors) { for (var i = 0; i < errors.length; i++) { @@ -51990,140 +53743,77 @@ module.exports.throwErrors = function throwErrors(emitter, errors) { } } }; - -},{"mapbox-gl-style-spec/lib/validate_style.min":396}],303:[function(require,module,exports){ +},{"mapbox-gl-style-spec/lib/validate_style.min":415}],315:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - module.exports = Anchor; - function Anchor(x, y, angle, segment) { this.x = x; this.y = y; this.angle = angle; - if (segment !== undefined) { this.segment = segment; } } - Anchor.prototype = Object.create(Point.prototype); - -Anchor.prototype.clone = function() { +Anchor.prototype.clone = function () { return new Anchor(this.x, this.y, this.angle, this.segment); }; - -},{"point-geometry":404}],304:[function(require,module,exports){ +},{"point-geometry":424}],316:[function(require,module,exports){ 'use strict'; - module.exports = checkMaxAngle; - -/** - * Labels placed around really sharp angles aren't readable. Check if any - * part of the potential label has a combined angle that is too big. - * - * @param {Array} line - * @param {Anchor} anchor The point on the line around which the label is anchored. - * @param {number} labelLength The length of the label in geometry units. - * @param {number} windowSize The check fails if the combined angles within a part of the line that is `windowSize` long is too big. - * @param {number} maxAngle The maximum combined angle that any window along the label is allowed to have. - * - * @returns {boolean} whether the label should be placed - * @private - */ function checkMaxAngle(line, anchor, labelLength, windowSize, maxAngle) { - - // horizontal labels always pass - if (anchor.segment === undefined) return true; - + if (anchor.segment === undefined) + return true; var p = anchor; var index = anchor.segment + 1; var anchorDistance = 0; - - // move backwards along the line to the first segment the label appears on while (anchorDistance > -labelLength / 2) { index--; - - // there isn't enough room for the label after the beginning of the line - if (index < 0) return false; - + if (index < 0) + return false; anchorDistance -= line[index].dist(p); p = line[index]; } - anchorDistance += line[index].dist(line[index + 1]); index++; - - // store recent corners and their total angle difference var recentCorners = []; var recentAngleDelta = 0; - - // move forwards by the length of the label and check angles along the way while (anchorDistance < labelLength / 2) { var prev = line[index - 1]; var current = line[index]; var next = line[index + 1]; - - // there isn't enough room for the label before the end of the line - if (!next) return false; - + if (!next) + return false; var angleDelta = prev.angleTo(current) - current.angleTo(next); - // restrict angle to -pi..pi range - angleDelta = Math.abs(((angleDelta + 3 * Math.PI) % (Math.PI * 2)) - Math.PI); - + angleDelta = Math.abs((angleDelta + 3 * Math.PI) % (Math.PI * 2) - Math.PI); recentCorners.push({ distance: anchorDistance, angleDelta: angleDelta }); recentAngleDelta += angleDelta; - - // remove corners that are far enough away from the list of recent anchors while (anchorDistance - recentCorners[0].distance > windowSize) { recentAngleDelta -= recentCorners.shift().angleDelta; } - - // the sum of angles within the window area exceeds the maximum allowed value. check fails. - if (recentAngleDelta > maxAngle) return false; - + if (recentAngleDelta > maxAngle) + return false; index++; anchorDistance += current.dist(next); } - - // no part of the line had an angle greater than the maximum allowed. check passes. return true; } - -},{}],305:[function(require,module,exports){ +},{}],317:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - module.exports = clipLine; - -/** - * Returns the part of a multiline that intersects with the provided rectangular box. - * - * @param {Array>} lines - * @param {number} x1 the left edge of the box - * @param {number} y1 the top edge of the box - * @param {number} x2 the right edge of the box - * @param {number} y2 the bottom edge of the box - * @returns {Array>} lines - * @private - */ function clipLine(lines, x1, y1, x2, y2) { var clippedLines = []; - for (var l = 0; l < lines.length; l++) { var line = lines[l]; var clippedLine; - for (var i = 0; i < line.length - 1; i++) { var p0 = line[i]; var p1 = line[i + 1]; - - if (p0.x < x1 && p1.x < x1) { continue; } else if (p0.x < x1) { @@ -52131,7 +53821,6 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.x < x1) { p1 = new Point(x1, p0.y + (p1.y - p0.y) * ((x1 - p0.x) / (p1.x - p0.x)))._round(); } - if (p0.y < y1 && p1.y < y1) { continue; } else if (p0.y < y1) { @@ -52139,7 +53828,6 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.y < y1) { p1 = new Point(p0.x + (p1.x - p0.x) * ((y1 - p0.y) / (p1.y - p0.y)), y1)._round(); } - if (p0.x >= x2 && p1.x >= x2) { continue; } else if (p0.x >= x2) { @@ -52147,7 +53835,6 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.x >= x2) { p1 = new Point(x2, p0.y + (p1.y - p0.y) * ((x2 - p0.x) / (p1.x - p0.x)))._round(); } - if (p0.y >= y2 && p1.y >= y2) { continue; } else if (p0.y >= y2) { @@ -52155,253 +53842,160 @@ function clipLine(lines, x1, y1, x2, y2) { } else if (p1.y >= y2) { p1 = new Point(p0.x + (p1.x - p0.x) * ((y2 - p0.y) / (p1.y - p0.y)), y2)._round(); } - if (!clippedLine || !p0.equals(clippedLine[clippedLine.length - 1])) { clippedLine = [p0]; clippedLines.push(clippedLine); } - clippedLine.push(p1); } } - return clippedLines; } - -},{"point-geometry":404}],306:[function(require,module,exports){ +},{"point-geometry":424}],318:[function(require,module,exports){ 'use strict'; - var StructArrayType = require('../util/struct_array'); var util = require('../util/util'); var Point = require('point-geometry'); - -/** - * A collision box represents an area of the map that that is covered by a - * label. CollisionFeature uses one or more of these collision boxes to - * represent all the area covered by a single label. They are used to - * prevent collisions between labels. - * - * A collision box actually represents a 3d volume. The first two dimensions, - * x and y, are specified with `anchor` along with `x1`, `y1`, `x2`, `y2`. - * The third dimension, zoom, is limited by `maxScale` which determines - * how far in the z dimensions the box extends. - * - * As you zoom in on a map, all points on the map get further and further apart - * but labels stay roughly the same size. Labels cover less real world area on - * the map at higher zoom levels than they do at lower zoom levels. This is why - * areas are are represented with an anchor point and offsets from that point - * instead of just using four absolute points. - * - * Line labels are represented by a set of these boxes spaced out along a line. - * When you zoom in, line labels cover less real world distance along the line - * than they used to. Collision boxes near the edges that used to cover label - * no longer do. If a box doesn't cover the label anymore it should be ignored - * when doing collision checks. `maxScale` is how much you can scale the map - * before the label isn't within the box anymore. - * For example - * lower zoom: - * https://cloud.githubusercontent.com/assets/1421652/8060094/4d975f76-0e91-11e5-84b1-4edeb30a5875.png - * slightly higher zoom: - * https://cloud.githubusercontent.com/assets/1421652/8060061/26ae1c38-0e91-11e5-8c5a-9f380bf29f0a.png - * In the zoomed in image the two grey boxes on either side don't cover the - * label anymore. Their maxScale is smaller than the current scale. - * - * - * @class CollisionBoxArray - * @private - */ - var CollisionBoxArray = module.exports = new StructArrayType({ members: [ - // the box is centered around the anchor point - { type: 'Int16', name: 'anchorPointX' }, - { type: 'Int16', name: 'anchorPointY' }, - - // distances to the edges from the anchor - { type: 'Int16', name: 'x1' }, - { type: 'Int16', name: 'y1' }, - { type: 'Int16', name: 'x2' }, - { type: 'Int16', name: 'y2' }, - - // the box is only valid for scales < maxScale. - // The box does not block other boxes at scales >= maxScale; - { type: 'Float32', name: 'maxScale' }, - - // the index of the feature in the original vectortile - { type: 'Uint32', name: 'featureIndex' }, - // the source layer the feature appears in - { type: 'Uint16', name: 'sourceLayerIndex' }, - // the bucket the feature appears in - { type: 'Uint16', name: 'bucketIndex' }, - - // rotated and scaled bbox used for indexing - { type: 'Int16', name: 'bbox0' }, - { type: 'Int16', name: 'bbox1' }, - { type: 'Int16', name: 'bbox2' }, - { type: 'Int16', name: 'bbox3' }, - - { type: 'Float32', name: 'placementScale' } - ]}); - + { + type: 'Int16', + name: 'anchorPointX' + }, + { + type: 'Int16', + name: 'anchorPointY' + }, + { + type: 'Int16', + name: 'x1' + }, + { + type: 'Int16', + name: 'y1' + }, + { + type: 'Int16', + name: 'x2' + }, + { + type: 'Int16', + name: 'y2' + }, + { + type: 'Float32', + name: 'maxScale' + }, + { + type: 'Uint32', + name: 'featureIndex' + }, + { + type: 'Uint16', + name: 'sourceLayerIndex' + }, + { + type: 'Uint16', + name: 'bucketIndex' + }, + { + type: 'Int16', + name: 'bbox0' + }, + { + type: 'Int16', + name: 'bbox1' + }, + { + type: 'Int16', + name: 'bbox2' + }, + { + type: 'Int16', + name: 'bbox3' + }, + { + type: 'Float32', + name: 'placementScale' + } + ] +}); util.extendAll(CollisionBoxArray.prototype.StructType.prototype, { get anchorPoint() { return new Point(this.anchorPointX, this.anchorPointY); } }); - -},{"../util/struct_array":347,"../util/util":349,"point-geometry":404}],307:[function(require,module,exports){ -'use strict'; - -module.exports = CollisionFeature; - -/** - * A CollisionFeature represents the area of the tile covered by a single label. - * It is used with CollisionTile to check if the label overlaps with any - * previous labels. A CollisionFeature is mostly just a set of CollisionBox - * objects. - * - * @class CollisionFeature - * @param {Array} line The geometry the label is placed on. - * @param {Anchor} anchor The point along the line around which the label is anchored. - * @param {VectorTileFeature} feature The VectorTileFeature that this CollisionFeature was created for. - * @param {Array} layerIDs The IDs of the layers that this CollisionFeature is a part of. - * @param {Object} shaped The text or icon shaping results. - * @param {number} boxScale A magic number used to convert from glyph metrics units to geometry units. - * @param {number} padding The amount of padding to add around the label edges. - * @param {boolean} alignLine Whether the label is aligned with the line or the viewport. - * - * @private - */ +},{"../util/struct_array":364,"../util/util":366,"point-geometry":424}],319:[function(require,module,exports){ +'use strict'; +module.exports = CollisionFeature; function CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shaped, boxScale, padding, alignLine, straight) { - var y1 = shaped.top * boxScale - padding; var y2 = shaped.bottom * boxScale + padding; var x1 = shaped.left * boxScale - padding; var x2 = shaped.right * boxScale + padding; - this.boxStartIndex = collisionBoxArray.length; - if (alignLine) { - var height = y2 - y1; var length = x2 - x1; - if (height > 0) { - // set minimum box height to avoid very many small labels height = Math.max(10 * boxScale, height); - if (straight) { - // used for icon labels that are aligned with the line, but don't curve along it var vector = line[anchor.segment + 1].sub(line[anchor.segment])._unit()._mult(length); - var straightLine = [anchor.sub(vector), anchor.add(vector)]; + var straightLine = [ + anchor.sub(vector), + anchor.add(vector) + ]; this._addLineCollisionBoxes(collisionBoxArray, straightLine, anchor, 0, length, height, featureIndex, sourceLayerIndex, bucketIndex); } else { - // used for text labels that curve along a line this._addLineCollisionBoxes(collisionBoxArray, line, anchor, anchor.segment, length, height, featureIndex, sourceLayerIndex, bucketIndex); } } - } else { - collisionBoxArray.emplaceBack(anchor.x, anchor.y, x1, y1, x2, y2, Infinity, featureIndex, sourceLayerIndex, bucketIndex, - 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(anchor.x, anchor.y, x1, y1, x2, y2, Infinity, featureIndex, sourceLayerIndex, bucketIndex, 0, 0, 0, 0, 0); } - this.boxEndIndex = collisionBoxArray.length; } - -/** - * Create a set of CollisionBox objects for a line. - * - * @param {Array} line - * @param {Anchor} anchor - * @param {number} labelLength The length of the label in geometry units. - * @param {Anchor} anchor The point along the line around which the label is anchored. - * @param {VectorTileFeature} feature The VectorTileFeature that this CollisionFeature was created for. - * @param {number} boxSize The size of the collision boxes that will be created. - * - * @private - */ -CollisionFeature.prototype._addLineCollisionBoxes = function(collisionBoxArray, line, anchor, segment, labelLength, boxSize, featureIndex, sourceLayerIndex, bucketIndex) { +CollisionFeature.prototype._addLineCollisionBoxes = function (collisionBoxArray, line, anchor, segment, labelLength, boxSize, featureIndex, sourceLayerIndex, bucketIndex) { var step = boxSize / 2; var nBoxes = Math.floor(labelLength / step); - - // offset the center of the first box by half a box so that the edge of the - // box is at the edge of the label. var firstBoxOffset = -boxSize / 2; - var bboxes = this.boxes; - var p = anchor; var index = segment + 1; var anchorDistance = firstBoxOffset; - - // move backwards along the line to the first segment the label appears on do { index--; - - // there isn't enough room for the label after the beginning of the line - // checkMaxAngle should have already caught this - if (index < 0) return bboxes; - + if (index < 0) + return bboxes; anchorDistance -= line[index].dist(p); p = line[index]; } while (anchorDistance > -labelLength / 2); - var segmentLength = line[index].dist(line[index + 1]); - for (var i = 0; i < nBoxes; i++) { - // the distance the box will be from the anchor var boxDistanceToAnchor = -labelLength / 2 + i * step; - - // the box is not on the current segment. Move to the next segment. while (anchorDistance + segmentLength < boxDistanceToAnchor) { anchorDistance += segmentLength; index++; - - // There isn't enough room before the end of the line. - if (index + 1 >= line.length) return bboxes; - + if (index + 1 >= line.length) + return bboxes; segmentLength = line[index].dist(line[index + 1]); } - - // the distance the box will be from the beginning of the segment var segmentBoxDistance = boxDistanceToAnchor - anchorDistance; - var p0 = line[index]; var p1 = line[index + 1]; var boxAnchorPoint = p1.sub(p0)._unit()._mult(segmentBoxDistance)._add(p0)._round(); - var distanceToInnerEdge = Math.max(Math.abs(boxDistanceToAnchor - firstBoxOffset) - step / 2, 0); var maxScale = labelLength / 2 / distanceToInnerEdge; - - collisionBoxArray.emplaceBack(boxAnchorPoint.x, boxAnchorPoint.y, - -boxSize / 2, -boxSize / 2, boxSize / 2, boxSize / 2, maxScale, - featureIndex, sourceLayerIndex, bucketIndex, - 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(boxAnchorPoint.x, boxAnchorPoint.y, -boxSize / 2, -boxSize / 2, boxSize / 2, boxSize / 2, maxScale, featureIndex, sourceLayerIndex, bucketIndex, 0, 0, 0, 0, 0); } - return bboxes; }; - -},{}],308:[function(require,module,exports){ +},{}],320:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); var EXTENT = require('../data/bucket').EXTENT; var Grid = require('grid-index'); - module.exports = CollisionTile; - -/** - * A collision tile used to prevent symbols from overlapping. It keep tracks of - * where previous symbols have been placed and is used to check if a new - * symbol overlaps with any previously added symbols. - * - * @class CollisionTile - * @param {number} angle - * @param {number} pitch - * @private - */ function CollisionTile(angle, pitch, collisionBoxArray) { if (typeof angle === 'object') { var serialized = angle; @@ -52414,48 +54008,32 @@ function CollisionTile(angle, pitch, collisionBoxArray) { this.grid = new Grid(EXTENT, 12, 6); this.ignoredGrid = new Grid(EXTENT, 12, 0); } - this.angle = angle; this.pitch = pitch; - - var sin = Math.sin(angle), - cos = Math.cos(angle); - this.rotationMatrix = [cos, -sin, sin, cos]; - this.reverseRotationMatrix = [cos, sin, -sin, cos]; - - // Stretch boxes in y direction to account for the map tilt. + var sin = Math.sin(angle), cos = Math.cos(angle); + this.rotationMatrix = [ + cos, + -sin, + sin, + cos + ]; + this.reverseRotationMatrix = [ + cos, + sin, + -sin, + cos + ]; this.yStretch = 1 / Math.cos(pitch / 180 * Math.PI); - - // The amount the map is squished depends on the y position. - // Sort of account for this by making all boxes a bit bigger. this.yStretch = Math.pow(this.yStretch, 1.3); - this.collisionBoxArray = collisionBoxArray; if (collisionBoxArray.length === 0) { - // the first collisionBoxArray is passed to a CollisionTile - - // tempCollisionBox collisionBoxArray.emplaceBack(); - var maxInt16 = 32767; - //left - collisionBoxArray.emplaceBack(0, 0, 0, -maxInt16, 0, maxInt16, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); - // right - collisionBoxArray.emplaceBack(EXTENT, 0, 0, -maxInt16, 0, maxInt16, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); - // top - collisionBoxArray.emplaceBack(0, 0, -maxInt16, 0, maxInt16, 0, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); - // bottom - collisionBoxArray.emplaceBack(0, EXTENT, -maxInt16, 0, maxInt16, 0, maxInt16, - 0, 0, 0, 0, 0, 0, 0, 0, - 0); + collisionBoxArray.emplaceBack(0, 0, 0, -maxInt16, 0, maxInt16, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(EXTENT, 0, 0, -maxInt16, 0, maxInt16, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(0, 0, -maxInt16, 0, maxInt16, 0, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); + collisionBoxArray.emplaceBack(0, EXTENT, -maxInt16, 0, maxInt16, 0, maxInt16, 0, 0, 0, 0, 0, 0, 0, 0, 0); } - this.tempCollisionBox = collisionBoxArray.get(0); this.edges = [ collisionBoxArray.get(1), @@ -52464,8 +54042,7 @@ function CollisionTile(angle, pitch, collisionBoxArray) { collisionBoxArray.get(4) ]; } - -CollisionTile.prototype.serialize = function() { +CollisionTile.prototype.serialize = function () { var data = { angle: this.angle, pitch: this.pitch, @@ -52474,71 +54051,51 @@ CollisionTile.prototype.serialize = function() { }; return { data: data, - transferables: [data.grid, data.ignoredGrid] + transferables: [ + data.grid, + data.ignoredGrid + ] }; }; - CollisionTile.prototype.minScale = 0.25; CollisionTile.prototype.maxScale = 2; - - -/** - * Find the scale at which the collisionFeature can be shown without - * overlapping with other features. - * - * @param {CollisionFeature} collisionFeature - * @returns {number} placementScale - * @private - */ -CollisionTile.prototype.placeCollisionFeature = function(collisionFeature, allowOverlap, avoidEdges) { - +CollisionTile.prototype.placeCollisionFeature = function (collisionFeature, allowOverlap, avoidEdges) { var collisionBoxArray = this.collisionBoxArray; var minPlacementScale = this.minScale; var rotationMatrix = this.rotationMatrix; var yStretch = this.yStretch; - for (var b = collisionFeature.boxStartIndex; b < collisionFeature.boxEndIndex; b++) { - var box = collisionBoxArray.get(b); - var anchorPoint = box.anchorPoint._matMult(rotationMatrix); var x = anchorPoint.x; var y = anchorPoint.y; - var x1 = x + box.x1; var y1 = y + box.y1 * yStretch; var x2 = x + box.x2; var y2 = y + box.y2 * yStretch; - box.bbox0 = x1; box.bbox1 = y1; box.bbox2 = x2; box.bbox3 = y2; - if (!allowOverlap) { var blockingBoxes = this.grid.query(x1, y1, x2, y2); - for (var i = 0; i < blockingBoxes.length; i++) { var blocking = collisionBoxArray.get(blockingBoxes[i]); var blockingAnchorPoint = blocking.anchorPoint._matMult(rotationMatrix); - minPlacementScale = this.getPlacementScale(minPlacementScale, anchorPoint, box, blockingAnchorPoint, blocking); if (minPlacementScale >= this.maxScale) { return minPlacementScale; } } } - if (avoidEdges) { var rotatedCollisionBox; - if (this.angle) { var reverseRotationMatrix = this.reverseRotationMatrix; var tl = new Point(box.x1, box.y1).matMult(reverseRotationMatrix); var tr = new Point(box.x2, box.y1).matMult(reverseRotationMatrix); var bl = new Point(box.x1, box.y2).matMult(reverseRotationMatrix); var br = new Point(box.x2, box.y2).matMult(reverseRotationMatrix); - rotatedCollisionBox = this.tempCollisionBox; rotatedCollisionBox.anchorPointX = box.anchorPoint.x; rotatedCollisionBox.anchorPointY = box.anchorPoint.y; @@ -52550,7 +54107,6 @@ CollisionTile.prototype.placeCollisionFeature = function(collisionFeature, allow } else { rotatedCollisionBox = box; } - for (var k = 0; k < this.edges.length; k++) { var edgeBox = this.edges[k]; minPlacementScale = this.getPlacementScale(minPlacementScale, box.anchorPoint, rotatedCollisionBox, edgeBox.anchorPoint, edgeBox); @@ -52560,18 +54116,14 @@ CollisionTile.prototype.placeCollisionFeature = function(collisionFeature, allow } } } - return minPlacementScale; }; - -CollisionTile.prototype.queryRenderedSymbols = function(minX, minY, maxX, maxY, scale) { +CollisionTile.prototype.queryRenderedSymbols = function (minX, minY, maxX, maxY, scale) { var sourceLayerFeatures = {}; var result = []; - var collisionBoxArray = this.collisionBoxArray; var rotationMatrix = this.rotationMatrix; var anchorPoint = new Point(minX, minY)._matMult(rotationMatrix); - var queryBox = this.tempCollisionBox; queryBox.anchorX = anchorPoint.x; queryBox.anchorY = anchorPoint.y; @@ -52580,32 +54132,25 @@ CollisionTile.prototype.queryRenderedSymbols = function(minX, minY, maxX, maxY, queryBox.x2 = maxX - minX; queryBox.y2 = maxY - minY; queryBox.maxScale = scale; - - // maxScale is stored using a Float32. Convert `scale` to the stored Float32 value. scale = queryBox.maxScale; - var searchBox = [ anchorPoint.x + queryBox.x1 / scale, anchorPoint.y + queryBox.y1 / scale * this.yStretch, anchorPoint.x + queryBox.x2 / scale, anchorPoint.y + queryBox.y2 / scale * this.yStretch ]; - var blockingBoxKeys = this.grid.query(searchBox[0], searchBox[1], searchBox[2], searchBox[3]); var blockingBoxKeys2 = this.ignoredGrid.query(searchBox[0], searchBox[1], searchBox[2], searchBox[3]); for (var k = 0; k < blockingBoxKeys2.length; k++) { blockingBoxKeys.push(blockingBoxKeys2[k]); } - for (var i = 0; i < blockingBoxKeys.length; i++) { var blocking = collisionBoxArray.get(blockingBoxKeys[i]); - var sourceLayer = blocking.sourceLayerIndex; var featureIndex = blocking.featureIndex; if (sourceLayerFeatures[sourceLayer] === undefined) { sourceLayerFeatures[sourceLayer] = {}; } - if (!sourceLayerFeatures[sourceLayer][featureIndex]) { var blockingAnchorPoint = blocking.anchorPoint.matMult(rotationMatrix); var minPlacementScale = this.getPlacementScale(this.minScale, anchorPoint, queryBox, blockingAnchorPoint, blocking); @@ -52615,66 +54160,36 @@ CollisionTile.prototype.queryRenderedSymbols = function(minX, minY, maxX, maxY, } } } - return result; }; - -CollisionTile.prototype.getPlacementScale = function(minPlacementScale, anchorPoint, box, blockingAnchorPoint, blocking) { - - // Find the lowest scale at which the two boxes can fit side by side without overlapping. - // Original algorithm: +CollisionTile.prototype.getPlacementScale = function (minPlacementScale, anchorPoint, box, blockingAnchorPoint, blocking) { var anchorDiffX = anchorPoint.x - blockingAnchorPoint.x; var anchorDiffY = anchorPoint.y - blockingAnchorPoint.y; - var s1 = (blocking.x1 - box.x2) / anchorDiffX; // scale at which new box is to the left of old box - var s2 = (blocking.x2 - box.x1) / anchorDiffX; // scale at which new box is to the right of old box - var s3 = (blocking.y1 - box.y2) * this.yStretch / anchorDiffY; // scale at which new box is to the top of old box - var s4 = (blocking.y2 - box.y1) * this.yStretch / anchorDiffY; // scale at which new box is to the bottom of old box - - if (isNaN(s1) || isNaN(s2)) s1 = s2 = 1; - if (isNaN(s3) || isNaN(s4)) s3 = s4 = 1; - + var s1 = (blocking.x1 - box.x2) / anchorDiffX; + var s2 = (blocking.x2 - box.x1) / anchorDiffX; + var s3 = (blocking.y1 - box.y2) * this.yStretch / anchorDiffY; + var s4 = (blocking.y2 - box.y1) * this.yStretch / anchorDiffY; + if (isNaN(s1) || isNaN(s2)) + s1 = s2 = 1; + if (isNaN(s3) || isNaN(s4)) + s3 = s4 = 1; var collisionFreeScale = Math.min(Math.max(s1, s2), Math.max(s3, s4)); var blockingMaxScale = blocking.maxScale; var boxMaxScale = box.maxScale; - if (collisionFreeScale > blockingMaxScale) { - // After a box's maxScale the label has shrunk enough that the box is no longer needed to cover it, - // so unblock the new box at the scale that the old box disappears. collisionFreeScale = blockingMaxScale; } - if (collisionFreeScale > boxMaxScale) { - // If the box can only be shown after it is visible, then the box can never be shown. - // But the label can be shown after this box is not visible. collisionFreeScale = boxMaxScale; } - - if (collisionFreeScale > minPlacementScale && - collisionFreeScale >= blocking.placementScale) { - // If this collision occurs at a lower scale than previously found collisions - // and the collision occurs while the other label is visible - - // this this is the lowest scale at which the label won't collide with anything + if (collisionFreeScale > minPlacementScale && collisionFreeScale >= blocking.placementScale) { minPlacementScale = collisionFreeScale; } - return minPlacementScale; }; - - -/** - * Remember this collisionFeature and what scale it was placed at to block - * later features from overlapping with it. - * - * @param {CollisionFeature} collisionFeature - * @param {number} minPlacementScale - * @private - */ -CollisionTile.prototype.insertCollisionFeature = function(collisionFeature, minPlacementScale, ignorePlacement) { - +CollisionTile.prototype.insertCollisionFeature = function (collisionFeature, minPlacementScale, ignorePlacement) { var grid = ignorePlacement ? this.ignoredGrid : this.grid; var collisionBoxArray = this.collisionBoxArray; - for (var k = collisionFeature.boxStartIndex; k < collisionFeature.boxEndIndex; k++) { var box = collisionBoxArray.get(k); box.placementScale = minPlacementScale; @@ -52683,211 +54198,122 @@ CollisionTile.prototype.insertCollisionFeature = function(collisionFeature, minP } } }; - -},{"../data/bucket":247,"grid-index":373,"point-geometry":404}],309:[function(require,module,exports){ +},{"../data/bucket":253,"grid-index":392,"point-geometry":424}],321:[function(require,module,exports){ 'use strict'; - var interpolate = require('../util/interpolate'); var Anchor = require('../symbol/anchor'); var checkMaxAngle = require('./check_max_angle'); - module.exports = getAnchors; - function getAnchors(line, spacing, maxAngle, shapedText, shapedIcon, glyphSize, boxScale, overscaling, tileExtent) { - - // Resample a line to get anchor points for labels and check that each - // potential label passes text-max-angle check and has enough froom to fit - // on the line. - - var angleWindowSize = shapedText ? - 3 / 5 * glyphSize * boxScale : - 0; - - var labelLength = Math.max( - shapedText ? shapedText.right - shapedText.left : 0, - shapedIcon ? shapedIcon.right - shapedIcon.left : 0); - - // Is the line continued from outside the tile boundary? + var angleWindowSize = shapedText ? 3 / 5 * glyphSize * boxScale : 0; + var labelLength = Math.max(shapedText ? shapedText.right - shapedText.left : 0, shapedIcon ? shapedIcon.right - shapedIcon.left : 0); var isLineContinued = line[0].x === 0 || line[0].x === tileExtent || line[0].y === 0 || line[0].y === tileExtent; - - // Is the label long, relative to the spacing? - // If so, adjust the spacing so there is always a minimum space of `spacing / 4` between label edges. - if (spacing - labelLength * boxScale < spacing / 4) { + if (spacing - labelLength * boxScale < spacing / 4) { spacing = labelLength * boxScale + spacing / 4; } - - // Offset the first anchor by: - // Either half the label length plus a fixed extra offset if the line is not continued - // Or half the spacing if the line is continued. - - // For non-continued lines, add a bit of fixed extra offset to avoid collisions at T intersections. var fixedExtraOffset = glyphSize * 2; - - var offset = !isLineContinued ? - ((labelLength / 2 + fixedExtraOffset) * boxScale * overscaling) % spacing : - (spacing / 2 * overscaling) % spacing; - + var offset = !isLineContinued ? (labelLength / 2 + fixedExtraOffset) * boxScale * overscaling % spacing : spacing / 2 * overscaling % spacing; return resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength * boxScale, isLineContinued, false, tileExtent); } - - function resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, placeAtMiddle, tileExtent) { - var halfLabelLength = labelLength / 2; var lineLength = 0; for (var k = 0; k < line.length - 1; k++) { lineLength += line[k].dist(line[k + 1]); } - - var distance = 0, - markedDistance = offset - spacing; - + var distance = 0, markedDistance = offset - spacing; var anchors = []; - for (var i = 0; i < line.length - 1; i++) { - - var a = line[i], - b = line[i + 1]; - - var segmentDist = a.dist(b), - angle = b.angleTo(a); - + var a = line[i], b = line[i + 1]; + var segmentDist = a.dist(b), angle = b.angleTo(a); while (markedDistance + spacing < distance + segmentDist) { markedDistance += spacing; - - var t = (markedDistance - distance) / segmentDist, - x = interpolate(a.x, b.x, t), - y = interpolate(a.y, b.y, t); - - // Check that the point is within the tile boundaries and that - // the label would fit before the beginning and end of the line - // if placed at this point. - if (x >= 0 && x < tileExtent && y >= 0 && y < tileExtent && - markedDistance - halfLabelLength >= 0 && - markedDistance + halfLabelLength <= lineLength) { + var t = (markedDistance - distance) / segmentDist, x = interpolate(a.x, b.x, t), y = interpolate(a.y, b.y, t); + if (x >= 0 && x < tileExtent && y >= 0 && y < tileExtent && markedDistance - halfLabelLength >= 0 && markedDistance + halfLabelLength <= lineLength) { var anchor = new Anchor(x, y, angle, i)._round(); - if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) { anchors.push(anchor); } } } - distance += segmentDist; } - if (!placeAtMiddle && !anchors.length && !isLineContinued) { - // The first attempt at finding anchors at which labels can be placed failed. - // Try again, but this time just try placing one anchor at the middle of the line. - // This has the most effect for short lines in overscaled tiles, since the - // initial offset used in overscaled tiles is calculated to align labels with positions in - // parent tiles instead of placing the label as close to the beginning as possible. anchors = resample(line, distance / 2, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, true, tileExtent); } - return anchors; } - -},{"../symbol/anchor":303,"../util/interpolate":343,"./check_max_angle":304}],310:[function(require,module,exports){ +},{"../symbol/anchor":315,"../util/interpolate":360,"./check_max_angle":316}],322:[function(require,module,exports){ 'use strict'; - var ShelfPack = require('shelf-pack'); - +var util = require('../util/util'); +var SIZE_GROWTH_RATE = 4; +var DEFAULT_SIZE = 128; +var MAX_SIZE = 2048; module.exports = GlyphAtlas; -function GlyphAtlas(width, height) { - this.width = width; - this.height = height; - - this.bin = new ShelfPack(width, height); +function GlyphAtlas() { + this.width = DEFAULT_SIZE; + this.height = DEFAULT_SIZE; + this.bin = new ShelfPack(this.width, this.height); this.index = {}; this.ids = {}; - this.data = new Uint8Array(width * height); + this.data = new Uint8Array(this.width * this.height); } - -GlyphAtlas.prototype.getGlyphs = function() { - var glyphs = {}, - split, - name, - id; - +GlyphAtlas.prototype.getGlyphs = function () { + var glyphs = {}, split, name, id; for (var key in this.ids) { split = key.split('#'); name = split[0]; id = split[1]; - - if (!glyphs[name]) glyphs[name] = []; + if (!glyphs[name]) + glyphs[name] = []; glyphs[name].push(id); } - return glyphs; }; - -GlyphAtlas.prototype.getRects = function() { - var rects = {}, - split, - name, - id; - +GlyphAtlas.prototype.getRects = function () { + var rects = {}, split, name, id; for (var key in this.ids) { split = key.split('#'); name = split[0]; id = split[1]; - - if (!rects[name]) rects[name] = {}; + if (!rects[name]) + rects[name] = {}; rects[name][id] = this.index[key]; } - return rects; }; - - -GlyphAtlas.prototype.addGlyph = function(id, name, glyph, buffer) { - if (!glyph) { - // console.warn('missing glyph', code, String.fromCharCode(code)); +GlyphAtlas.prototype.addGlyph = function (id, name, glyph, buffer) { + if (!glyph) return null; - } - var key = name + "#" + glyph.id; - - // The glyph is already in this texture. + var key = name + '#' + glyph.id; if (this.index[key]) { if (this.ids[key].indexOf(id) < 0) { this.ids[key].push(id); } return this.index[key]; } - - // The glyph bitmap has zero width. if (!glyph.bitmap) { return null; } - var bufferedWidth = glyph.width + buffer * 2; var bufferedHeight = glyph.height + buffer * 2; - - // Add a 1px border around every image. var padding = 1; var packWidth = bufferedWidth + 2 * padding; var packHeight = bufferedHeight + 2 * padding; - - // Increase to next number divisible by 4, but at least 1. - // This is so we can scale down the texture coordinates and pack them - // into 2 bytes rather than 4 bytes. - packWidth += (4 - packWidth % 4); - packHeight += (4 - packHeight % 4); - + packWidth += 4 - packWidth % 4; + packHeight += 4 - packHeight % 4; var rect = this.bin.packOne(packWidth, packHeight); if (!rect) { this.resize(); rect = this.bin.packOne(packWidth, packHeight); } if (!rect) { - console.warn('glyph bitmap overflow'); + util.warnOnce('glyph bitmap overflow'); return null; } - this.index[key] = rect; this.ids[key] = [id]; - var target = this.data; var source = glyph.bitmap; for (var y = 0; y < bufferedHeight; y++) { @@ -52897,42 +54323,32 @@ GlyphAtlas.prototype.addGlyph = function(id, name, glyph, buffer) { target[y1 + x] = source[y2 + x]; } } - this.dirty = true; - return rect; }; - -GlyphAtlas.prototype.resize = function() { - var origw = this.width, - origh = this.height; - - // For now, don't grow the atlas beyond 1024x1024 because of how - // texture coords pack into unsigned byte in symbol bucket. - if (origw > 512 || origh > 512) return; - +GlyphAtlas.prototype.resize = function () { + var prevWidth = this.width; + var prevHeight = this.height; + if (prevWidth >= MAX_SIZE || prevHeight >= MAX_SIZE) + return; if (this.texture) { if (this.gl) { this.gl.deleteTexture(this.texture); } this.texture = null; } - - this.width *= 2; - this.height *= 2; + this.width *= SIZE_GROWTH_RATE; + this.height *= SIZE_GROWTH_RATE; this.bin.resize(this.width, this.height); - - var buf = new ArrayBuffer(this.width * this.height), - src, dst; - for (var i = 0; i < origh; i++) { - src = new Uint8Array(this.data.buffer, origh * i, origw); - dst = new Uint8Array(buf, origh * i * 2, origw); + var buf = new ArrayBuffer(this.width * this.height); + for (var i = 0; i < prevHeight; i++) { + var src = new Uint8Array(this.data.buffer, prevHeight * i, prevWidth); + var dst = new Uint8Array(buf, prevHeight * i * SIZE_GROWTH_RATE, prevWidth); dst.set(src); } this.data = new Uint8Array(buf); }; - -GlyphAtlas.prototype.bind = function(gl) { +GlyphAtlas.prototype.bind = function (gl) { this.gl = gl; if (!this.texture) { this.texture = gl.createTexture(); @@ -52942,73 +54358,53 @@ GlyphAtlas.prototype.bind = function(gl) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, this.width, this.height, 0, gl.ALPHA, gl.UNSIGNED_BYTE, null); - } else { gl.bindTexture(gl.TEXTURE_2D, this.texture); } }; - -GlyphAtlas.prototype.updateTexture = function(gl) { +GlyphAtlas.prototype.updateTexture = function (gl) { this.bind(gl); if (this.dirty) { gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, this.height, gl.ALPHA, gl.UNSIGNED_BYTE, this.data); this.dirty = false; } }; - -},{"shelf-pack":406}],311:[function(require,module,exports){ +},{"../util/util":366,"shelf-pack":427}],323:[function(require,module,exports){ 'use strict'; - var normalizeURL = require('../util/mapbox').normalizeGlyphsURL; var getArrayBuffer = require('../util/ajax').getArrayBuffer; var Glyphs = require('../util/glyphs'); var GlyphAtlas = require('../symbol/glyph_atlas'); var Protobuf = require('pbf'); - module.exports = GlyphSource; - -/** - * A glyph source has a URL from which to load new glyphs and manages - * GlyphAtlases in which to store glyphs used by the requested fontstacks - * and ranges. - * - * @param {string} url glyph template url - * @private - */ function GlyphSource(url) { this.url = url && normalizeURL(url); this.atlases = {}; this.stacks = {}; this.loading = {}; } - -GlyphSource.prototype.getSimpleGlyphs = function(fontstack, glyphIDs, uid, callback) { +GlyphSource.prototype.getSimpleGlyphs = function (fontstack, glyphIDs, uid, callback) { if (this.stacks[fontstack] === undefined) { this.stacks[fontstack] = {}; } if (this.atlases[fontstack] === undefined) { - this.atlases[fontstack] = new GlyphAtlas(128, 128); + this.atlases[fontstack] = new GlyphAtlas(); } - var glyphs = {}; var stack = this.stacks[fontstack]; var atlas = this.atlases[fontstack]; - - // the number of pixels the sdf bitmaps are padded by var buffer = 3; - var missing = {}; var remaining = 0; var range; - for (var i = 0; i < glyphIDs.length; i++) { var glyphID = glyphIDs[i]; range = Math.floor(glyphID / 256); - if (stack[range]) { var glyph = stack[range].glyphs[glyphID]; - var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); - if (glyph) glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); + var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); + if (glyph) + glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); } else { if (missing[range] === undefined) { missing[range] = []; @@ -53017,30 +54413,27 @@ GlyphSource.prototype.getSimpleGlyphs = function(fontstack, glyphIDs, uid, callb missing[range].push(glyphID); } } - - if (!remaining) callback(undefined, glyphs, fontstack); - - var onRangeLoaded = function(err, range, data) { - // TODO not be silent about errors + if (!remaining) + callback(undefined, glyphs, fontstack); + var onRangeLoaded = function (err, range, data) { if (!err) { var stack = this.stacks[fontstack][range] = data.stacks[0]; for (var i = 0; i < missing[range].length; i++) { var glyphID = missing[range][i]; var glyph = stack.glyphs[glyphID]; - var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); - if (glyph) glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); + var rect = atlas.addGlyph(uid, fontstack, glyph, buffer); + if (glyph) + glyphs[glyphID] = new SimpleGlyph(glyph, rect, buffer); } } remaining--; - if (!remaining) callback(undefined, glyphs, fontstack); + if (!remaining) + callback(undefined, glyphs, fontstack); }.bind(this); - for (var r in missing) { this.loadRange(fontstack, r, onRangeLoaded); } }; - -// A simplified representation of the glyph containing only the properties needed for shaping. function SimpleGlyph(glyph, rect, buffer) { var padding = 1; this.advance = glyph.advance; @@ -53048,24 +54441,20 @@ function SimpleGlyph(glyph, rect, buffer) { this.top = glyph.top + buffer + padding; this.rect = rect; } - -GlyphSource.prototype.loadRange = function(fontstack, range, callback) { - if (range * 256 > 65535) return callback('glyphs > 65535 not supported'); - +GlyphSource.prototype.loadRange = function (fontstack, range, callback) { + if (range * 256 > 65535) + return callback('glyphs > 65535 not supported'); if (this.loading[fontstack] === undefined) { this.loading[fontstack] = {}; } var loading = this.loading[fontstack]; - if (loading[range]) { loading[range].push(callback); } else { loading[range] = [callback]; - - var rangeName = (range * 256) + '-' + (range * 256 + 255); + var rangeName = range * 256 + '-' + (range * 256 + 255); var url = glyphUrl(fontstack, rangeName, this.url); - - getArrayBuffer(url, function(err, data) { + getArrayBuffer(url, function (err, data) { var glyphs = !err && new Glyphs(new Protobuf(new Uint8Array(data))); for (var i = 0; i < loading[range].length; i++) { loading[range][i](err, range, glyphs); @@ -53074,190 +54463,116 @@ GlyphSource.prototype.loadRange = function(fontstack, range, callback) { }); } }; - -GlyphSource.prototype.getGlyphAtlas = function(fontstack) { +GlyphSource.prototype.getGlyphAtlas = function (fontstack) { return this.atlases[fontstack]; }; - -/** - * Use CNAME sharding to load a specific glyph range over a randomized - * but consistent subdomain. - * @param {string} fontstack comma-joined fonts - * @param {string} range comma-joined range - * @param {url} url templated url - * @param {string} [subdomains=abc] subdomains as a string where each letter is one. - * @returns {string} a url to load that section of glyphs - * @private - */ function glyphUrl(fontstack, range, url, subdomains) { subdomains = subdomains || 'abc'; - - return url - .replace('{s}', subdomains[fontstack.length % subdomains.length]) - .replace('{fontstack}', fontstack) - .replace('{range}', range); + return url.replace('{s}', subdomains[fontstack.length % subdomains.length]).replace('{fontstack}', fontstack).replace('{range}', range); } - -},{"../symbol/glyph_atlas":310,"../util/ajax":334,"../util/glyphs":342,"../util/mapbox":346,"pbf":402}],312:[function(require,module,exports){ +},{"../symbol/glyph_atlas":322,"../util/ajax":349,"../util/glyphs":359,"../util/mapbox":363,"pbf":422}],324:[function(require,module,exports){ 'use strict'; - module.exports = function (features, textFeatures, geometries) { - - var leftIndex = {}, - rightIndex = {}, - mergedFeatures = [], - mergedGeom = [], - mergedTexts = [], - mergedIndex = 0, - k; - + var leftIndex = {}, rightIndex = {}, mergedFeatures = [], mergedGeom = [], mergedTexts = [], mergedIndex = 0, k; function add(k) { mergedFeatures.push(features[k]); mergedGeom.push(geometries[k]); mergedTexts.push(textFeatures[k]); mergedIndex++; } - function mergeFromRight(leftKey, rightKey, geom) { var i = rightIndex[leftKey]; delete rightIndex[leftKey]; rightIndex[rightKey] = i; - mergedGeom[i][0].pop(); mergedGeom[i][0] = mergedGeom[i][0].concat(geom[0]); return i; } - function mergeFromLeft(leftKey, rightKey, geom) { var i = leftIndex[rightKey]; delete leftIndex[rightKey]; leftIndex[leftKey] = i; - mergedGeom[i][0].shift(); mergedGeom[i][0] = geom[0].concat(mergedGeom[i][0]); return i; } - function getKey(text, geom, onRight) { var point = onRight ? geom[0][geom[0].length - 1] : geom[0][0]; return text + ':' + point.x + ':' + point.y; } - for (k = 0; k < features.length; k++) { - var geom = geometries[k], - text = textFeatures[k]; - + var geom = geometries[k], text = textFeatures[k]; if (!text) { add(k); continue; } - - var leftKey = getKey(text, geom), - rightKey = getKey(text, geom, true); - - if ((leftKey in rightIndex) && (rightKey in leftIndex) && (rightIndex[leftKey] !== leftIndex[rightKey])) { - // found lines with the same text adjacent to both ends of the current line, merge all three + var leftKey = getKey(text, geom), rightKey = getKey(text, geom, true); + if (leftKey in rightIndex && rightKey in leftIndex && rightIndex[leftKey] !== leftIndex[rightKey]) { var j = mergeFromLeft(leftKey, rightKey, geom); var i = mergeFromRight(leftKey, rightKey, mergedGeom[j]); - delete leftIndex[leftKey]; delete rightIndex[rightKey]; - rightIndex[getKey(text, mergedGeom[i], true)] = i; mergedGeom[j] = null; - } else if (leftKey in rightIndex) { - // found mergeable line adjacent to the start of the current line, merge mergeFromRight(leftKey, rightKey, geom); - } else if (rightKey in leftIndex) { - // found mergeable line adjacent to the end of the current line, merge mergeFromLeft(leftKey, rightKey, geom); - } else { - // no adjacent lines, add as a new item add(k); leftIndex[leftKey] = mergedIndex - 1; rightIndex[rightKey] = mergedIndex - 1; } } - return { features: mergedFeatures, textFeatures: mergedTexts, geometries: mergedGeom }; }; - -},{}],313:[function(require,module,exports){ +},{}],325:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - module.exports = { getIconQuads: getIconQuads, - getGlyphQuads: getGlyphQuads + getGlyphQuads: getGlyphQuads, + SymbolQuad: SymbolQuad }; - -var minScale = 0.5; // underscale by 1 zoom level - -/** - * A textured quad for rendering a single icon or glyph. - * - * The zoom range the glyph can be shown is defined by minScale and maxScale. - * - * @param {Point} anchorPoint the point the symbol is anchored around - * @param {Point} tl The offset of the top left corner from the anchor. - * @param {Point} tr The offset of the top right corner from the anchor. - * @param {Point} bl The offset of the bottom left corner from the anchor. - * @param {Point} br The offset of the bottom right corner from the anchor. - * @param {Object} tex The texture coordinates. - * @param {number} angle The angle of the label at it's center, not the angle of this quad. - * @param {number} minScale The minimum scale, relative to the tile's intended scale, that the glyph can be shown at. - * @param {number} maxScale The maximum scale, relative to the tile's intended scale, that the glyph can be shown at. - * - * @class SymbolQuad - * @private - */ -function SymbolQuad(anchorPoint, tl, tr, bl, br, tex, angle, minScale, maxScale) { +var minScale = 0.5; +function SymbolQuad(anchorPoint, tl, tr, bl, br, tex, anchorAngle, glyphAngle, minScale, maxScale) { this.anchorPoint = anchorPoint; this.tl = tl; this.tr = tr; this.bl = bl; this.br = br; this.tex = tex; - this.angle = angle; + this.anchorAngle = anchorAngle; + this.glyphAngle = glyphAngle; this.minScale = minScale; this.maxScale = maxScale; } - -/** - * Create the quads used for rendering an icon. - * - * @param {Anchor} anchor - * @param {PositionedIcon} shapedIcon - * @param {number} boxScale A magic number for converting glyph metric units to geometry units. - * @param {Array>} line - * @param {LayoutProperties} layout - * @param {boolean} alongLine Whether the icon should be placed along the line. - * @returns {Array} - * @private - */ -function getIconQuads(anchor, shapedIcon, boxScale, line, layout, alongLine) { - +function getIconQuads(anchor, shapedIcon, boxScale, line, layer, alongLine, shapedText, globalProperties, featureProperties) { var rect = shapedIcon.image.rect; - + var layout = layer.layout; var border = 1; var left = shapedIcon.left - border; var right = left + rect.w / shapedIcon.image.pixelRatio; var top = shapedIcon.top - border; var bottom = top + rect.h / shapedIcon.image.pixelRatio; - var tl = new Point(left, top); - var tr = new Point(right, top); - var br = new Point(right, bottom); - var bl = new Point(left, bottom); - - var angle = layout['icon-rotate'] * Math.PI / 180; + var tl, tr, br, bl; + if (layout['icon-text-fit'] !== 'none' && shapedText) { + var iconWidth = right - left, iconHeight = bottom - top, size = layout['text-size'] / 24, textLeft = shapedText.left * size, textRight = shapedText.right * size, textTop = shapedText.top * size, textBottom = shapedText.bottom * size, textWidth = textRight - textLeft, textHeight = textBottom - textTop, padT = layout['icon-text-fit-padding'][0], padR = layout['icon-text-fit-padding'][1], padB = layout['icon-text-fit-padding'][2], padL = layout['icon-text-fit-padding'][3], offsetY = layout['icon-text-fit'] === 'width' ? (textHeight - iconHeight) * 0.5 : 0, offsetX = layout['icon-text-fit'] === 'height' ? (textWidth - iconWidth) * 0.5 : 0, width = layout['icon-text-fit'] === 'width' || layout['icon-text-fit'] === 'both' ? textWidth : iconWidth, height = layout['icon-text-fit'] === 'height' || layout['icon-text-fit'] === 'both' ? textHeight : iconHeight; + tl = new Point(textLeft + offsetX - padL, textTop + offsetY - padT); + tr = new Point(textLeft + offsetX + padR + width, textTop + offsetY - padT); + br = new Point(textLeft + offsetX + padR + width, textTop + offsetY + padB + height); + bl = new Point(textLeft + offsetX - padL, textTop + offsetY + padB + height); + } else { + tl = new Point(left, top); + tr = new Point(right, top); + br = new Point(right, bottom); + bl = new Point(left, bottom); + } + var angle = layer.getLayoutValue('icon-rotate', globalProperties, featureProperties) * Math.PI / 180; if (alongLine) { var prev = line[anchor.segment]; if (anchor.y === prev.y && anchor.x === prev.x && anchor.segment + 1 < line.length) { @@ -53267,50 +54582,32 @@ function getIconQuads(anchor, shapedIcon, boxScale, line, layout, alongLine) { angle += Math.atan2(anchor.y - prev.y, anchor.x - prev.x); } } - if (angle) { - var sin = Math.sin(angle), - cos = Math.cos(angle), - matrix = [cos, -sin, sin, cos]; - + var sin = Math.sin(angle), cos = Math.cos(angle), matrix = [ + cos, + -sin, + sin, + cos + ]; tl = tl.matMult(matrix); tr = tr.matMult(matrix); bl = bl.matMult(matrix); br = br.matMult(matrix); } - - return [new SymbolQuad(new Point(anchor.x, anchor.y), tl, tr, bl, br, shapedIcon.image.rect, 0, minScale, Infinity)]; + return [new SymbolQuad(new Point(anchor.x, anchor.y), tl, tr, bl, br, shapedIcon.image.rect, 0, 0, minScale, Infinity)]; } - -/** - * Create the quads used for rendering a text label. - * - * @param {Anchor} anchor - * @param {Shaping} shaping - * @param {number} boxScale A magic number for converting from glyph metric units to geometry units. - * @param {Array>} line - * @param {LayoutProperties} layout - * @param {boolean} alongLine Whether the label should be placed along the line. - * @returns {Array} - * @private - */ -function getGlyphQuads(anchor, shaping, boxScale, line, layout, alongLine) { - - var textRotate = layout['text-rotate'] * Math.PI / 180; - var keepUpright = layout['text-keep-upright']; - +function getGlyphQuads(anchor, shaping, boxScale, line, layer, alongLine) { + var textRotate = layer.layout['text-rotate'] * Math.PI / 180; + var keepUpright = layer.layout['text-keep-upright']; var positionedGlyphs = shaping.positionedGlyphs; var quads = []; - for (var k = 0; k < positionedGlyphs.length; k++) { var positionedGlyph = positionedGlyphs[k]; var glyph = positionedGlyph.glyph; var rect = glyph.rect; - - if (!rect) continue; - + if (!rect) + continue; var centerX = (positionedGlyph.x + glyph.advance / 2) * boxScale; - var glyphInstances; var labelMinScale = minScale; if (alongLine) { @@ -53319,99 +54616,55 @@ function getGlyphQuads(anchor, shaping, boxScale, line, layout, alongLine) { if (keepUpright) { labelMinScale = Math.min(labelMinScale, getSegmentGlyphs(glyphInstances, anchor, centerX, line, anchor.segment, false)); } - } else { glyphInstances = [{ - anchorPoint: new Point(anchor.x, anchor.y), - offset: 0, - angle: 0, - maxScale: Infinity, - minScale: minScale - }]; + anchorPoint: new Point(anchor.x, anchor.y), + offset: 0, + angle: 0, + maxScale: Infinity, + minScale: minScale + }]; } - - var x1 = positionedGlyph.x + glyph.left, - y1 = positionedGlyph.y - glyph.top, - x2 = x1 + rect.w, - y2 = y1 + rect.h, - - otl = new Point(x1, y1), - otr = new Point(x2, y1), - obl = new Point(x1, y2), - obr = new Point(x2, y2); - + var x1 = positionedGlyph.x + glyph.left, y1 = positionedGlyph.y - glyph.top, x2 = x1 + rect.w, y2 = y1 + rect.h, otl = new Point(x1, y1), otr = new Point(x2, y1), obl = new Point(x1, y2), obr = new Point(x2, y2); for (var i = 0; i < glyphInstances.length; i++) { - - var instance = glyphInstances[i], - tl = otl, - tr = otr, - bl = obl, - br = obr, - angle = instance.angle + textRotate; - - if (angle) { - var sin = Math.sin(angle), - cos = Math.cos(angle), - matrix = [cos, -sin, sin, cos]; - + var instance = glyphInstances[i], tl = otl, tr = otr, bl = obl, br = obr; + if (textRotate) { + var sin = Math.sin(textRotate), cos = Math.cos(textRotate), matrix = [ + cos, + -sin, + sin, + cos + ]; tl = tl.matMult(matrix); tr = tr.matMult(matrix); bl = bl.matMult(matrix); br = br.matMult(matrix); } - - // Prevent label from extending past the end of the line var glyphMinScale = Math.max(instance.minScale, labelMinScale); - - var glyphAngle = (anchor.angle + textRotate + instance.offset + 2 * Math.PI) % (2 * Math.PI); - quads.push(new SymbolQuad(instance.anchorPoint, tl, tr, bl, br, rect, glyphAngle, glyphMinScale, instance.maxScale)); - + var anchorAngle = (anchor.angle + instance.offset + 2 * Math.PI) % (2 * Math.PI); + var glyphAngle = (instance.angle + instance.offset + 2 * Math.PI) % (2 * Math.PI); + quads.push(new SymbolQuad(instance.anchorPoint, tl, tr, bl, br, rect, anchorAngle, glyphAngle, glyphMinScale, instance.maxScale)); } } - return quads; } - -/** - * We can only render glyph quads that slide along a straight line. To draw - * curved lines we need an instance of a glyph for each segment it appears on. - * This creates all the instances of a glyph that are necessary to render a label. - * - * We need a - * @param {Array} glyphInstances An empty array that glyphInstances are added to. - * @param {Anchor} anchor - * @param {number} offset The glyph's offset from the center of the label. - * @param {Array} line - * @param {number} segment The index of the segment of the line on which the anchor exists. - * @param {boolean} forward If true get the glyphs that come later on the line, otherwise get the glyphs that come earlier. - * - * @returns {Array} glyphInstances - * @private - */ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { var upsideDown = !forward; - - if (offset < 0) forward = !forward; - - if (forward) segment++; - + if (offset < 0) + forward = !forward; + if (forward) + segment++; var newAnchorPoint = new Point(anchor.x, anchor.y); var end = line[segment]; var prevScale = Infinity; - offset = Math.abs(offset); - var placementScale = minScale; - while (true) { var distance = newAnchorPoint.dist(end); var scale = offset / distance; - - // Get the angle of the line segment var angle = Math.atan2(end.y - newAnchorPoint.y, end.x - newAnchorPoint.x); - if (!forward) angle += Math.PI; - if (upsideDown) angle += Math.PI; - + if (!forward) + angle += Math.PI; glyphs.push({ anchorPoint: newAnchorPoint, offset: upsideDown ? Math.PI : 0, @@ -53419,12 +54672,9 @@ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { maxScale: prevScale, angle: (angle + 2 * Math.PI) % (2 * Math.PI) }); - - if (scale <= placementScale) break; - + if (scale <= placementScale) + break; newAnchorPoint = end; - - // skip duplicate nodes while (newAnchorPoint.equals(end)) { segment += forward ? 1 : -1; end = line[segment]; @@ -53432,33 +54682,18 @@ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { return scale; } } - var unit = end.sub(newAnchorPoint)._unit(); newAnchorPoint = newAnchorPoint.sub(unit._mult(distance)); - prevScale = scale; } - return placementScale; } - -},{"point-geometry":404}],314:[function(require,module,exports){ +},{"point-geometry":424}],326:[function(require,module,exports){ 'use strict'; - var resolveTokens = require('../util/token'); - module.exports = resolveText; - -/** - * For an array of features determine what glyphs need to be loaded - * and apply any text preprocessing. The remaining users of text should - * use the `textFeatures` key returned by this function rather than accessing - * feature text directly. - * @private - */ function resolveText(features, layoutProperties, codepoints) { var textFeatures = []; - for (var i = 0, fl = features.length; i < fl; i++) { var text = resolveTokens(features[i].properties, layoutProperties['text-field']); if (!text) { @@ -53466,43 +54701,31 @@ function resolveText(features, layoutProperties, codepoints) { continue; } text = text.toString(); - var transform = layoutProperties['text-transform']; if (transform === 'uppercase') { text = text.toLocaleUpperCase(); } else if (transform === 'lowercase') { text = text.toLocaleLowerCase(); } - for (var j = 0; j < text.length; j++) { codepoints[text.charCodeAt(j)] = true; } - - // Track indexes of features with text. textFeatures[i] = text; } - return textFeatures; } - -},{"../util/token":348}],315:[function(require,module,exports){ +},{"../util/token":365}],327:[function(require,module,exports){ 'use strict'; - module.exports = { shapeText: shapeText, shapeIcon: shapeIcon }; - - -// The position of a glyph relative to the text's anchor point. function PositionedGlyph(codePoint, x, y, glyph) { this.codePoint = codePoint; this.x = x; this.y = y; this.glyph = glyph; } - -// A collection of positioned glyphs and some metadata function Shaping(positionedGlyphs, text, top, bottom, left, right) { this.positionedGlyphs = positionedGlyphs; this.text = text; @@ -53511,153 +54734,114 @@ function Shaping(positionedGlyphs, text, top, bottom, left, right) { this.left = left; this.right = right; } - function shapeText(text, glyphs, maxWidth, lineHeight, horizontalAlign, verticalAlign, justify, spacing, translate) { - var positionedGlyphs = []; var shaping = new Shaping(positionedGlyphs, text, translate[1], translate[1], translate[0], translate[0]); - - // the y offset *should* be part of the font metadata var yOffset = -17; - var x = 0; var y = yOffset; - for (var i = 0; i < text.length; i++) { var codePoint = text.charCodeAt(i); var glyph = glyphs[codePoint]; - - if (!glyph) continue; - + if (!glyph) + continue; positionedGlyphs.push(new PositionedGlyph(codePoint, x, y, glyph)); x += glyph.advance + spacing; } - - if (!positionedGlyphs.length) return false; - + if (!positionedGlyphs.length) + return false; linewrap(shaping, glyphs, lineHeight, maxWidth, horizontalAlign, verticalAlign, justify, translate); - return shaping; } - var invisible = { - 0x20: true, // space - 0x200b: true // zero-width space + 32: true, + 8203: true }; - var breakable = { - 0x20: true, // space - 0x26: true, // ampersand - 0x2b: true, // plus sign - 0x2d: true, // hyphen-minus - 0x2f: true, // solidus - 0xad: true, // soft hyphen - 0xb7: true, // middle dot - 0x200b: true, // zero-width space - 0x2010: true, // hyphen - 0x2013: true // en dash + 32: true, + 38: true, + 43: true, + 45: true, + 47: true, + 173: true, + 183: true, + 8203: true, + 8208: true, + 8211: true }; - function linewrap(shaping, glyphs, lineHeight, maxWidth, horizontalAlign, verticalAlign, justify, translate) { var lastSafeBreak = null; - var lengthBeforeCurrentLine = 0; var lineStartIndex = 0; var line = 0; - var maxLineLength = 0; - var positionedGlyphs = shaping.positionedGlyphs; - if (maxWidth) { for (var i = 0; i < positionedGlyphs.length; i++) { var positionedGlyph = positionedGlyphs[i]; - positionedGlyph.x -= lengthBeforeCurrentLine; positionedGlyph.y += lineHeight * line; - if (positionedGlyph.x > maxWidth && lastSafeBreak !== null) { - var lineLength = positionedGlyphs[lastSafeBreak + 1].x; maxLineLength = Math.max(lineLength, maxLineLength); - for (var k = lastSafeBreak + 1; k <= i; k++) { positionedGlyphs[k].y += lineHeight; positionedGlyphs[k].x -= lineLength; } - if (justify) { - // Collapse invisible characters. var lineEnd = lastSafeBreak; if (invisible[positionedGlyphs[lastSafeBreak].codePoint]) { lineEnd--; } - justifyLine(positionedGlyphs, glyphs, lineStartIndex, lineEnd, justify); } - lineStartIndex = lastSafeBreak + 1; lastSafeBreak = null; lengthBeforeCurrentLine += lineLength; line++; } - if (breakable[positionedGlyph.codePoint]) { lastSafeBreak = i; } } } - var lastPositionedGlyph = positionedGlyphs[positionedGlyphs.length - 1]; var lastLineLength = lastPositionedGlyph.x + glyphs[lastPositionedGlyph.codePoint].advance; maxLineLength = Math.max(maxLineLength, lastLineLength); - var height = (line + 1) * lineHeight; - justifyLine(positionedGlyphs, glyphs, lineStartIndex, positionedGlyphs.length - 1, justify); align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, line, translate); - - // Calculate the bounding box shaping.top += -verticalAlign * height; shaping.bottom = shaping.top + height; shaping.left += -horizontalAlign * maxLineLength; shaping.right = shaping.left + maxLineLength; } - function justifyLine(positionedGlyphs, glyphs, start, end, justify) { var lastAdvance = glyphs[positionedGlyphs[end].codePoint].advance; var lineIndent = (positionedGlyphs[end].x + lastAdvance) * justify; - for (var j = start; j <= end; j++) { positionedGlyphs[j].x -= lineIndent; } - } - function align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, line, translate) { var shiftX = (justify - horizontalAlign) * maxLineLength + translate[0]; var shiftY = (-verticalAlign * (line + 1) + 0.5) * lineHeight + translate[1]; - for (var j = 0; j < positionedGlyphs.length; j++) { positionedGlyphs[j].x += shiftX; positionedGlyphs[j].y += shiftY; } } - - function shapeIcon(image, layout) { - if (!image || !image.rect) return null; - + if (!image || !image.rect) + return null; var dx = layout['icon-offset'][0]; var dy = layout['icon-offset'][1]; var x1 = dx - image.width / 2; var x2 = x1 + image.width; var y1 = dy - image.height / 2; var y2 = y1 + image.height; - return new PositionedIcon(image, y1, y2, x1, x2); } - function PositionedIcon(image, top, bottom, left, right) { this.image = image; this.top = top; @@ -53665,41 +54849,34 @@ function PositionedIcon(image, top, bottom, left, right) { this.left = left; this.right = right; } - -},{}],316:[function(require,module,exports){ +},{}],328:[function(require,module,exports){ 'use strict'; - var ShelfPack = require('shelf-pack'); var browser = require('../util/browser'); - +var util = require('../util/util'); module.exports = SpriteAtlas; function SpriteAtlas(width, height) { this.width = width; this.height = height; - this.bin = new ShelfPack(width, height); this.images = {}; this.data = false; - this.texture = 0; // WebGL ID - this.filter = 0; // WebGL ID + this.texture = 0; + this.filter = 0; this.pixelRatio = 1; this.dirty = true; } - function copyBitmap(src, srcStride, srcX, srcY, dst, dstStride, dstX, dstY, width, height, wrap) { var srcI = srcY * srcStride + srcX; var dstI = dstY * dstStride + dstX; var x, y; - if (wrap) { - // add 1 pixel wrapped padding on each side of the image dstI -= dstStride; for (y = -1; y <= height; y++, srcI = ((y + height) % height + srcY) * srcStride + srcX, dstI += dstStride) { for (x = -1; x <= width; x++) { - dst[dstI + x] = src[srcI + ((x + width) % width)]; + dst[dstI + x] = src[srcI + (x + width) % width]; } } - } else { for (y = 0; y < height; y++, srcI += srcStride, dstI += dstStride) { for (x = 0; x < width; x++) { @@ -53708,79 +54885,64 @@ function copyBitmap(src, srcStride, srcX, srcY, dst, dstStride, dstX, dstY, widt } } } - -SpriteAtlas.prototype.allocateImage = function(pixelWidth, pixelHeight) { - +SpriteAtlas.prototype.allocateImage = function (pixelWidth, pixelHeight) { pixelWidth = pixelWidth / this.pixelRatio; pixelHeight = pixelHeight / this.pixelRatio; - - // Increase to next number divisible by 4, but at least 1. - // This is so we can scale down the texture coordinates and pack them - // into 2 bytes rather than 4 bytes. - // Pad icons to prevent them from polluting neighbours during linear interpolation var padding = 2; var packWidth = pixelWidth + padding + (4 - (pixelWidth + padding) % 4); - var packHeight = pixelHeight + padding + (4 - (pixelHeight + padding) % 4);// + 4; - + var packHeight = pixelHeight + padding + (4 - (pixelHeight + padding) % 4); var rect = this.bin.packOne(packWidth, packHeight); if (!rect) { - console.warn('SpriteAtlas out of space.'); + util.warnOnce('SpriteAtlas out of space.'); return null; } - return rect; }; - -SpriteAtlas.prototype.getImage = function(name, wrap) { +SpriteAtlas.prototype.getImage = function (name, wrap) { if (this.images[name]) { return this.images[name]; } - if (!this.sprite) { return null; } - var pos = this.sprite.getSpritePosition(name); if (!pos.width || !pos.height) { return null; } - var rect = this.allocateImage(pos.width, pos.height); if (!rect) { return null; } - var image = new AtlasImage(rect, pos.width / pos.pixelRatio, pos.height / pos.pixelRatio, pos.sdf, pos.pixelRatio / this.pixelRatio); this.images[name] = image; - this.copy(rect, pos, wrap); - return image; }; - - -// Return position of a repeating fill pattern. -SpriteAtlas.prototype.getPosition = function(name, repeating) { +SpriteAtlas.prototype.getPosition = function (name, repeating) { var image = this.getImage(name, repeating); var rect = image && image.rect; - if (!rect) { return null; } - var width = image.width * image.pixelRatio; var height = image.height * image.pixelRatio; var padding = 1; - return { - size: [image.width, image.height], - tl: [(rect.x + padding) / this.width, (rect.y + padding) / this.height], - br: [(rect.x + padding + width) / this.width, (rect.y + padding + height) / this.height] + size: [ + image.width, + image.height + ], + tl: [ + (rect.x + padding) / this.width, + (rect.y + padding) / this.height + ], + br: [ + (rect.x + padding + width) / this.width, + (rect.y + padding + height) / this.height + ] }; }; - - -SpriteAtlas.prototype.allocate = function() { +SpriteAtlas.prototype.allocate = function () { if (!this.data) { var w = Math.floor(this.width * this.pixelRatio); var h = Math.floor(this.height * this.pixelRatio); @@ -53790,528 +54952,474 @@ SpriteAtlas.prototype.allocate = function() { } } }; - - -SpriteAtlas.prototype.copy = function(dst, src, wrap) { - if (!this.sprite.img.data) return; - var srcImg = new Uint32Array(this.sprite.img.data.buffer); - - this.allocate(); - var dstImg = this.data; - - var padding = 1; - - copyBitmap( - /* source buffer */ srcImg, - /* source stride */ this.sprite.img.width, - /* source x */ src.x, - /* source y */ src.y, - /* dest buffer */ dstImg, - /* dest stride */ this.width * this.pixelRatio, - /* dest x */ (dst.x + padding) * this.pixelRatio, - /* dest y */ (dst.y + padding) * this.pixelRatio, - /* icon dimension */ src.width, - /* icon dimension */ src.height, - /* wrap */ wrap - ); - - this.dirty = true; -}; - -SpriteAtlas.prototype.setSprite = function(sprite) { - if (sprite) { - this.pixelRatio = browser.devicePixelRatio > 1 ? 2 : 1; - - if (this.canvas) { - this.canvas.width = this.width * this.pixelRatio; - this.canvas.height = this.height * this.pixelRatio; +SpriteAtlas.prototype.copy = function (dst, src, wrap) { + if (!this.sprite.img.data) + return; + var srcImg = new Uint32Array(this.sprite.img.data.buffer); + this.allocate(); + var dstImg = this.data; + var padding = 1; + copyBitmap(srcImg, this.sprite.img.width, src.x, src.y, dstImg, this.width * this.pixelRatio, (dst.x + padding) * this.pixelRatio, (dst.y + padding) * this.pixelRatio, src.width, src.height, wrap); + this.dirty = true; +}; +SpriteAtlas.prototype.setSprite = function (sprite) { + if (sprite) { + this.pixelRatio = browser.devicePixelRatio > 1 ? 2 : 1; + if (this.canvas) { + this.canvas.width = this.width * this.pixelRatio; + this.canvas.height = this.height * this.pixelRatio; + } + } + this.sprite = sprite; +}; +SpriteAtlas.prototype.addIcons = function (icons, callback) { + for (var i = 0; i < icons.length; i++) { + this.getImage(icons[i]); + } + callback(null, this.images); +}; +SpriteAtlas.prototype.bind = function (gl, linear) { + var first = false; + if (!this.texture) { + this.texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, this.texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + first = true; + } else { + gl.bindTexture(gl.TEXTURE_2D, this.texture); + } + var filterVal = linear ? gl.LINEAR : gl.NEAREST; + if (filterVal !== this.filter) { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filterVal); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filterVal); + this.filter = filterVal; + } + if (this.dirty) { + this.allocate(); + if (first) { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width * this.pixelRatio, this.height * this.pixelRatio, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(this.data.buffer)); + } else { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width * this.pixelRatio, this.height * this.pixelRatio, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(this.data.buffer)); + } + this.dirty = false; + } +}; +function AtlasImage(rect, width, height, sdf, pixelRatio) { + this.rect = rect; + this.width = width; + this.height = height; + this.sdf = sdf; + this.pixelRatio = pixelRatio; +} +},{"../util/browser":350,"../util/util":366,"shelf-pack":427}],329:[function(require,module,exports){ +'use strict'; +var StructArrayType = require('../util/struct_array'); +var util = require('../util/util'); +var Point = require('point-geometry'); +var SymbolInstancesArray = module.exports = new StructArrayType({ + members: [ + { + type: 'Uint16', + name: 'textBoxStartIndex' + }, + { + type: 'Uint16', + name: 'textBoxEndIndex' + }, + { + type: 'Uint16', + name: 'iconBoxStartIndex' + }, + { + type: 'Uint16', + name: 'iconBoxEndIndex' + }, + { + type: 'Uint16', + name: 'glyphQuadStartIndex' + }, + { + type: 'Uint16', + name: 'glyphQuadEndIndex' + }, + { + type: 'Uint16', + name: 'iconQuadStartIndex' + }, + { + type: 'Uint16', + name: 'iconQuadEndIndex' + }, + { + type: 'Int16', + name: 'anchorPointX' + }, + { + type: 'Int16', + name: 'anchorPointY' + }, + { + type: 'Int8', + name: 'index' + } + ] +}); +util.extendAll(SymbolInstancesArray.prototype.StructType.prototype, { + get anchorPoint() { + return new Point(this.anchorPointX, this.anchorPointY); + } +}); +},{"../util/struct_array":364,"../util/util":366,"point-geometry":424}],330:[function(require,module,exports){ +'use strict'; +var StructArrayType = require('../util/struct_array'); +var util = require('../util/util'); +var Point = require('point-geometry'); +var SymbolQuad = require('./quads').SymbolQuad; +var SymbolQuadsArray = module.exports = new StructArrayType({ + members: [ + { + type: 'Int16', + name: 'anchorPointX' + }, + { + type: 'Int16', + name: 'anchorPointY' + }, + { + type: 'Float32', + name: 'tlX' + }, + { + type: 'Float32', + name: 'tlY' + }, + { + type: 'Float32', + name: 'trX' + }, + { + type: 'Float32', + name: 'trY' + }, + { + type: 'Float32', + name: 'blX' + }, + { + type: 'Float32', + name: 'blY' + }, + { + type: 'Float32', + name: 'brX' + }, + { + type: 'Float32', + name: 'brY' + }, + { + type: 'Int16', + name: 'texH' + }, + { + type: 'Int16', + name: 'texW' + }, + { + type: 'Int16', + name: 'texX' + }, + { + type: 'Int16', + name: 'texY' + }, + { + type: 'Float32', + name: 'anchorAngle' + }, + { + type: 'Float32', + name: 'glyphAngle' + }, + { + type: 'Float32', + name: 'maxScale' + }, + { + type: 'Float32', + name: 'minScale' + } + ] +}); +util.extendAll(SymbolQuadsArray.prototype.StructType.prototype, { + get anchorPoint() { + return new Point(this.anchorPointX, this.anchorPointY); + }, + get SymbolQuad() { + return new SymbolQuad(this.anchorPoint, new Point(this.tlX, this.tlY), new Point(this.trX, this.trY), new Point(this.blX, this.blY), new Point(this.brX, this.brY), { + x: this.texX, + y: this.texY, + h: this.texH, + w: this.texW, + height: this.texH, + width: this.texW + }, this.anchorAngle, this.glyphAngle, this.minScale, this.maxScale); + } +}); +},{"../util/struct_array":364,"../util/util":366,"./quads":325,"point-geometry":424}],331:[function(require,module,exports){ +'use strict'; +var DOM = require('../util/dom'); +var Point = require('point-geometry'); +var handlers = { + scrollZoom: require('./handler/scroll_zoom'), + boxZoom: require('./handler/box_zoom'), + dragRotate: require('./handler/drag_rotate'), + dragPan: require('./handler/drag_pan'), + keyboard: require('./handler/keyboard'), + doubleClickZoom: require('./handler/dblclick_zoom'), + touchZoomRotate: require('./handler/touch_zoom_rotate') +}; +module.exports = function bindHandlers(map, options) { + var el = map.getCanvasContainer(); + var contextMenuEvent = null; + var startPos = null; + var tapped = null; + for (var name in handlers) { + map[name] = new handlers[name](map, options); + if (options.interactive && options[name]) { + map[name].enable(); + } + } + el.addEventListener('mouseout', onMouseOut, false); + el.addEventListener('mousedown', onMouseDown, false); + el.addEventListener('mouseup', onMouseUp, false); + el.addEventListener('mousemove', onMouseMove, false); + el.addEventListener('touchstart', onTouchStart, false); + el.addEventListener('touchend', onTouchEnd, false); + el.addEventListener('touchmove', onTouchMove, false); + el.addEventListener('touchcancel', onTouchCancel, false); + el.addEventListener('click', onClick, false); + el.addEventListener('dblclick', onDblClick, false); + el.addEventListener('contextmenu', onContextMenu, false); + function onMouseOut(e) { + fireMouseEvent('mouseout', e); + } + function onMouseDown(e) { + map.stop(); + startPos = DOM.mousePos(el, e); + fireMouseEvent('mousedown', e); + } + function onMouseUp(e) { + var rotating = map.dragRotate && map.dragRotate.isActive(); + if (contextMenuEvent && !rotating) { + fireMouseEvent('contextmenu', contextMenuEvent); } + contextMenuEvent = null; + fireMouseEvent('mouseup', e); } - this.sprite = sprite; -}; - -SpriteAtlas.prototype.addIcons = function(icons, callback) { - for (var i = 0; i < icons.length; i++) { - this.getImage(icons[i]); + function onMouseMove(e) { + if (map.dragPan && map.dragPan.isActive()) + return; + if (map.dragRotate && map.dragRotate.isActive()) + return; + var target = e.toElement || e.target; + while (target && target !== el) + target = target.parentNode; + if (target !== el) + return; + fireMouseEvent('mousemove', e); } - - callback(null, this.images); -}; - -SpriteAtlas.prototype.bind = function(gl, linear) { - var first = false; - if (!this.texture) { - this.texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, this.texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - first = true; - } else { - gl.bindTexture(gl.TEXTURE_2D, this.texture); + function onTouchStart(e) { + map.stop(); + fireTouchEvent('touchstart', e); + if (!e.touches || e.touches.length > 1) + return; + if (!tapped) { + tapped = setTimeout(onTouchTimeout, 300); + } else { + clearTimeout(tapped); + tapped = null; + fireMouseEvent('dblclick', e); + } } - - var filterVal = linear ? gl.LINEAR : gl.NEAREST; - if (filterVal !== this.filter) { - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filterVal); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filterVal); - this.filter = filterVal; + function onTouchMove(e) { + fireTouchEvent('touchmove', e); } - - if (this.dirty) { - this.allocate(); - - if (first) { - gl.texImage2D( - gl.TEXTURE_2D, // enum target - 0, // ind level - gl.RGBA, // ind internalformat - this.width * this.pixelRatio, // GLsizei width - this.height * this.pixelRatio, // GLsizei height - 0, // ind border - gl.RGBA, // enum format - gl.UNSIGNED_BYTE, // enum type - new Uint8Array(this.data.buffer) // Object data - ); - } else { - gl.texSubImage2D( - gl.TEXTURE_2D, // enum target - 0, // int level - 0, // int xoffset - 0, // int yoffset - this.width * this.pixelRatio, // long width - this.height * this.pixelRatio, // long height - gl.RGBA, // enum format - gl.UNSIGNED_BYTE, // enum type - new Uint8Array(this.data.buffer) // Object pixels - ); + function onTouchEnd(e) { + fireTouchEvent('touchend', e); + } + function onTouchCancel(e) { + fireTouchEvent('touchcancel', e); + } + function onTouchTimeout() { + tapped = null; + } + function onClick(e) { + var pos = DOM.mousePos(el, e); + if (pos.equals(startPos)) { + fireMouseEvent('click', e); } - - this.dirty = false; + } + function onDblClick(e) { + fireMouseEvent('dblclick', e); + e.preventDefault(); + } + function onContextMenu(e) { + contextMenuEvent = e; + e.preventDefault(); + } + function fireMouseEvent(type, e) { + var pos = DOM.mousePos(el, e); + return map.fire(type, { + lngLat: map.unproject(pos), + point: pos, + originalEvent: e + }); + } + function fireTouchEvent(type, e) { + var touches = DOM.touchPos(el, e); + var singular = touches.reduce(function (prev, curr, i, arr) { + return prev.add(curr.div(arr.length)); + }, new Point(0, 0)); + return map.fire(type, { + lngLat: map.unproject(singular), + point: singular, + lngLats: touches.map(function (t) { + return map.unproject(t); + }, this), + points: touches, + originalEvent: e + }); } }; - -function AtlasImage(rect, width, height, sdf, pixelRatio) { - this.rect = rect; - this.width = width; - this.height = height; - this.sdf = sdf; - this.pixelRatio = pixelRatio; -} - -},{"../util/browser":335,"shelf-pack":406}],317:[function(require,module,exports){ +},{"../util/dom":352,"./handler/box_zoom":337,"./handler/dblclick_zoom":338,"./handler/drag_pan":339,"./handler/drag_rotate":340,"./handler/keyboard":341,"./handler/scroll_zoom":342,"./handler/touch_zoom_rotate":343,"point-geometry":424}],332:[function(require,module,exports){ 'use strict'; - var util = require('../util/util'); var interpolate = require('../util/interpolate'); var browser = require('../util/browser'); var LngLat = require('../geo/lng_lat'); var LngLatBounds = require('../geo/lng_lat_bounds'); var Point = require('point-geometry'); - -/** - * Options common to Map#jumpTo, Map#easeTo, and Map#flyTo, controlling the destination - * location, zoom level, bearing and pitch. All properties are options; unspecified - * options will default to the current value for that property. - * - * @typedef {Object} CameraOptions - * @property {LngLat} center Map center - * @property {number} zoom Map zoom level - * @property {number} bearing Map rotation bearing in degrees counter-clockwise from north - * @property {number} pitch Map angle in degrees at which the camera is looking at the ground - * @property {LngLat} around If zooming, the zoom center (defaults to map center) - */ - -/** - * Options common to map movement methods that involve animation, such as Map#panBy and - * Map#easeTo, controlling the duration of the animation and easing function. All properties - * are optional. - * - * @typedef {Object} AnimationOptions - * @property {number} duration Number in milliseconds - * @property {Function} easing - * @property {Array} offset point, origin of movement relative to map center - * @property {boolean} animate When set to false, no animation happens - */ - -var Camera = module.exports = function() {}; - -util.extend(Camera.prototype, /** @lends Map.prototype */{ - /** - * Get the current view geographical point. - * @returns {LngLat} - */ - getCenter: function() { return this.transform.center; }, - - /** - * Sets a map location. Equivalent to `jumpTo({center: center})`. - * - * @param {LngLat} center Map center to jump to - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - * @example - * map.setCenter([-74, 38]); - */ - setCenter: function(center, eventData) { - this.jumpTo({center: center}, eventData); +var Camera = module.exports = function () { +}; +util.extend(Camera.prototype, { + getCenter: function () { + return this.transform.center; + }, + setCenter: function (center, eventData) { + this.jumpTo({ center: center }, eventData); return this; }, - - /** - * Pan by a certain number of pixels - * - * @param {Array} offset [x, y] - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - panBy: function(offset, options, eventData) { - this.panTo(this.transform.center, - util.extend({offset: Point.convert(offset).mult(-1)}, options), eventData); + panBy: function (offset, options, eventData) { + this.panTo(this.transform.center, util.extend({ offset: Point.convert(offset).mult(-1) }, options), eventData); return this; }, - - /** - * Pan to a certain location with easing - * - * @param {LngLat} lnglat Location to pan to - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - panTo: function(lnglat, options, eventData) { - return this.easeTo(util.extend({ - center: lnglat - }, options), eventData); + panTo: function (lnglat, options, eventData) { + return this.easeTo(util.extend({ center: lnglat }, options), eventData); }, - - - /** - * Get the current zoom - * @returns {number} - */ - getZoom: function() { return this.transform.zoom; }, - - /** - * Sets a map zoom. Equivalent to `jumpTo({zoom: zoom})`. - * - * @param {number} zoom Map zoom level - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - * @example - * // zoom the map to 5 - * map.setZoom(5); - */ - setZoom: function(zoom, eventData) { - this.jumpTo({zoom: zoom}, eventData); + getZoom: function () { + return this.transform.zoom; + }, + setZoom: function (zoom, eventData) { + this.jumpTo({ zoom: zoom }, eventData); return this; }, - - /** - * Zooms to a certain zoom level with easing. - * - * @param {number} zoom - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - */ - zoomTo: function(zoom, options, eventData) { - return this.easeTo(util.extend({ - zoom: zoom - }, options), eventData); + zoomTo: function (zoom, options, eventData) { + return this.easeTo(util.extend({ zoom: zoom }, options), eventData); }, - - /** - * Zoom in by 1 level - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - */ - zoomIn: function(options, eventData) { + zoomIn: function (options, eventData) { this.zoomTo(this.getZoom() + 1, options, eventData); return this; }, - - /** - * Zoom out by 1 level - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires moveend - * @fires zoomend - * @returns {Map} `this` - */ - zoomOut: function(options, eventData) { + zoomOut: function (options, eventData) { this.zoomTo(this.getZoom() - 1, options, eventData); return this; }, - - - /** - * Get the current bearing in degrees - * @returns {number} - */ - getBearing: function() { return this.transform.bearing; }, - - /** - * Sets a map rotation. Equivalent to `jumpTo({bearing: bearing})`. - * - * @param {number} bearing Map rotation bearing in degrees counter-clockwise from north - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - * @example - * // rotate the map to 90 degrees - * map.setBearing(90); - */ - setBearing: function(bearing, eventData) { - this.jumpTo({bearing: bearing}, eventData); + getBearing: function () { + return this.transform.bearing; + }, + setBearing: function (bearing, eventData) { + this.jumpTo({ bearing: bearing }, eventData); return this; }, - - /** - * Rotate bearing by a certain number of degrees with easing - * - * @param {number} bearing - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - rotateTo: function(bearing, options, eventData) { - return this.easeTo(util.extend({ - bearing: bearing - }, options), eventData); + rotateTo: function (bearing, options, eventData) { + return this.easeTo(util.extend({ bearing: bearing }, options), eventData); }, - - /** - * Sets map bearing to 0 (north) with easing - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - resetNorth: function(options, eventData) { - this.rotateTo(0, util.extend({duration: 1000}, options), eventData); + resetNorth: function (options, eventData) { + this.rotateTo(0, util.extend({ duration: 1000 }, options), eventData); return this; }, - - /** - * Animates map bearing to 0 (north) if it's already close to it. - * - * @param {AnimationOptions} [options] - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - snapToNorth: function(options, eventData) { - if (Math.abs(this.getBearing()) < this.options.bearingSnap) { + snapToNorth: function (options, eventData) { + if (Math.abs(this.getBearing()) < this._bearingSnap) { return this.resetNorth(options, eventData); } return this; }, - - /** - * Get the current angle in degrees - * @returns {number} - */ - getPitch: function() { return this.transform.pitch; }, - - /** - * Sets a map angle. Equivalent to `jumpTo({pitch: pitch})`. - * - * @param {number} pitch The angle at which the camera is looking at the ground - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - setPitch: function(pitch, eventData) { - this.jumpTo({pitch: pitch}, eventData); + getPitch: function () { + return this.transform.pitch; + }, + setPitch: function (pitch, eventData) { + this.jumpTo({ pitch: pitch }, eventData); return this; }, - - - /** - * Zoom to contain certain geographical bounds - * - * @param {LngLatBounds|Array>} bounds [[minLng, minLat], [maxLng, maxLat]] - * @param {Object} options - * @param {boolean} [options.linear] When true, the map transitions to the new camera using - * {@link #Map.easeTo}. When false, the map transitions using {@link #Map.flyTo}. See - * {@link #Map.flyTo} for information on options specific to that animation transition. - * @param {Function} options.easing - * @param {number} options.padding how much padding there is around the given bounds on each side in pixels - * @param {number} options.maxZoom The resulting zoom level will be at most - * this value. - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires moveend - * @returns {Map} `this` - */ - fitBounds: function(bounds, options, eventData) { - + fitBounds: function (bounds, options, eventData) { options = util.extend({ padding: 0, - offset: [0, 0], + offset: [ + 0, + 0 + ], maxZoom: Infinity }, options); - bounds = LngLatBounds.convert(bounds); - - var offset = Point.convert(options.offset), - tr = this.transform, - nw = tr.project(bounds.getNorthWest()), - se = tr.project(bounds.getSouthEast()), - size = se.sub(nw), - scaleX = (tr.width - options.padding * 2 - Math.abs(offset.x) * 2) / size.x, - scaleY = (tr.height - options.padding * 2 - Math.abs(offset.y) * 2) / size.y; - + var offset = Point.convert(options.offset), tr = this.transform, nw = tr.project(bounds.getNorthWest()), se = tr.project(bounds.getSouthEast()), size = se.sub(nw), scaleX = (tr.width - options.padding * 2 - Math.abs(offset.x) * 2) / size.x, scaleY = (tr.height - options.padding * 2 - Math.abs(offset.y) * 2) / size.y; options.center = tr.unproject(nw.add(se).div(2)); options.zoom = Math.min(tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom); options.bearing = 0; - - return options.linear ? - this.easeTo(options, eventData) : - this.flyTo(options, eventData); + return options.linear ? this.easeTo(options, eventData) : this.flyTo(options, eventData); }, - - /** - * Change any combination of center, zoom, bearing, and pitch, without - * a transition. The map will retain the current values for any options - * not included in `options`. - * - * @param {CameraOptions} options map view options - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires rotate - * @fires pitch - * @fires zoomend - * @fires moveend - * @returns {Map} `this` - */ - jumpTo: function(options, eventData) { + jumpTo: function (options, eventData) { this.stop(); - - var tr = this.transform, - zoomChanged = false, - bearingChanged = false, - pitchChanged = false; - + var tr = this.transform, zoomChanged = false, bearingChanged = false, pitchChanged = false; if ('zoom' in options && tr.zoom !== +options.zoom) { zoomChanged = true; tr.zoom = +options.zoom; } - if ('center' in options) { tr.center = LngLat.convert(options.center); } - if ('bearing' in options && tr.bearing !== +options.bearing) { bearingChanged = true; tr.bearing = +options.bearing; } - if ('pitch' in options && tr.pitch !== +options.pitch) { pitchChanged = true; tr.pitch = +options.pitch; } - - this.fire('movestart', eventData) - .fire('move', eventData); - + this.fire('movestart', eventData).fire('move', eventData); if (zoomChanged) { - this.fire('zoomstart', eventData) - .fire('zoom', eventData) - .fire('zoomend', eventData); + this.fire('zoomstart', eventData).fire('zoom', eventData).fire('zoomend', eventData); } - if (bearingChanged) { this.fire('rotate', eventData); } - if (pitchChanged) { this.fire('pitch', eventData); } - return this.fire('moveend', eventData); }, - - /** - * Change any combination of center, zoom, bearing, and pitch, with a smooth animation - * between old and new values. The map will retain the current values for any options - * not included in `options`. - * - * @param {CameraOptions|AnimationOptions} options map view and animation options - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires rotate - * @fires pitch - * @fires zoomend - * @fires moveend - * @returns {Map} `this` - */ - easeTo: function(options, eventData) { + easeTo: function (options, eventData) { this.stop(); - options = util.extend({ - offset: [0, 0], + offset: [ + 0, + 0 + ], duration: 500, easing: util.ease }, options); - - var tr = this.transform, - offset = Point.convert(options.offset), - startZoom = this.getZoom(), - startBearing = this.getBearing(), - startPitch = this.getPitch(), - - zoom = 'zoom' in options ? +options.zoom : startZoom, - bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing, - pitch = 'pitch' in options ? +options.pitch : startPitch, - - toLngLat, - toPoint; - + var tr = this.transform, offset = Point.convert(options.offset), startZoom = this.getZoom(), startBearing = this.getBearing(), startPitch = this.getPitch(), zoom = 'zoom' in options ? +options.zoom : startZoom, bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing, pitch = 'pitch' in options ? +options.pitch : startPitch, toLngLat, toPoint; if ('center' in options) { toLngLat = LngLat.convert(options.center); toPoint = tr.centerPoint.add(offset); @@ -54322,39 +55430,30 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ toPoint = tr.centerPoint.add(offset); toLngLat = tr.pointLocation(toPoint); } - var fromPoint = tr.locationPoint(toLngLat); - - if (options.animate === false) options.duration = 0; - - this.zooming = (zoom !== startZoom); - this.rotating = (startBearing !== bearing); - this.pitching = (pitch !== startPitch); - + if (options.animate === false) + options.duration = 0; + this.zooming = zoom !== startZoom; + this.rotating = startBearing !== bearing; + this.pitching = pitch !== startPitch; if (!options.noMoveStart) { this.fire('movestart', eventData); } if (this.zooming) { this.fire('zoomstart', eventData); } - clearTimeout(this._onEaseEnd); - this._ease(function (k) { if (this.zooming) { tr.zoom = interpolate(startZoom, zoom, k); } - if (this.rotating) { tr.bearing = interpolate(startBearing, bearing, k); } - if (this.pitching) { tr.pitch = interpolate(startPitch, pitch, k); } - tr.setLocationAtPoint(toLngLat, fromPoint.add(toPoint.sub(fromPoint)._mult(k))); - this.fire('move', eventData); if (this.zooming) { this.fire('zoom', eventData); @@ -54365,106 +55464,41 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ if (this.pitching) { this.fire('pitch', eventData); } - }, function() { + }, function () { if (options.delayEndEvents) { this._onEaseEnd = setTimeout(this._easeToEnd.bind(this, eventData), options.delayEndEvents); } else { this._easeToEnd(eventData); } }.bind(this), options); - return this; }, - - _easeToEnd: function(eventData) { - if (this.zooming) { - this.fire('zoomend', eventData); - } - this.fire('moveend', eventData); - + _easeToEnd: function (eventData) { + var wasZooming = this.zooming; this.zooming = false; this.rotating = false; this.pitching = false; + if (wasZooming) { + this.fire('zoomend', eventData); + } + this.fire('moveend', eventData); }, - - /** - * Change any combination of center, zoom, bearing, and pitch, animated along a curve that - * evokes flight. The transition animation seamlessly incorporates zooming and panning to help - * the user find his or her bearings even after traversing a great distance. - * - * @param {CameraOptions|AnimationOptions} options map view and animation options - * @param {number} [options.curve=1.42] Relative amount of zooming that takes place along the - * flight path. A high value maximizes zooming for an exaggerated animation, while a low - * value minimizes zooming for something closer to {@link #Map.easeTo}. 1.42 is the average - * value selected by participants in the user study in - * [van Wijk (2003)](https://www.win.tue.nl/~vanwijk/zoompan.pdf). A value of - * `Math.pow(6, 0.25)` would be equivalent to the root mean squared average velocity. A - * value of 1 would produce a circular motion. - * @param {number} [options.minZoom] Zero-based zoom level at the peak of the flight path. If - * `options.curve` is specified, this option is ignored. - * @param {number} [options.speed=1.2] Average speed of the animation. A speed of 1.2 means that - * the map appears to move along the flight path by 1.2 times `options.curve` screenfuls every - * second. A _screenful_ is the visible span in pixels. It does not correspond to a fixed - * physical distance but rather varies by zoom level. - * @param {number} [options.screenSpeed] Average speed of the animation, measured in screenfuls - * per second, assuming a linear timing curve. If `options.speed` is specified, this option - * is ignored. - * @param {Function} [options.easing] Transition timing curve - * @param {EventData} [eventData] Data to propagate to any event receivers - * @fires movestart - * @fires zoomstart - * @fires move - * @fires zoom - * @fires rotate - * @fires pitch - * @fires zoomend - * @fires moveend - * @returns {this} - * @example - * // fly with default options to null island - * map.flyTo({center: [0, 0], zoom: 9}); - * // using flyTo options - * map.flyTo({ - * center: [0, 0], - * zoom: 9, - * speed: 0.2, - * curve: 1, - * easing: function(t) { - * return t; - * } - * }); - */ - flyTo: function(options, eventData) { - // This method implements an “optimal path” animation, as detailed in: - // - // Van Wijk, Jarke J.; Nuij, Wim A. A. “Smooth and efficient zooming and panning.” INFOVIS - // ’03. pp. 15–22. . - // - // Where applicable, local variable documentation begins with the associated variable or - // function in van Wijk (2003). - + flyTo: function (options, eventData) { this.stop(); - options = util.extend({ - offset: [0, 0], + offset: [ + 0, + 0 + ], speed: 1.2, curve: 1.42, easing: util.ease }, options); - - var tr = this.transform, - offset = Point.convert(options.offset), - startZoom = this.getZoom(), - startBearing = this.getBearing(), - startPitch = this.getPitch(); - + var tr = this.transform, offset = Point.convert(options.offset), startZoom = this.getZoom(), startBearing = this.getBearing(), startPitch = this.getPitch(); var center = 'center' in options ? LngLat.convert(options.center) : this.getCenter(); - var zoom = 'zoom' in options ? +options.zoom : startZoom; + var zoom = 'zoom' in options ? +options.zoom : startZoom; var bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing; var pitch = 'pitch' in options ? +options.pitch : startPitch; - - // If a path crossing the antimeridian would be shorter, extend the final coordinate so that - // interpolating between the two endpoints will cross it. if (Math.abs(tr.center.lng) + Math.abs(center.lng) > 180) { if (tr.center.lng > 0 && center.lng < 0) { center.lng += 360; @@ -54472,108 +55506,67 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ center.lng -= 360; } } - - var scale = tr.zoomScale(zoom - startZoom), - from = tr.point, - to = 'center' in options ? tr.project(center).sub(offset.div(scale)) : from; - - var startWorldSize = tr.worldSize, - rho = options.curve, - - // w₀: Initial visible span, measured in pixels at the initial scale. - w0 = Math.max(tr.width, tr.height), - // w₁: Final visible span, measured in pixels with respect to the initial scale. - w1 = w0 / scale, - // Length of the flight path as projected onto the ground plane, measured in pixels from - // the world image origin at the initial scale. - u1 = to.sub(from).mag(); - + var scale = tr.zoomScale(zoom - startZoom), from = tr.point, to = 'center' in options ? tr.project(center).sub(offset.div(scale)) : from; + var startWorldSize = tr.worldSize, rho = options.curve, w0 = Math.max(tr.width, tr.height), w1 = w0 / scale, u1 = to.sub(from).mag(); if ('minZoom' in options) { var minZoom = util.clamp(Math.min(options.minZoom, startZoom, zoom), tr.minZoom, tr.maxZoom); - // wm: Maximum visible span, measured in pixels with respect to the initial - // scale. var wMax = w0 / tr.zoomScale(minZoom - startZoom); rho = Math.sqrt(wMax / u1 * 2); } - - // ρ² var rho2 = rho * rho; - - /** - * rᵢ: Returns the zoom-out factor at one end of the animation. - * - * @param i 0 for the ascent or 1 for the descent. - * @private - */ function r(i) { var b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1); return Math.log(Math.sqrt(b * b + 1) - b); } - - function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; } - function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; } - function tanh(n) { return sinh(n) / cosh(n); } - - // r₀: Zoom-out factor during ascent. - var r0 = r(0), - /** - * w(s): Returns the visible span on the ground, measured in pixels with respect to the - * initial scale. - * - * Assumes an angular field of view of 2 arctan ½ ≈ 53°. - * @private - */ - w = function (s) { return (cosh(r0) / cosh(r0 + rho * s)); }, - /** - * u(s): Returns the distance along the flight path as projected onto the ground plane, - * measured in pixels from the world image origin at the initial scale. - * @private - */ - u = function (s) { return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1; }, - // S: Total length of the flight path, measured in ρ-screenfuls. - S = (r(1) - r0) / rho; - - // When u₀ = u₁, the optimal path doesn’t require both ascent and descent. + function sinh(n) { + return (Math.exp(n) - Math.exp(-n)) / 2; + } + function cosh(n) { + return (Math.exp(n) + Math.exp(-n)) / 2; + } + function tanh(n) { + return sinh(n) / cosh(n); + } + var r0 = r(0), w = function (s) { + return cosh(r0) / cosh(r0 + rho * s); + }, u = function (s) { + return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1; + }, S = (r(1) - r0) / rho; if (Math.abs(u1) < 0.000001) { - // Perform a more or less instantaneous transition if the path is too short. - if (Math.abs(w0 - w1) < 0.000001) return this.easeTo(options); - + if (Math.abs(w0 - w1) < 0.000001) + return this.easeTo(options); var k = w1 < w0 ? -1 : 1; S = Math.abs(Math.log(w1 / w0)) / rho; - - u = function() { return 0; }; - w = function(s) { return Math.exp(k * rho * s); }; + u = function () { + return 0; + }; + w = function (s) { + return Math.exp(k * rho * s); + }; } - if ('duration' in options) { options.duration = +options.duration; } else { var V = 'screenSpeed' in options ? +options.screenSpeed / rho : +options.speed; options.duration = 1000 * S / V; } - this.zooming = true; - if (startBearing !== bearing) this.rotating = true; - if (startPitch !== pitch) this.pitching = true; - + if (startBearing !== bearing) + this.rotating = true; + if (startPitch !== pitch) + this.pitching = true; this.fire('movestart', eventData); this.fire('zoomstart', eventData); - this._ease(function (k) { - // s: The distance traveled along the flight path, measured in ρ-screenfuls. - var s = k * S, - us = u(s); - + var s = k * S, us = u(s); tr.zoom = startZoom + tr.scaleZoom(1 / w(s)); tr.center = tr.unproject(from.add(to.sub(from).mult(us)), startWorldSize); - if (this.rotating) { tr.bearing = interpolate(startBearing, bearing, k); } if (this.pitching) { tr.pitch = interpolate(startPitch, pitch, k); } - this.fire('move', eventData); this.fire('zoom', eventData); if (this.rotating) { @@ -54582,35 +55575,26 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ if (this.pitching) { this.fire('pitch', eventData); } - }, function() { - this.fire('zoomend', eventData); - this.fire('moveend', eventData); + }, function () { this.zooming = false; this.rotating = false; this.pitching = false; + this.fire('zoomend', eventData); + this.fire('moveend', eventData); }, options); - return this; }, - - isEasing: function() { + isEasing: function () { return !!this._abortFn; }, - - /** - * Stop current animation - * - * @returns {Map} `this` - */ - stop: function() { + stop: function () { if (this._abortFn) { this._abortFn(); this._finishEase(); } return this; }, - - _ease: function(frame, finish, options) { + _ease: function (frame, finish, options) { this._finishFn = finish; this._abortFn = browser.timed(function (t) { frame.call(this, options.easing(t)); @@ -54619,166 +55603,102 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ } }, options.animate === false ? 0 : options.duration, this); }, - - _finishEase: function() { + _finishEase: function () { delete this._abortFn; - // The finish function might emit events which trigger new eases, which - // set a new _finishFn. Ensure we don't delete it unintentionally. var finish = this._finishFn; delete this._finishFn; finish.call(this); }, - - // convert bearing so that it's numerically close to the current one so that it interpolates properly - _normalizeBearing: function(bearing, currentBearing) { + _normalizeBearing: function (bearing, currentBearing) { bearing = util.wrap(bearing, -180, 180); var diff = Math.abs(bearing - currentBearing); - if (Math.abs(bearing - 360 - currentBearing) < diff) bearing -= 360; - if (Math.abs(bearing + 360 - currentBearing) < diff) bearing += 360; + if (Math.abs(bearing - 360 - currentBearing) < diff) + bearing -= 360; + if (Math.abs(bearing + 360 - currentBearing) < diff) + bearing += 360; return bearing; }, - - _updateEasing: function(duration, zoom, bezier) { + _updateEasing: function (duration, zoom, bezier) { var easing; - if (this.ease) { - var ease = this.ease, - t = (Date.now() - ease.start) / ease.duration, - speed = ease.easing(t + 0.01) - ease.easing(t), - - // Quick hack to make new bezier that is continuous with last - x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01, - y = Math.sqrt(0.27 * 0.27 - x * x); - + var ease = this.ease, t = (Date.now() - ease.start) / ease.duration, speed = ease.easing(t + 0.01) - ease.easing(t), x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01, y = Math.sqrt(0.27 * 0.27 - x * x); easing = util.bezier(x, y, 0.25, 1); } else { easing = bezier ? util.bezier.apply(util, bezier) : util.ease; } - - // store information on current easing this.ease = { - start: (new Date()).getTime(), + start: new Date().getTime(), to: Math.pow(2, zoom), duration: duration, easing: easing }; - return easing; } }); - -/** - * Pitch event. This event is emitted whenever the map's pitch changes. - * - * @event pitch - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../geo/lng_lat":256,"../geo/lng_lat_bounds":257,"../util/browser":335,"../util/interpolate":343,"../util/util":349,"point-geometry":404}],318:[function(require,module,exports){ +},{"../geo/lng_lat":263,"../geo/lng_lat_bounds":264,"../util/browser":350,"../util/interpolate":360,"../util/util":366,"point-geometry":424}],333:[function(require,module,exports){ 'use strict'; - var Control = require('./control'); var DOM = require('../../util/dom'); var util = require('../../util/util'); - module.exports = Attribution; - -/** - * Creates an attribution control - * @class Attribution - * @param {Object} [options] - * @param {string} [options.position='bottom-right'] A string indicating the control's position on the map. Options are `top-right`, `top-left`, `bottom-right`, `bottom-left` - * @example - * var map = new mapboxgl.Map({attributionControl: false}) - * .addControl(new mapboxgl.Attribution({position: 'top-left'})); - */ function Attribution(options) { util.setOptions(this, options); } - -Attribution.createAttributionString = function(sources) { +Attribution.createAttributionString = function (sources) { var attributions = []; - for (var id in sources) { var source = sources[id]; if (source.attribution && attributions.indexOf(source.attribution) < 0) { attributions.push(source.attribution); } } - - // remove any entries that are substrings of another entry. - // first sort by length so that substrings come first - attributions.sort(function (a, b) { return a.length - b.length; }); + attributions.sort(function (a, b) { + return a.length - b.length; + }); attributions = attributions.filter(function (attrib, i) { for (var j = i + 1; j < attributions.length; j++) { - if (attributions[j].indexOf(attrib) >= 0) { return false; } + if (attributions[j].indexOf(attrib) >= 0) { + return false; + } } return true; }); - return attributions.join(' | '); }; - Attribution.prototype = util.inherit(Control, { - options: { - position: 'bottom-right' - }, - - onAdd: function(map) { - var className = 'mapboxgl-ctrl-attrib', - container = this._container = DOM.create('div', className, map.getContainer()); - + options: { position: 'bottom-right' }, + onAdd: function (map) { + var className = 'mapboxgl-ctrl-attrib', container = this._container = DOM.create('div', className, map.getContainer()); this._update(); map.on('source.load', this._update.bind(this)); map.on('source.change', this._update.bind(this)); map.on('source.remove', this._update.bind(this)); map.on('moveend', this._updateEditLink.bind(this)); - return container; }, - - _update: function() { + _update: function () { if (this._map.style) { this._container.innerHTML = Attribution.createAttributionString(this._map.style.sources); } - this._editLink = this._container.getElementsByClassName('mapbox-improve-map')[0]; this._updateEditLink(); }, - - _updateEditLink: function() { + _updateEditLink: function () { if (this._editLink) { var center = this._map.getCenter(); - this._editLink.href = 'https://www.mapbox.com/map-feedback/#/' + - center.lng + '/' + center.lat + '/' + Math.round(this._map.getZoom() + 1); + this._editLink.href = 'https://www.mapbox.com/map-feedback/#/' + center.lng + '/' + center.lat + '/' + Math.round(this._map.getZoom() + 1); } } }); - -},{"../../util/dom":338,"../../util/util":349,"./control":319}],319:[function(require,module,exports){ +},{"../../util/dom":352,"../../util/util":366,"./control":334}],334:[function(require,module,exports){ 'use strict'; - +var util = require('../../util/util'); +var Evented = require('../../util/evented'); module.exports = Control; - -/** - * A base class for map-related interface elements. - * - * @class Control - */ -function Control() {} - +function Control() { +} Control.prototype = { - /** - * Add this control to the map, returning the control itself - * for chaining. This will insert the control's DOM element into - * the map's DOM element if the control has a `position` specified. - * - * @param {Map} map - * @returns {Control} `this` - */ - addTo: function(map) { + addTo: function (map) { this._map = map; var container = this._container = this.onAdd(map); if (this.options && this.options.position) { @@ -54791,200 +55711,146 @@ Control.prototype = { corner.appendChild(container); } } - return this; }, - - /** - * Remove this control from the map it has been added to. - * - * @returns {Control} `this` - */ - remove: function() { + remove: function () { this._container.parentNode.removeChild(this._container); - if (this.onRemove) this.onRemove(this._map); + if (this.onRemove) + this.onRemove(this._map); this._map = null; return this; } }; - -},{}],320:[function(require,module,exports){ +util.extend(Control.prototype, Evented); +},{"../../util/evented":358,"../../util/util":366}],335:[function(require,module,exports){ 'use strict'; - var Control = require('./control'); var browser = require('../../util/browser'); var DOM = require('../../util/dom'); var util = require('../../util/util'); - module.exports = Geolocate; - -var geoOptions = { enableHighAccuracy: false, timeout: 6000 /* 6sec */ }; - - -/** - * Creates a geolocation control - * @class Geolocate - * @param {Object} [options] - * @param {string} [options.position='top-right'] A string indicating the control's position on the map. Options are `top-right`, `top-left`, `bottom-right`, `bottom-left` - * @example - * map.addControl(new mapboxgl.Geolocate({position: 'top-left'})); // position is optional - */ +var geoOptions = { + enableHighAccuracy: false, + timeout: 6000 +}; function Geolocate(options) { util.setOptions(this, options); } - Geolocate.prototype = util.inherit(Control, { - options: { - position: 'top-right' - }, - - onAdd: function(map) { + options: { position: 'top-right' }, + onAdd: function (map) { var className = 'mapboxgl-ctrl'; - var container = this._container = DOM.create('div', className + '-group', map.getContainer()); - if (!browser.supportsGeolocation) return container; - + if (!browser.supportsGeolocation) + return container; this._container.addEventListener('contextmenu', this._onContextMenu.bind(this)); - - this._geolocateButton = DOM.create('button', (className + '-icon ' + className + '-geolocate'), this._container); + this._geolocateButton = DOM.create('button', className + '-icon ' + className + '-geolocate', this._container); + this._geolocateButton.type = 'button'; this._geolocateButton.addEventListener('click', this._onClickGeolocate.bind(this)); return container; }, - - _onContextMenu: function(e) { + _onContextMenu: function (e) { e.preventDefault(); }, - - _onClickGeolocate: function() { + _onClickGeolocate: function () { navigator.geolocation.getCurrentPosition(this._success.bind(this), this._error.bind(this), geoOptions); - - // This timeout ensures that we still call finish() even if - // the user declines to share their location in Firefox - this._timeoutId = setTimeout(this._finish.bind(this), 10000 /* 10sec */); + this._timeoutId = setTimeout(this._finish.bind(this), 10000); }, - - _success: function(position) { + _success: function (position) { this._map.jumpTo({ - center: [position.coords.longitude, position.coords.latitude], + center: [ + position.coords.longitude, + position.coords.latitude + ], zoom: 17, bearing: 0, pitch: 0 }); + this.fire('geolocate', position); this._finish(); }, - - _error: function() { + _error: function (error) { + this.fire('error', error); this._finish(); }, - - _finish: function() { - if (this._timeoutId) { clearTimeout(this._timeoutId); } + _finish: function () { + if (this._timeoutId) { + clearTimeout(this._timeoutId); + } this._timeoutId = undefined; } - }); - - -},{"../../util/browser":335,"../../util/dom":338,"../../util/util":349,"./control":319}],321:[function(require,module,exports){ +},{"../../util/browser":350,"../../util/dom":352,"../../util/util":366,"./control":334}],336:[function(require,module,exports){ 'use strict'; - var Control = require('./control'); var DOM = require('../../util/dom'); var util = require('../../util/util'); - module.exports = Navigation; - -/** - * Creates a navigation control with zoom buttons and a compass - * @class Navigation - * @param {Object} [options] - * @param {string} [options.position='top-right'] A string indicating the control's position on the map. Options are `top-right`, `top-left`, `bottom-right`, `bottom-left` - * @example - * map.addControl(new mapboxgl.Navigation({position: 'top-left'})); // position is optional - */ function Navigation(options) { util.setOptions(this, options); } - Navigation.prototype = util.inherit(Control, { - options: { - position: 'top-right' - }, - - onAdd: function(map) { + options: { position: 'top-right' }, + onAdd: function (map) { var className = 'mapboxgl-ctrl'; - var container = this._container = DOM.create('div', className + '-group', map.getContainer()); this._container.addEventListener('contextmenu', this._onContextMenu.bind(this)); - this._zoomInButton = this._createButton(className + '-icon ' + className + '-zoom-in', map.zoomIn.bind(map)); this._zoomOutButton = this._createButton(className + '-icon ' + className + '-zoom-out', map.zoomOut.bind(map)); this._compass = this._createButton(className + '-icon ' + className + '-compass', map.resetNorth.bind(map)); - this._compassArrow = DOM.create('div', 'arrow', this._compass); - this._compass.addEventListener('mousedown', this._onCompassDown.bind(this)); this._onCompassMove = this._onCompassMove.bind(this); this._onCompassUp = this._onCompassUp.bind(this); - map.on('rotate', this._rotateCompassArrow.bind(this)); this._rotateCompassArrow(); - this._el = map.getCanvasContainer(); - return container; }, - - _onContextMenu: function(e) { + _onContextMenu: function (e) { e.preventDefault(); }, - - _onCompassDown: function(e) { - if (e.button !== 0) return; - + _onCompassDown: function (e) { + if (e.button !== 0) + return; DOM.disableDrag(); document.addEventListener('mousemove', this._onCompassMove); document.addEventListener('mouseup', this._onCompassUp); - this._el.dispatchEvent(copyMouseEvent(e)); e.stopPropagation(); }, - - _onCompassMove: function(e) { - if (e.button !== 0) return; - + _onCompassMove: function (e) { + if (e.button !== 0) + return; this._el.dispatchEvent(copyMouseEvent(e)); e.stopPropagation(); }, - - _onCompassUp: function(e) { - if (e.button !== 0) return; - + _onCompassUp: function (e) { + if (e.button !== 0) + return; document.removeEventListener('mousemove', this._onCompassMove); document.removeEventListener('mouseup', this._onCompassUp); DOM.enableDrag(); - this._el.dispatchEvent(copyMouseEvent(e)); e.stopPropagation(); }, - - _createButton: function(className, fn) { + _createButton: function (className, fn) { var a = DOM.create('button', className, this._container); - a.addEventListener('click', function() { fn(); }); + a.type = 'button'; + a.addEventListener('click', function () { + fn(); + }); return a; }, - - _rotateCompassArrow: function() { - var rotate = 'rotate(' + (this._map.transform.angle * (180 / Math.PI)) + 'deg)'; + _rotateCompassArrow: function () { + var rotate = 'rotate(' + this._map.transform.angle * (180 / Math.PI) + 'deg)'; this._compassArrow.style.transform = rotate; } }); - - function copyMouseEvent(e) { return new MouseEvent(e.type, { - button: 2, // right click - buttons: 2, // right click + button: 2, + buttons: 2, bubbles: true, cancelable: true, detail: e.detail, @@ -55001,314 +55867,161 @@ function copyMouseEvent(e) { metaKey: e.metaKey }); } - - -},{"../../util/dom":338,"../../util/util":349,"./control":319}],322:[function(require,module,exports){ +},{"../../util/dom":352,"../../util/util":366,"./control":334}],337:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - LngLatBounds = require('../../geo/lng_lat_bounds'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), LngLatBounds = require('../../geo/lng_lat_bounds'), util = require('../../util/util'); module.exports = BoxZoomHandler; - -/** - * The `BoxZoomHandler` allows a user to zoom the map to fit a bounding box. - * The bounding box is defined by holding `shift` while dragging the cursor. - * @class BoxZoomHandler - */ function BoxZoomHandler(map) { this._map = map; this._el = map.getCanvasContainer(); this._container = map.getContainer(); - util.bindHandlers(this); } - BoxZoomHandler.prototype = { - _enabled: false, _active: false, - - /** - * Returns the current enabled/disabled state of the "box zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Returns true if the "box zoom" interaction is currently active, i.e. currently being used. - * @returns {boolean} active state - */ isActive: function () { return this._active; }, - - /** - * Enable the "box zoom" interaction. - * @example - * map.boxZoom.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('mousedown', this._onMouseDown, false); this._enabled = true; }, - - /** - * Disable the "box zoom" interaction. - * @example - * map.boxZoom.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('mousedown', this._onMouseDown); this._enabled = false; }, - _onMouseDown: function (e) { - if (!(e.shiftKey && e.button === 0)) return; - + if (!(e.shiftKey && e.button === 0)) + return; document.addEventListener('mousemove', this._onMouseMove, false); document.addEventListener('keydown', this._onKeyDown, false); document.addEventListener('mouseup', this._onMouseUp, false); - DOM.disableDrag(); this._startPos = DOM.mousePos(this._el, e); this._active = true; }, - _onMouseMove: function (e) { - var p0 = this._startPos, - p1 = DOM.mousePos(this._el, e); - + var p0 = this._startPos, p1 = DOM.mousePos(this._el, e); if (!this._box) { this._box = DOM.create('div', 'mapboxgl-boxzoom', this._container); this._container.classList.add('mapboxgl-crosshair'); this._fireEvent('boxzoomstart', e); } - - var minX = Math.min(p0.x, p1.x), - maxX = Math.max(p0.x, p1.x), - minY = Math.min(p0.y, p1.y), - maxY = Math.max(p0.y, p1.y); - + var minX = Math.min(p0.x, p1.x), maxX = Math.max(p0.x, p1.x), minY = Math.min(p0.y, p1.y), maxY = Math.max(p0.y, p1.y); DOM.setTransform(this._box, 'translate(' + minX + 'px,' + minY + 'px)'); - - this._box.style.width = (maxX - minX) + 'px'; - this._box.style.height = (maxY - minY) + 'px'; + this._box.style.width = maxX - minX + 'px'; + this._box.style.height = maxY - minY + 'px'; }, - _onMouseUp: function (e) { - if (e.button !== 0) return; - - var p0 = this._startPos, - p1 = DOM.mousePos(this._el, e), - bounds = new LngLatBounds(this._map.unproject(p0), this._map.unproject(p1)); - + if (e.button !== 0) + return; + var p0 = this._startPos, p1 = DOM.mousePos(this._el, e), bounds = new LngLatBounds(this._map.unproject(p0), this._map.unproject(p1)); this._finish(); - if (p0.x === p1.x && p0.y === p1.y) { this._fireEvent('boxzoomcancel', e); } else { - this._map - .fitBounds(bounds, {linear: true}) - .fire('boxzoomend', { originalEvent: e, boxZoomBounds: bounds }); + this._map.fitBounds(bounds, { linear: true }).fire('boxzoomend', { + originalEvent: e, + boxZoomBounds: bounds + }); } }, - _onKeyDown: function (e) { if (e.keyCode === 27) { this._finish(); this._fireEvent('boxzoomcancel', e); } }, - _finish: function () { this._active = false; - document.removeEventListener('mousemove', this._onMouseMove, false); document.removeEventListener('keydown', this._onKeyDown, false); document.removeEventListener('mouseup', this._onMouseUp, false); - this._container.classList.remove('mapboxgl-crosshair'); - if (this._box) { this._box.parentNode.removeChild(this._box); this._box = null; } - DOM.enableDrag(); }, - _fireEvent: function (type, e) { return this._map.fire(type, { originalEvent: e }); } }; - - -/** - * Boxzoom start event. This event is emitted at the start of a box zoom interaction. - * - * @event boxzoomstart - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Boxzoom end event. This event is emitted at the end of a box zoom interaction - * - * @event boxzoomend - * @memberof Map - * @instance - * @type {Object} - * @property {Event} originalEvent the original DOM event - * @property {LngLatBounds} boxZoomBounds the bounds of the box zoom target - */ - -/** - * Boxzoom cancel event. This event is emitted when the user cancels a box zoom interaction, - * or when the box zoom does not meet the minimum size threshold. - * - * @event boxzoomcancel - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../../geo/lng_lat_bounds":257,"../../util/dom":338,"../../util/util":349}],323:[function(require,module,exports){ +},{"../../geo/lng_lat_bounds":264,"../../util/dom":352,"../../util/util":366}],338:[function(require,module,exports){ 'use strict'; - module.exports = DoubleClickZoomHandler; - -/** - * The `DoubleClickZoomHandler` allows a user to zoom the map around point by - * double clicking. - * @class DoubleClickZoomHandler - */ function DoubleClickZoomHandler(map) { this._map = map; this._onDblClick = this._onDblClick.bind(this); } - DoubleClickZoomHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of the "double click to zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the "double click to zoom" interaction. - * @example - * map.doubleClickZoom.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._map.on('dblclick', this._onDblClick); this._enabled = true; }, - - /** - * Disable the "double click to zoom" interaction. - * @example - * map.doubleClickZoom.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._map.off('dblclick', this._onDblClick); this._enabled = false; }, - _onDblClick: function (e) { - this._map.zoomTo(this._map.getZoom() + - (e.originalEvent.shiftKey ? -1 : 1), {around: e.lngLat}); + this._map.zoomTo(this._map.getZoom() + (e.originalEvent.shiftKey ? -1 : 1), { around: e.lngLat }, e); } }; - -},{}],324:[function(require,module,exports){ +},{}],339:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), util = require('../../util/util'); module.exports = DragPanHandler; - -var inertiaLinearity = 0.3, - inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), - inertiaMaxSpeed = 1400, // px/s - inertiaDeceleration = 2500; // px/s^2 - - -/** - * The `DragPanHandler` allows a user to pan the map by clicking and dragging - * the cursor. - * @class DragPanHandler - */ +var inertiaLinearity = 0.3, inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), inertiaMaxSpeed = 1400, inertiaDeceleration = 2500; function DragPanHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - util.bindHandlers(this); } - DragPanHandler.prototype = { - _enabled: false, _active: false, - - /** - * Returns the current enabled/disabled state of the "drag to pan" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Returns true if the "drag to pan" interaction is currently active, i.e. currently being used. - * @returns {boolean} active state - */ isActive: function () { return this._active; }, - - /** - * Enable the "drag to pan" interaction. - * @example - * map.dragPan.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('mousedown', this._onDown); this._el.addEventListener('touchstart', this._onDown); this._enabled = true; }, - - /** - * Disable the "drag to pan" interaction. - * @example - * map.dragPan.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('mousedown', this._onDown); this._el.removeEventListener('touchstart', this._onDown); this._enabled = false; }, - _onDown: function (e) { - if (this._ignoreEvent(e)) return; - if (this.isActive()) return; - + if (this._ignoreEvent(e)) + return; + if (this.isActive()) + return; if (e.touches) { document.addEventListener('touchmove', this._onMove); document.addEventListener('touchend', this._onTouchEnd); @@ -55316,469 +56029,272 @@ DragPanHandler.prototype = { document.addEventListener('mousemove', this._onMove); document.addEventListener('mouseup', this._onMouseUp); } - this._active = false; this._startPos = this._pos = DOM.mousePos(this._el, e); - this._inertia = [[Date.now(), this._pos]]; + this._inertia = [[ + Date.now(), + this._pos + ]]; }, - _onMove: function (e) { - if (this._ignoreEvent(e)) return; - + if (this._ignoreEvent(e)) + return; if (!this.isActive()) { this._active = true; this._fireEvent('dragstart', e); this._fireEvent('movestart', e); } - - var pos = DOM.mousePos(this._el, e), - map = this._map; - + var pos = DOM.mousePos(this._el, e), map = this._map; map.stop(); this._drainInertiaBuffer(); - this._inertia.push([Date.now(), pos]); - + this._inertia.push([ + Date.now(), + pos + ]); map.transform.setLocationAtPoint(map.transform.pointLocation(this._pos), pos); - this._fireEvent('drag', e); this._fireEvent('move', e); - this._pos = pos; - e.preventDefault(); }, - _onUp: function (e) { - if (!this.isActive()) return; - + if (!this.isActive()) + return; this._active = false; this._fireEvent('dragend', e); this._drainInertiaBuffer(); - - var finish = function() { + var finish = function () { this._fireEvent('moveend', e); }.bind(this); - var inertia = this._inertia; if (inertia.length < 2) { finish(); return; } - - var last = inertia[inertia.length - 1], - first = inertia[0], - flingOffset = last[1].sub(first[1]), - flingDuration = (last[0] - first[0]) / 1000; - + var last = inertia[inertia.length - 1], first = inertia[0], flingOffset = last[1].sub(first[1]), flingDuration = (last[0] - first[0]) / 1000; if (flingDuration === 0 || last[1].equals(first[1])) { finish(); return; } - - // calculate px/s velocity & adjust for increased initial animation speed when easing out - var velocity = flingOffset.mult(inertiaLinearity / flingDuration), - speed = velocity.mag(); // px/s - + var velocity = flingOffset.mult(inertiaLinearity / flingDuration), speed = velocity.mag(); if (speed > inertiaMaxSpeed) { speed = inertiaMaxSpeed; velocity._unit()._mult(speed); } - - var duration = speed / (inertiaDeceleration * inertiaLinearity), - offset = velocity.mult(-duration / 2); - + var duration = speed / (inertiaDeceleration * inertiaLinearity), offset = velocity.mult(-duration / 2); this._map.panBy(offset, { duration: duration * 1000, easing: inertiaEasing, noMoveStart: true }, { originalEvent: e }); }, - _onMouseUp: function (e) { - if (this._ignoreEvent(e)) return; + if (this._ignoreEvent(e)) + return; this._onUp(e); document.removeEventListener('mousemove', this._onMove); document.removeEventListener('mouseup', this._onMouseUp); }, - _onTouchEnd: function (e) { - if (this._ignoreEvent(e)) return; + if (this._ignoreEvent(e)) + return; this._onUp(e); document.removeEventListener('touchmove', this._onMove); document.removeEventListener('touchend', this._onTouchEnd); }, - _fireEvent: function (type, e) { return this._map.fire(type, { originalEvent: e }); }, - _ignoreEvent: function (e) { var map = this._map; - - if (map.boxZoom && map.boxZoom.isActive()) return true; - if (map.dragRotate && map.dragRotate.isActive()) return true; + if (map.boxZoom && map.boxZoom.isActive()) + return true; + if (map.dragRotate && map.dragRotate.isActive()) + return true; if (e.touches) { - return (e.touches.length > 1); + return e.touches.length > 1; } else { - if (e.ctrlKey) return true; - var buttons = 1, // left button - button = 0; // left button - return (e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button); + if (e.ctrlKey) + return true; + var buttons = 1, button = 0; + return e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button; } }, - _drainInertiaBuffer: function () { - var inertia = this._inertia, - now = Date.now(), - cutoff = 160; // msec - - while (inertia.length > 0 && now - inertia[0][0] > cutoff) inertia.shift(); + var inertia = this._inertia, now = Date.now(), cutoff = 160; + while (inertia.length > 0 && now - inertia[0][0] > cutoff) + inertia.shift(); } }; - - -/** - * Drag start event. This event is emitted at the start of a user-initiated pan interaction. - * - * @event dragstart - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Drag event. This event is emitted repeatedly during a user-initiated pan interaction. - * - * @event drag - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Drag end event. This event is emitted at the end of a user-initiated pan interaction. - * - * @event dragend - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../../util/dom":338,"../../util/util":349}],325:[function(require,module,exports){ +},{"../../util/dom":352,"../../util/util":366}],340:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - Point = require('point-geometry'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), Point = require('point-geometry'), util = require('../../util/util'); module.exports = DragRotateHandler; - -var inertiaLinearity = 0.25, - inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), - inertiaMaxSpeed = 180, // deg/s - inertiaDeceleration = 720; // deg/s^2 - - -/** - * The `DragRotateHandler` allows a user to rotate the map by clicking and - * dragging the cursor while holding the right mouse button or the `ctrl` key. - * @class DragRotateHandler - */ -function DragRotateHandler(map) { +var inertiaLinearity = 0.25, inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), inertiaMaxSpeed = 180, inertiaDeceleration = 720; +function DragRotateHandler(map, options) { this._map = map; this._el = map.getCanvasContainer(); - + this._bearingSnap = options.bearingSnap; util.bindHandlers(this); } - DragRotateHandler.prototype = { - _enabled: false, _active: false, - - /** - * Returns the current enabled/disabled state of the "drag to rotate" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Returns true if the "drag to rotate" interaction is currently active, i.e. currently being used. - * @returns {boolean} active state - */ isActive: function () { return this._active; }, - - /** - * Enable the "drag to rotate" interaction. - * @example - * map.dragRotate.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('mousedown', this._onDown); this._enabled = true; }, - - /** - * Disable the "drag to rotate" interaction. - * @example - * map.dragRotate.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('mousedown', this._onDown); this._enabled = false; }, - _onDown: function (e) { - if (this._ignoreEvent(e)) return; - if (this.isActive()) return; - + if (this._ignoreEvent(e)) + return; + if (this.isActive()) + return; document.addEventListener('mousemove', this._onMove); document.addEventListener('mouseup', this._onUp); - this._active = false; - this._inertia = [[Date.now(), this._map.getBearing()]]; + this._inertia = [[ + Date.now(), + this._map.getBearing() + ]]; this._startPos = this._pos = DOM.mousePos(this._el, e); - this._center = this._map.transform.centerPoint; // Center of rotation - - // If the first click was too close to the center, move the center of rotation by 200 pixels - // in the direction of the click. - var startToCenter = this._startPos.sub(this._center), - startToCenterDist = startToCenter.mag(); - + this._center = this._map.transform.centerPoint; + var startToCenter = this._startPos.sub(this._center), startToCenterDist = startToCenter.mag(); if (startToCenterDist < 200) { this._center = this._startPos.add(new Point(-200, 0)._rotate(startToCenter.angle())); } - e.preventDefault(); }, - _onMove: function (e) { - if (this._ignoreEvent(e)) return; - + if (this._ignoreEvent(e)) + return; if (!this.isActive()) { this._active = true; this._fireEvent('rotatestart', e); this._fireEvent('movestart', e); } - var map = this._map; map.stop(); - - var p1 = this._pos, - p2 = DOM.mousePos(this._el, e), - center = this._center, - bearingDiff = p1.sub(center).angleWith(p2.sub(center)) / Math.PI * 180, - bearing = map.getBearing() - bearingDiff, - inertia = this._inertia, - last = inertia[inertia.length - 1]; - + var p1 = this._pos, p2 = DOM.mousePos(this._el, e), center = this._center, bearingDiff = p1.sub(center).angleWith(p2.sub(center)) / Math.PI * 180, bearing = map.getBearing() - bearingDiff, inertia = this._inertia, last = inertia[inertia.length - 1]; this._drainInertiaBuffer(); - inertia.push([Date.now(), map._normalizeBearing(bearing, last[1])]); - + inertia.push([ + Date.now(), + map._normalizeBearing(bearing, last[1]) + ]); map.transform.bearing = bearing; - this._fireEvent('rotate', e); this._fireEvent('move', e); - this._pos = p2; }, - _onUp: function (e) { - if (this._ignoreEvent(e)) return; + if (this._ignoreEvent(e)) + return; document.removeEventListener('mousemove', this._onMove); document.removeEventListener('mouseup', this._onUp); - - if (!this.isActive()) return; - + if (!this.isActive()) + return; this._active = false; this._fireEvent('rotateend', e); this._drainInertiaBuffer(); - - var map = this._map, - mapBearing = map.getBearing(), - inertia = this._inertia; - - var finish = function() { - if (Math.abs(mapBearing) < map.options.bearingSnap) { - map.resetNorth({noMoveStart: true}, { originalEvent: e }); + var map = this._map, mapBearing = map.getBearing(), inertia = this._inertia; + var finish = function () { + if (Math.abs(mapBearing) < this._bearingSnap) { + map.resetNorth({ noMoveStart: true }, { originalEvent: e }); } else { this._fireEvent('moveend', e); } }.bind(this); - if (inertia.length < 2) { finish(); return; } - - var first = inertia[0], - last = inertia[inertia.length - 1], - previous = inertia[inertia.length - 2], - bearing = map._normalizeBearing(mapBearing, previous[1]), - flingDiff = last[1] - first[1], - sign = flingDiff < 0 ? -1 : 1, - flingDuration = (last[0] - first[0]) / 1000; - + var first = inertia[0], last = inertia[inertia.length - 1], previous = inertia[inertia.length - 2], bearing = map._normalizeBearing(mapBearing, previous[1]), flingDiff = last[1] - first[1], sign = flingDiff < 0 ? -1 : 1, flingDuration = (last[0] - first[0]) / 1000; if (flingDiff === 0 || flingDuration === 0) { finish(); return; } - - var speed = Math.abs(flingDiff * (inertiaLinearity / flingDuration)); // deg/s + var speed = Math.abs(flingDiff * (inertiaLinearity / flingDuration)); if (speed > inertiaMaxSpeed) { speed = inertiaMaxSpeed; } - - var duration = speed / (inertiaDeceleration * inertiaLinearity), - offset = sign * speed * (duration / 2); - + var duration = speed / (inertiaDeceleration * inertiaLinearity), offset = sign * speed * (duration / 2); bearing += offset; - - if (Math.abs(map._normalizeBearing(bearing, 0)) < map.options.bearingSnap) { + if (Math.abs(map._normalizeBearing(bearing, 0)) < this._bearingSnap) { bearing = map._normalizeBearing(0, bearing); } - map.rotateTo(bearing, { duration: duration * 1000, easing: inertiaEasing, noMoveStart: true }, { originalEvent: e }); }, - _fireEvent: function (type, e) { return this._map.fire(type, { originalEvent: e }); }, - _ignoreEvent: function (e) { var map = this._map; - - if (map.boxZoom && map.boxZoom.isActive()) return true; - if (map.dragPan && map.dragPan.isActive()) return true; + if (map.boxZoom && map.boxZoom.isActive()) + return true; + if (map.dragPan && map.dragPan.isActive()) + return true; if (e.touches) { - return (e.touches.length > 1); + return e.touches.length > 1; } else { - var buttons = (e.ctrlKey ? 1 : 2), // ? ctrl+left button : right button - button = (e.ctrlKey ? 0 : 2); // ? ctrl+left button : right button - return (e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button); + var buttons = e.ctrlKey ? 1 : 2, button = e.ctrlKey ? 0 : 2; + return e.type === 'mousemove' ? e.buttons & buttons === 0 : e.button !== button; } }, - _drainInertiaBuffer: function () { - var inertia = this._inertia, - now = Date.now(), - cutoff = 160; //msec - + var inertia = this._inertia, now = Date.now(), cutoff = 160; while (inertia.length > 0 && now - inertia[0][0] > cutoff) inertia.shift(); } - }; - - -/** - * Rotate start event. This event is emitted at the start of a user-initiated rotate interaction. - * - * @event rotatestart - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Rotate event. This event is emitted repeatedly during a user-initiated rotate interaction. - * - * @event rotate - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Rotate end event. This event is emitted at the end of a user-initiated rotate interaction. - * - * @event rotateend - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -},{"../../util/dom":338,"../../util/util":349,"point-geometry":404}],326:[function(require,module,exports){ +},{"../../util/dom":352,"../../util/util":366,"point-geometry":424}],341:[function(require,module,exports){ 'use strict'; - module.exports = KeyboardHandler; - - -var panDelta = 80, - rotateDelta = 2, - pitchDelta = 5; - -/** - * The `KeyboardHandler` allows a user to zoom, rotate, and pan the map using - * following keyboard shortcuts: - * * `=` / `+`: increase zoom level by 1 - * * `Shift-=` / `Shift-+`: increase zoom level by 2 - * * `-`: decrease zoom level by 1 - * * `Shift--`: decrease zoom level by 2 - * * Arrow keys: pan by 80 pixels - * * `Shift+⇢`: increase rotation by 2 degrees - * * `Shift+⇠`: decrease rotation by 2 degrees - * * `Shift+⇡`: increase pitch by 5 degrees - * * `Shift+⇣`: decrease pitch by 5 degrees - * @class KeyboardHandler - */ +var panDelta = 80, rotateDelta = 2, pitchDelta = 5; function KeyboardHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - this._onKeyDown = this._onKeyDown.bind(this); } - KeyboardHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of keyboard interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the ability to interact with the map using keyboard input. - * @example - * map.keyboard.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('keydown', this._onKeyDown, false); this._enabled = true; }, - - /** - * Disable the ability to interact with the map using keyboard input. - * @example - * map.keyboard.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('keydown', this._onKeyDown); this._enabled = false; }, - _onKeyDown: function (e) { - if (e.altKey || e.ctrlKey || e.metaKey) return; - - var map = this._map, - eventData = { originalEvent: e }; - + if (e.altKey || e.ctrlKey || e.metaKey) + return; + var map = this._map, eventData = { originalEvent: e }; + if (map.isEasing()) + return; switch (e.keyCode) { case 61: case 107: @@ -55786,191 +56302,138 @@ KeyboardHandler.prototype = { case 187: map.zoomTo(Math.round(map.getZoom()) + (e.shiftKey ? 2 : 1), eventData); break; - case 189: case 109: case 173: map.zoomTo(Math.round(map.getZoom()) - (e.shiftKey ? 2 : 1), eventData); break; - case 37: if (e.shiftKey) { map.easeTo({ bearing: map.getBearing() - rotateDelta }, eventData); } else { e.preventDefault(); - map.panBy([-panDelta, 0], eventData); + map.panBy([ + -panDelta, + 0 + ], eventData); } break; - case 39: if (e.shiftKey) { map.easeTo({ bearing: map.getBearing() + rotateDelta }, eventData); } else { e.preventDefault(); - map.panBy([panDelta, 0], eventData); + map.panBy([ + panDelta, + 0 + ], eventData); } break; - case 38: if (e.shiftKey) { map.easeTo({ pitch: map.getPitch() + pitchDelta }, eventData); } else { e.preventDefault(); - map.panBy([0, -panDelta], eventData); + map.panBy([ + 0, + -panDelta + ], eventData); } break; - case 40: if (e.shiftKey) { map.easeTo({ pitch: Math.max(map.getPitch() - pitchDelta, 0) }, eventData); } else { e.preventDefault(); - map.panBy([0, panDelta], eventData); + map.panBy([ + 0, + panDelta + ], eventData); } break; } } }; - -},{}],327:[function(require,module,exports){ +},{}],342:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - browser = require('../../util/browser'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), browser = require('../../util/browser'), util = require('../../util/util'); module.exports = ScrollZoomHandler; - - -var ua = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase() : '', - firefox = ua.indexOf('firefox') !== -1, - safari = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') === -1; - - -/** - * The `ScrollZoomHandler` allows a user to zoom the map by scrolling. - * @class ScrollZoomHandler - */ +var ua = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase() : '', firefox = ua.indexOf('firefox') !== -1, safari = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') === -1; function ScrollZoomHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - util.bindHandlers(this); } - ScrollZoomHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of the "scroll to zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the "scroll to zoom" interaction. - * @example - * map.scrollZoom.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('wheel', this._onWheel, false); this._el.addEventListener('mousewheel', this._onWheel, false); this._enabled = true; }, - - /** - * Disable the "scroll to zoom" interaction. - * @example - * map.scrollZoom.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('wheel', this._onWheel); this._el.removeEventListener('mousewheel', this._onWheel); this._enabled = false; }, - _onWheel: function (e) { var value; - if (e.type === 'wheel') { value = e.deltaY; - // Firefox doubles the values on retina screens... - if (firefox && e.deltaMode === window.WheelEvent.DOM_DELTA_PIXEL) value /= browser.devicePixelRatio; - if (e.deltaMode === window.WheelEvent.DOM_DELTA_LINE) value *= 40; - + if (firefox && e.deltaMode === window.WheelEvent.DOM_DELTA_PIXEL) + value /= browser.devicePixelRatio; + if (e.deltaMode === window.WheelEvent.DOM_DELTA_LINE) + value *= 40; } else if (e.type === 'mousewheel') { value = -e.wheelDeltaY; - if (safari) value = value / 3; + if (safari) + value = value / 3; } - - var now = browser.now(), - timeDelta = now - (this._time || 0); - + var now = browser.now(), timeDelta = now - (this._time || 0); this._pos = DOM.mousePos(this._el, e); this._time = now; - - if (value !== 0 && (value % 4.000244140625) === 0) { - // This one is definitely a mouse wheel event. + if (value !== 0 && value % 4.000244140625 === 0) { this._type = 'wheel'; - // Normalize this value to match trackpad. value = Math.floor(value / 4); - } else if (value !== 0 && Math.abs(value) < 4) { - // This one is definitely a trackpad event because it is so small. this._type = 'trackpad'; - } else if (timeDelta > 400) { - // This is likely a new scroll action. this._type = null; this._lastValue = value; - - // Start a timeout in case this was a singular event, and dely it by up to 40ms. this._timeout = setTimeout(this._onTimeout, 40); - } else if (!this._type) { - // This is a repeating event, but we don't know the type of event just yet. - // If the delta per time is small, we assume it's a fast trackpad; otherwise we switch into wheel mode. - this._type = (Math.abs(timeDelta * value) < 200) ? 'trackpad' : 'wheel'; - - // Make sure our delayed event isn't fired again, because we accumulate - // the previous event (which was less than 40ms ago) into this event. + this._type = Math.abs(timeDelta * value) < 200 ? 'trackpad' : 'wheel'; if (this._timeout) { clearTimeout(this._timeout); this._timeout = null; value += this._lastValue; } } - - // Slow down zoom if shift key is held for more precise zooming - if (e.shiftKey && value) value = value / 4; - - // Only fire the callback if we actually know what type of scrolling device the user uses. - if (this._type) this._zoom(-value, e); - + if (e.shiftKey && value) + value = value / 4; + if (this._type) + this._zoom(-value, e); e.preventDefault(); }, - _onTimeout: function () { this._type = 'wheel'; this._zoom(-this._lastValue); }, - _zoom: function (delta, e) { - if (delta === 0) return; + if (delta === 0) + return; var map = this._map; - - // Scale by sigmoid of scroll wheel delta. var scale = 2 / (1 + Math.exp(-Math.abs(delta / 100))); - if (delta < 0 && scale !== 0) scale = 1 / scale; - - var fromScale = map.ease ? map.ease.to : map.transform.scale, - targetZoom = map.transform.scaleZoom(fromScale * scale); - + if (delta < 0 && scale !== 0) + scale = 1 / scale; + var fromScale = map.ease ? map.ease.to : map.transform.scale, targetZoom = map.transform.scaleZoom(fromScale * scale); map.zoomTo(targetZoom, { duration: 0, around: map.unproject(this._pos), @@ -55978,215 +56441,104 @@ ScrollZoomHandler.prototype = { }, { originalEvent: e }); } }; - - -/** - * Zoom start event. This event is emitted just before the map begins a transition from one - * zoom level to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event zoomstart - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Zoom event. This event is emitted repeatedly during animated transitions from one zoom level to - * another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event zoom - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Zoom end event. This event is emitted just after the map completes a transition from one - * zoom level to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event zoomend - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -},{"../../util/browser":335,"../../util/dom":338,"../../util/util":349}],328:[function(require,module,exports){ +},{"../../util/browser":350,"../../util/dom":352,"../../util/util":366}],343:[function(require,module,exports){ 'use strict'; - -var DOM = require('../../util/dom'), - util = require('../../util/util'); - +var DOM = require('../../util/dom'), util = require('../../util/util'); module.exports = TouchZoomRotateHandler; - -var inertiaLinearity = 0.15, - inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), - inertiaDeceleration = 12, // scale / s^2 - inertiaMaxSpeed = 2.5, // scale / s - significantScaleThreshold = 0.15, - significantRotateThreshold = 4; - - -/** - * The `TouchZoomRotateHandler` allows a user to zoom and rotate the map by - * pinching on a touchscreen. - * @class TouchZoomRotateHandler - */ +var inertiaLinearity = 0.15, inertiaEasing = util.bezier(0, 0, inertiaLinearity, 1), inertiaDeceleration = 12, inertiaMaxSpeed = 2.5, significantScaleThreshold = 0.15, significantRotateThreshold = 4; function TouchZoomRotateHandler(map) { this._map = map; this._el = map.getCanvasContainer(); - util.bindHandlers(this); } - TouchZoomRotateHandler.prototype = { - _enabled: false, - - /** - * Returns the current enabled/disabled state of the "pinch to rotate and zoom" interaction. - * @returns {boolean} enabled state - */ isEnabled: function () { return this._enabled; }, - - /** - * Enable the "pinch to rotate and zoom" interaction. - * @example - * map.touchZoomRotate.enable(); - */ enable: function () { - if (this.isEnabled()) return; + if (this.isEnabled()) + return; this._el.addEventListener('touchstart', this._onStart, false); this._enabled = true; }, - - /** - * Disable the "pinch to rotate and zoom" interaction. - * @example - * map.touchZoomRotate.disable(); - */ disable: function () { - if (!this.isEnabled()) return; + if (!this.isEnabled()) + return; this._el.removeEventListener('touchstart', this._onStart); this._enabled = false; }, - - /** - * Disable the "pinch to rotate" interaction, leaving the "pinch to zoom" - * interaction enabled. - * @example - * map.touchZoomRotate.disableRotation(); - */ - disableRotation: function() { + disableRotation: function () { this._rotationDisabled = true; }, - - /** - * Enable the "pinch to rotate" interaction, undoing a call to - * `disableRotation`. - * @example - * map.touchZoomRotate.enable(); - * map.touchZoomRotate.enableRotation(); - */ - enableRotation: function() { + enableRotation: function () { this._rotationDisabled = false; }, - _onStart: function (e) { - if (e.touches.length !== 2) return; - - var p0 = DOM.mousePos(this._el, e.touches[0]), - p1 = DOM.mousePos(this._el, e.touches[1]); - + if (e.touches.length !== 2) + return; + var p0 = DOM.mousePos(this._el, e.touches[0]), p1 = DOM.mousePos(this._el, e.touches[1]); this._startVec = p0.sub(p1); this._startScale = this._map.transform.scale; this._startBearing = this._map.transform.bearing; this._gestureIntent = undefined; this._inertia = []; - document.addEventListener('touchmove', this._onMove, false); document.addEventListener('touchend', this._onEnd, false); }, - _onMove: function (e) { - if (e.touches.length !== 2) return; - - var p0 = DOM.mousePos(this._el, e.touches[0]), - p1 = DOM.mousePos(this._el, e.touches[1]), - p = p0.add(p1).div(2), - vec = p0.sub(p1), - scale = vec.mag() / this._startVec.mag(), - bearing = this._rotationDisabled ? 0 : vec.angleWith(this._startVec) * 180 / Math.PI, - map = this._map; - - // Determine 'intent' by whichever threshold is surpassed first, - // then keep that state for the duration of this gesture. + if (e.touches.length !== 2) + return; + var p0 = DOM.mousePos(this._el, e.touches[0]), p1 = DOM.mousePos(this._el, e.touches[1]), p = p0.add(p1).div(2), vec = p0.sub(p1), scale = vec.mag() / this._startVec.mag(), bearing = this._rotationDisabled ? 0 : vec.angleWith(this._startVec) * 180 / Math.PI, map = this._map; if (!this._gestureIntent) { - var scalingSignificantly = (Math.abs(1 - scale) > significantScaleThreshold), - rotatingSignificantly = (Math.abs(bearing) > significantRotateThreshold); - + var scalingSignificantly = Math.abs(1 - scale) > significantScaleThreshold, rotatingSignificantly = Math.abs(bearing) > significantRotateThreshold; if (rotatingSignificantly) { this._gestureIntent = 'rotate'; } else if (scalingSignificantly) { this._gestureIntent = 'zoom'; } - if (this._gestureIntent) { this._startVec = vec; this._startScale = map.transform.scale; this._startBearing = map.transform.bearing; } - } else { - var param = { duration: 0, around: map.unproject(p) }; - + var param = { + duration: 0, + around: map.unproject(p) + }; if (this._gestureIntent === 'rotate') { param.bearing = this._startBearing + bearing; } if (this._gestureIntent === 'zoom' || this._gestureIntent === 'rotate') { param.zoom = map.transform.scaleZoom(this._startScale * scale); } - map.stop(); this._drainInertiaBuffer(); - this._inertia.push([Date.now(), scale, p]); - + this._inertia.push([ + Date.now(), + scale, + p + ]); map.easeTo(param, { originalEvent: e }); } - e.preventDefault(); }, - _onEnd: function (e) { document.removeEventListener('touchmove', this._onMove); document.removeEventListener('touchend', this._onEnd); this._drainInertiaBuffer(); - - var inertia = this._inertia, - map = this._map; - + var inertia = this._inertia, map = this._map; if (inertia.length < 2) { map.snapToNorth({}, { originalEvent: e }); return; } - - var last = inertia[inertia.length - 1], - first = inertia[0], - lastScale = map.transform.scaleZoom(this._startScale * last[1]), - firstScale = map.transform.scaleZoom(this._startScale * first[1]), - scaleOffset = lastScale - firstScale, - scaleDuration = (last[0] - first[0]) / 1000, - p = last[2]; - + var last = inertia[inertia.length - 1], first = inertia[0], lastScale = map.transform.scaleZoom(this._startScale * last[1]), firstScale = map.transform.scaleZoom(this._startScale * first[1]), scaleOffset = lastScale - firstScale, scaleDuration = (last[0] - first[0]) / 1000, p = last[2]; if (scaleDuration === 0 || lastScale === firstScale) { map.snapToNorth({}, { originalEvent: e }); return; } - - // calculate scale/s speed and adjust for increased initial animation speed when easing - var speed = scaleOffset * inertiaLinearity / scaleDuration; // scale/s - + var speed = scaleOffset * inertiaLinearity / scaleDuration; if (Math.abs(speed) > inertiaMaxSpeed) { if (speed > 0) { speed = inertiaMaxSpeed; @@ -56194,14 +56546,10 @@ TouchZoomRotateHandler.prototype = { speed = -inertiaMaxSpeed; } } - - var duration = Math.abs(speed / (inertiaDeceleration * inertiaLinearity)) * 1000, - targetScale = lastScale + speed * duration / 2000; - + var duration = Math.abs(speed / (inertiaDeceleration * inertiaLinearity)) * 1000, targetScale = lastScale + speed * duration / 2000; if (targetScale < 0) { targetScale = 0; } - map.easeTo({ zoom: targetScale, duration: duration, @@ -56209,68 +56557,43 @@ TouchZoomRotateHandler.prototype = { around: map.unproject(p) }, { originalEvent: e }); }, - - _drainInertiaBuffer: function() { - var inertia = this._inertia, - now = Date.now(), - cutoff = 160; // msec - - while (inertia.length > 2 && now - inertia[0][0] > cutoff) inertia.shift(); + _drainInertiaBuffer: function () { + var inertia = this._inertia, now = Date.now(), cutoff = 160; + while (inertia.length > 2 && now - inertia[0][0] > cutoff) + inertia.shift(); } }; - -},{"../../util/dom":338,"../../util/util":349}],329:[function(require,module,exports){ +},{"../../util/dom":352,"../../util/util":366}],344:[function(require,module,exports){ 'use strict'; - -/* - * Adds the map's position to its page's location hash. - * Passed as an option to the map object. - * - * @class mapboxgl.Hash - * @returns {Hash} `this` - */ module.exports = Hash; - var util = require('../util/util'); - function Hash() { util.bindAll([ '_onHashChange', '_updateHash' ], this); } - Hash.prototype = { - /* - * Map element to listen for coordinate changes - * - * @param {Object} map - * @returns {Hash} `this` - */ - addTo: function(map) { + addTo: function (map) { this._map = map; window.addEventListener('hashchange', this._onHashChange, false); this._map.on('moveend', this._updateHash); return this; }, - - /* - * Removes hash - * - * @returns {Popup} `this` - */ - remove: function() { + remove: function () { window.removeEventListener('hashchange', this._onHashChange, false); this._map.off('moveend', this._updateHash); delete this._map; return this; }, - - _onHashChange: function() { + _onHashChange: function () { var loc = location.hash.replace('#', '').split('/'); if (loc.length >= 3) { this._map.jumpTo({ - center: [+loc[2], +loc[1]], + center: [ + +loc[2], + +loc[1] + ], zoom: +loc[0], bearing: +(loc[3] || 0) }); @@ -56278,437 +56601,79 @@ Hash.prototype = { } return false; }, - - _updateHash: function() { - var center = this._map.getCenter(), - zoom = this._map.getZoom(), - bearing = this._map.getBearing(), - precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)), - - hash = '#' + (Math.round(zoom * 100) / 100) + - '/' + center.lat.toFixed(precision) + - '/' + center.lng.toFixed(precision) + - (bearing ? '/' + (Math.round(bearing * 10) / 10) : ''); - + _updateHash: function () { + var center = this._map.getCenter(), zoom = this._map.getZoom(), bearing = this._map.getBearing(), precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)), hash = '#' + Math.round(zoom * 100) / 100 + '/' + center.lat.toFixed(precision) + '/' + center.lng.toFixed(precision) + (bearing ? '/' + Math.round(bearing * 10) / 10 : ''); window.history.replaceState('', '', hash); } }; - -},{"../util/util":349}],330:[function(require,module,exports){ -'use strict'; - -var handlers = { - scrollZoom: require('./handler/scroll_zoom'), - boxZoom: require('./handler/box_zoom'), - dragRotate: require('./handler/drag_rotate'), - dragPan: require('./handler/drag_pan'), - keyboard: require('./handler/keyboard'), - doubleClickZoom: require('./handler/dblclick_zoom'), - touchZoomRotate: require('./handler/touch_zoom_rotate') -}; - -var DOM = require('../util/dom'), - util = require('../util/util'), - Point = require('point-geometry'); - -module.exports = Interaction; - -function Interaction(map) { - this._map = map; - this._el = map.getCanvasContainer(); - - for (var name in handlers) { - map[name] = new handlers[name](map); - } - - util.bindHandlers(this); -} - -Interaction.prototype = { - enable: function () { - var options = this._map.options, - el = this._el; - - for (var name in handlers) { - if (options[name]) this._map[name].enable(); - } - - el.addEventListener('mousedown', this._onMouseDown, false); - el.addEventListener('mouseup', this._onMouseUp, false); - el.addEventListener('mousemove', this._onMouseMove, false); - el.addEventListener('touchstart', this._onTouchStart, false); - el.addEventListener('touchend', this._onTouchEnd, false); - el.addEventListener('touchmove', this._onTouchMove, false); - el.addEventListener('touchcancel', this._onTouchCancel, false); - el.addEventListener('click', this._onClick, false); - el.addEventListener('dblclick', this._onDblClick, false); - el.addEventListener('contextmenu', this._onContextMenu, false); - }, - - disable: function () { - var options = this._map.options, - el = this._el; - - for (var name in handlers) { - if (options[name]) this._map[name].disable(); - } - - el.removeEventListener('mousedown', this._onMouseDown); - el.removeEventListener('mouseup', this._onMouseUp); - el.removeEventListener('mousemove', this._onMouseMove); - el.removeEventListener('touchstart', this._onTouchStart); - el.removeEventListener('touchend', this._onTouchEnd); - el.removeEventListener('touchmove', this._onTouchMove); - el.removeEventListener('touchcancel', this._onTouchCancel); - el.removeEventListener('click', this._onClick); - el.removeEventListener('dblclick', this._onDblClick); - el.removeEventListener('contextmenu', this._onContextMenu); - }, - - _onMouseDown: function (e) { - this._map.stop(); - this._startPos = DOM.mousePos(this._el, e); - this._fireMouseEvent('mousedown', e); - }, - - _onMouseUp: function (e) { - var map = this._map, - rotating = map.dragRotate && map.dragRotate.isActive(); - - if (this._contextMenuEvent && !rotating) { - this._fireMouseEvent('contextmenu', this._contextMenuEvent); - } - - this._contextMenuEvent = null; - this._fireMouseEvent('mouseup', e); - }, - - _onMouseMove: function (e) { - var map = this._map, - el = this._el; - - if (map.dragPan && map.dragPan.isActive()) return; - if (map.dragRotate && map.dragRotate.isActive()) return; - - var target = e.toElement || e.target; - while (target && target !== el) target = target.parentNode; - if (target !== el) return; - - this._fireMouseEvent('mousemove', e); - }, - - _onTouchStart: function (e) { - this._map.stop(); - this._fireTouchEvent('touchstart', e); - - if (!e.touches || e.touches.length > 1) return; - - if (!this._tapped) { - this._tapped = setTimeout(this._onTouchTimeout, 300); - - } else { - clearTimeout(this._tapped); - this._tapped = null; - this._fireMouseEvent('dblclick', e); - } - }, - - _onTouchMove: function (e) { - this._fireTouchEvent('touchmove', e); - }, - - _onTouchEnd: function (e) { - this._fireTouchEvent('touchend', e); - }, - - _onTouchCancel: function (e) { - this._fireTouchEvent('touchcancel', e); - }, - - _onTouchTimeout: function () { - this._tapped = null; - }, - - _onClick: function (e) { - var pos = DOM.mousePos(this._el, e); - - if (pos.equals(this._startPos)) { - this._fireMouseEvent('click', e); - } - }, - - _onDblClick: function (e) { - this._fireMouseEvent('dblclick', e); - e.preventDefault(); - }, - - _onContextMenu: function (e) { - this._contextMenuEvent = e; - e.preventDefault(); - }, - - _fireMouseEvent: function (type, e) { - var pos = DOM.mousePos(this._el, e); - - return this._map.fire(type, { - lngLat: this._map.unproject(pos), - point: pos, - originalEvent: e - }); - }, - - _fireTouchEvent: function (type, e) { - var touches = DOM.touchPos(this._el, e), - singular = touches.reduce(function (prev, curr, i, arr) { - return prev.add(curr.div(arr.length)); - }, new Point(0, 0)); - - return this._map.fire(type, { - lngLat: this._map.unproject(singular), - point: singular, - lngLats: touches.map(function(t) { return this._map.unproject(t); }, this), - points: touches, - originalEvent: e - }); - } -}; - - -/** - * When an event [fires]{@link #Evented.fire} as a result of a - * user interaction, the event will be called with an EventData - * object containing the original DOM event along with coordinates of - * the event target. - * - * @typedef {Object} EventData - * @property {Event} originalEvent The original DOM event - * @property {Point} point The pixel location of the event - * @property {LngLat} lngLat The geographic location of the event - * @example - * map.on('click', function(data) { - * var e = data && data.originalEvent; - * console.log('got click ' + (e ? 'button = ' + e.button : '')); - * }); - */ - -/** - * Mouse down event. - * - * @event mousedown - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [mousedown event](https://developer.mozilla.org/en-US/docs/Web/Events/mousedown) - */ - -/** - * Mouse up event. - * - * @event mouseup - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [mouseup event](https://developer.mozilla.org/en-US/docs/Web/Events/mouseup) - */ - -/** - * Mouse move event. - * - * @event mousemove - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [mousemouse event](https://developer.mozilla.org/en-US/docs/Web/Events/mousemove) - */ - -/** - * Touch start event. - * - * @event touchstart - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchstart event](https://developer.mozilla.org/en-US/docs/Web/Events/touchstart). - */ - -/** - * Touch end event. - * - * @event touchend - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchcancel event](https://developer.mozilla.org/en-US/docs/Web/Events/touchcancel). - */ - -/** - * Touch move event. - * - * @event touchmove - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchmove event](https://developer.mozilla.org/en-US/docs/Web/Events/touchmove). - */ - -/** - * Touch cancel event. - * - * @event touchcancel - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [touchcancel event](https://developer.mozilla.org/en-US/docs/Web/Events/touchcancel). - */ - -/** - * Click event. - * - * @event click - * @memberof Map - * @instance - * @property {EventData} data Original event data: a [click event](https://developer.mozilla.org/en-US/docs/Web/Events/click) - */ - -/** - * Double click event. - * - * @event dblclick - * @memberof Map - * @instance - * @property {EventData} data Original event data - */ - -/** - * Context menu event. - * - * @event contextmenu - * @memberof Map - * @instance - * @property {EventData} data Original event data, if available - */ - -/** - * Load event. This event is emitted immediately after all necessary resources have been downloaded - * and the first visually complete rendering has occurred. - * - * @event load - * @memberof Map - * @instance - * @type {Object} - */ - -/** - * Move start event. This event is emitted just before the map begins a transition from one - * view to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event movestart - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Move event. This event is emitted repeatedly during animated transitions from one view to - * another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event move - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -/** - * Move end event. This event is emitted just after the map completes a transition from one - * view to another, either as a result of user interaction or the use of methods such as `Map#jumpTo`. - * - * @event moveend - * @memberof Map - * @instance - * @property {EventData} data Original event data, if fired interactively - */ - -},{"../util/dom":338,"../util/util":349,"./handler/box_zoom":322,"./handler/dblclick_zoom":323,"./handler/drag_pan":324,"./handler/drag_rotate":325,"./handler/keyboard":326,"./handler/scroll_zoom":327,"./handler/touch_zoom_rotate":328,"point-geometry":404}],331:[function(require,module,exports){ +},{"../util/util":366}],345:[function(require,module,exports){ 'use strict'; - var Canvas = require('../util/canvas'); var util = require('../util/util'); var browser = require('../util/browser'); +var window = require('../util/browser').window; var Evented = require('../util/evented'); var DOM = require('../util/dom'); - var Style = require('../style/style'); var AnimationLoop = require('../style/animation_loop'); var Painter = require('../render/painter'); - var Transform = require('../geo/transform'); var Hash = require('./hash'); - -var Interaction = require('./interaction'); - +var bindHandlers = require('./bind_handlers'); var Camera = require('./camera'); var LngLat = require('../geo/lng_lat'); var LngLatBounds = require('../geo/lng_lat_bounds'); var Point = require('point-geometry'); var Attribution = require('./control/attribution'); - var defaultMinZoom = 0; var defaultMaxZoom = 20; - -/** - * Creates a map instance. This is usually the beginning of your map: - * you tell Mapbox GL JS where to put the map by specifying a `container` - * option, and the map's style with `style` and other attributes of the map, - * and in return Mapbox GL JS initializes the map on your page and returns - * a map variable that lets you programmatically call methods on the map. - * @class Map - * @param {Object} options - * @param {string|Element} options.container HTML element to initialize the map in (or element id as string) - * @param {number} [options.minZoom=0] Minimum zoom of the map - * @param {number} [options.maxZoom=20] Maximum zoom of the map - * @param {Object|string} [options.style] Map style. This must be an an object conforming to the schema described in the [style reference](https://mapbox.com/mapbox-gl-style-spec/), or a URL to a JSON style. To load a style from the Mapbox API, you can use a URL of the form `mapbox://styles/:owner/:style`, where `:owner` is your Mapbox account name and `:style` is the style ID. Or you can use one of the predefined Mapbox styles: - * * `mapbox://styles/mapbox/basic-v8` - Simple and flexible starting template. - * * `mapbox://styles/mapbox/bright-v8` - Template for complex custom basemaps. - * * `mapbox://styles/mapbox/streets-v8` - A ready-to-use basemap, perfect for minor customization or incorporating your own data. - * * `mapbox://styles/mapbox/light-v8` - Subtle light backdrop for data vizualizations. - * * `mapbox://styles/mapbox/dark-v8` - Subtle dark backdrop for data vizualizations. - * @param {boolean} [options.hash=false] If `true`, the map will track and update the page URL according to map position - * @param {boolean} [options.interactive=true] If `false`, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input - * @param {number} [options.bearingSnap=7] Snap to north threshold in degrees. - * @param {Array} [options.classes] Style class names with which to initialize the map - * @param {boolean} [options.attributionControl=true] If `true`, an attribution control will be added to the map. - * @param {boolean} [options.failIfMajorPerformanceCaveat=false] If `true`, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. - * @param {boolean} [options.preserveDrawingBuffer=false] If `true`, The maps canvas can be exported to a PNG using `map.getCanvas().toDataURL();`. This is false by default as a performance optimization. - * @param {LngLatBounds|Array>} [options.maxBounds] If set, the map is constrained to the given bounds. - * @param {boolean} [options.scrollZoom=true] If `true`, enable the "scroll to zoom" interaction (see `ScrollZoomHandler`) - * @param {boolean} [options.boxZoom=true] If `true`, enable the "box zoom" interaction (see `BoxZoomHandler`) - * @param {boolean} [options.dragRotate=true] If `true`, enable the "drag to rotate" interaction (see `DragRotateHandler`). - * @param {boolean} [options.dragPan=true] If `true`, enable the "drag to pan" interaction (see `DragPanHandler`). - * @param {boolean} [options.keyboard=true] If `true`, enable keyboard shortcuts (see `KeyboardHandler`). - * @param {boolean} [options.doubleClickZoom=true] If `true`, enable the "double click to zoom" interaction (see `DoubleClickZoomHandler`). - * @param {boolean} [options.touchZoomRotate=true] If `true`, enable the "pinch to rotate and zoom" interaction (see `TouchZoomRotateHandler`). - * @example - * var map = new mapboxgl.Map({ - * container: 'map', - * center: [-122.420679, 37.772537], - * zoom: 13, - * style: style_object, - * hash: true - * }); - */ -var Map = module.exports = function(options) { - - options = util.inherit(this.options, options); +var defaultOptions = { + center: [ + 0, + 0 + ], + zoom: 0, + bearing: 0, + pitch: 0, + minZoom: defaultMinZoom, + maxZoom: defaultMaxZoom, + interactive: true, + scrollZoom: true, + boxZoom: true, + dragRotate: true, + dragPan: true, + keyboard: true, + doubleClickZoom: true, + touchZoomRotate: true, + bearingSnap: 7, + hash: false, + attributionControl: true, + failIfMajorPerformanceCaveat: false, + preserveDrawingBuffer: false, + trackResize: true, + workerCount: Math.max(browser.hardwareConcurrency - 1, 1) +}; +var Map = module.exports = function (options) { + options = util.extend({}, defaultOptions, options); + if (options.workerCount < 1) { + throw new Error('workerCount must an integer greater than or equal to 1.'); + } this._interactive = options.interactive; this._failIfMajorPerformanceCaveat = options.failIfMajorPerformanceCaveat; this._preserveDrawingBuffer = options.preserveDrawingBuffer; - + this._trackResize = options.trackResize; + this._workerCount = options.workerCount; + this._bearingSnap = options.bearingSnap; if (typeof options.container === 'string') { this._container = document.getElementById(options.container); } else { this._container = options.container; } - this.animationLoop = new AnimationLoop(); this.transform = new Transform(options.minZoom, options.maxZoom); - if (options.maxBounds) { this.setMaxBounds(options.maxBounds); } - util.bindAll([ '_forwardStyleEvent', '_forwardSourceEvent', @@ -56719,230 +56684,122 @@ var Map = module.exports = function(options) { '_onSourceAdd', '_onSourceRemove', '_onSourceUpdate', + '_onWindowOnline', '_onWindowResize', - 'onError', '_update', '_render' ], this); - this._setupContainer(); this._setupPainter(); - this.on('move', this._update.bind(this, false)); this.on('zoom', this._update.bind(this, true)); - this.on('moveend', function() { - this.animationLoop.set(300); // text fading + this.on('moveend', function () { + this.animationLoop.set(300); this._rerender(); }.bind(this)); - - if (typeof window !== 'undefined') { - window.addEventListener('resize', this._onWindowResize, false); - } - - this.interaction = new Interaction(this); - - if (options.interactive) { - this.interaction.enable(); - } - - this._hash = options.hash && (new Hash()).addTo(this); - // don't set position from options if set through hash - if (!this._hash || !this._hash._onHashChange()) { - this.jumpTo(options); - } - - this.stacks = {}; - this._classes = []; - - this.resize(); - - if (options.classes) this.setClasses(options.classes); - if (options.style) this.setStyle(options.style); - if (options.attributionControl) this.addControl(new Attribution(options.attributionControl)); - - this.on('style.error', this.onError); - this.on('source.error', this.onError); - this.on('tile.error', this.onError); - this.on('layer.error', this.onError); -}; - -util.extend(Map.prototype, Evented); -util.extend(Map.prototype, Camera.prototype); -util.extend(Map.prototype, /** @lends Map.prototype */{ - - options: { - center: [0, 0], - zoom: 0, - bearing: 0, - pitch: 0, - - minZoom: defaultMinZoom, - maxZoom: defaultMaxZoom, - - interactive: true, - - scrollZoom: true, - boxZoom: true, - dragRotate: true, - dragPan: true, - keyboard: true, - doubleClickZoom: true, - touchZoomRotate: true, - - bearingSnap: 7, - - hash: false, - - attributionControl: true, - - failIfMajorPerformanceCaveat: false, - preserveDrawingBuffer: false - }, - - /** - * Adds a control to the map, calling `control.addTo(this)`. - * - * @param {Control} control - * @returns {Map} `this` - */ - addControl: function(control) { + if (typeof window !== 'undefined') { + window.addEventListener('online', this._onWindowOnline, false); + window.addEventListener('resize', this._onWindowResize, false); + } + bindHandlers(this, options); + this._hash = options.hash && new Hash().addTo(this); + if (!this._hash || !this._hash._onHashChange()) { + this.jumpTo({ + center: options.center, + zoom: options.zoom, + bearing: options.bearing, + pitch: options.pitch + }); + } + this.stacks = {}; + this._classes = []; + this.resize(); + if (options.classes) + this.setClasses(options.classes); + if (options.style) + this.setStyle(options.style); + if (options.attributionControl) + this.addControl(new Attribution(options.attributionControl)); + var fireError = this.fire.bind(this, 'error'); + this.on('style.error', fireError); + this.on('source.error', fireError); + this.on('tile.error', fireError); + this.on('layer.error', fireError); +}; +util.extend(Map.prototype, Evented); +util.extend(Map.prototype, Camera.prototype); +util.extend(Map.prototype, { + addControl: function (control) { control.addTo(this); return this; }, - - /** - * Adds a style class to a map. - * - * @param {string} klass name of style class - * @param {StyleOptions} [options] - * @fires change - * @returns {Map} `this` - */ - addClass: function(klass, options) { - if (this._classes.indexOf(klass) >= 0 || klass === '') return this; + addClass: function (klass, options) { + if (this._classes.indexOf(klass) >= 0 || klass === '') + return this; this._classes.push(klass); this._classOptions = options; - - if (this.style) this.style.updateClasses(); + if (this.style) + this.style.updateClasses(); return this._update(true); }, - - /** - * Removes a style class from a map. - * - * @param {string} klass name of style class - * @param {StyleOptions} [options] - * @fires change - * @returns {Map} `this` - */ - removeClass: function(klass, options) { + removeClass: function (klass, options) { var i = this._classes.indexOf(klass); - if (i < 0 || klass === '') return this; + if (i < 0 || klass === '') + return this; this._classes.splice(i, 1); this._classOptions = options; - - if (this.style) this.style.updateClasses(); + if (this.style) + this.style.updateClasses(); return this._update(true); }, - - /** - * Helper method to add more than one class. - * - * @param {Array} klasses An array of class names - * @param {StyleOptions} [options] - * @fires change - * @returns {Map} `this` - */ - setClasses: function(klasses, options) { + setClasses: function (klasses, options) { var uniqueClasses = {}; for (var i = 0; i < klasses.length; i++) { - if (klasses[i] !== '') uniqueClasses[klasses[i]] = true; + if (klasses[i] !== '') + uniqueClasses[klasses[i]] = true; } this._classes = Object.keys(uniqueClasses); this._classOptions = options; - - if (this.style) this.style.updateClasses(); + if (this.style) + this.style.updateClasses(); return this._update(true); }, - - /** - * Check whether a style class is active. - * - * @param {string} klass Name of style class - * @returns {boolean} - */ - hasClass: function(klass) { + hasClass: function (klass) { return this._classes.indexOf(klass) >= 0; }, - - /** - * Return an array of the current active style classes. - * - * @returns {boolean} - */ - getClasses: function() { + getClasses: function () { return this._classes; }, - - /** - * Detect the map's new width and height and resize it. Given - * the `container` of the map specified in the Map constructor, - * this reads the new width from the DOM: so this method is often - * called after the map's container is resized by another script - * or the map is shown after being initially hidden with CSS. - * - * @returns {Map} `this` - */ - resize: function() { + resize: function () { var width = 0, height = 0; - if (this._container) { width = this._container.offsetWidth || 400; height = this._container.offsetHeight || 300; } - this._canvas.resize(width, height); this.transform.resize(width, height); this.painter.resize(width, height); - - return this - .fire('movestart') - .fire('move') - .fire('resize') - .fire('moveend'); + return this.fire('movestart').fire('move').fire('resize').fire('moveend'); }, - - /** - * Get the map's geographical bounds. - * - * @returns {LngLatBounds} - */ - getBounds: function() { - var bounds = new LngLatBounds( - this.transform.pointLocation(new Point(0, 0)), - this.transform.pointLocation(this.transform.size)); - + getBounds: function () { + var bounds = new LngLatBounds(this.transform.pointLocation(new Point(0, 0)), this.transform.pointLocation(this.transform.size)); if (this.transform.angle || this.transform.pitch) { bounds.extend(this.transform.pointLocation(new Point(this.transform.size.x, 0))); bounds.extend(this.transform.pointLocation(new Point(0, this.transform.size.y))); } - return bounds; }, - - /** - * Set constraint on the map's geographical bounds. Pan or zoom operations that would result in - * displaying regions that fall outside of the bounds instead result in displaying the map at the - * closest point and/or zoom level of the requested operation that is within the max bounds. - * - * @param {LngLatBounds | Array> | null | undefined} lnglatbounds Desired max bounds of the map. If null or undefined, function removes any bounds constraints on the map. - * @returns {Map} `this` - */ setMaxBounds: function (lnglatbounds) { if (lnglatbounds) { var b = LngLatBounds.convert(lnglatbounds); - this.transform.lngRange = [b.getWest(), b.getEast()]; - this.transform.latRange = [b.getSouth(), b.getNorth()]; + this.transform.lngRange = [ + b.getWest(), + b.getEast() + ]; + this.transform.latRange = [ + b.getSouth(), + b.getNorth() + ]; this.transform._constrain(); this._update(); } else if (lnglatbounds === null || lnglatbounds === undefined) { @@ -56951,120 +56808,74 @@ util.extend(Map.prototype, /** @lends Map.prototype */{ this._update(); } return this; - }, - /** - * Set the map's minimum zoom level, and zooms map to that level if it is - * currently below it. If no parameter provided, unsets the current - * minimum zoom (sets it to 0) - * - * @param {number} minZoom Minimum zoom level. Must be between 0 and 20. - * @returns {Map} `this - */ - setMinZoom: function(minZoom) { - + setMinZoom: function (minZoom) { minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom; - if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) { this.transform.minZoom = minZoom; this._update(); - - if (this.getZoom() < minZoom) this.setZoom(minZoom); - + if (this.getZoom() < minZoom) + this.setZoom(minZoom); return this; - - } else throw new Error('minZoom must be between ' + defaultMinZoom + ' and the current maxZoom, inclusive'); + } else + throw new Error('minZoom must be between ' + defaultMinZoom + ' and the current maxZoom, inclusive'); }, - - /** - * Set the map's maximum zoom level, and zooms map to that level if it is - * currently above it. If no parameter provided, unsets the current - * maximum zoom (sets it to 20) - * @param {number} maxZoom Maximum zoom level. Must be between 0 and 20. - * @returns {Map} `this` - */ - setMaxZoom: function(maxZoom) { - + setMaxZoom: function (maxZoom) { maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom; - if (maxZoom >= this.transform.minZoom && maxZoom <= defaultMaxZoom) { this.transform.maxZoom = maxZoom; this._update(); - - if (this.getZoom() > maxZoom) this.setZoom(maxZoom); - + if (this.getZoom() > maxZoom) + this.setZoom(maxZoom); return this; - - } else throw new Error('maxZoom must be between the current minZoom and ' + defaultMaxZoom + ', inclusive'); + } else + throw new Error('maxZoom must be between the current minZoom and ' + defaultMaxZoom + ', inclusive'); }, - /** - * Get pixel coordinates relative to the map container, given a geographical - * location. - * - * @param {LngLat} lnglat - * @returns {Object} `x` and `y` coordinates - */ - project: function(lnglat) { + project: function (lnglat) { return this.transform.locationPoint(LngLat.convert(lnglat)); }, - - /** - * Get geographical coordinates, given pixel coordinates. - * - * @param {Array} point [x, y] pixel coordinates - * @returns {LngLat} - */ - unproject: function(point) { + unproject: function (point) { return this.transform.pointLocation(Point.convert(point)); }, - - /** - * Query rendered features within a point or rectangle. - * - * @param {Point|Array|Array|Array>} [pointOrBox] Either [x, y] pixel coordinates of a point, or [[x1, y1], [x2, y2]] pixel coordinates of opposite corners of bounding rectangle. Optional: use entire viewport if omitted. - * @param {Object} params - * @param {Array} [params.layers] Only query features from layers with these layer IDs. - * @param {Array} [params.filter] A mapbox-gl-style-spec filter. - * - * @returns {Array} features - An array of [GeoJSON](http://geojson.org/) features - * matching the query parameters. The GeoJSON properties of each feature are taken from - * the original source. Each feature object also contains a top-level `layer` - * property whose value is an object representing the style layer to which the - * feature belongs. Layout and paint properties in this object contain values - * which are fully evaluated for the given zoom level and feature. - * - * @example - * var features = map.queryRenderedFeatures([20, 35], { layers: ['my-layer-name'] }); - * - * @example - * var features = map.queryRenderedFeatures([[10, 20], [30, 50]], { layers: ['my-layer-name'] }); - */ - queryRenderedFeatures: function(pointOrBox, params) { - if (!(pointOrBox instanceof Point || Array.isArray(pointOrBox))) { - params = pointOrBox; - pointOrBox = undefined; + queryRenderedFeatures: function () { + var params = {}; + var geometry; + if (arguments.length === 2) { + geometry = arguments[0]; + params = arguments[1]; + } else if (arguments.length === 1 && isPointLike(arguments[0])) { + geometry = arguments[0]; + } else if (arguments.length === 1) { + params = arguments[0]; + } + return this.style.queryRenderedFeatures(this._makeQueryGeometry(geometry), params, this.transform.zoom, this.transform.angle); + function isPointLike(input) { + return input instanceof Point || Array.isArray(input); } - var queryGeometry = this._makeQueryGeometry(pointOrBox); - return this.style.queryRenderedFeatures(queryGeometry, params, this.transform.zoom, this.transform.angle); }, - - _makeQueryGeometry: function(pointOrBox) { + _makeQueryGeometry: function (pointOrBox) { if (pointOrBox === undefined) { - // bounds was omitted: use full viewport pointOrBox = [ - Point.convert([0, 0]), - Point.convert([this.transform.width, this.transform.height]) + Point.convert([ + 0, + 0 + ]), + Point.convert([ + this.transform.width, + this.transform.height + ]) ]; } - var queryGeometry; var isPoint = pointOrBox instanceof Point || typeof pointOrBox[0] === 'number'; - if (isPoint) { var point = Point.convert(pointOrBox); queryGeometry = [point]; } else { - var box = [Point.convert(pointOrBox[0]), Point.convert(pointOrBox[1])]; + var box = [ + Point.convert(pointOrBox[0]), + Point.convert(pointOrBox[1]) + ]; queryGeometry = [ box[0], new Point(box[1].x, box[0].y), @@ -57073,682 +56884,395 @@ util.extend(Map.prototype, /** @lends Map.prototype */{ box[0] ]; } - - queryGeometry = queryGeometry.map(function(p) { + queryGeometry = queryGeometry.map(function (p) { return this.transform.pointCoordinate(p); }.bind(this)); - return queryGeometry; }, - - /** - * Get data from vector tiles as an array of GeoJSON Features. - * - * @param {string} sourceID source ID - * @param {Object} params - * @param {string} [params.sourceLayer] The name of the vector tile layer to get features from. - * @param {Array} [params.filter] A mapbox-gl-style-spec filter. - * - * @returns {Array} features - An array of [GeoJSON](http://geojson.org/) features matching the query parameters. The GeoJSON properties of each feature are taken from the original source. Each feature object also contains a top-level `layer` property whose value is an object representing the style layer to which the feature belongs. Layout and paint properties in this object contain values which are fully evaluated for the given zoom level and feature. - */ - querySourceFeatures: function(sourceID, params) { + querySourceFeatures: function (sourceID, params) { return this.style.querySourceFeatures(sourceID, params); }, - - /** - * Replaces the map's style object with a new value. Unlike the `style` - * option in the Map constructor, this method only accepts an object - * of a new style, not a URL string. - * - * @param {Object} style A style object formatted as JSON - * @returns {Map} `this` - */ - setStyle: function(style) { + setStyle: function (style) { if (this.style) { - this.style - .off('load', this._onStyleLoad) - .off('error', this._forwardStyleEvent) - .off('change', this._onStyleChange) - .off('source.add', this._onSourceAdd) - .off('source.remove', this._onSourceRemove) - .off('source.load', this._onSourceUpdate) - .off('source.error', this._forwardSourceEvent) - .off('source.change', this._onSourceUpdate) - .off('layer.add', this._forwardLayerEvent) - .off('layer.remove', this._forwardLayerEvent) - .off('layer.error', this._forwardLayerEvent) - .off('tile.add', this._forwardTileEvent) - .off('tile.remove', this._forwardTileEvent) - .off('tile.load', this._update) - .off('tile.error', this._forwardTileEvent) - .off('tile.stats', this._forwardTileEvent) - ._remove(); - + this.style.off('load', this._onStyleLoad).off('error', this._forwardStyleEvent).off('change', this._onStyleChange).off('source.add', this._onSourceAdd).off('source.remove', this._onSourceRemove).off('source.load', this._onSourceUpdate).off('source.error', this._forwardSourceEvent).off('source.change', this._onSourceUpdate).off('layer.add', this._forwardLayerEvent).off('layer.remove', this._forwardLayerEvent).off('layer.error', this._forwardLayerEvent).off('tile.add', this._forwardTileEvent).off('tile.remove', this._forwardTileEvent).off('tile.load', this._update).off('tile.error', this._forwardTileEvent).off('tile.stats', this._forwardTileEvent)._remove(); this.off('rotate', this.style._redoPlacement); this.off('pitch', this.style._redoPlacement); } - if (!style) { this.style = null; return this; } else if (style instanceof Style) { this.style = style; } else { - this.style = new Style(style, this.animationLoop); - } - - this.style - .on('load', this._onStyleLoad) - .on('error', this._forwardStyleEvent) - .on('change', this._onStyleChange) - .on('source.add', this._onSourceAdd) - .on('source.remove', this._onSourceRemove) - .on('source.load', this._onSourceUpdate) - .on('source.error', this._forwardSourceEvent) - .on('source.change', this._onSourceUpdate) - .on('layer.add', this._forwardLayerEvent) - .on('layer.remove', this._forwardLayerEvent) - .on('layer.error', this._forwardLayerEvent) - .on('tile.add', this._forwardTileEvent) - .on('tile.remove', this._forwardTileEvent) - .on('tile.load', this._update) - .on('tile.error', this._forwardTileEvent) - .on('tile.stats', this._forwardTileEvent); - + this.style = new Style(style, this.animationLoop, this._workerCount); + } + this.style.on('load', this._onStyleLoad).on('error', this._forwardStyleEvent).on('change', this._onStyleChange).on('source.add', this._onSourceAdd).on('source.remove', this._onSourceRemove).on('source.load', this._onSourceUpdate).on('source.error', this._forwardSourceEvent).on('source.change', this._onSourceUpdate).on('layer.add', this._forwardLayerEvent).on('layer.remove', this._forwardLayerEvent).on('layer.error', this._forwardLayerEvent).on('tile.add', this._forwardTileEvent).on('tile.remove', this._forwardTileEvent).on('tile.load', this._update).on('tile.error', this._forwardTileEvent).on('tile.stats', this._forwardTileEvent); this.on('rotate', this.style._redoPlacement); this.on('pitch', this.style._redoPlacement); - return this; }, - - /** - * Get a style object that can be used to recreate the map's style. - * - * @returns {Object} style - */ - getStyle: function() { - return this.style.serialize(); + getStyle: function () { + if (this.style) { + return this.style.serialize(); + } }, - - /** - * Add a source to the map style. - * - * @param {string} id ID of the source. Must not be used by any existing source. - * @param {Object} source source specification, following the - * [Mapbox GL Style Reference](https://www.mapbox.com/mapbox-gl-style-spec/#sources) - * @fires source.add - * @returns {Map} `this` - */ - addSource: function(id, source) { + addSource: function (id, source) { this.style.addSource(id, source); this._update(true); return this; }, - - /** - * Remove an existing source from the map style. - * - * @param {string} id ID of the source to remove - * @fires source.remove - * @returns {Map} `this` - */ - removeSource: function(id) { + addSourceType: function (name, SourceType, callback) { + return this.style.addSourceType(name, SourceType, callback); + }, + removeSource: function (id) { this.style.removeSource(id); this._update(true); return this; }, - - /** - * Return the style source object with the given `id`. - * - * @param {string} id source ID - * @returns {Object} - */ - getSource: function(id) { + getSource: function (id) { return this.style.getSource(id); }, - - /** - * Add a layer to the map style. The layer will be inserted before the layer with - * ID `before`, or appended if `before` is omitted. - * @param {StyleLayer|Object} layer - * @param {string=} before ID of an existing layer to insert before - * @fires layer.add - * @returns {Map} `this` - */ - addLayer: function(layer, before) { + addLayer: function (layer, before) { this.style.addLayer(layer, before); this._update(true); return this; }, - - /** - * Remove the layer with the given `id` from the map. Any layers which refer to the - * specified layer via a `ref` property are also removed. - * - * @param {string} id layer id - * @throws {Error} if no layer with the given `id` exists - * @fires layer.remove - * @returns {Map} `this` - */ - removeLayer: function(id) { + removeLayer: function (id) { this.style.removeLayer(id); this._update(true); return this; }, - - /** - * Return the style layer object with the given `id`. - * - * @param {string} id layer id - * @returns {?Object} a layer, if one with the given `id` exists - */ - getLayer: function(id) { + getLayer: function (id) { return this.style.getLayer(id); }, - - /** - * Set the filter for a given style layer. - * - * @param {string} layer ID of a layer - * @param {Array} filter filter specification, as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#types-filter) - * @returns {Map} `this` - * @example - * map.setFilter('my-layer', ['==', 'name', 'USA']); - */ - setFilter: function(layer, filter) { + setFilter: function (layer, filter) { this.style.setFilter(layer, filter); this._update(true); return this; }, - - /** - * Set the zoom extent for a given style layer. - * - * @param {string} layerId ID of a layer - * @param {number} minzoom minimum zoom extent - * @param {number} maxzoom maximum zoom extent - * @returns {Map} `this` - * @example - * map.setLayerZoomRange('my-layer', 2, 5); - */ - setLayerZoomRange: function(layerId, minzoom, maxzoom) { + setLayerZoomRange: function (layerId, minzoom, maxzoom) { this.style.setLayerZoomRange(layerId, minzoom, maxzoom); this._update(true); return this; }, - - /** - * Get the filter for a given style layer. - * - * @param {string} layer ID of a layer - * @returns {Array} filter specification, as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#filter) - */ - getFilter: function(layer) { + getFilter: function (layer) { return this.style.getFilter(layer); }, - - /** - * Set the value of a paint property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a paint property - * @param {*} value value for the paint propery; must have the type appropriate for the property as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/) - * @param {string=} klass optional class specifier for the property - * @returns {Map} `this` - * @example - * map.setPaintProperty('my-layer', 'fill-color', '#faafee'); - */ - setPaintProperty: function(layer, name, value, klass) { + setPaintProperty: function (layer, name, value, klass) { this.style.setPaintProperty(layer, name, value, klass); this._update(true); return this; }, - - /** - * Get the value of a paint property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a paint property - * @param {string=} klass optional class specifier for the property - * @returns {*} value for the paint propery - */ - getPaintProperty: function(layer, name, klass) { + getPaintProperty: function (layer, name, klass) { return this.style.getPaintProperty(layer, name, klass); }, - - /** - * Set the value of a layout property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a layout property - * @param {*} value value for the layout propery; must have the type appropriate for the property as defined in the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/) - * @returns {Map} `this` - * @example - * map.setLayoutProperty('my-layer', 'visibility', 'none'); - */ - setLayoutProperty: function(layer, name, value) { + setLayoutProperty: function (layer, name, value) { this.style.setLayoutProperty(layer, name, value); this._update(true); return this; }, - - /** - * Get the value of a layout property in a given style layer. - * - * @param {string} layer ID of a layer - * @param {string} name name of a layout property - * @param {string=} klass optional class specifier for the property - * @returns {*} value for the layout propery - */ - getLayoutProperty: function(layer, name) { + getLayoutProperty: function (layer, name) { return this.style.getLayoutProperty(layer, name); }, - - /** - * Get the Map's container as an HTML element - * @returns {HTMLElement} container - */ - getContainer: function() { + getContainer: function () { return this._container; }, - - /** - * Get the container for the map `canvas` element. - * - * If you want to add non-GL overlays to the map, you should append them to this element. This - * is the element to which event bindings for map interactivity such as panning and zooming are - * attached. It will receive bubbled events for child elements such as the `canvas`, but not for - * map controls. - * - * @returns {HTMLElement} container - */ - getCanvasContainer: function() { + getCanvasContainer: function () { return this._canvasContainer; }, - - /** - * Get the Map's canvas as an HTML canvas - * @returns {HTMLElement} canvas - */ - getCanvas: function() { + getCanvas: function () { return this._canvas.getElement(); }, - - _setupContainer: function() { + _setupContainer: function () { var container = this._container; container.classList.add('mapboxgl-map'); - var canvasContainer = this._canvasContainer = DOM.create('div', 'mapboxgl-canvas-container', container); if (this._interactive) { canvasContainer.classList.add('mapboxgl-interactive'); } this._canvas = new Canvas(this, canvasContainer); - var controlContainer = this._controlContainer = DOM.create('div', 'mapboxgl-control-container', container); var corners = this._controlCorners = {}; - ['top-left', 'top-right', 'bottom-left', 'bottom-right'].forEach(function (pos) { + [ + 'top-left', + 'top-right', + 'bottom-left', + 'bottom-right' + ].forEach(function (pos) { corners[pos] = DOM.create('div', 'mapboxgl-ctrl-' + pos, controlContainer); }); }, - - _setupPainter: function() { + _setupPainter: function () { var gl = this._canvas.getWebGLContext({ failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer }); - if (!gl) { - console.error('Failed to initialize WebGL'); + this.fire('error', { error: new Error('Failed to initialize WebGL') }); return; } - this.painter = new Painter(gl, this.transform); }, - - /** - * WebGL Context Lost event. - * - * @event webglcontextlost - * @memberof Map - * @instance - * @type {Object} - * @property {Event} originalEvent the original DOM event - */ - _contextLost: function(event) { + _contextLost: function (event) { event.preventDefault(); if (this._frameId) { browser.cancelFrame(this._frameId); } - this.fire("webglcontextlost", {originalEvent: event}); + this.fire('webglcontextlost', { originalEvent: event }); }, - - /** - * WebGL Context Restored event. - * - * @event webglcontextrestored - * @memberof Map - * @instance - * @type {Object} - */ - _contextRestored: function(event) { + _contextRestored: function (event) { this._setupPainter(); this.resize(); this._update(); - this.fire("webglcontextrestored", {originalEvent: event}); + this.fire('webglcontextrestored', { originalEvent: event }); }, - - /** - * Is this map fully loaded? If the style isn't loaded - * or it has a change to the sources or style that isn't - * propagated to its style, return false. - * - * @returns {boolean} whether the map is loaded - */ - loaded: function() { + loaded: function () { if (this._styleDirty || this._sourcesDirty) return false; if (!this.style || !this.style.loaded()) return false; return true; }, - - /** - * Update this map's style and sources, and re-render the map. - * - * @param {boolean} updateStyle mark the map's style for reprocessing as - * well as its sources - * @returns {Map} this - * @private - */ - _update: function(updateStyle) { - if (!this.style) return this; - + _update: function (updateStyle) { + if (!this.style) + return this; this._styleDirty = this._styleDirty || updateStyle; this._sourcesDirty = true; - this._rerender(); - return this; }, - - /** - * Call when a (re-)render of the map is required, e.g. when the - * user panned or zoomed,f or new data is available. - * @returns {Map} this - * @private - */ - _render: function() { - if (this.style && this._styleDirty) { - this._styleDirty = false; - this.style.update(this._classes, this._classOptions); - this._classOptions = null; - this.style._recalculate(this.transform.zoom); - } - - if (this.style && this._sourcesDirty) { - this._sourcesDirty = false; - this.style._updateSources(this.transform); - } - - this.painter.render(this.style, { - debug: this.showTileBoundaries, - showOverdrawInspector: this._showOverdrawInspector, - vertices: this.vertices, - rotating: this.rotating, - zooming: this.zooming - }); - - this.fire('render'); - - if (this.loaded() && !this._loaded) { - this._loaded = true; - this.fire('load'); - } - - this._frameId = null; - - if (!this.animationLoop.stopped()) { - this._styleDirty = true; - } - - if (this._sourcesDirty || this._repaint || !this.animationLoop.stopped()) { - this._rerender(); + _render: function () { + try { + if (this.style && this._styleDirty) { + this._styleDirty = false; + this.style.update(this._classes, this._classOptions); + this._classOptions = null; + this.style._recalculate(this.transform.zoom); + } + if (this.style && this._sourcesDirty) { + this._sourcesDirty = false; + this.style._updateSources(this.transform); + } + this.painter.render(this.style, { + debug: this.showTileBoundaries, + showOverdrawInspector: this._showOverdrawInspector, + vertices: this.vertices, + rotating: this.rotating, + zooming: this.zooming + }); + this.fire('render'); + if (this.loaded() && !this._loaded) { + this._loaded = true; + this.fire('load'); + } + this._frameId = null; + if (!this.animationLoop.stopped()) { + this._styleDirty = true; + } + if (this._sourcesDirty || this._repaint || !this.animationLoop.stopped()) { + this._rerender(); + } + } catch (error) { + this.fire('error', { error: error }); } - return this; }, - - /** - * Destroys the map's underlying resources, including web workers and DOM elements. Afterwards, - * you must not call any further methods on this Map instance. - * - * @returns {undefined} - */ - remove: function() { - if (this._hash) this._hash.remove(); + remove: function () { + if (this._hash) + this._hash.remove(); browser.cancelFrame(this._frameId); this.setStyle(null); if (typeof window !== 'undefined') { window.removeEventListener('resize', this._onWindowResize, false); } + var extension = this.painter.gl.getExtension('WEBGL_lose_context'); + if (extension) + extension.loseContext(); removeNode(this._canvasContainer); removeNode(this._controlContainer); this._container.classList.remove('mapboxgl-map'); }, - - /** - * A default error handler for `style.error`, `source.error`, `layer.error`, - * and `tile.error` events. - * It logs the error via `console.error`. - * - * @example - * // Disable the default error handler - * map.off('style.error', map.onError); - * map.off('source.error', map.onError); - * map.off('tile.error', map.onError); - * map.off('layer.error', map.onError); - */ - onError: function(e) { - console.error(e.error); - }, - - _rerender: function() { + _rerender: function () { if (this.style && !this._frameId) { this._frameId = browser.frame(this._render); } }, - - _forwardStyleEvent: function(e) { - this.fire('style.' + e.type, util.extend({style: e.target}, e)); + _forwardStyleEvent: function (e) { + this.fire('style.' + e.type, util.extend({ style: e.target }, e)); }, - - _forwardSourceEvent: function(e) { - this.fire(e.type, util.extend({style: e.target}, e)); + _forwardSourceEvent: function (e) { + this.fire(e.type, util.extend({ style: e.target }, e)); }, - - _forwardLayerEvent: function(e) { - this.fire(e.type, util.extend({style: e.target}, e)); + _forwardLayerEvent: function (e) { + this.fire(e.type, util.extend({ style: e.target }, e)); }, - - _forwardTileEvent: function(e) { - this.fire(e.type, util.extend({style: e.target}, e)); + _forwardTileEvent: function (e) { + this.fire(e.type, util.extend({ style: e.target }, e)); }, - - _onStyleLoad: function(e) { + _onStyleLoad: function (e) { if (this.transform.unmodified) { this.jumpTo(this.style.stylesheet); } - this.style.update(this._classes, {transition: false}); + this.style.update(this._classes, { transition: false }); this._forwardStyleEvent(e); }, - - _onStyleChange: function(e) { + _onStyleChange: function (e) { this._update(true); this._forwardStyleEvent(e); }, - - _onSourceAdd: function(e) { + _onSourceAdd: function (e) { var source = e.source; if (source.onAdd) source.onAdd(this); this._forwardSourceEvent(e); }, - - _onSourceRemove: function(e) { + _onSourceRemove: function (e) { var source = e.source; if (source.onRemove) source.onRemove(this); this._forwardSourceEvent(e); }, - - _onSourceUpdate: function(e) { + _onSourceUpdate: function (e) { this._update(); this._forwardSourceEvent(e); }, - - _onWindowResize: function() { - this.stop().resize()._update(); + _onWindowOnline: function () { + this._update(); + }, + _onWindowResize: function () { + if (this._trackResize) { + this.stop().resize()._update(); + } } }); - -util.extendAll(Map.prototype, /** @lends Map.prototype */{ - - /** - * Draw an outline around each rendered tile for debugging. - * - * @name showTileBoundaries - * @type {boolean} - */ +util.extendAll(Map.prototype, { _showTileBoundaries: false, - get showTileBoundaries() { return this._showTileBoundaries; }, + get showTileBoundaries() { + return this._showTileBoundaries; + }, set showTileBoundaries(value) { - if (this._showTileBoundaries === value) return; + if (this._showTileBoundaries === value) + return; this._showTileBoundaries = value; this._update(); }, - - /** - * Draw boxes around all symbols in the data source, showing which were - * rendered and which were hidden due to collisions with other symbols for - * style debugging. - * - * @name showCollisionBoxes - * @type {boolean} - */ _showCollisionBoxes: false, - get showCollisionBoxes() { return this._showCollisionBoxes; }, + get showCollisionBoxes() { + return this._showCollisionBoxes; + }, set showCollisionBoxes(value) { - if (this._showCollisionBoxes === value) return; + if (this._showCollisionBoxes === value) + return; this._showCollisionBoxes = value; this.style._redoPlacement(); }, - - /* - * Show how many times each fragment has been shaded. White fragments have - * been shaded 8 or more times. Black fragments have been shaded 0 times. - * - * @name showOverdraw - * @type {boolean} - */ _showOverdrawInspector: false, - get showOverdrawInspector() { return this._showOverdrawInspector; }, + get showOverdrawInspector() { + return this._showOverdrawInspector; + }, set showOverdrawInspector(value) { - if (this._showOverdrawInspector === value) return; + if (this._showOverdrawInspector === value) + return; this._showOverdrawInspector = value; this._update(); }, - - /** - * Enable continuous repaint to analyze performance. - * - * @name repaint - * @type {boolean} - */ _repaint: false, - get repaint() { return this._repaint; }, - set repaint(value) { this._repaint = value; this._update(); }, - - // show vertices + get repaint() { + return this._repaint; + }, + set repaint(value) { + this._repaint = value; + this._update(); + }, _vertices: false, - get vertices() { return this._vertices; }, - set vertices(value) { this._vertices = value; this._update(); } + get vertices() { + return this._vertices; + }, + set vertices(value) { + this._vertices = value; + this._update(); + } }); - function removeNode(node) { if (node.parentNode) { node.parentNode.removeChild(node); } } - -/** - * Options common to Map#addClass, Map#removeClass, and Map#setClasses, controlling - * whether or not to smoothly transition property changes triggered by the class change. - * - * @typedef {Object} StyleOptions - * @property {boolean} transition - */ - - /** - * This event is fired whenever the map is drawn to the screen because of - * - * - a change in map position, zoom, pitch, or bearing - * - a change to the map style - * - a change to a GeoJSON source - * - a vector tile, GeoJSON file, glyph, or sprite being loaded - * - * @event render - * @memberof Map - * @instance - */ - -},{"../geo/lng_lat":256,"../geo/lng_lat_bounds":257,"../geo/transform":258,"../render/painter":271,"../style/animation_loop":287,"../style/style":290,"../util/browser":335,"../util/canvas":336,"../util/dom":338,"../util/evented":341,"../util/util":349,"./camera":317,"./control/attribution":318,"./hash":329,"./interaction":330,"point-geometry":404}],332:[function(require,module,exports){ +},{"../geo/lng_lat":263,"../geo/lng_lat_bounds":264,"../geo/transform":265,"../render/painter":279,"../style/animation_loop":299,"../style/style":302,"../util/browser":350,"../util/canvas":351,"../util/dom":352,"../util/evented":358,"../util/util":366,"./bind_handlers":331,"./camera":332,"./control/attribution":333,"./hash":344,"point-geometry":424}],346:[function(require,module,exports){ +'use strict'; +module.exports = Marker; +var DOM = require('../util/dom'); +var LngLat = require('../geo/lng_lat'); +var Point = require('point-geometry'); +function Marker(element, options) { + if (!element) { + element = DOM.create('div'); + } + element.classList.add('mapboxgl-marker'); + this._el = element; + this._offset = Point.convert(options && options.offset || [ + 0, + 0 + ]); + this._update = this._update.bind(this); +} +Marker.prototype = { + addTo: function (map) { + this.remove(); + this._map = map; + map.getCanvasContainer().appendChild(this._el); + map.on('move', this._update); + this._update(); + return this; + }, + remove: function () { + if (this._map) { + this._map.off('move', this._update); + this._map = null; + } + var parent = this._el.parentNode; + if (parent) + parent.removeChild(this._el); + return this; + }, + getLngLat: function () { + return this._lngLat; + }, + setLngLat: function (lnglat) { + this._lngLat = LngLat.convert(lnglat); + this._update(); + return this; + }, + getElement: function () { + return this._el; + }, + _update: function () { + if (!this._map) + return; + var pos = this._map.project(this._lngLat)._add(this._offset); + DOM.setTransform(this._el, 'translate(' + pos.x + 'px,' + pos.y + 'px)'); + } +}; +},{"../geo/lng_lat":263,"../util/dom":352,"point-geometry":424}],347:[function(require,module,exports){ 'use strict'; - module.exports = Popup; - var util = require('../util/util'); var Evented = require('../util/evented'); var DOM = require('../util/dom'); var LngLat = require('../geo/lng_lat'); - -/** - * Creates a popup component - * @class Popup - * @param {Object} options - * @param {boolean} options.closeButton whether to show a close button in the - * top right corner of the popup. - * @param {boolean} options.closeOnClick whether to close the popup when the - * map is clicked. - * @param {string} options.anchor - One of "top", "bottom", "left", "right", "top-left", - * "top-right", "bottom-left", or "bottom-right", describing where the popup's anchor - * relative to the coordinate set via `setLngLat`. - * @example - * var tooltip = new mapboxgl.Popup() - * .setLngLat(e.lngLat) - * .setHTML("

Hello World!

") - * .addTo(map); - */ function Popup(options) { util.setOptions(this, options); util.bindAll([ '_update', - '_onClickClose'], - this); + '_onClickClose' + ], this); } - -Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ +Popup.prototype = util.inherit(Evented, { options: { closeButton: true, closeOnClick: true }, - - /** - * Attaches the popup to a map - * @param {Map} map - * @returns {Popup} `this` - */ - addTo: function(map) { + addTo: function (map) { this._map = map; this._map.on('move', this._update); if (this.options.closeOnClick) { @@ -57757,137 +57281,75 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ this._update(); return this; }, - - /** - * Removes the popup from a map - * @example - * var popup = new mapboxgl.Popup().addTo(map); - * popup.remove(); - * @returns {Popup} `this` - */ - remove: function() { + remove: function () { if (this._content && this._content.parentNode) { this._content.parentNode.removeChild(this._content); } - if (this._container) { this._container.parentNode.removeChild(this._container); delete this._container; } - if (this._map) { this._map.off('move', this._update); this._map.off('click', this._onClickClose); delete this._map; } - + this.fire('close'); return this; }, - - /** - * Get the popup's geographical location - * @returns {LngLat} - */ - getLngLat: function() { + getLngLat: function () { return this._lngLat; }, - - /** - * Set the popup's geographical position and move it. - * @param {LngLat} lnglat - * @returns {Popup} `this` - */ - setLngLat: function(lnglat) { + setLngLat: function (lnglat) { this._lngLat = LngLat.convert(lnglat); this._update(); return this; }, - - /** - * Fill a popup element with text only content. This creates a text node - * in the DOM, so it cannot end up appending raw HTML. Use this method - * if you want an added level of security against XSS if the popup - * content is user-provided. - * @param {string} text - * @returns {Popup} `this` - * @example - * var tooltip = new mapboxgl.Popup() - * .setLngLat(e.lngLat) - * .setText('Hello, world!') - * .addTo(map); - */ - setText: function(text) { + setText: function (text) { return this.setDOMContent(document.createTextNode(text)); }, - - /** - * Fill a popup element with HTML content, provided as a string. - * @param {string} html - * @returns {Popup} `this` - */ - setHTML: function(html) { + setHTML: function (html) { var frag = document.createDocumentFragment(); var temp = document.createElement('body'), child; temp.innerHTML = html; while (true) { child = temp.firstChild; - if (!child) break; + if (!child) + break; frag.appendChild(child); } - return this.setDOMContent(frag); }, - - /** - * Fill a popup element with DOM content - * @param {Node} htmlNode Popup content as a DOM node - * @returns {Popup} `this` - * @example - * // create an element with the popup content - * var div = document.createElement('div'); - * div.innerHTML = 'Hello, world!'; - * var tooltip = new mapboxgl.Popup() - * .setLngLat(e.lngLat) - * .setDOMContent(div) - * .addTo(map); - */ - setDOMContent: function(htmlNode) { + setDOMContent: function (htmlNode) { this._createContent(); this._content.appendChild(htmlNode); this._update(); return this; }, - - _createContent: function() { + _createContent: function () { if (this._content && this._content.parentNode) { this._content.parentNode.removeChild(this._content); } - this._content = DOM.create('div', 'mapboxgl-popup-content', this._container); - if (this.options.closeButton) { this._closeButton = DOM.create('button', 'mapboxgl-popup-close-button', this._content); + this._closeButton.type = 'button'; this._closeButton.innerHTML = '×'; this._closeButton.addEventListener('click', this._onClickClose); } }, - - _update: function() { - if (!this._map || !this._lngLat || !this._content) { return; } - + _update: function () { + if (!this._map || !this._lngLat || !this._content) { + return; + } if (!this._container) { this._container = DOM.create('div', 'mapboxgl-popup', this._map.getContainer()); - this._tip = DOM.create('div', 'mapboxgl-popup-tip', this._container); + this._tip = DOM.create('div', 'mapboxgl-popup-tip', this._container); this._container.appendChild(this._content); } - - var pos = this._map.project(this._lngLat).round(), - anchor = this.options.anchor; - + var pos = this._map.project(this._lngLat).round(), anchor = this.options.anchor; if (!anchor) { - var width = this._container.offsetWidth, - height = this._container.offsetHeight; - + var width = this._container.offsetWidth, height = this._container.offsetHeight; if (pos.y < height) { anchor = ['top']; } else if (pos.y > this._map.transform.height - height) { @@ -57895,20 +57357,17 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ } else { anchor = []; } - if (pos.x < width / 2) { anchor.push('left'); } else if (pos.x > this._map.transform.width - width / 2) { anchor.push('right'); } - if (anchor.length === 0) { anchor = 'bottom'; } else { anchor = anchor.join('-'); } } - var anchorTranslate = { 'top': 'translate(-50%,0)', 'top-left': 'translate(0,0)', @@ -57919,36 +57378,20 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ 'left': 'translate(0,-50%)', 'right': 'translate(-100%,-50%)' }; - var classList = this._container.classList; for (var key in anchorTranslate) { classList.remove('mapboxgl-popup-anchor-' + key); } classList.add('mapboxgl-popup-anchor-' + anchor); - DOM.setTransform(this._container, anchorTranslate[anchor] + ' translate(' + pos.x + 'px,' + pos.y + 'px)'); }, - - _onClickClose: function() { + _onClickClose: function () { this.remove(); } }); - -},{"../geo/lng_lat":256,"../util/dom":338,"../util/evented":341,"../util/util":349}],333:[function(require,module,exports){ +},{"../geo/lng_lat":263,"../util/dom":352,"../util/evented":358,"../util/util":366}],348:[function(require,module,exports){ 'use strict'; - module.exports = Actor; - -/** - * An implementation of the [Actor design pattern](http://en.wikipedia.org/wiki/Actor_model) - * that maintains the relationship between asynchronous tasks and the objects - * that spin them off - in this case, tasks like parsing parts of styles, - * owned by the styles - * - * @param {WebWorker} target - * @param {WebWorker} parent - * @private - */ function Actor(target, parent) { this.target = target; this.parent = parent; @@ -57957,59 +57400,53 @@ function Actor(target, parent) { this.receive = this.receive.bind(this); this.target.addEventListener('message', this.receive, false); } - -Actor.prototype.receive = function(message) { - var data = message.data, - callback; - +Actor.prototype.receive = function (message) { + var data = message.data, id = data.id, callback; if (data.type === '') { callback = this.callbacks[data.id]; delete this.callbacks[data.id]; - callback(data.error || null, data.data); - } else if (typeof data.id !== 'undefined') { - var id = data.id; - this.parent[data.type](data.data, function(err, data, buffers) { - this.postMessage({ - type: '', - id: String(id), - error: err ? String(err) : null, - data: data - }, buffers); - }.bind(this)); + if (callback) + callback(data.error || null, data.data); + } else if (typeof data.id !== 'undefined' && this.parent[data.type]) { + this.parent[data.type](data.data, done.bind(this)); + } else if (typeof data.id !== 'undefined' && this.parent.workerSources) { + var keys = data.type.split('.'); + this.parent.workerSources[keys[0]][keys[1]](data.data, done.bind(this)); } else { this.parent[data.type](data.data); } + function done(err, data, buffers) { + this.postMessage({ + type: '', + id: String(id), + error: err ? String(err) : null, + data: data + }, buffers); + } }; - -Actor.prototype.send = function(type, data, callback, buffers) { +Actor.prototype.send = function (type, data, callback, buffers) { var id = null; - if (callback) this.callbacks[id = this.callbackID++] = callback; - this.postMessage({ type: type, id: String(id), data: data }, buffers); + if (callback) + this.callbacks[id = this.callbackID++] = callback; + this.postMessage({ + type: type, + id: String(id), + data: data + }, buffers); }; - -/** - * Wrapped postMessage API that abstracts around IE's lack of - * `transferList` support. - * - * @param {Object} message - * @param {Object} transferList - * @private - */ -Actor.prototype.postMessage = function(message, transferList) { +Actor.prototype.postMessage = function (message, transferList) { this.target.postMessage(message, transferList); }; - -},{}],334:[function(require,module,exports){ +},{}],349:[function(require,module,exports){ 'use strict'; - -exports.getJSON = function(url, callback) { +exports.getJSON = function (url, callback) { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.setRequestHeader('Accept', 'application/json'); - xhr.onerror = function(e) { + xhr.onerror = function (e) { callback(e); }; - xhr.onload = function() { + xhr.onload = function () { if (xhr.status >= 200 && xhr.status < 300 && xhr.response) { var data; try { @@ -58025,15 +57462,14 @@ exports.getJSON = function(url, callback) { xhr.send(); return xhr; }; - -exports.getArrayBuffer = function(url, callback) { +exports.getArrayBuffer = function (url, callback) { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = 'arraybuffer'; - xhr.onerror = function(e) { + xhr.onerror = function (e) { callback(e); }; - xhr.onload = function() { + xhr.onload = function () { if (xhr.status >= 200 && xhr.status < 300 && xhr.response) { callback(null, xhr.response); } else { @@ -58043,24 +57479,23 @@ exports.getArrayBuffer = function(url, callback) { xhr.send(); return xhr; }; - function sameOrigin(url) { var a = document.createElement('a'); a.href = url; return a.protocol === document.location.protocol && a.host === document.location.host; } - -exports.getImage = function(url, callback) { - return exports.getArrayBuffer(url, function(err, imgData) { - if (err) return callback(err); +exports.getImage = function (url, callback) { + return exports.getArrayBuffer(url, function (err, imgData) { + if (err) + return callback(err); var img = new Image(); - img.onload = function() { + img.onload = function () { callback(null, img); (window.URL || window.webkitURL).revokeObjectURL(img.src); }; var blob = new Blob([new Uint8Array(imgData)], { type: 'image/png' }); img.src = (window.URL || window.webkitURL).createObjectURL(blob); - img.getData = function() { + img.getData = function () { var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); canvas.width = img.width; @@ -58071,10 +57506,9 @@ exports.getImage = function(url, callback) { return img; }); }; - -exports.getVideo = function(urls, callback) { +exports.getVideo = function (urls, callback) { var video = document.createElement('video'); - video.onloadstart = function() { + video.onloadstart = function () { callback(null, video); }; for (var i = 0; i < urls.length; i++) { @@ -58085,64 +57519,39 @@ exports.getVideo = function(urls, callback) { s.src = urls[i]; video.appendChild(s); } - video.getData = function() { return video; }; + video.getData = function () { + return video; + }; return video; }; - -},{}],335:[function(require,module,exports){ +},{}],350:[function(require,module,exports){ 'use strict'; - -/** - * Unlike js/util/browser.js, this code is written with the expectation - * of a browser environment with a global 'window' object - * @module browser - * @private - */ - -/** - * Provides a function that outputs milliseconds: either performance.now() - * or a fallback to Date.now() - */ -module.exports.now = (function() { - if (window.performance && - window.performance.now) { +exports.window = window; +module.exports.now = function () { + if (window.performance && window.performance.now) { return window.performance.now.bind(window.performance); } else { return Date.now.bind(Date); } -}()); - -var frame = window.requestAnimationFrame || - window.mozRequestAnimationFrame || - window.webkitRequestAnimationFrame || - window.msRequestAnimationFrame; - -exports.frame = function(fn) { +}(); +var frame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; +exports.frame = function (fn) { return frame(fn); }; - -var cancel = window.cancelAnimationFrame || - window.mozCancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.msCancelAnimationFrame; - -exports.cancelFrame = function(id) { +var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame; +exports.cancelFrame = function (id) { cancel(id); }; - exports.timed = function (fn, dur, ctx) { if (!dur) { fn.call(ctx, 1); return null; } - - var abort = false, - start = module.exports.now(); - + var abort = false, start = module.exports.now(); function tick(now) { - if (abort) return; + if (abort) + return; now = module.exports.now(); - if (now >= start + dur) { fn.call(ctx, 1); } else { @@ -58150,49 +57559,32 @@ exports.timed = function (fn, dur, ctx) { exports.frame(tick); } } - exports.frame(tick); - - return function() { abort = true; }; + return function () { + abort = true; + }; }; - -/** - * Test if the current browser supports Mapbox GL JS - * @param {Object} options - * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false` - * if the performance of Mapbox GL JS would be dramatically worse than - * expected (i.e. a software renderer would be used) - * @return {boolean} - */ -exports.supported = require('mapbox-gl-js-supported'); - -exports.hardwareConcurrency = navigator.hardwareConcurrency || 8; - +exports.supported = require('mapbox-gl-supported'); +exports.hardwareConcurrency = navigator.hardwareConcurrency || 4; Object.defineProperty(exports, 'devicePixelRatio', { - get: function() { return window.devicePixelRatio; } + get: function () { + return window.devicePixelRatio; + } }); - exports.supportsWebp = false; - var webpImgTest = document.createElement('img'); -webpImgTest.onload = function() { +webpImgTest.onload = function () { exports.supportsWebp = true; }; webpImgTest.src = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA='; - exports.supportsGeolocation = !!navigator.geolocation; - -},{"mapbox-gl-js-supported":375}],336:[function(require,module,exports){ +},{"mapbox-gl-supported":420}],351:[function(require,module,exports){ 'use strict'; - var util = require('../util'); -var isSupported = require('mapbox-gl-js-supported'); - +var isSupported = require('mapbox-gl-supported'); module.exports = Canvas; - function Canvas(parent, container) { this.canvas = document.createElement('canvas'); - if (parent && container) { this.canvas.style.position = 'absolute'; this.canvas.classList.add('mapboxgl-canvas'); @@ -58202,88 +57594,32 @@ function Canvas(parent, container) { container.appendChild(this.canvas); } } - -Canvas.prototype.resize = function(width, height) { +Canvas.prototype.resize = function (width, height) { var pixelRatio = window.devicePixelRatio || 1; - - // Request the required canvas size taking the pixelratio into account. this.canvas.width = pixelRatio * width; this.canvas.height = pixelRatio * height; - - // Maintain the same canvas size, potentially downscaling it for HiDPI displays this.canvas.style.width = width + 'px'; this.canvas.style.height = height + 'px'; }; - -Canvas.prototype.getWebGLContext = function(attributes) { +Canvas.prototype.getWebGLContext = function (attributes) { attributes = util.extend({}, attributes, isSupported.webGLContextAttributes); - - return this.canvas.getContext('webgl', attributes) || - this.canvas.getContext('experimental-webgl', attributes); + return this.canvas.getContext('webgl', attributes) || this.canvas.getContext('experimental-webgl', attributes); }; - -Canvas.prototype.getElement = function() { +Canvas.prototype.getElement = function () { return this.canvas; }; - -},{"../util":349,"mapbox-gl-js-supported":375}],337:[function(require,module,exports){ -'use strict'; - -var Actor = require('../actor'); -var WebWorkify = require('webworkify'); - -module.exports = Dispatcher; - -function Dispatcher(length, parent) { - this.actors = []; - this.currentActor = 0; - for (var i = 0; i < length; i++) { - var worker = new WebWorkify(require('../../source/worker')); - var actor = new Actor(worker, parent); - actor.name = "Worker " + i; - this.actors.push(actor); - } -} - -Dispatcher.prototype = { - broadcast: function(type, data) { - for (var i = 0; i < this.actors.length; i++) { - this.actors[i].send(type, data); - } - }, - - send: function(type, data, callback, targetID, buffers) { - if (typeof targetID !== 'number' || isNaN(targetID)) { - // Use round robin to send requests to web workers. - targetID = this.currentActor = (this.currentActor + 1) % this.actors.length; - } - - this.actors[targetID].send(type, data, callback, buffers); - return targetID; - }, - - remove: function() { - for (var i = 0; i < this.actors.length; i++) { - this.actors[i].target.terminate(); - } - this.actors = []; - } -}; - -},{"../../source/worker":285,"../actor":333,"webworkify":420}],338:[function(require,module,exports){ +},{"../util":366,"mapbox-gl-supported":420}],352:[function(require,module,exports){ 'use strict'; - var Point = require('point-geometry'); - exports.create = function (tagName, className, container) { var el = document.createElement(tagName); - if (className) el.className = className; - if (container) container.appendChild(el); + if (className) + el.className = className; + if (container) + container.appendChild(el); return el; }; - var docStyle = document.documentElement.style; - function testProp(props) { for (var i = 0; i < props.length; i++) { if (props[i] in docStyle) { @@ -58291,9 +57627,12 @@ function testProp(props) { } } } - -var selectProp = testProp(['userSelect', 'MozUserSelect', 'WebkitUserSelect', 'msUserSelect']), - userSelect; +var selectProp = testProp([ + 'userSelect', + 'MozUserSelect', + 'WebkitUserSelect', + 'msUserSelect' + ]), userSelect; exports.disableDrag = function () { if (selectProp) { userSelect = docStyle[selectProp]; @@ -58305,61 +57644,98 @@ exports.enableDrag = function () { docStyle[selectProp] = userSelect; } }; - -var transformProp = testProp(['transform', 'WebkitTransform']); -exports.setTransform = function(el, value) { +var transformProp = testProp([ + 'transform', + 'WebkitTransform' +]); +exports.setTransform = function (el, value) { el.style[transformProp] = value; }; - -// Suppress the next click, but only if it's immediate. function suppressClick(e) { e.preventDefault(); e.stopPropagation(); window.removeEventListener('click', suppressClick, true); } -exports.suppressClick = function() { +exports.suppressClick = function () { window.addEventListener('click', suppressClick, true); - window.setTimeout(function() { + window.setTimeout(function () { window.removeEventListener('click', suppressClick, true); }, 0); }; - exports.mousePos = function (el, e) { var rect = el.getBoundingClientRect(); e = e.touches ? e.touches[0] : e; - return new Point( - e.clientX - rect.left - el.clientLeft, - e.clientY - rect.top - el.clientTop - ); + return new Point(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop); }; - exports.touchPos = function (el, e) { - var rect = el.getBoundingClientRect(), - points = []; + var rect = el.getBoundingClientRect(), points = []; for (var i = 0; i < e.touches.length; i++) { - points.push(new Point( - e.touches[i].clientX - rect.left - el.clientLeft, - e.touches[i].clientY - rect.top - el.clientTop - )); + points.push(new Point(e.touches[i].clientX - rect.left - el.clientLeft, e.touches[i].clientY - rect.top - el.clientTop)); + } + return points; +}; +},{"point-geometry":424}],353:[function(require,module,exports){ +'use strict'; +var WebWorkify = require('webworkify'); +module.exports = function () { + return new WebWorkify(require('../../source/worker')); +}; +},{"../../source/worker":297,"webworkify":441}],354:[function(require,module,exports){ +'use strict'; +var quickselect = require('quickselect'); +module.exports = function classifyRings(rings, maxRings) { + var len = rings.length; + if (len <= 1) + return [rings]; + var polygons = [], polygon, ccw; + for (var i = 0; i < len; i++) { + var area = calculateSignedArea(rings[i]); + if (area === 0) + continue; + rings[i].area = Math.abs(area); + if (ccw === undefined) + ccw = area < 0; + if (ccw === area < 0) { + if (polygon) + polygons.push(polygon); + polygon = [rings[i]]; + } else { + polygon.push(rings[i]); + } + } + if (polygon) + polygons.push(polygon); + if (maxRings > 1) { + for (var j = 0; j < polygons.length; j++) { + if (polygons[j].length <= maxRings) + continue; + quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas); + polygons[j] = polygons[j].slice(0, maxRings); + } + } + return polygons; +}; +function compareAreas(a, b) { + return b.area - a.area; +} +function calculateSignedArea(ring) { + var sum = 0; + for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) { + p1 = ring[i]; + p2 = ring[j]; + sum += (p2.x - p1.x) * (p1.y + p2.y); } - return points; -}; - -},{"point-geometry":404}],339:[function(require,module,exports){ + return sum; +} +},{"quickselect":425}],355:[function(require,module,exports){ 'use strict'; - module.exports = { API_URL: 'https://api.mapbox.com', REQUIRE_ACCESS_TOKEN: true }; - -},{}],340:[function(require,module,exports){ +},{}],356:[function(require,module,exports){ 'use strict'; - -var assert = require('assert'); - module.exports = DictionaryCoder; - function DictionaryCoder(strings) { this._stringToNumber = {}; this._numberToString = []; @@ -58369,59 +57745,67 @@ function DictionaryCoder(strings) { this._numberToString[i] = string; } } - -DictionaryCoder.prototype.encode = function(string) { - assert(string in this._stringToNumber); +DictionaryCoder.prototype.encode = function (string) { return this._stringToNumber[string]; }; - -DictionaryCoder.prototype.decode = function(n) { - assert(n < this._numberToString.length); +DictionaryCoder.prototype.decode = function (n) { return this._numberToString[n]; }; - -},{"assert":52}],341:[function(require,module,exports){ +},{}],357:[function(require,module,exports){ +'use strict'; +var util = require('./util'); +var Actor = require('./actor'); +var WebWorker = require('./web_worker'); +module.exports = Dispatcher; +function Dispatcher(length, parent) { + this.actors = []; + this.currentActor = 0; + for (var i = 0; i < length; i++) { + var worker = new WebWorker(); + var actor = new Actor(worker, parent); + actor.name = 'Worker ' + i; + this.actors.push(actor); + } +} +Dispatcher.prototype = { + broadcast: function (type, data, cb) { + cb = cb || function () { + }; + util.asyncAll(this.actors, function (actor, done) { + actor.send(type, data, done); + }, cb); + }, + send: function (type, data, callback, targetID, buffers) { + if (typeof targetID !== 'number' || isNaN(targetID)) { + targetID = this.currentActor = (this.currentActor + 1) % this.actors.length; + } + this.actors[targetID].send(type, data, callback, buffers); + return targetID; + }, + remove: function () { + for (var i = 0; i < this.actors.length; i++) { + this.actors[i].target.terminate(); + } + this.actors = []; + } +}; +},{"./actor":348,"./util":366,"./web_worker":353}],358:[function(require,module,exports){ 'use strict'; - var util = require('./util'); - -/** - * Methods mixed in to other classes for event capabilities. - * @mixin Evented - */ var Evented = { - - /** - * Subscribe to a specified event with a listener function the latter gets the data object that was passed to `fire` and additionally `target` and `type` properties - * - * @param {string} type Event type - * @param {Function} listener Function to be called when the event is fired - * @returns {Object} `this` - */ - on: function(type, listener) { + on: function (type, listener) { this._events = this._events || {}; this._events[type] = this._events[type] || []; this._events[type].push(listener); - return this; }, - - /** - * Remove a event listener - * - * @param {string} [type] Event type. If none is specified, remove all listeners - * @param {Function} [listener] Function to be called when the event is fired. If none is specified all listeners are removed - * @returns {Object} `this` - */ - off: function(type, listener) { + off: function (type, listener) { if (!type) { - // clear all listeners if no arguments specified delete this._events; return this; } - - if (!this.listens(type)) return this; - + if (!this.listens(type)) + return this; if (listener) { var idx = this._events[type].indexOf(listener); if (idx >= 0) { @@ -58433,123 +57817,91 @@ var Evented = { } else { delete this._events[type]; } - return this; }, - - /** - * Call a function once when an event has fired - * - * @param {string} type Event type. - * @param {Function} listener Function to be called once when the event is fired - * @returns {Object} `this` - */ - once: function(type, listener) { - var wrapper = function(data) { + once: function (type, listener) { + var wrapper = function (data) { this.off(type, wrapper); listener.call(this, data); }.bind(this); this.on(type, wrapper); return this; }, - - /** - * Fire event of a given string type with the given data object - * - * @param {string} type Event type - * @param {Object} [data] Optional data passed to the event receiver (e.g. {@link #EventData}) - * @returns {Object} `this` - */ - fire: function(type, data) { - if (!this.listens(type)) return this; - + fire: function (type, data) { + if (!this.listens(type)) { + if (util.endsWith(type, 'error')) { + console.error(data && data.error || data || 'Empty error event'); + } + return this; + } data = util.extend({}, data); - util.extend(data, {type: type, target: this}); - - // make sure adding/removing listeners inside other listeners won't cause infinite loop + util.extend(data, { + type: type, + target: this + }); var listeners = this._events[type].slice(); - for (var i = 0; i < listeners.length; i++) { listeners[i].call(this, data); } - return this; }, - - /** - * Check if an event is registered to a type - * @param {string} type Event type - * @returns {boolean} `true` if there is at least one registered listener for events of type `type` - */ - listens: function(type) { + listens: function (type) { return !!(this._events && this._events[type]); } }; - module.exports = Evented; - -},{"./util":349}],342:[function(require,module,exports){ +},{"./util":366}],359:[function(require,module,exports){ 'use strict'; - module.exports = Glyphs; - function Glyphs(pbf, end) { this.stacks = pbf.readFields(readFontstacks, [], end); } - function readFontstacks(tag, stacks, pbf) { if (tag === 1) { - var fontstack = pbf.readMessage(readFontstack, {glyphs: {}}); + var fontstack = pbf.readMessage(readFontstack, { glyphs: {} }); stacks.push(fontstack); } } - function readFontstack(tag, fontstack, pbf) { - if (tag === 1) fontstack.name = pbf.readString(); - else if (tag === 2) fontstack.range = pbf.readString(); + if (tag === 1) + fontstack.name = pbf.readString(); + else if (tag === 2) + fontstack.range = pbf.readString(); else if (tag === 3) { var glyph = pbf.readMessage(readGlyph, {}); fontstack.glyphs[glyph.id] = glyph; } } - function readGlyph(tag, glyph, pbf) { - if (tag === 1) glyph.id = pbf.readVarint(); - else if (tag === 2) glyph.bitmap = pbf.readBytes(); - else if (tag === 3) glyph.width = pbf.readVarint(); - else if (tag === 4) glyph.height = pbf.readVarint(); - else if (tag === 5) glyph.left = pbf.readSVarint(); - else if (tag === 6) glyph.top = pbf.readSVarint(); - else if (tag === 7) glyph.advance = pbf.readVarint(); + if (tag === 1) + glyph.id = pbf.readVarint(); + else if (tag === 2) + glyph.bitmap = pbf.readBytes(); + else if (tag === 3) + glyph.width = pbf.readVarint(); + else if (tag === 4) + glyph.height = pbf.readVarint(); + else if (tag === 5) + glyph.left = pbf.readSVarint(); + else if (tag === 6) + glyph.top = pbf.readSVarint(); + else if (tag === 7) + glyph.advance = pbf.readVarint(); } - -},{}],343:[function(require,module,exports){ +},{}],360:[function(require,module,exports){ 'use strict'; - module.exports = interpolate; - function interpolate(a, b, t) { - return (a * (1 - t)) + (b * t); + return a * (1 - t) + b * t; } - interpolate.number = interpolate; - -interpolate.vec2 = function(from, to, t) { +interpolate.vec2 = function (from, to, t) { return [ interpolate(from[0], to[0], t), interpolate(from[1], to[1], t) ]; }; - -/* - * Interpolate between two colors given as 4-element arrays. - * - * @param {Color} from - * @param {Color} to - * @param {number} t interpolation factor between 0 and 1 - * @returns {Color} interpolated color - */ -interpolate.color = function(from, to, t) { +interpolate.color = function (from, to, t) { return [ interpolate(from[0], to[0], t), interpolate(from[1], to[1], t), @@ -58557,22 +57909,18 @@ interpolate.color = function(from, to, t) { interpolate(from[3], to[3], t) ]; }; - -interpolate.array = function(from, to, t) { - return from.map(function(d, i) { +interpolate.array = function (from, to, t) { + return from.map(function (d, i) { return interpolate(d, to[i], t); }); }; - -},{}],344:[function(require,module,exports){ +},{}],361:[function(require,module,exports){ 'use strict'; - module.exports = { multiPolygonIntersectsBufferedMultiPoint: multiPolygonIntersectsBufferedMultiPoint, multiPolygonIntersectsMultiPolygon: multiPolygonIntersectsMultiPolygon, multiPolygonIntersectsBufferedMultiLine: multiPolygonIntersectsBufferedMultiLine }; - function multiPolygonIntersectsBufferedMultiPoint(multiPolygon, rings, radius) { for (var j = 0; j < multiPolygon.length; j++) { var polygon = multiPolygon[j]; @@ -58580,78 +57928,71 @@ function multiPolygonIntersectsBufferedMultiPoint(multiPolygon, rings, radius) { var ring = rings[i]; for (var k = 0; k < ring.length; k++) { var point = ring[k]; - if (polygonContainsPoint(polygon, point)) return true; - if (pointIntersectsBufferedLine(point, polygon, radius)) return true; + if (polygonContainsPoint(polygon, point)) + return true; + if (pointIntersectsBufferedLine(point, polygon, radius)) + return true; } } } return false; } - function multiPolygonIntersectsMultiPolygon(multiPolygonA, multiPolygonB) { - if (multiPolygonA.length === 1 && multiPolygonA[0].length === 1) { return multiPolygonContainsPoint(multiPolygonB, multiPolygonA[0][0]); } - for (var m = 0; m < multiPolygonB.length; m++) { var ring = multiPolygonB[m]; for (var n = 0; n < ring.length; n++) { - if (multiPolygonContainsPoint(multiPolygonA, ring[n])) return true; + if (multiPolygonContainsPoint(multiPolygonA, ring[n])) + return true; } } - for (var j = 0; j < multiPolygonA.length; j++) { var polygon = multiPolygonA[j]; for (var i = 0; i < polygon.length; i++) { - if (multiPolygonContainsPoint(multiPolygonB, polygon[i])) return true; + if (multiPolygonContainsPoint(multiPolygonB, polygon[i])) + return true; } - for (var k = 0; k < multiPolygonB.length; k++) { - if (lineIntersectsLine(polygon, multiPolygonB[k])) return true; + if (lineIntersectsLine(polygon, multiPolygonB[k])) + return true; } } - return false; } - function multiPolygonIntersectsBufferedMultiLine(multiPolygon, multiLine, radius) { for (var i = 0; i < multiLine.length; i++) { var line = multiLine[i]; - for (var j = 0; j < multiPolygon.length; j++) { var polygon = multiPolygon[j]; - if (polygon.length >= 3) { for (var k = 0; k < line.length; k++) { - if (polygonContainsPoint(polygon, line[k])) return true; + if (polygonContainsPoint(polygon, line[k])) + return true; } } - - if (lineIntersectsBufferedLine(polygon, line, radius)) return true; + if (lineIntersectsBufferedLine(polygon, line, radius)) + return true; } } return false; } - function lineIntersectsBufferedLine(lineA, lineB, radius) { - if (lineA.length > 1) { - if (lineIntersectsLine(lineA, lineB)) return true; - - // Check whether any point in either line is within radius of the other line + if (lineIntersectsLine(lineA, lineB)) + return true; for (var j = 0; j < lineB.length; j++) { - if (pointIntersectsBufferedLine(lineB[j], lineA, radius)) return true; + if (pointIntersectsBufferedLine(lineB[j], lineA, radius)) + return true; } } - for (var k = 0; k < lineA.length; k++) { - if (pointIntersectsBufferedLine(lineA[k], lineB, radius)) return true; + if (pointIntersectsBufferedLine(lineA[k], lineB, radius)) + return true; } - return false; } - function lineIntersectsLine(lineA, lineB) { for (var i = 0; i < lineA.length - 1; i++) { var a0 = lineA[i]; @@ -58659,292 +58000,205 @@ function lineIntersectsLine(lineA, lineB) { for (var j = 0; j < lineB.length - 1; j++) { var b0 = lineB[j]; var b1 = lineB[j + 1]; - if (lineSegmentIntersectsLineSegment(a0, a1, b0, b1)) return true; + if (lineSegmentIntersectsLineSegment(a0, a1, b0, b1)) + return true; } } return false; } - - -// http://bryceboe.com/2006/10/23/line-segment-intersection-algorithm/ function isCounterClockwise(a, b, c) { return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x); } - function lineSegmentIntersectsLineSegment(a0, a1, b0, b1) { - return isCounterClockwise(a0, b0, b1) !== isCounterClockwise(a1, b0, b1) && - isCounterClockwise(a0, a1, b0) !== isCounterClockwise(a0, a1, b1); + return isCounterClockwise(a0, b0, b1) !== isCounterClockwise(a1, b0, b1) && isCounterClockwise(a0, a1, b0) !== isCounterClockwise(a0, a1, b1); } - function pointIntersectsBufferedLine(p, line, radius) { var radiusSquared = radius * radius; - - if (line.length === 1) return p.distSqr(line[0]) < radiusSquared; - + if (line.length === 1) + return p.distSqr(line[0]) < radiusSquared; for (var i = 1; i < line.length; i++) { - // Find line segments that have a distance <= radius^2 to p - // In that case, we treat the line as "containing point p". var v = line[i - 1], w = line[i]; - if (distToSegmentSquared(p, v, w) < radiusSquared) return true; + if (distToSegmentSquared(p, v, w) < radiusSquared) + return true; } return false; } - -// Code from http://stackoverflow.com/a/1501725/331379. function distToSegmentSquared(p, v, w) { var l2 = v.distSqr(w); - if (l2 === 0) return p.distSqr(v); + if (l2 === 0) + return p.distSqr(v); var t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2; - if (t < 0) return p.distSqr(v); - if (t > 1) return p.distSqr(w); + if (t < 0) + return p.distSqr(v); + if (t > 1) + return p.distSqr(w); return p.distSqr(w.sub(v)._mult(t)._add(v)); } - -// point in polygon ray casting algorithm function multiPolygonContainsPoint(rings, p) { - var c = false, - ring, p1, p2; - + var c = false, ring, p1, p2; for (var k = 0; k < rings.length; k++) { ring = rings[k]; for (var i = 0, j = ring.length - 1; i < ring.length; j = i++) { p1 = ring[i]; p2 = ring[j]; - if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) { + if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) { c = !c; } } } return c; } - function polygonContainsPoint(ring, p) { var c = false; for (var i = 0, j = ring.length - 1; i < ring.length; j = i++) { var p1 = ring[i]; var p2 = ring[j]; - if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) { + if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) { c = !c; } } return c; } - -},{}],345:[function(require,module,exports){ +},{}],362:[function(require,module,exports){ 'use strict'; - module.exports = LRUCache; - -/** - * A [least-recently-used cache](http://en.wikipedia.org/wiki/Cache_algorithms) - * with hash lookup made possible by keeping a list of keys in parallel to - * an array of dictionary of values - * - * @param {number} max number of permitted values - * @param {Function} onRemove callback called with items when they expire - * @private - */ function LRUCache(max, onRemove) { this.max = max; this.onRemove = onRemove; this.reset(); } - -/** - * Clear the cache - * - * @returns {LRUCache} this cache - * @private - */ -LRUCache.prototype.reset = function() { +LRUCache.prototype.reset = function () { for (var key in this.data) { this.onRemove(this.data[key]); } - this.data = {}; this.order = []; - return this; }; - -/** - * Add a key, value combination to the cache, trimming its size if this pushes - * it over max length. - * - * @param {string} key lookup key for the item - * @param {*} data any value - * - * @returns {LRUCache} this cache - * @private - */ -LRUCache.prototype.add = function(key, data) { - +LRUCache.prototype.add = function (key, data) { if (this.has(key)) { this.order.splice(this.order.indexOf(key), 1); this.data[key] = data; this.order.push(key); - } else { this.data[key] = data; this.order.push(key); - if (this.order.length > this.max) { var removedData = this.get(this.order[0]); - if (removedData) this.onRemove(removedData); + if (removedData) + this.onRemove(removedData); } } - return this; }; - -/** - * Determine whether the value attached to `key` is present - * - * @param {string} key the key to be looked-up - * @returns {boolean} whether the cache has this value - * @private - */ -LRUCache.prototype.has = function(key) { +LRUCache.prototype.has = function (key) { return key in this.data; }; - -/** - * List all keys in the cache - * - * @returns {Array} an array of keys in this cache. - * @private - */ -LRUCache.prototype.keys = function() { +LRUCache.prototype.keys = function () { return this.order; }; - -/** - * Get the value attached to a specific key. If the key is not found, - * returns `null` - * - * @param {string} key the key to look up - * @returns {*} the data, or null if it isn't found - * @private - */ -LRUCache.prototype.get = function(key) { - if (!this.has(key)) { return null; } - +LRUCache.prototype.get = function (key) { + if (!this.has(key)) { + return null; + } var data = this.data[key]; - delete this.data[key]; this.order.splice(this.order.indexOf(key), 1); - return data; }; - -/** - * Change the max size of the cache. - * - * @param {number} max the max size of the cache - * @returns {LRUCache} this cache - * @private - */ -LRUCache.prototype.setMaxSize = function(max) { +LRUCache.prototype.setMaxSize = function (max) { this.max = max; - while (this.order.length > this.max) { var removedData = this.get(this.order[0]); - if (removedData) this.onRemove(removedData); + if (removedData) + this.onRemove(removedData); } - return this; }; - -},{}],346:[function(require,module,exports){ +},{}],363:[function(require,module,exports){ 'use strict'; - var config = require('./config'); var browser = require('./browser'); - +var URL = require('url'); +var util = require('./util'); function normalizeURL(url, pathPrefix, accessToken) { accessToken = accessToken || config.ACCESS_TOKEN; - if (!accessToken && config.REQUIRE_ACCESS_TOKEN) { - throw new Error('An API access token is required to use Mapbox GL. ' + - 'See https://www.mapbox.com/developers/api/#access-tokens'); + throw new Error('An API access token is required to use Mapbox GL. ' + 'See https://www.mapbox.com/developers/api/#access-tokens'); } - url = url.replace(/^mapbox:\/\//, config.API_URL + pathPrefix); url += url.indexOf('?') !== -1 ? '&access_token=' : '?access_token='; - if (config.REQUIRE_ACCESS_TOKEN) { if (accessToken[0] === 's') { - throw new Error('Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). ' + - 'See https://www.mapbox.com/developers/api/#access-tokens'); + throw new Error('Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). ' + 'See https://www.mapbox.com/developers/api/#access-tokens'); } - url += accessToken; } - return url; } - -module.exports.normalizeStyleURL = function(url, accessToken) { - if (!url.match(/^mapbox:\/\/styles\//)) +module.exports.normalizeStyleURL = function (url, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { return url; - - var split = url.split('/'); - var user = split[3]; - var style = split[4]; - var draft = split[5] ? '/draft' : ''; - return normalizeURL('mapbox://' + user + '/' + style + draft, '/styles/v1/', accessToken); + } else { + return normalizeURL('mapbox:/' + urlObject.pathname + formatQuery(urlObject.query), '/styles/v1/', accessToken); + } }; - -module.exports.normalizeSourceURL = function(url, accessToken) { - if (!url.match(/^mapbox:\/\//)) +module.exports.normalizeSourceURL = function (url, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { return url; - - // TileJSON requests need a secure flag appended to their URLs so - // that the server knows to send SSL-ified resource references. - return normalizeURL(url + '.json', '/v4/', accessToken) + '&secure'; + } else { + return normalizeURL(url + '.json', '/v4/', accessToken) + '&secure'; + } }; - -module.exports.normalizeGlyphsURL = function(url, accessToken) { - if (!url.match(/^mapbox:\/\//)) +module.exports.normalizeGlyphsURL = function (url, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { return url; - - var user = url.split('/')[3]; - return normalizeURL('mapbox://' + user + '/{fontstack}/{range}.pbf', '/fonts/v1/', accessToken); -}; - -module.exports.normalizeSpriteURL = function(url, format, ext, accessToken) { - if (!url.match(/^mapbox:\/\/sprites\//)) - return url + format + ext; - - var split = url.split('/'); - var user = split[3]; - var style = split[4]; - var draft = split[5] ? '/draft' : ''; - return normalizeURL('mapbox://' + user + '/' + style + draft + '/sprite' + format + ext, '/styles/v1/', accessToken); + } else { + var user = urlObject.pathname.split('/')[1]; + return normalizeURL('mapbox://' + user + '/{fontstack}/{range}.pbf' + formatQuery(urlObject.query), '/fonts/v1/', accessToken); + } }; - -module.exports.normalizeTileURL = function(url, sourceUrl, tileSize) { - if (!sourceUrl || !sourceUrl.match(/^mapbox:\/\//)) - return url; - - // The v4 mapbox tile API supports 512x512 image tiles only when @2x - // is appended to the tile URL. If `tileSize: 512` is specified for - // a Mapbox raster source force the @2x suffix even if a non hidpi - // device. - url = url.replace(/([?&]access_token=)tk\.[^&]+/, '$1' + config.ACCESS_TOKEN); - var extension = browser.supportsWebp ? 'webp' : '$1'; - return url.replace(/\.((?:png|jpg)\d*)(?=$|\?)/, browser.devicePixelRatio >= 2 || tileSize === 512 ? '@2x.' + extension : '.' + extension); +module.exports.normalizeSpriteURL = function (url, format, extension, accessToken) { + var urlObject = URL.parse(url); + if (urlObject.protocol !== 'mapbox:') { + urlObject.pathname += format + extension; + return URL.format(urlObject); + } else { + return normalizeURL('mapbox:/' + urlObject.pathname + '/sprite' + format + extension + formatQuery(urlObject.query), '/styles/v1/', accessToken); + } +}; +module.exports.normalizeTileURL = function (tileURL, sourceURL, tileSize) { + var tileURLObject = URL.parse(tileURL, true); + if (!sourceURL) + return tileURL; + var sourceURLObject = URL.parse(sourceURL); + if (sourceURLObject.protocol !== 'mapbox:') + return tileURL; + var extension = browser.supportsWebp ? '.webp' : '$1'; + var resolution = browser.devicePixelRatio >= 2 || tileSize === 512 ? '@2x' : ''; + return URL.format({ + protocol: tileURLObject.protocol, + hostname: tileURLObject.hostname, + pathname: tileURLObject.pathname.replace(/(\.(?:png|jpg)\d*)/, resolution + extension), + query: replaceTempAccessToken(tileURLObject.query) + }); }; - -},{"./browser":335,"./config":339}],347:[function(require,module,exports){ +function formatQuery(query) { + return query ? '?' + query : ''; +} +function replaceTempAccessToken(query) { + if (query.access_token && query.access_token.slice(0, 3) === 'tk.') { + return util.extend({}, query, { 'access_token': config.ACCESS_TOKEN }); + } else { + return query; + } +} +},{"./browser":350,"./config":355,"./util":366,"url":64}],364:[function(require,module,exports){ 'use strict'; - -// Note: all "sizes" are measured in bytes - -var assert = require('assert'); - module.exports = StructArrayType; - var viewTypes = { 'Int8': Int8Array, 'Uint8': Uint8Array, @@ -58956,126 +58210,56 @@ var viewTypes = { 'Float32': Float32Array, 'Float64': Float64Array }; - -/** - * @typedef StructMember - * @private - * @property {string} name - * @property {string} type - * @property {number} components - */ - var structArrayTypeCache = {}; - -/** - * `StructArrayType` is used to create new `StructArray` types. - * - * `StructArray` provides an abstraction over `ArrayBuffer` and `TypedArray` making it behave like - * an array of typed structs. A StructArray is comprised of elements. Each element has a set of - * members that are defined when the `StructArrayType` is created. - * - * StructArrays useful for creating large arrays that: - * - can be transferred from workers as a Transferable object - * - can be copied cheaply - * - use less memory for lower-precision members - * - can be used as buffers in WebGL. - * - * @class StructArrayType - * @param {Array.} - * @param options - * @param {number} options.alignment Use `4` to align members to 4 byte boundaries. Default is 1. - * - * @example - * - * var PointArrayType = new StructArrayType({ - * members: [ - * { type: 'Int16', name: 'x' }, - * { type: 'Int16', name: 'y' } - * ]}); - * - * var pointArray = new PointArrayType(); - * pointArray.emplaceBack(10, 15); - * pointArray.emplaceBack(20, 35); - * - * point = pointArray.get(0); - * assert(point.x === 10); - * assert(point.y === 15); - * - * @private - */ function StructArrayType(options) { - var key = JSON.stringify(options); if (structArrayTypeCache[key]) { return structArrayTypeCache[key]; } - - if (options.alignment === undefined) options.alignment = 1; - + if (options.alignment === undefined) + options.alignment = 1; function StructType() { Struct.apply(this, arguments); } - StructType.prototype = Object.create(Struct.prototype); - var offset = 0; var maxSize = 0; var usedTypes = ['Uint8']; - - StructType.prototype.members = options.members.map(function(member) { + StructType.prototype.members = options.members.map(function (member) { member = { name: member.name, type: member.type, components: member.components || 1 }; - - assert(member.name.length); - assert(member.type in viewTypes); - - if (usedTypes.indexOf(member.type) < 0) usedTypes.push(member.type); - + if (usedTypes.indexOf(member.type) < 0) + usedTypes.push(member.type); var typeSize = sizeOf(member.type); maxSize = Math.max(maxSize, typeSize); member.offset = offset = align(offset, Math.max(options.alignment, typeSize)); - for (var c = 0; c < member.components; c++) { Object.defineProperty(StructType.prototype, member.name + (member.components === 1 ? '' : c), { get: createGetter(member, c), set: createSetter(member, c) }); } - offset += typeSize * member.components; - return member; }); - StructType.prototype.alignment = options.alignment; StructType.prototype.size = align(offset, Math.max(maxSize, options.alignment)); - function StructArrayType() { StructArray.apply(this, arguments); this.members = StructType.prototype.members; } - StructArrayType.serialize = serializeStructArrayType; - StructArrayType.prototype = Object.create(StructArray.prototype); StructArrayType.prototype.StructType = StructType; StructArrayType.prototype.bytesPerElement = StructType.prototype.size; StructArrayType.prototype.emplaceBack = createEmplaceBack(StructType.prototype.members, StructType.prototype.size); StructArrayType.prototype._usedTypes = usedTypes; - - structArrayTypeCache[key] = StructArrayType; - return StructArrayType; } - -/** - * Serialize the StructArray type. This serializes the *type* not an instance of the type. - * @private - */ function serializeStructArrayType() { return { members: this.prototype.StructType.prototype.members, @@ -59083,42 +58267,26 @@ function serializeStructArrayType() { bytesPerElement: this.prototype.bytesPerElement }; } - - function align(offset, size) { return Math.ceil(offset / size) * size; } - function sizeOf(type) { return viewTypes[type].BYTES_PER_ELEMENT; } - function getArrayViewName(type) { return type.toLowerCase(); } - - -/* - * > I saw major perf gains by shortening the source of these generated methods (i.e. renaming - * > elementIndex to i) (likely due to v8 inlining heuristics). - * - lucaswoj - */ function createEmplaceBack(members, bytesPerElement) { var usedTypeSizes = []; var argNames = []; - var body = '' + - 'var i = this.length;\n' + - 'this.resize(this.length + 1);\n'; - + var body = '' + 'var i = this.length;\n' + 'this.resize(this.length + 1);\n'; for (var m = 0; m < members.length; m++) { var member = members[m]; var size = sizeOf(member.type); - if (usedTypeSizes.indexOf(size) < 0) { usedTypeSizes.push(size); body += 'var o' + size.toFixed(0) + ' = i * ' + (bytesPerElement / size).toFixed(0) + ';\n'; } - for (var c = 0; c < member.components; c++) { var argName = 'v' + argNames.length; var index = 'o' + size.toFixed(0) + ' + ' + (member.offset / size + c).toFixed(0); @@ -59126,34 +58294,21 @@ function createEmplaceBack(members, bytesPerElement) { argNames.push(argName); } } - body += 'return i;'; - return new Function(argNames, body); } - function createMemberComponentString(member, component) { var elementOffset = 'this._pos' + sizeOf(member.type).toFixed(0); var componentOffset = (member.offset / sizeOf(member.type) + component).toFixed(0); var index = elementOffset + ' + ' + componentOffset; return 'this._structArray.' + getArrayViewName(member.type) + '[' + index + ']'; - } - function createGetter(member, c) { return new Function([], 'return ' + createMemberComponentString(member, c) + ';'); } - function createSetter(member, c) { return new Function(['x'], createMemberComponentString(member, c) + ' = x;'); } - -/** - * @class Struct - * @param {StructArray} structArray The StructArray the struct is stored in - * @param {number} index The index of the struct in the StructArray. - * @private - */ function Struct(structArray, index) { this._structArray = structArray; this._pos1 = index * this.size; @@ -59161,269 +58316,120 @@ function Struct(structArray, index) { this._pos4 = this._pos1 / 4; this._pos8 = this._pos1 / 8; } - -/** - * @class StructArray - * The StructArray class is inherited by the custom StructArrayType classes created with - * `new StructArrayType(members, options)`. - * @private - */ function StructArray(serialized) { if (serialized !== undefined) { - // Create from an serialized StructArray this.arrayBuffer = serialized.arrayBuffer; this.length = serialized.length; this.capacity = this.arrayBuffer.byteLength / this.bytesPerElement; this._refreshViews(); - - // Create a new StructArray } else { this.capacity = -1; this.resize(0); } } - -/** - * @property {number} - * @private - * @readonly - */ StructArray.prototype.DEFAULT_CAPACITY = 128; - -/** - * @property {number} - * @private - * @readonly - */ StructArray.prototype.RESIZE_MULTIPLIER = 5; - -/** - * Serialize this StructArray instance - * @private - */ -StructArray.prototype.serialize = function() { +StructArray.prototype.serialize = function () { this.trim(); return { length: this.length, arrayBuffer: this.arrayBuffer }; }; - -/** - * Return the Struct at the given location in the array. - * @private - * @param {number} index The index of the element. - */ -StructArray.prototype.get = function(index) { +StructArray.prototype.get = function (index) { return new this.StructType(this, index); }; - -/** - * Resize the array to discard unused capacity. - * @private - */ -StructArray.prototype.trim = function() { +StructArray.prototype.trim = function () { if (this.length !== this.capacity) { this.capacity = this.length; this.arrayBuffer = this.arrayBuffer.slice(0, this.length * this.bytesPerElement); this._refreshViews(); } }; - -/** - * Resize the array. - * If `n` is greater than the current length then additional elements with undefined values are added. - * If `n` is less than the current length then the array will be reduced to the first `n` elements. - * @param {number} n The new size of the array. - */ -StructArray.prototype.resize = function(n) { +StructArray.prototype.resize = function (n) { this.length = n; if (n > this.capacity) { this.capacity = Math.max(n, Math.floor(this.capacity * this.RESIZE_MULTIPLIER), this.DEFAULT_CAPACITY); this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement); - var oldUint8Array = this.uint8; this._refreshViews(); - if (oldUint8Array) this.uint8.set(oldUint8Array); + if (oldUint8Array) + this.uint8.set(oldUint8Array); } }; - -/** - * Create TypedArray views for the current ArrayBuffer. - * @private - */ -StructArray.prototype._refreshViews = function() { +StructArray.prototype._refreshViews = function () { for (var t = 0; t < this._usedTypes.length; t++) { var type = this._usedTypes[t]; this[getArrayViewName(type)] = new viewTypes[type](this.arrayBuffer); } }; - -},{"assert":52}],348:[function(require,module,exports){ +StructArray.prototype.toArray = function (startIndex, endIndex) { + var array = []; + for (var i = startIndex; i < endIndex; i++) { + var struct = this.get(i); + array.push(struct); + } + return array; +}; +},{}],365:[function(require,module,exports){ 'use strict'; - module.exports = resolveTokens; - -/** - * Replace tokens in a string template with values in an object - * - * @param {Object} properties a key/value relationship between tokens and replacements - * @param {string} text the template string - * @returns {string} the template with tokens replaced - * @private - */ function resolveTokens(properties, text) { - return text.replace(/{([^{}()\[\]<>$=:;.,^]+)}/g, function(match, key) { + return text.replace(/{([^{}]+)}/g, function (match, key) { return key in properties ? properties[key] : ''; }); } - -},{}],349:[function(require,module,exports){ +},{}],366:[function(require,module,exports){ 'use strict'; - var UnitBezier = require('unitbezier'); var Coordinate = require('../geo/coordinate'); - -/** - * Given a value `t` that varies between 0 and 1, return - * an interpolation function that eases between 0 and 1 in a pleasing - * cubic in-out fashion. - * - * @param {number} t input - * @returns {number} input - * @private - */ exports.easeCubicInOut = function (t) { - if (t <= 0) return 0; - if (t >= 1) return 1; - var t2 = t * t, - t3 = t2 * t; + if (t <= 0) + return 0; + if (t >= 1) + return 1; + var t2 = t * t, t3 = t2 * t; return 4 * (t < 0.5 ? t3 : 3 * (t - t2) + t3 - 0.75); }; - -/** - * Given given (x, y), (x1, y1) control points for a bezier curve, - * return a function that interpolates along that curve. - * - * @param {number} p1x control point 1 x coordinate - * @param {number} p1y control point 1 y coordinate - * @param {number} p2x control point 2 x coordinate - * @param {number} p2y control point 2 y coordinate - * @returns {Function} interpolator: receives number value, returns - * number value. - * @private - */ -exports.bezier = function(p1x, p1y, p2x, p2y) { +exports.bezier = function (p1x, p1y, p2x, p2y) { var bezier = new UnitBezier(p1x, p1y, p2x, p2y); - return function(t) { + return function (t) { return bezier.solve(t); }; }; - -/** - * A default bezier-curve powered easing function with - * control points (0.25, 0.1) and (0.25, 1) - * - * @param {number} t - * @returns {number} output - * @private - */ exports.ease = exports.bezier(0.25, 0.1, 0.25, 1); - -/** - * Given a four-element array of numbers that represents a color in - * RGBA, return a version for which the RGB components are multiplied - * by the A (alpha) component - * - * @param {Array} color color array - * @returns {Array} premultiplied color array - * @private - */ -exports.premultiply = function (color) { - if (!color) return null; - var opacity = color[3]; - return [ - color[0] * opacity, - color[1] * opacity, - color[2] * opacity, - opacity - ]; -}; - -/** - * constrain n to the given range via min + max - * - * @param {number} n value - * @param {number} min the minimum value to be returned - * @param {number} max the maximum value to be returned - * @returns {number} the clamped value - * @private - */ exports.clamp = function (n, min, max) { return Math.min(max, Math.max(min, n)); }; - -/* - * constrain n to the given range, excluding the minimum, via modular arithmetic - * @param {number} n value - * @param {number} min the minimum value to be returned, exclusive - * @param {number} max the maximum value to be returned, inclusive - * @returns {number} constrained number - * @private - */ exports.wrap = function (n, min, max) { var d = max - min; var w = ((n - min) % d + d) % d + min; - return (w === min) ? max : w; + return w === min ? max : w; }; - -/* - * return the first non-null and non-undefined argument to this function. - * @returns {*} argument - * @private - */ -exports.coalesce = function() { +exports.coalesce = function () { for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (arg !== null && arg !== undefined) return arg; } }; - -/* - * Call an asynchronous function on an array of arguments, - * calling `callback` with the completed results of all calls. - * - * @param {Array<*>} array input to each call of the async function. - * @param {Function} fn an async function with signature (data, callback) - * @param {Function} callback a callback run after all async work is done. - * called with an array, containing the results of each async call. - * @returns {undefined} - * @private - */ exports.asyncAll = function (array, fn, callback) { - if (!array.length) { return callback(null, []); } + if (!array.length) { + return callback(null, []); + } var remaining = array.length; var results = new Array(array.length); var error = null; array.forEach(function (item, i) { fn(item, function (err, result) { - if (err) error = err; + if (err) + error = err; results[i] = result; - if (--remaining === 0) callback(error, results); + if (--remaining === 0) + callback(error, results); }); }); }; - -/* - * Compute the difference between the keys in one object and the keys - * in another object. - * - * @param {Object} obj - * @param {Object} other - * @returns {Array} keys difference - * @private - */ exports.keysDifference = function (obj, other) { var difference = []; for (var i in obj) { @@ -59433,17 +58439,6 @@ exports.keysDifference = function (obj, other) { } return difference; }; - -/** - * Given a destination object and optionally many source objects, - * copy all properties from the source objects into the destination. - * The last source object given overrides properties from previous - * source objects. - * @param {Object} dest destination object - * @param {...Object} sources sources from which properties are pulled - * @returns {Object} dest - * @private - */ exports.extend = function (dest) { for (var i = 1; i < arguments.length; i++) { var src = arguments[i]; @@ -59453,52 +58448,17 @@ exports.extend = function (dest) { } return dest; }; - -/** - * Extend a destination object with all properties of the src object, - * using defineProperty instead of simple assignment. - * @param {Object} dest - * @param {Object} src - * @returns {Object} dest - * @private - */ exports.extendAll = function (dest, src) { for (var i in src) { Object.defineProperty(dest, i, Object.getOwnPropertyDescriptor(src, i)); } return dest; }; - -/** - * Extend a parent's prototype with all properties in a properties - * object. - * - * @param {Object} parent - * @param {Object} props - * @returns {Object} - * @private - */ exports.inherit = function (parent, props) { - var parentProto = typeof parent === 'function' ? parent.prototype : parent, - proto = Object.create(parentProto); + var parentProto = typeof parent === 'function' ? parent.prototype : parent, proto = Object.create(parentProto); exports.extendAll(proto, props); return proto; }; - -/** - * Given an object and a number of properties as strings, return version - * of that object with only those properties. - * - * @param {Object} src the object - * @param {Array} properties an array of property names chosen - * to appear on the resulting object. - * @returns {Object} object with limited properties. - * @example - * var foo = { name: 'Charlie', age: 10 }; - * var justName = pick(foo, ['name']); - * // justName = { name: 'Charlie' } - * @private - */ exports.pick = function (src, properties) { var result = {}; for (var i = 0; i < properties.length; i++) { @@ -59509,96 +58469,36 @@ exports.pick = function (src, properties) { } return result; }; - var id = 1; - -/** - * Return a unique numeric id, starting at 1 and incrementing with - * each call. - * - * @returns {number} unique numeric id. - * @private - */ exports.uniqueId = function () { return id++; }; - -/** - * Create a version of `fn` that is only called `time` milliseconds - * after its last invocation - * - * @param {Function} fn the function to be debounced - * @param {number} time millseconds after which the function will be invoked - * @returns {Function} debounced function - * @private - */ -exports.debounce = function(fn, time) { +exports.debounce = function (fn, time) { var timer, args; - - return function() { + return function () { args = arguments; clearTimeout(timer); - - timer = setTimeout(function() { + timer = setTimeout(function () { fn.apply(null, args); }, time); }; }; - -/** - * Given an array of member function names as strings, replace all of them - * with bound versions that will always refer to `context` as `this`. This - * is useful for classes where otherwise event bindings would reassign - * `this` to the evented object or some other value: this lets you ensure - * the `this` value always. - * - * @param {Array} fns list of member function names - * @param {*} context the context value - * @returns {undefined} changes functions in-place - * @example - * function MyClass() { - * bindAll(['ontimer'], this); - * this.name = 'Tom'; - * } - * MyClass.prototype.ontimer = function() { - * alert(this.name); - * }; - * var myClass = new MyClass(); - * setTimeout(myClass.ontimer, 100); - * @private - */ -exports.bindAll = function(fns, context) { - fns.forEach(function(fn) { +exports.bindAll = function (fns, context) { + fns.forEach(function (fn) { + if (!context[fn]) { + return; + } context[fn] = context[fn].bind(context); }); }; - -/** - * Given a class, bind all of the methods that look like handlers: that - * begin with _on, and bind them to the class. - * - * @param {Object} context an object with methods - * @private - */ -exports.bindHandlers = function(context) { +exports.bindHandlers = function (context) { for (var i in context) { if (typeof context[i] === 'function' && i.indexOf('_on') === 0) { context[i] = context[i].bind(context); } } }; - -/** - * Set the 'options' property on `obj` with properties - * from the `options` argument. Properties in the `options` - * object will override existing properties. - * - * @param {Object} obj destination object - * @param {Object} options object of override options - * @returns {Object} derived options object. - * @private - */ -exports.setOptions = function(obj, options) { +exports.setOptions = function (obj, options) { if (!obj.hasOwnProperty('options')) { obj.options = obj.options ? Object.create(obj.options) : {}; } @@ -59607,79 +58507,36 @@ exports.setOptions = function(obj, options) { } return obj.options; }; - -/** - * Given a list of coordinates, get their center as a coordinate. - * @param {Array} coords - * @returns {Coordinate} centerpoint - * @private - */ -exports.getCoordinatesCenter = function(coords) { +exports.getCoordinatesCenter = function (coords) { var minX = Infinity; var minY = Infinity; var maxX = -Infinity; var maxY = -Infinity; - for (var i = 0; i < coords.length; i++) { minX = Math.min(minX, coords[i].column); minY = Math.min(minY, coords[i].row); maxX = Math.max(maxX, coords[i].column); maxY = Math.max(maxY, coords[i].row); } - var dx = maxX - minX; var dy = maxY - minY; var dMax = Math.max(dx, dy); - return new Coordinate((minX + maxX) / 2, (minY + maxY) / 2, 0) - .zoomTo(Math.floor(-Math.log(dMax) / Math.LN2)); + return new Coordinate((minX + maxX) / 2, (minY + maxY) / 2, 0).zoomTo(Math.floor(-Math.log(dMax) / Math.LN2)); }; - -/** - * Determine if a string ends with a particular substring - * @param {string} string - * @param {string} suffix - * @returns {boolean} - * @private - */ -exports.endsWith = function(string, suffix) { +exports.endsWith = function (string, suffix) { return string.indexOf(suffix, string.length - suffix.length) !== -1; }; - -/** - * Determine if a string starts with a particular substring - * @param {string} string - * @param {string} prefix - * @returns {boolean} - * @private - */ -exports.startsWith = function(string, prefix) { +exports.startsWith = function (string, prefix) { return string.indexOf(prefix) === 0; }; - -/** - * Create an object by mapping all the values of an existing object while - * preserving their keys. - * @param {Object} input - * @param {Function} iterator - * @returns {Object} - * @private - */ -exports.mapObject = function(input, iterator, context) { +exports.mapObject = function (input, iterator, context) { var output = {}; for (var key in input) { output[key] = iterator.call(context || this, input[key], key, input); } return output; }; - -/** - * Create an object by filtering out values of an existing object - * @param {Object} input - * @param {Function} iterator - * @returns {Object} - * @private - */ -exports.filterObject = function(input, iterator, context) { +exports.filterObject = function (input, iterator, context) { var output = {}; for (var key in input) { if (iterator.call(context || this, input[key], key, input)) { @@ -59688,41 +58545,30 @@ exports.filterObject = function(input, iterator, context) { } return output; }; - -/** - * Deeply compares two object literals. - * @param {Object} obj1 - * @param {Object} obj2 - * @returns {boolean} - * @private - */ exports.deepEqual = function deepEqual(a, b) { if (Array.isArray(a)) { - if (!Array.isArray(b) || a.length !== b.length) return false; + if (!Array.isArray(b) || a.length !== b.length) + return false; for (var i = 0; i < a.length; i++) { - if (!deepEqual(a[i], b[i])) return false; + if (!deepEqual(a[i], b[i])) + return false; } return true; } - if (typeof a === 'object') { - if (!(typeof b === 'object')) return false; + if (typeof a === 'object' && a !== null && b !== null) { + if (!(typeof b === 'object')) + return false; var keys = Object.keys(a); - if (keys.length !== Object.keys(b).length) return false; + if (keys.length !== Object.keys(b).length) + return false; for (var key in a) { - if (!deepEqual(a[key], b[key])) return false; + if (!deepEqual(a[key], b[key])) + return false; } return true; } return a === b; }; - -/** - * Deeply clones two objects. - * @param {Object} obj1 - * @param {Object} obj2 - * @returns {boolean} - * @private - */ exports.clone = function deepEqual(input) { if (Array.isArray(input)) { return input.map(exports.clone); @@ -59732,108 +58578,56 @@ exports.clone = function deepEqual(input) { return input; } }; - -/** - * Check if two arrays have at least one common element. - * @param {Array} a - * @param {Array} b - * @returns {boolean} - * @private - */ -exports.arraysIntersect = function(a, b) { +exports.arraysIntersect = function (a, b) { for (var l = 0; l < a.length; l++) { - if (b.indexOf(a[l]) >= 0) return true; + if (b.indexOf(a[l]) >= 0) + return true; } return false; }; - -},{"../geo/coordinate":255,"unitbezier":412}],350:[function(require,module,exports){ +var warnOnceHistory = {}; +exports.warnOnce = function (message) { + if (!warnOnceHistory[message]) { + if (typeof console !== 'undefined') + console.warn(message); + warnOnceHistory[message] = true; + } +}; +},{"../geo/coordinate":262,"unitbezier":433}],367:[function(require,module,exports){ 'use strict'; - -var VectorTileFeature = require('vector-tile').VectorTileFeature; - module.exports = Feature; - function Feature(vectorTileFeature, z, x, y) { this._vectorTileFeature = vectorTileFeature; vectorTileFeature._z = z; vectorTileFeature._x = x; vectorTileFeature._y = y; - this.properties = vectorTileFeature.properties; - - if (vectorTileFeature._id) { - this.id = vectorTileFeature._id; + if (vectorTileFeature.id != null) { + this.id = vectorTileFeature.id; } } - Feature.prototype = { - type: "Feature", - + type: 'Feature', get geometry() { if (this._geometry === undefined) { - var feature = this._vectorTileFeature; - var coords = projectCoords( - feature.loadGeometry(), - feature.extent, - feature._z, feature._x, feature._y); - - var type = VectorTileFeature.types[feature.type]; - - if (type === 'Point' && coords.length === 1) { - coords = coords[0][0]; - } else if (type === 'Point') { - coords = coords[0]; - type = 'MultiPoint'; - } else if (type === 'LineString' && coords.length === 1) { - coords = coords[0]; - } else if (type === 'LineString') { - type = 'MultiLineString'; - } - - this._geometry = { - type: type, - coordinates: coords - }; - - this._vectorTileFeature = null; + this._geometry = this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x, this._vectorTileFeature._y, this._vectorTileFeature._z).geometry; } return this._geometry; }, - set geometry(g) { this._geometry = g; }, - - toJSON: function() { + toJSON: function () { var json = {}; for (var i in this) { - if (i === '_geometry' || i === '_vectorTileFeature') continue; + if (i === '_geometry' || i === '_vectorTileFeature' || i === 'toJSON') + continue; json[i] = this[i]; } return json; } }; - -function projectCoords(coords, extent, z, x, y) { - var size = extent * Math.pow(2, z), - x0 = extent * x, - y0 = extent * y; - for (var i = 0; i < coords.length; i++) { - var line = coords[i]; - for (var j = 0; j < line.length; j++) { - var p = line[j]; - var y2 = 180 - (p.y + y0) * 360 / size; - line[j] = [ - (p.x + x0) * 360 / size - 180, - 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90 - ]; - } - } - return coords; -} - -},{"vector-tile":413}],351:[function(require,module,exports){ +},{}],368:[function(require,module,exports){ // (c) Dean McNamee , 2012. // // https://github.com/deanm/css-color-parser-js @@ -60035,7 +58829,653 @@ function parseCSSColor(css_str) { try { exports.parseCSSColor = parseCSSColor } catch(e) { } -},{}],352:[function(require,module,exports){ +},{}],369:[function(require,module,exports){ +'use strict'; + +module.exports = earcut; + +function earcut(data, holeIndices, dim) { + + dim = dim || 2; + + var hasHoles = holeIndices && holeIndices.length, + outerLen = hasHoles ? holeIndices[0] * dim : data.length, + outerNode = linkedList(data, 0, outerLen, dim, true), + triangles = []; + + if (!outerNode) return triangles; + + var minX, minY, maxX, maxY, x, y, size; + + if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); + + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (data.length > 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; + + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) minX = x; + if (y < minY) minY = y; + if (x > maxX) maxX = x; + if (y > maxY) maxY = y; + } + + // minX, minY and size are later used to transform coords into integers for z-order calculation + size = Math.max(maxX - minX, maxY - minY); + } + + earcutLinked(outerNode, triangles, dim, minX, minY, size); + + return triangles; +} + +// create a circular doubly linked list from polygon points in the specified winding order +function linkedList(data, start, end, dim, clockwise) { + var i, last; + + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); + } else { + for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); + } + + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } + + return last; +} + +// eliminate colinear or duplicate points +function filterPoints(start, end) { + if (!start) return start; + if (!end) end = start; + + var p = start, + again; + do { + again = false; + + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) return null; + again = true; + + } else { + p = p.next; + } + } while (again || p !== end); + + return end; +} + +// main ear slicing loop which triangulates a polygon (given as a linked list) +function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { + if (!ear) return; + + // interlink polygon nodes in z-order + if (!pass && size) indexCurve(ear, minX, minY, size); + + var stop = ear, + prev, next; + + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; + + if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim); + triangles.push(ear.i / dim); + triangles.push(next.i / dim); + + removeNode(ear); + + // skipping the next vertice leads to less sliver triangles + ear = next.next; + stop = next.next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); + + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(ear, triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, size, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, size); + } + + break; + } + } +} + +// check whether a polygon node forms a valid ear with adjacent nodes +function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // now make sure we don't have other points inside the potential ear + var p = ear.next.next; + + while (p !== ear.prev) { + if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.next; + } + + return true; +} + +function isEarHashed(ear, minX, minY, size) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // triangle bbox; min & max are calculated like this for speed + var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), + minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), + maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), + maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); + + // z-order range for the current triangle bbox; + var minZ = zOrder(minTX, minTY, minX, minY, size), + maxZ = zOrder(maxTX, maxTY, minX, minY, size); + + // first look for points inside the triangle in increasing z-order + var p = ear.nextZ; + + while (p && p.z <= maxZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.nextZ; + } + + // then look for points in decreasing z-order + p = ear.prevZ; + + while (p && p.z >= minZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + } + + return true; +} + +// go through all polygon nodes and cure small local self-intersections +function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; + + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + + triangles.push(a.i / dim); + triangles.push(p.i / dim); + triangles.push(b.i / dim); + + // remove two nodes involved + removeNode(p); + removeNode(p.next); + + p = start = b; + } + p = p.next; + } while (p !== start); + + return p; +} + +// try splitting polygon into two and triangulate them independently +function splitEarcut(start, triangles, dim, minX, minY, size) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); + + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, size); + earcutLinked(c, triangles, dim, minX, minY, size); + return; + } + b = b.next; + } + a = a.next; + } while (a !== start); +} + +// link every hole into the outer loop, producing a single-ring polygon without holes +function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; + + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) list.steiner = true; + queue.push(getLeftmost(list)); + } + + queue.sort(compareX); + + // process holes from left to right + for (i = 0; i < queue.length; i++) { + eliminateHole(queue[i], outerNode); + outerNode = filterPoints(outerNode, outerNode.next); + } + + return outerNode; +} + +function compareX(a, b) { + return a.x - b.x; +} + +// find a bridge between vertices that connects hole with an outer ring and and link it +function eliminateHole(hole, outerNode) { + outerNode = findHoleBridge(hole, outerNode); + if (outerNode) { + var b = splitPolygon(outerNode, hole); + filterPoints(b, b.next); + } +} + +// David Eberly's algorithm for finding a bridge between hole and outer polygon +function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; + + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + if (x === hx) { + if (hy === p.y) return p; + if (hy === p.next.y) return p.next; + } + m = p.x < p.next.x ? p : p.next; + } + } + p = p.next; + } while (p !== outerNode); + + if (!m) return null; + + if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint + + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point + + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; + + p = m.next; + + while (p !== stop) { + if (hx >= p.x && p.x >= mx && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { + + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential + + if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { + m = p; + tanMin = tan; + } + } + + p = p.next; + } + + return m; +} + +// interlink polygon nodes in z-order +function indexCurve(start, minX, minY, size) { + var p = start; + do { + if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); + + p.prevZ.nextZ = null; + p.prevZ = null; + + sortLinked(p); +} + +// Simon Tatham's linked list merge sort algorithm +// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html +function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; + + do { + p = list; + list = null; + tail = null; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) break; + } + + qSize = inSize; + + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize === 0) { + e = q; + q = q.nextZ; + qSize--; + } else if (qSize === 0 || !q) { + e = p; + p = p.nextZ; + pSize--; + } else if (p.z <= q.z) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) tail.nextZ = e; + else list = e; + + e.prevZ = tail; + tail = e; + } + + p = q; + } + + tail.nextZ = null; + inSize *= 2; + + } while (numMerges > 1); + + return list; +} + +// z-order of a point given coords and size of the data bounding box +function zOrder(x, y, minX, minY, size) { + // coords are transformed into non-negative 15-bit integer range + x = 32767 * (x - minX) / size; + y = 32767 * (y - minY) / size; + + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); +} + +// find the leftmost node of a polygon ring +function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x) leftmost = p; + p = p.next; + } while (p !== start); + + return leftmost; +} + +// check if a point lies within a convex triangle +function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && + (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && + (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; +} + +// check if a diagonal between two polygon nodes is valid (lies in polygon interior) +function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && + locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); +} + +// signed area of a triangle +function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); +} + +// check if two points are equal +function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; +} + +// check if two segments intersect +function intersects(p1, q1, p2, q2) { + if ((equals(p1, q1) && equals(p2, q2)) || + (equals(p1, q2) && equals(p2, q1))) return true; + return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && + area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; +} + +// check if a polygon diagonal intersects any polygon segments +function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) return true; + p = p.next; + } while (p !== a); + + return false; +} + +// check if a polygon diagonal is locally inside the polygon +function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; +} + +// check if the middle point of a polygon diagonal is inside the polygon +function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + inside = !inside; + p = p.next; + } while (p !== a); + + return inside; +} + +// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; +// if one belongs to the outer ring and another to a hole, it merges it into a single ring +function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; + + a.next = b; + b.prev = a; + + a2.next = an; + an.prev = a2; + + b2.next = a2; + a2.prev = b2; + + bp.next = b2; + b2.prev = bp; + + return b2; +} + +// create a node and optionally link it with previous one (in a circular doubly linked list) +function insertNode(i, x, y, last) { + var p = new Node(i, x, y); + + if (!last) { + p.prev = p; + p.next = p; + + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; +} + +function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) p.prevZ.nextZ = p.nextZ; + if (p.nextZ) p.nextZ.prevZ = p.prevZ; +} + +function Node(i, x, y) { + // vertice index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertice nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = null; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; +} + +// return a percentage difference between the polygon area and its triangulation area; +// used to verify correctness of triangulation +earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); + } + } + + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } + + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); +}; + +function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; +} + +// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts +earcut.flatten = function (data) { + var dim = data[0][0].length, + result = {vertices: [], holes: [], dimensions: dim}, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); + } + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); + } + } + return result; +}; + +},{}],370:[function(require,module,exports){ 'use strict'; module.exports = createFilter; @@ -60077,7 +59517,9 @@ function compile(filter) { } function compilePropertyReference(property) { - return property === '$type' ? 'f.type' : 'p[' + JSON.stringify(property) + ']'; + return property === '$type' ? 'f.type' : + property === '$id' ? 'f.id' : + 'p[' + JSON.stringify(property) + ']'; } function compileComparisonOp(property, value, op, checkType) { @@ -60117,7 +59559,7 @@ function compare(a, b) { return a < b ? -1 : a > b ? 1 : 0; } -},{}],353:[function(require,module,exports){ +},{}],371:[function(require,module,exports){ var geojsonArea = require('geojson-area'); module.exports = rewind; @@ -60168,7 +59610,7 @@ function cw(_) { return geojsonArea.ring(_) >= 0; } -},{"geojson-area":354}],354:[function(require,module,exports){ +},{"geojson-area":372}],372:[function(require,module,exports){ var wgs84 = require('wgs84'); module.exports.geometry = geometry; @@ -60234,16 +59676,18 @@ function rad(_) { return _ * Math.PI / 180; } -},{"wgs84":355}],355:[function(require,module,exports){ +},{"wgs84":373}],373:[function(require,module,exports){ module.exports.RADIUS = 6378137; module.exports.FLATTENING = 1/298.257223563; module.exports.POLAR_RADIUS = 6356752.3142; -},{}],356:[function(require,module,exports){ +},{}],374:[function(require,module,exports){ 'use strict'; module.exports = clip; +var createFeature = require('./feature'); + /* clip features between two axis-parallel lines: * | | * ___|___ | / @@ -60283,13 +59727,7 @@ function clip(features, scale, k1, k2, axis, intersect, minAll, maxAll) { if (slices.length) { // if a feature got clipped, it will likely get clipped on the next zoom level as well, // so there's no need to recalculate bboxes - clipped.push({ - geometry: slices, - type: type, - tags: features[i].tags || null, - min: feature.min, - max: feature.max - }); + clipped.push(createFeature(feature.tags, type, slices, feature.id)); } } @@ -60320,6 +59758,7 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { points = geometry[i], area = points.area, dist = points.dist, + outer = points.outer, len = points.length, a, j, last; @@ -60335,7 +59774,7 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if ((bk > k2)) { // ---|-----|--> slice.push(intersect(a, b, k1), intersect(a, b, k2)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } else if (bk >= k1) slice.push(intersect(a, b, k1)); // ---|--> | @@ -60343,7 +59782,7 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if ((bk < k1)) { // <--|-----|--- slice.push(intersect(a, b, k2), intersect(a, b, k1)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } else if (bk <= k2) slice.push(intersect(a, b, k2)); // | <--|--- @@ -60353,11 +59792,11 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if (bk < k1) { // <--|--- | slice.push(intersect(a, b, k1)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } else if (bk > k2) { // | ---|--> slice.push(intersect(a, b, k2)); - if (!closed) slice = newSlice(slices, slice, area, dist); + if (!closed) slice = newSlice(slices, slice, area, dist, outer); } // | --> | } @@ -60374,30 +59813,32 @@ function clipGeometry(geometry, k1, k2, axis, intersect, closed) { if (closed && last && (slice[0][0] !== last[0] || slice[0][1] !== last[1])) slice.push(slice[0]); // add the final slice - newSlice(slices, slice, area, dist); + newSlice(slices, slice, area, dist, outer); } return slices; } -function newSlice(slices, slice, area, dist) { +function newSlice(slices, slice, area, dist, outer) { if (slice.length) { // we don't recalculate the area/length of the unclipped geometry because the case where it goes // below the visibility threshold as a result of clipping is rare, so we avoid doing unnecessary work slice.area = area; slice.dist = dist; + if (outer !== undefined) slice.outer = outer; slices.push(slice); } return []; } -},{}],357:[function(require,module,exports){ +},{"./feature":376}],375:[function(require,module,exports){ 'use strict'; module.exports = convert; var simplify = require('./simplify'); +var createFeature = require('./feature'); // converts GeoJSON feature into an intermediate projected JSON vector format with simplification data @@ -60419,36 +59860,46 @@ function convert(data, tolerance) { } function convertFeature(features, feature, tolerance) { + if (feature.geometry === null) { + // ignore features with null geometry + return; + } + var geom = feature.geometry, type = geom.type, coords = geom.coordinates, tags = feature.properties, - i, j, rings; + id = feature.id, + i, j, rings, projectedRing; if (type === 'Point') { - features.push(create(tags, 1, [projectPoint(coords)])); + features.push(createFeature(tags, 1, [projectPoint(coords)], id)); } else if (type === 'MultiPoint') { - features.push(create(tags, 1, project(coords))); + features.push(createFeature(tags, 1, project(coords), id)); } else if (type === 'LineString') { - features.push(create(tags, 2, [project(coords, tolerance)])); + features.push(createFeature(tags, 2, [project(coords, tolerance)], id)); } else if (type === 'MultiLineString' || type === 'Polygon') { rings = []; for (i = 0; i < coords.length; i++) { - rings.push(project(coords[i], tolerance)); + projectedRing = project(coords[i], tolerance); + if (type === 'Polygon') projectedRing.outer = (i === 0); + rings.push(projectedRing); } - features.push(create(tags, type === 'Polygon' ? 3 : 2, rings)); + features.push(createFeature(tags, type === 'Polygon' ? 3 : 2, rings, id)); } else if (type === 'MultiPolygon') { rings = []; for (i = 0; i < coords.length; i++) { for (j = 0; j < coords[i].length; j++) { - rings.push(project(coords[i][j], tolerance)); + projectedRing = project(coords[i][j], tolerance); + projectedRing.outer = (j === 0); + rings.push(projectedRing); } } - features.push(create(tags, 3, rings)); + features.push(createFeature(tags, 3, rings, id)); } else if (type === 'GeometryCollection') { for (i = 0; i < geom.geometries.length; i++) { @@ -60463,18 +59914,6 @@ function convertFeature(features, feature, tolerance) { } } -function create(tags, type, geometry) { - var feature = { - geometry: geometry, - type: type, - tags: tags || null, - min: [2, 1], // initial bbox values; - max: [-1, 0] // note that coords are usually in [0..1] range - }; - calcBBox(feature); - return feature; -} - function project(lonlats, tolerance) { var projected = []; for (var i = 0; i < lonlats.length; i++) { @@ -60492,7 +59931,7 @@ function projectPoint(p) { x = (p[0] / 360 + 0.5), y = (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI); - y = y < -1 ? -1 : + y = y < 0 ? 0 : y > 1 ? 1 : y; return [x, y, 0]; @@ -60516,14 +59955,37 @@ function calcSize(points) { points.dist = dist; } +},{"./feature":376,"./simplify":378}],376:[function(require,module,exports){ +'use strict'; + +module.exports = createFeature; + +function createFeature(tags, type, geom, id) { + var feature = { + id: id || null, + type: type, + geometry: geom, + tags: tags || null, + min: [Infinity, Infinity], // initial bbox values + max: [-Infinity, -Infinity] + }; + calcBBox(feature); + return feature; +} + // calculate the feature bounding box for faster clipping later function calcBBox(feature) { var geometry = feature.geometry, min = feature.min, max = feature.max; - if (feature.type === 1) calcRingBBox(min, max, geometry); - else for (var i = 0; i < geometry.length; i++) calcRingBBox(min, max, geometry[i]); + if (feature.type === 1) { + calcRingBBox(min, max, geometry); + } else { + for (var i = 0; i < geometry.length; i++) { + calcRingBBox(min, max, geometry[i]); + } + } return feature; } @@ -60538,7 +60000,7 @@ function calcRingBBox(min, max, points) { } } -},{"./simplify":359}],358:[function(require,module,exports){ +},{}],377:[function(require,module,exports){ 'use strict'; module.exports = geojsonvt; @@ -60688,10 +60150,12 @@ GeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) { if (debug > 1) console.timeEnd('clipping'); - if (tl) stack.push(tl, z + 1, x * 2, y * 2); - if (bl) stack.push(bl, z + 1, x * 2, y * 2 + 1); - if (tr) stack.push(tr, z + 1, x * 2 + 1, y * 2); - if (br) stack.push(br, z + 1, x * 2 + 1, y * 2 + 1); + if (features.length) { + stack.push(tl || [], z + 1, x * 2, y * 2); + stack.push(bl || [], z + 1, x * 2, y * 2 + 1); + stack.push(tr || [], z + 1, x * 2 + 1, y * 2); + stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1); + } } return solid; @@ -60780,7 +60244,7 @@ function isClippedSquare(tile, extent, buffer) { return true; } -},{"./clip":356,"./convert":357,"./tile":360,"./transform":361,"./wrap":362}],359:[function(require,module,exports){ +},{"./clip":374,"./convert":375,"./tile":379,"./transform":380,"./wrap":381}],378:[function(require,module,exports){ 'use strict'; module.exports = simplify; @@ -60856,7 +60320,7 @@ function getSqSegDist(p, a, b) { return dx * dx + dy * dy; } -},{}],360:[function(require,module,exports){ +},{}],379:[function(require,module,exports){ 'use strict'; module.exports = createTile; @@ -60930,20 +60394,41 @@ function addFeature(tile, feature, tolerance, noSimplify) { tile.numPoints++; } + if (type === 3) rewind(simplifiedRing, ring.outer); + simplified.push(simplifiedRing); } } if (simplified.length) { - tile.features.push({ + var tileFeature = { geometry: simplified, type: type, tags: feature.tags || null - }); + }; + if (feature.id !== null) { + tileFeature.id = feature.id; + } + tile.features.push(tileFeature); } } -},{}],361:[function(require,module,exports){ +function rewind(ring, clockwise) { + var area = signedArea(ring); + if (area < 0 === clockwise) ring.reverse(); +} + +function signedArea(ring) { + var sum = 0; + for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) { + p1 = ring[i]; + p2 = ring[j]; + sum += (p2[0] - p1[0]) * (p1[1] + p2[1]); + } + return sum; +} + +},{}],380:[function(require,module,exports){ 'use strict'; exports.tile = transformTile; @@ -60986,10 +60471,11 @@ function transformPoint(p, extent, z2, tx, ty) { return [x, y]; } -},{}],362:[function(require,module,exports){ +},{}],381:[function(require,module,exports){ 'use strict'; var clip = require('./clip'); +var createFeature = require('./feature'); module.exports = wrap; @@ -60999,7 +60485,7 @@ function wrap(features, buffer, intersectX) { right = clip(features, 1, 1 - buffer, 2 + buffer, 0, intersectX, -1, 2); // right world copy if (left || right) { - merged = clip(features, 1, -buffer, 1 + buffer, 0, intersectX, -1, 2); // center world copy + merged = clip(features, 1, -buffer, 1 + buffer, 0, intersectX, -1, 2) || []; // center world copy if (left) merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center if (right) merged = merged.concat(shiftFeatureCoords(right, -1)); // merge right into center @@ -61026,13 +60512,7 @@ function shiftFeatureCoords(features, offset) { } } - newFeatures.push({ - geometry: newGeometry, - type: type, - tags: feature.tags, - min: [feature.min[0] + offset, feature.min[1]], - max: [feature.max[0] + offset, feature.max[1]] - }); + newFeatures.push(createFeature(feature.tags, type, newGeometry, feature.id)); } return newFeatures; @@ -61049,7 +60529,7 @@ function shiftCoords(points, offset) { return newPoints; } -},{"./clip":356}],363:[function(require,module,exports){ +},{"./clip":374,"./feature":376}],382:[function(require,module,exports){ /** * @fileoverview gl-matrix - High performance matrix and vector operations * @author Brandon Jones @@ -61087,7 +60567,7 @@ exports.quat = require("./gl-matrix/quat.js"); exports.vec2 = require("./gl-matrix/vec2.js"); exports.vec3 = require("./gl-matrix/vec3.js"); exports.vec4 = require("./gl-matrix/vec4.js"); -},{"./gl-matrix/common.js":364,"./gl-matrix/mat2.js":365,"./gl-matrix/mat2d.js":366,"./gl-matrix/mat3.js":367,"./gl-matrix/mat4.js":368,"./gl-matrix/quat.js":369,"./gl-matrix/vec2.js":370,"./gl-matrix/vec3.js":371,"./gl-matrix/vec4.js":372}],364:[function(require,module,exports){ +},{"./gl-matrix/common.js":383,"./gl-matrix/mat2.js":384,"./gl-matrix/mat2d.js":385,"./gl-matrix/mat3.js":386,"./gl-matrix/mat4.js":387,"./gl-matrix/quat.js":388,"./gl-matrix/vec2.js":389,"./gl-matrix/vec3.js":390,"./gl-matrix/vec4.js":391}],383:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -61159,7 +60639,7 @@ glMatrix.equals = function(a, b) { module.exports = glMatrix; -},{}],365:[function(require,module,exports){ +},{}],384:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -61597,7 +61077,7 @@ mat2.multiplyScalarAndAdd = function(out, a, b, scale) { module.exports = mat2; -},{"./common.js":364}],366:[function(require,module,exports){ +},{"./common.js":383}],385:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -62068,7 +61548,7 @@ mat2d.equals = function (a, b) { module.exports = mat2d; -},{"./common.js":364}],367:[function(require,module,exports){ +},{"./common.js":383}],386:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -62816,7 +62296,7 @@ mat3.equals = function (a, b) { module.exports = mat3; -},{"./common.js":364}],368:[function(require,module,exports){ +},{"./common.js":383}],387:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -64954,7 +64434,7 @@ mat4.equals = function (a, b) { module.exports = mat4; -},{"./common.js":364}],369:[function(require,module,exports){ +},{"./common.js":383}],388:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -65556,7 +65036,7 @@ quat.equals = vec4.equals; module.exports = quat; -},{"./common.js":364,"./mat3.js":367,"./vec3.js":371,"./vec4.js":372}],370:[function(require,module,exports){ +},{"./common.js":383,"./mat3.js":386,"./vec3.js":390,"./vec4.js":391}],389:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -66145,7 +65625,7 @@ vec2.equals = function (a, b) { module.exports = vec2; -},{"./common.js":364}],371:[function(require,module,exports){ +},{"./common.js":383}],390:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -66924,7 +66404,7 @@ vec3.equals = function (a, b) { module.exports = vec3; -},{"./common.js":364}],372:[function(require,module,exports){ +},{"./common.js":383}],391:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -67535,7 +67015,7 @@ vec4.equals = function (a, b) { module.exports = vec4; -},{"./common.js":364}],373:[function(require,module,exports){ +},{"./common.js":383}],392:[function(require,module,exports){ 'use strict'; module.exports = GridIndex; @@ -67609,7 +67089,10 @@ GridIndex.prototype.query = function(x1, y1, x2, y2) { var min = this.min; var max = this.max; if (x1 <= min && y1 <= min && max <= x2 && max <= y2) { - return this.keys.slice(); + // We use `Array#slice` because `this.keys` may be a `Int32Array` and + // some browsers (Safari and IE) do not support `TypedArray#slice` + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice#Browser_compatibility + return Array.prototype.slice.call(this.keys); } else { var result = []; @@ -67694,7 +67177,7 @@ GridIndex.prototype.toArrayBuffer = function() { return array.buffer; }; -},{}],374:[function(require,module,exports){ +},{}],393:[function(require,module,exports){ 'use strict'; function createFunction(parameters, defaultType) { @@ -67861,131 +67344,69 @@ module.exports['piecewise-constant'] = function(parameters) { return createFunction(parameters, 'interval'); }; -},{}],375:[function(require,module,exports){ -'use strict'; - -if (typeof module !== 'undefined' && module.exports) { - module.exports = isSupported; -} else if (window) { - window.mapboxgl = window.mapboxgl || {}; - window.mapboxgl.supported = isSupported; -} - -/** - * Test whether the current browser supports Mapbox GL JS - * @param {Object} options - * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false` - * if the performance of Mapbox GL JS would be dramatically worse than - * expected (i.e. a software renderer is would be used) - * @return {boolean} - */ -function isSupported(options) { - return !!( - isBrowser() && - isArraySupported() && - isFunctionSupported() && - isObjectSupported() && - isJSONSupported() && - isWorkerSupported() && - isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat) - ); -} - -function isBrowser() { - return typeof window !== 'undefined' && typeof document !== 'undefined'; -} - -function isArraySupported() { - return ( - Array.prototype && - Array.prototype.every && - Array.prototype.filter && - Array.prototype.forEach && - Array.prototype.indexOf && - Array.prototype.lastIndexOf && - Array.prototype.map && - Array.prototype.some && - Array.prototype.reduce && - Array.prototype.reduceRight && - Array.isArray - ); -} - -function isFunctionSupported() { - return Function.prototype && Function.prototype.bind; -} - -function isObjectSupported() { - return ( - Object.keys && - Object.create && - Object.getPrototypeOf && - Object.getOwnPropertyNames && - Object.isSealed && - Object.isFrozen && - Object.isExtensible && - Object.getOwnPropertyDescriptor && - Object.defineProperty && - Object.defineProperties && - Object.seal && - Object.freeze && - Object.preventExtensions - ); -} - -function isJSONSupported() { - return 'JSON' in window && 'parse' in JSON && 'stringify' in JSON; -} - -function isWorkerSupported() { - return 'Worker' in window; -} - -var isWebGLSupportedCache = {}; -function isWebGLSupportedCached(failIfMajorPerformanceCaveat) { - - if (isWebGLSupportedCache[failIfMajorPerformanceCaveat] === undefined) { - isWebGLSupportedCache[failIfMajorPerformanceCaveat] = isWebGLSupported(failIfMajorPerformanceCaveat); - } +},{}],394:[function(require,module,exports){ - return isWebGLSupportedCache[failIfMajorPerformanceCaveat]; -} +var path = require('path'); -isSupported.webGLContextAttributes = { - antialias: false, - alpha: true, - stencil: true, - depth: true +// readFileSync calls must be written out long-form for brfs. +module.exports = { + debug: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n" + }, + fill: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n" + }, + circle: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n float t = smoothstep(1.0 - max(blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = color * (1.0 - t) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform bool u_scale_with_map;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main(void) {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize mediump float radius\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n if (u_scale_with_map) {\n gl_Position.xy += extrude;\n } else {\n gl_Position.xy += extrude * gl_Position.w;\n }\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n" + }, + line: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_linewidth;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\nuniform mediump float u_blur;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" + }, + linepattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" + }, + linesdfpattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" + }, + outline: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" + }, + outlinepattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" + }, + pattern: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n" + }, + raster: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n" + }, + icon: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" + }, + sdf: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" + }, + collisionbox: { + fragmentSource: "#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n", + vertexSource: "#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n" + } }; -function isWebGLSupported(failIfMajorPerformanceCaveat) { - - var canvas = document.createElement('canvas'); - - var attributes = Object.create(isSupported.webGLContextAttributes); - attributes.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat; - - if (canvas.probablySupportsContext) { - return ( - canvas.probablySupportsContext('webgl', attributes) || - canvas.probablySupportsContext('experimental-webgl', attributes) - ); - - } else if (canvas.supportsContext) { - return ( - canvas.supportsContext('webgl', attributes) || - canvas.supportsContext('experimental-webgl', attributes) - ); - - } else { - return ( - canvas.getContext('webgl', attributes) || - canvas.getContext('experimental-webgl', attributes) - ); - } -} +module.exports.util = "float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"; -},{}],376:[function(require,module,exports){ +},{"path":58}],395:[function(require,module,exports){ 'use strict'; var format = require('util').format; @@ -68003,7 +67424,7 @@ function ValidationError(key, value /*, message, ...*/) { module.exports = ValidationError; -},{"util":62}],377:[function(require,module,exports){ +},{"util":67}],396:[function(require,module,exports){ 'use strict'; module.exports = function (output) { @@ -68016,7 +67437,7 @@ module.exports = function (output) { return output; }; -},{}],378:[function(require,module,exports){ +},{}],397:[function(require,module,exports){ 'use strict'; module.exports = function getType(val) { @@ -68035,7 +67456,7 @@ module.exports = function getType(val) { } }; -},{}],379:[function(require,module,exports){ +},{}],398:[function(require,module,exports){ 'use strict'; // Turn jsonlint-lines-primitives objects into primitive objects @@ -68047,7 +67468,7 @@ module.exports = function unbundle(value) { } }; -},{}],380:[function(require,module,exports){ +},{}],399:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68114,7 +67535,7 @@ module.exports = function validate(options) { } }; -},{"../error/validation_error":376,"../util/extend":377,"../util/get_type":378,"./validate_array":381,"./validate_boolean":382,"./validate_color":383,"./validate_constants":384,"./validate_enum":385,"./validate_filter":386,"./validate_function":387,"./validate_layer":389,"./validate_number":391,"./validate_object":392,"./validate_source":394,"./validate_string":395}],381:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/extend":396,"../util/get_type":397,"./validate_array":400,"./validate_boolean":401,"./validate_color":402,"./validate_constants":403,"./validate_enum":404,"./validate_filter":405,"./validate_function":406,"./validate_layer":408,"./validate_number":410,"./validate_object":411,"./validate_source":413,"./validate_string":414}],400:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -68168,7 +67589,7 @@ module.exports = function validateArray(options) { return errors; }; -},{"../error/validation_error":376,"../util/get_type":378,"./validate":380}],382:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397,"./validate":399}],401:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -68186,7 +67607,7 @@ module.exports = function validateBoolean(options) { return []; }; -},{"../error/validation_error":376,"../util/get_type":378}],383:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397}],402:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68209,7 +67630,7 @@ module.exports = function validateColor(options) { return []; }; -},{"../error/validation_error":376,"../util/get_type":378,"csscolorparser":351}],384:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397,"csscolorparser":368}],403:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68243,7 +67664,7 @@ module.exports = function validateConstants(options) { }; -},{"../error/validation_error":376,"../util/get_type":378}],385:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397}],404:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68261,7 +67682,7 @@ module.exports = function validateEnum(options) { return errors; }; -},{"../error/validation_error":376,"../util/unbundle_jsonlint":379}],386:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/unbundle_jsonlint":398}],405:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68366,7 +67787,7 @@ module.exports = function validateFilter(options) { return errors; }; -},{"../error/validation_error":376,"../util/get_type":378,"../util/unbundle_jsonlint":379,"./validate_enum":385}],387:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397,"../util/unbundle_jsonlint":398,"./validate_enum":404}],406:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68377,12 +67798,13 @@ var validateArray = require('./validate_array'); var validateNumber = require('./validate_number'); module.exports = function validateFunction(options) { - var originalValueSpec = options.valueSpec; - var originalValue = options.value; - + var functionValueSpec = options.valueSpec; var stopKeyType; - return validateObject({ + var isPropertyFunction = options.value.property !== undefined || stopKeyType === 'object'; + var isZoomFunction = options.value.property === undefined || stopKeyType === 'object'; + + var errors = validateObject({ key: options.key, value: options.value, valueSpec: options.styleSpec.function, @@ -68391,6 +67813,16 @@ module.exports = function validateFunction(options) { objectElementValidators: { stops: validateFunctionStops } }); + if (options.styleSpec.$version >= 8) { + if (isPropertyFunction && !options.valueSpec['property-function']) { + errors.push(new ValidationError(options.key, options.value, 'property functions not supported')); + } else if (isZoomFunction && !options.valueSpec['zoom-function']) { + errors.push(new ValidationError(options.key, options.value, 'zoom functions not supported')); + } + } + + return errors; + function validateFunctionStops(options) { var errors = []; var value = options.value; @@ -68446,7 +67878,6 @@ module.exports = function validateFunction(options) { objectElementValidators: { zoom: validateNumber, value: validateValue } })); } else { - var isZoomFunction = !originalValue.property; errors = errors.concat((isZoomFunction ? validateNumber : validateValue)({ key: key + '[0]', value: value[0], @@ -68459,13 +67890,13 @@ module.exports = function validateFunction(options) { errors = errors.concat(validate({ key: key + '[1]', value: value[1], - valueSpec: originalValueSpec, + valueSpec: functionValueSpec, style: options.style, styleSpec: options.styleSpec })); if (getType(value[0]) === 'number') { - if (originalValueSpec.function === 'piecewise-constant' && value[0] % 1 !== 0) { + if (functionValueSpec.function === 'piecewise-constant' && value[0] % 1 !== 0) { errors.push(new ValidationError(key + '[0]', value[0], 'zoom level for piecewise-constant functions must be an integer')); } @@ -68490,7 +67921,7 @@ module.exports = function validateFunction(options) { }; -},{"../error/validation_error":376,"../util/get_type":378,"./validate":380,"./validate_array":381,"./validate_number":391,"./validate_object":392}],388:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397,"./validate":399,"./validate_array":400,"./validate_number":410,"./validate_object":411}],407:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68514,7 +67945,7 @@ module.exports = function(options) { return errors; }; -},{"../error/validation_error":376,"./validate_string":395}],389:[function(require,module,exports){ +},{"../error/validation_error":395,"./validate_string":414}],408:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68572,7 +68003,7 @@ module.exports = function validateLayer(options) { if (!layer.source) { errors.push(new ValidationError(key, layer, 'missing required property "source"')); } else { - var source = style.sources[layer.source]; + var source = style.sources && style.sources[layer.source]; if (!source) { errors.push(new ValidationError(key, layer.source, 'source "%s" not found', layer.source)); } else if (source.type == 'vector' && type == 'raster') { @@ -68627,7 +68058,7 @@ module.exports = function validateLayer(options) { return errors; }; -},{"../error/validation_error":376,"../util/extend":377,"../util/unbundle_jsonlint":379,"./validate_filter":386,"./validate_layout_property":390,"./validate_object":392,"./validate_paint_property":393}],390:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/extend":396,"../util/unbundle_jsonlint":398,"./validate_filter":405,"./validate_layout_property":409,"./validate_object":411,"./validate_paint_property":412}],409:[function(require,module,exports){ 'use strict'; var validate = require('./validate'); @@ -68666,7 +68097,7 @@ module.exports = function validateLayoutProperty(options) { }; -},{"../error/validation_error":376,"./validate":380}],391:[function(require,module,exports){ +},{"../error/validation_error":395,"./validate":399}],410:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -68693,7 +68124,7 @@ module.exports = function validateNumber(options) { return []; }; -},{"../error/validation_error":376,"../util/get_type":378}],392:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397}],411:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68746,7 +68177,7 @@ module.exports = function validateObject(options) { return errors; }; -},{"../error/validation_error":376,"../util/get_type":378,"./validate":380}],393:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397,"./validate":399}],412:[function(require,module,exports){ 'use strict'; var validate = require('./validate'); @@ -68786,7 +68217,7 @@ module.exports = function validatePaintProperty(options) { }; -},{"../error/validation_error":376,"./validate":380}],394:[function(require,module,exports){ +},{"../error/validation_error":395,"./validate":399}],413:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -68863,7 +68294,7 @@ module.exports = function validateSource(options) { } }; -},{"../error/validation_error":376,"../util/unbundle_jsonlint":379,"./validate_enum":385,"./validate_object":392}],395:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/unbundle_jsonlint":398,"./validate_enum":404,"./validate_object":411}],414:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -68881,7 +68312,7 @@ module.exports = function validateString(options) { return []; }; -},{"../error/validation_error":376,"../util/get_type":378}],396:[function(require,module,exports){ +},{"../error/validation_error":395,"../util/get_type":397}],415:[function(require,module,exports){ 'use strict'; var validateConstants = require('./validate/validate_constants'); @@ -68951,13 +68382,13 @@ function wrapCleanErrors(inner) { module.exports = validateStyleMin; -},{"../reference/latest.min":398,"./validate/validate":380,"./validate/validate_constants":384,"./validate/validate_filter":386,"./validate/validate_glyphs_url":388,"./validate/validate_layer":389,"./validate/validate_layout_property":390,"./validate/validate_paint_property":393,"./validate/validate_source":394}],397:[function(require,module,exports){ +},{"../reference/latest.min":417,"./validate/validate":399,"./validate/validate_constants":403,"./validate/validate_filter":405,"./validate/validate_glyphs_url":407,"./validate/validate_layer":408,"./validate/validate_layout_property":409,"./validate/validate_paint_property":412,"./validate/validate_source":413}],416:[function(require,module,exports){ module.exports = require('./v8.json'); -},{"./v8.json":399}],398:[function(require,module,exports){ +},{"./v8.json":418}],417:[function(require,module,exports){ module.exports = require('./v8.min.json'); -},{"./v8.min.json":400}],399:[function(require,module,exports){ +},{"./v8.min.json":419}],418:[function(require,module,exports){ module.exports={ "$version": 8, "$root": { @@ -68965,7 +68396,7 @@ module.exports={ "required": true, "type": "enum", "values": [8], - "doc": "Stylesheet version number. Must be 8.", + "doc": "Style specification version number. Must be 8.", "example": 8 }, "name": { @@ -69280,155 +68711,279 @@ module.exports={ "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_fill": { "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_circle": { "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_line": { "line-cap": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "butt", "round", "square" ], "default": "butt", - "doc": "The display of line endings." + "doc": "The display of line endings.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-join": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "bevel", "round", "miter" ], "default": "miter", - "doc": "The display of lines when joining." + "doc": "The display of lines when joining.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-miter-limit": { "type": "number", "default": 2, "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Used to automatically convert miter joins to bevel joins for sharp angles.", "requires": [ { "line-join": "miter" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-round-limit": { "type": "number", "default": 1.05, "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Used to automatically convert round joins to miter joins for shallow angles.", "requires": [ { "line-join": "round" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_symbol": { "symbol-placement": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "point", "line" ], "default": "point", - "doc": "Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons." + "doc": "Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "symbol-spacing": { "type": "number", "default": 250, "minimum": 1, "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "pixels", "doc": "Distance between two symbol anchors.", "requires": [ { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "symbol-avoid-edges": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, - "doc": "If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer." + "doc": "If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-allow-overlap": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, the icon will be visible even if it collides with other previously drawn symbols.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-ignore-placement": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, other symbols can be visible even if they collide with the icon.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-optional": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.", "requires": [ "icon-image", "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-rotation-alignment": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -69437,49 +68992,141 @@ module.exports={ "doc": "Orientation of icon when map is rotated.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-size": { "type": "number", "default": 1, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Scale factor for icon. 1 is original size, 3 triples the size.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } + }, + "icon-text-fit": { + "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": false, + "values": [ + "none", + "both", + "width", + "height" + ], + "default": "none", + "doc": "Position and scale an icon by the its corresponding text.", + "requires": [ + "icon-image", + "text-field" + ], + "sdk-support": { + "basic": { + } + } + }, + "icon-text-fit-padding": { + "type": "array", + "value": "number", + "length": 4, + "default": [ + 0, + 0, + 0, + 0 + ], + "units": "pixels", + "function": "interpolated", + "zoom-function": true, + "property-function": true, + "doc": "Size of padding area around the text-fit size in clockwise order: top, right, bottom, left.", + "requires": [ + "icon-image", + "icon-text-fit", + "text-field" + ], + "sdk-support": { + "basic": { + } + } }, "icon-image": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "doc": "A string with {tokens} replaced, referencing the data property to pull from.", - "tokens": true + "tokens": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-rotate": { "type": "number", "default": 0, "period": 360, "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "degrees", "doc": "Rotates the icon clockwise.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-padding": { "type": "number", "default": 2, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "pixels", "doc": "Size of the additional area around the icon bounding box used for detecting symbol collisions.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-keep-upright": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, the icon may be flipped to prevent it from being rendered upside-down.", "requires": [ @@ -69490,7 +69137,14 @@ module.exports={ { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-offset": { "type": "array", @@ -69501,14 +69155,43 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } + }, + "text-pitch-alignment": { + "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, + "values": [ + "map", + "viewport" + ], + "doc": "Aligns text to the plane of the `viewport` or the `map` when the map is pitched. Matches `text-rotation-alignment` if unspecified.", + "requires": [ + "text-field" + ], + "sdk-support": { + "basic": { + } + } }, "text-rotation-alignment": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -69517,24 +69200,49 @@ module.exports={ "doc": "Orientation of text when map is rotated.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-field": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": "", "tokens": true, - "doc": "Value to use for a text label. Feature properties are specified using tokens like {field_name}." + "doc": "Value to use for a text label. Feature properties are specified using tokens like {field_name}.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-font": { "type": "array", "value": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": ["Open Sans Regular", "Arial Unicode MS Regular"], "doc": "Font stack to use for displaying text.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-size": { "type": "number", @@ -69542,10 +69250,19 @@ module.exports={ "minimum": 0, "units": "pixels", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Font size.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-max-width": { "type": "number", @@ -69553,34 +69270,63 @@ module.exports={ "minimum": 0, "units": "em", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "The maximum line width for text wrapping.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-line-height": { "type": "number", "default": 1.2, "units": "em", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Text leading value for multi-line text.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-letter-spacing": { "type": "number", "default": 0, "units": "em", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Text tracking amount.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-justify": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "left", "center", @@ -69590,11 +69336,20 @@ module.exports={ "doc": "Text justification options.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "center", "left", @@ -69610,20 +69365,36 @@ module.exports={ "doc": "Part of the text placed closest to the anchor.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-max-angle": { "type": "number", "default": 45, "units": "degrees", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Maximum angle change between adjacent characters.", "requires": [ "text-field", { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-rotate": { "type": "number", @@ -69631,10 +69402,19 @@ module.exports={ "period": 360, "units": "degrees", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Rotates the text clockwise.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-padding": { "type": "number", @@ -69642,14 +69422,25 @@ module.exports={ "minimum": 0, "units": "pixels", "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Size of the additional area around the text bounding box used for detecting symbol collisions.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-keep-upright": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": true, "doc": "If true, the text may be flipped vertically to prevent it from being rendered upside-down.", "requires": [ @@ -69660,11 +69451,20 @@ module.exports={ { "symbol-placement": "line" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-transform": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "none", "uppercase", @@ -69674,7 +69474,14 @@ module.exports={ "doc": "Specifies how to capitalize text, similar to the CSS `text-transform` property.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-offset": { "type": "array", @@ -69682,6 +69489,8 @@ module.exports={ "value": "number", "units": "ems", "function": "interpolated", + "zoom-function": true, + "property-function": true, "length": 2, "default": [ 0, @@ -69689,57 +69498,107 @@ module.exports={ ], "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-allow-overlap": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, the text will be visible even if it collides with other previously drawn symbols.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-ignore-placement": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, other symbols can be visible even if they collide with the text.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-optional": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": false, "doc": "If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.", "requires": [ "text-field", "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "layout_raster": { "visibility": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, "values": [ "visible", "none" ], "default": "visible", - "doc": "The display of this layer. `none` hides this layer." + "doc": "The display of this layer. `none` hides this layer.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "filter": { @@ -69838,34 +69697,66 @@ module.exports={ "fill-antialias": { "type": "boolean", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": true, - "doc": "Whether or not the fill should be antialiased." + "doc": "Whether or not the fill should be antialiased.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-opacity": { "type": "number", "function": "interpolated", + "zoom-function": true, + "property-function": true, "default": 1, "minimum": 0, "maximum": 1, - "doc": "The opacity given to the fill color.", - "transition": true + "doc": "The opacity of the entire fill layer. In contrast to the fill-color, this value will also affect the 1px stroke around the fill, if the stroke is used.", + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-color": { "type": "color", "default": "#000000", - "doc": "The color of the fill.", + "doc": "The color of the filled part of this layer. This color can be specified as rgba with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { "!": "fill-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.19.0" + } + } }, "fill-outline-color": { "type": "color", "doc": "The outline color of the fill. Matches the value of `fill-color` if unspecified.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { @@ -69874,7 +69765,17 @@ module.exports={ { "fill-antialias": true } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.19.0" + } + } }, "fill-translate": { "type": "array", @@ -69885,13 +69786,24 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively." + "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -69900,13 +69812,29 @@ module.exports={ "default": "map", "requires": [ "fill-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "fill-pattern": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "transition": true, - "doc": "Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)." + "doc": "Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_line": { @@ -69914,22 +69842,40 @@ module.exports={ "type": "number", "doc": "The opacity at which the line will be drawn.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "default": 1, "minimum": 0, "maximum": 1, - "transition": true + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-color": { "type": "color", "doc": "The color with which the line will be drawn.", "default": "#000000", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { "!": "line-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-translate": { "type": "array", @@ -69940,13 +69886,24 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively." + "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -69955,16 +69912,32 @@ module.exports={ "default": "map", "requires": [ "line-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-width": { "type": "number", "default": 1, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "Stroke thickness." + "doc": "Stroke thickness.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-gap-width": { "type": "number", @@ -69972,30 +69945,59 @@ module.exports={ "minimum": 0, "doc": "Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, - "units": "pixels" + "units": "pixels", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-offset": { "type": "number", "default": 0, "doc": "The line's offset perpendicular to its direction. Values may be positive or negative, where positive indicates \"rightwards\" (if you were moving in the direction of the line) and negative indicates \"leftwards.\"", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, - "units": "pixels" + "units": "pixels", + "sdk-support": { + "basic": { + "js": "0.12.1", + "ios": "3.1.0", + "android": "3.0.0" + } + } }, "line-blur": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "Blur applied to the line, in pixels." + "doc": "Blur applied to the line, in pixels.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-dasharray": { "type": "array", "value": "number", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "doc": "Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.", "minimum": 0, "transition": true, @@ -70004,13 +70006,29 @@ module.exports={ { "!": "line-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "line-pattern": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "transition": true, - "doc": "Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512)." + "doc": "Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_circle": { @@ -70019,23 +70037,59 @@ module.exports={ "default": 5, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "Circle radius." + "doc": "Circle radius.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.18.0" + } + } }, "circle-color": { "type": "color", "default": "#000000", "doc": "The color of the circle.", "function": "interpolated", - "transition": true + "zoom-function": true, + "property-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.18.0" + } + } }, "circle-blur": { "type": "number", "default": 0, "doc": "Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.", "function": "interpolated", - "transition": true + "zoom-function": true, + "property-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.20.0" + } + } }, "circle-opacity": { "type": "number", @@ -70044,7 +70098,19 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "property-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + }, + "property-function": { + "js": "0.20.0" + } + } }, "circle-translate": { "type": "array", @@ -70052,13 +70118,24 @@ module.exports={ "length": 2, "default": [0, 0], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", - "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively." + "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "circle-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -70067,7 +70144,30 @@ module.exports={ "default": "map", "requires": [ "circle-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } + }, + "circle-pitch-scale": { + "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, + "values": [ + "map", + "viewport" + ], + "default": "map", + "doc": "Controls the scaling behavior of the circle when the map is pitched. The value `map` scales circles according to their apparent distance to the camera. The value `viewport` results in no pitch-related scaling.", + "sdk-support": { + "basic": { + } + } } }, "paint_symbol": { @@ -70078,54 +70178,99 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-color": { "type": "color", "default": "#000000", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the icon. This can only be used with sdf icons.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-halo-color": { "type": "color", "default": "rgba(0, 0, 0, 0)", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the icon's halo. Icon halos can only be used with sdf icons.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-halo-width": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance of halo to the icon outline.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-halo-blur": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Fade out the halo towards the outside.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-translate": { "type": "array", @@ -70136,16 +70281,27 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.", "requires": [ "icon-image" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "icon-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -70155,7 +70311,14 @@ module.exports={ "requires": [ "icon-image", "icon-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-opacity": { "type": "number", @@ -70164,54 +70327,99 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-color": { "type": "color", "doc": "The color with which the text will be drawn.", "default": "#000000", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-halo-color": { "type": "color", "default": "rgba(0, 0, 0, 0)", "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the text's halo, which helps it stand out from backgrounds.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-halo-width": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-halo-blur": { "type": "number", "default": 0, "minimum": 0, "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "The halo's fadeout distance towards the outside.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-translate": { "type": "array", @@ -70222,16 +70430,27 @@ module.exports={ 0 ], "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.", "requires": [ "text-field" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "text-translate-anchor": { "type": "enum", "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": [ "map", "viewport" @@ -70241,7 +70460,14 @@ module.exports={ "requires": [ "text-field", "text-translate" - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_raster": { @@ -70252,34 +70478,66 @@ module.exports={ "minimum": 0, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-hue-rotate": { "type": "number", "default": 0, "period": 360, "function": "interpolated", + "zoom-function": true, "transition": true, "units": "degrees", - "doc": "Rotates hues around the color wheel." + "doc": "Rotates hues around the color wheel.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-brightness-min": { "type": "number", "function": "interpolated", + "zoom-function": true, "doc": "Increase or reduce the brightness of the image. The value is the minimum brightness.", "default": 0, "minimum": 0, "maximum": 1, - "transition": true + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-brightness-max": { "type": "number", "function": "interpolated", + "zoom-function": true, "doc": "Increase or reduce the brightness of the image. The value is the maximum brightness.", "default": 1, "minimum": 0, "maximum": 1, - "transition": true + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-saturation": { "type": "number", @@ -70288,7 +70546,15 @@ module.exports={ "minimum": -1, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-contrast": { "type": "number", @@ -70297,16 +70563,32 @@ module.exports={ "minimum": -1, "maximum": 1, "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "raster-fade-duration": { "type": "number", "default": 300, "minimum": 0, "function": "interpolated", + "zoom-function": true, "transition": true, "units": "milliseconds", - "doc": "Fade duration when a new tile is added." + "doc": "Fade duration when a new tile is added.", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "paint_background": { @@ -70315,18 +70597,34 @@ module.exports={ "default": "#000000", "doc": "The color with which the background will be drawn.", "function": "interpolated", + "zoom-function": true, "transition": true, "requires": [ { "!": "background-pattern" } - ] + ], + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "background-pattern": { "type": "string", "function": "piecewise-constant", + "zoom-function": true, "transition": true, - "doc": "Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)." + "doc": "Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).", + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } }, "background-opacity": { "type": "number", @@ -70335,7 +70633,15 @@ module.exports={ "maximum": 1, "doc": "The opacity at which the background will be drawn.", "function": "interpolated", - "transition": true + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic": { + "js": "0.10.0", + "ios": "2.0.0", + "android": "2.0.1" + } + } } }, "transition": { @@ -70356,9 +70662,140 @@ module.exports={ } } -},{}],400:[function(require,module,exports){ -module.exports={"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"type":"enum","values":["vector","raster"]},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":["geojson"]},"data":{"type":"*"},"maxzoom":{"type":"number","default":14},"buffer":{"type":"number","default":64},"tolerance":{"type":"number","default":3},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":400},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":["video"]},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":["image"]},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":["fill","line","symbol","circle","raster","background"]},"metadata":{"type":"*"},"ref":{"type":"string"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":22},"maxzoom":{"type":"number","minimum":0,"maximum":22},"interactive":{"type":"boolean","default":false},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"paint.*":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],"layout_background":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","values":["butt","round","square"],"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","values":["bevel","round","miter"],"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","requires":[{"line-join":"round"}]},"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","values":["point","line"],"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"viewport","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","requires":["icon-image"]},"icon-image":{"type":"string","function":"piecewise-constant","tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","requires":["icon-image"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"viewport","requires":["text-field"]},"text-field":{"type":"string","function":"piecewise-constant","default":"","tokens":true},"text-font":{"type":"array","value":"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"]},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","function":"interpolated","requires":["text-field"]},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"em","function":"interpolated","requires":["text-field"]},"text-line-height":{"type":"number","default":1.2,"units":"em","function":"interpolated","requires":["text-field"]},"text-letter-spacing":{"type":"number","default":0,"units":"em","function":"interpolated","requires":["text-field"]},"text-justify":{"type":"enum","function":"piecewise-constant","values":["left","center","right"],"default":"center","requires":["text-field"]},"text-anchor":{"type":"enum","function":"piecewise-constant","values":["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center","requires":["text-field"]},"text-max-angle":{"type":"number","default":45,"units":"degrees","function":"interpolated","requires":["text-field",{"symbol-placement":"line"}]},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","function":"interpolated","requires":["text-field"]},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","function":"interpolated","requires":["text-field"]},"text-keep-upright":{"type":"boolean","function":"piecewise-constant","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{"type":"enum","function":"piecewise-constant","values":["none","uppercase","lowercase"],"default":"none","requires":["text-field"]},"text-offset":{"type":"array","value":"number","units":"ems","function":"interpolated","length":2,"default":[0,0],"requires":["text-field"]},"text-allow-overlap":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["text-field"]},"text-ignore-placement":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["text-field"]},"text-optional":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["text-field","icon-image"]},"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_raster":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"filter":{"type":"array","value":"*"},"filter_operator":{"type":"enum","values":["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},"geometry_type":{"type":"enum","values":["Point","LineString","Polygon"]},"color_operation":{"type":"enum","values":["lighten","saturate","spin","fade","mix"]},"function":{"stops":{"type":"array","required":true,"value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":["exponential","interval","categorical"],"default":"exponential"}},"function_stop":{"type":"array","minimum":0,"maximum":22,"value":["number","color"],"length":2},"paint":["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],"paint_fill":{"fill-antialias":{"type":"boolean","function":"piecewise-constant","default":true},"fill-opacity":{"type":"number","function":"interpolated","default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","transition":true}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["circle-translate"]}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"map","requires":["text-field","text-translate"]}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} -},{}],401:[function(require,module,exports){ +},{}],419:[function(require,module,exports){ +module.exports={"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"type":"enum","values":["vector","raster"]},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":["geojson"]},"data":{"type":"*"},"maxzoom":{"type":"number","default":14},"buffer":{"type":"number","default":64},"tolerance":{"type":"number","default":3},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":400},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":["video"]},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":["image"]},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":["fill","line","symbol","circle","raster","background"]},"metadata":{"type":"*"},"ref":{"type":"string"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":22},"maxzoom":{"type":"number","minimum":0,"maximum":22},"interactive":{"type":"boolean","default":false},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"paint.*":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],"layout_background":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["butt","round","square"],"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["bevel","round","miter"],"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"round"}]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["point","line"],"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"viewport","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"icon-text-fit":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":false,"values":["none","both","width","height"],"default":"none","requires":["icon-image","text-field"]},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image","icon-text-fit","text-field"]},"icon-image":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"property-function":true,"units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"text-pitch-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"requires":["text-field"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"viewport","requires":["text-field"]},"text-field":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":"","tokens":true},"text-font":{"type":"array","value":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"]},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-line-height":{"type":"number","default":1.2,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-letter-spacing":{"type":"number","default":0,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-justify":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["left","center","right"],"default":"center","requires":["text-field"]},"text-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center","requires":["text-field"]},"text-max-angle":{"type":"number","default":45,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field",{"symbol-placement":"line"}]},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["none","uppercase","lowercase"],"default":"none","requires":["text-field"]},"text-offset":{"type":"array","value":"number","units":"ems","function":"interpolated","zoom-function":true,"property-function":true,"length":2,"default":[0,0],"requires":["text-field"]},"text-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field","icon-image"]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_raster":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"filter":{"type":"array","value":"*"},"filter_operator":{"type":"enum","values":["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},"geometry_type":{"type":"enum","values":["Point","LineString","Polygon"]},"color_operation":{"type":"enum","values":["lighten","saturate","spin","fade","mix"]},"function":{"stops":{"type":"array","required":true,"value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":["exponential","interval","categorical"],"default":"exponential"}},"function_stop":{"type":"array","minimum":0,"maximum":22,"value":["number","color"],"length":2},"paint":["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],"paint_fill":{"fill-antialias":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":true},"fill-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","zoom-function":true,"property-function":true,"minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["circle-translate"]},"circle-pitch-scale":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["text-field","text-translate"]}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","zoom-function":true,"default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","zoom-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","zoom-function":true,"transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} +},{}],420:[function(require,module,exports){ +'use strict'; + +if (typeof module !== 'undefined' && module.exports) { + module.exports = isSupported; +} else if (window) { + window.mapboxgl = window.mapboxgl || {}; + window.mapboxgl.supported = isSupported; +} + +/** + * Test whether the current browser supports Mapbox GL JS + * @param {Object} options + * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false` + * if the performance of Mapbox GL JS would be dramatically worse than + * expected (i.e. a software renderer is would be used) + * @return {boolean} + */ +function isSupported(options) { + return !!( + isBrowser() && + isArraySupported() && + isFunctionSupported() && + isObjectSupported() && + isJSONSupported() && + isWorkerSupported() && + isUint8ClampedArraySupported() && + isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat) + ); +} + +function isBrowser() { + return typeof window !== 'undefined' && typeof document !== 'undefined'; +} + +function isArraySupported() { + return ( + Array.prototype && + Array.prototype.every && + Array.prototype.filter && + Array.prototype.forEach && + Array.prototype.indexOf && + Array.prototype.lastIndexOf && + Array.prototype.map && + Array.prototype.some && + Array.prototype.reduce && + Array.prototype.reduceRight && + Array.isArray + ); +} + +function isFunctionSupported() { + return Function.prototype && Function.prototype.bind; +} + +function isObjectSupported() { + return ( + Object.keys && + Object.create && + Object.getPrototypeOf && + Object.getOwnPropertyNames && + Object.isSealed && + Object.isFrozen && + Object.isExtensible && + Object.getOwnPropertyDescriptor && + Object.defineProperty && + Object.defineProperties && + Object.seal && + Object.freeze && + Object.preventExtensions + ); +} + +function isJSONSupported() { + return 'JSON' in window && 'parse' in JSON && 'stringify' in JSON; +} + +function isWorkerSupported() { + return 'Worker' in window; +} + +// IE11 only supports `Uint8ClampedArray` as of version +// [KB2929437](https://support.microsoft.com/en-us/kb/2929437) +function isUint8ClampedArraySupported() { + return 'Uint8ClampedArray' in window; +} + +var isWebGLSupportedCache = {}; +function isWebGLSupportedCached(failIfMajorPerformanceCaveat) { + + if (isWebGLSupportedCache[failIfMajorPerformanceCaveat] === undefined) { + isWebGLSupportedCache[failIfMajorPerformanceCaveat] = isWebGLSupported(failIfMajorPerformanceCaveat); + } + + return isWebGLSupportedCache[failIfMajorPerformanceCaveat]; +} + +isSupported.webGLContextAttributes = { + antialias: false, + alpha: true, + stencil: true, + depth: true +}; + +function isWebGLSupported(failIfMajorPerformanceCaveat) { + + var canvas = document.createElement('canvas'); + + var attributes = Object.create(isSupported.webGLContextAttributes); + attributes.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat; + + if (canvas.probablySupportsContext) { + return ( + canvas.probablySupportsContext('webgl', attributes) || + canvas.probablySupportsContext('experimental-webgl', attributes) + ); + + } else if (canvas.supportsContext) { + return ( + canvas.supportsContext('webgl', attributes) || + canvas.supportsContext('experimental-webgl', attributes) + ); + + } else { + return ( + canvas.getContext('webgl', attributes) || + canvas.getContext('experimental-webgl', attributes) + ); + } +} + +},{}],421:[function(require,module,exports){ 'use strict'; // lightweight Buffer shim for pbf browser build @@ -70519,7 +70956,7 @@ function encodeString(str) { return bytes; } -},{"ieee754":403}],402:[function(require,module,exports){ +},{"ieee754":423}],422:[function(require,module,exports){ (function (global){ 'use strict'; @@ -70945,9 +71382,9 @@ function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pb function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./buffer":401}],403:[function(require,module,exports){ -arguments[4][55][0].apply(exports,arguments) -},{"dup":55}],404:[function(require,module,exports){ +},{"./buffer":421}],423:[function(require,module,exports){ +arguments[4][54][0].apply(exports,arguments) +},{"dup":54}],424:[function(require,module,exports){ 'use strict'; module.exports = Point; @@ -71080,7 +71517,69 @@ Point.convert = function (a) { return a; }; -},{}],405:[function(require,module,exports){ +},{}],425:[function(require,module,exports){ +'use strict'; + +module.exports = partialSort; + +// Floyd-Rivest selection algorithm: +// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right]; +// The k-th element will have the (k - left + 1)th smallest value in [left, right] + +function partialSort(arr, k, left, right, compare) { + left = left || 0; + right = right || (arr.length - 1); + compare = compare || defaultCompare; + + while (right > left) { + if (right - left > 600) { + var n = right - left + 1; + var m = k - left + 1; + var z = Math.log(n); + var s = 0.5 * Math.exp(2 * z / 3); + var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); + var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); + var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); + partialSort(arr, k, newLeft, newRight, compare); + } + + var t = arr[k]; + var i = left; + var j = right; + + swap(arr, left, k); + if (compare(arr[right], t) > 0) swap(arr, left, right); + + while (i < j) { + swap(arr, i, j); + i++; + j--; + while (compare(arr[i], t) < 0) i++; + while (compare(arr[j], t) > 0) j--; + } + + if (compare(arr[left], t) === 0) swap(arr, left, j); + else { + j++; + swap(arr, j, right); + } + + if (j <= k) left = j + 1; + if (k <= j) right = j - 1; + } +} + +function swap(arr, i, j) { + var tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; +} + +function defaultCompare(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +} + +},{}],426:[function(require,module,exports){ // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) @@ -71129,11 +71628,12 @@ void (function(root, factory) { })); -},{}],406:[function(require,module,exports){ -'use strict'; - -module.exports = ShelfPack; - +},{}],427:[function(require,module,exports){ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.ShelfPack = factory()); +}(this, function () { /** * Create a new ShelfPack bin allocator. @@ -71199,6 +71699,23 @@ ShelfPack.prototype.pack = function(bins, options) { } } + // Shrink the width/height of the sprite to the bare minimum. + // Since shelf-pack doubles first width, then height when running out of shelf space + // this can result in fairly large unused space both in width and height if that happens + // towards the end of bin packing. + if (this.shelves.length > 0) { + var w2 = 0; + var h2 = 0; + + for (var j = 0; j < this.shelves.length; j++) { + var shelf = this.shelves[j]; + h2 += shelf.h; + w2 = Math.max(shelf.w - shelf.free, w2); + } + + this.resize(w2, h2); + } + return results; }; @@ -71292,7 +71809,6 @@ ShelfPack.prototype.clear = function() { /** * Resize the sprite. - * The resize will fail if the requested dimensions are smaller than the current sprite dimensions. * * @param {number} w Requested new sprite width * @param {number} h Requested new sprite height @@ -71301,10 +71817,6 @@ ShelfPack.prototype.clear = function() { * sprite.resize(256, 256); */ ShelfPack.prototype.resize = function(w, h) { - if (w < this.w || h < this.h) { - return false; - } - this.w = w; this.h = h; for (var i = 0; i < this.shelves.length; i++) { @@ -71355,7 +71867,6 @@ Shelf.prototype.alloc = function(w, h) { /** * Resize the shelf. - * The resize will fail if the requested width is smaller than the current shelf width. * * @private * @param {number} w Requested new width of the shelf @@ -71364,15 +71875,15 @@ Shelf.prototype.alloc = function(w, h) { * shelf.resize(512); */ Shelf.prototype.resize = function(w) { - if (w < this.w) { - return false; - } this.free += (w - this.w); this.w = w; return true; }; -},{}],407:[function(require,module,exports){ +return ShelfPack; + +})); +},{}],428:[function(require,module,exports){ 'use strict'; var kdbush = require('kdbush'); @@ -71587,7 +72098,7 @@ function getY(p) { return p.y; } -},{"kdbush":408}],408:[function(require,module,exports){ +},{"kdbush":429}],429:[function(require,module,exports){ 'use strict'; var sort = require('./sort'); @@ -71633,7 +72144,7 @@ KDBush.prototype = { function defaultGetX(p) { return p[0]; } function defaultGetY(p) { return p[1]; } -},{"./range":409,"./sort":410,"./within":411}],409:[function(require,module,exports){ +},{"./range":430,"./sort":431,"./within":432}],430:[function(require,module,exports){ 'use strict'; module.exports = range; @@ -71681,7 +72192,7 @@ function range(ids, coords, minX, minY, maxX, maxY, nodeSize) { return result; } -},{}],410:[function(require,module,exports){ +},{}],431:[function(require,module,exports){ 'use strict'; module.exports = sortKD; @@ -71749,7 +72260,7 @@ function swap(arr, i, j) { arr[j] = tmp; } -},{}],411:[function(require,module,exports){ +},{}],432:[function(require,module,exports){ 'use strict'; module.exports = within; @@ -71801,7 +72312,7 @@ function sqDist(ax, ay, bx, by) { return dx * dx + dy * dy; } -},{}],412:[function(require,module,exports){ +},{}],433:[function(require,module,exports){ /* * Copyright (C) 2008 Apple Inc. All Rights Reserved. * @@ -71908,12 +72419,12 @@ UnitBezier.prototype.solve = function(x, epsilon) { return this.sampleCurveY(this.solveCurveX(x, epsilon)); }; -},{}],413:[function(require,module,exports){ +},{}],434:[function(require,module,exports){ module.exports.VectorTile = require('./lib/vectortile.js'); module.exports.VectorTileFeature = require('./lib/vectortilefeature.js'); module.exports.VectorTileLayer = require('./lib/vectortilelayer.js'); -},{"./lib/vectortile.js":414,"./lib/vectortilefeature.js":415,"./lib/vectortilelayer.js":416}],414:[function(require,module,exports){ +},{"./lib/vectortile.js":435,"./lib/vectortilefeature.js":436,"./lib/vectortilelayer.js":437}],435:[function(require,module,exports){ 'use strict'; var VectorTileLayer = require('./vectortilelayer'); @@ -71932,7 +72443,7 @@ function readTile(tag, layers, pbf) { } -},{"./vectortilelayer":416}],415:[function(require,module,exports){ +},{"./vectortilelayer":437}],436:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -71955,7 +72466,7 @@ function VectorTileFeature(pbf, end, extent, keys, values) { } function readFeature(tag, feature, pbf) { - if (tag == 1) feature._id = pbf.readVarint(); + if (tag == 1) feature.id = pbf.readVarint(); else if (tag == 2) readTag(pbf, feature); else if (tag == 3) feature.type = pbf.readVarint(); else if (tag == 4) feature._geometry = pbf.pos; @@ -72120,8 +72631,8 @@ VectorTileFeature.prototype.toGeoJSON = function(x, y, z) { properties: this.properties }; - if ('_id' in this) { - result.id = this._id; + if ('id' in this) { + result.id = this.id; } return result; @@ -72167,7 +72678,7 @@ function signedArea(ring) { return sum; } -},{"point-geometry":404}],416:[function(require,module,exports){ +},{"point-geometry":424}],437:[function(require,module,exports){ 'use strict'; var VectorTileFeature = require('./vectortilefeature.js'); @@ -72230,7 +72741,7 @@ VectorTileLayer.prototype.feature = function(i) { return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values); }; -},{"./vectortilefeature.js":415}],417:[function(require,module,exports){ +},{"./vectortilefeature.js":436}],438:[function(require,module,exports){ var Pbf = require('pbf') var vtpb = require('./vector-tile-pb') var GeoJSONWrapper = require('./lib/geojson_wrapper') @@ -72370,22 +72881,23 @@ function wrapValue (value) { } else if (type === 'boolean') { result = { bool_value: value } } else if (type === 'number') { - if (value !== (value | 0)) { - result = { float_value: value } + if (value % 1 !== 0) { + result = { double_value: value } } else if (value < 0) { result = { sint_value: value } } else { result = { uint_value: value } } } else { - result = { string_value: '' + value } + value = JSON.stringify(value) + result = { string_value: value } } result.key = type + ':' + value return result } -},{"./lib/geojson_wrapper":418,"./vector-tile-pb":419,"pbf":402}],418:[function(require,module,exports){ +},{"./lib/geojson_wrapper":439,"./vector-tile-pb":440,"pbf":422}],439:[function(require,module,exports){ 'use strict' var Point = require('point-geometry') @@ -72404,6 +72916,7 @@ GeoJSONWrapper.prototype.feature = function (i) { } function FeatureWrapper (feature) { + this.id = typeof feature.id === 'number' ? feature.id : undefined this.type = feature.type this.rawGeometry = feature.type === 1 ? [feature.geometry] : feature.geometry this.properties = feature.tags @@ -72452,7 +72965,7 @@ FeatureWrapper.prototype.bbox = function () { FeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON -},{"point-geometry":404,"vector-tile":413}],419:[function(require,module,exports){ +},{"point-geometry":424,"vector-tile":434}],440:[function(require,module,exports){ 'use strict'; // tile ======================================== @@ -72558,7 +73071,7 @@ function writeLayer(layer, pbf) { if (layer.extent !== undefined) pbf.writeVarintField(5, layer.extent); } -},{}],420:[function(require,module,exports){ +},{}],441:[function(require,module,exports){ var bundleFn = arguments[3]; var sources = arguments[4]; var cache = arguments[5]; @@ -72623,13 +73136,412 @@ module.exports = function (fn, options) { if (options && options.bare) { return blob; } var workerUrl = URL.createObjectURL(blob); var worker = new Worker(workerUrl); - if (typeof URL.revokeObjectURL == "function") { - URL.revokeObjectURL(workerUrl); - } + worker.objectURL = workerUrl; return worker; }; -},{}],421:[function(require,module,exports){ +},{}],442:[function(require,module,exports){ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.WhooTS = global.WhooTS || {}))); +}(this, function (exports) { + +/** + * getURL + * + * @param {String} baseUrl Base url of the WMS server + * @param {String} layer Layer name + * @param {Number} x Tile coordinate x + * @param {Number} y Tile coordinate y + * @param {Number} z Tile zoom + * @param {Object} [options] + * @param {String} [options.format='image/png'] + * @param {String} [options.service='WMS'] + * @param {String} [options.version='1.1.1'] + * @param {String} [options.request='GetMap'] + * @param {String} [options.srs='EPSG:3857'] + * @param {Number} [options.width='256'] + * @param {Number} [options.height='256'] + * @returns {String} url + * @example + * var baseUrl = 'http://geodata.state.nj.us/imagerywms/Natural2015'; + * var layer = 'Natural2015'; + * var url = whoots.getURL(baseUrl, layer, 154308, 197167, 19); + */ +function getURL(baseUrl, layer, x, y, z, options) { + options = options || {}; + + var url = baseUrl + '?' + [ + 'bbox=' + getTileBBox(x, y, z), + 'format=' + (options.format || 'image/png'), + 'service=' + (options.service || 'WMS'), + 'version=' + (options.version || '1.1.1'), + 'request=' + (options.request || 'GetMap'), + 'srs=' + (options.srs || 'EPSG:3857'), + 'width=' + (options.width || 256), + 'height=' + (options.height || 256), + 'layers=' + layer + ].join('&'); + + return url; +} + + +/** + * getTileBBox + * + * @param {Number} x Tile coordinate x + * @param {Number} y Tile coordinate y + * @param {Number} z Tile zoom + * @returns {String} String of the bounding box + */ +function getTileBBox(x, y, z) { + // for Google/OSM tile scheme we need to alter the y + y = (Math.pow(2, z) - y - 1); + + var min = getMercCoords(x * 256, y * 256, z), + max = getMercCoords((x + 1) * 256, (y + 1) * 256, z); + + return min[0] + ',' + min[1] + ',' + max[0] + ',' + max[1]; +} + + +/** + * getMercCoords + * + * @param {Number} x Pixel coordinate x + * @param {Number} y Pixel coordinate y + * @param {Number} z Tile zoom + * @returns {Array} [x, y] + */ +function getMercCoords(x, y, z) { + var resolution = (2 * Math.PI * 6378137 / 256) / Math.pow(2, z), + merc_x = (x * resolution - 2 * Math.PI * 6378137 / 2.0), + merc_y = (y * resolution - 2 * Math.PI * 6378137 / 2.0); + + return [merc_x, merc_y]; +} + +exports.getURL = getURL; +exports.getTileBBox = getTileBBox; +exports.getMercCoords = getMercCoords; + +Object.defineProperty(exports, '__esModule', { value: true }); + +})); +},{}],443:[function(require,module,exports){ +module.exports={ + "name": "mapbox-gl", + "description": "A WebGL interactive maps library", + "version": "0.22.0", + "main": "js/mapbox-gl.js", + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "git://github.com/mapbox/mapbox-gl-js.git" + }, + "engines": { + "node": ">=4.0.0" + }, + "dependencies": { + "csscolorparser": "^1.0.2", + "earcut": "^2.0.3", + "feature-filter": "^2.2.0", + "geojson-rewind": "^0.1.0", + "geojson-vt": "^2.4.0", + "gl-matrix": "^2.3.1", + "grid-index": "^1.0.0", + "mapbox-gl-function": "^1.2.1", + "mapbox-gl-shaders": "github:mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747", + "mapbox-gl-style-spec": "github:mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae", + "mapbox-gl-supported": "^1.2.0", + "pbf": "^1.3.2", + "pngjs": "^2.2.0", + "point-geometry": "^0.0.0", + "quickselect": "^1.0.0", + "request": "^2.39.0", + "resolve-url": "^0.2.1", + "shelf-pack": "^1.0.0", + "supercluster": "^2.0.1", + "unassertify": "^2.0.0", + "unitbezier": "^0.0.0", + "vector-tile": "^1.3.0", + "vt-pbf": "^2.0.2", + "webworkify": "^1.3.0", + "whoots-js": "^2.0.0" + }, + "devDependencies": { + "async": "^2.0.1", + "babel-preset-react": "^6.11.1", + "babelify": "^7.3.0", + "benchmark": "~2.1.0", + "browserify": "^13.0.0", + "browserify-middleware": "^7.0.0", + "clipboard": "^1.5.12", + "concat-stream": "1.5.1", + "coveralls": "^2.11.8", + "doctrine": "^1.2.1", + "documentation": "https://github.com/documentationjs/documentation/archive/bb41619c734e59ef3fbc3648610032efcfdaaace.tar.gz", + "documentation-theme-utils": "3.0.0", + "envify": "^3.4.0", + "eslint": "^2.5.3", + "eslint-config-mourner": "^2.0.0", + "eslint-plugin-html": "^1.5.1", + "express": "^4.13.4", + "gl": "^4.0.1", + "handlebars": "4.0.5", + "highlight.js": "9.3.0", + "istanbul": "^0.4.2", + "json-loader": "^0.5.4", + "lodash": "^4.13.1", + "mapbox-gl-test-suite": "github:mapbox/mapbox-gl-test-suite#1619d84e76ff3434becd51237720d370c7405ee5", + "memory-fs": "^0.3.0", + "minifyify": "^7.0.1", + "nyc": "6.4.0", + "proxyquire": "^1.7.9", + "react": "^15.3.0", + "react-dom": "^15.3.0", + "remark": "4.2.2", + "remark-html": "3.0.0", + "sinon": "^1.15.4", + "st": "^1.0.0", + "tap": "^5.7.0", + "through": "^2.3.7", + "transform-loader": "^0.2.3", + "unist-util-visit": "1.1.0", + "vinyl": "1.1.1", + "vinyl-fs": "2.4.3", + "watchify": "^3.2.2", + "webpack": "^1.13.1", + "webworkify-webpack": "^1.1.3" + }, + "browserify": { + "transform": [ + "unassertify" + ] + }, + "browser": { + "./js/util/ajax.js": "./js/util/browser/ajax.js", + "./js/util/browser.js": "./js/util/browser/browser.js", + "./js/util/canvas.js": "./js/util/browser/canvas.js", + "./js/util/dom.js": "./js/util/browser/dom.js", + "./js/util/web_worker.js": "./js/util/browser/web_worker.js" + }, + "scripts": { + "build-dev": "browserify js/mapbox-gl.js --debug --ignore-transform unassertify --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js", + "build-docs": "documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/", + "build-min": "browserify js/mapbox-gl.js --debug --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js", + "//": "The 'build' script is invoked by publisher when publishing docs on the mb-pages branch", + "build": "npm run build-docs", + "lint": "eslint js test bench server.js docs/_posts/examples/*.html", + "open-changed-examples": "git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open", + "start-docs": "npm run build-min && npm run build-docs && jekyll serve -w", + "start": "node server.js", + "test-suite": "node test/render.test.js && node test/query.test.js", + "test": "npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js" + }, + "gitHead": "98461d3e2db6369cbcb66d70595e3032558fba9d", + "bugs": { + "url": "https://github.com/mapbox/mapbox-gl-js/issues" + }, + "homepage": "https://github.com/mapbox/mapbox-gl-js#readme", + "_id": "mapbox-gl@0.22.0", + "_shasum": "7fb1d70984dc7d8671abcd09ef6ab5fb98c0a310", + "_from": "mapbox-gl@latest", + "_npmVersion": "2.15.5", + "_nodeVersion": "4.4.5", + "_npmUser": { + "name": "lucaswoj", + "email": "lucas@lucaswoj.com" + }, + "dist": { + "shasum": "7fb1d70984dc7d8671abcd09ef6ab5fb98c0a310", + "tarball": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.0.tgz" + }, + "maintainers": [ + { + "name": "aaronlidman", + "email": "aaronlidman@gmail.com" + }, + { + "name": "ajashton", + "email": "aj.ashton@gmail.com" + }, + { + "name": "ansis", + "email": "ansis.brammanis@gmail.com" + }, + { + "name": "bergwerkgis", + "email": "wb@bergwerk-gis.at" + }, + { + "name": "bhousel", + "email": "bryan@mapbox.com" + }, + { + "name": "bsudekum", + "email": "bobby@mapbox.com" + }, + { + "name": "camilleanne", + "email": "camille@mapbox.com" + }, + { + "name": "dnomadb", + "email": "damon@mapbox.com" + }, + { + "name": "dthompson", + "email": "dthompson@gmail.com" + }, + { + "name": "emilymcafee", + "email": "emily@mapbox.com" + }, + { + "name": "flippmoke", + "email": "flippmoke@gmail.com" + }, + { + "name": "freenerd", + "email": "spam@freenerd.de" + }, + { + "name": "gretacb", + "email": "carol@mapbox.com" + }, + { + "name": "ian29", + "email": "ian.villeda@gmail.com" + }, + { + "name": "ianshward", + "email": "ian@mapbox.com" + }, + { + "name": "ingalls", + "email": "nicholas.ingalls@gmail.com" + }, + { + "name": "jfirebaugh", + "email": "john.firebaugh@gmail.com" + }, + { + "name": "jrpruit1", + "email": "jake@jakepruitt.com" + }, + { + "name": "karenzshea", + "email": "karen@mapbox.com" + }, + { + "name": "kkaefer", + "email": "kkaefer@gmail.com" + }, + { + "name": "lbud", + "email": "lauren@mapbox.com" + }, + { + "name": "lucaswoj", + "email": "lucas@lucaswoj.com" + }, + { + "name": "lxbarth", + "email": "alex@mapbox.com" + }, + { + "name": "lyzidiamond", + "email": "lyzi@mapbox.com" + }, + { + "name": "mapbox-admin", + "email": "accounts@mapbox.com" + }, + { + "name": "mateov", + "email": "matt@mapbox.com" + }, + { + "name": "mcwhittemore", + "email": "mcwhittemore@gmail.com" + }, + { + "name": "miccolis", + "email": "jeff@miccolis.net" + }, + { + "name": "mikemorris", + "email": "michael.patrick.morris@gmail.com" + }, + { + "name": "morganherlocker", + "email": "morgan.herlocker@gmail.com" + }, + { + "name": "mourner", + "email": "agafonkin@gmail.com" + }, + { + "name": "nickidlugash", + "email": "nicki@mapbox.com" + }, + { + "name": "rclark", + "email": "ryan.clark.j@gmail.com" + }, + { + "name": "samanbb", + "email": "saman@mapbox.com" + }, + { + "name": "sbma44", + "email": "tlee@mapbox.com" + }, + { + "name": "scothis", + "email": "scothis@gmail.com" + }, + { + "name": "sgillies", + "email": "sean@mapbox.com" + }, + { + "name": "springmeyer", + "email": "dane@mapbox.com" + }, + { + "name": "themarex", + "email": "patrick@mapbox.com" + }, + { + "name": "tmcw", + "email": "tom@macwright.org" + }, + { + "name": "tristen", + "email": "tristen.brown@gmail.com" + }, + { + "name": "willwhite", + "email": "will@mapbox.com" + }, + { + "name": "yhahn", + "email": "young@mapbox.com" + } + ], + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/mapbox-gl-0.22.0.tgz_1471021366539_0.7491761057171971" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.0.tgz" +} + +},{}],444:[function(require,module,exports){ 'use strict' module.exports = mouseListen @@ -72838,7 +73750,7 @@ function mouseListen(element, callback) { return result } -},{"mouse-event":422}],422:[function(require,module,exports){ +},{"mouse-event":445}],445:[function(require,module,exports){ 'use strict' function mouseButtons(ev) { @@ -72900,7 +73812,7 @@ function mouseRelativeY(ev) { } exports.y = mouseRelativeY -},{}],423:[function(require,module,exports){ +},{}],446:[function(require,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -72911,7 +73823,7 @@ module.exports = function parseUnit(str, out) { out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],424:[function(require,module,exports){ +},{}],447:[function(require,module,exports){ 'use strict' var parseUnit = require('parse-unit') @@ -72972,7 +73884,7 @@ function toPX(str, element) { } return 1 } -},{"parse-unit":423}],425:[function(require,module,exports){ +},{"parse-unit":446}],448:[function(require,module,exports){ 'use strict' var toPX = require('to-px') @@ -73014,7 +73926,7 @@ function mouseWheelListen(element, callback, noScroll) { return listener } -},{"to-px":424}],426:[function(require,module,exports){ +},{"to-px":447}],449:[function(require,module,exports){ "use strict" @@ -73026,7 +73938,7 @@ module.exports = function(array, f) { return array } -},{"cwise/lib/wrapper":118}],427:[function(require,module,exports){ +},{"cwise/lib/wrapper":123}],450:[function(require,module,exports){ 'use strict' module.exports = invert @@ -73057,7 +73969,7 @@ function invert(out, M) { } return out } -},{"gl-mat2/invert":428,"gl-mat3/invert":136,"gl-mat4/invert":143}],428:[function(require,module,exports){ +},{"gl-mat2/invert":451,"gl-mat3/invert":141,"gl-mat4/invert":148}],451:[function(require,module,exports){ module.exports = invert /** @@ -73086,7 +73998,7 @@ function invert(out, a) { return out } -},{}],429:[function(require,module,exports){ +},{}],452:[function(require,module,exports){ "use strict" function interp1d(arr, x) { @@ -73197,7 +74109,7 @@ module.exports.d1 = interp1d module.exports.d2 = interp2d module.exports.d3 = interp3d -},{}],430:[function(require,module,exports){ +},{}],453:[function(require,module,exports){ 'use strict' var interp = require('ndarray-linear-interpolate') @@ -73229,7 +74141,7 @@ module.exports = function warp(dest, src, func) { return dest } -},{"cwise/lib/wrapper":118,"ndarray-linear-interpolate":429}],431:[function(require,module,exports){ +},{"cwise/lib/wrapper":123,"ndarray-linear-interpolate":452}],454:[function(require,module,exports){ 'use strict' var warp = require('ndarray-warp') @@ -73259,7 +74171,7 @@ function applyHomography(dest, src, Xi) { }) return dest } -},{"gl-matrix-invert":427,"ndarray-warp":430}],432:[function(require,module,exports){ +},{"gl-matrix-invert":450,"ndarray-warp":453}],455:[function(require,module,exports){ "use strict" var compile = require("cwise-compiler") @@ -73722,7 +74634,7 @@ exports.equals = compile({ -},{"cwise-compiler":115}],433:[function(require,module,exports){ +},{"cwise-compiler":120}],456:[function(require,module,exports){ var iota = require("iota-array") var isBuffer = require("is-buffer") @@ -74067,7 +74979,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":245,"is-buffer":246}],434:[function(require,module,exports){ +},{"iota-array":250,"is-buffer":251}],457:[function(require,module,exports){ /*! * repeat-string * @@ -74137,7 +75049,7 @@ function repeat(str, num) { } -},{}],435:[function(require,module,exports){ +},{}],458:[function(require,module,exports){ (function (global){ module.exports = global.performance && @@ -74148,7 +75060,7 @@ module.exports = } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],436:[function(require,module,exports){ +},{}],459:[function(require,module,exports){ "use strict" var determinant = require("robust-determinant") @@ -74220,7 +75132,7 @@ function generateDispatch() { } generateDispatch() -},{"robust-determinant":438}],437:[function(require,module,exports){ +},{"robust-determinant":461}],460:[function(require,module,exports){ "use strict" module.exports = compressExpansion @@ -74255,7 +75167,7 @@ function compressExpansion(e) { e.length = top return e } -},{}],438:[function(require,module,exports){ +},{}],461:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -74359,7 +75271,7 @@ return robustDeterminant") } generateDispatch() -},{"robust-compress":437,"robust-scale":440,"robust-sum":442,"two-product":456}],439:[function(require,module,exports){ +},{"robust-compress":460,"robust-scale":463,"robust-sum":465,"two-product":479}],462:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -74550,7 +75462,7 @@ function generateOrientationProc() { } generateOrientationProc() -},{"robust-scale":440,"robust-subtract":441,"robust-sum":442,"two-product":456}],440:[function(require,module,exports){ +},{"robust-scale":463,"robust-subtract":464,"robust-sum":465,"two-product":479}],463:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -74601,7 +75513,7 @@ function scaleLinearExpansion(e, scale) { g.length = count return g } -},{"two-product":456,"two-sum":457}],441:[function(require,module,exports){ +},{"two-product":479,"two-sum":480}],464:[function(require,module,exports){ "use strict" module.exports = robustSubtract @@ -74758,7 +75670,7 @@ function robustSubtract(e, f) { g.length = count return g } -},{}],442:[function(require,module,exports){ +},{}],465:[function(require,module,exports){ "use strict" module.exports = linearExpansionSum @@ -74915,7 +75827,7 @@ function linearExpansionSum(e, f) { g.length = count return g } -},{}],443:[function(require,module,exports){ +},{}],466:[function(require,module,exports){ 'use strict' module.exports = toSuperScript @@ -74970,7 +75882,7 @@ function toSuperScript(x) { }).join('') } -},{}],444:[function(require,module,exports){ +},{}],467:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -75386,7 +76298,7 @@ function createSurfaceExtractor(args) { order, typesig) } -},{"typedarray-pool":458}],445:[function(require,module,exports){ +},{"typedarray-pool":481}],468:[function(require,module,exports){ // transliterated from the python snippet here: // http://en.wikipedia.org/wiki/Lanczos_approximation @@ -75455,7 +76367,7 @@ module.exports = function gamma (z) { module.exports.log = lngamma; -},{}],446:[function(require,module,exports){ +},{}],469:[function(require,module,exports){ "use strict" module.exports = permutationSign @@ -75507,7 +76419,7 @@ function permutationSign(p) { return sgn } } -},{"typedarray-pool":458}],447:[function(require,module,exports){ +},{"typedarray-pool":481}],470:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -75594,7 +76506,7 @@ function unrank(n, r, p) { exports.rank = rank exports.unrank = unrank -},{"invert-permutation":448,"typedarray-pool":458}],448:[function(require,module,exports){ +},{"invert-permutation":471,"typedarray-pool":481}],471:[function(require,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -75606,7 +76518,7 @@ function invertPermutation(pi, result) { } module.exports = invertPermutation -},{}],449:[function(require,module,exports){ +},{}],472:[function(require,module,exports){ "use strict" module.exports = triangulateCube @@ -75640,7 +76552,7 @@ function triangulateCube(dimension) { } return result } -},{"gamma":445,"permutation-parity":446,"permutation-rank":447}],450:[function(require,module,exports){ +},{"gamma":468,"permutation-parity":469,"permutation-rank":470}],473:[function(require,module,exports){ module.exports = require('cwise-compiler')({ args: ['array', { offset: [1], @@ -75692,7 +76604,7 @@ module.exports = require('cwise-compiler')({ funcName: 'zeroCrossings' }) -},{"cwise-compiler":115}],451:[function(require,module,exports){ +},{"cwise-compiler":120}],474:[function(require,module,exports){ "use strict" module.exports = findZeroCrossings @@ -75705,7 +76617,7 @@ function findZeroCrossings(array, level) { core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":450}],452:[function(require,module,exports){ +},{"./lib/zc-core":473}],475:[function(require,module,exports){ "use strict" module.exports = surfaceNets @@ -75913,7 +76825,7 @@ function surfaceNets(array,level) { } return proc(array,level) } -},{"ndarray-extract-contour":444,"triangulate-hypercube":449,"zero-crossings":451}],453:[function(require,module,exports){ +},{"ndarray-extract-contour":467,"triangulate-hypercube":472,"zero-crossings":474}],476:[function(require,module,exports){ (function (process){ 'use strict' @@ -76002,7 +76914,7 @@ function textGet(font, text) { } }).call(this,require('_process')) -},{"_process":60,"vectorize-text":460}],454:[function(require,module,exports){ +},{"_process":59,"vectorize-text":483}],477:[function(require,module,exports){ // TinyColor v1.3.0 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -77170,7 +78082,7 @@ else { })(); -},{}],455:[function(require,module,exports){ +},{}],478:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -77719,7 +78631,7 @@ else { exports.presimplify = presimplify; })); -},{}],456:[function(require,module,exports){ +},{}],479:[function(require,module,exports){ "use strict" module.exports = twoProduct @@ -77753,7 +78665,7 @@ function twoProduct(a, b, result) { return [ y, x ] } -},{}],457:[function(require,module,exports){ +},{}],480:[function(require,module,exports){ "use strict" module.exports = fastTwoSum @@ -77771,7 +78683,7 @@ function fastTwoSum(a, b, result) { } return [ar+br, x] } -},{}],458:[function(require,module,exports){ +},{}],481:[function(require,module,exports){ (function (global,Buffer){ 'use strict' @@ -77988,7 +78900,7 @@ exports.clearCache = function clearCache() { } } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"bit-twiddle":51,"buffer":53,"dup":121}],459:[function(require,module,exports){ +},{"bit-twiddle":51,"buffer":52,"dup":126}],482:[function(require,module,exports){ "use strict" function unique_pred(list, compare) { @@ -78047,7 +78959,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],460:[function(require,module,exports){ +},{}],483:[function(require,module,exports){ "use strict" module.exports = createText @@ -78074,7 +78986,7 @@ function createText(str, options) { options) } -},{"./lib/vtext":461}],461:[function(require,module,exports){ +},{"./lib/vtext":484}],484:[function(require,module,exports){ "use strict" module.exports = vectorizeText @@ -78280,7 +79192,7 @@ function vectorizeText(str, canvas, context, options) { return processPixels(pixels, options, size) } -},{"cdt2d":63,"clean-pslg":70,"ndarray":433,"planar-graph-to-polyline":474,"simplify-planar-graph":478,"surface-nets":452}],462:[function(require,module,exports){ +},{"cdt2d":68,"clean-pslg":75,"ndarray":456,"planar-graph-to-polyline":497,"simplify-planar-graph":501,"surface-nets":475}],485:[function(require,module,exports){ 'use strict' module.exports = trimLeaves @@ -78336,7 +79248,7 @@ function trimLeaves(edges, positions) { return [ nedges, npositions ] } -},{"edges-to-adjacency-list":463}],463:[function(require,module,exports){ +},{"edges-to-adjacency-list":486}],486:[function(require,module,exports){ "use strict" module.exports = edgeToAdjacency @@ -78370,7 +79282,7 @@ function edgeToAdjacency(edges, numVertices) { } return adj } -},{"uniq":459}],464:[function(require,module,exports){ +},{"uniq":482}],487:[function(require,module,exports){ "use strict" module.exports = planarDual @@ -78501,7 +79413,7 @@ function planarDual(cells, positions) { //Combine paths and loops together return cycles } -},{"compare-angle":465}],465:[function(require,module,exports){ +},{"compare-angle":488}],488:[function(require,module,exports){ "use strict" module.exports = compareAngle @@ -78587,7 +79499,7 @@ function compareAngle(a, b, c, d) { } } } -},{"robust-orientation":439,"robust-product":466,"robust-sum":442,"signum":467,"two-sum":457}],466:[function(require,module,exports){ +},{"robust-orientation":462,"robust-product":489,"robust-sum":465,"signum":490,"two-sum":480}],489:[function(require,module,exports){ "use strict" var robustSum = require("robust-sum") @@ -78617,7 +79529,7 @@ function robustProduct(a, b) { } return r } -},{"robust-scale":440,"robust-sum":442}],467:[function(require,module,exports){ +},{"robust-scale":463,"robust-sum":465}],490:[function(require,module,exports){ "use strict" module.exports = function signum(x) { @@ -78625,9 +79537,9 @@ module.exports = function signum(x) { if(x > 0) { return 1 } return 0.0 } -},{}],468:[function(require,module,exports){ +},{}],491:[function(require,module,exports){ arguments[4][22][0].apply(exports,arguments) -},{"dup":22}],469:[function(require,module,exports){ +},{"dup":22}],492:[function(require,module,exports){ "use strict" var bounds = require("binary-search-bounds") @@ -78994,7 +79906,7 @@ function createWrapper(intervals) { return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":468}],470:[function(require,module,exports){ +},{"binary-search-bounds":491}],493:[function(require,module,exports){ "use strict" module.exports = orderSegments @@ -79090,7 +80002,7 @@ function orderSegments(b, a) { } return ar[0] - br[0] } -},{"robust-orientation":439}],471:[function(require,module,exports){ +},{"robust-orientation":462}],494:[function(require,module,exports){ "use strict" module.exports = createRBTree @@ -80087,7 +80999,7 @@ function defaultCompare(a, b) { function createRBTree(compare) { return new RedBlackTree(compare || defaultCompare, null) } -},{}],472:[function(require,module,exports){ +},{}],495:[function(require,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -80318,7 +81230,7 @@ function createSlabDecomposition(segments) { } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":470,"binary-search-bounds":468,"functional-red-black-tree":471,"robust-orientation":439}],473:[function(require,module,exports){ +},{"./lib/order-segments":493,"binary-search-bounds":491,"functional-red-black-tree":494,"robust-orientation":462}],496:[function(require,module,exports){ module.exports = preprocessPolygon var orient = require('robust-orientation')[3] @@ -80470,7 +81382,7 @@ function preprocessPolygon(loops) { testSlab) } } -},{"binary-search-bounds":468,"interval-tree-1d":469,"robust-orientation":439,"slab-decomposition":472}],474:[function(require,module,exports){ +},{"binary-search-bounds":491,"interval-tree-1d":492,"robust-orientation":462,"slab-decomposition":495}],497:[function(require,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -80675,9 +81587,9 @@ function planarGraphToPolyline(edges, positions) { return result } -},{"./lib/trim-leaves":462,"edges-to-adjacency-list":463,"planar-dual":464,"point-in-big-polygon":473,"robust-sum":442,"two-product":456,"uniq":459}],475:[function(require,module,exports){ +},{"./lib/trim-leaves":485,"edges-to-adjacency-list":486,"planar-dual":487,"point-in-big-polygon":496,"robust-sum":465,"two-product":479,"uniq":482}],498:[function(require,module,exports){ arguments[4][51][0].apply(exports,arguments) -},{"dup":51}],476:[function(require,module,exports){ +},{"dup":51}],499:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -80734,9 +81646,9 @@ UnionFind.prototype.link = function(x, y) { } -},{}],477:[function(require,module,exports){ -arguments[4][244][0].apply(exports,arguments) -},{"bit-twiddle":475,"dup":244,"union-find":476}],478:[function(require,module,exports){ +},{}],500:[function(require,module,exports){ +arguments[4][249][0].apply(exports,arguments) +},{"bit-twiddle":498,"dup":249,"union-find":499}],501:[function(require,module,exports){ "use strict" module.exports = simplifyPolygon @@ -81008,7 +81920,7 @@ function simplifyPolygon(cells, positions, minArea) { edges: ncells } } -},{"robust-orientation":439,"simplicial-complex":477}],479:[function(require,module,exports){ +},{"robust-orientation":462,"simplicial-complex":500}],502:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81070,7 +81982,7 @@ module.exports = [ } ]; -},{}],480:[function(require,module,exports){ +},{}],503:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81263,7 +82175,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/cartesian/constants":597,"../../plots/font_attributes":610,"./arrow_paths":479}],481:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/cartesian/constants":620,"../../plots/font_attributes":633,"./arrow_paths":502}],504:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82272,7 +83184,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":568,"../../lib/setcursor":577,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/cartesian/axes":592,"../color":483,"../dragelement":504,"../drawing":506,"./arrow_paths":479,"./attributes":480,"d3":119,"fast-isnumeric":123}],482:[function(require,module,exports){ +},{"../../lib":591,"../../lib/setcursor":600,"../../lib/svg_text_utils":604,"../../plotly":612,"../../plots/cartesian/axes":615,"../color":506,"../dragelement":527,"../drawing":529,"./arrow_paths":502,"./attributes":503,"d3":124,"fast-isnumeric":128}],505:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82312,7 +83224,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],483:[function(require,module,exports){ +},{}],506:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82466,7 +83378,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":482,"fast-isnumeric":123,"tinycolor2":454}],484:[function(require,module,exports){ +},{"./attributes":505,"fast-isnumeric":128,"tinycolor2":477}],507:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82621,7 +83533,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/cartesian/layout_attributes":601,"../../plots/font_attributes":610}],485:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/cartesian/layout_attributes":624,"../../plots/font_attributes":633}],508:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82688,7 +83600,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":568,"../../plots/cartesian/tick_label_defaults":607,"../../plots/cartesian/tick_mark_defaults":608,"../../plots/cartesian/tick_value_defaults":609,"./attributes":484}],486:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/tick_label_defaults":630,"../../plots/cartesian/tick_mark_defaults":631,"../../plots/cartesian/tick_value_defaults":632,"./attributes":507}],509:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83318,7 +84230,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":568,"../../lib/extend":563,"../../lib/setcursor":577,"../../plotly":589,"../../plots/cartesian/axes":592,"../../plots/cartesian/axis_defaults":593,"../../plots/cartesian/layout_attributes":601,"../../plots/cartesian/position_defaults":604,"../../plots/plots":648,"../color":483,"../dragelement":504,"../drawing":506,"../titles":546,"./attributes":484,"d3":119,"tinycolor2":454}],487:[function(require,module,exports){ +},{"../../lib":591,"../../lib/extend":586,"../../lib/setcursor":600,"../../plotly":612,"../../plots/cartesian/axes":615,"../../plots/cartesian/axis_defaults":616,"../../plots/cartesian/layout_attributes":624,"../../plots/cartesian/position_defaults":627,"../../plots/plots":671,"../color":506,"../dragelement":527,"../drawing":529,"../titles":569,"./attributes":507,"d3":124,"tinycolor2":477}],510:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83337,7 +84249,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":568}],488:[function(require,module,exports){ +},{"../../lib":591}],511:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83358,7 +84270,7 @@ exports.draw = require('./draw'); exports.hasColorbar = require('./has_colorbar'); -},{"./attributes":484,"./defaults":485,"./draw":486,"./has_colorbar":487}],489:[function(require,module,exports){ +},{"./attributes":507,"./defaults":508,"./draw":509,"./has_colorbar":510}],512:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83413,7 +84325,7 @@ module.exports = { } }; -},{}],490:[function(require,module,exports){ +},{}],513:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83479,7 +84391,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":568,"./flip_scale":494,"./scales":501}],491:[function(require,module,exports){ +},{"../../lib":591,"./flip_scale":517,"./scales":524}],514:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83523,7 +84435,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":563,"./attributes":489,"./scales.js":501}],492:[function(require,module,exports){ +},{"../../lib/extend":586,"./attributes":512,"./scales.js":524}],515:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83539,7 +84451,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":501}],493:[function(require,module,exports){ +},{"./scales":524}],516:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83603,7 +84515,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":568,"../colorbar/defaults":485,"../colorbar/has_colorbar":487,"./flip_scale":494,"./is_valid_scale":498,"fast-isnumeric":123}],494:[function(require,module,exports){ +},{"../../lib":591,"../colorbar/defaults":508,"../colorbar/has_colorbar":510,"./flip_scale":517,"./is_valid_scale":521,"fast-isnumeric":128}],517:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83628,7 +84540,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],495:[function(require,module,exports){ +},{}],518:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83668,7 +84580,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":492,"./is_valid_scale_array":499,"./scales":501}],496:[function(require,module,exports){ +},{"./default_scale":515,"./is_valid_scale_array":522,"./scales":524}],519:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83714,7 +84626,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":568,"./is_valid_scale":498,"fast-isnumeric":123}],497:[function(require,module,exports){ +},{"../../lib":591,"./is_valid_scale":521,"fast-isnumeric":128}],520:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83746,7 +84658,7 @@ exports.flipScale = require('./flip_scale'); exports.makeScaleFunction = require('./make_scale_function'); -},{"./attributes":489,"./calc":490,"./default_scale":492,"./defaults":493,"./flip_scale":494,"./get_scale":495,"./has_colorscale":496,"./is_valid_scale":498,"./make_scale_function":500,"./scales":501}],498:[function(require,module,exports){ +},{"./attributes":512,"./calc":513,"./default_scale":515,"./defaults":516,"./flip_scale":517,"./get_scale":518,"./has_colorscale":519,"./is_valid_scale":521,"./make_scale_function":523,"./scales":524}],521:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83767,7 +84679,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":499,"./scales":501}],499:[function(require,module,exports){ +},{"./is_valid_scale_array":522,"./scales":524}],522:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83804,7 +84716,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":454}],500:[function(require,module,exports){ +},{"tinycolor2":477}],523:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83853,7 +84765,7 @@ module.exports = function makeScaleFunction(scl, cmin, cmax) { }; }; -},{"../../lib":568,"../color":483,"d3":119,"fast-isnumeric":123,"tinycolor2":454}],501:[function(require,module,exports){ +},{"../../lib":591,"../color":506,"d3":124,"fast-isnumeric":128,"tinycolor2":477}],524:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83984,7 +84896,7 @@ module.exports = { ] }; -},{}],502:[function(require,module,exports){ +},{}],525:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84017,7 +84929,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],503:[function(require,module,exports){ +},{}],526:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84055,7 +84967,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":568}],504:[function(require,module,exports){ +},{"../../lib":591}],527:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84240,7 +85152,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":568,"../../plotly":589,"../../plots/cartesian/constants":597,"./align":502,"./cursor":503,"./unhover":505}],505:[function(require,module,exports){ +},{"../../lib":591,"../../plotly":612,"../../plots/cartesian/constants":620,"./align":525,"./cursor":526,"./unhover":528}],528:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84291,7 +85203,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":562}],506:[function(require,module,exports){ +},{"../../lib/events":585}],529:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84855,7 +85767,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../../lib/svg_text_utils":581,"../../plots/plots":648,"../../traces/scatter/make_bubble_size_func":764,"../../traces/scatter/subtypes":769,"../color":483,"../colorscale":497,"./symbol_defs":507,"d3":119,"fast-isnumeric":123}],507:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../../lib":591,"../../lib/svg_text_utils":604,"../../plots/plots":671,"../../traces/scatter/make_bubble_size_func":787,"../../traces/scatter/subtypes":792,"../color":506,"../colorscale":520,"./symbol_defs":530,"d3":124,"fast-isnumeric":128}],530:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85331,7 +86243,7 @@ module.exports = { } }; -},{"d3":119}],508:[function(require,module,exports){ +},{"d3":124}],531:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85430,7 +86342,7 @@ module.exports = { } }; -},{}],509:[function(require,module,exports){ +},{}],532:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85493,7 +86405,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":592,"../../plots/plots":648,"./compute_error":510,"fast-isnumeric":123}],510:[function(require,module,exports){ +},{"../../plots/cartesian/axes":615,"../../plots/plots":671,"./compute_error":533,"fast-isnumeric":128}],533:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85589,7 +86501,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],511:[function(require,module,exports){ +},{}],534:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85666,7 +86578,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":568,"../../plots/plots":648,"./attributes":508,"fast-isnumeric":123}],512:[function(require,module,exports){ +},{"../../lib":591,"../../plots/plots":671,"./attributes":531,"fast-isnumeric":128}],535:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85725,7 +86637,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":508,"./calc":509,"./defaults":511,"./plot":513,"./style":514}],513:[function(require,module,exports){ +},{"./attributes":531,"./calc":532,"./defaults":534,"./plot":536,"./style":537}],536:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85846,7 +86758,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../lib":568,"../../traces/scatter/subtypes":769,"d3":119,"fast-isnumeric":123}],514:[function(require,module,exports){ +},{"../../lib":591,"../../traces/scatter/subtypes":792,"d3":124,"fast-isnumeric":128}],537:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85883,7 +86795,7 @@ module.exports = function style(traces) { }); }; -},{"../color":483,"d3":119}],515:[function(require,module,exports){ +},{"../color":506,"d3":124}],538:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85998,7 +86910,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":597}],516:[function(require,module,exports){ +},{"../../plots/cartesian/constants":620}],539:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86064,7 +86976,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":568,"../../plots/cartesian/axes":592,"./attributes":515}],517:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"./attributes":538}],540:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86078,6 +86990,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = require('d3'); var Drawing = require('../drawing'); var Axes = require('../../plots/cartesian/axes'); +var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -86119,9 +87032,10 @@ module.exports = function draw(gd) { // Images must be converted to dataURL's for exporting. function setImage(d) { - var thisImage = d3.select(this); + thisImage.attr('xmlns', xmlnsNamespaces.svg); + var imagePromise = new Promise(function(resolve) { var img = new Image(); @@ -86159,7 +87073,6 @@ module.exports = function draw(gd) { } function applyAttributes(d) { - var thisImage = d3.select(this); // Axes if specified @@ -86207,7 +87120,9 @@ module.exports = function draw(gd) { yId = yref ? yref._id : '', clipAxes = xId + yId; - thisImage.call(Drawing.setClipUrl, 'clip' + fullLayout._uid + clipAxes); + if(clipAxes) { + thisImage.call(Drawing.setClipUrl, 'clip' + fullLayout._uid + clipAxes); + } } @@ -86237,7 +87152,7 @@ module.exports = function draw(gd) { imagesAbove.each(applyAttributes); }; -},{"../../plots/cartesian/axes":592,"../drawing":506,"d3":119}],518:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../../plots/cartesian/axes":615,"../drawing":529,"d3":124}],541:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86260,7 +87175,7 @@ module.exports = { supplyLayoutDefaults: supplyLayoutDefaults }; -},{"./attributes":515,"./defaults":516,"./draw":517}],519:[function(require,module,exports){ +},{"./attributes":538,"./defaults":539,"./draw":540}],542:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86309,7 +87224,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],520:[function(require,module,exports){ +},{}],543:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86400,7 +87315,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482}],521:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/font_attributes":633,"../color/attributes":505}],544:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86418,7 +87333,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],522:[function(require,module,exports){ +},{}],545:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86510,7 +87425,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":568,"../../plots/plots":648,"./attributes":520,"./helpers":525}],523:[function(require,module,exports){ +},{"../../lib":591,"../../plots/plots":671,"./attributes":543,"./helpers":548}],546:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87183,7 +88098,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":568,"../../plotly":589,"../../plots/plots":648,"../color":483,"../dragelement":504,"../drawing":506,"./anchor_utils":519,"./constants":521,"./get_legend_data":524,"./helpers":525,"./style":527,"d3":119}],524:[function(require,module,exports){ +},{"../../lib":591,"../../plotly":612,"../../plots/plots":671,"../color":506,"../dragelement":527,"../drawing":529,"./anchor_utils":542,"./constants":544,"./get_legend_data":547,"./helpers":548,"./style":550,"d3":124}],547:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87289,7 +88204,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../plots/plots":648,"./helpers":525}],525:[function(require,module,exports){ +},{"../../plots/plots":671,"./helpers":548}],548:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87320,7 +88235,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../plots/plots":648}],526:[function(require,module,exports){ +},{"../../plots/plots":671}],549:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87343,7 +88258,7 @@ legend.draw = require('./draw'); legend.style = require('./style'); -},{"./attributes":520,"./defaults":522,"./draw":523,"./style":527}],527:[function(require,module,exports){ +},{"./attributes":543,"./defaults":545,"./draw":546,"./style":550}],550:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87565,7 +88480,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":568,"../../plots/plots":648,"../../traces/pie/style_one":748,"../../traces/scatter/subtypes":769,"../color":483,"../drawing":506,"d3":119}],528:[function(require,module,exports){ +},{"../../lib":591,"../../plots/plots":671,"../../traces/pie/style_one":771,"../../traces/scatter/subtypes":792,"../color":506,"../drawing":529,"d3":124}],551:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88073,7 +88988,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":568,"../../plotly":589,"../../snapshot/download":663}],529:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":591,"../../plotly":612,"../../snapshot/download":686}],552:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88363,7 +89278,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":568,"d3":119}],530:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":591,"d3":124}],553:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88591,7 +89506,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plotly":589,"../../traces/scatter/subtypes":769,"./":529,"./buttons":528}],531:[function(require,module,exports){ +},{"../../plotly":612,"../../traces/scatter/subtypes":792,"./":552,"./buttons":551}],554:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88680,7 +89595,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482,"./button_attributes":532}],532:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/font_attributes":633,"../color/attributes":505,"./button_attributes":555}],555:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88721,7 +89636,7 @@ module.exports = { } }; -},{}],533:[function(require,module,exports){ +},{}],556:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88750,7 +89665,7 @@ module.exports = { darkAmount: 10 }; -},{}],534:[function(require,module,exports){ +},{}],557:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88836,13 +89751,14 @@ function getPosDflt(containerOut, layout, counterAxes) { var posY = 0; for(var i = 0; i < anchoredList.length; i++) { - posY = Math.max(layout[anchoredList[i]].domain[1], posY); + var domain = layout[anchoredList[i]].domain; + if(domain) posY = Math.max(domain[1], posY); } return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":568,"../color":483,"./attributes":531,"./button_attributes":532,"./constants":533}],535:[function(require,module,exports){ +},{"../../lib":591,"../color":506,"./attributes":554,"./button_attributes":555,"./constants":556}],558:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89117,7 +90033,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/cartesian/axis_ids":594,"../../plots/plots":648,"../color":483,"../drawing":506,"../legend/anchor_utils":519,"./constants":533,"./get_update_object":536,"d3":119}],536:[function(require,module,exports){ +},{"../../lib/svg_text_utils":604,"../../plotly":612,"../../plots/cartesian/axis_ids":617,"../../plots/plots":671,"../color":506,"../drawing":529,"../legend/anchor_utils":542,"./constants":556,"./get_update_object":559,"d3":124}],559:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89175,7 +90091,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":119}],537:[function(require,module,exports){ +},{"d3":124}],560:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89193,7 +90109,7 @@ exports.supplyLayoutDefaults = require('./defaults'); exports.draw = require('./draw'); -},{"./attributes":531,"./defaults":534,"./draw":535}],538:[function(require,module,exports){ +},{"./attributes":554,"./defaults":557,"./draw":558}],561:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89251,7 +90167,7 @@ module.exports = { } }; -},{"../color/attributes":482}],539:[function(require,module,exports){ +},{"../color/attributes":505}],562:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89547,7 +90463,7 @@ module.exports = function createSlider(gd) { }); }; -},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../../plotly":589,"../../plots/cartesian/axes":592,"./helpers":541,"./range_plot":543}],540:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../../lib":591,"../../plotly":612,"../../plots/cartesian/axes":615,"./helpers":564,"./range_plot":566}],563:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89600,7 +90516,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, axName, coun } }; -},{"../../lib":568,"./attributes":538}],541:[function(require,module,exports){ +},{"../../lib":591,"./attributes":561}],564:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89626,7 +90542,7 @@ exports.appendChildren = function appendChildren(el, children) { } }; -},{}],542:[function(require,module,exports){ +},{}],565:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89683,7 +90599,7 @@ function draw(gd) { }); } -},{"../../plots/plots":648,"./create_slider":539,"./defaults":540}],543:[function(require,module,exports){ +},{"../../plots/plots":671,"./create_slider":562,"./defaults":563}],566:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89864,7 +90780,7 @@ function makeScatter(trace, pointPairs, w, h) { return [line, markers, fill]; } -},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../drawing":506,"../drawing/symbol_defs":507,"./helpers":541,"d3":119}],544:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../../lib":591,"../drawing":529,"../drawing/symbol_defs":530,"./helpers":564,"d3":124}],567:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89955,7 +90871,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../traces/scatter/attributes":750,"../annotations/attributes":480}],545:[function(require,module,exports){ +},{"../../lib/extend":586,"../../traces/scatter/attributes":773,"../annotations/attributes":503}],568:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90745,7 +91661,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":568,"../../lib/setcursor":577,"../../plotly":589,"../../plots/cartesian/axes":592,"../color":483,"../dragelement":504,"../drawing":506,"./attributes":544,"fast-isnumeric":123}],546:[function(require,module,exports){ +},{"../../lib":591,"../../lib/setcursor":600,"../../plotly":612,"../../plots/cartesian/axes":615,"../color":506,"../dragelement":527,"../drawing":529,"./attributes":567,"fast-isnumeric":128}],569:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90975,7 +91891,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":568,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/plots":648,"../color":483,"../drawing":506,"d3":119,"fast-isnumeric":123}],547:[function(require,module,exports){ +},{"../../lib":591,"../../lib/svg_text_utils":604,"../../plotly":612,"../../plots/plots":671,"../color":506,"../drawing":529,"d3":124,"fast-isnumeric":128}],570:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91093,7 +92009,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482}],548:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/font_attributes":633,"../color/attributes":505}],571:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91168,7 +92084,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],549:[function(require,module,exports){ +},{}],572:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91264,7 +92180,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":568,"./attributes":547,"./constants":548}],550:[function(require,module,exports){ +},{"../../lib":591,"./attributes":570,"./constants":571}],573:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91723,7 +92639,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":568,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/plots":648,"../color":483,"../drawing":506,"../legend/anchor_utils":519,"./constants":548,"d3":119}],551:[function(require,module,exports){ +},{"../../lib":591,"../../lib/svg_text_utils":604,"../../plotly":612,"../../plots/plots":671,"../color":506,"../drawing":529,"../legend/anchor_utils":542,"./constants":571,"d3":124}],574:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91741,7 +92657,7 @@ exports.supplyLayoutDefaults = require('./defaults'); exports.draw = require('./draw'); -},{"./attributes":547,"./defaults":549,"./draw":550}],552:[function(require,module,exports){ +},{"./attributes":570,"./defaults":572,"./draw":573}],575:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91762,7 +92678,7 @@ module.exports = { longdashdot: [8, 1, 1, 1] }; -},{}],553:[function(require,module,exports){ +},{}],576:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91783,7 +92699,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],554:[function(require,module,exports){ +},{}],577:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91806,7 +92722,7 @@ module.exports = { x: '❌' }; -},{}],555:[function(require,module,exports){ +},{}],578:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91844,7 +92760,7 @@ module.exports = { }; -},{}],556:[function(require,module,exports){ +},{}],579:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91868,7 +92784,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],557:[function(require,module,exports){ +},{}],580:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91886,7 +92802,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.16.2'; +exports.version = '1.16.3'; // plot api exports.plot = Plotly.plot; @@ -91919,7 +92835,7 @@ exports.Queue = Plotly.Queue; // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/ploticon":2,"./plot_api/set_plot_config":586,"./plot_api/to_image":587,"./plot_api/validate":588,"./plotly":589,"./snapshot/download":663,"d3":119}],558:[function(require,module,exports){ +},{"../build/ploticon":2,"./plot_api/set_plot_config":609,"./plot_api/to_image":610,"./plot_api/validate":611,"./plotly":612,"./snapshot/download":686,"d3":124}],581:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91952,7 +92868,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],559:[function(require,module,exports){ +},{}],582:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91969,7 +92885,7 @@ module.exports = function arrayToCalcItem(traceAttr, calcItem, calcAttr, i) { if(Array.isArray(traceAttr)) calcItem[calcAttr] = traceAttr[i]; }; -},{}],560:[function(require,module,exports){ +},{}],583:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92279,7 +93195,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":495,"../components/colorscale/scales":501,"./nested_property":572,"fast-isnumeric":123,"tinycolor2":454}],561:[function(require,module,exports){ +},{"../components/colorscale/get_scale":518,"../components/colorscale/scales":524,"./nested_property":595,"fast-isnumeric":128,"tinycolor2":477}],584:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92618,7 +93534,7 @@ exports.parseDate = function(v) { return out; }; -},{"../lib":568,"d3":119,"fast-isnumeric":123}],562:[function(require,module,exports){ +},{"../lib":591,"d3":124,"fast-isnumeric":128}],585:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92752,7 +93668,7 @@ var Events = { module.exports = Events; -},{"events":57}],563:[function(require,module,exports){ +},{"events":56}],586:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92866,7 +93782,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":569}],564:[function(require,module,exports){ +},{"./is_plain_object.js":592}],587:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92890,7 +93806,7 @@ module.exports = function filterVisible(dataIn) { return dataOut; }; -},{}],565:[function(require,module,exports){ +},{}],588:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92949,7 +93865,7 @@ function countryNameToISO3(countryName) { Lib.warn('Unrecognized country name: ' + countryName + '.'); } -},{"../lib":568,"country-regex":114}],566:[function(require,module,exports){ +},{"../lib":591,"country-regex":119}],589:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93028,7 +93944,7 @@ function formatColor(containerIn, opacityIn, len) { module.exports = formatColor; -},{"../components/color/attributes":482,"../components/colorscale/make_scale_function":500,"./str2rgbarray":580,"fast-isnumeric":123,"tinycolor2":454}],567:[function(require,module,exports){ +},{"../components/color/attributes":505,"../components/colorscale/make_scale_function":523,"./str2rgbarray":603,"fast-isnumeric":128,"tinycolor2":477}],590:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93097,7 +94013,7 @@ function convertHTMLToUnicode(html) { module.exports = convertHTMLToUnicode; -},{"../constants/string_mappings":555,"superscript-text":443}],568:[function(require,module,exports){ +},{"../constants/string_mappings":578,"superscript-text":466}],591:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93717,7 +94633,7 @@ lib.numSeparate = function(value, separators) { return x1 + x2; }; -},{"./coerce":560,"./dates":561,"./extend":563,"./is_plain_object":569,"./loggers":570,"./matrix":571,"./nested_property":572,"./notifier":573,"./search":576,"./stats":579,"d3":119}],569:[function(require,module,exports){ +},{"./coerce":583,"./dates":584,"./extend":586,"./is_plain_object":592,"./loggers":593,"./matrix":594,"./nested_property":595,"./notifier":596,"./search":599,"./stats":602,"d3":124}],592:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93746,7 +94662,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],570:[function(require,module,exports){ +},{}],593:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93813,7 +94729,7 @@ loggers.error = function() { }; /* eslint-enable no-console */ -},{"../plot_api/plot_config":584}],571:[function(require,module,exports){ +},{"../plot_api/plot_config":607}],594:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93923,7 +94839,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],572:[function(require,module,exports){ +},{}],595:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94179,7 +95095,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"fast-isnumeric":123}],573:[function(require,module,exports){ +},{"fast-isnumeric":128}],596:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94256,7 +95172,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":119,"fast-isnumeric":123}],574:[function(require,module,exports){ +},{"d3":124,"fast-isnumeric":128}],597:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94496,7 +95412,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":571}],575:[function(require,module,exports){ +},{"./matrix":594}],598:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94707,7 +95623,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":568,"../plot_api/plot_config":584}],576:[function(require,module,exports){ +},{"../lib":591,"../plot_api/plot_config":607}],599:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94819,7 +95735,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"../lib":568,"fast-isnumeric":123}],577:[function(require,module,exports){ +},{"../lib":591,"fast-isnumeric":128}],600:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94842,7 +95758,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],578:[function(require,module,exports){ +},{}],601:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94891,7 +95807,7 @@ module.exports = function showWebGlMsg(scene) { return false; }; -},{"../components/color":483}],579:[function(require,module,exports){ +},{"../components/color":506}],602:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94987,7 +95903,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":123}],580:[function(require,module,exports){ +},{"fast-isnumeric":128}],603:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95009,7 +95925,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"arraytools":50,"tinycolor2":454}],581:[function(require,module,exports){ +},{"arraytools":50,"tinycolor2":477}],604:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95536,7 +96452,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":555,"../constants/xmlns_namespaces":556,"../lib":568,"d3":119}],582:[function(require,module,exports){ +},{"../constants/string_mappings":578,"../constants/xmlns_namespaces":579,"../lib":591,"d3":124}],605:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95572,7 +96488,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":611,"topojson":455}],583:[function(require,module,exports){ +},{"../plots/geo/constants":634,"topojson":478}],606:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -98687,7 +99603,7 @@ function drawMainTitle(gd) { }); } -},{"../components/color":483,"../components/drawing":506,"../components/errorbars":512,"../components/images":518,"../components/legend":526,"../components/modebar/manage":530,"../components/rangeselector":537,"../components/rangeslider":542,"../components/shapes":545,"../components/titles":546,"../components/updatemenus":551,"../constants/xmlns_namespaces":556,"../lib":568,"../lib/events":562,"../lib/queue":575,"../plotly":589,"../plots/cartesian/graph_interact":599,"../plots/plots":648,"d3":119,"fast-isnumeric":123,"gl-mat4/fromQuat":140}],584:[function(require,module,exports){ +},{"../components/color":506,"../components/drawing":529,"../components/errorbars":535,"../components/images":541,"../components/legend":549,"../components/modebar/manage":553,"../components/rangeselector":560,"../components/rangeslider":565,"../components/shapes":568,"../components/titles":569,"../components/updatemenus":574,"../constants/xmlns_namespaces":579,"../lib":591,"../lib/events":585,"../lib/queue":598,"../plotly":612,"../plots/cartesian/graph_interact":622,"../plots/plots":671,"d3":124,"fast-isnumeric":128,"gl-mat4/fromQuat":145}],607:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -98796,7 +99712,7 @@ function defaultSetBackground(gd, bgColor) { catch(e) { Lib.error(e); } } -},{"../lib":568}],585:[function(require,module,exports){ +},{"../lib":591}],608:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99136,7 +100052,7 @@ function handleLinkedToArray(layoutAttributes) { PlotSchema.crawl(layoutAttributes, callback); } -},{"../lib":568,"../plotly":589,"../plots/plots":648,"../plots/polar/area_attributes":649,"../plots/polar/axis_attributes":650}],586:[function(require,module,exports){ +},{"../lib":591,"../plotly":612,"../plots/plots":671,"../plots/polar/area_attributes":672,"../plots/polar/axis_attributes":673}],609:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99162,7 +100078,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":568,"../plotly":589}],587:[function(require,module,exports){ +},{"../lib":591,"../plotly":612}],610:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99275,7 +100191,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":568,"../plotly":589,"../snapshot":665,"fast-isnumeric":123}],588:[function(require,module,exports){ +},{"../lib":591,"../plotly":612,"../snapshot":688,"fast-isnumeric":128}],611:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99645,7 +100561,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":568,"../plots/plots":648,"./plot_schema":585}],589:[function(require,module,exports){ +},{"../lib":591,"../plots/plots":671,"./plot_schema":608}],612:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99763,7 +100679,7 @@ exports.PlotSchema = require('./plot_api/plot_schema'); // imaging routines exports.Snapshot = require('./snapshot'); -},{"../build/plotcss":1,"./components/annotations":481,"./components/color":483,"./components/colorbar":488,"./components/colorscale":497,"./components/drawing":506,"./components/errorbars":512,"./components/images":518,"./components/legend":526,"./components/modebar":529,"./components/shapes":545,"./components/updatemenus":551,"./fonts/mathjax_config":558,"./lib":568,"./lib/queue":575,"./lib/svg_text_utils":581,"./plot_api/plot_api":583,"./plot_api/plot_config":584,"./plot_api/plot_schema":585,"./plots/cartesian/axes":592,"./plots/cartesian/graph_interact":599,"./plots/plots":648,"./plots/polar/micropolar":651,"./snapshot":665,"./traces/scatter":760,"es6-promise":122}],590:[function(require,module,exports){ +},{"../build/plotcss":1,"./components/annotations":504,"./components/color":506,"./components/colorbar":511,"./components/colorscale":520,"./components/drawing":529,"./components/errorbars":535,"./components/images":541,"./components/legend":549,"./components/modebar":552,"./components/shapes":568,"./components/updatemenus":574,"./fonts/mathjax_config":581,"./lib":591,"./lib/queue":598,"./lib/svg_text_utils":604,"./plot_api/plot_api":606,"./plot_api/plot_config":607,"./plot_api/plot_schema":608,"./plots/cartesian/axes":615,"./plots/cartesian/graph_interact":622,"./plots/plots":671,"./plots/polar/micropolar":674,"./snapshot":688,"./traces/scatter":783,"es6-promise":127}],613:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99844,7 +100760,7 @@ module.exports = { } }; -},{}],591:[function(require,module,exports){ +},{}],614:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99871,7 +100787,7 @@ module.exports = { } }; -},{}],592:[function(require,module,exports){ +},{}],615:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101895,7 +102811,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":483,"../../components/drawing":506,"../../components/titles":546,"../../lib":568,"../../lib/svg_text_utils":581,"../../plotly":589,"./axis_ids":594,"./layout_attributes":601,"./layout_defaults":602,"./set_convert":606,"d3":119,"fast-isnumeric":123}],593:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"../../components/titles":569,"../../lib":591,"../../lib/svg_text_utils":604,"../../plotly":612,"./axis_ids":617,"./layout_attributes":624,"./layout_defaults":625,"./set_convert":629,"d3":124,"fast-isnumeric":128}],616:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102178,7 +103094,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../components/color/attributes":482,"../../lib":568,"../plots":648,"./axis_ids":594,"./category_order_defaults":595,"./clean_datum":596,"./layout_attributes":601,"./ordered_categories":603,"./set_convert":606,"./tick_label_defaults":607,"./tick_mark_defaults":608,"./tick_value_defaults":609,"fast-isnumeric":123,"tinycolor2":454}],594:[function(require,module,exports){ +},{"../../components/color/attributes":505,"../../lib":591,"../plots":671,"./axis_ids":617,"./category_order_defaults":618,"./clean_datum":619,"./layout_attributes":624,"./ordered_categories":626,"./set_convert":629,"./tick_label_defaults":630,"./tick_mark_defaults":631,"./tick_value_defaults":632,"fast-isnumeric":128,"tinycolor2":477}],617:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102299,7 +103215,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":568,"../plots":648,"./constants":597}],595:[function(require,module,exports){ +},{"../../lib":591,"../plots":671,"./constants":620}],618:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102333,7 +103249,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],596:[function(require,module,exports){ +},{}],619:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102372,7 +103288,7 @@ module.exports = function cleanDatum(c) { return c; }; -},{"../../lib":568,"fast-isnumeric":123}],597:[function(require,module,exports){ +},{"../../lib":591,"fast-isnumeric":128}],620:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102450,7 +103366,7 @@ module.exports = { REDRAWDELAY: 50 }; -},{}],598:[function(require,module,exports){ +},{}],621:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -103139,7 +104055,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../lib":568,"../../lib/setcursor":577,"../../lib/svg_text_utils":581,"../../plotly":589,"./axes":592,"./constants":597,"./select":605,"d3":119,"tinycolor2":454}],599:[function(require,module,exports){ +},{"../../components/color":506,"../../components/dragelement":527,"../../components/drawing":529,"../../lib":591,"../../lib/setcursor":600,"../../lib/svg_text_utils":604,"../../plotly":612,"./axes":615,"./constants":620,"./select":628,"d3":124,"tinycolor2":477}],622:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -104481,7 +105397,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../lib":568,"../../lib/events":562,"../../lib/svg_text_utils":581,"./axes":592,"./constants":597,"./dragbox":598,"d3":119,"fast-isnumeric":123,"tinycolor2":454}],600:[function(require,module,exports){ +},{"../../components/color":506,"../../components/dragelement":527,"../../components/drawing":529,"../../lib":591,"../../lib/events":585,"../../lib/svg_text_utils":604,"./axes":615,"./constants":620,"./dragbox":621,"d3":124,"fast-isnumeric":128,"tinycolor2":477}],623:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -104568,7 +105484,7 @@ exports.plot = function(gd) { } }; -},{"../plots":648,"./attributes":591,"./constants":597}],601:[function(require,module,exports){ +},{"../plots":671,"./attributes":614,"./constants":620}],624:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -104913,7 +105829,7 @@ module.exports = { } }; -},{"../../components/color/attributes":482,"../../components/rangeselector/attributes":531,"../../components/rangeslider/attributes":538,"../../lib/extend":563,"../font_attributes":610,"./constants":597}],602:[function(require,module,exports){ +},{"../../components/color/attributes":505,"../../components/rangeselector/attributes":554,"../../components/rangeslider/attributes":561,"../../lib/extend":586,"../font_attributes":633,"./constants":620}],625:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105086,7 +106002,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":483,"../../components/rangeselector":537,"../../components/rangeslider":542,"../../lib":568,"../plots":648,"./axis_defaults":593,"./axis_ids":594,"./constants":597,"./layout_attributes":601,"./position_defaults":604}],603:[function(require,module,exports){ +},{"../../components/color":506,"../../components/rangeselector":560,"../../components/rangeslider":565,"../../lib":591,"../plots":671,"./axis_defaults":616,"./axis_ids":617,"./constants":620,"./layout_attributes":624,"./position_defaults":627}],626:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105130,7 +106046,7 @@ function flattenUniqueSort(axisLetter, sortFunction, data) { insertionIndex = bisector(categoryArray, category); // skip loop on already encountered values - if(insertionIndex < categoryArray.length - 1 && categoryArray[insertionIndex] === category) continue; + if(insertionIndex < categoryArray.length && categoryArray[insertionIndex] === category) continue; // insert value categoryArray.splice(insertionIndex, 0, category); @@ -105165,7 +106081,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":119}],604:[function(require,module,exports){ +},{"d3":124}],627:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105230,7 +106146,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":568,"fast-isnumeric":123}],605:[function(require,module,exports){ +},{"../../lib":591,"fast-isnumeric":128}],628:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105430,7 +106346,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":483,"../../lib/polygon":574,"./axes":592,"./constants":597}],606:[function(require,module,exports){ +},{"../../components/color":506,"../../lib/polygon":597,"./axes":615,"./constants":620}],629:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105674,7 +106590,7 @@ module.exports = function setConvert(ax) { ax._forceTick0 = null; }; -},{"../../lib":568,"./axis_ids":594,"./clean_datum":596,"./constants":597,"d3":119,"fast-isnumeric":123}],607:[function(require,module,exports){ +},{"../../lib":591,"./axis_ids":617,"./clean_datum":619,"./constants":620,"d3":124,"fast-isnumeric":128}],630:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105757,7 +106673,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":568}],608:[function(require,module,exports){ +},{"../../lib":591}],631:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105790,7 +106706,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":568,"./layout_attributes":601}],609:[function(require,module,exports){ +},{"../../lib":591,"./layout_attributes":624}],632:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105831,7 +106747,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":123}],610:[function(require,module,exports){ +},{"fast-isnumeric":128}],633:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105862,7 +106778,7 @@ module.exports = { } }; -},{}],611:[function(require,module,exports){ +},{}],634:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106020,7 +106936,7 @@ params.layerNameToAdjective = { // base layers drawn over choropleth params.baseLayersOverChoropleth = ['rivers', 'lakes']; -},{}],612:[function(require,module,exports){ +},{}],635:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106514,7 +107430,7 @@ function createMockAxis(fullLayout) { return mockAxis; } -},{"../../components/color":483,"../../components/drawing":506,"../../constants/xmlns_namespaces":556,"../../lib/filter_visible":564,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"./constants":611,"./projections":619,"./set_scale":620,"./zoom":621,"./zoom_reset":622,"d3":119,"topojson":455}],613:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"../../constants/xmlns_namespaces":579,"../../lib/filter_visible":587,"../../lib/topojson_utils":605,"../../plots/cartesian/axes":615,"./constants":634,"./projections":642,"./set_scale":643,"./zoom":644,"./zoom_reset":645,"d3":124,"topojson":478}],636:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106620,7 +107536,7 @@ exports.toSVG = function(gd) { } }; -},{"../../plots/plots":648,"./geo":612,"./layout/attributes":614,"./layout/defaults":617,"./layout/layout_attributes":618}],614:[function(require,module,exports){ +},{"../../plots/plots":671,"./geo":635,"./layout/attributes":637,"./layout/defaults":640,"./layout/layout_attributes":641}],637:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106641,7 +107557,7 @@ module.exports = { } }; -},{}],615:[function(require,module,exports){ +},{}],638:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106696,7 +107612,7 @@ module.exports = { } }; -},{"../../../components/color/attributes":482}],616:[function(require,module,exports){ +},{"../../../components/color/attributes":505}],639:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106770,7 +107686,7 @@ module.exports = function supplyGeoAxisLayoutDefaults(geoLayoutIn, geoLayoutOut) } }; -},{"../../../lib":568,"../constants":611,"./axis_attributes":615}],617:[function(require,module,exports){ +},{"../../../lib":591,"../constants":634,"./axis_attributes":638}],640:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106889,7 +107805,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce) { ]; } -},{"../../subplot_defaults":654,"../constants":611,"./axis_defaults":616,"./layout_attributes":618}],618:[function(require,module,exports){ +},{"../../subplot_defaults":677,"../constants":634,"./axis_defaults":639,"./layout_attributes":641}],641:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107122,7 +108038,7 @@ module.exports = { lataxis: geoAxesAttrs }; -},{"../../../components/color/attributes":482,"../constants":611,"./axis_attributes":615}],619:[function(require,module,exports){ +},{"../../../components/color/attributes":505,"../constants":634,"./axis_attributes":638}],642:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107568,7 +108484,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],620:[function(require,module,exports){ +},{}],643:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107719,7 +108635,7 @@ function getBounds(projection, rangeBox) { return d3.geo.path().projection(projection).bounds(rangeBox); } -},{"./constants":611,"d3":119}],621:[function(require,module,exports){ +},{"./constants":634,"d3":124}],644:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108146,7 +109062,7 @@ function d3_eventDispatch(target) { return dispatch; } -},{"d3":119}],622:[function(require,module,exports){ +},{"d3":124}],645:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108181,7 +109097,7 @@ function createGeoZoomReset(geo, geoLayout) { module.exports = createGeoZoomReset; -},{"../cartesian/graph_interact":599}],623:[function(require,module,exports){ +},{"../cartesian/graph_interact":622}],646:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108216,6 +109132,11 @@ function createCamera(scene) { plot = scene.glplot, result = new Camera2D(element, plot); + function unSetAutoRange() { + scene.xaxis.autorange = false; + scene.yaxis.autorange = false; + } + result.mouseListener = mouseChange(element, function(buttons, x, y) { var xrange = scene.xaxis.range, yrange = scene.yaxis.range, @@ -108268,7 +109189,7 @@ function createCamera(scene) { else if(result.boxEnabled) { updateRange(xrange, result.boxStart[0], result.boxEnd[0]); updateRange(yrange, result.boxStart[1], result.boxEnd[1]); - + unSetAutoRange(); result.boxEnabled = false; } break; @@ -108288,7 +109209,7 @@ function createCamera(scene) { yrange[1] += dy; result.lastInputTime = Date.now(); - + unSetAutoRange(); scene.cameraChanged(); } break; @@ -108326,6 +109247,7 @@ function createCamera(scene) { yrange[1] = (yrange[1] - cy) * scale + cy; result.lastInputTime = Date.now(); + unSetAutoRange(); scene.cameraChanged(); break; } @@ -108336,7 +109258,7 @@ function createCamera(scene) { return result; } -},{"mouse-change":421,"mouse-wheel":425}],624:[function(require,module,exports){ +},{"mouse-change":444,"mouse-wheel":448}],647:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108579,7 +109501,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/html2unicode":567,"../../lib/str2rgbarray":580,"../../plotly":589}],625:[function(require,module,exports){ +},{"../../lib/html2unicode":590,"../../lib/str2rgbarray":603,"../../plotly":612}],648:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108691,7 +109613,7 @@ exports.toSVG = function(gd) { } }; -},{"../../constants/xmlns_namespaces":556,"../cartesian/attributes":591,"../plots":648,"./scene2d":626}],626:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../cartesian/attributes":614,"../plots":671,"./scene2d":649}],649:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -108969,7 +109891,9 @@ var relayoutCallback = function(scene) { yrange = scene.yaxis.range; // Update the layout on the DIV + scene.graphDiv.layout.xaxis.autorange = scene.xaxis.autorange; scene.graphDiv.layout.xaxis.range = xrange.slice(0); + scene.graphDiv.layout.yaxis.autorange = scene.yaxis.autorange; scene.graphDiv.layout.yaxis.range = yrange.slice(0); // Make a meaningful value to be passed on to the possible 'plotly_relayout' subscriber(s) @@ -109004,7 +109928,6 @@ proto.cameraChanged = function() { }; proto.destroy = function() { - var traces = this.traces; if(traces) { @@ -109028,10 +109951,9 @@ proto.plot = function(fullData, calcData, fullLayout) { var glplot = this.glplot, pixelRatio = this.pixelRatio; - var i, j, trace; - this.fullLayout = fullLayout; this.updateAxes(fullLayout); + this.updateTraces(fullData, calcData); var width = fullLayout.width, height = fullLayout.height, @@ -109045,34 +109967,6 @@ proto.plot = function(fullData, calcData, fullLayout) { canvas.height = pixelHeight; } - // update traces - for(i = 0; i < fullData.length; ++i) { - var fullTrace = fullData[i], - calcTrace = calcData[i]; - trace = this.traces[fullTrace.uid]; - - if(trace) trace.update(fullTrace, calcTrace); - else { - trace = fullTrace._module.plot(this, fullTrace, calcTrace); - } - - this.traces[fullTrace.uid] = trace; - } - - // remove empty traces - var traceIds = Object.keys(this.traces); - - trace_id_loop: - for(i = 0; i < traceIds.length; ++i) { - for(j = 0; j < calcData.length; ++j) { - if(calcData[j][0].trace.uid === traceIds[i]) continue trace_id_loop; - } - - trace = this.traces[traceIds[i]]; - trace.dispose(); - delete this.traces[traceIds[i]]; - } - var options = this.glplotOptions; options.merge(fullLayout); options.screenBox = [0, 0, width, height]; @@ -109098,16 +109992,18 @@ proto.plot = function(fullData, calcData, fullLayout) { bounds[0] = bounds[1] = Infinity; bounds[2] = bounds[3] = -Infinity; - traceIds = Object.keys(this.traces); + var traceIds = Object.keys(this.traces); + var ax, i; + for(i = 0; i < traceIds.length; ++i) { - trace = this.traces[traceIds[i]]; + var traceObj = this.traces[traceIds[i]]; + for(var k = 0; k < 2; ++k) { - bounds[k] = Math.min(bounds[k], trace.bounds[k]); - bounds[k + 2] = Math.max(bounds[k + 2], trace.bounds[k + 2]); + bounds[k] = Math.min(bounds[k], traceObj.bounds[k]); + bounds[k + 2] = Math.max(bounds[k + 2], traceObj.bounds[k + 2]); } } - var ax; for(i = 0; i < 2; ++i) { if(bounds[i] > bounds[i + 2]) { bounds[i] = -1; @@ -109133,6 +110029,43 @@ proto.plot = function(fullData, calcData, fullLayout) { this.glplot.draw(); }; +proto.updateTraces = function(fullData, calcData) { + var traceIds = Object.keys(this.traces); + var i, j, fullTrace; + + // remove empty traces + trace_id_loop: + for(i = 0; i < traceIds.length; i++) { + var oldUid = traceIds[i], + oldTrace = this.traces[oldUid]; + + for(j = 0; j < fullData.length; j++) { + fullTrace = fullData[j]; + + if(fullTrace.uid === oldUid && fullTrace.type === oldTrace.type) { + continue trace_id_loop; + } + } + + oldTrace.dispose(); + delete this.traces[oldUid]; + } + + // update / create trace objects + for(i = 0; i < fullData.length; i++) { + fullTrace = fullData[i]; + + var calcTrace = calcData[i], + traceObj = this.traces[fullTrace.uid]; + + if(traceObj) traceObj.update(fullTrace, calcTrace); + else { + traceObj = fullTrace._module.plot(this, fullTrace, calcTrace); + this.traces[fullTrace.uid] = traceObj; + } + } +}; + proto.draw = function() { if(this.stopped) return; @@ -109240,7 +110173,7 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../lib/html2unicode":567,"../../lib/show_no_webgl_msg":578,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"./camera":623,"./convert":624,"gl-plot2d":171,"gl-select-box":201,"gl-spikes2d":221}],627:[function(require,module,exports){ +},{"../../lib/html2unicode":590,"../../lib/show_no_webgl_msg":601,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622,"./camera":646,"./convert":647,"gl-plot2d":176,"gl-select-box":206,"gl-spikes2d":226}],650:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109483,7 +110416,7 @@ function createCamera(element, options) { return camera; } -},{"3d-view":40,"mouse-change":421,"mouse-wheel":425,"right-now":435}],628:[function(require,module,exports){ +},{"3d-view":40,"mouse-change":444,"mouse-wheel":448,"right-now":458}],651:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109617,7 +110550,7 @@ function initAxes(gd, sceneLayout) { } } -},{"../../constants/xmlns_namespaces":556,"../plots":648,"./layout/attributes":629,"./layout/defaults":633,"./layout/layout_attributes":634,"./scene":638,"./set_convert":639}],629:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../plots":671,"./layout/attributes":652,"./layout/defaults":656,"./layout/layout_attributes":657,"./scene":661,"./set_convert":662}],652:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109638,7 +110571,7 @@ module.exports = { } }; -},{}],630:[function(require,module,exports){ +},{}],653:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109744,7 +110677,7 @@ module.exports = { zerolinewidth: axesAttrs.zerolinewidth }; -},{"../../../components/color":483,"../../../lib/extend":563,"../../cartesian/layout_attributes":601}],631:[function(require,module,exports){ +},{"../../../components/color":506,"../../../lib/extend":586,"../../cartesian/layout_attributes":624}],654:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109813,7 +110746,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":568,"../../cartesian/axis_defaults":593,"./axis_attributes":630,"tinycolor2":454}],632:[function(require,module,exports){ +},{"../../../lib":591,"../../cartesian/axis_defaults":616,"./axis_attributes":653,"tinycolor2":477}],655:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109969,7 +110902,7 @@ function createAxesOptions(plotlyOptions) { module.exports = createAxesOptions; -},{"../../../lib/html2unicode":567,"../../../lib/str2rgbarray":580,"arraytools":50}],633:[function(require,module,exports){ +},{"../../../lib/html2unicode":590,"../../../lib/str2rgbarray":603,"arraytools":50}],656:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110076,7 +111009,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":483,"../../subplot_defaults":654,"./axis_defaults":631,"./layout_attributes":634}],634:[function(require,module,exports){ +},{"../../../components/color":506,"../../subplot_defaults":677,"./axis_defaults":654,"./layout_attributes":657}],657:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110204,7 +111137,7 @@ module.exports = { } }; -},{"../../../lib/extend":563,"./axis_attributes":630}],635:[function(require,module,exports){ +},{"../../../lib/extend":586,"./axis_attributes":653}],658:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110250,7 +111183,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":580}],636:[function(require,module,exports){ +},{"../../../lib/str2rgbarray":603}],659:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110345,7 +111278,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib/html2unicode":567,"../../../plotly":589}],637:[function(require,module,exports){ +},{"../../../lib/html2unicode":590,"../../../plotly":612}],660:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110379,7 +111312,7 @@ function project(camera, v) { module.exports = project; -},{}],638:[function(require,module,exports){ +},{}],661:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111109,7 +112042,7 @@ proto.toImage = function(format) { module.exports = Scene; -},{"../../lib":568,"../../lib/show_no_webgl_msg":578,"../../lib/str2rgbarray":580,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../../plots/plots":648,"./camera":627,"./layout/convert":632,"./layout/spikes":635,"./layout/tick_marks":636,"./project":637,"./set_convert":639,"gl-plot3d":189}],639:[function(require,module,exports){ +},{"../../lib":591,"../../lib/show_no_webgl_msg":601,"../../lib/str2rgbarray":603,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622,"../../plots/plots":671,"./camera":650,"./layout/convert":655,"./layout/spikes":658,"./layout/tick_marks":659,"./project":660,"./set_convert":662,"gl-plot3d":194}],662:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111131,7 +112064,7 @@ module.exports = function setConvert(containerOut) { containerOut.setScale = noop; }; -},{"../cartesian/axes":592}],640:[function(require,module,exports){ +},{"../cartesian/axes":615}],663:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111296,7 +112229,7 @@ module.exports = { } }; -},{"../components/color/attributes":482,"../plotly":589,"./font_attributes":610}],641:[function(require,module,exports){ +},{"../components/color/attributes":505,"../plotly":612,"./font_attributes":633}],664:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111326,7 +112259,7 @@ module.exports = { mapOnErrorMsg: 'Mapbox error.' }; -},{}],642:[function(require,module,exports){ +},{}],665:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111400,7 +112333,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":568}],643:[function(require,module,exports){ +},{"../../lib":591}],666:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111553,7 +112486,7 @@ function findAccessToken(gd, mapboxIds) { return accessToken; } -},{"../../constants/xmlns_namespaces":556,"../plots":648,"./constants":641,"./layout_attributes":645,"./layout_defaults":646,"./mapbox":647,"mapbox-gl":260}],644:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":579,"../plots":671,"./constants":664,"./layout_attributes":668,"./layout_defaults":669,"./mapbox":670,"mapbox-gl":267}],667:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111778,7 +112711,7 @@ module.exports = function createMapboxLayer(mapbox, index, opts) { return mapboxLayer; }; -},{"../../lib":568,"./convert_text_opts":642}],645:[function(require,module,exports){ +},{"../../lib":591,"./convert_text_opts":665}],668:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111981,7 +112914,7 @@ module.exports = { }; -},{"../../components/color":483,"../../lib":568,"../../traces/scatter/attributes":750,"../font_attributes":610}],646:[function(require,module,exports){ +},{"../../components/color":506,"../../lib":591,"../../traces/scatter/attributes":773,"../font_attributes":633}],669:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112077,7 +113010,7 @@ function handleLayerDefaults(containerIn, containerOut) { } } -},{"../../lib":568,"../subplot_defaults":654,"./layout_attributes":645}],647:[function(require,module,exports){ +},{"../../lib":591,"../subplot_defaults":677,"./layout_attributes":668}],670:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112438,16 +113371,24 @@ proto.toImage = function() { // convenience wrapper to create blank GeoJSON sources // and avoid 'invalid GeoJSON' errors -proto.createGeoJSONSource = function() { +proto.initSource = function(idSource) { var blank = { - type: 'Feature', - geometry: { - type: 'Point', - coordinates: [] + type: 'geojson', + data: { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [] + } } }; - return new mapboxgl.GeoJSONSource({data: blank}); + return this.map.addSource(idSource, blank); +}; + +// convenience wrapper to set data of GeoJSON sources +proto.setSourceData = function(idSource, data) { + this.map.getSource(idSource).setData(data); }; // convenience wrapper to create set multiple layer @@ -112515,7 +113456,7 @@ function convertCenter(center) { return [center.lon, center.lat]; } -},{"../../lib":568,"../cartesian/graph_interact":599,"./constants":641,"./layers":644,"./layout_attributes":645,"mapbox-gl":260}],648:[function(require,module,exports){ +},{"../../lib":591,"../cartesian/graph_interact":622,"./constants":664,"./layers":667,"./layout_attributes":668,"mapbox-gl":267}],671:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113706,7 +114647,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { return (output === 'object') ? obj : JSON.stringify(obj); }; -},{"../components/color":483,"../lib":568,"../plotly":589,"./attributes":590,"./font_attributes":610,"./layout_attributes":640,"d3":119,"fast-isnumeric":123}],649:[function(require,module,exports){ +},{"../components/color":506,"../lib":591,"../plotly":612,"./attributes":613,"./font_attributes":633,"./layout_attributes":663,"d3":124,"fast-isnumeric":128}],672:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113731,7 +114672,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":750}],650:[function(require,module,exports){ +},{"../../traces/scatter/attributes":773}],673:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113846,7 +114787,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../cartesian/layout_attributes":601}],651:[function(require,module,exports){ +},{"../../lib/extend":586,"../cartesian/layout_attributes":624}],674:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115269,7 +116210,7 @@ var extendDeepAll = Plotly.Lib.extendDeepAll; return exports; }; -},{"../../plotly":589,"./micropolar_manager":652,"d3":119}],652:[function(require,module,exports){ +},{"../../plotly":612,"./micropolar_manager":675,"d3":124}],675:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115352,7 +116293,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../plotly":589,"./undo_manager":653,"d3":119}],653:[function(require,module,exports){ +},{"../../plotly":612,"./undo_manager":676,"d3":124}],676:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115418,7 +116359,7 @@ module.exports = function UndoManager() { }; }; -},{}],654:[function(require,module,exports){ +},{}],677:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115493,7 +116434,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":568,"./plots":648}],655:[function(require,module,exports){ +},{"../lib":591,"./plots":671}],678:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115567,7 +116508,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":648,"./layout/attributes":656,"./layout/defaults":659,"./layout/layout_attributes":660,"./ternary":661}],656:[function(require,module,exports){ +},{"../../plots/plots":671,"./layout/attributes":679,"./layout/defaults":682,"./layout/layout_attributes":683,"./ternary":684}],679:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115588,7 +116529,7 @@ module.exports = { } }; -},{}],657:[function(require,module,exports){ +},{}],680:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115647,7 +116588,7 @@ module.exports = { } }; -},{"../../../lib/extend":563,"../../cartesian/layout_attributes":601}],658:[function(require,module,exports){ +},{"../../../lib/extend":586,"../../cartesian/layout_attributes":624}],681:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115731,7 +116672,7 @@ module.exports = function supplyLayoutDefaults(containerIn, containerOut, option } }; -},{"../../../lib":568,"../../cartesian/tick_label_defaults":607,"../../cartesian/tick_mark_defaults":608,"../../cartesian/tick_value_defaults":609,"./axis_attributes":657,"tinycolor2":454}],659:[function(require,module,exports){ +},{"../../../lib":591,"../../cartesian/tick_label_defaults":630,"../../cartesian/tick_mark_defaults":631,"../../cartesian/tick_value_defaults":632,"./axis_attributes":680,"tinycolor2":477}],682:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115794,7 +116735,7 @@ function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, option } } -},{"../../../components/color":483,"../../subplot_defaults":654,"./axis_defaults":658,"./layout_attributes":660}],660:[function(require,module,exports){ +},{"../../../components/color":506,"../../subplot_defaults":677,"./axis_defaults":681,"./layout_attributes":683}],683:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115850,7 +116791,7 @@ module.exports = { caxis: ternaryAxesAttrs }; -},{"../../../components/color/attributes":482,"./axis_attributes":657}],661:[function(require,module,exports){ +},{"../../../components/color/attributes":505,"./axis_attributes":680}],684:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116540,7 +117481,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../components/titles":546,"../../lib":568,"../../lib/extend":563,"../../lib/filter_visible":564,"../../plotly":589,"../cartesian/axes":592,"../cartesian/constants":597,"../cartesian/graph_interact":599,"../cartesian/select":605,"../cartesian/set_convert":606,"d3":119,"tinycolor2":454}],662:[function(require,module,exports){ +},{"../../components/color":506,"../../components/dragelement":527,"../../components/drawing":529,"../../components/titles":569,"../../lib":591,"../../lib/extend":586,"../../lib/filter_visible":587,"../../plotly":612,"../cartesian/axes":615,"../cartesian/constants":620,"../cartesian/graph_interact":622,"../cartesian/select":628,"../cartesian/set_convert":629,"d3":124,"tinycolor2":477}],685:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116696,7 +117637,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../plotly":589}],663:[function(require,module,exports){ +},{"../plotly":612}],686:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116762,7 +117703,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":568,"../plot_api/to_image":587,"./filesaver":664}],664:[function(require,module,exports){ +},{"../lib":591,"../plot_api/to_image":610,"./filesaver":687}],687:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116830,7 +117771,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],665:[function(require,module,exports){ +},{}],688:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116875,7 +117816,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":662,"./download":663,"./svgtoimg":666,"./toimage":667,"./tosvg":668}],666:[function(require,module,exports){ +},{"./cloneplot":685,"./download":686,"./svgtoimg":689,"./toimage":690,"./tosvg":691}],689:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117006,7 +117947,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":568,"events":57}],667:[function(require,module,exports){ +},{"../lib":591,"events":56}],690:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117085,7 +118026,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":568,"../plotly":589,"events":57}],668:[function(require,module,exports){ +},{"../lib":591,"../plotly":612,"events":56}],691:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117197,7 +118138,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":483,"../components/drawing":506,"../constants/xmlns_namespaces":556,"../lib/svg_text_utils":581,"d3":119}],669:[function(require,module,exports){ +},{"../components/color":506,"../components/drawing":529,"../constants/xmlns_namespaces":579,"../lib/svg_text_utils":604,"d3":124}],692:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117225,7 +118166,7 @@ module.exports = function arraysToCalcdata(cd) { mergeArray(markerLine.width, cd, 'mlw'); }; -},{"../../lib":568}],670:[function(require,module,exports){ +},{"../../lib":591}],693:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117293,7 +118234,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../scatter/attributes":750}],671:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../lib/extend":586,"../scatter/attributes":773}],694:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117358,7 +118299,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":490,"../../components/colorscale/has_colorscale":496,"../../plots/cartesian/axes":592,"fast-isnumeric":123}],672:[function(require,module,exports){ +},{"../../components/colorscale/calc":513,"../../components/colorscale/has_colorscale":519,"../../plots/cartesian/axes":615,"fast-isnumeric":128}],695:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117400,7 +118341,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":483,"../../components/errorbars/defaults":511,"../../lib":568,"../bar/style_defaults":680,"../scatter/xy_defaults":771,"./attributes":670}],673:[function(require,module,exports){ +},{"../../components/color":506,"../../components/errorbars/defaults":534,"../../lib":591,"../bar/style_defaults":703,"../scatter/xy_defaults":794,"./attributes":693}],696:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117491,7 +118432,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":483,"../../components/errorbars":512,"../../plots/cartesian/graph_interact":599}],674:[function(require,module,exports){ +},{"../../components/color":506,"../../components/errorbars":535,"../../plots/cartesian/graph_interact":622}],697:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117527,7 +118468,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":600,"../scatter/colorbar":753,"./arrays_to_calcdata":669,"./attributes":670,"./calc":671,"./defaults":672,"./hover":673,"./layout_attributes":675,"./layout_defaults":676,"./plot":677,"./set_positions":678,"./style":679}],675:[function(require,module,exports){ +},{"../../plots/cartesian":623,"../scatter/colorbar":776,"./arrays_to_calcdata":692,"./attributes":693,"./calc":694,"./defaults":695,"./hover":696,"./layout_attributes":698,"./layout_defaults":699,"./plot":700,"./set_positions":701,"./style":702}],698:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117571,7 +118512,7 @@ module.exports = { } }; -},{}],676:[function(require,module,exports){ +},{}],699:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117629,7 +118570,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648,"./layout_attributes":675}],677:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/plots":671,"./layout_attributes":698}],700:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117741,7 +118682,7 @@ module.exports = function plot(gd, plotinfo, cdbar) { }; -},{"../../components/color":483,"../../components/errorbars":512,"../../lib":568,"./arrays_to_calcdata":669,"d3":119,"fast-isnumeric":123}],678:[function(require,module,exports){ +},{"../../components/color":506,"../../components/errorbars":535,"../../lib":591,"./arrays_to_calcdata":692,"d3":124,"fast-isnumeric":128}],701:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117972,7 +118913,7 @@ module.exports = function setPositions(gd, plotinfo) { }); }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648,"fast-isnumeric":123}],679:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/plots":671,"fast-isnumeric":128}],702:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118051,7 +118992,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/color":483,"../../components/drawing":506,"../../components/errorbars":512,"d3":119}],680:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"../../components/errorbars":535,"d3":124}],703:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118088,7 +119029,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":483,"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496}],681:[function(require,module,exports){ +},{"../../components/color":506,"../../components/colorscale/defaults":516,"../../components/colorscale/has_colorscale":519}],704:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118219,7 +119160,7 @@ module.exports = { fillcolor: scatterAttrs.fillcolor }; -},{"../../components/color/attributes":482,"../../lib/extend":563,"../scatter/attributes":750}],682:[function(require,module,exports){ +},{"../../components/color/attributes":505,"../../lib/extend":586,"../scatter/attributes":773}],705:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118368,7 +119309,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"fast-isnumeric":123}],683:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"fast-isnumeric":128}],706:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118437,7 +119378,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { } }; -},{"../../components/color":483,"../../lib":568,"./attributes":681}],684:[function(require,module,exports){ +},{"../../components/color":506,"../../lib":591,"./attributes":704}],707:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118546,7 +119487,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return closeData; }; -},{"../../components/color":483,"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599}],685:[function(require,module,exports){ +},{"../../components/color":506,"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622}],708:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118579,7 +119520,7 @@ Box.meta = { module.exports = Box; -},{"../../plots/cartesian":600,"./attributes":681,"./calc":682,"./defaults":683,"./hover":684,"./layout_attributes":686,"./layout_defaults":687,"./plot":688,"./set_positions":689,"./style":690}],686:[function(require,module,exports){ +},{"../../plots/cartesian":623,"./attributes":704,"./calc":705,"./defaults":706,"./hover":707,"./layout_attributes":709,"./layout_defaults":710,"./plot":711,"./set_positions":712,"./style":713}],709:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118617,7 +119558,7 @@ module.exports = { } }; -},{}],687:[function(require,module,exports){ +},{}],710:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118651,7 +119592,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { coerce('boxgroupgap'); }; -},{"../../lib":568,"../../plots/plots":648,"./layout_attributes":686}],688:[function(require,module,exports){ +},{"../../lib":591,"../../plots/plots":671,"./layout_attributes":709}],711:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118878,7 +119819,7 @@ module.exports = function plot(gd, plotinfo, cdbox) { }); }; -},{"../../components/drawing":506,"../../lib":568,"d3":119}],689:[function(require,module,exports){ +},{"../../components/drawing":529,"../../lib":591,"d3":124}],712:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118971,7 +119912,7 @@ module.exports = function setPositions(gd, plotinfo) { } }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648}],690:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/plots":671}],713:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119010,7 +119951,7 @@ module.exports = function style(gd) { }); }; -},{"../../components/color":483,"../../components/drawing":506,"d3":119}],691:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"d3":124}],714:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119058,7 +119999,7 @@ module.exports = extendFlat({}, { colorscaleAttrs ); -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../../plots/attributes":590,"../scattergeo/attributes":778}],692:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../../plots/attributes":613,"../scattergeo/attributes":801}],715:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119077,7 +120018,7 @@ module.exports = function calc(gd, trace) { colorscaleCalc(trace, trace.z, '', 'z'); }; -},{"../../components/colorscale/calc":490}],693:[function(require,module,exports){ +},{"../../components/colorscale/calc":513}],716:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119132,7 +120073,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hoverinfo', (layout._dataLength === 1) ? 'location+z+text' : undefined); }; -},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":691}],694:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":714}],717:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119162,7 +120103,7 @@ Choropleth.meta = { module.exports = Choropleth; -},{"../../plots/geo":613,"../heatmap/colorbar":708,"./attributes":691,"./calc":692,"./defaults":693,"./plot":695}],695:[function(require,module,exports){ +},{"../../plots/geo":636,"../heatmap/colorbar":731,"./attributes":714,"./calc":715,"./defaults":716,"./plot":718}],718:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119383,7 +120324,7 @@ function makeEventDataFunc(trace) { }; } -},{"../../components/color":483,"../../components/colorscale/get_scale":495,"../../components/colorscale/make_scale_function":500,"../../components/drawing":506,"../../lib/array_to_calc_item":559,"../../lib/geo_location_utils":565,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../../plots/geo/constants":611,"./attributes":691,"d3":119}],696:[function(require,module,exports){ +},{"../../components/color":506,"../../components/colorscale/get_scale":518,"../../components/colorscale/make_scale_function":523,"../../components/drawing":529,"../../lib/array_to_calc_item":582,"../../lib/geo_location_utils":588,"../../lib/topojson_utils":605,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622,"../../plots/geo/constants":634,"./attributes":714,"d3":124}],719:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119483,7 +120424,7 @@ module.exports = extendFlat({}, {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} ); -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../heatmap/attributes":706,"../scatter/attributes":750}],697:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../heatmap/attributes":729,"../scatter/attributes":773}],720:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119536,7 +120477,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":592,"../heatmap/calc":707}],698:[function(require,module,exports){ +},{"../../plots/cartesian/axes":615,"../heatmap/calc":730}],721:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119597,7 +120538,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":486,"../../plots/plots":648,"./make_color_map":702}],699:[function(require,module,exports){ +},{"../../components/colorbar/draw":509,"../../plots/plots":671,"./make_color_map":725}],722:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119641,7 +120582,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":568,"../contour/style_defaults":705,"../heatmap/has_columns":711,"../heatmap/xyz_defaults":717,"./attributes":696}],700:[function(require,module,exports){ +},{"../../lib":591,"../contour/style_defaults":728,"../heatmap/has_columns":734,"../heatmap/xyz_defaults":740,"./attributes":719}],723:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119660,7 +120601,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return heatmapHoverPoints(pointData, xval, yval, hovermode, true); }; -},{"../heatmap/hover":712}],701:[function(require,module,exports){ +},{"../heatmap/hover":735}],724:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119692,7 +120633,7 @@ Contour.meta = { module.exports = Contour; -},{"../../plots/cartesian":600,"./attributes":696,"./calc":697,"./colorbar":698,"./defaults":699,"./hover":700,"./plot":703,"./style":704}],702:[function(require,module,exports){ +},{"../../plots/cartesian":623,"./attributes":719,"./calc":720,"./colorbar":721,"./defaults":722,"./hover":723,"./plot":726,"./style":727}],725:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119772,7 +120713,7 @@ module.exports = function makeColorMap(trace) { return colorMap; }; -},{"../../components/colorscale/get_scale":495,"d3":119}],703:[function(require,module,exports){ +},{"../../components/colorscale/get_scale":518,"d3":124}],726:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120482,7 +121423,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/drawing":506,"../../lib":568,"../heatmap/plot":715,"d3":119}],704:[function(require,module,exports){ +},{"../../components/drawing":529,"../../lib":591,"../heatmap/plot":738,"d3":124}],727:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120539,7 +121480,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":506,"../heatmap/style":716,"./make_color_map":702,"d3":119}],705:[function(require,module,exports){ +},{"../../components/drawing":529,"../heatmap/style":739,"./make_color_map":725,"d3":124}],728:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120575,7 +121516,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout) } }; -},{"../../components/colorscale/defaults":493}],706:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516}],729:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120647,7 +121588,7 @@ module.exports = extendFlat({}, {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} ); -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../scatter/attributes":750}],707:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../scatter/attributes":773}],730:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120679,6 +121620,7 @@ module.exports = function calc(gd, trace) { ya = Axes.getFromId(gd, trace.yaxis || 'y'), isContour = Plots.traceIs(trace, 'contour'), isHist = Plots.traceIs(trace, 'histogram'), + isGL2D = Plots.traceIs(trace, 'gl2d'), zsmooth = isContour ? 'best' : trace.zsmooth, x, x0, @@ -120762,8 +121704,11 @@ module.exports = function calc(gd, trace) { yIn = trace.ytype === 'scaled' ? '' : trace.y, yArray = makeBoundArray(trace, yIn, y0, dy, z.length, ya); - Axes.expand(xa, xArray); - Axes.expand(ya, yArray); + // handled in gl2d convert step + if(!isGL2D) { + Axes.expand(xa, xArray); + Axes.expand(ya, yArray); + } var cd0 = {x: xArray, y: yArray, z: z}; @@ -121093,7 +122038,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../components/colorscale/calc":490,"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648,"../histogram2d/calc":727,"./convert_column_xyz":709,"./has_columns":711,"./max_row_length":714,"fast-isnumeric":123}],708:[function(require,module,exports){ +},{"../../components/colorscale/calc":513,"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/plots":671,"../histogram2d/calc":750,"./convert_column_xyz":732,"./has_columns":734,"./max_row_length":737,"fast-isnumeric":128}],731:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121139,7 +122084,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,"d3":119,"fast-isnumeric":123}],709:[function(require,module,exports){ +},{"../../components/colorbar/draw":509,"../../components/colorscale/get_scale":518,"../../lib":591,"../../plots/plots":671,"d3":124,"fast-isnumeric":128}],732:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121196,7 +122141,7 @@ module.exports = function convertColumnXYZ(trace, xa, ya) { if(hasColumnText) trace.text = text; }; -},{"../../lib":568}],710:[function(require,module,exports){ +},{"../../lib":591}],733:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121234,7 +122179,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":706,"./has_columns":711,"./xyz_defaults":717}],711:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":729,"./has_columns":734,"./xyz_defaults":740}],734:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121250,7 +122195,7 @@ module.exports = function(trace) { return !Array.isArray(trace.z[0]); }; -},{}],712:[function(require,module,exports){ +},{}],735:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121368,7 +122313,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour) })]; }; -},{"../../lib":568,"../../plots/cartesian/constants":597,"../../plots/cartesian/graph_interact":599}],713:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/constants":620,"../../plots/cartesian/graph_interact":622}],736:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121400,7 +122345,7 @@ Heatmap.meta = { module.exports = Heatmap; -},{"../../plots/cartesian":600,"./attributes":706,"./calc":707,"./colorbar":708,"./defaults":710,"./hover":712,"./plot":715,"./style":716}],714:[function(require,module,exports){ +},{"../../plots/cartesian":623,"./attributes":729,"./calc":730,"./colorbar":731,"./defaults":733,"./hover":735,"./plot":738,"./style":739}],737:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121422,7 +122367,7 @@ module.exports = function maxRowLength(z) { return len; }; -},{}],715:[function(require,module,exports){ +},{}],738:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121821,7 +122766,7 @@ function plotOne(gd, plotinfo, cd) { image3.exit().remove(); } -},{"../../components/colorscale/get_scale":495,"../../constants/xmlns_namespaces":556,"../../lib":568,"../../plots/plots":648,"./max_row_length":714,"d3":119,"tinycolor2":454}],716:[function(require,module,exports){ +},{"../../components/colorscale/get_scale":518,"../../constants/xmlns_namespaces":579,"../../lib":591,"../../plots/plots":671,"./max_row_length":737,"d3":124,"tinycolor2":477}],739:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121842,7 +122787,7 @@ module.exports = function style(gd) { }); }; -},{"d3":119}],717:[function(require,module,exports){ +},{"d3":124}],740:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121931,7 +122876,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"./has_columns":711,"fast-isnumeric":123}],718:[function(require,module,exports){ +},{"./has_columns":734,"fast-isnumeric":128}],741:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122039,7 +122984,7 @@ function makeBinsAttr(axLetter) { }; } -},{"../bar/attributes":670}],719:[function(require,module,exports){ +},{"../bar/attributes":693}],742:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122065,7 +123010,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],720:[function(require,module,exports){ +},{}],743:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122095,7 +123040,7 @@ module.exports = function handleBinDefaults(traceIn, traceOut, coerce, binDirect return traceOut; }; -},{}],721:[function(require,module,exports){ +},{}],744:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122169,7 +123114,7 @@ module.exports = { } }; -},{"fast-isnumeric":123}],722:[function(require,module,exports){ +},{"fast-isnumeric":128}],745:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122299,7 +123244,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"./average":719,"./bin_functions":721,"./norm_functions":725,"fast-isnumeric":123}],723:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"./average":742,"./bin_functions":744,"./norm_functions":748,"fast-isnumeric":128}],746:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122351,7 +123296,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":483,"../../components/errorbars/defaults":511,"../../lib":568,"../bar/style_defaults":680,"./attributes":718,"./bin_defaults":720}],724:[function(require,module,exports){ +},{"../../components/color":506,"../../components/errorbars/defaults":534,"../../lib":591,"../bar/style_defaults":703,"./attributes":741,"./bin_defaults":743}],747:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122400,7 +123345,7 @@ Histogram.meta = { module.exports = Histogram; -},{"../../plots/cartesian":600,"../bar/hover":673,"../bar/layout_attributes":675,"../bar/layout_defaults":676,"../bar/plot":677,"../bar/set_positions":678,"../bar/style":679,"../scatter/colorbar":753,"./attributes":718,"./calc":722,"./defaults":723}],725:[function(require,module,exports){ +},{"../../plots/cartesian":623,"../bar/hover":696,"../bar/layout_attributes":698,"../bar/layout_defaults":699,"../bar/plot":700,"../bar/set_positions":701,"../bar/style":702,"../scatter/colorbar":776,"./attributes":741,"./calc":745,"./defaults":746}],748:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122435,7 +123380,7 @@ module.exports = { } }; -},{}],726:[function(require,module,exports){ +},{}],749:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122487,7 +123432,7 @@ module.exports = extendFlat({}, {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} ); -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../heatmap/attributes":706,"../histogram/attributes":718}],727:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../heatmap/attributes":729,"../histogram/attributes":741}],750:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122653,7 +123598,7 @@ module.exports = function calc(gd, trace) { }; }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"../histogram/average":719,"../histogram/bin_functions":721,"../histogram/norm_functions":725}],728:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"../histogram/average":742,"../histogram/bin_functions":744,"../histogram/norm_functions":748}],751:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122686,7 +123631,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, layout) { ); }; -},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":726,"./sample_defaults":730}],729:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":749,"./sample_defaults":753}],752:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122719,7 +123664,7 @@ Histogram2D.meta = { module.exports = Histogram2D; -},{"../../plots/cartesian":600,"../heatmap/calc":707,"../heatmap/colorbar":708,"../heatmap/hover":712,"../heatmap/plot":715,"../heatmap/style":716,"./attributes":726,"./defaults":728}],730:[function(require,module,exports){ +},{"../../plots/cartesian":623,"../heatmap/calc":730,"../heatmap/colorbar":731,"../heatmap/hover":735,"../heatmap/plot":738,"../heatmap/style":739,"./attributes":749,"./defaults":751}],753:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122755,7 +123700,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce) { handleBinDefaults(traceIn, traceOut, coerce, binDirections); }; -},{"../histogram/bin_defaults":720}],731:[function(require,module,exports){ +},{"../histogram/bin_defaults":743}],754:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122799,7 +123744,7 @@ module.exports = extendFlat({}, { colorscaleAttrs ); -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../contour/attributes":696,"../histogram2d/attributes":726}],732:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../contour/attributes":719,"../histogram2d/attributes":749}],755:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122835,7 +123780,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":568,"../contour/style_defaults":705,"../histogram2d/sample_defaults":730,"./attributes":731}],733:[function(require,module,exports){ +},{"../../lib":591,"../contour/style_defaults":728,"../histogram2d/sample_defaults":753,"./attributes":754}],756:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122868,7 +123813,7 @@ Histogram2dContour.meta = { module.exports = Histogram2dContour; -},{"../../plots/cartesian":600,"../contour/calc":697,"../contour/colorbar":698,"../contour/hover":700,"../contour/plot":703,"../contour/style":704,"./attributes":731,"./defaults":732}],734:[function(require,module,exports){ +},{"../../plots/cartesian":623,"../contour/calc":720,"../contour/colorbar":721,"../contour/hover":723,"../contour/plot":726,"../contour/style":727,"./attributes":754,"./defaults":755}],757:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123002,7 +123947,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../surface/attributes":802}],735:[function(require,module,exports){ +},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../surface/attributes":825}],758:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123164,7 +124109,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../lib/str2rgbarray":580,"alpha-shape":41,"convex-hull":108,"delaunay-triangulate":120,"gl-mesh3d":156,"tinycolor2":454}],736:[function(require,module,exports){ +},{"../../lib/str2rgbarray":603,"alpha-shape":41,"convex-hull":113,"delaunay-triangulate":125,"gl-mesh3d":161,"tinycolor2":477}],759:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123261,7 +124206,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/colorbar/defaults":485,"../../lib":568,"./attributes":734}],737:[function(require,module,exports){ +},{"../../components/colorbar/defaults":508,"../../lib":591,"./attributes":757}],760:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123290,7 +124235,7 @@ Mesh3D.meta = { module.exports = Mesh3D; -},{"../../plots/gl3d":628,"../heatmap/colorbar":708,"./attributes":734,"./convert":735,"./defaults":736}],738:[function(require,module,exports){ +},{"../../plots/gl3d":651,"../heatmap/colorbar":731,"./attributes":757,"./convert":758,"./defaults":759}],761:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123510,7 +124455,7 @@ module.exports = { } }; -},{"../../components/color/attributes":482,"../../lib/extend":563,"../../plots/attributes":590,"../../plots/font_attributes":610}],739:[function(require,module,exports){ +},{"../../components/color/attributes":505,"../../lib/extend":586,"../../plots/attributes":613,"../../plots/font_attributes":633}],762:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123557,7 +124502,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../plots/plots":648}],740:[function(require,module,exports){ +},{"../../plots/plots":671}],763:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123709,7 +124654,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":483,"./helpers":742,"fast-isnumeric":123,"tinycolor2":454}],741:[function(require,module,exports){ +},{"../../components/color":506,"./helpers":765,"fast-isnumeric":128,"tinycolor2":477}],764:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123793,7 +124738,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":568,"./attributes":738}],742:[function(require,module,exports){ +},{"../../lib":591,"./attributes":761}],765:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123822,7 +124767,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":568}],743:[function(require,module,exports){ +},{"../../lib":591}],766:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123854,7 +124799,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":738,"./base_plot":739,"./calc":740,"./defaults":741,"./layout_attributes":744,"./layout_defaults":745,"./plot":746,"./style":747,"./style_one":748}],744:[function(require,module,exports){ +},{"./attributes":761,"./base_plot":762,"./calc":763,"./defaults":764,"./layout_attributes":767,"./layout_defaults":768,"./plot":769,"./style":770,"./style_one":771}],767:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123874,7 +124819,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],745:[function(require,module,exports){ +},{}],768:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123896,7 +124841,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":568,"./layout_attributes":744}],746:[function(require,module,exports){ +},{"../../lib":591,"./layout_attributes":767}],769:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124591,7 +125536,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":483,"../../components/drawing":506,"../../lib/svg_text_utils":581,"../../plots/cartesian/graph_interact":599,"./helpers":742,"d3":119}],747:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"../../lib/svg_text_utils":604,"../../plots/cartesian/graph_interact":622,"./helpers":765,"d3":124}],770:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124620,7 +125565,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":748,"d3":119}],748:[function(require,module,exports){ +},{"./style_one":771,"d3":124}],771:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124647,7 +125592,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":483}],749:[function(require,module,exports){ +},{"../../components/color":506}],772:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124685,7 +125630,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":568}],750:[function(require,module,exports){ +},{"../../lib":591}],773:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124935,7 +125880,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../components/drawing":506,"../../lib/extend":563,"./constants":755}],751:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../components/drawing":529,"../../lib/extend":586,"./constants":778}],774:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125062,7 +126007,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"./colorscale_calc":754,"./subtypes":769,"fast-isnumeric":123}],752:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"./colorscale_calc":777,"./subtypes":792,"fast-isnumeric":128}],775:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125103,7 +126048,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],753:[function(require,module,exports){ +},{}],776:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125156,7 +126101,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,"d3":119,"fast-isnumeric":123}],754:[function(require,module,exports){ +},{"../../components/colorbar/draw":509,"../../components/colorscale/get_scale":518,"../../lib":591,"../../plots/plots":671,"d3":124,"fast-isnumeric":128}],777:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125189,7 +126134,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":490,"../../components/colorscale/has_colorscale":496,"./subtypes":769}],755:[function(require,module,exports){ +},{"../../components/colorscale/calc":513,"../../components/colorscale/has_colorscale":519,"./subtypes":792}],778:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125205,7 +126150,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],756:[function(require,module,exports){ +},{}],779:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125283,7 +126228,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":511,"../../lib":568,"./attributes":750,"./constants":755,"./fillcolor_defaults":757,"./line_defaults":761,"./line_shape_defaults":763,"./marker_defaults":765,"./subtypes":769,"./text_defaults":770,"./xy_defaults":771}],757:[function(require,module,exports){ +},{"../../components/errorbars/defaults":534,"../../lib":591,"./attributes":773,"./constants":778,"./fillcolor_defaults":780,"./line_defaults":784,"./line_shape_defaults":786,"./marker_defaults":788,"./subtypes":792,"./text_defaults":793,"./xy_defaults":794}],780:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125322,7 +126267,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":483}],758:[function(require,module,exports){ +},{"../../components/color":506}],781:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125375,7 +126320,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":483,"./subtypes":769}],759:[function(require,module,exports){ +},{"../../components/color":506,"./subtypes":792}],782:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125544,7 +126489,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":483,"../../components/errorbars":512,"../../lib":568,"../../plots/cartesian/constants":597,"../../plots/cartesian/graph_interact":599,"./get_trace_color":758}],760:[function(require,module,exports){ +},{"../../components/color":506,"../../components/errorbars":535,"../../lib":591,"../../plots/cartesian/constants":620,"../../plots/cartesian/graph_interact":622,"./get_trace_color":781}],783:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125587,7 +126532,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":600,"./arrays_to_calcdata":749,"./attributes":750,"./calc":751,"./clean_data":752,"./colorbar":753,"./defaults":756,"./hover":759,"./plot":766,"./select":767,"./style":768,"./subtypes":769}],761:[function(require,module,exports){ +},{"../../plots/cartesian":623,"./arrays_to_calcdata":772,"./attributes":773,"./calc":774,"./clean_data":775,"./colorbar":776,"./defaults":779,"./hover":782,"./plot":789,"./select":790,"./style":791,"./subtypes":792}],784:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125620,7 +126565,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496}],762:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516,"../../components/colorscale/has_colorscale":519}],785:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125789,7 +126734,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":592}],763:[function(require,module,exports){ +},{"../../plots/cartesian/axes":615}],786:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125808,7 +126753,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],764:[function(require,module,exports){ +},{}],787:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125850,7 +126795,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":123}],765:[function(require,module,exports){ +},{"fast-isnumeric":128}],788:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125910,7 +126855,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":483,"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496,"./subtypes":769}],766:[function(require,module,exports){ +},{"../../components/color":506,"../../components/colorscale/defaults":516,"../../components/colorscale/has_colorscale":519,"./subtypes":792}],789:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126203,7 +127148,7 @@ function selectMarkers(gd, plotinfo, cdscatter) { }); } -},{"../../components/drawing":506,"../../components/errorbars":512,"../../lib":568,"../../lib/polygon":574,"./arrays_to_calcdata":749,"./line_points":762,"./subtypes":769,"d3":119}],767:[function(require,module,exports){ +},{"../../components/drawing":529,"../../components/errorbars":535,"../../lib":591,"../../lib/polygon":597,"./arrays_to_calcdata":772,"./line_points":785,"./subtypes":792,"d3":124}],790:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126274,7 +127219,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":769}],768:[function(require,module,exports){ +},{"./subtypes":792}],791:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126316,7 +127261,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":506,"../../components/errorbars":512,"d3":119}],769:[function(require,module,exports){ +},{"../../components/drawing":529,"../../components/errorbars":535,"d3":124}],792:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126352,7 +127297,7 @@ module.exports = { } }; -},{"../../lib":568}],770:[function(require,module,exports){ +},{"../../lib":591}],793:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126373,7 +127318,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":568}],771:[function(require,module,exports){ +},{"../../lib":591}],794:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126418,7 +127363,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return len; }; -},{}],772:[function(require,module,exports){ +},{}],795:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126549,7 +127494,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../constants/gl_markers":554,"../../lib/extend":563,"../scatter/attributes":750}],773:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../constants/gl_markers":577,"../../lib/extend":586,"../scatter/attributes":773}],796:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126578,7 +127523,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":749,"../scatter/colorscale_calc":754}],774:[function(require,module,exports){ +},{"../scatter/arrays_to_calcdata":772,"../scatter/colorscale_calc":777}],797:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126649,7 +127594,7 @@ function calculateErrors(data, scaleFactor) { module.exports = calculateErrors; -},{"../../components/errorbars/compute_error":510}],775:[function(require,module,exports){ +},{"../../components/errorbars/compute_error":533}],798:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127108,7 +128053,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../constants/gl3d_dashes":553,"../../constants/gl_markers":554,"../../lib":568,"../../lib/gl_format_color":566,"../../lib/str2rgbarray":580,"../scatter/make_bubble_size_func":764,"./calc_errors":774,"delaunay-triangulate":120,"gl-error3d":127,"gl-line3d":133,"gl-mesh3d":156,"gl-scatter3d":199}],776:[function(require,module,exports){ +},{"../../constants/gl3d_dashes":576,"../../constants/gl_markers":577,"../../lib":591,"../../lib/gl_format_color":589,"../../lib/str2rgbarray":603,"../scatter/make_bubble_size_func":787,"./calc_errors":797,"delaunay-triangulate":125,"gl-error3d":132,"gl-line3d":138,"gl-mesh3d":161,"gl-scatter3d":204}],799:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127193,7 +128138,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../components/errorbars/defaults":511,"../../lib":568,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":772}],777:[function(require,module,exports){ +},{"../../components/errorbars/defaults":534,"../../lib":591,"../scatter/line_defaults":784,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/text_defaults":793,"./attributes":795}],800:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127224,7 +128169,7 @@ Scatter3D.meta = { module.exports = Scatter3D; -},{"../../constants/gl_markers":554,"../../plots/gl3d":628,"../scatter/colorbar":753,"./attributes":772,"./calc":773,"./convert":775,"./defaults":776}],778:[function(require,module,exports){ +},{"../../constants/gl_markers":577,"../../plots/gl3d":651,"../scatter/colorbar":776,"./attributes":795,"./calc":796,"./convert":798,"./defaults":799}],801:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127299,7 +128244,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../../plots/attributes":590,"../scatter/attributes":750}],779:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../lib/extend":586,"../../plots/attributes":613,"../scatter/attributes":773}],802:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127322,7 +128267,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/colorscale_calc":754}],780:[function(require,module,exports){ +},{"../scatter/colorscale_calc":777}],803:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127395,7 +128340,7 @@ function handleLonLatLocDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":568,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":778}],781:[function(require,module,exports){ +},{"../../lib":591,"../scatter/line_defaults":784,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/text_defaults":793,"./attributes":801}],804:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127426,7 +128371,7 @@ ScatterGeo.meta = { module.exports = ScatterGeo; -},{"../../plots/geo":613,"../scatter/colorbar":753,"./attributes":778,"./calc":779,"./defaults":780,"./plot":782}],782:[function(require,module,exports){ +},{"../../plots/geo":636,"../scatter/colorbar":776,"./attributes":801,"./calc":802,"./defaults":803,"./plot":805}],805:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127726,7 +128671,7 @@ function makeEventDataFunc(trace) { }; } -},{"../../components/color":483,"../../components/drawing":506,"../../lib/array_to_calc_item":559,"../../lib/geo_location_utils":565,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../scatter/subtypes":769,"./attributes":778,"d3":119}],783:[function(require,module,exports){ +},{"../../components/color":506,"../../components/drawing":529,"../../lib/array_to_calc_item":582,"../../lib/geo_location_utils":588,"../../lib/topojson_utils":605,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622,"../scatter/subtypes":792,"./attributes":801,"d3":124}],806:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127808,7 +128753,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../constants/gl2d_dashes":552,"../../constants/gl_markers":554,"../../lib/extend":563,"../scatter/attributes":750}],784:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../constants/gl2d_dashes":575,"../../constants/gl_markers":577,"../../lib/extend":586,"../scatter/attributes":773}],807:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127843,6 +128788,7 @@ var AXES = ['xaxis', 'yaxis']; function LineWithMarkers(scene, uid) { this.scene = scene; this.uid = uid; + this.type = 'scattergl'; this.pickXData = []; this.pickYData = []; @@ -128400,7 +129346,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../components/errorbars":512,"../../constants/gl2d_dashes":552,"../../constants/gl_markers":554,"../../lib":568,"../../lib/gl_format_color":566,"../../lib/str2rgbarray":580,"../../plots/cartesian/axes":592,"../scatter/get_trace_color":758,"../scatter/make_bubble_size_func":764,"../scatter/subtypes":769,"fast-isnumeric":123,"gl-error2d":125,"gl-line2d":131,"gl-scatter2d":196,"gl-scatter2d-fancy":191}],785:[function(require,module,exports){ +},{"../../components/errorbars":535,"../../constants/gl2d_dashes":575,"../../constants/gl_markers":577,"../../lib":591,"../../lib/gl_format_color":589,"../../lib/str2rgbarray":603,"../../plots/cartesian/axes":615,"../scatter/get_trace_color":781,"../scatter/make_bubble_size_func":787,"../scatter/subtypes":792,"fast-isnumeric":128,"gl-error2d":130,"gl-line2d":136,"gl-scatter2d":201,"gl-scatter2d-fancy":196}],808:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128457,7 +129403,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":511,"../../lib":568,"../scatter/constants":755,"../scatter/fillcolor_defaults":757,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/xy_defaults":771,"./attributes":783}],786:[function(require,module,exports){ +},{"../../components/errorbars/defaults":534,"../../lib":591,"../scatter/constants":778,"../scatter/fillcolor_defaults":780,"../scatter/line_defaults":784,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/xy_defaults":794,"./attributes":806}],809:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128488,7 +129434,7 @@ ScatterGl.meta = { module.exports = ScatterGl; -},{"../../plots/gl2d":625,"../scatter/colorbar":753,"../scatter3d/calc":773,"./attributes":783,"./convert":784,"./defaults":785}],787:[function(require,module,exports){ +},{"../../plots/gl2d":648,"../scatter/colorbar":776,"../scatter3d/calc":796,"./attributes":806,"./convert":807,"./defaults":808}],810:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128587,7 +129533,7 @@ module.exports = { } }; -},{"../../lib/extend":563,"../../plots/attributes":590,"../../plots/mapbox/layout_attributes":645,"../scatter/attributes":750,"../scattergeo/attributes":778}],788:[function(require,module,exports){ +},{"../../lib/extend":586,"../../plots/attributes":613,"../../plots/mapbox/layout_attributes":668,"../scatter/attributes":773,"../scattergeo/attributes":801}],811:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128684,7 +129630,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale/has_colorscale":496,"../../components/colorscale/make_scale_function":500,"../../lib":568,"../scatter/colorscale_calc":754,"../scatter/make_bubble_size_func":764,"../scatter/subtypes":769,"fast-isnumeric":123}],789:[function(require,module,exports){ +},{"../../components/colorscale/has_colorscale":519,"../../components/colorscale/make_scale_function":523,"../../lib":591,"../scatter/colorscale_calc":777,"../scatter/make_bubble_size_func":787,"../scatter/subtypes":792,"fast-isnumeric":128}],812:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128834,9 +129780,21 @@ function makeBlankGeoJSON() { } function makeFillGeoJSON(_, coords) { + if(coords.length === 1) { + return { + type: 'Polygon', + coordinates: coords + }; + } + + var _coords = new Array(coords.length); + for(var i = 0; i < coords.length; i++) { + _coords[i] = [coords[i]]; + } + return { - type: 'Polygon', - coordinates: coords + type: 'MultiPolygon', + coordinates: _coords }; } @@ -129035,7 +129993,7 @@ function getFillFunc(attr) { function blankFillFunc() { return ''; } -},{"../../lib":568,"../../plots/mapbox/convert_text_opts":642,"../scatter/subtypes":769}],790:[function(require,module,exports){ +},{"../../lib":591,"../../plots/mapbox/convert_text_opts":665,"../scatter/subtypes":792}],813:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129123,7 +130081,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":568,"../scatter/attributes":750,"../scatter/fillcolor_defaults":757,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":787}],791:[function(require,module,exports){ +},{"../../lib":591,"../scatter/attributes":773,"../scatter/fillcolor_defaults":780,"../scatter/line_defaults":784,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/text_defaults":793,"./attributes":810}],814:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129216,7 +130174,7 @@ function getExtraText(trace, di) { return text.join('
'); } -},{"../../plots/cartesian/graph_interact":599,"../scatter/get_trace_color":758}],792:[function(require,module,exports){ +},{"../../plots/cartesian/graph_interact":622,"../scatter/get_trace_color":781}],815:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129248,7 +130206,7 @@ ScatterMapbox.meta = { module.exports = ScatterMapbox; -},{"../../plots/mapbox":643,"../scatter/colorbar":753,"./attributes":787,"./calc":788,"./defaults":790,"./hover":791,"./plot":793}],793:[function(require,module,exports){ +},{"../../plots/mapbox":666,"../scatter/colorbar":776,"./attributes":810,"./calc":811,"./defaults":813,"./hover":814,"./plot":816}],816:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129279,17 +130237,10 @@ function ScatterMapbox(mapbox, uid) { this.idLayerCircle = uid + '-layer-circle'; this.idLayerSymbol = uid + '-layer-symbol'; - this.sourceFill = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceFill, this.sourceFill); - - this.sourceLine = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceLine, this.sourceLine); - - this.sourceCircle = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceCircle, this.sourceCircle); - - this.sourceSymbol = mapbox.createGeoJSONSource(); - this.map.addSource(this.idSourceSymbol, this.sourceSymbol); + this.mapbox.initSource(this.idSourceFill); + this.mapbox.initSource(this.idSourceLine); + this.mapbox.initSource(this.idSourceCircle); + this.mapbox.initSource(this.idSourceSymbol); this.map.addLayer({ id: this.idLayerFill, @@ -129324,7 +130275,6 @@ var proto = ScatterMapbox.prototype; proto.update = function update(calcTrace) { var mapbox = this.mapbox; - var opts = convert(calcTrace); mapbox.setOptions(this.idLayerFill, 'setLayoutProperty', opts.fill.layout); @@ -129333,22 +130283,22 @@ proto.update = function update(calcTrace) { mapbox.setOptions(this.idLayerSymbol, 'setLayoutProperty', opts.symbol.layout); if(isVisible(opts.fill)) { - this.sourceFill.setData(opts.fill.geojson); + mapbox.setSourceData(this.idSourceFill, opts.fill.geojson); mapbox.setOptions(this.idLayerFill, 'setPaintProperty', opts.fill.paint); } if(isVisible(opts.line)) { - this.sourceLine.setData(opts.line.geojson); + mapbox.setSourceData(this.idSourceLine, opts.line.geojson); mapbox.setOptions(this.idLayerLine, 'setPaintProperty', opts.line.paint); } if(isVisible(opts.circle)) { - this.sourceCircle.setData(opts.circle.geojson); + mapbox.setSourceData(this.idSourceCircle, opts.circle.geojson); mapbox.setOptions(this.idLayerCircle, 'setPaintProperty', opts.circle.paint); } if(isVisible(opts.symbol)) { - this.sourceSymbol.setData(opts.symbol.geojson); + mapbox.setSourceData(this.idSourceSymbol, opts.symbol.geojson); mapbox.setOptions(this.idLayerSymbol, 'setPaintProperty', opts.symbol.paint); } }; @@ -129380,7 +130330,7 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { return scatterMapbox; }; -},{"./convert":789}],794:[function(require,module,exports){ +},{"./convert":812}],817:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129466,7 +130416,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../../plots/attributes":590,"../scatter/attributes":750}],795:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":514,"../../lib/extend":586,"../../plots/attributes":613,"../scatter/attributes":773}],818:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129565,7 +130515,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":568,"../../plots/cartesian/axes":592,"../scatter/colorscale_calc":754,"../scatter/subtypes":769,"fast-isnumeric":123}],796:[function(require,module,exports){ +},{"../../lib":591,"../../plots/cartesian/axes":615,"../scatter/colorscale_calc":777,"../scatter/subtypes":792,"fast-isnumeric":128}],819:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129670,7 +130620,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hoveron', dfltHoverOn.join('+') || 'points'); }; -},{"../../lib":568,"../scatter/constants":755,"../scatter/fillcolor_defaults":757,"../scatter/line_defaults":761,"../scatter/line_shape_defaults":763,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":794}],797:[function(require,module,exports){ +},{"../../lib":591,"../scatter/constants":778,"../scatter/fillcolor_defaults":780,"../scatter/line_defaults":784,"../scatter/line_shape_defaults":786,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/text_defaults":793,"./attributes":817}],820:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129741,7 +130691,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../../plots/cartesian/axes":592,"../scatter/hover":759}],798:[function(require,module,exports){ +},{"../../plots/cartesian/axes":615,"../scatter/hover":782}],821:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129774,7 +130724,7 @@ ScatterTernary.meta = { module.exports = ScatterTernary; -},{"../../plots/ternary":655,"../scatter/colorbar":753,"./attributes":794,"./calc":795,"./defaults":796,"./hover":797,"./plot":799,"./select":800,"./style":801}],799:[function(require,module,exports){ +},{"../../plots/ternary":678,"../scatter/colorbar":776,"./attributes":817,"./calc":818,"./defaults":819,"./hover":820,"./plot":822,"./select":823,"./style":824}],822:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129820,7 +130770,7 @@ module.exports = function plot(ternary, data) { scatterPlot(ternary.graphDiv, plotinfo, calcdata); }; -},{"../scatter/plot":766}],800:[function(require,module,exports){ +},{"../scatter/plot":789}],823:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129855,7 +130805,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"../scatter/select":767}],801:[function(require,module,exports){ +},{"../scatter/select":790}],824:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129884,7 +130834,7 @@ module.exports = function style(gd) { scatterStyle(gd); }; -},{"../scatter/style":768}],802:[function(require,module,exports){ +},{"../scatter/style":791}],825:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130104,7 +131054,7 @@ module.exports = { } }; -},{"../../components/color":483,"../../components/colorscale/attributes":489,"../../lib/extend":563}],803:[function(require,module,exports){ +},{"../../components/color":506,"../../components/colorscale/attributes":512,"../../lib/extend":586}],826:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130128,7 +131078,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":490}],804:[function(require,module,exports){ +},{"../../components/colorscale/calc":513}],827:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130175,7 +131125,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,"d3":119,"fast-isnumeric":123}],805:[function(require,module,exports){ +},{"../../components/colorbar/draw":509,"../../components/colorscale/get_scale":518,"../../lib":591,"../../plots/plots":671,"d3":124,"fast-isnumeric":128}],828:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130538,7 +131488,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../lib/str2rgbarray":580,"gl-surface3d":227,"ndarray":433,"ndarray-fill":426,"ndarray-homography":431,"ndarray-ops":432,"tinycolor2":454}],806:[function(require,module,exports){ +},{"../../lib/str2rgbarray":603,"gl-surface3d":232,"ndarray":456,"ndarray-fill":449,"ndarray-homography":454,"ndarray-ops":455,"tinycolor2":477}],829:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130655,7 +131605,7 @@ function mapLegacy(traceIn, oldAttr, newAttr) { } } -},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":802}],807:[function(require,module,exports){ +},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":825}],830:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130685,5 +131635,5 @@ Surface.meta = { module.exports = Surface; -},{"../../plots/gl3d":628,"./attributes":802,"./calc":803,"./colorbar":804,"./convert":805,"./defaults":806}]},{},[12])(12) +},{"../../plots/gl3d":651,"./attributes":825,"./calc":826,"./colorbar":827,"./convert":828,"./defaults":829}]},{},[12])(12) }); \ No newline at end of file diff --git a/dist/plotly.min.js b/dist/plotly.min.js index 2d8a525e990..1d94947ad29 100644 --- a/dist/plotly.min.js +++ b/dist/plotly.min.js @@ -1,59 +1,61 @@ /** -* plotly.js v1.16.2 +* plotly.js v1.16.3 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return i(r?r:e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;ar;++r)e[r]=0;return e}function a(t,e,r){switch(arguments.length){case 0:return new i([0],[0],0);case 1:if("number"==typeof t){var n=o(t);return new i(n,n,0)}return new i(t,o(t.length),0);case 2:if("number"==typeof e){var n=o(t.length);return new i(t,n,+e)}r=0;case 3:if(t.length!==e.length)throw new Error("state and velocity lengths must match");return new i(t,e,r)}}e.exports=a;var s=t("cubic-hermite"),l=t("binary-search-bounds"),u=i.prototype;u.flush=function(t){var e=l.gt(this._time,t)-1;0>=e||(this._time.splice(0,e),this._state.splice(0,e*this.dimension),this._velocity.splice(0,e*this.dimension))},u.curve=function(t){var e=this._time,r=e.length,i=l.le(e,t),o=this._scratch[0],a=this._state,u=this._velocity,c=this.dimension,h=this.bounds;if(0>i)for(var f=c-1,d=0;c>d;++d,--f)o[d]=a[f];else if(i>=r-1)for(var f=a.length-1,p=t-e[r-1],d=0;c>d;++d,--f)o[d]=a[f]+p*u[f];else{for(var f=c*(i+1)-1,v=e[i],m=e[i+1],g=m-v||1,y=this._scratch[1],b=this._scratch[2],x=this._scratch[3],_=this._scratch[4],w=!0,d=0;c>d;++d,--f)y[d]=a[f],x[d]=u[f]*g,b[d]=a[f+c],_[d]=u[f+c]*g,w=w&&y[d]===b[d]&&x[d]===_[d]&&0===x[d];if(w)for(var d=0;c>d;++d)o[d]=y[d];else s(y,x,b,_,(t-v)/g,o)}for(var M=h[0],k=h[1],d=0;c>d;++d)o[d]=n(M[d],k[d],o[d]);return o},u.dcurve=function(t){var e=this._time,r=e.length,n=l.le(e,t),i=this._scratch[0],o=this._state,a=this._velocity,u=this.dimension;if(n>=r-1)for(var c=o.length-1,h=(t-e[r-1],0);u>h;++h,--c)i[h]=a[c];else{for(var c=u*(n+1)-1,f=e[n],d=e[n+1],p=d-f||1,v=this._scratch[1],m=this._scratch[2],g=this._scratch[3],y=this._scratch[4],b=!0,h=0;u>h;++h,--c)v[h]=o[c],g[h]=a[c]*p,m[h]=o[c+u],y[h]=a[c+u]*p,b=b&&v[h]===m[h]&&g[h]===y[h]&&0===g[h];if(b)for(var h=0;u>h;++h)i[h]=0;else{s.derivative(v,g,m,y,(t-f)/p,i);for(var h=0;u>h;++h)i[h]/=p}}return i},u.lastT=function(){var t=this._time;return t[t.length-1]},u.stable=function(){for(var t=this._velocity,e=t.length,r=this.dimension-1;r>=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(e>t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1];this._time.push(e,t);for(var c=0;2>c;++c)for(var h=0;r>h;++h)i.push(i[a++]),o.push(0);this._time.push(t);for(var h=r;h>0;--h)i.push(n(l[h-1],u[h-1],arguments[h])),o.push(0)}},u.push=function(t){var e=this.lastT(),r=this.dimension;if(!(e>t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=t-e,l=this.bounds,u=l[0],c=l[1],h=s>1e-6?1/s:0;this._time.push(t);for(var f=r;f>0;--f){var d=n(u[f-1],c[f-1],arguments[f]);i.push(d),o.push((d-i[a++])*h)}}},u.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(n(a[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(e>=t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,h=c>1e-6?1/c:0;this._time.push(t);for(var f=r;f>0;--f){var d=arguments[f];i.push(n(l[f-1],u[f-1],i[a++]+d)),o.push(d*h)}}},u.idle=function(t){var e=this.lastT();if(!(e>t)){var r=this.dimension,i=this._state,o=this._velocity,a=i.length-r,s=this.bounds,l=s[0],u=s[1],c=t-e;this._time.push(t);for(var h=r-1;h>=0;--h)i.push(n(l[h],u[h],i[a]+c*o[a])),o.push(0),a+=1}}},{"binary-search-bounds":22,"cubic-hermite":23}],22:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){var a=["function ",t,"(a,l,h,",n.join(","),"){",o?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return o?e.indexOf("c")<0?a.push(";if(x===y){return m}else if(x<=y){"):a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):a.push(";if(",e,"){i=m;"),r?a.push("l=m+1}else{h=m-1}"):a.push("h=m-1}else{l=m+1}"),a.push("}"),o?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){var o=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(""));return o()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],23:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){var a=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,u=3*i*i-2*i;if(t.length){o||(o=new Array(t.length));for(var c=t.length-1;c>=0;--c)o[c]=a*t[c]+s*e[c]+l*r[c]+u*n[c];return o}return a*t+s*e+l*r[c]+u*n}function i(t,e,r,n,i,o){var a=i-1,s=i*i,l=a*a,u=(1+2*i)*l,c=i*l,h=s*(3-2*i),f=s*a;if(t.length){o||(o=new Array(t.length));for(var d=t.length-1;d>=0;--d)o[d]=u*t[d]+c*e[d]+h*r[d]+f*n[d];return o}return u*t+c*e+h*r+f*n}e.exports=i,e.exports.derivative=n},{}],24:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=i*l-o*s,t[1]=o*a-n*l,t[2]=n*s-i*a,t}e.exports=n},{}],25:[function(t,e,r){function n(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.exports=n},{}],26:[function(t,e,r){function n(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}e.exports=n},{}],27:[function(t,e,r){function n(t,e,r,n){var i=e[0],o=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t}e.exports=n},{}],28:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t}e.exports=n},{}],29:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var o=t("binary-search-bounds"),a=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),h=t("gl-mat4/lookAt"),f=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var v=n.prototype;v.recalcMatrix=function(t){var e=this._time,r=o.le(e,t),n=this.computedMatrix;if(!(0>r)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;16>u;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,h=this.prevMatrix,f=!0,u=0;16>u;++u)h[u]=i[l++];for(var p=this.nextMatrix,u=0;16>u;++u)p[u]=i[l++],f=f&&h[u]===p[u];if(1e-6>c||f)for(var u=0;16>u;++u)n[u]=h[u];else a(n,h,p,(t-e[r])/c)}var v=this.computedUp;v[0]=n[1],v[1]=n[5],v[2]=n[6],d(v,v);var m=this.computedInverse;s(m,n);var g=this.computedEye,y=m[15];g[0]=m[12]/y,g[1]=m[13]/y,g[2]=m[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;3>u;++u)b[u]=g[u]-n[2+4*u]*x}},v.idle=function(t){if(!(tn;++n)e.push(e[r++]);this._time.push(t)}},v.flush=function(t){var e=o.gt(this._time,t)-2;0>e||(this._time.slice(0,e),this._components.slice(0,16*e))},v.lastT=function(){return this._time[this._time.length-1]},v.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||p,n=n||this.computedUp,this.setMatrix(t,h(this.computedMatrix,e,r,n));for(var i=0,o=0;3>o;++o)i+=Math.pow(r[o]-e[o],2);i=Math.log(Math.sqrt(i)),this.computedRadius[0]=i},v.rotate=function(t,e,r,n){this.recalcMatrix(t);var i=this.computedInverse;e&&u(i,i,e),r&&l(i,i,r),n&&c(i,i,n),this.setMatrix(t,s(this.computedMatrix,i))};var m=[0,0,0];v.pan=function(t,e,r,n){m[0]=-(e||0),m[1]=-(r||0),m[2]=-(n||0),this.recalcMatrix(t);var i=this.computedInverse;f(i,i,m),this.setMatrix(t,s(i,i))},v.translate=function(t,e,r,n){m[0]=e||0,m[1]=r||0,m[2]=n||0,this.recalcMatrix(t);var i=this.computedMatrix;f(i,i,m),this.setMatrix(t,i)},v.setMatrix=function(t,e){if(!(tr;++r)this._components.push(e[r])}},v.setDistance=function(t,e){this.computedRadius[0]=e},v.setDistanceLimits=function(t,e){var r=this._limits;r[0]=t,r[1]=e},v.getDistanceLimits=function(t){var e=this._limits;return t?(t[0]=e[0],t[1]=e[1],t):e}},{"binary-search-bounds":30,"gl-mat4/invert":143,"gl-mat4/lookAt":144,"gl-mat4/rotateX":148,"gl-mat4/rotateY":149,"gl-mat4/rotateZ":150,"gl-mat4/scale":151,"gl-mat4/translate":152,"gl-vec3/normalize":28,"mat4-interpolate":31}],30:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],31:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,f.translate,f.scale,f.skew,f.perspective,f.quaternion),o=u(r,d.translate,d.scale,d.skew,d.perspective,d.quaternion);return i&&o?(s(p.translate,f.translate,d.translate,n),s(p.skew,f.skew,d.skew,n),s(p.scale,f.scale,d.scale,n),s(p.perspective,f.perspective,d.perspective,n),h(p.quaternion,f.quaternion,d.quaternion,n),l(t,p.translate,p.scale,p.skew,p.perspective,p.quaternion),!0):!1}function i(){return{translate:o(),scale:o(1),skew:o(),perspective:a(),quaternion:a()}}function o(t){return[t||0,t||0,t||0]}function a(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),h=t("quat-slerp"),f=i(),d=i(),p=i();e.exports=n},{"gl-mat4/determinant":139,"gl-vec3/lerp":27,"mat4-decompose":32,"mat4-recompose":34,"quat-slerp":35}],32:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function i(t,e){t[0][0]=e[0],t[0][1]=e[1],t[0][2]=e[2],t[1][0]=e[4],t[1][1]=e[5],t[1][2]=e[6],t[2][0]=e[8],t[2][1]=e[9],t[2][2]=e[10]}function o(t,e,r,n,i){t[0]=e[0]*n+r[0]*i,t[1]=e[1]*n+r[1]*i,t[2]=e[2]*n+r[2]*i}var a=t("./normalize"),s=t("gl-mat4/create"),l=t("gl-mat4/clone"),u=t("gl-mat4/determinant"),c=t("gl-mat4/invert"),h=t("gl-mat4/transpose"),f={length:t("gl-vec3/length"),normalize:t("gl-vec3/normalize"),dot:t("gl-vec3/dot"),cross:t("gl-vec3/cross")},d=s(),p=s(),v=[0,0,0,0],m=[[0,0,0],[0,0,0],[0,0,0]],g=[0,0,0];e.exports=function(t,e,r,s,y,b){if(e||(e=[0,0,0]),r||(r=[0,0,0]),s||(s=[0,0,0]),y||(y=[0,0,0,1]),b||(b=[0,0,0,1]),!a(d,t))return!1;if(l(p,d),p[3]=0,p[7]=0,p[11]=0,p[15]=1,Math.abs(u(p)<1e-8))return!1;var x=d[3],_=d[7],w=d[11],M=d[12],k=d[13],A=d[14],T=d[15];if(0!==x||0!==_||0!==w){v[0]=x,v[1]=_,v[2]=w,v[3]=T;var E=c(p,p);if(!E)return!1;h(p,p),n(y,v,p)}else y[0]=y[1]=y[2]=0,y[3]=1;if(e[0]=M,e[1]=k,e[2]=A,i(m,d),r[0]=f.length(m[0]),f.normalize(m[0],m[0]),s[0]=f.dot(m[0],m[1]),o(m[1],m[1],m[0],1,-s[0]),r[1]=f.length(m[1]),f.normalize(m[1],m[1]),s[0]/=r[1],s[1]=f.dot(m[0],m[2]),o(m[2],m[2],m[0],1,-s[1]),s[2]=f.dot(m[1],m[2]),o(m[2],m[2],m[1],1,-s[2]),r[2]=f.length(m[2]),f.normalize(m[2],m[2]),s[1]/=r[2],s[2]/=r[2],f.cross(g,m[1],m[2]),f.dot(m[0],g)<0)for(var S=0;3>S;S++)r[S]*=-1,m[S][0]*=-1,m[S][1]*=-1,m[S][2]*=-1;return b[0]=.5*Math.sqrt(Math.max(1+m[0][0]-m[1][1]-m[2][2],0)),b[1]=.5*Math.sqrt(Math.max(1-m[0][0]+m[1][1]-m[2][2],0)),b[2]=.5*Math.sqrt(Math.max(1-m[0][0]-m[1][1]+m[2][2],0)),b[3]=.5*Math.sqrt(Math.max(1+m[0][0]+m[1][1]+m[2][2],0)),m[2][1]>m[1][2]&&(b[0]=-b[0]),m[0][2]>m[2][0]&&(b[1]=-b[1]),m[1][0]>m[0][1]&&(b[2]=-b[2]),!0}},{"./normalize":33,"gl-mat4/clone":137,"gl-mat4/create":138,"gl-mat4/determinant":139,"gl-mat4/invert":143,"gl-mat4/transpose":153,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/length":26,"gl-vec3/normalize":28}],33:[function(t,e,r){e.exports=function(t,e){var r=e[15];if(0===r)return!1;for(var n=1/r,i=0;16>i;i++)t[i]=e[i]*n;return!0}},{}],34:[function(t,e,r){var n={identity:t("gl-mat4/identity"),translate:t("gl-mat4/translate"),multiply:t("gl-mat4/multiply"),create:t("gl-mat4/create"),scale:t("gl-mat4/scale"),fromRotationTranslation:t("gl-mat4/fromRotationTranslation")},i=(n.create(),n.create());e.exports=function(t,e,r,o,a,s){return n.identity(t),n.fromRotationTranslation(t,s,e),t[3]=a[0],t[7]=a[1],t[11]=a[2],t[15]=a[3],n.identity(i),0!==o[2]&&(i[9]=o[2],n.multiply(t,t,i)),0!==o[1]&&(i[9]=0,i[8]=o[1],n.multiply(t,t,i)),0!==o[0]&&(i[8]=0,i[4]=o[0],n.multiply(t,t,i)),n.scale(t,t,r),t}},{"gl-mat4/create":138,"gl-mat4/fromRotationTranslation":141,"gl-mat4/identity":142,"gl-mat4/multiply":145,"gl-mat4/scale":151,"gl-mat4/translate":152}],35:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":36}],36:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],v=r[2],m=r[3];return o=u*d+c*p+h*v+f*m,0>o&&(o=-o,d=-d,p=-p,v=-v,m=-m),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-n)*i)/a,l=Math.sin(n*i)/a):(s=1-n,l=n),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*v,t[3]=s*f+l*m,t}e.exports=n},{}],37:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u){var c=e+o+u;if(h>0){var h=Math.sqrt(c+1);t[0]=.5*(a-l)/h,t[1]=.5*(s-n)/h,t[2]=.5*(r-o)/h,t[3]=.5*h}else{var f=Math.max(e,o,u),h=Math.sqrt(2*f-c+1);e>=f?(t[0]=.5*h,t[1]=.5*(i+r)/h,t[2]=.5*(s+n)/h,t[3]=.5*(a-l)/h):o>=f?(t[0]=.5*(r+i)/h,t[1]=.5*h,t[2]=.5*(l+a)/h,t[3]=.5*(s-n)/h):(t[0]=.5*(n+s)/h,t[1]=.5*(a+l)/h,t[2]=.5*h,t[3]=.5*(r-i)/h)}return t}e.exports=n},{}],38:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function o(t,e){var r=e[0],n=e[1],o=e[2],a=e[3],s=i(r,n,o,a);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=o/s,t[3]=a/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function a(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),o(r,r);var i=new a(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),h=t("gl-mat4/invert"),f=t("./lib/quatFromFrame"),d=a.prototype;d.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},d.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;o(e,e);var r=this.computedMatrix;c(r,e);var n=this.computedCenter,i=this.computedEye,a=this.computedUp,s=Math.exp(this.computedRadius[0]);i[0]=n[0]+s*r[2],i[1]=n[1]+s*r[6],i[2]=n[2]+s*r[10],a[0]=r[1],a[1]=r[5],a[2]=r[9];for(var l=0;3>l;++l){for(var u=0,h=0;3>h;++h)u+=r[l+4*h]*i[h];r[12+l]=-u}},d.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;16>n;++n)e[n]=r[n];return e}return r},d.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},d.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var o=this.computedMatrix,a=o[1],s=o[5],l=o[9],u=n(a,s,l);a/=u,s/=u,l/=u;var c=o[0],h=o[4],f=o[8],d=c*a+h*s+f*l;c-=a*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var v=o[2],m=o[6],g=o[10],y=v*a+m*s+g*l,b=v*c+m*h+g*f;v-=y*a+b*c,m-=y*s+b*h,g-=y*l+b*f;var x=n(v,m,g);v/=x,m/=x,g/=x;var _=c*e+a*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var k=Math.exp(this.computedRadius[0]);k=Math.max(1e-4,k+i),this.radius.set(t,Math.log(k))},d.rotate=function(t,e,r,o){this.recalcMatrix(t),e=e||0,r=r||0;var a=this.computedMatrix,s=a[0],l=a[4],u=a[8],c=a[1],h=a[5],f=a[9],d=a[2],p=a[6],v=a[10],m=e*s+r*c,g=e*l+r*h,y=e*u+r*f,b=-(p*y-v*g),x=-(v*m-d*y),_=-(d*g-p*m),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),M=i(b,x,_,w);M>1e-6?(b/=M,x/=M,_/=M,w/=M):(b=x=_=0,w=1);var k=this.computedRotation,A=k[0],T=k[1],E=k[2],S=k[3],L=A*w+S*b+T*_-E*x,z=T*w+S*x+E*b-A*_,I=E*w+S*_+A*x-T*b,P=S*w-A*b-T*x-E*_;if(o){b=d,x=p,_=v;var C=Math.sin(o)/n(b,x,_);b*=C,x*=C,_*=C,w=Math.cos(e),L=L*w+P*b+z*_-I*x,z=z*w+P*x+I*b-L*_,I=I*w+P*_+L*x-z*b,P=P*w-L*b-z*x-I*_}var R=i(L,z,I,P);R>1e-6?(L/=R,z/=R,I/=R,P/=R):(L=z=I=0,P=1),this.rotation.set(t,L,z,I,P)},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var a=this.computedRotation;f(a,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),o(a,a),this.rotation.set(t,a[0],a[1],a[2],a[3]);for(var s=0,l=0;3>l;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e){var r=this.computedRotation;f(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),o(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;h(n,e);var i=n[15];if(Math.abs(i)>1e-6){var a=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,a-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0), -e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},d.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":37,"filtered-vector":21,"gl-mat4/fromQuat":140,"gl-mat4/invert":143,"gl-mat4/lookAt":144}],39:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t){return Math.min(1,Math.max(-1,t))}function o(t){var e=Math.abs(t[0]),r=Math.abs(t[1]),n=Math.abs(t[2]),i=[0,0,0];e>Math.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var o=0,a=0,s=0;3>s;++s)o+=t[s]*t[s],a+=i[s]*t[s];for(var s=0;3>s;++s)i[s]-=a/o*t[s];return f(i,i),i}function a(t,e,r,n,i,o,a,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([o]),this.angle=l([a,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;16>u;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||o(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),f(r,r),i=[].slice.call(i,0,3),f(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];h(i,p,r),n(i[0],i[1],i[2])<1e-6?i=o(r):f(i,i),s=n(p[0],p[1],p[2]);var v=d(r,p)/s,m=d(i,p)/s;u=Math.acos(v),l=Math.acos(m)}return s=Math.log(s),new a(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),h=t("gl-vec3/cross"),f=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=a.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,o=0,a=0;3>a;++a)o+=e[a]*r[a],i+=e[a]*e[a];for(var s=Math.sqrt(i),l=0,a=0;3>a;++a)r[a]-=e[a]*o/i,l+=r[a]*r[a],e[a]/=s;for(var u=Math.sqrt(l),a=0;3>a;++a)r[a]/=u;var c=this.computedToward;h(c,e,r),f(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],v=this.computedAngle[1],m=Math.cos(p),g=Math.sin(p),y=Math.cos(v),b=Math.sin(v),x=this.computedCenter,_=m*y,w=g*y,M=b,k=-m*b,A=-g*b,T=y,E=this.computedEye,S=this.computedMatrix,a=0;3>a;++a){var L=_*r[a]+w*c[a]+M*e[a];S[4*a+1]=k*r[a]+A*c[a]+T*e[a],S[4*a+2]=L,S[4*a+3]=0}var z=S[1],I=S[5],P=S[9],C=S[2],R=S[6],D=S[10],O=I*D-P*R,F=P*C-z*D,j=z*R-I*C,N=n(O,F,j);O/=N,F/=N,j/=N,S[0]=O,S[4]=F,S[8]=j;for(var a=0;3>a;++a)E[a]=x[a]+S[2+4*a]*d;for(var a=0;3>a;++a){for(var l=0,B=0;3>B;++B)l+=S[a+4*B]*E[B];S[12+a]=-l}S[15]=1},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;16>n;++n)e[n]=r[n];return e}return r};var v=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;v[0]=i[2],v[1]=i[6],v[2]=i[10];for(var o=this.computedUp,a=this.computedRight,s=this.computedToward,l=0;3>l;++l)i[4*l]=o[l],i[4*l+1]=a[l],i[4*l+2]=s[l];c(i,i,n,v);for(var l=0;3>l;++l)o[l]=i[4*l],a[l]=i[4*l+1];this.up.set(t,o[0],o[1],o[2]),this.right.set(t,a[0],a[1],a[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var o=this.computedMatrix,a=(Math.exp(this.computedRadius[0]),o[1]),s=o[5],l=o[9],u=n(a,s,l);a/=u,s/=u,l/=u;var c=o[0],h=o[4],f=o[8],d=c*a+h*s+f*l;c-=a*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var v=c*e+a*r,m=h*e+s*r,g=f*e+l*r;this.center.move(t,v,m,g);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,o){var a=1;"number"==typeof r&&(a=0|r),(0>a||a>3)&&(a=1);var s=(a+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[a],c=e[a+4],h=e[a+8];if(o){var f=Math.abs(l),d=Math.abs(c),p=Math.abs(h),v=Math.max(f,d,p);f===v?(l=0>l?-1:1,c=h=0):p===v?(h=0>h?-1:1,l=c=0):(c=0>c?-1:1,l=h=0)}else{var m=n(l,c,h);l/=m,c/=m,h/=m}var g=e[s],y=e[s+4],b=e[s+8],x=g*l+y*c+b*h;g-=l*x,y-=c*x,b-=h*x;var _=n(g,y,b);g/=_,y/=_,b/=_;var w=c*b-h*y,M=h*g-l*b,k=l*y-c*g,A=n(w,M,k);w/=A,M/=A,k/=A,this.center.jump(t,G,H,X),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,g,y,b);var T,E;if(2===a){var S=e[1],L=e[5],z=e[9],I=S*g+L*y+z*b,P=S*w+L*M+z*k;T=0>O?-Math.PI/2:Math.PI/2,E=Math.atan2(P,I)}else{var C=e[2],R=e[6],D=e[10],O=C*l+R*c+D*h,F=C*g+R*y+D*b,j=C*w+R*M+D*k;T=Math.asin(i(O)),E=Math.atan2(j,F)}this.angle.jump(t,E,T),this.recalcMatrix(t);var N=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var q=V[15],G=V[12]/q,H=V[13]/q,X=V[14]/q,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,G-N*Y,H-B*Y,X-U*Y)},p.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},p.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},p.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.lookAt=function(t,e,r,o){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,o=o||this.computedUp;var a=o[0],s=o[1],l=o[2],u=n(a,s,l);if(!(1e-6>u)){a/=u,s/=u,l/=u;var c=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],d=n(c,h,f);if(!(1e-6>d)){c/=d,h/=d,f/=d;var p=this.computedRight,v=p[0],m=p[1],g=p[2],y=a*v+s*m+l*g;v-=y*a,m-=y*s,g-=y*l;var b=n(v,m,g);if(!(.01>b&&(v=s*f-l*h,m=l*c-a*f,g=a*h-s*c,b=n(v,m,g),1e-6>b))){v/=b,m/=b,g/=b,this.up.set(t,a,s,l),this.right.set(t,v,m,g),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*g-l*m,_=l*v-a*g,w=a*m-s*v,M=n(x,_,w);x/=M,_/=M,w/=M;var k=a*c+s*h+l*f,A=v*c+m*h+g*f,T=x*c+_*h+w*f,E=Math.asin(i(k)),S=Math.atan2(T,A),L=this.angle._state,z=L[L.length-1],I=L[L.length-2];z%=2*Math.PI;var P=Math.abs(z+2*Math.PI-S),C=Math.abs(z-S),R=Math.abs(z-2*Math.PI-S);C>P&&(z+=2*Math.PI),C>R&&(z-=2*Math.PI),this.angle.jump(this.angle.lastT(),z,I),this.angle.set(t,S,E)}}}}},{"filtered-vector":21,"gl-mat4/invert":143,"gl-mat4/rotate":147,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/normalize":28}],40:[function(t,e,r){"use strict";function n(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}function i(t){t=t||{};var e=t.eye||[0,0,1],r=t.center||[0,0,0],i=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],u=t.mode||"turntable",c=o(),h=a(),f=s();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,i),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,i),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,i),new n({turntable:c,orbit:h,matrix:f},u)}e.exports=i;var o=t("turntable-camera-controller"),a=t("orbit-camera-controller"),s=t("matrix-camera-controller"),l=n.prototype,u=[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]];u.forEach(function(t){for(var e=t[0],r=[],n=0;ne)){var r=this._active,n=this._controllerList[e],i=Math.max(r.lastT(),n.lastT());r.recalcMatrix(i),n.setMatrix(i,r.computedMatrix),this._active=n,this._mode=t,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}}},l.getMode=function(){return this._mode}},{"matrix-camera-controller":29,"orbit-camera-controller":38,"turntable-camera-controller":39}],41:[function(t,e,r){function n(t,e){return o(i(t,e))}e.exports=n;var i=t("alpha-complex"),o=t("simplicial-complex-boundary")},{"alpha-complex":42,"simplicial-complex-boundary":45}],42:[function(t,e,r){"use strict";function n(t,e){return i(e).filter(function(r){for(var n=new Array(r.length),i=0;ii;++i)r+=t[i]*e[i];return r}function i(t){var e=t.length;if(0===e)return[];var r=(t[0].length,a([t.length+1,t.length+1],1)),i=a([t.length+1],1);r[e][e]=0;for(var o=0;e>o;++o){for(var l=0;o>=l;++l)r[l][o]=r[o][l]=2*n(t[o],t[l]);i[o]=n(t[o],t[o])}for(var u=s(r,i),c=0,h=u[e+1],o=0;oo;++o){for(var h=u[o],d=0,l=0;ls;++s)r[s]+=t[o][s]*n[o];return r}var a=t("dup"),s=t("robust-linear-solve");o.barycenetric=i,e.exports=o},{dup:121,"robust-linear-solve":436}],45:[function(t,e,r){"use strict";function n(t){return o(i(t))}e.exports=n;var i=t("boundary-cells"),o=t("reduce-simplicial-complex")},{"boundary-cells":46,"reduce-simplicial-complex":49}],46:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r+=t[n].length;for(var i=new Array(r),o=0,n=0;e>n;++n)for(var a=t[n],s=a.length,l=0;s>l;++l)for(var u=i[o++]=new Array(s-1),c=1;s>c;++c)u[c-1]=a[(l+c)%s];return i}e.exports=n},{}],47:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;rn;++n)if(t[r]n;++n){var s=t[n],l=a(s);if(0!==l){if(r>0){var u=t[r-1];if(0===i(s,u)&&a(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),o=t("compare-oriented-cell"),a=t("cell-orientation");e.exports=n},{"cell-orientation":47,"compare-cell":107,"compare-oriented-cell":48}],50:[function(t,e,r){"use strict";var n=function(){function t(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t}function e(t,e,r){for(var n=(e-t)/Math.max(r-1,1),i=[],o=0;r>o;o++)i.push(t+o*n);return i}function r(){for(var t=[].slice.call(arguments),e=t.map(function(t){return t.length}),r=Math.min.apply(null,e),n=[],i=0;r>i;i++){n[i]=[];for(var o=0;oo;o++)i.push([t[o],e[o],r[o]]);return i}function i(t){function e(t){for(var n=0;n>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;3>i;++i)r[i]=r[i]/255;return r}function u(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;3>i;++i)r[i]=r[i]/255;return r}var c={},h=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,f=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return c.isPlainObject=t,c.linspace=e,c.zip3=n,c.sum=i,c.zip=r,c.isEqual=s,c.copy2D=o,c.copy1D=a,c.str2RgbArray=l,c.str2RgbaArray=u,c};e.exports=n()},{}],51:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<0)-(0>t)},r.abs=function(t){var e=t>>i-1;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(e>t)},r.max=function(t,e){return t^(t^e)&-(e>t)},r.isPow2=function(t){return!(t&t-1||!t)},r.log2=function(t){var e,r;return e=(t>65535)<<4,t>>>=e,r=(t>255)<<3,t>>>=r,e|=r,r=(t>15)<<2,t>>>=r,e|=r,r=(t>3)<<1,t>>>=r,e|=r,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var o=new Array(256);!function(t){for(var e=0;256>e;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|o[t>>>16&255]<<8|o[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],52:[function(t,e,r){function n(t,e){return d.isUndefined(e)?""+e:d.isNumber(e)&&!isFinite(e)?e.toString():d.isFunction(e)||d.isRegExp(e)?e.toString():e}function i(t,e){return d.isString(t)?t.length=0;o--)if(a[o]!=s[o])return!1;for(o=a.length-1;o>=0;o--)if(i=a[o],!l(t[i],e[i]))return!1;return!0}function h(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0:!1}function f(t,e,r,n){var i;d.isString(r)&&(n=r,r=null);try{e()}catch(o){i=o}if(n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&a(i,r,"Missing expected exception"+n),!t&&h(i,r)&&a(i,r,"Got unwanted exception"+n),t&&i&&r&&!h(i,r)||!t&&i)throw i}var d=t("util/"),p=Array.prototype.slice,v=Object.prototype.hasOwnProperty,m=e.exports=s;m.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=o(this),this.generatedMessage=!0);var e=t.stackStartFunction||a;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=e.name,s=n.indexOf("\n"+i);if(s>=0){var l=n.indexOf("\n",s+1);n=n.substring(l+1)}this.stack=n}}},d.inherits(m.AssertionError,Error),m.fail=a,m.ok=s,m.equal=function(t,e,r){t!=e&&a(t,e,r,"==",m.equal)},m.notEqual=function(t,e,r){t==e&&a(t,e,r,"!=",m.notEqual)},m.deepEqual=function(t,e,r){l(t,e)||a(t,e,r,"deepEqual",m.deepEqual)},m.notDeepEqual=function(t,e,r){l(t,e)&&a(t,e,r,"notDeepEqual",m.notDeepEqual)},m.strictEqual=function(t,e,r){t!==e&&a(t,e,r,"===",m.strictEqual)},m.notStrictEqual=function(t,e,r){t===e&&a(t,e,r,"!==",m.notStrictEqual)},m.throws=function(t,e,r){f.apply(this,[!0].concat(p.call(arguments)))},m.doesNotThrow=function(t,e){f.apply(this,[!1].concat(p.call(arguments)))},m.ifError=function(t){if(t)throw t};var g=Object.keys||function(t){var e=[];for(var r in t)v.call(t,r)&&e.push(r);return e}},{"util/":62}],53:[function(t,e,r){(function(e){"use strict";function n(){try{var t=new Uint8Array(1);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function i(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t){return this instanceof o?(o.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof t?a(this,t):"string"==typeof t?s(this,t,arguments.length>1?arguments[1]:"utf8"):l(this,t)):arguments.length>1?new o(t,arguments[1]):new o(t)}function a(t,e){if(t=v(t,0>e?0:0|m(e)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;e>r;r++)t[r]=0;return t}function s(t,e,r){"string"==typeof r&&""!==r||(r="utf8");var n=0|y(e,r);return t=v(t,n),t.write(e,r),t}function l(t,e){if(o.isBuffer(e))return u(t,e);if(K(e))return c(t,e);if(null==e)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(e.buffer instanceof ArrayBuffer)return h(t,e);if(e instanceof ArrayBuffer)return f(t,e)}return e.length?d(t,e):p(t,e)}function u(t,e){var r=0|m(e.length);return t=v(t,r),e.copy(t,0,0,r),t}function c(t,e){var r=0|m(e.length);t=v(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function h(t,e){var r=0|m(e.length);t=v(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function f(t,e){return e.byteLength,o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):t=h(t,new Uint8Array(e)),t}function d(t,e){var r=0|m(e.length);t=v(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function p(t,e){var r,n=0;"Buffer"===e.type&&K(e.data)&&(r=e.data,n=0|m(r.length)),t=v(t,n);for(var i=0;n>i;i+=1)t[i]=255&r[i];return t}function v(t,e){o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):t.length=e;var r=0!==e&&e<=o.poolSize>>>1;return r&&(t.parent=J),t}function m(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function g(t,e){if(!(this instanceof g))return new g(t,e);var r=new o(t,e);return delete r.parent,r}function y(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function b(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return L(this,e,r);case"binary":return z(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function x(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new Error("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;n>a;a++){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");t[r+a]=s}return a}function _(t,e,r,n){return Y(q(e,t.length-r),t,r,n)}function w(t,e,r,n){return Y(G(e),t,r,n)}function M(t,e,r,n){return w(t,e,r,n)}function k(t,e,r,n){return Y(X(e),t,r,n)}function A(t,e,r,n){return Y(H(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?W.fromByteArray(t):W.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;r>i;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(r>=i+s){var l,u,c,h;switch(s){case 1:128>o&&(a=o);break;case 2:l=t[i+1],128===(192&l)&&(h=(31&o)<<6|63&l,h>127&&(a=h));break;case 3:l=t[i+1],u=t[i+2],128===(192&l)&&128===(192&u)&&(h=(15&o)<<12|(63&l)<<6|63&u,h>2047&&(55296>h||h>57343)&&(a=h));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(h=(15&o)<<18|(63&l)<<12|(63&u)<<6|63&c,h>65535&&1114112>h&&(a=h))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return S(n)}function S(t){var e=t.length;if($>=e)return String.fromCharCode.apply(String,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=$));return r}function L(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(127&t[i]);return n}function z(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var i="",o=e;r>o;o++)i+=V(t[o]);return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;ot)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,i,a){if(!o.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>i||a>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range")}function D(t,e,r,n){0>e&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);o>i;i++)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function O(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);o>i;i++)t[r+i]=e>>>8*(n?i:3-i)&255}function F(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function j(t,e,r,n,i){return i||F(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,i){return i||F(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,r,n,52,8),r+8}function B(t){if(t=U(t).replace(Q,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function U(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function V(t){return 16>t?"0"+t.toString(16):t.toString(16)}function q(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;n>a;a++){if(r=t.charCodeAt(a),r>55295&&57344>r){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(56320>r){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,128>r){if((e-=1)<0)break;o.push(r)}else if(2048>r){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function X(t){return W.toByteArray(B(t))}function Y(t,e,r,n){for(var i=0;n>i&&!(i+r>=e.length||i>=t.length);i++)e[i+r]=t[i];return i}var W=t("base64-js"),Z=t("ieee754"),K=t("isarray");r.Buffer=o,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50,o.poolSize=8192;var J={};o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),o._augment=function(t){return t.__proto__=o.prototype,t},o.TYPED_ARRAY_SUPPORT?(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})):(o.prototype.length=void 0,o.prototype.parent=void 0),o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);a>i&&t[i]===e[i];)++i;return i!==a&&(r=t[i],n=e[i]),n>r?-1:r>n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!K(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new o(0);var r;if(void 0===e)for(e=0,r=0;r0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},o.prototype.compare=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:o.compare(this,t)},o.prototype.indexOf=function(t,e){function r(t,e,r){for(var n=-1,i=0;r+i2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(o.isBuffer(t))return r(this,t,e);if("number"==typeof t)return o.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):r(this,[t],e);throw new TypeError("val must be string, number or Buffer")},o.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=e,e=0|r,r=i}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"binary":return M(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),t>e&&(e=t);var n;if(o.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=o.prototype;else{var i=e-t;n=new o(i,void 0);for(var a=0;i>a;a++)n[a]=this[a+t]}return n.length&&(n.parent=this.parent||this),n},o.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),Z.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),Z.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),Z.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){ -return e||C(t,8,this.length),Z.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||R(this,t,e,r,Math.pow(2,8*r),0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=0,a=1,s=0>t?1:0;for(this[e]=255&t;++o>0)-s&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0>t?1:0;for(this[e+o]=255&t;--o>=0&&(a*=256);)this[e+o]=(t/a>>0)-s&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-er&&n>e)for(i=a-1;i>=0;i--)t[i+e]=this[i+r];else if(1e3>a||!o.TYPED_ARRAY_SUPPORT)for(i=0;a>i;i++)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a},o.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var i=q(t.toString()),o=i.length;for(n=e;r>n;n++)this[n]=i[n%o]}return this}};var Q=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":54,ieee754:55,isarray:56}],54:[function(t,e,r){"use strict";function n(){var t,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=e.length;for(t=0;r>t;t++)l[t]=e[t];for(t=0;r>t;++t)u[e.charCodeAt(t)]=t;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63}function i(t){var e,r,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new c(3*s/4-o),n=o>0?s-4:s;var l=0;for(e=0,r=0;n>e;e+=4,r+=3)i=u[t.charCodeAt(e)]<<18|u[t.charCodeAt(e+1)]<<12|u[t.charCodeAt(e+2)]<<6|u[t.charCodeAt(e+3)],a[l++]=(16711680&i)>>16,a[l++]=(65280&i)>>8,a[l++]=255&i;return 2===o?(i=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[l++]=255&i):1===o&&(i=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}function o(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}function a(t,e,r){for(var n,i=[],a=e;r>a;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],i.push(o(n));return i.join("")}function s(t){for(var e,r=t.length,n=r%3,i="",o=[],s=16383,u=0,c=r-n;c>u;u+=s)o.push(a(t,u,u+s>c?c:u+s));return 1===n?(e=t[r-1],i+=l[e>>2],i+=l[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=l[e>>10],i+=l[e>>4&63],i+=l[e<<2&63],i+="="),o.push(i),o.join("")}r.toByteArray=i,r.fromByteArray=s;var l=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array;n()},{}],55:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,l=(1<>1,c=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,n),o-=u}return(d?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,v=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),e+=a+h>=1?f/l:f*Math.pow(2,1-h),e*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,u-=8);t[r+d-p]|=128*v}},{}],56:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],57:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function a(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,o,l,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],s(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),r.apply(this,o)}else if(a(r))for(o=Array.prototype.slice.call(arguments,1),u=r.slice(),n=u.length,l=0;n>l;l++)u[l].apply(this,o);return!0},n.prototype.addListener=function(t,e){var r;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(r=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],58:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],59:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),o="/"===a(t,-1);return t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),o=n(e.split("/")),a=Math.min(i.length,o.length),s=a,l=0;a>l;l++)if(i[l]!==o[l]){s=l;break}for(var u=[],l=s;le&&(e=t.length+e),t.substr(e,r)}}).call(this,t("_process"))},{_process:60}],60:[function(t,e,r){function n(){c=!1,s.length?u=s.concat(u):h=-1,u.length&&i()}function i(){if(!c){var t=setTimeout(n);c=!0;for(var e=u.length;e;){for(s=u,u=[];++h1)for(var r=1;r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),v(e)?n.showHidden=e:e&&r._extend(n,e),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),l(n,t,n.depth)}function o(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function a(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function l(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return b(i)||(i=l(t,i,n)),i}var o=u(t,e);if(o)return o;var a=Object.keys(e),v=s(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),A(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(e);if(0===a.length){if(T(e)){var m=e.name?": "+e.name:"";return t.stylize("[Function"+m+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(k(e))return t.stylize(Date.prototype.toString.call(e),"date");if(A(e))return c(e)}var g="",y=!1,x=["{","}"];if(p(e)&&(y=!0,x=["[","]"]),T(e)){var _=e.name?": "+e.name:"";g=" [Function"+_+"]"}if(w(e)&&(g=" "+RegExp.prototype.toString.call(e)),k(e)&&(g=" "+Date.prototype.toUTCString.call(e)),A(e)&&(g=" "+c(e)),0===a.length&&(!y||0==e.length))return x[0]+g+x[1];if(0>n)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?h(t,e,n,v,a):a.map(function(r){return f(t,e,n,v,r,y)}),t.seen.pop(),d(M,g,x)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):v(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var o=[],a=0,s=e.length;s>a;++a)I(e,String(a))?o.push(f(t,e,r,n,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(f(t,e,r,n,i,!0))}),o}function f(t,e,r,n,i,o){var a,s,u;if(u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},u.get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),I(n,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=m(r)?l(t,u.value,null):l(t,u.value,r-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n"))):s=t.stylize("[Circular]","special")),_(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function d(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function p(t){return Array.isArray(t)}function v(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return null==t}function y(t){return"number"==typeof t}function b(t){return"string"==typeof t}function x(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===S(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===S(t)}function A(t){return M(t)&&("[object Error]"===S(t)||t instanceof Error)}function T(t){return"function"==typeof t}function E(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function S(t){return Object.prototype.toString.call(t)}function L(t){return 10>t?"0"+t.toString(10):t.toString(10)}function z(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),D[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var P=/%[sdj%]/g;r.format=function(t){if(!b(t)){for(var e=[],r=0;r=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return t}}),s=n[r];o>r;s=n[++r])a+=m(s)||!M(s)?" "+s:" "+i(s);return a},r.deprecate=function(t,i){function o(){if(!a){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),a=!0}return t.apply(this,arguments)}if(_(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var a=!1;return o};var C,R={};r.debuglog=function(t){if(_(C)&&(C=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!R[t])if(new RegExp("\\b"+t+"\\b","i").test(C)){var n=e.pid;R[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else R[t]=function(){};return R[t]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=v,r.isNull=m,r.isNullOrUndefined=g,r.isNumber=y,r.isString=b,r.isSymbol=x,r.isUndefined=_,r.isRegExp=w,r.isObject=M,r.isDate=k,r.isError=A,r.isFunction=T,r.isPrimitive=E,r.isBuffer=t("./support/isBuffer");var D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",z(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!M(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":61,_process:60,inherits:58}],63:[function(t,e,r){"use strict";function n(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function i(t,e){return t[0]-e[0]||t[1]-e[1]}function o(t){return t.map(n).sort(i)}function a(t,e,r){return e in t?t[e]:r}function s(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var n=!!a(r,"delaunay",!0),i=!!a(r,"interior",!0),s=!!a(r,"exterior",!0),f=!!a(r,"infinity",!1);if(!i&&!s||0===t.length)return[];var d=l(t,e);if(n||i!==s||f){for(var p=u(t.length,o(e)),v=0;vs)){if(n>i){var l=n;n=i,i=l,l=a,a=s,s=l}e.isConstraint(n,i)||o(t[n],t[i],t[a],t[s])<0&&r.push(n,i)}}function i(t,e){for(var r=[],i=t.length,a=e.stars,s=0;i>s;++s)for(var l=a[s],u=1;uc||e.isConstraint(s,c))){for(var h=l[u-1],f=-1,d=1;df||o(t[s],t[c],t[h],t[f])<0&&r.push(s,c)}}for(;r.length>0;){for(var c=r.pop(),s=r.pop(),h=-1,f=-1,l=a[s],p=1;ph||0>f||o(t[s],t[c],t[h],t[f])>=0||(e.flip(s,c),n(t,e,r,h,s,f),n(t,e,r,s,f,h),n(t,e,r,f,c,h),n(t,e,r,c,h,f))}}var o=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":68,"robust-in-sphere":69}],65:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=o,this.boundary=a}function i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function o(t,e){for(var r=t.cells(),o=r.length,a=0;o>a;++a){var s=r[a],l=s[0],u=s[1],c=s[2];c>u?l>u&&(s[0]=u,s[1]=c,s[2]=l):l>c&&(s[0]=c,s[1]=l,s[2]=u)}r.sort(i);for(var h=new Array(o),a=0;aa;++a)for(var s=r[a],y=0;3>y;++y){var l=s[y],u=s[(y+1)%3],b=p[3*a+y]=g.locate(u,l,t.opposite(u,l)),x=v[3*a+y]=t.isConstraint(l,u);0>b&&(x?d.push(a):(f.push(a),h[a]=1),e&&m.push([u,l,-1]))}return g}function a(t,e,r){for(var n=0,i=0;i0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);3>p;++p){var v=f[3*d+p];v>=0&&0===u[v]&&(h[3*d+p]?l.push(v):(s.push(v),u[v]=i))}}}var m=l;l=s,s=m,l.length=0,i=-i}var g=a(c,u,e);return r?g.concat(n.boundary):g}var l=t("binary-search-bounds");e.exports=s;var u=n.prototype;u.locate=function(){var t=[0,0,0];return function(e,r,n){var o=e,a=r,s=n;return n>r?e>r&&(o=r,a=n,s=e):e>n&&(o=n,a=e,s=r),0>o?-1:(t[0]=o,t[1]=a,t[2]=s,l.eq(this.cells,t,i))}}()},{"binary-search-bounds":68}],66:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.a=t,this.b=e,this.idx=r,this.lowerIds=n,this.upperIds=i}function i(t,e,r,n){this.a=t,this.b=e,this.type=r,this.idx=n}function o(t,e){var r=t.a[0]-e.a[0]||t.a[1]-e.a[1]||t.type-e.type;return r?r:t.type!==p&&(r=d(t.a,t.b,e.b))?r:t.idx-e.idx}function a(t,e){return d(t.a,t.b,e)}function s(t,e,r,n,i){for(var o=f.lt(e,n,a),s=f.gt(e,n,a),l=o;s>l;++l){for(var u=e[l],c=u.lowerIds,h=c.length;h>1&&d(r[c[h-2]],r[c[h-1]],n)>0;)t.push([c[h-1],c[h-2],i]),h-=1;c.length=h,c.push(i);for(var p=u.upperIds,h=p.length;h>1&&d(r[p[h-2]],r[p[h-1]],n)<0;)t.push([p[h-2],p[h-1],i]),h-=1;p.length=h,p.push(i)}}function l(t,e){var r;return(r=t.a[0]h;++h)l.push(new i(t[h],null,p,h));for(var h=0;a>h;++h){var f=e[h],d=t[f[0]],g=t[f[1]];d[0]g[0]&&l.push(new i(g,d,m,h),new i(d,g,v,h))}l.sort(o);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],h=0,_=l.length;_>h;++h){var w=l[h],M=w.type;M===p?s(x,b,t,w.a,w.idx):M===m?u(b,t,w):c(b,t,w)}return x}var f=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,v=1,m=2;e.exports=h},{"binary-search-bounds":68,"robust-orientation":439}],67:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;i>n;n+=2)if(t[n-1]===e&&t[n]===r)return t[n-1]=t[i-2],t[n]=t[i-1],void(t.length=i-2)}function o(t,e){for(var r=new Array(t),i=0;t>i;++i)r[i]=[];return new n(r,e)}var a=t("binary-search-bounds");e.exports=o;var s=n.prototype;s.isConstraint=function(){function t(t,e){return t[0]-e[0]||t[1]-e[1]}var e=[0,0];return function(r,n){return e[0]=Math.min(r,n),e[1]=Math.max(r,n),a.eq(this.edges,e,t)>=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;i>n;n+=2)if(r[n]===t)return r[n-1];return-1},s.flip=function(t,e){var r=this.opposite(t,e),n=this.opposite(e,t);this.removeTriangle(t,e,r),this.removeTriangle(e,t,n),this.addTriangle(t,n,r),this.addTriangle(e,r,n)},s.edges=function(){for(var t=this.stars,e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;o+=2)e.push([i[o],i[o+1]]);return e},s.cells=function(){for(var t=this.stars,e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;o+=2){var s=i[o],l=i[o+1];r>>1,x=a[m]"];return i?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){var o=new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""));return o()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],69:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-2,"]"].join("")}return e}function o(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function a(t,e){if("m"===t.charAt(0)){if("w"===e.charAt(0)){var r=t.split("[");return["w",e.substr(1),"m",r[0].substr(1)].join("")}return["prod(",t,",",e,")"].join("")}return a(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",a(t[0][0],t[1][1]),",",a(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;rn;++n)r.push(["prod(m",t,"[",n,"],m",t,"[",n,"])"].join(""));return o(r)}function c(t){for(var e=[],r=[],a=i(t),s=0;t>s;++s)a[0][s]="1",a[t-1][s]="w"+s;for(var s=0;t>s;++s)0===(1&s)?e.push.apply(e,l(n(a,s))):r.push.apply(r,l(n(a,s)));for(var c=o(e),h=o(r),f="exactInSphere"+t,d=[],s=0;t>s;++s)d.push("m"+s);for(var p=["function ",f,"(",d.join(),"){"],s=0;t>s;++s){p.push("var w",s,"=",u(s,t),";");for(var v=0;t>v;++v)v!==s&&p.push("var w",s,"m",v,"=scale(w",s,",m",v,"[0]);")}p.push("var p=",c,",n=",h,",d=diff(p,n);return d[d.length-1];}return ",f);var x=new Function("sum","diff","prod","scale",p.join(""));return x(g,y,m,b)}function h(){return 0}function f(){return 0}function d(){return 0}function p(t){var e=_[t.length];return e||(e=_[t.length]=c(t.length)),e.apply(void 0,t)}function v(){for(;_.length<=x;)_.push(c(_.length));for(var t=[],r=["slow"],n=0;x>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function testInSphere(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;x>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i=n;++n)e.exports[n]=_[n]}var m=t("two-product"),g=t("robust-sum"),y=t("robust-subtract"),b=t("robust-scale"),x=6,_=[h,f,d];v()},{"robust-scale":440,"robust-subtract":441,"robust-sum":442,"two-product":456}],70:[function(t,e,r){"use strict";function n(t){var e=x(t),r=b(y(e),t);return 0>r?[e,w(e,1/0)]:r>0?[w(e,-(1/0)),e]:[e,e]}function i(t,e){for(var r=new Array(e.length),n=0;n=t.length)return a[e-t.length];var r=t[e];return[y(r[0]),y(r[1])]}for(var a=[],s=0;s=0;--s){var v=n[s],u=v[0],m=e[u],g=m[0],x=m[1],w=t[g],k=t[x];if((w[0]-k[0]||w[1]-k[1])<0){var A=g;g=x,x=A}m[0]=g;var T,E=m[1]=v[1];for(i&&(T=m[2]);s>0&&n[s-1][0]===u;){var v=n[--s],S=v[1];i?e.push([E,S,T]):e.push([E,S]),E=S}i?e.push([E,x,T]):e.push([E,x])}return a}function u(t,e,r){for(var i=t.length+e.length,o=new v(i),a=r,s=0;ss;++s){var p=o.find(s);p===s?(d[s]=h,t[h++]=t[s]):(f=!1,d[s]=-1)}if(t.length=h,f)return null;for(var s=0;i>s;++s)d[s]<0&&(d[s]=d[o.find(s)]);return d}function c(t,e){return t[0]-e[0]||t[1]-e[1]}function h(t,e){var r=t[0]-e[0]||t[1]-e[1];return r?r:t[2]e[2]?1:0}function f(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0}function p(t,e,r){var n,i=!1;if(r){n=e;for(var o=new Array(e.length),a=0;a0?r=r.shln(h):0>h&&(c=c.shln(-h)),l(r,c)}var i=t("./is-rat"),o=t("./lib/is-bn"),a=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":74,"./is-rat":76,"./lib/is-bn":80,"./lib/num-to-bn":81,"./lib/rationalize":82,"./lib/str-to-bn":83}],76:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":80}],77:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":85}],78:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;e>i;i++){var o=r[i];n+=o*Math.pow(67108864,i)}return t.sign?-n:n}e.exports=n},{}],79:[function(t,e,r){"use strict";function n(t){var e=o(i.lo(t));if(32>e)return e;var r=o(i.hi(t));return r>20?52:r+32}var i=t("double-bits"),o=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":51,"double-bits":96}],80:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":85}],81:[function(t,e,r){"use strict";function n(t){var e=o.exponent(t);return 52>e?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),o=t("double-bits");e.exports=n},{"bn.js":85,"double-bits":96}],82:[function(t,e,r){"use strict";function n(t,e){var r=o(t),n=o(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];0>n&&(t=t.neg(),e=e.neg());var a=t.gcd(e);return a.cmpn(1)?[t.div(a),e.div(a)]:[t,e]}var i=t("./num-to-bn"),o=t("./bn-sign");e.exports=n},{"./bn-sign":77,"./num-to-bn":81}],83:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":85}],84:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":82}],85:[function(t,e,r){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==e&&"be"!==e||(r=e,e=10),void(null!==t&&this._init(t||0,e||10,r||"be")))}function o(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;i>o;o++){var a=t.charCodeAt(o)-48;n<<=4,n|=a>=49&&54>=a?a-49+10:a>=17&&22>=a?a-17+10:15&a}return n}function a(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;o>a;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}function s(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function u(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function c(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function h(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function f(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function d(t){f.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&36>=e),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){0>t&&(this.sign=!0,t=-t),67108864>t?(this.words=[67108863&t],this.length=1):4503599627370496>t?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(9007199254740992>t),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var s=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[a]|=s<>>26-o&67108863,o+=24,o>=26&&(o-=26,a++)}else if("le"===n)for(var i=0,a=0;i>>26-o&67108863,o+=24,o>=26&&(o-=26,a++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6){var a=o(t,r,r+6);this.words[i]|=a<>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){var a=o(t,e,r+6);this.words[i]|=a<>>26-n&4194303}this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;67108863>=i;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,l=Math.min(o,o-s)+r,u=0,c=r;l>c;c+=n)u=a(t,c,c+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){for(var h=1,u=a(t,c,t.length,e),c=0;s>c;c++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?""};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,o=0,a=0;a>>24-i&16777215,n=0!==o||a!==this.length-1?p[6-l.length]+l+n:l+n,i+=2,i>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&36>=t){var u=v[t],c=m[t],n="",h=this.clone();for(h.sign=!1;0!==h.cmpn(0);){var f=h.modn(c).toString(t);h=h.idivn(c),n=0!==h.cmpn(0)?p[u-f.length]+f+n:f+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(t){this.strip();var e=new Array(this.byteLength());e[0]=0;var r=this.clone();if("le"!==t)for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[e.length-n-1]=i}else for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[n]=i}return e},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},i.prototype.bitLength=function(){var t=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function(t){this.sign=this.sign||t.sign;var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26}for(;0!==i&&o>>26}if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e}for(;0!==o&&a>26,this.words[a]=67108863&e}if(0===o&&a>>26,o=67108863&r,a=Math.min(n,t.length-1),s=Math.max(0,n-this.length+1);a>=s;s++){var l=n-s,u=0|this.words[l],c=0|t.words[s],h=u*c,f=67108863&h;i=i+(h/67108864|0)|0,f=f+o|0,o=67108863&f,i=i+(f>>>26)|0}e.words[n]=o,r=i}return 0!==r?e.words[n]=r:e.length--,e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i=l;l++){var u=i-l,c=0|this.words[u],h=0|t.words[l],f=c*h,d=67108863&f;o=o+(f/67108864|0)|0,d=d+a|0,a=67108863&d,o=o+(d>>>26)|0,n+=o>>>26,o&=67108863}e.words[i]=a,r=o,o=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,o=0,a=Math.min(n,r-1),s=Math.max(0,n-e+1);a>=s;s++){var l=n-s,u=this.words[l],c=t.words[s],h=u*c,f=67108863&h;i+=h/67108864|0,f+=o,o=67108863&f,i+=f>>>26}this.words[n]=o,this.words[n+1]+=i,i=0}for(var i=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var o=0,a=0;a>>26-e}o&&(this.words[a]=o,this.length++)}if(0!==n){for(var a=this.length-1;a>=0;a--)this.words[a+n]=this.words[a];for(var a=0;n>a;a++)this.words[a]=0;this.length+=n}return this.strip()},i.prototype.ishrn=function(t,e,n){r("number"==typeof t&&t>=0);var i;i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<u;u++)l.words[u]=this.words[u];l.length=a}if(0===a);else if(this.length>a){this.length-=a;for(var u=0;u=0&&(0!==c||u>=i);u--){var h=this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<t?this.isubn(-t):this.sign?1===this.length&&this.words[0]=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),0>t)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&l}for(;i>26,this.words[i+n]=67108863&l}if(0===s)return this.strip();r(-1===s),s=0;for(var i=0;i>26,this.words[i]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),o=t,a=o.words[o.length-1],s=this._countBits(a);r=26-s,0!==r&&(o=o.shln(r),n.ishln(r),a=o.words[o.length-1]);var l,u=n.length-o.length;if("mod"!==e){l=new i(null),l.length=u+1,l.words=new Array(l.length);for(var c=0;c=0;f--){var d=67108864*n.words[o.length+f]+n.words[o.length+f-1];for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,f);n.sign;)d--,n.sign=!1,n._ishlnsubmul(o,1,f),0!==n.cmpn(0)&&(n.sign=!n.sign);l&&(l.words[f]=d)}return l&&l.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:l?l:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,o,a=this.neg().divmod(t,e);return"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=0===a.mod.cmpn(0)?a.mod:t.sub(a.mod)),{div:n,mod:o}}if(!this.sign&&t.sign){var n,a=this.divmod(t.neg(),e);return"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),o=r.cmp(n);return 0>o||1===i&&0===o?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(67108863>=t);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(67108863>=t);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++u;for(var c=n.clone(),h=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),o.isEven()&&a.isEven()?(o.ishrn(1),a.ishrn(1)):(o.iadd(c).ishrn(1),a.isub(h).ishrn(1));for(;n.isEven();)n.ishrn(1),s.isEven()&&l.isEven()?(s.ishrn(1),l.ishrn(1)):(s.iadd(c).ishrn(1),l.isub(h).ishrn(1));e.cmp(n)>=0?(e.isub(n),o.isub(s),a.isub(l)):(n.isub(e),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:n.ishln(u)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var o=new i(1),a=new i(0),s=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);for(;n.isEven();)n.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a)):(n.isub(e),a.isub(o))}return 0===e.cmpn(1)?o:a},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(0>i){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<o;o++)this.words[o]=0;return this.words[n]|=i,this.length=n+1,this}for(var a=i,o=n;0!==a&&o>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},i.prototype.cmpn=function(t){var e=0>t;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip();var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:t>n?-1:1}return this.sign&&(r=-r),r},i.prototype.cmp=function(t){if(this.sign&&!t.sign)return-1;if(!this.sign&&t.sign)return 1;var e=this.ucmp(t);return this.sign?-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){i>n?e=-1:n>i&&(e=1);break}}return e},i.red=function(t){return new f(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},s.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},s.prototype.split=function(t,e){t.ishrn(this.n,0,e)},s.prototype.imulK=function(t){return t.imul(this.k)},n(l,s),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;n>i;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];e.words[e.length++]=o&r;for(var i=10;i>>22,o=a}t.words[i-10]=o>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function y(t){if(g[t])return g[t];var y;if("k256"===t)y=new l;else if("p224"===t)y=new u;else if("p192"===t)y=new c;else{if("p25519"!==t)throw new Error("Unknown prime "+t);y=new h}return g[t]=y,y},f.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},f.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},f.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},f.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},f.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},f.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},f.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},f.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},f.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},f.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},f.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},f.prototype.isqr=function(t){return this.imul(t,t)},f.prototype.sqr=function(t){return this.mul(t,t)},f.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),o=this.pow(t,n);return o}for(var a=this.m.subn(1),s=0;0!==a.cmpn(0)&&0===a.andln(1);)s++,a.ishrn(1);r(0!==a.cmpn(0));var l=new i(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,a),o=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),p=s;0!==d.cmp(l);){for(var v=d,m=0;0!==v.cmp(l);m++)v=v.redSqr();r(p>m);var g=this.pow(f,new i(1).ishln(p-m-1));o=o.redMul(g),f=g.redSqr(),d=d.redMul(f),p=m}return o},f.prototype.invm=function(t){var e=t._invmp(this.m);return e.sign?(e.sign=!1,this.imod(e).redNeg()):this.imod(e)},f.prototype.pow=function(t,e){var r=[];if(0===e.cmpn(0))return new i(1);for(var n=e.clone();0!==n.cmpn(0);)r.push(n.andln(1)),n.ishrn(1);for(var o=t,a=0;a=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},d.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).ishrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},d.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],86:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":77}],87:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":82}],88:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),a=n.div,s=i(a),l=n.mod;if(0===l.cmpn(0))return s;if(s){var u=o(s)+4,c=i(l.shln(u).divRound(r));return 0>s&&(c=-c),s+c*Math.pow(2,-u)}var h=r.bitLength()-l.bitLength()+53,c=i(l.shln(h).divRound(r));return 1023>h?c*Math.pow(2,-h):(c*=Math.pow(2,-1023),c*Math.pow(2,1023-h))}var i=t("./lib/bn-to-num"),o=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":78,"./lib/ctz":79}],89:[function(t,e,r){"use strict";function n(t,e){for(var r=0;t>r;++r)if(!(e[r]<=e[r+t]))return!0;return!1}function i(t,e,r,i){for(var o=0,a=0,s=0,l=t.length;l>s;++s){var u=t[s];if(!n(e,u)){for(var c=0;2*e>c;++c)r[o++]=u[c];i[a++]=s}}return a}function o(t,e,r,n){var o=t.length,a=e.length;if(!(0>=o||0>=a)){var s=t[0].length>>>1;if(!(0>=s)){var l,u=h.mallocDouble(2*s*o),c=h.mallocInt32(o);if(o=i(t,s,u,c),o>0){if(1===s&&n)f.init(o),l=f.sweepComplete(s,r,0,o,u,c,0,o,u,c);else{var p=h.mallocDouble(2*s*a),v=h.mallocInt32(a);a=i(e,s,p,v),a>0&&(f.init(o+a),l=1===s?f.sweepBipartite(s,r,0,o,u,c,0,a,p,v):d(s,r,n,o,u,c,a,p,v),h.free(p),h.free(v))}h.free(u),h.free(c)}return l}}}function a(t,e){c.push([t,e])}function s(t){return c=[],o(t,t,a,!0),c}function l(t,e){return c=[],o(t,e,a,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?o(t,t,e,!0):l(t,e);case 3:return o(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,h=t("typedarray-pool"),f=t("./lib/sweep"),d=t("./lib/intersect"); -},{"./lib/intersect":91,"./lib/sweep":95,"typedarray-pool":458}],90:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",u,"=2*",o,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+h+";++i,"+p+"+="+u+"){var x0="+f+"["+a+"+"+p+"],x1="+f+"["+a+"+"+p+"+"+o+"],xi="+d+"[i];",M="for(var j="+v+","+b+"="+u+"*"+v+";j<"+m+";++j,"+b+"+="+u+"){var y0="+g+"["+a+"+"+b+"],"+(r?"y1="+g+"["+a+"+"+b+"+"+o+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",M):i.push(M,_,":",l),r?i.push("if(y1"+m+"-"+v+"){"),t?(e(!0,!1),a.push("}else{"),e(!1,!1)):(a.push("if("+l+"){"),e(!0,!0),a.push("}else{"),e(!0,!1),a.push("}}else{if("+l+"){"),e(!1,!0),a.push("}else{"),e(!1,!1),a.push("}")),a.push("}}return "+r);var s=i.join("")+a.join(""),u=new Function(s);return u()}var o="d",a="ax",s="vv",l="fp",u="es",c="rs",h="re",f="rb",d="ri",p="rp",v="bs",m="be",g="bb",y="bi",b="bp",x="rv",_="Q",w=[o,a,s,c,h,f,d,v,m,g,y];r.partial=i(!1),r.full=i(!0)},{}],91:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(A*r);S.lengthL&&(l.free(L),L=l.mallocDouble(i))}function i(t,e,r,n,i,o,a,s,l){var u=A*t;S[u]=e,S[u+1]=r,S[u+2]=n,S[u+3]=i,S[u+4]=o,S[u+5]=a;var c=T*t;L[c]=s,L[c+1]=l}function o(t,e,r,n,i,o,a,s,l,u,c){var h=2*t,f=l*h,d=u[f+e];t:for(var p=i,v=i*h;o>p;++p,v+=h){var m=a[v+e],g=a[v+e+t];if(!(m>d||d>g||n&&d===m)){for(var y=s[p],b=e+1;t>b;++b){var m=a[v+b],g=a[v+b+t],x=u[f+b],_=u[f+b+t];if(x>g||m>_)continue t}var w;if(w=n?r(c,y):r(y,c),void 0!==w)return w}}}function a(t,e,r,n,i,o,a,s,l,u){var c=2*t,h=s*c,f=l[h+e];t:for(var d=n,p=n*c;i>d;++d,p+=c){var v=a[d];if(v!==u){var m=o[p+e],g=o[p+e+t];if(!(m>f||f>g)){for(var y=e+1;t>y;++y){var m=o[p+y],g=o[p+y+t],b=l[h+y],x=l[h+y+t];if(b>g||m>x)continue t}var _=r(v,u);if(void 0!==_)return _}}}}function s(t,e,r,s,l,u,c,v,E){n(t,s+c);var z,I=0,P=2*t;for(i(I++,0,0,s,0,c,r?16:0,-(1/0),1/0),r||i(I++,0,0,c,0,s,1,-(1/0),1/0);I>0;){I-=1;var C=I*A,R=S[C],D=S[C+1],O=S[C+2],F=S[C+3],j=S[C+4],N=S[C+5],B=I*T,U=L[B],V=L[B+1],q=1&N,G=!!(16&N),H=l,X=u,Y=v,W=E;if(q&&(H=v,X=E,Y=l,W=u),!(2&N&&(O=_(t,R,D,O,H,X,V),D>=O)||4&N&&(D=w(t,R,D,O,H,X,U),D>=O))){var Z=O-D,K=j-F;if(G){if(y>t*Z*(Z+K)){if(z=d.scanComplete(t,R,e,D,O,H,X,F,j,Y,W),void 0!==z)return z;continue}}else{if(t*Math.min(Z,K)t*Z*K){if(z=d.scanBipartite(t,R,e,q,D,O,H,X,F,j,Y,W),void 0!==z)return z;continue}}var J=b(t,R,D,O,H,X,U,V);if(J>D)if(m>t*(J-D)){if(z=f(t,R+1,e,D,J,H,X,F,j,Y,W),void 0!==z)return z}else if(R===t-2){if(z=q?d.sweepBipartite(t,e,F,j,Y,W,D,J,H,X):d.sweepBipartite(t,e,D,J,H,X,F,j,Y,W),void 0!==z)return z}else i(I++,R+1,D,J,F,j,q,-(1/0),1/0),i(I++,R+1,F,j,D,J,1^q,-(1/0),1/0);if(O>J){var $=p(t,R,F,j,Y,W),Q=Y[P*$+R],tt=x(t,R,$,j,Y,W,Q);if(j>tt&&i(I++,R,J,O,tt,j,(4|q)+(G?16:0),Q,V),$>F&&i(I++,R,J,O,F,$,(2|q)+(G?16:0),U,Q),$+1===tt){if(z=G?a(t,R,e,J,O,H,X,$,Y,W[$]):o(t,R,e,q,J,O,H,X,$,Y,W[$]),void 0!==z)return z}else if(tt>$){var et;if(G){if(et=M(t,R,J,O,H,X,Q),et>J){var rt=x(t,R,J,et,H,X,Q);if(R===t-2){if(rt>J&&(z=d.sweepComplete(t,e,J,rt,H,X,$,tt,Y,W),void 0!==z))return z;if(et>rt&&(z=d.sweepBipartite(t,e,rt,et,H,X,$,tt,Y,W),void 0!==z))return z}else rt>J&&i(I++,R+1,J,rt,$,tt,16,-(1/0),1/0),et>rt&&(i(I++,R+1,rt,et,$,tt,0,-(1/0),1/0),i(I++,R+1,$,tt,rt,et,1,-(1/0),1/0))}}else et=q?k(t,R,J,O,H,X,Q):M(t,R,J,O,H,X,Q),et>J&&(R===t-2?z=q?d.sweepBipartite(t,e,$,tt,Y,W,J,et,H,X):d.sweepBipartite(t,e,J,et,H,X,$,tt,Y,W):(i(I++,R+1,J,et,$,tt,q,-(1/0),1/0),i(I++,R+1,$,tt,J,et,1^q,-(1/0),1/0)))}}}}}e.exports=s;var l=t("typedarray-pool"),u=t("bit-twiddle"),c=t("./brute"),h=c.partial,f=c.full,d=t("./sweep"),p=t("./median"),v=t("./partition"),m=128,g=1<<22,y=1<<22,b=v("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),x=v("lo===p0",["p0"]),_=v("lol;++l,s+=a)for(var u=i[s],c=l,h=a*(l-1);c>r&&i[h+e]>u;--c,h-=a){for(var f=h,d=h+a,p=0;a>p;++p,++f,++d){var v=i[f];i[f]=i[d],i[d]=v}var m=o[c];o[c]=o[c-1],o[c-1]=m}}function i(t,e,r,i,o,l){if(r+1>=i)return r;for(var u=r,c=i,h=i+r>>>1,f=2*t,d=h,p=o[f*h+e];c>u;){if(s>c-u){n(t,e,u,c,o,l),p=o[f*h+e];break}var v=c-u,m=Math.random()*v+u|0,g=o[f*m+e],y=Math.random()*v+u|0,b=o[f*y+e],x=Math.random()*v+u|0,_=o[f*x+e];b>=g?_>=b?(d=y,p=b):g>=_?(d=m,p=g):(d=x,p=_):b>=_?(d=y,p=b):_>=g?(d=m,p=g):(d=x,p=_);for(var w=f*(c-1),M=f*d,k=0;f>k;++k,++w,++M){var A=o[w];o[w]=o[M],o[M]=A}var T=l[c-1];l[c-1]=l[d],l[d]=T,d=a(t,e,u,c-1,o,l,p);for(var w=f*(c-1),M=f*d,k=0;f>k;++k,++w,++M){var A=o[w];o[w]=o[M],o[M]=A}var T=l[c-1];if(l[c-1]=l[d],l[d]=T,d>h){for(c=d-1;c>u&&o[f*(c-1)+e]===p;)c-=1;c+=1}else{if(!(h>d))break;for(u=d+1;c>u&&o[f*u+e]===p;)u+=1}}return a(t,e,r,h,o,l,o[f*h+e])}e.exports=i;var o=t("./partition"),a=o("lo=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],94:[function(t,e,r){"use strict";function n(t,e){4*f>=e?i(0,e-1,t):h(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;e>=i;++i){for(var o=r[n++],a=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(o>u)break;if(u===o&&a>c)break;r[l]=u,r[l+1]=c,l-=2}r[l]=o,r[l+1]=a}}function o(t,e,r){t*=2,e*=2;var n=r[t],i=r[t+1];r[t]=r[e],r[t+1]=r[e+1],r[e]=n,r[e+1]=i}function a(t,e,r){t*=2,e*=2,r[t]=r[e],r[t+1]=r[e+1]}function s(t,e,r,n){t*=2,e*=2,r*=2;var i=n[t],o=n[t+1];n[t]=n[e],n[t+1]=n[e+1],n[e]=n[r],n[e+1]=n[r+1],n[r]=i,n[r+1]=o}function l(t,e,r,n,i){t*=2,e*=2,i[t]=i[e],i[e]=r,i[t+1]=i[e+1],i[e+1]=n}function u(t,e,r){t*=2,e*=2;var n=r[t],i=r[e];return i>n?!1:n===i?r[t+1]>r[e+1]:!0}function c(t,e,r,n){t*=2;var i=n[t];return e>i?!0:i===e?n[t+1]>1,m=v-n,g=v+n,y=d,b=m,x=v,_=g,w=p,M=t+1,k=e-1,A=0;u(y,b,r)&&(A=y,y=b,b=A),u(_,w,r)&&(A=_,_=w,w=A),u(y,x,r)&&(A=y,y=x,x=A),u(b,x,r)&&(A=b,b=x,x=A),u(y,_,r)&&(A=y,y=_,_=A),u(x,_,r)&&(A=x,x=_,_=A),u(b,w,r)&&(A=b,b=w,w=A),u(b,x,r)&&(A=b,b=x,x=A),u(_,w,r)&&(A=_,_=w,w=A);for(var T=r[2*b],E=r[2*b+1],S=r[2*_],L=r[2*_+1],z=2*y,I=2*x,P=2*w,C=2*d,R=2*v,D=2*p,O=0;2>O;++O){var F=r[z+O],j=r[I+O],N=r[P+O];r[C+O]=F,r[R+O]=j,r[D+O]=N}a(m,t,r),a(g,e,r);for(var B=M;k>=B;++B)if(c(B,T,E,r))B!==M&&o(B,M,r),++M;else if(!c(B,S,L,r))for(;;){if(c(k,S,L,r)){c(k,T,E,r)?(s(B,M,k,r),++M,--k):(o(B,k,r),--k);break}if(--k=M-2-t?i(t,M-2,r):h(t,M-2,r),f>=e-(k+2)?i(k+2,e,r):h(k+2,e,r),f>=k-M?i(M,k,r):h(M,k,r)}e.exports=n;var f=32},{}],95:[function(t,e,r){"use strict";function n(t){var e=h.nextPow2(t);v.lengthM;++M){var k=s[M],A=b*M;_[p++]=a[A+x],_[p++]=-(k+1),_[p++]=a[A+w],_[p++]=k}for(var M=l;u>M;++M){var k=h[M]+d,T=b*M;_[p++]=c[T+x],_[p++]=-k,_[p++]=c[T+w],_[p++]=k}var E=p>>>1;f(_,E);for(var S=0,L=0,M=0;E>M;++M){var z=0|_[2*M+1];if(z>=d)z=z-d|0,i(g,y,L--,z);else if(z>=0)i(v,m,S--,z);else if(-d>=z){z=-z-d|0;for(var I=0;S>I;++I){var P=e(v[I],z);if(void 0!==P)return P}o(g,y,L++,z)}else{z=-z-1|0;for(var I=0;L>I;++I){var P=e(z,g[I]);if(void 0!==P)return P}o(v,m,S++,z)}}}function s(t,e,r,n,a,s,l,u,c,h){for(var d=0,p=2*t,w=t-1,M=p-1,k=r;n>k;++k){var A=s[k]+1<<1,T=p*k;_[d++]=a[T+w],_[d++]=-A,_[d++]=a[T+M],_[d++]=A}for(var k=l;u>k;++k){var A=h[k]+1<<1,E=p*k;_[d++]=c[E+w],_[d++]=1|-A,_[d++]=c[E+M],_[d++]=1|A}var S=d>>>1;f(_,S);for(var L=0,z=0,I=0,k=0;S>k;++k){var P=0|_[2*k+1],C=1&P;if(S-1>k&&P>>1===_[2*k+3]>>1&&(C=2,k+=1),0>P){for(var R=-(P>>1)-1,D=0;I>D;++D){var O=e(b[D],R);if(void 0!==O)return O}if(0!==C)for(var D=0;L>D;++D){var O=e(v[D],R);if(void 0!==O)return O}if(1!==C)for(var D=0;z>D;++D){var O=e(g[D],R);if(void 0!==O)return O}0===C?o(v,m,L++,R):1===C?o(g,y,z++,R):2===C&&o(b,x,I++,R)}else{var R=(P>>1)-1;0===C?i(v,m,L--,R):1===C?i(g,y,z--,R):2===C&&i(b,x,I--,R)}}}function l(t,e,r,n,a,s,l,u,c,h,p,g){var y=0,b=2*t,x=e,w=e+t,M=1,k=1;n?k=d:M=d;for(var A=a;s>A;++A){var T=A+M,E=b*A;_[y++]=l[E+x],_[y++]=-T,_[y++]=l[E+w],_[y++]=T}for(var A=c;h>A;++A){var T=A+k,S=b*A;_[y++]=p[S+x],_[y++]=-T}var L=y>>>1;f(_,L);for(var z=0,A=0;L>A;++A){var I=0|_[2*A+1];if(0>I){var T=-I,P=!1;if(T>=d?(P=!n,T-=d):(P=!!n,T-=1),P)o(v,m,z++,T);else{var C=g[T],R=b*T,D=p[R+e+1],O=p[R+e+1+t];t:for(var F=0;z>F;++F){var j=v[F],N=b*j;if(!(OB;++B)if(p[R+B+t]y;++y){var b=y+d,x=p*y;_[h++]=o[x+m],_[h++]=-b,_[h++]=o[x+g],_[h++]=b}for(var y=s;l>y;++y){var b=y+1,w=p*y;_[h++]=u[w+m],_[h++]=-b}var M=h>>>1;f(_,M);for(var k=0,y=0;M>y;++y){var A=0|_[2*y+1];if(0>A){var b=-A;if(b>=d)v[k++]=b-d;else{b-=1;var T=c[b],E=p*b,S=u[E+e+1],L=u[E+e+1+t];t:for(var z=0;k>z;++z){var I=v[z],P=a[I];if(P===T)break;var C=p*I;if(!(LR;++R)if(u[E+R+t]=0;--z)if(v[z]===b){for(var R=z+1;k>R;++R)v[R-1]=v[R];break}--k}}}e.exports={init:n,sweepBipartite:a,sweepComplete:s,scanBipartite:l,scanComplete:u};var c=t("typedarray-pool"),h=t("bit-twiddle"),f=t("./sort"),d=1<<28,p=1024,v=c.mallocInt32(p),m=c.mallocInt32(p),g=c.mallocInt32(p),y=c.mallocInt32(p),b=c.mallocInt32(p),x=c.mallocInt32(p),_=c.mallocDouble(8*p)},{"./sort":94,"bit-twiddle":51,"typedarray-pool":458}],96:[function(t,e,r){(function(t){function r(t,e){return d[0]=t,d[1]=e,f[0]}function n(t){return f[0]=t,d[0]}function i(t){return f[0]=t,d[1]}function o(t,e){return d[1]=t,d[0]=e,f[0]}function a(t){return f[0]=t,d[1]}function s(t){return f[0]=t,d[0]}function l(t,e){return p.writeUInt32LE(t,0,!0),p.writeUInt32LE(e,4,!0),p.readDoubleLE(0,!0)}function u(t){return p.writeDoubleLE(t,0,!0),p.readUInt32LE(0,!0)}function c(t){return p.writeDoubleLE(t,0,!0),p.readUInt32LE(4,!0)}var h=!1;if("undefined"!=typeof Float64Array){var f=new Float64Array(1),d=new Uint32Array(f.buffer);f[0]=1,h=!0,1072693248===d[1]?(e.exports=function(t){return f[0]=t,[d[0],d[1]]},e.exports.pack=r,e.exports.lo=n,e.exports.hi=i):1072693248===d[0]?(e.exports=function(t){return f[0]=t,[d[1],d[0]]},e.exports.pack=o,e.exports.lo=a,e.exports.hi=s):h=!1}if(!h){var p=new t(8);e.exports=function(t){return p.writeDoubleLE(t,0,!0),[p.readUInt32LE(0,!0),p.readUInt32LE(4,!0)]},e.exports.pack=l,e.exports.lo=u,e.exports.hi=c}e.exports.sign=function(t){return e.exports.hi(t)>>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:53}],97:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return 0>e?-o:o;var r=i.hi(t),n=i.lo(t);return e>t==t>0?n===a?(r+=1,n=0):n+=1:0===n?(n=a,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),o=Math.pow(2,-1074),a=-1>>>0;e.exports=n},{"double-bits":96}],98:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),o=0;r>o;++o)n[o]=i(t[o],e[o]);return n}var i=t("big-rat/add");e.exports=n},{"big-rat/add":72}],99:[function(t,e,r){"use strict";function n(t){for(var e=new Array(t.length),r=0;rs;++s)a[s]=o(t[s],r);return a}var i=t("big-rat"),o=t("big-rat/mul");e.exports=n},{"big-rat":75,"big-rat/mul":84}],101:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),o=0;r>o;++o)n[o]=i(t[o],e[o]);return n}var i=t("big-rat/sub");e.exports=n},{"big-rat/sub":87}],102:[function(t,e,r){"use strict";function n(t,e,r,n){for(var i=0;2>i;++i){var o=t[i],a=e[i],s=Math.min(o,a),l=Math.max(o,a),u=r[i],c=n[i],h=Math.min(u,c),f=Math.max(u,c);if(s>f||h>l)return!1}return!0}function i(t,e,r,i){var a=o(t,r,i),s=o(e,r,i);if(a>0&&s>0||0>a&&0>s)return!1;var l=o(r,t,e),u=o(i,t,e);return l>0&&u>0||0>l&&0>u?!1:0===a&&0===s&&0===l&&0===u?n(t,e,r,i):!0}e.exports=i;var o=t("robust-orientation")[3]},{"robust-orientation":439}],103:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n;var i=n.prototype;Object.defineProperty(i,"length",{get:function(){return this.roots.length}}),i.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},i.find=function(t){for(var e=t,r=this.roots;r[t]!==t;)t=r[t];for(;r[e]!==t;){var n=r[e];r[e]=t,e=n}return t},i.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,o=this.roots,a=i[r],s=i[n];s>a?o[r]=n:a>s?o[n]=r:(o[n]=r,++i[r])}}},{}],104:[function(t,e,r){(function(t){var r=function(){"use strict";function e(r,n,i,o){function s(r,i){if(null===r)return null;if(0==i)return r;var l,f;if("object"!=typeof r)return r;if(e.__isArray(r))l=[];else if(e.__isRegExp(r))l=new RegExp(r.source,a(r)),r.lastIndex&&(l.lastIndex=r.lastIndex);else if(e.__isDate(r))l=new Date(r.getTime());else{if(h&&t.isBuffer(r))return l=new t(r.length),r.copy(l),l;"undefined"==typeof o?(f=Object.getPrototypeOf(r),l=Object.create(f)):(l=Object.create(o),f=o)}if(n){var d=u.indexOf(r);if(-1!=d)return c[d];u.push(r),c.push(l)}for(var p in r){var v;f&&(v=Object.getOwnPropertyDescriptor(f,p)),v&&null==v.set||(l[p]=s(r[p],i-1))}return l}var l;"object"==typeof n&&(i=n.depth,o=n.prototype,l=n.filter,n=n.circular);var u=[],c=[],h="undefined"!=typeof t;return"undefined"==typeof n&&(n=!0),"undefined"==typeof i&&(i=1/0),s(r,i)}function r(t){return Object.prototype.toString.call(t)}function n(t){return"object"==typeof t&&"[object Date]"===r(t)}function i(t){return"object"==typeof t&&"[object Array]"===r(t)}function o(t){return"object"==typeof t&&"[object RegExp]"===r(t)}function a(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return e.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},e.__objToStr=r,e.__isDate=n,e.__isArray=i,e.__isRegExp=o,e.__getRegExpFlags=a,e}();"object"==typeof e&&e.exports&&(e.exports=r)}).call(this,t("buffer").Buffer)},{buffer:53}],105:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:0,rgb:[255,255,255,1]}]}},{}],106:[function(t,e,r){"use strict";function n(t){for(var e,r="#",n=0;3>n;++n)e=t[n],e=e.toString(16),r+=("00"+e).substr(e.length);return r}function i(t){return"rgba("+t.join(",")+")"}var o=t("arraytools"),a=t("clone"),s=t("./colorScales");e.exports=function(t){var e,r,l,u,c,h,f,d,p,v,m,g,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",f=t.colormap,f||(f="jet"),"string"==typeof f){if(f=f.toLowerCase(),!s[f])throw Error(f+" not a supported colorscale");h=a(s[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=a(f)}if(h.length>p)throw new Error(f+" map requires nshades to be at least size "+h.length);for(m=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:a(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),m[0]<0&&(m[0]=0),m[1]<0&&(m[0]=0),m[0]>1&&(m[0]=1),m[1]>1&&(m[0]=1),y=0;y=0&&r[3]<=1||(r[3]=m[0]+(m[1]-m[0])*g);for(y=0;yx;++x)if(i=y[x]-b[x])return i;return 0}}e.exports=i;var o=Math.min},{}],108:[function(t,e,r){"use strict";function n(t){var e=t.length;if(0===e)return[];if(1===e)return[[0]];var r=t[0].length;return 0===r?[]:1===r?i(t):2===r?o(t):a(t,r)}var i=t("./lib/ch1d"),o=t("./lib/ch2d"),a=t("./lib/chnd");e.exports=n},{"./lib/ch1d":109,"./lib/ch2d":110,"./lib/chnd":111}],109:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0,n=1;nt[r][0]&&(r=n);return r>e?[[e],[r]]:e>r?[[r],[e]]:[[e]]}e.exports=n},{}],110:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(2>=r)return[];for(var n=new Array(r),o=e[r-1],a=0;r>a;++a){var s=e[a];n[a]=[o,s],o=s}return n}e.exports=n;var i=t("monotone-convex-hull-2d")},{"monotone-convex-hull-2d":113}],111:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),i=0;ii;++i)e.indexOf(i)<0&&(n[o++]=t[i]);return n}function i(t,e){for(var r=t.length,n=e.length,i=0;r>i;++i)for(var o=t[i],a=0;as)o[a]=e[s];else{s-=n;for(var l=0;n>l;++l)s>=e[l]&&(s+=1);o[a]=s}}return t}function o(t,e){try{return a(t,!0)}catch(r){var o=s(t);if(o.length<=e)return[];var l=n(t,o),u=a(l,!0);return i(u,o)}}e.exports=o;var a=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":112,"incremental-convex-hull":241}],112:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(e+1),n=0;n=i;++i){for(var a=new Array(e),s=0;e>s;++s)a[s]=Math.pow(i+1-n,s);r[i]=a}var l=o.apply(void 0,r);if(l)return!0}return!1}function i(t){var e=t.length;if(0===e)return[];if(1===e)return[0];for(var r=t[0].length,i=[t[0]],o=[0],a=1;e>a;++a)if(i.push(t[a]),n(i,r)){if(o.push(a),o.length===r+1)return o}else i.pop();return o}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":439}],113:[function(t,e,r){"use strict";function n(t){var e=t.length;if(3>e){for(var r=new Array(e),n=0;e>n;++n)r[n]=n;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:r}for(var o=new Array(e),n=0;e>n;++n)o[n]=n;o.sort(function(e,r){var n=t[e][0]-t[r][0];return n?n:t[e][1]-t[r][1]});for(var a=[o[0],o[1]],s=[o[0],o[1]],n=2;e>n;++n){for(var l=o[n],u=t[l],c=a.length;c>1&&i(t[a[c-2]],t[a[c-1]],u)<=0;)c-=1,a.pop();for(a.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+a.length-2),h=0,n=0,f=a.length;f>n;++n)r[h++]=a[n];for(var d=s.length-2;d>0;--d)r[h++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":439}],114:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CPV:"verde",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bdr|\\bdr.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",COG:"^(?!.*\\bdem)(?!.*\\bdr)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CZE:"^(?=.*rep).*czech|czechia|bohemia",CSK:"czechoslovakia",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"ireland",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat).*\\bkorea|^(?=.*people).*\\bkorea|^(?=.*north).*\\bkorea|dprk",KOR:"^(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MKD:"macedonia|fyrom",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"micronesia",MDA:"moldov|b(a|e)ssarabia",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"\\bs\\w*.?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa",TJK:"tajik",TZA:"tanzania",THA:"thailand|\\bsiam",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",USA:"united.?states|\\bu\\.?s\\.?a\\.?\\b|\\bu\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],115:[function(t,e,r){"use strict";function n(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function i(t){var e=new n;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===a){if(e.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(i),ir.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>r.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>r.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,o(e)}var o=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":117}],116:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=t.length,a=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,h=0;for(n=0;o>n;++n)u.push(["i",n,"=0"].join(""));for(i=0;a>i;++i)for(n=0;o>n;++n)h=c,c=t[n],0===n?u.push(["d",i,"s",n,"=t",i,"p",c].join("")):u.push(["d",i,"s",n,"=(t",i,"p",c,"-s",h,"*t",i,"p",h,")"].join(""));for(l.push("var "+u.join(",")),n=o-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"n;++n){for(h=c,c=t[n],i=0;a>i;++i)l.push(["p",i,"+=d",i,"s",n].join(""));s&&(n>0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var o=e.length,a=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],c=0;a>c;++c)u.push(["var offset",c,"=p",c].join(""));for(var c=t;o>c;++c)u.push(["for(var j"+c+"=SS[",e[c],"]|0;j",c,">0;){"].join("")),u.push(["if(j",c,"<",s,"){"].join("")),u.push(["s",e[c],"=j",c].join("")),u.push(["j",c,"=0"].join("")),u.push(["}else{s",e[c],"=",s].join("")),u.push(["j",c,"-=",s,"}"].join("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(var c=0;a>c;++c){for(var h=["offset"+c],f=t;o>f;++f)h.push(["j",f,"*t",c,"p",e[f]].join(""));u.push(["p",c,"=(",h.join("+"),")"].join(""))}u.push(n(e,r,i));for(var c=t;o>c;++c)u.push("}");return u.join("\n")}function o(t){for(var e=0,r=t[0].length;r>e;){for(var n=1;n0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function l(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,l=new Array(t.arrayArgs.length),c=new Array(t.arrayArgs.length),h=0;hy;++y)_.push(["s",y,"=SS[",y,"]"].join(""));for(var h=0;hy;++y)_.push(["t",h,"p",y,"=t",h,"[",p[h]+y,"]"].join(""));for(var y=0;y0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),h=0;r>h;++h)w[h]="0";_.push(["index=[",w.join(","),"]"].join(""))}for(var h=0;h3&&x.push(a(t.pre,t,c));var T=a(t.body,t,c),E=o(m);r>E?x.push(i(E,m[0],t,T)):x.push(n(m[0],t,T)),t.post.body.length>3&&x.push(a(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var S=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join(""),L=new Function(["function ",S,"(",b.join(","),"){",x.join("\n"),"} return ",S].join(""));return L()}var u=t("uniq");e.exports=l},{uniq:459}],117:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var o=[],a=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],c=0;c0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+h+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[c]))),u.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+h+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;ct?-1:t>e?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function a(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);i>n;){var o=n+i>>>1;t(e[o],r)<0?n=o+1:i=o}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);i>n;){var o=n+i>>>1;t(e[o],r)>0?i=o:n=o+1}return n}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function h(){this._=Object.create(null)}function f(t){return(t+="")===Ma||t[0]===ka?ka+t:t}function d(t){return(t+="")[0]===ka?t.slice(1):t}function p(t){return f(t)in this._}function v(t){return(t=f(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(d(e));return t}function g(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function b(){this._=Object.create(null)}function x(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=Aa.length;n>r;++r){var i=Aa[r]+e;if(i in t)return i}}function M(){}function k(){}function A(t){function e(){for(var e,n=r,i=-1,o=n.length;++ir;r++)for(var i,o=t[r],a=0,s=o.length;s>a;a++)(i=o[a])&&e(i,a,r);return t}function X(t){return Ea(t,Ra),t}function Y(t){var e,r;return function(n,i,o){var a,s=t[o].update,l=s.length;for(o!=r&&(r=o,e=0),i>=e&&(e=i+1);!(a=s[e])&&++e0&&(t=t.slice(0,s));var u=Da.get(t);return u&&(t=u,l=K),s?e?i:n:e?M:o}function Z(t,e){return function(r){var n=ca.event;ca.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{ca.event=n}}}function K(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function J(t){var r=".dragsuppress-"+ ++Fa,i="click"+r,o=ca.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Oa&&(Oa="onselectstart"in t?!1:w(t.style,"userSelect")),Oa){var a=e(t).style,s=a[Oa];a[Oa]="none"}return function(t){if(o.on(r,null),Oa&&(a[Oa]=s),t){var e=function(){o.on(i,null)};o.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function $(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>ja){var o=n(t);if(o.scrollX||o.scrollY){r=ca.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=r[0][0].getScreenCTM();ja=!(a.f||a.e),r.remove()}}return ja?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function Q(){return ca.event.changedTouches[0].identifier}function tt(t){return t>0?1:0>t?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:-1>t?Ua:Math.acos(t)}function nt(t){return t>1?Ga:-1>t?-Ga:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function at(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,r){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):Mt(""+t,kt,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:0>t&&(t+=360),60>t?o+(a-o)*t/60:180>t?a:240>t?o+(a-o)*(240-t)/60:o}function i(t){return Math.round(255*n(t))}var o,a;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:0>e?0:e>1?1:e,r=0>r?0:r>1?1:r,a=.5>=r?r*(1+e):r+e-r*e,o=2*r-a,new bt(i(t+120),i(t),i(t-120))}function ht(t,e,r){return this instanceof ht?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ht?new ht(t.h,t.c,t.l):t instanceof dt?vt(t.l,t.a,t.b):vt((t=At((t=ca.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ht(t,e,r)}function ft(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Ha)*e,Math.sin(t)*e)}function dt(t,e,r){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ht?ft(t.h,t.c,t.l):At((t=bt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,i=n+e/500,o=n-r/200;return i=mt(i)*rs,n=mt(n)*ns,o=mt(o)*is,new bt(yt(3.2404542*i-1.5371385*n-.4985314*o),yt(-.969266*i+1.8760108*n+.041556*o),yt(.0556434*i-.2040259*n+1.0572252*o))}function vt(t,e,r){return t>0?new ht(Math.atan2(r,e)*Xa,Math.sqrt(e*e+r*r),t):new ht(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function gt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function bt(t,e,r){return this instanceof bt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof bt?new bt(t.r,t.g,t.b):Mt(""+t,bt,ct):new bt(t,e,r)}function xt(t){return new bt(t>>16,t>>8&255,255&t)}function _t(t){return xt(t)+""}function wt(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,r){var n,i,o,a=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Et(i[0]),Et(i[1]),Et(i[2]))}return(o=ss.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(a=(3840&o)>>4,a=a>>4|a,s=240&o,s=s>>4|s,l=15&o,l=l<<4|l):7===t.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,l=255&o)),e(a,s,l))}function kt(t,e,r){var n,i,o=Math.min(t/=255,e/=255,r/=255),a=Math.max(t,e,r),s=a-o,l=(a+o)/2;return s?(i=.5>l?s/(a+o):s/(2-a-o),n=t==a?(e-r)/s+(r>e?6:0):e==a?(r-t)/s+2:(t-e)/s+4,n*=60):(n=NaN,i=l>0&&1>l?0:n),new ut(n,i,l)}function At(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=gt((.4124564*t+.3575761*e+.1804375*r)/rs),i=gt((.2126729*t+.7151522*e+.072175*r)/ns),o=gt((.0193339*t+.119192*e+.9503041*r)/is);return dt(116*i-16,500*(n-i),200*(i-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function St(t){return"function"==typeof t?t:function(){return t}}function Lt(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),zt(e,r,t,n)}}function zt(t,e,r,n){function i(){var t,e=l.status;if(!e&&Pt(l)||e>=200&&300>e||304===e){try{t=r.call(o,l)}catch(n){return void a.error.call(o,n)}a.load.call(o,t)}else a.error.call(o,l)}var o={},a=ca.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=ca.event;ca.event=t;try{a.progress.call(o,l)}finally{ca.event=e}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(u=t,o):u},o.response=function(t){return r=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(fa(arguments)))}}),o.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),a.beforesend.call(o,l),l.send(null==n?null:n),o},o.abort=function(){return l.abort(),o},ca.rebind(o,a,"on"),null==n?o:o.get(It(n))}function It(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Pt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Ct(t,e,r){var n=arguments.length;2>n&&(e=0),3>n&&(r=Date.now());var i=r+e,o={c:t,t:i,n:null};return us?us.n=o:ls=o,us=o,cs||(hs=clearTimeout(hs),cs=1,fs(Rt)),o}function Rt(){var t=Dt(),e=Ot()-t;e>24?(isFinite(e)&&(clearTimeout(hs),hs=setTimeout(Rt,e)),cs=0):(cs=1,fs(Rt))}function Dt(){for(var t=Date.now(),e=ls;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ot(){for(var t,e=ls,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Nt(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,o=n&&r?function(t,e){for(var i=t.length,o=[],a=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[a=(a+1)%n.length];return o.reverse().join(r)}:x;return function(t){var r=ps.exec(t),n=r[1]||" ",a=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],h=r[7],f=r[8],d=r[9],p=1,v="",m="",g=!1,y=!0;switch(f&&(f=+f.substring(1)),(u||"0"===n&&"="===a)&&(u=n="0",a="="),d){case"n":h=!0,d="g";break;case"%":p=100,m="%",d="f";break;case"p":p=100,m="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(v="0"+d.toLowerCase());case"c":y=!1;case"d":g=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(v=i[0],m=i[1]),"r"!=d||f||(d="g"),null!=f&&("g"==d?f=Math.max(1,Math.min(21,f)):"e"!=d&&"f"!=d||(f=Math.max(0,Math.min(20,f)))),d=vs.get(d)||Bt;var b=u&&h;return function(t){var r=m;if(g&&t%1)return"";var i=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===s?"":s;if(0>p){var l=ca.formatPrefix(t,f);t=l.scale(t),r=l.symbol+m}else t*=p;t=d(t,f);var x,_,w=t.lastIndexOf(".");if(0>w){var M=y?t.lastIndexOf("e"):-1;0>M?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&h&&(x=o(x,1/0));var k=v.length+x.length+_.length+(b?0:i.length),A=c>k?new Array(k=c-k+1).join(n):"";return b&&(x=o(A+x,A.length?c-_.length:1/0)),i+=v,t=x+_,("<"===a?i+t+A:">"===a?A+i+t:"^"===a?A.substring(0,k>>=1)+i+t+A.substring(k):i+(b?t:A+t))+r}}}function Bt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,r){function n(e){var r=t(e),n=o(r,1);return n-e>e-r?r:n}function i(r){return e(r=t(new gs(r-1)),1),r}function o(t,r){return e(t=new gs(+t),r),t}function a(t,n,o){var a=i(t),s=[];if(o>1)for(;n>a;)r(a)%o||s.push(new Date(+a)),e(a,1);else for(;n>a;)s.push(new Date(+a)),e(a,1);return s}function s(t,e,r){try{gs=Ut;var n=new Ut;return n._=t,a(n,e,r)}finally{gs=Date}}t.floor=t,t.round=n,t.ceil=i,t.offset=o,t.range=a;var l=t.utc=qt(t);return l.floor=l,l.round=qt(n),l.ceil=qt(i),l.offset=qt(o),l.range=s,t}function qt(t){return function(e,r){try{gs=Ut;var n=new Ut;return n._=e,t(n,r)._}finally{gs=Date}}}function Gt(t){function e(t){function e(e){for(var r,i,o,a=[],s=-1,l=0;++ss;){if(n>=u)return-1;if(i=e.charCodeAt(s++),37===i){if(a=e.charAt(s++),o=L[a in bs?e.charAt(s++):a],!o||(n=o(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=M.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){k.lastIndex=0;var n=k.exec(e.slice(r));return n?(t.m=A.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,S.c.toString(),e,n)}function l(t,e,n){return r(t,S.x.toString(),e,n)}function u(t,e,n){return r(t,S.X.toString(),e,n)}function c(t,e,r){var n=b.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var h=t.dateTime,f=t.date,d=t.time,p=t.periods,v=t.days,m=t.shortDays,g=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gs=Ut;var e=new gs;return e._=t,n(e)}finally{gs=Date}}var n=e(t);return r.parse=function(t){try{gs=Ut;var e=n.parse(t);return e&&e._}finally{gs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=ca.map(),x=Xt(v),_=Yt(v),w=Xt(m),M=Yt(m),k=Xt(g),A=Yt(g),T=Xt(y),E=Yt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var S={a:function(t){return m[t.getDay()]},A:function(t){return v[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return g[t.getMonth()]},c:e(h),d:function(t,e){return Ht(t.getDate(),e,2)},e:function(t,e){return Ht(t.getDate(),e,2)},H:function(t,e){return Ht(t.getHours(),e,2)},I:function(t,e){return Ht(t.getHours()%12||12,e,2)},j:function(t,e){return Ht(1+ms.dayOfYear(t),e,3)},L:function(t,e){return Ht(t.getMilliseconds(),e,3)},m:function(t,e){return Ht(t.getMonth()+1,e,2)},M:function(t,e){return Ht(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Ht(t.getSeconds(),e,2)},U:function(t,e){return Ht(ms.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ht(ms.mondayOfYear(t),e,2)},x:e(f),X:e(d),y:function(t,e){return Ht(t.getFullYear()%100,e,2)},Y:function(t,e){return Ht(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},L={a:n,A:i,b:o,B:a,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:oe,p:c,S:ae,U:Zt,w:Wt,W:Kt,x:l,X:u,y:$t,Y:Jt,Z:Qt,"%":ue};return e}function Ht(t,e,r){var n=0>t?"-":"",i=(n?-t:t)+"",o=i.length;return n+(r>o?new Array(r-o+1).join(e)+i:i)}function Xt(t){return new RegExp("^(?:"+t.map(ca.requote).join("|")+")","i")}function Yt(t){for(var e=new h,r=-1,n=t.length;++r68?1900:2e3)}function ee(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ae(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=wa(e)/60|0,i=wa(e)%60;return r+Ht(n,"0",2)+Ht(i,"0",2)}function ue(t,e,r){_s.lastIndex=0;var n=_s.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ce(t){for(var e=t.length,r=-1;++r=0?1:-1,s=a*r,l=Math.cos(e),u=Math.sin(e),c=o*u,h=i*l+c*Math.cos(s),f=c*a*Math.sin(s);Es.add(Math.atan2(f,h)),n=t,i=l,o=u}var e,r,n,i,o;Ss.point=function(a,s){Ss.point=t,n=(e=a)*Ha,i=Math.cos(s=(r=s)*Ha/2+Ua/4),o=Math.sin(s)},Ss.lineEnd=function(){t(e,r)}}function ge(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function be(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function ke(t,e){return wa(t[0]-e[0])s;++s)i.point((r=t[s])[0],r[1]);return void i.lineEnd()}var l=new Re(r,t,null,!0),u=new Re(r,null,l,!1);l.o=u,o.push(l),a.push(u),l=new Re(n,t,null,!1),u=new Re(n,null,l,!0),l.o=u,o.push(l),a.push(u)}}),a.sort(e),Ce(o),Ce(a),o.length){for(var s=0,l=r,u=a.length;u>s;++s)a[s].e=l=!l;for(var c,h,f=o[0];;){for(var d=f,p=!0;d.v;)if((d=d.n)===f)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(var s=0,u=c.length;u>s;++s)i.point((h=c[s])[0],h[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p){c=d.p.z;for(var s=c.length-1;s>=0;--s)i.point((h=c[s])[0],h[1])}else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Ce(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(o.polygonStart(),_=!0),o.lineStart();++a1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(Oe))}var d,p,v,m=e(o),g=i.invert(n[0],n[1]),y={point:a,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=h,y.lineEnd=f,d=[],p=[]},polygonEnd:function(){y.point=a,y.lineStart=l,y.lineEnd=u,d=ca.merge(d);var t=Ve(g,p);d.length?(_||(o.polygonStart(),_=!0),Pe(d,je,t,r,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),d=p=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}},b=Fe(),x=e(b),_=!1;return y}}function Oe(t){return t.length>1}function Fe(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:M,buffer:function(){var r=e;return e=[], -t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function je(t,e){return((t=t.x)[0]<0?t[1]-Ga-Na:Ga-t[1])-((e=e.x)[0]<0?e[1]-Ga-Na:Ga-e[1])}function Ne(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?Ua:-Ua,l=wa(o-r);wa(l-Ua)0?Ga:-Ga),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(o,n),e=0):i!==s&&l>=Ua&&(wa(r-i)Na?Math.atan((Math.sin(e)*(o=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*o*a)):(e+n)/2}function Ue(t,e,r,n){var i;if(null==t)i=r*Ga,n.point(-Ua,i),n.point(0,i),n.point(Ua,i),n.point(Ua,0),n.point(Ua,-i),n.point(0,-i),n.point(-Ua,-i),n.point(-Ua,0),n.point(-Ua,i);else if(wa(t[0]-e[0])>Na){var o=t[0]s;++s){var u=e[s],c=u.length;if(c)for(var h=u[0],f=h[0],d=h[1]/2+Ua/4,p=Math.sin(d),v=Math.cos(d),m=1;;){m===c&&(m=0),t=u[m];var g=t[0],y=t[1]/2+Ua/4,b=Math.sin(y),x=Math.cos(y),_=g-f,w=_>=0?1:-1,M=w*_,k=M>Ua,A=p*b;if(Es.add(Math.atan2(A*w*Math.sin(M),v*x+A*Math.cos(M))),o+=k?_+w*Va:_,k^f>=r^g>=r){var T=be(ge(h),ge(t));we(T);var E=be(i,T);we(E);var S=(k^_>=0?-1:1)*nt(E[2]);(n>S||n===S&&(T[0]||T[1]))&&(a+=k^_>=0?1:-1)}if(!m++)break;f=g,p=b,v=x,h=t}}return(-Na>o||Na>o&&0>Es)^1&a}function qe(t){function e(t,e){return Math.cos(t)*Math.cos(e)>o}function r(t){var r,o,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,f){var d,p=[h,f],v=e(h,f),m=a?v?0:i(h,f):v?i(h+(0>h?Ua:-Ua),f):0;if(!r&&(u=l=v)&&t.lineStart(),v!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=Na,p[1]+=Na,v=e(p[0],p[1]))),v!==l)c=0,v?(t.lineStart(),d=n(p,r),t.point(d[0],d[1])):(d=n(r,p),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(s&&r&&a^v){var g;m&o||!(g=n(p,r,!0))||(c=0,a?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1])))}!v||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=v,o=m},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ge(t),i=ge(e),a=[1,0,0],s=be(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var h=o*l/c,f=-o*u/c,d=be(a,s),p=_e(a,h),v=_e(s,f);xe(p,v);var m=d,g=ye(p,m),y=ye(m,m),b=g*g-y*(ye(p,p)-1);if(!(0>b)){var x=Math.sqrt(b),_=_e(m,(-g-x)/y);if(xe(_,p),_=Me(_),!r)return _;var w,M=t[0],k=e[0],A=t[1],T=e[1];M>k&&(w=M,M=k,k=w);var E=k-M,S=wa(E-Ua)E;if(!S&&A>T&&(w=A,A=T,T=w),L?S?A+T>0^_[1]<(wa(_[0]-M)Ua^(M<=_[0]&&_[0]<=k)){var z=_e(m,(-g+x)/y);return xe(z,p),[_,Me(z)]}}}function i(e,r){var n=a?t:Ua-t,i=0;return-n>e?i|=1:e>n&&(i|=2),-n>r?i|=4:r>n&&(i|=8),i}var o=Math.cos(t),a=o>0,s=wa(o)>Na,l=mr(t,6*Ha);return De(e,r,l,a?[0,-t]:[-Ua,t-Ua])}function Ge(t,e,r,n){return function(i){var o,a=i.a,s=i.b,l=a.x,u=a.y,c=s.x,h=s.y,f=0,d=1,p=c-l,v=h-u;if(o=t-l,p||!(o>0)){if(o/=p,0>p){if(f>o)return;d>o&&(d=o)}else if(p>0){if(o>d)return;o>f&&(f=o)}if(o=r-l,p||!(0>o)){if(o/=p,0>p){if(o>d)return;o>f&&(f=o)}else if(p>0){if(f>o)return;d>o&&(d=o)}if(o=e-u,v||!(o>0)){if(o/=v,0>v){if(f>o)return;d>o&&(d=o)}else if(v>0){if(o>d)return;o>f&&(f=o)}if(o=n-u,v||!(0>o)){if(o/=v,0>v){if(o>d)return;o>f&&(f=o)}else if(v>0){if(f>o)return;d>o&&(d=o)}return f>0&&(i.a={x:l+f*p,y:u+f*v}),1>d&&(i.b={x:l+d*p,y:u+d*v}),i}}}}}}function He(t,e,r,n){function i(n,i){return wa(n[0]-t)0?0:3:wa(n[0]-r)0?2:1:wa(n[1]-e)0?1:0:i>0?3:2}function o(t,e){return a(t.x,e.x)}function a(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=m.length,n=t[1],i=0;r>i;++i)for(var o,a=1,s=m[i],l=s.length,u=s[0];l>a;++a)o=s[a],u[1]<=n?o[1]>n&&et(u,o,t)>0&&++e:o[1]<=n&&et(u,o,t)<0&&--e,u=o;return 0!==e}function u(o,s,l,u){var c=0,h=0;if(null==o||(c=i(o,l))!==(h=i(s,l))||a(o,s)<0^l>0){do u.point(0===c||3===c?t:r,c>1?n:e);while((c=(c+l+4)%4)!==h)}else u.point(s[0],s[1])}function c(i,o){return i>=t&&r>=i&&o>=e&&n>=o}function h(t,e){c(t,e)&&s.point(t,e)}function f(){L.point=p,m&&m.push(g=[]),k=!0,M=!1,_=w=NaN}function d(){v&&(p(y,b),x&&M&&E.rejoin(),v.push(E.buffer())),L.point=h,M&&s.lineEnd()}function p(t,e){t=Math.max(-Vs,Math.min(Vs,t)),e=Math.max(-Vs,Math.min(Vs,e));var r=c(t,e);if(m&&g.push([t,e]),k)y=t,b=e,x=r,k=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&M)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};S(n)?(M||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),A=!1):r&&(s.lineStart(),s.point(t,e),A=!1)}_=t,w=e,M=r}var v,m,g,y,b,x,_,w,M,k,A,T=s,E=Fe(),S=Ge(t,e,r,n),L={point:h,lineStart:f,lineEnd:d,polygonStart:function(){s=E,v=[],m=[],A=!0},polygonEnd:function(){s=T,v=ca.merge(v);var e=l([t,n]),r=A&&e,i=v.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Pe(v,o,e,u,s),s.polygonEnd()),v=m=g=null}};return L}}function Xe(t){var e=0,r=Ua/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Ua/180,r=t[1]*Ua/180):[e/Ua*180,r/Ua*180]},i}function Ye(t,e){function r(t,e){var r=Math.sqrt(o-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),a-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,o=1+n*(2*i-n),a=Math.sqrt(o)/i;return r.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/i,nt((o-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Gs+=i*t-n*e,n=t,i=e}var e,r,n,i;Zs.point=function(o,a){Zs.point=t,e=n=o,r=i=a},Zs.lineEnd=function(){t(e,r)}}function Ze(t,e){Hs>t&&(Hs=t),t>Ys&&(Ys=t),Xs>e&&(Xs=e),e>Ws&&(Ws=e)}function Ke(){function t(t,e){a.push("M",t,",",e,o)}function e(t,e){a.push("M",t,",",e),s.point=r}function r(t,e){a.push("L",t,",",e)}function n(){s.point=t}function i(){a.push("Z")}var o=Je(4.5),a=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return o=Je(t),s},result:function(){if(a.length){var t=a.join("");return a=[],t}}};return s}function Je(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $e(t,e){Is+=t,Ps+=e,++Cs}function Qe(){function t(t,n){var i=t-e,o=n-r,a=Math.sqrt(i*i+o*o);Rs+=a*(e+t)/2,Ds+=a*(r+n)/2,Os+=a,$e(e=t,r=n)}var e,r;Js.point=function(n,i){Js.point=t,$e(e=n,r=i)}}function tr(){Js.point=$e}function er(){function t(t,e){var r=t-n,o=e-i,a=Math.sqrt(r*r+o*o);Rs+=a*(n+t)/2,Ds+=a*(i+e)/2,Os+=a,a=i*t-n*e,Fs+=a*(n+t),js+=a*(i+e),Ns+=3*a,$e(n=t,i=e)}var e,r,n,i;Js.point=function(o,a){Js.point=t,$e(e=n=o,r=i=a)},Js.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+a,r),t.arc(e,r,a,0,Va)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function o(){t.closePath()}var a=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return a=t,s},result:M};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return ar(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){b=NaN,k.point=o,e.lineStart()}function o(r,n){var o=ge([r,n]),a=t(r,n);i(b,x,y,_,w,M,b=a[0],x=a[1],y=r,_=o[0],w=o[1],M=o[2],s,e),e.point(b,x)}function a(){k.point=r,e.lineEnd()}function l(){n(),k.point=u,k.lineEnd=c}function u(t,e){o(h=t,f=e),d=b,p=x,v=_,m=w,g=M,k.point=o}function c(){i(b,x,y,_,w,M,d,p,h,v,m,g,s,e),k.lineEnd=a,a()}var h,f,d,p,v,m,g,y,b,x,_,w,M,k={point:r,lineStart:n,lineEnd:a,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=n}};return k}function i(e,r,n,s,l,u,c,h,f,d,p,v,m,g){var y=c-e,b=h-r,x=y*y+b*b;if(x>4*o&&m--){var _=s+d,w=l+p,M=u+v,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=wa(wa(M)-1)o||wa((y*z+b*I)/x-.5)>.3||a>s*d+l*p+u*v)&&(i(e,r,n,s,l,u,S,L,T,_/=k,w/=k,M,m,g),g.point(S,L),i(S,L,T,_,w,M,c,h,f,d,p,v,m,g))}}var o=.5,a=Math.cos(30*Ha),s=16;return e.precision=function(t){return arguments.length?(s=(o=t*t)>0&&16,e):Math.sqrt(o)},e}function ir(t){var e=nr(function(e,r){return t([e*Xa,r*Xa])});return function(t){return ur(e(t))}}function or(t){this.stream=t}function ar(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*Ha,t[1]*Ha),[t[0]*f+l,u-t[1]*f]}function r(t){return t=s.invert((t[0]-l)/f,(u-t[1])/f),t&&[t[0]*Xa,t[1]*Xa]}function n(){s=ze(a=fr(g,y,b),o);var t=o(v,m);return l=d-t[0]*f,u=p+t[1]*f,i()}function i(){return c&&(c.valid=!1,c=null),e}var o,a,s,l,u,c,h=nr(function(t,e){return t=o(t,e),[t[0]*f+l,u-t[1]*f]}),f=150,d=480,p=250,v=0,m=0,g=0,y=0,b=0,_=Us,w=x,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(a,h(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Us):qe((M=+t)*Ha),i()):M},e.clipExtent=function(t){return arguments.length?(k=t,w=t?He(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):k},e.scale=function(t){return arguments.length?(f=+t,n()):f},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(v=t[0]%360*Ha,m=t[1]%360*Ha,n()):[v*Xa,m*Xa]},e.rotate=function(t){return arguments.length?(g=t[0]%360*Ha,y=t[1]%360*Ha,b=t.length>2?t[2]%360*Ha:0,n()):[g*Xa,y*Xa,b*Xa]},ca.rebind(e,h,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&r,n()}}function ur(t){return ar(t,function(e,r){t.point(e*Ha,r*Ha)})}function cr(t,e){return[t,e]}function hr(t,e){return[t>Ua?t-Va:-Ua>t?t+Va:t,e]}function fr(t,e,r){return t?e||r?ze(pr(t),vr(e,r)):pr(t):e||r?vr(e,r):hr}function dr(t){return function(e,r){return e+=t,[e>Ua?e-Va:-Ua>e?e+Va:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function vr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*o-c*a,s*n-u*i),nt(c*o+l*a)]}var n=Math.cos(t),i=Math.sin(t),o=Math.cos(e),a=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*o-l*a;return[Math.atan2(l*o+u*a,s*n+c*i),nt(c*n-s*i)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,o,a,s){var l=a*e;null!=i?(i=gr(r,i),o=gr(r,o),(a>0?o>i:i>o)&&(i+=a*Va)):(i=t+a*Va,o=t-.5*l);for(var u,c=i;a>0?c>o:o>c;c-=l)s.point((u=Me([r,-n*Math.cos(c),-n*Math.sin(c)]))[0],u[1])}}function gr(t,e){var r=ge(e);r[0]-=t,we(r);var n=rt(-r[1]);return((-r[2]<0?-n:n)+2*Math.PI-Na)%(2*Math.PI)}function yr(t,e,r){var n=ca.range(t,e-Na,r).concat(e);return function(t){return n.map(function(e){return[t,e]})}}function br(t,e,r){var n=ca.range(t,e-Na,r).concat(e);return function(t){return n.map(function(e){return[e,t]})}}function xr(t){return t.source}function _r(t){return t.target}function wr(t,e,r,n){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),l=i*Math.cos(t),u=i*Math.sin(t),c=a*Math.cos(r),h=a*Math.sin(r),f=2*Math.asin(Math.sqrt(st(n-e)+i*a*st(r-t))),d=1/Math.sin(f),p=f?function(t){var e=Math.sin(t*=f)*d,r=Math.sin(f-t)*d,n=r*l+e*c,i=r*u+e*h,a=r*o+e*s;return[Math.atan2(i,n)*Xa,Math.atan2(a,Math.sqrt(n*n+i*i))*Xa]}:function(){return[t*Xa,e*Xa]};return p.distance=f,p}function Mr(){function t(t,i){var o=Math.sin(i*=Ha),a=Math.cos(i),s=wa((t*=Ha)-e),l=Math.cos(s);$s+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=n*o-r*a*l)*s),r*o+n*a*l),e=t,r=o,n=a}var e,r,n;Qs.point=function(i,o){e=i*Ha,r=Math.sin(o*=Ha),n=Math.cos(o),Qs.point=t},Qs.lineEnd=function(){Qs.point=Qs.lineEnd=M}}function kr(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),o=t(n*i);return[o*i*Math.sin(e),o*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,n*a),Math.asin(n&&r*o/n)]},r}function Ar(t,e){function r(t,e){a>0?-Ga+Na>e&&(e=-Ga+Na):e>Ga-Na&&(e=Ga-Na);var r=a/Math.pow(i(e),o);return[r*Math.sin(o*t),a-r*Math.cos(o*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Ua/4+t/2)},o=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),a=n*Math.pow(i(t),o)/o;return o?(r.invert=function(t,e){var r=a-e,n=tt(o)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/o,2*Math.atan(Math.pow(a/n,1/o))-Ga]},r):Er}function Tr(t,e){function r(t,e){var r=o-e;return[r*Math.sin(i*t),o-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),o=n/i+t;return wa(i)i;i++){for(;n>1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Cr(t,e){return t[0]-e[0]||t[1]-e[1]}function Rr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Dr(t,e,r,n){var i=t[0],o=r[0],a=e[0]-i,s=n[0]-o,l=t[1],u=r[1],c=e[1]-l,h=n[1]-u,f=(s*(l-u)-h*(i-o))/(h*a-s*c);return[i+f*a,l+f*c]}function Or(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Fr(){on(this),this.edge=this.site=this.circle=null}function jr(t){var e=hl.pop()||new Fr;return e.site=t,e}function Nr(t){Zr(t),ll.remove(t),hl.push(t),on(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},o=t.P,a=t.N,s=[t];Nr(t);for(var l=o;l.circle&&wa(r-l.circle.x)c;++c)u=s[c],l=s[c-1],en(u.edge,l.site,u.site,i);l=s[0],u=s[h-1],u.edge=Qr(l.site,u.site,null,i),Wr(l),Wr(u)}function Ur(t){for(var e,r,n,i,o=t.x,a=t.y,s=ll._;s;)if(n=Vr(s,a)-o,n>Na)s=s.L;else{if(i=o-qr(s,a),!(i>Na)){n>-Na?(e=s.P,r=s):i>-Na?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(ll.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),ll.insert(l,r),l.edge=r.edge=Qr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Qr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,h=u.y,f=t.x-c,d=t.y-h,p=r.site,v=p.x-c,m=p.y-h,g=2*(f*m-d*v),y=f*f+d*d,b=v*v+m*m,x={x:(m*y-d*b)/g+c,y:(f*b-v*y)/g+h};en(r.edge,u,p,x),l.edge=Qr(u,t,null,x),r.edge=Qr(t,p,null,x),Wr(e),Wr(r)}}function Vr(t,e){var r=t.site,n=r.x,i=r.y,o=i-e;if(!o)return n;var a=t.P;if(!a)return-(1/0);r=a.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,h=1/o-1/u,f=c/u;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*u)-l+u/2+i-o/2)))/h+n:(n+s)/2}function qr(t,e){var r=t.N;if(r)return Vr(r,e);var n=t.site;return n.y===e?n.x:1/0}function Gr(t){this.site=t,this.edges=[]}function Hr(t){for(var e,r,n,i,o,a,s,l,u,c,h=t[0][0],f=t[1][0],d=t[0][1],p=t[1][1],v=sl,m=v.length;m--;)if(o=v[m],o&&o.prepare())for(s=o.edges,l=s.length,a=0;l>a;)c=s[a].end(),n=c.x,i=c.y,u=s[++a%l].start(),e=u.x,r=u.y,(wa(n-e)>Na||wa(i-r)>Na)&&(s.splice(a,0,new rn(tn(o.site,c,wa(n-h)Na?{x:h,y:wa(e-h)Na?{x:wa(r-p)Na?{x:f,y:wa(e-f)Na?{x:wa(r-d)=-Ba)){var d=l*l+u*u,p=c*c+h*h,v=(h*d-u*p)/f,m=(l*p-c*d)/f,h=m+s,g=fl.pop()||new Yr;g.arc=t,g.site=i,g.x=v+a,g.y=h+Math.sqrt(v*v+m*m),g.cy=h,t.circle=g;for(var y=null,b=cl._;b;)if(g.ym||m>=s)return;if(f>p){if(o){if(o.y>=u)return}else o={x:m,y:l};r={x:m,y:u}}else{if(o){if(o.yn||n>1)if(f>p){if(o){if(o.y>=u)return}else o={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(o){if(o.yd){if(o){if(o.x>=s)return}else o={x:a,y:n*a+i};r={x:s,y:n*s+i}}else{if(o){if(o.xo||h>a||n>f||i>d)){if(p=t.point){var p,v=e-t.x,m=r-t.y,g=v*v+m*m;if(l>g){var y=Math.sqrt(l=g);n=e-y,i=r-y,o=e+y,a=r+y,s=p}}for(var b=t.nodes,x=.5*(c+f),_=.5*(h+d),w=e>=x,M=r>=_,k=M<<1|w,A=k+4;A>k;++k)if(t=b[3&k])switch(3&k){case 0:u(t,c,h,x,_);break;case 1:u(t,x,h,f,_);break;case 2:u(t,c,_,x,d);break;case 3:u(t,x,_,f,d)}}}(t,n,i,o,a),s}function gn(t,e){t=ca.rgb(t),e=ca.rgb(e);var r=t.r,n=t.g,i=t.b,o=e.r-r,a=e.g-n,s=e.b-i;return function(t){return"#"+wt(Math.round(r+o*t))+wt(Math.round(n+a*t))+wt(Math.round(i+s*t))}}function yn(t,e){var r,n={},i={};for(r in t)r in e?n[r]=_n(t[r],e[r]):i[r]=t[r];for(r in e)r in t||(i[r]=e[r]);return function(t){for(r in n)i[r]=n[r](t);return i}}function bn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function xn(t,e){var r,n,i,o=pl.lastIndex=vl.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(r=pl.exec(t))&&(n=vl.exec(e));)(i=n.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(r=r[0])===(n=n[0])?s[a]?s[a]+=n:s[++a]=n:(s[++a]=null,l.push({i:a,x:bn(r,n)})),o=vl.lastIndex;return on;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})}function _n(t,e){for(var r,n=ca.interpolators.length;--n>=0&&!(r=ca.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],o=t.length,a=e.length,s=Math.min(t.length,e.length);for(r=0;s>r;++r)n.push(_n(t[r],e[r]));for(;o>r;++r)i[r]=t[r];for(;a>r;++r)i[r]=e[r];return function(t){for(r=0;s>r;++r)i[r]=n[r](t);return i}}function Mn(t){return function(e){return 0>=e?0:e>=1?1:t(e)}}function kn(t){return function(e){return 1-t(1-e)}}function An(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Sn(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(.5>t?r:3*(t-e)+r-.75)}function Ln(t){return function(e){return Math.pow(e,t)}}function zn(t){return 1-Math.cos(t*Ga)}function In(t){return Math.pow(2,10*(t-1))}function Pn(t){return 1-Math.sqrt(1-t*t)}function Cn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Va*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Va/e)}}function Rn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Dn(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function On(t,e){t=ca.hcl(t),e=ca.hcl(e);var r=t.h,n=t.c,i=t.l,o=e.h-r,a=e.c-n,s=e.l-i;return isNaN(a)&&(a=0,n=isNaN(n)?e.c:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:-180>o&&(o+=360),function(t){return ft(r+o*t,n+a*t,i+s*t)+""}}function Fn(t,e){t=ca.hsl(t),e=ca.hsl(e);var r=t.h,n=t.s,i=t.l,o=e.h-r,a=e.s-n,s=e.l-i;return isNaN(a)&&(a=0,n=isNaN(n)?e.s:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:-180>o&&(o+=360),function(t){return ct(r+o*t,n+a*t,i+s*t)+""}}function jn(t,e){t=ca.lab(t),e=ca.lab(e);var r=t.l,n=t.a,i=t.b,o=e.l-r,a=e.a-n,s=e.b-i;return function(t){return pt(r+o*t,n+a*t,i+s*t)+""}}function Nn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Vn(e),i=Un(e,r),o=Vn(qn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Gn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(Gn(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Gn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(Gn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(Gn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Gn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=ca.transform(t),e=ca.transform(e),Hn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,o=n.length;++i=0;)r.push(i[n])}function li(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(o=t.children)&&(i=o.length))for(var i,o,a=-1;++ar;++r)(e=t[r][1])>i&&(n=r,i=e);return n}function bi(t){return t.reduce(xi,0)}function xi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,o=[];++r<=e;)o[r]=i*r+n;return o}function Mi(t){return[ca.min(t),ca.max(t)]}function ki(t,e){return t.value-e.value}function Ai(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Si(t){function e(t){c=Math.min(t.x-t.r,c),h=Math.max(t.x+t.r,h),f=Math.min(t.y-t.r,f),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(u=r.length)){var r,n,i,o,a,s,l,u,c=1/0,h=-(1/0),f=1/0,d=-(1/0);if(r.forEach(Li),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(i=r[1],i.x=i.r,i.y=0,e(i),u>2))for(o=r[2],Pi(n,i,o),e(o),Ai(n,o),n._pack_prev=o,Ai(o,i),i=n._pack_next,a=3;u>a;a++){Pi(n,i,o=r[a]);var p=0,v=1,m=1;for(s=i._pack_next;s!==i;s=s._pack_next,v++)if(Ei(s,o)){p=1;break}if(1==p)for(l=n._pack_prev;l!==s._pack_prev&&!Ei(l,o);l=l._pack_prev,m++);p?(m>v||v==m&&i.ra;a++)o=r[a],o.x-=g,o.y-=y,b=Math.max(b,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=b,r.forEach(zi)}}function Li(t){t._pack_next=t._pack_prev=t}function zi(t){delete t._pack_next,delete t._pack_prev}function Ii(t,e,r,n){var i=t.children;if(t.x=e+=n*t.x,t.y=r+=n*t.y,t.r*=n,i)for(var o=-1,a=i.length;++o=0;)e=i[o],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function ji(t,e,r){return t.a.parent===e.parent?t.a:r}function Ni(t){return 1+ca.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Vi(t){var e,r=t.children;return r&&(e=r.length)?Vi(r[e-1]):t}function qi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Gi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return 0>i&&(r+=i/2,i=0),0>o&&(n+=o/2,o=0),{x:r,y:n,dx:i,dy:o}}function Hi(t){var e=t[0],r=t[t.length-1];return r>e?[e,r]:[r,e]}function Xi(t){return t.rangeExtent?t.rangeExtent():Hi(t.range())}function Yi(t,e,r,n){var i=r(t[0],t[1]),o=n(e[0],e[1]);return function(t){return o(i(t))}}function Wi(t,e){var r,n=0,i=t.length-1,o=t[n],a=t[i];return o>a&&(r=n,n=i,i=r,r=o,o=a,a=r),t[n]=e.floor(o),t[i]=e.ceil(a),t}function Zi(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:Tl}function Ki(t,e,r,n){var i=[],o=[],a=0,s=Math.min(t.length,e.length)-1;for(t[s]2?Ki:Yi,l=n?Jn:Kn;return a=i(t,e,l,r),s=i(e,t,l,_n),o}function o(t){return a(t)}var a,s;return o.invert=function(t){return s(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},o.range=function(t){return arguments.length?(e=t,i()):e},o.rangeRound=function(t){return o.range(t).interpolate(Nn)},o.clamp=function(t){return arguments.length?(n=t,i()):n},o.interpolate=function(t){return arguments.length?(r=t,i()):r},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,r){return ro(t,e,r)},o.nice=function(e){return Qi(t,e),i()},o.copy=function(){return Ji(t,e,r,n)},i()}function $i(t,e){return ca.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Qi(t,e){return Wi(t,Zi(to(t,e)[2])),Wi(t,Zi(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var r=Hi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),o=e/n*i;return.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function eo(t,e){return ca.range.apply(ca,to(t,e))}function ro(t,e,r){var n=to(t,e);if(r){var i=ps.exec(r);if(i.shift(),"s"===i[8]){var o=ca.formatPrefix(Math.max(wa(n[0]),wa(n[1])));return i[7]||(i[7]="."+no(o.scale(n[2]))),i[8]="f",r=ca.format(i.join("")),function(t){return r(o.scale(t))+o.symbol}}i[7]||(i[7]="."+io(i[8],n)),r=i.join("")}else r=",."+no(n[2])+"f";return ca.format(r)}function no(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function io(t,e){var r=no(e[2]);return t in El?Math.abs(r-no(Math.max(wa(e[0]),wa(e[1]))))+ +("e"!==t):r-2*("%"===t)}function oo(t,e,r,n){function i(t){return(r?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function a(e){return t(i(e))}return a.invert=function(e){return o(t.invert(e))},a.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),a):n},a.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),a):e},a.nice=function(){var e=Wi(n.map(i),r?Math:Ll);return t.domain(e),n=e.map(o),a},a.ticks=function(){var t=Hi(n),a=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),h=e%1?2:e;if(isFinite(c-u)){if(r){for(;c>u;u++)for(var f=1;h>f;f++)a.push(o(u)*f);a.push(o(u))}else for(a.push(o(u));u++0;f--)a.push(o(u)*f);for(u=0;a[u]l;c--);a=a.slice(u,c)}return a},a.tickFormat=function(t,r){if(!arguments.length)return Sl;arguments.length<2?r=Sl:"function"!=typeof r&&(r=ca.format(r));var n=Math.max(1,e*t/a.ticks().length);return function(t){var a=t/o(Math.round(i(t)));return e-.5>a*e&&(a*=e),n>=a?r(t):""}},a.copy=function(){return oo(t.copy(),e,r,n)},$i(a,t)}function ao(t,e,r){function n(e){return t(i(e))}var i=so(e),o=so(1/e);return n.invert=function(e){return o(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain((r=e.map(Number)).map(i)),n):r},n.ticks=function(t){return eo(r,t)},n.tickFormat=function(t,e){return ro(r,t,e)},n.nice=function(t){return n.domain(Qi(r,t)); -},n.exponent=function(a){return arguments.length?(i=so(e=a),o=so(1/e),t.domain(r.map(i)),n):e},n.copy=function(){return ao(t.copy(),e,r)},$i(n,t)}function so(t){return function(e){return 0>e?-Math.pow(-e,t):Math.pow(e,t)}}function lo(t,e){function r(r){return o[((i.get(r)||("range"===e.t?i.set(r,t.push(r)):NaN))-1)%o.length]}function n(e,r){return ca.range(t.length).map(function(t){return e+r*t})}var i,o,a;return r.domain=function(n){if(!arguments.length)return t;t=[],i=new h;for(var o,a=-1,s=n.length;++ar?[NaN,NaN]:[r>0?s[r-1]:t[0],re?NaN:e/o+t,[e,e+1/o]},n.copy=function(){return co(t,e,r)},i()}function ho(t,e){function r(r){return r>=r?e[ca.bisect(t,r)]:void 0}return r.domain=function(e){return arguments.length?(t=e,r):t},r.range=function(t){return arguments.length?(e=t,r):e},r.invertExtent=function(r){return r=e.indexOf(r),[t[r-1],t[r]]},r.copy=function(){return ho(t,e)},r}function fo(t){function e(t){return+t}return e.invert=e,e.domain=e.range=function(r){return arguments.length?(t=r.map(e),e):t},e.ticks=function(e){return eo(t,e)},e.tickFormat=function(e,r){return ro(t,e,r)},e.copy=function(){return fo(t)},e}function po(){return 0}function vo(t){return t.innerRadius}function mo(t){return t.outerRadius}function go(t){return t.startAngle}function yo(t){return t.endAngle}function bo(t){return t&&t.padAngle}function xo(t,e,r,n){return(t-r)*e-(e-n)*t>0?0:1}function _o(t,e,r,n,i){var o=t[0]-e[0],a=t[1]-e[1],s=(i?n:-n)/Math.sqrt(o*o+a*a),l=s*a,u=-s*o,c=t[0]+l,h=t[1]+u,f=e[0]+l,d=e[1]+u,p=(c+f)/2,v=(h+d)/2,m=f-c,g=d-h,y=m*m+g*g,b=r-n,x=c*d-f*h,_=(0>g?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*g-m*_)/y,M=(-x*m-g*_)/y,k=(x*g+m*_)/y,A=(-x*m+g*_)/y,T=w-p,E=M-v,S=k-p,L=A-v;return T*T+E*E>S*S+L*L&&(w=k,M=A),[[w-l,M-u],[w*r/b,M*r/b]]}function wo(t){function e(e){function a(){u.push("M",o(t(c),s))}for(var l,u=[],c=[],h=-1,f=e.length,d=St(r),p=St(n);++h1?t.join("L"):t+"Z"}function ko(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1&&i.push("H",n[0]),i.join("")}function To(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],o=t[l],l++,n+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var u=2;u9&&(i=3*e/Math.sqrt(i),a[s]=i*r,a[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}function Vo(t){return t.length<3?Mo(t):t[0]+Io(t,Uo(t))}function qo(t){for(var e,r,n,i=-1,o=t.length;++i=e?a(t-e):void(u.c=a)}function a(r){var i=p.active,o=p[i];o&&(o.timer.c=null,o.timer.t=NaN,--p.count,delete p[i],o.event&&o.event.interrupt.call(t,t.__data__,o.index));for(var a in p)if(n>+a){var h=p[a];h.timer.c=null,h.timer.t=NaN,--p.count,delete p[a]}u.c=s,Ct(function(){return u.c&&s(r||1)&&(u.c=null,u.t=NaN),1},0,l),p.active=n,v.event&&v.event.start.call(t,t.__data__,e),d=[],v.tween.forEach(function(r,n){(n=n.call(t,t.__data__,e))&&d.push(n)}),f=v.ease,c=v.duration}function s(i){for(var o=i/c,a=f(o),s=d.length;s>0;)d[--s].call(t,a);return o>=1?(v.event&&v.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1):void 0}var l,u,c,f,d,p=t[r]||(t[r]={active:0,count:0}),v=p[n];v||(l=i.time,u=Ct(o,0,l),v=p[n]={tween:new h,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function na(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function ia(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function oa(t){return t.toISOString()}function aa(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,o=ca.bisect(tu,i);return o==tu.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[i/tu[o-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=sa(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=sa(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Hi(n.domain()),o=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(r[0],sa(+r[1]+1),1>e?1:e)},n.tickFormat=function(){return r},n.copy=function(){return aa(t.copy(),e,r)},$i(n,t)}function sa(t){return new Date(t)}function la(t){return JSON.parse(t.responseText)}function ua(t){var e=da.createRange();return e.selectNode(da.body),e.createContextualFragment(t.responseText)}var ca={version:"3.5.16"},ha=[].slice,fa=function(t){return ha.call(t)},da=this.document;if(da)try{fa(da.documentElement.childNodes)[0].nodeType}catch(pa){fa=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),da)try{da.createElement("DIV").style.setProperty("opacity",0,"")}catch(va){var ma=this.Element.prototype,ga=ma.setAttribute,ya=ma.setAttributeNS,ba=this.CSSStyleDeclaration.prototype,xa=ba.setProperty;ma.setAttribute=function(t,e){ga.call(this,t,e+"")},ma.setAttributeNS=function(t,e,r){ya.call(this,t,e,r+"")},ba.setProperty=function(t,e,r){xa.call(this,t,e+"",r)}}ca.ascending=i,ca.descending=function(t,e){return t>e?-1:e>t?1:e>=t?0:NaN},ca.min=function(t,e){var r,n,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++in&&(r=n)}else{for(;++i=n){r=n;break}for(;++in&&(r=n)}return r},ca.max=function(t,e){var r,n,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++ir&&(r=n)}else{for(;++i=n){r=n;break}for(;++ir&&(r=n)}return r},ca.extent=function(t,e){var r,n,i,o=-1,a=t.length;if(1===arguments.length){for(;++o=n){r=i=n;break}for(;++on&&(r=n),n>i&&(i=n))}else{for(;++o=n){r=i=n;break}for(;++on&&(r=n),n>i&&(i=n))}return[r,i]},ca.sum=function(t,e){var r,n=0,i=t.length,o=-1;if(1===arguments.length)for(;++o1?l/(c-1):void 0},ca.deviation=function(){var t=ca.variance.apply(this,arguments);return t?Math.sqrt(t):t};var _a=s(i);ca.bisectLeft=_a.left,ca.bisect=ca.bisectRight=_a.right,ca.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},ca.shuffle=function(t,e,r){(o=arguments.length)<3&&(r=t.length,2>o&&(e=0));for(var n,i,o=r-e;o;)i=Math.random()*o--|0,n=t[o+e],t[o+e]=t[i+e],t[i+e]=n;return t},ca.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},ca.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],o=new Array(0>n?0:n);n>r;)o[r]=[e=i,i=t[++r]];return o},ca.transpose=function(t){if(!(i=t.length))return[];for(var e=-1,r=ca.min(t,l),n=new Array(r);++e=0;)for(n=t[i],e=n.length;--e>=0;)r[--a]=n[e];return r};var wa=Math.abs;ca.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r===1/0)throw new Error("infinite range");var n,i=[],o=u(wa(r)),a=-1;if(t*=o,e*=o,r*=o,0>r)for(;(n=t+r*++a)>e;)i.push(n/o);else for(;(n=t+r*++a)=o.length)return n?n.call(i,a):r?a.sort(r):a;for(var l,u,c,f,d=-1,p=a.length,v=o[s++],m=new h;++d=o.length)return t;var n=[],i=a[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},o=[],a=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(ca.map,r,0),0)},i.key=function(t){return o.push(t),i},i.sortKeys=function(t){return a[o.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},ca.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;n>r;++r)e.add(t[r]);return e},c(b,{has:p,add:function(t){return this._[f(t+="")]=!0,t},remove:v,values:m,size:g,empty:y,forEach:function(t){for(var e in this._)t.call(this,d(e))}}),ca.behavior={},ca.rebind=function(t,e){for(var r,n=1,i=arguments.length;++n=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},ca.event=null,ca.requote=function(t){return t.replace(Ta,"\\$&")};var Ta=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ea={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},Sa=function(t,e){return e.querySelector(t)},La=function(t,e){return e.querySelectorAll(t)},za=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(za=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Sa=function(t,e){return Sizzle(t,e)[0]||null},La=Sizzle,za=Sizzle.matchesSelector),ca.selection=function(){return ca.select(da.documentElement)};var Ia=ca.selection.prototype=[];Ia.select=function(t){var e,r,n,i,o=[];t=z(t);for(var a=-1,s=this.length;++a=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Ca.hasOwnProperty(r)?{space:Ca[r],local:t}:t}},Ia.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=ca.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(P(e,t[e]));return this}return this.each(P(t,e))},Ia.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=D(t)).length,i=-1;if(e=r.classList){for(;++ii){if("string"!=typeof t){2>i&&(e="");for(r in t)this.each(j(r,t[r],e));return this}if(2>i){var o=this.node();return n(o).getComputedStyle(o,null).getPropertyValue(t)}r=""}return this.each(j(t,e,r))},Ia.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(N(e,t[e]));return this}return this.each(N(t,e))},Ia.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Ia.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Ia.append=function(t){return t=B(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},Ia.insert=function(t,e){return t=B(t),e=z(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},Ia.remove=function(){return this.each(U)},Ia.data=function(t,e){function r(t,r){var n,i,o,a=t.length,c=r.length,f=Math.min(a,c),d=new Array(c),p=new Array(c),v=new Array(a);if(e){var m,g=new h,y=new Array(a);for(n=-1;++nn;++n)p[n]=V(r[n]);for(;a>n;++n)v[n]=t[n]}p.update=d,p.parentNode=d.parentNode=v.parentNode=t.parentNode,s.push(p),l.push(d),u.push(v)}var n,i,o=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(n=this[0]).length);++oo;o++){i.push(e=[]),e.parentNode=(r=this[o]).parentNode;for(var s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,o)&&e.push(n)}return L(i)},Ia.order=function(){for(var t=-1,e=this.length;++t=0;)(r=n[i])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this},Ia.sort=function(t){t=G.apply(this,arguments);for(var e=-1,r=this.length;++et;t++)for(var r=this[t],n=0,i=r.length;i>n;n++){var o=r[n];if(o)return o}return null},Ia.size=function(){var t=0;return H(this,function(){++t}),t};var Ra=[];ca.selection.enter=X,ca.selection.enter.prototype=Ra,Ra.append=Ia.append,Ra.empty=Ia.empty,Ra.node=Ia.node,Ra.call=Ia.call,Ra.size=Ia.size,Ra.select=function(t){for(var e,r,n,i,o,a=[],s=-1,l=this.length;++sn){if("string"!=typeof t){2>n&&(e=!1);for(r in t)this.each(W(r,t[r],e));return this}if(2>n)return(n=this.node()["__on"+t])&&n._;r=!1}return this.each(W(t,e,r))};var Da=ca.map({mouseenter:"mouseover",mouseleave:"mouseout"});da&&Da.forEach(function(t){"on"+t in da&&Da.remove(t)});var Oa,Fa=0;ca.mouse=function(t){return $(t,E())};var ja=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ca.touch=function(t,e,r){if(arguments.length<3&&(r=e,e=E().changedTouches),e)for(var n,i=0,o=e.length;o>i;++i)if((n=e[i]).identifier===r)return $(t,n)},ca.behavior.drag=function(){function t(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function e(t,e,n,o,a){return function(){function s(){var t,r,n=e(f,v);n&&(t=n[0]-b[0],r=n[1]-b[1],p|=t|r,b=n,d({type:"drag",x:n[0]+u[0],y:n[1]+u[1],dx:t,dy:r}))}function l(){e(f,v)&&(g.on(o+m,null).on(a+m,null),y(p),d({type:"dragend"}))}var u,c=this,h=ca.event.target.correspondingElement||ca.event.target,f=c.parentNode,d=r.of(c,arguments),p=0,v=t(),m=".drag"+(null==v?"":"-"+v),g=ca.select(n(h)).on(o+m,s).on(a+m,l),y=J(h),b=e(f,v);i?(u=i.apply(c,arguments),u=[u.x-b[0],u.y-b[1]]):u=[0,0],d({type:"dragstart"})}}var r=S(t,"drag","dragstart","dragend"),i=null,o=e(M,ca.mouse,n,"mousemove","mouseup"),a=e(Q,ca.touch,x,"touchmove","touchend");return t.origin=function(e){return arguments.length?(i=e,t):i},ca.rebind(t,r,"on")},ca.touches=function(t,e){return arguments.length<2&&(e=E().touches),e?fa(e).map(function(e){var r=$(t,e);return r.identifier=e.identifier,r}):[]};var Na=1e-6,Ba=Na*Na,Ua=Math.PI,Va=2*Ua,qa=Va-Na,Ga=Ua/2,Ha=Ua/180,Xa=180/Ua,Ya=Math.SQRT2,Wa=2,Za=4;ca.interpolateZoom=function(t,e){var r,n,i=t[0],o=t[1],a=t[2],s=e[0],l=e[1],u=e[2],c=s-i,h=l-o,f=c*c+h*h;if(Ba>f)n=Math.log(u/a)/Ya,r=function(t){return[i+t*c,o+t*h,a*Math.exp(Ya*t*n)]};else{var d=Math.sqrt(f),p=(u*u-a*a+Za*f)/(2*a*Wa*d),v=(u*u-a*a-Za*f)/(2*u*Wa*d),m=Math.log(Math.sqrt(p*p+1)-p),g=Math.log(Math.sqrt(v*v+1)-v);n=(g-m)/Ya,r=function(t){var e=t*n,r=ot(m),s=a/(Wa*d)*(r*at(Ya*e+m)-it(m));return[i+s*c,o+s*h,a*r/ot(Ya*e+m)]}}return r.duration=1e3*n,r},ca.behavior.zoom=function(){function t(t){t.on(I,h).on(Ja+".zoom",d).on("dblclick.zoom",p).on(R,f)}function e(t){return[(t[0]-k.x)/k.k,(t[1]-k.y)/k.k]}function r(t){return[t[0]*k.k+k.x,t[1]*k.k+k.y]}function i(t){k.k=Math.max(E[0],Math.min(E[1],t))}function o(t,e){e=r(e),k.x+=t[0]-e[0],k.y+=t[1]-e[1]}function a(e,r,n,a){e.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2,a)),o(m=r,n),e=ca.select(e),L>0&&(e=e.transition().duration(L)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-k.x)/k.k}).map(x.invert)),M&&M.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){z++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--z||(t({type:"zoomend"}),m=null)}function h(){function t(){s=1,o(ca.mouse(i),f),u(a)}function r(){h.on(P,null).on(C,null),d(s),c(a)}var i=this,a=D.of(i,arguments),s=0,h=ca.select(n(i)).on(P,t).on(C,r),f=e(ca.mouse(i)),d=J(i);Gl.call(i),l(a)}function f(){function t(){var t=ca.touches(p);return d=k.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function r(){var e=ca.event.target;ca.select(e).on(x,n).on(_,s),w.push(e);for(var r=ca.event.changedTouches,i=0,o=r.length;o>i;++i)m[r[i].identifier]=null;var l=t(),u=Date.now();if(1===l.length){if(500>u-b){var c=l[0];a(p,c,m[c.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),T()}b=u}else if(l.length>1){var c=l[0],h=l[1],f=c[0]-h[0],d=c[1]-h[1];g=f*f+d*d}}function n(){var t,e,r,n,a=ca.touches(p);Gl.call(p);for(var s=0,l=a.length;l>s;++s,n=null)if(r=a[s],n=m[r.identifier]){if(e)break;t=r,e=n}if(n){var c=(c=r[0]-t[0])*c+(c=r[1]-t[1])*c,h=g&&Math.sqrt(c/g);t=[(t[0]+r[0])/2,(t[1]+r[1])/2],e=[(e[0]+n[0])/2,(e[1]+n[1])/2],i(h*d)}b=null,o(t,e),u(v)}function s(){if(ca.event.touches.length){for(var e=ca.event.changedTouches,r=0,n=e.length;n>r;++r)delete m[e[r].identifier];for(var i in m)return void t()}ca.selectAll(w).on(y,null),M.on(I,h).on(R,f),A(),c(v)}var d,p=this,v=D.of(p,arguments),m={},g=0,y=".zoom-"+ca.event.changedTouches[0].identifier,x="touchmove"+y,_="touchend"+y,w=[],M=ca.select(p),A=J(p);r(),l(v),M.on(I,null).on(R,r)}function d(){var t=D.of(this,arguments);y?clearTimeout(y):(Gl.call(this),v=e(m=g||ca.mouse(this)),l(t)),y=setTimeout(function(){y=null,c(t)},50),T(),i(Math.pow(2,.002*Ka())*k.k),o(m,v),u(t)}function p(){var t=ca.mouse(this),r=Math.log(k.k)/Math.LN2;a(this,t,e(t),ca.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1)}var v,m,g,y,b,x,_,w,M,k={x:0,y:0,k:1},A=[960,500],E=$a,L=250,z=0,I="mousedown.zoom",P="mousemove.zoom",C="mouseup.zoom",R="touchstart.zoom",D=S(t,"zoomstart","zoom","zoomend");return Ja||(Ja="onwheel"in da?(Ka=function(){return-ca.event.deltaY*(ca.event.deltaMode?120:1)},"wheel"):"onmousewheel"in da?(Ka=function(){return ca.event.wheelDelta},"mousewheel"):(Ka=function(){return-ca.event.detail},"MozMousePixelScroll")),t.event=function(t){t.each(function(){var t=D.of(this,arguments),e=k;Vl?ca.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(t)}).tween("zoom:zoom",function(){var r=A[0],n=A[1],i=m?m[0]:r/2,o=m?m[1]:n/2,a=ca.interpolateZoom([(i-k.x)/k.k,(o-k.y)/k.k,r/k.k],[(i-e.x)/e.k,(o-e.y)/e.k,r/e.k]);return function(e){var n=a(e),s=r/n[2];this.__chart__=k={x:i-n[0]*s,y:o-n[1]*s,k:s},u(t)}}).each("interrupt.zoom",function(){c(t)}).each("end.zoom",function(){c(t)}):(this.__chart__=k,l(t),u(t),c(t))})},t.translate=function(e){return arguments.length?(k={x:+e[0],y:+e[1],k:k.k},s(),t):[k.x,k.y]},t.scale=function(e){return arguments.length?(k={x:k.x,y:k.y,k:null},i(+e),s(),t):k.k},t.scaleExtent=function(e){return arguments.length?(E=null==e?$a:[+e[0],+e[1]],t):E},t.center=function(e){return arguments.length?(g=e&&[+e[0],+e[1]],t):g},t.size=function(e){return arguments.length?(A=e&&[+e[0],+e[1]],t):A},t.duration=function(e){return arguments.length?(L=+e,t):L},t.x=function(e){return arguments.length?(_=e,x=e.copy(),k={x:0,y:0,k:1},t):_},t.y=function(e){return arguments.length?(M=e,w=e.copy(),k={x:0,y:0,k:1},t):M},ca.rebind(t,D,"on")};var Ka,Ja,$a=[0,1/0];ca.color=lt,lt.prototype.toString=function(){return this.rgb()+""},ca.hsl=ut;var Qa=ut.prototype=new lt;Qa.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,this.l/t)},Qa.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,t*this.l)},Qa.rgb=function(){return ct(this.h,this.s,this.l)},ca.hcl=ht;var ts=ht.prototype=new lt;ts.brighter=function(t){return new ht(this.h,this.c,Math.min(100,this.l+es*(arguments.length?t:1)))},ts.darker=function(t){return new ht(this.h,this.c,Math.max(0,this.l-es*(arguments.length?t:1)))},ts.rgb=function(){return ft(this.h,this.c,this.l).rgb()},ca.lab=dt;var es=18,rs=.95047,ns=1,is=1.08883,os=dt.prototype=new lt;os.brighter=function(t){return new dt(Math.min(100,this.l+es*(arguments.length?t:1)),this.a,this.b)},os.darker=function(t){return new dt(Math.max(0,this.l-es*(arguments.length?t:1)),this.a,this.b)},os.rgb=function(){return pt(this.l,this.a,this.b)},ca.rgb=bt;var as=bt.prototype=new lt;as.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,i=30;return e||r||n?(e&&i>e&&(e=i),r&&i>r&&(r=i),n&&i>n&&(n=i),new bt(Math.min(255,e/t),Math.min(255,r/t),Math.min(255,n/t))):new bt(i,i,i)},as.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new bt(t*this.r,t*this.g,t*this.b)},as.hsl=function(){return kt(this.r,this.g,this.b)},as.toString=function(){return"#"+wt(this.r)+wt(this.g)+wt(this.b)};var ss=ca.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939, -darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});ss.forEach(function(t,e){ss.set(t,xt(e))}),ca.functor=St,ca.xhr=Lt(x),ca.dsv=function(t,e){function r(t,r,o){arguments.length<3&&(o=r,r=null);var a=zt(t,e,null==r?n:i(r),o);return a.row=function(t){return arguments.length?a.response(null==(r=t)?n:i(t)):r},a}function n(t){return r.parse(t.responseText)}function i(t){return function(e){return r.parse(e.responseText,t)}}function o(e){return e.map(a).join(t)}function a(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return r.parse=function(t,e){var n;return r.parseRows(t,function(t,r){if(n)return n(t,r-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");n=e?function(t,r){return e(i(t),r)}:i})},r.parseRows=function(t,e){function r(){if(c>=u)return a;if(i)return i=!1,o;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++c;){var n=t.charCodeAt(c++),s=1;if(10===n)i=!0;else if(13===n)i=!0,10===t.charCodeAt(c)&&(++c,++s);else if(n!==l)continue;return t.slice(e,c-s)}return t.slice(e)}for(var n,i,o={},a={},s=[],u=t.length,c=0,h=0;(n=r())!==a;){for(var f=[];n!==o&&n!==a;)f.push(n),n=r();e&&null==(f=e(f,h++))||s.push(f)}return s},r.format=function(e){if(Array.isArray(e[0]))return r.formatRows(e);var n=new b,i=[];return e.forEach(function(t){for(var e in t)n.has(e)||i.push(n.add(e))}),[i.map(a).join(t)].concat(e.map(function(e){return i.map(function(t){return a(e[t])}).join(t)})).join("\n")},r.formatRows=function(t){return t.map(o).join("\n")},r},ca.csv=ca.dsv(",","text/csv"),ca.tsv=ca.dsv(" ","text/tab-separated-values");var ls,us,cs,hs,fs=this[w(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};ca.timer=function(){Ct.apply(this,arguments)},ca.timer.flush=function(){Dt(),Ot()},ca.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var ds=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(jt);ca.formatPrefix=function(t,e){var r=0;return(t=+t)&&(0>t&&(t*=-1),e&&(t=ca.round(t,Ft(t,e))),r=1+Math.floor(1e-12+Math.log(t)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((r-1)/3)))),ds[8+r/3]};var ps=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,vs=ca.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ca.round(t,Ft(t,e))).toFixed(Math.max(0,Math.min(20,Ft(t*(1+1e-15),e))))}}),ms=ca.time={},gs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ys.setUTCDate.apply(this._,arguments)},setDay:function(){ys.setUTCDay.apply(this._,arguments)},setFullYear:function(){ys.setUTCFullYear.apply(this._,arguments)},setHours:function(){ys.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ys.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ys.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ys.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ys.setUTCSeconds.apply(this._,arguments)},setTime:function(){ys.setTime.apply(this._,arguments)}};var ys=Date.prototype;ms.year=Vt(function(t){return t=ms.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ms.years=ms.year.range,ms.years.utc=ms.year.utc.range,ms.day=Vt(function(t){var e=new gs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ms.days=ms.day.range,ms.days.utc=ms.day.utc.range,ms.dayOfYear=function(t){var e=ms.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=ms[t]=Vt(function(t){return(t=ms.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=ms.year(t).getDay();return Math.floor((ms.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});ms[t+"s"]=r.range,ms[t+"s"].utc=r.utc.range,ms[t+"OfYear"]=function(t){var r=ms.year(t).getDay();return Math.floor((ms.dayOfYear(t)+(r+e)%7)/7)}}),ms.week=ms.sunday,ms.weeks=ms.sunday.range,ms.weeks.utc=ms.sunday.utc.range,ms.weekOfYear=ms.sundayOfYear;var bs={"-":"",_:" ",0:"0"},xs=/^\s*\d+/,_s=/^%/;ca.locale=function(t){return{numberFormat:Nt(t),timeFormat:Gt(t)}};var ws=ca.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ca.format=ws.numberFormat,ca.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,Ms),fe(Ms.s,this.s,this),this.s?this.t+=Ms.t:this.s=Ms.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Ms=new he;ca.geo.stream=function(t,e){t&&ks.hasOwnProperty(t.type)?ks[t.type](t,e):de(t,e)};var ks={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nt?4*Ua+t:t,Ss.lineStart=Ss.lineEnd=Ss.point=M}};ca.geo.bounds=function(){function t(t,e){b.push(x=[c=t,f=t]),h>e&&(h=e),e>d&&(d=e)}function e(e,r){var n=ge([e*Ha,r*Ha]);if(g){var i=be(g,n),o=[i[1],-i[0],0],a=be(o,i);we(a),a=Me(a);var l=e-p,u=l>0?1:-1,v=a[0]*Xa*u,m=wa(l)>180;if(m^(v>u*p&&u*e>v)){var y=a[1]*Xa;y>d&&(d=y)}else if(v=(v+360)%360-180,m^(v>u*p&&u*e>v)){var y=-a[1]*Xa;h>y&&(h=y)}else h>r&&(h=r),r>d&&(d=r);m?p>e?s(c,e)>s(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e):f>=c?(c>e&&(c=e),e>f&&(f=e)):e>p?s(c,e)>s(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e)}else t(e,r);g=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=f,_.point=t,g=null}function i(t,r){if(g){var n=t-p;y+=wa(n)>180?n+(n>0?360:-360):n}else v=t,m=r;Ss.point(t,r),e(t,r)}function o(){Ss.lineStart()}function a(){i(v,m),Ss.lineEnd(),wa(y)>Na&&(c=-(f=180)),x[0]=c,x[1]=f,g=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tEs?(c=-(f=180),h=-(d=90)):y>Na?d=90:-Na>y&&(h=-90),x[0]=c,x[1]=f}};return function(t){d=f=-(c=h=1/0),b=[],ca.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],o=[i];e>n;++n)r=b[n],u(r[0],i)||u(r[1],i)?(s(i[0],r[1])>s(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(var a,r,p=-(1/0),e=o.length-1,n=0,i=o[e];e>=n;i=r,++n)r=o[n],(a=s(i[1],r[0]))>p&&(p=a,c=r[0],f=i[1])}return b=x=null,c===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,h],[f,d]]}}(),ca.geo.centroid=function(t){Ls=zs=Is=Ps=Cs=Rs=Ds=Os=Fs=js=Ns=0,ca.geo.stream(t,Bs);var e=Fs,r=js,n=Ns,i=e*e+r*r+n*n;return Ba>i&&(e=Rs,r=Ds,n=Os,Na>zs&&(e=Is,r=Ps,n=Cs),i=e*e+r*r+n*n,Ba>i)?[NaN,NaN]:[Math.atan2(r,e)*Xa,nt(n/Math.sqrt(i))*Xa]};var Ls,zs,Is,Ps,Cs,Rs,Ds,Os,Fs,js,Ns,Bs={sphere:M,point:Ae,lineStart:Ee,lineEnd:Se,polygonStart:function(){Bs.lineStart=Le},polygonEnd:function(){Bs.lineStart=Ee}},Us=De(Ie,Ne,Ue,[-Ua,-Ua/2]),Vs=1e9;ca.geo.clipExtent=function(){var t,e,r,n,i,o,a={stream:function(t){return i&&(i.valid=!1),i=o(t),i.valid=!0,i},extent:function(s){return arguments.length?(o=He(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),a):[[t,e],[r,n]]}};return a.extent([[0,0],[960,500]])},(ca.geo.conicEqualArea=function(){return Xe(Ye)}).raw=Ye,ca.geo.albers=function(){return ca.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ca.geo.albersUsa=function(){function t(t){var o=t[0],a=t[1];return e=null,r(o,a),e||(n(o,a),e)||i(o,a),e}var e,r,n,i,o=ca.geo.albers(),a=ca.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=ca.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};return t.invert=function(t){var e=o.scale(),r=o.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&.234>i&&n>=-.425&&-.214>n?a:i>=.166&&.234>i&&n>=-.214&&-.115>n?s:o).invert(t)},t.stream=function(t){var e=o.stream(t),r=a.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),a.precision(e),s.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),a.scale(.35*e),s.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var u=o.scale(),c=+e[0],h=+e[1];return r=o.translate(e).clipExtent([[c-.455*u,h-.238*u],[c+.455*u,h+.238*u]]).stream(l).point,n=a.translate([c-.307*u,h+.201*u]).clipExtent([[c-.425*u+Na,h+.12*u+Na],[c-.214*u-Na,h+.234*u-Na]]).stream(l).point,i=s.translate([c-.205*u,h+.212*u]).clipExtent([[c-.214*u+Na,h+.166*u+Na],[c-.115*u-Na,h+.234*u-Na]]).stream(l).point,t},t.scale(1070)};var qs,Gs,Hs,Xs,Ys,Ws,Zs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Gs=0,Zs.lineStart=We},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=M,qs+=wa(Gs/2)}},Ks={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Js={point:$e,lineStart:Qe,lineEnd:tr,polygonStart:function(){Js.lineStart=er},polygonEnd:function(){Js.point=$e,Js.lineStart=Qe,Js.lineEnd=tr}};ca.geo.path=function(){function t(t){return t&&("function"==typeof s&&o.pointRadius(+s.apply(this,arguments)),a&&a.valid||(a=i(o)),ca.geo.stream(t,a)),o.result()}function e(){return a=null,t}var r,n,i,o,a,s=4.5;return t.area=function(t){return qs=0,ca.geo.stream(t,i(Zs)),qs},t.centroid=function(t){return Is=Ps=Cs=Rs=Ds=Os=Fs=js=Ns=0,ca.geo.stream(t,i(Js)),Ns?[Fs/Ns,js/Ns]:Os?[Rs/Os,Ds/Os]:Cs?[Is/Cs,Ps/Cs]:[NaN,NaN]},t.bounds=function(t){return Ys=Ws=-(Hs=Xs=1/0),ca.geo.stream(t,i(Ks)),[[Hs,Xs],[Ys,Ws]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(o=null==(n=t)?new Ke:new rr(t),"function"!=typeof s&&o.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(o.pointRadius(+e),+e),t):s},t.projection(ca.geo.albersUsa()).context(null)},ca.geo.transform=function(t){return{stream:function(e){var r=new or(e);for(var n in t)r[n]=t[n];return r}}},or.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ca.geo.projection=sr,ca.geo.projectionMutator=lr,(ca.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,ca.geo.rotation=function(t){function e(e){return e=t(e[0]*Ha,e[1]*Ha),e[0]*=Xa,e[1]*=Xa,e}return t=fr(t[0]%360*Ha,t[1]*Ha,t.length>2?t[2]*Ha:0),e.invert=function(e){return e=t.invert(e[0]*Ha,e[1]*Ha),e[0]*=Xa,e[1]*=Xa,e},e},hr.invert=cr,ca.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=fr(-t[0]*Ha,-t[1]*Ha,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=Xa,t[1]*=Xa}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=mr((e=+n)*Ha,i*Ha),t):e},t.precision=function(n){return arguments.length?(r=mr(e*Ha,(i=+n)*Ha),t):i},t.angle(90)},ca.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ha,i=t[1]*Ha,o=e[1]*Ha,a=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(o),h=Math.cos(o);return Math.atan2(Math.sqrt((r=h*a)*r+(r=u*c-l*h*s)*r),l*c+u*h*s)},ca.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ca.range(Math.ceil(o/m)*m,i,m).map(f).concat(ca.range(Math.ceil(u/g)*g,l,g).map(d)).concat(ca.range(Math.ceil(n/p)*p,r,p).filter(function(t){return wa(t%m)>Na}).map(c)).concat(ca.range(Math.ceil(s/v)*v,a,v).filter(function(t){return wa(t%g)>Na}).map(h))}var r,n,i,o,a,s,l,u,c,h,f,d,p=10,v=p,m=90,g=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[f(o).concat(d(l).slice(1),f(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],o>i&&(e=o,o=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[o,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],a=+e[1][1],n>r&&(e=n,n=r,r=e),s>a&&(e=s,s=a,a=e),t.precision(y)):[[n,s],[r,a]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],g=+e[1],t):[m,g]},t.minorStep=function(e){return arguments.length?(p=+e[0],v=+e[1],t):[p,v]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,a,90),h=br(n,r,y),f=yr(u,l,90),d=br(o,i,y),t):y},t.majorExtent([[-180,-90+Na],[180,90-Na]]).minorExtent([[-180,-80-Na],[180,80+Na]])},ca.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=xr,i=_r;return t.distance=function(){return ca.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},ca.geo.interpolate=function(t,e){return wr(t[0]*Ha,t[1]*Ha,e[0]*Ha,e[1]*Ha)},ca.geo.length=function(t){return $s=0,ca.geo.stream(t,Qs),$s};var $s,Qs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},tl=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ca.geo.azimuthalEqualArea=function(){return sr(tl)}).raw=tl;var el=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(ca.geo.azimuthalEquidistant=function(){return sr(el)}).raw=el,(ca.geo.conicConformal=function(){return Xe(Ar)}).raw=Ar,(ca.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var rl=kr(function(t){return 1/t},Math.atan);(ca.geo.gnomonic=function(){return sr(rl)}).raw=rl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ga]},(ca.geo.mercator=function(){return Sr(Er)}).raw=Er;var nl=kr(function(){return 1},Math.asin);(ca.geo.orthographic=function(){return sr(nl)}).raw=nl;var il=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ca.geo.stereographic=function(){return sr(il)}).raw=il,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ga]},(ca.geo.transverseMercator=function(){var t=Sr(Lr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Lr,ca.geom={},ca.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=St(r),o=St(n),a=t.length,s=[],l=[];for(e=0;a>e;e++)s.push([+i.call(this,t[e],e),+o.call(this,t[e],e),e]);for(s.sort(Cr),e=0;a>e;e++)l.push([s[e][0],-s[e][1]]);var u=Pr(s),c=Pr(l),h=c[0]===u[0],f=c[c.length-1]===u[u.length-1],d=[];for(e=u.length-1;e>=0;--e)d.push(t[s[u[e]][2]]);for(e=+h;e=n&&u.x<=o&&u.y>=i&&u.y<=a?[[n,a],[o,a],[o,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Na)*Na,y:Math.round(a(t,e)/Na)*Na,i:e}})}var n=zr,i=Ir,o=n,a=i,s=dl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,o,a=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,h=c.l===a?c.r:c.l;++l=u,f=n>=c,d=f<<1|h;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),h?i=u:s=u,f?a=c:l=c,o(t,e,r,n,i,a,s,l)}var c,h,f,d,p,v,m,g,y,b=St(s),x=St(l);if(null!=e)v=e,m=r,g=n,y=i;else if(g=y=-(v=m=1/0),h=[],f=[],p=t.length,a)for(d=0;p>d;++d)c=t[d],c.xg&&(g=c.x),c.y>y&&(y=c.y),h.push(c.x),f.push(c.y);else for(d=0;p>d;++d){var _=+b(c=t[d],d),w=+x(c,d);v>_&&(v=_),m>w&&(m=w),_>g&&(g=_),w>y&&(y=w),h.push(_),f.push(w)}var M=g-v,k=y-m;M>k?y=m+M:g=v+k;var A=pn();if(A.add=function(t){o(A,t,+b(t,++d),+x(t,d),v,m,g,y)},A.visit=function(t){vn(t,A,v,m,g,y)},A.find=function(t){return mn(A,t[0],t[1],v,m,g,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gl.get(r)||ml,n=yl.get(n)||x,Mn(n(r.apply(null,ha.call(arguments,1))))},ca.interpolateHcl=On,ca.interpolateHsl=Fn,ca.interpolateLab=jn,ca.interpolateRound=Nn,ca.transform=function(t){var e=da.createElementNS(ca.ns.prefix.svg,"g");return(ca.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:bl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var bl={a:1,b:0,c:0,d:1,e:0,f:0};ca.interpolateTransform=Zn,ca.layout={},ca.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++rs*s/g){if(v>l){var u=e.charge/l;t.px-=o*u,t.py-=a*u}return!0}if(e.point&&l&&v>l){var u=e.pointCharge/l;t.px-=o*u,t.py-=a*u}}return!e.charge}}function e(t){t.px=ca.event.x,t.py=ca.event.y,l.resume()}var r,n,i,o,a,s,l={},u=ca.dispatch("start","tick","end"),c=[1,1],h=.9,f=xl,d=_l,p=-30,v=wl,m=.1,g=.64,y=[],b=[];return l.tick=function(){if((i*=.99)<.005)return r=null,u.end({type:"end",alpha:i=0}),!0;var e,n,l,f,d,v,g,x,_,w=y.length,M=b.length;for(n=0;M>n;++n)l=b[n],f=l.source,d=l.target,x=d.x-f.x,_=d.y-f.y,(v=x*x+_*_)&&(v=i*a[n]*((v=Math.sqrt(v))-o[n])/v,x*=v,_*=v,d.x-=x*(g=f.weight+d.weight?f.weight/(f.weight+d.weight):.5),d.y-=_*g,f.x+=x*(g=1-g),f.y+=_*g);if((g=i*m)&&(x=c[0]/2,_=c[1]/2,n=-1,g))for(;++n0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=Ct(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;i>l;++l)r[l]=[];for(l=0;u>l;++l){var o=b[l];r[o.source.index].push(o.target),r[o.target.index].push(o.source)}}for(var a,s=r[e],l=-1,c=s.length;++le;++e)(n=y[e]).index=e,n.weight=0;for(e=0;u>e;++e)n=b[e],"number"==typeof n.source&&(n.source=y[n.source]),"number"==typeof n.target&&(n.target=y[n.target]),++n.source.weight,++n.target.weight;for(e=0;i>e;++e)n=y[e],isNaN(n.x)&&(n.x=t("x",h)),isNaN(n.y)&&(n.y=t("y",v)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(o=[],"function"==typeof f)for(e=0;u>e;++e)o[e]=+f.call(this,b[e],e);else for(e=0;u>e;++e)o[e]=f;if(a=[],"function"==typeof d)for(e=0;u>e;++e)a[e]=+d.call(this,b[e],e);else for(e=0;u>e;++e)a[e]=d;if(s=[],"function"==typeof p)for(e=0;i>e;++e)s[e]=+p.call(this,y[e],e);else for(e=0;i>e;++e)s[e]=p;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return n||(n=ca.behavior.drag().origin(x).on("dragstart.force",ei).on("drag.force",e).on("dragend.force",ri)),arguments.length?void this.on("mouseover.force",ni).on("mouseout.force",ii).call(n):n},ca.rebind(l,u,"on")};var xl=20,_l=1,wl=1/0;ca.layout.hierarchy=function(){function t(i){var o,a=[i],s=[];for(i.depth=0;null!=(o=a.pop());)if(s.push(o),(u=r.call(t,o,o.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)a.push(c=u[l]),c.parent=o,c.depth=o.depth+1;n&&(o.value=0),o.children=u}else n&&(o.value=+n.call(t,o,o.depth)||0),delete o.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=hi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0), -(r=e.parent)&&(r.value+=e.value)})),e},t},ca.layout.partition=function(){function t(e,r,n,i){var o=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,o&&(a=o.length)){var a,s,l,u=-1;for(n=e.value?n/e.value:0;++uh?-1:1),p=ca.sum(u),v=p?(h-l*d)/p:0,m=ca.range(l),g=[];return null!=r&&m.sort(r===Ml?function(t,e){return u[e]-u[t]}:function(t,e){return r(a[t],a[e])}),m.forEach(function(t){g[t]={data:a[t],value:s=u[t],startAngle:c,endAngle:c+=s*v+d,padAngle:f}}),g}var e=Number,r=Ml,n=0,i=Va,o=0;return t.value=function(r){return arguments.length?(e=r,t):e},t.sort=function(e){return arguments.length?(r=e,t):r},t.startAngle=function(e){return arguments.length?(n=e,t):n},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(o=e,t):o},t};var Ml={};ca.layout.stack=function(){function t(s,l){if(!(f=s.length))return s;var u=s.map(function(r,n){return e.call(t,r,n)}),c=u.map(function(e){return e.map(function(e,r){return[o.call(t,e,r),a.call(t,e,r)]})}),h=r.call(t,c,l);u=ca.permute(u,h),c=ca.permute(c,h);var f,d,p,v,m=n.call(t,c,l),g=u[0].length;for(p=0;g>p;++p)for(i.call(t,u[0][p],v=m[p],c[0][p][1]),d=1;f>d;++d)i.call(t,u[d][p],v+=c[d-1][p][1],c[d][p][1]);return s}var e=x,r=mi,n=gi,i=vi,o=di,a=pi;return t.values=function(r){return arguments.length?(e=r,t):e},t.order=function(e){return arguments.length?(r="function"==typeof e?e:kl.get(e)||mi,t):r},t.offset=function(e){return arguments.length?(n="function"==typeof e?e:Al.get(e)||gi,t):n},t.x=function(e){return arguments.length?(o=e,t):o},t.y=function(e){return arguments.length?(a=e,t):a},t.out=function(e){return arguments.length?(i=e,t):i},t};var kl=ca.map({"inside-out":function(t){var e,r,n=t.length,i=t.map(yi),o=t.map(bi),a=ca.range(n).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,u=[],c=[];for(e=0;n>e;++e)r=a[e],l>s?(s+=o[r],u.push(r)):(l+=o[r],c.push(r));return c.reverse().concat(u)},reverse:function(t){return ca.range(t.length).reverse()},"default":mi}),Al=ca.map({silhouette:function(t){var e,r,n,i=t.length,o=t[0].length,a=[],s=0,l=[];for(r=0;o>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];n>s&&(s=n),a.push(n)}for(r=0;o>r;++r)l[r]=(s-a[r])/2;return l},wiggle:function(t){var e,r,n,i,o,a,s,l,u,c=t.length,h=t[0],f=h.length,d=[];for(d[0]=l=u=0,r=1;f>r;++r){for(e=0,i=0;c>e;++e)i+=t[e][r][1];for(e=0,o=0,s=h[r][0]-h[r-1][0];c>e;++e){for(n=0,a=(t[e][r][1]-t[e][r-1][1])/(2*s);e>n;++n)a+=(t[n][r][1]-t[n][r-1][1])/s;o+=a*t[e][r][1]}d[r]=l-=i?o/i*s:0,u>l&&(u=l)}for(r=0;f>r;++r)d[r]-=u;return d},expand:function(t){var e,r,n,i=t.length,o=t[0].length,a=1/i,s=[];for(r=0;o>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];if(n)for(e=0;i>e;e++)t[e][r][1]/=n;else for(e=0;i>e;e++)t[e][r][1]=a}for(r=0;o>r;++r)s[r]=0;return s},zero:gi});ca.layout.histogram=function(){function t(t,o){for(var a,s,l=[],u=t.map(r,this),c=n.call(this,u,o),h=i.call(this,c,u,o),o=-1,f=u.length,d=h.length-1,p=e?1:1/f;++o0)for(o=-1;++o=c[0]&&s<=c[1]&&(a=l[ca.bisect(h,s,1,d)-1],a.y+=p,a.push(t[o]));return l}var e=!0,r=Number,n=Mi,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=St(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:St(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},ca.layout.pack=function(){function t(t,o){var a=r.call(this,t,o),s=a[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Si),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=h}),li(s,Si),li(s,function(t){t.r-=h})}return Ii(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),a}var e,r=ca.layout.hierarchy().sort(ki),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},ai(t,r)},ca.layout.tree=function(){function t(t,i){var c=a.call(this,t,i),h=c[0],f=e(h);if(li(f,r),f.parent.m=-f.z,si(f,n),u)si(h,o);else{var d=h,p=h,v=h;si(h,function(t){t.xp.x&&(p=t),t.depth>v.depth&&(v=t)});var m=s(d,p)/2-d.x,g=l[0]/(p.x+s(p,d)/2+m),y=l[1]/(v.depth||1);si(h,function(t){t.x=(t.x+m)*g,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,o=e.children,a=0,s=o.length;s>a;++a)n.push((o[a]=i={_:o[a],parent:e,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return r.children[0]}function r(t){var e=t.children,r=t.parent.children,n=t.i?r[t.i-1]:null;if(e.length){Fi(t);var o=(e[0].z+e[e.length-1].z)/2;n?(t.z=n.z+s(t._,n._),t.m=t.z-o):t.z=o}else n&&(t.z=n.z+s(t._,n._));t.parent.A=i(t,n,t.parent.A||r[0])}function n(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t,e,r){if(e){for(var n,i=t,o=t,a=e,l=i.parent.children[0],u=i.m,c=o.m,h=a.m,f=l.m;a=Di(a),i=Ri(i),a&&i;)l=Ri(l),o=Di(o),o.a=t,n=a.z+h-i.z-u+s(a._,i._),n>0&&(Oi(ji(a,t,r),t,n),u+=n,c+=n),h+=a.m,u+=i.m,f+=l.m,c+=o.m;a&&!Di(o)&&(o.t=a,o.m+=h-c),i&&!Ri(l)&&(l.t=i,l.m+=u-f,r=t)}return r}function o(t){t.x*=l[0],t.y=t.depth*l[1]}var a=ca.layout.hierarchy().sort(null).value(null),s=Ci,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?o:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:o,t):u?l:null},ai(t,a)},ca.layout.cluster=function(){function t(t,o){var a,s=e.call(this,t,o),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Ni(e)):(t.x=a?u+=r(t,a):0,t.y=0,a=t)});var c=Ui(l),h=Vi(l),f=c.x-r(c,h)/2,d=h.x+r(h,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-f)/(d-f)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=ca.layout.hierarchy().sort(null).value(null),r=Ci,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},ai(t,e)},ca.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,o=t.length;++ie?0:e),r.area=isNaN(n)||0>=n?0:n}function e(r){var o=r.children;if(o&&o.length){var a,s,l,u=h(r),c=[],f=o.slice(),p=1/0,v="slice"===d?u.dx:"dice"===d?u.dy:"slice-dice"===d?1&r.depth?u.dy:u.dx:Math.min(u.dx,u.dy);for(t(f,u.dx*u.dy/r.value),c.area=0;(l=f.length)>0;)c.push(a=f[l-1]),c.area+=a.area,"squarify"!==d||(s=n(c,v))<=p?(f.pop(),p=s):(c.area-=c.pop().area,i(c,v,u,!1),v=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,v,u,!0),c.length=c.area=0),o.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var o,a=h(e),s=n.slice(),l=[];for(t(s,a.dx*a.dy/e.value),l.area=0;o=s.pop();)l.push(o),l.area+=o.area,null!=o.z&&(i(l,o.z?a.dx:a.dy,a,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,o=1/0,a=-1,s=t.length;++ar&&(o=r),r>i&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*o*p)):1/0}function i(t,e,r,n){var i,o=-1,a=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++or.dx)&&(c=r.dx);++or&&(e=1),1>r&&(t=0),function(){var r,n,i;do r=2*Math.random()-1,n=2*Math.random()-1,i=r*r+n*n;while(!i||i>1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=ca.random.normal.apply(ca,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ca.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;t>r;r++)e+=Math.random();return e}}},ca.scale={};var Tl={floor:x,ceil:x};ca.scale.linear=function(){return Ji([0,1],[0,1],_n,!1)};var El={s:1,g:1,p:1,r:1,e:1};ca.scale.log=function(){return oo(ca.scale.linear().domain([0,1]),10,!0,[1,10])};var Sl=ca.format(".0e"),Ll={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};ca.scale.pow=function(){return ao(ca.scale.linear(),1,[0,1])},ca.scale.sqrt=function(){return ca.scale.pow().exponent(.5)},ca.scale.ordinal=function(){return lo([],{t:"range",a:[[]]})},ca.scale.category10=function(){return ca.scale.ordinal().range(zl)},ca.scale.category20=function(){return ca.scale.ordinal().range(Il)},ca.scale.category20b=function(){return ca.scale.ordinal().range(Pl)},ca.scale.category20c=function(){return ca.scale.ordinal().range(Cl)};var zl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(_t),Il=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(_t),Pl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(_t),Cl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(_t);ca.scale.quantile=function(){return uo([],[])},ca.scale.quantize=function(){return co(0,1,[0,1])},ca.scale.threshold=function(){return ho([.5],[0,1])},ca.scale.identity=function(){return fo([0,1])},ca.svg={},ca.svg.arc=function(){function t(){var t=Math.max(0,+r.apply(this,arguments)),u=Math.max(0,+n.apply(this,arguments)),c=a.apply(this,arguments)-Ga,h=s.apply(this,arguments)-Ga,f=Math.abs(h-c),d=c>h?0:1;if(t>u&&(p=u,u=t,t=p),f>=qa)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,v,m,g,y,b,x,_,w,M,k,A,T=0,E=0,S=[];if((g=(+l.apply(this,arguments)||0)/2)&&(m=o===Rl?Math.sqrt(t*t+u*u):+o.apply(this,arguments),d||(E*=-1),u&&(E=nt(m/u*Math.sin(g))),t&&(T=nt(m/t*Math.sin(g)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(h-E),_=u*Math.sin(h-E);var L=Math.abs(h-c-2*E)<=Ua?0:1;if(E&&xo(y,b,x,_)===d^L){var z=(c+h)/2;y=u*Math.cos(z),b=u*Math.sin(z),x=_=null}}else y=b=0;if(t){w=t*Math.cos(h-T),M=t*Math.sin(h-T),k=t*Math.cos(c+T),A=t*Math.sin(c+T);var I=Math.abs(c-h+2*T)<=Ua?0:1;if(T&&xo(w,M,k,A)===1-d^I){var P=(c+h)/2;w=t*Math.cos(P),M=t*Math.sin(P),k=A=null}}else w=M=0;if(f>Na&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){v=u>t^d?0:1;var C=p,R=p;if(Ua>f){var D=null==k?[w,M]:null==x?[y,b]:Dr([y,b],[k,A],[x,_],[w,M]),O=y-D[0],F=b-D[1],j=x-D[0],N=_-D[1],B=1/Math.sin(Math.acos((O*j+F*N)/(Math.sqrt(O*O+F*F)*Math.sqrt(j*j+N*N)))/2),U=Math.sqrt(D[0]*D[0]+D[1]*D[1]);R=Math.min(p,(t-U)/(B-1)),C=Math.min(p,(u-U)/(B+1))}if(null!=x){var V=_o(null==k?[w,M]:[k,A],[y,b],u,C,d),q=_o([x,_],[w,M],u,C,d);p===C?S.push("M",V[0],"A",C,",",C," 0 0,",v," ",V[1],"A",u,",",u," 0 ",1-d^xo(V[1][0],V[1][1],q[1][0],q[1][1]),",",d," ",q[1],"A",C,",",C," 0 0,",v," ",q[0]):S.push("M",V[0],"A",C,",",C," 0 1,",v," ",q[0])}else S.push("M",y,",",b);if(null!=k){var G=_o([y,b],[k,A],t,-R,d),H=_o([w,M],null==x?[y,b]:[x,_],t,-R,d);p===R?S.push("L",H[0],"A",R,",",R," 0 0,",v," ",H[1],"A",t,",",t," 0 ",d^xo(H[1][0],H[1][1],G[1][0],G[1][1]),",",1-d," ",G[1],"A",R,",",R," 0 0,",v," ",G[0]):S.push("L",H[0],"A",R,",",R," 0 0,",v," ",G[0])}else S.push("L",w,",",M)}else S.push("M",y,",",b),null!=x&&S.push("A",u,",",u," 0 ",L,",",d," ",x,",",_),S.push("L",w,",",M),null!=k&&S.push("A",t,",",t," 0 ",I,",",1-d," ",k,",",A);return S.push("Z"),S.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var r=vo,n=mo,i=po,o=Rl,a=go,s=yo,l=bo;return t.innerRadius=function(e){return arguments.length?(r=St(e),t):r},t.outerRadius=function(e){return arguments.length?(n=St(e),t):n},t.cornerRadius=function(e){return arguments.length?(i=St(e),t):i},t.padRadius=function(e){return arguments.length?(o=e==Rl?Rl:St(e),t):o},t.startAngle=function(e){return arguments.length?(a=St(e),t):a},t.endAngle=function(e){return arguments.length?(s=St(e),t):s},t.padAngle=function(e){return arguments.length?(l=St(e),t):l},t.centroid=function(){var t=(+r.apply(this,arguments)+ +n.apply(this,arguments))/2,e=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-Ga;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Rl="auto";ca.svg.line=function(){return wo(x)};var Dl=ca.map({linear:Mo,"linear-closed":ko,step:Ao,"step-before":To,"step-after":Eo,basis:Co,"basis-open":Ro,"basis-closed":Do,bundle:Oo,cardinal:zo,"cardinal-open":So,"cardinal-closed":Lo,monotone:Vo});Dl.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var Ol=[0,2/3,1/3,0],Fl=[0,1/3,2/3,0],jl=[0,1/6,2/3,1/6];ca.svg.line.radial=function(){var t=wo(qo);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},To.reverse=Eo,Eo.reverse=To,ca.svg.area=function(){return Go(x)},ca.svg.area.radial=function(){var t=Go(qo);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},ca.svg.chord=function(){function t(t,s){var l=e(this,o,t,s),u=e(this,a,t,s);return"M"+l.p0+n(l.r,l.p1,l.a1-l.a0)+(r(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+n(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function e(t,e,r,n){var i=e.call(t,r,n),o=s.call(t,i,n),a=l.call(t,i,n)-Ga,c=u.call(t,i,n)-Ga;return{r:o,a0:a,a1:c,p0:[o*Math.cos(a),o*Math.sin(a)],p1:[o*Math.cos(c),o*Math.sin(c)]}}function r(t,e){return t.a0==e.a0&&t.a1==e.a1}function n(t,e,r){return"A"+t+","+t+" 0 "+ +(r>Ua)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var o=xr,a=_r,s=Ho,l=go,u=yo;return t.radius=function(e){return arguments.length?(s=St(e),t):s},t.source=function(e){return arguments.length?(o=St(e),t):o},t.target=function(e){return arguments.length?(a=St(e),t):a},t.startAngle=function(e){return arguments.length?(l=St(e),t):l},t.endAngle=function(e){return arguments.length?(u=St(e),t):u},t},ca.svg.diagonal=function(){function t(t,i){var o=e.call(this,t,i),a=r.call(this,t,i),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Xo;return t.source=function(r){return arguments.length?(e=St(r),t):e},t.target=function(e){return arguments.length?(r=St(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},ca.svg.diagonal.radial=function(){var t=ca.svg.diagonal(),e=Xo,r=t.projection;return t.projection=function(t){return arguments.length?r(Yo(e=t)):e},t},ca.svg.symbol=function(){function t(t,n){return(Nl.get(e.call(this,t,n))||Ko)(r.call(this,t,n))}var e=Zo,r=Wo;return t.type=function(r){return arguments.length?(e=St(r),t):e},t.size=function(e){return arguments.length?(r=St(e),t):r},t};var Nl=ca.map({circle:Ko,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Ul)),r=e*Ul;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Bl),r=e*Bl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Bl),r=e*Bl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ca.svg.symbolTypes=Nl.keys();var Bl=Math.sqrt(3),Ul=Math.tan(30*Ha);Ia.transition=function(t){for(var e,r,n=Vl||++Xl,i=ea(t),o=[],a=ql||{time:Date.now(),ease:Sn,delay:0,duration:250},s=-1,l=this.length;++so;o++){i.push(e=[]);for(var r=this[o],s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,o)&&e.push(n)}return $o(i,this.namespace,this.id)},Hl.tween=function(t,e){var r=this.id,n=this.namespace;return arguments.length<2?this.node()[n][r].tween.get(t):H(this,null==e?function(e){e[n][r].tween.remove(t)}:function(i){i[n][r].tween.set(t,e)})},Hl.attr=function(t,e){function r(){this.removeAttribute(s)}function n(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?r:(t+="",function(){var e,r=this.getAttribute(s);return r!==t&&(e=a(r,t),function(t){this.setAttribute(s,e(t))})})}function o(t){return null==t?n:(t+="",function(){var e,r=this.getAttributeNS(s.space,s.local);return r!==t&&(e=a(r,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var a="transform"==t?Zn:_n,s=ca.ns.qualify(t);return Qo(this,"attr."+t,e,s.local?o:i)},Hl.attrTween=function(t,e){function r(t,r){var n=e.call(this,t,r,this.getAttribute(i));return n&&function(t){this.setAttribute(i,n(t))}}function n(t,r){var n=e.call(this,t,r,this.getAttributeNS(i.space,i.local));return n&&function(t){this.setAttributeNS(i.space,i.local,n(t))}}var i=ca.ns.qualify(t);return this.tween("attr."+t,i.local?n:r)},Hl.style=function(t,e,r){function i(){this.style.removeProperty(t)}function o(e){return null==e?i:(e+="",function(){var i,o=n(this).getComputedStyle(this,null).getPropertyValue(t);return o!==e&&(i=_n(o,e),function(e){this.style.setProperty(t,i(e),r)})})}var a=arguments.length;if(3>a){if("string"!=typeof t){2>a&&(e="");for(r in t)this.style(r,t[r],e);return this}r=""}return Qo(this,"style."+t,e,o)},Hl.styleTween=function(t,e,r){function i(i,o){var a=e.call(this,i,o,n(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(e){this.style.setProperty(t,a(e),r)}}return arguments.length<3&&(r=""),this.tween("style."+t,i)},Hl.text=function(t){return Qo(this,"text",t,ta)},Hl.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Hl.ease=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].ease:("function"!=typeof t&&(t=ca.ease.apply(ca,arguments)),H(this,function(n){n[r][e].ease=t}))},Hl.delay=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].delay:H(this,"function"==typeof t?function(n,i,o){n[r][e].delay=+t.call(n,n.__data__,i,o)}:(t=+t,function(n){n[r][e].delay=t}))},Hl.duration=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].duration:H(this,"function"==typeof t?function(n,i,o){n[r][e].duration=Math.max(1,t.call(n,n.__data__,i,o))}:(t=Math.max(1,t),function(n){n[r][e].duration=t}))},Hl.each=function(t,e){var r=this.id,n=this.namespace;if(arguments.length<2){var i=ql,o=Vl;try{Vl=r,H(this,function(e,i,o){ql=e[n][r],t.call(e,e.__data__,i,o)})}finally{ql=i,Vl=o}}else H(this,function(i){var o=i[n][r];(o.event||(o.event=ca.dispatch("start","end","interrupt"))).on(t,e)});return this},Hl.transition=function(){for(var t,e,r,n,i=this.id,o=++Xl,a=this.namespace,s=[],l=0,u=this.length;u>l;l++){s.push(t=[]);for(var e=this[l],c=0,h=e.length;h>c;c++)(r=e[c])&&(n=r[a][i],ra(r,c,a,o,{time:n.time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration})),t.push(r)}return $o(s,a,o)},ca.svg.axis=function(){function t(t){t.each(function(){var t,u=ca.select(this),c=this.__chart__||r,h=this.__chart__=r.copy(),f=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,d=null==e?h.tickFormat?h.tickFormat.apply(h,s):x:e,p=u.selectAll(".tick").data(f,h),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Na),m=ca.transition(p.exit()).style("opacity",Na).remove(),g=ca.transition(p.order()).style("opacity",1),y=Math.max(i,0)+a,b=Xi(h),_=u.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),ca.transition(_));v.append("line"),v.append("text");var M,k,A,T,E=v.select("line"),S=g.select("line"),L=p.select("text").text(d),z=v.select("text"),I=g.select("text"),P="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(t=na,M="x",A="y",k="x2",T="y2",L.attr("dy",0>P?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+b[0]+","+P*o+"V0H"+b[1]+"V"+P*o)):(t=ia,M="y",A="x",k="y2",T="x2",L.attr("dy",".32em").style("text-anchor",0>P?"end":"start"),w.attr("d","M"+P*o+","+b[0]+"H0V"+b[1]+"H"+P*o)),E.attr(T,P*i),z.attr(A,P*y),S.attr(k,0).attr(T,P*i),I.attr(M,0).attr(A,P*y),h.rangeBand){var C=h,R=C.rangeBand()/2;c=h=function(t){return C(t)+R}}else c.rangeBand?c=h:m.call(t,h,c);v.call(t,c,h),g.call(t,h,h)})}var e,r=ca.scale.linear(),n=Yl,i=6,o=6,a=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(r=e,t):r},t.orient=function(e){return arguments.length?(n=e in Wl?e+"":Yl,t):n},t.ticks=function(){return arguments.length?(s=fa(arguments),t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(r){return arguments.length?(e=r,t):e},t.tickSize=function(e){var r=arguments.length;return r?(i=+e,o=+arguments[r-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(o=+e,t):o},t.tickPadding=function(e){return arguments.length?(a=+e,t):a},t.tickSubdivide=function(){return arguments.length&&t},t};var Yl="bottom",Wl={top:1,right:1,bottom:1,left:1};ca.svg.brush=function(){function t(n){n.each(function(){var n=ca.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),a=n.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),n.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=n.selectAll(".resize").data(v,x);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Zl[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var l,h=ca.transition(n),f=ca.transition(a);u&&(l=Xi(u),f.attr("x",l[0]).attr("width",l[1]-l[0]),r(h)),c&&(l=Xi(c),f.attr("y",l[0]).attr("height",l[1]-l[0]),i(h)),e(h)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+h[+/e$/.test(t)]+","+f[+/^s/.test(t)]+")"})}function r(t){t.select(".extent").attr("x",h[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",h[1]-h[0])}function i(t){t.select(".extent").attr("y",f[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function o(){function o(){32==ca.event.keyCode&&(L||(b=null,I[0]-=h[1],I[1]-=f[1],L=2),T())}function v(){32==ca.event.keyCode&&2==L&&(I[0]+=h[1],I[1]+=f[1],L=0,T())}function m(){var t=ca.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),L||(ca.event.altKey?(b||(b=[(h[0]+h[1])/2,(f[0]+f[1])/2]),I[0]=h[+(t[0]c?(i=n,n=c):i=c),v[0]!=n||v[1]!=i?(r?s=null:a=null,v[0]=n,v[1]=i,!0):void 0}function y(){m(),k.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),ca.select("body").style("cursor",null),P.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),M({type:"brushend"})}var b,x,_=this,w=ca.select(ca.event.target),M=l.of(_,arguments),k=ca.select(_),A=w.datum(),E=!/^(n|s)$/.test(A)&&u,S=!/^(e|w)$/.test(A)&&c,L=w.classed("extent"),z=J(_),I=ca.mouse(_),P=ca.select(n(_)).on("keydown.brush",o).on("keyup.brush",v);if(ca.event.changedTouches?P.on("touchmove.brush",m).on("touchend.brush",y):P.on("mousemove.brush",m).on("mouseup.brush",y),k.interrupt().selectAll("*").interrupt(),L)I[0]=h[0]-I[0],I[1]=f[0]-I[1];else if(A){var C=+/w$/.test(A),R=+/^n/.test(A);x=[h[1-C]-I[0],f[1-R]-I[1]],I[0]=h[C],I[1]=f[R]}else ca.event.altKey&&(b=I.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),ca.select("body").style("cursor",w.style("cursor")),M({type:"brushstart"}),m()}var a,s,l=S(t,"brushstart","brush","brushend"),u=null,c=null,h=[0,0],f=[0,0],d=!0,p=!0,v=Kl[0];return t.event=function(t){t.each(function(){var t=l.of(this,arguments),e={x:h,y:f,i:a,j:s},r=this.__chart__||e;this.__chart__=e,Vl?ca.select(this).transition().each("start.brush",function(){a=r.i,s=r.j,h=r.x,f=r.y,t({type:"brushstart"})}).tween("brush:brush",function(){var r=wn(h,e.x),n=wn(f,e.y);return a=s=null,function(i){h=e.x=r(i),f=e.y=n(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(u=e,v=Kl[!u<<1|!c],t):u},t.y=function(e){return arguments.length?(c=e,v=Kl[!u<<1|!c],t):c},t.clamp=function(e){return arguments.length?(u&&c?(d=!!e[0],p=!!e[1]):u?d=!!e:c&&(p=!!e),t):u&&c?[d,p]:u?d:c?p:null},t.extent=function(e){var r,n,i,o,l;return arguments.length?(u&&(r=e[0],n=e[1],c&&(r=r[0],n=n[0]),a=[r,n],u.invert&&(r=u(r),n=u(n)),r>n&&(l=r,r=n,n=l),r==h[0]&&n==h[1]||(h=[r,n])),c&&(i=e[0],o=e[1],u&&(i=i[1],o=o[1]),s=[i,o],c.invert&&(i=c(i),o=c(o)),i>o&&(l=i,i=o,o=l),i==f[0]&&o==f[1]||(f=[i,o])),t):(u&&(a?(r=a[0],n=a[1]):(r=h[0],n=h[1],u.invert&&(r=u.invert(r),n=u.invert(n)),r>n&&(l=r,r=n,n=l))),c&&(s?(i=s[0],o=s[1]):(i=f[0],o=f[1],c.invert&&(i=c.invert(i),o=c.invert(o)),i>o&&(l=i,i=o,o=l))),u&&c?[[r,i],[n,o]]:u?[r,n]:c&&[i,o])},t.clear=function(){return t.empty()||(h=[0,0],f=[0,0],a=s=null),t},t.empty=function(){return!!u&&h[0]==h[1]||!!c&&f[0]==f[1]},ca.rebind(t,l,"on")};var Zl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Kl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Jl=ms.format=ws.timeFormat,$l=Jl.utc,Ql=$l("%Y-%m-%dT%H:%M:%S.%LZ");Jl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?oa:Ql,oa.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},oa.toString=Ql.toString,ms.second=Vt(function(t){return new gs(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),ms.seconds=ms.second.range,ms.seconds.utc=ms.second.utc.range,ms.minute=Vt(function(t){return new gs(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),ms.minutes=ms.minute.range,ms.minutes.utc=ms.minute.utc.range,ms.hour=Vt(function(t){var e=t.getTimezoneOffset()/60;return new gs(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),ms.hours=ms.hour.range,ms.hours.utc=ms.hour.utc.range,ms.month=Vt(function(t){return t=ms.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),ms.months=ms.month.range,ms.months.utc=ms.month.utc.range;var tu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],eu=[[ms.second,1],[ms.second,5],[ms.second,15],[ms.second,30],[ms.minute,1],[ms.minute,5],[ms.minute,15],[ms.minute,30],[ms.hour,1],[ms.hour,3],[ms.hour,6],[ms.hour,12],[ms.day,1],[ms.day,2],[ms.week,1],[ms.month,1],[ms.month,3],[ms.year,1]],ru=Jl.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Ie]]),nu={range:function(t,e,r){return ca.range(Math.ceil(t/r)*r,+e,r).map(sa)},floor:x,ceil:x};eu.year=ms.year,ms.scale=function(){return aa(ca.scale.linear(),eu,ru)};var iu=eu.map(function(t){return[t[0].utc,t[1]]}),ou=$l.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Ie]]);iu.year=ms.year.utc,ms.scale.utc=function(){return aa(ca.scale.linear(),iu,ou)},ca.text=Lt(function(t){return t.responseText}),ca.json=function(t,e){return zt(t,"application/json",la,e)},ca.html=function(t,e){return zt(t,"text/html",ua,e)},ca.xml=Lt(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=ca,t(ca)):"object"==typeof r&&r.exports?r.exports=ca:this.d3=ca}()},{}],120:[function(t,e,r){"use strict";function n(t,e){this.point=t,this.index=e}function i(t,e){for(var r=t.point,n=e.point,i=r.length,o=0;i>o;++o){var a=n[o]-r[o];if(a)return a}return 0}function o(t,e,r){if(1===t)return r?[[-1,0]]:[];var n=e.map(function(t,e){return[t[0],e]});n.sort(function(t,e){return t[0]-e[0]});for(var i=new Array(t-1),o=1;t>o;++o){var a=n[o-1],s=n[o];i[o-1]=[a[1],s[1]]}return r&&i.push([-1,i[0][1]],[i[t-1][1],-1]),i}function a(t,e){var r=t.length;if(0===r)return[];var a=t[0].length;if(1>a)return[];if(1===a)return o(r,t,e);for(var u=new Array(r),c=1,h=0;r>h;++h){for(var f=t[h],d=new Array(a+1),p=0,v=0;a>v;++v){var m=f[v];d[v]=m,p+=m*m; -}d[a]=p,u[h]=new n(d,h),c=Math.max(p,c)}l(u,i),r=u.length;for(var g=new Array(r+a+1),y=new Array(r+a+1),b=(a+1)*(a+1)*c,x=new Array(a+1),h=0;a>=h;++h)x[h]=0;x[a]=b,g[0]=x.slice(),y[0]=-1;for(var h=0;a>=h;++h){var d=x.slice();d[h]=1,g[h+1]=d,y[h+1]=-1}for(var h=0;r>h;++h){var _=u[h];g[h+a+1]=_.point,y[h+a+1]=_.index}var w=s(g,!1);if(w=e?w.filter(function(t){for(var e=0,r=0;a>=r;++r){var n=y[t[r]];if(0>n&&++e>=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;a>=e;++e){var r=y[t[e]];if(0>r)return!1;t[e]=r}return!0}),1&a)for(var h=0;h=i)return[];var o,a=new Array(i);if(r===t.length-1)for(o=0;i>o;++o)a[o]=e;else for(o=0;i>o;++o)a[o]=n(t,e,r+1);return a}function i(t,e){var r,n;for(r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e){switch("undefined"==typeof e&&(e=0),typeof t){case"number":if(t>0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=o},{}],122:[function(e,r,n){(function(n,i){(function(){"use strict";function o(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return"function"==typeof t}function s(t){X=t}function l(t){K=t}function u(){return function(){n.nextTick(p)}}function c(){return function(){H(p)}}function h(){var t=0,e=new Q(p),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}function f(){var t=new MessageChannel;return t.port1.onmessage=p,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(p,1)}}function p(){for(var t=0;Z>t;t+=2){var e=rt[t],r=rt[t+1];e(r),rt[t]=void 0,rt[t+1]=void 0}Z=0}function v(){try{var t=e,r=t("vertx");return H=r.runOnLoop||r.runOnContext,c()}catch(n){return d()}}function m(t,e){var r=this,n=r._state;if(n===at&&!t||n===st&&!e)return this;var i=new this.constructor(y),o=r._result;if(n){var a=arguments[n-1];K(function(){R(n,i,a,o)})}else z(r,i,t,e);return i}function g(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var r=new e(y);return T(r,t),r}function y(){}function b(){return new TypeError("You cannot resolve a promise with itself")}function x(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return lt.error=e,lt}}function w(t,e,r,n){try{t.call(e,r,n)}catch(i){return i}}function M(t,e,r){K(function(t){var n=!1,i=w(r,e,function(r){n||(n=!0,e!==r?T(t,r):S(t,r))},function(e){n||(n=!0,L(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&i&&(n=!0,L(t,i))},t)}function k(t,e){e._state===at?S(t,e._result):e._state===st?L(t,e._result):z(e,void 0,function(e){T(t,e)},function(e){L(t,e)})}function A(t,e,r){e.constructor===t.constructor&&r===nt&&constructor.resolve===it?k(t,e):r===lt?L(t,lt.error):void 0===r?S(t,e):a(r)?M(t,e,r):S(t,e)}function T(t,e){t===e?L(t,b()):o(e)?A(t,e,_(e)):S(t,e)}function E(t){t._onerror&&t._onerror(t._result),I(t)}function S(t,e){t._state===ot&&(t._result=e,t._state=at,0!==t._subscribers.length&&K(I,t))}function L(t,e){t._state===ot&&(t._state=st,t._result=e,K(E,t))}function z(t,e,r,n){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+at]=r,i[o+st]=n,0===o&&t._state&&K(I,t)}function I(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n,i,o=t._result,a=0;aa;a++)z(n.resolve(t[a]),void 0,e,r);return i}function j(t){var e=this,r=new e(y);return L(r,t),r}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this._id=dt++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==t&&("function"!=typeof t&&N(),this instanceof U?D(this,t):B())}function V(t,e){this._instanceConstructor=t,this.promise=new t(y),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):L(this.promise,this._validationError())}function q(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=t.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(t.Promise=pt)}var G;G=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var H,X,Y,W=G,Z=0,K=function(t,e){rt[Z]=t,rt[Z+1]=e,Z+=2,2===Z&&(X?X(p):Y())},J="undefined"!=typeof window?window:void 0,$=J||{},Q=$.MutationObserver||$.WebKitMutationObserver,tt="undefined"!=typeof n&&"[object process]"==={}.toString.call(n),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);Y=tt?u():Q?h():et?f():void 0===J&&"function"==typeof e?v():d();var nt=m,it=g,ot=void 0,at=1,st=2,lt=new P,ut=new P,ct=O,ht=F,ft=j,dt=0,pt=U;U.all=ct,U.race=ht,U.resolve=it,U.reject=ft,U._setScheduler=s,U._setAsap=l,U._asap=K,U.prototype={constructor:U,then:nt,"catch":function(t){return this.then(null,t)}};var vt=V;V.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},V.prototype._enumerate=function(){for(var t=this.length,e=this._input,r=0;this._state===ot&&t>r;r++)this._eachEntry(e[r],r)},V.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===it){var i=_(t);if(i===nt&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(r===pt){var o=new r(y);A(o,t,i),this._willSettleAt(o,e)}else this._willSettleAt(new r(function(e){e(t)}),e)}else this._willSettleAt(n(t),e)},V.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===ot&&(this._remaining--,t===st?L(n,r):this._result[e]=r),0===this._remaining&&S(n,this._result)},V.prototype._willSettleAt=function(t,e){var r=this;z(t,void 0,function(t){r._settledAt(at,e,t)},function(t){r._settledAt(st,e,t)})};var mt=q,gt={Promise:pt,polyfill:mt};"function"==typeof t&&t.amd?t(function(){return gt}):"undefined"!=typeof r&&r.exports?r.exports=gt:"undefined"!=typeof this&&(this.ES6Promise=gt),mt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:60}],123:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;r>n;n++)if(e=t.charCodeAt(n),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],124:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.gl=t,this.type=e,this.handle=r,this.length=n,this.usage=i}function i(t,e,r,n,i,o){var a=i.length*i.BYTES_PER_ELEMENT;if(0>o)return t.bufferData(e,i,n),a;if(a+o>r)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,o,i),r}function o(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;n>i;++i)r[i]=t[i];return r}function a(t,e){for(var r=1,n=e.length-1;n>=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var o=t.createBuffer(),a=new n(t,r,o,0,i);return a.update(e),a}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),h=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],f=n.prototype;f.bind=function(){this.gl.bindBuffer(this.type,this.handle)},f.unbind=function(){this.gl.bindBuffer(this.type,null)},f.dispose=function(){this.gl.deleteBuffer(this.handle)},f.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&a(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),f=c(s,t.shape);u.assign(f,t),0>e?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?o(t,"uint16"):o(t,"float32"),0>e?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t=0|t,0>=t&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:433,"ndarray-ops":432,"typedarray-pool":458}],125:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.shader=e,this.buffer=r,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.color=[0,0,0,1]}function i(t,e){var r=o(t.gl,l.vertex,l.fragment),i=a(t.gl),s=new n(t,r,i);return s.update(e),t.addObject(s),s}var o=t("gl-shader"),a=t("gl-buffer"),s=t("typedarray-pool"),l=t("./lib/shaders");e.exports=i;var u=[[1,0,0,1,0,0],[1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,1,0,0],[1,0,0,1,0,0],[1,0,-1,0,0,1],[1,0,-1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,1],[1,0,-1,0,0,1],[-1,0,-1,0,0,1],[-1,0,-1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,1],[-1,0,-1,0,0,1],[0,1,1,0,0,0],[0,1,-1,0,0,0],[0,-1,-1,0,0,0],[0,-1,-1,0,0,0],[0,1,1,0,0,0],[0,-1,1,0,0,0],[0,1,0,-1,1,0],[0,1,0,-1,-1,0],[0,1,0,1,-1,0],[0,1,0,1,1,0],[0,1,0,-1,1,0],[0,1,0,1,-1,0],[0,-1,0,-1,1,0],[0,-1,0,-1,-1,0],[0,-1,0,1,-1,0],[0,-1,0,1,1,0],[0,-1,0,-1,1,0],[0,-1,0,1,-1,0]],c=n.prototype;c.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[1,1];return function(){var r=this.plot,n=this.shader,i=this.buffer,o=this.bounds,a=this.numPoints;if(a){var s=r.gl,l=r.dataBox,c=r.viewBox,h=r.pixelRatio,f=o[2]-o[0],d=o[3]-o[1],p=l[2]-l[0],v=l[3]-l[1];t[0]=2*f/p,t[4]=2*d/v,t[6]=2*(o[0]-l[0])/p-1,t[7]=2*(o[1]-l[1])/v-1;var m=c[2]-c[0],g=c[3]-c[1];e[0]=2*h/m,e[1]=2*h/g,i.bind(),n.bind(),n.uniforms.viewTransform=t,n.uniforms.pixelScale=e,n.uniforms.color=this.color,n.attributes.position.pointer(s.FLOAT,!1,16,0),n.attributes.pixelOffset.pointer(s.FLOAT,!1,16,8),s.drawArrays(s.TRIANGLES,0,a*u.length)}}}(),c.drawPick=function(t){return t},c.pick=function(t,e){return null},c.update=function(t){t=t||{};var e,r,n,i=t.positions||[],o=t.errors||[],a=1;"lineWidth"in t&&(a=+t.lineWidth);var l=5;"capSize"in t&&(l=+t.capSize),this.color=(t.color||[0,0,0,1]).slice();var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=this.numPoints=i.length>>1;for(e=0;h>e;++e)r=i[2*e],n=i[2*e+1],c[0]=Math.min(r,c[0]),c[1]=Math.min(n,c[1]),c[2]=Math.max(r,c[2]),c[3]=Math.max(n,c[3]);c[2]===c[0]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);var f=1/(c[2]-c[0]),d=1/(c[3]-c[1]),p=c[0],v=c[1],m=s.mallocFloat32(h*u.length*4),g=0;for(e=0;h>e;++e){r=i[2*e],n=i[2*e+1];for(var y=o[4*e],b=o[4*e+1],x=o[4*e+2],_=o[4*e+3],w=0;wk?k*=y:k>0&&(k*=b),0>A?A*=x:A>0&&(A*=_),m[g++]=f*(r-p+k),m[g++]=d*(n-v+A),m[g++]=a*M[2]+(l+a)*M[4],m[g++]=a*M[3]+(l+a)*M[5]}}this.buffer.update(m),s.free(m)},c.dispose=function(){this.plot.removeObject(this),this.shader.dispose(),this.buffer.dispose()}},{"./lib/shaders":126,"gl-buffer":124,"gl-shader":203,"typedarray-pool":458}],126:[function(t,e,r){e.exports={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 pixelOffset;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvoid main() {\n vec3 scrPosition = viewTransform * vec3(position, 1);\n gl_Position = vec4(\n scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n 0,\n scrPosition.z);\n}\n",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"}},{}],127:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1}function i(t,e){for(var r=0;3>r;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}function o(t,e,r,n){for(var i=f[n],o=0;o=1},h.isTransparent=function(){return this.opacity<1},h.drawTransparent=h.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||c,i=r.projection=t.projection||c;r.model=t.model||c,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var o=n[12],a=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*o+i[7]*a+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;3>h;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*u,e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var f=function(){for(var t=new Array(3),e=0;3>e;++e){for(var r=[],n=1;2>=n;++n)for(var i=-1;1>=i;i+=2){var o=(n+e)%3,a=[0,0,0];a[o]=i,r.push(a)}t[e]=r}return t}();h.update=function(t){t=t||{},"lineWidth"in t&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var a=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.lineCount=[0,0,0];for(var u=0;3>u;++u){this.lineOffset[u]=l;t:for(var c=0;s>c;++c){for(var h=r[c],f=0;3>f;++f)if(isNaN(h[f])||!isFinite(h[f]))continue t;var d=n[c],p=e[u];if(Array.isArray(p[0])&&(p=e[c]),3===p.length&&(p=[p[0],p[1],p[2],1]),!isNaN(d[0][u])&&!isNaN(d[1][u])){if(d[0][u]<0){var v=h.slice();v[u]+=d[0][u],a.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,v[0],v[1],v[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,v),l+=2+o(a,v,p,u)}if(d[1][u]>0){var v=h.slice();v[u]+=d[1][u],a.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,v[0],v[1],v[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,v),l+=2+o(a,v,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(a)}},h.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":128,"gl-buffer":124,"gl-vao":232}],128:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}",o="precision mediump float;\n#define GLSLIFY 1\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(fragPosition, clipBounds[0])) || any(greaterThan(fragPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = opacity * fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":203}],129:[function(t,e,r){"use strict";function n(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING),r=t.getParameter(t.RENDERBUFFER_BINDING),n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function o(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);y=new Array(r+1);for(var n=0;r>=n;++n){for(var i=new Array(r),o=0;n>o;++o)i[o]=t.COLOR_ATTACHMENT0+o;for(var o=n;r>o;++o)i[o]=t.NONE;y[n]=i}}function a(t){switch(t){case p:throw new Error("gl-fbo: Framebuffer unsupported");case v:throw new Error("gl-fbo: Framebuffer incomplete attachment");case m:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case g:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function s(t,e,r,n,i,o){if(!n)return null;var a=d(t,e,r,i,n);return a.magFilter=t.NEAREST,a.minFilter=t.NEAREST,a.mipSamples=1,a.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,o,t.TEXTURE_2D,a.handle,0),a}function l(t,e,r,n,i){var o=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,o),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,o),o}function u(t){var e=n(t.gl),r=t.gl,o=t.handle=r.createFramebuffer(),u=t._shape[0],c=t._shape[1],h=t.color.length,f=t._ext,d=t._useStencil,p=t._useDepth,v=t._colorType;r.bindFramebuffer(r.FRAMEBUFFER,o);for(var m=0;h>m;++m)t.color[m]=s(r,u,c,v,r.RGBA,r.COLOR_ATTACHMENT0+m);0===h?(t._color_rb=l(r,u,c,r.RGBA4,r.COLOR_ATTACHMENT0),f&&f.drawBuffersWEBGL(y[0])):h>1&&f.drawBuffersWEBGL(y[h]);var g=r.getExtension("WEBGL_depth_texture");g?d?t.depth=s(r,u,c,g.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var m=0;ml;++l)this.color[l]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=n,this._useDepth=o,this._useStencil=a;var c=this,h=[0|e,0|r];Object.defineProperties(h,{0:{get:function(){return c._shape[0]},set:function(t){return c.width=t}},1:{get:function(){return c._shape[1]},set:function(t){return c.height=t}}}),this._shapeVector=h,u(this)}function h(t,e,r){if(t._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(t._shape[0]!==e||t._shape[1]!==r){var o=t.gl,s=o.getParameter(o.MAX_RENDERBUFFER_SIZE);if(0>e||e>s||0>r||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(o),u=0;ue||e>a||0>r||r>a)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),0>s)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var h=!0;"depth"in n&&(h=!!n.depth);var f=!1;return"stencil"in n&&(f=!!n.stencil),new c(t,e,r,l,s,h,f,i)}var d=t("gl-texture2d");e.exports=f;var p,v,m,g,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return h(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t=0|t,h(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t=0|t,h(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e2&&!this.usingDashes){var z=this.mitreShader;z.bind();var I=z.uniforms;I.matrix=t,I.color=s,I.screenShape=e,I.radius=l*p,z.attributes.p.pointer(h.FLOAT,!1,48,0),h.drawArrays(h.POINTS,0,c/3|0)}}}}(),f.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0],r=[0,0,0,0];return function(n){var i=this.plot,o=this.pickShader,a=this.lineBuffer,s=this.pickBuffer,l=this.width,u=this.numPoints,c=this.bounds,h=this.vertCount,f=i.gl,d=i.viewBox,p=i.dataBox,v=i.pickPixelRatio,m=c[2]-c[0],g=c[3]-c[1],y=p[2]-p[0],b=p[3]-p[1],x=d[2]-d[0],_=d[3]-d[1];if(this.pickOffset=n,!h)return n+u;t[0]=2*m/y,t[4]=2*g/b,t[6]=2*(c[0]-p[0])/y-1,t[7]=2*(c[1]-p[1])/b-1,e[0]=x,e[1]=_,r[0]=255&n,r[1]=n>>>8&255,r[2]=n>>>16&255,r[3]=n>>>24,o.bind();var w=o.uniforms;w.matrix=t,w.width=l*v,w.pickOffset=r,w.screenShape=e;var M=o.attributes;return a.bind(),M.a.pointer(f.FLOAT,!1,16,0),M.d.pointer(f.FLOAT,!1,16,8),s.bind(),M.pick0.pointer(f.UNSIGNED_BYTE,!1,8,0),M.pick1.pointer(f.UNSIGNED_BYTE,!1,8,4),f.drawArrays(f.TRIANGLES,0,h),n+u}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var o=r-n,a=this.data;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}},f.update=function(t){t=t||{};var e=this.plot.gl;!!t.connectGaps;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);for(var r=t.dashes||[1],n=0,o=0;o1,this.dashPattern=l(e,u(a,[n,1,4],[1,0,0])),this.dashPattern.minFilter=e.NEAREST,this.dashPattern.magFilter=e.NEAREST,this.dashLength=n,c.free(a);var d=t.positions;this.data=d;var p=this.bounds;p[0]=p[1]=1/0,p[2]=p[3]=-(1/0);var v=this.numPoints=d.length>>>1;if(0!==v){for(var o=0;v>o;++o){var m=d[2*o],g=d[2*o+1];isNaN(m)||isNaN(g)||(p[0]=Math.min(p[0],m),p[1]=Math.min(p[1],g),p[2]=Math.max(p[2],m),p[3]=Math.max(p[3],g))}p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);for(var y=c.mallocFloat32(24*(v-1)),b=c.mallocUint32(12*(v-1)),x=y.length,_=b.length,s=v,w=0;s>1;){var M=--s,m=d[2*s],g=d[2*s+1],k=M-1,A=d[2*k],T=d[2*k+1];if(!(isNaN(m)||isNaN(g)||isNaN(A)||isNaN(T))){w+=1,m=(m-p[0])/(p[2]-p[0]),g=(g-p[1])/(p[3]-p[1]),A=(A-p[0])/(p[2]-p[0]),T=(T-p[1])/(p[3]-p[1]);var E=A-m,S=T-g,L=M|1<<24,z=M-1,I=M,P=M-1|1<<24;y[--x]=-S,y[--x]=-E,y[--x]=g,y[--x]=m,b[--_]=L,b[--_]=z,y[--x]=S,y[--x]=E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=-S,y[--x]=-E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=S,y[--x]=E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=-S,y[--x]=-E,y[--x]=g,y[--x]=m,b[--_]=L,b[--_]=z,y[--x]=S,y[--x]=E,y[--x]=g,y[--x]=m,b[--_]=L,b[--_]=z}}this.vertCount=6*w,this.lineBuffer.update(y.subarray(x)),this.pickBuffer.update(b.subarray(_)),c.free(y),c.free(b)}},f.dispose=function(){this.plot.removeObject(this),this.lineBuffer.dispose(),this.pickBuffer.dispose(),this.lineShader.dispose(),this.mitreShader.dispose(),this.fillShader.dispose(),this.pickShader.dispose(),this.dashPattern.dispose()}},{"./lib/shaders":130,"gl-buffer":124,"gl-shader":203,"gl-texture2d":228,ndarray:433,"typedarray-pool":458}],132:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, nextPosition;\nattribute float arcLength, lineWidth;\nattribute vec4 color;\n\nuniform vec2 screenShape;\nuniform float pixelRatio;\nuniform mat4 model, view, projection;\n\nvarying vec4 fragColor;\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\n\nvoid main() {\n vec4 projected = projection * view * model * vec4(position, 1.0);\n vec4 tangentClip = projection * view * model * vec4(nextPosition - position, 0.0);\n vec2 tangent = normalize(screenShape * tangentClip.xy);\n vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(tangent.y, -tangent.x) / screenShape;\n\n gl_Position = vec4(projected.xy + projected.w * offset, projected.zw);\n\n worldPosition = position;\n pixelArcLength = arcLength;\n fragColor = color;\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D dashTexture;\nuniform float dashScale;\nuniform float opacity;\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\n if(dashWeight < 0.5) {\n discard;\n }\n gl_FragColor = fragColor * opacity;\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1_0(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\n\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1_0(pixelArcLength).xyz);\n}",s=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];r.createShader=function(t){return n(t,i,o,null,s)},r.createPickShader=function(t){return n(t,i,a,null,s)}},{"gl-shader":203}],133:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;3>n;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;3>r;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function o(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function a(t,e,r,n,i,o){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=o,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}function s(t){var e=t.gl||t.scene&&t.scene.gl,r=v(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var n=m(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=l(e),o=u(e,[{buffer:i,size:3,offset:0,stride:48},{buffer:i,size:3,offset:12,stride:48},{buffer:i,size:1,offset:24,stride:48},{buffer:i,size:1,offset:28,stride:48},{buffer:i,size:4,offset:32,stride:48}]),s=d(new Array(1024),[256,1,4]),h=0;1024>h;++h)s.data[h]=255;var f=c(e,s);f.wrap=e.REPEAT;var p=new a(e,r,n,i,o,f);return p.update(t),p}e.exports=s;var l=t("gl-buffer"),u=t("gl-vao"),c=t("gl-texture2d"),h=t("glsl-read-float"),f=t("binary-search-bounds"),d=t("ndarray"),p=t("./lib/shaders"),v=p.createShader,m=p.createPickShader,g=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],y=a.prototype;y.isTransparent=function(){return this.opacity<1},y.isOpaque=function(){return this.opacity>=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||g,view:t.view||g,projection:t.projection||g,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||g,view:t.view||g,projection:t.projection||g,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var o=t.position||t.positions;if(o){var a=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],h=0,p=0,v=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],m=!1;t:for(e=1;er;++r){if(isNaN(g[r])||isNaN(y[r])||!isFinite(g[r])||!isFinite(y[r])){if(!i&&l.length>0){for(var b=0;24>b;++b)l.push(l[l.length-12]);p+=2,m=!0}continue t}v[0][r]=Math.min(v[0][r],g[r],y[r]),v[1][r]=Math.max(v[1][r],g[r],y[r])}var x,_;Array.isArray(a[0])?(x=a[e-1],_=a[e]):x=_=a,3===x.length&&(x=[x[0],x[1],x[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var M=h;if(h+=n(g,y),m){for(r=0;2>r;++r)l.push(g[0],g[1],g[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3]);p+=2,m=!1}l.push(g[0],g[1],g[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3],g[0],g[1],g[2],y[0],y[1],y[2],M,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],g[0],g[1],g[2],h,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],g[0],g[1],g[2],h,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),u.push(h),c.push(o[o.length-1].slice()),this.bounds=v,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var k=t.dashes,A=k.slice();for(A.unshift(0),e=1;ee;++e){for(r=0;4>r;++r)T.set(e,0,r,0);1&f.le(A,A[A.length-1]*e/255)?T.set(e,0,0,0):T.set(e,0,0,255)}this.texture.setPixels(T)}}},y.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()},y.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=h(t.value[0],t.value[1],t.value[2],0),r=f.le(this.arcLength,e);if(0>r)return null;if(r===this.arcLength.length-1)return new o(this.arcLength[this.arcLength.length-1],this.points[this.points.length-1].slice(),r);for(var n=this.points[r],i=this.points[Math.min(r+1,this.points.length-1)],a=(e-this.arcLength[r])/(this.arcLength[r+1]-this.arcLength[r]),s=1-a,l=[0,0,0],u=0;3>u;++u)l[u]=s*n[u]+a*i[u];var c=Math.min(.5>a?r:r+1,this.points.length-1);return new o(e,l,c,this.points[c])}},{"./lib/shaders":132,"binary-search-bounds":134,"gl-buffer":124,"gl-texture2d":228,"gl-vao":232,"glsl-read-float":135,ndarray:433}],134:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],135:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,o[0]}e.exports=n;var i=new Uint8Array(4),o=new Float32Array(i.buffer)},{}],136:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=c*a-s*u,f=-c*o+s*l,d=u*o-a*l,p=r*h+n*f+i*d;return p?(p=1/p,t[0]=h*p,t[1]=(-c*n+i*u)*p,t[2]=(s*n-i*a)*p,t[3]=f*p,t[4]=(c*r-i*l)*p,t[5]=(-s*r+i*o)*p,t[6]=d*p,t[7]=(-u*r+n*l)*p,t[8]=(a*r-n*o)*p,t):null}e.exports=n},{}],137:[function(t,e,r){function n(t){var e=new Float32Array(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}e.exports=n},{}],138:[function(t,e,r){function n(){var t=new Float32Array(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],139:[function(t,e,r){function n(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],f=t[11],d=t[12],p=t[13],v=t[14],m=t[15],g=e*a-r*o,y=e*s-n*o,b=e*l-i*o,x=r*s-n*a,_=r*l-i*a,w=n*l-i*s,M=u*p-c*d,k=u*v-h*d,A=u*m-f*d,T=c*v-h*p,E=c*m-f*p,S=h*m-f*v;return g*S-y*E+b*T+x*A-_*k+w*M}e.exports=n},{}],140:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,h=n*s,f=i*a,d=i*s,p=i*l,v=o*a,m=o*s,g=o*l;return t[0]=1-h-p,t[1]=c+g,t[2]=f-m,t[3]=0,t[4]=c-g,t[5]=1-u-p,t[6]=d+v,t[7]=0,t[8]=f+m,t[9]=d-v,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],141:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,u=o+o,c=n*s,h=n*l,f=n*u,d=i*l,p=i*u,v=o*u,m=a*s,g=a*l,y=a*u;return t[0]=1-(d+v),t[1]=h+y,t[2]=f-g,t[3]=0,t[4]=h-y,t[5]=1-(c+v),t[6]=p+m,t[7]=0,t[8]=f+g,t[9]=p-m,t[10]=1-(c+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}e.exports=n},{}],142:[function(t,e,r){function n(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],143:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],m=e[14],g=e[15],y=r*s-n*a,b=r*l-i*a,x=r*u-o*a,_=n*l-i*s,w=n*u-o*s,M=i*u-o*l,k=c*v-h*p,A=c*m-f*p,T=c*g-d*p,E=h*m-f*v,S=h*g-d*v,L=f*g-d*m,z=y*L-b*S+x*E+_*T-w*A+M*k;return z?(z=1/z,t[0]=(s*L-l*S+u*E)*z,t[1]=(i*S-n*L-o*E)*z,t[2]=(v*M-m*w+g*_)*z,t[3]=(f*w-h*M-d*_)*z,t[4]=(l*T-a*L-u*A)*z,t[5]=(r*L-i*T+o*A)*z,t[6]=(m*x-p*M-g*b)*z,t[7]=(c*M-f*x+d*b)*z,t[8]=(a*S-s*T+u*k)*z,t[9]=(n*T-r*S-o*k)*z,t[10]=(p*w-v*x+g*y)*z,t[11]=(h*x-c*w-d*y)*z,t[12]=(s*A-a*E-l*k)*z,t[13]=(r*E-n*A+i*k)*z,t[14]=(v*b-p*_-m*y)*z,t[15]=(c*_-h*b+f*y)*z,t):null}e.exports=n},{}],144:[function(t,e,r){function n(t,e,r,n){var o,a,s,l,u,c,h,f,d,p,v=e[0],m=e[1],g=e[2],y=n[0],b=n[1],x=n[2],_=r[0],w=r[1],M=r[2];return Math.abs(v-_)<1e-6&&Math.abs(m-w)<1e-6&&Math.abs(g-M)<1e-6?i(t):(h=v-_,f=m-w,d=g-M,p=1/Math.sqrt(h*h+f*f+d*d),h*=p,f*=p,d*=p,o=b*d-x*f,a=x*h-y*d,s=y*f-b*h,p=Math.sqrt(o*o+a*a+s*s),p?(p=1/p,o*=p,a*=p,s*=p):(o=0,a=0,s=0),l=f*s-d*a,u=d*o-h*s,c=h*a-f*o,p=Math.sqrt(l*l+u*u+c*c),p?(p=1/p,l*=p,u*=p,c*=p):(l=0,u=0,c=0),t[0]=o,t[1]=l,t[2]=h,t[3]=0,t[4]=a,t[5]=u,t[6]=f,t[7]=0,t[8]=s,t[9]=c,t[10]=d,t[11]=0,t[12]=-(o*v+a*m+s*g),t[13]=-(l*v+u*m+c*g),t[14]=-(h*v+f*m+d*g),t[15]=1,t)}var i=t("./identity");e.exports=n},{"./identity":142}],145:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],d=e[10],p=e[11],v=e[12],m=e[13],g=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*h+w*v,t[1]=b*i+x*l+_*f+w*m,t[2]=b*o+x*u+_*d+w*g,t[3]=b*a+x*c+_*p+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*h+w*v,t[5]=b*i+x*l+_*f+w*m,t[6]=b*o+x*u+_*d+w*g,t[7]=b*a+x*c+_*p+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*h+w*v,t[9]=b*i+x*l+_*f+w*m,t[10]=b*o+x*u+_*d+w*g,t[11]=b*a+x*c+_*p+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*h+w*v,t[13]=b*i+x*l+_*f+w*m,t[14]=b*o+x*u+_*d+w*g,t[15]=b*a+x*c+_*p+w*y,t}e.exports=n},{}],146:[function(t,e,r){function n(t,e,r,n,i){var o=1/Math.tan(e/2),a=1/(n-i);return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t}e.exports=n},{}],147:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,u,c,h,f,d,p,v,m,g,y,b,x,_,w,M,k,A,T,E,S=n[0],L=n[1],z=n[2],I=Math.sqrt(S*S+L*L+z*z);return Math.abs(I)<1e-6?null:(I=1/I,S*=I,L*=I,z*=I,i=Math.sin(r),o=Math.cos(r),a=1-o,s=e[0],l=e[1],u=e[2],c=e[3],h=e[4],f=e[5],d=e[6],p=e[7],v=e[8],m=e[9],g=e[10],y=e[11],b=S*S*a+o,x=L*S*a+z*i,_=z*S*a-L*i,w=S*L*a-z*i,M=L*L*a+o,k=z*L*a+S*i,A=S*z*a+L*i,T=L*z*a-S*i,E=z*z*a+o,t[0]=s*b+h*x+v*_,t[1]=l*b+f*x+m*_,t[2]=u*b+d*x+g*_,t[3]=c*b+p*x+y*_,t[4]=s*w+h*M+v*k,t[5]=l*w+f*M+m*k,t[6]=u*w+d*M+g*k,t[7]=c*w+p*M+y*k,t[8]=s*A+h*T+v*E,t[9]=l*A+f*T+m*E,t[10]=u*A+d*T+g*E,t[11]=c*A+p*T+y*E,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}e.exports=n},{}],148:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=a*i+c*n,t[6]=s*i+h*n,t[7]=l*i+f*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=h*i-s*n,t[11]=f*i-l*n,t}e.exports=n},{}],149:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],h=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=a*i-c*n,t[2]=s*i-h*n,t[3]=l*i-f*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+h*i,t[11]=l*n+f*i,t}e.exports=n},{}],150:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],h=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*n,t[1]=a*i+c*n,t[2]=s*i+h*n,t[3]=l*i+f*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=h*i-s*n,t[7]=f*i-l*n,t}e.exports=n},{}],151:[function(t,e,r){function n(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}e.exports=n},{}],152:[function(t,e,r){function n(t,e,r){var n,i,o,a,s,l,u,c,h,f,d,p,v=r[0],m=r[1],g=r[2];return e===t?(t[12]=e[0]*v+e[4]*m+e[8]*g+e[12],t[13]=e[1]*v+e[5]*m+e[9]*g+e[13],t[14]=e[2]*v+e[6]*m+e[10]*g+e[14],t[15]=e[3]*v+e[7]*m+e[11]*g+e[15]):(n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],d=e[10],p=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=f,t[10]=d,t[11]=p,t[12]=n*v+s*m+h*g+e[12],t[13]=i*v+l*m+f*g+e[13],t[14]=o*v+u*m+d*g+e[14],t[15]=a*v+c*m+p*g+e[15]),t}e.exports=n},{}],153:[function(t,e,r){function n(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}e.exports=n},{}],154:[function(t,e,r){"use strict";function n(t,e){for(var r=[0,0,0,0],n=0;4>n;++n)for(var i=0;4>i;++i)r[i]+=t[4*n+i]*e[n];return r}function i(t,e,r,i,o){for(var a=n(i,n(r,n(e,[t[0],t[1],t[2],1]))),s=0;3>s;++s)a[s]/=a[3];return[.5*o[0]*(1+a[0]),.5*o[1]*(1-a[1])]}function o(t,e){if(2===t.length){for(var r=0,n=0,i=0;2>i;++i)r+=Math.pow(e[i]-t[0][i],2),n+=Math.pow(e[i]-t[1][i],2);return r=Math.sqrt(r),n=Math.sqrt(n),1e-6>r+n?[1,0]:[n/(r+n),r/(n+r)]}if(3===t.length){var o=[0,0];return u(t[0],t[1],t[2],e,o),l(t,o)}return[]}function a(t,e){for(var r=[0,0,0],n=0;na;++a)r[a]+=o*i[a];return r}function s(t,e,r,n,s,l){if(1===t.length)return[0,t[0].slice()];for(var u=new Array(t.length),c=0;cp;++p)d+=Math.pow(u[c][p]-e[p],2);f>d&&(f=d,h=c)}for(var v=o(u,e),m=0,c=0;3>c;++c){if(v[c]<-.001||v[c]>1.0001)return null;m+=v[c]}return Math.abs(m-1)>.001?null:[h,a(t,v),v]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:157,"polytope-closest-point/lib/closest_point_2d.js":159}],155:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n f_data = position;\n f_uv = uv;\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",h="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}",f="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",d="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:o,fragment:a,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:f,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],156:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c,h,f,d,p,v,m,g,y,b,x,_,w,M,k,A,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=o,this.pointPickShader=a,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=m,this.edgeUVs=g,this.edgeIds=v,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=M,this.pointIds=x,this.pointVAO=k,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=D,this._view=D,this._projection=D,this._resolution=[1,1]}function i(t){for(var e=k({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;256>n;++n){for(var i=e[n],o=0;3>o;++o)r[4*n+o]=i[o];r[4*n+3]=255*i[3]}return M(r,[256,256,4],[4,0,1])}function o(t,e,r){for(var n=new Array(e),i=0;e>i;++i)n[i]=0;for(var o=t.length,i=0;o>i;++i)for(var a=t[i],s=0;sn;++n)r[n]=t[n][2];return r}function s(t){var e=m(t,L);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function l(t){var e=m(t,z);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function u(t){var e=m(t,I);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.pointSize.location=4,e}function c(t){var e=m(t,P);return e.attributes.position.location=0,e.attributes.id.location=1,e}function h(t){var e=m(t,C);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function f(t){var e=m(t,R);return e.attributes.position.location=0,e}function d(t){var e=t.gl,r=s(e),i=l(e),o=u(e),a=c(e),d=h(e),p=f(e),v=b(e,M(new Uint8Array([255,255,255,255]),[1,1,4]));v.generateMipmap(),v.minFilter=e.LINEAR_MIPMAP_LINEAR,v.magFilter=e.LINEAR;var m=g(e),x=g(e),_=g(e),w=g(e),k=g(e),A=y(e,[{buffer:m,type:e.FLOAT,size:3},{buffer:k,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:x,type:e.FLOAT,size:4},{buffer:_,type:e.FLOAT,size:2},{buffer:w,type:e.FLOAT,size:3}]),T=g(e),E=g(e),S=g(e),L=g(e),z=y(e,[{buffer:T,type:e.FLOAT,size:3},{buffer:L,type:e.UNSIGNED_BYTE, -size:4,normalized:!0},{buffer:E,type:e.FLOAT,size:4},{buffer:S,type:e.FLOAT,size:2}]),I=g(e),P=g(e),C=g(e),R=g(e),D=g(e),O=y(e,[{buffer:I,type:e.FLOAT,size:3},{buffer:D,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:P,type:e.FLOAT,size:4},{buffer:C,type:e.FLOAT,size:2},{buffer:R,type:e.FLOAT,size:1}]),F=g(e),j=y(e,[{buffer:F,type:e.FLOAT,size:3}]),N=new n(e,v,r,i,o,a,d,p,m,k,x,_,w,A,T,L,E,S,z,I,D,P,C,R,O,F,j);return N.update(t),N}var p=1e-6,v=1e-6,m=t("gl-shader"),g=t("gl-buffer"),y=t("gl-vao"),b=t("gl-texture2d"),x=t("normals"),_=t("gl-mat4/multiply"),w=t("gl-mat4/invert"),M=t("ndarray"),k=t("colormap"),A=t("simplicial-complex-contour"),T=t("typedarray-pool"),E=t("./lib/shaders"),S=t("./lib/closest-point"),L=E.meshShader,z=E.wireShader,I=E.pointShader,P=E.pickShader,C=E.pointPickShader,R=E.contourShader,D=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],O=n.prototype;O.isOpaque=function(){return this.opacity>=1},O.isTransparent=function(){return this.opacity<1},O.pickSlots=1,O.setPickBase=function(t){this.pickId=t},O.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=A(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,o=r.length,a=T.mallocFloat32(6*o),s=0,l=0;o>l;++l)for(var u=r[l],c=0;2>c;++c){var h=u[0];2===u.length&&(h=u[c]);for(var f=n[h][0],d=n[h][1],p=i[h],v=1-p,m=this.positions[f],g=this.positions[d],y=0;3>y;++y)a[s++]=p*m[y]+v*g[y]}this.contourCount=s/3|0,this.contourPositions.update(a.subarray(0,s)),T.free(a)},O.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"contourEnable"in t&&(this.contourEnable=t.contourEnable),"contourColor"in t&&(this.contourColor=t.contourColor),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"lightPosition"in t&&(this.lightPosition=t.lightPosition),"opacity"in t&&(this.opacity=t.opacity),"ambient"in t&&(this.ambientLight=t.ambient),"diffuse"in t&&(this.diffuseLight=t.diffuse),"specular"in t&&(this.specularLight=t.specular),"roughness"in t&&(this.roughness=t.roughness),"fresnel"in t&&(this.fresnel=t.fresnel),t.texture?(this.texture.dispose(),this.texture=b(e,t.texture)):t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(i(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions;if(n&&r){var s=[],l=[],u=[],c=[],h=[],f=[],d=[],m=[],g=[],y=[],_=[],w=[],M=[],k=[];this.cells=r,this.positions=n;var A=t.vertexNormals,T=t.cellNormals,E=void 0===t.vertexNormalsEpsilon?p:t.vertexNormalsEpsilon,S=void 0===t.faceNormalsEpsilon?v:t.faceNormalsEpsilon;t.useFacetNormals&&!T&&(T=x.faceNormals(r,n,S)),T||A||(A=x.vertexNormals(r,n,E));var L=t.vertexColors,z=t.cellColors,I=t.meshColor||[1,1,1,1],P=t.vertexUVs,C=t.vertexIntensity,R=t.cellUVs,D=t.cellIntensity,O=1/0,F=-(1/0);if(!P&&!R)if(C)for(var j=0;jq;++q)!isNaN(V[q])&&isFinite(V[q])&&(this.bounds[0][q]=Math.min(this.bounds[0][q],V[q]),this.bounds[1][q]=Math.max(this.bounds[1][q],V[q]));var G=0,H=0,X=0;t:for(var j=0;jq;++q)if(isNaN(V[q])||!isFinite(V[q]))continue t;y.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[j]:I,3===Z.length?_.push(Z[0],Z[1],Z[2],1):_.push(Z[0],Z[1],Z[2],Z[3]);var K;K=P?P[W]:C?[(C[W]-O)/(F-O),0]:R?R[j]:D?[(D[j]-O)/(F-O),0]:[(V[2]-O)/(F-O),0],w.push(K[0],K[1]),B?M.push(B[W]):M.push(U),k.push(j),X+=1;break;case 2:for(var q=0;2>q;++q)for(var W=Y[q],V=n[W],J=0;3>J;++J)if(isNaN(V[J])||!isFinite(V[J]))continue t;for(var q=0;2>q;++q){var W=Y[q],V=n[W];f.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[j]:I,3===Z.length?d.push(Z[0],Z[1],Z[2],1):d.push(Z[0],Z[1],Z[2],Z[3]);var K;K=P?P[W]:C?[(C[W]-O)/(F-O),0]:R?R[j]:D?[(D[j]-O)/(F-O),0]:[(V[2]-O)/(F-O),0],m.push(K[0],K[1]),g.push(j)}H+=1;break;case 3:for(var q=0;3>q;++q)for(var W=Y[q],V=n[W],J=0;3>J;++J)if(isNaN(V[J])||!isFinite(V[J]))continue t;for(var q=0;3>q;++q){var W=Y[q],V=n[W];s.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[j]:I,3===Z.length?l.push(Z[0],Z[1],Z[2],1):l.push(Z[0],Z[1],Z[2],Z[3]);var K;K=P?P[W]:C?[(C[W]-O)/(F-O),0]:R?R[j]:D?[(D[j]-O)/(F-O),0]:[(V[2]-O)/(F-O),0],c.push(K[0],K[1]);var $;$=A?A[W]:T[j],u.push($[0],$[1],$[2]),h.push(j)}G+=1}}this.pointCount=X,this.edgeCount=H,this.triangleCount=G,this.pointPositions.update(y),this.pointColors.update(_),this.pointUVs.update(w),this.pointSizes.update(M),this.pointIds.update(new Uint32Array(k)),this.edgePositions.update(f),this.edgeColors.update(d),this.edgeUVs.update(m),this.edgeIds.update(new Uint32Array(g)),this.trianglePositions.update(s),this.triangleColors.update(l),this.triangleUVs.update(c),this.triangleNormals.update(u),this.triangleIds.update(new Uint32Array(h))}},O.drawTransparent=O.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);var s={model:r,view:n,projection:i,clipBounds:o,kambient:this.ambientLight,kdiffuse:this.diffuseLight,kspecular:this.specularLight,roughness:this.roughness,fresnel:this.fresnel,eyePosition:[0,0,0],lightPosition:[0,0,0],opacity:this.opacity,contourColor:this.contourColor,texture:0};this.texture.bind(0);var l=new Array(16);_(l,s.view,s.model),_(l,s.projection,l),w(l,l);for(var a=0;3>a;++a)s.eyePosition[a]=l[12+a]/l[15];for(var u=l[15],a=0;3>a;++a)u+=this.lightPosition[a]*l[4*a+3];for(var a=0;3>a;++a){for(var c=l[12+a],h=0;3>h;++h)c+=l[4*h+a]*this.lightPosition[h];s.lightPosition[a]=c/u}if(this.triangleCount>0){var f=this.triShader;f.bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var f=this.lineShader;f.bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var f=this.pointShader;f.bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var f=this.contourShader;f.bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},O.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:o,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},O.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),o=0;oa;++a){for(var s=new Array(r+1),l=0;r>=l;++l)s[l]=t[l][a];i[a]=s}i[r]=new Array(r+1);for(var a=0;r>=a;++a)i[r][a]=1;for(var u=new Array(r+1),a=0;r>a;++a)u[a]=e[a];u[r]=1;var c=o(i,u),h=n(c[r+1]);0===h&&(h=1);for(var f=new Array(r+1),a=0;r>=a;++a)f[a]=n(c[a])/h;return f}e.exports=i;var o=t("robust-linear-solve")},{"robust-linear-solve":436}],158:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,o=new Array(i),a=void 0===r?n:r,s=0;i>s;++s)o[s]=[0,0,0];for(var s=0;sx;++x)m[x]=d[x]-p[x],g+=m[x]*m[x],y[x]=v[x]-p[x],b+=y[x]*y[x];if(g*b>a)for(var _=o[c],w=1/Math.sqrt(g*b),x=0;3>x;++x){var M=(x+1)%3,k=(x+2)%3;_[x]+=w*(y[M]*m[k]-y[k]*m[M])}}for(var s=0;i>s;++s){for(var _=o[s],A=0,x=0;3>x;++x)A+=_[x]*_[x];if(A>a)for(var w=1/Math.sqrt(A),x=0;3>x;++x)_[x]*=w;else for(var x=0;3>x;++x)_[x]=0}return o},r.faceNormals=function(t,e,r){for(var n=t.length,o=new Array(n),a=void 0===r?i:r,s=0;n>s;++s){for(var l=t[s],u=new Array(3),c=0;3>c;++c)u[c]=e[l[c]];for(var h=new Array(3),f=new Array(3),c=0;3>c;++c)h[c]=u[1][c]-u[0][c],f[c]=u[2][c]-u[0][c];for(var d=new Array(3),p=0,c=0;3>c;++c){var v=(c+1)%3,m=(c+2)%3;d[c]=h[v]*f[m]-h[m]*f[v],p+=d[c]*d[c]}p=p>a?1/Math.sqrt(p):0;for(var c=0;3>c;++c)d[c]*=p;o[s]=d}return o}},{}],159:[function(t,e,r){"use strict";function n(t,e,r,n,s){i.length=x+_)if(0>x)0>_&&0>f?(_=0,-f>=u?(x=1,y=u+2*f+p):(x=-f/u,y=f*x+p)):(x=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):(_=-d/h,y=d*_+p));else if(0>_)_=0,f>=0?(x=0,y=p):-f>=u?(x=1,y=u+2*f+p):(x=-f/u,y=f*x+p);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p}else{var M,k,A,T;0>x?(M=c+f,k=h+d,k>M?(A=k-M,T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+p):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)):(x=0,0>=k?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):(_=-d/h,y=d*_+p))):0>_?(M=c+d,k=u+f,k>M?(A=k-M,T=u-2*c+h,A>=T?(_=1,x=0,y=h+2*d+p):(_=A/T,x=1-_,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)):(_=0,0>=k?(x=1,y=u+2*f+p):f>=0?(x=0,y=p):(x=-f/u,y=f*x+p))):(A=h+d-c-f,0>=A?(x=0,_=1,y=h+2*d+p):(T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+p):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)))}for(var E=1-x-_,l=0;ly?0:y}var i=new Float64Array(4),o=new Float64Array(4),a=new Float64Array(4);e.exports=n},{}],160:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r=0|Math.max(r,t[n].length);return r-1}function i(t,e){for(var r=t.length,n=h.mallocUint8(r),i=0;r>i;++i)n[i]=t[i]a;++a)for(var s=t[a],e=s.length,l=0;e>l;++l)for(var u=0;l>u;++u){var d=s[u],p=s[l];i[o++]=0|Math.min(d,p),i[o++]=0|Math.max(d,p)}var v=o/2|0;f(c(i,[v,2]));for(var m=2,a=2;o>a;a+=2)i[a-2]===i[a]&&i[a-1]===i[a+1]||(i[m++]=i[a],i[m++]=i[a+1]);return c(i,[m/2|0,2])}function a(t,e,r,n){for(var i=t.data,o=t.shape[0],a=h.mallocDouble(o),s=0,l=0;o>l;++l){var u=i[2*l],f=i[2*l+1];if(r[u]!==r[f]){var d=e[u],p=e[f];i[2*s]=u,i[2*s+1]=f,a[s++]=(p-n)/(p-d)}}return t.shape[0]=s,c(a,[s])}function s(t,e){var r=h.mallocInt32(2*e),n=t.shape[0],i=t.data;r[0]=0;for(var o=0,a=0;n>a;++a){var s=i[2*a];if(s!==o){for(r[2*o+1]=a;++oi;++i)n[i]=[r[2*i],r[2*i+1]];return n}function u(t,e,r,u){r=r||0,"undefined"==typeof u&&(u=n(t));var c=t.length;if(0===c||1>u)return{cells:[],vertexIds:[],vertexWeights:[]};var f=i(e,+r),p=o(t,u),v=a(p,e,f,+r),m=s(p,0|e.length),g=d(u)(t,p.data,m,f),y=l(p),b=[].slice.call(v.data,0,v.shape[0]);return h.free(f),h.free(p.data),h.free(v.data),h.free(m),{cells:g,vertexIds:y,vertexWeights:b}}e.exports=u;var c=t("ndarray"),h=t("typedarray-pool"),f=t("ndarray-sort"),d=t("./lib/codegen")},{"./lib/codegen":161,ndarray:433,"ndarray-sort":164,"typedarray-pool":458}],161:[function(t,e,r){"use strict";function n(t){function e(t){if(!(t.length<=0)){u.push("R.push(");for(var e=0;e0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;t>=i;++i)for(var s=n[i]=a(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){t+1>i&&u.push("else "),u.push("if(l===",i,"){");for(var c=[],l=0;i>l;++l)c.push("(S[c["+l+"]]<<"+l+")");u.push("var M=",c.join("+"),";if(M===0||M===",(1<i;++i)n[i]=0,i===e&&(n[i]+=.5),i===r&&(n[i]+=.5);return n}function i(t,e){if(0===e||e===(1<=o;++o)if(e&1<=s;++s)~e&1<n;++n)r[n]=i(t,n);return r}e.exports=o;var a=t("convex-hull")},{"convex-hull":108}],163:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;t>r;++r)e.push("s"+r);for(var r=0;t>r;++r)e.push("n"+r);for(var r=1;t>r;++r)e.push("d"+r);for(var r=1;t>r;++r)e.push("e"+r);for(var r=1;t>r;++r)e.push("f"+r);return e}function o(t,e){function r(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function o(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}var a=["'use strict'"],s=["ndarrayInsertionSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(i(t.length)),u=n(e),c=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var h=[],f=1;f1){a.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"left){","dptr=0","sptr=cptr-s0");for(var f=1;fb){break __l}"].join(""));for(var f=t.length-1;f>=1;--f)a.push("sptr+=e"+f,"dptr+=f"+f,"}");a.push("dptr=cptr;sptr=cptr-s0");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"left)&&("+r("cptr-s0")+">scratch)){",o("cptr",r("cptr-s0")),"cptr-=s0","}",o("cptr","scratch"));if(a.push("}"),t.length>1&&u&&a.push("free(scratch)"),a.push("} return "+s),u){var p=new Function("malloc","free",a.join("\n"));return p(u[0],u[1])}var p=new Function(a.join("\n"));return p()}function a(t,e,r){function o(t){return["(offset+",t,"*s0)"].join("")}function a(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+o(e[0]));else for(var i=0;i=0;--i){var a=t[i];0!==a&&_.push(["for(i",a,"=0;i",a,"1)for(var i=0;i1?_.push("ptr_shift+=d"+a):_.push("ptr0+=d"+a),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+o(r[0]));else{for(var a=0;a1)for(var a=0;a=1;--a)n&&_.push("pivot_ptr+=f"+a),r.length>1?_.push("ptr_shift+=e"+a):_.push("ptr0+=e"+a),_.push("}")}function h(){t.length>1&&k&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++A;c(s,[n,i],!1,["comp=",a("ptr0"),"-",a("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",a(o(n)),">",a(o(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",a("ptr1"))):_.push(s(o(e),a(o(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++A;c(i,[r],!0,[e,"=",a("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",a(o(r)),"-pivot",n].join(""))}function v(e,r){t.length>1?l([e,r],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join(""))}function m(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","ptr2=",o(n),"\n","++",r,"\n","--",n,"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join(""))}function g(t,e){v(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",a("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(o(e),a(o(r))),s(o(r),"pivot"+n))}function b(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function x(e,r,n){t.length>1?(_.push(["__l",++A,":while(true){"].join("")),l([e],!0,["if(",a("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",A,"}"].join("")),_.push(n,"}")):_.push(["while(",a(o(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),k=n(e),A=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],S=1;SS;++S)T.push("b_ptr"+S);T.push("ptr3","ptr4","ptr5","ptr6","ptr7","pivot_ptr","ptr_shift","elementSize="+E.join("*")),k?T.push("pivot1=malloc(elementSize)","pivot2=malloc(elementSize)"):T.push("pivot1=new Array(elementSize),pivot2=new Array(elementSize)")}else T.push("pivot1","pivot2");if(_.push("var "+T.join(",")),f(1,2),f(4,5),f(1,3),f(2,3),f(1,4),f(3,4),f(2,5),f(2,3),f(4,5),t.length>1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",a("ptr1"),"\n","pivot2[pivot_ptr]=",a("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",a("ptr0"),"\n","y=",a("ptr2"),"\n","z=",a("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",a(o("el2")),"\n","pivot2=",a(o("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",a(o("el1")),"\n","y=",a(o("el3")),"\n","z=",a(o("el5")),"\n",s(o("index1"),"x"),"\n",s(o("index3"),"y"),"\n",s(o("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),v("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),m("k","less","great"),_.push("break"),_.push("}else{"),g("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),v("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),v("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&k){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,k[0],k[1])}var L=new Function("insertionSort",_.join("\n"));return L(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",m,"=s",m,"-d",p,"*n",p].join("")):l.push(["d",m,"=s",m].join("")),p=m);var d=t.length-1-c;0!==d&&(v>0?l.push(["e",d,"=s",d,"-e",v,"*n",v,",f",d,"=",h[d],"-f",v,"*n",v].join("")):l.push(["e",d,"=s",d,",f",d,"=",h[d]].join("")),v=d)}r.push("var "+l.join(","));var g=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",g.join(","),")}else{","quickSort(",g.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=o(t,e),x=a(t,e,b);return y(b,x)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":458}],164:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],a=n.join(":"),s=o[a];return s||(o[a]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),o={};e.exports=n},{"./lib/compile_sort.js":163}],165:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=o(e,[0,0,0,1,1,0,1,1]),i=a(e,s.boxVert,s.lineFrag);return new n(t,r,i)}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawBox=function(){var t=[0,0],e=[0,0];return function(r,n,i,o,a){var s=this.plot,l=this.shader,u=s.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,l.uniforms.lo=t,l.uniforms.hi=e,l.uniforms.color=a,u.drawArrays(u.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":168,"gl-buffer":124,"gl-shader":203}],166:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.vbo=e,this.shader=r,this.tickShader=n,this.ticks=[[],[]]}function i(t,e){return t-e}function o(t){var e=t.gl,r=a(e),i=s(e,u.gridVert,u.gridFrag),o=s(e,u.tickVert,u.gridFrag),l=new n(t,r,i,o);return l}e.exports=o;var a=t("gl-buffer"),s=t("gl-shader"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.draw=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){for(var n=this.plot,i=this.vbo,o=this.shader,a=this.ticks,s=n.gl,l=n._tickBounds,u=n.dataBox,c=n.viewBox,h=n.gridLineWidth,f=n.gridLineColor,d=n.gridLineEnable,p=n.pixelRatio,v=0;2>v;++v){var m=l[v],g=l[v+2],y=g-m,b=.5*(u[v+2]+u[v]),x=u[v+2]-u[v];e[v]=2*y/x,t[v]=2*(m-b)/x}o.bind(),i.bind(),o.attributes.dataCoord.pointer(),o.uniforms.dataShift=t,o.uniforms.dataScale=e;for(var _=0,v=0;2>v;++v){r[0]=r[1]=0,r[v]=1,o.uniforms.dataAxis=r,o.uniforms.lineWidth=h[v]/(c[v+2]-c[v])*p,o.uniforms.color=f[v];var w=6*a[v].length;d[v]&&w&&s.drawArrays(s.TRIANGLES,_,w),_+=w}}}(),c.drawTickMarks=function(){var t=[0,0],e=[0,0],r=[1,0],n=[0,1],o=[0,0],a=[0,0];return function(){for(var s=this.plot,u=this.vbo,c=this.tickShader,h=this.ticks,f=s.gl,d=s._tickBounds,p=s.dataBox,v=s.viewBox,m=s.pixelRatio,g=s.screenBox,y=g[2]-g[0],b=g[3]-g[1],x=v[2]-v[0],_=v[3]-v[1],w=0;2>w;++w){var M=d[w],k=d[w+2],A=k-M,T=.5*(p[w+2]+p[w]),E=p[w+2]-p[w];e[w]=2*A/E,t[w]=2*(M-T)/E}e[0]*=x/y,t[0]*=x/y,e[1]*=_/b,t[1]*=_/b,c.bind(),u.bind(),c.attributes.dataCoord.pointer();var S=c.uniforms;S.dataShift=t,S.dataScale=e;var L=s.tickMarkLength,z=s.tickMarkWidth,I=s.tickMarkColor,P=0,C=6*h[0].length,R=Math.min(l.ge(h[0],(p[0]-d[0])/(d[2]-d[0]),i),h[0].length),D=Math.min(l.gt(h[0],(p[2]-d[0])/(d[2]-d[0]),i),h[0].length),O=P+6*R,F=6*Math.max(0,D-R),j=Math.min(l.ge(h[1],(p[1]-d[1])/(d[3]-d[1]),i),h[1].length),N=Math.min(l.gt(h[1],(p[3]-d[1])/(d[3]-d[1]),i),h[1].length),B=C+6*j,U=6*Math.max(0,N-j);o[0]=2*(v[0]-L[1])/y-1,o[1]=(v[3]+v[1])/b-1,a[0]=L[1]*m/y,a[1]=z[1]*m/b,U&&(S.color=I[1],S.tickScale=a,S.dataAxis=n,S.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U)),o[0]=(v[2]+v[0])/y-1,o[1]=2*(v[1]-L[0])/b-1,a[0]=z[0]*m/y,a[1]=L[0]*m/b,F&&(S.color=I[0],S.tickScale=a,S.dataAxis=r,S.screenOffset=o,f.drawArrays(f.TRIANGLES,O,F)),o[0]=2*(v[2]+L[3])/y-1,o[1]=(v[3]+v[1])/b-1,a[0]=L[3]*m/y,a[1]=z[3]*m/b,U&&(S.color=I[3],S.tickScale=a,S.dataAxis=n,S.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U)),o[0]=(v[2]+v[0])/y-1,o[1]=2*(v[3]+L[2])/b-1,a[0]=z[2]*m/y,a[1]=L[2]*m/b,F&&(S.color=I[2],S.tickScale=a,S.dataAxis=r,S.screenOffset=o,f.drawArrays(f.TRIANGLES,O,F))}}(),c.update=function(){var t=[1,1,-1,-1,1,-1],e=[1,-1,1,1,-1,-1];return function(r){for(var n=r.ticks,i=r.bounds,o=new Float32Array(18*(n[0].length+n[1].length)),a=(this.plot.zeroLineEnable,0),s=[[],[]],l=0;2>l;++l)for(var u=s[l],c=n[l],h=i[l],f=i[l+2],d=0;dv;++v)o[a++]=p,o[a++]=t[v],o[a++]=e[v]}this.ticks=s,this.vbo.update(o)}}(),c.dispose=function(){this.vbo.dispose(),this.shader.dispose(),this.tickShader.dispose()}},{"./shaders":168,"binary-search-bounds":170,"gl-buffer":124,"gl-shader":203}],167:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=o(e,[-1,-1,-1,1,1,-1,1,1]),i=a(e,s.lineVert,s.lineFrag),l=new n(t,r,i);return l}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawLine=function(){var t=[0,0],e=[0,0];return function(r,n,i,o,a,s){var l=this.plot,u=this.shader,c=l.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,u.uniforms.start=t,u.uniforms.end=e,u.uniforms.width=a*l.pixelRatio,u.uniforms.color=s,c.drawArrays(c.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":168,"gl-buffer":124,"gl-shader":203}],168:[function(t,e,r){"use strict";var n="precision lowp float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = vec4(color.xyz * color.w, color.w);\n}\n";e.exports={lineVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 start, end;\nuniform float width;\n\nvec2 perp(vec2 v) {\n return vec2(v.y, -v.x);\n}\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n vec2 delta = normalize(perp(start - end));\n vec2 offset = mix(start, end, 0.5 * (coord.y+1.0));\n gl_Position = vec4(screen(offset + 0.5 * width * delta * coord.x), 0, 1);\n}\n",lineFrag:n,textVert:"#define GLSLIFY 1\nattribute vec3 textCoordinate;\n\nuniform vec2 dataScale, dataShift, dataAxis, screenOffset, textScale;\nuniform float angle;\n\nvoid main() {\n float dataOffset = textCoordinate.z;\n vec2 glyphOffset = textCoordinate.xy;\n mat2 glyphMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n vec2 screenCoordinate = dataAxis * (dataScale * dataOffset + dataShift) +\n glyphMatrix * glyphOffset * textScale + screenOffset;\n gl_Position = vec4(screenCoordinate, 0, 1);\n}\n", -textFrag:n,gridVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale;\nuniform float lineWidth;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n pos += 10.0 * dataCoord.y * vec2(dataAxis.y, -dataAxis.x) + dataCoord.z * lineWidth;\n gl_Position = vec4(pos, 0, 1);\n}\n",gridFrag:n,boxVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 lo, hi;\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n gl_Position = vec4(screen(mix(lo, hi, coord)), 0, 1);\n}\n",tickVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n"}},{}],169:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r,this.tickOffset=[[],[]],this.tickX=[[],[]],this.labelOffset=[0,0],this.labelCount=[0,0]}function i(t){var e=t.gl,r=o(e),i=a(e,u.textVert,u.textFrag),s=new n(t,r,i);return s}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("text-cache"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.drawTicks=function(){var t=[0,0],e=[0,0],r=[0,0];return function(n){var i=this.plot,o=this.shader,a=this.tickX[n],s=this.tickOffset[n],u=i.gl,c=i.viewBox,h=i.dataBox,f=i.screenBox,d=i.pixelRatio,p=i.tickEnable,v=i.tickPad,m=i.tickColor,g=i.tickAngle,y=(i.tickMarkLength,i.labelEnable),b=i.labelPad,x=i.labelColor,_=i.labelAngle,w=this.labelOffset[n],M=this.labelCount[n],k=l.lt(a,h[n]),A=l.le(a,h[n+2]);t[0]=t[1]=0,t[n]=1,e[n]=(c[2+n]+c[n])/(f[2+n]-f[n])-1;var T=2/f[2+(1^n)]-f[1^n];e[1^n]=T*c[1^n]-1,p[n]&&(e[1^n]-=T*d*v[n],A>k&&s[A]>s[k]&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=m[n],o.uniforms.angle=g[n],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n]&&M&&(e[1^n]-=T*d*b[n],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=x[n],o.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,M)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*v[n+2],A>k&&s[A]>s[k]&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=m[n+2],o.uniforms.angle=g[n+2],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n+2]&&M&&(e[1^n]+=T*d*b[n+2],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=x[n+2],o.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,M))}}(),c.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,o=r.screenBox,a=r.titleCenter,s=r.titleAngle,l=r.titleColor,a=r.titleCenter,u=r.pixelRatio;if(this.titleCount){for(var c=0;2>c;++c)e[c]=2*(a[c]*u-o[c])/(o[2+c]-o[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,o=n._tickBounds,a=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;2>u;++u){var c=o[u],h=o[u+2],f=h-c,d=.5*(a[u+2]+a[u]),p=a[u+2]-a[u],v=l[u],m=l[u+2],g=m-v,y=s[u],b=s[u+2],x=b-y;e[u]=2*f/p*g/x,t[u]=2*(c-d)/p*g/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){for(var e=[],r=t.ticks,n=t.bounds,i=0;2>i;++i){for(var o=[Math.floor(e.length/3)],a=[-(1/0)],l=r[i],u=0;ui;++i){this.labelOffset[i]=Math.floor(e.length/3);for(var v=s(t.labelFont[i],t.labels[i]).data,p=t.labelSize[i],u=0;up;++p)if(h[p]&&n[p]<=0&&n[p+2]>=0){var v=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?a.drawLine(v,e[1],v,e[3],d[p],f[p]):a.drawLine(e[0],v,e[2],v,d[p],f[p])}}for(var p=0;pp;++p)s.drawTicks(p);this.titleEnable&&s.drawTitle();for(var b=this.overlays,p=0;pu;++u){var c=s[u].slice(0);0!==c.length&&(c.sort(o),l[u]=Math.min(l[u],c[0].x),l[u+2]=Math.max(l[u+2],c[c.length-1].x))}this.grid.update({bounds:l,ticks:s}),this.text.update({bounds:l,ticks:s,labels:t.labels||["x","y"],labelSize:t.labelSize||[12,12],labelFont:t.labelFont||["sans-serif","sans-serif"],title:t.title||"",titleSize:t.titleSize||18,titleFont:t.titleFont||"sans-serif"}),this.setDirty()},f.dispose=function(){this.box.dispose(),this.grid.dispose(),this.text.dispose(),this.line.dispose();for(var t=this.objects.length-1;t>=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},f.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},f.removeObject=function(t){for(var e=this.objects,r=0;rf;++f)a=a&&l[f]===s[f],l[f]=s[f];var d=t.clientWidth===c&&t.clientHeight===h;return c=t.clientWidth,h=t.clientHeight,a?!d:(u=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(f,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){return n.setMode(t),n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return u},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var d=0,p=0;return a(t,function(e,r,o,a){var s=1/t.clientHeight,l=s*(r-d),c=s*(o-p),h=f.flipX?1:-1,v=f.flipY?1:-1,m=Math.PI*f.rotateSpeed,g=i();if(1&e)a.shift?n.rotate(g,0,0,-l*m):n.rotate(g,h*m*l,-v*m*c,0);else if(2&e)n.pan(g,-f.translateSpeed*l*u,f.translateSpeed*c*u,0);else if(4&e){var y=f.zoomSpeed*c/window.innerHeight*(g-n.lastT())*50;n.pan(g,0,0,u*(Math.exp(y)-1))}d=r,p=o}),s(t,function(t,e,r){var o=f.flipX?1:-1,a=f.flipY?1:-1,s=i();if(Math.abs(t)>Math.abs(e))n.rotate(s,0,0,-t*o*Math.PI*f.rotateSpeed/window.innerWidth);else{var l=f.zoomSpeed*a*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,u*(Math.exp(l)-1))}},!0),f}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":40,"mouse-change":421,"mouse-wheel":425,"right-now":435}],174:[function(t,e,r){!function(){"use strict";function t(e){e.permitHostObjects___&&e.permitHostObjects___(t)}function r(t){return!(t.substr(0,d.length)==d&&"___"===t.substr(t.length-3))}function n(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[p];if(e&&e.key===t)return e;if(f(t)){e={key:t};try{return h(t,p,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(r){return}}}function i(t){return t.prototype=null,Object.freeze(t)}function o(){y||"undefined"==typeof console||(y=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=t);var a=!1;if("function"==typeof WeakMap){var s=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var l=new s,u=Object.freeze({});if(l.set(u,1),1===l.get(u))return void(e.exports=WeakMap);a=!0}}var c=(Object.prototype.hasOwnProperty,Object.getOwnPropertyNames),h=Object.defineProperty,f=Object.isExtensible,d="weakmap:",p=d+"ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var v=new ArrayBuffer(25),m=new Uint8Array(v);crypto.getRandomValues(m),p=d+"rand:"+Array.prototype.map.call(m,function(t){return(t%36).toString(36)}).join("")+"___"}if(h(Object,"getOwnPropertyNames",{value:function(t){return c(t).filter(r)}}),"getPropertyNames"in Object){var g=Object.getPropertyNames;h(Object,"getPropertyNames",{value:function(t){return g(t).filter(r)}})}!function(){var t=Object.freeze;h(Object,"freeze",{value:function(e){return n(e),t(e)}});var e=Object.seal;h(Object,"seal",{value:function(t){return n(t),e(t)}});var r=Object.preventExtensions;h(Object,"preventExtensions",{value:function(t){return n(t),r(t)}})}();var y=!1,b=0,x=function(){function t(t,e){var r,i=n(t);return i?u in i?i[u]:e:(r=s.indexOf(t),r>=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function a(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),0>e?!1:(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||o();var s=[],l=[],u=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(a)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},"delete":{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||(c?c.has___(t):!1)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||o();var l,u=new s,c=void 0,h=!1;return l=a?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new x),c.set(t,e)),this}:function(t,e){if(h)try{u.set(t,e)}catch(r){c||(c=new x),c.set___(t,e)}else u.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");h=!0})}})}a&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],175:[function(t,e,r){"use strict";function n(t){var e=s.get(t);if(!e||!t.isBuffer(e._triangleBuffer.buffer)){var r=o(t,new Float32Array([-1,-1,-1,4,4,-1]));e=a(t,[{buffer:r,type:t.FLOAT,size:2}]),e._triangleBuffer=r,s.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}var i="undefined"==typeof WeakMap?t("weak-map"):WeakMap,o=t("gl-buffer"),a=t("gl-vao"),s=new i;e.exports=n},{"gl-buffer":124,"gl-vao":232,"weak-map":174}],176:[function(t,e,r){"use strict";function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function i(t){this.gl=t,this.pixelRatio=1,this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.autoTicks=!0,this.tickSpacing=[1,1,1],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[10,10,10],this.lastCubeProps={cubeEdges:[0,0,0],axis:[0,0,0]},this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont="sans-serif",this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[10,10,10],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[0,0,0],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!1,!1,!1],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._firstInit=!0,this._text=null,this._lines=null,this._background=c(t)}function o(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}function a(t,e,r,n,i){for(var o=t.primalOffset,a=t.primalMinor,s=t.mirrorOffset,l=t.mirrorMinor,u=n[e],c=0;3>c;++c)if(e!==c){var h=o,f=s,d=a,p=l;u&1<0?(d[c]=-1,p[c]=0):(d[c]=0,p[c]=1)}}function s(t,e){var r=new i(t);return r.update(e),r}e.exports=s;var l=t("./lib/text.js"),u=t("./lib/lines.js"),c=t("./lib/background.js"),h=t("./lib/cube.js"),f=t("./lib/ticks.js"),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),p=i.prototype;p.update=function(t){function e(e,r,n){if(n in t){var i,o=t[n],a=this[n];(e?Array.isArray(o)&&Array.isArray(o[0]):Array.isArray(o))?this[n]=i=[r(o[0]),r(o[1]),r(o[2])]:this[n]=i=[r(o),r(o),r(o)];for(var s=0;3>s;++s)if(i[s]!==a[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),o=e.bind(this,!1,String),a=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),s=!1,c=!1;if("bounds"in t)for(var h=t.bounds,d=0;2>d;++d)for(var p=0;3>p;++p)h[d][p]!==this.bounds[d][p]&&(c=!0),this.bounds[d][p]=h[d][p];if("ticks"in t){r=t.ticks,s=!0,this.autoTicks=!1;for(var d=0;3>d;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,c=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),c=!0,s=!0,this._firstInit=!1),c&&this.autoTicks&&(r=f.create(this.bounds,this.tickSpacing),s=!0),s){for(var d=0;3>d;++d)r[d].sort(function(t,e){return t.x-e.x});f.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),o("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),a("tickColor");var v=o("labels");o("labelFont")&&(v=!0),i("labelEnable"),n("labelSize"),n("labelPad"),a("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),a("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),a("lineTickColor"),i("gridEnable"),n("gridWidth"),a("gridColor"),i("zeroEnable"),a("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),a("backgroundColor"),this._text?this._text&&(v||s)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=l(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&s&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=u(this.gl,this.bounds,this.ticks))};var v=[new o,new o,new o],m=[0,0,0],g={model:d,view:d,projection:d};p.isOpaque=function(){return!0},p.isTransparent=function(){return!1},p.drawTransparent=function(t){};var y=[0,0,0],b=[0,0,0],x=[0,0,0];p.draw=function(t){t=t||g;for(var e=this.gl,r=t.model||d,i=t.view||d,o=t.projection||d,s=this.bounds,l=h(r,i,o,s),u=l.cubeEdges,c=l.axis,f=i[12],p=i[13],_=i[14],w=i[15],M=this.pixelRatio*(o[3]*f+o[7]*p+o[11]*_+o[15]*w)/e.drawingBufferHeight,k=0;3>k;++k)this.lastCubeProps.cubeEdges[k]=u[k],this.lastCubeProps.axis[k]=c[k];for(var A=v,k=0;3>k;++k)a(v[k],k,this.bounds,u,c);for(var e=this.gl,T=m,k=0;3>k;++k)this.backgroundEnable[k]?T[k]=c[k]:T[k]=0;this._background.draw(r,i,o,s,T,this.backgroundColor),this._lines.bind(r,i,o,this);for(var k=0;3>k;++k){var E=[0,0,0];c[k]>0?E[k]=s[1][k]:E[k]=s[0][k];for(var S=0;2>S;++S){var L=(k+1+S)%3,z=(k+1+(1^S))%3;this.gridEnable[L]&&this._lines.drawGrid(L,z,this.bounds,E,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var S=0;2>S;++S){var L=(k+1+S)%3,z=(k+1+(1^S))%3;this.zeroEnable[z]&&s[0][z]<=0&&s[1][z]>=0&&this._lines.drawZero(L,z,this.bounds,E,this.zeroLineColor[z],this.zeroLineWidth[z]*this.pixelRatio)}}for(var k=0;3>k;++k){this.lineEnable[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);for(var I=n(y,A[k].primalMinor),P=n(b,A[k].mirrorMinor),C=this.lineTickLength,S=0;3>S;++S){var R=M/r[5*S];I[S]*=C[S]*R,P[S]*=C[S]*R}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,A[k].primalOffset,I,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,A[k].mirrorOffset,P,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,o,this.pixelRatio);for(var k=0;3>k;++k){for(var D=A[k].primalMinor,O=n(x,A[k].primalOffset),S=0;3>S;++S)this.lineTickEnable[k]&&(O[S]+=M*D[S]*Math.max(this.lineTickLength[S],0)/r[5*S]);if(this.tickEnable[k]){for(var S=0;3>S;++S)O[S]+=M*D[S]*this.tickPad[S]/r[5*S];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],O,this.tickColor[k])}if(this.labelEnable[k]){for(var S=0;3>S;++S)O[S]+=M*D[S]*this.labelPad[S]/r[5*S];O[k]+=.5*(s[0][k]+s[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],O,this.labelColor[k])}}},p.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":177,"./lib/cube.js":178,"./lib/lines.js":179,"./lib/text.js":181,"./lib/ticks.js":182}],177:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}function i(t){for(var e=[],r=[],i=0,l=0;3>l;++l)for(var u=(l+1)%3,c=(l+2)%3,h=[0,0,0],f=[0,0,0],d=-1;1>=d;d+=2){r.push(i,i+2,i+1,i+1,i+2,i+3),h[l]=d,f[l]=d;for(var p=-1;1>=p;p+=2){h[u]=p;for(var v=-1;1>=v;v+=2)h[c]=v,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var m=u;u=c,c=m}var g=o(t,new Float32Array(e)),y=o(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=a(t,[{buffer:g,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:g,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=s(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,g,b,x)}e.exports=i;var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.draw=function(t,e,r,n,i,o){for(var a=!1,s=0;3>s;++s)a=a||i[s];if(a){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:o},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":180,"gl-buffer":124,"gl-vao":232}],178:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;4>n;++n){t[n]=r[12+n];for(var i=0;3>i;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;ev;++v){d[2]=o[v][2];for(var b=0;2>b;++b){d[1]=o[b][1];for(var x=0;2>x;++x)d[0]=o[x][0],n(h[l],d,c),l+=1}}for(var _=-1,v=0;8>v;++v){for(var w=h[v][3],M=0;3>M;++M)f[v][M]=h[v][M]/w;0>w&&(0>_?_=v:f[v][2]_){_=0;for(var k=0;3>k;++k){for(var A=(k+2)%3,T=(k+1)%3,E=-1,S=-1,L=0;2>L;++L){var z=L<E||0>S)S>E&&(_|=1<L;++L){var z=L<E&&(_|=1<v;++v)v!==_&&v!==R&&(0>D?D=v:f[D][1]>f[v][1]&&(D=v));for(var O=-1,v=0;3>v;++v){var F=D^1<O&&(O=F);var T=f[F];T[0]v;++v){var F=D^1<j&&(j=F);var T=f[F];T[0]>f[j][0]&&(j=F)}}var N=m;N[0]=N[1]=N[2]=0,N[a.log2(O^D)]=D&O,N[a.log2(D^j)]=D&j;var B=7^j;B===_||B===R?(B=7^O,N[a.log2(j^B)]=B&j):N[a.log2(O^B)]=B&O;for(var U=g,V=_,k=0;3>k;++k)V&1<t;++t)h[t]=[1,1,1,1],f[t]=[1,1,1]}();var v=[[0,0,1,0,0],[0,0,-1,1,0],[0,-1,0,1,0],[0,1,0,1,0],[-1,0,0,1,0],[1,0,0,1,0]],m=[1,1,1],g=[0,0,0],y={cubeEdges:m,axis:g}},{"bit-twiddle":51,"gl-mat4/invert":143,"gl-mat4/multiply":145,"robust-orientation":439,"split-polygon":184}],179:[function(t,e,r){"use strict";function n(t){return t[0]=t[1]=t[2]=0,t}function i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(t,e,r,n,i,o,a,s){this.gl=t,this.vertBuffer=e,this.vao=r,this.shader=n,this.tickCount=i,this.tickOffset=o,this.gridCount=a,this.gridOffset=s}function a(t,e,r){var n=[],i=[0,0,0],a=[0,0,0],c=[0,0,0],h=[0,0,0];n.push(0,0,1,0,1,1,0,0,-1,0,0,-1,0,1,1,0,1,-1);for(var f=0;3>f;++f){for(var d=n.length/3|0,p=0;pf;++f)for(var p=c[f],v=2;v>=0;--v){var m=u[p[v]];s.push(l*m[0],-l*m[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],u=[0,0,0],c=[0,0,0],d=[0,0,0],p=0;3>p;++p){c[p]=s.length/f|0,a(.5*(t[0][p]+t[1][p]),e[p],r),d[p]=(s.length/f|0)-c[p],l[p]=s.length/f|0;for(var v=0;v=0&&(i=r.length-n-1);var o=Math.pow(10,i),a=Math.round(t*e*o),s=a+"";if(s.indexOf("e")>=0)return s;var l=a/o,u=a%o;0>a?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u=0|u);var c=""+l;if(0>a&&(c="-"+c),i){for(var h=""+u;h.lengthi;++i){for(var o=[],a=(.5*(t[0][i]+t[1][i]),0);a*e[i]<=t[1][i];++a)o.push({x:a*e[i],text:n(e[i],a)});for(var a=-1;a*e[i]>=t[0][i];--a)o.push({x:a*e[i],text:n(e[i],a)});r.push(o)}return r}function o(t,e){for(var r=0;3>r;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;no?o=0:o>1&&(o=1);for(var a=1-o,s=t.length,l=new Array(s),u=0;s>u;++u)l[u]=o*t[u]+a*r[u];return l}function o(t,e){for(var r=[],o=[],a=n(t[t.length-1],e),s=t[t.length-1],l=t[0],u=0;ua&&c>0||a>0&&0>c){var h=i(s,c,l,a);r.push(h),o.push(h.slice())}0>c?o.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),o.push(l.slice())),a=c}return{positive:r,negative:o}}function a(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;lo&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),u>=0&&r.push(s.slice()),o=u}return r}function s(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;lo&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),0>=u&&r.push(s.slice()),o=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=o,e.exports.positive=a,e.exports.negative=s},{"robust-dot-product":185,"robust-sum":442}],185:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t[0],e[0]),n=1;no;++o){for(var a=p,s=v,l=0;3>l;++l)s[l]=a[l]=r[l];s[3]=a[3]=1,s[o]+=1,h(s,s,e),s[3]<0&&(t[o]=1/0),a[o]-=1,h(a,a,e),a[3]<0&&(t[o]=1/0);var u=(a[0]/a[3]-s[0]/s[3])*n,c=(a[1]/a[3]-s[1]/s[3])*i;t[o]=.25*Math.sqrt(u*u+c*c)}return t}function o(t,e,r,n,o){var h=e.model||f,p=e.view||f,v=e.projection||f,y=t.bounds,o=o||l(h,p,v,y),b=o.axis;o.edges;u(d,p,h),u(d,v,d);for(var x=m,_=0;3>_;++_)x[_].lo=1/0,x[_].hi=-(1/0),x[_].pixelsPerDataUnit=1/0;var w=a(c(d,d));c(d,d);for(var M=0;3>M;++M){var k=(M+1)%3,A=(M+2)%3,T=g;t:for(var _=0;2>_;++_){var E=[];if(b[M]<0!=!!_){T[M]=y[_][M];for(var S=0;2>S;++S){T[k]=y[S^_][k];for(var L=0;2>L;++L)T[A]=y[L^S^_][A],E.push(T.slice())}for(var S=0;SL;++L)x[L].lo=Math.min(x[L].lo,A[L]),x[L].hi=Math.max(x[L].hi,A[L]),L!==M&&(x[L].pixelsPerDataUnit=Math.min(x[L].pixelsPerDataUnit,Math.abs(z[L])))}}}return x}e.exports=o;var a=t("extract-frustum-planes"),s=t("split-polygon"),l=t("./lib/cube.js"),u=t("gl-mat4/multiply"),c=t("gl-mat4/transpose"),h=t("gl-vec4/transformMat4"),f=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),d=new Float32Array(16),p=[0,0,0,1],v=[0,0,0,1],m=[new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0)],g=[0,0,0]},{"./lib/cube.js":178,"extract-frustum-planes":183,"gl-mat4/multiply":145,"gl-mat4/transpose":153,"gl-vec4/transformMat4":233,"split-polygon":184}],187:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":203}],188:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}function i(t,e){function r(t,e,r,n,o,a){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=o,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=a,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s)}var i=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=o(t,i),u=a(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),c=s(t);c.attributes.position.location=0,c.attributes.color.location=1,c.attributes.weight.location=2;var h=new n(t,l,u,c);return h.update(e),h}var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders/index");e.exports=i;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype,c=[0,0,0],h=[0,0,0],f=[0,0];u.isTransparent=function(){return!1},u.drawTransparent=function(t){},u.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,o=t.model||l,a=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,d=h,p=0;3>p;++p)i&&i[p]<0?(u[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(u[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=o,n.uniforms.view=a,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var p=0;3>p;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},u.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},u.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":187,"gl-buffer":124,"gl-vao":232}],189:[function(t,e,r){"use strict";function n(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function i(t,e){var r=null;try{r=t.getContext("webgl",e),r||(r=t.getContext("experimental-webgl",e))}catch(n){return null}return r}function o(t){var e=Math.round(Math.log(Math.abs(t))/Math.log(10));if(0>e){var r=Math.round(Math.pow(10,-e));return Math.ceil(t*r)/r}if(e>0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function a(t){return"boolean"==typeof t?t:!0}function s(t){function e(){if(!_&&G.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*G.pixelRatio),i=0|Math.ceil(r*G.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var o=w.style;o.position=o.position||"absolute",o.left="0px",o.top="0px",o.width=e+"px",o.height=r+"px",j=!0}}}function r(){for(var t=R.length,e=F.length,r=0;e>r;++r)O[r]=0;t:for(var r=0;t>r;++r){var n=R[r],i=n.pickSlots;if(i){for(var o=0;e>o;++o)if(O[o]+i<255){D[r]=o,n.setPickBase(O[o]+1),O[o]+=i;continue t}var a=f(k,q);D[r]=e,F.push(a),O.push(i),n.setPickBase(1),e+=1}else D[r]=-1}for(;e>0&&0===O[e-1];)O.pop(),F.pop().dispose()}function s(){return G.contextLost?!0:void(k.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss()))}function y(){if(!s()){k.colorMask(!0,!0,!0,!0),k.depthMask(!0),k.disable(k.BLEND),k.enable(k.DEPTH_TEST);for(var t=R.length,e=F.length,r=0;e>r;++r){var n=F[r];n.shape=H,n.begin();for(var i=0;t>i;++i)if(D[i]===r){var o=R[i];o.drawPick&&(o.pixelRatio=1,o.drawPick(V))}n.end()}}}function b(){if(!s()){e();var t=G.camera.tick();V.view=G.camera.matrix,j=j||t,N=N||t,I.pixelRatio=G.pixelRatio,C.pixelRatio=G.pixelRatio;var r=R.length,n=W[0],i=W[1];n[0]=n[1]=n[2]=1/0,i[0]=i[1]=i[2]=-(1/0);for(var a=0;r>a;++a){var l=R[a];l.pixelRatio=G.pixelRatio,l.axes=G.axes,j=j||!!l.dirty,N=N||!!l.dirty;var u=l.bounds;if(u)for(var h=u[0],f=u[1],d=0;3>d;++d)n[d]=Math.min(n[d],h[d]),i[d]=Math.max(i[d],f[d])}var v=G.bounds;if(G.autoBounds)for(var d=0;3>d;++d){if(i[d]d;++d)b=b||Z[0][d]!==v[0][d]||Z[1][d]!==v[1][d],Z[0][d]=v[0][d],Z[1][d]=v[1][d];if(b){for(var x=[0,0,0],a=0;3>a;++a)x[a]=o((v[1][a]-v[0][a])/10);I.autoTicks?I.update({bounds:v,tickSpacing:x}):I.update({bounds:v})}N=N||b,j=j||b;var _=k.drawingBufferWidth,w=k.drawingBufferHeight;q[0]=_,q[1]=w,H[0]=0|Math.max(_/G.pixelRatio,1),H[1]=0|Math.max(w/G.pixelRatio,1),m(B,G.fovy,_/w,G.zNear,G.zFar);for(var a=0;16>a;++a)U[a]=0;U[15]=1;for(var M=0,a=0;3>a;++a)M=Math.max(M,v[1][a]-v[0][a]);for(var a=0;3>a;++a)G.autoScale?U[5*a]=G.aspect[a]/(v[1][a]-v[0][a]):U[5*a]=1/M,G.autoCenter&&(U[12+a]=.5*-U[5*a]*(v[0][a]+v[1][a]));for(var a=0;r>a;++a){var l=R[a];l.axesBounds=v,G.clipToBounds&&(l.clipBounds=v)}if(T.object&&(G.snapToData?C.position=T.dataCoordinate:C.position=T.dataPosition,C.bounds=v),N&&(N=!1,y()),j){G.axesPixels=c(G.axes,V,_,w),G.onrender&&G.onrender(),k.bindFramebuffer(k.FRAMEBUFFER,null),k.viewport(0,0,_,w);var A=G.clearColor;k.clearColor(A[0],A[1],A[2],A[3]),k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT),k.depthMask(!0),k.colorMask(!0,!0,!0,!0),k.enable(k.DEPTH_TEST),k.depthFunc(k.LEQUAL),k.disable(k.BLEND),k.disable(k.CULL_FACE);var L=!1;I.enable&&(L=L||I.isTransparent(),I.draw(V)),C.axes=I,T.object&&C.draw(V),k.disable(k.CULL_FACE);for(var a=0;r>a;++a){var l=R[a];l.axes=I,l.pixelRatio=G.pixelRatio,l.isOpaque&&l.isOpaque()&&l.draw(V),l.isTransparent&&l.isTransparent()&&(L=!0)}if(L){E.shape=q,E.bind(),k.clear(k.DEPTH_BUFFER_BIT),k.colorMask(!1,!1,!1,!1),k.depthMask(!0),k.depthFunc(k.LESS),I.enable&&I.isTransparent()&&I.drawTransparent(V);for(var a=0;r>a;++a){var l=R[a];l.isOpaque&&l.isOpaque()&&l.draw(V)}k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA),k.colorMask(!0,!0,!0,!0),k.depthMask(!1),k.clearColor(0,0,0,0),k.clear(k.COLOR_BUFFER_BIT),I.isTransparent()&&I.drawTransparent(V);for(var a=0;r>a;++a){var l=R[a];l.isTransparent&&l.isTransparent()&&l.drawTransparent(V)}k.bindFramebuffer(k.FRAMEBUFFER,null),k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA),k.disable(k.DEPTH_TEST),S.bind(),E.color[0].bind(0),S.uniforms.accumBuffer=0,p(k),k.disable(k.BLEND)}j=!1;for(var a=0;r>a;++a)R[a].dirty=!1}}}function x(){_||G.contextLost||(requestAnimationFrame(x),b())}t=t||{};var _=!1,w=(t.pixelRatio||parseFloat(window.devicePixelRatio),t.canvas);if(!w)if(w=document.createElement("canvas"),t.container){var M=t.container;M.appendChild(w)}else document.body.appendChild(w);var k=t.gl;if(k||(k=i(w,t.glOptions||{premultipliedAlpha:!0,antialias:!0})),!k)throw new Error("webgl not supported");var A=t.bounds||[[-10,-10,-10],[10,10,10]],T=new n,E=d(k,[k.drawingBufferWidth,k.drawingBufferHeight],{preferFloat:!0}),S=g(k),L=t.camera||{eye:[2,0,0],center:[0,0,0],up:[0,1,0],zoomMin:.1,zoomMax:100,mode:"turntable"},z=t.axes||{},I=u(k,z);I.enable=!z.disable;var P=t.spikes||{},C=h(k,P),R=[],D=[],O=[],F=[],j=!0,N=!0,B=new Array(16),U=new Array(16),V={view:null,projection:B,model:U},N=!0,q=[k.drawingBufferWidth,k.drawingBufferHeight],G={gl:k,contextLost:!1,pixelRatio:t.pixelRatio||parseFloat(window.devicePixelRatio),canvas:w,selection:T,camera:l(w,L),axes:I,axesPixels:null,spikes:C,bounds:A,objects:R,shape:q,aspect:t.aspectRatio||[1,1,1],pickRadius:t.pickRadius||10,zNear:t.zNear||.01,zFar:t.zFar||1e3,fovy:t.fovy||Math.PI/4,clearColor:t.clearColor||[0,0,0,0],autoResize:a(t.autoResize),autoBounds:a(t.autoBounds),autoScale:!!t.autoScale,autoCenter:a(t.autoCenter),clipToBounds:a(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:V,oncontextloss:null,mouseListener:null},H=[k.drawingBufferWidth/G.pixelRatio|0,k.drawingBufferHeight/G.pixelRatio|0];G.autoResize&&e(),window.addEventListener("resize",e),G.update=function(t){_||(t=t||{},j=!0,N=!0)},G.add=function(t){_||(t.axes=I,R.push(t),D.push(-1),j=!0,N=!0,r())},G.remove=function(t){if(!_){var e=R.indexOf(t);0>e||(R.splice(e,1),D.pop(),j=!0,N=!0,r())}},G.dispose=function(){if(!_&&(_=!0,window.removeEventListener("resize",e),w.removeEventListener("webglcontextlost",s),G.mouseListener.enabled=!1,!G.contextLost)){I.dispose(),C.dispose();for(var t=0;ts;++s){var l=F[s].query(e,H[1]-r-1,G.pickRadius);if(l){if(l.distance>T.distance)continue;for(var u=0;i>u;++u){var c=R[u];if(D[u]===s){var h=c.pick(l);h&&(T.buttons=t,T.screen=l.coord,T.distance=l.distance,T.object=c,T.index=h.distance,T.dataPosition=h.position,T.dataCoordinate=h.dataCoordinate,T.data=h,a=!0)}}}}}o&&o!==T.object&&(o.highlight&&o.highlight(null),j=!0),T.object&&(T.object.highlight&&T.object.highlight(T.data),j=!0),a=a||T.object!==o,a&&G.onselect&&G.onselect(T),1&t&&!(1&Y)&&G.onclick&&G.onclick(T),Y=t}}),w.addEventListener("webglcontextlost",s);var W=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],Z=[W[0].slice(),W[1].slice()];return x(),G.redraw=function(){_||(j=!0,b())},G}e.exports=s;var l=t("3d-view-controls"),u=t("gl-axes3d"),c=t("gl-axes3d/properties"),h=t("gl-spikes3d"),f=t("gl-select-static"),d=t("gl-fbo"),p=t("a-big-triangle"),v=t("mouse-change"),m=t("gl-mat4/perspective"),g=t("./lib/shader")},{"./lib/shader":172,"3d-view-controls":173,"a-big-triangle":175,"gl-axes3d":176,"gl-axes3d/properties":186,"gl-fbo":129,"gl-mat4/perspective":146,"gl-select-static":202,"gl-spikes3d":188,"mouse-change":421}],190:[function(t,e,r){"use strict";e.exports={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvarying vec4 fragColor;\n\nvec4 computePosition_1_0(vec2 position, vec2 offset, mat3 view, vec2 scale) {\n vec3 xposition = view * vec3(position, 1.0);\n return vec4(\n xposition.xy + scale * offset * xposition.z,\n 0,\n xposition.z);\n}\n\n\n\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n position,\n offset,\n viewTransform,\n pixelScale);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\nvec4 computePosition_1_0(vec2 position, vec2 offset, mat3 view, vec2 scale) {\n vec3 xposition = view * vec3(position, 1.0);\n return vec4(\n xposition.xy + scale * offset * xposition.z,\n 0,\n xposition.z);\n}\n\n\n\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n position,\n offset,\n viewTransform,\n pixelScale);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],191:[function(t,e,r){"use strict";function n(t){if(t in f)return f[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;ea;++a)i[a]=Math.min(i[a],r[o+a]),i[2+a]=Math.max(i[2+a],r[o+a]);return f[t]={coords:r,normals:n,bounds:i}}function i(t,e,r,n,i,o,a){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.offsetBuffer=i,this.colorBuffer=o,this.idBuffer=a,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.numVertices=0,this.pickOffset=0,this.points=null}function o(t,e){var r=t.gl,n=a(r,h.vertex,h.fragment),o=a(r,h.pickVertex,h.pickFragment),l=s(r),u=s(r),c=s(r),f=s(r),d=new i(t,n,o,l,u,c,f);return d.update(e),t.addObject(d),d}e.exports=o;var a=t("gl-shader"),s=t("gl-buffer"),l=t("text-cache"),u=t("typedarray-pool"),c=t("vectorize-text"),h=t("./lib/shaders"),f={},d=i.prototype;!function(){function t(){var t=this.plot,n=this.bounds,i=t.viewBox,o=t.dataBox,a=t.pixelRatio,s=n[2]-n[0],l=n[3]-n[1],u=o[2]-o[0],c=o[3]-o[1];e[0]=2*s/u,e[4]=2*l/c,e[6]=2*(n[0]-o[0])/u-1,e[7]=2*(n[1]-o[1])/c-1;var h=i[2]-i[0],f=i[3]-i[1];r[0]=2*a/h,r[1]=2*a/f}var e=[1,0,0,0,1,0,0,0,1],r=[1,1];d.draw=function(){var n=this.plot,i=this.shader,o=this.numVertices;if(o){var a=n.gl;t.call(this),i.bind(),i.uniforms.pixelScale=r,i.uniforms.viewTransform=e,this.positionBuffer.bind(),i.attributes.position.pointer(),this.offsetBuffer.bind(),i.attributes.offset.pointer(),this.colorBuffer.bind(),i.attributes.color.pointer(a.UNSIGNED_BYTE,!0),a.drawArrays(a.TRIANGLES,0,o)}};var n=[0,0,0,0];d.drawPick=function(i){var o=this.plot,a=this.pickShader,s=this.numVertices,l=o.gl;if(this.pickOffset=i,!s)return i;for(var u=0;4>u;++u)n[u]=i>>8*u&255;return t.call(this),a.bind(),a.uniforms.pixelScale=r,a.uniforms.viewTransform=e,a.uniforms.pickOffset=n,this.positionBuffer.bind(),a.attributes.position.pointer(),this.offsetBuffer.bind(),a.attributes.offset.pointer(),this.idBuffer.bind(),a.attributes.id.pointer(l.UNSIGNED_BYTE,!1),l.drawArrays(l.TRIANGLES,0,s),i+this.numPoints}}(),d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}},d.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],i=t.glyphs||[],o=t.sizes||[],a=t.borderWidths||[],s=t.borderColors||[];this.points=e;for(var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=0,f=0;f>1;for(var d=0;2>d;++d)c[d]=Math.min(c[d],e[2*f+d]),c[2+d]=Math.max(c[2+d],e[2*f+d])}c[0]===c[2]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);for(var p=1/(c[2]-c[0]),v=1/(c[3]-c[1]),m=c[0],g=c[1],y=u.mallocFloat32(2*h),b=u.mallocFloat32(2*h),x=u.mallocUint8(4*h),_=u.mallocUint32(h),w=0,f=0;f=o?i(0,o-1,t,e,r,n):h(0,o-1,t,e,r,n)}function i(t,e,r,n,i,o){for(var a=t+1;e>=a;++a){for(var s=r[a],l=n[2*a],u=n[2*a+1],c=i[a],h=o[a],f=a;f>t;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,n[2*f+1]=n[2*f-1],i[f]=i[f-1],o[f]=o[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,o[f]=h}}function o(t,e,r,n,i,o){var a=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=o[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e],r[e]=a,n[2*e]=s,n[2*e+1]=l,i[e]=u,o[e]=c}function a(t,e,r,n,i,o){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e]}function s(t,e,r,n,i,o,a){var s=n[t],l=i[2*t],u=i[2*t+1],c=o[t],h=a[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],o[t]=o[e],a[t]=a[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],o[e]=o[r],a[e]=a[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,o[r]=c,a[r]=h}function l(t,e,r,n,i,o,a,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=o,c[e]=a}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,o,a,s){return(e-o[t]||a[2*t]-r||i-s[t])<0}function h(t,e,r,n,d,p){var v=(e-t+1)/6|0,m=t+v,g=e-v,y=t+e>>1,b=y-v,x=y+v,_=m,w=b,M=y,k=x,A=g,T=t+1,E=e-1,S=0;u(_,w,r,n,d,p)&&(S=_,_=w,w=S),u(k,A,r,n,d,p)&&(S=k,k=A,A=S),u(_,M,r,n,d,p)&&(S=_,_=M,M=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(_,k,r,n,d,p)&&(S=_,_=k,k=S),u(M,k,r,n,d,p)&&(S=M, -M=k,k=S),u(w,A,r,n,d,p)&&(S=w,w=A,A=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(k,A,r,n,d,p)&&(S=k,k=A,A=S);var L=r[w],z=n[2*w],I=n[2*w+1],P=d[w],C=p[w],R=r[k],D=n[2*k],O=n[2*k+1],F=d[k],j=p[k],N=_,B=M,U=A,V=m,q=y,G=g,H=r[N],X=r[B],Y=r[U];r[V]=H,r[q]=X,r[G]=Y;for(var W=0;2>W;++W){var Z=n[2*N+W],K=n[2*B+W],J=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=K,n[2*G+W]=J}var $=d[N],Q=d[B],tt=d[U];d[V]=$,d[q]=Q,d[G]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[G]=nt,a(b,t,r,n,d,p),a(x,e,r,n,d,p);for(var it=T;E>=it;++it)if(c(it,L,z,I,P,r,n,d))it!==T&&o(it,T,r,n,d,p),++T;else if(!c(it,R,D,O,F,r,n,d))for(;;){if(c(E,R,D,O,F,r,n,d)){c(E,L,z,I,P,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(o(it,E,r,n,d,p),--E);break}if(--E=T-2-t?i(t,T-2,r,n,d,p):h(t,T-2,r,n,d,p),f>=e-(E+2)?i(E+2,e,r,n,d,p):h(E+2,e,r,n,d,p),f>=E-T?i(T,E,r,n,d,p):h(T,E,r,n,d,p)}e.exports=n;var f=32},{}],195:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s){for(var l=r,u=r;n>u;++u){var c=t[2*u],h=t[2*u+1],f=e[u];c>=i&&a>=c&&h>=o&&s>=h&&(u===l?l+=1:(t[2*u]=t[2*l],t[2*u+1]=t[2*l+1],e[u]=e[l],t[2*l]=c,t[2*l+1]=h,e[l]=f,l+=1))}return l}function i(t,e,r){this.pixelSize=t,this.offset=e,this.count=r}function o(t,e,r,o){function l(i,o,a,s,u,c){var h=.5*a,f=s+1,d=u-s;r[_]=d,x[_++]=c;for(var p=0;2>p;++p)for(var v=0;2>v;++v){var m=i+p*h,g=o+v*h,y=n(t,e,f,u,m,g,m+h,g+h);if(y!==f){if(y-f>=Math.max(.9*d,32)){var b=u+s>>>1;l(m,g,h,f,b,c+1),f=b}l(m,g,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(1>u)return[];for(var c=1/0,h=1/0,f=-(1/0),d=-(1/0),p=0;u>p;++p){var v=t[2*p],m=t[2*p+1];c=Math.min(c,v),f=Math.max(f,v),h=Math.min(h,m),d=Math.max(d,m),e[p]=p}c===f&&(f+=1+Math.abs(f)),h===d&&(d+=1+Math.abs(f));var g=1/(f-c),y=1/(d-h),b=Math.max(f-c,d-h);o=o||[0,0,0,0],o[0]=c,o[1]=h,o[2]=f,o[3]=d;var x=a.mallocInt32(u),_=0;l(c,h,b,0,u,0),s(x,t,e,r,u);for(var w=[],M=0,k=u,_=u-1;_>=0;--_){t[2*_]=(t[2*_]-c)*g,t[2*_+1]=(t[2*_+1]-h)*y;var A=x[_];A!==M&&(w.push(new i(b*Math.pow(.5,A),_+1,k-(_+1))),k=_+1,M=A)}return w.push(new i(b*Math.pow(.5,A+1),0,k)),a.free(x),w}var a=t("typedarray-pool"),s=t("./lib/sort");e.exports=o},{"./lib/sort":194,"typedarray-pool":458}],196:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.weightBuffer=n,this.shader=i,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=a(r),s=a(r),l=a(r),u=o(r,c.pointVertex,c.pointFragment),h=o(r,c.pickVertex,c.pickFragment),f=new n(t,i,s,l,u,h);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),a=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var h=n.prototype;h.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},h.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords);var r=t.positions,n=u.mallocFloat32(r.length),i=u.mallocInt32(r.length>>>1);n.set(r);var o=u.mallocFloat32(r.length);this.points=r,this.scales=l(n,i,o,this.bounds),this.offsetBuffer.update(n),this.pickBuffer.update(i),this.weightBuffer.update(o);for(var a=u.mallocFloat32(r.length>>>1),s=0,c=0;s>>1,this.pickOffset=0},h.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0,0,0];return function(r){var n=this.plot,i=this.pickShader,o=this.scales,a=this.offsetBuffer,l=this.pickBuffer,u=this.bounds,c=this.size,h=this.borderSize,f=n.gl,d=n.pickPixelRatio,p=n.viewBox,v=n.dataBox;if(0===this.pointCount)return r;var m=u[2]-u[0],g=u[3]-u[1],y=v[2]-v[0],b=v[3]-v[1],x=(p[2]-p[0])*d/n.pixelRatio,_=(p[3]-p[1])*d/n.pixelRatio,w=Math.min(y/x,b/_);t[0]=2*m/y,t[4]=2*g/b,t[6]=2*(u[0]-v[0])/y-1,t[7]=2*(u[1]-v[1])/b-1,this.pickOffset=r,e[0]=255&r,e[1]=r>>8&255,e[2]=r>>16&255,e[3]=r>>24&255,i.bind(),i.uniforms.matrix=t,i.uniforms.color=this.color,i.uniforms.borderColor=this.borderColor,i.uniforms.pointSize=d*(c+h),i.uniforms.pickOffset=e,0===this.borderSize?i.uniforms.centerFraction=2:i.uniforms.centerFraction=c/(c+h+1.25),a.bind(),i.attributes.position.pointer(),l.bind(),i.attributes.pickId.pointer(f.UNSIGNED_BYTE);for(var M=this.xCoords,k=(v[0]-u[0]-w*c*d)/m,A=(v[2]-u[0]+w*c*d)/m,T=o.length-1;T>=0;--T){var E=o[T];if(!(E.pixelSize1)){var S=E.offset,L=E.count+S,z=s.ge(M,k,S,L-1),I=s.lt(M,A,z,L-1)+1;I>z&&f.drawArrays(f.POINTS,z,I-z)}}return r+this.pointCount}}(),h.draw=function(){var t=[1,0,0,0,1,0,0,0,1];return function(){var e=this.plot,r=this.shader,n=this.scales,i=this.offsetBuffer,o=this.bounds,a=this.size,l=this.borderSize,u=e.gl,c=e.pixelRatio,h=e.viewBox,f=e.dataBox;if(0!==this.pointCount){var d=o[2]-o[0],p=o[3]-o[1],v=f[2]-f[0],m=f[3]-f[1],g=h[2]-h[0],y=h[3]-h[1],b=Math.min(v/g,m/y);t[0]=2*d/v,t[4]=2*p/m,t[6]=2*(o[0]-f[0])/v-1,t[7]=2*(o[1]-f[1])/m-1,r.bind(),r.uniforms.matrix=t,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointSize=c*(a+l),r.uniforms.useWeight=1,0===this.borderSize?r.uniforms.centerFraction=2:r.uniforms.centerFraction=a/(a+l+1.25),i.bind(),r.attributes.position.pointer(),this.weightBuffer.bind(),r.attributes.weight.pointer();for(var x=this.xCoords,_=(f[0]-o[0]-b*a*c)/d,w=(f[2]-o[0]+b*a*c)/d,M=!0,k=n.length-1;k>=0;--k){var A=n[k];if(!(A.pixelSize1)){var T=A.offset,E=A.count+T,S=s.ge(x,_,T,E-1),L=s.lt(x,w,S,E-1)+1;L>S&&u.drawArrays(u.POINTS,S,L-S),M&&(M=!1,r.uniforms.useWeight=0)}}}}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}}},{"./lib/shader":192,"binary-search-bounds":193,"gl-buffer":124,"gl-shader":203,"snap-points-2d":195,"typedarray-pool":458}],197:[function(t,e,r){"use strict";function n(t,e){var r=o[e];if(r||(r=o[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),a=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lc;++c)s[0][c]=Math.min(s[0][c],u[c]),s[1][c]=Math.max(s[1][c],u[c]);return r[t]=[a,n,s]}var i=t("vectorize-text");e.exports=n;var o={}},{"vectorize-text":460}],198:[function(t,e,r){function n(t,e){var r=i(t,e),n=r.attributes;return n.position.location=0,n.color.location=1,n.glyph.location=2,n.id.location=3,r}var i=t("gl-shader"),o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\n\nuniform vec4 highlightId;\nuniform float highlightScale;\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = 1.0;\n if(distance(highlightId, id) < 0.0001) {\n scale = highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1);\n vec4 viewPosition = view * worldPosition;\n viewPosition = viewPosition / viewPosition.w;\n vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\n \n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float highlightScale, pixelRatio;\nuniform vec4 highlightId;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = pixelRatio;\n if(distance(highlightId.bgr, id.bgr) < 0.001) {\n scale *= highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1.0);\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n \n gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform float highlightScale;\nuniform vec4 highlightId;\nuniform vec3 axes[2];\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float scale, pixelRatio;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) ||\n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float lscale = pixelRatio * scale;\n if(distance(highlightId, id) < 0.0001) {\n lscale *= highlightScale;\n }\n\n vec4 clipCenter = projection * view * model * vec4(position, 1);\n vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\n vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = dataPosition;\n }\n}\n",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) ||\n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = interpColor * opacity;\n }\n}\n",u="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) || \n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n }\n}",c=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],h={vertex:o,fragment:l,attributes:c},f={vertex:a,fragment:l,attributes:c},d={vertex:s,fragment:l,attributes:c},p={vertex:o,fragment:u,attributes:c},v={vertex:a,fragment:u,attributes:c},m={vertex:s,fragment:u,attributes:c};r.createPerspective=function(t){return n(t,h)},r.createOrtho=function(t){return n(t,f)},r.createProject=function(t){return n(t,d)},r.createPickPerspective=function(t){return n(t,p)},r.createPickOrtho=function(t){return n(t,v)},r.createPickProject=function(t){return n(t,m)}},{"gl-shader":203}],199:[function(t,e,r){"use strict";function n(t,e){var r=t[0],n=t[1],i=t[2],o=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*i+e[12]*o,t[1]=e[1]*r+e[5]*n+e[9]*i+e[13]*o,t[2]=e[2]*r+e[6]*n+e[10]*i+e[14]*o,t[3]=e[3]*r+e[7]*n+e[11]*i+e[15]*o,t}function i(t,e,r,i){return n(i,i,r),n(i,i,e),n(i,i,t)}function o(t,e){this.index=t,this.dataCoordinate=this.position=e}function a(t,e,r,n,i,a,s,l,u,c,h,f){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=i,this.colorBuffer=a,this.glyphBuffer=s,this.idBuffer=l,this.vao=u,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.pickId=0,this.pickPerspectiveShader=c,this.pickOrthoShader=h,this.pickProjectShader=f,this.points=[],this._selectResult=new o(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.dirty=!0}function s(t){return t[0]=t[1]=t[2]=0,t}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function u(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function c(t){for(var e=L,r=0;2>r;++r)for(var n=0;3>n;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}function h(t,e,r,n,o){var a,h=e.axesProject,f=e.gl,d=t.uniforms,p=r.model||x,v=r.view||x,m=r.projection||x,y=e.axesBounds,b=c(e.clipBounds);a=e.axes?e.axes.lastCubeProps.axis:[1,1,1],w[0]=2/f.drawingBufferWidth,w[1]=2/f.drawingBufferHeight,t.bind(),d.view=v,d.projection=m,d.screenSize=w,d.highlightId=e.highlightId,d.highlightScale=e.highlightScale,d.clipBounds=b,d.pickGroup=e.pickId/255,d.pixelRatio=e.pixelRatio;for(var _=0;3>_;++_)if(h[_]&&e.projectOpacity[_]<1===n){d.scale=e.projectScale[_],d.opacity=e.projectOpacity[_];for(var L=E,z=0;16>z;++z)L[z]=0;for(var z=0;4>z;++z)L[5*z]=1;L[5*_]=0,a[_]<0?L[12+_]=y[0][_]:L[12+_]=y[1][_],g(L,p,L),d.model=L;var I=(_+1)%3,P=(_+2)%3,C=s(M),R=s(k);C[I]=1,R[P]=1;var D=i(m,v,p,l(A,C)),O=i(m,v,p,l(T,R));if(Math.abs(D[1])>Math.abs(O[1])){var F=D;D=O,O=F,F=C,C=R,R=F;var j=I;I=P,P=j}D[0]<0&&(C[I]=-1),O[1]>0&&(R[P]=-1);for(var N=0,B=0,z=0;4>z;++z)N+=Math.pow(p[4*I+z],2),B+=Math.pow(p[4*P+z],2);C[I]/=Math.sqrt(N),R[P]/=Math.sqrt(B),d.axes[0]=C,d.axes[1]=R,d.fragClipBounds[0]=u(S,b[0],_,-1e8),d.fragClipBounds[1]=u(S,b[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,o){var a=r.gl;if(r.vao.bind(),i===r.opacity<1||o){t.bind();var s=t.uniforms;s.model=n.model||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/a.drawingBufferWidth,w[1]=2/a.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=P,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(a.TRIANGLES,r.vertexCount),r.lineWidth>0&&(a.lineWidth(r.lineWidth),r.vao.draw(a.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,o),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),o=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),h=p(e),f=p(e),d=v(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),m=new a(e,r,n,i,u,c,h,f,d,o,s,l);return m.update(t),m}var p=t("gl-buffer"),v=t("gl-vao"),m=t("typedarray-pool"),g=t("gl-mat4/multiply"),y=t("./lib/shaders"),b=t("./lib/glyphs"),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=a.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],k=[0,0,0],A=[0,0,0,1],T=[0,0,0,1],E=x.slice(),S=[0,0,0],L=[[0,0,0],[0,0,0]],z=[-1e8,-1e8,-1e8],I=[1e8,1e8,1e8],P=[z,I];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;f(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||0>e)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;3>i;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",o=t.alignment||[0,0],a=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,h=t.angle,f=t.lineColor,d=0,p=0,v=0,g=n.length;t:for(var y=0;g>y;++y){for(var x=n[y],_=0;3>_;++_)if(isNaN(x[_])||!isFinite(x[_]))continue t;var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var M=w[0],k=w[1],A=w[2];p+=3*M.cells.length,v+=2*k.edges.length}var T=p+v,E=m.mallocFloat(3*T),S=m.mallocFloat(4*T),L=m.mallocFloat(2*T),z=m.mallocUint32(T),I=[0,o[1]],P=0,C=p,R=[0,0,0,1],D=[0,0,0,1],O=Array.isArray(u)&&Array.isArray(u[0]),F=Array.isArray(f)&&Array.isArray(f[0]);t:for(var y=0;g>y;++y){for(var x=n[y],_=0;3>_;++_){if(isNaN(x[_])||!isFinite(x[_])){d+=1;continue t}s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_])}var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var M=w[0],k=w[1],A=w[2];if(Array.isArray(u)){var j;if(j=O?u[y]:u,3===j.length){for(var _=0;3>_;++_)R[_]=j[_];R[3]=1}else if(4===j.length)for(var _=0;4>_;++_)R[_]=j[_]}else R[0]=R[1]=R[2]=0,R[3]=1;if(Array.isArray(f)){var j;if(j=F?f[y]:f,3===j.length){for(var _=0;3>_;++_)D[_]=j[_];D[_]=1}else if(4===j.length)for(var _=0;4>_;++_)D[_]=j[_]}else D[0]=D[1]=D[2]=0,D[3]=1;var N=.5;Array.isArray(c)?N=+c[y]:c?N=+c:this.useOrtho&&(N=12);var B=0;Array.isArray(h)?B=+h[y]:h&&(B=+h);for(var U=Math.cos(B),V=Math.sin(B),x=n[y],_=0;3>_;++_)s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_]);o[0]<0?I[0]=o[0]*(1+A[1][0]):o[0]>0&&(I[0]=-o[0]*(1+A[0][0]));for(var q=M.cells,G=M.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*P+Y]=x[Y];for(var Y=0;4>Y;++Y)S[4*P+Y]=R[Y];z[P]=d;var W=G[H[X]];L[2*P]=N*(U*W[0]-V*W[1]+I[0]),L[2*P+1]=N*(V*W[0]+U*W[1]+I[1]),P+=1}for(var q=k.edges,G=k.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*C+Y]=x[Y];for(var Y=0;4>Y;++Y)S[4*C+Y]=D[Y];z[C]=d;var W=G[H[X]];L[2*C]=N*(U*W[0]-V*W[1]+I[0]),L[2*C+1]=N*(V*W[0]+U*W[1]+I[1]),C+=1}d+=1}this.vertexCount=p,this.lineVertexCount=v,this.pointBuffer.update(E),this.colorBuffer.update(S),this.glyphBuffer.update(L),this.idBuffer.update(new Uint32Array(z)),m.free(E),m.free(S),m.free(L),m.free(z),this.bounds=[a,s],this.points=n,this.pointCount=n.length}},_.dispose=function(){this.shader.dispose(),this.orthoShader.dispose(),this.pickPerspectiveShader.dispose(),this.pickOrthoShader.dispose(),this.vao.dispose(),this.pointBuffer.dispose(),this.colorBuffer.dispose(),this.glyphBuffer.dispose(),this.idBuffer.dispose()}},{"./lib/glyphs":197,"./lib/shaders":198,"gl-buffer":124,"gl-mat4/multiply":145,"gl-vao":232,"typedarray-pool":458}],200:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],201:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=a(r,[0,0,0,1,1,0,1,1]),l=o(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var o=t("gl-shader"),a=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),o=this.borderColor,a=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,h=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],f=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],d=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(h=Math.max(h,u[0]),f=Math.max(f,u[1]),d=Math.min(d,u[2]),p=Math.min(p,u[3]),!(h>d||f>p)){a.bind();var v=s[2]-s[0],m=s[3]-s[1];if(this.outerFill&&(a.drawBox(0,0,v,f,i),a.drawBox(0,f,h,p,i),a.drawBox(0,p,v,m,i),a.drawBox(d,f,v,p,i)),this.innerFill&&a.drawBox(h,f,d,p,n),r>0){var g=r*c;a.drawBox(h-g,f-g,d+g,f+g,o),a.drawBox(h-g,p-g,d+g,p+g,o),a.drawBox(h-g,f-g,h+g,p+g,o),a.drawBox(d-g,f-g,d+g,p+g,o)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":200,"gl-buffer":124,"gl-shader":203}],202:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function o(t,e){var r=a(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=o;var a=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(255>_inline_46_arg0_||255>_inline_46_arg1_||255>_inline_46_arg2_||255>_inline_46_arg3_){var _inline_46_l=_inline_46_arg4_-_inline_46_arg6_[0],_inline_46_a=_inline_46_arg5_-_inline_46_arg6_[1],_inline_46_f=_inline_46_l*_inline_46_l+_inline_46_a*_inline_46_a;_inline_46_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;r*e*4>i;++i)n[i]=255}return t}}}),h.begin=function(){var t=this.gl;this.shape;t&&(this.fbo.bind(),t.clearColor(1,1,1,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT))},h.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},h.query=function(t,e,r){if(!this.gl)return null;var i=this.fbo.shape.slice();t=0|t,e=0|e,"number"!=typeof r&&(r=1);var o=0|Math.min(Math.max(t-r,0),i[0]),a=0|Math.min(Math.max(t+r,0),i[0]),s=0|Math.min(Math.max(e-r,0),i[1]),u=0|Math.min(Math.max(e+r,0),i[1]);if(o>=a||s>=u)return null;var h=[a-o,u-s],f=l(this.buffer,[h[0],h[1],4],[4,4*i[0],1],4*(o+i[0]*s)),d=c(f.hi(h[0],h[1],1),r,r),p=d[0],v=d[1];if(0>p||Math.pow(this.radius,2)=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;k>T;++T)A[T]=_.length,x.push(M.name+"["+T+"]"),"number"==typeof M.location?_.push(M.location+T):Array.isArray(M.location)&&M.location.length===k&&"number"==typeof M.location[T]?_.push(0|M.location[T]):_.push(-1);b.push({name:M.name,type:M.type,locations:A})}else b.push({name:M.name,type:M.type,locations:[_.length]}),x.push(M.name),"number"==typeof M.location?_.push(0|M.location):_.push(-1)}for(var E=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(E)>=0;)E+=1;_[w]=E}var S=new Array(r.length);o(),d._relink=o,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",a(p,d,r,S))},e.exports=o},{"./lib/GLError":204,"./lib/create-attributes":205,"./lib/create-uniforms":206,"./lib/reflect":207,"./lib/runtime-reflect":208,"./lib/shader-cache":209}],204:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],205:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=o}function i(t,e,r,i,o,a,s){for(var l=["gl","v"],u=[],c=0;o>c;++c)l.push("x"+c),u.push("x"+c);l.push("if(x0.length===void 0){return gl.vertexAttrib"+o+"f(v,"+u.join()+")}else{return gl.vertexAttrib"+o+"fv(v,x0)}");var h=Function.apply(null,l),f=new n(t,e,r,i,o,h);Object.defineProperty(a,s,{set:function(e){return t.disableVertexAttribArray(i[r]),h(t,i[r],e),e},get:function(){return f},enumerable:!0})}function o(t,e,r,n,o,a,s){for(var l=new Array(o),u=new Array(o),c=0;o>c;++c)i(t,e,r[c],n,o,l,c),u[c]=l[c];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;o>e;++e)u[e].location=t[e];else for(var e=0;o>e;++e)u[e].location=t+e;return t},get:function(){for(var t=new Array(o),e=0;o>e;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,a,s){e=e||t.FLOAT,i=!!i,a=a||o*o,s=s||0;for(var l=0;o>l;++l){var u=n[r[l]];t.vertexAttribPointer(u,o,e,i,a,s+l*o),t.enableVertexAttribArray(u)}};var h=new Array(o),f=t["vertexAttrib"+o+"fv"];Object.defineProperty(a,s,{set:function(e){for(var i=0;o>i;++i){var a=n[r[i]];if(t.disableVertexAttribArray(a),Array.isArray(e[0]))f.call(t,a,e[i]);else{for(var s=0;o>s;++s)h[s]=e[o*i+s];f.call(t,a,h)}}return e},get:function(){return l},enumerable:!0})}function a(t,e,r,n){for(var a={},l=0,u=r.length;u>l;++l){var c=r[l],h=c.name,f=c.type,d=c.locations;switch(f){case"bool":case"int":case"float":i(t,e,d[0],n,1,a,h);break;default:if(f.indexOf("vec")>=0){var p=f.charCodeAt(f.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,a,h)}else{if(!(f.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+h+": "+f);var p=f.charCodeAt(f.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);o(t,e,d,n,p,a,h)}}}return a}e.exports=a;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,o=i._gl,a=i._locations[i._index];o.vertexAttribPointer(a,i._dimension,t||o.FLOAT,!!e,r||0,n||0),o.enableVertexAttribArray(a)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":204}],206:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e,r,o){function l(r){var n=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}");return n(t,e,o)}function u(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(n>=0&&1>=n&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],o=t;o+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(o,i)):r.push([o,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=c("",e),a=0;a=0&&1>=e&&t.length===4+e){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var a=p(i);Object.defineProperty(t,e,{get:n(a),set:h(i),enumerable:!0,configurable:!1})}else o[i]?Object.defineProperty(t,e,{get:l(i),set:h(i),enumerable:!0,configurable:!1}):t[e]=f(r[i].type)}function p(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in a||(a[l[0]]=[]),a=a[l[0]];for(var u=1;uo;++o){var a=t.getActiveUniform(e,o);if(a){var s=n(t,a.type);if(a.size>1)for(var l=0;lo;++o){var a=t.getActiveAttrib(e,o);a&&i.push({name:a.name,type:n(t,a.type)})}return i}r.uniforms=i,r.attributes=o;var a={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},s=null},{}],209:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=o,this.programs=[],this.cache=a}function i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function o(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);try{var o=h(i,r,e)}catch(a){throw console.warn("Failed to format compiler error: "+a),new c(i,"Error compiling shader:\n"+i)}throw new c(i,o.short,o.long)}return n}function a(t,e,r,n,i){var o=t.createProgram();t.attachShader(o,e),t.attachShader(o,r);for(var a=0;an;++n){var o=t.programs[r[n]];o&&(delete t.programs[n],e.deleteProgram(o))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var v=i.prototype;v.getShaderReference=function(t,e){var r=this.gl,i=this.shaders[t===r.FRAGMENT_SHADER|0],a=i[e];if(a&&r.isShader(a.shader))a.count+=1;else{var s=o(r,t,e);a=i[e]=new n(p++,e,t,s,[],1,this)}return a},v.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),o=this.programs[i];return o&&this.gl.isProgram(o)||(this.programs[i]=o=a(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),o}},{"./GLError":204,"gl-format-compiler-error":210,"weakmap-shim":220}],210:[function(t,e,r){function n(t,e,r){"use strict";var n=a(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===o.FRAGMENT_SHADER?"fragment":"vertex");for(var u=i("Error compiling %s shader %s:\n",l,n),c=i("%s%s",u,t),h=t.split("\n"),f={},d=0;ds;s++)if(v=i(t[s]),"string"===v)m[m.length]=t[s];else if("array"===v){if(u=t[s],u[2])for(n=e[d],l=0;l=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}a.json.test(u[8])?m[m.length]=n:(!a.number.test(u[8])||g&&!u[3]?y="":(y=g?"+":"-",n=n.toString().replace(a.sign,"")),h=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",f=u[6]-(y+n).length,c=u[6]&&f>0?o(h,f):"",m[m.length]=u[5]?y+n+c:"0"===h?y+c+n:c+y+n)}return m.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=a.text.exec(e)))n[n.length]=r[0];else if(null!==(r=a.modulo.exec(e)))n[n.length]="%";else{if(null===(r=a.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var o=[],s=r[2],l=[];if(null===(l=a.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=a.key_access.exec(s)))o[o.length]=l[1];else{if(null===(l=a.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=l[1]}r[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],218:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":219}],219:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],220:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},"delete":function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":218}],221:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var o=n.prototype;o.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},o.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,o=i.line,a=i.dataBox,s=i.viewBox;if(o.bind(),a[0]<=n[0]&&n[0]<=a[2]&&a[1]<=n[1]&&n[1]<=a[3]){var l=s[0]+(n[0]-a[0])/(a[2]-a[0])*(s[2]-s[0]),u=s[1]+(n[1]-a[1])/(a[3]-a[1])*(s[3]-s[1]);t[0]&&o.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&o.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&o.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&o.drawLine(l,u,l,s[3],e[3],r[3])}},o.dispose=function(){this.plot.removeOverlay(this)}},{}],222:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n worldCoordinate = vec3(uv.zw, f.x);\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = beckmannSpecular_1_1(L, V, N, roughness);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = texture2D(colormap, vec2(value, value));\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,a,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},r.createPickContourShader=function(t){var e=n(t,a,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":203}],223:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],224:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;t>r;++r)e.push("out",r,"s=0.5*(inp",r,"l-inp",r,"r);");for(var n=["array"],i=["junk"],r=0;t>r;++r){n.push("array"),i.push("out"+r+"s");var o=a(t);o[r]=-1,n.push({array:0,offset:o.slice()}),o[r]=1,n.push({array:0,offset:o.slice()}),i.push("inp"+r+"l","inp"+r+"r")}return l[t]=s({args:n,pre:c,post:c,body:{body:e.join(""),args:i.map(function(t){return{name:t,lvalue:0===t.indexOf("out"),rvalue:0===t.indexOf("inp"),count:"junk"!==t|0}}),thisVars:[],localVars:[]},funcName:"fdTemplate"+t})}function i(t){function e(e){for(var r=o-e.length,n=[],i=[],s=[],l=0;o>l;++l)e.indexOf(l+1)>=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===r?a.push("dst.set(",s.join(),",",c,",0);"):a.push("zero(",h,");");break;case"wrap":var p=s.slice(),v=s.slice();e[l]<0?(p[c]="s["+c+"]-2",v[c]="0"):(p[c]="s["+c+"]-1",v[c]="1"),0===r?a.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",v.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>2){diff(",h,",src.pick(",p.join(),")",u,",src.pick(",v.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var o=t.length,a=["function gradient(dst,src){var s=src.shape.slice();"],s=0;1<s;++s){for(var c=[],d=0;o>d;++d)s&1<=s;++s)m.push("grad"+s),g.push(n(s));m.push(a.join(""));var y=Function.apply(void 0,m),i=y.apply(void 0,g);return l[r]=i,i}function o(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?a(e.dimension,r):a(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;nr;++r)for(a=a||e.surfaceProject[r],n=0;3>n;++n)s=s||e.contourProject[r][n];for(r=0;3>r;++r){var l=N.projections[r];for(n=0;16>n;++n)l[n]=0;for(n=0;4>n;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(o[r]>0)][r],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;2>i;++i)for(n=0;3>n;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=a,N.showContour=s,N}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||C,n.view=t.view||C,n.projection=t.projection||C,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=k(n.inverseModel,n.model);for(var i=0;2>i;++i)for(var o=n.clipBounds[i],s=0;3>s;++s)o[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),k(l,l),i=0;3>i;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;3>i;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;3>i;++i){var c=l[12+i];for(s=0;3>s;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=a(n,this);if(h.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;3>i;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[i],this._shader.uniforms.clipBounds=h.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(h.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;3>i;++i)for(f.uniforms.permutation=D[i],r.lineWidth(this.contourWidth[i]),s=0;si;++i)for(f.uniforms.model=h.projections[i],f.uniforms.clipBounds=h.clipBounds[i],s=0;3>s;++s)if(this.contourProject[i][s]){f.uniforms.permutation=D[s],r.lineWidth(this.contourWidth[s]);for(var p=0;pi;++i)if(0!==this._dynamicCounts[i])for(f.uniforms.model=n.model,f.uniforms.clipBounds=n.clipBounds,f.uniforms.permutation=D[i],r.lineWidth(this.dynamicWidth[i]),f.uniforms.contourColor=this.dynamicColor[i],f.uniforms.contourTint=this.dynamicTint[i],f.uniforms.height=this.dynamicLevel[i],d.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]),s=0;3>s;++s)this.contourProject[s][i]&&(f.uniforms.model=h.projections[s],f.uniforms.clipBounds=h.clipBounds[s],d.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]));d.unbind()}}function l(t,e){var r=e.shape.slice(),n=t.shape.slice();b.assign(t.lo(1,1).hi(r[0],r[1]),e),b.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),b.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),b.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),b.assign(t.lo(n[0]-1,1).hi(1,r[1]),e.lo(r[0]-1)),t.set(0,0,e.get(0,0)),t.set(0,n[1]-1,e.get(0,r[1]-1)),t.set(n[0]-1,0,e.get(r[0]-1,0)),t.set(n[0]-1,n[1]-1,e.get(r[0]-1,r[1]-1))}function u(t,e){return Array.isArray(t)?[e(t[0]),e(t[1]),e(t[2])]:[e(t),e(t),e(t)]}function c(t){return Array.isArray(t)?3===t.length?[t[0],t[1],t[2],1]:[t[0],t[1],t[2],t[3]]:[0,0,0,1]}function h(t){if(Array.isArray(t)){if(Array.isArray(t))return[c(t[0]),c(t[1]),c(t[2])];var e=c(t);return[e.slice(),e.slice(),e.slice()]}}function f(t){var e=t.gl,r=S(e),n=z(e),i=L(e),a=I(e),s=p(e),l=v(e,[{buffer:s,size:4,stride:P,offset:0},{buffer:s,size:3,stride:P,offset:16},{buffer:s,size:3,stride:P,offset:28}]),u=p(e),c=v(e,[{buffer:u,size:4,stride:20,offset:0},{buffer:u,size:1,stride:20,offset:16}]),h=p(e),f=v(e,[{buffer:h,size:2,type:e.FLOAT}]),d=m(e,1,O,e.RGBA,e.UNSIGNED_BYTE);d.minFilter=e.LINEAR,d.magFilter=e.LINEAR;var g=new o(e,[0,0],[[0,0,0],[0,0,0]],r,n,s,l,d,i,a,u,c,h,f),y={levels:[[],[],[]]};for(var b in t)y[b]=t[b];return y.colormap=y.colormap||"jet",g.update(y),g}e.exports=f;var d=t("bit-twiddle"),p=t("gl-buffer"),v=t("gl-vao"),m=t("gl-texture2d"),g=t("typedarray-pool"),y=t("colormap"),b=t("ndarray-ops"),x=t("ndarray-pack"),_=t("ndarray"),w=t("surface-nets"),M=t("gl-mat4/multiply"),k=t("gl-mat4/invert"),A=t("binary-search-bounds"),T=t("ndarray-gradient"),E=t("./lib/shaders"),S=E.createShader,L=E.createContourShader,z=E.createPickShader,I=E.createPickContourShader,P=40,C=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],R=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],D=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];!function(){for(var t=0;3>t;++t){var e=D[t],r=(t+1)%3,n=(t+2)%3;e[r+0]=1,e[n+3]=1,e[t+6]=1}}();var O=265,F=o.prototype;F.isTransparent=function(){return this.opacity<1},F.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},F.pickSlots=1,F.setPickBase=function(t){this.pickId=t};var j=[0,0,0],N={showSurface:!1,showContour:!1,projections:[C.slice(),C.slice(),C.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:C,view:C,projection:C,inverseModel:C.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1},U=C.slice(),V=[1,0,0,0,1,0,0,0,1];F.draw=function(t){return s.call(this,t,!1)},F.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:C,view:C,projection:C,inverseModel:C,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};F.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||C,r.view=t.view||C,r.projection=t.projection||C,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;2>n;++n)for(var i=r.clipBounds[n],o=0;3>o;++o)i[o]=Math.min(Math.max(this.clipBounds[n][o],-1e8),1e8);var s=a(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;3>n;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),o=0;3>o;++o)for(e.lineWidth(this.contourWidth[o]),l.uniforms.permutation=D[o],n=0;nn;++n)for(l.uniforms.model=s.projections[n],l.uniforms.clipBounds=s.clipBounds[n],o=0;3>o;++o)if(this.contourProject[n][o]){l.uniforms.permutation=D[o],e.lineWidth(this.contourWidth[o]);for(var c=0;c>4)/16)/255,i=Math.floor(n),o=n-i,a=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(a),l=a-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;2>c;++c)for(var h=c?o:1-o,f=0;2>f;++f)for(var d=f?l:1-l,p=i+c,v=s+f,m=h*d,g=0;3>g;++g)u[g]+=this._field[g].get(p,v)*m;for(var y=this._pickResult.level,b=0;3>b;++b)if(y[b]=A.le(this.contourLevels[b],u[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]Math.abs(_-u[b])&&(y[b]+=1)}for(r.index[0]=.5>o?i:i+1,r.index[1]=.5>l?s:s+1,r.uv[0]=n/e[0],r.uv[1]=a/e[1],g=0;3>g;++g)r.dataCoordinate[g]=this._field[g].get(r.index[0],r.index[1]);return r},F.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=h(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=h(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(g.freeFloat(this._field[2].data),this._field[2].data=g.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var o=this.shape,a=0;2>a;++a)this._field[2].size>this._field[a].data.length&&(g.freeFloat(this._field[a].data),this._field[a].data=g.mallocFloat(this._field[2].size)),this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(a=0;2>a;++a){var c=s[a];for(y=0;2>y;++y)if(c.shape[y]!==o[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[a],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(a=0;2>a;++a){var p=f[a];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==o[a])throw new Error("gl-surface: invalid tick length");var v=_(p.data,o);v.stride[a]=p.stride[0],v.stride[1^a]=0,l(this._field[a],v)}}else{for(a=0;2>a;++a){var m=[0,0];m[a]=1,this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2],m,0)}this._field[0].set(0,0,0);for(var y=0;ya;++a)T(x.pick(a),b[a],"mirror");var M=_(g.mallocFloat(3*b[2].size),[o[0]+2,o[1]+2,3]);for(a=0;aD?(D=Math.max(Math.abs(I),Math.abs(P),Math.abs(C)),1e-8>D?(C=1,P=I=0,D=1):D=1/D):D=1/Math.sqrt(D),M.set(a,y,0,I*D),M.set(a,y,1,P*D),M.set(a,y,2,C*D)}g.free(x.data);var O=[1/0,1/0,1/0],F=[-(1/0),-(1/0),-(1/0)],j=1/0,N=-(1/0),B=(o[0]-1)*(o[1]-1)*6,U=g.mallocFloat(d.nextPow2(10*B)),V=0,q=0;for(a=0;aG;++G)for(var H=0;2>H;++H)for(var X=0;3>X;++X){var Y=this._field[X].get(1+a+G,1+y+H);if(isNaN(Y)||!isFinite(Y))continue t}for(X=0;6>X;++X){var W=a+R[X][0],Z=y+R[X][1],K=this._field[0].get(W+1,Z+1),J=this._field[1].get(W+1,Z+1);Y=this._field[2].get(W+1,Z+1);var $=Y;I=M.get(W+1,Z+1,0),P=M.get(W+1,Z+1,1),C=M.get(W+1,Z+1,2),t.intensity&&($=t.intensity.get(W,Z)),U[V++]=W,U[V++]=Z,U[V++]=K,U[V++]=J,U[V++]=Y,U[V++]=0,U[V++]=$,U[V++]=I,U[V++]=P,U[V++]=C,O[0]=Math.min(O[0],K),O[1]=Math.min(O[1],J),O[2]=Math.min(O[2],Y),j=Math.min(j,$),F[0]=Math.max(F[0],K),F[1]=Math.max(F[1],J),F[2]=Math.max(F[2],Y),N=Math.max(N,$),q+=1}}for(t.intensityBounds&&(j=+t.intensityBounds[0],N=+t.intensityBounds[1]),a=6;V>a;a+=10)U[a]=(U[a]-j)/(N-j);this._vertexCount=q,this._coordinateBuffer.update(U.subarray(0,V)),g.freeFloat(U),g.free(M.data),this.bounds=[O,F],this.intensity=t.intensity||this._field[2],this.intensityBounds[0]===j&&this.intensityBounds[1]===N||(r=!0),this.intensityBounds=[j,N]}if("levels"in t){var Q=t.levels;for(Q=Array.isArray(Q[0])?Q.slice():[[],[],Q],a=0;3>a;++a)Q[a]=Q[a].slice(),Q.sort(function(t,e){return t-e});t:for(a=0;3>a;++a){if(Q[a].length!==this.contourLevels[a].length){r=!0;break}for(y=0;yet;++et){Q=this.contourLevels[et];var rt=[],nt=[],it=[0,0,0];for(a=0;aX;++X){var st=ot.positions[at[X]],lt=st[0],ut=0|Math.floor(lt),ct=lt-ut,ht=st[1],ft=0|Math.floor(ht),dt=ht-ft,pt=!1;e:for(var vt=0;3>vt;++vt){it[vt]=0;var mt=(et+vt+1)%3;for(G=0;2>G;++G){var gt=G?ct:1-ct;for(W=0|Math.min(Math.max(ut+G,0),o[0]),H=0;2>H;++H){var yt=H?dt:1-dt;if(Z=0|Math.min(Math.max(ft+H,0),o[1]),Y=2>vt?this._field[mt].get(W,Z):(this.intensity.get(W,Z)-this.intensityBounds[0])/(this.intensityBounds[1]-this.intensityBounds[0]),!isFinite(Y)||isNaN(Y)){pt=!0;break e}var bt=gt*yt;it[vt]+=bt*Y}}}if(pt){if(X>0){for(var xt=0;5>xt;++xt)tt.pop();q-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),q+=1}}nt.push(q)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=g.mallocFloat(tt.length);for(a=0;at;++t)g.freeFloat(this._field[t].data)},F.highlight=function(t){if(!t)return this._dynamicCounts=[0,0,0],this.dyanamicLevel=[NaN,NaN,NaN],void(this.highlightLevel=[-1,-1,-1]);for(var e=0;3>e;++e)this.enableHighlight[e]?this.highlightLevel[e]=t.level[e]:this.highlightLevel[e]=-1;var r;if(r=this.snapToData?t.dataCoordinate:t.position,this.enableDynamic[0]&&r[0]!==this.dynamicLevel[0]||this.enableDynamic[1]&&r[1]!==this.dynamicLevel[1]||this.enableDynamic[2]&&r[2]!==this.dynamicLevel[2]){for(var n=0,i=this.shape,o=g.mallocFloat(12*i[0]*i[1]),a=0;3>a;++a)if(this.enableDynamic[a]){this.dynamicLevel[a]=r[a];var s=(a+1)%3,l=(a+2)%3,u=this._field[a],c=this._field[s],h=this._field[l],f=(this.intensity,w(u,r[a])),d=f.cells,p=f.positions;for(this._dynamicOffsets[a]=n,e=0;em;++m){var y=p[v[m]],b=+y[0],x=0|b,_=0|Math.min(x+1,i[0]),M=b-x,k=1-M,A=+y[1],T=0|A,E=0|Math.min(T+1,i[1]),S=A-T,L=1-S,z=k*L,I=k*S,P=M*L,C=M*S,R=z*c.get(x,T)+I*c.get(x,E)+P*c.get(_,T)+C*c.get(_,E),D=z*h.get(x,T)+I*h.get(x,E)+P*h.get(_,T)+C*h.get(_,E);if(isNaN(R)||isNaN(D)){m&&(n-=1);break}o[2*n+0]=R,o[2*n+1]=D,n+=1}this._dynamicCounts[a]=n-this._dynamicOffsets[a]}else this.dynamicLevel[a]=NaN,this._dynamicCounts[a]=0;this._dynamicBuffer.update(o.subarray(0,2*n)),g.freeFloat(o)}}},{"./lib/shaders":222,"binary-search-bounds":223,"bit-twiddle":51,colormap:106,"gl-buffer":124,"gl-mat4/invert":143,"gl-mat4/multiply":145,"gl-texture2d":228,"gl-vao":232,ndarray:433,"ndarray-gradient":224,"ndarray-ops":432,"ndarray-pack":225,"surface-nets":452,"typedarray-pool":458}],228:[function(t,e,r){"use strict";function n(t){m=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],g=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(0>e||e>i||0>r||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function o(t,e,r,n,i,o){this.gl=t,this.handle=e,this.format=i,this.type=o,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var a=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return a._wrapS},set:function(t){return a.wrapS=t}},{get:function(){return a._wrapT},set:function(t){return a.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return a._shape[0]},set:function(t){return a.width=t}},{get:function(){return a._shape[1]},set:function(t){return a.height=t}}]),this._shapeVector=l}function a(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,o,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var h=0,f=0,m=a(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,m=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,m=!1,u="uint8");var g=1;if(2===c.length)f=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])f=t.ALPHA;else if(2===c[2])f=t.LUMINANCE_ALPHA;else if(3===c[2])f=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}g=c[2]}if(f!==t.LUMINANCE&&f!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(f=i),f!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),h===o&&m)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data.subarray(l.offset,l.offset+y));else{var _;_=o===t.FLOAT?v.mallocFloat32(y):v.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&o===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,_.subarray(0,y)),o===t.FLOAT?v.freeFloat32(_):v.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(0>e||e>a||0>r||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=a(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var h,f,m=e.size;if(s)h=0===e.offset&&e.data.length===m?e.data:e.data.subarray(e.offset,e.offset+m);else{var g=[n[2],n[2]*n[0],1];f=v.malloc(m,r);var y=d(f,n,g,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),h=f.subarray(0,m)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,h),s||v.free(f),new o(t,x,n[0],n[1],c,u)}function f(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(m||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),v=t("typedarray-pool");e.exports=f;var m=null,g=null,y=null,b=function(t,e){p.muls(t,e,255)},x=o.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),g.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),g.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;2>e;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||0>e||0>r)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:433,"ndarray-ops":432,"typedarray-pool":458}],229:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;ii;++i)t.disableVertexAttribArray(i)}else{t.bindBuffer(t.ARRAY_BUFFER,null);for(var i=0;n>i;++i)t.disableVertexAttribArray(i)}}e.exports=n},{}],230:[function(t,e,r){"use strict";function n(t){this.gl=t,this._elements=null,this._attributes=null,this._elementsType=t.UNSIGNED_SHORT}function i(t){return new n(t)}var o=t("./do-bind.js");n.prototype.bind=function(){o(this.gl,this._elements,this._attributes)},n.prototype.update=function(t,e,r){this._elements=e,this._attributes=t,this._elementsType=r||this.gl.UNSIGNED_SHORT},n.prototype.dispose=function(){},n.prototype.unbind=function(){},n.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._elements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=i},{"./do-bind.js":229}],231:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.location=t,this.dimension=e,this.a=r,this.b=n,this.c=i,this.d=o}function i(t,e,r){this.gl=t,this._ext=e,this.handle=r,this._attribs=[],this._useElements=!1,this._elementsType=t.UNSIGNED_SHORT}function o(t,e){return new i(t,e,e.createVertexArrayOES())}var a=t("./do-bind.js");n.prototype.bind=function(t){switch(this.dimension){case 1:t.vertexAttrib1f(this.location,this.a);break;case 2:t.vertexAttrib2f(this.location,this.a,this.b);break;case 3:t.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:t.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d)}},i.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var t=0;tj;){switch(e=j,B){case h:j=S();break;case f:j=E();break;case d:j=T();break;case p:j=L();break;case v:j=P();break;case w:j=I();break;case m:j=C();break;case c:j=R();break;case x:j=A();break;case u:j=k()}if(e!==j)switch(W[e]){case"\n":G=0,++q;break;default:++G}}return N+=j,W=W.slice(j),V}function n(t){return U.length&&e(U.join("")),B=_,e("(eof)"),V}function k(){return U=U.length?[]:U,"/"===O&&"*"===D?(H=N+j-1,B=h,O=D,j+1):"/"===O&&"/"===D?(H=N+j-1,B=f,O=D,j+1):"#"===D?(B=d,H=N+j,j):/\s/.test(D)?(B=x,H=N+j,j):(X=/\d/.test(D),Y=/[^\w_]/.test(D),H=N+j,B=X?v:Y?p:c,j)}function A(){return/[^\s]/g.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function T(){return"\n"===D&&"\\"!==O?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function E(){return T()}function S(){return"/"===D&&"*"===O?(U.push(D),e(U.join("")),B=u,j+1):(U.push(D),O=D,j+1)}function L(){if("."===O&&/\d/.test(D))return B=m,j;if("/"===O&&"*"===D)return B=h,j;if("/"===O&&"/"===D)return B=f,j;if("."===D&&U.length){for(;z(U););return B=m,j}if(";"===D||")"===D||"("===D){if(U.length)for(;z(U););return e(D),B=u,j+1}var t=2===U.length&&"="!==D;if(/[\w_\d\s]/.test(D)||t){for(;z(U););return B=u,j}return U.push(D),O=D,j+1}function z(t){for(var r,n,i=0;;){if(r=o.indexOf(t.slice(0,t.length+i).join("")),n=o[r],-1===r){if(i--+t.length>0)continue;n=t.slice(0,1).join("")}return e(n),H+=n.length,U=U.slice(n.length),U.length}}function I(){return/[^a-fA-F0-9]/.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function P(){return"."===D?(U.push(D),B=m,O=D,j+1):/[eE]/.test(D)?(U.push(D),B=m,O=D,j+1):"x"===D&&1===U.length&&"0"===U[0]?(B=w,U.push(D),O=D,j+1):/[^\d]/.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function C(){return"f"===D&&(U.push(D),O=D,j+=1),/[eE]/.test(D)?(U.push(D),O=D,j+1):"-"===D&&/[eE]/.test(O)?(U.push(D),O=D,j+1):/[^\d]/.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function R(){if(/[^\d\w_]/.test(D)){var t=U.join("");return B=K.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:g,e(U.join("")),B=u,j}return U.push(D),O=D,j+1}var D,O,F,j=0,N=0,B=u,U=[],V=[],q=1,G=0,H=0,X=!1,Y=!1,W="";t=t||{};var Z=a,K=i;return"300 es"===t.version&&(Z=l,K=s),function(t){return V=[],null!==t?r(t):n()}}e.exports=n;var i=t("./lib/literals"),o=t("./lib/operators"),a=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,h=0,f=1,d=2,p=3,v=4,m=5,g=6,y=7,b=8,x=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":236,"./lib/builtins-300es":235,"./lib/literals":238,"./lib/literals-300es":237,"./lib/operators":239}],235:[function(t,e,r){var n=t("./builtins");n=n.slice().filter(function(t){return!/^(gl\_|texture)/.test(t)}),e.exports=n.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},{"./builtins":236}],236:[function(t,e,r){e.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]; -},{}],237:[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","uint","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":238}],238:[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","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"]},{}],239:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],240:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":234}],241:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function o(t,e){return c(t.vertices,e.vertices)}function a(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;t>=r;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(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 n=0;t>=n;++n)this.tuple[n]=this.vertices[n];var i=h[t];i||(i=h[t]=a(t)),this.orient=i}function l(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(i>=r)throw new Error("Must input at least d+1 points");var o=t.slice(0,i+1),a=u.apply(void 0,o);if(0===a)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;i>=c;++c)l[c]=c;0>a&&(l[0]=1,l[1]=0);for(var h=new n(l,new Array(i+1),!1),f=h.adjacent,d=new Array(i+2),c=0;i>=c;++c){for(var p=l.slice(),v=0;i>=v;++v)v===c&&(p[v]=-1);var m=p[0];p[0]=p[1],p[1]=m;var g=new n(p,new Array(i+1),!0);f[c]=g,d[c]=g}d[i+1]=h;for(var c=0;i>=c;++c)for(var p=f[c].vertices,y=f[c].adjacent,v=0;i>=v;++v){var b=p[v];if(0>b)y[v]=h;else for(var x=0;i>=x;++x)f[x].vertices.indexOf(b)<0&&(y[v]=f[x])}for(var _=new s(i,o,d),w=!!e,c=i+1;r>c;++c)_.insert(t[c],w);return _.boundary()}e.exports=l;var u=t("robust-orientation"),c=t("simplicial-complex").compareCells;n.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 h=[],f=s.prototype;f.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,o=this.vertices,a=[t];for(t.lastVisited=-n;a.length>0;){t=a.pop();for(var s=(t.vertices,t.adjacent),l=0;r>=l;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,h=0;r>=h;++h){var f=c[h];0>f?i[h]=e:i[h]=o[f]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&a.push(u)}}}return null},f.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,o=this.tuple,a=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[a];t:for(;!s.boundary;){for(var l=s.vertices,u=s.adjacent,c=0;n>=c;++c)o[c]=i[l[c]];s.lastVisited=r;for(var c=0;n>=c;++c){var h=u[c];if(!(h.lastVisited>=r)){var f=o[c];o[c]=t;var d=this.orient();if(o[c]=f,0>d){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},f.addPeaks=function(t,e){var r=this.vertices.length-1,a=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var f=[];h.length>0;){var e=h.pop(),d=e.vertices,p=e.adjacent,v=d.indexOf(r);if(!(0>v))for(var m=0;a>=m;++m)if(m!==v){var g=p[m];if(g.boundary&&!(g.lastVisited>=r)){var y=g.vertices;if(g.lastVisited!==-r){for(var b=0,x=0;a>=x;++x)y[x]<0?(b=x,l[x]=t):l[x]=s[y[x]];var _=this.orient();if(_>0){y[b]=r,g.boundary=!1,u.push(g),h.push(g),g.lastVisited=r;continue}g.lastVisited=-r}var w=g.adjacent,M=d.slice(),k=p.slice(),A=new n(M,k,!0);c.push(A);var T=w.indexOf(e);if(!(0>T)){w[T]=A,k[v]=g,M[m]=-1,k[m]=e,p[m]=A,A.flip();for(var x=0;a>=x;++x){var E=M[x];if(!(0>E||E===r)){for(var S=new Array(a-1),L=0,z=0;a>=z;++z){var I=M[z];0>I||z===x||(S[L++]=I)}f.push(new i(S,A,x))}}}}}}f.sort(o);for(var m=0;m+1R||0>D||(P.cell.adjacent[P.index]=C.cell,C.cell.adjacent[C.index]=P.cell)}},f.insert=function(t,e){var r=this.vertices;r.push(t);var n=this.walk(t,e);if(n){for(var i=this.dimension,o=this.tuple,a=0;i>=a;++a){var s=n.vertices[a];0>s?o[a]=t:o[a]=r[s]}var l=this.orient(o);0>l||(0!==l||(n=this.handleBoundaryDegeneracy(n,t)))&&this.addPeaks(t,n)}},f.boundary=function(){for(var t=this.dimension,e=[],r=this.simplices,n=r.length,i=0;n>i;++i){var o=r[i];if(o.boundary){for(var a=new Array(t),s=o.vertices,l=0,u=0,c=0;t>=c;++c)s[c]>=0?a[l++]=s[c]:u=1&c;if(u===(1&t)){var h=a[0];a[0]=a[1],a[1]=h}e.push(a)}}return e}},{"robust-orientation":439,"simplicial-complex":244}],242:[function(t,e,r){arguments[4][51][0].apply(r,arguments)},{dup:51}],243:[function(t,e,r){arguments[4][103][0].apply(r,arguments)},{dup:103}],244:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;i>n;++n)e=r(e,t[n].length);return e-1}function i(t){for(var e=-1,r=Math.max,n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)e=r(e,o[a]);return e+1}function o(t){for(var e=new Array(t.length),r=0,n=t.length;n>r;++r)e[r]=t[r].slice(0);return e}function a(t,e){var r=t.length,n=t.length-e.length,i=Math.min;if(n)return n;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:var o=t[0]+t[1]-e[0]-e[1];return o?o:i(t[0],t[1])-i(e[0],e[1]);case 3:var a=t[0]+t[1],s=e[0]+e[1];if(o=a+t[2]-(s+e[2]))return o;var l=i(t[0],t[1]),u=i(e[0],e[1]),o=i(l,t[2])-i(u,e[2]);return o?o:i(l+t[2],a)-i(u+e[2],s);default:var c=t.slice(0);c.sort();var h=e.slice(0);h.sort();for(var f=0;r>f;++f)if(n=c[f]-h[f])return n;return 0}}function s(t,e){return a(t[0],e[0])}function l(t,e){if(e){for(var r=t.length,n=new Array(r),i=0;r>i;++i)n[i]=[t[i],e[i]];n.sort(s);for(var i=0;r>i;++i)t[i]=n[i][0],e[i]=n[i][1];return t}return t.sort(a),t}function u(t){if(0===t.length)return[];for(var e=1,r=t.length,n=1;r>n;++n){var i=t[n];if(a(i,t[n-1])){if(n===e){e++;continue}t[e++]=i}}return t.length=e,t}function c(t,e){for(var r=0,n=t.length-1,i=-1;n>=r;){var o=r+n>>1,s=a(t[o],e);0>=s?(0===s&&(i=o),r=o+1):s>0&&(n=o-1)}return i}function h(t,e){for(var r=new Array(t.length),n=0,i=r.length;i>n;++n)r[n]=[];for(var o=[],n=0,s=e.length;s>n;++n)for(var l=e[n],u=l.length,h=1,f=1<h;++h){o.length=b.popCount(h);for(var d=0,p=0;u>p;++p)h&1<v))for(;;)if(r[v++].push(n),v>=t.length||0!==a(t[v],o))break}return r}function f(t,e){if(!e)return h(u(p(t,0)),t,0);for(var r=new Array(e),n=0;e>n;++n)r[n]=[];for(var n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)r[o[a]].push(n);return r}function d(t){for(var e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0|i.length,a=1,s=1<a;++a){for(var u=[],c=0;o>c;++c)a>>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(0>e)return[];for(var r=[],n=(1<r;++r)for(var i=t[r],o=0,a=i.length;a>o;++o){for(var s=new Array(i.length-1),u=0,c=0;a>u;++u)u!==o&&(s[c++]=i[u]);e.push(s)}return l(e)}function m(t,e){for(var r=new x(e),n=0;nr;++r)e[r]=r;return e}e.exports=n},{}],246:[function(t,e,r){e.exports=function(t){return!(null==t||!(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)))}},{}],247:[function(t,e,r){"use strict";function n(t){if(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layer=t.layer,this.childLayers=t.childLayers,this.type=this.layer.type,this.features=[],this.id=this.layer.id,this.index=t.index,this.sourceLayer=this.layer.sourceLayer,this.sourceLayerIndex=t.sourceLayerIndex,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,this.paintAttributes=o(this),t.arrays){var e=this.childLayers;this.bufferGroups=c.mapObject(t.arrays,function(r,n){return r.map(function(r){var i=c.mapObject(r,function(e,r){return c.mapObject(e,function(e,i){var o=t.arrayTypes[n][r][i],a=o.members.length&&"vertices"===o.members[0].name?u.BufferType.ELEMENT:u.BufferType.VERTEX;return new u(e,o,a)})});i.vaos={},i.layout.element2&&(i.secondVaos={});for(var o=0;ob;b++)y.push(v[Math.min(g+b,v.length-1)]);var x=h.components;if(1===x)p.attributes.push(c.extend({},h,{getValue:a(h,y),isFunction:!0,components:4*x}));else for(var _=0;4>_;_++)p.attributes.push(c.extend({},h,{getValue:a(h,[y[_]]),isFunction:!0,name:h.name+_}));p.uniforms.push(c.extend({},h,{name:"u_"+h.name.slice(2)+"_t",getValue:s(h,g),components:1}))}}}return e}function a(t,e){return function(r,n,i){if(1===e.length)return t.getValue(r,c.extend({},n,{zoom:e[0]}),i);for(var o=[],a=0;a65535){var i=this.arrayTypes[t],o=i.layout.vertex,a=i.layout.element,s=i.layout.element2;n={index:r.length,layout:{},paint:{}},n.layout.vertex=new o,a&&(n.layout.element=new a),s&&(n.layout.element2=new s);for(var l=0;ly;y++)for(var b=h.get(y),x=0;g>x;x++){var _=g>1?p.name+x:p.name;b[_]=v[x]*m}}}},{"../render/vertex_array_object":273,"../util/struct_array":347,"../util/util":349,"./bucket/circle_bucket":248,"./bucket/fill_bucket":249,"./bucket/line_bucket":250,"./bucket/symbol_bucket":251,"./buffer":252,"feature-filter":352}],248:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),o=t("../../util/util"),a=t("../load_geometry"),s=i.EXTENT;e.exports=n,n.prototype=o.inherit(i,{}),n.prototype.addCircleVertex=function(t,e,r,n,i){return t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)},n.prototype.programInterfaces={circle:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"}],paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return o.premultiply(t.getPaintValue("circle-color",e,r))},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-radius",e,r)]},multiplier:10,paintProperty:"circle-radius"}]}},n.prototype.addFeature=function(t){for(var e={zoom:this.zoom},r=a(t),n=this.makeRoomFor("circle",0),i=n.layout.vertex.length,o=0;ou||u>=s||0>c||c>=s)){var h=this.makeRoomFor("circle",4),f=h.layout.vertex,d=this.addCircleVertex(f,u,c,-1,-1);this.addCircleVertex(f,u,c,1,-1),this.addCircleVertex(f,u,c,1,1),this.addCircleVertex(f,u,c,-1,1),h.layout.element.emplaceBack(d,d+1,d+2),h.layout.element.emplaceBack(d,d+3,d+2)}}this.addPaintAttributes("circle",e,t.properties,n,i)}},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],249:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),o=t("../../util/util"),a=t("../load_geometry");e.exports=n,n.prototype=o.inherit(i,{}),n.prototype.programInterfaces={fill:{vertexBuffer:!0,elementBuffer:!0,elementBuffer2:!0,elementBuffer2Components:2,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"}]}},n.prototype.addFeature=function(t){for(var e=a(t),r=0;r=2&&(a.x!==t[0].x||a.y!==t[0].y)&&i.layout.element.emplaceBack(e,r,s),o>=1&&i.layout.element2.emplaceBack(r,s),r=s}}},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],250:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),o=t("../../util/util"),a=t("../load_geometry"),s=i.EXTENT,l=63,u=Math.cos(37.5*(Math.PI/180)),c=15,h=14,f=.5,d=Math.pow(2,h)/f;e.exports=n,n.prototype=o.inherit(i,{}),n.prototype.addLineVertex=function(t,e,r,n,i,o,a){return t.emplaceBack(e.x<<1|n,e.y<<1|i,Math.round(l*r.x)+128,Math.round(l*r.y)+128,(0===o?0:0>o?-1:1)+1|(a*f&63)<<2,a*f>>6)},n.prototype.programInterfaces={line:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]}},n.prototype.addFeature=function(t){for(var e=a(t),r=0;r2&&t[o-1].equals(t[o-2]);)o--;if(!(t.length<2)){"bevel"===e&&(n=1.05);var a=c*(s/(512*this.overscaling)),l=t[0],h=t[o-1],f=l.equals(h);if(this.makeRoomFor("line",10*o),2!==o||!f){this.distance=0;var d,p,v,m,g,y,b,x=r,_=f?"butt":r,w=!0;this.e1=this.e2=this.e3=-1,f&&(d=t[o-2],g=l.sub(d)._unit()._perp());for(var M=0;o>M;M++)if(v=f&&M===o-1?t[1]:t[M+1],!v||!t[M].equals(v)){g&&(m=g),d&&(p=d),d=t[M],g=v?v.sub(d)._unit()._perp():m,m=m||g;var k=m.add(g)._unit(),A=k.x*g.x+k.y*g.y,T=1/A,E=u>A&&p&&v;if(E&&M>0){var S=d.dist(p);if(S>2*a){var L=d.sub(d.sub(p)._mult(a/S)._round());this.distance+=L.dist(p),this.addCurrentVertex(L,this.distance,m.mult(1),0,0,!1),p=L}}var z=p&&v,I=z?e:v?x:_;if(z&&"round"===I&&(i>T?I="miter":2>=T&&(I="fakeround")),"miter"===I&&T>n&&(I="bevel"),"bevel"===I&&(T>2&&(I="flipbevel"),n>T&&(I="miter")),p&&(this.distance+=d.dist(p)),"miter"===I)k._mult(T),this.addCurrentVertex(d,this.distance,k,0,0,!1);else if("flipbevel"===I){if(T>100)k=g.clone();else{var P=m.x*g.y-m.y*g.x>0?-1:1,C=T*m.add(g).mag()/m.sub(g).mag();k._perp()._mult(C*P)}this.addCurrentVertex(d,this.distance,k,0,0,!1),this.addCurrentVertex(d,this.distance,k.mult(-1),0,0,!1)}else if("bevel"===I||"fakeround"===I){var R=m.x*g.y-m.y*g.x>0,D=-Math.sqrt(T*T-1);if(R?(b=0,y=D):(y=0,b=D),w||this.addCurrentVertex(d,this.distance,m,y,b,!1),"fakeround"===I){for(var O,F=Math.floor(8*(.5-(A-.5))),j=0;F>j;j++)O=g.mult((j+1)/(F+1))._add(m)._unit(),this.addPieSliceVertex(d,this.distance,O,R);this.addPieSliceVertex(d,this.distance,k,R);for(var N=F-1;N>=0;N--)O=m.mult((N+1)/(F+1))._add(g)._unit(),this.addPieSliceVertex(d,this.distance,O,R)}v&&this.addCurrentVertex(d,this.distance,g,-y,-b,!1)}else"butt"===I?(w||this.addCurrentVertex(d,this.distance,m,0,0,!1),v&&this.addCurrentVertex(d,this.distance,g,0,0,!1)):"square"===I?(w||(this.addCurrentVertex(d,this.distance,m,1,1,!1),this.e1=this.e2=-1),v&&this.addCurrentVertex(d,this.distance,g,-1,-1,!1)):"round"===I&&(w||(this.addCurrentVertex(d,this.distance,m,0,0,!1),this.addCurrentVertex(d,this.distance,m,1,1,!0),this.e1=this.e2=-1),v&&(this.addCurrentVertex(d,this.distance,g,-1,-1,!0),this.addCurrentVertex(d,this.distance,g,0,0,!1)));if(E&&o-1>M){var B=d.dist(v);if(B>2*a){var U=d.add(v.sub(d)._mult(a/B)._round());this.distance+=U.dist(d),this.addCurrentVertex(U,this.distance,g.mult(1),0,0,!1),d=U}}w=!1}}}},n.prototype.addCurrentVertex=function(t,e,r,n,i,o){var a,s=o?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1].layout,u=l.vertex,c=l.element;a=r.clone(),n&&a._sub(r.perp()._mult(n)),this.e3=this.addLineVertex(u,t,a,s,0,n,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,a=r.mult(-1),i&&a._sub(r.perp()._mult(i)),this.e3=this.addLineVertex(u,t,a,s,1,-i,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>d/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,o))},n.prototype.addPieSliceVertex=function(t,e,r,n){var i=n?1:0;r=r.mult(n?-1:1);var o=this.arrayGroups.line[this.arrayGroups.line.length-1].layout,a=o.vertex,s=o.element;this.e3=this.addLineVertex(a,t,r,0,i,0,e),this.e1>=0&&this.e2>=0&&s.emplaceBack(this.e1,this.e2,this.e3),n?this.e2=this.e3:this.e1=this.e3}},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],251:[function(t,e,r){"use strict";function n(t){s.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,r,n,i,o,a,s,l,u){return t.emplaceBack(e,r,Math.round(64*n),Math.round(64*i),o/4,a/4,10*(u||0),0,10*(s||0),10*Math.min(l||25,25))}function o(t,e,r,n,i,o,a,s,l,u,c,h,f,d,p,v,m){this.x=t.x,this.y=t.y,this.index=a,this.hasText=!!r,this.hasIcon=!!n,this.hasText&&(this.glyphQuads=o?_(t,r,h,e,i,d):[],this.textCollisionFeature=new y(s,e,t,l,u,c,r,h,f,d,!1)),this.hasIcon&&(this.iconQuads=o?w(t,n,p,e,i,m):[],this.iconCollisionFeature=new y(s,e,t,l,u,c,n,p,v,m,!0))}var a=t("point-geometry"),s=t("../bucket"),l=t("../../symbol/anchor"),u=t("../../symbol/get_anchors"),c=t("../../util/token"),h=t("../../symbol/quads"),f=t("../../symbol/shaping"),d=t("../../symbol/resolve_text"),p=t("../../symbol/mergelines"),v=t("../../symbol/clip_line"),m=t("../../util/util"),g=t("../load_geometry"),y=t("../../symbol/collision_feature"),b=f.shapeText,x=f.shapeIcon,_=h.getGlyphQuads,w=h.getIconQuads,M=s.EXTENT;e.exports=n,n.prototype=m.inherit(s,{}),n.prototype.serialize=function(){var t=s.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var k=[{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_data1",components:4,type:"Uint8"},{name:"a_data2",components:2,type:"Uint8"}];n.prototype.addCollisionBoxVertex=function(t,e,r,n,i){return t.emplaceBack(e.x,e.y,Math.round(r.x),Math.round(r.y),10*n,10*i)},n.prototype.programInterfaces={glyph:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:k},icon:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:k},collisionBox:{vertexBuffer:!0,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}]}},n.prototype.populateBuffers=function(t,e,r){var n={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:n}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:n}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:n}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:n});var i=512*this.overscaling;this.tilePixelRatio=M/i,this.compareText={},this.symbolInstances=[],this.iconsNeedLinear=!1;var o=this.layer.layout,a=this.features,s=this.textFeatures,l=.5,u=.5;switch(o["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(o["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":u=1;break;case"top":case"top-right":case"top-left":u=0}for(var h="right"===o["text-justify"]?1:"left"===o["text-justify"]?0:.5,f=24,d=o["text-line-height"]*f,v="line"!==o["symbol-placement"]?o["text-max-width"]*f:0,m=o["text-letter-spacing"]*f,y=[o["text-offset"][0]*f,o["text-offset"][1]*f],_=this.fontstack=o["text-font"].join(","),w=[],k=0;kL;L++){var I=E[L];if(!(e&&k&&this.anchorIsTooClose(e.text,A,I))){var P=!(I.x<0||I.x>M||I.y<0||I.y>M);if(!m||P){var C=P||w;this.symbolInstances.push(new o(I,S,e,r,i,C,this.symbolInstances.length,this.collisionBoxArray,n,this.sourceLayerIndex,this.index,h,g,x,d,y,_))}}}}},n.prototype.anchorIsTooClose=function(t,e,r){var n=this.compareText;if(t in n){for(var i=n[t],o=i.length-1;o>=0;o--)if(r.dist(i[o])=m&&this.addSymbols("glyph",h.glyphQuads,m,r["text-keep-upright"],i,t.angle)),d&&(t.insertCollisionFeature(h.iconCollisionFeature,g,r["icon-ignore-placement"]),n>=g&&this.addSymbols("icon",h.iconQuads,g,r["icon-keep-upright"],o,t.angle))}e&&this.addToDebugBuffers(t)},n.prototype.addSymbols=function(t,e,r,n,o,a){for(var s=this.makeRoomFor(t,4*e.length),l=s.layout.element,u=s.layout.vertex,c=this.zoom,h=Math.max(Math.log(r)/Math.LN2+c,0),f=0;f3*Math.PI/2))){var m=d.tl,g=d.tr,y=d.bl,b=d.br,x=d.tex,_=d.anchorPoint,w=Math.max(c+Math.log(d.minScale)/Math.LN2,h),M=Math.min(c+Math.log(d.maxScale)/Math.LN2,25);if(!(w>=M)){w===h&&(w=0);var k=i(u,_.x,_.y,m.x,m.y,x.x,x.y,w,M,h);i(u,_.x,_.y,g.x,g.y,x.x+x.w,x.y,w,M,h),i(u,_.x,_.y,y.x,y.y,x.x,x.y+x.h,w,M,h),i(u,_.x,_.y,b.x,b.y,x.x+x.w,x.y+x.h,w,M,h),l.emplaceBack(k,k+1,k+2),l.emplaceBack(k+1,k+2,k+3)}}}},n.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var r=0;rs;s++){var l=this.symbolInstances[o][0===s?"textCollisionFeature":"iconCollisionFeature"];if(l)for(var u=l.boxStartIndex;u0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,r,n,i){if(!e[0]&&!e[1])return t;e=u.convert(e),"viewport"===r&&e._rotate(-n);for(var o=[],a=0;ao||c.yo)&&(console.warn("Geometry exceeds allowed extent, reduce your vector tile buffer size"),a=!0)}return r}},{"./bucket":247}],255:[function(t,e,r){"use strict";function n(t,e,r){this.column=t,this.row=e,this.zoom=r}e.exports=n,n.prototype={clone:function(){return new n(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],256:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}e.exports=n;var i=t("../util/util").wrap;n.prototype.wrap=function(){return new n(i(this.lng,-180,180),this.lat)},n.prototype.toArray=function(){return[this.lng,this.lat]},n.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{"../util/util":349}],257:[function(t,e,r){"use strict";function n(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=n;var i=t("./lng_lat");n.prototype={extend:function(t){var e,r,o=this._sw,a=this._ne;if(t instanceof i)e=t,r=t;else{if(!(t instanceof n))return t?this.extend(i.convert(t)||n.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return o||a?(o.lng=Math.min(e.lng,o.lng),o.lat=Math.min(e.lat,o.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new i(e.lng,e.lat),this._ne=new i(r.lng,r.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},n.convert=function(t){return!t||t instanceof n?t:new n(t)}},{"./lng_lat":256}],258:[function(t,e,r){"use strict";function n(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),o=t("point-geometry"),a=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),u=t("../source/tile_coord"),c=t("../data/bucket").EXTENT,h=t("gl-matrix"),f=h.vec4,d=h.mat4,p=h.mat2;e.exports=n,n.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new o(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcProjMatrix(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcProjMatrix())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcProjMatrix())},get zoom(){return this._zoom},set zoom(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._calcProjMatrix(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcProjMatrix(),this._constrain())},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcProjMatrix(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new o(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new o(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var r=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-r)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var r=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var r=this.locationCoordinate(t),n=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),o=n._sub(r);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(o))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,r=i.convert(t);return new a(this.lngX(r.lng)*e,this.latY(r.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=0,r=this.coordinatePointMatrix(this.tileZoom);if(d.invert(r,r),!r)throw new Error("failed to invert matrix");var n=[t.x,t.y,0,1],i=[t.x,t.y,1,1];f.transformMat4(n,n,r),f.transformMat4(i,i,r);var o=n[3],s=i[3],u=n[0]/o,c=i[0]/s,h=n[1]/o,p=i[1]/s,v=n[2]/o,m=i[2]/s,g=v===m?0:(e-v)/(m-v);return new a(l(u,c,g),l(h,p,g),this.tileZoom)},coordinatePoint:function(t){var e=this.coordinatePointMatrix(t.zoom),r=[t.column,t.row,0,1];return f.transformMat4(r,r,e),new o(r[0]/r[3],r[1]/r[3])},coordinatePointMatrix:function(t){var e=d.copy(new Float64Array(16),this.projMatrix),r=this.worldSize/this.zoomScale(t);return d.scale(e,e,[r,r,1]),d.multiply(e,this.getPixelMatrix(),e),e},getPixelMatrix:function(){var t=d.create();return d.scale(t,t,[this.width/2,-this.height/2,1]),d.translate(t,t,[1,-1,0]),t},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof u&&(t=t.toCoordinate(e));var r=Math.min(t.zoom,e),n=this.worldSize/Math.pow(2,r),i=new Float64Array(16);return d.identity(i),d.translate(i,i,[t.column*n,t.row*n,0]),d.scale(i,i,[n/c,n/c,1]),d.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,r,n,i,a,s,l,u=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),e=this.latY(this.latRange[0]),i=e-tf-d&&(l=t+d),f+d>e&&(l=e-d)}if(this.lngRange){var p=this.x,v=u.x/2;r>p-v&&(s=r+v),p+v>n&&(s=n-v)}void 0===s&&void 0===l||(this.center=this.unproject(new o(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=c,this._constraining=!1}},_calcProjMatrix:function(){var t=new Float64Array(16),e=Math.atan(.5/this.altitude),r=Math.sin(e)*this.altitude/Math.sin(Math.PI/2-this._pitch-e),n=Math.cos(Math.PI/2-this._pitch)*r+this.altitude;d.perspective(t,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,n),d.translate(t,t,[0,0,-this.altitude]),d.scale(t,t,[1,-1,1/this.height]),d.rotateX(t,t,this._pitch),d.rotateZ(t,t,this.angle),d.translate(t,t,[-this.x,-this.y,0]),this.projMatrix=t}}},{"../data/bucket":247,"../source/tile_coord":281,"../util/interpolate":343,"../util/util":349,"./coordinate":255,"./lng_lat":256,"gl-matrix":363,"point-geometry":404}],259:[function(t,e,r){"use strict";var n={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]};e.exports=function(t,e,r,i){i=i||1;var o,a,s,l,u,c,h,f,d=[];for(o=0,a=t.length;a>o;o++)if(u=n[t[o]]){for(f=null,s=0,l=u[1].length;l>s;s+=2)-1===u[1][s]&&-1===u[1][s+1]?f=null:(c=e+u[1][s]*i,h=r-u[1][s+1]*i,f&&d.push(f.x,f.y,c,h),f={x:c,y:h});e+=u[0]*i}return d}},{}],260:[function(t,e,r){"use strict";var n=e.exports={};n.Map=t("./ui/map"),n.Control=t("./ui/control/control"),n.Navigation=t("./ui/control/navigation"),n.Geolocate=t("./ui/control/geolocate"),n.Attribution=t("./ui/control/attribution"),n.Popup=t("./ui/popup"),n.GeoJSONSource=t("./source/geojson_source"),n.VideoSource=t("./source/video_source"),n.ImageSource=t("./source/image_source"),n.Style=t("./style/style"),n.LngLat=t("./geo/lng_lat"),n.LngLatBounds=t("./geo/lng_lat_bounds"),n.Point=t("point-geometry"),n.Evented=t("./util/evented"),n.util=t("./util/util"),n.supported=t("./util/browser").supported;var i=t("./util/ajax");n.util.getJSON=i.getJSON,n.util.getArrayBuffer=i.getArrayBuffer;var o=t("./util/config");n.config=o,Object.defineProperty(n,"accessToken",{get:function(){return o.ACCESS_TOKEN},set:function(t){o.ACCESS_TOKEN=t}})},{"./geo/lng_lat":256,"./geo/lng_lat_bounds":257,"./source/geojson_source":274,"./source/image_source":276,"./source/video_source":284,"./style/style":290,"./ui/control/attribution":318,"./ui/control/control":319,"./ui/control/geolocate":320,"./ui/control/navigation":321,"./ui/map":331,"./ui/popup":332,"./util/ajax":334,"./util/browser":335,"./util/config":339,"./util/evented":341,"./util/util":349,"point-geometry":404}],261:[function(t,e,r){"use strict";function n(t,e,r){var n,i=t.gl,l=t.transform,u=a.premultiply(r.paint["background-color"]),c=r.paint["background-pattern"],h=r.paint["background-opacity"],f=c?t.spriteAtlas.getPosition(c.from,!0):null,d=c?t.spriteAtlas.getPosition(c.to,!0):null;if(t.setDepthSublayer(0),f&&d){if(t.isOpaquePass)return;n=t.useProgram("pattern"),i.uniform1i(n.u_image,0),i.uniform2fv(n.u_pattern_tl_a,f.tl),i.uniform2fv(n.u_pattern_br_a,f.br),i.uniform2fv(n.u_pattern_tl_b,d.tl),i.uniform2fv(n.u_pattern_br_b,d.br),i.uniform1f(n.u_opacity,h),i.uniform1f(n.u_mix,c.t),t.spriteAtlas.bind(i,!0),t.tileExtentPatternVAO.bind(i,n,t.tileExtentBuffer)}else{if(t.isOpaquePass!==(1===u[3]))return;n=t.useProgram("fill"),i.uniform4fv(n.u_color,u),i.uniform1f(n.u_opacity,h),t.tileExtentVAO.bind(i,n,t.tileExtentBuffer)}i.disable(i.STENCIL_TEST);for(var p=o.coveringTiles(l),v=0;v0&&(f=r.paint["line-gap-width"]/2+.5*u,h=r.paint["line-width"],d=f-u/2);var v=d+h+u/2+p,m=o.premultiply(r.paint["line-color"]),g=t.transform,y=i.create();i.scale(y,y,[1,Math.cos(g._pitch)]),i.rotate(y,y,t.transform.angle);var b,x,_,w,M,k=Math.sqrt(g.height*g.height/4*(1+g.altitude*g.altitude)),A=g.height/2*Math.tan(g._pitch),T=(k+A)/k-1,E=r.paint["line-dasharray"],S=r.paint["line-pattern"];if(E)b=t.useProgram("linesdfpattern"),l.uniform2fv(b.u_linewidth,[v,f]),l.uniform1f(b.u_blur,c),l.uniform4fv(b.u_color,m),l.uniform1f(b.u_opacity,r.paint["line-opacity"]),x=t.lineAtlas.getDash(E.from,"round"===r.layout["line-cap"]),_=t.lineAtlas.getDash(E.to,"round"===r.layout["line-cap"]),l.uniform1i(b.u_image,0),l.activeTexture(l.TEXTURE0),t.lineAtlas.bind(l),l.uniform1f(b.u_tex_y_a,x.y),l.uniform1f(b.u_tex_y_b,_.y),l.uniform1f(b.u_mix,E.t),l.uniform1f(b.u_extra,T),l.uniform1f(b.u_offset,-r.paint["line-offset"]),l.uniformMatrix2fv(b.u_antialiasingmatrix,!1,y);else if(S){if(w=t.spriteAtlas.getPosition(S.from,!0),M=t.spriteAtlas.getPosition(S.to,!0),!w||!M)return;b=t.useProgram("linepattern"),l.uniform1i(b.u_image,0),l.activeTexture(l.TEXTURE0),t.spriteAtlas.bind(l,!0),l.uniform2fv(b.u_linewidth,[v,f]),l.uniform1f(b.u_blur,c),l.uniform2fv(b.u_pattern_tl_a,w.tl),l.uniform2fv(b.u_pattern_br_a,w.br),l.uniform2fv(b.u_pattern_tl_b,M.tl),l.uniform2fv(b.u_pattern_br_b,M.br),l.uniform1f(b.u_fade,S.t),l.uniform1f(b.u_opacity,r.paint["line-opacity"]),l.uniform1f(b.u_extra,T),l.uniform1f(b.u_offset,-r.paint["line-offset"]),l.uniformMatrix2fv(b.u_antialiasingmatrix,!1,y)}else b=t.useProgram("line"),l.uniform2fv(b.u_linewidth,[v,f]),l.uniform1f(b.u_blur,c),l.uniform1f(b.u_extra,T),l.uniform1f(b.u_offset,-r.paint["line-offset"]),l.uniformMatrix2fv(b.u_antialiasingmatrix,!1,y),l.uniform4fv(b.u_color,m),l.uniform1f(b.u_opacity,r.paint["line-opacity"]);for(var L=0;L0?1/(1-t):1+t}function s(t){return t>0?1-1/(1.001-t):-t}function l(t,e,r,n){var i=[1,0],o=r.paint["raster-fade-duration"];if(t.source&&o>0){var a=(new Date).getTime(),s=(a-t.timeAdded)/o,l=e?(a-e.timeAdded)/o:-1,c=t.source._pyramid.coveringZoomLevel(n),h=e?Math.abs(e.coord.z-c)>Math.abs(t.coord.z-c):!1;!e||h?(i[0]=u.clamp(s,0,1),i[1]=1-i[0]):(i[0]=u.clamp(1-l,0,1),i[1]=1-i[0])}var f=r.paint["raster-opacity"];return i[0]*=f,i[1]*=f,i}var u=t("../util/util"),c=t("../util/struct_array");e.exports=n,n.RasterBoundsArray=new c({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":347,"../util/util":349}],268:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var o=!(r.layout["text-allow-overlap"]||r.layout["icon-allow-overlap"]||r.layout["text-ignore-placement"]||r.layout["icon-ignore-placement"]),a=t.gl;o?a.disable(a.STENCIL_TEST):a.enable(a.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.DEPTH_TEST),i(t,e,r,n,!1,r.paint["icon-translate"],r.paint["icon-translate-anchor"],r.layout["icon-rotation-alignment"],r.layout["icon-size"],r.paint["icon-halo-width"],r.paint["icon-halo-color"],r.paint["icon-halo-blur"],r.paint["icon-opacity"],r.paint["icon-color"]),i(t,e,r,n,!0,r.paint["text-translate"],r.paint["text-translate-anchor"],r.layout["text-rotation-alignment"],r.layout["text-size"],r.paint["text-halo-width"],r.paint["text-halo-color"],r.paint["text-halo-blur"],r.paint["text-opacity"],r.paint["text-color"]),a.enable(a.DEPTH_TEST),s(t,e,r,n)}}function i(t,e,r,n,i,a,s,u,c,h,f,d,p,v){f=l.premultiply(f),v=l.premultiply(v);for(var m=0;mthis.previousZoom;r--)this.changeTimes[r]=e,this.changeOpacities[r]=this.opacities[r];for(r=0;256>r;r++){var n=e-this.changeTimes[r],i=n/this.fadeDuration*255;t>=r?this.opacities[r]=this.changeOpacities[r]+i:this.opacities[r]=this.changeOpacities[r]-i}this.changed=!0,this.previousZoom=t},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],270:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}e.exports=n,n.prototype.setSprite=function(t){this.sprite=t},n.prototype.getDash=function(t,e){var r=t.join(",")+e;return this.positions[r]||(this.positions[r]=this.addDash(t,e)),this.positions[r]},n.prototype.addDash=function(t,e){var r=e?7:0,n=2*r+1,i=128;if(this.nextRow+n>this.height)return console.warn("LineAtlas out of space"),null;for(var o=0,a=0;a=c;c++)for(var h=this.nextRow+r+c,f=this.width*h,d=u?-t[t.length-1]:0,p=t[0],v=1,m=0;mp;)d=p,p+=t[v],u&&v===t.length-1&&(p+=t[0]),v++;var g,y=Math.abs(m-d*s),b=Math.abs(m-p*s),x=Math.min(y,b),_=v%2===1;if(e){var w=r?c/r*(l+1):0;if(_){var M=l-Math.abs(w);g=Math.sqrt(x*x+M*M)}else g=l-Math.sqrt(x*x+w*w)}else g=(_?1:-1)*x;this.data[3+4*(f+m)]=Math.max(0,Math.min(255,g+i))}var k={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=n,this.dirty=!0,k},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,this.data))}},{}],271:[function(t,e,r){"use strict";function n(t,e){this.gl=t,this.transform=e,this.reusableTextures={},this.preFbos={},this.frameHistory=new a,this.setup(),this.numSublayers=s.maxUnderzooming+s.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.lineWidthRange=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE)}var i=t("../util/browser"),o=t("gl-matrix").mat4,a=t("./frame_history"),s=t("../source/tile_pyramid"),l=t("../data/bucket").EXTENT,u=t("../source/pixels_to_tile_units"),c=t("../util/util"),h=t("../util/struct_array"),f=t("../data/buffer"),d=t("./vertex_array_object"),p=t("./draw_raster").RasterBoundsArray;e.exports=n,c.extend(n.prototype,t("./painter/use_program")),n.prototype.resize=function(t,e){var r=this.gl;this.width=t*i.devicePixelRatio,this.height=e*i.devicePixelRatio,r.viewport(0,0,this.width,this.height)},n.prototype.setup=function(){var t=this.gl;t.verbose=!0,t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.enable(t.STENCIL_TEST),t.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),this._depthMask=!1,t.depthMask(!1);var e=this.PosArray=new h({members:[{name:"a_pos",type:"Int16",components:2}]}),r=new e;r.emplaceBack(0,0),r.emplaceBack(l,0),r.emplaceBack(0,l),r.emplaceBack(l,l),this.tileExtentBuffer=new f(r.serialize(),e.serialize(),f.BufferType.VERTEX),this.tileExtentVAO=new d,this.tileExtentPatternVAO=new d;var n=new e;n.emplaceBack(0,0),n.emplaceBack(l,0),n.emplaceBack(l,l),n.emplaceBack(0,l),n.emplaceBack(0,0),this.debugBuffer=new f(n.serialize(),e.serialize(),f.BufferType.VERTEX),this.debugVAO=new d;var i=new p;i.emplaceBack(0,0,0,0),i.emplaceBack(l,0,32767,0),i.emplaceBack(0,l,0,32767),i.emplaceBack(l,l,32767,32767),this.rasterBoundsBuffer=new f(i.serialize(),p.serialize(),f.BufferType.VERTEX),this.rasterBoundsVAO=new d},n.prototype.clearColor=function(){var t=this.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},n.prototype.clearStencil=function(){var t=this.gl;t.clearStencil(0),t.stencilMask(255),t.clear(t.STENCIL_BUFFER_BIT)},n.prototype.clearDepth=function(){var t=this.gl;t.clearDepth(1),this.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},n.prototype._renderTileClippingMasks=function(t){var e=this.gl;e.colorMask(!1,!1,!1,!1),this.depthMask(!1),e.disable(e.DEPTH_TEST),e.enable(e.STENCIL_TEST),e.stencilMask(248),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE);var r=1;this._tileClippingMaskIDs={};for(var n=0;n0?e.pop():null},n.prototype.lineWidth=function(t){this.gl.lineWidth(c.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},n.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);var r=8,n=1/r;e.blendColor(n,n,n,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":247,"../data/buffer":252,"../source/pixels_to_tile_units":277,"../source/tile_pyramid":282,"../util/browser":335,"../util/struct_array":347,"../util/util":349,"./draw_background":261,"./draw_circle":262,"./draw_debug":264,"./draw_fill":265,"./draw_line":266,"./draw_raster":267,"./draw_symbol":268,"./frame_history":269,"./painter/use_program":272,"./vertex_array_object":273,"gl-matrix":363}],272:[function(t,e,r){"use strict";var n=(t("path"),t("assert")),i=t("../../util/util"),o={debug:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n"},fill:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvoid main() {\n gl_FragColor = u_color * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},circle:{fragmentSource:"precision mediump float;\n\nuniform lowp float u_blur;\nuniform lowp float u_opacity;\n\nvarying lowp vec4 v_color;\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n float t = smoothstep(1.0 - max(u_blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = v_color * (1.0 - t) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#ifdef ATTRIBUTE_A_COLOR\nattribute lowp vec4 a_color;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\nuniform lowp float u_color_t;\nattribute lowp vec4 a_color0;\nattribute lowp vec4 a_color1;\nattribute lowp vec4 a_color2;\nattribute lowp vec4 a_color3;\n#else\nuniform lowp vec4 a_color;\n#endif\n\n#ifdef ATTRIBUTE_A_RADIUS\nattribute mediump float a_radius;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\nuniform lowp float u_radius_t;\nattribute mediump vec4 a_radius;\n#else\nuniform mediump float a_radius;\n#endif\n\nvarying vec2 v_extrude;\nvarying lowp vec4 v_color;\nvarying lowp float v_antialiasblur;\n\nfloat evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\n\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n\nvoid main(void) {\n\n#ifdef ATTRIBUTE_A_RADIUS\n mediump float radius = a_radius / 10.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\n mediump float radius = evaluate_zoom_function_1(a_radius, u_radius_t) / 10.0;\n#else\n mediump float radius = a_radius;\n#endif\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n // gl_Position is divided by gl_Position.w after this shader runs.\n // Multiply the extrude by it so that it isn't affected by it.\n gl_Position.xy += extrude * gl_Position.w;\n\n#ifdef ATTRIBUTE_A_COLOR\n v_color = a_color / 255.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\n v_color = evaluate_zoom_function_4(a_color0, a_color1, a_color2, a_color3, u_color_t) / 255.0;\n#else\n v_color = a_color;\n#endif\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n"},line:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform float u_point;\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_b.y);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos), texture2D(u_image, pos2), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 extrude = a_extrude * scale;\n mediump vec2 dist = u_linewidth.s * extrude;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump vec2 u_linewidth;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" -},outline:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n}\n"},raster:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - y * u_extra);\n v_gamma_scale = perspective_scale;\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},collisionbox:{fragmentSource:"precision mediump float;\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}};e.exports._createProgram=function(t,e){var r=this.gl,a=r.createProgram(),s=o[t],l="";if(e)for(var u=0;up;p++){var v=r.getActiveAttrib(a,p);f[v.name]=p}for(var m={},g=r.getProgramParameter(a,r.ACTIVE_UNIFORMS),y=0;g>y;y++){var b=r.getActiveUniform(a,y);m[b.name]=r.getUniformLocation(a,b.name)}return i.extend({program:a,definition:s,attributes:f,numAttributes:d},f,m)},e.exports._createProgramCached=function(t,e){this.cache=this.cache||{},this._showOverdrawInspector&&(e=e||[],e.push("OVERDRAW_INSPECTOR"));var r=JSON.stringify({name:t,macros:e});return this.cache[r]||(this.cache[r]=this._createProgram(t,e)),this.cache[r]},e.exports.useProgram=function(t,e){var r=this.gl,n=this._createProgramCached(t,e),i=this.currentProgram;return i!==n&&(r.useProgram(n.program),this.currentProgram=n),n}},{"../../util/util":349,assert:52,path:59}],273:[function(t,e,r){"use strict";function n(){this.boundProgram=null,this.boundVertexBuffer=null,this.boundVertexBuffer2=null,this.boundElementBuffer=null,this.vao=null}var i=t("assert");e.exports=n;var o=!1;n.prototype.bind=function(t,e,r,n,a){var s=t.extVertexArrayObject;if(void 0===s&&(s=t.extVertexArrayObject=t.getExtension("OES_vertex_array_object")),s?(this.vao||(this.vao=s.createVertexArrayOES()),s.bindVertexArrayOES(this.vao)):o||(console.warn("Not using VertexArrayObject extension."),o=!0),this.boundProgram)i(this.boundProgram===e,"trying to bind a VAO to a different shader"),i(this.boundVertexBuffer===r,"trying to bind a VAO to a different vertex buffer"),i(this.boundVertexBuffer2===a,"trying to bind a VAO to a different vertex buffer"),i(this.boundElementBuffer===n,"trying to bind a VAO to a different element buffer");else{var l,u=s?0:t.currentNumAttributes||0,c=e.numAttributes;for(l=u;c>l;l++)t.enableVertexAttribArray(l);if(!s){for(i(l>0),l=c;u>l;l++)t.disableVertexAttribArray(l);t.currentNumAttributes=c}r.bind(t),r.setVertexAttribPointers(t,e),a&&(a.bind(t),a.setVertexAttribPointers(t,e)),n&&n.bind(t),s&&(this.boundProgram=e,this.boundVertexBuffer=r,this.boundVertexBuffer2=a,this.boundElementBuffer=n)}},n.prototype.unbind=function(t){var e=t.extVertexArrayObject;e&&e.bindVertexArrayOES(null)},n.prototype.destroy=function(t){var e=t.extVertexArrayObject;e&&this.vao&&(e.deleteVertexArrayOES(this.vao),this.vao=null)}},{assert:52}],274:[function(t,e,r){"use strict";function n(t){t=t||{},this._data=t.data,void 0!==t.maxzoom&&(this.maxzoom=t.maxzoom);var e=u/this.tileSize;this.geojsonVtOptions={buffer:(void 0!==t.buffer?t.buffer:128)*e,tolerance:(void 0!==t.tolerance?t.tolerance:.375)*e,extent:u,maxZoom:this.maxzoom},this.cluster=t.cluster||!1,this.superclusterOptions={maxZoom:Math.min(t.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:u,radius:(t.clusterRadius||50)*e,log:!1},this._pyramid=new a({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!0,load:this._loadTile.bind(this),abort:this._abortTile.bind(this),unload:this._unloadTile.bind(this),add:this._addTile.bind(this),remove:this._removeTile.bind(this),redoPlacement:this._redoTilePlacement.bind(this)})}var i=t("../util/util"),o=t("../util/evented"),a=t("./tile_pyramid"),s=t("./source"),l=t("resolve-url"),u=t("../data/bucket").EXTENT;e.exports=n,n.prototype=i.inherit(o,{minzoom:0,maxzoom:18,tileSize:512,_dirty:!0,isTileClipped:!0,setData:function(t){return this._data=t,this._dirty=!0,this.fire("change"),this.map&&this.update(this.map.transform),this},onAdd:function(t){this.map=t},loaded:function(){return this._loaded&&this._pyramid.loaded()},update:function(t){this._dirty&&this._updateData(),this._loaded&&this._pyramid.update(this.used,t)},reload:function(){this._loaded&&this._pyramid.reload()},serialize:function(){return{type:"geojson",data:this._data}},getVisibleCoordinates:s._getVisibleCoordinates,getTile:s._getTile,queryRenderedFeatures:s._queryRenderedVectorFeatures,querySourceFeatures:s._querySourceFeatures,_updateData:function(){this._dirty=!1;var t={tileSize:this.tileSize,source:this.id,geojsonVtOptions:this.geojsonVtOptions,cluster:this.cluster,superclusterOptions:this.superclusterOptions},e=this._data;"string"==typeof e?t.url="undefined"!=typeof window?l(window.location.href,e):e:t.data=JSON.stringify(e),this.workerID=this.dispatcher.send("parse geojson",t,function(t){this._loaded=!0,t?this.fire("error",{error:t}):(this._pyramid.reload(),this.fire("change"))}.bind(this))},_loadTile:function(t){var e=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,r={uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:e,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load geojson tile",r,function(e,r){if(t.unloadVectorData(this.map.painter),!t.aborted){if(e)return void this.fire("tile.error",{tile:t});t.loadVectorData(r,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),this.fire("tile.load",{tile:t})}}.bind(this),this.workerID)},_abortTile:function(t){t.aborted=!0},_addTile:function(t){this.fire("tile.add",{tile:t})},_removeTile:function(t){this.fire("tile.remove",{tile:t})},_unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)},redoPlacement:s.redoPlacement,_redoTilePlacement:function(t){t.redoPlacement(this)}})},{"../data/bucket":247,"../util/evented":341,"../util/util":349,"./source":279,"./tile_pyramid":282,"resolve-url":405}],275:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length,this.extent=s}function i(t){this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=s}var o=t("point-geometry"),a=t("vector-tile").VectorTileFeature,s=t("../data/bucket").EXTENT;e.exports=n,n.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e=0&&t%1===0),s(!isNaN(e)&&e>=0&&e%1===0),s(!isNaN(r)&&r>=0&&r%1===0),isNaN(n)&&(n=0),this.z=+t,this.x=+e,this.y=+r,this.w=+n,n*=2,0>n&&(n=-1*n-1);var i=1<e.row){var r=t;t=e,e=r}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function o(t,e,r,n,i){var o=Math.max(r,Math.floor(e.y0)),a=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx0,h=e.dx<0,f=o;a>f;f++){var d=l*Math.max(0,Math.min(t.dy,f+c-t.y0))+t.x0,p=u*Math.max(0,Math.min(e.dy,f+h-e.y0))+e.x0;i(Math.floor(p),Math.ceil(d),f)}}function a(t,e,r,n,a,s){var l,u=i(t,e),c=i(e,r),h=i(r,t);u.dy>c.dy&&(l=u,u=c,c=l),u.dy>h.dy&&(l=u,u=h,h=l),c.dy>h.dy&&(l=c,c=h,h=l),u.dy&&o(h,u,n,a,s),c.dy&&o(h,c,n,a,s)}var s=t("assert"),l=t("../geo/coordinate");e.exports=n,n.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},n.prototype.toCoordinate=function(t){var e=Math.min(this.z,t),r=Math.pow(2,e),n=this.y,i=this.x+r*this.w;return new l(i,n,e)},n.fromID=function(t){var e=t%32,r=1<t?new n(this.z-1,this.x,this.y,this.w):new n(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},n.prototype.wrapped=function(){return new n(this.z,this.x,this.y,0)},n.prototype.children=function(t){if(this.z>=t)return[new n(this.z+1,this.x,this.y,this.w)];var e=this.z+1,r=2*this.x,i=2*this.y;return[new n(e,r,i,this.w),new n(e,r+1,i,this.w),new n(e,r,i+1,this.w),new n(e,r+1,i+1,this.w)]},n.cover=function(t,e,r){function i(t,e,i){var a,l,u;if(i>=0&&o>=i)for(a=t;e>a;a++)l=(a%o+o)%o,u=new n(r,l,i,Math.floor(a/o)),s[u.id]=u}var o=1<this.maxzoom&&(e=this.maxzoom);var n=t,i=n.locationCoordinate(n.center)._zoomTo(e),o=new l(i.column-.5,i.row-.5);return s.cover(e,[n.pointCoordinate(new l(0,0))._zoomTo(e),n.pointCoordinate(new l(n.width,0))._zoomTo(e),n.pointCoordinate(new l(n.width,n.height))._zoomTo(e),n.pointCoordinate(new l(0,n.height))._zoomTo(e)],this.reparseOverscaled?r:e).sort(function(t,e){return o.dist(t)-o.dist(e)})},findLoadedChildren:function(t,e,r){var n=!1;for(var i in this._tiles){var o=this._tiles[i];if(!(r[i]||!o.loaded||o.coord.z<=t.z||o.coord.z>e)){ -var a=Math.pow(2,Math.min(o.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(o.coord.x/a)===t.x&&Math.floor(o.coord.y/a)===t.y)for(r[i]=!0,n=!0;o&&o.coord.z-1>t.z;){var s=o.coord.parent(this.maxzoom).id;o=this._tiles[s],o&&o.loaded&&(delete r[i],r[s]=!0)}}}return n},findLoadedParent:function(t,e,r){for(var n=t.z-1;n>=e;n--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.loaded)return r[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),r[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=Math.ceil(t.width/t.tileSize)+1,r=Math.ceil(t.height/t.tileSize)+1,n=e*r,i=5;this._cache.setMaxSize(Math.floor(n*i))},update:function(t,e,r){var i,o,a;this.updateCacheSize(e);var l=(this.roundZoom?Math.round:Math.floor)(this.getZoom(e)),u=Math.max(l-n.maxOverzooming,this.minzoom),c=Math.max(l+n.maxUnderzooming,this.minzoom),f={},d=(new Date).getTime();this._coveredTiles={};var p=t?this.coveringTiles(e):[];for(i=0;id-(r||0)&&(this.findLoadedChildren(o,c,f)&&(f[y]=!0),this.findLoadedParent(o,u,v))}var b;for(b in v)f[b]||(this._coveredTiles[b]=!0);for(b in v)f[b]=!0;var x=h.keysDifference(this._tiles,f);for(i=0;ithis.maxzoom?Math.pow(2,n-this.maxzoom):1;e=new a(r,this.tileSize*i,this.maxzoom),this._load(e)}return e.uses++,this._tiles[t.id]=e,this._add(e,t),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._remove(e),e.uses>0||(e.loaded?this._cache.add(e.coord.wrapped().id,e):(this._abort(e),this._unload(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},r=this.orderedIDs(),n=1/0,o=1/0,a=-(1/0),l=-(1/0),u=t[0].zoom,h=0;h=0&&g[1].y>=0){for(var y=[],b=0;bthis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,r={url:s(t.coord.url(this.tiles,this.maxzoom),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*e,source:this.id,overscaling:e,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?(r.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",r,this._tileLoaded.bind(this,t),t.workerID)):t.workerID=this.dispatcher.send("load tile",r,this._tileLoaded.bind(this,t))},_tileLoaded:function(t,e,r){if(!t.aborted){if(e)return t.errored=!0,void this.fire("tile.error",{tile:t,error:e});t.loadVectorData(r,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),this.fire("tile.load",{tile:t}),this.fire("tile.stats",r.bucketStats)}},_abortTile:function(t){t.aborted=!0,this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},_addTile:function(t){this.fire("tile.add",{tile:t})},_removeTile:function(t){this.fire("tile.remove",{tile:t})},_unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)},redoPlacement:a.redoPlacement,_redoTilePlacement:function(t){t.redoPlacement(this)}})},{"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./source":279}],284:[function(t,e,r){"use strict";function n(t){this.urls=t.urls,this.coordinates=t.coordinates,c.getVideo(t.urls,function(e,r){if(!e){this.video=r,this.video.loop=!0;var n;this.video.addEventListener("playing",function(){n=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(n)}.bind(this)),this._loaded=!0,this.map&&(this.video.play(),this.setCoordinates(t.coordinates))}}.bind(this))}var i=t("../util/util"),o=t("./tile"),a=t("./tile_coord"),s=t("../geo/lng_lat"),l=t("point-geometry"),u=t("../util/evented"),c=t("../util/ajax"),h=t("../data/bucket").EXTENT,f=t("../render/draw_raster").RasterBoundsArray,d=t("../data/buffer"),p=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(u,{roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates))},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(s.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);n.column=Math.round(n.column),n.row=Math.round(n.row);var u=r.map(function(t){var e=t.zoomTo(n.zoom);return new l(Math.round((e.column-n.column)*h),Math.round((e.row-n.row)*h))}),c=32767,v=new f;return v.emplaceBack(u[0].x,u[0].y,0,0),v.emplaceBack(u[1].x,u[1].y,c,0),v.emplaceBack(u[3].x,u[3].y,0,c),v.emplaceBack(u[2].x,u[2].y,c,c),this.tile=new o(new a(n.zoom,n.column,n.row)),this.tile.buckets={},this.tile.boundsBuffer=new d(v.serialize(),f.serialize(),d.BufferType.VERTEX),this.tile.boundsVAO=new p,this.fire("change"),this},loaded:function(){return this.video&&this.video.readyState>=2},update:function(){},reload:function(){},prepare:function(){if(this._loaded&&!(this.video.readyState<2)){var t=this.map.painter.gl;this.tile.texture?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},getVisibleCoordinates:function(){return this.tile?[this.tile.coord]:[]},getTile:function(){return this.tile},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":247,"../data/buffer":252,"../geo/lng_lat":256,"../render/draw_raster":267,"../render/vertex_array_object":273,"../util/ajax":334,"../util/evented":341,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],285:[function(t,e,r){"use strict";function n(t){this.self=t,this.actor=new o(t,this),this.loading={},this.loaded={},this.geoJSONIndexes={}}function i(t){var e={};for(var r in t){var n=t[r],i=n.ref||n.id,o=t[i];o.layout&&"none"===o.layout.visibility||(e[i]=e[i]||[],r===i?e[i].unshift(n):e[i].push(n))}return e}var o=t("../util/actor"),a=t("./worker_tile"),s=t("../style/style_layer"),l=t("../util/util"),u=t("../util/ajax"),c=t("vector-tile"),h=t("pbf"),f=t("supercluster"),d=t("geojson-vt"),p=t("geojson-rewind"),v=t("./geojson_wrapper"),m=t("vt-pbf");e.exports=function(t){return new n(t)},l.extend(n.prototype,{"set layers":function(t){function e(t){var e=s.create(t,t.ref&&r.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),r.layers[e.id]=e}this.layers={};for(var r=this,n=[],o=0;o0)return!0}}return!1}function o(t){return t.serialize()}function a(t){var e=[];for(var r in t){var n=t[r];for(var i in n.arrayGroups)for(var o=n.arrayGroups[i],a=0;a=0;e--)m(T,P[e]);g()}}function m(t,e){var r=Date.now();e.populateBuffers(w,O,D);var n=Date.now()-r;if("symbol"!==e.type)for(var i=0;i=b.maxzoom||b.layout&&"none"===b.layout.visibility||t.layers&&!t.layers[b.sourceLayer]||(_=c.create({layer:b,index:L++,childLayers:e[z],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:k.encode(b.sourceLayer||"_geojsonTileLayer")}),_.createFilter(),E[b.id]=_,t.layers&&(x=b.sourceLayer,S[x]=S[x]||{},S[x][b.id]=_)));if(t.layers)for(x in S)b=t.layers[x],b&&p(b,S[x]);else p(t,E);var I=[],P=this.symbolBuckets=[],C=[];M.bucketLayerIDs={};for(var R in E)_=E[R],0!==_.features.length&&(M.bucketLayerIDs[_.index]=_.childLayers.map(s),I.push(_),"symbol"===_.type?P.push(_):C.push(_));var D={},O={},F=0;if(P.length>0){for(y=P.length-1;y>=0;y--)P[y].updateIcons(D),P[y].updateFont(O);for(var j in O)O[j]=Object.keys(O[j]).map(Number);D=Object.keys(D),r.send("get glyphs",{uid:this.uid,stacks:O},function(t,e){O=e,v(t)}),D.length?r.send("get icons",{icons:D},function(t,e){D=e,v(t)}):v()}for(y=C.length-1;y>=0;y--)m(this,C[y]);return 0===P.length?g():void 0},n.prototype.redoPlacement=function(t,e,r){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var n=new u(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(n,r);var c=n.serialize(),h=s.filter(i);return{result:{buckets:h.map(o),collisionTile:c.data},transferables:a(h).concat(c.transferables)}}},{"../data/bucket":247,"../data/feature_index":253,"../symbol/collision_box":306,"../symbol/collision_tile":308,"../util/dictionary_coder":340}],287:[function(t,e,r){"use strict";function n(){this.n=0,this.times=[]}e.exports=n,n.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},n.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},n.prototype.cancel=function(t){this.times=this.times.filter(function(e){return e.id!==t})}},{}],288:[function(t,e,r){"use strict";function n(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";a.getJSON(l(t,e,".json"),function(t,e){return t?void this.fire("error",{error:t}):(this.data=e,void(this.img&&this.fire("load")))}.bind(this)),a.getImage(l(t,e,".png"),function(t,e){if(t)return void this.fire("error",{error:t});for(var r=e.getData(),n=e.data=new Uint8Array(r.length),i=0;i1!==this.retina){var t=new n(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},i.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},n.prototype.getSpritePosition=function(t){if(!this.loaded())return new i;var e=this.data&&this.data[t];return e&&this.img?e:new i}},{"../util/ajax":334,"../util/browser":335,"../util/evented":341,"../util/mapbox":346}],289:[function(t,e,r){"use strict";function n(t){if(l[t])return l[t];if(Array.isArray(t))return t;if(t&&t.stops)return s.extend({},t,{stops:t.stops.map(i)});if("string"==typeof t){var e=a(t);if(!e)throw new Error("Invalid color "+t);var r=o(e);return l[t]=r,r}throw new Error("Invalid color "+t)}function i(t){return[t[0],n(t[1])]}function o(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]/1]}var a=t("csscolorparser").parseCSSColor,s=t("../util/util"),l={};e.exports=n},{"../util/util":349,csscolorparser:351}],290:[function(t,e,r){"use strict";function n(t,e){this.animationLoop=e||new v,this.dispatcher=new p(Math.max(d.hardwareConcurrency-1,1),this),this.spriteAtlas=new l(512,512),this.lineAtlas=new u(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},c.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var r=function(t,e){if(t)return void this.fire("error",{error:t});if(!m.emitErrors(this,m(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var r=e.sources;for(var n in r)this.addSource(n,r[n]);e.sprite&&(this.sprite=new a(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?h.getJSON(f(t),r):d.frame(r.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var r in this._layers){var n=this._layers[r];n.source===e.id&&this._validateLayer(n)}})}var i=t("../util/evented"),o=t("./style_layer"),a=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),u=t("../render/line_atlas"),c=t("../util/util"),h=t("../util/ajax"),f=t("../util/mapbox").normalizeStyleURL,d=t("../util/browser"),p=t("../util/dispatcher"),v=t("./animation_loop"),m=t("./validate_style"),g=t("../source/source"),y=t("./style_spec"),b=t("./style_function");e.exports=n,n.prototype=c.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&-1===e.vectorLayerIds.indexOf(t.sourceLayer)&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!this.sprite||this.sprite.loaded()},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var r=0;rMath.floor(t)&&(e.lastIntegerZoom=Math.floor(t+1),e.lastIntegerZoomTime=Date.now()),e.lastZoom=t},_checkLoaded:function(){if(!this._loaded)throw new Error("Style is not done loading")},update:function(t,e){if(!this._updates.changed)return this;if(this._updates.allLayers)this._groupLayers(),this._updateWorkerLayers();else{var r=Object.keys(this._updates.layers);r.length&&this._updateWorkerLayers(r)}var n,i=Object.keys(this._updates.sources);for(n=0;n=0;r--)for(var n=this._order[r],i=0;is.lastIntegerZoom?(n=u+(1-u)*c,h*=2,i=t({zoom:a-1},r),o=t({zoom:a},r)):(n=1-(1-c)*u,o=t({zoom:a},r),i=t({zoom:a+1},r),h/=2),{from:i,fromScale:h,to:o,toScale:f,t:n}}}var o=t("./style_function"),a=t("./parse_color"),s=t("../util/util");e.exports=n},{"../util/util":349,"./parse_color":289,"./style_function":292}],292:[function(t,e,r){"use strict";var n=t("mapbox-gl-function");r.interpolated=function(t){var e=n.interpolated(t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r["piecewise-constant"]=function(t){var e=n["piecewise-constant"](t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r.isFunctionDefinition=n.isFunctionDefinition},{"mapbox-gl-function":374}],293:[function(t,e,r){"use strict";function n(t,e){this.set(t,e)}function i(t){return t.value}var o=t("../util/util"),a=t("./style_transition"),s=t("./style_declaration"),l=t("./style_spec"),u=t("./validate_style"),c=t("./parse_color"),h=t("../util/evented");e.exports=n;var f="-transition";n.create=function(e,r){var n={background:t("./style_layer/background_style_layer"),circle:t("./style_layer/circle_style_layer"),fill:t("./style_layer/fill_style_layer"),line:t("./style_layer/line_style_layer"),raster:t("./style_layer/raster_style_layer"),symbol:t("./style_layer/symbol_style_layer")};return new n[(r||e).type](e,r)},n.prototype=o.inherit(h,{set:function(t,e){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(e||t).type,this.source=(e||t).source,this.sourceLayer=(e||t)["source-layer"],this.minzoom=(e||t).minzoom,this.maxzoom=(e||t).maxzoom,this.filter=(e||t).filter,this.paint={},this.layout={},this._paintSpecifications=l["paint_"+this.type],this._layoutSpecifications=l["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var r,n;for(var i in t){var o=i.match(/^paint(?:\.(.*))?$/);if(o){var a=o[1]||"";for(r in t[i])this.setPaintProperty(r,t[i][r],a)}}if(this.ref)this._layoutDeclarations=e._layoutDeclarations;else for(n in t.layout)this.setLayoutProperty(n,t.layout[n]);for(r in this._paintSpecifications)this.paint[r]=this.getPaintValue(r); -for(n in this._layoutSpecifications)this._updateLayoutValue(n)},setLayoutProperty:function(t,e){if(null==e)delete this._layoutDeclarations[t];else{var r="layers."+this.id+".layout."+t;if(this._handleErrors(u.layoutProperty,r,t,e))return;this._layoutDeclarations[t]=new s(this._layoutSpecifications[t],e)}this._updateLayoutValue(t)},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,e,r){var n=this._layoutSpecifications[t],i=this._layoutDeclarations[t];return i?i.calculate(e,r):n.default},setPaintProperty:function(t,e,r){var n="layers."+this.id+(r?'["paint.'+r+'"].':".paint.")+t;if(o.endsWith(t,f))if(this._paintTransitionOptions[r||""]||(this._paintTransitionOptions[r||""]={}),null===e||void 0===e)delete this._paintTransitionOptions[r||""][t];else{if(this._handleErrors(u.paintProperty,n,t,e))return;this._paintTransitionOptions[r||""][t]=e}else if(this._paintDeclarations[r||""]||(this._paintDeclarations[r||""]={}),null===e||void 0===e)delete this._paintDeclarations[r||""][t];else{if(this._handleErrors(u.paintProperty,n,t,e))return;this._paintDeclarations[r||""][t]=new s(this._paintSpecifications[t],e)}},getPaintProperty:function(t,e){return e=e||"",o.endsWith(t,f)?this._paintTransitionOptions[e]&&this._paintTransitionOptions[e][t]:this._paintDeclarations[e]&&this._paintDeclarations[e][t]&&this._paintDeclarations[e][t].value},getPaintValue:function(t,e,r){var n=this._paintSpecifications[t],i=this._paintTransitions[t];return i?i.calculate(e,r):"color"===n.type&&n.default?c(n.default):n.default},getPaintValueStopZoomLevels:function(t){var e=this._paintTransitions[t];return e?e.declaration.stopZoomLevels:[]},getPaintInterpolationT:function(t,e){var r=this._paintTransitions[t];return r.declaration.calculateInterpolationT({zoom:e})},isPaintValueFeatureConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isFeatureConstant:!0},isPaintValueZoomConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isZoomConstant:!0},isHidden:function(t){return this.minzoom&&t=this.maxzoom?!0:"none"===this.layout.visibility?!0:0===this.paint[this.type+"-opacity"]},updatePaintTransitions:function(t,e,r,n){for(var i=o.extend({},this._paintDeclarations[""]),a=0;a-r/2;){if(a--,0>a)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;r/2>s;){var c=t[a-1],h=t[a],f=t[a+1];if(!f)return!1;var d=c.angleTo(h)-h.angleTo(f);for(d=Math.abs((d+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:d}),u+=d;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=h.dist(f)}return!0}e.exports=n},{}],305:[function(t,e,r){"use strict";function n(t,e,r,n,o){for(var a=[],s=0;s=n&&f.x>=n||(h.x>=n?h=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round():f.x>=n&&(f=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round()),h.y>=o&&f.y>=o||(h.y>=o?h=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round():f.y>=o&&(f=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round()),l&&h.equals(l[l.length-1])||(l=[h],a.push(l)),l.push(f)))))}return a}var i=t("point-geometry");e.exports=n},{"point-geometry":404}],306:[function(t,e,r){"use strict";var n=t("../util/struct_array"),i=t("../util/util"),o=t("point-geometry"),a=e.exports=new n({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});i.extendAll(a.prototype.StructType.prototype,{get anchorPoint(){return new o(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":347,"../util/util":349,"point-geometry":404}],307:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c){var h=a.top*s-l,f=a.bottom*s+l,d=a.left*s-l,p=a.right*s+l;if(this.boxStartIndex=t.length,u){var v=f-h,m=p-d;if(v>0)if(v=Math.max(10*s,v),c){var g=e[r.segment+1].sub(e[r.segment])._unit()._mult(m),y=[r.sub(g),r.add(g)];this._addLineCollisionBoxes(t,y,r,0,m,v,n,i,o)}else this._addLineCollisionBoxes(t,e,r,r.segment,m,v,n,i,o)}else t.emplaceBack(r.x,r.y,d,h,p,f,1/0,n,i,o,0,0,0,0,0);this.boxEndIndex=t.length}e.exports=n,n.prototype._addLineCollisionBoxes=function(t,e,r,n,i,o,a,s,l){var u=o/2,c=Math.floor(i/u),h=-o/2,f=this.boxes,d=r,p=n+1,v=h;do{if(p--,0>p)return f;v-=e[p].dist(d),d=e[p]}while(v>-i/2);for(var m=e[p].dist(e[p+1]),g=0;c>g;g++){for(var y=-i/2+g*u;y>v+m;){if(v+=m,p++,p+1>=e.length)return f;m=e[p].dist(e[p+1])}var b=y-v,x=e[p],_=e[p+1],w=_.sub(x)._unit()._mult(b)._add(x)._round(),M=Math.max(Math.abs(y-h)-u/2,0),k=i/2/M;t.emplaceBack(w.x,w.y,-o/2,-o/2,o/2,o/2,k,a,s,l,0,0,0,0,0)}return f}},{}],308:[function(t,e,r){"use strict";function n(t,e,r){if("object"==typeof t){var n=t;r=e,t=n.angle,e=n.pitch,this.grid=new a(n.grid),this.ignoredGrid=new a(n.ignoredGrid)}else this.grid=new a(o,12,6),this.ignoredGrid=new a(o,12,0);this.angle=t,this.pitch=e;var i=Math.sin(t),s=Math.cos(t);if(this.rotationMatrix=[s,-i,i,s],this.reverseRotationMatrix=[s,i,-i,s],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=r,0===r.length){r.emplaceBack();var l=32767;r.emplaceBack(0,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(o,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,0,-l,0,l,0,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,o,-l,0,l,0,l,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=r.get(0),this.edges=[r.get(1),r.get(2),r.get(3),r.get(4)]}var i=t("point-geometry"),o=t("../data/bucket").EXTENT,a=t("grid-index");e.exports=n,n.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},n.prototype.minScale=.25,n.prototype.maxScale=2,n.prototype.placeCollisionFeature=function(t,e,r){for(var n=this.collisionBoxArray,o=this.minScale,a=this.rotationMatrix,s=this.yStretch,l=t.boxStartIndex;l=this.maxScale)return o}if(r){var _;if(this.angle){var w=this.reverseRotationMatrix,M=new i(u.x1,u.y1).matMult(w),k=new i(u.x2,u.y1).matMult(w),A=new i(u.x1,u.y2).matMult(w),T=new i(u.x2,u.y2).matMult(w);_=this.tempCollisionBox,_.anchorPointX=u.anchorPoint.x,_.anchorPointY=u.anchorPoint.y,_.x1=Math.min(M.x,k.x,A.x,T.x),_.y1=Math.min(M.y,k.x,A.x,T.x),_.x2=Math.max(M.x,k.x,A.x,T.x),_.y2=Math.max(M.y,k.x,A.x,T.x),_.maxScale=u.maxScale}else _=u;for(var E=0;E=this.maxScale)return o}}}return o},n.prototype.queryRenderedSymbols=function(t,e,r,n,o){var a={},s=[],l=this.collisionBoxArray,u=this.rotationMatrix,c=new i(t,e)._matMult(u),h=this.tempCollisionBox;h.anchorX=c.x,h.anchorY=c.y,h.x1=0,h.y1=0,h.x2=r-t,h.y2=n-e,h.maxScale=o,o=h.maxScale;for(var f=[c.x+h.x1/o,c.y+h.y1/o*this.yStretch,c.x+h.x2/o,c.y+h.y2/o*this.yStretch],d=this.grid.query(f[0],f[1],f[2],f[3]),p=this.ignoredGrid.query(f[0],f[1],f[2],f[3]),v=0;v=o&&(a[y][b]=!0,s.push(d[m]))}}return s},n.prototype.getPlacementScale=function(t,e,r,n,i){var o=e.x-n.x,a=e.y-n.y,s=(i.x1-r.x2)/o,l=(i.x2-r.x1)/o,u=(i.y1-r.y2)*this.yStretch/a,c=(i.y2-r.y1)*this.yStretch/a;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(u)||isNaN(c))&&(u=c=1);var h=Math.min(Math.max(s,l),Math.max(u,c)),f=i.maxScale,d=r.maxScale;return h>f&&(h=f),h>d&&(h=d),h>t&&h>=i.placementScale&&(t=h),t},n.prototype.insertCollisionFeature=function(t,e,r){for(var n=r?this.ignoredGrid:this.grid,i=this.collisionBoxArray,o=t.boxStartIndex;oe-h*s&&(e=h*s+e/4);var d=2*a,p=f?e/2*l%e:(h/2+d)*s*l%e;return i(t,p,e,c,r,h*s,f,!1,u)}function i(t,e,r,n,l,u,c,h,f){for(var d=u/2,p=0,v=0;vg+r;){g+=r;var k=(g-m)/w,A=o(x.x,_.x,k),T=o(x.y,_.y,k);if(A>=0&&f>A&&T>=0&&f>T&&g-d>=0&&p>=g+d){var E=new a(A,T,M,b)._round();n&&!s(t,E,u,n,l)||y.push(E)}}m+=w}return h||y.length||c||(y=i(t,m/2,r,n,l,u,c,!0,f)),y}var o=t("../util/interpolate"),a=t("../symbol/anchor"),s=t("./check_max_angle");e.exports=n},{"../symbol/anchor":303,"../util/interpolate":343,"./check_max_angle":304}],310:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.bin=new i(t,e),this.index={},this.ids={},this.data=new Uint8Array(t*e)}var i=t("shelf-pack");e.exports=n,n.prototype.getGlyphs=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]=[]),n[e].push(r);return n},n.prototype.getRects=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]={}),n[e][r]=this.index[i];return n},n.prototype.addGlyph=function(t,e,r,n){if(!r)return null;var i=e+"#"+r.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!r.bitmap)return null;var o=r.width+2*n,a=r.height+2*n,s=1,l=o+2*s,u=a+2*s;l+=4-l%4,u+=4-u%4;var c=this.bin.packOne(l,u);if(c||(this.resize(),c=this.bin.packOne(l,u)),!c)return console.warn("glyph bitmap overflow"),null;this.index[i]=c,this.ids[i]=[t];for(var h=this.data,f=r.bitmap,d=0;a>d;d++)for(var p=this.width*(c.y+d+s)+c.x+s,v=o*d,m=0;o>m;m++)h[p+m]=f[v+m];return this.dirty=!0,c},n.prototype.resize=function(){var t=this.width,e=this.height;if(!(t>512||e>512)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=2,this.height*=2,this.bin.resize(this.width,this.height);for(var r,n,i=new ArrayBuffer(this.width*this.height),o=0;e>o;o++)r=new Uint8Array(this.data.buffer,e*o,t),n=new Uint8Array(i,e*o*2,t),n.set(r);this.data=new Uint8Array(i)}},n.prototype.bind=function(t){this.gl=t,this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,null))},n.prototype.updateTexture=function(t){this.bind(t),this.dirty&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data),this.dirty=!1)}},{"shelf-pack":406}],311:[function(t,e,r){"use strict";function n(t){this.url=t&&a(t),this.atlases={},this.stacks={},this.loading={}}function i(t,e,r){var n=1;this.advance=t.advance,this.left=t.left-r-n,this.top=t.top+r+n,this.rect=e}function o(t,e,r,n){return n=n||"abc",r.replace("{s}",n[t.length%n.length]).replace("{fontstack}",t).replace("{range}",e)}var a=t("../util/mapbox").normalizeGlyphsURL,s=t("../util/ajax").getArrayBuffer,l=t("../util/glyphs"),u=t("../symbol/glyph_atlas"),c=t("pbf");e.exports=n,n.prototype.getSimpleGlyphs=function(t,e,r,n){void 0===this.stacks[t]&&(this.stacks[t]={}),void 0===this.atlases[t]&&(this.atlases[t]=new u(128,128));for(var o,a={},s=this.stacks[t],l=this.atlases[t],c=3,h={},f=0,d=0;d65535)return r("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var n=this.loading[t];if(n[e])n[e].push(r);else{n[e]=[r];var i=256*e+"-"+(256*e+255),a=o(t,i,this.url);s(a,function(t,r){for(var i=!t&&new l(new c(new Uint8Array(r))),o=0;or&&(o=!o),o&&i++;var u=new s(e.x,e.y),c=n[i],h=1/0;r=Math.abs(r);for(var f=l;;){var d=u.dist(c),p=r/d,v=Math.atan2(c.y-u.y,c.x-u.x);if(o||(v+=Math.PI),a&&(v+=Math.PI),t.push({anchorPoint:u,offset:a?Math.PI:0,minScale:p,maxScale:h,angle:(v+2*Math.PI)%(2*Math.PI)}),f>=p)break;for(u=c;u.equals(c);)if(i+=o?1:-1,c=n[i],!c)return p;var m=c.sub(u)._unit();u=u.sub(m._mult(d)),h=p}return f}var s=t("point-geometry");e.exports={getIconQuads:i,getGlyphQuads:o};var l=.5},{"point-geometry":404}],314:[function(t,e,r){"use strict";function n(t,e,r){for(var n=[],o=0,a=t.length;a>o;o++){var s=i(t[o].properties,e["text-field"]);if(s){s=s.toString();var l=e["text-transform"];"uppercase"===l?s=s.toLocaleUpperCase():"lowercase"===l&&(s=s.toLocaleLowerCase());for(var u=0;un&&null!==c){var x=g[c+1].x;m=Math.max(x,m);for(var _=c+1;y>=_;_++)g[_].y+=r,g[_].x-=x;if(a){var w=c;h[g[c].codePoint]&&w--,s(g,e,p,w,a)}p=c+1,c=null,d+=x,v++}f[b.codePoint]&&(c=y)}var M=g[g.length-1],k=M.x+e[M.codePoint].advance;m=Math.max(m,k);var A=(v+1)*r;s(g,e,p,g.length-1,a),l(g,a,i,o,m,r,v,u),t.top+=-o*A,t.bottom=t.top+A,t.left+=-i*m,t.right=t.left+m}function s(t,e,r,n,i){for(var o=e[t[n].codePoint].advance,a=(t[n].x+o)*i,s=r;n>=s;s++)t[s].x-=a}function l(t,e,r,n,i,o,a,s){for(var l=(e-r)*i+s[0],u=(-n*(a+1)+.5)*o+s[1],c=0;c=f;f++,d=((f+u)%u+n)*e+r,p+=o)for(h=-1;l>=h;h++)i[p+h]=t[d+(h+l)%l];else for(f=0;u>f;f++,d+=e,p+=o)for(h=0;l>h;h++)i[p+h]=t[d+h]}function o(t,e,r,n,i){this.rect=t,this.width=e,this.height=r,this.sdf=n,this.pixelRatio=i}var a=t("shelf-pack"),s=t("../util/browser");e.exports=n,n.prototype.allocateImage=function(t,e){t/=this.pixelRatio,e/=this.pixelRatio;var r=2,n=t+r+(4-(t+r)%4),i=e+r+(4-(e+r)%4),o=this.bin.packOne(n,i);return o?o:(console.warn("SpriteAtlas out of space."),null)},n.prototype.getImage=function(t,e){if(this.images[t])return this.images[t];if(!this.sprite)return null;var r=this.sprite.getSpritePosition(t);if(!r.width||!r.height)return null;var n=this.allocateImage(r.width,r.height);if(!n)return null;var i=new o(n,r.width/r.pixelRatio,r.height/r.pixelRatio,r.sdf,r.pixelRatio/this.pixelRatio);return this.images[t]=i,this.copy(n,r,e),i},n.prototype.getPosition=function(t,e){var r=this.getImage(t,e),n=r&&r.rect;if(!n)return null;var i=r.width*r.pixelRatio,o=r.height*r.pixelRatio,a=1;return{size:[r.width,r.height],tl:[(n.x+a)/this.width,(n.y+a)/this.height],br:[(n.x+a+i)/this.width,(n.y+a+o)/this.height]}},n.prototype.allocate=function(){if(!this.data){var t=Math.floor(this.width*this.pixelRatio),e=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(t*e);for(var r=0;r1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},n.prototype.addIcons=function(t,e){for(var r=0;r180&&(c.center.lng>0&&v.lng<0?v.lng+=360:c.center.lng<0&&v.lng>0&&(v.lng-=360));var b=c.zoomScale(m-f),x=c.point,_="center"in t?c.project(v).sub(h.div(b)):x,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),A=k/b,T=_.sub(x).mag(); -if("minZoom"in t){var E=n.clamp(Math.min(t.minZoom,f,m),c.minZoom,c.maxZoom),S=k/c.zoomScale(E-f);M=Math.sqrt(S/T*2)}var L=M*M,z=r(0),I=function(t){return s(z)/s(z+M*t)},P=function(t){return k*((s(z)*u(z+M*t)-o(z))/L)/T},C=(r(1)-z)/M;if(Math.abs(T)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var R=k>A?-1:1;C=Math.abs(Math.log(A/k))/M,P=function(){return 0},I=function(t){return Math.exp(R*M*t)}}if("duration"in t)t.duration=+t.duration;else{var D="screenSpeed"in t?+t.screenSpeed/M:+t.speed;t.duration=1e3*C/D}return this.zooming=!0,d!==g&&(this.rotating=!0),p!==y&&(this.pitching=!0),this.fire("movestart",e),this.fire("zoomstart",e),this._ease(function(t){var r=t*C,n=P(r);c.zoom=f+c.scaleZoom(1/I(r)),c.center=c.unproject(x.add(_.sub(x).mult(n)),w),this.rotating&&(c.bearing=i(d,g,t)),this.pitching&&(c.pitch=i(p,y,t)),this.fire("move",e),this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){this.fire("zoomend",e),this.fire("moveend",e),this.zooming=!1,this.rotating=!1,this.pitching=!1},t),this},isEasing:function(){return!!this._abortFn},stop:function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},_ease:function(t,e,r){this._finishFn=e,this._abortFn=o.timed(function(e){t.call(this,r.easing(e)),1===e&&this._finishEase()},r.animate===!1?0:r.duration,this)},_finishEase:function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},_normalizeBearing:function(t,e){t=n.wrap(t,-180,180);var r=Math.abs(t-e);return Math.abs(t-360-e)=0)return!1;return!0}),e.join(" | ")},n.prototype=a.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",r=this._container=o.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),r},_update:function(){this._map.style&&(this._container.innerHTML=n.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":338,"../../util/util":349,"./control":319}],319:[function(t,e,r){"use strict";function n(){}e.exports=n,n.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var r=this.options.position,n=t._controlCorners[r];e.className+=" mapboxgl-ctrl",-1!==r.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}}},{}],320:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}var i=t("./control"),o=t("../../util/browser"),a=t("../../util/dom"),s=t("../../util/util");e.exports=n;var l={enableHighAccuracy:!1,timeout:6e3};n.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=a.create("div",e+"-group",t.getContainer());return o.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=a.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),r):r},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this._finish()},_error:function(){this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":335,"../../util/dom":338,"../../util/util":349,"./control":319}],321:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var o=t("./control"),a=t("../../util/dom"),s=t("../../util/util");e.exports=n,n.prototype=s.inherit(o,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=a.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=a.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),r},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(a.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),a.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var r=a.create("button",t,this._container);return r.addEventListener("click",function(){e()}),r},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":338,"../../util/util":349,"./control":319}],322:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../geo/lng_lat_bounds"),a=t("../../util/util");e.exports=n,n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,r=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,r.x),o=Math.max(e.x,r.x),a=Math.min(e.y,r.y),s=Math.max(e.y,r.y);i.setTransform(this._box,"translate("+n+"px,"+a+"px)"),this._box.style.width=o-n+"px",this._box.style.height=s-a+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,r=i.mousePos(this._el,t),n=new o(this._map.unproject(e),this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:n})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":257,"../../util/dom":338,"../../util/util":349}],323:[function(t,e,r){"use strict";function n(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=n,n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat})}}},{}],324:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=n;var a=.3,s=o.bezier(0,0,a,1),l=1400,u=2500;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),r=this._map;r.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),r.transform.setLocationAtPoint(r.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),r=this._inertia;if(r.length<2)return void e();var n=r[r.length-1],i=r[0],o=n[1].sub(i[1]),c=(n[0]-i[0])/1e3;if(0===c||n[1].equals(i[1]))return void e();var h=o.mult(a/c),f=h.mag();f>l&&(f=l,h._unit()._mult(f));var d=f/(u*a),p=h.mult(-d/2);this._map.panBy(p,{duration:1e3*d,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var r=1,n=0;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":338,"../../util/util":349}],325:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("point-geometry"),a=t("../../util/util");e.exports=n;var s=.25,l=a.bezier(0,0,s,1),u=180,c=720;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),r=e.mag();200>r&&(this._center=this._startPos.add(new o(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var r=this._pos,n=i.mousePos(this._el,t),o=this._center,a=r.sub(o).angleWith(n.sub(o))/Math.PI*180,s=e.getBearing()-a,l=this._inertia,u=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,u[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,r=e.getBearing(),n=this._inertia,i=function(){Math.abs(r)d?-1:1,v=(a[0]-o[0])/1e3;if(0===d||0===v)return void i();var m=Math.abs(d*(s/v));m>u&&(m=u);var g=m/(c*s),y=p*m*(g/2);f+=y,Math.abs(e._normalizeBearing(f,0))1;var r=t.ctrlKey?1:2,n=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":338,"../../util/util":349,"point-geometry":404}],326:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=n;var i=80,o=2,a=5;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,r={originalEvent:t};switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),r);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),r);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-o},r):(t.preventDefault(),e.panBy([-i,0],r));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+o},r):(t.preventDefault(),e.panBy([i,0],r));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+a},r):(t.preventDefault(),e.panBy([0,-i],r));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-a,0)},r):(t.preventDefault(),e.panBy([0,i],r))}}}}},{}],327:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/browser"),a=t("../../util/util");e.exports=n;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=-1!==s.indexOf("firefox"),u=-1!==s.indexOf("safari")&&-1===s.indexOf("chrom");n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=o.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,u&&(e/=3));var r=o.now(),n=r-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=r,0!==e&&e%4.000244140625===0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(n*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var r=this._map,n=2/(1+Math.exp(-Math.abs(t/100)));0>t&&0!==n&&(n=1/n);var i=r.ease?r.ease.to:r.transform.scale,o=r.transform.scaleZoom(i*n);r.zoomTo(o,{duration:0,around:r.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":335,"../../util/dom":338,"../../util/util":349}],328:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=n;var a=.15,s=o.bezier(0,0,a,1),l=12,u=2.5,c=.15,h=4;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(r),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]),n=e.add(r).div(2),o=e.sub(r),a=o.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*o.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var u={duration:0,around:l.unproject(n)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=l.transform.scaleZoom(this._startScale*a)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),a,n]),l.easeTo(u,{originalEvent:t})}else{var f=Math.abs(1-a)>c,d=Math.abs(s)>h;d?this._gestureIntent="rotate":f&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=o,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,r=this._map;if(e.length<2)return void r.snapToNorth({},{originalEvent:t});var n=e[e.length-1],i=e[0],o=r.transform.scaleZoom(this._startScale*n[1]),c=r.transform.scaleZoom(this._startScale*i[1]),h=o-c,f=(n[0]-i[0])/1e3,d=n[2];if(0===f||o===c)return void r.snapToNorth({},{originalEvent:t});var p=h*a/f;Math.abs(p)>u&&(p=p>0?u:-u);var v=1e3*Math.abs(p/(l*a)),m=o+p*v/2e3;0>m&&(m=0),r.easeTo({zoom:m,duration:v,easing:s,around:r.unproject(d)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>2&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":338,"../../util/util":349}],329:[function(t,e,r){"use strict";function n(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=n;var i=t("../util/util");n.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3?(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0):!1},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),r=this._map.getBearing(),n=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(n)+"/"+t.lng.toFixed(n)+(r?"/"+Math.round(10*r)/10:"");window.history.replaceState("","",i)}}},{"../util/util":349}],330:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer();for(var e in i)t[e]=new i[e](t);a.bindHandlers(this)}var i={scrollZoom:t("./handler/scroll_zoom"),boxZoom:t("./handler/box_zoom"),dragRotate:t("./handler/drag_rotate"),dragPan:t("./handler/drag_pan"),keyboard:t("./handler/keyboard"),doubleClickZoom:t("./handler/dblclick_zoom"),touchZoomRotate:t("./handler/touch_zoom_rotate")},o=t("../util/dom"),a=t("../util/util"),s=t("point-geometry");e.exports=n,n.prototype={enable:function(){var t=this._map.options,e=this._el;for(var r in i)t[r]&&this._map[r].enable();e.addEventListener("mousedown",this._onMouseDown,!1),e.addEventListener("mouseup",this._onMouseUp,!1),e.addEventListener("mousemove",this._onMouseMove,!1),e.addEventListener("touchstart",this._onTouchStart,!1),e.addEventListener("touchend",this._onTouchEnd,!1),e.addEventListener("touchmove",this._onTouchMove,!1),e.addEventListener("touchcancel",this._onTouchCancel,!1),e.addEventListener("click",this._onClick,!1),e.addEventListener("dblclick",this._onDblClick,!1),e.addEventListener("contextmenu",this._onContextMenu,!1)},disable:function(){var t=this._map.options,e=this._el;for(var r in i)t[r]&&this._map[r].disable();e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp),e.removeEventListener("mousemove",this._onMouseMove),e.removeEventListener("touchstart",this._onTouchStart),e.removeEventListener("touchend",this._onTouchEnd),e.removeEventListener("touchmove",this._onTouchMove),e.removeEventListener("touchcancel",this._onTouchCancel),e.removeEventListener("click",this._onClick),e.removeEventListener("dblclick",this._onDblClick),e.removeEventListener("contextmenu",this._onContextMenu)},_onMouseDown:function(t){this._map.stop(),this._startPos=o.mousePos(this._el,t),this._fireMouseEvent("mousedown",t)},_onMouseUp:function(t){var e=this._map,r=e.dragRotate&&e.dragRotate.isActive();this._contextMenuEvent&&!r&&this._fireMouseEvent("contextmenu",this._contextMenuEvent),this._contextMenuEvent=null,this._fireMouseEvent("mouseup",t)},_onMouseMove:function(t){var e=this._map,r=this._el;if(!(e.dragPan&&e.dragPan.isActive()||e.dragRotate&&e.dragRotate.isActive())){for(var n=t.toElement||t.target;n&&n!==r;)n=n.parentNode;n===r&&this._fireMouseEvent("mousemove",t)}},_onTouchStart:function(t){this._map.stop(),this._fireTouchEvent("touchstart",t),!t.touches||t.touches.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._fireMouseEvent("dblclick",t)):this._tapped=setTimeout(this._onTouchTimeout,300))},_onTouchMove:function(t){this._fireTouchEvent("touchmove",t)},_onTouchEnd:function(t){this._fireTouchEvent("touchend",t)},_onTouchCancel:function(t){this._fireTouchEvent("touchcancel",t)},_onTouchTimeout:function(){this._tapped=null},_onClick:function(t){var e=o.mousePos(this._el,t);e.equals(this._startPos)&&this._fireMouseEvent("click",t)},_onDblClick:function(t){this._fireMouseEvent("dblclick",t),t.preventDefault()},_onContextMenu:function(t){this._contextMenuEvent=t,t.preventDefault()},_fireMouseEvent:function(t,e){var r=o.mousePos(this._el,e);return this._map.fire(t,{lngLat:this._map.unproject(r),point:r,originalEvent:e})},_fireTouchEvent:function(t,e){var r=o.touchPos(this._el,e),n=r.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new s(0,0));return this._map.fire(t,{lngLat:this._map.unproject(n),point:n,lngLats:r.map(function(t){return this._map.unproject(t)},this),points:r,originalEvent:e})}}},{"../util/dom":338,"../util/util":349,"./handler/box_zoom":322,"./handler/dblclick_zoom":323,"./handler/drag_pan":324,"./handler/drag_rotate":325,"./handler/keyboard":326,"./handler/scroll_zoom":327,"./handler/touch_zoom_rotate":328,"point-geometry":404}],331:[function(t,e,r){"use strict";function n(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),o=t("../util/util"),a=t("../util/browser"),s=t("../util/evented"),l=t("../util/dom"),u=t("../style/style"),c=t("../style/animation_loop"),h=t("../render/painter"),f=t("../geo/transform"),d=t("./hash"),p=t("./interaction"),v=t("./camera"),m=t("../geo/lng_lat"),g=t("../geo/lng_lat_bounds"),y=t("point-geometry"),b=t("./control/attribution"),x=0,_=20,w=e.exports=function(t){t=o.inherit(this.options,t),this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new c,this.transform=new f(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),o.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowResize","onError","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof window&&window.addEventListener("resize",this._onWindowResize,!1),this.interaction=new p(this),t.interactive&&this.interaction.enable(),this._hash=t.hash&&(new d).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo(t),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new b(t.attributionControl)),this.on("style.error",this.onError),this.on("source.error",this.onError),this.on("tile.error",this.onError),this.on("layer.error",this.onError)};o.extend(w.prototype,s),o.extend(w.prototype,v.prototype),o.extend(w.prototype,{options:{center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:x,maxZoom:_,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1},addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var r=this._classes.indexOf(t);return 0>r||""===t?this:(this._classes.splice(r,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var r={},n=0;n=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new g(this.transform.pointLocation(new y(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new y(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new y(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=g.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?x:t,t>=x&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&_>=t)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+_+", inclusive")},project:function(t){return this.transform.locationPoint(m.convert(t))},unproject:function(t){return this.transform.pointLocation(y.convert(t))},queryRenderedFeatures:function(t,e){t instanceof y||Array.isArray(t)||(e=t,t=void 0);var r=this._makeQueryGeometry(t);return this.style.queryRenderedFeatures(r,e,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[y.convert([0,0]),y.convert([this.transform.width,this.transform.height])]);var e,r=t instanceof y||"number"==typeof t[0];if(r){var n=y.convert(t);e=[n]}else{var i=[y.convert(t[0]),y.convert(t[1])];e=[i[0],new y(i[1].x,i[0].y),i[1],new y(i[0].x,i[1].y),i[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement), -this.off("pitch",this.style._redoPlacement)),t?(t instanceof u?this.style=t:this.style=new u(t,this.animationLoop),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){return this.style.serialize()},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,r,n){return this.style.setPaintProperty(t,e,r,n),this._update(!0),this},getPaintProperty:function(t,e,r){return this.style.getPaintProperty(t,e,r)},setLayoutProperty:function(t,e,r){return this.style.setLayoutProperty(t,e,r),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=l.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var r=this._controlContainer=l.create("div","mapboxgl-control-container",t),n=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){n[t]=l.create("div","mapboxgl-ctrl-"+t,r)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});return t?void(this.painter=new h(t,this.transform)):void console.error("Failed to initialize WebGL")},_contextLost:function(t){t.preventDefault(),this._frameId&&a.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return this._styleDirty||this._sourcesDirty?!1:!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){return this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||!this.animationLoop.stopped())&&this._rerender(),this},remove:function(){this._hash&&this._hash.remove(),a.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof window&&window.removeEventListener("resize",this._onWindowResize,!1),n(this._canvasContainer),n(this._controlContainer),this._container.classList.remove("mapboxgl-map")},onError:function(t){console.error(t.error)},_rerender:function(){this.style&&!this._frameId&&(this._frameId=a.frame(this._render))},_forwardStyleEvent:function(t){this.fire("style."+t.type,o.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowResize:function(){this.stop().resize()._update()}}),o.extendAll(w.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":256,"../geo/lng_lat_bounds":257,"../geo/transform":258,"../render/painter":271,"../style/animation_loop":287,"../style/style":290,"../util/browser":335,"../util/canvas":336,"../util/dom":338,"../util/evented":341,"../util/util":349,"./camera":317,"./control/attribution":318,"./hash":329,"./interaction":330,"point-geometry":404}],332:[function(t,e,r){"use strict";function n(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=n;var i=t("../util/util"),o=t("../util/evented"),a=t("../util/dom"),s=t("../geo/lng_lat");n.prototype=i.inherit(o,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,r=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=t;;){if(e=n.firstChild,!e)break;r.appendChild(e)}return this.setDOMContent(r)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=a.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=a.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=a.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=a.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var r=this._container.offsetWidth,n=this._container.offsetHeight;e=t.ythis._map.transform.height-n?["bottom"]:[],t.xthis._map.transform.width-r/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},o=this._container.classList;for(var s in i)o.remove("mapboxgl-popup-anchor-"+s);o.add("mapboxgl-popup-anchor-"+e),a.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":256,"../util/dom":338,"../util/evented":341,"../util/util":349}],333:[function(t,e,r){"use strict";function n(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=n,n.prototype.receive=function(t){var e,r=t.data;if(""===r.type)e=this.callbacks[r.id],delete this.callbacks[r.id],e(r.error||null,r.data);else if("undefined"!=typeof r.id){var n=r.id;this.parent[r.type](r.data,function(t,e,r){this.postMessage({type:"",id:String(n),error:t?String(t):null,data:e},r)}.bind(this))}else this.parent[r.type](r.data)},n.prototype.send=function(t,e,r,n){var i=null;r&&(this.callbacks[i=this.callbackID++]=r),this.postMessage({type:t,id:String(i),data:e},n)},n.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],334:[function(t,e,r){"use strict";function n(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}r.getJSON=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.setRequestHeader("Accept","application/json"),r.onerror=function(t){e(t)},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var t;try{t=JSON.parse(r.response)}catch(n){return e(n)}e(null,t)}else e(new Error(r.statusText))},r.send(),r},r.getArrayBuffer=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onerror=function(t){e(t)},r.onload=function(){r.status>=200&&r.status<300&&r.response?e(null,r.response):e(new Error(r.statusText))},r.send(),r},r.getImage=function(t,e){return r.getArrayBuffer(t,function(t,r){if(t)return e(t);var n=new Image;n.onload=function(){e(null,n),(window.URL||window.webkitURL).revokeObjectURL(n.src)};var i=new Blob([new Uint8Array(r)],{type:"image/png"});return n.src=(window.URL||window.webkitURL).createObjectURL(i),n.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=n.width,t.height=n.height,e.drawImage(n,0,0),e.getImageData(0,0,n.width,n.height).data},n})},r.getVideo=function(t,e){var r=document.createElement("video");r.onloadstart=function(){e(null,r)};for(var i=0;i=s+n?t.call(i,1):(t.call(i,(l-s)/n),r.frame(o)))}if(!n)return t.call(i,1),null;var a=!1,s=e.exports.now();return r.frame(o),function(){a=!0}},r.supported=t("mapbox-gl-js-supported"),r.hardwareConcurrency=navigator.hardwareConcurrency||8,Object.defineProperty(r,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),r.supportsWebp=!1;var o=document.createElement("img");o.onload=function(){r.supportsWebp=!0},o.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",r.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-js-supported":375}],336:[function(t,e,r){"use strict";function n(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),o=t("mapbox-gl-js-supported");e.exports=n,n.prototype.resize=function(t,e){var r=window.devicePixelRatio||1;this.canvas.width=r*t,this.canvas.height=r*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},n.prototype.getWebGLContext=function(t){return t=i.extend({},t,o.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},n.prototype.getElement=function(){return this.canvas}},{"../util":349,"mapbox-gl-js-supported":375}],337:[function(t,e,r){"use strict";function n(e,r){this.actors=[],this.currentActor=0;for(var n=0;e>n;n++){var a=new o(t("../../source/worker")),s=new i(a,r);s.name="Worker "+n,this.actors.push(s)}}var i=t("../actor"),o=t("webworkify");e.exports=n,n.prototype={broadcast:function(t,e){for(var r=0;r=0&&this._events[t].splice(r,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var r=function(n){this.off(t,r),e.call(this,n)}.bind(this);return this.on(t,r),this},fire:function(t,e){if(!this.listens(t))return this;e=n.extend({},e),n.extend(e,{type:t,target:this});for(var r=this._events[t].slice(),i=0;i=3)for(var l=0;l1){if(s(t,e))return!0;for(var n=0;n(e.y-t.y)*(r.x-t.x)}function u(t,e,r,n){return l(t,r,n)!==l(e,r,n)&&l(t,e,r)!==l(t,e,n)}function c(t,e,r){var n=r*r;if(1===e.length)return t.distSqr(e[0])i?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function f(t,e){for(var r,n,i,o=!1,a=0;ae.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o)}return o}function d(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}e.exports={multiPolygonIntersectsBufferedMultiPoint:n,multiPolygonIntersectsMultiPolygon:i,multiPolygonIntersectsBufferedMultiLine:o}},{}],345:[function(t,e,r){"use strict";function n(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=n,n.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},n.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.get(this.order[0]);r&&this.onRemove(r)}return this},n.prototype.has=function(t){return t in this.data},n.prototype.keys=function(){return this.order},n.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},n.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],346:[function(t,e,r){"use strict";function n(t,e,r){if(r=r||i.ACCESS_TOKEN,!r&&i.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,i.API_URL+e),t+=-1!==t.indexOf("?")?"&access_token=":"?access_token=",i.REQUIRE_ACCESS_TOKEN){if("s"===r[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=r}return t}var i=t("./config"),o=t("./browser");e.exports.normalizeStyleURL=function(t,e){if(!t.match(/^mapbox:\/\/styles\//))return t;var r=t.split("/"),i=r[3],o=r[4],a=r[5]?"/draft":"";return n("mapbox://"+i+"/"+o+a,"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){return t.match(/^mapbox:\/\//)?n(t+".json","/v4/",e)+"&secure":t},e.exports.normalizeGlyphsURL=function(t,e){if(!t.match(/^mapbox:\/\//))return t;var r=t.split("/")[3];return n("mapbox://"+r+"/{fontstack}/{range}.pbf","/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,r,i){if(!t.match(/^mapbox:\/\/sprites\//))return t+e+r;var o=t.split("/"),a=o[3],s=o[4],l=o[5]?"/draft":"";return n("mapbox://"+a+"/"+s+l+"/sprite"+e+r,"/styles/v1/",i)},e.exports.normalizeTileURL=function(t,e,r){if(!e||!e.match(/^mapbox:\/\//))return t;t=t.replace(/([?&]access_token=)tk\.[^&]+/,"$1"+i.ACCESS_TOKEN);var n=o.supportsWebp?"webp":"$1";return t.replace(/\.((?:png|jpg)\d*)(?=$|\?)/,o.devicePixelRatio>=2||512===r?"@2x."+n:"."+n)}},{"./browser":335,"./config":339}],347:[function(t,e,r){"use strict";function n(t){function e(){f.apply(this,arguments)}function r(){d.apply(this,arguments),this.members=e.prototype.members}var n=JSON.stringify(t);if(m[n])return m[n];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(f.prototype);var s=0,u=0,g=["Uint8"];return e.prototype.members=t.members.map(function(r){r={name:r.name,type:r.type,components:r.components||1},p(r.name.length),p(r.type in v),g.indexOf(r.type)<0&&g.push(r.type);var n=a(r.type);u=Math.max(u,n),r.offset=s=o(s,Math.max(t.alignment,n));for(var i=0;ithis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},d.prototype._refreshViews=function(){for(var t=0;t$=:;.,^]+)}/g,function(e,r){return r in t?t[r]:""})}e.exports=n},{}],349:[function(t,e,r){"use strict";var n=t("unitbezier"),i=t("../geo/coordinate");r.easeCubicInOut=function(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(.5>t?r:3*(t-e)+r-.75)},r.bezier=function(t,e,r,i){var o=new n(t,e,r,i);return function(t){return o.solve(t)}},r.ease=r.bezier(.25,.1,.25,1),r.premultiply=function(t){if(!t)return null;var e=t[3];return[t[0]*e,t[1]*e,t[2]*e,e]},r.clamp=function(t,e,r){return Math.min(r,Math.max(e,t))},r.wrap=function(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i},r.coalesce=function(){for(var t=0;t=0)return!0;return!1}},{"../geo/coordinate":255,unitbezier:412}],350:[function(t,e,r){"use strict";function n(t,e,r,n){this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,t._id&&(this.id=t._id)}function i(t,e,r,n,i){for(var o=e*Math.pow(2,r),a=e*n,s=e*i,l=0;lt?0:t>255?255:t}function i(t){return 0>t?0:t>1?1:t}function o(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return i("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function s(t,e,r){return 0>r?r+=1:r>1&&(r-=1),1>6*r?t+(e-t)*r*6:1>2*r?e:2>3*r?t+(e-t)*(2/3-r)*6:t}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in u)return u[e].slice();if("#"===e[0]){if(4===e.length){var r=parseInt(e.substr(1),16);return r>=0&&4095>=r?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null}if(7===e.length){var r=parseInt(e.substr(1),16);return r>=0&&16777215>=r?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(-1!==i&&l+1===e.length){var c=e.substr(0,i),h=e.substr(i+1,l-(i+1)).split(","),f=1;switch(c){case"rgba":if(4!==h.length)return null;f=a(h.pop());case"rgb":return 3!==h.length?null:[o(h[0]),o(h[1]),o(h[2]),f];case"hsla":if(4!==h.length)return null;f=a(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,p=a(h[1]),v=a(h[2]),m=.5>=v?v*(p+1):v+p-v*p,g=2*v-m;return[n(255*s(g,m,d+1/3)),n(255*s(g,m,d)),n(255*s(g,m,d-1/3)),f];default:return null}}return null}var u={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1], -dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{r.parseCSSColor=l}catch(c){}},{}],352:[function(t,e,r){"use strict";function n(t){return new Function("f","var p = (f && f.properties || {}); return "+i(t))}function i(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";var r="=="===e?a(t[1],t[2],"===",!1):"!="===e?a(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?a(t[1],t[2],e,!0):"any"===e?s(t.slice(1),"||"):"all"===e?s(t.slice(1),"&&"):"none"===e?c(s(t.slice(1),"||")):"in"===e?l(t[1],t.slice(2)):"!in"===e?c(l(t[1],t.slice(2))):"has"===e?u(t[1]):"!has"===e?c(u([t[1]])):"true";return"("+r+")"}function o(t){return"$type"===t?"f.type":"p["+JSON.stringify(t)+"]"}function a(t,e,r,n){var i=o(t),a="$type"===t?f.indexOf(e):JSON.stringify(e);return(n?"typeof "+i+"=== typeof "+a+"&&":"")+i+r+a}function s(t,e){return t.map(i).join(e)}function l(t,e){"$type"===t&&(e=e.map(function(t){return f.indexOf(t)}));var r=JSON.stringify(e.sort(h)),n=o(t);return e.length<=200?r+".indexOf("+n+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+n+", "+r+",0,"+(e.length-1)+")"}function u(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function h(t,e){return e>t?-1:t>e?1:0}e.exports=n;var f=["Unknown","Point","LineString","Polygon"]},{}],353:[function(t,e,r){function n(t,e){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.map(i(n,e)),t;case"Feature":return t.geometry=n(t.geometry,e),t;case"Polygon":case"MultiPolygon":return o(t,e);default:return t}}function i(t,e){return function(r){return t(r,e)}}function o(t,e){return"Polygon"===t.type?t.coordinates=a(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(i(a,e))),t}function a(t,e){e=!!e,t[0]=s(t[0],!e);for(var r=1;r=0}var u=t("geojson-area");e.exports=n},{"geojson-area":354}],354:[function(t,e,r){function n(t){if("Polygon"===t.type)return i(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,r=0;r0){e+=Math.abs(o(t[0]));for(var r=1;r2){for(var r,n,i=0;i=r&&n>=u)return t;if(l>n||r>u)return null;for(var c=[],h=0;h=r&&n>=d)c.push(p);else if(!(f>n||r>d)){var g=1===m?i(v,r,n,a):o(v,r,n,a,s,3===m);g.length&&c.push({geometry:g,type:m,tags:t[h].tags||null,min:p.min,max:p.max})}}return c.length?c:null}function i(t,e,r,n){for(var i=[],o=0;o=e&&r>=s&&i.push(a)}return i}function o(t,e,r,n,i,o){for(var s=[],l=0;lc;c++)u=p||v[c],p=v[c+1],f=d||u[n],d=p[n],e>f?d>r?(b.push(i(u,p,e),i(u,p,r)),o||(b=a(s,b,m,g))):d>=e&&b.push(i(u,p,e)):f>r?e>d?(b.push(i(u,p,r),i(u,p,e)),o||(b=a(s,b,m,g))):r>=d&&b.push(i(u,p,r)):(b.push(u),e>d?(b.push(i(u,p,e)),o||(b=a(s,b,m,g))):d>r&&(b.push(i(u,p,r)),o||(b=a(s,b,m,g))));u=v[y-1],f=u[n],f>=e&&r>=f&&b.push(u),h=b[b.length-1],o&&h&&(b[0][0]!==h[0]||b[0][1]!==h[1])&&b.push(b[0]),a(s,b,m,g)}return s}function a(t,e,r,n){return e.length&&(e.area=r,e.dist=n,t.push(e)),[]}e.exports=n},{}],357:[function(t,e,r){"use strict";function n(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;nn?-1:n>1?1:n,[r,n,0]}function l(t){for(var e,r,n=0,i=0,o=0;o1)return!1;var o=i.geometry[0].length;if(5!==o)return!1;for(var a=0;o>a;a++){var s=h.point(i.geometry[0][a],e,t.z2,t.x,t.y);if(s[0]!==-r&&s[0]!==e+r||s[1]!==-r&&s[1]!==e+r)return!1}return!0}e.exports=n;var c=t("./convert"),h=t("./transform"),f=t("./clip"),d=t("./wrap"),p=t("./tile");i.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},i.prototype.splitTile=function(t,e,r,n,i,l,c){for(var h=[t,e,r,n],d=this.options,v=d.debug,m=null;h.length;){n=h.pop(),r=h.pop(),e=h.pop(),t=h.pop();var g=1<1&&console.time("creation"),b=this.tiles[y]=p(t,g,r,n,x,e===d.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),v)){v>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(b.source=t,i){if(e===d.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,k,A,T,E,S,L=.5*d.buffer/d.extent,z=.5-L,I=.5+L,P=1+L;M=k=A=T=null,E=f(t,g,r-L,r+I,0,a,b.min[0],b.max[0]),S=f(t,g,r+z,r+P,0,a,b.min[0],b.max[0]),E&&(M=f(E,g,n-L,n+I,1,s,b.min[1],b.max[1]),k=f(E,g,n+z,n+P,1,s,b.min[1],b.max[1])),S&&(A=f(S,g,n-L,n+I,1,s,b.min[1],b.max[1]),T=f(S,g,n+z,n+P,1,s,b.min[1],b.max[1])),v>1&&console.timeEnd("clipping"),M&&h.push(M,e+1,2*r,2*n),k&&h.push(k,e+1,2*r,2*n+1),A&&h.push(A,e+1,2*r+1,2*n),T&&h.push(T,e+1,2*r+1,2*n+1)}else i&&(m=e)}return m},i.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,a=n.debug,s=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var c,f=t,d=e,p=r;!c&&f>0;)f--,d=Math.floor(d/2),p=Math.floor(p/2),c=this.tiles[o(f,d,p)];if(!c||!c.source)return null;if(a>1&&console.log("found parent tile z%d-%d-%d",f,d,p),u(c,i,n.buffer))return h.tile(c,i);a>1&&console.time("drilling down");var v=this.splitTile(c.source,f,d,p,t,e,r);if(a>1&&console.timeEnd("drilling down"),null!==v){var m=1<r;r++)o=i(t[r],t[u],t[c]),o>n&&(a=r,n=o);n>s?(t[a][2]=n,h.push(u),h.push(a),u=a):(c=h.pop(),u=h.pop())}}function i(t,e,r){var n=e[0],i=e[1],o=r[0],a=r[1],s=t[0],l=t[1],u=o-n,c=a-i;if(0!==u||0!==c){var h=((s-n)*u+(l-i)*c)/(u*u+c*c);h>1?(n=o,i=a):h>0&&(n+=u*h,i+=c*h)}return u=s-n,c=l-i,u*u+c*c}e.exports=n},{}],360:[function(t,e,r){"use strict";function n(t,e,r,n,o,a){for(var s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z2:e,transformed:!1,min:[2,1],max:[-1,0]},l=0;ls.max[0]&&(s.max[0]=c[0]),c[1]>s.max[1]&&(s.max[1]=c[1])}return s}function i(t,e,r,n){var i,o,a,s,l=e.geometry,u=e.type,c=[],h=r*r;if(1===u)for(i=0;ih)&&(f.push(s),t.numSimplified++),t.numPoints++;c.push(f)}else t.numPoints+=a.length;c.length&&t.features.push({geometry:c,type:u,tags:e.tags||null})}e.exports=n},{}],361:[function(t,e,r){"use strict";function n(t,e){if(t.transformed)return t;var r,n,o,a=t.z2,s=t.x,l=t.y;for(r=0;r0?(n=2*Math.sqrt(r+1),t[3]=.25*n,t[0]=(e[6]-e[9])/n,t[1]=(e[8]-e[2])/n,t[2]=(e[1]-e[4])/n):e[0]>e[5]&e[0]>e[10]?(n=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/n,t[0]=.25*n,t[1]=(e[1]+e[4])/n,t[2]=(e[8]+e[2])/n):e[5]>e[10]?(n=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/n,t[0]=(e[1]+e[4])/n,t[1]=.25*n,t[2]=(e[6]+e[9])/n):(n=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/n,t[0]=(e[8]+e[2])/n,t[1]=(e[6]+e[9])/n,t[2]=.25*n),t},i.fromRotationTranslationScale=function(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3],l=i+i,u=o+o,c=a+a,h=i*l,f=i*u,d=i*c,p=o*u,v=o*c,m=a*c,g=s*l,y=s*u,b=s*c,x=n[0],_=n[1],w=n[2];return t[0]=(1-(p+m))*x,t[1]=(f+b)*x,t[2]=(d-y)*x,t[3]=0,t[4]=(f-b)*_,t[5]=(1-(h+m))*_,t[6]=(v+g)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(v-g)*w,t[10]=(1-(h+p))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,r,n,i){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,h=s+s,f=o*u,d=o*c,p=o*h,v=a*c,m=a*h,g=s*h,y=l*u,b=l*c,x=l*h,_=n[0],w=n[1],M=n[2],k=i[0],A=i[1],T=i[2];return t[0]=(1-(v+g))*_,t[1]=(d+x)*_,t[2]=(p-b)*_,t[3]=0,t[4]=(d-x)*w,t[5]=(1-(f+g))*w,t[6]=(m+y)*w,t[7]=0,t[8]=(p+b)*M,t[9]=(m-y)*M,t[10]=(1-(f+v))*M,t[11]=0,t[12]=r[0]+k-(t[0]*k+t[4]*A+t[8]*T),t[13]=r[1]+A-(t[1]*k+t[5]*A+t[9]*T),t[14]=r[2]+T-(t[2]*k+t[6]*A+t[10]*T),t[15]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,h=n*s,f=i*a,d=i*s,p=i*l,v=o*a,m=o*s,g=o*l;return t[0]=1-h-p,t[1]=c+g,t[2]=f-m,t[3]=0,t[4]=c-g,t[5]=1-u-p,t[6]=d+v,t[7]=0,t[8]=f+m,t[9]=d-v,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,r,n,i,o,a){var s=1/(r-e),l=1/(i-n),u=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t},i.perspective=function(t,e,r,n,i){var o=1/Math.tan(e/2),a=1/(n-i);return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((a-s)*l*.5),t[9]=(i-o)*u*.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},i.ortho=function(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);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*u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(a+o)*u,t[15]=1,t},i.lookAt=function(t,e,r,o){var a,s,l,u,c,h,f,d,p,v,m=e[0],g=e[1],y=e[2],b=o[0],x=o[1],_=o[2],w=r[0],M=r[1],k=r[2];return Math.abs(m-w)l?(o.cross(t,e,i),o.length(t)<1e-6&&o.cross(t,r,i),o.normalize(t,t),s.setAxisAngle(n,t,Math.PI),n):l>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(o.cross(t,i,a),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+l,s.normalize(n,n))}}(),s.setAxes=function(){var t=i.create();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=a.clone,s.fromValues=a.fromValues,s.copy=a.copy,s.set=a.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,r){r=.5*r;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t},s.getAxisAngle=function(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return 0!=n?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r},s.add=a.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+a*s+i*u-o*l,t[1]=i*c+a*l+o*s-n*u,t[2]=o*c+a*u+n*l-i*s,t[3]=a*c-n*s-i*l-o*u,t},s.mul=s.multiply,s.scale=a.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+a*s,t[1]=i*l+o*s,t[2]=o*l-i*s,t[3]=a*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l-o*s,t[1]=i*l+a*s,t[2]=o*l+n*s,t[3]=a*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=i*l-n*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t},s.calculateW=function(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t},s.dot=a.dot,s.lerp=a.lerp,s.slerp=function(t,e,r,n){var i,o,a,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],v=r[2],m=r[3];return o=u*d+c*p+h*v+f*m,0>o&&(o=-o,d=-d,p=-p,v=-v,m=-m),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-n)*i)/a,l=Math.sin(n*i)/a):(s=1-n,l=n),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*v,t[3]=s*f+l*m,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,o,a,l){return s.slerp(t,n,a,l),s.slerp(e,i,o,l),s.slerp(r,t,e,2*l*(1-l)),r}}(),s.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o,s=a?1/a:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=o*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=a.length,s.len=s.length,s.squaredLength=a.squaredLength,s.sqrLen=s.squaredLength,s.normalize=a.normalize,s.fromMat3=function(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*a+a]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+a]-e[3*a+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[a]=(e[3*a+i]+e[3*i+a])*r}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=a.exactEquals,s.equals=a.equals,e.exports=s},{"./common.js":364,"./mat3.js":367,"./vec3.js":371,"./vec4.js":372}],370:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var r=new n.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,r){return t[0]=e,t[1]=r,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1];return e*e+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,e,r,n){var i=e[0],o=e[1];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t},i.transformMat2=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t},i.transformMat2d=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],o(t,t,a),e[s]=t[0],e[s+1]=t[1];return e}}(),i.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},i.equals=function(t,e){var r=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-a)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))},e.exports=i},{"./common.js":364}],371:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(3);return t[0]=0,t[1]=0,t[2]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},i.fromValues=function(t,e,r){var i=new n.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=r,i},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},i.set=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t},i.distance=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)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=i*l-o*s,t[1]=o*a-n*l,t[2]=n*s-i*a,t},i.lerp=function(t,e,r,n){var i=e[0],o=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t},i.hermite=function(t,e,r,n,i,o){var a=o*o,s=a*(2*o-3)+1,l=a*(o-2)+o,u=a*(o-1),c=a*(3-2*o);return t[0]=e[0]*s+r[0]*l+n[0]*u+i[0]*c,t[1]=e[1]*s+r[1]*l+n[1]*u+i[1]*c,t[2]=e[2]*s+r[2]*l+n[2]*u+i[2]*c,t},i.bezier=function(t,e,r,n,i,o){var a=1-o,s=a*a,l=o*o,u=s*a,c=3*o*s,h=3*l*a,f=l*o;return t[0]=e[0]*u+r[0]*c+n[0]*h+i[0]*f,t[1]=e[1]*u+r[1]*c+n[1]*h+i[1]*f,t[2]=e[2]*u+r[2]*c+n[2]*h+i[2]*f,t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI,i=2*n.RANDOM()-1,o=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*o,t[1]=Math.sin(r)*o,t[2]=i*e,t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return a=a||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/a,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,h=u*i+l*n-a*o,f=u*o+a*i-s*n,d=-a*n-s*i-l*o;return t[0]=c*u+d*-a+h*-l-f*-s,t[1]=h*u+d*-s+f*-a-c*-l,t[2]=f*u+d*-l+c*-s-h*-a,t},i.rotateX=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.rotateY=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.rotateZ=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}}(),i.angle=function(t,e){var r=i.fromValues(t[0],t[1],t[2]),n=i.fromValues(e[0],e[1],e[2]);i.normalize(r,r),i.normalize(n,n);var o=i.dot(r,n);return o>1?0:Math.acos(o)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=e[0],s=e[1],l=e[2];return Math.abs(r-a)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(o-l)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(l))},e.exports=i},{"./common.js":364}],372:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,r,i){var o=new n.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=r,o[3]=i,o},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0], -t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+o*o)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t},i.random=function(t,e){return e=e||1,t[0]=n.RANDOM(),t[1]=n.RANDOM(),t[2]=n.RANDOM(),t[3]=n.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,h=u*i+l*n-a*o,f=u*o+a*i-s*n,d=-a*n-s*i-l*o;return t[0]=c*u+d*-a+h*-l-f*-s,t[1]=h*u+d*-s+f*-a-c*-l,t[2]=f*u+d*-l+c*-s-h*-a,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}(),i.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=e[3];return Math.abs(r-s)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))},e.exports=i},{"./common.js":364}],373:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],e=o[1],r=o[2],this.d=e+2*r;for(var a=0;a=t&&i>=e&&r>=o&&n>=o)return this.keys.slice();var a=[],s={};return this._forEachCell(t,e,r,n,this._queryCell,a,s),a},n.prototype._queryCell=function(t,e,r,n,i,o,a){var s=this.cells[i];if(null!==s)for(var l=this.keys,u=this.bboxes,c=0;c=u[f+0]&&n>=u[f+1]?(a[h]=!0,o.push(l[h])):a[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,o,a){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;u>=h;h++)for(var f=l;c>=f;f++){var d=this.d*f+h;if(i.call(this,t,e,r,n,d,o,a))return}},n.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},n.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,r=0,n=0;n=t.stops.length)break;if(e<=t.stops[n][0])break;n++}return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:s(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e,r,n,i,o){return"function"==typeof i?function(){var a=i.apply(void 0,arguments),l=o.apply(void 0,arguments);return s(t,e,r,n,a,l)}:i.length?u(t,e,r,n,i,o):l(t,e,r,n,i,o)}function l(t,e,r,n,i,o){var a,s=n-r,l=t-r;return a=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-a)+o*a}function u(t,e,r,n,i,o){for(var a=[],s=0;s7)return[new n(c,l,"constants have been deprecated as of v8")];if(!(l in f.constants))return[new n(c,l,'constant "%s" not found',l)];e=o({},e,{value:f.constants[l]})}return u.function&&"object"===i(l)?r(e):u.type&&s[u.type]?s[u.type](e):a(o({},e,{valueSpec:u.type?h[u.type]:u}))}},{"../error/validation_error":376,"../util/extend":377,"../util/get_type":378,"./validate_array":381,"./validate_boolean":382,"./validate_color":383,"./validate_constants":384,"./validate_enum":385,"./validate_filter":386,"./validate_function":387,"./validate_layer":389,"./validate_number":391,"./validate_object":392,"./validate_source":394,"./validate_string":395}],381:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("./validate"),o=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.valueSpec,a=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==n(e))return[new o(l,e,"array expected, %s found",n(e))];if(r.length&&e.length!==r.length)return[new o(l,e,"array length %d expected, length %d found",r.length,e.length)];if(r["min-length"]&&e.length7)return r?[new n(e,r,"constants have been deprecated as of v8")]:[];var a=i(r);if("object"!==a)return[new n(e,r,"object expected, %s found",a)];var s=[];for(var l in r)"@"!==l[0]&&s.push(new n(e+"."+l,r[l],'constants must start with "@"'));return s}},{"../error/validation_error":376,"../util/get_type":378}],385:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,r=t.value,o=t.valueSpec,a=[];return-1===o.values.indexOf(i(r))&&a.push(new n(e,r,"expected one of [%s], %s found",o.values.join(", "),r)),a}},{"../error/validation_error":376,"../util/unbundle_jsonlint":379}],386:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_enum"),o=t("../util/get_type"),a=t("../util/unbundle_jsonlint");e.exports=function s(t){var e,r=t.value,l=t.key,u=t.styleSpec,c=[];if("array"!==o(r))return[new n(l,r,"array expected, %s found",o(r))];if(r.length<1)return[new n(l,r,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:r[0],valueSpec:u.filter_operator,style:t.style,styleSpec:t.styleSpec})),a(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"==r[1]&&c.push(new n(l,r,'"$type" cannot be use with operator "%s"',r[0]));case"==":case"!=":3!=r.length&&c.push(new n(l,r,'filter array for operator "%s" must have 3 elements',r[0]));case"in":case"!in":r.length>=2&&(e=o(r[1]),"string"!==e?c.push(new n(l+"[1]",r[1],"string expected, %s found",e)):"@"===r[1][0]&&c.push(new n(l+"[1]",r[1],"filter key cannot be a constant")));for(var h=2;ho.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,o.maximum)]:[]}},{"../error/validation_error":376,"../util/get_type":378}],392:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),o=t("./validate");e.exports=function(t){var e=t.key,r=t.value,a=t.valueSpec,s=t.objectElementValidators||{},l=t.style,u=t.styleSpec,c=[],h=i(r);if("object"!==h)return[new n(e,r,"object expected, %s found",h)];for(var f in r){var d=f.split(".")[0],p=a&&(a[d]||a["*"]),v=s[d]||s["*"];p||v?c=c.concat((v||o)({key:(e?e+".":e)+f,value:r[f],valueSpec:p,style:l,styleSpec:u,object:r,objectKey:f})):""!==e&&1!==e.split(".").length&&c.push(new n(e,r[f],'unknown property "%s"',f))}for(d in a)a[d].required&&void 0===a[d].default&&void 0===r[d]&&c.push(new n(e,r,'missing required property "%s"',d));return c}},{"../error/validation_error":376,"../util/get_type":378,"./validate":380}],393:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["paint_"+t.layerType],u=s.match(/^(.*)-transition$/);return u&&l[u[1]]&&l[u[1]].transition?n({key:e,value:a,valueSpec:o.transition,style:r,styleSpec:o}):t.valueSpec||l[s]?n({key:t.key,value:a,valueSpec:t.valueSpec||l[s],style:r,styleSpec:o}):[new i(e,a,'unknown property "%s"',s)]}},{"../error/validation_error":376,"./validate":380}],394:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),o=t("./validate_object"),a=t("./validate_enum");e.exports=function(t){var e=t.value,r=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new n(r,e,'"type" is required')];var u=i(e.type);switch(u){case"vector":case"raster":var c=[];if(c=c.concat(o({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var h in e)["type","url","tileSize"].indexOf(h)<0&&c.push(new n(r+"."+h,e[h],'a source with a "url" property may not include a "%s" property',h));return c;case"geojson":return o({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return o({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return o({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return a({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":376,"../util/unbundle_jsonlint":379,"./validate_enum":385,"./validate_object":392}],395:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,o=n(e);return"string"!==o?[new i(r,e,"string expected, %s found",o)]:[]}},{"../error/validation_error":376,"../util/get_type":378}],396:[function(t,e,r){"use strict";function n(t,e){e=e||l;var r=[];return r=r.concat(s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:u}})),e.$version>7&&t.constants&&(r=r.concat(a({key:"constants",value:t.constants,style:t,styleSpec:e}))),i(r)}function i(t){return[].concat(t).sort(function(t,e){return t.line-e.line})}function o(t){return function(){return i(t.apply(this,arguments))}}var a=t("./validate/validate_constants"),s=t("./validate/validate"),l=t("../reference/latest.min"),u=t("./validate/validate_glyphs_url");n.source=o(t("./validate/validate_source")),n.layer=o(t("./validate/validate_layer")),n.filter=o(t("./validate/validate_filter")),n.paintProperty=o(t("./validate/validate_paint_property")),n.layoutProperty=o(t("./validate/validate_layout_property")),e.exports=n},{"../reference/latest.min":398,"./validate/validate":380,"./validate/validate_constants":384,"./validate/validate_filter":386,"./validate/validate_glyphs_url":388,"./validate/validate_layer":389,"./validate/validate_layout_property":390,"./validate/validate_paint_property":393,"./validate/validate_source":394}],397:[function(t,e,r){e.exports=t("./v8.json")},{"./v8.json":399}],398:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":400}],399:[function(t,e,r){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8],doc:"Stylesheet version number. Must be 8.",example:8},name:{type:"string",doc:"A human-readable name for the style.",example:"Bright"},metadata:{type:"*",doc:"Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},center:{type:"array",value:"number",doc:"Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:[-73.9749,40.7736]},zoom:{type:"number",doc:"Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:12.5},bearing:{type:"number","default":0,period:360,units:"degrees",doc:"Default bearing, in degrees. The style bearing will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:29},pitch:{type:"number","default":0,units:"degrees",doc:"Default pitch, in degrees. Zero is perpendicular to the surface. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:50},sources:{required:!0,type:"sources",doc:"Data source specifications.",example:{"mapbox-streets":{type:"vector",url:"mapbox://mapbox.mapbox-streets-v6"}}},sprite:{type:"string",doc:"A base URL for retrieving the sprite image and metadata. The extensions `.png`, `.json` and scale factor `@2x.png` will be automatically appended. This property is required if any layer uses the 'sprite-image' layout property.",example:"mapbox://sprites/mapbox/bright-v8"},glyphs:{type:"string",doc:"A URL template for loading signed-distance-field glyph sets in PBF format. The URL must include `{fontstack}` and `{range}` tokens. This property is required if any layer uses the 'text-field' layout property.",example:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},transition:{type:"transition",doc:"A global transition definition to use as a default across properties.",example:{duration:300,delay:0}},layers:{required:!0,type:"array",value:"layer",doc:"Layers will be drawn in the order of this array.",example:[{id:"water",source:"mapbox-streets","source-layer":"water",type:"fill",paint:{"fill-color":"#00ffff"}}]}},sources:{"*":{type:"source",doc:"Specification of a data source. For vector and raster sources, either TileJSON or a URL to a TileJSON must be provided. For GeoJSON and video sources, a URL must be provided."}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"],doc:"The data type of the tile source."},url:{type:"string",doc:"A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://`."},tiles:{type:"array",value:"string",doc:"An array of one or more tile source URLs, as in the TileJSON spec."},minzoom:{type:"number","default":0,doc:"Minimum zoom level for which tiles are available, as in the TileJSON spec."},maxzoom:{type:"number","default":22,doc:"Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."},tileSize:{type:"number","default":512,units:"pixels",doc:"The minimum visual size to display tiles for this layer. Only configurable for raster layers."},"*":{type:"*",doc:"Other keys to configure the data source."}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"],doc:"The data type of the GeoJSON source."},data:{type:"*",doc:"A URL to a GeoJSON file, or inline GeoJSON."},maxzoom:{type:"number","default":14,doc:"Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."},buffer:{type:"number","default":64,doc:"Tile buffer size on each side (higher means fewer rendering artifacts near tile edges but slower performance)."},tolerance:{type:"number","default":3,doc:"Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance)."},cluster:{type:"boolean","default":!1,doc:"If the data is a collection of point features, setting this to true clusters the points by radius into groups."},clusterRadius:{type:"number","default":400,doc:"Radius of each cluster when clustering points, relative to 4096 tile."},clusterMaxZoom:{type:"number",doc:"Max zoom to cluster points on. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered)."}},source_video:{type:{required:!0,type:"enum",values:["video"],doc:"The data type of the video source."},urls:{required:!0,type:"array",value:"string",doc:"URLs to video content in order of preferred format."},coordinates:{required:!0,doc:"Corners of video specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},source_image:{type:{required:!0,type:"enum",values:["image"],doc:"The data type of the image source."},url:{required:!0,type:"string",doc:"URL that points to an image"},coordinates:{required:!0,doc:"Corners of image specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},layer:{id:{type:"string",doc:"Unique layer name.",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"],doc:"Rendering type of this layer."},metadata:{type:"*",doc:"Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},ref:{type:"string",doc:"References another layer to copy `type`, `source`, `source-layer`, `minzoom`, `maxzoom`, `filter`, and `layout` properties from. This allows the layers to share processing and be more efficient."},source:{type:"string",doc:"Name of a source description to be used for this layer."},"source-layer":{type:"string",doc:"Layer to use from a vector tile source. Required if the source supports multiple layers."},minzoom:{type:"number",minimum:0,maximum:22,doc:"The minimum zoom level on which the layer gets parsed and appears on."},maxzoom:{type:"number",minimum:0,maximum:22,doc:"The maximum zoom level on which the layer gets parsed and appears on."},interactive:{type:"boolean",doc:"Enable querying of feature data from this layer for interactivity.","default":!1},filter:{type:"filter",doc:"A expression specifying conditions on source features. Only features that match the filter are displayed."},layout:{type:"layout",doc:"Layout properties for the layer."},paint:{type:"paint",doc:"Default paint properties for this layer."},"paint.*":{type:"paint",doc:"Class-specific paint properties for this layer. The class name is the part after the first dot." -}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant",values:["butt","round","square"],"default":"butt",doc:"The display of line endings."},"line-join":{type:"enum","function":"piecewise-constant",values:["bevel","round","miter"],"default":"miter",doc:"The display of lines when joining."},"line-miter-limit":{type:"number","default":2,"function":"interpolated",doc:"Used to automatically convert miter joins to bevel joins for sharp angles.",requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number","default":1.05,"function":"interpolated",doc:"Used to automatically convert round joins to miter joins for shallow angles.",requires:[{"line-join":"round"}]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant",values:["point","line"],"default":"point",doc:"Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons."},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated",units:"pixels",doc:"Distance between two symbol anchors.",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer."},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the icon will be visible even if it collides with other previously drawn symbols.",requires:["icon-image"]},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, other symbols can be visible even if they collide with the icon.",requires:["icon-image"]},"icon-optional":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.",requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",doc:"Orientation of icon when map is rotated.",requires:["icon-image"]},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated",doc:"Scale factor for icon. 1 is original size, 3 triples the size.",requires:["icon-image"]},"icon-image":{type:"string","function":"piecewise-constant",doc:"A string with {tokens} replaced, referencing the data property to pull from.",tokens:!0},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated",units:"degrees",doc:"Rotates the icon clockwise.",requires:["icon-image"]},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated",units:"pixels",doc:"Size of the additional area around the icon bounding box used for detecting symbol collisions.",requires:["icon-image"]},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the icon may be flipped to prevent it from being rendered upside-down.",requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",doc:"Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"]},"text-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",doc:"Orientation of text when map is rotated.",requires:["text-field"]},"text-field":{type:"string","function":"piecewise-constant","default":"",tokens:!0,doc:"Value to use for a text label. Feature properties are specified using tokens like {field_name}."},"text-font":{type:"array",value:"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],doc:"Font stack to use for displaying text.",requires:["text-field"]},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated",doc:"Font size.",requires:["text-field"]},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated",doc:"The maximum line width for text wrapping.",requires:["text-field"]},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated",doc:"Text leading value for multi-line text.",requires:["text-field"]},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated",doc:"Text tracking amount.",requires:["text-field"]},"text-justify":{type:"enum","function":"piecewise-constant",values:["left","center","right"],"default":"center",doc:"Text justification options.",requires:["text-field"]},"text-anchor":{type:"enum","function":"piecewise-constant",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",doc:"Part of the text placed closest to the anchor.",requires:["text-field"]},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated",doc:"Maximum angle change between adjacent characters.",requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated",doc:"Rotates the text clockwise.",requires:["text-field"]},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated",doc:"Size of the additional area around the text bounding box used for detecting symbol collisions.",requires:["text-field"]},"text-keep-upright":{type:"boolean","function":"piecewise-constant","default":!0,doc:"If true, the text may be flipped vertically to prevent it from being rendered upside-down.",requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum","function":"piecewise-constant",values:["none","uppercase","lowercase"],"default":"none",doc:"Specifies how to capitalize text, similar to the CSS `text-transform` property.",requires:["text-field"]},"text-offset":{type:"array",doc:"Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.",value:"number",units:"ems","function":"interpolated",length:2,"default":[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the text will be visible even if it collides with other previously drawn symbols.",requires:["text-field"]},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, other symbols can be visible even if they collide with the text.",requires:["text-field"]},"text-optional":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.",requires:["text-field","icon-image"]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},filter:{type:"array",value:"*",doc:"A filter selects specific features from a layer."},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"],doc:"The filter operator."},geometry_type:{type:"enum",values:["Point","LineString","Polygon"],doc:"The geometry type for the filter to select."},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"],doc:"A color operation to apply."},"function":{stops:{type:"array",required:!0,doc:"An array of stops.",value:"function_stop"},base:{type:"number","default":1,minimum:0,doc:"The exponential base of the interpolation curve. It controls the rate at which the result increases. Higher values make the result increase more towards the high end of the range. With `1` the stops are interpolated linearly."},property:{type:"string",doc:"The name of a global property or feature property to use as the function input.","default":"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],doc:"The interpolation strategy to use in function evaluation.","default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2,doc:"Zoom level and value pair."},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","default":!0,doc:"Whether or not the fill should be antialiased."},"fill-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,doc:"The opacity given to the fill color.",transition:!0},"fill-color":{type:"color","default":"#000000",doc:"The color of the fill.","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color",doc:"The outline color of the fill. Matches the value of `fill-color` if unspecified.","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"fill-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["fill-translate"]},"fill-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)."}},paint_line:{"line-opacity":{type:"number",doc:"The opacity at which the line will be drawn.","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color",doc:"The color with which the line will be drawn.","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"line-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["line-translate"]},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Stroke thickness."},"line-gap-width":{type:"number","default":0,minimum:0,doc:"Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.","function":"interpolated",transition:!0,units:"pixels"},"line-offset":{type:"number","default":0,doc:'The line\'s offset perpendicular to its direction. Values may be positive or negative, where positive indicates "rightwards" (if you were moving in the direction of the line) and negative indicates "leftwards."',"function":"interpolated",transition:!0,units:"pixels"},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Blur applied to the line, in pixels."},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant",doc:"Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512)."}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Circle radius."},"circle-color":{type:"color","default":"#000000",doc:"The color of the circle.","function":"interpolated",transition:!0},"circle-blur":{type:"number","default":0,doc:"Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.","function":"interpolated",transition:!0},"circle-opacity":{type:"number",doc:"The opacity at which the circle will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"circle-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["circle-translate"]}},paint_symbol:{"icon-opacity":{doc:"The opacity at which the icon will be drawn.",type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["icon-image"]},"icon-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,doc:"The color of the icon. This can only be used with sdf icons.",requires:["icon-image"]},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,doc:"The color of the icon's halo. Icon halos can only be used with sdf icons.",requires:["icon-image"]},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Distance of halo to the icon outline.",requires:["icon-image"]},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Fade out the halo towards the outside.",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"]},"icon-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number",doc:"The opacity at which the text will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["text-field"]},"text-color":{type:"color",doc:"The color with which the text will be drawn.","default":"#000000","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,doc:"The color of the text's halo, which helps it stand out from backgrounds.",requires:["text-field"]},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.",requires:["text-field"]},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"The halo's fadeout distance towards the outside.",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["text-field"]},"text-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number",doc:"The opacity at which the image will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated",transition:!0,units:"degrees",doc:"Rotates hues around the color wheel."},"raster-brightness-min":{type:"number","function":"interpolated",doc:"Increase or reduce the brightness of the image. The value is the minimum brightness.","default":0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number","function":"interpolated",doc:"Increase or reduce the brightness of the image. The value is the maximum brightness.","default":1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number",doc:"Increase or reduce the saturation of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-contrast":{type:"number",doc:"Increase or reduce the contrast of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated",transition:!0,units:"milliseconds",doc:"Fade duration when a new tile is added."}},paint_background:{"background-color":{type:"color","default":"#000000",doc:"The color with which the background will be drawn.","function":"interpolated",transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)."},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,doc:"The opacity at which the background will be drawn.","function":"interpolated",transition:!0}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds",doc:"Time allotted for transitions to complete."},delay:{type:"number","default":0,minimum:0,units:"milliseconds",doc:"Length of time before a transition begins."}}}},{}],400:[function(t,e,r){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number","default":0,period:360,units:"degrees"},pitch:{type:"number","default":0,units:"degrees"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number","default":0},maxzoom:{type:"number","default":22},tileSize:{type:"number","default":512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number","default":14},buffer:{type:"number","default":64},tolerance:{type:"number","default":3},cluster:{type:"boolean","default":!1},clusterRadius:{type:"number","default":400},clusterMaxZoom:{type:"number"}},source_video:{type:{required:!0,type:"enum",values:["video"]},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:["image"]},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean","default":!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant",values:["butt","round","square"],"default":"butt"},"line-join":{type:"enum","function":"piecewise-constant",values:["bevel","round","miter"],"default":"miter"},"line-miter-limit":{type:"number","default":2,"function":"interpolated",requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number","default":1.05,"function":"interpolated",requires:[{"line-join":"round"}]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant",values:["point","line"],"default":"point"},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated",units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","default":!1},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image"]},"icon-optional":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",requires:["icon-image"]},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated",requires:["icon-image"]},"icon-image":{type:"string","function":"piecewise-constant",tokens:!0},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated",units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated",units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",requires:["icon-image"]},"text-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",requires:["text-field"]},"text-field":{type:"string","function":"piecewise-constant","default":"",tokens:!0},"text-font":{type:"array",value:"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated",requires:["text-field"]},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated",requires:["text-field"]},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated",requires:["text-field"]},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated",requires:["text-field"]},"text-justify":{type:"enum","function":"piecewise-constant",values:["left","center","right"],"default":"center",requires:["text-field"]},"text-anchor":{type:"enum","function":"piecewise-constant",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",requires:["text-field"]},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated",requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated",requires:["text-field"]},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated",requires:["text-field"]},"text-keep-upright":{type:"boolean","function":"piecewise-constant","default":!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum","function":"piecewise-constant",values:["none","uppercase","lowercase"],"default":"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems","function":"interpolated",length:2,"default":[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field"]},"text-optional":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field","icon-image"]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},geometry_type:{type:"enum",values:["Point","LineString","Polygon"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},"function":{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number","default":1,minimum:0},property:{type:"string","default":"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],"default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","default":!0},"fill-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["fill-translate"]},"fill-pattern":{type:"string","function":"piecewise-constant",transition:!0}},paint_line:{"line-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["line-translate"]},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-gap-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-offset":{type:"number","default":0,"function":"interpolated",transition:!0,units:"pixels"},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string","function":"piecewise-constant",transition:!0}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"circle-color":{type:"color","default":"#000000","function":"interpolated",transition:!0},"circle-blur":{type:"number","default":0,"function":"interpolated",transition:!0},"circle-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["circle-translate"]}},paint_symbol:{"icon-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["icon-image"]},"icon-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["text-field"]},"text-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated",transition:!0,units:"degrees"},"raster-brightness-min":{type:"number","function":"interpolated","default":0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated", -transition:!0},"raster-contrast":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated",transition:!0,units:"milliseconds"}},paint_background:{"background-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string","function":"piecewise-constant",transition:!0},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds"},delay:{type:"number","default":0,minimum:0,units:"milliseconds"}}}},{}],401:[function(t,e,r){"use strict";function n(t){var e;t&&t.length&&(e=t,t=e.length);var r=new Uint8Array(t||0);return e&&r.set(e),r.readUInt32LE=o.readUInt32LE,r.writeUInt32LE=o.writeUInt32LE,r.readInt32LE=o.readInt32LE,r.writeInt32LE=o.writeInt32LE,r.readFloatLE=o.readFloatLE,r.writeFloatLE=o.writeFloatLE,r.readDoubleLE=o.readDoubleLE,r.writeDoubleLE=o.writeDoubleLE,r.toString=o.toString,r.write=o.write,r.slice=o.slice,r.copy=o.copy,r._isBuffer=!0,r}function i(t){for(var e,r,n=t.length,i=[],o=0;n>o;o++){if(e=t.charCodeAt(o),e>55295&&57344>e){if(!r){e>56319||o+1===n?i.push(239,191,189):r=e;continue}if(56320>e){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);128>e?i.push(e):2048>e?i.push(e>>6|192,63&e|128):65536>e?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=n;var o,a,s,l=t("ieee754");o={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var o=e;r>o;o++){var a=this[o];127>=a?(n+=decodeURIComponent(i)+String.fromCharCode(a),i=""):i+="%"+a.toString(16)}return n+=decodeURIComponent(i)},write:function(t,e){for(var r=t===a?s:i(t),n=0;nr)return t;if(r=n[e.pos++],t+=34359738368*(127&r),128>r)return t;if(r=n[e.pos++],t+=4398046511104*(127&r),128>r)return t;if(r=n[e.pos++],t+=562949953421312*(127&r),128>r)return t;if(r=n[e.pos++],t+=72057594037927940*(127&r),128>r)return t;if(r=n[e.pos++],t+=0x8000000000000000*(127&r),128>r)return t;throw new Error("Expected varint not more than 10 bytes")}function o(t,e){e.realloc(10);for(var r=e.pos+10;t>=1;){if(e.pos>=r)throw new Error("Given varint doesn't fit into 10 bytes");var n=255&t;e.buf[e.pos++]=n|(t>=128?128:0),t/=128}}function a(t,e,r){var n=16383>=e?1:2097151>=e?2:268435455>=e?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function s(t,e){for(var r=0;r>3,o=this.pos;t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*g;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*g;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,r=this.buf;return e=r[this.pos++],t=127&e,128>e?t:(e=r[this.pos++],t|=(127&e)<<7,128>e?t:(e=r[this.pos++],t|=(127&e)<<14,128>e?t:(e=r[this.pos++],t|=(127&e)<<21,128>e?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(b>e)return e;for(var r=this.pos-2;255===this.buf[r];)r--;t>r&&(r=t),e=0;for(var n=0;r-t+1>n;n++){var i=127&~this.buf[t+n];e+=4>n?i<<7*n:i*Math.pow(2,7*n)}return-e-1},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.buf.toString("utf8",this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.slice(this.pos,t);return this.pos=t,e},readPackedVarint:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455?void o(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=t>>>7&127)))))},writeSVarint:function(t){this.writeVarint(0>t?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);var e=m.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;e>r;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&a(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,n.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,s,e)},writePackedSVarint:function(t,e){this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){this.writeMessage(t,h,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,f,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedFixed64:function(t,e){this.writeMessage(t,p,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,v,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":401}],403:[function(t,e,r){arguments[4][55][0].apply(r,arguments)},{dup:55}],404:[function(t,e,r){"use strict";function n(t,e){this.x=t,this.y=e}e.exports=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(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)},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[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,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},_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=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{}],405:[function(e,r,n){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof n?r.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(e,r.firstChild);for(var n,i=document.createElement("a"),o=1;t>o;o++)i.href=arguments[o],n=i.href,e.href=n;return r.removeChild(e),n}return t})},{}],406:[function(t,e,r){"use strict";function n(t,e,r){r=r||{},this.w=t||64,this.h=e||64,this.autoResize=!!r.autoResize,this.shelves=[],this.stats={},this.count=function(t){this.stats[t]=(0|this.stats[t])+1}}function i(t,e,r){this.x=0,this.y=t,this.w=this.free=e,this.h=r}e.exports=n,n.prototype.pack=function(t,e){t=[].concat(t),e=e||{};for(var r,n,i,o=[],a=0;ar.h||t>r.free||e=c||t>c)&&(h=2*Math.max(t,c)),(c>l||e>l)&&(u=2*Math.max(e,l)),this.resize(h,u),this.packOne(t,e)}return null},n.prototype.clear=function(){this.shelves=[],this.stats={}},n.prototype.resize=function(t,e){if(tthis.free||e>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,{x:r,y:this.y,w:t,h:e,width:t,height:e}},i.prototype.resize=function(t){return t=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:r}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return 0>r?0:r>1?1:r}function h(t){return 360*(t-.5)}function f(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function d(t,e){for(var r in e)t[r]=e[r];return t}function p(t){return t.x}function v(t){return t.y}var m=t("kdbush");e.exports=n,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(a);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var o=+Date.now();this.trees[i+1]=m(n,p,v,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-o)}return this.trees[this.options.minZoom]=m(n,p,v,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],o=0;o=f-d)for(var p=d;f>=p;p++)s=e[2*p],l=e[2*p+1],s>=r&&i>=s&&l>=n&&o>=l&&c.push(t[p]);else{var v=Math.floor((d+f)/2);s=e[2*v],l=e[2*v+1],s>=r&&i>=s&&l>=n&&o>=l&&c.push(t[v]);var m=(h+1)%2;(0===h?s>=r:l>=n)&&(u.push(d),u.push(v-1),u.push(m)),(0===h?i>=s:o>=l)&&(u.push(v+1),u.push(f),u.push(m))}}return c}e.exports=n},{}],410:[function(t,e,r){"use strict";function n(t,e,r,o,a,s){if(!(r>=a-o)){var l=Math.floor((o+a)/2);i(t,e,l,o,a,s%2),n(t,e,r,o,l-1,s+1),n(t,e,r,l+1,a,s+1)}}function i(t,e,r,n,a,s){for(;a>n;){if(a-n>600){var l=a-n+1,u=r-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(0>u-l/2?-1:1),d=Math.max(n,Math.floor(r-u*h/l+f)),p=Math.min(a,Math.floor(r+(l-u)*h/l+f));i(t,e,r,d,p,s)}var v=e[2*r+s],m=n,g=a;for(o(t,e,n,r),e[2*a+s]>v&&o(t,e,n,a);g>m;){for(o(t,e,m,g),m++,g--;e[2*m+s]v;)g--}e[2*n+s]===v?o(t,e,n,g):(g++,o(t,e,g,a)),r>=g&&(n=g+1),g>=r&&(a=g-1)}}function o(t,e,r,n){a(t,r,n),a(e,2*r,2*n),a(e,2*r+1,2*n+1)}function a(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],411:[function(t,e,r){"use strict";function n(t,e,r,n,o,a){for(var s=[0,t.length-1,0],l=[],u=o*o;s.length;){var c=s.pop(),h=s.pop(),f=s.pop();if(a>=h-f)for(var d=f;h>=d;d++)i(e[2*d],e[2*d+1],r,n)<=u&&l.push(t[d]);else{var p=Math.floor((f+h)/2),v=e[2*p],m=e[2*p+1];i(v,m,r,n)<=u&&l.push(t[p]);var g=(c+1)%2;(0===c?v>=r-o:m>=n-o)&&(s.push(f),s.push(p-1),s.push(g)),(0===c?r+o>=v:n+o>=m)&&(s.push(p+1),s.push(h),s.push(g))}}return l}function i(t,e,r,n){var i=t-r,o=e-n;return i*i+o*o}e.exports=n},{}],412:[function(t,e,r){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}e.exports=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){"undefined"==typeof e&&(e=1e-6);var r,n,i,o,a;for(i=t,a=0;8>a;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)i)return r;if(i>n)return n;for(;n>r;){if(o=this.sampleCurveX(i),Math.abs(o-t)o?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],413:[function(t,e,r){e.exports.VectorTile=t("./lib/vectortile.js"),e.exports.VectorTileFeature=t("./lib/vectortilefeature.js"),e.exports.VectorTileLayer=t("./lib/vectortilelayer.js")},{"./lib/vectortile.js":414,"./lib/vectortilefeature.js":415,"./lib/vectortilelayer.js":416}],414:[function(t,e,r){"use strict";function n(t,e){this.layers=t.readFields(i,{},e)}function i(t,e,r){if(3===t){var n=new o(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}var o=t("./vectortilelayer");e.exports=n},{"./vectortilelayer":416}],415:[function(t,e,r){"use strict";function n(t,e,r,n,o){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=o,t.readFields(i,this,e)}function i(t,e,r){1==t?e._id=r.readVarint():2==t?o(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function o(t,e){for(var r=t.readVarint()+t.pos;t.pos=e)return[t];for(var r,n,i=[],o=0;e>o;o++){var a=s(t[o]);0!==a&&(void 0===n&&(n=0>a),n===0>a?(r&&i.push(r),r=[t[o]]):r.push(t[o]))}return r&&i.push(r),i}function s(t){for(var e,r,n=0,i=0,o=t.length,a=o-1;o>i;a=i++)e=t[i],r=t[a],n+=(r.x-e.x)*(e.y+r.y);return n}var l=t("point-geometry");e.exports=n,n.types=["Unknown","Point","LineString","Polygon"],n.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,o=0,a=0,s=[];t.pos>3}if(i--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new l(o,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},n.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-(1/0),l=1/0,u=-(1/0);t.pos>3}if(n--,1===r||2===r)i+=t.readSVarint(),o+=t.readSVarint(),a>i&&(a=i),i>s&&(s=i),l>o&&(l=o),o>u&&(u=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,s,u]},n.prototype.toGeoJSON=function(t,e,r){function i(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}var a=t("./vectortilefeature.js");e.exports=n,n.prototype.feature=function(t){if(0>t||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new a(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":415}],417:[function(t,e,r){function n(t){var e=[];for(var r in t.layers)e.push(o(t.layers[r]));var n=new c;return h.tile.write({layers:e},n),n.finish()}function i(t){var e={};for(var r in t)e[r]=new f(t[r].features),e[r].name=r;return n({layers:e})}function o(t){for(var e={name:t.name||"",version:t.version||1,extent:t.extent||4096,keys:[],values:[],features:[]},r={},n={},i=0;i>31}function l(t){for(var e=[],r=0,n=0,i=t.length,o=0;i>o;o++){var l=t[o];e.push(a(1,1));for(var u=0;ut?{sint_value:t}:{uint_value:t}:{string_value:""+t},e.key=r+":"+t,e}var c=t("pbf"),h=t("./vector-tile-pb"),f=t("./lib/geojson_wrapper");e.exports=n,e.exports.fromVectorTileJs=n,e.exports.fromGeojsonVt=i,e.exports.GeoJSONWrapper=f},{"./lib/geojson_wrapper":418,"./vector-tile-pb":419,pbf:402}],418:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length}function i(t){this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=4096}var o=t("point-geometry"),a=t("vector-tile").VectorTileFeature;e.exports=n,n.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;el;l++){var c=s[l],h=o[c].exports;if(h===t||h&&h.default===t){r=c;break}}if(!r){r=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var f={},l=0,u=s.length;u>l;l++){var c=s[l];f[c]=c}i[r]=[Function(["require","module","exports"],"("+t+")(self)"),f]}var d=Math.floor(Math.pow(16,8)*Math.random()).toString(16),p={};p[r]=r,i[d]=[Function(["require"],"var f = require("+a(r)+");(f.default ? f.default : f)(self);"),p];var v="("+n+")({"+Object.keys(i).map(function(t){return a(t)+":["+i[t][0]+","+a(i[t][1])+"]"}).join(",")+"},{},["+a(d)+"])",m=window.URL||window.webkitURL||window.mozURL||window.msURL,g=new Blob([v],{type:"text/javascript"});if(e&&e.bare)return g;var y=m.createObjectURL(g),b=new Worker(y);return"function"==typeof m.revokeObjectURL&&m.revokeObjectURL(y),b}},{}],421:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==v.alt,v.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==v.shift,v.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==v.control,v.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==v.meta,v.meta=!!t.metaKey),e}function n(t,n){var o=i.x(n),a=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==f||o!==d||a!==p||r(n))&&(f=0|t,d=o||0,p=a||0,e(f,d,p,v))}function o(t){n(0,t)}function a(){(f||d||p||v.shift||v.alt||v.meta||v.control)&&(d=p=0,f=0,v.shift=v.alt=v.control=v.meta=!1,e(0,0,0,v))}function s(t){r(t)&&e(f,d,p,v)}function l(t){0===i.buttons(t)?n(0,t):n(f,t)}function u(t){n(f|i.buttons(t),t)}function c(t){n(f&~i.buttons(t),t)}function h(){m||(m=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",o),t.addEventListener("mouseenter",o),t.addEventListener("mouseout",o),t.addEventListener("mouseover",o),t.addEventListener("blur",a),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",a),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var f=0,d=0,p=0,v={shift:!1,alt:!1,control:!1,meta:!1},m=!1;h();var g={element:t};return Object.defineProperties(g,{enabled:{get:function(){return m},set:function(t){t&&h()},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return v},enumerable:!0}}),g}e.exports=n;var i=t("mouse-event")},{"mouse-event":422}],422:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0&&r=0&&r+1=0&&n=0&&n+1=0&&s=0&&s+1=0&&i=0&&i+1=0&&l=0&&l+1=0&&f=0&&f+1e;++e)r=+arguments[e+1],i[e]=Math.floor(r),o[e]=r-i[e],a[e]=0<=i[e]&&i[e]e;++e){for(u=1,c=t.offset,l=0;n>l;++l)if(e&1<r;++r){t[r]=a[(n+1)*n+r];for(var i=0;n>i;++i)t[r]+=a[(n+1)*i+r]*e[i]}for(var o=a[(n+1)*(n+1)-1],i=0;n>i;++i)o+=a[(n+1)*i+n]*e[i];for(var s=1/o,r=0;n>r;++r)t[r]*=s;return t}),t}var i=t("ndarray-warp"),o=t("gl-matrix-invert");e.exports=n},{"gl-matrix-invert":427,"ndarray-warp":430}],432:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var h=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=a({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=a({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=a({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":115}],433:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;te&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var o="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}",a=new Function(o);return a()}if(0===e){var o="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}",a=new Function("TrivialArray",o);return a(h[t][0])}var o=["'use strict'"],s=l(e),u=s.map(function(t){return"i"+t}),c="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),f=s.map(function(t){return"b"+t}).join(","),d=s.map(function(t){return"c"+t}).join(",");o.push("function "+r+"(a,"+f+","+d+",d){this.data=a","this.shape=["+f+"]","this.stride=["+d+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),o.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>e?(o.push("function "+r+"_order(){"),2===e?o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?o.push("return this.data.set("+c+",v)}"):o.push("return this.data["+c+"]=v}"),o.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?o.push("return this.data.get("+c+")}"):o.push("return this.data["+c+"]}"),o.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),o.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),v=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+v.join(","));for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'&&i"+m+">=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),o.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'){d=i"+m+"|0;if(d<0){c+=b"+m+"*(a"+m+"-1);a"+m+"=ceil(-a"+m+"/d)}else{a"+m+"=ceil(a"+m+"/d)}b"+m+"*=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");for(var g=new Array(e),y=new Array(e),m=0;e>m;++m)g[m]="a[i"+m+"]",y[m]="b[i"+m+"]";o.push("proto.transpose=function "+r+"_transpose("+u+"){"+u.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+g.join(",")+","+y.join(",")+",this.offset)}"),o.push("proto.pick=function "+r+"_pick("+u+"){var a=[],b=[],c=this.offset");for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'&&i"+m+">=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var a=new Function("CTOR_LIST","ORDER",o.join("\n"));return a(h[t],i)}function a(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=h.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;s>l;++l)r[l]<0&&(n-=(e[l]-1)*r[l])}for(var c=a(t),f=h[c];f.length<=s+1;)f.push(o(c,f.length-1));var i=f[s+1];return i(t,e,r,n)}var l=t("iota-array"),u=t("is-buffer"),c="undefined"!=typeof Float64Array,h={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s},{"iota-array":245,"is-buffer":246}],434:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,o="");r>o.length&&e>0&&(1&e&&(o+=t),e>>=1);)t+=t;return o.substr(0,r)}var i,o="";e.exports=n},{}],435:[function(t,e,r){(function(t){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],436:[function(t,e,r){"use strict";function n(t){for(var e="robustLinearSolve"+t+"d",r=["function ",e,"(A,b){return ["],n=0;t>n;++n){r.push("det([");for(var i=0;t>i;++i){i>0&&r.push(","),r.push("[");for(var o=0;t>o;++o)o>0&&r.push(","),o===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",o,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var a=new Function("det",r.join(""));return a(6>t?s[t]:s)}function i(){return[0]}function o(t,e){return[[e[0]],[t[0][0]]]}function a(){for(;u.lengthi;++i)t.push("s"+i),r.push("case ",i,":return s",i,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);e.exports=o.apply(void 0,u.concat([u,n]));for(var i=0;l>i;++i)e.exports[i]=u[i]}var s=t("robust-determinant"),l=6,u=[i,o];a()},{"robust-determinant":438}],437:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var o=r,a=t[i];r=o+a;var s=r-o,l=a-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;e>i;++i){var o=t[i],a=r;r=o+a;var s=r-o,l=a-s;l&&(t[u++]=l)}return t[u++]=r,t.length=u,t}e.exports=n},{}],438:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m[",r,"][",n,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;rn;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var i=Function.apply(void 0,t);e.exports=i.apply(void 0,v.concat([v,l]));for(var n=0;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;ru;++u)0===(1&u)?e.push.apply(e,s(n(o,u))):r.push.apply(r,s(n(o,u))),l.push("m"+u);var c=a(e),v=a(r),m="orientation"+t+"Exact",g=["function ",m,"(",l.join(),"){var p=",c,",n=",v,",d=sub(p,n);return d[d.length-1];};return ",m].join(""),y=new Function("sum","prod","scale","sub",g);return y(f,h,d,p)}function u(t){var e=_[t.length];return e||(e=_[t.length]=l(t.length)),e.apply(void 0,t)}function c(){for(;_.length<=v;)_.push(l(_.length));for(var t=[],r=["slow"],n=0;v>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;v>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i=n;++n)e.exports[n]=_[n]}var h=t("two-product"),f=t("robust-sum"),d=t("robust-scale"),p=t("robust-subtract"),v=5,m=1.1102230246251565e-16,g=(3+16*m)*m,y=(7+56*m)*m,b=l(3),x=l(4),_=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,r){var n,i=(t[1]-r[1])*(e[0]-r[0]),o=(t[0]-r[0])*(e[1]-r[1]),a=i-o;if(i>0){if(0>=o)return a;n=i+o}else{if(!(0>i))return a;if(o>=0)return a;n=-(i+o)}var s=g*n;return a>=s||-s>=a?a:b(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],o=e[0]-n[0],a=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],u=r[1]-n[1],c=t[2]-n[2],h=e[2]-n[2],f=r[2]-n[2],d=o*u,p=a*l,v=a*s,m=i*u,g=i*l,b=o*s,_=c*(d-p)+h*(v-m)+f*(g-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(v)+Math.abs(m))*Math.abs(h)+(Math.abs(g)+Math.abs(b))*Math.abs(f),M=y*w;return _>M||-_>M?_:x(t,e,r,n)}];c()},{"robust-scale":440,"robust-subtract":441,"robust-sum":442,"two-product":456}],440:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if(1===r){var n=i(t[0],e);return n[0]?n:[n[1]]}var a=new Array(2*r),s=[.1,.1],l=[.1,.1],u=0;i(t[0],e,s),s[0]&&(a[u++]=s[0]);for(var c=1;r>c;++c){i(t[c],e,l);var h=s[1];o(h,l[0],s),s[0]&&(a[u++]=s[0]);var f=l[1],d=s[1],p=f+d,v=p-f,m=d-v;s[1]=p,m&&(a[u++]=m)}return s[1]&&(a[u++]=s[1]),0===u&&(a[u++]=0),a.length=u,a}var i=t("two-product"),o=t("two-sum");e.exports=n},{"two-product":456,"two-sum":457}],441:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,o=e-n,a=t-i,s=a+o;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var o,a,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,d=t[c],p=f(d),v=-e[h],m=f(v);m>p?(a=d,c+=1,r>c&&(d=t[c],p=f(d))):(a=v,h+=1,i>h&&(v=-e[h],m=f(v))),r>c&&m>p||h>=i?(o=d,c+=1,r>c&&(d=t[c],p=f(d))):(o=v,h+=1,i>h&&(v=-e[h],m=f(v)));for(var g,y,b,x,_,w=o+a,M=w-o,k=a-M,A=k,T=w;r>c&&i>h;)m>p?(o=d,c+=1,r>c&&(d=t[c],p=f(d))):(o=v,h+=1,i>h&&(v=-e[h],m=f(v))),a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g;for(;r>c;)o=d,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g,c+=1,r>c&&(d=t[c]);for(;i>h;)o=v,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g,h+=1,i>h&&(v=-e[h]);return A&&(l[u++]=A),T&&(l[u++]=T),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],442:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,o=e-n,a=t-i,s=a+o;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],e[0]);var o,a,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,d=t[c],p=f(d),v=e[h],m=f(v);m>p?(a=d,c+=1,r>c&&(d=t[c],p=f(d))):(a=v,h+=1,i>h&&(v=e[h],m=f(v))),r>c&&m>p||h>=i?(o=d,c+=1,r>c&&(d=t[c],p=f(d))):(o=v,h+=1,i>h&&(v=e[h],m=f(v)));for(var g,y,b,x,_,w=o+a,M=w-o,k=a-M,A=k,T=w;r>c&&i>h;)m>p?(o=d,c+=1,r>c&&(d=t[c],p=f(d))):(o=v,h+=1,i>h&&(v=e[h],m=f(v))),a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g;for(;r>c;)o=d,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k), -g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g,c+=1,r>c&&(d=t[c]);for(;i>h;)o=v,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g,h+=1,i>h&&(v=e[h]);return A&&(l[u++]=A),T&&(l[u++]=T),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],443:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],444:[function(t,e,r){"use strict";function n(t){return"a"+t}function i(t){return"d"+t}function o(t,e){return"c"+t+"_"+e}function a(t){return"s"+t}function s(t,e){return"t"+t+"_"+e}function l(t){return"o"+t}function u(t){return"x"+t}function c(t){return"p"+t}function h(t,e){return"d"+t+"_"+e}function f(t){return"i"+t}function d(t,e){return"u"+t+"_"+e}function p(t){return"b"+t}function v(t){return"y"+t}function m(t){return"e"+t}function g(t){return"v"+t}function y(t,e,r){for(var n=0,i=0;t>i;++i)e&1<e;++e)j.push(c(e),"+=",d(e,x[t]),";");j.push("}")}function I(t){for(var e=t-1;e>=0;--e)L(e,0);for(var r=[],e=0;D>e;++e)S[e]?r.push(i(e)+".get("+c(e)+")"):r.push(i(e)+"["+c(e)+"]");for(var e=0;b>e;++e)r.push(u(e));j.push(M,"[",T,"++]=phase(",r.join(),");");for(var e=0;t>e;++e)z(e);for(var n=0;D>n;++n)j.push(c(n),"+=",d(n,x[t]),";")}function P(t){for(var e=0;D>e;++e)S[e]?j.push(o(e,0),"=",i(e),".get(",c(e),");"):j.push(o(e,0),"=",i(e),"[",c(e),"];");for(var r=[],e=0;D>e;++e)r.push(o(e,0));for(var e=0;b>e;++e)r.push(u(e));j.push(p(0),"=",M,"[",T,"]=phase(",r.join(),");");for(var n=1;1<n;++n)j.push(p(n),"=",M,"[",T,"+",m(n),"];");for(var a=[],n=1;1<n;++n)a.push("("+p(0)+"!=="+p(n)+")");j.push("if(",a.join("||"),"){");for(var s=[],e=0;O>e;++e)s.push(f(e));for(var e=0;D>e;++e){s.push(o(e,0));for(var n=1;1<n;++n)S[e]?j.push(o(e,n),"=",i(e),".get(",c(e),"+",h(e,n),");"):j.push(o(e,n),"=",i(e),"[",c(e),"+",h(e,n),"];"),s.push(o(e,n))}for(var e=0;1<e;++e)s.push(p(e));for(var e=0;b>e;++e)s.push(u(e));j.push("vertex(",s.join(),");",g(0),"=",w,"[",T,"]=",k,"++;");for(var l=(1<n;++n)if(0===(t&~(1<0;_=_-1&v)x.push(w+"["+T+"+"+m(_)+"]");x.push(g(0));for(var _=0;D>_;++_)1&n?x.push(o(_,l),o(_,v)):x.push(o(_,v),o(_,l));1&n?x.push(d,y):x.push(y,d);for(var _=0;b>_;++_)x.push(u(_));j.push("if(",d,"!==",y,"){","face(",x.join(),")}")}j.push("}",T,"+=1;")}function C(){for(var t=1;1<t;++t)j.push(E,"=",m(t),";",m(t),"=",v(t),";",v(t),"=",E,";")}function R(t,e){if(0>t)return void P(e);I(t),j.push("if(",a(x[t]),">0){",f(x[t]),"=1;"),R(t-1,e|1<r;++r)j.push(c(r),"+=",d(r,x[t]),";");t===O-1&&(j.push(T,"=0;"),C()),L(t,2),R(t-1,e),t===O-1&&(j.push("if(",f(x[O-1]),"&1){",T,"=0;}"),C()),z(t),j.push("}")}var D=S.length,O=x.length;if(2>O)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var F="extractContour"+x.join("_"),j=[],N=[],B=[],U=0;D>U;++U)B.push(n(U));for(var U=0;b>U;++U)B.push(u(U));for(var U=0;O>U;++U)N.push(a(U)+"="+n(0)+".shape["+U+"]|0");for(var U=0;D>U;++U){N.push(i(U)+"="+n(U)+".data",l(U)+"="+n(U)+".offset|0");for(var V=0;O>V;++V)N.push(s(U,V)+"="+n(U)+".stride["+V+"]|0")}for(var U=0;D>U;++U){N.push(c(U)+"="+l(U)),N.push(o(U,0));for(var V=1;1<V;++V){for(var q=[],G=0;O>G;++G)V&1<U;++U)for(var V=0;O>V;++V){var H=[s(U,x[V])];V>0&&H.push(s(U,x[V-1])+"*"+a(x[V-1])),N.push(d(U,x[V])+"=("+H.join("-")+")|0")}for(var U=0;O>U;++U)N.push(f(U)+"=0");N.push(k+"=0");for(var X=["2"],U=O-2;U>=0;--U)X.push(a(x[U]));N.push(A+"=("+X.join("*")+")|0",M+"=mallocUint32("+A+")",w+"=mallocUint32("+A+")",T+"=0"),N.push(p(0)+"=0");for(var V=1;1<V;++V){for(var Y=[],W=[],G=0;O>G;++G)V&1<n&&e("Must have at least one array argument");var i=t.scalarArguments||0;0>i&&e("Scalar arg count must be > 0"),"function"!=typeof t.vertex&&e("Must specify vertex creation function"),"function"!=typeof t.cell&&e("Must specify cell creation function"),"function"!=typeof t.phase&&e("Must specify phase function");for(var o=t.getters||[],a=new Array(n),s=0;n>s;++s)o.indexOf(s)>=0?a[s]=!0:a[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,a)}var _=t("typedarray-pool");e.exports=x;var w="V",M="P",k="N",A="Q",T="X",E="T"},{"typedarray-pool":458}],445:[function(t,e,r){function n(t){if(0>t)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,o=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function l(t){if(.5>t)return Math.PI/(Math.sin(Math.PI*t)*l(1-t));if(t>100)return Math.exp(n(t));t-=1;for(var e=o[0],r=1;i+2>r;r++)e+=o[r]/(t+r);var a=t+i+.5;return Math.sqrt(2*Math.PI)*Math.pow(a,t+.5)*Math.exp(-a)*e},e.exports.log=n},{}],446:[function(t,e,r){"use strict";function n(t){var e=t.length;if(i>e){for(var r=1,n=0;e>n;++n)for(var a=0;n>a;++a)if(t[n]n;++n)s[n]=0;for(var r=1,n=0;e>n;++n)if(!s[n]){var l=1;s[n]=1;for(var a=t[n];a!==n;a=t[a]){if(s[a])return o.freeUint8(s),0;l+=1,s[a]=1}1&l||(r=-r)}return o.freeUint8(s),r}e.exports=n;var i=32,o=t("typedarray-pool")},{"typedarray-pool":458}],447:[function(t,e,r){"use strict";function n(t){var e=t.length;switch(e){case 0:case 1:return 0;case 2:return t[1]}var r,n,i,s=o.mallocUint32(e),l=o.mallocUint32(e),u=0;for(a(t,l),i=0;e>i;++i)s[i]=t[i];for(i=e-1;i>0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return o.freeUint32(l),o.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,o,a=1;for(r[0]=0,o=1;t>o;++o)r[o]=o,a=a*o|0;for(o=t-1;o>0;--o)n=e/a|0,e=e-n*a|0,a=a/o|0,i=0|r[o],r[o]=0|r[n],r[n]=0|i;return r}var o=t("typedarray-pool"),a=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":448,"typedarray-pool":458}],448:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;rt)return[];if(0===t)return[[0]];for(var e=0|Math.round(a(t+1)),r=[],n=0;e>n;++n){for(var s=i.unrank(t,n),l=[0],u=0,c=0;c= 0) !== (_inline_1_db >= 0)) {\n _inline_1_arg2_.push(_inline_1_arg4_[0] + 0.5 + 0.5 * (_inline_1_da + _inline_1_db) / (_inline_1_da - _inline_1_db))\n }\n }",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg3_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:["_inline_1_da","_inline_1_db"]},funcName:"zeroCrossings"})},{"cwise-compiler":115}],451:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":450}],452:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var o=[],l=[],u=0;r>u;++u)o.push("d"+u),l.push("d"+u);for(var u=0;1<u;++u)o.push("v"+u),l.push("v"+u);for(var u=0;1<u;++u)o.push("p"+u),l.push("p"+u);o.push("a","b","c"),l.push("a","c"),n.push("vertex:function vertexFunc(",o.join(),"){");for(var c=[],u=0;1<u;++u)c.push("(p"+u+"<<"+u+")");n.push("var m=(",c.join("+"),")|0;if(m===0||m===",(1<<(1<=1<<(1<>>7){");for(var u=0;1<<(1<u;++u){if(1<<(1<128&&u%128===0){h.length>0&&f.push("}}");var d="vExtra"+h.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),f=["function ",d,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&u,":");for(var p=new Array(r),v=new Array(r),m=new Array(r),g=new Array(r),y=0,b=0;r>b;++b)p[b]=[],v[b]=[],m[b]=0,g[b]=0;for(var b=0;1<b;++b)for(var x=0;r>x;++x){var _=b^1<b)&&!(u&1<<_)!=!(u&1<w?(p[x].push("-v"+b+"-v"+_),m[x]+=2):(p[x].push("v"+b+"+v"+_),m[x]-=2),y+=1;for(var M=0;r>M;++M)M!==x&&(_&1<x;++x)if(0===p[x].length)k.push("d"+x+"-0.5");else{var A="";m[x]<0?A=m[x]+"*c":m[x]>0&&(A="+"+m[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(g[x]/y);k.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+A+")/("+v[x].join("+")+")")}f.push("a.push([",k.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var S=[],u=0;1<u;++u)S.push("v"+u);S.push("c0","c1","p0","p1","a","b","c"),n.push("cell:function cellFunc(",S.join(),"){");var L=s(r-1);n.push("if(p0){b.push(",L.map(function(t){return"["+t.map(function(t){return"v"+t})+"]"}).join(),")}else{b.push(",L.map(function(t){var e=t.slice();return e.reverse(),"["+e.map(function(t){return"v"+t})+"]"}).join(),")}}});function ",i,"(array,level){var verts=[],cells=[];contour(array,verts,cells,level);return {positions:verts,cells:cells};} return ",i,";");for(var u=0;ua;++a)i[a]=[r[a]],o[a]=[a];return{positions:i,cells:o}}function o(t,e){if(t.dimension<=0)return{positions:[],cells:[]};if(1===t.dimension)return i(t,e);var r=t.order.join()+"-"+t.dtype,o=u[r],e=+e||0;return o||(o=u[r]=n(t.order,t.dtype)),o(t,e)}e.exports=o;var a=t("ndarray-extract-contour"),s=t("triangulate-hypercube"),l=t("zero-crossings"),u={}},{"ndarray-extract-contour":444,"triangulate-hypercube":449,"zero-crossings":451}],453:[function(t,e,r){(function(r){"use strict";function n(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),i=0,o=0,a=0;al;++l){var u=r[s[l]];n[i++]=u[0],n[i++]=u[1]+1.4,o=Math.max(u[0],o)}return{data:n,shape:o}}function i(t,e){var r=s[t];r||(r=s[t]={" ":{data:new Float32Array(0),shape:.2}});var a=r[e];if(!a)if(e.length<=1||!/\d/.test(e))a=r[e]=n(o(e,{triangles:!0,font:t,textAlign:"left",textBaseline:"alphabetic"}));else{for(var l=e.split(/(\d|\s)/),u=new Array(l.length),c=0,h=0,f=0;f0&&(h+=.02);for(var d=new Float32Array(c),p=0,v=-.5*h,f=0;f.5?l/(2-o-a):l/(o+a),o){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,l:s}}function a(t,e,r){function n(t,e,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?t+6*(e-t)*r:.5>r?e:2/3>r?t+(e-t)*(2/3-r)*6:t}var i,o,a;if(t=T(t,360),e=T(e,100),r=T(r,100),0===e)i=o=a=r;else{var s=.5>r?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),o=n(l,s,t),a=n(l,s,t-1/3)}return{r:255*i,g:255*o,b:255*a}}function s(t,e,r){t=T(t,255),e=T(e,255),r=T(r,255);var n,i,o=q(t,e,r),a=V(t,e,r),s=o,l=o-a;if(i=0===o?0:l/o,o==a)n=0;else{switch(o){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,v:s}}function l(t,e,r){t=6*T(t,360),e=T(e,100),r=T(r,100);var n=B.floor(t),i=t-n,o=r*(1-e),a=r*(1-i*e),s=r*(1-(1-i)*e),l=n%6,u=[r,a,o,o,s,r][l],c=[s,r,r,a,o,o][l],h=[o,o,s,r,r,a][l];return{r:255*u,g:255*c,b:255*h}}function u(t,e,r,n){var i=[I(U(t).toString(16)),I(U(e).toString(16)),I(U(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function c(t,e,r,n){var i=[I(C(n)),I(U(t).toString(16)),I(U(e).toString(16)),I(U(r).toString(16))];return i.join("")}function h(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s-=r/100,n.s=E(n.s),e(n)}function f(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s+=r/100,n.s=E(n.s),e(n)}function d(t){return e(t).desaturate(100)}function p(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l+=r/100,n.l=E(n.l),e(n)}function v(t,r){r=0===r?0:r||10;var n=e(t).toRgb();return n.r=q(0,V(255,n.r-U(255*-(r/100)))),n.g=q(0,V(255,n.g-U(255*-(r/100)))),n.b=q(0,V(255,n.b-U(255*-(r/100)))),e(n)}function m(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l-=r/100,n.l=E(n.l),e(n)}function g(t,r){var n=e(t).toHsl(),i=(U(n.h)+r)%360;return n.h=0>i?360+i:i,e(n)}function y(t){var r=e(t).toHsl();return r.h=(r.h+180)%360,e(r)}function b(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+120)%360,s:r.s,l:r.l}),e({h:(n+240)%360,s:r.s,l:r.l})]}function x(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+90)%360,s:r.s,l:r.l}),e({h:(n+180)%360,s:r.s,l:r.l}),e({h:(n+270)%360,s:r.s,l:r.l})]}function _(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+72)%360,s:r.s,l:r.l}),e({h:(n+216)%360,s:r.s,l:r.l})]}function w(t,r,n){r=r||6,n=n||30;var i=e(t).toHsl(),o=360/n,a=[e(t)];for(i.h=(i.h-(o*r>>1)+720)%360;--r;)i.h=(i.h+o)%360,a.push(e(i));return a}function M(t,r){r=r||6;for(var n=e(t).toHsv(),i=n.h,o=n.s,a=n.v,s=[],l=1/r;r--;)s.push(e({h:i,s:o,v:a})),a=(a+l)%1;return s}function k(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function A(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function T(t,e){L(t)&&(t="100%");var r=z(t);return t=V(e,q(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),B.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function E(t){return V(1,q(0,t))}function S(t){return parseInt(t,16)}function L(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function z(t){return"string"==typeof t&&-1!=t.indexOf("%")}function I(t){return 1==t.length?"0"+t:""+t}function P(t){return 1>=t&&(t=100*t+"%"),t}function C(t){return Math.round(255*parseFloat(t)).toString(16)}function R(t){return S(t)/255}function D(t){t=t.replace(F,"").replace(j,"").toLowerCase();var e=!1;if(H[t])t=H[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Y.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Y.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Y.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Y.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Y.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Y.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Y.hex8.exec(t))?{a:R(r[1]),r:S(r[2]),g:S(r[3]),b:S(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=Y.hex3.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function O(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var F=/^\s+/,j=/\s+$/,N=0,B=Math,U=B.round,V=B.min,q=B.max,G=B.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,n,i,o,a=this.toRgb();return t=a.r/255,e=a.g/255,r=a.b/255,n=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),i=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),o=.03928>=r?r/12.92:Math.pow((r+.055)/1.055,2.4),.2126*n+.7152*i+.0722*o},setAlpha:function(t){return this._a=A(t),this._roundA=U(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return c(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:U(this._r),g:U(this._g),b:U(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+U(this._r)+", "+U(this._g)+", "+U(this._b)+")":"rgba("+U(this._r)+", "+U(this._g)+", "+U(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:U(100*T(this._r,255))+"%",g:U(100*T(this._g,255))+"%",b:U(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+U(100*T(this._r,255))+"%, "+U(100*T(this._g,255))+"%, "+U(100*T(this._b,255))+"%)":"rgba("+U(100*T(this._r,255))+"%, "+U(100*T(this._g,255))+"%, "+U(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:X[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+c(this._r,this._g,this._b,this._a),n=r,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=e(t);n=o.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(m,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(f,arguments)},greyscale:function(){return this._applyModification(d,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(x,arguments)}},e.fromRatio=function(t,r){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?n[i]=t[i]:n[i]=P(t[i]));t=n}return e(t,r)},e.equals=function(t,r){return t&&r?e(t).toRgbString()==e(r).toRgbString():!1},e.random=function(){return e.fromRatio({r:G(),g:G(),b:G()})},e.mix=function(t,r,n){n=0===n?0:n||50;var i,o=e(t).toRgb(),a=e(r).toRgb(),s=n/100,l=2*s-1,u=a.a-o.a;i=l*u==-1?l:(l+u)/(1+l*u),i=(i+1)/2;var c=1-i,h={r:a.r*i+o.r*c,g:a.g*i+o.g*c,b:a.b*i+o.b*c,a:a.a*s+o.a*(1-s)};return e(h)},e.readability=function(t,r){var n=e(t),i=e(r);return(Math.max(n.getLuminance(),i.getLuminance())+.05)/(Math.min(n.getLuminance(),i.getLuminance())+.05)},e.isReadable=function(t,r,n){var i,o,a=e.readability(t,r);switch(o=!1,i=O(n),i.level+i.size){case"AAsmall":case"AAAlarge":o=a>=4.5;break;case"AAlarge":o=a>=3;break;case"AAAsmall":o=a>=7}return o},e.mostReadable=function(t,r,n){var i,o,a,s,l=null,u=0;n=n||{},o=n.includeFallbackColors,a=n.level,s=n.size;for(var c=0;cu&&(u=i,l=e(r[c]));return e.isReadable(t,l,{level:a,size:s})||!o?l:(n.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],n))};var H=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},X=e.hexNames=k(H),Y=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof r&&r.exports?r.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],455:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.topojson={})}(this,function(t){"use strict";function e(){}function r(t){if(!t)return e;var r,n,i=t.scale[0],o=t.scale[1],a=t.translate[0],s=t.translate[1];return function(t,e){e||(r=n=0),t[0]=(r+=t[0])*i+a,t[1]=(n+=t[1])*o+s}}function n(t){if(!t)return e;var r,n,i=t.scale[0],o=t.scale[1],a=t.translate[0],s=t.translate[1];return function(t,e){e||(r=n=0);var l=(t[0]-a)/i|0,u=(t[1]-s)/o|0;t[0]=l-r,t[1]=u-n,r=l,n=u}}function i(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r}function o(t,e){for(var r=0,n=t.length;n>r;){var i=r+n>>>1;t[i]t?~t:t],o=0,a=n.length;a>o;++o)e.push(r=n[o].slice()),c(r,o);0>t&&i(e,a)}function o(t){return t=t.slice(),c(t,0),t}function a(t){for(var e=[],r=0,i=t.length;i>r;++r)n(t[r],e);return e.length<2&&e.push(e[0].slice()),e}function s(t){for(var e=a(t);e.length<4;)e.push(e[0].slice());return e}function l(t){return t.map(s)}function u(t){var e=t.type;return"GeometryCollection"===e?{type:e,geometries:t.geometries.map(u)}:e in f?{type:e,coordinates:f[e](t)}:null}var c=r(t.transform),h=t.arcs,f={Point:function(t){return o(t.coordinates)},MultiPoint:function(t){return t.coordinates.map(o)},LineString:function(t){return a(t.arcs)},MultiLineString:function(t){return t.arcs.map(a)},Polygon:function(t){return l(t.arcs)},MultiPolygon:function(t){return t.arcs.map(l)}};return u(e)}function u(t,e){function r(e){var r,n=t.arcs[0>e?~e:e],i=n[0];return t.transform?(r=[0,0],n.forEach(function(t){r[0]+=t[0],r[1]+=t[1]})):r=n[n.length-1],0>e?[r,i]:[i,r]}function n(t,e){for(var r in t){var n=t[r];delete e[n.start],delete n.start,delete n.end,n.forEach(function(t){i[0>t?~t:t]=1}),s.push(n)}}var i={},o={},a={},s=[],l=-1;return e.forEach(function(r,n){var i,o=t.arcs[0>r?~r:r];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++l],e[l]=r,e[n]=i)}),e.forEach(function(t){var e,n,i=r(t),s=i[0],l=i[1];if(e=a[s])if(delete a[e.end],e.push(t),e.end=l,n=o[l]){delete o[n.start];var u=n===e?e:e.concat(n);o[u.start=e.start]=a[u.end=n.end]=u}else o[e.start]=a[e.end]=e;else if(e=o[l])if(delete o[e.start],e.unshift(t),e.start=s,n=a[s]){delete a[n.end];var c=n===e?e:n.concat(e);o[c.start=n.start]=a[c.end=e.end]=c}else o[e.start]=a[e.end]=e;else e=[t],o[e.start=s]=a[e.end=l]=e}),n(a,o),n(o,a),e.forEach(function(t){i[0>t?~t:t]||s.push([t])}),s}function c(t){return l(t,h.apply(this,arguments))}function h(t,e,r){function n(t){var e=0>t?~t:t;(c[e]||(c[e]=[])).push({i:t,g:l})}function i(t){t.forEach(n)}function o(t){t.forEach(i)}function a(t){"GeometryCollection"===t.type?t.geometries.forEach(a):t.type in h&&(l=t,h[t.type](t.arcs))}var s=[];if(arguments.length>1){var l,c=[],h={LineString:i,MultiLineString:o,Polygon:o,MultiPolygon:function(t){t.forEach(o)}};a(e),c.forEach(arguments.length<3?function(t){s.push(t[0].i)}:function(t){r(t[0].g,t[t.length-1].g)&&s.push(t[0].i)})}else for(var f=0,d=t.arcs.length;d>f;++f)s.push(f);return{type:"MultiLineString",arcs:u(t,s)}}function f(t){var e=t[0],r=t[1],n=t[2];return Math.abs((e[0]-n[0])*(r[1]-e[1])-(e[0]-r[0])*(n[1]-e[1]))}function d(t){for(var e,r=-1,n=t.length,i=t[n-1],o=0;++re?~e:e]||(i[e]=[])).push(t)})}),o.push(t)}function n(e){return d(l(t,{type:"Polygon",arcs:[e]}).coordinates[0])>0}var i={},o=[],a=[];return e.forEach(function(t){"Polygon"===t.type?r(t.arcs):"MultiPolygon"===t.type&&t.arcs.forEach(r)}),o.forEach(function(t){if(!t._){var e=[],r=[t];for(t._=1,a.push(e);t=r.pop();)e.push(t),t.forEach(function(t){t.forEach(function(t){i[0>t?~t:t].forEach(function(t){t._||(t._=1,r.push(t))})})})}}),o.forEach(function(t){delete t._}),{type:"MultiPolygon",arcs:a.map(function(e){var r,o=[];if(e.forEach(function(t){t.forEach(function(t){t.forEach(function(t){i[0>t?~t:t].length<2&&o.push(t)})})}),o=u(t,o),(r=o.length)>1)for(var a,s=n(e[0][0]),l=0;r>l;++l)if(s===n(o[l])){a=o[0],o[0]=o[l],o[l]=a;break}return o})}}function m(t){function e(t,e){t.forEach(function(t){0>t&&(t=~t);var r=i[t];r?r.push(e):i[t]=[e]})}function r(t,r){t.forEach(function(t){e(t,r)})}function n(t,e){ -"GeometryCollection"===t.type?t.geometries.forEach(function(t){n(t,e)}):t.type in s&&s[t.type](t.arcs,e)}var i={},a=t.map(function(){return[]}),s={LineString:e,MultiLineString:r,Polygon:r,MultiPolygon:function(t,e){t.forEach(function(t){r(t,e)})}};t.forEach(n);for(var l in i)for(var u=i[l],c=u.length,h=0;c>h;++h)for(var f=h+1;c>f;++f){var d,p=u[h],v=u[f];(d=a[p])[l=o(d,v)]!==v&&d.splice(l,0,v),(d=a[v])[l=o(d,p)]!==p&&d.splice(l,0,p)}return a}function g(t,e){return t[1][2]-e[1][2]}function y(){function t(t,e){for(;e>0;){var r=(e+1>>1)-1,i=n[r];if(g(t,i)>=0)break;n[i._=e]=i,n[t._=e=r]=t}}function e(t,e){for(;;){var r=e+1<<1,o=r-1,a=e,s=n[a];if(i>o&&g(n[o],s)<0&&(s=n[a=o]),i>r&&g(n[r],s)<0&&(s=n[a=r]),a===e)break;n[s._=e]=s,n[t._=e=a]=t}}var r={},n=[],i=0;return r.push=function(e){return t(n[e._=i]=e,i++),i},r.pop=function(){if(!(0>=i)){var t,r=n[0];return--i>0&&(t=n[i],e(n[t._=0]=t,0)),r}},r.remove=function(r){var o,a=r._;if(n[a]===r)return a!==--i&&(o=n[i],(g(o,r)<0?t:e)(n[o._=a]=o,a)),a},r}function b(t,e){function i(t){s.remove(t),t[1][2]=e(t),s.push(t)}var o=r(t.transform),a=n(t.transform),s=y();return e||(e=f),t.arcs.forEach(function(t){var r,n,l,u,c=[],h=0;for(n=0,l=t.length;l>n;++n)u=t[n],o(t[n]=[u[0],u[1],1/0],n);for(n=1,l=t.length-1;l>n;++n)r=t.slice(n-1,n+2),r[1][2]=e(r),c.push(r),s.push(r);for(n=0,l=c.length;l>n;++n)r=c[n],r.previous=c[n-1],r.next=c[n+1];for(;r=s.pop();){var f=r.previous,d=r.next;r[1][2]0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(a(t),0,t)}function l(t){return new Uint16Array(a(2*t),0,t)}function u(t){return new Uint32Array(a(4*t),0,t)}function c(t){return new Int8Array(a(t),0,t)}function h(t){return new Int16Array(a(2*t),0,t)}function f(t){return new Int32Array(a(4*t),0,t)}function d(t){return new Float32Array(a(4*t),0,t)}function p(t){return new Float64Array(a(8*t),0,t)}function v(t){return x?new Uint8ClampedArray(a(t),0,t):s(t)}function m(t){return new DataView(a(t),0,t)}function g(t){t=y.nextPow2(t);var e=y.log2(t),r=M[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,M=_.BUFFER;r.free=function(t){if(n.isBuffer(t))M[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=o,r.freeArrayBuffer=i,r.freeBuffer=function(t){M[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return a(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return h(t);case"int32":return f(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return v(t);case"buffer":return g(t);case"data":case"dataview":return m(t);default:return null}return null},r.mallocArrayBuffer=a,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=h,r.mallocInt32=f,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=v,r.mallocDataView=m,r.mallocBuffer=g,r.clearCache=function(){for(var t=0;32>t;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,M[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":51,buffer:53,dup:121}],459:[function(t,e,r){"use strict";function n(t,e){for(var r=1,n=t.length,i=t[0],o=t[0],a=1;n>a;++a)if(o=i,i=t[a],e(i,o)){if(a===r){r++;continue}t[r++]=i}return t.length=r,t}function i(t){for(var e=1,r=t.length,n=t[0],i=t[0],o=1;r>o;++o,i=n)if(i=n,n=t[o],n!==i){if(o===e){e++;continue}t[e++]=n}return t.length=e,t}function o(t,e,r){return 0===t.length?t:e?(r||t.sort(e),n(t,e)):(r||t.sort(),i(t))}e.exports=o},{}],460:[function(t,e,r){"use strict";function n(t,e){return"object"==typeof e&&null!==e||(e={}),i(t,e.canvas||o,e.context||a,e)}e.exports=n;var i=t("./lib/vtext"),o=null,a=null;"undefined"!=typeof document&&(o=document.createElement("canvas"),o.width=8192,o.height=1024,a=o.getContext("2d"))},{"./lib/vtext":461}],461:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",o=[1<<30,1<<30],a=[0,0],s=t.length,l=0;s>l;++l)for(var u=t[l],c=0;2>c;++c)o[c]=0|Math.min(o[c],u[c]),a[c]=0|Math.max(a[c],u[c]);var h=0;switch(n){case"center":h=-.5*(o[0]+a[0]);break;case"right":case"end":h=-a[0];break;case"left":case"start":h=-o[0];break;default:throw new Error("vectorize-text: Unrecognized textAlign: '"+n+"'")}var f=0;switch(i){case"hanging":case"top":f=-o[1];break;case"middle":f=-.5*(o[1]+a[1]);break;case"alphabetic":case"ideographic":f=-3*r;break;case"bottom":f=-a[1];break;default:throw new Error("vectorize-text: Unrecoginized textBaseline: '"+i+"'")}var d=1/r;return"lineHeight"in e?d*=+e.lineHeight:"width"in e?d=e.width/(a[0]-o[0]):"height"in e&&(d=e.height/(a[1]-o[1])),t.map(function(t){return[d*(t[0]+h),d*(t[1]+f)]})}function i(t,e,r,n){var i=0|Math.ceil(e.measureText(r).width+2*n);if(i>8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var o=3*n;t.height=l&&a.push(s)}for(;a.length>0;){var u=a.pop();n[u]=!1;for(var c=r[u],s=0;sn;++n){var o=t[n];e=Math.max(e,o[0],o[1])}e=(0|e)+1}e=0|e;for(var a=new Array(e),n=0;e>n;++n)a[n]=[];for(var n=0;r>n;++n){var o=t[n];a[o[0]].push(o[1]),a[o[1]].push(o[0])}for(var s=0;e>s;++s)i(a[s],function(t,e){return t-e});return a}e.exports=n;var i=t("uniq")},{uniq:459}],464:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,o){for(var a,s,l,c=0;2>c;++c)if(u[c][n].length>0){a=u[c][n][0],l=c;break}s=a[1^l];for(var h=0;2>h;++h)for(var f=u[h][n],d=0;d0&&(a=p,s=v,l=h)}return o?s:(a&&r(a,l),s)}function o(t,o){var a=u[o][t][0],s=[t];r(a,o);for(var l=a[1^o];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],h=t,f=s[1],d=n(c,h,!0);if(i(e[c],e[h],e[f],e[d])<0)break;s.push(t),l=n(c,h)}return s}function a(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;s>c;++c)u[0][c]=[],u[1][c]=[];for(var c=0;l>c;++c){var h=t[c];u[0][h[0]].push(h),u[1][h[1]].push(h)}for(var f=[],c=0;s>c;++c)u[0][c].length+u[1][c].length===0&&f.push([c]);for(var c=0;s>c;++c)for(var d=0;2>d;++d){for(var p=[];u[d][c].length>0;){var v=(u[0][c].length,o(c,d));a(p,v)?p.push.apply(p,v):(p.length>0&&f.push(p),p=v)}p.length>0&&f.push(p)}return f}e.exports=n;var i=t("compare-angle")},{"compare-angle":465}],465:[function(t,e,r){"use strict";function n(t,e,r){var n=s(t[0],-e[0]),i=s(t[1],-e[1]),o=s(r[0],-e[0]),a=s(r[1],-e[1]),c=u(l(n,o),l(i,a));return c[c.length-1]>=0}function i(t,e,r,i){var s=o(e,r,i);if(0===s){var l=a(o(t,e,r)),u=a(o(t,e,i));if(l===u){if(0===l){var c=n(t,e,r),h=n(t,e,i);return c===h?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,i)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:a(u-l)}var f=o(t,e,r);if(f>0)return s>0&&o(t,e,i)>0?1:-1;if(0>f)return s>0||o(t,e,i)>0?1:-1;var d=o(t,e,i);return d>0?1:n(t,e,r)?1:-1}e.exports=i;var o=t("robust-orientation"),a=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":439,"robust-product":466,"robust-sum":442,signum:467,"two-sum":457}],466:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return o(e,t[0]);if(1===e.length)return o(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.lengtht?-1:t>0?1:0}},{}],468:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],469:[function(t,e,r){"use strict";function n(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}function i(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 o(t,e){var r=p(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 a(t,e){var r=t.intervals([]);r.push(e),o(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return 0>n?y:(r.splice(n,1),o(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],o=[],a=[],s=[],r=0;r3*(e+1)?a(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?a(this,t):this.right.insert(t):this.right=p([t]);else{var r=g.ge(this.leftPoints,t,f),n=g.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var o=this.left?this.left.count:0;if(4*o>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var a=this,l=this.left;l.right;)a=l,l=l.right;if(a===this)l.right=this.right;else{var u=this.left,n=this.right;a.count-=l.count,a.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=g.ge(this.leftPoints,t,f);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=v.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){return this.root?this.root.queryPoint(t,e):void 0},w.queryInterval=function(t,e,r){return e>=t&&this.root?this.root.queryInterval(t,e,r):void 0},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":468}],470:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),a=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return s>a?a-s:i>l?i-l:a-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var a,s;if(t[0][0]t[1][0]))return-n(t,e);a=t[1],s=t[0]}var l=o(r,i,s),u=o(r,i,a);if(0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;if(l=o(s,a,i),u=o(s,a,r),0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;return i[0]-s[0]}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":439}],471:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=o}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function o(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function a(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}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(0>=i){if(n.left){var o=u(t,e,r,n.left);if(o)return o}var o=r(n.key,n.value);if(o)return o}return n.right?u(t,e,r,n.right):void 0}function c(t,e,r,n,i){var o,a=r(t,i.key),s=r(e,i.key);if(0>=a){if(i.left&&(o=c(t,e,r,n,i.left)))return o;if(s>0&&(o=n(i.key,i.value)))return o}return s>0&&i.right?c(t,e,r,n,i.right):void 0}function h(t,e){this.tree=t,this._stack=e}function f(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 d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=g);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===m){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=g,r._color=g,s._color=g,a(r),a(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===m){if(n=r.right=i(n),s=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=g,n._color=g,e._color=g,a(r),a(n),a(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===g){if(r._color===m)return r._color=g,void(r.right=o(m,n));r.right=o(m,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=m,a(r),a(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===m){if(n=r.left=i(n),s=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=g,n._color=g,e._color=g,a(r),a(n),a(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===g){if(r._color===m)return r._color=g,void(r.left=o(m,n));r.left=o(m,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=m,a(r),a(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1t?-1:t>e?1:0}function v(t){return new s(t||p,null)}e.exports=v;var m=0,g=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=0>=c?i.left:i.right}l.push(new n(m,t,e,null,null,1));for(var h=l.length-2;h>=0;--h){var i=l[h];u[h]<=0?l[h]=new n(i._color,i.key,i.value,l[h+1],i.right,i._count+1):l[h]=new n(i._color,i.key,i.value,i.left,l[h+1],i._count+1)}for(var h=l.length-1;h>1;--h){var f=l[h-1],i=l[h];if(f._color===g||i._color===g)break;var d=l[h-2];if(d.left===f)if(f.left===i){var p=d.right;if(!p||p._color!==m){if(d._color=m,d.left=f.right,f._color=g,f.right=d,l[h-2]=f,l[h-1]=i,a(d),a(f),h>=3){var v=l[h-3];v.left===d?v.left=f:v.right=f}break}f._color=g,d.right=o(g,p),d._color=m,h-=1}else{var p=d.right;if(!p||p._color!==m){if(f.right=i.left,d._color=m,d.left=i.right,i._color=g,i.left=f,i.right=d,l[h-2]=i,l[h-1]=f,a(d),a(f),a(i),h>=3){var v=l[h-3];v.left===d?v.left=i:v.right=i}break}f._color=g,d.right=o(g,p),d._color=m,h-=1}else if(f.right===i){var p=d.left;if(!p||p._color!==m){if(d._color=m,d.right=f.left,f._color=g,f.left=d,l[h-2]=f,l[h-1]=i,a(d),a(f),h>=3){var v=l[h-3];v.right===d?v.right=f:v.left=f}break}f._color=g,d.left=o(g,p),d._color=m,h-=1}else{var p=d.left;if(!p||p._color!==m){if(f.left=i.right,d._color=m,d.right=i.left,i._color=g,i.right=f,i.left=d,l[h-2]=i,l[h-1]=f,a(d),a(f),a(i),h>=3){var v=l[h-3];v.right===d?v.right=i:v.left=i}break}f._color=g,d.left=o(g,p),d._color=m,h-=1}}return l[0]._color=g,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),y.at=function(t){if(0>t)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new h(this,[])},y.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),0>=o&&(i=n.length),r=0>=o?r.left:r.right}return n.length=i,new h(this,n)},y.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),0>o&&(i=n.length),r=0>o?r.left:r.right}return n.length=i,new h(this,n)},y.lt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),o>0&&(i=n.length),r=0>=o?r.left:r.right}return n.length=i,new h(this,n)},y.le=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),o>=0&&(i=n.length),r=0>o?r.left:r.right}return n.length=i,new h(this,n)},y.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=0>=i?r.left:r.right}return new h(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.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=0>=n?r.left:r.right}};var b=h.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new h(this.tree,this._stack.slice())},b.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 i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var o=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var a=e[o-1];e.push(new n(r._color,a.key,a.value,r.left,r.right,r._count)),e[o-1].key=r.key,e[o-1].value=r.value;for(var i=e.length-2;i>=o;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[o-1].left=e[o]}if(r=e[e.length-1],r._color===m){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0?this._stack[this._stack.length-1].key:void 0},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1].value:void 0},enumerable:!0}),Object.defineProperty(b,"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}),b.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(b,"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}}),b.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 o=e.length-2;o>=0;--o)i=e[o],i.left===e[o+1]?r[o]=new n(i._color,i.key,i.value,r[o+1],i.right,i._count):r[o]=new n(i._color,i.key,i.value,i.left,r[o+1],i._count);return new s(this.tree._compare,r[0])},b.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(b,"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}})},{}],472:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function o(t,e){for(var r=null;t;){var n,i,a=t.key;a[0][0]s)t=t.left;else if(s>0)if(e[0]!==a[1][0])r=t,t=t.right;else{var l=o(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==a[1][0])return t;var l=o(t.right,e);if(l)return l;t=t.left}}return r}function a(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),o=0;e>o;++o){var l=t[o],u=l[0][0]o;){for(var m=i[o].x,g=[];r>o;){var y=i[o];if(y.x!==m)break;o+=1,y.segment[0][0]===y.x&&y.segment[1][0]===y.x?y.create&&(y.segment[0][1]e)return-1;var r=(this.slabs[e],o(this.slabs[e],t)),n=-1;if(r&&(n=r.value),this.coordinates[e]===t[0]){var a=null;if(r&&(a=r.key),e>0){var s=o(this.slabs[e-1],t);s&&(a?f(s.key,a)>0&&(a=s.key,n=s.value):(n=s.value,a=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(a){var p=h(a[0],a[1],[t[0],d.y]);a[0][0]>a[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":470,"binary-search-bounds":468,"functional-red-black-tree":471,"robust-orientation":439}],473:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return i?!!i.queryPoint(r,n):!1}}function o(t){for(var e={},r=0;rn)return 1;var i=t[n];if(!i){if(!(n>0&&e[n]===r[0]))return 1;i=t[n-1]}for(var o=1;i;){var a=i.key,s=h(r,a[0],a[1]);if(a[0][0]s)i=i.left;else{if(!(s>0))return 0;o=-1,i=i.right}else if(s>0)i=i.left;else{if(!(0>s))return 0;o=1,i=i.right}}return o}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;e>i;++i)for(var c=t[i],h=c.length,d=h-1,p=0;h>p;d=p++){var v=c[d],m=c[p];v[0]===m[0]?n.push([v,m]):r.push([v,m])}if(0===r.length)return 0===n.length?s:l(o(n));var g=f(r),y=a(g.slabs,g.coordinates);return 0===n.length?y:u(o(n),y)}e.exports=c;var h=t("robust-orientation")[3],f=t("slab-decomposition"),d=t("interval-tree-1d"),p=t("binary-search-bounds")},{"binary-search-bounds":468,"interval-tree-1d":469,"robust-orientation":439,"slab-decomposition":472}],474:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function i(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=[];return e}function o(t,e){function r(t){for(var r=t.length,n=[0],i=0;r>i;++i){var o=e[t[i]],a=e[t[(i+1)%r]],s=u(-o[0],o[1]),l=u(-o[0],a[1]),h=u(a[0],o[1]),f=u(a[0],a[1]);n=c(n,c(c(s,l),c(h,f)))}return n[n.length-1]>0}function o(t){for(var e=t.length,r=0;e>r;++r)if(!R[t[r]])return!1;return!0}var d=f(t,e);t=d[0],e=d[1];for(var p=e.length,v=(t.length,a(t,e.length)),m=0;p>m;++m)if(v[m].length%2===1)throw new Error("planar-graph-to-polyline: graph must be manifold");var g=s(t,e);g=g.filter(r);for(var y=g.length,b=new Array(y),x=new Array(y),m=0;y>m;++m){b[m]=m;var _=new Array(y),w=g[m].map(function(t){return e[t]}),M=l([w]),k=0;t:for(var A=0;y>A;++A)if(_[A]=0,m!==A){for(var T=g[A],E=T.length,S=0;E>S;++S){var L=M(e[T[S]]);if(0!==L){0>L&&(_[A]=1,k+=1);continue t}}_[A]=1,k+=1}x[m]=[k,m,_]}x.sort(function(t,e){return e[0]-t[0]});for(var m=0;y>m;++m)for(var _=x[m],z=_[1],I=_[2],A=0;y>A;++A)I[A]&&(b[A]=z);for(var P=i(y),m=0;y>m;++m)P[m].push(b[m]),P[b[m]].push(m);for(var C={},R=n(p,!1),m=0;y>m;++m)for(var T=g[m],E=T.length,A=0;E>A;++A){var D=T[A],O=T[(A+1)%E],F=Math.min(D,O)+":"+Math.max(D,O);if(F in C){var j=C[F];P[j].push(m),P[m].push(j),R[D]=R[O]=!0}else C[F]=m}for(var N=[],B=n(y,-1),m=0;y>m;++m)b[m]!==m||o(g[m])?B[m]=-1:(N.push(m),B[m]=0);for(var d=[];N.length>0;){var U=N.pop(),V=P[U];h(V,function(t,e){return t-e});var q,G=V.length,H=B[U];if(0===H){var T=g[U];q=[T]}for(var m=0;G>m;++m){var X=V[m];if(!(B[X]>=0)&&(B[X]=1^H,N.push(X),0===H)){var T=g[X];o(T)||(T.reverse(),q.push(T))}}0===H&&d.push(q)}return d}e.exports=o;var a=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),h=t("uniq"),f=t("./lib/trim-leaves")},{"./lib/trim-leaves":462,"edges-to-adjacency-list":463,"planar-dual":464,"point-in-big-polygon":473,"robust-sum":442,"two-product":456,uniq:459}],475:[function(t,e,r){arguments[4][51][0].apply(r,arguments)},{dup:51}],476:[function(t,e,r){"use strict"; -"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n,n.prototype.length=function(){return this.roots.length},n.prototype.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},n.prototype.find=function(t){for(var e=this.roots;e[t]!==t;){var r=e[t];e[t]=e[r],t=r}return t},n.prototype.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,o=this.roots,a=i[r],s=i[n];s>a?o[r]=n:a>s?o[n]=r:(o[n]=r,++i[r])}}},{}],477:[function(t,e,r){arguments[4][244][0].apply(r,arguments)},{"bit-twiddle":475,dup:244,"union-find":476}],478:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.abs(o(t,e,r)),i=Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2));return n/i}function i(t,e,r){function i(t){if(x[t])return 1/0;var r=g[t],i=y[t];return 0>r||0>i?1/0:n(e[t],e[r],e[i])}function o(t,e){var r=A[t],n=A[e];A[t]=n,A[e]=r,T[r]=e,T[n]=t}function s(t){return b[A[t]]}function l(t){return 1&t?t-1>>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(S>n){var l=s(n);r>l&&(a=n,r=l)}if(S>i){var u=s(i);r>u&&(a=i)}if(a===t)return t;o(t,a),t=a}}function c(t){for(var e=s(t);t>0;){var r=l(t);if(r>=0){var n=s(r);if(n>e){o(t,r),t=r;continue}}return t}}function h(){if(S>0){var t=A[0];return o(0,S-1),S-=1,u(0),t}return-1}function f(t,e){var r=A[t];return b[r]===e?t:(b[r]=-(1/0),c(t),h(),b[r]=e,S+=1,c(S-1))}function d(t){if(!x[t]){x[t]=!0;var e=g[t],r=y[t];g[r]>=0&&(g[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&f(T[e],i(e)),T[r]>=0&&f(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||0>i||i===n)break;if(n=i,i=t[n],!x[n]||0>i||i===n)break;n=i,r=t[r]}while(r!==n);for(var o=e;o!==n;o=t[o])t[o]=n;return n}for(var v=e.length,m=t.length,g=new Array(v),y=new Array(v),b=new Array(v),x=new Array(v),_=0;v>_;++_)g[_]=y[_]=-1,b[_]=1/0,x[_]=!1;for(var _=0;m>_;++_){var w=t[_];if(2!==w.length)throw new Error("Input must be a graph");var M=w[1],k=w[0];-1!==y[k]?y[k]=-2:y[k]=M,-1!==g[M]?g[M]=-2:g[M]=k}for(var A=[],T=new Array(v),_=0;v>_;++_){var E=b[_]=i(_);1/0>E?(T[_]=A.length,A.push(_)):T[_]=-1}for(var S=A.length,_=S>>1;_>=0;--_)u(_);for(;;){var L=h();if(0>L||b[L]>r)break;d(L)}for(var z=[],_=0;v>_;++_)x[_]||(T[_]=z.length,z.push(e[_].slice()));var I=(z.length,[]);return t.forEach(function(t){var e=p(g,t[0]),r=p(y,t[1]);if(e>=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&I.push([n,i])}}),a.unique(a.normalize(I)),{positions:z,edges:I}}e.exports=i;var o=t("robust-orientation"),a=t("simplicial-complex")},{"robust-orientation":439,"simplicial-complex":477}],479:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],480:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),a=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:a({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":563,"../../plots/cartesian/constants":597,"../../plots/font_attributes":610,"./arrow_paths":479}],481:[function(t,e,r){"use strict";function n(t,e){function r(e,r){return u.coerce(t,n,m.layoutAttributes,e,r)}var n={};r("opacity"),r("align"),r("bgcolor");var i=r("bordercolor"),o=h.opacity(i);r("borderpad");var a=r("borderwidth"),s=r("showarrow");s&&(r("arrowcolor",o?n.bordercolor:h.defaultLine),r("arrowhead"),r("arrowsize"),r("arrowwidth",2*(o&&a||1)),r("ax"),r("ay"),r("axref"),r("ayref"),u.noneOrAll(t,n,["ax","ay"])),r("text",s?" ":"new text"),r("textangle"),u.coerceFont(r,"font",e.font);for(var l=["x","y"],f=0;2>f;f++){var d=l[f],p={_fullLayout:e},v=c.coerceRef(t,n,p,d),g=c.coerceARef(t,n,p,d),y=.5;if("paper"!==v){var b=c.getFromId(p,v);if(y=b.range[0]+y*(b.range[1]-b.range[0]),-1!==["date","category"].indexOf(b.type)&&"string"==typeof t[d]){var x;if("date"===b.type){if(x=u.dateTime2ms(t[d]),x!==!1&&(t[d]=x),g===v){var _=u.dateTime2ms(t["a"+d]);_!==!1&&(t["a"+d]=_)}}else(b._categories||[]).length&&(x=b._categories.indexOf(t[d]),-1!==x&&(t[d]=x))}}r(d,y),s||r(d+"anchor")}return u.noneOrAll(t,n,["x","y"]),n}function i(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=c.getFromId(t,e.xref),n=c.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,a=(e._ysize||0)/2,s=e._yshift||0,l=i-o,u=i+o,h=a-s,f=a+s;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;l=Math.max(l,d),u=Math.max(u,d),h=Math.max(h,d),f=Math.max(f,d)}r&&r.autorange&&c.expand(r,[r.l2c(e.x)],{ppadplus:u,ppadminus:l}),n&&n.autorange&&c.expand(n,[n.l2c(e.y)],{ppadplus:f,ppadminus:h})}})}function o(t,e,r,n,i,o,a,s){var l=r-t,u=i-t,c=a-i,h=n-e,f=o-e,d=s-o,p=l*d-c*h;if(0===p)return null;var v=(u*d-c*f)/p,m=(u*h-l*f)/p;return 0>m||m>1||0>v||v>1?null:{x:t+l*v,y:e+h*v}}var a=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),h=t("../color"),f=t("../drawing"),d=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),v=t("../dragelement"),m=e.exports={};m.ARROWPATHS=t("./arrow_paths"),m.layoutAttributes=t("./attributes"),m.supplyLayoutDefaults=function(t,e){for(var r=t.annotations||[],i=e.annotations=[],o=0;ot?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var n=W.select(".annotation-math-group"),i=!n.empty(),s=f.bBox((i?n:tt).node()),d=s.width,g=s.height,y=Math.round(d+2*J),b=Math.round(g+2*J);U._w=d,U._h=g;var x=!1;if(["x","y"].forEach(function(e){var n,i=U[e+"ref"]||e,o=c.getFromId(t,i),a=(H+("x"===e?0:90))*Math.PI/180,s=y*Math.abs(Math.cos(a))+b*Math.abs(Math.sin(a)),l=U[e+"anchor"];if(o){if(!o.autorange&&(U[e]-o.range[0])*(U[e]-o.range[1])>0&&(U["a"+e+"ref"]===i?(U["a"+e]-o.range[0])*(U["a"+e]-o.range[1])>0&&(x=!0):x=!0,x))return;G[e]=o._offset+o.l2p(U[e]),n=.5}else n=U[e],"y"===e&&(n=1-n),G[e]="x"===e?L.l+L.w*n:L.t+L.h*n;var u=0;U["a"+e+"ref"]===i?G["aa"+e]=o._offset+o.l2p(U["a"+e]):(u=U.showarrow?U["a"+e]:s*r(n,l),G[e]+=u),U["_"+e+"type"]=o&&o.type,U["_"+e+"size"]=s,U["_"+e+"shift"]=u}),x)return void W.remove();var w,M;U.showarrow&&(w=U.axref===U.xref?G.x:u.constrain(G.x-U.ax,1,_.width-1),M=U.ayref===U.yref?G.y:u.constrain(G.y-U.ay,1,_.height-1)),G.x=u.constrain(G.x,1,_.width-1),G.y=u.constrain(G.y,1,_.height-1);var k=J-s.top,A=J-s.left;i?n.select("svg").attr({x:J-1,y:J}):(tt.attr({x:A,y:k}),tt.selectAll("tspan.line").attr({y:k,x:A})),$.call(f.setRect,Z/2,Z/2,y-Z,b-Z);var T=0,E=0;T=U.axref===U.xref?Math.round(G.aax-y/2):Math.round(G.x-y/2),E=U.ayref===U.yref?Math.round(G.aay-b/2):Math.round(G.y-b/2),W.call(u.setTranslate,T,E);var S="annotations["+e+"]",z=function(r,n){a.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=U.axref===U.xref?G.aax+r:G.x+r,s=U.ayref===U.yref?G.aay+n:G.y+n;var c=u.rotationXYMatrix(H,i,s),f=u.apply2DTransform(c),d=u.apply2DTransform2(c),p=$.attr("width")/2,g=$.attr("height")/2,y=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!y.reduce(function(t,e){return t^!!o(w,M,w+1e6,M+1e6,e[0],e[1],e[2],e[3])},!1)){y.forEach(function(t){var e=o(i,s,w,M,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var b=U.arrowwidth,x=U.arrowcolor,_=X.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=_.append("path").attr("d","M"+i+","+s+"L"+w+","+M).style("stroke-width",b+"px").call(h.stroke,h.rgb(x));m.arrowhead(k,U.arrowhead,"end",U.arrowsize);var A=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-w)+","+(s-M),transform:"translate("+w+","+M+")"}).style("stroke-width",b+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,z;v.init({element:A.node(),prepFn:function(){var t=u.getTranslate(W);E=t.x,z=t.y,T={},V&&V.autorange&&(T[V._name+".autorange"]=!0),q&&q.autorange&&(T[q._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var r=f(E,z),n=r[0]+t,i=r[1]+e;W.call(u.setTranslate,n,i),T[S+".x"]=V?U.x+t/V._m:(w+t-L.l)/L.w,T[S+".y"]=q?U.y+e/q._m:1-(M+e-L.t)/L.h,U.axref===U.xref&&(T[S+".ax"]=V?U.ax+t/V._m:(w+t-L.l)/L.w),U.ayref===U.yref&&(T[S+".ay"]=q?U.ay+e/q._m:1-(M+e-L.t)/L.h),Y.attr({transform:"rotate("+H+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};U.showarrow&&z(0,0);var I=u.rotationXYMatrix(H,G.x,G.y),P=u.apply2DTransform(I);if(t._context.editable){var C,R,D;v.init({element:W.node(),prepFn:function(){var t=u.getTranslate(W);C=t.x,R=t.y,D={}},moveFn:function(t,e){W.call(u.setTranslate,C+t,R+e);var r="pointer";if(U.showarrow)U.axref===U.xref?D[S+".ax"]=V.p2l(V.l2p(U.ax)+t):D[S+".ax"]=U.ax+t,U.ayref===U.yref?D[S+".ay"]=q.p2l(q.l2p(U.ay)+e):D[S+".ay"]=U.ay+e,z(t,e);else{if(V)D[S+".x"]=U.x+t/V._m;else{var n=U._xsize/L.w,i=U.x+U._xshift/L.w-n/2;D[S+".x"]=v.align(i+t/L.w,n,0,1,U.xanchor)}if(q)D[S+".y"]=U.y+e/q._m;else{var o=U._ysize/L.h,a=U.y-U._yshift/L.h-o/2;D[S+".y"]=v.align(a-e/L.h,o,0,1,U.yanchor)}V&&q||(r=v.getCursor(V?.5:D[S+".x"],q?.5:D[S+".y"],U.xanchor,U.yanchor))}var s=P(C,R),l=s[0]+t,c=s[1]+e;W.call(u.setTranslate,C+t,R+e),Y.attr({transform:"rotate("+H+","+l+","+c+")"}),p(W,r)},doneFn:function(e){if(p(W),e){l.relayout(t,D);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var b,x=t.layout,_=t._fullLayout;if(!s(e)||-1===e){if(!e&&Array.isArray(i))return x.annotations=i,m.supplyLayoutDefaults(x,_),void m.drawAll(t);if("remove"===i)return delete x.annotations,_.annotations=[],void m.drawAll(t);if(r&&"add"!==i){for(b=0;b<_.annotations.length;b++)m.draw(t,b,r,i);return}e=_.annotations.length,_.annotations.push({})}if(!r&&i){if("remove"===i){for(_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),_.annotations.splice(e,1),x.annotations.splice(e,1),b=e;b<_.annotations.length;b++)_._infolayer.selectAll('.annotation[data-index="'+(b+1)+'"]').attr("data-index",String(b)),m.draw(t,b);return}if("add"===i||u.isPlainObject(i)){_.annotations.splice(e,0,{});var w=u.isPlainObject(i)?u.extendFlat({},i):{text:"New text"};for(x.annotations?x.annotations.splice(e,0,w):x.annotations=[w],b=_.annotations.length-1;b>e;b--)_._infolayer.selectAll('.annotation[data-index="'+(b-1)+'"]').attr("data-index",String(b)),m.draw(t,b)}}_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var M=x.annotations[e],k=_.annotations[e];if(M){var A={xref:M.xref,yref:M.yref},T={};"string"==typeof r&&r?T[r]=i:u.isPlainObject(r)&&(T=r);var E=Object.keys(T);for(b=0;bb;b++){var I=z[b];if(void 0===T[I]&&void 0!==M[I]){var P=c.getFromId(t,c.coerceRef(A,{},t,I)),C=c.getFromId(t,c.coerceRef(M,{},t,I)),R=M[I],D=k["_"+I+"type"];if(void 0!==T[I+"ref"]){var O="auto"===M[I+"anchor"],F="x"===I?L.w:L.h,j=(k["_"+I+"size"]||0)/(2*F);if(P&&C)R=(R-P.range[0])/(P.range[1]-P.range[0]),R=C.range[0]+R*(C.range[1]-C.range[0]);else if(P){if(R=(R-P.range[0])/(P.range[1]-P.range[0]),R=P.domain[0]+R*(P.domain[1]-P.domain[0]),O){var N=R+j,B=R-j;2/3>R+B?R=B:R+N>4/3&&(R=N)}}else C&&(O&&(1/3>R?R+=j:R>2/3&&(R-=j)),R=(R-C.domain[0])/(C.domain[1]-C.domain[0]),R=C.range[0]+R*(C.range[1]-C.range[0]))}C&&C===P&&D&&("log"===D&&"log"!==C.type?R=Math.pow(10,R):"log"!==D&&"log"===C.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),M[I]=R}}var U=n(M,_);_.annotations[e]=U;var V=c.getFromId(t,U.xref),q=c.getFromId(t,U.yref),G={x:0,y:0},H=+U.textangle||0,X=_._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",U.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:M,fullAnnotation:U})}),Y=X.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),W=Y.append("g"),Z=U.borderwidth,K=U.borderpad,J=Z+K,$=W.append("rect").attr("class","bg").style("stroke-width",Z+"px").call(h.stroke,U.bordercolor).call(h.fill,U.bgcolor),Q=U.font,tt=W.append("text").classed("annotation",!0).attr("data-unformatted",U.text).text(U.text);t._context.editable?tt.call(d.makeEditable,W).call(g).on("edit",function(r){U.text=r,this.attr({"data-unformatted":U.text}),this.call(g);var n={};n["annotations["+e+"].text"]=U.text,V&&V.autorange&&(n[V._name+".autorange"]=!0),q&&q.autorange&&(n[q._name+".autorange"]=!0),l.relayout(t,n)}):tt.call(g),Y.attr({transform:"rotate("+H+","+G.x+","+G.y+")"}).call(f.setPosition,G.x,G.y)}},m.arrowhead=function(t,e,r,n){s(n)||(n=1);var i=t.node(),o=m.ARROWPATHS[e||0];if(o){"string"==typeof r&&r||(r="end");var l,u,c,d,p=(f.getPx(t,"stroke-width")||1)*n,v=t.style("stroke")||h.defaultLine,g=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=o.backoff*p;if("line"===i.nodeName){if(l={x:+t.attr("x1"),y:+t.attr("y1")},u={x:+t.attr("x2"),y:+t.attr("y2")},c=Math.atan2(l.y-u.y,l.x-u.x),d=c+Math.PI,x){var _=x*Math.cos(c),w=x*Math.sin(c);y&&(l.x-=_,l.y-=w,t.attr({x1:l.x,y1:l.y})),b&&(u.x+=_,u.y+=w,t.attr({x2:u.x,y2:u.y}))}}else if("path"===i.nodeName){var M=i.getTotalLength(),k="";if(y){var A=i.getPointAtLength(0),T=i.getPointAtLength(.1);c=Math.atan2(A.y-T.y,A.x-T.x),l=i.getPointAtLength(Math.min(x,M)),x&&(k="0px,"+x+"px,")}if(b){var E=i.getPointAtLength(M),S=i.getPointAtLength(M-.1);if(d=Math.atan2(E.y-S.y,E.x-S.x),u=i.getPointAtLength(Math.max(0,M-x)),x){var L=k?2*x:x;k+=M-L+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var z=function(r,n){e>5&&(n=0),a.select(i.parentElement).append("path").attr({"class":t.attr("class"),d:o.path,transform:"translate("+r.x+","+r.y+")rotate("+180*n/Math.PI+")scale("+p+")"}).style({fill:v,opacity:g,"stroke-width":0})};y&&z(l,c),b&&z(u,d)}},m.calcAutorange=function(t){var e=t._fullLayout,r=e.annotations;if(r.length&&t._fullData.length){var n={};r.forEach(function(t){n[t.xref]=!0,n[t.yref]=!0});var o=c.list(t).filter(function(t){return t.autorange&&n[t._id]});if(o.length)return u.syncOrAsync([m.drawAll,i],t)}}},{"../../lib":568,"../../lib/setcursor":577,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/cartesian/axes":592,"../color":483,"../dragelement":504,"../drawing":506,"./arrow_paths":479,"./attributes":480,d3:119,"fast-isnumeric":123}],482:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],483:[function(t,e,r){"use strict";function n(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var a=0;a=0))return t;if(3===a)n[a]>1&&(n[a]=1);else if(n[a]>=1)return t}var s=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),o=t("fast-isnumeric"),a=e.exports={},s=t("./attributes");a.defaults=s.defaults,a.defaultLine=s.defaultLine,a.lightLine=s.lightLine,a.background=s.background,a.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},a.rgb=function(t){return a.tinyRGB(i(t))},a.opacity=function(t){return t?i(t).getAlpha():0},a.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},a.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||a.background).toRgb(),o=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r:o.r*(1-r.a)+r.r*r.a,g:o.g*(1-r.a)+r.g*r.a,b:o.b*(1-r.a)+r.b*r.a};return i(s).toRgbString()},a.contrast=function(t,e,r){var n=i(t),o=n.isLight()?n.darken(r):n.lighten(e);return o.toString()},a.stroke=function(t,e){var r=i(e);t.style({stroke:a.tinyRGB(r),"stroke-opacity":r.getAlpha()})},a.fill=function(t,e){var r=i(e);t.style({fill:a.tinyRGB(r),"fill-opacity":r.getAlpha()})},a.clean=function(t){if(t&&"object"==typeof t){var e,r,i,o,s=Object.keys(t);for(e=0;el&&(o[1]-=(at-l)/2)):r.node()&&!r.classed("js-placeholder")&&(at=f.bBox(e.node()).height),at){if(at+=5,"top"===x.titleside)$.domain[1]-=at/A.h,o[1]*=-1;else{$.domain[0]+=at/A.h;var c=Math.max(1,r.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),$.setScale()}}it.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(A.h*(1-$.domain[1]))+")");var h=it.select(".cbfills").selectAll("rect.cbfill").data(L);h.enter().append("rect").classed("cbfill",!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?E[0]:(L[e]+L[e-1])/2,e===L.length-1?E[1]:(L[e]+L[e+1])/2].map($.c2p).map(Math.round);e!==L.length-1&&(r[1]+=r[1]>r[0]?1:-1);var o=I(t).replace("e-",""),a=i(o).toHexString();n.select(this).attr({x:X,width:Math.max(N,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:a})});var d=it.select(".cblines").selectAll("path.cbline").data(x.line.color&&x.line.width?S:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+X+","+(Math.round($.c2p(t))+x.line.width/2%1)+"h"+N).call(f.lineGroupStyle,x.line.width,z(t),x.line.dash)}),$._axislayer.selectAll("g."+$._id+"tick,path").remove(),$._pos=X+N+(x.outlinewidth||0)/2-("outside"===x.ticks?1:0),$.side="right",u.syncOrAsync([function(){return s.doTicks(t,$,!0)},function(){if(-1===["top","bottom"].indexOf(x.titleside)){var e=$.titlefont.size,r=$._offset+$._length/2,i=A.l+($.position||0)*A.w+("right"===$.side?10+e*($.showticklabels?1:.5):-10-e*($.showticklabels?.5:0));w("h"+$._id+"title",{avoid:{selection:n.select(t).selectAll("g."+$._id+"tick"),side:x.titleside,offsetLeft:A.l,offsetTop:A.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,r){var n,i=b();n=a.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:$,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:it.select(".cbtitle")},s="h"===e.charAt(0)?e.substr(1):"h"+e;it.selectAll("."+s+",."+s+"-math-group").remove(),p.draw(t,e,c(o,r||{}))}function M(){var r=N+x.outlinewidth/2+f.bBox($._axislayer.node()).width;if(O=ot.select("text"),O.node()&&!O.classed("js-placeholder")){var n,i=ot.select(".h"+$._id+"title-math-group").node();n=i&&-1!==["top","bottom"].indexOf(x.titleside)?f.bBox(i).width:f.bBox(ot.node()).right-X-A.l,r=Math.max(r,n)}var o=2*x.xpad+r+x.borderwidth+x.outlinewidth/2,s=Z-K;it.select(".cbbg").attr({x:X-x.xpad-(x.borderwidth+x.outlinewidth)/2,y:K-G,width:Math.max(o,2),height:Math.max(s+2*G,2)}).call(d.fill,x.bgcolor).call(d.stroke,x.bordercolor).style({"stroke-width":x.borderwidth}),it.selectAll(".cboutline").attr({x:X,y:K+x.ypad+("top"===x.titleside?at:0),width:Math.max(N,2),height:Math.max(s-2*x.ypad-at,2)}).call(d.stroke,x.outlinecolor).style({fill:"None","stroke-width":x.outlinewidth});var l=({center:.5,right:1}[x.xanchor]||0)*o;it.attr("transform","translate("+(A.l-l)+","+A.t+")"),a.autoMargin(t,e,{x:x.x,y:x.y,l:o*({right:1,center:.5}[x.xanchor]||0),r:o*({left:1,center:.5}[x.xanchor]||0),t:s*({bottom:1,middle:.5}[x.yanchor]||0),b:s*({top:1,middle:.5}[x.yanchor]||0)})}var k=t._fullLayout,A=k._size;if("function"!=typeof x.fillcolor&&"function"!=typeof x.line.color)return void k._infolayer.selectAll("g."+e).remove();var T,E=n.extent(("function"==typeof x.fillcolor?x.fillcolor:x.line.color).domain()),S=[],L=[],z="function"==typeof x.line.color?x.line.color:function(){return x.line.color},I="function"==typeof x.fillcolor?x.fillcolor:function(){return x.fillcolor},P=x.levels.end+x.levels.size/100,C=x.levels.size,R=1.001*E[0]-.001*E[1],D=1.001*E[1]-.001*E[0];for(T=x.levels.start;0>(T-P)*C;T+=C)T>R&&D>T&&S.push(T);if("function"==typeof x.fillcolor)if(x.filllevels)for(P=x.filllevels.end+x.filllevels.size/100,C=x.filllevels.size,T=x.filllevels.start;0>(T-P)*C;T+=C)T>E[0]&&T1){var nt=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));tt*=nt*u.roundUp(rt/nt,[2,5,10]),(Math.abs(x.levels.start)/x.levels.size+1e-6)%1<2e-6&&($.tick0=0)}$.dtick=tt}$.domain=[W+H,W+V-H],$.setScale();var it=k._infolayer.selectAll("g."+e).data([0]);it.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),it.attr("transform","translate("+Math.round(A.l)+","+Math.round(A.t)+")");var ot=it.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(A.l)+",-"+Math.round(A.t)+")");$._axislayer=it.select(".cbaxis");var at=0;if(-1!==["top","bottom"].indexOf(x.titleside)){var st,lt=A.l+(x.x+q)*A.w,ut=$.titlefont.size;st="top"===x.titleside?(1-(W+V-H))*A.h+A.t+3+.75*ut:(1-(W+H))*A.h+A.t-3-.25*ut,w($._id+"title",{attributes:{x:lt,y:st,"text-anchor":"start"}})}var ct=u.syncOrAsync([a.previousPromises,_,a.previousPromises,M],t);if(ct&&ct.then&&(t._promises||[]).push(ct),t._context.editable){var ht,ft,dt;l.init({element:it.node(),prepFn:function(){ht=it.attr("transform"),h(it)},moveFn:function(t,e){it.attr("transform",ht+" translate("+t+","+e+")"),ft=l.align(Y+t/A.w,B,0,1,x.xanchor),dt=l.align(W-e/A.h,V,0,1,x.yanchor);var r=l.getCursor(ft,dt,x.xanchor,x.yanchor);h(it,r)},doneFn:function(e){h(it),e&&void 0!==ft&&void 0!==dt&&o.restyle(t,{"colorbar.x":ft,"colorbar.y":dt},b().index)}})}return ct}function b(){var r,n,i=e.substr(2);for(r=0;rc*h?i.RdBu:c>=0?i.Reds:i.Blues,l.colorscale=f,s.reversescale&&(f=o(f)),s.colorscale=f)}},{"../../lib":568,"./flip_scale":494,"./scales":501}],491:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":563,"./attributes":489,"./scales.js":501}],492:[function(t,e,r){"use strict";var n=t("./scales"); -e.exports=n.RdBu},{"./scales":501}],493:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../colorbar/has_colorbar"),a=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,r,u,c){var h=c.prefix,f=c.cLetter,d=h.slice(0,h.length-1),p=h?i.nestedProperty(t,d).get()||{}:t,v=h?i.nestedProperty(e,d).get()||{}:e,m=p[f+"min"],g=p[f+"max"],y=p.colorscale,b=n(m)&&n(g)&&g>m;u(h+f+"auto",!b),u(h+f+"min"),u(h+f+"max");var x;void 0!==y&&(x=!s(y)),u(h+"autocolorscale",x);var _=u(h+"colorscale"),w=u(h+"reversescale");if(w&&(v.colorscale=l(_)),"marker.line."!==h){var M;h&&(M=o(p));var k=u(h+"showscale",M);k&&a(p,v,r)}}},{"../../lib":568,"../colorbar/defaults":485,"../colorbar/has_colorbar":487,"./flip_scale":494,"./is_valid_scale":498,"fast-isnumeric":123}],494:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=t.length,n=new Array(r),i=r-1,o=0;i>=0;i--,o++)e=t[i],n[o]=[1-e[0],e[1]];return n}},{}],495:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),o(t)?t:e):e}},{"./default_scale":492,"./is_valid_scale_array":499,"./scales":501}],496:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var r=e?i.nestedProperty(t,e).get()||{}:t,a=r.color,s=!1;if(Array.isArray(a))for(var l=0;lf;f++)l=t[f],c[f]=e+l[0]*(r-e),h[f]=i(l[1]).toRgb();var d=n.scale.linear().domain(c).interpolate(n.interpolateObject).range(h);return function(t){if(o(t)){var n=a.constrain(t,e,r),l=d(n);return i(l).toRgbString()}return i(t).isValid()?t:s.defaultLine}}},{"../../lib":568,"../color":483,d3:119,"fast-isnumeric":123,tinycolor2:454}],501:[function(t,e,r){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],502:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){var o=(t-r)/(n-r),a=o+e/(n-r),s=(o+a)/2;return"left"===i||"bottom"===i?o:"center"===i||"middle"===i?s:"right"===i||"top"===i?a:2/3-s>o?o:a>4/3-s?a:s}},{}],503:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,o){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":568}],504:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),a=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,v._dragged=!1,v._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,h=(new Date).getTime(),h-v._mouseDownTimeg&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(v._dragged,m),!v._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(v),v._dragged=!1,a.pauseEvent(e)}var u,c,h,f,d,p,v=a.getPlotDiv(t.element)||{},m=1,g=s.DBLCLICKDELAY;v._mouseDownTime||(v._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":568,"../../plotly":589,"../../plots/cartesian/constants":597,"./align":502,"./cursor":503,"./unhover":505}],505:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":562}],506:[function(t,e,r){"use strict";function n(t,e,r,n){var o=t[0]-e[0],a=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(o*o+a*a,x/2),c=Math.pow(s*s+l*l,x/2),h=(c*c*o-u*u*s)*n,f=(c*c*a-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[i.round(e[0]+(d&&h/d),2),i.round(e[1]+(d&&f/d),2)],[i.round(e[0]-(p&&h/p),2),i.round(e[1]-(p&&f/p),2)]]}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../plots/plots"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),f=t("../../traces/scatter/subtypes"),d=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},p.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},p.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},p.setRect=function(t,e,r,n,i){t.call(p.setPosition,e,r).call(p.setSize,n,i)},p.translatePoints=function(t,e,r){t.each(function(t){var n=t.xp||e.c2p(t.x),a=t.yp||r.c2p(t.y),s=i.select(this);o(n)&&o(a)?"text"===this.nodeName?s.attr("x",n).attr("y",a):s.attr("transform","translate("+n+","+a+")"):s.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):r||0},p.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},a=e||o.width||0,l=n||o.dash||"";i.select(this).call(s.stroke,r||o.color).call(p.dashLine,l,a)})},p.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(n){u.error(n,t),r.remove()}})};var v=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=p.symbolNames.length,g="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=r.line;if(a.traceIs(e,"symbols")){var o=d(e);t.attr("d",function(t){var n;n="various"===t.ms||"various"===r.size?3:f.isBubble(e)?o(t.ms):(r.size||6)/2,t.mrc=n;var i=p.symbolNumber(t.mx||r.symbol)||0,a=i%100;return t.om=i%200>=100,p.symbolFuncs[a](n)+(i>=200?g:"")}).style("opacity",function(t){return(t.mo+1||r.opacity+1)-1})}var l=(e._input||{}).marker||{},u=p.tryColorscale(r,l,""),c=p.tryColorscale(r,l,"line.");t.each(function(t){var e,o,a;t.so?(a=n.outlierwidth,o=n.outliercolor,e=r.outliercolor):(a=(t.mlw+1||n.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(n.color)?s.defaultLine:n.color,e="mc"in t?t.mcc=u(t.mc):Array.isArray(r.color)?s.defaultLine:r.color||"rgba(0,0,0,0)");var l=i.select(this);t.om?l.call(s.stroke,e).style({"stroke-width":(a||1)+"px",fill:"none"}):(l.style("stroke-width",a+"px").call(s.fill,e),a&&l.call(s.stroke,o))})}},p.tryColorscale=function(t,e,r){var n=u.nestedProperty(t,r+"color").get(),i=u.nestedProperty(t,r+"colorscale").get(),a=u.nestedProperty(t,r+"cauto").get(),s=u.nestedProperty(t,r+"cmin"),c=u.nestedProperty(t,r+"cmax"),h=s.get(),f=c.get();return i&&Array.isArray(n)?(!a&&o(h)&&o(f)||(h=1/0,f=-(1/0),n.forEach(function(t){o(t)&&(h>t&&(h=+t),t>f&&(f=+t))}),h>f&&(h=0,f=1),s.set(h),c.set(f),u.nestedProperty(e,r+"cmin").set(h),u.nestedProperty(e,r+"cmax").set(f)),l.makeScaleFunction(i,h,f)):u.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;p.textPointStyle=function(t,e){t.each(function(t){var r=i.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,s=-1!==a.indexOf("top")?"top":-1!==a.indexOf("bottom")?"bottom":"middle",l=-1!==a.indexOf("left")?"end":-1!==a.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,h=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(p.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(c.convertToTspans);var f=i.select(this.parentNode),d=r.selectAll("tspan.line"),v=((d[0].length||1)-1)*b+1,m=y[l]*h,g=.75*u+y[s]*h+(y[s]-1)*v*u/2;f.attr("transform","translate("+m+","+g+")"),v>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var x=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,i="M"+t[0],o=[];for(r=1;rr;r++)a.push(n(t[r-1],t[r],t[r+1],e));for(a.push(n(t[o-1],t[o],t[0],e)),r=1;o>=r;r++)i+="C"+a[r-1][1]+" "+a[r][0]+" "+t[r];return i+="C"+a[o][1]+" "+a[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+i.round(e[0],2)+"V"+i.round(e[1],2)},vh:function(t,e){return"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},hvh:function(t,e){return"H"+i.round((t[0]+e[0])/2,2)+"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},vhv:function(t,e){return"V"+i.round((t[1]+e[1])/2,2)+"H"+i.round(e[0],2)+"V"+i.round(e[1],2)}},w=function(t,e){return"L"+i.round(e[0],2)+","+i.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var r="M"+i.round(t[0][0],2)+","+i.round(t[0][1],2),n=1;n=k&&(i.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),u.extendFlat({},l)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../../lib/svg_text_utils":581,"../../plots/plots":648,"../../traces/scatter/make_bubble_size_func":764,"../../traces/scatter/subtypes":769,"../color":483,"../colorscale":497,"./symbol_defs":507,d3:119,"fast-isnumeric":123}],507:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,o="l-"+e+",-"+e,a="l-"+e+","+e;return"M0,"+e+r+i+o+i+o+a+o+a+r+a+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),o=n.round(t*-.309,2),a=n.round(.809*t,2);return"M"+e+","+o+"L"+r+","+a+"H-"+r+"L-"+e+","+o+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),o=n.round(.363*e,2),a=n.round(.588*e,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),h=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+o+","+u+"L"+a+","+c+"L0,"+h+"L-"+a+","+c+"L-"+o+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+r+a+e+","+r+a+"0,-"+i+a+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+r+a+"-"+e+",-"+r+a+"0,"+i+a+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:119}],508:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],509:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},l=o.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(o),h=0;hs;s++)a[s]={x:r[s],y:i[s]};return a[0].trace=t,n.calc({calcdata:[a],_fullLayout:e}),a},n.plot=t("./plot"),n.style=t("./style"),n.hoverInfo=function(t,e,r){(e.error_y||{}).visible&&(r.yerr=t.yh-t.y,e.error_y.symmetric||(r.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(r.xerr=t.xh-t.x,e.error_x.symmetric||(r.xerrneg=t.x-t.xs))}},{"./attributes":508,"./calc":509,"./defaults":511,"./plot":513,"./style":514}],513:[function(t,e,r){"use strict";function n(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};return void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),o(n.ys)||(n.noYS=!0,n.ys=r.c2p(t.ys,!0))),void 0!==t.xh&&(n.xh=e.c2p(t.xh),n.xs=e.c2p(t.xs),o(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0))),n}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../lib"),s=t("../../traces/scatter/subtypes");e.exports=function(t,e){var r=e.x(),l=e.y();t.each(function(t){var e=t[0].trace,u=e.error_x||{},c=e.error_y||{},h=s.hasMarkers(e)&&e.marker.maxdisplayed>0;if(c.visible||u.visible){var f=i.select(this).selectAll("g.errorbar").data(a.identity);f.enter().append("g").classed("errorbar",!0),f.each(function(t){var e=i.select(this),a=n(t,r,l);if(!h||t.vis){var s;if(c.visible&&o(a.x)&&o(a.yh)&&o(a.ys)){var f=c.width;s="M"+(a.x-f)+","+a.yh+"h"+2*f+"m-"+f+",0V"+a.ys,a.noYS||(s+="m-"+f+",0h"+2*f),e.append("path").classed("yerror",!0).attr("d",s)}if(u.visible&&o(a.y)&&o(a.xh)&&o(a.xs)){var d=(u.copy_ystyle?c:u).width;s="M"+a.xh+","+(a.y-d)+"v"+2*d+"m0,-"+d+"H"+a.xs,a.noXS||(s+="m0,-"+d+"v"+2*d),e.append("path").classed("xerror",!0).attr("d",s)}}})}})}},{"../../lib":568,"../../traces/scatter/subtypes":769,d3:119,"fast-isnumeric":123}],514:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},a=n.select(this);a.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),o.copy_ystyle&&(o=r),a.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(i.stroke,o.color)})}},{"../color":483,d3:119}],515:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":597}],516:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;2>s;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],o=0;o=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],520:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482}],521:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],522:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/plots"),o=t("./attributes"),a=t("./helpers");e.exports=function(t,e,r){function s(t,e){return n.coerce(f,d,o,t,e)}for(var l,u,c,h,f=t.legend||{},d=e.legend={},p=0,v="normal",m=0;m1);if(y!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),n.coerceFont(s,"font",e.font),s("orientation"),"h"===d.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(l=0,c="left",u=1.1,h="bottom"):(l=0,c="left",u=-.1,h="top")}s("traceorder",v),a.isGrouped(e.legend)&&s("tracegroupgap"),s("x",l),s("xanchor",c),s("y",u),s("yanchor",h),n.noneOrAll(f,d,["x","y"])}}},{"../../lib":568,"../../plots/plots":648,"./attributes":520,"./helpers":525}],523:[function(t,e,r){"use strict";function n(t,e){function r(r){c.util.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=f.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,h=t.selectAll("text.legendtext").data([0]);h.enter().append("text").classed("legendtext",!0),h.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,i.legend.font).text(u),e._context.editable&&!s?h.call(c.util.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" "),c.restyle(e,"name",t,l)}):h.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,o=t.data()[0][0],a=e._fullData,s=o.trace,l=s.legendgroup,u=[];if(f.traceIs(s,"pie")){var h=o.label,d=r.indexOf(h);-1===d?r.push(h):r.splice(d,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),d=f[0].length||1;r=l*d,n=c.node()&&p.bBox(c.node()).width;var v=l*(.3+(1-d)/2);c.attr("y",v),f.attr("y",v)}r=Math.max(r,16)+3,o.attr({x:0,y:-r/2,height:r}),i.height=r,i.width=n}function a(t,e,r){var n=t._fullLayout,i=n.legend,o=i.borderwidth,a=b.isGrouped(i);if(b.isVertical(i))a&&e.each(function(t,e){h.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;h.setTranslate(this,o,5+o+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*o,i.height+=10+2*o,a&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),r.selectAll(".legendtoggle").attr("width",(t._context.editable?0:i.width)+40),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height);else if(a){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,f=l.length;f>c;c++){var d=l[c].map(function(t){return t[0].width}),p=40+Math.max.apply(null,d);i.width+=i.tracegroupgap+p,s.push(i.width)}e.each(function(t,e){h.setTranslate(this,s[e],0)}),e.each(function(){var t=u.select(this),e=t.selectAll("g.traces"),r=0;e.each(function(t){var e=t[0],n=e.height;h.setTranslate(this,0,5+o+r+n/2),r+=n}),i.height=Math.max(i.height,r)}),i.height+=10+2*o,i.width+=2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}else{i.width=0,i.height=0;var v=0,m=0,g=0,y=0;r.each(function(t){g=Math.max(40+t[0].width,g)}),r.each(function(t){var e=t[0],r=g,a=i.tracegroupgap||5;o+y+a+r>n.width-(n.margin.r+n.margin.l)&&(y=0,v+=m,i.height=i.height+m,m=0),h.setTranslate(this,o+y,5+o+e.height/2+v),i.width+=a+r,i.height=Math.max(i.height,e.height),y+=a+r,m=Math.max(e.height,m)}),i.width+=2*o,i.height+=10+2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}}function s(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center");var i="top";x.isBottomAnchor(r)?i="bottom":x.isMiddleAnchor(r)&&(i="middle"),f.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center"),f.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),h=t("../../lib"),f=t("../../plots/plots"),d=t("../dragelement"),p=t("../drawing"),v=t("../color"),m=t("./constants"),g=t("./get_legend_data"),y=t("./style"),b=t("./helpers"),x=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(h.setTranslate,0,e),E.call(p.setRect,j,t,m.scrollBarWidth,m.scrollBarHeight),k.select("rect").attr({y:b.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var b=r.legend,_=r.showlegend&&g(t.calcdata,b),w=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void f.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({"class":"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+o).data([0]);k.enter().append("clipPath").attr("id",o).append("rect");var A=M.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(v.stroke,b.bordercolor),A.call(v.fill,b.bgcolor),A.style("stroke-width",b.borderwidth+"px");var T=M.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var E=M.selectAll("rect.scrollbar").data([0]);E.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=T.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var L=S.selectAll("g.traces").data(h.identity);L.enter().append("g").attr("class","traces"),L.exit().remove(),L.call(y).style("opacity",function(t){var e=t[0].trace;return f.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var z=0!==M.enter().size();z&&(a(t,S,L),s(t));var I=0,P=r.width,C=0,R=r.height;a(t,S,L),b.height>R?l(t):s(t);var D=r._size,O=D.l+D.w*b.x,F=D.t+D.h*(1-b.y);x.isRightAnchor(b)?O-=b.width:x.isCenterAnchor(b)&&(O-=b.width/2),x.isBottomAnchor(b)?F-=b.height:x.isMiddleAnchor(b)&&(F-=b.height/2);var j=b.width,N=D.w;j>N?(O=D.l,j=N):(O+j>P&&(O=P-j),I>O&&(O=I),j=Math.min(P-O,b.width));var B=b.height,U=D.h;B>U?(F=D.t,B=U):(F+B>R&&(F=R-B),C>F&&(F=C),B=Math.min(R-F,b.height)),h.setTranslate(M,O,F);var V,q,G=B-m.scrollBarHeight-2*m.scrollBarMargin,H=b.height-B;if(b.height<=B||t._context.staticPlot)A.attr({width:j-b.borderwidth,height:B-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),h.setTranslate(T,0,0),k.select("rect").attr({width:j-2*b.borderwidth,height:B-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth}),T.call(p.setClipUrl,o);else{V=m.scrollBarMargin,q=T.attr("data-scroll")||0,A.attr({width:j-2*b.borderwidth+m.scrollBarWidth+m.scrollBarMargin,height:B-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),k.select("rect").attr({width:j-2*b.borderwidth+m.scrollBarWidth+m.scrollBarMargin,height:B-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth-q}),T.call(p.setClipUrl,o),z&&e(V,q),M.on("wheel",null),M.on("wheel",function(){q=h.constrain(T.attr("data-scroll")-u.event.deltaY/G*H,-H,0),V=m.scrollBarMargin-q/H*G,e(V,q),u.event.preventDefault()}),E.on(".drag",null),T.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=h.constrain(u.event.y-m.scrollBarHeight/2,m.scrollBarMargin,m.scrollBarMargin+G),q=-(V-m.scrollBarMargin)/G*H,e(V,q)});E.call(X),T.call(X)}if(t._context.editable){var Y,W,Z,K;M.classed("cursor-move",!0),d.init({element:M.node(),prepFn:function(){var t=h.getTranslate(M);Z=t.x,K=t.y},moveFn:function(t,e){var r=Z+t,n=K+e;h.setTranslate(M,r,n),Y=d.align(r,0,D.l,D.l+D.w,b.xanchor),W=d.align(n,0,D.t+D.h,D.t,b.yanchor)},doneFn:function(e){e&&void 0!==Y&&void 0!==W&&c.relayout(t,{"legend.x":Y,"legend.y":W})}})}}}},{"../../lib":568,"../../plotly":589,"../../plots/plots":648,"../color":483,"../dragelement":504,"../drawing":506,"./anchor_utils":519,"./constants":521,"./get_legend_data":524,"./helpers":525,"./style":527,d3:119}],524:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+h;l.push(n),s[n]=[[r]],h++}}var o,a,s={},l=[],u=!1,c={},h=0;for(o=0;oo;o++)g=s[l[o]],y[o]=i.isReversed(e)?g.reverse():g;else{for(y=[new Array(b)],o=0;b>o;o++)g=s[l[o]][0],y[0][i.isReversed(e)?b-o-1:o]=g;b=1}return e._lgroupsLength=b,y}},{"../../plots/plots":648,"./helpers":525}],525:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.legendGetsTrace=function(t){return t.visible&&n.traceIs(t,"showLegend")},r.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},r.isVertical=function(t){return"h"!==t.orientation},r.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":648}],526:[function(t,e,r){"use strict";var n=e.exports={};n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.draw=t("./draw"),n.style=t("./style")},{"./attributes":520,"./defaults":522,"./draw":523,"./style":527}],527:[function(t,e,r){"use strict";function n(t){var e=t[0].trace,r=e.visible&&e.fill&&"none"!==e.fill,n=d.hasLines(e),i=l.select(this).select(".legendfill").selectAll("path").data(r?[t]:[]);i.enter().append("path").classed("js-fill",!0),i.exit().remove(),i.attr("d","M5,0h30v6h-30z").call(h.fillGroupStyle);var o=l.select(this).select(".legendlines").selectAll("path").data(n?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(h.lineGroupStyle)}function i(t){function e(t,e,r){var n=u.nestedProperty(a,t).get(),i=Array.isArray(n)&&e?e(n):n;if(r){if(ir[1])return r[1]}return i}function r(t){return t[0]}var n,i,o=t[0],a=o.trace,s=d.hasMarkers(a),c=d.hasText(a),f=d.hasLines(a);if(s||c||f){var p={},v={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(v.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(o,p)],i=u.minExtend(a,v)}var m=l.select(this).select("g.legendpoints"),g=m.selectAll("path.scatterpts").data(s?n:[]);g.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),g.exit().remove(),g.call(h.pointStyle,i),s&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(h.textPointStyle,i)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(f.fill,t.mc||r.color),e&&i.call(f.stroke,t.mlc||n.color)})}function a(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(f.fill,t.fc||e.fillcolor),r&&n.call(f.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../lib"),c=t("../../plots/plots"),h=t("../drawing"),f=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(a).each(s).each(n).each(i)}},{"../../lib":568,"../../plots/plots":648,"../../traces/pie/style_one":748,"../../traces/scatter/subtypes":769,"../color":483,"../drawing":506,d3:119}],528:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,o=t._fullLayout,a={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,f=(1-c)/2,d=u.Axes.list(t,null,!0),p=0;py;y++){var b=s[y];f=g[b]={};for(var x=0;x1)return n(["resetViews","toggleHover"]),a(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var g=i(s),y=[];return((u||p)&&!g||v)&&(y=["zoom2d","pan2d"]),(u||v)&&o(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||g||v||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),a(m,r)}function i(t){for(var e=l.Axes.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var v=i(e,r,l);c("x",v[0]),c("y",v[1]),o.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),o.coerceFont(c,"font",r.font);var m=c("bgcolor");c("activecolor",a.contrast(m,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":568,"../color":483,"./attributes":531,"./button_attributes":532,"./constants":533}],535:[function(t,e,r){"use strict";function n(t){for(var e=g.list(t,"x",!0),r=[],n=0;ne){var r=e;e=t,t=r}s.setAttributes(w,{"data-min":t,"data-max":e}),s.setAttributes(C,{x:t,width:e-t}),s.setAttributes(A,{width:t}),s.setAttributes(T,{x:e,width:p-e}),s.setAttributes(E,{transform:"translate("+(t-m-1)+")"}),s.setAttributes(z,{transform:"translate("+e+")"})}var h=t._fullLayout,f=h._infolayer.selectAll("g.range-slider"),d=h.xaxis.rangeslider,p=h._size.w,v=(h.height-h.margin.b-h.margin.t)*d.thickness,m=2,g=Math.floor(d.borderwidth/2),y=h.margin.l,b=h.height-v-h.margin.b,x=0,_=p,w=document.createElementNS(a,"g");s.setAttributes(w,{"class":"range-slider","data-min":x,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+b+")"});var M=document.createElementNS(a,"rect"),k=d.borderwidth%2===0?d.borderwidth:d.borderwidth-1;s.setAttributes(M,{fill:d.bgcolor,stroke:d.bordercolor,"stroke-width":d.borderwidth,height:v+k,width:p+k,transform:"translate(-"+g+", -"+g+")","shape-rendering":"crispEdges"});var A=document.createElementNS(a,"rect");s.setAttributes(A,{x:0,width:x,height:v,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(a,"rect");s.setAttributes(T,{x:_,width:p-_,height:v,fill:"rgba(0,0,0,0.4)"});var E=document.createElementNS(a,"g"),S=document.createElementNS(a,"rect"),L=document.createElementNS(a,"rect");s.setAttributes(E,{transform:"translate("+(x-m-1)+")"}),s.setAttributes(S,{width:10,height:v,x:-6,fill:"transparent",cursor:"col-resize"}),s.setAttributes(L,{width:m,height:v/2,y:v/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(E,[L,S]);var z=document.createElementNS(a,"g"),I=document.createElementNS(a,"rect"),P=document.createElementNS(a,"rect");s.setAttributes(z,{transform:"translate("+_+")"}),s.setAttributes(I,{width:10,height:v,x:-2,fill:"transparent",cursor:"col-resize"}),s.setAttributes(P,{width:m,height:v/2,y:v/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(z,[P,I]);var C=document.createElementNS(a,"rect");s.setAttributes(C,{x:x,width:_-x,height:v,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function r(t){var r,n,h=+t.clientX-o;switch(i){case C:w.style.cursor="ew-resize",r=+s+h,n=+l+h,c(r,n),u(e(r),e(n));break;case S:w.style.cursor="col-resize",r=+s+h,n=+l,c(r,n),u(e(r),e(n));break;case I:w.style.cursor="col-resize",r=+s,n=+l+h,c(r,n),u(e(r),e(n));break;default:w.style.cursor="ew-resize",r=a,n=a+h,c(r,n),u(e(r),e(n))}}function n(){window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n),w.style.cursor="auto"}var i=t.target,o=t.clientX,a=o-w.getBoundingClientRect().left,s=w.getAttribute("data-min"),l=w.getAttribute("data-max");window.addEventListener("mousemove",r),window.addEventListener("mouseup",n)}),d.range||(d.range=i.getAutoRange(h.xaxis));var R=l(t,p,v);s.appendChildren(w,[M,R,A,T,C,E,z]),r(h.xaxis.range[0],h.xaxis.range[1]),f.data([0]).enter().append(function(){return d.setRange=r,w})}},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../../plotly":589,"../../plots/cartesian/axes":592,"./helpers":541,"./range_plot":543}],540:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,o){function a(t,e){return n.coerce(s,l,i,t,e)}if(t[r].rangeslider){var s=n.isPlainObject(t[r].rangeslider)?t[r].rangeslider:{},l=e[r].rangeslider={};if(a("bgcolor"),a("bordercolor"),a("borderwidth"),a("thickness"),a("visible"),a("range"),l.range&&!e[r].autorange){var u=l.range,c=e[r].range;u[0]=Math.min(u[0],c[0]),u[1]=Math.max(u[1],c[1])}else e[r]._needsExpand=!0;l.visible&&o.forEach(function(t){var r=e[t]||{};r.fixedrange=!0,e[t]=r})}}},{"../../lib":568,"./attributes":538}],541:[function(t,e,r){"use strict";r.setAttributes=function(t,e){for(var r in e)t.setAttribute(r,e[r])},r.appendChildren=function(t,e){for(var r=0;rl;l++){var u=s[l],c={_fullLayout:e},h=A.coerceRef(t,n,c,u);if("path"!==a){var f=.25,d=.75;if("paper"!==h){var p=A.getFromId(c,h),v=o(p);f=v(p.range[0]+f*(p.range[1]-p.range[0])),d=v(p.range[0]+d*(p.range[1]-p.range[0]))}r(u+"0",f),r(u+"1",d)}}return"path"===a?r("path"):k.noneOrAll(t,n,["x0","x1","y0","y1"]),n}function i(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function a(t,e){t.layout.shapes=e,z.supplyLayoutDefaults(t.layout,t._fullLayout),z.drawAll(t)}function s(t){delete t.layout.shapes,t._fullLayout.shapes=[],z.drawAll(t)}function l(t,e,r){for(var n=0;ne;i--)d(t,i).selectAll('[data-index="'+(i-1)+'"]').attr("data-index",i),z.draw(t,i)}function h(t,e,r,a){function s(r){var n={"data-index":e,"fill-rule":"evenodd",d:b(t,z)},i=z.line.width?z.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",z.opacity).call(T.stroke,i).call(T.fill,z.fillcolor).call(E.dashLine,z.line.dash,z.line.width);I&&o.call(E.setClipUrl,"clip"+t._fullLayout._uid+I),t._context.editable&&f(t,o,z,e)}var l,u;d(t,e).selectAll('[data-index="'+e+'"]').remove();var c=t.layout.shapes[e];if(c){var h={xref:c.xref,yref:c.yref},v={};"string"==typeof r&&r?v[r]=a:k.isPlainObject(r)&&(v=r);var m=Object.keys(v);for(l=0;ll;l++){var x=y[l];if(void 0===v[x]&&void 0!==c[x]){var _,w=x.charAt(0),M=A.getFromId(t,A.coerceRef(h,{},t,w)),S=A.getFromId(t,A.coerceRef(c,{},t,w)),L=c[x];void 0!==v[w+"ref"]&&(M?(_=i(M)(L),L=(_-M.range[0])/(M.range[1]-M.range[0])):L=(L-S.domain[0])/(S.domain[1]-S.domain[0]),S?(_=S.range[0]+L*(S.range[1]-S.range[0]),L=o(S)(_)):L=M.domain[0]+L*(M.domain[1]-M.domain[0])),c[x]=L}}var z=n(c,t._fullLayout);t._fullLayout.shapes[e]=z;var I;if("below"!==z.layer)I=(z.xref+z.yref).replace(/paper/g,""),s(t._fullLayout._shapeUpperLayer);else if("paper"===z.xref&&"paper"===z.yref)I="",s(t._fullLayout._shapeLowerLayer);else{var P,C=t._fullLayout._plots||{},R=Object.keys(C);for(l=0,u=R.length;u>l;l++)P=C[R[l]],I=R[l],p(t,z,P)&&s(P.shapelayer)}}}function f(t,e,r,n){function i(t){var r=J.right-J.left,n=J.bottom-J.top,i=t.clientX-J.left,o=t.clientY-J.top,a=r>W&&n>Z&&!t.shiftKey?S.getCursor(i/r,1-o/n):"move";L(e,a),Y=a.split("-")[0]}function o(e){U=A.getFromId(t,r.xref),V=A.getFromId(t,r.yref),q=g(t,U),G=g(t,V,!0),H=y(t,U),X=y(t,V,!0);var o="shapes["+n+"]";"path"===r.type?(N=r.path,B=o+".path"):(c=q(r.x0),h=G(r.y0),f=q(r.x1),d=G(r.y1),p=o+".x0",v=o+".y0",_=o+".x1",w=o+".y1"),f>c?(E=c,C=o+".x0",F="x0",z=f,R=o+".x1",j="x1"):(E=f,C=o+".x1",F="x1",z=c,R=o+".x0",j="x0"),d>h?(k=h,I=o+".y0",D="y0",T=d,P=o+".y1",O="y1"):(k=d,I=o+".y1",D="y1",T=h,P=o+".y0",O="y0"),u={},i(e),K.moveFn="move"===Y?s:l}function a(r){L(e),r&&M.relayout(t,u)}function s(n,i){if("path"===r.type){var o=function(t){return H(q(t)+n)};U&&"date"===U.type&&(o=m(o));var a=function(t){return X(G(t)+i)};V&&"date"===V.type&&(a=m(a)),r.path=x(N,o,a),u[B]=r.path}else u[p]=r.x0=H(c+n),u[v]=r.y0=X(h+i),u[_]=r.x1=H(f+n),u[w]=r.y1=X(d+i);e.attr("d",b(t,r))}function l(n,i){if("path"===r.type){var o=function(t){return H(q(t)+n)};U&&"date"===U.type&&(o=m(o));var a=function(t){return X(G(t)+i)};V&&"date"===V.type&&(a=m(a)),r.path=x(N,o,a),u[B]=r.path}else{var s=~Y.indexOf("n")?k+i:k,l=~Y.indexOf("s")?T+i:T,c=~Y.indexOf("w")?E+n:E,h=~Y.indexOf("e")?z+n:z;l-s>Z&&(u[I]=r[D]=X(s),u[P]=r[O]=X(l)),h-c>W&&(u[C]=r[F]=H(c),u[R]=r[j]=H(h))}e.attr("d",b(t,r))}var u,c,h,f,d,p,v,_,w,k,T,E,z,I,P,C,R,D,O,F,j,N,B,U,V,q,G,H,X,Y,W=10,Z=10,K={setCursor:i,element:e.node(),prepFn:o,doneFn:a},J=K.element.getBoundingClientRect();S.init(K)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):k.log("getShapeLayer: undefined shape: index",e),n}function p(t,e,r){var n=M.Axes.getFromId(t,r.id,"x")._id,i=M.Axes.getFromId(t,r.id,"y")._id,o="below"===e.layer,a=n===e.xref||i===e.yref,s=!!r.shapelayer;return o&&a&&s}function v(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function m(t){return function(e){return t(e).replace(" ","_")}}function g(t,e,r){var n,o=t._fullLayout._size;if(e){var a=i(e);n=function(t){return e._offset+e.l2p(a(t,!0))},"date"===e.type&&(n=v(n))}else n=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return n}function y(t,e,r){var n,i=t._fullLayout._size;if(e){var a=o(e);n=function(t){return a(e.p2l(t-e._offset))}}else n=r?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return n}function b(t,e){var r,n,o,a,s=e.type,l=A.getFromId(t,e.xref),u=A.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=i(l),n=function(t){return l._offset+l.l2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(o=i(u),a=function(t){return u._offset+u.l2p(o(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===s)return l&&"date"===l.type&&(n=v(n)),u&&"date"===u.type&&(a=v(a)),z.convertPath(e.path,n,a);var h=n(e.x0),f=n(e.x1),d=a(e.y0),p=a(e.y1);if("line"===s)return"M"+h+","+d+"L"+f+","+p;if("rect"===s)return"M"+h+","+d+"H"+f+"V"+p+"H"+h+"Z";var m=(h+f)/2,g=(d+p)/2,y=Math.abs(m-h),b=Math.abs(g-d),x="A"+y+","+b,_=m+y+","+g,w=m+","+(g-b);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function x(t,e,r){return t.replace(I,function(t){var n=0,i=t.charAt(0),o=C[i],a=R[i],s=D[i],l=t.substr(1).replace(P,function(t){return n>=s?t:(o[n]?t=e(t):a[n]&&(t=r(t)),n++,t)});return i+l})}function _(t,e,r,n,i){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(r)];if(n){var a,s,l,u,c,h=1/0,f=-(1/0),d=n.match(I);for("date"===t.type&&(o=v(o)),a=0;ac&&(h=c),c>f&&(f=c)));return f>=h?[h,f]:void 0}}var w=t("fast-isnumeric"),M=t("../../plotly"),k=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),E=t("../drawing"),S=t("../dragelement"),L=t("../../lib/setcursor"),z=e.exports={};z.layoutAttributes=t("./attributes"),z.supplyLayoutDefaults=function(t,e){for(var r=t.shapes||[],i=e.shapes=[],o=0;os&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),k.log("Ignoring extra params in segment "+t)),i+l})},z.calcAutorange=function(t){var e,r,n,i,o,a=t._fullLayout,s=a.shapes;if(s.length&&t._fullData.length)for(e=0;ef?r=f:(c.left-=b.offsetLeft,c.right-=b.offsetLeft,c.top-=b.offsetTop,c.bottom-=b.offsetTop,b.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(r=Math.max(r,a*(t[b.side]-c[o])+u))}),r=Math.min(f,r)),r>0||0>f){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,S=!0,L=I,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var v=r.propContainer,m=r.propName,g=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,k=v.titlefont.family,A=v.titlefont.size,T=v.titlefont.color,E=1,S=!1,L=v.title.trim();""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,S=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(h);var I="Click to enter "+y+" title";t._context.editable?(L||p(),z.call(c.makeEditable).on("edit",function(e){void 0!==g?o.restyle(t,m,e,g):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",S)}},{"../../lib":568,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/plots":648,"../color":483,"../drawing":506,d3:119,"fast-isnumeric":123}],547:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat,a={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:a,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482}],548:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],549:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return o.coerce(n,i,u,t,e)}for(var n,i,a=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(l.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&g(t),0!==r.length){var u=l.selectAll("g."+T.headerGroupClassName).data(r,i);u.enter().append("g").classed(T.headerGroupClassName,!0);var c=l.selectAll("g."+T.buttonGroupClassName).data([0]);c.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(m).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){y.select(this).remove(),c.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],556:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],557:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.16.2",r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout, -r.redraw=n.redraw,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=n.register,r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=n.Snapshot,r.PlotSchema=n.PlotSchema,r.Queue=n.Queue,r.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":586,"./plot_api/to_image":587,"./plot_api/validate":588,"./plotly":589,"./snapshot/download":663,d3:119}],558:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],559:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],560:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),o=t("./nested_property"),a=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)}},"boolean":{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r?!0:"string"!=typeof t?!1:!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),o=0;o2)return!1;var l=a[0].split("-");if(l.length>3||3!==l.length&&a[1])return!1;if(4===l[0].length)r=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();r=((Number(l[0])-u+70)%100+200)%100+u-70}return s(r)?1===l.length?new Date(r,0,1).getTime():(n=Number(l[1])-1,l[1].length>2||!(n>=0&&11>=n)?!1:2===l.length?new Date(r,n,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(r,n,i).getTime(),a[1]?(l=a[1].split(":"),l.length>3?!1:(o=Number(l[0]),l[0].length>2||!(o>=0&&23>=o)?!1:(i+=36e5*o,1===l.length?i:(n=Number(l[1]),l[1].length>2||!(n>=0&&59>=n)?!1:(i+=6e4*n,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){if("undefined"==typeof a)return void l.error("d3 is not defined.");e||(e=0);var r=new Date(t),i=a.time.format("%Y-%m-%d")(r);return 7776e6>e?(i+=" "+n(r.getHours(),2),432e6>e&&(i+=":"+n(r.getMinutes(),2),108e5>e&&(i+=":"+n(r.getSeconds(),2),3e5>e&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={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"]},c={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"]},h=a.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(h),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(h)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(h)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){f[t].D.push(h(e)),["H","I","D"].forEach(function(r){u[r].forEach(function(n){var i=f[t][r];i.push(h(e+"~"+n)),i.push(h(n+"~"+e))})})})});var d=/[a-z]*/g,p=function(t){return t.substr(0,3)},v=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,m=/[\s,\/\-\.\(\)]+/g,g=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},b=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,M=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return k[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,p).replace(v,"").replace(m,"~").replace(g,y).replace(M,A).trim().replace(T,"");var e,r,n=null,a=i(t),s=o(t);e=f[a][s],r=e.length;for(var l=0;r>l&&!(n=e[l].parse(t));l++);if(!(n instanceof Date))return!1;var u=n.getTimezoneOffset();return n.setTime(n.getTime()+60*u*1e3),n}},{"../lib":568,d3:119,"fast-isnumeric":123}],562:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof n)return t;var e=new n;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(r,n){"undefined"!=typeof jQuery&&jQuery(t).trigger(r,n),e.emit(r,n)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof jQuery&&(n=jQuery(t).triggerHandler(e,r));var o=t._ev;if(!o)return n;var a=o._events[e];if(!a)return n;"function"==typeof a&&(a=[a]);for(var s=a.pop(),l=0;lg;g++){l=t[g];for(u in l)c=v[u],h=l[u],s&&a(h)?v[u]=h:e&&h&&(o(h)||(f=a(h)))?(f?(f=!1,d=c&&a(c)?c:[]):d=c&&o(c)?c:{},v[u]=i([d,h],e,r,s)):("undefined"!=typeof h||r)&&(v[u]=h)}return v}var o=t("./is_plain_object.js"),a=Array.isArray;r.extendFlat=function(){return i(arguments,!1,!1,!1)},r.extendDeep=function(){return i(arguments,!0,!1,!1)},r.extendDeepAll=function(){return i(arguments,!0,!0,!1)},r.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":569}],564:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=0;ry;y++)h=s(p,y),d=l(e,y),g[y]=n(h,d);else g=n(p,e);return g}var s=t("tinycolor2"),l=t("fast-isnumeric"),u=t("../components/colorscale/make_scale_function"),c=t("../components/color/attributes").defaultLine,h=t("./str2rgbarray"),f=1;e.exports=a},{"../components/color/attributes":482,"../components/colorscale/make_scale_function":500,"./str2rgbarray":580,"fast-isnumeric":123,tinycolor2:454}],567:[function(t,e,r){"use strict";function n(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(e>r)break;t=t.slice(0,e)+l(t.slice(e+5,r))+t.slice(r+6)}return t}function i(t){return t.replace(/\/g,"\n")}function o(t){return t.replace(/\<.*\>/g,"")}function a(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(r>n)r+=1;else{var i=e[t.slice(r+1,n)];t=i?t.slice(0,r)+i+t.slice(n+1):t.slice(0,r)+t.slice(n+1)}}return t}function s(t){return""+a(o(n(i(t))))}var l=t("superscript-text"),u=t("../constants/string_mappings");e.exports=s},{"../constants/string_mappings":555,"superscript-text":443}],568:[function(t,e,r){"use strict";var n=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var o=t("./coerce");i.valObjects=o.valObjects,i.coerce=o.coerce,i.coerce2=o.coerce2,i.coerceFont=o.coerceFont,i.validate=o.validate;var a=t("./dates");i.dateTime2ms=a.dateTime2ms,i.isDateTime=a.isDateTime,i.ms2DateTime=a.ms2DateTime,i.parseDate=a.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var h=t("./loggers");i.log=h.log,i.warn=h.warn,i.error=h.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var o=0;or?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.randstr=function f(t,e,r){if(r||(r=16),void 0===e&&(e=24),0>=e)return"0";var n,i,o,a=Math.log(Math.pow(2,e))/Math.log(r),s="";for(n=2;a===1/0;n*=2)a=Math.log(Math.pow(2,e/n))/Math.log(r)*n;var l=a-Math.floor(a);for(n=0;n-1||u!==1/0&&u>=Math.pow(2,e)?f(t,e,r):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var r,n,i,o,a=t.length,s=2*a,l=2*e-1,u=new Array(l),c=new Array(a);for(r=0;l>r;r++)u[r]=(1-Math.cos(Math.PI*(r+1)/e))/(2*e);for(r=0;a>r;r++){for(o=0,n=0;l>n;n++)i=r+n+1-e,-a>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=a&&(i=s-1-i),o+=t[i]*u[n];c[r]=o}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var o,a;t.length;)if(a=t.splice(0,1)[0],o=a(e),o&&o.then)return o.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,o=!1,a=!0;for(n=0;ni;i++)e[i][r]=t[i]},i.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,o,a,s=3,l=Object.keys(t);for(n=0;n1?n+o[1]:"";if(i&&(o.length>1||a.length>4))for(;r.test(a);)a=a.replace(r,"$1"+i+"$2");return a+s}},{"./coerce":560,"./dates":561,"./extend":563,"./is_plain_object":569,"./loggers":570,"./matrix":571,"./nested_property":572,"./notifier":573,"./search":576,"./stats":579,d3:119}],569:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],570:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;en;n++)r[n]=new Array(e);return r},r.transposeRagged=function(t){var e,r,n=0,i=t.length;for(e=0;i>e;e++)n=Math.max(n,t[e].length);var o=new Array(n);for(e=0;n>e;e++)for(o[e]=new Array(i),r=0;i>r;r++)o[e][r]=t[r][e];return o},r.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var n,i,o=t.length;if(t[0].length)for(n=new Array(o),i=0;o>i;i++)n[i]=r.dot(t[i],e);else if(e[0].length){var a=r.transposeRagged(e);for(n=new Array(a.length),i=0;ii;i++)n+=t[i]*e[i];return n},r.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},r.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},r.rotationXYMatrix=function(t,e,n){return r.dot(r.dot(r.translationMatrix(e,n),r.rotationMatrix(t)),r.translationMatrix(-e,-n))},r.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var n=1===arguments.length?e[0]:[e[0],e[1]];return r.dot(t,[n[0],n[1],1]).slice(0,2)}},r.apply2DTransform2=function(t){var e=r.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],572:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,o,a,s,l=t;for(a=0;a=0;e--){if(n=t[e],a=!1,Array.isArray(n))for(r=n.length-1;r>=0;r--)u(n[r])?a?n[r]=void 0:n.pop():a=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),a=!1,r=o.length-1;r>=0;r--)u(n[o[r]])&&!i(n[o[r]],o[r])?delete n[o[r]]:a=!0;if(a)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric");e.exports=function(t,e){if(h(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,a,s=0,l=e.split(".");sr||r>o||a>n||n>s?!1:!e||!u(t)}function r(t,e){var r=t[0],l=t[1];if(i>r||r>o||a>l||l>s)return!1;var u,c,h,f,d,p=n.length,v=n[0][0],m=n[0][1],g=0;for(u=1;p>u;u++)if(c=v,h=m,v=n[u][0],m=n[u][1],f=Math.min(c,v),!(f>r||r>Math.max(c,v)||l>Math.max(h,m)))if(l=l&&r!==f&&g++}return g%2===1}var n=t.slice(),i=n[0][0],o=i,a=n[0][1],s=a;n.push(n[0]);for(var l=1;lo;o++)if(a=[t[o][0]-l[0],t[o][1]-l[1]],s=n(a,u),0>s||s>c||Math.abs(n(a,f))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":571}],575:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},a.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},a.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},a.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;rt}function i(t,e){return e>=t}function o(t,e){return t>e}function a(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,h=0,f=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?a:o;f>h&&d++<100;)u=Math.floor((h+f)/2),c(e[u],t)?h=u+1:f=u;return d>90&&l.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,o=i/(n||1)/1e4,a=[e[0]],s=0;n>s;s++)e[s+1]>e[s]+o&&(i=Math.min(i,e[s+1]-e[s]),a.push(e[s+1]));return{vals:a,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,o=e.length-1,a=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;o>i&&a++<100;)n=u((i+o)/2),e[n]<=t?i=n+s:o=n-l;return e[i]}},{"../lib":568,"fast-isnumeric":123}],577:[function(t,e,r){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],578:[function(t,e,r){"use strict";var n=t("../components/color"),i=function(){};e.exports=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=i);t.destroy=function(){t.container.parentNode.removeChild(t.container)};var r=document.createElement("div");return r.textContent="Webgl is not supported by your browser - visit http://get.webgl.org for more info",r.style.cursor="pointer",r.style.fontSize="24px",r.style.color=n.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../components/color":483}],579:[function(t,e,r){"use strict";var n=t("fast-isnumeric");r.aggNums=function(t,e,i,o){var a,s;if(o||(o=i.length),n(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(o),a=0;o>a;a++)s[a]=r.aggNums(t,e,i[a]);i=s}for(a=0;o>a;a++)n(e)?n(i[a])&&(e=t(+e,+i[a])):e=i[a];return e},r.len=function(t){return r.aggNums(function(t){return t+1},0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums(function(t,e){return t+e},0,t)/e},r.variance=function(t,e,i){return e||(e=r.len(t)),n(i)||(i=r.mean(t,e)),r.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":123}],580:[function(t,e,r){"use strict";function n(t){return t=i(t),o.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),o=t("arraytools");e.exports=n},{arraytools:50,tinycolor2:454}],581:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+f.randstr([],64),o=h.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())f.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function a(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=v[n];if(void 0!==i){var o=e[1],a=e[3],s=a.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"";if("href"!==a.substr(0,4).toLowerCase())return"";var u=a.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,-1===m.indexOf(c.protocol)?"":''}if("br"===n)return"
";if(o)return"sup"===n?'':"sub"===n?'':"";var h=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),i="",a=n.length-1;a>=0;a--){var s=n[a].match(/<(\/?).*>/i);if(s&&"
"!==n[a]){s[1]||(i=n[a]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),o+=2)});var a=e.join(""),u=a.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,o,a=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},o="right"===a?function(){return l.right-n.width}:"center"===a?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:o()-u.left+"px","z-index":1e3}),this}}var h=t("d3"),f=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(f.log(r.querySelector("parsererror div").textContent), -null):h.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=h.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),c=t.appendSVG(a),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),a=u(i),s=t,l=!s.attr("data-notex")&&a.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=h.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var v=t.node();v&&v.removeAttribute;v=v.parentNode)v.removeAttribute("data-bb");if(l){var m=f.getPlotDiv(s.node());(m&&m._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};o(l[2],i,function(i,o,a){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),o&&o.node()&&l.node().insertBefore(o.node().cloneNode(!0),l.node().firstChild),l.attr({"class":p,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var h=n(l,"width"),f=n(l,"height"),v=+s.attr("x")-h*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],m=parseInt(s.style("font-size"),10)||n(s,"height"),g=-m/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-h/2,g-f/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:g-f/2}):"a"===p[0]?l.attr({x:0,y:g}):l.attr({x:v,y:+s.attr("y")+g-f/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var v={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],g=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(g," ")},r.makeEditable=function(t,e,r){function n(){o(),a.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(a.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=h.select(f.getPlotDiv(a.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":a.style("font-family")||"Arial","font-size":a.style("font-size")||12,color:r.fill||a.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(a.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||a.attr("data-unformatted")).call(c(a,e,r)).on("blur",function(){a.text(this.textContent).style({opacity:1});var t,e=h.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(a.node().parentNode).select(t).style({opacity:0});var r=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(a,r)}).on("focus",function(){var t=this;h.select(document).on("mouseup",function(){return h.event.target===t?!1:void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===h.event.which?(a.style({opacity:1}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(a,this.textContent)):(s.input.call(a,this.textContent),h.select(this).call(c(a,e,r)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(i)}r||(r={});var a=this,s=h.dispatch("edit","input","cancel"),l=h.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),h.rebind(this,s,"on")}},{"../constants/string_mappings":555,"../constants/xmlns_namespaces":556,"../lib":568,d3:119}],582:[function(t,e,r){"use strict";var n=e.exports={},i=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson").feature;n.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},n.getTopojsonPath=function(t,e){return t+e+".json"},n.getTopojsonFeatures=function(t,e){var r=i[t.locationmode],n=e.objects[r];return o(e,n).features}},{"../plots/geo/constants":611,topojson:455}],583:[function(t,e,r){"use strict";function n(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function i(t){Array.isArray(t._promises)&&t._promises.length>0&&R.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),C.defaultConfig.setBackground(t,e)}function a(t,e){t._context||(t._context=R.extendFlat({},C.defaultConfig));var r=t._context;e&&(Object.keys(e).forEach(function(t){t in r&&("setBackground"===t&&"opaque"===e[t]?r[t]=o:r[t]=e[t])}),e.plot3dPixelRatio&&!r.plotGlPixelRatio&&(r.plotGlPixelRatio=r.plot3dPixelRatio)),r.staticPlot&&(r.editable=!1,r.autosizable=!1,r.scrollZoom=!1,r.doubleClick=!1,r.showTips=!1,r.showLink=!1,r.displayModeBar=!1)}function s(t,e,r){var n=z.select(t).selectAll(".plot-container").data([0]);n.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=n.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),r&&(t.layout=r),C.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(M(t,{}),t._fullLayout.autosize=r.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=C.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var o=t.framework.svg(),a=1,s=t._fullLayout.title;""!==s&&s||(a=0);var l="Click to enter title",u=function(){this.call(C.util.convertToTspans)},c=o.select(".title-group text").call(u);if(t._context.editable){c.attr({"data-unformatted":s}),s&&s!==l||(a=.2,c.attr({"data-unformatted":l}).text(l).style({opacity:a}).on("mouseover.opacity",function(){z.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){z.select(this).transition().duration(1e3).style("opacity",0)}));var h=function(){this.call(C.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(u),this.call(h)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(u)})};c.call(h)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),F.addLinks(t),Promise.resolve()}function l(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var n=C.Axes.list({_fullLayout:t});for(e=0;ee;e++){var a=t.annotations[e];a.ref&&("paper"===a.ref?(a.xref="paper",a.yref="paper"):"data"===a.ref&&(a.xref="x",a.yref="y"),delete a.ref),u(a,"xref"),u(a,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(R.warn("Shapes must be an array."),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var l=t.shapes[e];u(l,"xref"),u(l,"yref")}var c=t.legend;c&&(c.x>3?(c.x=1.02,c.xanchor="left"):c.x<-2&&(c.x=-.02,c.xanchor="right"),c.y>3?(c.y=1.02,c.yanchor="bottom"):c.y<-2&&(c.y=-.02,c.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var h=F.getSubplotIds(t,"gl3d");for(e=0;er;++r)b[r]=m[e]+g*y[2+4*r];d.camera={eye:{x:b[0],y:b[1],z:b[2]},center:{x:m[0],y:m[1],z:m[2]},up:{x:y[1],y:y[5],z:y[9]}},delete d.cameraposition}}return N.clean(t),t}function u(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=C.Axes.cleanId(r,n))}function c(t,e){for(var r=[],n=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),i=0;io&&(s=R.randstr(n),-1!==r.indexOf(s));o++);a.uid=R.randstr(n),n.push(a.uid)}if(r.push(a.uid),"histogramy"===a.type&&"xbins"in a&&!("ybins"in a)&&(a.ybins=a.xbins,delete a.xbins),a.error_y&&"opacity"in a.error_y){var l=N.defaults,u=a.error_y.color||(F.traceIs(a,"bar")?N.defaultLine:l[i%l.length]);a.error_y.color=N.addOpacity(N.rgb(u),N.opacity(u)*a.error_y.opacity),delete a.error_y.opacity}if("bardir"in a&&("h"!==a.bardir||!F.traceIs(a,"bar")&&"histogram"!==a.type.substr(0,9)||(a.orientation="h",_(a)),delete a.bardir),"histogramy"===a.type&&_(a),"histogramx"!==a.type&&"histogramy"!==a.type||(a.type="histogram"),"scl"in a&&(a.colorscale=a.scl,delete a.scl),"reversescl"in a&&(a.reversescale=a.reversescl,delete a.reversescl),a.xaxis&&(a.xaxis=C.Axes.cleanId(a.xaxis,"x")),a.yaxis&&(a.yaxis=C.Axes.cleanId(a.yaxis,"y")),F.traceIs(a,"gl3d")&&a.scene&&(a.scene=F.subplotsRegistry.gl3d.cleanId(a.scene)),F.traceIs(a,"pie")||(Array.isArray(a.textposition)?a.textposition=a.textposition.map(h):a.textposition&&(a.textposition=h(a.textposition))),F.traceIs(a,"2dMap")&&("YIGnBu"===a.colorscale&&(a.colorscale="YlGnBu"),"YIOrRd"===a.colorscale&&(a.colorscale="YlOrRd")),F.traceIs(a,"markerColorscale")&&a.marker){var c=a.marker;"YIGnBu"===c.colorscale&&(c.colorscale="YlGnBu"),"YIOrRd"===c.colorscale&&(c.colorscale="YlOrRd")}if("surface"===a.type&&R.isPlainObject(a.contours)){var d=["x","y","z"];for(o=0;on?o.push(i+n):o.push(n);return o}function v(t,e,r){var n,i;for(n=0;n=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||0>i&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function m(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),v(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&v(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function g(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&l0){var s=w(t._boundingBoxMargins),l=s.left+s.right,u=s.bottom+s.top,c=o._container.node().getBoundingClientRect(),h=1-2*a.frameMargins;i=Math.round(h*(c.width-l)),n=Math.round(h*(c.height-u))}else r=window.getComputedStyle(t),n=parseFloat(r.height)||o.height,i=parseFloat(r.width)||o.width;return Math.abs(o.width-i)>1||Math.abs(o.height-n)>1?(o.height=t.layout.height=n,o.width=t.layout.width=i):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),F.sanitizeMargins(o),e}function k(t){var e=z.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===r.autosize&&(M(t,{}),r.autosize=!0,t.layout.autosize=!0),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];z.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=R.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(K.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0);var o=C.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),r._has("cartesian")&&T(t,o),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.selectAll(".layer-subplot");r._imageSubplotLayer=a.selectAll(".imagelayer"),r._shapeSubplotLayer=a.selectAll(".shapelayer");var s=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=s.append("g").classed("imagelayer",!0),r._shapeUpperLayer=s.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var l=R.syncOrAsync([E,function(){return C.Axes.doTicks(t,"redraw")},j.init],t);return l&&l.then&&t._promises.push(l),l}function A(t,e){function r(e,r){return function(){return C.Axes.getFromId(t,e,r)}}for(var n,i,o=t._fullLayout._plots={},a=0;a0,_=C.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),M=w===_;x?t.framework===k&&!b&&M||(t.framework=k,k(t)):M?b&&k(t):(t.framework=k,k(t)),b&&C.Axes.saveRangeInitial(t);var A=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&d(t);for(var S=0;SW.range[0]?[1,2]:[2,1]);else{var K=W.range[0],J=W.range[1];"log"===j?(0>=K&&0>=J&&o(H+".autorange",!0),0>=K?K=J/1e6:0>=J&&(J=K/1e6),o(H+".range[0]",Math.log(K)/Math.LN10),o(H+".range[1]",Math.log(J)/Math.LN10)):(o(H+".range[0]",Math.pow(10,K)),o(H+".range[1]",Math.pow(10,J)))}else o(H+".autorange",!0)}if("reverse"===U)X.range?X.range.reverse():(o(H+".autorange",!0),X.range=[1,0]),Y.autorange?w=!0:_=!0;else if("annotations"===D.parts[0]||"shapes"===D.parts[0]){var $=D.parts[1],Q=D.parts[0],tt=v[Q]||[],et=C[R.titleCase(Q)],rt=tt[$]||{};2===D.parts.length&&("add"===g[I]||R.isPlainObject(g[I])?S[I]="remove":"remove"===g[I]?-1===$?(S[Q]=tt,delete S[I]):S[I]=rt:R.log("???",g)),!a(rt,"x")&&!a(rt,"y")||R.containsAny(I,["color","opacity","align","dash"])||(w=!0),et.draw(t,$,D.parts.slice(2).join("."),g[I]),delete g[I]}else if("images"===D.parts[0]){var it=R.objectFromPath(I,j);R.extendDeepAll(t.layout,it),V.supplyLayoutDefaults(t.layout,t._fullLayout),V.draw(t)}else if("mapbox"===D.parts[0]&&"layers"===D.parts[1]){R.extendDeepAll(t.layout,R.objectFromPath(I,j));var ot=(t._fullLayout.mapbox||{}).layers||[];for(P=D.parts[2]+1-ot.length,p=0;P>p;p++)ot.push({});_=!0}else if("updatemenus"===D.parts[0]){R.extendDeepAll(t.layout,R.objectFromPath(I,j));var at=t._fullLayout.updatemenus||[];for(P=D.parts[2]+1-at.length,p=0;P>p;p++)at.push({});_=!0}else 0===D.parts[0].indexOf("scene")?_=!0:0===D.parts[0].indexOf("geo")?_=!0:0===D.parts[0].indexOf("ternary")?_=!0:!m._has("gl2d")||-1===I.indexOf("axis")&&"plot_bgcolor"!==D.parts[0]?"hiddenlabels"===I?w=!0:-1!==D.parts[0].indexOf("legend")?y=!0:-1!==I.indexOf("title")?b=!0:-1!==D.parts[0].indexOf("bgcolor")?x=!0:D.parts.length>1&&R.containsAny(D.parts[1],["tick","exponent","grid","zeroline"])?b=!0:-1!==I.indexOf(".linewidth")&&-1!==I.indexOf("axis")?b=x=!0:D.parts.length>1&&-1!==D.parts[1].indexOf("line")?x=!0:D.parts.length>1&&"mirror"===D.parts[1]?b=x=!0:"margin.pad"===I?b=x=!0:"margin"===D.parts[0]||"autorange"===D.parts[1]||"rangemode"===D.parts[1]||"type"===D.parts[1]||"domain"===D.parts[1]||I.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(I)?k=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(I)&&(_=!0):_=!0,D.set(j)}O.add(t,nt,[t,S],nt,[t,T]),g.autosize&&(g=M(t,g)),(g.height||g.width||g.autosize)&&(w=!0);var st=Object.keys(g),lt=[F.previousPromises];if(_||w)lt.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),C.plot(t,"",v)});else if(st.length&&(F.supplyDefaults(t),m=t._fullLayout,y&<.push(function(){return q.draw(t),F.previousPromises(t)}),x&<.push(E),b&<.push(function(){return C.Axes.doTicks(t,"redraw"),L(t),F.previousPromises(t)}),k)){var ut;for(Z(t),C.Fx.supplyLayoutDefaults(t.layout,m,t._fullData),C.Fx.init(t),ut=F.getSubplotIds(m,"gl3d"),p=0;p1)};u(r.width)&&u(r.height)||s(new Error("Height and width should be pixel values."));var c=n.clone(e,{format:"png",height:r.height,width:r.width}),h=c.td;h.style.position="absolute",h.style.left="-5000px",document.body.appendChild(h);var f=n.getRedrawFunc(h);o.plot(h,c.data,c.layout,c.config).then(f).then(l).then(function(e){t(e)}).catch(function(t){s(t)})});return s}var i=t("fast-isnumeric"),o=t("../plotly"),a=t("../lib");e.exports=n},{"../lib":568,"../plotly":589,"../snapshot":665,"fast-isnumeric":123}],588:[function(t,e,r){"use strict";function n(t,e,r,i,o,u){u=u||[];for(var c=Object.keys(t),f=0;f1&&l.push(a("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,m=r.length,g=0;m>g;g++){var y=r[g],b=["data",g];if(p(y)){var x=c[g],_=x.type,w=s.traces[_].attributes;w.type={valType:"enumerated",values:[_]},x.visible===!1&&y.visible!==!1&&l.push(a("invisible",b)),n(y,x,w,l,b);var M=y.transforms,k=x.transforms;if(M){v(M)||l.push(a("array",b,["transforms"])),b.push("transforms");for(var A=0;Au&&c>e&&(void 0===i[r]?o[h]=T.tickText(t,e):o[h]=s(t,e,String(i[r])),h++);return h=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{b(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function a(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,o))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,o=e.x,s=t._tickround,l=new Date(o),u="";r&&t.hoverformat?i=a(t.hoverformat,o):t.tickformat?i=a(t.tickformat,o):(n&&(b(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=D(l):"m"===s?i=O(l):(o!==t._tmin||r||(u="
"+D(l)),"d"===s?i=F(l):"H"===s?i=j(l):(o!==t._tmin||r||(u="
"+F(l)+", "+D(l)),i=N(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=f(g(o/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var o=t.dtick,a=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=f(Math.pow(10,a),t,i,n);else if(b(o)||"D"===o.charAt(0)&&g(a+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(a);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=f(Math.pow(10,a),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,g(a,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>a?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}function f(t,e,r,n){var i=0>t,a=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat;if(n){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(c),a=(Number(c._tickround)||0)+4,l=c._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-a)/2;if("none"===s&&(l=0),t=Math.abs(t),h>t)t="0",i=!1;else{if(t+=h,l&&(t*=Math.pow(10,-l),a+=l),0===a)t=String(Math.floor(t));else if(0>a){t=String(Math.round(t)),t=t.substr(0,t.length+a);for(var f=a;0>f;f++)t+="0"}else{t=String(t);var d=t.indexOf(".")+1;d&&(t=t.substr(0,d+a).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(l&&"hide"!==s){var p;p=0>l?"\u2212"+-l:"power"!==s?"+"+l:String(l),"e"===s||("SI"===s||"B"===s)&&(l>12||-15>l)?t+="e"+p:"E"===s?t+="E"+p:"power"===s?t+="\xd710"+p+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&h/c>f&&(l=a,u=s,f=h/c);if(n===i){var p=n-1,v=n+1;r="tozero"===t.rangemode?0>n?[p,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,v)]:[p,v]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),f=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-f*l.pad,u.val+f*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,i=0;ip&&(p=v/10),u=t.c2l(p),c=t.c2l(v),y&&(u=Math.min(0,u),c=Math.max(0,c)),n(u)){for(d=!0,a=0;a=f?d=!1:s.val>=u&&s.pad<=f&&(t._min.splice(a,1),a--);d&&t._min.push({val:u,pad:y&&0===u?0:f})}if(n(c)){for(d=!0,a=0;a=c&&s.pad>=h?d=!1:s.val<=c&&s.pad<=h&&(t._max.splice(a,1),a--);d&&t._max.push({val:c,pad:y&&0===c?0:h})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,a,s,l,u,c,h,f,d,p,v,m=e.length,g=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(o=0;6>o;o++)i(o);for(o=m-1;o>5;o--)i(o)}},T.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/h.dtick)%100<2}var o=_.aggNums(Math.min,null,t),a=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:a+.5,size:1};var s;if(r)s=(a-o)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var h={type:"log"===e.type?"linear":e.type,range:[o,a]};T.autoTicks(h,s);var f,d=T.tickIncrement(T.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var p=0,v=0,m=0,g=0,y=0;yv&&(p>.3*x||i(o)||i(a))){var w=h.dtick/2;d+=o>d+w?w:-w}var M=1+Math.floor((a-d)/h.dtick);f=d+M*h.dtick}else for(f=d;a>=f;)f=T.tickIncrement(f,h.dtick);return{start:d,end:f,size:h.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return n(t);if("auto"===t.tickmode||!t.dtick){var e,r=t.nticks;r||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/e):(e="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var i=t.range[1]=s:s>=l)&&(a.push(l),!(a.length>1e3));l=T.tickIncrement(l,t.dtick,i));t._tmax=a[a.length-1];for(var u=new Array(a.length),c=0;c157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,L)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,z)):e>432e5?(t.dtick=i(e,864e5,P),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,z):e>3e4?t.dtick=i(e,6e4,I):e>500?t.dtick=i(e,1e3,I):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,L));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,L)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,L));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),o=n*Number(e.substr(1));if("M"===i){var a=new Date(t);return a.setMonth(a.getMonth()+o)}if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===i){var s="D2"===e?R:C,l=t+.01*n,u=_.roundUp(g(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]n:n>u;)u=T.tickIncrement(u,i,e);return u}if("L"===c)return Math.log(r((Math.pow(10,n)-o)/h)*h+o)/Math.LN10;if("D"===c){var f="D2"===i?R:C,d=_.roundUp(g(n,1),f,e);return Math.floor(n)+Math.log(y.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var D=y.time.format("%Y"),O=y.time.format("%b %Y"),F=y.time.format("%b %-d"),j=y.time.format("%b %-d %Hh"),N=y.time.format("%H:%M"),B=y.time.format(":%S"),U=/%(\d?)f/g;T.tickText=function(t,e,r){function n(n){var i;return void 0===n?!0:r?"none"===n:(i={first:t._tmin,last:t._tmax}[n],"all"!==n&&e!==i)}var i,o,a=s(t,e),f="array"===t.tickmode,d=r||f;if(f&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&er&&(k=90),i(c,k)}u._lastangle=k}return a(e),e+" done"}function l(){u._boundingBox=r.node().getBoundingClientRect()}var c=r.selectAll("g."+z).data(S,L);if(!u.showticklabels||!b(n))return c.remove(),void a(e);var h,f,p,g,x;"x"===m?(x="bottom"===B?1:-1,h=function(t){return t.dx+D*x},g=n+(R+C)*x,f=function(t){return t.dy+g+t.fontSize*("bottom"===B?1:-.5)},p=function(t){return b(t)&&0!==t&&180!==t?0>t*x?"end":"start":"middle"}):(x="right"===B?1:-1,f=function(t){return t.dy+t.fontSize/2-D*x},h=function(t){return t.dx+n+(R+C+(90===Math.abs(u.tickangle)?t.fontSize/2:0))*x},p=function(t){return b(t)&&90===Math.abs(t)?"middle":"right"===B?"start":"end"});var M=0,k=0,T=[];c.enter().append("g").classed(z,1).append("text").attr("text-anchor","middle").each(function(e){var r=y.select(this),n=t._promises.length;r.call(A.setPosition,h(e),f(e)).call(A.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),n=t._promises[n],n?T.push(t._promises.pop().then(function(){i(r,u.tickangle)})):i(r,u.tickangle)}),c.exit().remove(),c.each(function(t){M=Math.max(M,t.fontSize)}),i(c,u._lastangle||u.tickangle);var E=_.syncOrAsync([o,s,l]);return E&&E.then&&t._promises.push(E),E}function a(e){if(!r){var n,i,o,a,s=E.getFromId(t,e),l=y.select(t).selectAll("g."+e+"tick"),u={selection:l,side:s.side},h=e.charAt(0),f=t._fullLayout._size,d=1.5,p=s.titlefont.size;if(l.size()){var v=y.select(l.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);v&&(u.offsetLeft=+v[1],u.offsetTop=+v[2])}"x"===h?(i="free"===s.anchor?{_offset:f.t+(1-(s.position||0))*f.h,_length:0}:E.getFromId(t,s.anchor),o=s._offset+s._length/2,a=i._offset+("top"===s.side?-10-p*(d+(s.showticklabels?1:0)):i._length+10+p*(d+(s.showticklabels?1.5:.5))),s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(a+=(c.height-c.margin.b-c.margin.t)*s.rangeslider.thickness+s._boundingBox.height),u.side||(u.side="bottom")):(i="free"===s.anchor?{_offset:f.l+(s.position||0)*f.w,_length:0}:E.getFromId(t,s.anchor),a=s._offset+s._length/2,o=i._offset+("right"===s.side?i._length+10+p*(d+(s.showticklabels?1:.5)):-10-p*(d+(s.showticklabels?.5:0))),n={rotate:"-90",offset:0},u.side||(u.side="left")),M.draw(t,e+"title",{propContainer:s,propName:s._name+".title",dfltName:h.toUpperCase()+" axis",avoid:u,transform:n,attributes:{x:o,y:a,"text-anchor":"middle"}})}}function s(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:x.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[m]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===m}function l(e,r,i){var o=e.gridlayer,a=e.zerolinelayer,l=e["hidegrid"+m]?[]:V,c=u._gridpath||"M0,0"+("x"===m?"v":"h")+r._length,h=o.selectAll("path."+I).data(u.showgrid===!1?[]:l,L);if(h.enter().append("path").classed(I,1).classed("crisp",1).attr("d",c).each(function(t){u.zeroline&&("linear"===u.type||"-"===u.type)&&Math.abs(t.x)v;v++){var y=u.mirrors[a._id+f[v]];"ticks"!==y&&"labels"!==y||(h[v]=!0)}return void 0!==n[2]&&(h[2]=!0),h.forEach(function(t,e){var r=n[e],i=U[e];t&&b(r)&&(d+=p(r+C*i,i*u.ticklen))}),i(r,d),l(e,a,t),o(r,n[3])}}).filter(function(t){return t&&t.then});return G.length?Promise.all(G):0},T.swap=function(t,e){for(var r=d(t,e),n=0;n2*n}function c(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,o=0;o2*n}var h=t("fast-isnumeric"),f=t("tinycolor2").mix,d=t("../../lib"),p=t("../plots"),v=t("../../components/color/attributes").lightFraction,m=t("./layout_attributes"),g=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),b=t("./tick_label_defaults"),x=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),M=t("./clean_datum"),k=t("./axis_ids");e.exports=function(t,e,r,i){function o(r,n){return d.coerce2(t,e,m,r,n)}var a=i.letter,s=i.font||{},l="Click to enter "+(i.title||a.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=k.name2id(i.name));var u=r("type");"-"===u&&(n(e,i.data),"-"===e.type?e.type="linear":u=t.type=e.type),_(e);var c=r("color"),p=c===t.color?c:s.color;r("title",l),d.coerceFont(r,"titlefont",{family:s.family,size:Math.round(1.2*s.size),color:p});var M=2===(t.range||[]).length&&h(t.range[0])&&h(t.range[1]),A=r("autorange",!M);A&&r("rangemode");var T=r("range",[-1,"x"===a?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),d.noneOrAll(t.range,e.range,[0,1]),r("fixedrange"),g(t,e,r,u),b(t,e,r,u,i),y(t,e,r,i),x(t,e,r);var E=o("linecolor",c),S=o("linewidth"),L=r("showline",!!E||!!S);L||(delete e.linecolor,delete e.linewidth),(L||e.ticks)&&r("mirror");var z=o("gridcolor",f(c,i.bgColor,v).toRgbString()),I=o("gridwidth"),P=r("showgrid",i.showGrid||!!z||!!I);P||(delete e.gridcolor,delete e.gridwidth);var C=o("zerolinecolor",c),R=o("zerolinewidth"),D=r("zeroline",i.showGrid||!!C||!!R);return D||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===u?w(a,e.categoryorder,e.categoryarray,i.data):[],e}},{"../../components/color/attributes":482,"../../lib":568,"../plots":648,"./axis_ids":594,"./category_order_defaults":595,"./clean_datum":596,"./layout_attributes":601,"./ordered_categories":603,"./set_convert":606,"./tick_label_defaults":607,"./tick_mark_defaults":608,"./tick_value_defaults":609,"fast-isnumeric":123,tinycolor2:454}],594:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,o=[],a=0;a0;o&&(n="array");var a=r("categoryorder",n);"array"===a&&r("categoryarray"),o||"array"!==a||(e.categoryorder="trace")}}},{}],596:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":568,"fast-isnumeric":123}],597:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],598:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?c.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function a(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../lib"),h=t("../../lib/svg_text_utils"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),g=t("./select"),y=t("./constants"),b=!0;e.exports=function(t,e,r,s,x,_,w,M){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+vt+")").attr("d",lt+"Z"),ft=dt.append("path").attr("class","zoombox-corners").style({fill:f.background,stroke:f.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+vt+")").attr("d","M0,0Z"),E();for(var o=0;oi?(ct="",at.r=at.l,at.t=at.b,ft.attr("d","M0,0Z")):(at.t=0,at.b=q,ct="x",ft.attr("d","M"+(at.l-.5)+","+(ot-H-.5)+"h-3v"+(2*H+1)+"h3ZM"+(at.r+.5)+","+(ot-H-.5)+"h3v"+(2*H+1)+"h-3Z")):!J||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ft.transition().style("opacity",1).duration(200),ut=!0)}function L(t,e,r){var n,i,o;for(n=0;nzoom back out","long"),b=!1)))}function I(e,r){var i=1===(w+M).length;if(e)O();else if(2!==r||i){if(1===r&&i){var o=w?U[0]:B[0],a="s"===w||"w"===M?0:1,s=o._name+".range["+a+"]",l=n(o,a),c="left",f="middle";if(o.fixedrange)return;w?(f="n"===w?"top":"bottom","right"===o.side&&(c="right")):"e"===M&&(c="right"),et.call(h.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(l),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r="category"===o.type?o.c2l(e):o.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else D()}function P(e){function r(t,e,r){if(!t.fixedrange){A(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||j._enablescrollzoom){var n=t.querySelector(".plotly");if(!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(gt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void c.log("Did not find wheel motion attributes: ",e);var o,a=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,h=(s.bottom-e.clientY)/s.height,f=mt[1]+mt[3]*(1-h);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function i(t,e,r){for(var i=1-e,o=0,a=0;a0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nT;T++){var E=o[T],S=d[E];if(S)k[T]=w.getFromId(t,S.xaxis._id),A[T]=w.getFromId(t,S.yaxis._id);else{var L=a[E]._subplot;k[T]=L.xaxis,A[T]=L.yaxis}}var z=e.hovermode||a.hovermode;if(-1===["x","y","closest"].indexOf(z)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var I,P,C,R,D,O,F,j,N,B,U,V,q=[],G=[];if(Array.isArray(e))for(z="array",C=0;CH||H>Y.width||0>X||X>Y.height)return _.unhoverRaw(t,e)}else H="xpx"in e?e.xpx:k[0]._length/2,X="ypx"in e?e.ypx:A[0]._length/2;if(I="xval"in e?n(o,e.xval):i(k,H),P="yval"in e?n(o,e.yval):i(A,X),!v(I[0])||!v(P[0]))return m.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(R=0;R1||-1!==O.hoverinfo.indexOf("name")?O.name:void 0,index:!1,distance:Math.min(W,M.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},V=q.length,"array"===j){var Z=e[R];"pointNumber"in Z?(U.index=Z.pointNumber,j="closest"):(j="","xval"in Z&&(N=Z.xval,j="x"),"yval"in Z&&(B=Z.yval,j=j?"closest":"y"))}else N=I[F],B=P[F];if(O._module&&O._module.hoverPoints){var K=O._module.hoverPoints(U,N,B,j);if(K)for(var J,$=0;$V&&(q.splice(0,V),W=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var Q="y"===z&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var tt=b.combine(a.plot_bgcolor||b.background,a.paper_bgcolor),et={ -hovermode:z,rotateLabels:Q,bgColor:tt,container:a._hoverlayer,outerContainer:a._paperdiv},rt=u(q,et);c(q,Q?"xa":"ya"),h(rt,Q);var nt=t._hoverdata,it=[];for(C=0;C128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):A&&t[i+"Label"]===v?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var h=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);h.selectAll("tspan.line").call(x.setPosition,0,0);var f=e.select("text.name"),m=0;r&&r!==n?(f.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),f.selectAll("tspan.line").call(x.setPosition,0,0),m=f.node().getBoundingClientRect().width+2*P):(f.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var g,M,E=h.node().getBoundingClientRect(),S=t.xa._offset+(t.x0+t.x1)/2,L=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),C=Math.abs(t.y1-t.y0),R=E.width+I+P+m;t.ty0=_-E.top,t.bx=E.width+2*P,t.by=E.height+2*P,t.anchor="start",t.txwidth=E.width,t.tx2width=m,t.offset=0,o?(t.pos=S,g=k>=L+C/2+R,M=L-C/2-R>=0,"top"!==t.idealAlign&&g||!M?g?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")):(t.pos=L,g=w>=S+z/2+R,M=S-z/2-R>=0,"left"!==t.idealAlign&&g||!M?g?(S+=z/2,t.anchor="start"):t.anchor="middle":(S-=z/2,t.anchor="end")),h.attr("text-anchor",t.anchor),m&&f.attr("text-anchor",t.anchor),e.attr("transform","translate("+S+","+L+")"+(o?"rotate("+T+")":""))}),L}function c(t,e){function r(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(.01>o)){if(-.01>i){for(s=t.length-1;s>=0;s--)t[s].dp-=o;n=!1}if(n){var u=0;for(a=0;ae.pmax&&u++;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos>e.pmax-1&&(l.del=!0,u--);for(a=0;a=u);a++)if(l=t[a],l.pos=0;s--)t[s].dp-=o;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,o,a,s,l,u,c=0,h=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,a=0;a.01&&p.pmin===v.pmin&&p.pmax===v.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(f.push.apply(f,d),h.splice(a+1,1),u=0,s=f.length-1;s>=0;s--)u+=f[s].dp;for(o=u/f.length,s=f.length-1;s>=0;s--)f[s].dp-=o;n=!1}else a++}h.forEach(r)}for(a=h.length-1;a>=0;a--){var m=h[a];for(s=m.length-1;s>=0;s--){var g=m[s],y=t[g.i];y.offset=g.dp,y.del=g.del}}}function h(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],a=o*(I+P),s=a+o*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(a-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-z,l=t.offset*L),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*I+l)+","+(I+u)+"v"+(t.by/2-I)+"h"+n*t.bx+"v-"+t.by+"H"+(n*I+l)+"V"+(u-I)+"Z"),i.call(x.setPosition,a+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+o*P+l,u+t.ty0-t.by/2+P),r.select("rect").call(x.setRect,s+(o-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function f(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],o=t._hoverdata[n];if(i.curveNumber!==o.curveNumber||String(i.pointNumber)!==String(o.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),v=t("fast-isnumeric"),m=t("../../lib"),g=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,A.layoutAttributes,r,n)}n("dragmode");var i;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(r);i=o?"y":"x"}else i="closest";n("hovermode",i)},A.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+M.HOVERMINTIME?(a(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){a(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},A.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},A.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indext*e||0===t?M.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../lib":568,"../../lib/events":562,"../../lib/svg_text_utils":581,"./axes":592,"./constants":597,"./dragbox":598,d3:119,"fast-isnumeric":123,tinycolor2:454}],600:[function(t,e,r){"use strict";var n=t("../plots"),i=t("./constants");r.name="cartesian",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex=i.idRegex,r.attrRegex=i.attrRegex,r.attributes=t("./attributes"),r.plot=function(t){function e(t,e){for(var r=[],n=0;nh[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":568,"fast-isnumeric":123}],605:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),o=t("../../components/color"),a=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,h){function f(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,v=i.gd._fullLayout._zoomlayer,m=i.element.getBoundingClientRect(),g=i.plotinfo.x()._offset,y=i.plotinfo.y()._offset,b=e-m.left,x=r-m.top,_=b,w=x,M="M"+b+","+x,k=i.xaxes[0]._length,A=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),S=i.xaxes.concat(i.yaxes);"lasso"===h&&(p=l([[b,x]],s.BENDPX));var L=v.selectAll("path.select-outline").data([1,2]);L.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+g+", "+y+")").attr("d",M+"Z");var z,I,P,C,R,D=v.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+g+", "+y+")").attr("d","M0,0Z"),O=[],F=i.gd,j=[];for(z=0;z0)return Math.log(e)/Math.LN10;if(0>=e&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*c*Math.abs(n-i))}return a.BADNUM}function r(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):a.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?r:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var n=l.getFromId(t._gd,t.overlaying);t.domain=n.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)i(t.range[e])||(t.range[e]=i(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):a.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):a.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?o.ms2DateTime(t):a.BADNUM},t.d2c=function(t){return i(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var h=t.range.map(o.dateTime2ms);!i(t.range[0])&&i(h[0])&&(t.range[0]=h[0]),!i(t.range[1])&&i(h[1])&&(t.range[1]=h[1])}catch(f){o.error(f,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var r=t._categories.indexOf(e);return-1===r?a.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,o;if(r in e)for(n=e[r],i=new Array(n.length),o=0;on?"0":"1.0"}var r=this.framework,n=r.select("g.choroplethlayer"),i=r.select("g.scattergeolayer"),o=this.projection,a=this.path,s=this.clipAngle;r.selectAll("path.basepath").attr("d",a),r.selectAll("path.graticulepath").attr("d",a),n.selectAll("path.choroplethlocation").attr("d",a),n.selectAll("path.basepath").attr("d",a),i.selectAll("path.js-line").attr("d",a),null!==s?(i.selectAll("path.point").style("opacity",e).attr("transform",t),i.selectAll("text").style("opacity",e).attr("transform",t)):(i.selectAll("path.point").attr("transform",t),i.selectAll("text").attr("transform",t))}},{"../../components/color":483,"../../components/drawing":506,"../../constants/xmlns_namespaces":556,"../../lib/filter_visible":564,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"./constants":611,"./projections":619,"./set_scale":620,"./zoom":621,"./zoom_reset":622,d3:119,topojson:455}],613:[function(t,e,r){"use strict";var n=t("./geo"),i=t("../../plots/plots");r.name="geo",r.attr="geo",r.idRoot="geo",r.idRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"geo");void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var a=0;a=n}function o(t,e){for(var r=e[0],n=e[1],i=!1,o=0,a=t.length,s=a-1;a>o;s=o++){var l=t[o],u=l[0],c=l[1],h=t[s],f=h[0],d=h[1];c>n^d>n&&(f-u)*(n-c)/(d-c)+u>r&&(i=!i)}return i}function a(t){return t?t/Math.sin(t):1}function s(t){return t>1?P:-1>t?-P:Math.asin(t)}function l(t){return t>1?0:-1>t?I:Math.acos(t)}function u(t,e){var r=(2+P)*Math.sin(e);e/=2;for(var n=0,i=1/0;10>n&&Math.abs(i)>L;n++){var o=Math.cos(e);e-=i=(e+Math.sin(e)*(o+2)-r)/(2*o*(1+o))}return[2/Math.sqrt(I*(4+I))*t*(1+Math.cos(e)),2*Math.sqrt(I/(4+I))*Math.sin(e)]}function c(t,e){function r(r,n){var i=F(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?F:e===1/0?f:(r.invert=function(r,n){var i=F.invert(r/t,n);return i[0]*=e,i},r)}function h(){var t=2,e=O(c),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}function f(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function d(t,e){return[3*t/(2*I)*Math.sqrt(I*I/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(I/4+.4*e))]}function v(t){return function(e){var r,n=t*Math.sin(e),i=30;do e-=r=(e+Math.sin(e)-n)/(1+Math.cos(e));while(Math.abs(r)>L&&--i>0);return e/2}}function m(t,e,r){function n(r,n){return[t*r*Math.cos(n=i(n)),e*Math.sin(n)]}var i=v(r);return n.invert=function(n,i){var o=s(i/e);return[n/(t*Math.cos(o)),s((2*o+Math.sin(2*o))/r)]},n}function g(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(-.013791+n*(.003971*r-.001529*n))),e*(1.007226+r*(.015085+n*(-.044475+.028874*r-.005916*n)))]}function y(t,e){var r,n=Math.min(18,36*Math.abs(e)/I),i=Math.floor(n),o=n-i,a=(r=N[i])[0],s=r[1],l=(r=N[++i])[0],u=r[1],c=(r=N[Math.min(19,++i)])[0],h=r[1];return[t*(l+o*(c-a)/2+o*o*(c-2*l+a)/2),(e>0?P:-P)*(u+o*(h-s)/2+o*o*(h-2*u+s)/2)]}function b(t,e){return[t*Math.cos(e),e]}function x(t,e){var r=Math.cos(e),n=a(l(r*Math.cos(t/=2)));return[2*r*Math.sin(t)*n,Math.sin(e)*n]}function _(t,e){var r=x(t,e);return[(r[0]+t/P)/2,(r[1]+e)/2]}t.geo.project=function(t,e){var n=e.stream;if(!n)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:r)(t,n)};var w={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},M=[],k=[],A={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(k.push(M),M=[])},result:function(){var t=k.length?k.length<2?{type:"LineString",coordinates:k[0]}:{type:"MultiLineString",coordinates:k}:null;return k=[],t}},E={polygonStart:n,lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);k.push(M),M=[]}},polygonEnd:n,result:function(){if(!k.length)return null;var t=[],e=[];return k.forEach(function(r){i(r)?t.push([r]):e.push(r)}),e.forEach(function(e){var r=e[0];t.some(function(t){return o(t[0],r)?(t.push(e),!0):void 0})||t.push([e])}),k=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},S={Point:A,MultiPoint:A,LineString:T,MultiLineString:T,Polygon:E,MultiPolygon:E,Sphere:E},L=1e-6,z=L*L,I=Math.PI,P=I/2,C=(Math.sqrt(I),I/180),R=180/I,D=t.geo.projection,O=t.geo.projectionMutator;t.geo.interrupt=function(e){function r(t,r){for(var n=0>r?-1:1,i=l[+(0>r)],o=0,a=i.length-1;a>o&&t>i[o][2][0];++o);var s=e(t-i[o][1][0],r);return s[0]+=e(i[o][1][0],n*r>n*i[o][0][1]?i[o][0][1]:r)[0],s}function n(){s=l.map(function(t){return t.map(function(t){var r,n=e(t[0][0],t[0][1])[0],i=e(t[2][0],t[2][1])[0],o=e(t[1][0],t[0][1])[1],a=e(t[1][0],t[1][1])[1];return o>a&&(r=o,o=a,a=r),[[n,o],[i,a]]})})}function i(){for(var e=1e-6,r=[],n=0,i=l[0].length;i>n;++n){var a=l[0][n],s=180*a[0][0]/I,u=180*a[0][1]/I,c=180*a[1][1]/I,h=180*a[2][0]/I,f=180*a[2][1]/I;r.push(o([[s+e,u+e],[s+e,c-e],[h-e,c-e],[h-e,f+e]],30))}for(var n=l[1].length-1;n>=0;--n){var a=l[1][n],s=180*a[0][0]/I,u=180*a[0][1]/I,c=180*a[1][1]/I,h=180*a[2][0]/I,f=180*a[2][1]/I;r.push(o([[h-e,f-e],[h-e,c+e],[s+e,c+e],[s+e,u-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}function o(t,e){for(var r,n,i,o=-1,a=t.length,s=t[0],l=[];++ou;++u)l.push([s[0]+u*n,s[1]+u*i]);s=r}return l.push(r),l}function a(t,e){return Math.abs(t[0]-e[0])n)],o=l[+(0>n)],u=0,c=i.length;c>u;++u){var h=i[u];if(h[0][0]<=t&&tL&&--i>0);return[t/(.8707+(o=n*n)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),n]},(t.geo.naturalEarth=function(){return D(g)}).raw=g;var N=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];N.forEach(function(t){t[1]*=1.0144}),y.invert=function(t,e){var r=e/P,n=90*r,i=Math.min(18,Math.abs(n/5)),o=Math.max(0,Math.floor(i));do{var a=N[o][1],s=N[o+1][1],l=N[Math.min(19,o+2)][1],u=l-a,c=l-2*s+a,h=2*(Math.abs(r)-s)/u,f=c/u,d=h*(1-f*h*(1-2*f*h));if(d>=0||1===o){n=(e>=0?5:-5)*(d+i);var p,v=50;do i=Math.min(18,Math.abs(n)/5),o=Math.floor(i),d=i-o,a=N[o][1],s=N[o+1][1],l=N[Math.min(19,o+2)][1],n-=(p=(e>=0?P:-P)*(s+d*(l-a)/2+d*d*(l-2*s+a)/2)-e)*R;while(Math.abs(p)>z&&--v>0);break}}while(--o>=0);var m=N[o][0],g=N[o+1][0],y=N[Math.min(19,o+2)][0];return[t/(g+d*(y-m)/2+d*d*(y-2*g+m)/2),n*C]},(t.geo.robinson=function(){return D(y)}).raw=y,b.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return D(b)}).raw=b,x.invert=function(t,e){if(!(t*t+4*e*e>I*I+L)){var r=t,n=e,i=25;do{var o,a=Math.sin(r),s=Math.sin(r/2),u=Math.cos(r/2),c=Math.sin(n),h=Math.cos(n),f=Math.sin(2*n),d=c*c,p=h*h,v=s*s,m=1-p*u*u,g=m?l(h*u)*Math.sqrt(o=1/m):o=0,y=2*g*h*s-t,b=g*c-e,x=o*(p*v+g*h*u*d),_=o*(.5*a*f-2*g*c*s),w=.25*o*(f*s-g*c*p*a),M=o*(d*u+g*v*h),k=_*w-M*x;if(!k)break;var A=(b*_-y*M)/k,T=(y*w-b*x)/k;r-=A,n-=T}while((Math.abs(A)>L||Math.abs(T)>L)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return D(x)}).raw=x,_.invert=function(t,e){var r=t,n=e,i=25;do{var o,a=Math.cos(n),s=Math.sin(n),u=Math.sin(2*n),c=s*s,h=a*a,f=Math.sin(r),d=Math.cos(r/2),p=Math.sin(r/2),v=p*p,m=1-h*d*d,g=m?l(a*d)*Math.sqrt(o=1/m):o=0,y=.5*(2*g*a*p+r/P)-t,b=.5*(g*s+n)-e,x=.5*o*(h*v+g*a*d*c)+.5/P,_=o*(f*u/4-g*s*p),w=.125*o*(u*p-g*s*h*f),M=.5*o*(c*d+g*v*a)+.5,k=_*w-M*x,A=(b*_-y*M)/k,T=(y*w-b*x)/k;r-=A,n-=T}while((Math.abs(A)>L||Math.abs(T)>L)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return D(_)}).raw=_}e.exports=n},{}],620:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.lonaxis,a=t.lataxis,l=t.domain,u=t.framewidth||0,c=e.w*(l.x[1]-l.x[0]),h=e.h*(l.y[1]-l.y[0]),f=n.range[0]+s,d=n.range[1]-s,p=a.range[0]+s,v=a.range[1]-s,m=n._fullRange[0]+s,g=n._fullRange[1]-s,y=a._fullRange[0]+s,b=a._fullRange[1]-s;r._translate0=[e.l+c/2,e.t+h/2];var x=d-f,_=v-p,w=[f+x/2,p+_/2],M=r._rotate;r._center=[w[0]+M[0],w[1]+M[1]];var k=function(e){function n(t){return Math.min(_*c/(t[1][0]-t[0][0]),_*h/(t[1][1]-t[0][1]))}var a,s,l,x,_=e.scale(),w=r._translate0,M=i(f,p,d,v),k=i(m,y,g,b);l=o(e,M),a=n(l),x=o(e,k),r._fullScale=n(x),e.scale(a),l=o(e,M),s=[w[0]-l[0][0]+u,w[1]-l[0][1]+u],r._translate=s,e.translate(s),l=o(e,M),t._isAlbersUsa||e.clipExtent(l),a=r.scale*a,r._scale=a,t._width=Math.round(l[1][0])+u,t._height=Math.round(l[1][1])+u,t._marginX=(c-Math.round(l[1][0]))/2,t._marginY=(h-Math.round(l[1][1]))/2};return k}function i(t,e,r,n){var i=(r-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,n],[t+i,n],[t+2*i,n],[t+3*i,n],[r,n],[r,e],[r-i,e],[r-2*i,e],[r-3*i,e],[t,e]]]}}function o(t,e){return a.geo.path().projection(t).bounds(e)}var a=t("d3"),s=t("./constants").clipPad;e.exports=n},{"./constants":611,d3:119}],621:[function(t,e,r){"use strict";function n(t,e){var r;return(r=e._isScoped?o:e._clipAngle?s:a)(t,e.projection)}function i(t,e){var r=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*r,100*r])}function o(t,e){function r(){_.select(this).style(k)}function n(){a.scale(_.event.scale).translate(_.event.translate),t.render()}function o(){_.select(this).style(A)}var a=t.projection,s=i(a,e);return s.on("zoomstart",r).on("zoom",n).on("zoomend",o),s}function a(t,e){function r(t){return m.invert(t)}function n(t){var e=m(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(k),l=_.mouse(this),u=m.rotate(),c=m.translate(),h=u,f=r(l)}function a(){return d=_.mouse(this),n(l)?(g.scale(m.scale()),void g.translate(m.translate())):(m.scale(_.event.scale),m.translate([c[0],_.event.translate[1]]),f?r(d)&&(v=r(d),p=[h[0]+(v[0]-f[0]),u[1],u[2]],m.rotate(p),h=p):(l=d,f=r(l)),void t.render())}function s(){_.select(this).style(A)}var l,u,c,h,f,d,p,v,m=t.projection,g=i(m,e),y=2;return g.on("zoomstart",o).on("zoom",a).on("zoomend",s),g}function s(t,e){function r(t){g++||t({type:"zoomstart"})}function n(t){t({type:"zoom"})}function o(t){--g||t({type:"zoomend"})}var a,s=t.projection,d={r:s.rotate(),k:s.scale()},p=i(s,e),v=x(p,"zoomstart","zoom","zoomend"),g=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(k);var t=_.mouse(this),e=s.rotate(),i=e,o=s.translate(),g=u(e);a=l(s,t),y.call(p,"zoom",function(){var r=_.mouse(this);if(s.scale(d.k=_.event.scale),a){if(l(s,r)){s.rotate(e).translate(o);var u=l(s,r),p=h(a,u),y=m(c(g,p)),b=d.r=f(y,a,i);isFinite(b[0])&&isFinite(b[1])&&isFinite(b[2])||(b=i),s.rotate(b),i=b}}else t=r,a=l(s,t);n(v.of(this,arguments))}),r(v.of(this,arguments))}).on("zoomend",function(){_.select(this).style(A),y.call(p,"zoom",null),o(v.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,v,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&g(r)}function u(t){var e=.5*t[0]*w,r=.5*t[1]*w,n=.5*t[2]*w,i=Math.sin(e),o=Math.cos(e),a=Math.sin(r),s=Math.cos(r),l=Math.sin(n),u=Math.cos(n);return[o*s*u+i*a*l,i*s*u-o*a*l,o*a*u+i*s*l,o*s*l-i*a*u]}function c(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],l=e[2],u=e[3];return[r*a-n*s-i*l-o*u,r*s+n*a+i*u-o*l,r*l-n*u+i*a+o*s,r*u+n*l-i*s+o*a]}function h(t,e){if(t&&e){var r=b(t,e),n=Math.sqrt(y(r,r)),i=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),o=Math.sin(i)/n;return n&&[Math.cos(i),r[2]*o,-r[1]*o,r[0]*o]}}function f(t,e,r){var n=v(e,2,t[0]);n=v(n,1,t[1]),n=v(n,0,t[2]-r[2]);var i,o,a=e[0],s=e[1],l=e[2],u=n[0],c=n[1],h=n[2],f=Math.atan2(s,a)*M,p=Math.sqrt(a*a+s*s);Math.abs(c)>p?(o=(c>0?90:-90)-f,i=0):(o=Math.asin(c/p)*M-f,i=Math.sqrt(p*p-c*c));var m=180-o-2*f,g=(Math.atan2(h,u)-Math.atan2(l,i))*M,y=(Math.atan2(h,u)-Math.atan2(l,-i))*M,b=d(r[0],r[1],o,g),x=d(r[0],r[1],m,y);return x>=b?[o,g,r[2]]:[m,y,r[2]]}function d(t,e,r,n){var i=p(r-t),o=p(n-e);return Math.sqrt(i*i+o*o)}function p(t){return(t%360+540)%360-180}function v(t,e,r){var n=r*w,i=t.slice(),o=0===e?1:0,a=2===e?1:2,s=Math.cos(n),l=Math.sin(n);return i[o]=t[o]*s-t[a]*l,i[a]=t[a]*s+t[o]*l,i}function m(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function g(t){var e=t[0]*w,r=t[1]*w,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function y(t,e){for(var r=0,n=0,i=t.length;i>n;++n)r+=t[n]*e[n];return r}function b(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 x(t){for(var e=0,r=arguments.length,n=[];++ed;++d){for(e=u[d],r=t[this.scene[e]._name],n=/Click to enter .+ title/.test(r.title)?"":r.title,p=0;2>=p;p+=2)this.labelEnable[d+p]=!1,this.labels[d+p]=a(n),this.labelColor[d+p]=s(r.titlefont.color),this.labelFont[d+p]=r.titlefont.family,this.labelSize[d+p]=r.titlefont.size,this.labelPad[d+p]=this.getLabelPad(e,r),this.tickEnable[d+p]=!1,this.tickColor[d+p]=s((r.tickfont||{}).color),this.tickAngle[d+p]="auto"===r.tickangle?0:Math.PI*-r.tickangle/180,this.tickPad[d+p]=this.getTickPad(r),this.tickMarkLength[d+p]=0,this.tickMarkWidth[d+p]=r.tickwidth||0,this.tickMarkColor[d+p]=s(r.tickcolor),this.borderLineEnable[d+p]=!1,this.borderLineColor[d+p]=s(r.linecolor),this.borderLineWidth[d+p]=r.linewidth||0;c=this.hasSharedAxis(r),o=this.hasAxisInDfltPos(e,r)&&!c,l=this.hasAxisInAltrPos(e,r)&&!c,i=r.mirror||!1,h=c?-1!==String(i).indexOf("all"):!!i,f=c?"allticks"===i:-1!==String(i).indexOf("ticks"),o?this.labelEnable[d]=!0:l&&(this.labelEnable[d+2]=!0),o?this.tickEnable[d]=r.showticklabels:l&&(this.tickEnable[d+2]=r.showticklabels),(o||h)&&(this.borderLineEnable[d]=r.showline),(l||h)&&(this.borderLineEnable[d+2]=r.showline),(o||f)&&(this.tickMarkLength[d]=this.getTickMarkLength(r)),(l||f)&&(this.tickMarkLength[d+2]=this.getTickMarkLength(r)),this.gridLineEnable[d]=r.showgrid,this.gridLineColor[d]=s(r.gridcolor),this.gridLineWidth[d]=r.gridwidth,this.zeroLineEnable[d]=r.zeroline,this.zeroLineColor[d]=s(r.zerolinecolor),this.zeroLineWidth[d]=r.zerolinewidth}},l.hasSharedAxis=function(t){var e=this.scene,r=o.Plots.getSubplotIds(e.fullLayout,"gl2d"),n=o.Axes.findSubplotsWithAxis(r,t);return 0!==n.indexOf(e.id)},l.hasAxisInDfltPos=function(t,e){var r=e.side;return"xaxis"===t?"bottom"===r:"yaxis"===t?"left"===r:void 0},l.hasAxisInAltrPos=function(t,e){var r=e.side;return"xaxis"===t?"top"===r:"yaxis"===t?"right"===r:void 0},l.getLabelPad=function(t,e){var r=1.5,n=e.titlefont.size,i=e.showticklabels;return"xaxis"===t?"top"===e.side?-10+n*(r+(i?1:0)):-10+n*(r+(i?.5:0)):"yaxis"===t?"right"===e.side?10+n*(r+(i?1:.5)):10+n*(r+(i?.5:0)):void 0},l.getTickPad=function(t){return"outside"===t.ticks?10+t.ticklen:15},l.getTickMarkLength=function(t){if(!t.ticks)return 0;var e=t.ticklen;return"inside"===t.ticks?-e:e},e.exports=i},{"../../lib/html2unicode":567,"../../lib/str2rgbarray":580,"../../plotly":589}],625:[function(t,e,r){"use strict";var n=t("./scene2d"),i=t("../plots"),o=t("../../constants/xmlns_namespaces");r.name="gl2d",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex={x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},r.attrRegex={x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},r.attributes=t("../cartesian/attributes"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"gl2d"),a=0;ar;++r){var n=t[r],i=e[r];if(n.length!==i.length)return!0;for(var o=0;oa;++a,--s)for(var l=0;r>l;++l)for(var u=0;4>u;++u){var c=i[4*(r*a+l)+u];i[4*(r*a+l)+u]=i[4*(r*s+l)+u],i[4*(r*s+l)+u]=c}var h=document.createElement("canvas");h.width=r,h.height=n;var f=h.getContext("2d"),d=f.createImageData(r,n);d.data.set(i),f.putImageData(d,0,0);var p;switch(t){case"jpeg":p=h.toDataURL("image/jpeg");break;case"webp":p=h.toDataURL("image/webp");break;default:p=h.toDataURL("image/png")}return this.staticPlot&&this.container.removeChild(o),p},g.computeTickMarks=function(){this.xaxis._length=this.glplot.viewBox[2]-this.glplot.viewBox[0],this.yaxis._length=this.glplot.viewBox[3]-this.glplot.viewBox[1];for(var t=[s.calcTicks(this.xaxis),s.calcTicks(this.yaxis)],e=0;2>e;++e)for(var r=0;rM;++M)w[M]=Math.min(w[M],o.bounds[M]),w[M+2]=Math.max(w[M+2],o.bounds[M+2])}var k;for(n=0;2>n;++n)w[n]>w[n+2]&&(w[n]=-1,w[n+2]=1),k=this[m[n]],k._length=y.viewBox[n+2]-y.viewBox[n],s.doAutoRange(k);y.ticks=this.computeTickMarks();var A=this.xaxis.range,T=this.yaxis.range;y.dataBox=[A[0],T[0],A[1],T[1]],y.merge(r),a.update(y),this.glplot.draw()},g.draw=function(){if(!this.stopped){requestAnimationFrame(this.redraw);var t=this.glplot,e=this.camera,r=e.mouseListener,n=this.fullLayout;this.cameraChanged();var i=r.x*t.pixelRatio,o=this.canvas.height-t.pixelRatio*r.y;if(e.boxEnabled&&"zoom"===n.dragmode)this.selectBox.enabled=!0,this.selectBox.selectBox=[Math.min(e.boxStart[0],e.boxEnd[0]),Math.min(e.boxStart[1],e.boxEnd[1]),Math.max(e.boxStart[0],e.boxEnd[0]),Math.max(e.boxStart[1],e.boxEnd[1])],t.setDirty();else{this.selectBox.enabled=!1;var a=n._size,s=this.xaxis.domain,u=this.yaxis.domain,c=t.pick(i/t.pixelRatio+a.l+s[0]*a.w,o/t.pixelRatio-(a.t+(1-u[1])*a.h));if(c&&n.hovermode){var h=c.object._trace.handlePick(c);if(h&&(!this.lastPickResult||this.lastPickResult.traceUid!==h.trace.uid||this.lastPickResult.dataCoord[0]!==h.dataCoord[0]||this.lastPickResult.dataCoord[1]!==h.dataCoord[1])){var f=h;this.lastPickResult={traceUid:h.trace?h.trace.uid:null,dataCoord:h.dataCoord.slice()},this.spikes.update({center:c.dataCoord}),f.screenCoord=[((t.viewBox[2]-t.viewBox[0])*(c.dataCoord[0]-t.dataBox[0])/(t.dataBox[2]-t.dataBox[0])+t.viewBox[0])/t.pixelRatio,(this.canvas.height-(t.viewBox[3]-t.viewBox[1])*(c.dataCoord[1]-t.dataBox[1])/(t.dataBox[3]-t.dataBox[1])-t.viewBox[1])/t.pixelRatio];var d=f.hoverinfo;if("all"!==d){var p=d.split("+");-1===p.indexOf("x")&&(f.traceCoord[0]=void 0),-1===p.indexOf("y")&&(f.traceCoord[1]=void 0),-1===p.indexOf("z")&&(f.traceCoord[2]=void 0),-1===p.indexOf("text")&&(f.textLabel=void 0),-1===p.indexOf("name")&&(f.name=void 0)}l.loneHover({x:f.screenCoord[0],y:f.screenCoord[1],xLabel:this.hoverFormatter("xaxis",f.traceCoord[0]),yLabel:this.hoverFormatter("yaxis",f.traceCoord[1]),zLabel:f.traceCoord[2],text:f.textLabel,name:f.name,color:f.color},{container:this.svgContainer})}}else!c&&this.lastPickResult&&(this.spikes.update({}),this.lastPickResult=null,l.loneUnhover(this.svgContainer))}t.draw()}},g.hoverFormatter=function(t,e){if(void 0!==e){var r=this[t];return s.tickText(r,r.c2l(e),"hover").text}}},{"../../lib/html2unicode":567,"../../lib/show_no_webgl_msg":578,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"./camera":623,"./convert":624,"gl-plot2d":171,"gl-select-box":201,"gl-spikes2d":221}],627:[function(t,e,r){"use strict";function n(t,e){t=t||document.body,e=e||{};var r=[.01,1/0];"distanceLimits"in e&&(r[0]=e.distanceLimits[0],r[1]=e.distanceLimits[1]),"zoomMin"in e&&(r[0]=e.zoomMin),"zoomMax"in e&&(r[1]=e.zoomMax);var n=o({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:r}),l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],u=0,c=t.clientWidth,h=t.clientHeight,f={keyBindingMode:"rotate",view:n,element:t,delay:e.delay||16,rotateSpeed:e.rotateSpeed||1,zoomSpeed:e.zoomSpeed||1,translateSpeed:e.translateSpeed||1,flipX:!!e.flipX,flipY:!!e.flipY,modes:n.modes,tick:function(){var e=i(),r=this.delay,o=e-2*r;n.idle(e-r),n.recalcMatrix(o),n.flush(e-(100+2*r));for(var a=!0,s=n.computedMatrix,f=0;16>f;++f)a=a&&l[f]===s[f],l[f]=s[f];var d=t.clientWidth===c&&t.clientHeight===h;return c=t.clientWidth,h=t.clientHeight,a?!d:(u=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(f,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){var e=n.computedUp.slice(),r=n.computedEye.slice(),o=n.computedCenter.slice();if(n.setMode(t),"turntable"===t){var a=i();n._active.lookAt(a,r,o,e),n._active.lookAt(a+500,r,o,[0,0,1]),n._active.flush(a)}return n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return u},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var d=0,p=0;return a(t,function(e,r,o,a){var s="rotate"===f.keyBindingMode,l="pan"===f.keyBindingMode,c="zoom"===f.keyBindingMode,h=!!a.control,v=!!a.alt,m=!!a.shift,g=!!(1&e),y=!!(2&e),b=!!(4&e),x=1/t.clientHeight,_=x*(r-d),w=x*(o-p),M=f.flipX?1:-1,k=f.flipY?1:-1,A=i(),T=Math.PI*f.rotateSpeed;if((s&&g&&!h&&!v&&!m||g&&!h&&!v&&m)&&n.rotate(A,M*T*_,-k*T*w,0),(l&&g&&!h&&!v&&!m||y||g&&h&&!v&&!m)&&n.pan(A,-f.translateSpeed*_*u,f.translateSpeed*w*u,0),c&&g&&!h&&!v&&!m||b||g&&!h&&v&&!m){var E=-f.zoomSpeed*w/window.innerHeight*(A-n.lastT())*100;n.pan(A,0,0,u*(Math.exp(E)-1))}return d=r,p=o,!0}),s(t,function(t,e){var r=f.flipX?1:-1,o=f.flipY?1:-1,a=i();if(Math.abs(t)>Math.abs(e))n.rotate(a,0,0,-t*r*Math.PI*f.rotateSpeed/window.innerWidth);else{var s=-f.zoomSpeed*o*e/window.innerHeight*(a-n.lastT())/100;n.pan(a,0,0,u*(Math.exp(s)-1))}},!0),f}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":40,"mouse-change":421,"mouse-wheel":425,"right-now":435}],628:[function(t,e,r){"use strict";function n(t,e){for(var r=0;3>r;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),o=t("../plots"),a=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,a=o.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sr;++r){var n=t[u[r]];e.labels[r]=a(n.title),"titlefont"in n&&(n.titlefont.color&&(e.labelColor[r]=s(n.titlefont.color)),n.titlefont.family&&(e.labelFont[r]=n.titlefont.family),n.titlefont.size&&(e.labelSize[r]=n.titlefont.size)),"showline"in n&&(e.lineEnable[r]=n.showline),"linecolor"in n&&(e.lineColor[r]=s(n.linecolor)),"linewidth"in n&&(e.lineWidth[r]=n.linewidth),"showgrid"in n&&(e.gridEnable[r]=n.showgrid),"gridcolor"in n&&(e.gridColor[r]=s(n.gridcolor)),"gridwidth"in n&&(e.gridWidth[r]=n.gridwidth),"log"===n.type?e.zeroEnable[r]=!1:"zeroline"in n&&(e.zeroEnable[r]=n.zeroline),"zerolinecolor"in n&&(e.zeroLineColor[r]=s(n.zerolinecolor)),"zerolinewidth"in n&&(e.zeroLineWidth[r]=n.zerolinewidth),"ticks"in n&&n.ticks?e.lineTickEnable[r]=!0:e.lineTickEnable[r]=!1,"ticklen"in n&&(e.lineTickLength[r]=e._defaultLineTickLength[r]=n.ticklen),"tickcolor"in n&&(e.lineTickColor[r]=s(n.tickcolor)),"tickwidth"in n&&(e.lineTickWidth[r]=n.tickwidth),"tickangle"in n&&(e.tickAngle[r]="auto"===n.tickangle?0:Math.PI*-n.tickangle/180),"showticklabels"in n&&(e.tickEnable[r]=n.showticklabels),"tickfont"in n&&(n.tickfont.color&&(e.tickColor[r]=s(n.tickfont.color)),n.tickfont.family&&(e.tickFont[r]=n.tickfont.family),n.tickfont.size&&(e.tickSize[r]=n.tickfont.size)),"mirror"in n?-1!==["ticks","all","allticks"].indexOf(n.mirror)?(e.lineTickMirror[r]=!0,e.lineMirror[r]=!0):n.mirror===!0?(e.lineTickMirror[r]=!1,e.lineMirror[r]=!0):(e.lineTickMirror[r]=!1,e.lineMirror[r]=!1):e.lineMirror[r]=!1,"showbackground"in n&&n.showbackground!==!1?(e.backgroundEnable[r]=!0,e.backgroundColor[r]=s(n.backgroundcolor)):e.backgroundEnable[r]=!1}},e.exports=i},{"../../../lib/html2unicode":567,"../../../lib/str2rgbarray":580,arraytools:50}],633:[function(t,e,r){"use strict";function n(t,e,r,n){for(var o=r("bgcolor"),l=i.combine(o,n.paper_bgcolor),u=Object.keys(a.camera),c=0;ce;++e){var r=t[a[e]];this.enabled[e]=r.showspikes,this.colors[e]=o(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness}},e.exports=i},{"../../../lib/str2rgbarray":580}],636:[function(t,e,r){"use strict";function n(t){for(var e=new Array(3),r=0;3>r;++r){for(var n=t[r],i=new Array(n.length),o=0;oc;++c){var h=i[s[c]];if(h._length=(r[c].hi-r[c].lo)*r[c].pixelsPerDataUnit/t.dataScale[c],Math.abs(h._length)===1/0)u[c]=[];else{h.range[0]=r[c].lo/t.dataScale[c],h.range[1]=r[c].hi/t.dataScale[c],h._m=1/(t.dataScale[c]*r[c].pixelsPerDataUnit),h.range[0]===h.range[1]&&(h.range[0]-=1,h.range[1]+=1);var f=h.tickmode;if("auto"===h.tickmode){h.tickmode="linear";var d=h.nticks||o.Lib.constrain(h._length/40,4,9);o.Axes.autoTicks(h,Math.abs(h.range[1]-h.range[0])/d)}for(var p=o.Axes.calcTicks(h),v=0;vc;++c){l[c]=.5*(t.glplot.bounds[0][c]+t.glplot.bounds[1][c]);for(var v=0;2>v;++v)e.bounds[v][c]=t.glplot.bounds[v][c]}t.contourLevels=n(u)}e.exports=i;var o=t("../../../plotly"),a=t("../../../lib/html2unicode"),s=["xaxis","yaxis","zaxis"],l=[0,0,0]},{"../../../lib/html2unicode":567,"../../../plotly":589}],637:[function(t,e,r){"use strict";function n(t,e){var r,n,i=[0,0,0,0];for(r=0;4>r;++r)for(n=0;4>n;++n)i[n]+=t[4*r+n]*e[r];return i}function i(t,e){var r=n(t.projection,n(t.view,n(t.model,[e[0],e[1],e[2],1])));return r}e.exports=i},{}],638:[function(t,e,r){"use strict";function n(t){function e(e,r){if("string"==typeof r)return r;var n=t.fullSceneLayout[e];return v.tickText(n,n.c2l(r),"hover").text}var r,n=t.svgContainer,i=t.container.getBoundingClientRect(),o=i.width,a=i.height;n.setAttributeNS(null,"viewBox","0 0 "+o+" "+a),n.setAttributeNS(null,"width",o),n.setAttributeNS(null,"height",a),k(t),t.glplot.axes.update(t.axesOptions);for(var s=Object.keys(t.traces),l=null,u=t.glplot.selection,c=0;co;++o)l=c[T[o]],_(l);t?Array.isArray(t)||(t=[t]):t=[];var f=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]];for(o=0;oa;++a)f[0][a]>f[1][a]?d[a]=1:f[1][a]===f[0][a]?d[a]=1:d[a]=1/(f[1][a]-f[0][a]);for(this.dataScale=d,o=0;oo;++o){if(l=c[T[o]],u=l.type,u in x?(x[u].acc*=d[o],x[u].count+=1):x[u]={acc:d[o],count:1},l.autorange){for(y[0][o]=1/0,y[1][o]=-(1/0),a=0;ay[1][o])y[0][o]=-1,y[1][o]=1;else{var M=y[1][o]-y[0][o];y[0][o]-=M/32,y[1][o]+=M/32}}else{var k=c[T[o]].range;y[0][o]=k[0],y[1][o]=k[1]}y[0][o]===y[1][o]&&(y[0][o]-=1,y[1][o]+=1),b[o]=y[1][o]-y[0][o],this.glplot.bounds[0][o]=y[0][o]*d[o],this.glplot.bounds[1][o]=y[1][o]*d[o]}var A=[1,1,1];for(o=0;3>o;++o){l=c[T[o]],u=l.type;var E=x[u];A[o]=Math.pow(E.acc,1/E.count)/d[o]}var S,L=4;if("auto"===c.aspectmode)S=Math.max.apply(null,A)/Math.min.apply(null,A)<=L?A:[1,1,1];else if("cube"===c.aspectmode)S=[1,1,1];else if("data"===c.aspectmode)S=A;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var z=c.aspectratio;S=[z.x,z.y,z.z]}c.aspectratio.x=h.aspectratio.x=S[0],c.aspectratio.y=h.aspectratio.y=S[1],c.aspectratio.z=h.aspectratio.z=S[2],this.glplot.aspect=S;var I=c.domain||null,P=e._size||null;if(I&&P){var C=this.container.style;C.position="absolute",C.left=P.l+I.x[0]*P.w+"px",C.top=P.t+(1-I.y[1])*P.h+"px",C.width=P.w*(I.x[1]-I.x[0])+"px",C.height=P.h*(I.y[1]-I.y[0])+"px"}this.glplot.redraw()}},A.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},A.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},A.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},A.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},A.saveCamera=function(t){function e(t,e,r,n){var i=["up","center","eye"],o=["x","y","z"];return e[i[r]]&&t[i[r]][o[n]]===e[i[r]][o[n]]}var r=this.getCamera(),n=d.nestedProperty(t,this.id+".camera"),i=n.get(),o=!1;if(void 0===i)o=!0;else for(var a=0;3>a;a++)for(var s=0;3>s;s++)if(!e(r,i,a,s)){o=!0;break}return o&&n.set(r),o},A.updateFx=function(t,e){var r=this.camera;r&&("orbit"===t?(r.mode="orbit",r.keyBindingMode="rotate"):"turntable"===t?(r.up=[0,0,1],r.mode="turntable",r.keyBindingMode="rotate"):r.keyBindingMode=t),this.fullSceneLayout.hovermode=e},A.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var o=0,a=n-1;a>o;++o,--a)for(var s=0;r>s;++s)for(var l=0;4>l;++l){var u=i[4*(r*o+s)+l];i[4*(r*o+s)+l]=i[4*(r*a+s)+l],i[4*(r*a+s)+l]=u}var h=document.createElement("canvas");h.width=r,h.height=n;var f=h.getContext("2d"),d=f.createImageData(r,n);d.data.set(i),f.putImageData(d,0,0);var p;switch(t){case"jpeg":p=h.toDataURL("image/jpeg");break;case"webp":p=h.toDataURL("image/webp");break;default:p=h.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(c),p},e.exports=o},{"../../lib":568,"../../lib/show_no_webgl_msg":578,"../../lib/str2rgbarray":580,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../../plots/plots":648,"./camera":627,"./layout/convert":632,"./layout/spikes":635,"./layout/tick_marks":636,"./project":637,"./set_convert":639,"gl-plot3d":189}],639:[function(t,e,r){"use strict";var n=t("../cartesian/axes"),i=function(){};e.exports=function(t){n.setConvert(t),t.setScale=i}},{"../cartesian/axes":592}],640:[function(t,e,r){"use strict";var n=t("../plotly"),i=t("./font_attributes"),o=t("../components/color/attributes"),a=n.Lib.extendFlat;e.exports={font:{family:a({},i.family,{dflt:'"Open Sans", verdana, arial, sans-serif'}),size:a({},i.size,{dflt:12}),color:a({},i.color,{dflt:o.defaultLine})},title:{valType:"string",dflt:"Click to enter Plot title"},titlefont:a({},i,{}),autosize:{valType:"enumerated",values:[!0,!1,"initial"]},width:{valType:"number",min:10,dflt:700},height:{valType:"number",min:10,dflt:450},margin:{l:{valType:"number",min:0,dflt:80},r:{valType:"number",min:0,dflt:80},t:{valType:"number",min:0,dflt:100},b:{valType:"number",min:0,dflt:80},pad:{valType:"number",min:0,dflt:0},autoexpand:{ -valType:"boolean",dflt:!0}},paper_bgcolor:{valType:"color",dflt:o.background},plot_bgcolor:{valType:"color",dflt:o.background},separators:{valType:"string",dflt:".,"},hidesources:{valType:"boolean",dflt:!1},smith:{valType:"enumerated",values:[!1],dflt:!1},showlegend:{valType:"boolean"},_composedModules:{"*":"Fx"},_nestedModules:{xaxis:"Axes",yaxis:"Axes",scene:"gl3d",geo:"geo",legend:"Legend",annotations:"Annotations",shapes:"Shapes",images:"Images",updatemenus:"UpdateMenus",ternary:"ternary",mapbox:"mapbox"}}},{"../components/color/attributes":482,"../plotly":589,"./font_attributes":610}],641:[function(t,e,r){"use strict";e.exports={styleUrlPrefix:"mapbox://styles/mapbox/",styleUrlSuffix:"v9",controlContainerClassName:"mapboxgl-control-container",noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:"," Plotly.plot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join("\n"),mapOnErrorMsg:"Mapbox error."}},{}],642:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r=t.split(" "),i=r[0],o=r[1],a=Array.isArray(e)?n.mean(e):e,s=.5+a/100,l=1.5+a/100,u=["",""],c=[0,0];switch(i){case"top":u[0]="top",c[1]=-l;break;case"bottom":u[0]="bottom",c[1]=l}switch(o){case"left":u[1]="right",c[0]=-s;break;case"right":u[1]="left",c[0]=s}var h;return h=u[0]&&u[1]?u.join("-"):u[0]?u[0]:u[1]?u[1]:"center",{anchor:h,offset:c}}},{"../../lib":568}],643:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n0}function o(t){var e={},r={};switch(t.type){case"circle":s.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var n=t.symbol,i=l(n.textposition,n.iconsize);s.extendFlat(e,{"icon-image":n.icon+"-15","icon-size":n.iconsize/10,"text-field":n.text,"text-size":n.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(r,{"icon-color":t.color,"text-color":n.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:r}}function a(t){var e,r=t.sourcetype,n=t.source,i={type:r},o="string"==typeof n;return"geojson"===r?e="data":"vector"===r&&(e=o?"url":"tiles"),i[e]=n,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=n.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var r=a(t);e.addSource(this.idSource,r)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var r={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",r)}},u.updateStyle=function(t){var e=o(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,r){var i=new n(t,e);return i.update(r),i}},{"../../lib":568,"./convert_text_opts":642}],645:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color").defaultLine,o=t("../font_attributes"),a=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},accesstoken:{valType:"string",noBlank:!0,strict:!0},style:{valType:"any",values:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],dflt:"basic"},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},layers:{_isLinkedToArray:!0,sourcetype:{valType:"enumerated",values:["geojson","vector"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},type:{valType:"enumerated",values:["circle","line","fill","symbol"],dflt:"circle"},below:{valType:"string",dflt:""},color:{valType:"color",dflt:i},opacity:{valType:"number",min:0,max:1,dflt:1},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2}},fill:{outlinecolor:{valType:"color",dflt:i}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},textfont:n.extendDeep({},o,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:n.extendFlat({},a,{arrayOk:!1})}}}},{"../../components/color":483,"../../lib":568,"../../traces/scatter/attributes":750,"../font_attributes":610}],646:[function(t,e,r){"use strict";function n(t,e,r){r("accesstoken"),r("style"),r("center.lon"),r("center.lat"),r("zoom"),r("bearing"),r("pitch"),i(t,e),e._input=t}function i(t,e){function r(t,e){return o.coerce(n,i,s.layers,t,e)}for(var n,i,a=t.layers||[],l=e.layers=[],u=0;u=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),r.attr(o);var a=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&i(t,a),s.text(a.text()&&u.text()?" - ":"")},d.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=d.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},d.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},i=t.layout||{},a=t._fullData||[],s=t._fullData=[],l=t.data||[];d.supplyLayoutGlobalDefaults(i,n),n._dataLength=l.length,d.supplyDataDefaults(l,s,n),n._has=d._hasPlotType.bind(n);var u=n._modules;for(e=0;eo&&(e=(r-1)/(i.l+i.r),i.l=Math.floor(e*i.l),i.r=Math.floor(e*i.r)),0>a&&(e=(n-1)/(i.t+i.b),i.t=Math.floor(e*i.t),i.b=Math.floor(e*i.b))}},d.autoMargin=function(t,e,r){var n=t._fullLayout;if(n._pushmargin||(n._pushmargin={}),n.margin.autoexpand!==!1){if(r){var i=void 0===r.pad?12:r.pad;r.l+r.r>.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||d.doAutoMargin(t)}},d.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),a=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;return e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:o},t:{val:1,size:a},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,h=r.size,f=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(h)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(h*r+(n-e.width)*c)/(r-c),v=(n*(1-c)+(h-e.width)*(1-r))/(r-c);p>=0&&v>=0&&p+v>i+o&&(i=p,o=v)}}if(u(d)&&l[t].t){var m=l[t].t.val,g=l[t].t.size;if(m>f){var y=(d*m+(g-e.height)*f)/(m-f),b=(g*(1-f)+(d-e.height)*(1-m))/(m-f);y>=0&&b>=0&&y+b>s+a&&(s=y,a=b)}}})})),r.l=Math.round(i),r.r=Math.round(o),r.t=Math.round(a),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,t._replotting||"{}"===n||n===JSON.stringify(e._size)?void 0:c.plot(t)},d.graphJson=function(t,e,r,n,i){function o(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=o(t[e])}return i}return Array.isArray(t)?t.map(o):t&&t.getTime?h.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&d.supplyDefaults(t);var a=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(a||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(l.layout=o(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)}},{"../components/color":483,"../lib":568,"../plotly":589,"./attributes":590,"./font_attributes":610,"./layout_attributes":640,d3:119,"fast-isnumeric":123}],649:[function(t,e,r){"use strict";var n=t("../../traces/scatter/attributes"),i=n.marker;e.exports={r:n.r,t:n.t,marker:{color:i.color,size:i.size,symbol:i.symbol,opacity:i.opacity}}},{"../../traces/scatter/attributes":750}],650:[function(t,e,r){"use strict";function n(t,e){var r={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,r)}var i=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,a=o({},i.domain,{});e.exports={radialaxis:n("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:a,orientation:{valType:"number"}}),angularaxis:n("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:a}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":563,"../cartesian/layout_attributes":601}],651:[function(t,e,r){var n=t("../../plotly"),i=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},a=n.Lib.extendDeepAll;o.Axis=function(){function t(t){r=t||r;var u=l.data,h=l.layout;return("string"==typeof r||r.nodeName)&&(r=i.select(r)),r.datum(u).each(function(t,r){function l(t,e){return s(t)%360+h.orientation}var u=t.slice();c={data:o.util.cloneJson(u),layout:o.util.cloneJson(h)};var f=0;u.forEach(function(t,e){t.color||(t.color=h.defaultColorRange[f],f=(f+1)%h.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:i.rgb(t.color).darker().toString()),c.data[e].color=t.color,c.data[e].strokeColor=t.strokeColor,c.data[e].strokeDash=t.strokeDash,c.data[e].strokeSize=t.strokeSize});var d=u.filter(function(t,e){var r=t.visible;return"undefined"==typeof r||r===!0}),p=!1,v=d.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var m=i.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(v),g=[],y=m.map(function(t,e){if("unstacked"===t.key)return t.values;var r=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,n){t.yStack=[r],g.push(r),r=o.util.sumArrays(t.r,r)}),t.values});d=i.merge(y)}d.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var b=Math.min(h.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2;b=Math.max(10,b);var x,_=[h.margin.left+b,h.margin.top+b];if(p){var w=i.max(o.util.sumArrays(o.util.arrayLast(d).r[0],o.util.arrayLast(g)));x=[0,w]}else x=i.extent(o.util.flattenArray(d.map(function(t,e){return t.r})));h.radialAxis.domain!=o.DATAEXTENT&&(x[0]=0),n=i.scale.linear().domain(h.radialAxis.domain!=o.DATAEXTENT&&h.radialAxis.domain?h.radialAxis.domain:x).range([0,b]),c.layout.radialAxis.domain=n.domain();var M,k=o.util.flattenArray(d.map(function(t,e){return t.t})),A="string"==typeof k[0];A&&(k=o.util.deduplicate(k),M=k.slice(),k=i.range(k.length),d=d.map(function(t,e){var r=t;return t.t=[k],p&&(r.yStack=t.yStack),r}));var T=d.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===d.length,E=null===h.needsEndSpacing?A||!T:h.needsEndSpacing,S=h.angularAxis.domain&&h.angularAxis.domain!=o.DATAEXTENT&&!A&&h.angularAxis.domain[0]>=0,L=S?h.angularAxis.domain:i.extent(k),z=Math.abs(k[1]-k[0]);T&&!A&&(z=0);var I=L.slice();E&&A&&(I[1]+=z);var P=h.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),h.angularAxis.ticksStep&&(P=(I[1]-I[0])/P);var C=h.angularAxis.ticksStep||(I[1]-I[0])/(P*(h.minorTicks+1));M&&(C=Math.max(Math.round(C),1)),I[2]||(I[2]=C);var R=i.range.apply(this,I);if(R=R.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=i.scale.linear().domain(I.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?z:0,e=i.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var D="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",O=(new DOMParser).parseFromString(D,"application/xml"),F=this.appendChild(this.ownerDocument.importNode(O.documentElement,!0));e=i.select(F)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,N=e.select(".chart-group"),B={fill:"none",stroke:h.tickColor},U={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[b,h.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:j,elements:V,reverseOrder:h.legend.reverseOrder})})();var q=j.node().getBBox();b=Math.min(h.width-q.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,b=Math.max(10,b),_=[h.margin.left+b,h.margin.top+b],n.range([0,b]),c.layout.radialAxis.domain=n.domain(),j.attr("transform","translate("+[_[0]+b,_[1]-b]+")"); -}else j=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),N.attr("transform","translate("+_+")").style({cursor:"crosshair"});var G=[(h.width-(h.margin.left+h.margin.right+2*b+(q?q.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*b))/2];if(G[0]=Math.max(0,G[0]),G[1]=Math.max(0,G[1]),e.select(".outer-group").attr("transform","translate("+G+")"),h.title){var H=e.select("g.title-group text").style(U).text(h.title),X=H.node().getBBox();H.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(n.ticks(5));W.enter().append("circle").attr({"class":"grid-circle"}).style(B),W.attr("r",n),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(B);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var K=i.svg.axis().scale(n).ticks(5).tickSize(5);Y.call(K).attr({transform:"rotate("+h.radialAxis.orientation+")"}),Y.selectAll(".domain").style(B),Y.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var J=e.select(".angular.axis-group").selectAll("g.angular-tick").data(R),$=J.enter().append("g").classed("angular-tick",!0);J.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),J.exit().remove(),$.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(B),$.selectAll(".minor").style({stroke:h.minorTickColor}),J.select("line.grid-line").attr({x1:h.tickLength?b-h.tickLength:0,x2:b}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(U);var Q=J.select("text.axis-text").attr({x:b+h.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+h.labelOffset,i=h.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?270>r&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(180>=r&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:h.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(h.minorTicks+1)!=0?"":M?M[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(U);h.angularAxis.rewriteTicks&&Q.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var tt=i.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[b+tt,h.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=n,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=i.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),ot=[];it.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var at,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!A){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;at=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(at)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=n.invert(o.util.getMousePos(Z).radius);var i=o.util.convertToCartesian(r,h.radialAxis.orientation);ht.text(o.util.round(st)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ft.hide(),ct.hide(),ht.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var n=i.select(this),a=n.style("fill"),s="black",l=n.style("opacity")||1;if(n.attr({"data-opacity":l}),"none"!=a){n.attr({"data-fill":a}),s=i.hsl(a).darker().toString(),n.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,h=this.getBoundingClientRect(),f=e.node().getBoundingClientRect(),d=[h.left+h.width/2-G[0]-f.left,h.top+h.height/2-G[1]-f.top];ft.config({color:s}).text(c),ft.move(d)}else a=n.style("stroke"),n.attr({"data-stroke":a}),s=i.hsl(a).darker().toString(),n.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=i.event.which?!1:void(i.select(this).attr("data-fill")&&ft.show())}).on("mouseout.tooltip",function(t,e){ft.hide();var r=i.select(this),n=r.attr("data-fill");n?r.style({fill:n,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),f}var e,r,n,s,l={data:[],layout:{}},u={},c={},h=i.dispatch("hover"),f={};return f.render=function(e){return t(e),this},f.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},f.getLiveConfig=function(){return c},f.getinputConfig=function(){return u},f.radialScale=function(t){return n},f.angularScale=function(t){return s},f.svg=function(){return e},i.rebind(f,h,"on"),f},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:i.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,n=i.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return n},o.util.dataFromEquation=function(t,e,r){var n=e||6,o=[],a=[];i.range(0,360+n,n).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);o.push(e),a.push(i)});var s={t:o,r:a};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return i.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return i.zip(t,e).map(function(t,e){return i.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=i.mouse(t.node()),r=e[0],n=e[1],o={};return o.x=r,o.y=n,o.pos=e,o.angle=180*(Math.atan2(n,r)+Math.PI)/Math.PI,o.radius=Math.sqrt(r*r+n*n),o},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,o=t.length;o>i;i++)e=t[i],e in r?(r[e]++,n[e]=r[e]):r[e]=1;return n},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,r,n){if(n){var i=r.slice();r=e,e=i}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,r,n){return"undefined"!=typeof t?(n===e.length-1&&delete t[r],t[r]):void 0},t),r.reduce(function(t,e,n){return"undefined"==typeof t[e]&&(t[e]={}),n===r.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=r[0].geometryConfig,e=t.container;"string"==typeof e&&(e=i.select(e)),e.datum(r).each(function(e,r){function n(e,r){var n=t.radialScale(e[1]),i=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:n,t:i}}function o(t){var e=t.r*Math.cos(t.t),r=t.r*Math.sin(t.t);return{x:e,y:r}}var a=!!e[0].data.yStack,l=e.map(function(t,e){return a?i.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):i.zip(t.data.t[0],t.data.r[0])}),u=t.angularScale,c=t.radialScale.domain()[0],h={};h.bar=function(r,n,o){var a=e[o].data,s=t.radialScale(r[1])-t.radialScale(0),l=t.radialScale(r[2]||0),c=a.barWidth;i.select(this).attr({"class":"mark bar",d:"M"+[[s+l,-c/2],[s+l,c/2],[l,c/2],[l,-c/2]].join("L")+"Z",transform:function(e,r){return"rotate("+(t.orientation+u(e[0]))+")"}})},h.dot=function(t,r,a){var s=t[2]?[t[0],t[1]+t[2]]:t,l=i.svg.symbol().size(e[a].data.dotSize).type(e[a].data.dotType)(t,r);i.select(this).attr({"class":"mark dot",d:l,transform:function(t,e){var r=o(n(s));return"translate("+[r.x,r.y]+")"}})};var f=i.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});h.line=function(r,n,o){var a=r[2]?l[o].map(function(t,e){return[t[0],t[1]+t[2]]}):l[o];if(i.select(this).each(h.dot).style({opacity:function(t,r){return+e[o].data.dotVisible},fill:m.stroke(r,n,o)}).attr({"class":"mark dot"}),!(n>0)){var s=i.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({"class":"line",d:f(a),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(r,n,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,n,o)},"stroke-width":function(t,e){return m["stroke-width"](r,n,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,n,o)},opacity:function(t,e){return m.opacity(r,n,o)},display:function(t,e){return m.display(r,n,o)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,v=i.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});h.arc=function(e,r,n){i.select(this).attr({"class":"mark arc",d:v,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var m={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},g=i.select(this).selectAll("g.layer").data(l);g.enter().append("g").attr({"class":"layer"});var y=g.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(m).each(h[t.geometryType]),y.exit().remove(),g.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],n=i.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},i.rebind(t,n,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:i.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,n=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=i.merge(n);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=i.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,h=c?r.height:u*o.length,f=s.classed("legend-group",!0),d=f.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:h+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var v=i.range(o.length),m=i.scale[c?"linear":"ordinal"]().domain(v).range(l),g=i.scale[c?"linear":"ordinal"]().domain(v)[c?"range":"rangePoints"]([0,h]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=i.svg.symbolTypes.indexOf(t)?i.svg.symbol().type(t).size(r)():i.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,g(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return m(e)}}),x.exit().remove()}var _=i.svg.axis().scale(g).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=i.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},i.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,n={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=n.container.selectAll("g."+s).data([0]);var i=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return r=i.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=i.append("text").attr({dx:n.padding+l,dy:.3*+n.fontSize}),u};return u.text=function(o){var a=i.hsl(n.color).l,s=a>=.5?"#aaa":"white",c=a>=.5?"black":"white",h=o||"";e.style({fill:c,"font-size":n.fontSize+"px"}).text(h);var f=n.padding,d=e.node().getBBox(),p={fill:n.color,stroke:s,"stroke-width":"2px"},v=d.width+2*f+l,m=d.height+2*f;return r.attr({d:"M"+[[l,-m/2],[l,-m/4],[n.hasTick?0:l,0],[l,m/4],[l,m/2],[v,m/2],[v,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-m/2+2*f]+")"}),t.style({display:"block"}),u},u.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u):void 0},u.hide=function(){return t?(t.style({display:"none"}),u):void 0},u.show=function(){return t?(t.style({display:"block"}),u):void 0},u.config=function(t){return a(n,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var n=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var i=n.indexOf(t.geometry);-1!=i&&(r.data[e].groupId=i)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],h={};i.entries(s.margin).forEach(function(t,e){h[c[u.indexOf(t.key)]]=t.value}),s.margin=h}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../plotly":589,"./micropolar_manager":652,d3:119}],652:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("d3"),o=t("./undo_manager"),a=e.exports={},s=n.Lib.extendDeepAll;a.framework=function(t){function e(e,o){return o&&(h=o),i.select(i.select(h).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?s(r,e):e,u||(u=n.micropolar.Axis()),c=n.micropolar.adapter.plotly().convert(r),u.config(c).render(h),t.data=r.data,t.layout=r.layout,a.fillLayout(t),r}var r,l,u,c,h,f=new o;return e.isPolar=!0,e.svg=function(){return u.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return n.micropolar.adapter.plotly().convert(u.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:u.angularScale(),r:u.radialScale()}},e.setUndoPoint=function(){var t=this,e=n.micropolar.util.cloneJson(r);!function(e,r){f.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,l),l=n.micropolar.util.cloneJson(e)},e.undo=function(){f.undo()},e.redo=function(){f.redo()},e},a.fillLayout=function(t){var e=i.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),a={width:800,height:600,paper_bgcolor:n.Color.background,_container:e,_paperdiv:r,_paper:o};t._fullLayout=s(a,t.layout)}},{"../../plotly":589,"./undo_manager":653,d3:119}],653:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return nv;v++){var m=d[v];s=t[m]?t[m]:t[m]={},e[m]=l={},a("domain."+f,[v/p,(v+1)/p]),a("domain."+{x:"y",y:"x"}[f]),o.id=m,h(s,l,a,o)}}},{"../lib":568,"./plots":648}],655:[function(t,e,r){"use strict";var n=t("./ternary"),i=t("../../plots/plots");r.name="ternary",r.attr="subplot",r.idRoot="ternary",r.idRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"ternary"),a=0;a=a&&(d.min=0,p.min=0,v.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),o=t("../../subplot_defaults"),a=t("./layout_attributes"),s=t("./axis_defaults"),l=["aaxis","baxis","caxis"];e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:a,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":483,"../../subplot_defaults":654,"./axis_defaults":658,"./layout_attributes":660}],660:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:i,baxis:i,caxis:i}},{"../../../components/color/attributes":482,"./axis_attributes":657}],661:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function i(t){o.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var o=t("d3"),a=t("tinycolor2"),s=t("../../plotly"),l=t("../../lib"),u=t("../../components/color"),c=t("../../components/drawing"),h=t("../cartesian/set_convert"),f=t("../../lib/extend").extendFlat,d=t("../cartesian/axes"),p=t("../../lib/filter_visible"),v=t("../../components/dragelement"),m=t("../../components/titles"),g=t("../cartesian/select"),y=t("../cartesian/constants"),b=t("../cartesian/graph_interact");e.exports=n;var x=n.prototype;x.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},x.plot=function(t,e){var r,n=this,i=e[n.id],o=e._size;l.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(i,o);var a=n.traceHash,s={};for(r=0;r_*y?(o=y,i=o*_):(i=g,o=i/_),a=v*i/g,s=m*o/y,r=e.l+e.w*d-i/2,n=e.t+e.h*(1-p)-o/2,l.x0=r,l.y0=n,l.w=i,l.h=o,l.sum=b,l.xaxis={type:"linear",range:[x+2*M-b,b-x-2*w],domain:[d-a/2,d+a/2],_id:"x",_gd:l.graphDiv},h(l.xaxis),l.xaxis.setScale(),l.yaxis={type:"linear",range:[x,b-w-M],domain:[p-s/2,p+s/2],_id:"y",_gd:l.graphDiv},h(l.yaxis),l.yaxis.setScale();var k=l.yaxis.domain[0],A=l.aaxis=f({},t.aaxis,{range:[x,b-w-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[k,k+s*_],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l"+o+",-"+i/2});h(A);var T=l.baxis=f({},t.baxis,{range:[b-x-M,w],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_gd:l.graphDiv,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+o});h(T),A._counteraxis=T;var E=l.caxis=f({},t.caxis,{range:[b-x-w,M],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[k,k+s*_],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l-"+o+","+i/2});h(E);var S="M"+r+","+(n+o)+"h"+i+"l-"+i/2+",-"+o+"Z";l.clipDef.select("path").attr("d",S),l.layers.plotbg.select("path").attr("d",S);var L="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",L);var z="translate("+r+","+(n+o)+")";l.layers.baxis.attr("transform",z),l.layers.bgrid.attr("transform",z);var I="translate("+(r+i/2)+","+n+")rotate(30)";l.layers.aaxis.attr("transform",I),l.layers.agrid.attr("transform",I);var P="translate("+(r+i/2)+","+n+")rotate(-30)";l.layers.caxis.attr("transform",P),l.layers.cgrid.attr("transform",P),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1);var C=l.layers.axlines;C.select(".aline").attr("d",A.showline?"M"+r+","+(n+o)+"l"+i/2+",-"+o:"M0,0").call(u.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),C.select(".bline").attr("d",T.showline?"M"+r+","+(n+o)+"h"+i:"M0,0").call(u.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),C.select(".cline").attr("d",E.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+o:"M0,0").call(u.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px")},x.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",i=e.aaxis,o=e.baxis,a=e.caxis;if(d.doTicks(r,i,!0),d.doTicks(r,o,!0),d.doTicks(r,a,!0),t){var s=Math.max(i.showticklabels?i.tickfont.size/2:0,(a.showticklabels?.75*a.tickfont.size:0)+("outside"===a.ticks?.87*a.ticklen:0));m.draw(r,"a"+n,{propContainer:i,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-i.titlefont.size/3-s,"text-anchor":"middle"}});var l=(o.showticklabels?o.tickfont.size:0)+("outside"===o.ticks?o.ticklen:0)+3;m.draw(r,"b"+n,{propContainer:o,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-l,y:e.y0+e.h+.83*o.titlefont.size+l,"text-anchor":"middle"}}),m.draw(r,"c"+n,{propContainer:a,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+l,y:e.y0+e.h+.83*a.titlefont.size+l,"text-anchor":"middle"}})}};var w=y.MINZOOM/2+.87,M="m-0.87,.5h"+w+"v3h-"+(w+5.2)+"l"+(w/2+2.6)+",-"+(.87*w+4.5)+"l2.6,1.5l-"+w/2+","+.87*w+"Z",k="m0.87,.5h-"+w+"v3h"+(w+5.2)+"l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-2.6,1.5l"+w/2+","+.87*w+"Z",A="m0,1l"+w/2+","+.87*w+"l2.6,-1.5l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-"+(w/2+2.6)+","+(.87*w+4.5)+"l2.6,1.5l"+w/2+",-"+.87*w+"Z",T="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",E=!0;x.initInteractions=function(){function t(t,e,r){var n=F.getBoundingClientRect();x=e-n.left,w=r-n.top,S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},z=S,L=O.aaxis.range[1]-S.a,I=a(O.graphDiv._fullLayout[O.id].bgcolor).getLuminance(),P="M0,"+O.h+"L"+O.w/2+", 0L"+O.w+","+O.h+"Z",C=!1,R=N.append("path").attr("class","zoombox").style({fill:I>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",P),D=N.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),p()}function e(t,e){return 1-e/O.h}function r(t,e){return 1-(t+(O.h-e)/Math.sqrt(3))/O.w}function n(t,e){return(t-(O.h-e)/Math.sqrt(3))/O.w}function o(t,i){var o=x+t,a=w+i,s=Math.max(0,Math.min(1,e(x,w),e(o,a))),l=Math.max(0,Math.min(1,r(x,w),r(o,a))),u=Math.max(0,Math.min(1,n(x,w),n(o,a))),c=(s/2+u)*O.w,h=(1-s/2-l)*O.w,f=(c+h)/2,d=h-c,p=(1-s)*O.h,v=p-d/_;d.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),D.transition().style("opacity",1).duration(200),C=!0)}function c(t,e){if(z===S)return 2===e&&m(),i(j);i(j);var r={};r[O.id+".aaxis.min"]=z.a,r[O.id+".baxis.min"]=z.b,r[O.id+".caxis.min"]=z.c,s.relayout(j,r),E&&j.data&&j._context.showTips&&(l.notifier("Double-click to
zoom back out","long"),E=!1)}function h(){S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},z=S}function f(t,e){var r=t/O.xaxis._m,n=e/O.yaxis._m;z={a:S.a-n,b:S.b+(r+n)/2,c:S.c-(r-n)/2};var i=[z.a,z.b,z.c].sort(),o={a:i.indexOf(z.a),b:i.indexOf(z.b),c:i.indexOf(z.c)};i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),z={a:i[o.a],b:i[o.b],c:i[o.c]},e=(S.a-z.a)*O.yaxis._m,t=(S.c-z.c-S.b+z.b)*O.xaxis._m);var a="translate("+(O.x0+t)+","+(O.y0+e)+")";O.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",a),O.aaxis.range=[z.a,O.sum-z.b-z.c],O.baxis.range=[O.sum-z.a-z.c,z.b],O.caxis.range=[O.sum-z.a-z.b,z.c],O.drawAxes(!1),O.plotContainer.selectAll(".crisp").classed("crisp",!1)}function d(t,e){if(t){var r={};r[O.id+".aaxis.min"]=z.a,r[O.id+".baxis.min"]=z.b,r[O.id+".caxis.min"]=z.c,s.relayout(j,r)}else 2===e&&m()}function p(){O.plotContainer.selectAll(".select-outline").remove()}function m(){var t={};t[O.id+".aaxis.min"]=0,t[O.id+".baxis.min"]=0,t[O.id+".caxis.min"]=0,j.emit("plotly_doubleclick",null),s.relayout(j,t)}var x,w,S,L,z,I,P,C,R,D,O=this,F=O.layers.plotbg.select("path").node(),j=O.graphDiv,N=O.layers.zoom,B={element:F,gd:j,plotinfo:{plot:N},doubleclick:m,subplot:O.id,prepFn:function(e,r,n){B.xaxes=[O.xaxis],B.yaxes=[O.yaxis];var i=j._fullLayout.dragmode;e.shiftKey&&(i="pan"===i?"zoom":"pan"),"lasso"===i?B.minDrag=1:B.minDrag=void 0,"zoom"===i?(B.moveFn=o,B.doneFn=c,t(e,r,n)):"pan"===i?(B.moveFn=f,B.doneFn=d,h(),p()):"select"!==i&&"lasso"!==i||g(e,r,n,B,i)}};F.onmousemove=function(t){b.hover(j,t,O.id),j._fullLayout._lasthover=F,j._fullLayout._hoversubplot=O.id},F.onmouseout=function(t){j._dragging||v.unhover(j,t)},F.onclick=function(t){b.click(j,t)},v.init(B)}},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../components/titles":546,"../../lib":568,"../../lib/extend":563,"../../lib/filter_visible":564,"../../plotly":589,"../cartesian/axes":592,"../cartesian/constants":597,"../cartesian/graph_interact":599,"../cartesian/select":605,"../cartesian/set_convert":606,d3:119,tinycolor2:454}],662:[function(t,e,r){"use strict";function n(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function i(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),a=o.Lib.extendFlat,s=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,l=t.data,u=t.layout,c=s([],l),h=s({},u,n(e.tileClass));if(e.width&&(h.width=e.width),e.height&&(h.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){h.annotations=[];var f=Object.keys(h);for(r=0;rl;l++)n(r[l])&&d.push({p:r[l],s:s[l],b:0});return o(e,"marker")&&a(e,e.marker.color,"marker","c"),o(e,"marker.line")&&a(e,e.marker.line.color,"marker.line","c"),d}},{"../../components/colorscale/calc":490,"../../components/colorscale/has_colorscale":496,"../../plots/cartesian/axes":592,"fast-isnumeric":123}],672:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),o=t("../scatter/xy_defaults"),a=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=o(t,e,c);return h?(c("orientation",e.x&&!e.y?"h":"v"),c("text"),a(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),void s(t,e,i.defaultLine,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/color":483,"../../components/errorbars/defaults":511,"../../lib":568,"../bar/style_defaults":680,"../scatter/xy_defaults":771,"./attributes":670}],673:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/graph_interact"),i=t("../../components/errorbars"),o=t("../../components/color");e.exports=function(t,e,r,a){var s,l=t.cd,u=l[0].trace,c=l[0].t,h=t.xa,f=t.ya,d="closest"===a?c.barwidth/2:c.dbar*(1-h._gd._fullLayout.bargap)/2;s="closest"!==a?function(t){return t.p}:"h"===u.orientation?function(t){return t.y}:function(t){return t.x};var p,v;"h"===u.orientation?(p=function(t){return n.inbox(t.b-e,t.x-e)+(t.x-e)/(t.x-t.b)},v=function(t){var e=s(t)-r;return n.inbox(e-d,e+d)}):(v=function(t){return n.inbox(t.b-r,t.y-r)+(t.y-r)/(t.y-t.b)},p=function(t){var r=s(t)-e;return n.inbox(r-d,r+d)});var m=n.getDistanceFunction(a,p,v);if(n.getClosest(l,m,t),t.index!==!1){var g=l[t.index],y=g.mcc||u.marker.color,b=g.mlcc||u.marker.line.color,x=g.mlw||u.marker.line.width;return o.opacity(y)?t.color=y:o.opacity(b)&&x&&(t.color=b),"h"===u.orientation?(t.x0=t.x1=h.c2p(g.x,!0),t.xLabelVal=g.s,t.y0=f.c2p(s(g)-d,!0),t.y1=f.c2p(s(g)+d,!0),t.yLabelVal=g.p):(t.y0=t.y1=f.c2p(g.y,!0),t.yLabelVal=g.s,t.x0=h.c2p(s(g)-d,!0),t.x1=h.c2p(s(g)+d,!0),t.xLabelVal=g.p),g.tx&&(t.text=g.tx),i.hoverInfo(g,u,t),[t]}}},{"../../components/color":483,"../../components/errorbars":512,"../../plots/cartesian/graph_interact":599}],674:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("./layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.calc=t("./calc"),n.setPositions=t("./set_positions"),n.colorbar=t("../scatter/colorbar"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="bar",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","oriented","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"../scatter/colorbar":753,"./arrays_to_calcdata":669,"./attributes":670,"./calc":671,"./defaults":672,"./hover":673,"./layout_attributes":675,"./layout_defaults":676,"./plot":677,"./set_positions":678,"./style":679}],675:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:""},bargap:{valType:"number",min:0,max:1},bargroupgap:{valType:"number",min:0,max:1,dflt:0}}},{}],676:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){function s(r,n){return o.coerce(t,e,a,r,n)}for(var l=!1,u=!1,c=!1,h={},f=0;f=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var f,d,p,v;if("h"===s.orientation?(p=c.c2p(r.poffset+e.p,!0),v=c.c2p(r.poffset+e.p+r.barwidth,!0),f=u.c2p(e.b,!0),d=u.c2p(e.s+e.b,!0)):(f=u.c2p(r.poffset+e.p,!0),d=u.c2p(r.poffset+e.p+r.barwidth,!0),v=c.c2p(e.s+e.b,!0),p=c.c2p(e.b,!0)),!(i(f)&&i(d)&&i(p)&&i(v)&&f!==d&&p!==v))return void n.select(this).remove();var m=(e.mlw+1||s.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,g=n.round(m/2%1,2);if(!t._context.staticPlot){var y=a.opacity(e.mc||s.marker.color),b=1>y||m>.01?o:l;f=b(f,d),d=b(d,f),p=b(p,v),v=b(v,p)}n.select(this).attr("d","M"+f+","+p+"V"+v+"H"+d+"V"+p+"Z")})}),f.call(s.plot,e)}},{"../../components/color":483,"../../components/errorbars":512,"../../lib":568,"./arrays_to_calcdata":669,d3:119,"fast-isnumeric":123}],678:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/plots"),o=t("../../plots/cartesian/axes"),a=t("../../lib");e.exports=function(t,e){var r,s,l=t._fullLayout,u=e.x(),c=e.y();["v","h"].forEach(function(h){function f(e){function r(t){t[p]=t.p+f}var n=[];e.forEach(function(e){t.calcdata[e].forEach(function(t){n.push(t.p)})});var i=a.distinctVals(n),s=i.vals,u=i.minDiff,c=!1,h=[];"group"===l.barmode&&e.forEach(function(e){c||(t.calcdata[e].forEach(function(t){c||h.forEach(function(e){Math.abs(t.p-e)_&&(L=!0,A=_),_>k+C&&(L=!0,k=_))}o.expand(g,[A,k],{tozero:!0,padded:L})}else{var R=function(t){return t[v]=t.s,t.s};for(r=0;r1||0===s.bargap&&0===s.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,a=r.line,s=(e._input||{}).marker||{},l=o.tryColorscale(r,s,""),u=o.tryColorscale(r,s,"line.");n.select(this).selectAll("path").each(function(t){var e,o,s=(t.mlw+1||a.width+1)-1,c=n.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(r.color)?i.defaultLine:r.color,c.style("stroke-width",s+"px").call(i.fill,e),s&&(o="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(a.color)?i.defaultLine:a.color,c.call(i.stroke,o))})}),e.call(a.style)}},{"../../components/color":483,"../../components/drawing":506,"../../components/errorbars":512,d3:119}],680:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,s){r("marker.color",a),i(t,"marker")&&o(t,e,s,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),i(t,"marker.line")&&o(t,e,s,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width")}},{"../../components/color":483,"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496}],681:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,a=n.marker,s=a.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},a.symbol,{arrayOk:!1}),opacity:o({},a.opacity,{arrayOk:!1,dflt:1}),size:o({},a.size,{arrayOk:!1}),color:o({},a.color,{arrayOk:!1}),line:{color:o({},s.color,{arrayOk:!1,dflt:i.defaultLine}),width:o({},s.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":482,"../../lib/extend":563,"../scatter/attributes":750}],682:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,o,a){var s;return r in e?p=o.makeCalcdata(e,r):(s=r+"0"in e?e[r+"0"]:"name"in e&&("category"===o.type||n(e.name)&&-1!==["linear","log"].indexOf(o.type)||i.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,s=o.d2c(s),p=a.map(function(){return s})),p}function a(t,e,r,o,a){var s,l,u,c,h=o.length,f=e.length,d=[],p=[];for(s=0;h>s;++s)l=o[s],t[s]={pos:l},p[s]=l-a,d[s]=[];for(p.push(o[h-1]+a),s=0;f>s;++s)c=e[s],n(c)&&(u=i.findBin(r[s],p),u>=0&&f>u&&d[u].push(c));return d}function s(t,e){var r,n,o,a;for(a=0;a1,g=r.dPos*(1-f.boxgap)*(1-f.boxgroupgap)/(m?t.numboxes:1),y=m?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-f.boxgap):0,b=g*v.whiskerwidth;return v.visible!==!0||r.emptybox?void o.select(this).remove():("h"===v.orientation?(l=p,h=d):(l=d,h=p),r.bPos=y,r.bdPos=g,n(),o.select(this).selectAll("path.box").data(a.identity).enter().append("path").attr("class","box").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-g,!0),n=l.c2p(t.pos+y+g,!0),i=l.c2p(t.pos+y-b,!0),s=l.c2p(t.pos+y+b,!0),u=h.c2p(t.q1,!0),c=h.c2p(t.q3,!0),f=a.constrain(h.c2p(t.med,!0),Math.min(u,c)+1,Math.max(u,c)-1),d=h.c2p(v.boxpoints===!1?t.min:t.lf,!0),p=h.c2p(v.boxpoints===!1?t.max:t.uf,!0); -"h"===v.orientation?o.select(this).attr("d","M"+f+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+c+"V"+r+"ZM"+u+","+e+"H"+d+"M"+c+","+e+"H"+p+(0===v.whiskerwidth?"":"M"+d+","+i+"V"+s+"M"+p+","+i+"V"+s)):o.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+u+"H"+n+"V"+c+"H"+r+"ZM"+e+","+u+"V"+d+"M"+e+","+c+"V"+p+(0===v.whiskerwidth?"":"M"+i+","+d+"H"+s+"M"+i+","+p+"H"+s))}),v.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=v}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,s,l,h,f="all"===v.boxpoints?t.val:t.val.filter(function(e){return et.uf}),d=(t.q3-t.q1)*c,p=[],m=0;if(v.jitter){for(e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(s.translatePoints,d,p),void(v.boxmean&&o.select(this).selectAll("path.mean").data(a.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-g,!0),n=l.c2p(t.pos+y+g,!0),i=h.c2p(t.mean,!0),a=h.c2p(t.mean-t.sd,!0),s=h.c2p(t.mean+t.sd,!0);"h"===v.orientation?o.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==v.boxmean?"":"m0,0L"+a+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):o.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==v.boxmean?"":"m0,0L"+e+","+a+"L"+r+","+i+"L"+e+","+s+"Z"))})))})}},{"../../components/drawing":506,"../../lib":568,d3:119}],689:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var r,a,s,l,u=t._fullLayout,c=e.x(),h=e.y(),f=["v","h"];for(a=0;al&&(e.z=c.slice(0,l)),s("locationmode"),s("text"),s("marker.line.color"),s("marker.line.width"),i(t,e,a,s,{prefix:"",cLetter:"z"}),void s("hoverinfo",1===a._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":691}],694:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot").plot,n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":613,"../heatmap/colorbar":708,"./attributes":691,"./calc":692,"./defaults":693,"./plot":695}],695:[function(t,e,r){"use strict";function n(t,e){function r(e){var r=t.mockAxis;return a.tickText(r,r.c2l(e),"hover").text}var n=e.hoverinfo;if("none"===n)return function(t){delete t.nameLabel,delete t.textLabel};var i="all"===n?m.hoverinfo.flags:n.split("+"),o=-1!==i.indexOf("name"),s=-1!==i.indexOf("location"),l=-1!==i.indexOf("z"),u=-1!==i.indexOf("text"),c=!o&&s;return function(t){var n=[];c?t.nameLabel=t.id:(o&&(t.nameLabel=e.name),s&&n.push(t.id)),l&&n.push(r(t.z)),u&&n.push(t.tx),t.textLabel=n.join("
")}}function i(t){return function(e,r){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:r,location:e.id,z:e.z}]}}}var o=t("d3"),a=t("../../plots/cartesian/axes"),s=t("../../plots/cartesian/graph_interact"),l=t("../../components/color"),u=t("../../components/drawing"),c=t("../../components/colorscale/get_scale"),h=t("../../components/colorscale/make_scale_function"),f=t("../../lib/topojson_utils").getTopojsonFeatures,d=t("../../lib/geo_location_utils").locationToFeature,p=t("../../lib/array_to_calc_item"),v=t("../../plots/geo/constants"),m=t("./attributes"),g=e.exports={};g.calcGeoJSON=function(t,e){for(var r,n=[],i=t.locations,o=i.length,a=f(t,e),s=(t.marker||{}).line||{},l=0;o>l;l++)r=d(t.locationmode,i[l],a),void 0!==r&&(r.z=t.z[l],void 0!==t.text&&(r.tx=t.text[l]),p(s.color,r,"mlc",l),p(s.width,r,"mlw",l),n.push(r));return n.length>0&&(n[0].trace=t),n},g.plot=function(t,e,r){var a,l=t.framework,u=l.select("g.choroplethlayer"),c=l.select("g.baselayer"),h=l.select("g.baselayeroverchoropleth"),f=v.baseLayersOverChoropleth,d=u.selectAll("g.trace.choropleth").data(e,function(t){return t.uid});d.enter().append("g").attr("class","trace choropleth"),d.exit().remove(),d.each(function(e){function r(e,r){if(t.showHover){var n=t.projection(e.properties.ct);u(e),s.loneHover({x:n[0],y:n[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),h=c(e,r),t.graphDiv.emit("plotly_hover",h)}}function a(e,r){t.graphDiv.emit("plotly_click",c(e,r))}var l=g.calcGeoJSON(e,t.topojson),u=n(t,e),c=i(e),h=null,f=o.select(this).selectAll("path.choroplethlocation").data(l);f.enter().append("path").classed("choroplethlocation",!0).on("mouseover",r).on("click",a).on("mouseout",function(){s.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",h)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",r),f.exit().remove()}),h.selectAll("*").remove();for(var p=0;pr;r++)e=h[r],d[r]=e[0]*(t.zmax-t.zmin)+t.zmin,p[r]=e[1];var v=n.extent([t.zmin,t.zmax,o.start,o.start+l*(u-1)]),m=v[t.zminr;r++)e=h[r],d[r]=(e[0]*(u+c-1)-c/2)*l+a,p[r]=e[1];var y=n.scale.linear().interpolate(n.interpolateRgb).domain(d).range(p);return y}},{"../../components/colorscale/get_scale":495,d3:119}],703:[function(t,e,r){"use strict";function n(t,e,r){var n=r[0].trace,o=r[0].x,s=r[0].y,u=n.contours,c=n.uid,h=e.x(),f=e.y(),m=t._fullLayout,b="contour"+c,x=i(u,e,r[0]);if(n.visible!==!0)return m._paper.selectAll("."+b+",.hm"+c).remove(),void m._infolayer.selectAll(".cb"+c).remove();"heatmap"===u.coloring?(n.zauto&&n.autocontour===!1&&(n._input.zmin=n.zmin=u.start-u.size/2,n._input.zmax=n.zmax=n.zmin+x.length*u.size),M(t,e,[r])):m._paper.selectAll(".hm"+c).remove(),a(x),l(x);var _=h.c2p(o[0],!0),w=h.c2p(o[o.length-1],!0),k=f.c2p(s[0],!0),A=f.c2p(s[s.length-1],!0),T=[[_,A],[w,A],[w,k],[_,k]],E=d(e,r,b);p(E,T,u),v(E,x,T,u),g(E,x,u),y(E,e,r[0],T)}function i(t,e,r){for(var n=t.size||1,i=[],o=t.start;ot?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function a(t){var e,r,n,i,a,s,l,u,c,h=t[0].z,f=h.length,d=h[0].length,p=2===f||2===d;for(r=0;f-1>r;r++)for(i=[],0===r&&(i=i.concat(k)),r===f-2&&(i=i.concat(A)),e=0;d-1>e;e++)for(n=i.slice(),0===e&&(n=n.concat(T)),e===d-2&&(n=n.concat(E)),a=e+","+r,s=[[h[r][e],h[r][e+1]],[h[r+1][e],h[r+1][e+1]]],c=0;ci;i++){if(s>20?(s=L[s][(l[0]||l[1])<0?0:1],t.crossings[a]=z[s]):delete t.crossings[a],l=S[s],!l){_.log("Found bad marching index:",s,e,t.level);break}if(d.push(f(t,e,l)),e[0]+=l[0],e[1]+=l[1],c(d[d.length-1],d[d.length-2])&&d.pop(),a=e.join(","),a===o&&l.join(",")===p||r&&(l[0]&&(e[0]<0||e[0]>m-2)||l[1]&&(e[1]<0||e[1]>v-2)))break;s=t.crossings[a]}1e4===i&&_.log("Infinite loop in contour?");var g,y,b,x,w,M,k,A=c(d[0],d[d.length-1]),T=0,E=.2*t.smoothing,I=[],P=0;for(i=1;i=P;i--)if(g=I[i],C>g){for(b=0,y=i-1;y>=P&&g+I[y]b&&g+I[b]e;)e++,r=Object.keys(i.crossings)[0].split(",").map(Number),s(i,r);1e4===e&&_.log("Infinite loop in contour?")}}function u(t,e,r){var n=0,i=0;return t>20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==k.indexOf(t)?i=1:-1!==T.indexOf(t)?n=1:-1!==A.indexOf(t)?i=-1:n=-1,[n,i]}function c(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function h(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function f(t,e,r){var n=e[0]+Math.max(r[0],0),i=e[1]+Math.max(r[1],0),o=t.z[i][n],a=t.xaxis,s=t.yaxis;if(r[1]){var l=(t.level-o)/(t.z[i][n+1]-o);return[a.c2p((1-l)*t.x[n]+l*t.x[n+1],!0),s.c2p(t.y[i],!0)]}var u=(t.level-o)/(t.z[i+1][n]-o);return[a.c2p(t.x[n],!0),s.c2p((1-u)*t.y[i]+u*t.y[i+1],!0)]}function d(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function p(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var i=n.selectAll("path").data("fill"===r.coloring?[0]:[]);i.enter().append("path"),i.exit().remove(),i.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function v(t,e,r,n){var i=t.selectAll("g.contourfill").data([0]);i.enter().append("g").classed("contourfill",!0);var o=i.selectAll("path").data("fill"===n.coloring?e:[]);o.enter().append("path"),o.exit().remove(),o.each(function(t){var e=m(t,r);e?x.select(this).attr("d",e).style("stroke","none"):x.select(this).remove()})}function m(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function i(t){return Math.abs(t[0]-e[0][0])<.01}function o(t){return Math.abs(t[0]-e[2][0])<.01}for(var a,s,l,u,c,h,f=t.edgepaths.length||t.z[0][0]l;l++){if(!a){_.log("Missing end?",d,t);break}for(r(a)&&!o(a)?s=e[1]:i(a)?s=e[0]:n(a)?s=e[3]:o(a)&&(s=e[2]),c=0;c=0&&(s=m,u=c):Math.abs(a[1]-s[1])<.01?Math.abs(a[1]-m[1])<.01&&(m[0]-a[0])*(s[0]-m[0])>=0&&(s=m,u=c):_.log("endpt to newendpt is not vert. or horz.",a,s,m)}if(a=s,u>=0)break;f+="L"+s}if(u===t.edgepaths.length){_.log("unclosed perimeter path");break}d=u,v=-1===p.indexOf(d),v&&(d=p[0],f+="Z")}for(d=0;de;e++)s.push(1);for(e=0;o>e;e++)i.push(s.slice());for(e=0;ea;a++)for(n=i(l,a),c[a]=new Array(n),s=0;n>s;s++)c[a][s]=e(o(l,a,s));return c}function i(t,e,r,n,i,o){var a,s,l,u=[],c=f.traceIs(t,"contour"),h=f.traceIs(t,"histogram"),d=f.traceIs(t,"gl2d"),p=Array.isArray(e)&&e.length>1;if(p&&!h&&"category"!==o.type){e=e.map(o.d2c);var v=e.length;if(!(i>=v))return c?e.slice(0,i):e.slice(0,i+1);if(c||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;v>l;l++)u.push(.5*(e[l-1]+e[l]));u.push(1.5*e[v-1]-.5*e[v-2])}if(i>v){var m=u[u.length-1],g=m-u[u.length-2];for(l=v;i>l;l++)m+=g,u.push(m)}}else for(s=n||1,a=h||"category"===o.type?r||0:Array.isArray(e)&&1===e.length?e[0]:void 0===r?0:o.d2c(r),l=c||d?0:-.5;i>l;l++)u.push(a+s*l);return u}function o(t){return.5-.25*Math.min(1,.5*t)}function a(t,e,r){var n,i,a=1;if(Array.isArray(r))for(n=0;nn&&a>y;n++)a=l(t,e,o(a));return a>y&&c.log("interp2d didn't converge quickly",a),t}function s(t){var e,r,n,i,o,a,s,l,u=[],c={},h=[],f=t[0],d=[],p=[0,0,0],v=g(t);for(r=0;rn;n++)void 0===d[n]&&(a=(void 0!==d[n-1]?1:0)+(void 0!==d[n+1]?1:0)+(void 0!==e[n]?1:0)+(void 0!==f[n]?1:0),a?(0===r&&a++,0===n&&a++,r===t.length-1&&a++,n===d.length-1&&a++,4>a&&(c[[r,n]]=[r,n,a]),u.push([r,n,a])):h.push([r,n]));for(;h.length;){for(s={},l=!1,o=h.length-1;o>=0;o--)i=h[o],r=i[0],n=i[1],a=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,a&&(s[i]=[r,n,a],h.splice(o,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,o,a,s,l,u,c,h,f,d,p,v,m=0;for(a=0;as;s++)l=b[s],u=t[i+l[0]],u&&(c=u[o+l[1]],void 0!==c&&(0===f?p=v=c:(p=Math.min(p,c),v=Math.max(v,c)),h++,f+=c));if(0===h)throw"iterateInterp2d order is wrong: no defined neighbors";t[i][o]=f/h,void 0===d?4>h&&(m=1):(t[i][o]=(1+r)*t[i][o]-r*d,v>p&&(m=Math.max(m,Math.abs(t[i][o]-d)/(v-p))))}return m}var u=t("fast-isnumeric"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../../plots/plots"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),v=t("./has_columns"),m=t("./convert_column_xyz"),g=t("./max_row_length");e.exports=function(t,e){function r(t){E=e._input.zsmooth=e.zsmooth=!1,c.notifier("cannot fast-zsmooth: "+t)}var o,l,u,y,b,x,_,w,M=h.getFromId(t,e.xaxis||"x"),k=h.getFromId(t,e.yaxis||"y"),A=f.traceIs(e,"contour"),T=f.traceIs(e,"histogram"),E=A?"best":e.zsmooth;if(M._minDtick=0,k._minDtick=0,T){var S=d(t,e);o=S.x,l=S.x0,u=S.dx,y=S.y,b=S.y0,x=S.dy,_=S.z}else v(e)&&m(e,M,k),o=e.x?M.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(A||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=a(_,e._emptypoints,e._interpz));if("fast"===E)if("log"===M.type||"log"===k.type)r("log axis found");else if(!T){if(o.length){var L=(o[o.length-1]-o[0])/(o.length-1),z=Math.abs(L/100);for(w=0;wz){r("x scale is not linear");break}}if(y.length&&"fast"===E){var I=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(I/100);for(w=0;wP){r("y scale is not linear");break}}}var C=g(_),R="scaled"===e.xtype?"":e.x,D=i(e,R,l,u,C,M),O="scaled"===e.ytype?"":e.y,F=i(e,O,b,x,_.length,k);h.expand(M,D),h.expand(k,F);var j={x:D,y:F,z:_};if(p(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var N="contour"===e.type?"heatmap":"histogram2d";j.xfill=i(N,R,l,u,C,M),j.yfill=i(N,O,b,x,_.length,k)}return[j]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":490,"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648,"../histogram2d/calc":727,"./convert_column_xyz":709,"./has_columns":711,"./max_row_length":714,"fast-isnumeric":123}],708:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u="cb"+r.uid,c=s(r.colorscale),h=r.zmin,f=r.zmax;if(i(h)||(h=o.aggNums(Math.min,null,r.z)),i(f)||(f=o.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+u).remove(),!r.showscale)return void a.autoMargin(t,u);var d=e[0].t.cb=l(t,u);d.fillcolor(n.scale.linear().domain(c.map(function(t){return h+t[0]*(f-h)})).range(c.map(function(t){return t[1]}))).filllevels({start:h,end:f,size:(f-h)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,d3:119,"fast-isnumeric":123}],709:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,o=t.x.slice(),a=t.y.slice(),s=t.z,l=t.text,u=Math.min(o.length,a.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(ui;i++)o[i]=e.d2c(o[i]),a[i]=r.d2c(a[i]);var h,f,d,p=n.distinctVals(o),v=p.vals,m=n.distinctVals(a),g=m.vals,y=n.init2dArray(g.length,v.length);for(c&&(d=n.init2dArray(g.length,v.length)),i=0;u>i;i++)h=n.findBin(o[i]+p.minDiff/2,v),f=n.findBin(a[i]+m.minDiff/2,g),y[f][h]=s[i],c&&(d[f][h]=l[i]);t.x=v,t.y=g,t.z=y,c&&(t.text=d)}},{"../../lib":568}],710:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./has_columns"),o=t("./xyz_defaults"),a=t("../../components/colorscale/defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function u(r,i){return n.coerce(t,e,s,r,i)}var c=o(t,e,u);return c?(u("text"),u("zsmooth"),u("connectgaps",i(e)&&e.zsmooth!==!1),void a(t,e,l,u,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":706,"./has_columns":711,"./xyz_defaults":717}],711:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],712:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/graph_interact"),i=t("../../lib"),o=t("../../plots/cartesian/constants").MAXDIST;e.exports=function(t,e,r,a,s){if(!(t.distancec||c>=y[0].length||0>h||h>y.length)return}else{if(n.inbox(e-m[0],e-m[m.length-1])>o||n.inbox(r-g[0],r-g[g.length-1])>o)return;if(s){var M;for(x=[2*m[0]-m[1]],M=1;M0;)_=m.c2p(z[A]),A--;for(x>_&&(w=_,_=x,x=w,O=!0),A=0;void 0===M&&A0;)k=g.c2p(I[A]),A--;if(M>k&&(w=M,M=k,k=w,F=!0),P&&(z=r[0].xfill,I=r[0].yfill),"fast"!==C){var j="best"===C?0:.5;x=Math.max(-j*m._length,x),_=Math.min((1+j)*m._length,_),M=Math.max(-j*g._length,M),k=Math.min((1+j)*g._length,k)}var N=Math.round(_-x),B=Math.round(k-M),U=0>=N||0>=B,V=e.plot.select(".imagelayer").selectAll("g.hm."+b).data(U?[]:[0]);if(V.enter().append("g").classed("hm",!0).classed(b,!0),V.exit().remove(),!U){var q,G;"fast"===C?(q=D,G=R):(q=N,G=B);var H=document.createElement("canvas");H.width=q,H.height=G;var X,Y,W=H.getContext("2d"),Z=i.scale.linear().domain(L.map(function(t){return t[0]})).range(L.map(function(t){var e=o(t[1]).toRgb();return[e.r,e.g,e.b,e.a]})).clamp(!0);"fast"===C?(X=O?function(t){return D-1-t}:a.identity,Y=F?function(t){return R-1-t}:a.identity):(X=function(t){return a.constrain(Math.round(m.c2p(z[t])-x),0,N)},Y=function(t){return a.constrain(Math.round(g.c2p(I[t])-M),0,B)});var K,J,$,Q,tt,et,rt=Y(0),nt=[rt,rt],it=O?0:1,ot=F?0:1,at=0,st=0,lt=0,ut=0;if(C){var ct=0,ht=new Uint8Array(N*B*4);if("best"===C){var ft,dt,pt,vt=new Array(z.length),mt=new Array(I.length),gt=new Array(N);for(A=0;AA;A++)gt[A]=n(A,vt);for(J=0;B>J;J++)for(ft=n(J,mt),dt=T[ft.bin0],pt=T[ft.bin1],A=0;N>A;A++,ct+=4)et=d(dt,pt,gt[A],ft),f(ht,ct,et)}else for(J=0;R>J;J++)for(tt=T[J],nt=Y(J),A=0;N>A;A++)et=h(tt[A],1),ct=4*(nt*N+X(A)),f(ht,ct,et);var yt=W.createImageData(N,B);yt.data.set(ht),W.putImageData(yt,0,0)}else for(J=0;R>J;J++)if(tt=T[J],nt.reverse(),nt[ot]=Y(J+1),nt[0]!==nt[1]&&void 0!==nt[0]&&void 0!==nt[1])for($=X(0),K=[$,$],A=0;D>A;A++)K.reverse(),K[it]=X(A+1),K[0]!==K[1]&&void 0!==K[0]&&void 0!==K[1]&&(Q=tt[A],et=h(Q,(K[1]-K[0])*(nt[1]-nt[0])),W.fillStyle="rgba("+et.join(",")+")",W.fillRect(K[0],nt[0],K[1]-K[0],nt[1]-nt[0]));st=Math.round(st/at),lt=Math.round(lt/at),ut=Math.round(ut/at);var bt=o("rgb("+st+","+lt+","+ut+")");t._hmpixcount=(t._hmpixcount||0)+at,t._hmlumcount=(t._hmlumcount||0)+at*bt.getLuminance();var xt=V.selectAll("image").data(r);xt.enter().append("svg:image").attr({xmlns:u.svg,preserveAspectRatio:"none"}),xt.attr({height:B,width:N,x:x,y:M,"xlink:href":H.toDataURL("image/png")}),xt.exit().remove()}}var i=t("d3"),o=t("tinycolor2"),a=t("../../lib"),s=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),u=t("../../constants/xmlns_namespaces"),c=t("./max_row_length");e.exports=function(t,e,r){for(var i=0;i0&&(n=!0);for(var s=0;si;i++)e[i]?(t[i]/=e[i],n+=t[i]):t[i]=null;return n}},{}],720:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){return r("histnorm"),n.forEach(function(t){var e=r(t+"bins.start"),n=r(t+"bins.end"),i=r("autobin"+t,!(e&&n));r(i?"nbins"+t:t+"bins.size")}),e}},{}],721:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports={count:function(t,e,r){return r[t]++,1},sum:function(t,e,r,i){var o=i[e];return n(o)?(o=Number(o),r[t]+=o,o):0},avg:function(t,e,r,i,o){var a=i[e];return n(a)&&(a=Number(a),r[t]+=a,o[t]++),0},min:function(t,e,r,i){var o=i[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]>o)return r[t]=o,o-r[t]}return 0},max:function(t,e,r,i){var o=i[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]r&&u.length<5e3;)v=o.tickIncrement(r,b.size),u.push((r+v)/2),c.push(L),x&&_.push(r),E&&w.push(1/(v-r)),P&&M.push(0),r=v;var C=c.length;for(r=0;r=0&&C>g&&(k+=z(g,r,c,y,M));P&&(k=l(c,M)),I&&I(c,k,w);var R=Math.min(u.length,c.length),D=[],O=0,F=R-1;for(r=0;R>r;r++)if(c[r]){O=r;break}for(r=R-1;r>O;r--)if(c[r]){F=r;break}for(r=O;F>=r;r++)n(u[r])&&n(c[r])&&D.push({p:u[r],s:c[r],b:0});return D}}},{"../../lib":568,"../../plots/cartesian/axes":592,"./average":719,"./bin_functions":721,"./norm_functions":725,"fast-isnumeric":123}],723:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),o=t("./bin_defaults"),a=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=c("x"),f=c("y");c("text");var d=c("orientation",f&&!h?"h":"v"),p=e["v"===d?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var v=e["h"===d?"x":"y"];v&&c("histfunc");var m="h"===d?["y"]:["x"];o(t,e,c,m),a(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),s(t,e,i.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":483,"../../components/errorbars/defaults":511,"../../lib":568,"../bar/style_defaults":680,"./attributes":718,"./bin_defaults":720}],724:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"../bar/hover":673,"../bar/layout_attributes":675,"../bar/layout_defaults":676,"../bar/plot":677,"../bar/set_positions":678,"../bar/style":679,"../scatter/colorbar":753,"./attributes":718,"./calc":722,"./defaults":723}],725:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;r>i;i++)t[i]*=n},probability:function(t,e){for(var r=t.length,n=0;r>n;n++)t[n]/=e},density:function(t,e,r,n){var i=t.length;n=n||1;for(var o=0;i>o;o++)t[o]*=r[o]*n},"probability density":function(t,e,r,n){var i=t.length;n&&(e/=n);for(var o=0;i>o;o++)t[o]*=r[o]/e}}},{}],726:[function(t,e,r){"use strict";var n=t("../histogram/attributes"),i=t("../heatmap/attributes"),o=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat;e.exports=a({},{x:n.x,y:n.y,z:{valType:"data_array"},marker:{color:{valType:"data_array"}},histnorm:n.histnorm,histfunc:n.histfunc,autobinx:n.autobinx,nbinsx:n.nbinsx,xbins:n.xbins,autobiny:n.autobiny,nbinsy:n.nbinsy,ybins:n.ybins,zsmooth:i.zsmooth,_nestedModules:{colorbar:"Colorbar"}},o,{autocolorscale:a({},o.autocolorscale,{dflt:!1})})},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../heatmap/attributes":706,"../histogram/attributes":718}],727:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("../histogram/bin_functions"),a=t("../histogram/norm_functions"),s=t("../histogram/average");e.exports=function(t,e){var r,l,u,c,h,f,d=i.getFromId(t,e.xaxis||"x"),p=e.x?d.makeCalcdata(e,"x"):[],v=i.getFromId(t,e.yaxis||"y"),m=e.y?v.makeCalcdata(e,"y"):[],g=Math.min(p.length,m.length);p.length>g&&p.splice(g,p.length-g),m.length>g&&m.splice(g,m.length-g),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(p,d,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(m,v,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),h=[];var y,b,x=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,M="string"==typeof e.xbins.size?[]:e.ybins,k=0,A=[],T=e.histnorm,E=e.histfunc,S=-1!==T.indexOf("density"),L="max"===E||"min"===E,z=L?null:0,I=o.count,P=a[T],C=!1,R=[],D=[],O="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";O&&"count"!==E&&(C="avg"===E,I=o[E]);var F=e.xbins,j=F.end+(F.start-i.tickIncrement(F.start,F.size))/1e6;for(f=F.start;j>f;f=i.tickIncrement(f,F.size))x.push(z),Array.isArray(w)&&w.push(f),C&&_.push(0);Array.isArray(w)&&w.push(f);var N=x.length;for(r=e.xbins.start,l=(f-r)/N,r+=l/2,F=e.ybins,j=F.end+(F.start-i.tickIncrement(F.start,F.size))/1e6,f=F.start;j>f;f=i.tickIncrement(f,F.size))h.push(x.concat()),Array.isArray(M)&&M.push(f),C&&A.push(_.concat());Array.isArray(M)&&M.push(f);var B=h.length;for(u=e.ybins.start,c=(f-u)/B,u+=c/2,S&&(R=x.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/l}),D=h.map(function(t,e){return Array.isArray(M)?1/(M[e+1]-M[e]):1/c})),f=0;g>f;f++)y=n.findBin(p[f],w),b=n.findBin(m[f],M),y>=0&&N>y&&b>=0&&B>b&&(k+=I(y,f,h[b],O,A[b]));if(C)for(b=0;B>b;b++)k+=s(h[b],A[b]);if(P)for(b=0;B>b;b++)P(h[b],k,R,D[b]);return{x:p,x0:r,dx:l,y:m,y0:u,dy:c,z:h}}},{"../../lib":568,"../../plots/cartesian/axes":592,"../histogram/average":719,"../histogram/bin_functions":721,"../histogram/norm_functions":725}],728:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./sample_defaults"),o=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r){function s(r,i){return n.coerce(t,e,a,r,i)}i(t,e,s),s("zsmooth"),o(t,e,r,s,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":726,"./sample_defaults":730}],729:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../heatmap/calc"),n.plot=t("../heatmap/plot"),n.colorbar=t("../heatmap/colorbar"),n.style=t("../heatmap/style"),n.hoverPoints=t("../heatmap/hover"),n.moduleType="trace",n.name="histogram2d",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","histogram"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"../heatmap/calc":707,"../heatmap/colorbar":708,"../heatmap/hover":712,"../heatmap/plot":715,"../heatmap/style":716,"./attributes":726,"./defaults":728}],730:[function(t,e,r){"use strict";var n=t("../histogram/bin_defaults");e.exports=function(t,e,r){var i=r("x"),o=r("y");if(!(i&&i.length&&o&&o.length))return void(e.visible=!1);var a=r("z")||r("marker.color");a&&r("histfunc");var s=["x","y"];n(t,e,r,s)}},{"../histogram/bin_defaults":720}],731:[function(t,e,r){"use strict";var n=t("../histogram2d/attributes"),i=t("../contour/attributes"),o=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat;e.exports=a({},{x:n.x,y:n.y,z:n.z,marker:n.marker,histnorm:n.histnorm,histfunc:n.histfunc,autobinx:n.autobinx,nbinsx:n.nbinsx,xbins:n.xbins,autobiny:n.autobiny,nbinsy:n.nbinsy,ybins:n.ybins,autocontour:i.autocontour,ncontours:i.ncontours,contours:i.contours,line:i.line,_nestedModules:{colorbar:"Colorbar"}},o)},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../contour/attributes":696,"../histogram2d/attributes":726}],732:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../histogram2d/sample_defaults"),o=t("../contour/style_defaults"),a=t("./attributes");e.exports=function(t,e,r,s){function l(r,i){return n.coerce(t,e,a,r,i)}i(t,e,l);var u=n.coerce2(t,e,a,"contours.start"),c=n.coerce2(t,e,a,"contours.end"),h=l("autocontour",!(u&&c));l(h?"ncontours":"contours.size"),o(t,e,l,s)}},{"../../lib":568,"../contour/style_defaults":705,"../histogram2d/sample_defaults":730,"./attributes":731}],733:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../contour/calc"),n.plot=t("../contour/plot"),n.style=t("../contour/style"),n.colorbar=t("../contour/colorbar"),n.hoverPoints=t("../contour/hover"),n.moduleType="trace",n.name="histogram2dcontour",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","contour","histogram"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"../contour/calc":697,"../contour/colorbar":698,"../contour/hover":700,"../contour/plot":703,"../contour/style":704,"./attributes":731,"./defaults":732}],734:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../surface/attributes"),o=t("../../lib/extend").extendFlat;e.exports={x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},i:{valType:"data_array"},j:{valType:"data_array"},k:{valType:"data_array"},delaunayaxis:{valType:"enumerated",values:["x","y","z"],dflt:"z"},alphahull:{valType:"number",dflt:-1},intensity:{valType:"data_array"},color:{valType:"color"},vertexcolor:{valType:"data_array"},facecolor:{valType:"data_array"},opacity:o({},i.opacity),flatshading:{valType:"boolean",dflt:!1},contour:{show:o({},i.contours.x.show,{}),color:o({},i.contours.x.color),width:o({},i.contours.x.width)},colorscale:n.colorscale,reversescale:n.reversescale,showscale:n.showscale,lightposition:{x:o({},i.lightposition.x,{dflt:1e5}),y:o({},i.lightposition.y,{dflt:1e5}),z:o({},i.lightposition.z,{dflt:0})},lighting:o({},{vertexnormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-12},facenormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-6}},i.lighting),_nestedModules:{colorbar:"Colorbar"}}},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../surface/attributes":802}],735:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.mesh=e,this.name="",this.color="#fff",this.data=null,this.showContour=!1}function i(t){return t.map(function(t){var e=t[0],r=u(t[1]),n=r.toRgb();return{index:e,rgb:[n.r,n.g,n.b,1]}})}function o(t){return t.map(d)}function a(t,e,r){for(var n=new Array(t.length),i=0;i0)s=h(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=o(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=o(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":580,"alpha-shape":41,"convex-hull":108,"delaunay-triangulate":120,"gl-mesh3d":156,tinycolor2:454}],736:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),o=t("./attributes");e.exports=function(t,e,r,a){function s(r,i){return n.coerce(t,e,o,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;el||(u=p[r],void 0!==u&&""!==u||(u=r),u=String(u),void 0===y[u]&&(y[u]=!0,c=o(e.marker.colors[r]),c.isValid()?(c=a.addOpacity(c,c.getAlpha()),g[u]||(g[u]=c)):g[u]?c=g[u]:(c=!1,b=!0),h=-1!==_.indexOf(u),h||(x+=l),v.push({v:l,label:u,color:c,i:r,hidden:h}))));if(e.sort&&v.sort(function(t,e){return e.v-t.v}),b)for(r=0;r")}return v};var l},{"../../components/color":483,"./helpers":742,"fast-isnumeric":123,tinycolor2:454}],741:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,o){function a(r,o){return n.coerce(t,e,i,r,o)}var s=n.coerceFont,l=a("values");if(!Array.isArray(l)||!l.length)return void(e.visible=!1);var u=a("labels");Array.isArray(u)||(a("label0"),a("dlabel"));var c=a("marker.line.width");c&&a("marker.line.color");var h=a("marker.colors");Array.isArray(h)||(e.marker.colors=[]),a("scalegroup");var f=a("text"),d=a("textinfo",Array.isArray(f)?"text+percent":"percent");if(a("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),d&&"none"!==d){var p=a("textposition"),v=Array.isArray(p)||"auto"===p,m=v||"inside"===p,g=v||"outside"===p;if(m||g){var y=s(a,"textfont",o.font);m&&s(a,"insidetextfont",y),g&&s(a,"outsidetextfont",y)}}a("domain.x"),a("domain.y"),a("hole"),a("sort"),a("direction"),a("rotation"),a("pull")}},{"../../lib":568,"./attributes":738}],742:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":568}],743:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":738,"./base_plot":739,"./calc":740,"./defaults":741,"./layout_attributes":744,"./layout_defaults":745,"./plot":746,"./style":747,"./style_one":748}],744:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],745:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,o){return n.coerce(t,e,i,r,o)}r("hiddenlabels")}},{"../../lib":568,"./layout_attributes":744}],746:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,a=Math.PI*Math.min(e.v/r.vTotal,.5),s=1-r.trace.hole,l=i(e,r),u={scale:l*r.r*2/n,rCenter:1-l,rotate:0};if(u.scale>=1)return u;var c=o+1/(2*Math.tan(a)),h=r.r*Math.min(1/(Math.sqrt(c*c+.5)+c),s/(Math.sqrt(o*o+s/2)+o)),f={scale:2*h/t.height,rCenter:Math.cos(h/r.r)-h*o/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},d=1/o,p=d+1/(2*Math.tan(a)),v=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),s/(Math.sqrt(d*d+s/2)+d)),m={scale:2*v/t.width,rCenter:Math.cos(v/r.r)-v/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},g=m.scale>f.scale?m:f;return u.scale<1&&g.scale>u.scale?g:u}function i(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function o(t,e){var r=e.pxmid[0],n=e.pxmid[1],i=t.width/2,o=t.height/2;return 0>r&&(i*=-1),0>n&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:i+Math.abs(o)*(i>0?1:-1)/2,y:o/(1+r*r/(n*n)),outside:!0}}function a(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function i(t,r){r||(r={});var n,i,o,s,f,d,v=r.labelExtraY+(a?r.yLabelMax:r.yLabelMin),m=a?t.yLabelMin:t.yLabelMax,g=a?t.yLabelMax:t.yLabelMin,y=t.cyFinal+u(t.px0[1],t.px1[1]),b=v-m;if(b*h>0&&(t.labelExtraY=b),Array.isArray(e.pull))for(i=0;i=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*h>0?(s=o.cyFinal+u(o.px0[1],o.px1[1]),b=s-m-t.labelExtraY,b*h>0&&(t.labelExtraY+=b)):(g+t.labelExtraY-y)*h>0&&(n=3*c*Math.abs(i-p.indexOf(t)),f=o.cxFinal+l(o.px0[0],o.px1[0]),d=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,d*c>0&&(t.labelExtraX+=d)))}var o,a,s,l,u,c,h,f,d,p,v,m,g;for(a=0;2>a;a++)for(s=a?r:n,u=a?Math.max:Math.min,h=a?1:-1,o=0;2>o;o++){for(l=o?Math.max:Math.min,c=o?1:-1,f=t[a][o],f.sort(s),d=t[1-a][o],p=d.concat(f),m=[],v=0;vc&&(c=s.pull[o]);a.r=Math.min(r/u(s.tilt,Math.sin(l),s.depth),n/u(s.tilt,Math.cos(l),s.depth))/(2+2*c),a.cx=e.l+e.w*(s.domain.x[1]+s.domain.x[0])/2,a.cy=e.t+e.h*(2-s.domain.y[1]-s.domain.y[0])/2,s.scalegroup&&-1===d.indexOf(s.scalegroup)&&d.push(s.scalegroup)}for(o=0;oh.vTotal/2?1:0)}function u(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var c=t("d3"),h=t("../../plots/cartesian/graph_interact"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),v=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round","class":"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],m=u.trace,g=0,y=(m.depth||0)*u.r*Math.sin(g)/2,b=m.tiltaxis||0,x=b*Math.PI/180,_=[y*Math.sin(x),y*Math.cos(x)],w=u.r*Math.cos(g),M=s.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);M.enter().append("g").attr("class",function(t){return t+" part"}),M.exit().remove(),M.order(),l(e),s.selectAll(".top").each(function(){var s=c.select(this).selectAll("g.slice").data(e);s.enter().append("g").classed("slice",!0),s.exit().remove();var l=[[[],[]],[[],[]]],g=!1;s.each(function(a){function s(e){var n=t._fullLayout,o=t._fullData[m.index],s=o.hoverinfo;if("all"===s&&(s="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==s&&s){var l=i(a,u),c=M+a.pxmid[0]*(1-l),f=k+a.pxmid[1]*(1-l),d=r.separators,p=[];-1!==s.indexOf("label")&&p.push(a.label),o.text&&o.text[a.i]&&-1!==s.indexOf("text")&&p.push(o.text[a.i]),-1!==s.indexOf("value")&&p.push(v.formatPieValue(a.v,d)),-1!==s.indexOf("percent")&&p.push(v.formatPiePercent(a.v/u.vTotal,d)),h.loneHover({x0:c-l*u.r,x1:c+l*u.r,y:f,text:p.join("
"),name:-1!==s.indexOf("name")?o.name:void 0,color:a.color,idealAlign:a.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),h.hover(t,e,"pie"),E=!0}}function f(e){t.emit("plotly_unhover",{points:[e]}),E&&(h.loneUnhover(r._hoverlayer.node()),E=!1)}function y(){t._hoverdata=[a],t._hoverdata.trace=e.trace,h.click(t,{target:!0})}function x(t,e,r,n){return"a"+n*u.r+","+n*w+" "+b+" "+a.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(a.hidden)return void c.select(this).selectAll("path,g").remove();l[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var M=u.cx+_[0],k=u.cy+_[1],A=c.select(this),T=A.selectAll("path.surface").data([a]),E=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",s).on("mouseout",f).on("click",y),m.pull){var S=+(Array.isArray(m.pull)?m.pull[a.i]:m.pull)||0;S>0&&(M+=S*a.pxmid[0],k+=S*a.pxmid[1])}a.cxFinal=M,a.cyFinal=k;var L=m.hole;if(a.v===u.vTotal){var z="M"+(M+a.px0[0])+","+(k+a.px0[1])+x(a.px0,a.pxmid,!0,1)+x(a.pxmid,a.px0,!0,1)+"Z";L?T.attr("d","M"+(M+L*a.px0[0])+","+(k+L*a.px0[1])+x(a.px0,a.pxmid,!1,L)+x(a.pxmid,a.px0,!1,L)+"Z"+z):T.attr("d",z)}else{var I=x(a.px0,a.px1,!0,1);if(L){var P=1-L;T.attr("d","M"+(M+L*a.px1[0])+","+(k+L*a.px1[1])+x(a.px1,a.px0,!1,L)+"l"+P*a.px0[0]+","+P*a.px0[1]+I+"Z")}else T.attr("d","M"+M+","+k+"l"+a.px0[0]+","+a.px0[1]+I+"Z")}var C=Array.isArray(m.textposition)?m.textposition[a.i]:m.textposition,R=A.selectAll("g.slicetext").data(a.text&&"none"!==C?[0]:[]);R.enter().append("g").classed("slicetext",!0),R.exit().remove(),R.each(function(){var t=c.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1), -t.exit().remove(),t.text(a.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(d.font,"outside"===C?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=d.bBox(t.node());"outside"===C?e=o(r,a):(e=n(r,a,u),"auto"===C&&e.scale<1&&(t.call(d.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),r=d.bBox(t.node())),e=o(r,a)));var i=M+a.pxmid[0]*e.rCenter+(e.x||0),s=k+a.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(a.yLabelMin=s-r.height/2,a.yLabelMid=s,a.yLabelMax=s+r.height/2,a.labelExtraX=0,a.labelExtraY=0,g=!0),t.attr("transform","translate("+i+","+s+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),g&&a(l,m),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],o="M"+n+","+i,a=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var s=t.labelExtraX*t.pxmid[1]/t.pxmid[0],l=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(s)>Math.abs(l)?"l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+a):"l"+t.labelExtraX+","+s+"v"+(l-s)+"h"+a}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+a;e.append("path").classed("textline",!0).call(f.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){u.selectAll("tspan").each(function(){var t=c.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":483,"../../components/drawing":506,"../../lib/svg_text_utils":581,"../../plots/cartesian/graph_interact":599,"./helpers":742,d3:119}],747:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,o=n.select(this);o.style({opacity:r.opacity}),o.selectAll(".top path.surface").each(function(t){n.select(this).call(i,t,r)})})}},{"./style_one":748,d3:119}],748:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var o=r.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(n.stroke,i)}},{"../../components/color":483}],749:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var i=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(i.color,t,"mlc"),n.mergeArray(i.width,t,"mlw")}}},{"../../lib":568}],750:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../components/drawing":506,"../../lib/extend":563,"./constants":755}],751:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./subtypes"),s=t("./colorscale_calc");e.exports=function(t,e){var r,l,u,c=i.getFromId(t,e.xaxis||"x"),h=i.getFromId(t,e.yaxis||"y"),f=c.makeCalcdata(e,"x"),d=h.makeCalcdata(e,"y"),p=Math.min(f.length,d.length);c._minDtick=0,h._minDtick=0,f.length>p&&f.splice(p,f.length-p),d.length>p&&d.splice(p,d.length-p);var v={padded:!0},m={padded:!0};if(a.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var g={type:"linear"};i.setConvert(g),l=g.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},v.ppad=m.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(a.hasMarkers(e)||a.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,i.expand(c,f,v),i.expand(h,d,m);var x=new Array(p);for(u=0;p>u;u++)x[u]=n(f[u])&&n(d[u])?{x:f[u],y:d[u]}:{x:!1,y:!1};return void 0!==typeof l&&o.mergeArray(l,x,"ms"),t.firstscatter=!1,x}},{"../../lib":568,"../../plots/cartesian/axes":592,"./colorscale_calc":754,"./subtypes":769,"fast-isnumeric":123}],752:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i,o;for(e=0;e=0;i--)if(o=t[i],"scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}},{}],753:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void a.autoMargin(t,c);var h=s(u.colorscale),f=u.color,d=u.cmin,p=u.cmax;i(d)||(d=o.aggNums(Math.min,null,f)),i(p)||(p=o.aggNums(Math.max,null,f));var v=e[0].t.cb=l(t,c);v.fillcolor(n.scale.linear().domain(h.map(function(t){return d+t[0]*(p-d)})).range(h.map(function(t){return t[1]}))).filllevels({start:d,end:p,size:(p-d)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,d3:119,"fast-isnumeric":123}],754:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),o.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":490,"../../components/colorscale/has_colorscale":496,"./subtypes":769}],755:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],756:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),o=t("./constants"),a=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function v(r,o){return n.coerce(t,e,i,r,o)}var m=s(t,e,v),g=mU!=C>=U&&(z=S[T-1][0],I=S[T][0],L=z+(I-z)*(U-P)/(C-P),F=Math.min(F,L),j=Math.max(j,L));F=Math.max(F,0),j=Math.min(j,f._length);var V=l.defaultLine;return l.opacity(h.fillcolor)?V=h.fillcolor:l.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:o.MAXDIST+10,x0:F,x1:j,y0:U,y1:U,color:V}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":483,"../../components/errorbars":512,"../../lib":568,"../../plots/cartesian/constants":597,"../../plots/cartesian/graph_interact":599,"./get_trace_color":758}],760:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"./arrays_to_calcdata":749,"./attributes":750,"./calc":751,"./clean_data":752,"./colorbar":753,"./defaults":756,"./hover":759,"./plot":766,"./select":767,"./style":768,"./subtypes":769}],761:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,a){var s=(t.marker||{}).color;if(a("line.color",r),n(t,"line"))i(t,e,o,a,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||r;a("line.color",l)}a("line.width"),a("line.dash")}},{"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496}],762:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=M.c2p(t[e].y);return r===S||n===S?!1:[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}function o(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var a,s,l,u,c,h,f,d,p,v,m,g,y,b,x,_,w=e.xaxis,M=e.yaxis,k=e.connectGaps,A=e.baseTolerance,T=e.linear,E=[],S=n.BADNUM,L=.2,z=new Array(t.length),I=0;for(a=0;ai(h))break;l=h,y=v[0]*p[0]+v[1]*p[1],y>m?(m=y,u=h,d=!1):g>y&&(g=y,c=h,d=!0)}if(d?(z[I++]=u,l!==c&&(z[I++]=c)):(c!==s&&(z[I++]=c),l!==u&&(z[I++]=u)),z[I++]=l,a>=t.length||!h)break;z[I++]=h,s=h}}else z[I++]=u}E.push(z.slice(0,I))}return E}},{"../../plots/cartesian/axes":592}],763:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],764:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t){var e=t.marker,r=e.sizeref||1,i=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/r)}:function(t){return t/r};return function(t){var e=o(t/2);return n(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":123}],765:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),a=t("./subtypes");e.exports=function(t,e,r,s,l){var u,c=a.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&o(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=h&&!Array.isArray(h)&&e.marker.color!==h?h:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&o(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":483,"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496,"./subtypes":769}],766:[function(t,e,r){"use strict";function n(t,e,r){var n=e.x(),o=e.y(),a=i.extent(n.range.map(n.l2c)),s=i.extent(o.range.map(o.l2c));r.forEach(function(t,e){var n=t[0].trace;if(u.hasMarkers(n)){var i=n.marker.maxdisplayed;if(0!==i){var o=t.filter(function(t){return t.x>=a[0]&&t.x<=a[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(o.length/i),c=0;r.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&e>r&&c++});var h=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+h)%l)&&(t.vis=!0)})}}})}var i=t("d3"),o=t("../../lib"),a=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),h=t("./line_points");e.exports=function(t,e,r){function f(t){return t.filter(function(t){return t.vis})}n(t,e,r);var d=e.x(),p=e.y(),v=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(r);v.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),v.call(s.plot,e);var m,g,y,b,x="",_=[];v.each(function(t){var e=t[0].trace,r=e.line,n=i.select(this);if(e.visible===!0&&(g=e.fill.charAt(e.fill.length-1),"x"!==g&&"y"!==g&&(g=""),t[0].node3=n,c(t),u.hasLines(e)||"none"!==e.fill)){var o,s,f,v,w,M="",k="";m="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!x?n.append("path").classed("js-fill",!0):null,b&&(y=b.datum(t)),b=n.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(r.shape)?(f=a.steps(r.shape),v=a.steps(r.shape.split("").reverse().join(""))):f=v="spline"===r.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?a.smoothclosed(t.slice(1),r.smoothing):a.smoothopen(t,r.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return v(t.reverse())};var A,T=h(t,{xaxis:d,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(r.width||1,3)/4,linear:"linear"===r.shape}),E=e._polygons=new Array(T.length);for(A=0;A1&&n.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}m?S&&z&&(g?("y"===g?S[1]=z[1]=p.c2p(0,!0):"x"===g&&(S[0]=z[0]=d.c2p(0,!0)),m.attr("d",M+"L"+z+"L"+S+"Z")):m.attr("d",M+"Z")):"tonext"===e.fill.substr(0,6)&&M&&x&&("tonext"===e.fill?y.attr("d",M+"Z"+x+"Z"):y.attr("d",M+"L"+x.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),x=k,_=E}}}),v.selectAll("path:not([d])").remove(),v.append("g").attr("class","points").each(function(t){var e=t[0].trace,r=i.select(this),n=u.hasMarkers(e),s=u.hasText(e);!n&&!s||e.visible!==!0?r.remove():(n&&r.selectAll("path.point").data(e.marker.maxdisplayed?f:o.identity).enter().append("path").classed("point",!0).call(a.translatePoints,d,p),s&&r.selectAll("g").data(e.marker.maxdisplayed?f:o.identity).enter().append("g").append("text").call(a.translatePoints,d,p))})}},{"../../components/drawing":506,"../../components/errorbars":512,"../../lib":568,"../../lib/polygon":574,"./arrays_to_calcdata":749,"./line_points":762,"./subtypes":769,d3:119}],767:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,o,a,s,l=t.cd,u=t.xaxis,c=t.yaxis,h=[],f=l[0].trace,d=f.index,p=f.marker,v=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!v){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;rs;s++){for(var l=[[0,0,0],[0,0,0]],u=0;3>u;u++)if(r[u])for(var c=0;2>c;c++)l[c][u]=r[u][s][c];a[s]=l}return a}var a=t("../../components/errorbars/compute_error");e.exports=o},{"../../components/errorbars/compute_error":510}],775:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.linePlot=null,this.scatterPlot=null,this.errorBars=null,this.textMarkers=null,this.delaunayMesh=null,this.color=null,this.mode="",this.dataPoints=[],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.textLabels=null,this.data=null}function i(t,e,r){var n,i=(r+1)%3,o=(r+2)%3,a=[],s=[];for(n=0;ni;i++){var o=t[i];o&&o.copy_zstyle!==!1&&(o=t[2]),o&&(e[i]=o.width/2,r[i]=b(o.color),n=o.thickness)}return{capSize:e,color:r,lineWidth:n}}function a(t){var e=[0,0];return Array.isArray(t)?[0,-1]:(t.indexOf("bottom")>=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return M[t]}function u(t,e,r,n,i){var o=null;if(Array.isArray(t)){o=[];for(var a=0;e>a;a++)void 0===t[a]?o[a]=n:o[a]=r(t[a],i)}else o=r(t,y.identity);return o}function c(t,e){var r,n,i,c,h,f,d=[],p=t.fullSceneLayout,v=t.dataScale,m=p.xaxis,g=p.yaxis,w=p.zaxis,M=e.marker,A=e.line,T=e.x||[],E=e.y||[],S=e.z||[],L=T.length;for(n=0;L>n;n++)i=m.d2l(T[n])*v[0],c=g.d2l(E[n])*v[1],h=w.d2l(S[n])*v[2],d[n]=[i,c,h];if(Array.isArray(e.text))f=e.text;else if(void 0!==e.text)for(f=new Array(L),n=0;L>n;n++)f[n]=e.text;if(r={position:d,mode:e.mode,text:f},"line"in e&&(r.lineColor=x(A,1,L),r.lineWidth=A.width,r.lineDashes=A.dash),"marker"in e){var z=_(e);r.scatterColor=x(M,1,L),r.scatterSize=u(M.size,L,s,20,z),r.scatterMarker=u(M.symbol,L,l,"\u25cf"),r.scatterLineWidth=M.line.width,r.scatterLineColor=x(M.line,1,L),r.scatterAngle=0}"textposition"in e&&(r.textOffset=a(e.textposition),r.textColor=x(e.textfont,1,L),r.textSize=u(e.textfont.size,L,y.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var I=["x","y","z"];for(r.project=[!1,!1,!1],r.projectScale=[1,1,1],r.projectOpacity=[1,1,1],n=0;3>n;++n){var P=e.projection[I[n]];(r.project[n]=P.show)&&(r.projectOpacity[n]=P.opacity,r.projectScale[n]=P.scale)}r.errorBounds=k(e,v);var C=o([e.error_x,e.error_y,e.error_z]);return r.errorColor=C.color,r.errorLineWidth=C.lineWidth,r.errorCapSize=C.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=b(e.surfacecolor),r}function h(t){if(Array.isArray(t)){var e=t[0];return Array.isArray(e)&&(t=e),"rgb("+t.slice(0,3).map(function(t){return Math.round(255*t)})+")"}return null}function f(t,e){var r=new n(t,e.uid);return r.update(e),r}var d=t("gl-line3d"),p=t("gl-scatter3d"),v=t("gl-error3d"),m=t("gl-mesh3d"),g=t("delaunay-triangulate"),y=t("../../lib"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/make_bubble_size_func"),w=t("../../constants/gl3d_dashes"),M=t("../../constants/gl_markers"),k=t("./calc_errors"),A=n.prototype;A.handlePick=function(t){if(t.object&&(t.object===this.linePlot||t.object===this.delaunayMesh||t.object===this.textMarkers||t.object===this.scatterPlot)){t.object.highlight&&t.object.highlight(null),this.scatterPlot&&(t.object=this.scatterPlot,this.scatterPlot.highlight(t.data)),this.textLabels&&void 0!==this.textLabels[t.data.index]?t.textLabel=this.textLabels[t.data.index]:t.textLabel="";var e=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},A.update=function(t){var e,r,n,o,a=this.scene.glplot.gl,s=w.solid;this.data=t;var l=c(this.scene,t);"mode"in l&&(this.mode=l.mode),"lineDashes"in l&&l.lineDashes in w&&(s=w[l.lineDashes]),this.color=h(l.scatterColor)||h(l.lineColor),this.dataPoints=l.position,e={gl:a,position:l.position,color:l.lineColor,lineWidth:l.lineWidth||1,dashes:s[0],dashScale:s[1],opacity:t.opacity,connectGaps:t.connectgaps},-1!==this.mode.indexOf("lines")?this.linePlot?this.linePlot.update(e):(this.linePlot=d(e),this.scene.glplot.add(this.linePlot)):this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose(),this.linePlot=null);var u=t.opacity;if(t.marker&&t.marker.opacity&&(u*=t.marker.opacity),r={gl:a,position:l.position,color:l.scatterColor,size:l.scatterSize,glyph:l.scatterMarker,opacity:u,orthographic:!0,lineWidth:l.scatterLineWidth,lineColor:l.scatterLineColor,project:l.project,projectScale:l.projectScale,projectOpacity:l.projectOpacity},-1!==this.mode.indexOf("markers")?this.scatterPlot?this.scatterPlot.update(r):(this.scatterPlot=p(r),this.scatterPlot.highlightScale=1,this.scene.glplot.add(this.scatterPlot)):this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose(),this.scatterPlot=null),o={gl:a,position:l.position,glyph:l.text,color:l.textColor,size:l.textSize,angle:l.textAngle,alignment:l.textOffset,font:l.textFont,orthographic:!0,lineWidth:0,project:!1,opacity:t.opacity},this.textLabels=l.text,-1!==this.mode.indexOf("text")?this.textMarkers?this.textMarkers.update(o):(this.textMarkers=p(o),this.textMarkers.highlightScale=1,this.scene.glplot.add(this.textMarkers)):this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose(),this.textMarkers=null),n={gl:a,position:l.position,color:l.errorColor,error:l.errorBounds,lineWidth:l.errorLineWidth,capSize:l.errorCapSize,opacity:t.opacity},this.errorBars?l.errorBounds?this.errorBars.update(n):(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose(),this.errorBars=null):l.errorBounds&&(this.errorBars=v(n),this.scene.glplot.add(this.errorBars)),l.delaunayAxis>=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);f.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=a,this.delaunayMesh=m(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},A.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":553,"../../constants/gl_markers":554,"../../lib":568,"../../lib/gl_format_color":566,"../../lib/str2rgbarray":580,"../scatter/make_bubble_size_func":764,"./calc_errors":774,"delaunay-triangulate":120,"gl-error3d":127,"gl-line3d":133,"gl-mesh3d":156,"gl-scatter3d":199}],776:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),o=r("y"),a=r("z");return i&&o&&a&&(n=Math.min(i.length,o.length,a.length),n=0&&f("surfacecolor",p||v);for(var m=["x","y","z"],g=0;3>g;++g){var y="projection."+m[g];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":511,"../../lib":568,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":772}],777:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":554,"../../plots/gl3d":628, -"../scatter/colorbar":753,"./attributes":772,"./calc":773,"./convert":775,"./defaults":776}],778:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array"},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names"],dflt:"ISO-3"},mode:a({},n.mode,{dflt:"markers"}),text:a({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash},marker:a({},{symbol:s.symbol,opacity:s.opacity,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:a({},{width:u.width},o("marker.line"))},o("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:a({},i.hoverinfo,{flags:["lon","lat","location","text","name"]}),_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../../plots/attributes":590,"../scatter/attributes":750}],779:[function(t,e,r){"use strict";var n=t("../scatter/colorscale_calc");e.exports=function(t,e){var r=[{x:!1,y:!1,trace:e,t:{}}];return n(e),r}},{"../scatter/colorscale_calc":754}],780:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=0,a=r("locations");return a?(r("locationmode"),o=a.length):(n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length),on;n++)r[n]=[t.lon[n],t.lat[n]];return{type:"LineString",coordinates:r,trace:t}}function o(t,e){function r(e){var r=t.mockAxis;return u.tickText(r,r.c2l(e),"hover").text+"\xb0"}var n=e.hoverinfo;if("none"===n)return function(t){delete t.textLabel};var i="all"===n?m.hoverinfo.flags:n.split("+"),o=-1!==i.indexOf("location")&&Array.isArray(e.locations),a=-1!==i.indexOf("lon"),s=-1!==i.indexOf("lat"),l=-1!==i.indexOf("text");return function(t){var n=[];o?n.push(t.location):a&&s?n.push("("+r(t.lon)+", "+r(t.lat)+")"):a?n.push("lon: "+r(t.lon)):s&&n.push("lat: "+r(t.lat)),l&&n.push(t.tx||e.text),t.textLabel=n.join("
")}}function a(t){var e=Array.isArray(t.locations);return function(r,n){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:n,lon:r.lon,lat:r.lat,location:e?r.location:null}]}}}var s=t("d3"),l=t("../../plots/cartesian/graph_interact"),u=t("../../plots/cartesian/axes"),c=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/array_to_calc_item"),d=t("../../components/color"),p=t("../../components/drawing"),v=t("../scatter/subtypes"),m=t("./attributes"),g=e.exports={};g.calcGeoJSON=function(t,e){var r,i,o,a,s=[],l=Array.isArray(t.locations);l?(a=t.locations,r=a.length,i=c(t,e),o=function(t,e){var r=h(t.locationmode,a[e],i);return void 0!==r?r.properties.ct:void 0}):(r=t.lon.length,o=function(t,e){return[t.lon[e],t.lat[e]]});for(var u=0;r>u;u++){var f=o(t,u);if(f){var d={lon:f[0],lat:f[1],location:l?t.locations[u]:null};n(t,d,u),s.push(d)}}return s.length>0&&(s[0].trace=t),s},g.plot=function(t,e){var r=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,function(t){return t.uid});r.enter().append("g").attr("class","trace scattergeo"),r.exit().remove(),r.selectAll("*").remove(),r.each(function(t){var e=s.select(this);v.hasLines(t)&&e.selectAll("path.js-line").data([i(t)]).enter().append("path").classed("js-line",!0)}),r.each(function(e){function r(r,n){if(t.showHover){var i=t.projection([r.lon,r.lat]);f(r),l.loneHover({x:i[0],y:i[1],name:m?e.name:void 0,text:r.textLabel,color:r.mc||(e.marker||{}).color},{container:t.hoverContainer.node()}),y=d(r,n),t.graphDiv.emit("plotly_hover",y)}}function n(e,r){t.graphDiv.emit("plotly_click",d(e,r))}var i=s.select(this),u=v.hasMarkers(e),c=v.hasText(e);if(u||c){var h=g.calcGeoJSON(e,t.topojson),f=o(t,e),d=a(e),p=e.hoverinfo,m="all"===p||-1!==p.indexOf("name"),y=null;u&&i.selectAll("path.point").data(h).enter().append("path").classed("point",!0).on("mouseover",r).on("click",n).on("mouseout",function(){l.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",y)}).on("mousedown",function(){l.loneUnhover(t.hoverContainer)}).on("mouseup",r),c&&i.selectAll("g").data(h).enter().append("g").append("text")}}),g.style(t)},g.style=function(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t.opacity}),e.each(function(t){s.select(this).selectAll("path.point").call(p.pointStyle,t),s.select(this).selectAll("text").call(p.textPointStyle,t)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=t.trace,r=e.line||{};s.select(this).call(d.stroke,r.color).call(p.dashLine,r.dash||"",r.width||0)})}},{"../../components/color":483,"../../components/drawing":506,"../../lib/array_to_calc_item":559,"../../lib/geo_location_utils":565,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../scatter/subtypes":769,"./attributes":778,d3:119}],783:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/color_attributes"),o=t("../../constants/gl2d_dashes"),a=t("../../constants/gl_markers"),s=t("../../lib/extend").extendFlat,l=t("../../lib/extend").extendDeep,u=n.line,c=n.marker,h=c.line;e.exports={x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:s({},n.text,{}),mode:{valType:"flaglist",flags:["lines","markers"],extras:["none"]},line:{color:u.color,width:u.width,dash:{valType:"enumerated",values:Object.keys(o),dflt:"solid"}},marker:l({},i("marker"),{symbol:{valType:"enumerated",values:Object.keys(a),dflt:"circle",arrayOk:!0},size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,opacity:c.opacity,showscale:c.showscale,line:l({},i("marker.line"),{width:h.width})}),connectgaps:n.connectgaps,fill:s({},n.fill,{values:["none","tozeroy","tozerox"]}),fillcolor:n.fillcolor,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../constants/gl2d_dashes":552,"../../constants/gl_markers":554,"../../lib/extend":563,"../scatter/attributes":750}],784:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.connectgaps=!0,this.idToIndex=[],this.bounds=[0,0,0,0],this.hasLines=!1,this.lineOptions={positions:new Float32Array(0),color:[0,0,0,1],width:1,fill:[!1,!1,!1,!1],fillColor:[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],dashes:[1]},this.line=d(t.glplot,this.lineOptions),this.line._trace=this,this.hasErrorX=!1,this.errorXOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorX=p(t.glplot,this.errorXOptions),this.errorX._trace=this,this.hasErrorY=!1,this.errorYOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorY=p(t.glplot,this.errorYOptions),this.errorY._trace=this,this.hasMarkers=!1,this.scatterOptions={positions:new Float32Array(0),sizes:[],colors:[],glyphs:[],borderWidths:[],borderColors:[],size:12,color:[0,0,0,1],borderSize:1,borderColor:[0,0,0,1]},this.scatter=h(t.glplot,this.scatterOptions),this.scatter._trace=this,this.fancyScatter=f(t.glplot,this.scatterOptions),this.fancyScatter._trace=this}function i(t,e,r){return Array.isArray(e)||(e=[e]),o(t,e,r)}function o(t,e,r){for(var n=new Array(r),i=e[0],o=0;r>o;++o)n[o]=t(o>=e.length?i:e[o]);return n}function a(t,e,r){return l(L(t,r),S(e,r),r)}function s(t,e,r,n){var i=x(t,e,n);return i=Array.isArray(i[0])?i:o(m.identity,[i],n),l(i,S(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;r>i;++i){for(var o=0;3>o;++o)n[4*i+o]=t[i][o];n[4*i+3]=t[i][3]*e[i]}return n}function u(t,e){if(void 0===Float32Array.slice){for(var r=new Float32Array(e),n=0;e>n;n++)r[n]=t[n];return r}return t.slice(0,e)}function c(t,e){var r=new n(t,e.uid);return r.update(e),r}var h=t("gl-scatter2d"),f=t("gl-scatter2d-fancy"),d=t("gl-line2d"),p=t("gl-error2d"),v=t("fast-isnumeric"),m=t("../../lib"),g=t("../../plots/cartesian/axes"),y=t("../../components/errorbars"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/subtypes"),w=t("../scatter/make_bubble_size_func"),M=t("../scatter/get_trace_color"),k=t("../../constants/gl_markers"),A=t("../../constants/gl2d_dashes"),T=["xaxis","yaxis"],E=n.prototype;E.handlePick=function(t){var e=t.pointId;return(t.object!==this.line||this.connectgaps)&&(e=this.idToIndex[t.pointId]),{trace:this,dataCoord:t.dataCoord,traceCoord:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:Array.isArray(this.color)?this.color[e]:this.color,name:this.name,hoverinfo:this.hoverinfo}},E.isFancy=function(t){if("linear"!==this.scene.xaxis.type)return!0;if("linear"!==this.scene.yaxis.type)return!0;if(!t.x||!t.y)return!0;if(this.hasMarkers){var e=t.marker||{};if(Array.isArray(e.symbol)||"circle"!==e.symbol||Array.isArray(e.size)||Array.isArray(e.color)||Array.isArray(e.line.width)||Array.isArray(e.line.color)||Array.isArray(e.opacity))return!0}return this.hasLines&&!this.connectgaps?!0:this.hasErrorX?!0:!!this.hasErrorY};var S=i.bind(null,function(t){return+t}),L=i.bind(null,b),z=i.bind(null,function(t){return k[t]||"\u25cf"});E.update=function(t){t.visible!==!0?(this.hasLines=!1,this.hasErrorX=!1,this.hasErrorY=!1,this.hasMarkers=!1):(this.hasLines=_.hasLines(t),this.hasErrorX=t.error_x.visible===!0,this.hasErrorY=t.error_y.visible===!0,this.hasMarkers=_.hasMarkers(t)),this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.connectgaps=!!t.connectgaps,this.isFancy(t)?this.updateFancy(t):this.updateFast(t),this.color=M(t,{})},E.updateFast=function(t){for(var e,r,n=this.xData=this.pickXData=t.x,i=this.yData=this.pickYData=t.y,o=n.length,a=new Array(o),s=new Float32Array(2*o),l=this.bounds,c=0,h=0,f=0;o>f;++f)e=n[f],r=i[f],v(e)&&v(r)&&(a[c++]=f,s[h++]=e,s[h++]=r,l[0]=Math.min(l[0],e),l[1]=Math.min(l[1],r),l[2]=Math.max(l[2],e),l[3]=Math.max(l[3],r));s=u(s,h),this.idToIndex=a,this.updateLines(t,s),this.updateError("X",t),this.updateError("Y",t);var d;if(this.hasMarkers){this.scatterOptions.positions=s;var p=b(t.marker.color),m=b(t.marker.line.color),g=t.opacity*t.marker.opacity;p[3]*=g,this.scatterOptions.color=p,m[3]*=g,this.scatterOptions.borderColor=m,d=t.marker.size,this.scatterOptions.size=d,this.scatterOptions.borderSize=t.marker.line.width,this.scatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions),this.expandAxesFast(l,d)},E.updateFancy=function(t){var e=this.scene,r=e.xaxis,n=e.yaxis,o=this.bounds,a=this.pickXData=r.makeCalcdata(t,"x").slice(),l=this.pickYData=n.makeCalcdata(t,"y").slice();this.xData=a.slice(),this.yData=l.slice();var c,h,f,d,p,v,m,g,b=y.calcFromTrace(t,e.fullLayout),x=a.length,_=new Array(x),M=new Float32Array(2*x),k=new Float32Array(4*x),A=new Float32Array(4*x),T=0,E=0,L=0,I=0,P="log"===r.type?function(t){return r.d2l(t)}:function(t){return t},C="log"===n.type?function(t){return n.d2l(t)}:function(t){return t};for(c=0;x>c;++c)this.xData[c]=f=P(a[c]),this.yData[c]=d=C(l[c]),isNaN(f)||isNaN(d)||(_[T++]=c,M[E++]=f,M[E++]=d,p=k[L++]=f-b[c].xs||0,v=k[L++]=b[c].xh-f||0,k[L++]=0,k[L++]=0,A[I++]=0,A[I++]=0,m=A[I++]=d-b[c].ys||0,g=A[I++]=b[c].yh-d||0,o[0]=Math.min(o[0],f-p),o[1]=Math.min(o[1],d-m),o[2]=Math.max(o[2],f+v),o[3]=Math.max(o[3],d+g));M=u(M,E),this.idToIndex=_,this.updateLines(t,M),this.updateError("X",t,M,k),this.updateError("Y",t,M,A);var R;if(this.hasMarkers){this.scatterOptions.positions=M,this.scatterOptions.sizes=new Array(T),this.scatterOptions.glyphs=new Array(T),this.scatterOptions.borderWidths=new Array(T),this.scatterOptions.colors=new Array(4*T),this.scatterOptions.borderColors=new Array(4*T);var D,O=w(t),F=t.marker,j=F.opacity,N=t.opacity,B=s(F,j,N,x),U=z(F.symbol,x),V=S(F.line.width,x),q=s(F.line,j,N,x);for(R=i(O,F.size,x),c=0;T>c;++c)for(D=_[c],this.scatterOptions.sizes[c]=4*R[D],this.scatterOptions.glyphs[c]=U[D],this.scatterOptions.borderWidths[c]=.5*V[D],h=0;4>h;++h)this.scatterOptions.colors[4*c+h]=B[4*D+h],this.scatterOptions.borderColors[4*c+h]=q[4*D+h];this.fancyScatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions),this.expandAxesFancy(a,l,R)},E.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var i=0,o=this.xData,s=this.yData;for(n=new Float32Array(2*o.length),r=0;ra;a++)r=this.scene[T[a]],n=r._min,n||(n=[]),n.push({val:t[a],pad:o}),i=r._max,i||(i=[]),i.push({val:t[a+2],pad:o})},E.expandAxesFancy=function(t,e,r){var n=this.scene,i={padded:!0,ppad:r};g.expand(n.xaxis,t,i),g.expand(n.yaxis,e,i)},E.dispose=function(){this.line.dispose(),this.errorX.dispose(),this.errorY.dispose(),this.scatter.dispose(),this.fancyScatter.dispose()},e.exports=c},{"../../components/errorbars":512,"../../constants/gl2d_dashes":552,"../../constants/gl_markers":554,"../../lib":568,"../../lib/gl_format_color":566,"../../lib/str2rgbarray":580,"../../plots/cartesian/axes":592,"../scatter/get_trace_color":758,"../scatter/make_bubble_size_func":764,"../scatter/subtypes":769,"fast-isnumeric":123,"gl-error2d":125,"gl-line2d":131,"gl-scatter2d":196,"gl-scatter2d-fancy":191}],785:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/xy_defaults"),s=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),u=t("../scatter/fillcolor_defaults"),c=t("../../components/errorbars/defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p=a(t,e,d);return p?(d("text"),d("mode",px;x++){var _=e.lon[x],w=e.lat[x];if(n(_)&&n(w)){var M={};if(b++,M.lonlat=[+_,+w],h){if(f){var k=c.color[x];M.mc=k,M.mcc=m(k)}if(d){var A=c.size[x];M.ms=A,M.mrc=g(A)}if(p){var T=c.symbol[x];M.mx="string"==typeof T?T:"circle"}}if(v){var E=e.text[x];M.tx="string"==typeof E?E:""}y.push(M)}else b>0&&(y[b-1].gapAfter=!0)}return y}},{"../../components/colorscale/has_colorscale":496,"../../components/colorscale/make_scale_function":500,"../../lib":568,"../scatter/colorscale_calc":754,"../scatter/make_bubble_size_func":764,"../scatter/subtypes":769,"fast-isnumeric":123}],789:[function(t,e,r){"use strict";function n(){return{geojson:i(),layout:{visibility:"none"},paint:{}}}function i(){return{type:"Point",coordinates:[]}}function o(t,e){return{type:"Polygon",coordinates:e}}function a(t,e){return{type:"MultiLineString",coordinates:e}}function s(t,e){function r(t,r,n,i){void 0===e[r][n]&&(e[r][n]=i),t[r]=e[r][n]}for(var n=t[0].trace,i=n.marker,o=Array.isArray(i.color),a=Array.isArray(i.size),s=[],l=0;l0&&(n.push(i),i=[])}return n.push(i),n}function f(t){return Array.isArray(t)?function(t){return t}:t?function(){return t}:d}function d(){return""}var p=t("../../lib"),v=t("../scatter/subtypes"),m=t("../../plots/mapbox/convert_text_opts"),g="circle-color",y="circle-radius";e.exports=function(t){var e=t[0].trace,r=e.visible===!0,i="none"!==e.fill,f=v.hasLines(e),d=v.hasMarkers(e),b=v.hasText(e),x=d&&"circle"===e.marker.symbol,_=d&&"circle"!==e.marker.symbol,w=n(),M=n(),k=n(),A=n(),T={fill:w,line:M,circle:k,symbol:A};if(!r)return T;var E;if((i||f)&&(E=h(t)),i&&(w.geojson=o(t,E),w.layout.visibility="visible",p.extendFlat(w.paint,{"fill-color":e.fillcolor})),f&&(M.geojson=a(t,E),M.layout.visibility="visible",p.extendFlat(M.paint,{"line-width":e.line.width,"line-color":e.line.color,"line-opacity":e.opacity})),x){var S={};S[g]={},S[y]={},k.geojson=s(t,S),k.layout.visibility="visible",p.extendFlat(k.paint,{"circle-opacity":e.opacity*e.marker.opacity,"circle-color":u(e,S),"circle-radius":c(e,S)})}if((_||b)&&(A.geojson=l(t),p.extendFlat(A.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),_&&(p.extendFlat(A.layout,{"icon-size":e.marker.size/10}),p.extendFlat(A.paint,{"icon-opacity":e.opacity*e.marker.opacity,"icon-color":e.marker.color})),b)){var L=(e.marker||{}).size,z=m(e.textposition,L);p.extendFlat(A.layout,{"text-size":e.textfont.size,"text-anchor":z.anchor,"text-offset":z.offset}),p.extendFlat(A.paint,{"text-color":e.textfont.color,"text-opacity":e.opacity})}return T}},{"../../lib":568,"../../plots/mapbox/convert_text_opts":642,"../scatter/subtypes":769}],790:[function(t,e,r){"use strict";function n(t,e,r){var n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length);return o")}var i=t("../../plots/cartesian/graph_interact"),o=t("../scatter/get_trace_color");e.exports=function(t,e,r){function a(t){var e=t.lonlat,n=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],r])),o=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-o,1-3/o)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya,h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),f=360*h,d=e-f;if(i.getClosest(s,a,t),t.index!==!1){var p=s[t.index],v=p.lonlat,m=[v[0]+f,v[1]],g=u.c2p(m),y=c.c2p(m),b=p.mrc||1;return t.x0=g-b,t.x1=g+b,t.y0=y-b,t.y1=y+b,t.color=o(l,p),t.extraText=n(l,p),[t]}}},{"../../plots/cartesian/graph_interact":599,"../scatter/get_trace_color":758}],792:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.hoverPoints=t("./hover"),n.plot=t("./plot"),n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/mapbox":643,"../scatter/colorbar":753,"./attributes":787,"./calc":788,"./defaults":790,"./hover":791,"./plot":793}],793:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.sourceFill=t.createGeoJSONSource(),this.map.addSource(this.idSourceFill,this.sourceFill),this.sourceLine=t.createGeoJSONSource(),this.map.addSource(this.idSourceLine,this.sourceLine),this.sourceCircle=t.createGeoJSONSource(),this.map.addSource(this.idSourceCircle,this.sourceCircle),this.sourceSymbol=t.createGeoJSONSource(),this.map.addSource(this.idSourceSymbol,this.sourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var o=t("./convert"),a=n.prototype;a.update=function(t){var e=this.mapbox,r=o(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout),i(r.fill)&&(this.sourceFill.setData(r.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(this.sourceLine.setData(r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(this.sourceCircle.setData(r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(this.sourceSymbol.setData(r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint))},a.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=e[0].trace,i=new n(t,r.uid);return i.update(e),i}},{"./convert":789}],794:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},mode:a({},n.mode,{dflt:"markers"}),text:a({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash,shape:a({},l.shape,{values:["linear","spline"]}),smoothing:l.smoothing},connectgaps:n.connectgaps,fill:a({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:a({},{symbol:s.symbol,opacity:s.opacity,maxdisplayed:s.maxdisplayed,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:a({},{width:u.width},o("marker".line))},o("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:a({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron,_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../../plots/attributes":590,"../scatter/attributes":750}],795:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("../scatter/subtypes"),s=t("../scatter/colorscale_calc"),l=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,c,h,f,d,p,v=t._fullLayout[e.subplot],m=v.sum,g=e.sum||m;for(r=0;rr;r++)y=e.a[r],b=e.b[r],x=e.c[r],n(y)&&n(b)&&n(x)?(y=+y,b=+b,x=+x,_=m/(y+b+x),1!==_&&(y*=_,b*=_,x*=_),M=y,w=x-b,A[r]={x:w,y:M,a:y,b:b,c:x}):A[r]={x:!1,y:!1};var T,E;if(a.hasMarkers(e)&&(T=e.marker,E=T.size,Array.isArray(E))){var S={type:"linear"};i.setConvert(S),E=S.makeCalcdata(e.marker,"size"),E.length>k&&E.splice(k,E.length-k)}return s(e),void 0!==typeof E&&o.mergeArray(E,A,"ms"),A}},{"../../lib":568,"../../plots/cartesian/axes":592,"../scatter/colorscale_calc":754,"../scatter/subtypes":769,"fast-isnumeric":123}],796:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),u=t("../scatter/text_defaults"),c=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p,v=d("a"),m=d("b"),g=d("c");if(v?(p=v.length,m?(p=Math.min(p,m.length),g&&(p=Math.min(p,g.length))):p=g?Math.min(p,g.length):0):m&&g&&(p=Math.min(m.length,g.length)),!p)return void(e.visible=!1);v&&p"),s}}},{"../../plots/cartesian/axes":592,"../scatter/hover":759}],798:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":655,"../scatter/colorbar":753,"./attributes":794,"./calc":795,"./defaults":796,"./hover":797,"./plot":799,"./select":800,"./style":801}],799:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={x:function(){return t.xaxis},y:function(){return t.yaxis},plot:r},o=new Array(e.length),a=t.graphDiv.calcdata,s=0;se){for(var r=v/e,n=[0|Math.floor(t[0].shape[0]*r+1),0|Math.floor(t[0].shape[1]*r+1)],i=n[0]*n[1],a=0;ar;++r)this.showContour[r]&&(e=!0,t[r]=this.scene.contourLevels[r]);e&&this.surface.update({levels:t})},m.update=function(t){var e,r=this.scene,n=r.fullSceneLayout,o=this.surface,s=t.opacity,l=i(t.colorscale,s),c=t.z,f=t.x,d=t.y,v=n.xaxis,m=n.yaxis,g=n.zaxis,y=r.dataScale,b=c[0].length,x=c.length,_=[u(new Float32Array(b*x),[b,x]),u(new Float32Array(b*x),[b,x]),u(new Float32Array(b*x),[b,x])],w=_[0],M=_[1],k=r.contourLevels;this.data=t,h(_[2],function(t,e){return g.d2l(c[e][t])*y[2]}),Array.isArray(f[0])?h(w,function(t,e){return v.d2l(f[e][t])*y[0]}):h(w,function(t){return v.d2l(f[t])*y[0]}),Array.isArray(d[0])?h(M,function(t,e){return m.d2l(d[e][t])*y[1]}):h(M,function(t,e){return m.d2l(d[e])*y[1]});var A={colormap:l,levels:[[],[],[]],showContour:[!0,!0,!0],showSurface:!t.hidesurface,contourProject:[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],contourWidth:[1,1,1],contourColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],contourTint:[1,1,1],dynamicColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],dynamicWidth:[1,1,1],dynamicTint:[1,1,1],opacity:1};if(A.intensityBounds=[t.cmin,t.cmax],t.surfacecolor){var T=u(new Float32Array(b*x),[b,x]);h(T,function(e,r){return t.surfacecolor[r][e]}),_.push(T)}else A.intensityBounds[0]*=y[2],A.intensityBounds[1]*=y[2];this.dataScale=a(_),t.surfacecolor&&(A.intensity=_.pop()),"opacity"in t&&t.opacity<1&&(A.opacity=.25*t.opacity);var E=[!0,!0,!0],S=["x","y","z"];for(e=0;3>e;++e){var L=t.contours[S[e]];E[e]=L.highlight,A.showContour[e]=L.show||L.highlight,A.showContour[e]&&(A.contourProject[e]=[L.project.x,L.project.y,L.project.z],L.show?(this.showContour[e]=!0,A.levels[e]=k[e],o.highlightColor[e]=A.contourColor[e]=p(L.color),L.usecolormap?o.highlightTint[e]=A.contourTint[e]=0:o.highlightTint[e]=A.contourTint[e]=1,A.contourWidth[e]=L.width):this.showContour[e]=!1,L.highlight&&(A.dynamicColor[e]=p(L.highlightcolor),A.dynamicWidth[e]=L.highlightwidth))}A.coords=_,o.update(A),o.visible=t.visible,o.enableDynamic=E,o.snapToData=!0,"lighting"in t&&(o.ambientLight=t.lighting.ambient,o.diffuseLight=t.lighting.diffuse,o.specularLight=t.lighting.specular,o.roughness=t.lighting.roughness,o.fresnel=t.lighting.fresnel),"lightposition"in t&&(o.lightPosition=[t.lightposition.x,t.lightposition.y,t.lightposition.z]),s&&1>s&&(o.supportsTransparency=!0)},m.dispose=function(){this.scene.glplot.remove(this.surface),this.surface.dispose()},e.exports=s},{"../../lib/str2rgbarray":580,"gl-surface3d":227,ndarray:433,"ndarray-fill":426,"ndarray-homography":431,"ndarray-ops":432,tinycolor2:454}],806:[function(t,e,r){"use strict";function n(t,e,r){e in t&&!(r in t)&&(t[r]=t[e])}var i=t("../../lib"),o=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,a,r,n)}var u,c,h=l("z");if(!h)return void(e.visible=!1);var f=h[0].length,d=h.length;if(l("x"),l("y"),!Array.isArray(e.x))for(e.x=[],u=0;f>u;++u)e.x[u]=u;if(l("text"),!Array.isArray(e.y))for(e.y=[],u=0;d>u;++u)e.y[u]=u;["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lightposition.x","lightposition.y","lightposition.z","hidesurface","opacity"].forEach(function(t){l(t)});var p=l("surfacecolor");l("colorscale");var v=["x","y","z"];for(u=0;3>u;++u){var m="contours."+v[u],g=l(m+".show"),y=l(m+".highlight");if(g||y)for(c=0;3>c;++c)l(m+".project."+v[c]);g&&(l(m+".color"),l(m+".width"),l(m+".usecolormap")),y&&(l(m+".highlightcolor"),l(m+".highlightwidth"))}p||(n(t,"zmin","cmin"),n(t,"zmax","cmax"),n(t,"zauto","cauto")),o(t,e,s,l,{prefix:"",cLetter:"c"})}},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":802}],807:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("./colorbar"),n.calc=t("./calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="surface",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","noOpacity"],n.meta={},e.exports=n},{"../../plots/gl3d":628,"./attributes":802,"./calc":803,"./colorbar":804,"./convert":805,"./defaults":806}]},{},[12])(12)}); \ No newline at end of file +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return i(r?r:e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;ar;++r)e[r]=0;return e}function a(t,e,r){switch(arguments.length){case 0:return new i([0],[0],0);case 1:if("number"==typeof t){var n=o(t);return new i(n,n,0)}return new i(t,o(t.length),0);case 2:if("number"==typeof e){var n=o(t.length);return new i(t,n,+e)}r=0;case 3:if(t.length!==e.length)throw new Error("state and velocity lengths must match");return new i(t,e,r)}}e.exports=a;var s=t("cubic-hermite"),l=t("binary-search-bounds"),u=i.prototype;u.flush=function(t){var e=l.gt(this._time,t)-1;0>=e||(this._time.splice(0,e),this._state.splice(0,e*this.dimension),this._velocity.splice(0,e*this.dimension))},u.curve=function(t){var e=this._time,r=e.length,i=l.le(e,t),o=this._scratch[0],a=this._state,u=this._velocity,c=this.dimension,h=this.bounds;if(0>i)for(var f=c-1,p=0;c>p;++p,--f)o[p]=a[f];else if(i>=r-1)for(var f=a.length-1,d=t-e[r-1],p=0;c>p;++p,--f)o[p]=a[f]+d*u[f];else{for(var f=c*(i+1)-1,m=e[i],g=e[i+1],v=g-m||1,y=this._scratch[1],b=this._scratch[2],x=this._scratch[3],_=this._scratch[4],w=!0,p=0;c>p;++p,--f)y[p]=a[f],x[p]=u[f]*v,b[p]=a[f+c],_[p]=u[f+c]*v,w=w&&y[p]===b[p]&&x[p]===_[p]&&0===x[p];if(w)for(var p=0;c>p;++p)o[p]=y[p];else s(y,x,b,_,(t-m)/v,o)}for(var M=h[0],k=h[1],p=0;c>p;++p)o[p]=n(M[p],k[p],o[p]);return o},u.dcurve=function(t){var e=this._time,r=e.length,n=l.le(e,t),i=this._scratch[0],o=this._state,a=this._velocity,u=this.dimension;if(n>=r-1)for(var c=o.length-1,h=(t-e[r-1],0);u>h;++h,--c)i[h]=a[c];else{for(var c=u*(n+1)-1,f=e[n],p=e[n+1],d=p-f||1,m=this._scratch[1],g=this._scratch[2],v=this._scratch[3],y=this._scratch[4],b=!0,h=0;u>h;++h,--c)m[h]=o[c],v[h]=a[c]*d,g[h]=o[c+u],y[h]=a[c+u]*d,b=b&&m[h]===g[h]&&v[h]===y[h]&&0===v[h];if(b)for(var h=0;u>h;++h)i[h]=0;else{s.derivative(m,v,g,y,(t-f)/d,i);for(var h=0;u>h;++h)i[h]/=d}}return i},u.lastT=function(){var t=this._time;return t[t.length-1]},u.stable=function(){for(var t=this._velocity,e=t.length,r=this.dimension-1;r>=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(e>t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1];this._time.push(e,t);for(var c=0;2>c;++c)for(var h=0;r>h;++h)i.push(i[a++]),o.push(0);this._time.push(t);for(var h=r;h>0;--h)i.push(n(l[h-1],u[h-1],arguments[h])),o.push(0)}},u.push=function(t){var e=this.lastT(),r=this.dimension;if(!(e>t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=t-e,l=this.bounds,u=l[0],c=l[1],h=s>1e-6?1/s:0;this._time.push(t);for(var f=r;f>0;--f){var p=n(u[f-1],c[f-1],arguments[f]);i.push(p),o.push((p-i[a++])*h)}}},u.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(n(a[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(e>=t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,h=c>1e-6?1/c:0;this._time.push(t);for(var f=r;f>0;--f){var p=arguments[f];i.push(n(l[f-1],u[f-1],i[a++]+p)),o.push(p*h)}}},u.idle=function(t){var e=this.lastT();if(!(e>t)){var r=this.dimension,i=this._state,o=this._velocity,a=i.length-r,s=this.bounds,l=s[0],u=s[1],c=t-e;this._time.push(t);for(var h=r-1;h>=0;--h)i.push(n(l[h],u[h],i[a]+c*o[a])),o.push(0),a+=1}}},{"binary-search-bounds":22,"cubic-hermite":23}],22:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){var a=["function ",t,"(a,l,h,",n.join(","),"){",o?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return o?e.indexOf("c")<0?a.push(";if(x===y){return m}else if(x<=y){"):a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):a.push(";if(",e,"){i=m;"),r?a.push("l=m+1}else{h=m-1}"):a.push("h=m-1}else{l=m+1}"),a.push("}"),o?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){var o=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(""));return o()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],23:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){var a=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,u=3*i*i-2*i;if(t.length){o||(o=new Array(t.length));for(var c=t.length-1;c>=0;--c)o[c]=a*t[c]+s*e[c]+l*r[c]+u*n[c];return o}return a*t+s*e+l*r[c]+u*n}function i(t,e,r,n,i,o){var a=i-1,s=i*i,l=a*a,u=(1+2*i)*l,c=i*l,h=s*(3-2*i),f=s*a;if(t.length){o||(o=new Array(t.length));for(var p=t.length-1;p>=0;--p)o[p]=u*t[p]+c*e[p]+h*r[p]+f*n[p];return o}return u*t+c*e+h*r+f*n}e.exports=i,e.exports.derivative=n},{}],24:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=i*l-o*s,t[1]=o*a-n*l,t[2]=n*s-i*a,t}e.exports=n},{}],25:[function(t,e,r){function n(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.exports=n},{}],26:[function(t,e,r){function n(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}e.exports=n},{}],27:[function(t,e,r){function n(t,e,r,n){var i=e[0],o=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t}e.exports=n},{}],28:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t}e.exports=n},{}],29:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var o=t("binary-search-bounds"),a=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),h=t("gl-mat4/lookAt"),f=t("gl-mat4/translate"),p=(t("gl-mat4/scale"),t("gl-vec3/normalize")),d=[0,0,0];e.exports=i;var m=n.prototype;m.recalcMatrix=function(t){var e=this._time,r=o.le(e,t),n=this.computedMatrix;if(!(0>r)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;16>u;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,h=this.prevMatrix,f=!0,u=0;16>u;++u)h[u]=i[l++];for(var d=this.nextMatrix,u=0;16>u;++u)d[u]=i[l++],f=f&&h[u]===d[u];if(1e-6>c||f)for(var u=0;16>u;++u)n[u]=h[u];else a(n,h,d,(t-e[r])/c)}var m=this.computedUp;m[0]=n[1],m[1]=n[5],m[2]=n[6],p(m,m);var g=this.computedInverse;s(g,n);var v=this.computedEye,y=g[15];v[0]=g[12]/y,v[1]=g[13]/y,v[2]=g[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;3>u;++u)b[u]=v[u]-n[2+4*u]*x}},m.idle=function(t){if(!(tn;++n)e.push(e[r++]);this._time.push(t)}},m.flush=function(t){var e=o.gt(this._time,t)-2;0>e||(this._time.slice(0,e),this._components.slice(0,16*e))},m.lastT=function(){return this._time[this._time.length-1]},m.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||d,n=n||this.computedUp,this.setMatrix(t,h(this.computedMatrix,e,r,n));for(var i=0,o=0;3>o;++o)i+=Math.pow(r[o]-e[o],2);i=Math.log(Math.sqrt(i)),this.computedRadius[0]=i},m.rotate=function(t,e,r,n){this.recalcMatrix(t);var i=this.computedInverse;e&&u(i,i,e),r&&l(i,i,r),n&&c(i,i,n),this.setMatrix(t,s(this.computedMatrix,i))};var g=[0,0,0];m.pan=function(t,e,r,n){g[0]=-(e||0),g[1]=-(r||0),g[2]=-(n||0),this.recalcMatrix(t);var i=this.computedInverse;f(i,i,g),this.setMatrix(t,s(i,i))},m.translate=function(t,e,r,n){g[0]=e||0,g[1]=r||0,g[2]=n||0,this.recalcMatrix(t);var i=this.computedMatrix;f(i,i,g),this.setMatrix(t,i)},m.setMatrix=function(t,e){if(!(tr;++r)this._components.push(e[r])}},m.setDistance=function(t,e){this.computedRadius[0]=e},m.setDistanceLimits=function(t,e){var r=this._limits;r[0]=t,r[1]=e},m.getDistanceLimits=function(t){var e=this._limits;return t?(t[0]=e[0],t[1]=e[1],t):e}},{"binary-search-bounds":30,"gl-mat4/invert":148,"gl-mat4/lookAt":149,"gl-mat4/rotateX":153,"gl-mat4/rotateY":154,"gl-mat4/rotateZ":155,"gl-mat4/scale":156,"gl-mat4/translate":157,"gl-vec3/normalize":28,"mat4-interpolate":31}],30:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],31:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,f.translate,f.scale,f.skew,f.perspective,f.quaternion),o=u(r,p.translate,p.scale,p.skew,p.perspective,p.quaternion);return i&&o?(s(d.translate,f.translate,p.translate,n),s(d.skew,f.skew,p.skew,n),s(d.scale,f.scale,p.scale,n),s(d.perspective,f.perspective,p.perspective,n),h(d.quaternion,f.quaternion,p.quaternion,n),l(t,d.translate,d.scale,d.skew,d.perspective,d.quaternion),!0):!1}function i(){return{translate:o(),scale:o(1),skew:o(),perspective:a(),quaternion:a()}}function o(t){return[t||0,t||0,t||0]}function a(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),h=t("quat-slerp"),f=i(),p=i(),d=i();e.exports=n},{"gl-mat4/determinant":144,"gl-vec3/lerp":27,"mat4-decompose":32,"mat4-recompose":34,"quat-slerp":35}],32:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function i(t,e){t[0][0]=e[0],t[0][1]=e[1],t[0][2]=e[2],t[1][0]=e[4],t[1][1]=e[5],t[1][2]=e[6],t[2][0]=e[8],t[2][1]=e[9],t[2][2]=e[10]}function o(t,e,r,n,i){t[0]=e[0]*n+r[0]*i,t[1]=e[1]*n+r[1]*i,t[2]=e[2]*n+r[2]*i}var a=t("./normalize"),s=t("gl-mat4/create"),l=t("gl-mat4/clone"),u=t("gl-mat4/determinant"),c=t("gl-mat4/invert"),h=t("gl-mat4/transpose"),f={length:t("gl-vec3/length"),normalize:t("gl-vec3/normalize"),dot:t("gl-vec3/dot"),cross:t("gl-vec3/cross")},p=s(),d=s(),m=[0,0,0,0],g=[[0,0,0],[0,0,0],[0,0,0]],v=[0,0,0];e.exports=function(t,e,r,s,y,b){if(e||(e=[0,0,0]),r||(r=[0,0,0]),s||(s=[0,0,0]),y||(y=[0,0,0,1]),b||(b=[0,0,0,1]),!a(p,t))return!1;if(l(d,p),d[3]=0,d[7]=0,d[11]=0,d[15]=1,Math.abs(u(d)<1e-8))return!1;var x=p[3],_=p[7],w=p[11],M=p[12],k=p[13],A=p[14],T=p[15];if(0!==x||0!==_||0!==w){m[0]=x,m[1]=_,m[2]=w,m[3]=T;var E=c(d,d);if(!E)return!1;h(d,d),n(y,m,d)}else y[0]=y[1]=y[2]=0,y[3]=1;if(e[0]=M,e[1]=k,e[2]=A,i(g,p),r[0]=f.length(g[0]),f.normalize(g[0],g[0]),s[0]=f.dot(g[0],g[1]),o(g[1],g[1],g[0],1,-s[0]),r[1]=f.length(g[1]),f.normalize(g[1],g[1]),s[0]/=r[1],s[1]=f.dot(g[0],g[2]),o(g[2],g[2],g[0],1,-s[1]),s[2]=f.dot(g[1],g[2]),o(g[2],g[2],g[1],1,-s[2]),r[2]=f.length(g[2]),f.normalize(g[2],g[2]),s[1]/=r[2],s[2]/=r[2],f.cross(v,g[1],g[2]),f.dot(g[0],v)<0)for(var S=0;3>S;S++)r[S]*=-1,g[S][0]*=-1,g[S][1]*=-1,g[S][2]*=-1;return b[0]=.5*Math.sqrt(Math.max(1+g[0][0]-g[1][1]-g[2][2],0)),b[1]=.5*Math.sqrt(Math.max(1-g[0][0]+g[1][1]-g[2][2],0)),b[2]=.5*Math.sqrt(Math.max(1-g[0][0]-g[1][1]+g[2][2],0)),b[3]=.5*Math.sqrt(Math.max(1+g[0][0]+g[1][1]+g[2][2],0)),g[2][1]>g[1][2]&&(b[0]=-b[0]),g[0][2]>g[2][0]&&(b[1]=-b[1]),g[1][0]>g[0][1]&&(b[2]=-b[2]),!0}},{"./normalize":33,"gl-mat4/clone":142,"gl-mat4/create":143,"gl-mat4/determinant":144,"gl-mat4/invert":148,"gl-mat4/transpose":158,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/length":26,"gl-vec3/normalize":28}],33:[function(t,e,r){e.exports=function(t,e){var r=e[15];if(0===r)return!1;for(var n=1/r,i=0;16>i;i++)t[i]=e[i]*n;return!0}},{}],34:[function(t,e,r){var n={identity:t("gl-mat4/identity"),translate:t("gl-mat4/translate"),multiply:t("gl-mat4/multiply"),create:t("gl-mat4/create"),scale:t("gl-mat4/scale"),fromRotationTranslation:t("gl-mat4/fromRotationTranslation")},i=(n.create(),n.create());e.exports=function(t,e,r,o,a,s){return n.identity(t),n.fromRotationTranslation(t,s,e),t[3]=a[0],t[7]=a[1],t[11]=a[2],t[15]=a[3],n.identity(i),0!==o[2]&&(i[9]=o[2],n.multiply(t,t,i)),0!==o[1]&&(i[9]=0,i[8]=o[1],n.multiply(t,t,i)),0!==o[0]&&(i[8]=0,i[4]=o[0],n.multiply(t,t,i)),n.scale(t,t,r),t}},{"gl-mat4/create":143,"gl-mat4/fromRotationTranslation":146,"gl-mat4/identity":147,"gl-mat4/multiply":150,"gl-mat4/scale":156,"gl-mat4/translate":157}],35:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":36}],36:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,u=e[0],c=e[1],h=e[2],f=e[3],p=r[0],d=r[1],m=r[2],g=r[3];return o=u*p+c*d+h*m+f*g,0>o&&(o=-o,p=-p,d=-d,m=-m,g=-g),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-n)*i)/a,l=Math.sin(n*i)/a):(s=1-n,l=n),t[0]=s*u+l*p,t[1]=s*c+l*d,t[2]=s*h+l*m,t[3]=s*f+l*g,t}e.exports=n},{}],37:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u){var c=e+o+u;if(h>0){var h=Math.sqrt(c+1);t[0]=.5*(a-l)/h,t[1]=.5*(s-n)/h,t[2]=.5*(r-o)/h,t[3]=.5*h}else{var f=Math.max(e,o,u),h=Math.sqrt(2*f-c+1);e>=f?(t[0]=.5*h,t[1]=.5*(i+r)/h,t[2]=.5*(s+n)/h,t[3]=.5*(a-l)/h):o>=f?(t[0]=.5*(r+i)/h,t[1]=.5*h,t[2]=.5*(l+a)/h,t[3]=.5*(s-n)/h):(t[0]=.5*(n+s)/h,t[1]=.5*(a+l)/h,t[2]=.5*h,t[3]=.5*(r-i)/h)}return t}e.exports=n},{}],38:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function o(t,e){var r=e[0],n=e[1],o=e[2],a=e[3],s=i(r,n,o,a);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=o/s,t[3]=a/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function a(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),o(r,r);var i=new a(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),h=t("gl-mat4/invert"),f=t("./lib/quatFromFrame"),p=a.prototype;p.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},p.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;o(e,e);var r=this.computedMatrix;c(r,e);var n=this.computedCenter,i=this.computedEye,a=this.computedUp,s=Math.exp(this.computedRadius[0]);i[0]=n[0]+s*r[2],i[1]=n[1]+s*r[6],i[2]=n[2]+s*r[10],a[0]=r[1],a[1]=r[5],a[2]=r[9];for(var l=0;3>l;++l){for(var u=0,h=0;3>h;++h)u+=r[l+4*h]*i[h];r[12+l]=-u}},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;16>n;++n)e[n]=r[n];return e}return r},p.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},p.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var o=this.computedMatrix,a=o[1],s=o[5],l=o[9],u=n(a,s,l);a/=u,s/=u,l/=u;var c=o[0],h=o[4],f=o[8],p=c*a+h*s+f*l;c-=a*p,h-=s*p,f-=l*p;var d=n(c,h,f);c/=d,h/=d,f/=d;var m=o[2],g=o[6],v=o[10],y=m*a+g*s+v*l,b=m*c+g*h+v*f;m-=y*a+b*c,g-=y*s+b*h,v-=y*l+b*f;var x=n(m,g,v);m/=x,g/=x,v/=x;var _=c*e+a*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var k=Math.exp(this.computedRadius[0]);k=Math.max(1e-4,k+i),this.radius.set(t,Math.log(k))},p.rotate=function(t,e,r,o){this.recalcMatrix(t),e=e||0,r=r||0;var a=this.computedMatrix,s=a[0],l=a[4],u=a[8],c=a[1],h=a[5],f=a[9],p=a[2],d=a[6],m=a[10],g=e*s+r*c,v=e*l+r*h,y=e*u+r*f,b=-(d*y-m*v),x=-(m*g-p*y),_=-(p*v-d*g),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),M=i(b,x,_,w);M>1e-6?(b/=M,x/=M,_/=M,w/=M):(b=x=_=0,w=1);var k=this.computedRotation,A=k[0],T=k[1],E=k[2],S=k[3],L=A*w+S*b+T*_-E*x,z=T*w+S*x+E*b-A*_,I=E*w+S*_+A*x-T*b,P=S*w-A*b-T*x-E*_;if(o){b=p,x=d,_=m;var C=Math.sin(o)/n(b,x,_);b*=C,x*=C,_*=C,w=Math.cos(e),L=L*w+P*b+z*_-I*x,z=z*w+P*x+I*b-L*_,I=I*w+P*_+L*x-z*b,P=P*w-L*b-z*x-I*_}var R=i(L,z,I,P);R>1e-6?(L/=R,z/=R,I/=R,P/=R):(L=z=I=0,P=1),this.rotation.set(t,L,z,I,P)},p.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var a=this.computedRotation;f(a,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),o(a,a),this.rotation.set(t,a[0],a[1],a[2],a[3]);for(var s=0,l=0;3>l;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e){var r=this.computedRotation;f(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),o(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;h(n,e);var i=n[15];if(Math.abs(i)>1e-6){var a=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,a-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0), +e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},p.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":37,"filtered-vector":21,"gl-mat4/fromQuat":145,"gl-mat4/invert":148,"gl-mat4/lookAt":149}],39:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t){return Math.min(1,Math.max(-1,t))}function o(t){var e=Math.abs(t[0]),r=Math.abs(t[1]),n=Math.abs(t[2]),i=[0,0,0];e>Math.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var o=0,a=0,s=0;3>s;++s)o+=t[s]*t[s],a+=i[s]*t[s];for(var s=0;3>s;++s)i[s]-=a/o*t[s];return f(i,i),i}function a(t,e,r,n,i,o,a,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([o]),this.angle=l([a,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;16>u;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||o(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),f(r,r),i=[].slice.call(i,0,3),f(i,i),"eye"in t){var c=t.eye,d=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];h(i,d,r),n(i[0],i[1],i[2])<1e-6?i=o(r):f(i,i),s=n(d[0],d[1],d[2]);var m=p(r,d)/s,g=p(i,d)/s;u=Math.acos(m),l=Math.acos(g)}return s=Math.log(s),new a(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),h=t("gl-vec3/cross"),f=t("gl-vec3/normalize"),p=t("gl-vec3/dot"),d=a.prototype;d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,o=0,a=0;3>a;++a)o+=e[a]*r[a],i+=e[a]*e[a];for(var s=Math.sqrt(i),l=0,a=0;3>a;++a)r[a]-=e[a]*o/i,l+=r[a]*r[a],e[a]/=s;for(var u=Math.sqrt(l),a=0;3>a;++a)r[a]/=u;var c=this.computedToward;h(c,e,r),f(c,c);for(var p=Math.exp(this.computedRadius[0]),d=this.computedAngle[0],m=this.computedAngle[1],g=Math.cos(d),v=Math.sin(d),y=Math.cos(m),b=Math.sin(m),x=this.computedCenter,_=g*y,w=v*y,M=b,k=-g*b,A=-v*b,T=y,E=this.computedEye,S=this.computedMatrix,a=0;3>a;++a){var L=_*r[a]+w*c[a]+M*e[a];S[4*a+1]=k*r[a]+A*c[a]+T*e[a],S[4*a+2]=L,S[4*a+3]=0}var z=S[1],I=S[5],P=S[9],C=S[2],R=S[6],j=S[10],D=I*j-P*R,O=P*C-z*j,F=z*R-I*C,N=n(D,O,F);D/=N,O/=N,F/=N,S[0]=D,S[4]=O,S[8]=F;for(var a=0;3>a;++a)E[a]=x[a]+S[2+4*a]*p;for(var a=0;3>a;++a){for(var l=0,B=0;3>B;++B)l+=S[a+4*B]*E[B];S[12+a]=-l}S[15]=1},d.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;16>n;++n)e[n]=r[n];return e}return r};var m=[0,0,0];d.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;m[0]=i[2],m[1]=i[6],m[2]=i[10];for(var o=this.computedUp,a=this.computedRight,s=this.computedToward,l=0;3>l;++l)i[4*l]=o[l],i[4*l+1]=a[l],i[4*l+2]=s[l];c(i,i,n,m);for(var l=0;3>l;++l)o[l]=i[4*l],a[l]=i[4*l+1];this.up.set(t,o[0],o[1],o[2]),this.right.set(t,a[0],a[1],a[2])}},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var o=this.computedMatrix,a=(Math.exp(this.computedRadius[0]),o[1]),s=o[5],l=o[9],u=n(a,s,l);a/=u,s/=u,l/=u;var c=o[0],h=o[4],f=o[8],p=c*a+h*s+f*l;c-=a*p,h-=s*p,f-=l*p;var d=n(c,h,f);c/=d,h/=d,f/=d;var m=c*e+a*r,g=h*e+s*r,v=f*e+l*r;this.center.move(t,m,g,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e,r,o){var a=1;"number"==typeof r&&(a=0|r),(0>a||a>3)&&(a=1);var s=(a+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[a],c=e[a+4],h=e[a+8];if(o){var f=Math.abs(l),p=Math.abs(c),d=Math.abs(h),m=Math.max(f,p,d);f===m?(l=0>l?-1:1,c=h=0):d===m?(h=0>h?-1:1,l=c=0):(c=0>c?-1:1,l=h=0)}else{var g=n(l,c,h);l/=g,c/=g,h/=g}var v=e[s],y=e[s+4],b=e[s+8],x=v*l+y*c+b*h;v-=l*x,y-=c*x,b-=h*x;var _=n(v,y,b);v/=_,y/=_,b/=_;var w=c*b-h*y,M=h*v-l*b,k=l*y-c*v,A=n(w,M,k);w/=A,M/=A,k/=A,this.center.jump(t,G,H,X),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,v,y,b);var T,E;if(2===a){var S=e[1],L=e[5],z=e[9],I=S*v+L*y+z*b,P=S*w+L*M+z*k;T=0>D?-Math.PI/2:Math.PI/2,E=Math.atan2(P,I)}else{var C=e[2],R=e[6],j=e[10],D=C*l+R*c+j*h,O=C*v+R*y+j*b,F=C*w+R*M+j*k;T=Math.asin(i(D)),E=Math.atan2(F,O)}this.angle.jump(t,E,T),this.recalcMatrix(t);var N=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var q=V[15],G=V[12]/q,H=V[13]/q,X=V[14]/q,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,G-N*Y,H-B*Y,X-U*Y)},d.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},d.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},d.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.lookAt=function(t,e,r,o){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,o=o||this.computedUp;var a=o[0],s=o[1],l=o[2],u=n(a,s,l);if(!(1e-6>u)){a/=u,s/=u,l/=u;var c=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],p=n(c,h,f);if(!(1e-6>p)){c/=p,h/=p,f/=p;var d=this.computedRight,m=d[0],g=d[1],v=d[2],y=a*m+s*g+l*v;m-=y*a,g-=y*s,v-=y*l;var b=n(m,g,v);if(!(.01>b&&(m=s*f-l*h,g=l*c-a*f,v=a*h-s*c,b=n(m,g,v),1e-6>b))){m/=b,g/=b,v/=b,this.up.set(t,a,s,l),this.right.set(t,m,g,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(p));var x=s*v-l*g,_=l*m-a*v,w=a*g-s*m,M=n(x,_,w);x/=M,_/=M,w/=M;var k=a*c+s*h+l*f,A=m*c+g*h+v*f,T=x*c+_*h+w*f,E=Math.asin(i(k)),S=Math.atan2(T,A),L=this.angle._state,z=L[L.length-1],I=L[L.length-2];z%=2*Math.PI;var P=Math.abs(z+2*Math.PI-S),C=Math.abs(z-S),R=Math.abs(z-2*Math.PI-S);C>P&&(z+=2*Math.PI),C>R&&(z-=2*Math.PI),this.angle.jump(this.angle.lastT(),z,I),this.angle.set(t,S,E)}}}}},{"filtered-vector":21,"gl-mat4/invert":148,"gl-mat4/rotate":152,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/normalize":28}],40:[function(t,e,r){"use strict";function n(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}function i(t){t=t||{};var e=t.eye||[0,0,1],r=t.center||[0,0,0],i=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],u=t.mode||"turntable",c=o(),h=a(),f=s();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,i),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,i),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,i),new n({turntable:c,orbit:h,matrix:f},u)}e.exports=i;var o=t("turntable-camera-controller"),a=t("orbit-camera-controller"),s=t("matrix-camera-controller"),l=n.prototype,u=[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]];u.forEach(function(t){for(var e=t[0],r=[],n=0;ne)){var r=this._active,n=this._controllerList[e],i=Math.max(r.lastT(),n.lastT());r.recalcMatrix(i),n.setMatrix(i,r.computedMatrix),this._active=n,this._mode=t,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}}},l.getMode=function(){return this._mode}},{"matrix-camera-controller":29,"orbit-camera-controller":38,"turntable-camera-controller":39}],41:[function(t,e,r){function n(t,e){return o(i(t,e))}e.exports=n;var i=t("alpha-complex"),o=t("simplicial-complex-boundary")},{"alpha-complex":42,"simplicial-complex-boundary":45}],42:[function(t,e,r){"use strict";function n(t,e){return i(e).filter(function(r){for(var n=new Array(r.length),i=0;ii;++i)r+=t[i]*e[i];return r}function i(t){var e=t.length;if(0===e)return[];var r=(t[0].length,a([t.length+1,t.length+1],1)),i=a([t.length+1],1);r[e][e]=0;for(var o=0;e>o;++o){for(var l=0;o>=l;++l)r[l][o]=r[o][l]=2*n(t[o],t[l]);i[o]=n(t[o],t[o])}for(var u=s(r,i),c=0,h=u[e+1],o=0;oo;++o){for(var h=u[o],p=0,l=0;ls;++s)r[s]+=t[o][s]*n[o];return r}var a=t("dup"),s=t("robust-linear-solve");o.barycenetric=i,e.exports=o},{dup:126,"robust-linear-solve":459}],45:[function(t,e,r){"use strict";function n(t){return o(i(t))}e.exports=n;var i=t("boundary-cells"),o=t("reduce-simplicial-complex")},{"boundary-cells":46,"reduce-simplicial-complex":49}],46:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r+=t[n].length;for(var i=new Array(r),o=0,n=0;e>n;++n)for(var a=t[n],s=a.length,l=0;s>l;++l)for(var u=i[o++]=new Array(s-1),c=1;s>c;++c)u[c-1]=a[(l+c)%s];return i}e.exports=n},{}],47:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;rn;++n)if(t[r]n;++n){var s=t[n],l=a(s);if(0!==l){if(r>0){var u=t[r-1];if(0===i(s,u)&&a(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),o=t("compare-oriented-cell"),a=t("cell-orientation");e.exports=n},{"cell-orientation":47,"compare-cell":112,"compare-oriented-cell":48}],50:[function(t,e,r){"use strict";var n=function(){function t(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t}function e(t,e,r){for(var n=(e-t)/Math.max(r-1,1),i=[],o=0;r>o;o++)i.push(t+o*n);return i}function r(){for(var t=[].slice.call(arguments),e=t.map(function(t){return t.length}),r=Math.min.apply(null,e),n=[],i=0;r>i;i++){n[i]=[];for(var o=0;oo;o++)i.push([t[o],e[o],r[o]]);return i}function i(t){function e(t){for(var n=0;n>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;3>i;++i)r[i]=r[i]/255;return r}function u(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;3>i;++i)r[i]=r[i]/255;return r}var c={},h=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,f=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return c.isPlainObject=t,c.linspace=e,c.zip3=n,c.sum=i,c.zip=r,c.isEqual=s,c.copy2D=o,c.copy1D=a,c.str2RgbArray=l,c.str2RgbaArray=u,c};e.exports=n()},{}],51:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<0)-(0>t)},r.abs=function(t){var e=t>>i-1;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(e>t)},r.max=function(t,e){return t^(t^e)&-(e>t)},r.isPow2=function(t){return!(t&t-1||!t)},r.log2=function(t){var e,r;return e=(t>65535)<<4,t>>>=e,r=(t>255)<<3,t>>>=r,e|=r,r=(t>15)<<2,t>>>=r,e|=r,r=(t>3)<<1,t>>>=r,e|=r,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var o=new Array(256);!function(t){for(var e=0;256>e;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|o[t>>>16&255]<<8|o[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],52:[function(t,e,r){(function(e){"use strict";function n(){try{var t=new Uint8Array(1);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function i(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t){return this instanceof o?(o.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof t?a(this,t):"string"==typeof t?s(this,t,arguments.length>1?arguments[1]:"utf8"):l(this,t)):arguments.length>1?new o(t,arguments[1]):new o(t)}function a(t,e){if(t=m(t,0>e?0:0|g(e)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;e>r;r++)t[r]=0;return t}function s(t,e,r){"string"==typeof r&&""!==r||(r="utf8");var n=0|y(e,r);return t=m(t,n),t.write(e,r),t}function l(t,e){if(o.isBuffer(e))return u(t,e);if(Q(e))return c(t,e);if(null==e)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(e.buffer instanceof ArrayBuffer)return h(t,e);if(e instanceof ArrayBuffer)return f(t,e)}return e.length?p(t,e):d(t,e)}function u(t,e){var r=0|g(e.length);return t=m(t,r),e.copy(t,0,0,r),t}function c(t,e){var r=0|g(e.length);t=m(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function h(t,e){var r=0|g(e.length);t=m(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function f(t,e){return e.byteLength,o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):t=h(t,new Uint8Array(e)),t}function p(t,e){var r=0|g(e.length);t=m(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function d(t,e){var r,n=0;"Buffer"===e.type&&Q(e.data)&&(r=e.data,n=0|g(r.length)),t=m(t,n);for(var i=0;n>i;i+=1)t[i]=255&r[i];return t}function m(t,e){o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):t.length=e;var r=0!==e&&e<=o.poolSize>>>1;return r&&(t.parent=K),t}function g(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function v(t,e){if(!(this instanceof v))return new v(t,e);var r=new o(t,e);return delete r.parent,r}function y(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function b(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return L(this,e,r);case"binary":return z(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function x(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new Error("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;n>a;a++){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");t[r+a]=s}return a}function _(t,e,r,n){return Y(q(e,t.length-r),t,r,n)}function w(t,e,r,n){return Y(G(e),t,r,n)}function M(t,e,r,n){return w(t,e,r,n)}function k(t,e,r,n){return Y(X(e),t,r,n)}function A(t,e,r,n){return Y(H(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?W.fromByteArray(t):W.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;r>i;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(r>=i+s){var l,u,c,h;switch(s){case 1:128>o&&(a=o);break;case 2:l=t[i+1],128===(192&l)&&(h=(31&o)<<6|63&l,h>127&&(a=h));break;case 3:l=t[i+1],u=t[i+2],128===(192&l)&&128===(192&u)&&(h=(15&o)<<12|(63&l)<<6|63&u,h>2047&&(55296>h||h>57343)&&(a=h));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(h=(15&o)<<18|(63&l)<<12|(63&u)<<6|63&c,h>65535&&1114112>h&&(a=h))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return S(n)}function S(t){var e=t.length;if(J>=e)return String.fromCharCode.apply(String,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=J));return r}function L(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(127&t[i]);return n}function z(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var i="",o=e;r>o;o++)i+=V(t[o]);return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;ot)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,i,a){if(!o.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>i||a>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range")}function j(t,e,r,n){0>e&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);o>i;i++)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function D(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);o>i;i++)t[r+i]=e>>>8*(n?i:3-i)&255}function O(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function F(t,e,r,n,i){return i||O(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,i){return i||O(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,r,n,52,8),r+8}function B(t){if(t=U(t).replace($,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function U(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function V(t){return 16>t?"0"+t.toString(16):t.toString(16)}function q(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;n>a;a++){if(r=t.charCodeAt(a),r>55295&&57344>r){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(56320>r){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,128>r){if((e-=1)<0)break;o.push(r)}else if(2048>r){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function X(t){return W.toByteArray(B(t))}function Y(t,e,r,n){for(var i=0;n>i&&!(i+r>=e.length||i>=t.length);i++)e[i+r]=t[i];return i}var W=t("base64-js"),Z=t("ieee754"),Q=t("isarray");r.Buffer=o,r.SlowBuffer=v,r.INSPECT_MAX_BYTES=50,o.poolSize=8192;var K={};o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),o._augment=function(t){return t.__proto__=o.prototype,t},o.TYPED_ARRAY_SUPPORT?(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})):(o.prototype.length=void 0,o.prototype.parent=void 0),o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);a>i&&t[i]===e[i];)++i;return i!==a&&(r=t[i],n=e[i]),n>r?-1:r>n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Q(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new o(0);var r;if(void 0===e)for(e=0,r=0;r0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},o.prototype.compare=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:o.compare(this,t)},o.prototype.indexOf=function(t,e){function r(t,e,r){for(var n=-1,i=0;r+i2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(o.isBuffer(t))return r(this,t,e);if("number"==typeof t)return o.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):r(this,[t],e);throw new TypeError("val must be string, number or Buffer")},o.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=e,e=0|r,r=i}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"binary":return M(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),t>e&&(e=t);var n;if(o.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=o.prototype;else{var i=e-t;n=new o(i,void 0);for(var a=0;i>a;a++)n[a]=this[a+t]}return n.length&&(n.parent=this.parent||this),n},o.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),Z.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),Z.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),Z.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),Z.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||R(this,t,e,r,Math.pow(2,8*r),0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=0,a=1,s=0>t?1:0;for(this[e]=255&t;++o>0)-s&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0>t?1:0;for(this[e+o]=255&t;--o>=0&&(a*=256);)this[e+o]=(t/a>>0)-s&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return F(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return F(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds"); +if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-er&&n>e)for(i=a-1;i>=0;i--)t[i+e]=this[i+r];else if(1e3>a||!o.TYPED_ARRAY_SUPPORT)for(i=0;a>i;i++)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a},o.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var i=q(t.toString()),o=i.length;for(n=e;r>n;n++)this[n]=i[n%o]}return this}};var $=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":53,ieee754:54,isarray:55}],53:[function(t,e,r){"use strict";function n(){var t,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=e.length;for(t=0;r>t;t++)l[t]=e[t];for(t=0;r>t;++t)u[e.charCodeAt(t)]=t;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63}function i(t){var e,r,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new c(3*s/4-o),n=o>0?s-4:s;var l=0;for(e=0,r=0;n>e;e+=4,r+=3)i=u[t.charCodeAt(e)]<<18|u[t.charCodeAt(e+1)]<<12|u[t.charCodeAt(e+2)]<<6|u[t.charCodeAt(e+3)],a[l++]=(16711680&i)>>16,a[l++]=(65280&i)>>8,a[l++]=255&i;return 2===o?(i=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[l++]=255&i):1===o&&(i=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}function o(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}function a(t,e,r){for(var n,i=[],a=e;r>a;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],i.push(o(n));return i.join("")}function s(t){for(var e,r=t.length,n=r%3,i="",o=[],s=16383,u=0,c=r-n;c>u;u+=s)o.push(a(t,u,u+s>c?c:u+s));return 1===n?(e=t[r-1],i+=l[e>>2],i+=l[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=l[e>>10],i+=l[e>>4&63],i+=l[e<<2&63],i+="="),o.push(i),o.join("")}r.toByteArray=i,r.fromByteArray=s;var l=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array;n()},{}],54:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,l=(1<>1,c=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,o=p&(1<<-c)-1,p>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:(p?-1:1)*(1/0);a+=Math.pow(2,n),o-=u}return(p?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,m=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),e+=a+h>=1?f/l:f*Math.pow(2,1-h),e*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<0;t[r+p]=255&a,p+=d,a/=256,u-=8);t[r+p-d]|=128*m}},{}],55:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],56:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function a(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,o,l,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],s(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),r.apply(this,o)}else if(a(r))for(o=Array.prototype.slice.call(arguments,1),u=r.slice(),n=u.length,l=0;n>l;l++)u[l].apply(this,o);return!0},n.prototype.addListener=function(t,e){var r;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(r=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],57:[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}},{}],58:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),o="/"===a(t,-1);return t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),o=n(e.split("/")),a=Math.min(i.length,o.length),s=a,l=0;a>l;l++)if(i[l]!==o[l]){s=l;break}for(var u=[],l=s;le&&(e=t.length+e),t.substr(e,r)}}).call(this,t("_process"))},{_process:59}],59:[function(t,e,r){function n(){c=!1,s.length?u=s.concat(u):h=-1,u.length&&i()}function i(){if(!c){var t=setTimeout(n);c=!0;for(var e=u.length;e;){for(s=u,u=[];++h1)for(var r=1;r1&&(n=r[0]+"@",t=r[1]),t=t.replace(C,".");var i=t.split("."),o=a(i,e).join(".");return n+o}function l(t){for(var e,r,n=[],i=0,o=t.length;o>i;)e=t.charCodeAt(i++),e>=55296&&56319>=e&&o>i?(r=t.charCodeAt(i++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--)):n.push(e);return n}function u(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=O(t>>>10&1023|55296),t=56320|1023&t),e+=O(t)}).join("")}function c(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:M}function h(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function f(t,e,r){var n=0;for(t=r?D(t/E):t>>1,t+=D(t/e);t>j*A>>1;n+=M)t=D(t/j);return D(n+(j+1)*t/(t+T))}function p(t){var e,r,n,i,a,s,l,h,p,d,m=[],g=t.length,v=0,y=L,b=S;for(r=t.lastIndexOf(z),0>r&&(r=0),n=0;r>n;++n)t.charCodeAt(n)>=128&&o("not-basic"),m.push(t.charCodeAt(n));for(i=r>0?r+1:0;g>i;){for(a=v,s=1,l=M;i>=g&&o("invalid-input"),h=c(t.charCodeAt(i++)),(h>=M||h>D((w-v)/s))&&o("overflow"),v+=h*s,p=b>=l?k:l>=b+A?A:l-b,!(p>h);l+=M)d=M-p,s>D(w/d)&&o("overflow"),s*=d;e=m.length+1,b=f(v-a,e,0==a),D(v/e)>w-y&&o("overflow"),y+=D(v/e),v%=e,m.splice(v++,0,y)}return u(m)}function d(t){var e,r,n,i,a,s,u,c,p,d,m,g,v,y,b,x=[];for(t=l(t),g=t.length,e=L,r=0,a=S,s=0;g>s;++s)m=t[s],128>m&&x.push(O(m));for(n=i=x.length,i&&x.push(z);g>n;){for(u=w,s=0;g>s;++s)m=t[s],m>=e&&u>m&&(u=m);for(v=n+1,u-e>D((w-r)/v)&&o("overflow"),r+=(u-e)*v,e=u,s=0;g>s;++s)if(m=t[s],e>m&&++r>w&&o("overflow"),m==e){for(c=r,p=M;d=a>=p?k:p>=a+A?A:p-a,!(d>c);p+=M)b=c-d,y=M-d,x.push(O(h(d+b%y,0))),c=D(b/y);x.push(O(h(c,0))),a=f(r,v,n==i),r=0,++n}++r,++e}return x.join("")}function m(t){return s(t,function(t){return I.test(t)?p(t.slice(4).toLowerCase()):t})}function g(t){return s(t,function(t){return P.test(t)?"xn--"+d(t):t})}var v="object"==typeof n&&n&&!n.nodeType&&n,y="object"==typeof r&&r&&!r.nodeType&&r,b="object"==typeof e&&e;b.global!==b&&b.window!==b&&b.self!==b||(i=b);var x,_,w=2147483647,M=36,k=1,A=26,T=38,E=700,S=72,L=128,z="-",I=/^xn--/,P=/[^\x20-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},j=M-k,D=Math.floor,O=String.fromCharCode;if(x={version:"1.3.2",ucs2:{decode:l,encode:u},decode:p,encode:d,toASCII:g,toUnicode:m},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return x});else if(v&&y)if(r.exports==v)y.exports=x;else for(_ in x)x.hasOwnProperty(_)&&(v[_]=x[_]);else i.punycode=x}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],61:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,o){e=e||"&",r=r||"=";var a={};if("string"!=typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var c=0;u>c;++c){var h,f,p,d,m=t[c].replace(s,"%20"),g=m.indexOf(r);g>=0?(h=m.substr(0,g),f=m.substr(g+1)):(h=m,f=""),p=decodeURIComponent(h),d=decodeURIComponent(f),n(a,p)?i(a[p])?a[p].push(d):a[p]=[a[p],d]:a[p]=d}return a};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],62:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n",'"',"`"," ","\r","\n"," "],d=["{","}","|","\\","^","`"].concat(p),m=["'"].concat(d),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],y=255,b=/^[+a-z0-9A-Z_-]{0,63}$/,x=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=t("querystring");n.prototype.parse=function(t,e,r){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),i=-1!==n&&nS)&&(T=S)}var L,z;z=-1===T?s.lastIndexOf("@"):s.lastIndexOf("@",T),-1!==z&&(L=s.slice(0,z),s=s.slice(z+1),this.auth=decodeURIComponent(L)),T=-1;for(var E=0;ES)&&(T=S)}-1===T&&(T=s.length),this.host=s.slice(0,T),s=s.slice(T),this.parseHost(),this.hostname=this.hostname||"";var I="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!I)for(var P=this.hostname.split(/\./),E=0,C=P.length;C>E;E++){var R=P[E];if(R&&!R.match(b)){for(var j="",D=0,O=R.length;O>D;D++)j+=R.charCodeAt(D)>127?"x":R[D];if(!j.match(b)){var F=P.slice(0,E),N=P.slice(E+1),B=R.match(x);B&&(F.push(B[1]),N.unshift(B[2])),N.length&&(s="/"+N.join(".")+s),this.hostname=F.join(".");break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=l.toASCII(this.hostname));var U=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+U,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[d])for(var E=0,C=m.length;C>E;E++){var q=m[E];if(-1!==s.indexOf(q)){var G=encodeURIComponent(q);G===q&&(G=escape(q)),s=s.split(q).join(G)}}var H=s.indexOf("#");-1!==H&&(this.hash=s.substr(H),s=s.slice(0,H));var X=s.indexOf("?");if(-1!==X?(this.search=s.substr(X),this.query=s.substr(X+1),e&&(this.query=k.parse(this.query)),s=s.slice(0,X)):e&&(this.search="",this.query={}),s&&(this.pathname=s),M[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var U=this.pathname||"",Y=this.search||"";this.path=U+Y}return this.href=this.format(),this},n.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,o="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&u.isObject(this.query)&&Object.keys(this.query).length&&(o=k.stringify(this.query));var a=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||M[e])&&i!==!1?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),r=r.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),a=a.replace("#","%23"),e+i+r+a+n},n.prototype.resolve=function(t){return this.resolveObject(i(t,!1,!0)).format()},n.prototype.resolveObject=function(t){if(u.isString(t)){var e=new n;e.parse(t,!1,!0),t=e}for(var r=new n,i=Object.keys(this),o=0;o0?r.host.split("@"):!1;A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return r.search=t.search,r.query=t.query,u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=_.slice(-1)[0],E=(r.host||t.host||_.length>1)&&("."===T||".."===T)||""===T,S=0,L=_.length;L>=0;L--)T=_[L],"."===T?_.splice(L,1):".."===T?(_.splice(L,1),S++):S&&(_.splice(L,1),S--);if(!b&&!x)for(;S--;S)_.unshift("..");!b||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),E&&"/"!==_.join("/").substr(-1)&&_.push("");var z=""===_[0]||_[0]&&"/"===_[0].charAt(0);if(k){r.hostname=r.host=z?"":_.length?_.shift():"";var A=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return b=b||r.host&&_.length,b&&!z&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":65,punycode:60,querystring:63}],65:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],66:[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}},{}],67:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:a};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(e)?n.showHidden=e:e&&r._extend(n,e),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),l(n,t,n.depth)}function o(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function a(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function l(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return b(i)||(i=l(t,i,n)),i}var o=u(t,e);if(o)return o;var a=Object.keys(e),m=s(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),A(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(e);if(0===a.length){if(T(e)){var g=e.name?": "+e.name:"";return t.stylize("[Function"+g+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(k(e))return t.stylize(Date.prototype.toString.call(e),"date");if(A(e))return c(e)}var v="",y=!1,x=["{","}"];if(d(e)&&(y=!0,x=["[","]"]),T(e)){var _=e.name?": "+e.name:"";v=" [Function"+_+"]"}if(w(e)&&(v=" "+RegExp.prototype.toString.call(e)),k(e)&&(v=" "+Date.prototype.toUTCString.call(e)),A(e)&&(v=" "+c(e)),0===a.length&&(!y||0==e.length))return x[0]+v+x[1];if(0>n)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?h(t,e,n,m,a):a.map(function(r){return f(t,e,n,m,r,y)}),t.seen.pop(),p(M,v,x)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var o=[],a=0,s=e.length;s>a;++a)I(e,String(a))?o.push(f(t,e,r,n,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(f(t,e,r,n,i,!0))}),o}function f(t,e,r,n,i,o){var a,s,u;if(u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},u.get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),I(n,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=g(r)?l(t,u.value,null):l(t,u.value,r-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n"))):s=t.stylize("[Circular]","special")),_(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function p(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function d(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function g(t){return null===t}function v(t){return null==t}function y(t){return"number"==typeof t}function b(t){return"string"==typeof t}function x(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===S(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===S(t)}function A(t){return M(t)&&("[object Error]"===S(t)||t instanceof Error)}function T(t){return"function"==typeof t}function E(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function S(t){return Object.prototype.toString.call(t)}function L(t){return 10>t?"0"+t.toString(10):t.toString(10)}function z(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),j[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var P=/%[sdj%]/g;r.format=function(t){if(!b(t)){for(var e=[],r=0;r=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return t}}),s=n[r];o>r;s=n[++r])a+=g(s)||!M(s)?" "+s:" "+i(s);return a},r.deprecate=function(t,i){function o(){if(!a){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),a=!0}return t.apply(this,arguments)}if(_(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var a=!1;return o};var C,R={};r.debuglog=function(t){if(_(C)&&(C=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!R[t])if(new RegExp("\\b"+t+"\\b","i").test(C)){var n=e.pid;R[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else R[t]=function(){};return R[t]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=d,r.isBoolean=m,r.isNull=g,r.isNullOrUndefined=v,r.isNumber=y,r.isString=b,r.isSymbol=x,r.isUndefined=_,r.isRegExp=w,r.isObject=M,r.isDate=k,r.isError=A,r.isFunction=T,r.isPrimitive=E,r.isBuffer=t("./support/isBuffer");var j=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",z(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!M(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":66,_process:59,inherits:57}],68:[function(t,e,r){"use strict";function n(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function i(t,e){return t[0]-e[0]||t[1]-e[1]}function o(t){return t.map(n).sort(i)}function a(t,e,r){return e in t?t[e]:r}function s(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var n=!!a(r,"delaunay",!0),i=!!a(r,"interior",!0),s=!!a(r,"exterior",!0),f=!!a(r,"infinity",!1);if(!i&&!s||0===t.length)return[];var p=l(t,e);if(n||i!==s||f){for(var d=u(t.length,o(e)),m=0;ms)){if(n>i){var l=n;n=i,i=l,l=a,a=s,s=l}e.isConstraint(n,i)||o(t[n],t[i],t[a],t[s])<0&&r.push(n,i)}}function i(t,e){for(var r=[],i=t.length,a=e.stars,s=0;i>s;++s)for(var l=a[s],u=1;uc||e.isConstraint(s,c))){for(var h=l[u-1],f=-1,p=1;pf||o(t[s],t[c],t[h],t[f])<0&&r.push(s,c)}}for(;r.length>0;){for(var c=r.pop(),s=r.pop(),h=-1,f=-1,l=a[s],d=1;dh||0>f||o(t[s],t[c],t[h],t[f])>=0||(e.flip(s,c),n(t,e,r,h,s,f),n(t,e,r,s,f,h),n(t,e,r,f,c,h),n(t,e,r,c,h,f))}}var o=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":73,"robust-in-sphere":74}],70:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=o,this.boundary=a}function i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function o(t,e){for(var r=t.cells(),o=r.length,a=0;o>a;++a){var s=r[a],l=s[0],u=s[1],c=s[2];c>u?l>u&&(s[0]=u,s[1]=c,s[2]=l):l>c&&(s[0]=c,s[1]=l,s[2]=u)}r.sort(i);for(var h=new Array(o),a=0;aa;++a)for(var s=r[a],y=0;3>y;++y){var l=s[y],u=s[(y+1)%3],b=d[3*a+y]=v.locate(u,l,t.opposite(u,l)),x=m[3*a+y]=t.isConstraint(l,u);0>b&&(x?p.push(a):(f.push(a),h[a]=1),e&&g.push([u,l,-1]))}return v}function a(t,e,r){for(var n=0,i=0;i0||l.length>0;){for(;s.length>0;){var p=s.pop();if(u[p]!==-i){u[p]=i;for(var d=(c[p],0);3>d;++d){var m=f[3*p+d];m>=0&&0===u[m]&&(h[3*p+d]?l.push(m):(s.push(m),u[m]=i))}}}var g=l;l=s,s=g,l.length=0,i=-i}var v=a(c,u,e);return r?v.concat(n.boundary):v}var l=t("binary-search-bounds");e.exports=s;var u=n.prototype;u.locate=function(){var t=[0,0,0];return function(e,r,n){var o=e,a=r,s=n;return n>r?e>r&&(o=r,a=n,s=e):e>n&&(o=n,a=e,s=r),0>o?-1:(t[0]=o,t[1]=a,t[2]=s,l.eq(this.cells,t,i))}}()},{"binary-search-bounds":73}],71:[function(t,e,r){"use strict"; +function n(t,e,r,n,i){this.a=t,this.b=e,this.idx=r,this.lowerIds=n,this.upperIds=i}function i(t,e,r,n){this.a=t,this.b=e,this.type=r,this.idx=n}function o(t,e){var r=t.a[0]-e.a[0]||t.a[1]-e.a[1]||t.type-e.type;return r?r:t.type!==d&&(r=p(t.a,t.b,e.b))?r:t.idx-e.idx}function a(t,e){return p(t.a,t.b,e)}function s(t,e,r,n,i){for(var o=f.lt(e,n,a),s=f.gt(e,n,a),l=o;s>l;++l){for(var u=e[l],c=u.lowerIds,h=c.length;h>1&&p(r[c[h-2]],r[c[h-1]],n)>0;)t.push([c[h-1],c[h-2],i]),h-=1;c.length=h,c.push(i);for(var d=u.upperIds,h=d.length;h>1&&p(r[d[h-2]],r[d[h-1]],n)<0;)t.push([d[h-2],d[h-1],i]),h-=1;d.length=h,d.push(i)}}function l(t,e){var r;return(r=t.a[0]h;++h)l.push(new i(t[h],null,d,h));for(var h=0;a>h;++h){var f=e[h],p=t[f[0]],v=t[f[1]];p[0]v[0]&&l.push(new i(v,p,g,h),new i(p,v,m,h))}l.sort(o);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],h=0,_=l.length;_>h;++h){var w=l[h],M=w.type;M===d?s(x,b,t,w.a,w.idx):M===g?u(b,t,w):c(b,t,w)}return x}var f=t("binary-search-bounds"),p=t("robust-orientation")[3],d=0,m=1,g=2;e.exports=h},{"binary-search-bounds":73,"robust-orientation":462}],72:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;i>n;n+=2)if(t[n-1]===e&&t[n]===r)return t[n-1]=t[i-2],t[n]=t[i-1],void(t.length=i-2)}function o(t,e){for(var r=new Array(t),i=0;t>i;++i)r[i]=[];return new n(r,e)}var a=t("binary-search-bounds");e.exports=o;var s=n.prototype;s.isConstraint=function(){function t(t,e){return t[0]-e[0]||t[1]-e[1]}var e=[0,0];return function(r,n){return e[0]=Math.min(r,n),e[1]=Math.max(r,n),a.eq(this.edges,e,t)>=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;i>n;n+=2)if(r[n]===t)return r[n-1];return-1},s.flip=function(t,e){var r=this.opposite(t,e),n=this.opposite(e,t);this.removeTriangle(t,e,r),this.removeTriangle(e,t,n),this.addTriangle(t,n,r),this.addTriangle(e,r,n)},s.edges=function(){for(var t=this.stars,e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;o+=2)e.push([i[o],i[o+1]]);return e},s.cells=function(){for(var t=this.stars,e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;o+=2){var s=i[o],l=i[o+1];r>>1,x=a[m]"];return i?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){var o=new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""));return o()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],74:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-2,"]"].join("")}return e}function o(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function a(t,e){if("m"===t.charAt(0)){if("w"===e.charAt(0)){var r=t.split("[");return["w",e.substr(1),"m",r[0].substr(1)].join("")}return["prod(",t,",",e,")"].join("")}return a(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",a(t[0][0],t[1][1]),",",a(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;rn;++n)r.push(["prod(m",t,"[",n,"],m",t,"[",n,"])"].join(""));return o(r)}function c(t){for(var e=[],r=[],a=i(t),s=0;t>s;++s)a[0][s]="1",a[t-1][s]="w"+s;for(var s=0;t>s;++s)0===(1&s)?e.push.apply(e,l(n(a,s))):r.push.apply(r,l(n(a,s)));for(var c=o(e),h=o(r),f="exactInSphere"+t,p=[],s=0;t>s;++s)p.push("m"+s);for(var d=["function ",f,"(",p.join(),"){"],s=0;t>s;++s){d.push("var w",s,"=",u(s,t),";");for(var m=0;t>m;++m)m!==s&&d.push("var w",s,"m",m,"=scale(w",s,",m",m,"[0]);")}d.push("var p=",c,",n=",h,",d=diff(p,n);return d[d.length-1];}return ",f);var x=new Function("sum","diff","prod","scale",d.join(""));return x(v,y,g,b)}function h(){return 0}function f(){return 0}function p(){return 0}function d(t){var e=_[t.length];return e||(e=_[t.length]=c(t.length)),e.apply(void 0,t)}function m(){for(;_.length<=x;)_.push(c(_.length));for(var t=[],r=["slow"],n=0;x>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function testInSphere(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;x>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i=n;++n)e.exports[n]=_[n]}var g=t("two-product"),v=t("robust-sum"),y=t("robust-subtract"),b=t("robust-scale"),x=6,_=[h,f,p];m()},{"robust-scale":463,"robust-subtract":464,"robust-sum":465,"two-product":479}],75:[function(t,e,r){"use strict";function n(t){var e=x(t),r=b(y(e),t);return 0>r?[e,w(e,1/0)]:r>0?[w(e,-(1/0)),e]:[e,e]}function i(t,e){for(var r=new Array(e.length),n=0;n=t.length)return a[e-t.length];var r=t[e];return[y(r[0]),y(r[1])]}for(var a=[],s=0;s=0;--s){var m=n[s],u=m[0],g=e[u],v=g[0],x=g[1],w=t[v],k=t[x];if((w[0]-k[0]||w[1]-k[1])<0){var A=v;v=x,x=A}g[0]=v;var T,E=g[1]=m[1];for(i&&(T=g[2]);s>0&&n[s-1][0]===u;){var m=n[--s],S=m[1];i?e.push([E,S,T]):e.push([E,S]),E=S}i?e.push([E,x,T]):e.push([E,x])}return a}function u(t,e,r){for(var i=t.length+e.length,o=new m(i),a=r,s=0;ss;++s){var d=o.find(s);d===s?(p[s]=h,t[h++]=t[s]):(f=!1,p[s]=-1)}if(t.length=h,f)return null;for(var s=0;i>s;++s)p[s]<0&&(p[s]=p[o.find(s)]);return p}function c(t,e){return t[0]-e[0]||t[1]-e[1]}function h(t,e){var r=t[0]-e[0]||t[1]-e[1];return r?r:t[2]e[2]?1:0}function f(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||p.length>0}function d(t,e,r){var n,i=!1;if(r){n=e;for(var o=new Array(e.length),a=0;a0?r=r.shln(h):0>h&&(c=c.shln(-h)),l(r,c)}var i=t("./is-rat"),o=t("./lib/is-bn"),a=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":79,"./is-rat":81,"./lib/is-bn":85,"./lib/num-to-bn":86,"./lib/rationalize":87,"./lib/str-to-bn":88}],81:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":85}],82:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":90}],83:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;e>i;i++){var o=r[i];n+=o*Math.pow(67108864,i)}return t.sign?-n:n}e.exports=n},{}],84:[function(t,e,r){"use strict";function n(t){var e=o(i.lo(t));if(32>e)return e;var r=o(i.hi(t));return r>20?52:r+32}var i=t("double-bits"),o=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":51,"double-bits":101}],85:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":90}],86:[function(t,e,r){"use strict";function n(t){var e=o.exponent(t);return 52>e?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),o=t("double-bits");e.exports=n},{"bn.js":90,"double-bits":101}],87:[function(t,e,r){"use strict";function n(t,e){var r=o(t),n=o(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];0>n&&(t=t.neg(),e=e.neg());var a=t.gcd(e);return a.cmpn(1)?[t.div(a),e.div(a)]:[t,e]}var i=t("./num-to-bn"),o=t("./bn-sign");e.exports=n},{"./bn-sign":82,"./num-to-bn":86}],88:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":90}],89:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":87}],90:[function(t,e,r){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==e&&"be"!==e||(r=e,e=10),void(null!==t&&this._init(t||0,e||10,r||"be")))}function o(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;i>o;o++){var a=t.charCodeAt(o)-48;n<<=4,n|=a>=49&&54>=a?a-49+10:a>=17&&22>=a?a-17+10:15&a}return n}function a(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;o>a;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}function s(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function u(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function c(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function h(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function f(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function p(t){f.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&36>=e),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){0>t&&(this.sign=!0,t=-t),67108864>t?(this.words=[67108863&t],this.length=1):4503599627370496>t?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(9007199254740992>t),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var s=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[a]|=s<>>26-o&67108863,o+=24,o>=26&&(o-=26,a++)}else if("le"===n)for(var i=0,a=0;i>>26-o&67108863,o+=24,o>=26&&(o-=26,a++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6){var a=o(t,r,r+6);this.words[i]|=a<>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){var a=o(t,e,r+6);this.words[i]|=a<>>26-n&4194303}this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;67108863>=i;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,l=Math.min(o,o-s)+r,u=0,c=r;l>c;c+=n)u=a(t,c,c+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){for(var h=1,u=a(t,c,t.length,e),c=0;s>c;c++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?""};var d=["","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"],m=[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],g=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,o=0,a=0;a>>24-i&16777215,n=0!==o||a!==this.length-1?d[6-l.length]+l+n:l+n,i+=2,i>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&36>=t){var u=m[t],c=g[t],n="",h=this.clone();for(h.sign=!1;0!==h.cmpn(0);){var f=h.modn(c).toString(t);h=h.idivn(c),n=0!==h.cmpn(0)?d[u-f.length]+f+n:f+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(t){this.strip();var e=new Array(this.byteLength());e[0]=0;var r=this.clone();if("le"!==t)for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[e.length-n-1]=i}else for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[n]=i}return e},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},i.prototype.bitLength=function(){var t=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function(t){this.sign=this.sign||t.sign;var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26}for(;0!==i&&o>>26}if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e}for(;0!==o&&a>26,this.words[a]=67108863&e}if(0===o&&a>>26,o=67108863&r,a=Math.min(n,t.length-1),s=Math.max(0,n-this.length+1);a>=s;s++){var l=n-s,u=0|this.words[l],c=0|t.words[s],h=u*c,f=67108863&h;i=i+(h/67108864|0)|0,f=f+o|0,o=67108863&f,i=i+(f>>>26)|0}e.words[n]=o,r=i}return 0!==r?e.words[n]=r:e.length--,e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i=l;l++){var u=i-l,c=0|this.words[u],h=0|t.words[l],f=c*h,p=67108863&f;o=o+(f/67108864|0)|0,p=p+a|0,a=67108863&p,o=o+(p>>>26)|0,n+=o>>>26,o&=67108863}e.words[i]=a,r=o,o=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,o=0,a=Math.min(n,r-1),s=Math.max(0,n-e+1);a>=s;s++){var l=n-s,u=this.words[l],c=t.words[s],h=u*c,f=67108863&h;i+=h/67108864|0,f+=o,o=67108863&f,i+=f>>>26}this.words[n]=o,this.words[n+1]+=i,i=0}for(var i=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var o=0,a=0;a>>26-e}o&&(this.words[a]=o,this.length++)}if(0!==n){for(var a=this.length-1;a>=0;a--)this.words[a+n]=this.words[a];for(var a=0;n>a;a++)this.words[a]=0;this.length+=n}return this.strip()},i.prototype.ishrn=function(t,e,n){r("number"==typeof t&&t>=0);var i;i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<u;u++)l.words[u]=this.words[u];l.length=a}if(0===a);else if(this.length>a){this.length-=a;for(var u=0;u=0&&(0!==c||u>=i);u--){var h=this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<t?this.isubn(-t):this.sign?1===this.length&&this.words[0]=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),0>t)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&l}for(;i>26,this.words[i+n]=67108863&l}if(0===s)return this.strip();r(-1===s),s=0;for(var i=0;i>26,this.words[i]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),o=t,a=o.words[o.length-1],s=this._countBits(a);r=26-s,0!==r&&(o=o.shln(r),n.ishln(r),a=o.words[o.length-1]);var l,u=n.length-o.length;if("mod"!==e){l=new i(null),l.length=u+1,l.words=new Array(l.length);for(var c=0;c=0;f--){var p=67108864*n.words[o.length+f]+n.words[o.length+f-1];for(p=Math.min(p/a|0,67108863),n._ishlnsubmul(o,p,f);n.sign;)p--,n.sign=!1,n._ishlnsubmul(o,1,f),0!==n.cmpn(0)&&(n.sign=!n.sign);l&&(l.words[f]=p)}return l&&l.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:l?l:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,o,a=this.neg().divmod(t,e);return"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=0===a.mod.cmpn(0)?a.mod:t.sub(a.mod)),{div:n,mod:o}}if(!this.sign&&t.sign){var n,a=this.divmod(t.neg(),e);return"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),o=r.cmp(n);return 0>o||1===i&&0===o?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(67108863>=t);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(67108863>=t);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++u;for(var c=n.clone(),h=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),o.isEven()&&a.isEven()?(o.ishrn(1),a.ishrn(1)):(o.iadd(c).ishrn(1),a.isub(h).ishrn(1));for(;n.isEven();)n.ishrn(1),s.isEven()&&l.isEven()?(s.ishrn(1),l.ishrn(1)):(s.iadd(c).ishrn(1),l.isub(h).ishrn(1));e.cmp(n)>=0?(e.isub(n),o.isub(s),a.isub(l)):(n.isub(e),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:n.ishln(u)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var o=new i(1),a=new i(0),s=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);for(;n.isEven();)n.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a)):(n.isub(e),a.isub(o))}return 0===e.cmpn(1)?o:a},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(0>i){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<o;o++)this.words[o]=0;return this.words[n]|=i,this.length=n+1,this}for(var a=i,o=n;0!==a&&o>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},i.prototype.cmpn=function(t){var e=0>t;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip(); +var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:t>n?-1:1}return this.sign&&(r=-r),r},i.prototype.cmp=function(t){if(this.sign&&!t.sign)return-1;if(!this.sign&&t.sign)return 1;var e=this.ucmp(t);return this.sign?-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){i>n?e=-1:n>i&&(e=1);break}}return e},i.red=function(t){return new f(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},s.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},s.prototype.split=function(t,e){t.ishrn(this.n,0,e)},s.prototype.imulK=function(t){return t.imul(this.k)},n(l,s),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;n>i;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];e.words[e.length++]=o&r;for(var i=10;i>>22,o=a}t.words[i-10]=o>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function y(t){if(v[t])return v[t];var y;if("k256"===t)y=new l;else if("p224"===t)y=new u;else if("p192"===t)y=new c;else{if("p25519"!==t)throw new Error("Unknown prime "+t);y=new h}return v[t]=y,y},f.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},f.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},f.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},f.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},f.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},f.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},f.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},f.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},f.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},f.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},f.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},f.prototype.isqr=function(t){return this.imul(t,t)},f.prototype.sqr=function(t){return this.mul(t,t)},f.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),o=this.pow(t,n);return o}for(var a=this.m.subn(1),s=0;0!==a.cmpn(0)&&0===a.andln(1);)s++,a.ishrn(1);r(0!==a.cmpn(0));var l=new i(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,a),o=this.pow(t,a.addn(1).ishrn(1)),p=this.pow(t,a),d=s;0!==p.cmp(l);){for(var m=p,g=0;0!==m.cmp(l);g++)m=m.redSqr();r(d>g);var v=this.pow(f,new i(1).ishln(d-g-1));o=o.redMul(v),f=v.redSqr(),p=p.redMul(f),d=g}return o},f.prototype.invm=function(t){var e=t._invmp(this.m);return e.sign?(e.sign=!1,this.imod(e).redNeg()):this.imod(e)},f.prototype.pow=function(t,e){var r=[];if(0===e.cmpn(0))return new i(1);for(var n=e.clone();0!==n.cmpn(0);)r.push(n.andln(1)),n.ishrn(1);for(var o=t,a=0;a=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},p.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).ishrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},p.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],91:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":82}],92:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":87}],93:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),a=n.div,s=i(a),l=n.mod;if(0===l.cmpn(0))return s;if(s){var u=o(s)+4,c=i(l.shln(u).divRound(r));return 0>s&&(c=-c),s+c*Math.pow(2,-u)}var h=r.bitLength()-l.bitLength()+53,c=i(l.shln(h).divRound(r));return 1023>h?c*Math.pow(2,-h):(c*=Math.pow(2,-1023),c*Math.pow(2,1023-h))}var i=t("./lib/bn-to-num"),o=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":83,"./lib/ctz":84}],94:[function(t,e,r){"use strict";function n(t,e){for(var r=0;t>r;++r)if(!(e[r]<=e[r+t]))return!0;return!1}function i(t,e,r,i){for(var o=0,a=0,s=0,l=t.length;l>s;++s){var u=t[s];if(!n(e,u)){for(var c=0;2*e>c;++c)r[o++]=u[c];i[a++]=s}}return a}function o(t,e,r,n){var o=t.length,a=e.length;if(!(0>=o||0>=a)){var s=t[0].length>>>1;if(!(0>=s)){var l,u=h.mallocDouble(2*s*o),c=h.mallocInt32(o);if(o=i(t,s,u,c),o>0){if(1===s&&n)f.init(o),l=f.sweepComplete(s,r,0,o,u,c,0,o,u,c);else{var d=h.mallocDouble(2*s*a),m=h.mallocInt32(a);a=i(e,s,d,m),a>0&&(f.init(o+a),l=1===s?f.sweepBipartite(s,r,0,o,u,c,0,a,d,m):p(s,r,n,o,u,c,a,d,m),h.free(d),h.free(m))}h.free(u),h.free(c)}return l}}}function a(t,e){c.push([t,e])}function s(t){return c=[],o(t,t,a,!0),c}function l(t,e){return c=[],o(t,e,a,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?o(t,t,e,!0):l(t,e);case 3:return o(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,h=t("typedarray-pool"),f=t("./lib/sweep"),p=t("./lib/intersect")},{"./lib/intersect":96,"./lib/sweep":100,"typedarray-pool":481}],95:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",u,"=2*",o,";"],l="for(var i="+c+","+d+"="+u+"*"+c+";i<"+h+";++i,"+d+"+="+u+"){var x0="+f+"["+a+"+"+d+"],x1="+f+"["+a+"+"+d+"+"+o+"],xi="+p+"[i];",M="for(var j="+m+","+b+"="+u+"*"+m+";j<"+g+";++j,"+b+"+="+u+"){var y0="+v+"["+a+"+"+b+"],"+(r?"y1="+v+"["+a+"+"+b+"+"+o+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",M):i.push(M,_,":",l),r?i.push("if(y1"+g+"-"+m+"){"),t?(e(!0,!1),a.push("}else{"),e(!1,!1)):(a.push("if("+l+"){"),e(!0,!0),a.push("}else{"),e(!0,!1),a.push("}}else{if("+l+"){"),e(!1,!0),a.push("}else{"),e(!1,!1),a.push("}")),a.push("}}return "+r);var s=i.join("")+a.join(""),u=new Function(s);return u()}var o="d",a="ax",s="vv",l="fp",u="es",c="rs",h="re",f="rb",p="ri",d="rp",m="bs",g="be",v="bb",y="bi",b="bp",x="rv",_="Q",w=[o,a,s,c,h,f,p,m,g,v,y];r.partial=i(!1),r.full=i(!0)},{}],96:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(A*r);S.lengthL&&(l.free(L),L=l.mallocDouble(i))}function i(t,e,r,n,i,o,a,s,l){var u=A*t;S[u]=e,S[u+1]=r,S[u+2]=n,S[u+3]=i,S[u+4]=o,S[u+5]=a;var c=T*t;L[c]=s,L[c+1]=l}function o(t,e,r,n,i,o,a,s,l,u,c){var h=2*t,f=l*h,p=u[f+e];t:for(var d=i,m=i*h;o>d;++d,m+=h){var g=a[m+e],v=a[m+e+t];if(!(g>p||p>v||n&&p===g)){for(var y=s[d],b=e+1;t>b;++b){var g=a[m+b],v=a[m+b+t],x=u[f+b],_=u[f+b+t];if(x>v||g>_)continue t}var w;if(w=n?r(c,y):r(y,c),void 0!==w)return w}}}function a(t,e,r,n,i,o,a,s,l,u){var c=2*t,h=s*c,f=l[h+e];t:for(var p=n,d=n*c;i>p;++p,d+=c){var m=a[p];if(m!==u){var g=o[d+e],v=o[d+e+t];if(!(g>f||f>v)){for(var y=e+1;t>y;++y){var g=o[d+y],v=o[d+y+t],b=l[h+y],x=l[h+y+t];if(b>v||g>x)continue t}var _=r(m,u);if(void 0!==_)return _}}}}function s(t,e,r,s,l,u,c,m,E){n(t,s+c);var z,I=0,P=2*t;for(i(I++,0,0,s,0,c,r?16:0,-(1/0),1/0),r||i(I++,0,0,c,0,s,1,-(1/0),1/0);I>0;){I-=1;var C=I*A,R=S[C],j=S[C+1],D=S[C+2],O=S[C+3],F=S[C+4],N=S[C+5],B=I*T,U=L[B],V=L[B+1],q=1&N,G=!!(16&N),H=l,X=u,Y=m,W=E;if(q&&(H=m,X=E,Y=l,W=u),!(2&N&&(D=_(t,R,j,D,H,X,V),j>=D)||4&N&&(j=w(t,R,j,D,H,X,U),j>=D))){var Z=D-j,Q=F-O;if(G){if(y>t*Z*(Z+Q)){if(z=p.scanComplete(t,R,e,j,D,H,X,O,F,Y,W),void 0!==z)return z;continue}}else{if(t*Math.min(Z,Q)t*Z*Q){if(z=p.scanBipartite(t,R,e,q,j,D,H,X,O,F,Y,W),void 0!==z)return z;continue}}var K=b(t,R,j,D,H,X,U,V);if(K>j)if(g>t*(K-j)){if(z=f(t,R+1,e,j,K,H,X,O,F,Y,W),void 0!==z)return z}else if(R===t-2){if(z=q?p.sweepBipartite(t,e,O,F,Y,W,j,K,H,X):p.sweepBipartite(t,e,j,K,H,X,O,F,Y,W),void 0!==z)return z}else i(I++,R+1,j,K,O,F,q,-(1/0),1/0),i(I++,R+1,O,F,j,K,1^q,-(1/0),1/0);if(D>K){var J=d(t,R,O,F,Y,W),$=Y[P*J+R],tt=x(t,R,J,F,Y,W,$);if(F>tt&&i(I++,R,K,D,tt,F,(4|q)+(G?16:0),$,V),J>O&&i(I++,R,K,D,O,J,(2|q)+(G?16:0),U,$),J+1===tt){if(z=G?a(t,R,e,K,D,H,X,J,Y,W[J]):o(t,R,e,q,K,D,H,X,J,Y,W[J]),void 0!==z)return z}else if(tt>J){var et;if(G){if(et=M(t,R,K,D,H,X,$),et>K){var rt=x(t,R,K,et,H,X,$);if(R===t-2){if(rt>K&&(z=p.sweepComplete(t,e,K,rt,H,X,J,tt,Y,W),void 0!==z))return z;if(et>rt&&(z=p.sweepBipartite(t,e,rt,et,H,X,J,tt,Y,W),void 0!==z))return z}else rt>K&&i(I++,R+1,K,rt,J,tt,16,-(1/0),1/0),et>rt&&(i(I++,R+1,rt,et,J,tt,0,-(1/0),1/0),i(I++,R+1,J,tt,rt,et,1,-(1/0),1/0))}}else et=q?k(t,R,K,D,H,X,$):M(t,R,K,D,H,X,$),et>K&&(R===t-2?z=q?p.sweepBipartite(t,e,J,tt,Y,W,K,et,H,X):p.sweepBipartite(t,e,K,et,H,X,J,tt,Y,W):(i(I++,R+1,K,et,J,tt,q,-(1/0),1/0),i(I++,R+1,J,tt,K,et,1^q,-(1/0),1/0)))}}}}}e.exports=s;var l=t("typedarray-pool"),u=t("bit-twiddle"),c=t("./brute"),h=c.partial,f=c.full,p=t("./sweep"),d=t("./median"),m=t("./partition"),g=128,v=1<<22,y=1<<22,b=m("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),x=m("lo===p0",["p0"]),_=m("lol;++l,s+=a)for(var u=i[s],c=l,h=a*(l-1);c>r&&i[h+e]>u;--c,h-=a){for(var f=h,p=h+a,d=0;a>d;++d,++f,++p){var m=i[f];i[f]=i[p],i[p]=m}var g=o[c];o[c]=o[c-1],o[c-1]=g}}function i(t,e,r,i,o,l){if(r+1>=i)return r;for(var u=r,c=i,h=i+r>>>1,f=2*t,p=h,d=o[f*h+e];c>u;){if(s>c-u){n(t,e,u,c,o,l),d=o[f*h+e];break}var m=c-u,g=Math.random()*m+u|0,v=o[f*g+e],y=Math.random()*m+u|0,b=o[f*y+e],x=Math.random()*m+u|0,_=o[f*x+e];b>=v?_>=b?(p=y,d=b):v>=_?(p=g,d=v):(p=x,d=_):b>=_?(p=y,d=b):_>=v?(p=g,d=v):(p=x,d=_);for(var w=f*(c-1),M=f*p,k=0;f>k;++k,++w,++M){var A=o[w];o[w]=o[M],o[M]=A}var T=l[c-1];l[c-1]=l[p],l[p]=T,p=a(t,e,u,c-1,o,l,d);for(var w=f*(c-1),M=f*p,k=0;f>k;++k,++w,++M){var A=o[w];o[w]=o[M],o[M]=A}var T=l[c-1];if(l[c-1]=l[p],l[p]=T,p>h){for(c=p-1;c>u&&o[f*(c-1)+e]===d;)c-=1;c+=1}else{if(!(h>p))break;for(u=p+1;c>u&&o[f*u+e]===d;)u+=1}}return a(t,e,r,h,o,l,o[f*h+e])}e.exports=i;var o=t("./partition"),a=o("lo=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],99:[function(t,e,r){"use strict";function n(t,e){4*f>=e?i(0,e-1,t):h(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;e>=i;++i){for(var o=r[n++],a=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(o>u)break;if(u===o&&a>c)break;r[l]=u,r[l+1]=c,l-=2}r[l]=o,r[l+1]=a}}function o(t,e,r){t*=2,e*=2;var n=r[t],i=r[t+1];r[t]=r[e],r[t+1]=r[e+1],r[e]=n,r[e+1]=i}function a(t,e,r){t*=2,e*=2,r[t]=r[e],r[t+1]=r[e+1]}function s(t,e,r,n){t*=2,e*=2,r*=2;var i=n[t],o=n[t+1];n[t]=n[e],n[t+1]=n[e+1],n[e]=n[r],n[e+1]=n[r+1],n[r]=i,n[r+1]=o}function l(t,e,r,n,i){t*=2,e*=2,i[t]=i[e],i[e]=r,i[t+1]=i[e+1],i[e+1]=n}function u(t,e,r){t*=2,e*=2;var n=r[t],i=r[e];return i>n?!1:n===i?r[t+1]>r[e+1]:!0}function c(t,e,r,n){t*=2;var i=n[t];return e>i?!0:i===e?n[t+1]>1,g=m-n,v=m+n,y=p,b=g,x=m,_=v,w=d,M=t+1,k=e-1,A=0;u(y,b,r)&&(A=y,y=b,b=A),u(_,w,r)&&(A=_,_=w,w=A),u(y,x,r)&&(A=y,y=x,x=A),u(b,x,r)&&(A=b,b=x,x=A),u(y,_,r)&&(A=y,y=_,_=A),u(x,_,r)&&(A=x,x=_,_=A),u(b,w,r)&&(A=b,b=w,w=A),u(b,x,r)&&(A=b,b=x,x=A),u(_,w,r)&&(A=_,_=w,w=A);for(var T=r[2*b],E=r[2*b+1],S=r[2*_],L=r[2*_+1],z=2*y,I=2*x,P=2*w,C=2*p,R=2*m,j=2*d,D=0;2>D;++D){var O=r[z+D],F=r[I+D],N=r[P+D];r[C+D]=O,r[R+D]=F,r[j+D]=N}a(g,t,r),a(v,e,r);for(var B=M;k>=B;++B)if(c(B,T,E,r))B!==M&&o(B,M,r),++M;else if(!c(B,S,L,r))for(;;){if(c(k,S,L,r)){c(k,T,E,r)?(s(B,M,k,r),++M,--k):(o(B,k,r),--k);break}if(--k=M-2-t?i(t,M-2,r):h(t,M-2,r),f>=e-(k+2)?i(k+2,e,r):h(k+2,e,r),f>=k-M?i(M,k,r):h(M,k,r)}e.exports=n;var f=32},{}],100:[function(t,e,r){"use strict";function n(t){var e=h.nextPow2(t);m.lengthM;++M){var k=s[M],A=b*M;_[d++]=a[A+x],_[d++]=-(k+1),_[d++]=a[A+w],_[d++]=k}for(var M=l;u>M;++M){var k=h[M]+p,T=b*M;_[d++]=c[T+x],_[d++]=-k,_[d++]=c[T+w],_[d++]=k}var E=d>>>1;f(_,E);for(var S=0,L=0,M=0;E>M;++M){var z=0|_[2*M+1];if(z>=p)z=z-p|0,i(v,y,L--,z);else if(z>=0)i(m,g,S--,z);else if(-p>=z){z=-z-p|0;for(var I=0;S>I;++I){var P=e(m[I],z);if(void 0!==P)return P}o(v,y,L++,z)}else{z=-z-1|0;for(var I=0;L>I;++I){var P=e(z,v[I]);if(void 0!==P)return P}o(m,g,S++,z)}}}function s(t,e,r,n,a,s,l,u,c,h){for(var p=0,d=2*t,w=t-1,M=d-1,k=r;n>k;++k){var A=s[k]+1<<1,T=d*k;_[p++]=a[T+w],_[p++]=-A,_[p++]=a[T+M],_[p++]=A}for(var k=l;u>k;++k){var A=h[k]+1<<1,E=d*k;_[p++]=c[E+w],_[p++]=1|-A,_[p++]=c[E+M],_[p++]=1|A}var S=p>>>1;f(_,S);for(var L=0,z=0,I=0,k=0;S>k;++k){var P=0|_[2*k+1],C=1&P;if(S-1>k&&P>>1===_[2*k+3]>>1&&(C=2,k+=1),0>P){for(var R=-(P>>1)-1,j=0;I>j;++j){var D=e(b[j],R);if(void 0!==D)return D}if(0!==C)for(var j=0;L>j;++j){var D=e(m[j],R);if(void 0!==D)return D}if(1!==C)for(var j=0;z>j;++j){var D=e(v[j],R);if(void 0!==D)return D}0===C?o(m,g,L++,R):1===C?o(v,y,z++,R):2===C&&o(b,x,I++,R)}else{var R=(P>>1)-1;0===C?i(m,g,L--,R):1===C?i(v,y,z--,R):2===C&&i(b,x,I--,R)}}}function l(t,e,r,n,a,s,l,u,c,h,d,v){var y=0,b=2*t,x=e,w=e+t,M=1,k=1;n?k=p:M=p;for(var A=a;s>A;++A){var T=A+M,E=b*A;_[y++]=l[E+x],_[y++]=-T,_[y++]=l[E+w],_[y++]=T}for(var A=c;h>A;++A){var T=A+k,S=b*A;_[y++]=d[S+x],_[y++]=-T}var L=y>>>1;f(_,L);for(var z=0,A=0;L>A;++A){var I=0|_[2*A+1];if(0>I){var T=-I,P=!1;if(T>=p?(P=!n,T-=p):(P=!!n,T-=1),P)o(m,g,z++,T);else{var C=v[T],R=b*T,j=d[R+e+1],D=d[R+e+1+t];t:for(var O=0;z>O;++O){var F=m[O],N=b*F;if(!(DB;++B)if(d[R+B+t]y;++y){var b=y+p,x=d*y;_[h++]=o[x+g],_[h++]=-b,_[h++]=o[x+v],_[h++]=b}for(var y=s;l>y;++y){var b=y+1,w=d*y;_[h++]=u[w+g],_[h++]=-b}var M=h>>>1;f(_,M);for(var k=0,y=0;M>y;++y){var A=0|_[2*y+1];if(0>A){var b=-A;if(b>=p)m[k++]=b-p;else{b-=1;var T=c[b],E=d*b,S=u[E+e+1],L=u[E+e+1+t];t:for(var z=0;k>z;++z){var I=m[z],P=a[I];if(P===T)break;var C=d*I;if(!(LR;++R)if(u[E+R+t]=0;--z)if(m[z]===b){for(var R=z+1;k>R;++R)m[R-1]=m[R];break}--k}}}e.exports={init:n,sweepBipartite:a,sweepComplete:s,scanBipartite:l,scanComplete:u};var c=t("typedarray-pool"),h=t("bit-twiddle"),f=t("./sort"),p=1<<28,d=1024,m=c.mallocInt32(d),g=c.mallocInt32(d),v=c.mallocInt32(d),y=c.mallocInt32(d),b=c.mallocInt32(d),x=c.mallocInt32(d),_=c.mallocDouble(8*d)},{"./sort":99,"bit-twiddle":51,"typedarray-pool":481}],101:[function(t,e,r){(function(t){function r(t,e){return p[0]=t,p[1]=e,f[0]}function n(t){return f[0]=t,p[0]}function i(t){return f[0]=t,p[1]}function o(t,e){return p[1]=t,p[0]=e,f[0]}function a(t){return f[0]=t,p[1]}function s(t){return f[0]=t,p[0]}function l(t,e){return d.writeUInt32LE(t,0,!0),d.writeUInt32LE(e,4,!0),d.readDoubleLE(0,!0)}function u(t){return d.writeDoubleLE(t,0,!0),d.readUInt32LE(0,!0)}function c(t){return d.writeDoubleLE(t,0,!0),d.readUInt32LE(4,!0)}var h=!1;if("undefined"!=typeof Float64Array){var f=new Float64Array(1),p=new Uint32Array(f.buffer);f[0]=1,h=!0,1072693248===p[1]?(e.exports=function(t){return f[0]=t,[p[0],p[1]]},e.exports.pack=r,e.exports.lo=n,e.exports.hi=i):1072693248===p[0]?(e.exports=function(t){return f[0]=t,[p[1],p[0]]},e.exports.pack=o,e.exports.lo=a,e.exports.hi=s):h=!1}if(!h){var d=new t(8);e.exports=function(t){return d.writeDoubleLE(t,0,!0),[d.readUInt32LE(0,!0),d.readUInt32LE(4,!0)]},e.exports.pack=l,e.exports.lo=u,e.exports.hi=c}e.exports.sign=function(t){return e.exports.hi(t)>>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:52}],102:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return 0>e?-o:o;var r=i.hi(t),n=i.lo(t);return e>t==t>0?n===a?(r+=1,n=0):n+=1:0===n?(n=a,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),o=Math.pow(2,-1074),a=-1>>>0;e.exports=n},{"double-bits":101}],103:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),o=0;r>o;++o)n[o]=i(t[o],e[o]);return n}var i=t("big-rat/add");e.exports=n},{"big-rat/add":77}],104:[function(t,e,r){"use strict";function n(t){for(var e=new Array(t.length),r=0;rs;++s)a[s]=o(t[s],r);return a}var i=t("big-rat"),o=t("big-rat/mul");e.exports=n},{"big-rat":80,"big-rat/mul":89}],106:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),o=0;r>o;++o)n[o]=i(t[o],e[o]);return n}var i=t("big-rat/sub");e.exports=n},{"big-rat/sub":92}],107:[function(t,e,r){"use strict";function n(t,e,r,n){for(var i=0;2>i;++i){var o=t[i],a=e[i],s=Math.min(o,a),l=Math.max(o,a),u=r[i],c=n[i],h=Math.min(u,c),f=Math.max(u,c);if(s>f||h>l)return!1}return!0}function i(t,e,r,i){var a=o(t,r,i),s=o(e,r,i);if(a>0&&s>0||0>a&&0>s)return!1;var l=o(r,t,e),u=o(i,t,e);return l>0&&u>0||0>l&&0>u?!1:0===a&&0===s&&0===l&&0===u?n(t,e,r,i):!0}e.exports=i;var o=t("robust-orientation")[3]},{"robust-orientation":462}],108:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n;var i=n.prototype;Object.defineProperty(i,"length",{get:function(){return this.roots.length}}),i.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},i.find=function(t){for(var e=t,r=this.roots;r[t]!==t;)t=r[t];for(;r[e]!==t;){var n=r[e];r[e]=t,e=n}return t},i.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,o=this.roots,a=i[r],s=i[n];s>a?o[r]=n:a>s?o[n]=r:(o[n]=r,++i[r])}}},{}],109:[function(t,e,r){(function(t){var r=function(){"use strict";function e(r,n,i,o){function s(r,i){if(null===r)return null;if(0==i)return r;var l,f;if("object"!=typeof r)return r;if(e.__isArray(r))l=[];else if(e.__isRegExp(r))l=new RegExp(r.source,a(r)),r.lastIndex&&(l.lastIndex=r.lastIndex);else if(e.__isDate(r))l=new Date(r.getTime());else{if(h&&t.isBuffer(r))return l=new t(r.length),r.copy(l),l;"undefined"==typeof o?(f=Object.getPrototypeOf(r),l=Object.create(f)):(l=Object.create(o),f=o)}if(n){var p=u.indexOf(r);if(-1!=p)return c[p];u.push(r),c.push(l)}for(var d in r){var m;f&&(m=Object.getOwnPropertyDescriptor(f,d)),m&&null==m.set||(l[d]=s(r[d],i-1))}return l}var l;"object"==typeof n&&(i=n.depth,o=n.prototype,l=n.filter,n=n.circular);var u=[],c=[],h="undefined"!=typeof t;return"undefined"==typeof n&&(n=!0),"undefined"==typeof i&&(i=1/0),s(r,i)}function r(t){return Object.prototype.toString.call(t)}function n(t){return"object"==typeof t&&"[object Date]"===r(t)}function i(t){return"object"==typeof t&&"[object Array]"===r(t)}function o(t){return"object"==typeof t&&"[object RegExp]"===r(t)}function a(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return e.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},e.__objToStr=r,e.__isDate=n,e.__isArray=i,e.__isRegExp=o,e.__getRegExpFlags=a,e}();"object"==typeof e&&e.exports&&(e.exports=r)}).call(this,t("buffer").Buffer)},{buffer:52}],110:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:0,rgb:[255,255,255,1]}]}},{}],111:[function(t,e,r){"use strict";function n(t){for(var e,r="#",n=0;3>n;++n)e=t[n],e=e.toString(16),r+=("00"+e).substr(e.length);return r}function i(t){return"rgba("+t.join(",")+")"}var o=t("arraytools"),a=t("clone"),s=t("./colorScales");e.exports=function(t){var e,r,l,u,c,h,f,p,d,m,g,v,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),d=t.nshades||72,p=t.format||"hex",f=t.colormap,f||(f="jet"),"string"==typeof f){if(f=f.toLowerCase(),!s[f])throw Error(f+" not a supported colorscale");h=a(s[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=a(f)}if(h.length>d)throw new Error(f+" map requires nshades to be at least size "+h.length);for(g=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:a(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*d)}),g[0]<0&&(g[0]=0),g[1]<0&&(g[0]=0),g[0]>1&&(g[0]=1),g[1]>1&&(g[0]=1),y=0;y=0&&r[3]<=1||(r[3]=g[0]+(g[1]-g[0])*v);for(y=0;yx;++x)if(i=y[x]-b[x])return i;return 0}}e.exports=i;var o=Math.min},{}],113:[function(t,e,r){"use strict";function n(t){var e=t.length;if(0===e)return[];if(1===e)return[[0]];var r=t[0].length;return 0===r?[]:1===r?i(t):2===r?o(t):a(t,r)}var i=t("./lib/ch1d"),o=t("./lib/ch2d"),a=t("./lib/chnd");e.exports=n},{"./lib/ch1d":114,"./lib/ch2d":115,"./lib/chnd":116}],114:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0,n=1;nt[r][0]&&(r=n);return r>e?[[e],[r]]:e>r?[[r],[e]]:[[e]]}e.exports=n},{}],115:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(2>=r)return[];for(var n=new Array(r),o=e[r-1],a=0;r>a;++a){var s=e[a];n[a]=[o,s],o=s}return n}e.exports=n;var i=t("monotone-convex-hull-2d")},{"monotone-convex-hull-2d":118}],116:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),i=0;ii;++i)e.indexOf(i)<0&&(n[o++]=t[i]);return n}function i(t,e){ +for(var r=t.length,n=e.length,i=0;r>i;++i)for(var o=t[i],a=0;as)o[a]=e[s];else{s-=n;for(var l=0;n>l;++l)s>=e[l]&&(s+=1);o[a]=s}}return t}function o(t,e){try{return a(t,!0)}catch(r){var o=s(t);if(o.length<=e)return[];var l=n(t,o),u=a(l,!0);return i(u,o)}}e.exports=o;var a=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":117,"incremental-convex-hull":246}],117:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(e+1),n=0;n=i;++i){for(var a=new Array(e),s=0;e>s;++s)a[s]=Math.pow(i+1-n,s);r[i]=a}var l=o.apply(void 0,r);if(l)return!0}return!1}function i(t){var e=t.length;if(0===e)return[];if(1===e)return[0];for(var r=t[0].length,i=[t[0]],o=[0],a=1;e>a;++a)if(i.push(t[a]),n(i,r)){if(o.push(a),o.length===r+1)return o}else i.pop();return o}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":462}],118:[function(t,e,r){"use strict";function n(t){var e=t.length;if(3>e){for(var r=new Array(e),n=0;e>n;++n)r[n]=n;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:r}for(var o=new Array(e),n=0;e>n;++n)o[n]=n;o.sort(function(e,r){var n=t[e][0]-t[r][0];return n?n:t[e][1]-t[r][1]});for(var a=[o[0],o[1]],s=[o[0],o[1]],n=2;e>n;++n){for(var l=o[n],u=t[l],c=a.length;c>1&&i(t[a[c-2]],t[a[c-1]],u)<=0;)c-=1,a.pop();for(a.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+a.length-2),h=0,n=0,f=a.length;f>n;++n)r[h++]=a[n];for(var p=s.length-2;p>0;--p)r[h++]=s[p];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":462}],119:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CPV:"verde",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bdr|\\bdr.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",COG:"^(?!.*\\bdem)(?!.*\\bdr)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CZE:"^(?=.*rep).*czech|czechia|bohemia",CSK:"czechoslovakia",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"ireland",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat).*\\bkorea|^(?=.*people).*\\bkorea|^(?=.*north).*\\bkorea|dprk",KOR:"^(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MKD:"macedonia|fyrom",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"micronesia",MDA:"moldov|b(a|e)ssarabia",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"\\bs\\w*.?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa",TJK:"tajik",TZA:"tanzania",THA:"thailand|\\bsiam",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",USA:"united.?states|\\bu\\.?s\\.?a\\.?\\b|\\bu\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],120:[function(t,e,r){"use strict";function n(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function i(t){var e=new n;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===a){if(e.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(i),ir.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>r.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>r.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,o(e)}var o=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":122}],121:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=t.length,a=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,h=0;for(n=0;o>n;++n)u.push(["i",n,"=0"].join(""));for(i=0;a>i;++i)for(n=0;o>n;++n)h=c,c=t[n],0===n?u.push(["d",i,"s",n,"=t",i,"p",c].join("")):u.push(["d",i,"s",n,"=(t",i,"p",c,"-s",h,"*t",i,"p",h,")"].join(""));for(l.push("var "+u.join(",")),n=o-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"n;++n){for(h=c,c=t[n],i=0;a>i;++i)l.push(["p",i,"+=d",i,"s",n].join(""));s&&(n>0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var o=e.length,a=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],c=0;a>c;++c)u.push(["var offset",c,"=p",c].join(""));for(var c=t;o>c;++c)u.push(["for(var j"+c+"=SS[",e[c],"]|0;j",c,">0;){"].join("")),u.push(["if(j",c,"<",s,"){"].join("")),u.push(["s",e[c],"=j",c].join("")),u.push(["j",c,"=0"].join("")),u.push(["}else{s",e[c],"=",s].join("")),u.push(["j",c,"-=",s,"}"].join("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(var c=0;a>c;++c){for(var h=["offset"+c],f=t;o>f;++f)h.push(["j",f,"*t",c,"p",e[f]].join(""));u.push(["p",c,"=(",h.join("+"),")"].join(""))}u.push(n(e,r,i));for(var c=t;o>c;++c)u.push("}");return u.join("\n")}function o(t){for(var e=0,r=t[0].length;r>e;){for(var n=1;n0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function l(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,l=new Array(t.arrayArgs.length),c=new Array(t.arrayArgs.length),h=0;hy;++y)_.push(["s",y,"=SS[",y,"]"].join(""));for(var h=0;hy;++y)_.push(["t",h,"p",y,"=t",h,"[",d[h]+y,"]"].join(""));for(var y=0;y0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),h=0;r>h;++h)w[h]="0";_.push(["index=[",w.join(","),"]"].join(""))}for(var h=0;h3&&x.push(a(t.pre,t,c));var T=a(t.body,t,c),E=o(g);r>E?x.push(i(E,g[0],t,T)):x.push(n(g[0],t,T)),t.post.body.length>3&&x.push(a(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var S=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join(""),L=new Function(["function ",S,"(",b.join(","),"){",x.join("\n"),"} return ",S].join(""));return L()}var u=t("uniq");e.exports=l},{uniq:482}],122:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var o=[],a=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],c=0;c0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+h+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[c]))),u.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+h+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;ct?-1:t>e?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function a(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);i>n;){var o=n+i>>>1;t(e[o],r)<0?n=o+1:i=o}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);i>n;){var o=n+i>>>1;t(e[o],r)>0?i=o:n=o+1}return n}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function h(){this._=Object.create(null)}function f(t){return(t+="")===Ma||t[0]===ka?ka+t:t}function p(t){return(t+="")[0]===ka?t.slice(1):t}function d(t){return f(t)in this._}function m(t){return(t=f(t))in this._&&delete this._[t]}function g(){var t=[];for(var e in this._)t.push(p(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function b(){this._=Object.create(null)}function x(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=Aa.length;n>r;++r){var i=Aa[r]+e;if(i in t)return i}}function M(){}function k(){}function A(t){function e(){for(var e,n=r,i=-1,o=n.length;++ir;r++)for(var i,o=t[r],a=0,s=o.length;s>a;a++)(i=o[a])&&e(i,a,r);return t}function X(t){return Ea(t,Ra),t}function Y(t){var e,r;return function(n,i,o){var a,s=t[o].update,l=s.length;for(o!=r&&(r=o,e=0),i>=e&&(e=i+1);!(a=s[e])&&++e0&&(t=t.slice(0,s));var u=ja.get(t);return u&&(t=u,l=Q),s?e?i:n:e?M:o}function Z(t,e){return function(r){var n=ca.event;ca.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{ca.event=n}}}function Q(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function K(t){var r=".dragsuppress-"+ ++Oa,i="click"+r,o=ca.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Da&&(Da="onselectstart"in t?!1:w(t.style,"userSelect")),Da){var a=e(t).style,s=a[Da];a[Da]="none"}return function(t){if(o.on(r,null),Da&&(a[Da]=s),t){var e=function(){o.on(i,null)};o.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function J(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>Fa){var o=n(t);if(o.scrollX||o.scrollY){r=ca.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=r[0][0].getScreenCTM();Fa=!(a.f||a.e),r.remove()}}return Fa?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function $(){return ca.event.changedTouches[0].identifier}function tt(t){return t>0?1:0>t?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:-1>t?Ua:Math.acos(t)}function nt(t){return t>1?Ga:-1>t?-Ga:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function at(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,r){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):Mt(""+t,kt,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:0>t&&(t+=360),60>t?o+(a-o)*t/60:180>t?a:240>t?o+(a-o)*(240-t)/60:o}function i(t){return Math.round(255*n(t))}var o,a;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:0>e?0:e>1?1:e,r=0>r?0:r>1?1:r,a=.5>=r?r*(1+e):r+e-r*e,o=2*r-a,new bt(i(t+120),i(t),i(t-120))}function ht(t,e,r){return this instanceof ht?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ht?new ht(t.h,t.c,t.l):t instanceof pt?mt(t.l,t.a,t.b):mt((t=At((t=ca.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ht(t,e,r)}function ft(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new pt(r,Math.cos(t*=Ha)*e,Math.sin(t)*e)}function pt(t,e,r){return this instanceof pt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof pt?new pt(t.l,t.a,t.b):t instanceof ht?ft(t.h,t.c,t.l):At((t=bt(t)).r,t.g,t.b):new pt(t,e,r)}function dt(t,e,r){var n=(t+16)/116,i=n+e/500,o=n-r/200;return i=gt(i)*rs,n=gt(n)*ns,o=gt(o)*is,new bt(yt(3.2404542*i-1.5371385*n-.4985314*o),yt(-.969266*i+1.8760108*n+.041556*o),yt(.0556434*i-.2040259*n+1.0572252*o))}function mt(t,e,r){return t>0?new ht(Math.atan2(r,e)*Xa,Math.sqrt(e*e+r*r),t):new ht(NaN,NaN,t)}function gt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function bt(t,e,r){return this instanceof bt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof bt?new bt(t.r,t.g,t.b):Mt(""+t,bt,ct):new bt(t,e,r)}function xt(t){return new bt(t>>16,t>>8&255,255&t)}function _t(t){return xt(t)+""}function wt(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,r){var n,i,o,a=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Et(i[0]),Et(i[1]),Et(i[2]))}return(o=ss.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(a=(3840&o)>>4,a=a>>4|a,s=240&o,s=s>>4|s,l=15&o,l=l<<4|l):7===t.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,l=255&o)),e(a,s,l))}function kt(t,e,r){var n,i,o=Math.min(t/=255,e/=255,r/=255),a=Math.max(t,e,r),s=a-o,l=(a+o)/2;return s?(i=.5>l?s/(a+o):s/(2-a-o),n=t==a?(e-r)/s+(r>e?6:0):e==a?(r-t)/s+2:(t-e)/s+4,n*=60):(n=NaN,i=l>0&&1>l?0:n),new ut(n,i,l)}function At(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=vt((.4124564*t+.3575761*e+.1804375*r)/rs),i=vt((.2126729*t+.7151522*e+.072175*r)/ns),o=vt((.0193339*t+.119192*e+.9503041*r)/is);return pt(116*i-16,500*(n-i),200*(i-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function St(t){return"function"==typeof t?t:function(){return t}}function Lt(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),zt(e,r,t,n)}}function zt(t,e,r,n){function i(){var t,e=l.status;if(!e&&Pt(l)||e>=200&&300>e||304===e){try{t=r.call(o,l)}catch(n){return void a.error.call(o,n)}a.load.call(o,t)}else a.error.call(o,l)}var o={},a=ca.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=ca.event;ca.event=t;try{a.progress.call(o,l)}finally{ca.event=e}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(u=t,o):u},o.response=function(t){return r=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(fa(arguments)))}}),o.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),a.beforesend.call(o,l),l.send(null==n?null:n),o},o.abort=function(){return l.abort(),o},ca.rebind(o,a,"on"),null==n?o:o.get(It(n))}function It(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Pt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Ct(t,e,r){var n=arguments.length;2>n&&(e=0),3>n&&(r=Date.now());var i=r+e,o={c:t,t:i,n:null};return us?us.n=o:ls=o,us=o,cs||(hs=clearTimeout(hs),cs=1,fs(Rt)),o}function Rt(){var t=jt(),e=Dt()-t;e>24?(isFinite(e)&&(clearTimeout(hs),hs=setTimeout(Rt,e)),cs=0):(cs=1,fs(Rt))}function jt(){for(var t=Date.now(),e=ls;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Dt(){for(var t,e=ls,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Nt(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,o=n&&r?function(t,e){for(var i=t.length,o=[],a=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[a=(a+1)%n.length];return o.reverse().join(r)}:x;return function(t){var r=ds.exec(t),n=r[1]||" ",a=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],h=r[7],f=r[8],p=r[9],d=1,m="",g="",v=!1,y=!0;switch(f&&(f=+f.substring(1)),(u||"0"===n&&"="===a)&&(u=n="0",a="="),p){case"n":h=!0,p="g";break;case"%":d=100,g="%",p="f";break;case"p":d=100,g="%",p="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+p.toLowerCase());case"c":y=!1;case"d":v=!0,f=0;break;case"s":d=-1,p="r"}"$"===l&&(m=i[0],g=i[1]),"r"!=p||f||(p="g"),null!=f&&("g"==p?f=Math.max(1,Math.min(21,f)):"e"!=p&&"f"!=p||(f=Math.max(0,Math.min(20,f)))),p=ms.get(p)||Bt;var b=u&&h;return function(t){var r=g;if(v&&t%1)return"";var i=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===s?"":s;if(0>d){var l=ca.formatPrefix(t,f);t=l.scale(t),r=l.symbol+g}else t*=d;t=p(t,f);var x,_,w=t.lastIndexOf(".");if(0>w){var M=y?t.lastIndexOf("e"):-1;0>M?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&h&&(x=o(x,1/0));var k=m.length+x.length+_.length+(b?0:i.length),A=c>k?new Array(k=c-k+1).join(n):"";return b&&(x=o(A+x,A.length?c-_.length:1/0)),i+=m,t=x+_,("<"===a?i+t+A:">"===a?A+i+t:"^"===a?A.substring(0,k>>=1)+i+t+A.substring(k):i+(b?t:A+t))+r}}}function Bt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,r){function n(e){var r=t(e),n=o(r,1);return n-e>e-r?r:n}function i(r){return e(r=t(new vs(r-1)),1),r}function o(t,r){return e(t=new vs(+t),r),t}function a(t,n,o){var a=i(t),s=[];if(o>1)for(;n>a;)r(a)%o||s.push(new Date(+a)),e(a,1);else for(;n>a;)s.push(new Date(+a)),e(a,1);return s}function s(t,e,r){try{vs=Ut;var n=new Ut;return n._=t,a(n,e,r)}finally{vs=Date}}t.floor=t,t.round=n,t.ceil=i,t.offset=o,t.range=a;var l=t.utc=qt(t);return l.floor=l,l.round=qt(n),l.ceil=qt(i),l.offset=qt(o),l.range=s,t}function qt(t){return function(e,r){try{vs=Ut;var n=new Ut;return n._=e,t(n,r)._}finally{vs=Date}}}function Gt(t){function e(t){function e(e){for(var r,i,o,a=[],s=-1,l=0;++ss;){if(n>=u)return-1;if(i=e.charCodeAt(s++),37===i){if(a=e.charAt(s++),o=L[a in bs?e.charAt(s++):a],!o||(n=o(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=M.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){k.lastIndex=0;var n=k.exec(e.slice(r));return n?(t.m=A.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,S.c.toString(),e,n)}function l(t,e,n){return r(t,S.x.toString(),e,n)}function u(t,e,n){return r(t,S.X.toString(),e,n)}function c(t,e,r){var n=b.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var h=t.dateTime,f=t.date,p=t.time,d=t.periods,m=t.days,g=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{vs=Ut;var e=new vs;return e._=t,n(e)}finally{vs=Date}}var n=e(t);return r.parse=function(t){try{vs=Ut;var e=n.parse(t);return e&&e._}finally{vs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=ca.map(),x=Xt(m),_=Yt(m),w=Xt(g),M=Yt(g),k=Xt(v),A=Yt(v),T=Xt(y),E=Yt(y);d.forEach(function(t,e){b.set(t.toLowerCase(),e)});var S={a:function(t){return g[t.getDay()]},A:function(t){return m[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(h),d:function(t,e){return Ht(t.getDate(),e,2)},e:function(t,e){return Ht(t.getDate(),e,2)},H:function(t,e){return Ht(t.getHours(),e,2)},I:function(t,e){return Ht(t.getHours()%12||12,e,2)},j:function(t,e){return Ht(1+gs.dayOfYear(t),e,3)},L:function(t,e){return Ht(t.getMilliseconds(),e,3)},m:function(t,e){return Ht(t.getMonth()+1,e,2)},M:function(t,e){return Ht(t.getMinutes(),e,2)},p:function(t){return d[+(t.getHours()>=12)]},S:function(t,e){return Ht(t.getSeconds(),e,2)},U:function(t,e){return Ht(gs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ht(gs.mondayOfYear(t),e,2)},x:e(f),X:e(p),y:function(t,e){return Ht(t.getFullYear()%100,e,2)},Y:function(t,e){return Ht(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},L={a:n,A:i,b:o,B:a,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:oe,p:c,S:ae,U:Zt,w:Wt,W:Qt,x:l,X:u,y:Jt,Y:Kt,Z:$t,"%":ue};return e}function Ht(t,e,r){var n=0>t?"-":"",i=(n?-t:t)+"",o=i.length;return n+(r>o?new Array(r-o+1).join(e)+i:i)}function Xt(t){return new RegExp("^(?:"+t.map(ca.requote).join("|")+")","i")}function Yt(t){for(var e=new h,r=-1,n=t.length;++r68?1900:2e3)}function ee(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ae(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=wa(e)/60|0,i=wa(e)%60;return r+Ht(n,"0",2)+Ht(i,"0",2)}function ue(t,e,r){_s.lastIndex=0;var n=_s.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ce(t){for(var e=t.length,r=-1;++r=0?1:-1,s=a*r,l=Math.cos(e),u=Math.sin(e),c=o*u,h=i*l+c*Math.cos(s),f=c*a*Math.sin(s);Es.add(Math.atan2(f,h)),n=t,i=l,o=u}var e,r,n,i,o;Ss.point=function(a,s){Ss.point=t,n=(e=a)*Ha,i=Math.cos(s=(r=s)*Ha/2+Ua/4),o=Math.sin(s)},Ss.lineEnd=function(){t(e,r)}}function ve(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function be(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function ke(t,e){return wa(t[0]-e[0])s;++s)i.point((r=t[s])[0],r[1]);return void i.lineEnd()}var l=new Re(r,t,null,!0),u=new Re(r,null,l,!1);l.o=u,o.push(l),a.push(u),l=new Re(n,t,null,!1),u=new Re(n,null,l,!0),l.o=u,o.push(l),a.push(u)}}),a.sort(e),Ce(o),Ce(a),o.length){for(var s=0,l=r,u=a.length;u>s;++s)a[s].e=l=!l;for(var c,h,f=o[0];;){for(var p=f,d=!0;p.v;)if((p=p.n)===f)return;c=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(d)for(var s=0,u=c.length;u>s;++s)i.point((h=c[s])[0],h[1]);else n(p.x,p.n.x,1,i);p=p.n}else{if(d){c=p.p.z;for(var s=c.length-1;s>=0;--s)i.point((h=c[s])[0],h[1])}else n(p.x,p.p.x,-1,i);p=p.p}p=p.o,c=p.z,d=!d}while(!p.v);i.lineEnd()}}}function Ce(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(o.polygonStart(),_=!0),o.lineStart();++a1&&2&e&&r.push(r.pop().concat(r.shift())),p.push(r.filter(De))}var p,d,m,g=e(o),v=i.invert(n[0],n[1]),y={point:a,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=h,y.lineEnd=f,p=[],d=[]},polygonEnd:function(){y.point=a,y.lineStart=l,y.lineEnd=u,p=ca.merge(p);var t=Ve(v,d);p.length?(_||(o.polygonStart(),_=!0),Pe(p,Fe,t,r,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),p=d=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}},b=Oe(),x=e(b),_=!1;return y}}function De(t){return t.length>1}function Oe(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:M,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Fe(t,e){return((t=t.x)[0]<0?t[1]-Ga-Na:Ga-t[1])-((e=e.x)[0]<0?e[1]-Ga-Na:Ga-e[1])}function Ne(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?Ua:-Ua,l=wa(o-r);wa(l-Ua)0?Ga:-Ga),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(o,n),e=0):i!==s&&l>=Ua&&(wa(r-i)Na?Math.atan((Math.sin(e)*(o=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*o*a)):(e+n)/2}function Ue(t,e,r,n){var i;if(null==t)i=r*Ga,n.point(-Ua,i),n.point(0,i),n.point(Ua,i),n.point(Ua,0),n.point(Ua,-i),n.point(0,-i),n.point(-Ua,-i),n.point(-Ua,0),n.point(-Ua,i);else if(wa(t[0]-e[0])>Na){var o=t[0]s;++s){var u=e[s],c=u.length;if(c)for(var h=u[0],f=h[0],p=h[1]/2+Ua/4,d=Math.sin(p),m=Math.cos(p),g=1;;){g===c&&(g=0),t=u[g];var v=t[0],y=t[1]/2+Ua/4,b=Math.sin(y),x=Math.cos(y),_=v-f,w=_>=0?1:-1,M=w*_,k=M>Ua,A=d*b;if(Es.add(Math.atan2(A*w*Math.sin(M),m*x+A*Math.cos(M))),o+=k?_+w*Va:_,k^f>=r^v>=r){var T=be(ve(h),ve(t));we(T);var E=be(i,T);we(E);var S=(k^_>=0?-1:1)*nt(E[2]);(n>S||n===S&&(T[0]||T[1]))&&(a+=k^_>=0?1:-1)}if(!g++)break;f=v,d=b,m=x,h=t}}return(-Na>o||Na>o&&0>Es)^1&a}function qe(t){function e(t,e){return Math.cos(t)*Math.cos(e)>o}function r(t){var r,o,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,f){var p,d=[h,f],m=e(h,f),g=a?m?0:i(h,f):m?i(h+(0>h?Ua:-Ua),f):0;if(!r&&(u=l=m)&&t.lineStart(),m!==l&&(p=n(r,d),(ke(r,p)||ke(d,p))&&(d[0]+=Na,d[1]+=Na,m=e(d[0],d[1]))),m!==l)c=0,m?(t.lineStart(),p=n(d,r),t.point(p[0],p[1])):(p=n(r,d),t.point(p[0],p[1]),t.lineEnd()),r=p;else if(s&&r&&a^m){var v;g&o||!(v=n(d,r,!0))||(c=0,a?(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||r&&ke(r,d)||t.point(d[0],d[1]),r=d,l=m,o=g},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ve(t),i=ve(e),a=[1,0,0],s=be(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var h=o*l/c,f=-o*u/c,p=be(a,s),d=_e(a,h),m=_e(s,f);xe(d,m);var g=p,v=ye(d,g),y=ye(g,g),b=v*v-y*(ye(d,d)-1);if(!(0>b)){var x=Math.sqrt(b),_=_e(g,(-v-x)/y);if(xe(_,d),_=Me(_),!r)return _;var w,M=t[0],k=e[0],A=t[1],T=e[1];M>k&&(w=M,M=k,k=w);var E=k-M,S=wa(E-Ua)E;if(!S&&A>T&&(w=A,A=T,T=w),L?S?A+T>0^_[1]<(wa(_[0]-M)Ua^(M<=_[0]&&_[0]<=k)){var z=_e(g,(-v+x)/y);return xe(z,d),[_,Me(z)]}}}function i(e,r){var n=a?t:Ua-t,i=0;return-n>e?i|=1:e>n&&(i|=2),-n>r?i|=4:r>n&&(i|=8),i}var o=Math.cos(t),a=o>0,s=wa(o)>Na,l=gr(t,6*Ha);return je(e,r,l,a?[0,-t]:[-Ua,t-Ua])}function Ge(t,e,r,n){return function(i){var o,a=i.a,s=i.b,l=a.x,u=a.y,c=s.x,h=s.y,f=0,p=1,d=c-l,m=h-u;if(o=t-l,d||!(o>0)){if(o/=d,0>d){if(f>o)return;p>o&&(p=o)}else if(d>0){if(o>p)return;o>f&&(f=o)}if(o=r-l,d||!(0>o)){if(o/=d,0>d){if(o>p)return;o>f&&(f=o)}else if(d>0){if(f>o)return;p>o&&(p=o)}if(o=e-u,m||!(o>0)){if(o/=m,0>m){if(f>o)return;p>o&&(p=o)}else if(m>0){if(o>p)return;o>f&&(f=o)}if(o=n-u,m||!(0>o)){if(o/=m,0>m){if(o>p)return;o>f&&(f=o)}else if(m>0){if(f>o)return;p>o&&(p=o)}return f>0&&(i.a={x:l+f*d,y:u+f*m}),1>p&&(i.b={x:l+p*d,y:u+p*m}),i}}}}}}function He(t,e,r,n){function i(n,i){return wa(n[0]-t)0?0:3:wa(n[0]-r)0?2:1:wa(n[1]-e)0?1:0:i>0?3:2}function o(t,e){return a(t.x,e.x)}function a(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=g.length,n=t[1],i=0;r>i;++i)for(var o,a=1,s=g[i],l=s.length,u=s[0];l>a;++a)o=s[a],u[1]<=n?o[1]>n&&et(u,o,t)>0&&++e:o[1]<=n&&et(u,o,t)<0&&--e,u=o;return 0!==e}function u(o,s,l,u){var c=0,h=0;if(null==o||(c=i(o,l))!==(h=i(s,l))||a(o,s)<0^l>0){do u.point(0===c||3===c?t:r,c>1?n:e);while((c=(c+l+4)%4)!==h)}else u.point(s[0],s[1])}function c(i,o){return i>=t&&r>=i&&o>=e&&n>=o}function h(t,e){c(t,e)&&s.point(t,e)}function f(){L.point=d,g&&g.push(v=[]),k=!0,M=!1,_=w=NaN}function p(){m&&(d(y,b),x&&M&&E.rejoin(),m.push(E.buffer())),L.point=h,M&&s.lineEnd()}function d(t,e){t=Math.max(-Vs,Math.min(Vs,t)),e=Math.max(-Vs,Math.min(Vs,e));var r=c(t,e);if(g&&v.push([t,e]),k)y=t,b=e,x=r,k=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&M)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};S(n)?(M||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),A=!1):r&&(s.lineStart(),s.point(t,e),A=!1)}_=t,w=e,M=r}var m,g,v,y,b,x,_,w,M,k,A,T=s,E=Oe(),S=Ge(t,e,r,n),L={point:h,lineStart:f,lineEnd:p,polygonStart:function(){s=E,m=[],g=[],A=!0},polygonEnd:function(){s=T,m=ca.merge(m);var e=l([t,n]),r=A&&e,i=m.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Pe(m,o,e,u,s),s.polygonEnd()),m=g=v=null}};return L}}function Xe(t){var e=0,r=Ua/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Ua/180,r=t[1]*Ua/180):[e/Ua*180,r/Ua*180]},i}function Ye(t,e){function r(t,e){var r=Math.sqrt(o-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),a-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,o=1+n*(2*i-n),a=Math.sqrt(o)/i;return r.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/i,nt((o-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Gs+=i*t-n*e,n=t,i=e}var e,r,n,i;Zs.point=function(o,a){Zs.point=t,e=n=o,r=i=a},Zs.lineEnd=function(){t(e,r)}}function Ze(t,e){Hs>t&&(Hs=t),t>Ys&&(Ys=t),Xs>e&&(Xs=e),e>Ws&&(Ws=e)}function Qe(){function t(t,e){a.push("M",t,",",e,o)}function e(t,e){a.push("M",t,",",e),s.point=r}function r(t,e){a.push("L",t,",",e)}function n(){s.point=t}function i(){a.push("Z")}var o=Ke(4.5),a=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return o=Ke(t),s},result:function(){if(a.length){var t=a.join("");return a=[],t}}};return s}function Ke(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Je(t,e){Is+=t,Ps+=e,++Cs}function $e(){function t(t,n){var i=t-e,o=n-r,a=Math.sqrt(i*i+o*o);Rs+=a*(e+t)/2,js+=a*(r+n)/2,Ds+=a,Je(e=t,r=n)}var e,r;Ks.point=function(n,i){Ks.point=t,Je(e=n,r=i)}}function tr(){Ks.point=Je}function er(){function t(t,e){var r=t-n,o=e-i,a=Math.sqrt(r*r+o*o);Rs+=a*(n+t)/2,js+=a*(i+e)/2,Ds+=a,a=i*t-n*e,Os+=a*(n+t),Fs+=a*(i+e),Ns+=3*a,Je(n=t,i=e)}var e,r,n,i;Ks.point=function(o,a){Ks.point=t,Je(e=n=o,r=i=a)},Ks.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+a,r),t.arc(e,r,a,0,Va)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function o(){t.closePath()}var a=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return a=t,s},result:M};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return ar(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){b=NaN,k.point=o,e.lineStart()}function o(r,n){var o=ve([r,n]),a=t(r,n);i(b,x,y,_,w,M,b=a[0],x=a[1],y=r,_=o[0],w=o[1],M=o[2],s,e),e.point(b,x)}function a(){k.point=r,e.lineEnd()}function l(){n(),k.point=u,k.lineEnd=c}function u(t,e){o(h=t,f=e),p=b,d=x,m=_,g=w,v=M,k.point=o}function c(){i(b,x,y,_,w,M,p,d,h,m,g,v,s,e),k.lineEnd=a,a()}var h,f,p,d,m,g,v,y,b,x,_,w,M,k={point:r,lineStart:n,lineEnd:a,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=n}};return k}function i(e,r,n,s,l,u,c,h,f,p,d,m,g,v){var y=c-e,b=h-r,x=y*y+b*b;if(x>4*o&&g--){var _=s+p,w=l+d,M=u+m,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=wa(wa(M)-1)o||wa((y*z+b*I)/x-.5)>.3||a>s*p+l*d+u*m)&&(i(e,r,n,s,l,u,S,L,T,_/=k,w/=k,M,g,v),v.point(S,L),i(S,L,T,_,w,M,c,h,f,p,d,m,g,v))}}var o=.5,a=Math.cos(30*Ha),s=16;return e.precision=function(t){return arguments.length?(s=(o=t*t)>0&&16,e):Math.sqrt(o)},e}function ir(t){var e=nr(function(e,r){return t([e*Xa,r*Xa])});return function(t){return ur(e(t))}}function or(t){this.stream=t}function ar(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*Ha,t[1]*Ha),[t[0]*f+l,u-t[1]*f]}function r(t){return t=s.invert((t[0]-l)/f,(u-t[1])/f),t&&[t[0]*Xa,t[1]*Xa]}function n(){s=ze(a=fr(v,y,b),o);var t=o(m,g);return l=p-t[0]*f,u=d+t[1]*f,i()}function i(){return c&&(c.valid=!1,c=null),e}var o,a,s,l,u,c,h=nr(function(t,e){return t=o(t,e),[t[0]*f+l,u-t[1]*f]}),f=150,p=480,d=250,m=0,g=0,v=0,y=0,b=0,_=Us,w=x,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(a,h(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Us):qe((M=+t)*Ha),i()):M},e.clipExtent=function(t){return arguments.length?(k=t,w=t?He(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):k},e.scale=function(t){return arguments.length?(f=+t,n()):f},e.translate=function(t){return arguments.length?(p=+t[0],d=+t[1],n()):[p,d]},e.center=function(t){return arguments.length?(m=t[0]%360*Ha,g=t[1]%360*Ha,n()):[m*Xa,g*Xa]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Ha,y=t[1]%360*Ha,b=t.length>2?t[2]%360*Ha:0,n()):[v*Xa,y*Xa,b*Xa]},ca.rebind(e,h,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&r,n()}}function ur(t){return ar(t,function(e,r){t.point(e*Ha,r*Ha)})}function cr(t,e){return[t,e]}function hr(t,e){return[t>Ua?t-Va:-Ua>t?t+Va:t,e]}function fr(t,e,r){return t?e||r?ze(dr(t),mr(e,r)):dr(t):e||r?mr(e,r):hr}function pr(t){return function(e,r){return e+=t,[e>Ua?e-Va:-Ua>e?e+Va:e,r]}}function dr(t){var e=pr(t);return e.invert=pr(-t),e}function mr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*o-c*a,s*n-u*i),nt(c*o+l*a)]}var n=Math.cos(t),i=Math.sin(t),o=Math.cos(e),a=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*o-l*a;return[Math.atan2(l*o+u*a,s*n+c*i),nt(c*n-s*i)]},r}function gr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,o,a,s){var l=a*e;null!=i?(i=vr(r,i),o=vr(r,o),(a>0?o>i:i>o)&&(i+=a*Va)):(i=t+a*Va,o=t-.5*l);for(var u,c=i;a>0?c>o:o>c;c-=l)s.point((u=Me([r,-n*Math.cos(c),-n*Math.sin(c)]))[0],u[1])}}function vr(t,e){var r=ve(e);r[0]-=t,we(r);var n=rt(-r[1]);return((-r[2]<0?-n:n)+2*Math.PI-Na)%(2*Math.PI)}function yr(t,e,r){var n=ca.range(t,e-Na,r).concat(e);return function(t){return n.map(function(e){return[t,e]})}}function br(t,e,r){var n=ca.range(t,e-Na,r).concat(e);return function(t){return n.map(function(e){return[e,t]})}}function xr(t){return t.source}function _r(t){return t.target}function wr(t,e,r,n){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),l=i*Math.cos(t),u=i*Math.sin(t),c=a*Math.cos(r),h=a*Math.sin(r),f=2*Math.asin(Math.sqrt(st(n-e)+i*a*st(r-t))),p=1/Math.sin(f),d=f?function(t){var e=Math.sin(t*=f)*p,r=Math.sin(f-t)*p,n=r*l+e*c,i=r*u+e*h,a=r*o+e*s;return[Math.atan2(i,n)*Xa,Math.atan2(a,Math.sqrt(n*n+i*i))*Xa]}:function(){return[t*Xa,e*Xa]};return d.distance=f,d}function Mr(){function t(t,i){var o=Math.sin(i*=Ha),a=Math.cos(i),s=wa((t*=Ha)-e),l=Math.cos(s);Js+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=n*o-r*a*l)*s),r*o+n*a*l),e=t,r=o,n=a}var e,r,n;$s.point=function(i,o){e=i*Ha,r=Math.sin(o*=Ha),n=Math.cos(o),$s.point=t},$s.lineEnd=function(){$s.point=$s.lineEnd=M}}function kr(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),o=t(n*i);return[o*i*Math.sin(e),o*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,n*a),Math.asin(n&&r*o/n)]},r}function Ar(t,e){function r(t,e){a>0?-Ga+Na>e&&(e=-Ga+Na):e>Ga-Na&&(e=Ga-Na);var r=a/Math.pow(i(e),o);return[r*Math.sin(o*t),a-r*Math.cos(o*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Ua/4+t/2)},o=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),a=n*Math.pow(i(t),o)/o;return o?(r.invert=function(t,e){var r=a-e,n=tt(o)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/o,2*Math.atan(Math.pow(a/n,1/o))-Ga]},r):Er}function Tr(t,e){function r(t,e){var r=o-e;return[r*Math.sin(i*t),o-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),o=n/i+t;return wa(i)i;i++){for(;n>1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Cr(t,e){return t[0]-e[0]||t[1]-e[1]}function Rr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function jr(t,e,r,n){var i=t[0],o=r[0],a=e[0]-i,s=n[0]-o,l=t[1],u=r[1],c=e[1]-l,h=n[1]-u,f=(s*(l-u)-h*(i-o))/(h*a-s*c);return[i+f*a,l+f*c]}function Dr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Or(){on(this),this.edge=this.site=this.circle=null}function Fr(t){var e=hl.pop()||new Or;return e.site=t,e}function Nr(t){Zr(t),ll.remove(t),hl.push(t),on(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},o=t.P,a=t.N,s=[t];Nr(t);for(var l=o;l.circle&&wa(r-l.circle.x)c;++c)u=s[c],l=s[c-1],en(u.edge,l.site,u.site,i);l=s[0],u=s[h-1],u.edge=$r(l.site,u.site,null,i),Wr(l),Wr(u)}function Ur(t){for(var e,r,n,i,o=t.x,a=t.y,s=ll._;s;)if(n=Vr(s,a)-o,n>Na)s=s.L;else{if(i=o-qr(s,a),!(i>Na)){n>-Na?(e=s.P,r=s):i>-Na?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Fr(t);if(ll.insert(e,l),e||r){if(e===r)return Zr(e),r=Fr(e.site),ll.insert(l,r),l.edge=r.edge=$r(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=$r(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,h=u.y,f=t.x-c,p=t.y-h,d=r.site,m=d.x-c,g=d.y-h,v=2*(f*g-p*m),y=f*f+p*p,b=m*m+g*g,x={x:(g*y-p*b)/v+c,y:(f*b-m*y)/v+h};en(r.edge,u,d,x),l.edge=$r(u,t,null,x),r.edge=$r(t,d,null,x),Wr(e),Wr(r)}}function Vr(t,e){var r=t.site,n=r.x,i=r.y,o=i-e;if(!o)return n;var a=t.P;if(!a)return-(1/0);r=a.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,h=1/o-1/u,f=c/u;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*u)-l+u/2+i-o/2)))/h+n:(n+s)/2}function qr(t,e){var r=t.N;if(r)return Vr(r,e);var n=t.site;return n.y===e?n.x:1/0}function Gr(t){this.site=t,this.edges=[]}function Hr(t){for(var e,r,n,i,o,a,s,l,u,c,h=t[0][0],f=t[1][0],p=t[0][1],d=t[1][1],m=sl,g=m.length;g--;)if(o=m[g],o&&o.prepare())for(s=o.edges,l=s.length,a=0;l>a;)c=s[a].end(),n=c.x,i=c.y,u=s[++a%l].start(),e=u.x,r=u.y,(wa(n-e)>Na||wa(i-r)>Na)&&(s.splice(a,0,new rn(tn(o.site,c,wa(n-h)Na?{x:h,y:wa(e-h)Na?{x:wa(r-d)Na?{x:f,y:wa(e-f)Na?{x:wa(r-p)=-Ba)){var p=l*l+u*u,d=c*c+h*h,m=(h*p-u*d)/f,g=(l*d-c*p)/f,h=g+s,v=fl.pop()||new Yr;v.arc=t,v.site=i,v.x=m+a,v.y=h+Math.sqrt(m*m+g*g),v.cy=h,t.circle=v;for(var y=null,b=cl._;b;)if(v.yg||g>=s)return;if(f>d){if(o){if(o.y>=u)return}else o={x:g,y:l};r={x:g,y:u}}else{if(o){if(o.yn||n>1)if(f>d){if(o){if(o.y>=u)return}else o={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(o){if(o.yp){if(o){if(o.x>=s)return}else o={x:a,y:n*a+i};r={x:s,y:n*s+i}}else{if(o){if(o.xo||h>a||n>f||i>p)){if(d=t.point){var d,m=e-t.x,g=r-t.y,v=m*m+g*g;if(l>v){var y=Math.sqrt(l=v);n=e-y,i=r-y,o=e+y,a=r+y,s=d}}for(var b=t.nodes,x=.5*(c+f),_=.5*(h+p),w=e>=x,M=r>=_,k=M<<1|w,A=k+4;A>k;++k)if(t=b[3&k])switch(3&k){case 0:u(t,c,h,x,_);break;case 1:u(t,x,h,f,_);break;case 2:u(t,c,_,x,p);break;case 3:u(t,x,_,f,p)}}}(t,n,i,o,a),s}function vn(t,e){t=ca.rgb(t),e=ca.rgb(e);var r=t.r,n=t.g,i=t.b,o=e.r-r,a=e.g-n,s=e.b-i;return function(t){return"#"+wt(Math.round(r+o*t))+wt(Math.round(n+a*t))+wt(Math.round(i+s*t))}}function yn(t,e){var r,n={},i={};for(r in t)r in e?n[r]=_n(t[r],e[r]):i[r]=t[r];for(r in e)r in t||(i[r]=e[r]);return function(t){for(r in n)i[r]=n[r](t);return i}}function bn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function xn(t,e){var r,n,i,o=dl.lastIndex=ml.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(r=dl.exec(t))&&(n=ml.exec(e));)(i=n.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(r=r[0])===(n=n[0])?s[a]?s[a]+=n:s[++a]=n:(s[++a]=null,l.push({i:a,x:bn(r,n)})),o=ml.lastIndex;return on;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})}function _n(t,e){for(var r,n=ca.interpolators.length;--n>=0&&!(r=ca.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],o=t.length,a=e.length,s=Math.min(t.length,e.length);for(r=0;s>r;++r)n.push(_n(t[r],e[r]));for(;o>r;++r)i[r]=t[r];for(;a>r;++r)i[r]=e[r];return function(t){for(r=0;s>r;++r)i[r]=n[r](t);return i}}function Mn(t){return function(e){return 0>=e?0:e>=1?1:t(e)}}function kn(t){return function(e){return 1-t(1-e)}}function An(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Sn(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(.5>t?r:3*(t-e)+r-.75)}function Ln(t){return function(e){return Math.pow(e,t)}}function zn(t){return 1-Math.cos(t*Ga)}function In(t){return Math.pow(2,10*(t-1))}function Pn(t){return 1-Math.sqrt(1-t*t)}function Cn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Va*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Va/e)}}function Rn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function jn(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Dn(t,e){t=ca.hcl(t),e=ca.hcl(e);var r=t.h,n=t.c,i=t.l,o=e.h-r,a=e.c-n,s=e.l-i;return isNaN(a)&&(a=0,n=isNaN(n)?e.c:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:-180>o&&(o+=360),function(t){return ft(r+o*t,n+a*t,i+s*t)+""}}function On(t,e){t=ca.hsl(t),e=ca.hsl(e);var r=t.h,n=t.s,i=t.l,o=e.h-r,a=e.s-n,s=e.l-i;return isNaN(a)&&(a=0,n=isNaN(n)?e.s:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:-180>o&&(o+=360),function(t){return ct(r+o*t,n+a*t,i+s*t)+""}}function Fn(t,e){t=ca.lab(t),e=ca.lab(e);var r=t.l,n=t.a,i=t.b,o=e.l-r,a=e.a-n,s=e.b-i;return function(t){return dt(r+o*t,n+a*t,i+s*t)+""}}function Nn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Vn(e),i=Un(e,r),o=Vn(qn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Gn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(Gn(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Gn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(Gn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(Gn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Gn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=ca.transform(t),e=ca.transform(e),Hn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,o=n.length;++i=0;)r.push(i[n])}function li(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(o=t.children)&&(i=o.length))for(var i,o,a=-1;++ar;++r)(e=t[r][1])>i&&(n=r,i=e);return n}function bi(t){return t.reduce(xi,0)}function xi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,o=[];++r<=e;)o[r]=i*r+n;return o}function Mi(t){return[ca.min(t),ca.max(t)]}function ki(t,e){return t.value-e.value}function Ai(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Si(t){function e(t){c=Math.min(t.x-t.r,c),h=Math.max(t.x+t.r,h),f=Math.min(t.y-t.r,f),p=Math.max(t.y+t.r,p)}if((r=t.children)&&(u=r.length)){var r,n,i,o,a,s,l,u,c=1/0,h=-(1/0),f=1/0,p=-(1/0);if(r.forEach(Li),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(i=r[1],i.x=i.r,i.y=0,e(i),u>2))for(o=r[2],Pi(n,i,o),e(o),Ai(n,o),n._pack_prev=o,Ai(o,i),i=n._pack_next,a=3;u>a;a++){Pi(n,i,o=r[a]);var d=0,m=1,g=1;for(s=i._pack_next;s!==i;s=s._pack_next,m++)if(Ei(s,o)){d=1;break}if(1==d)for(l=n._pack_prev;l!==s._pack_prev&&!Ei(l,o);l=l._pack_prev,g++);d?(g>m||m==g&&i.ra;a++)o=r[a],o.x-=v,o.y-=y,b=Math.max(b,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=b,r.forEach(zi)}}function Li(t){t._pack_next=t._pack_prev=t}function zi(t){delete t._pack_next,delete t._pack_prev}function Ii(t,e,r,n){var i=t.children;if(t.x=e+=n*t.x,t.y=r+=n*t.y,t.r*=n,i)for(var o=-1,a=i.length;++o=0;)e=i[o],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function Fi(t,e,r){return t.a.parent===e.parent?t.a:r}function Ni(t){return 1+ca.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Vi(t){var e,r=t.children;return r&&(e=r.length)?Vi(r[e-1]):t}function qi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Gi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return 0>i&&(r+=i/2,i=0),0>o&&(n+=o/2,o=0),{x:r,y:n,dx:i,dy:o}}function Hi(t){var e=t[0],r=t[t.length-1];return r>e?[e,r]:[r,e]}function Xi(t){return t.rangeExtent?t.rangeExtent():Hi(t.range())}function Yi(t,e,r,n){var i=r(t[0],t[1]),o=n(e[0],e[1]);return function(t){return o(i(t))}}function Wi(t,e){var r,n=0,i=t.length-1,o=t[n],a=t[i];return o>a&&(r=n,n=i,i=r,r=o,o=a,a=r),t[n]=e.floor(o),t[i]=e.ceil(a),t}function Zi(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:Tl}function Qi(t,e,r,n){var i=[],o=[],a=0,s=Math.min(t.length,e.length)-1;for(t[s]2?Qi:Yi,l=n?Kn:Qn;return a=i(t,e,l,r),s=i(e,t,l,_n),o}function o(t){return a(t)}var a,s;return o.invert=function(t){return s(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},o.range=function(t){return arguments.length?(e=t,i()):e},o.rangeRound=function(t){return o.range(t).interpolate(Nn)},o.clamp=function(t){return arguments.length?(n=t,i()):n},o.interpolate=function(t){return arguments.length?(r=t,i()):r},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,r){return ro(t,e,r)},o.nice=function(e){return $i(t,e),i()},o.copy=function(){return Ki(t,e,r,n)},i()}function Ji(t,e){return ca.rebind(t,e,"range","rangeRound","interpolate","clamp")}function $i(t,e){return Wi(t,Zi(to(t,e)[2])),Wi(t,Zi(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var r=Hi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),o=e/n*i;return.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function eo(t,e){return ca.range.apply(ca,to(t,e))}function ro(t,e,r){var n=to(t,e);if(r){var i=ds.exec(r);if(i.shift(),"s"===i[8]){var o=ca.formatPrefix(Math.max(wa(n[0]),wa(n[1])));return i[7]||(i[7]="."+no(o.scale(n[2]))),i[8]="f",r=ca.format(i.join("")),function(t){return r(o.scale(t))+o.symbol}}i[7]||(i[7]="."+io(i[8],n)),r=i.join("")}else r=",."+no(n[2])+"f";return ca.format(r)}function no(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function io(t,e){var r=no(e[2]);return t in El?Math.abs(r-no(Math.max(wa(e[0]),wa(e[1]))))+ +("e"!==t):r-2*("%"===t)}function oo(t,e,r,n){function i(t){return(r?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function a(e){return t(i(e))}return a.invert=function(e){return o(t.invert(e))},a.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),a):n},a.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),a):e},a.nice=function(){var e=Wi(n.map(i),r?Math:Ll);return t.domain(e),n=e.map(o),a},a.ticks=function(){var t=Hi(n),a=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),h=e%1?2:e;if(isFinite(c-u)){if(r){for(;c>u;u++)for(var f=1;h>f;f++)a.push(o(u)*f);a.push(o(u))}else for(a.push(o(u));u++0;f--)a.push(o(u)*f);for(u=0;a[u]l;c--);a=a.slice(u,c)}return a},a.tickFormat=function(t,r){if(!arguments.length)return Sl;arguments.length<2?r=Sl:"function"!=typeof r&&(r=ca.format(r));var n=Math.max(1,e*t/a.ticks().length);return function(t){var a=t/o(Math.round(i(t)));return e-.5>a*e&&(a*=e),n>=a?r(t):""}},a.copy=function(){return oo(t.copy(),e,r,n)},Ji(a,t)}function ao(t,e,r){function n(e){return t(i(e))}var i=so(e),o=so(1/e);return n.invert=function(e){return o(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain((r=e.map(Number)).map(i)),n):r},n.ticks=function(t){return eo(r,t)},n.tickFormat=function(t,e){return ro(r,t,e)},n.nice=function(t){return n.domain($i(r,t))},n.exponent=function(a){return arguments.length?(i=so(e=a),o=so(1/e),t.domain(r.map(i)),n):e},n.copy=function(){return ao(t.copy(),e,r)},Ji(n,t)}function so(t){return function(e){return 0>e?-Math.pow(-e,t):Math.pow(e,t)}}function lo(t,e){function r(r){return o[((i.get(r)||("range"===e.t?i.set(r,t.push(r)):NaN))-1)%o.length]}function n(e,r){return ca.range(t.length).map(function(t){return e+r*t})}var i,o,a;return r.domain=function(n){if(!arguments.length)return t;t=[],i=new h;for(var o,a=-1,s=n.length;++ar?[NaN,NaN]:[r>0?s[r-1]:t[0],re?NaN:e/o+t,[e,e+1/o]},n.copy=function(){return co(t,e,r)},i()}function ho(t,e){function r(r){return r>=r?e[ca.bisect(t,r)]:void 0}return r.domain=function(e){return arguments.length?(t=e,r):t},r.range=function(t){return arguments.length?(e=t,r):e},r.invertExtent=function(r){return r=e.indexOf(r),[t[r-1],t[r]]},r.copy=function(){return ho(t,e)},r}function fo(t){function e(t){return+t}return e.invert=e,e.domain=e.range=function(r){return arguments.length?(t=r.map(e),e):t},e.ticks=function(e){return eo(t,e)},e.tickFormat=function(e,r){return ro(t,e,r)},e.copy=function(){return fo(t)},e}function po(){return 0}function mo(t){return t.innerRadius}function go(t){return t.outerRadius}function vo(t){return t.startAngle}function yo(t){return t.endAngle}function bo(t){return t&&t.padAngle}function xo(t,e,r,n){return(t-r)*e-(e-n)*t>0?0:1}function _o(t,e,r,n,i){var o=t[0]-e[0],a=t[1]-e[1],s=(i?n:-n)/Math.sqrt(o*o+a*a),l=s*a,u=-s*o,c=t[0]+l,h=t[1]+u,f=e[0]+l,p=e[1]+u,d=(c+f)/2,m=(h+p)/2,g=f-c,v=p-h,y=g*g+v*v,b=r-n,x=c*p-f*h,_=(0>v?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-g*_)/y,M=(-x*g-v*_)/y,k=(x*v+g*_)/y,A=(-x*g+v*_)/y,T=w-d,E=M-m,S=k-d,L=A-m;return T*T+E*E>S*S+L*L&&(w=k,M=A),[[w-l,M-u],[w*r/b,M*r/b]]}function wo(t){function e(e){function a(){u.push("M",o(t(c),s))}for(var l,u=[],c=[],h=-1,f=e.length,p=St(r),d=St(n);++h1?t.join("L"):t+"Z"}function ko(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1&&i.push("H",n[0]),i.join("")}function To(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],o=t[l],l++,n+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var u=2;u9&&(i=3*e/Math.sqrt(i),a[s]=i*r,a[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}function Vo(t){return t.length<3?Mo(t):t[0]+Io(t,Uo(t))}function qo(t){for(var e,r,n,i=-1,o=t.length;++i=e?a(t-e):void(u.c=a)}function a(r){var i=d.active,o=d[i];o&&(o.timer.c=null,o.timer.t=NaN,--d.count,delete d[i],o.event&&o.event.interrupt.call(t,t.__data__,o.index));for(var a in d)if(n>+a){var h=d[a];h.timer.c=null,h.timer.t=NaN,--d.count,delete d[a]}u.c=s,Ct(function(){return u.c&&s(r||1)&&(u.c=null,u.t=NaN),1},0,l),d.active=n,m.event&&m.event.start.call(t,t.__data__,e),p=[],m.tween.forEach(function(r,n){(n=n.call(t,t.__data__,e))&&p.push(n)}),f=m.ease,c=m.duration}function s(i){for(var o=i/c,a=f(o),s=p.length;s>0;)p[--s].call(t,a);return o>=1?(m.event&&m.event.end.call(t,t.__data__,e),--d.count?delete d[n]:delete t[r],1):void 0}var l,u,c,f,p,d=t[r]||(t[r]={active:0,count:0}),m=d[n];m||(l=i.time,u=Ct(o,0,l),m=d[n]={tween:new h,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++d.count)}function na(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function ia(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function oa(t){return t.toISOString()}function aa(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,o=ca.bisect(tu,i);return o==tu.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[i/tu[o-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=sa(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=sa(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Hi(n.domain()),o=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(r[0],sa(+r[1]+1),1>e?1:e)},n.tickFormat=function(){return r},n.copy=function(){return aa(t.copy(),e,r)},Ji(n,t)}function sa(t){return new Date(t)}function la(t){return JSON.parse(t.responseText)}function ua(t){var e=pa.createRange();return e.selectNode(pa.body),e.createContextualFragment(t.responseText)}var ca={version:"3.5.16"},ha=[].slice,fa=function(t){return ha.call(t)},pa=this.document;if(pa)try{fa(pa.documentElement.childNodes)[0].nodeType}catch(da){fa=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),pa)try{pa.createElement("DIV").style.setProperty("opacity",0,"")}catch(ma){var ga=this.Element.prototype,va=ga.setAttribute,ya=ga.setAttributeNS,ba=this.CSSStyleDeclaration.prototype,xa=ba.setProperty;ga.setAttribute=function(t,e){va.call(this,t,e+"")},ga.setAttributeNS=function(t,e,r){ya.call(this,t,e,r+"")},ba.setProperty=function(t,e,r){xa.call(this,t,e+"",r)}}ca.ascending=i,ca.descending=function(t,e){return t>e?-1:e>t?1:e>=t?0:NaN},ca.min=function(t,e){var r,n,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++in&&(r=n)}else{for(;++i=n){r=n;break}for(;++in&&(r=n)}return r},ca.max=function(t,e){var r,n,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++ir&&(r=n)}else{for(;++i=n){r=n;break}for(;++ir&&(r=n)}return r},ca.extent=function(t,e){var r,n,i,o=-1,a=t.length;if(1===arguments.length){for(;++o=n){r=i=n;break}for(;++on&&(r=n),n>i&&(i=n))}else{for(;++o=n){r=i=n;break}for(;++on&&(r=n),n>i&&(i=n))}return[r,i]},ca.sum=function(t,e){var r,n=0,i=t.length,o=-1;if(1===arguments.length)for(;++o1?l/(c-1):void 0},ca.deviation=function(){var t=ca.variance.apply(this,arguments);return t?Math.sqrt(t):t};var _a=s(i);ca.bisectLeft=_a.left,ca.bisect=ca.bisectRight=_a.right,ca.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},ca.shuffle=function(t,e,r){(o=arguments.length)<3&&(r=t.length,2>o&&(e=0));for(var n,i,o=r-e;o;)i=Math.random()*o--|0,n=t[o+e],t[o+e]=t[i+e],t[i+e]=n;return t},ca.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},ca.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],o=new Array(0>n?0:n);n>r;)o[r]=[e=i,i=t[++r]];return o},ca.transpose=function(t){if(!(i=t.length))return[];for(var e=-1,r=ca.min(t,l),n=new Array(r);++e=0;)for(n=t[i],e=n.length;--e>=0;)r[--a]=n[e];return r};var wa=Math.abs;ca.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r===1/0)throw new Error("infinite range");var n,i=[],o=u(wa(r)),a=-1;if(t*=o,e*=o,r*=o,0>r)for(;(n=t+r*++a)>e;)i.push(n/o);else for(;(n=t+r*++a)=o.length)return n?n.call(i,a):r?a.sort(r):a;for(var l,u,c,f,p=-1,d=a.length,m=o[s++],g=new h;++p=o.length)return t;var n=[],i=a[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},o=[],a=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(ca.map,r,0),0)},i.key=function(t){return o.push(t),i},i.sortKeys=function(t){return a[o.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},ca.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;n>r;++r)e.add(t[r]);return e},c(b,{has:d,add:function(t){return this._[f(t+="")]=!0,t},remove:m,values:g,size:v,empty:y,forEach:function(t){for(var e in this._)t.call(this,p(e))}}),ca.behavior={},ca.rebind=function(t,e){for(var r,n=1,i=arguments.length;++n=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},ca.event=null,ca.requote=function(t){return t.replace(Ta,"\\$&")};var Ta=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ea={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},Sa=function(t,e){return e.querySelector(t)},La=function(t,e){return e.querySelectorAll(t)},za=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(za=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Sa=function(t,e){return Sizzle(t,e)[0]||null},La=Sizzle,za=Sizzle.matchesSelector),ca.selection=function(){return ca.select(pa.documentElement)};var Ia=ca.selection.prototype=[];Ia.select=function(t){var e,r,n,i,o=[];t=z(t);for(var a=-1,s=this.length;++a=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Ca.hasOwnProperty(r)?{space:Ca[r],local:t}:t}},Ia.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=ca.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(P(e,t[e]));return this}return this.each(P(t,e))},Ia.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=j(t)).length,i=-1;if(e=r.classList){for(;++ii){if("string"!=typeof t){2>i&&(e="");for(r in t)this.each(F(r,t[r],e));return this}if(2>i){var o=this.node();return n(o).getComputedStyle(o,null).getPropertyValue(t)}r=""}return this.each(F(t,e,r))},Ia.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(N(e,t[e]));return this}return this.each(N(t,e))},Ia.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Ia.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Ia.append=function(t){return t=B(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},Ia.insert=function(t,e){return t=B(t),e=z(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},Ia.remove=function(){return this.each(U)},Ia.data=function(t,e){function r(t,r){var n,i,o,a=t.length,c=r.length,f=Math.min(a,c),p=new Array(c),d=new Array(c),m=new Array(a);if(e){var g,v=new h,y=new Array(a);for(n=-1;++nn;++n)d[n]=V(r[n]);for(;a>n;++n)m[n]=t[n]}d.update=p,d.parentNode=p.parentNode=m.parentNode=t.parentNode,s.push(d),l.push(p),u.push(m)}var n,i,o=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(n=this[0]).length);++oo;o++){i.push(e=[]),e.parentNode=(r=this[o]).parentNode;for(var s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,o)&&e.push(n)}return L(i)},Ia.order=function(){for(var t=-1,e=this.length;++t=0;)(r=n[i])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r); +return this},Ia.sort=function(t){t=G.apply(this,arguments);for(var e=-1,r=this.length;++et;t++)for(var r=this[t],n=0,i=r.length;i>n;n++){var o=r[n];if(o)return o}return null},Ia.size=function(){var t=0;return H(this,function(){++t}),t};var Ra=[];ca.selection.enter=X,ca.selection.enter.prototype=Ra,Ra.append=Ia.append,Ra.empty=Ia.empty,Ra.node=Ia.node,Ra.call=Ia.call,Ra.size=Ia.size,Ra.select=function(t){for(var e,r,n,i,o,a=[],s=-1,l=this.length;++sn){if("string"!=typeof t){2>n&&(e=!1);for(r in t)this.each(W(r,t[r],e));return this}if(2>n)return(n=this.node()["__on"+t])&&n._;r=!1}return this.each(W(t,e,r))};var ja=ca.map({mouseenter:"mouseover",mouseleave:"mouseout"});pa&&ja.forEach(function(t){"on"+t in pa&&ja.remove(t)});var Da,Oa=0;ca.mouse=function(t){return J(t,E())};var Fa=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ca.touch=function(t,e,r){if(arguments.length<3&&(r=e,e=E().changedTouches),e)for(var n,i=0,o=e.length;o>i;++i)if((n=e[i]).identifier===r)return J(t,n)},ca.behavior.drag=function(){function t(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function e(t,e,n,o,a){return function(){function s(){var t,r,n=e(f,m);n&&(t=n[0]-b[0],r=n[1]-b[1],d|=t|r,b=n,p({type:"drag",x:n[0]+u[0],y:n[1]+u[1],dx:t,dy:r}))}function l(){e(f,m)&&(v.on(o+g,null).on(a+g,null),y(d),p({type:"dragend"}))}var u,c=this,h=ca.event.target.correspondingElement||ca.event.target,f=c.parentNode,p=r.of(c,arguments),d=0,m=t(),g=".drag"+(null==m?"":"-"+m),v=ca.select(n(h)).on(o+g,s).on(a+g,l),y=K(h),b=e(f,m);i?(u=i.apply(c,arguments),u=[u.x-b[0],u.y-b[1]]):u=[0,0],p({type:"dragstart"})}}var r=S(t,"drag","dragstart","dragend"),i=null,o=e(M,ca.mouse,n,"mousemove","mouseup"),a=e($,ca.touch,x,"touchmove","touchend");return t.origin=function(e){return arguments.length?(i=e,t):i},ca.rebind(t,r,"on")},ca.touches=function(t,e){return arguments.length<2&&(e=E().touches),e?fa(e).map(function(e){var r=J(t,e);return r.identifier=e.identifier,r}):[]};var Na=1e-6,Ba=Na*Na,Ua=Math.PI,Va=2*Ua,qa=Va-Na,Ga=Ua/2,Ha=Ua/180,Xa=180/Ua,Ya=Math.SQRT2,Wa=2,Za=4;ca.interpolateZoom=function(t,e){var r,n,i=t[0],o=t[1],a=t[2],s=e[0],l=e[1],u=e[2],c=s-i,h=l-o,f=c*c+h*h;if(Ba>f)n=Math.log(u/a)/Ya,r=function(t){return[i+t*c,o+t*h,a*Math.exp(Ya*t*n)]};else{var p=Math.sqrt(f),d=(u*u-a*a+Za*f)/(2*a*Wa*p),m=(u*u-a*a-Za*f)/(2*u*Wa*p),g=Math.log(Math.sqrt(d*d+1)-d),v=Math.log(Math.sqrt(m*m+1)-m);n=(v-g)/Ya,r=function(t){var e=t*n,r=ot(g),s=a/(Wa*p)*(r*at(Ya*e+g)-it(g));return[i+s*c,o+s*h,a*r/ot(Ya*e+g)]}}return r.duration=1e3*n,r},ca.behavior.zoom=function(){function t(t){t.on(I,h).on(Ka+".zoom",p).on("dblclick.zoom",d).on(R,f)}function e(t){return[(t[0]-k.x)/k.k,(t[1]-k.y)/k.k]}function r(t){return[t[0]*k.k+k.x,t[1]*k.k+k.y]}function i(t){k.k=Math.max(E[0],Math.min(E[1],t))}function o(t,e){e=r(e),k.x+=t[0]-e[0],k.y+=t[1]-e[1]}function a(e,r,n,a){e.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2,a)),o(g=r,n),e=ca.select(e),L>0&&(e=e.transition().duration(L)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-k.x)/k.k}).map(x.invert)),M&&M.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){z++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--z||(t({type:"zoomend"}),g=null)}function h(){function t(){s=1,o(ca.mouse(i),f),u(a)}function r(){h.on(P,null).on(C,null),p(s),c(a)}var i=this,a=j.of(i,arguments),s=0,h=ca.select(n(i)).on(P,t).on(C,r),f=e(ca.mouse(i)),p=K(i);Gl.call(i),l(a)}function f(){function t(){var t=ca.touches(d);return p=k.k,t.forEach(function(t){t.identifier in g&&(g[t.identifier]=e(t))}),t}function r(){var e=ca.event.target;ca.select(e).on(x,n).on(_,s),w.push(e);for(var r=ca.event.changedTouches,i=0,o=r.length;o>i;++i)g[r[i].identifier]=null;var l=t(),u=Date.now();if(1===l.length){if(500>u-b){var c=l[0];a(d,c,g[c.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),T()}b=u}else if(l.length>1){var c=l[0],h=l[1],f=c[0]-h[0],p=c[1]-h[1];v=f*f+p*p}}function n(){var t,e,r,n,a=ca.touches(d);Gl.call(d);for(var s=0,l=a.length;l>s;++s,n=null)if(r=a[s],n=g[r.identifier]){if(e)break;t=r,e=n}if(n){var c=(c=r[0]-t[0])*c+(c=r[1]-t[1])*c,h=v&&Math.sqrt(c/v);t=[(t[0]+r[0])/2,(t[1]+r[1])/2],e=[(e[0]+n[0])/2,(e[1]+n[1])/2],i(h*p)}b=null,o(t,e),u(m)}function s(){if(ca.event.touches.length){for(var e=ca.event.changedTouches,r=0,n=e.length;n>r;++r)delete g[e[r].identifier];for(var i in g)return void t()}ca.selectAll(w).on(y,null),M.on(I,h).on(R,f),A(),c(m)}var p,d=this,m=j.of(d,arguments),g={},v=0,y=".zoom-"+ca.event.changedTouches[0].identifier,x="touchmove"+y,_="touchend"+y,w=[],M=ca.select(d),A=K(d);r(),l(m),M.on(I,null).on(R,r)}function p(){var t=j.of(this,arguments);y?clearTimeout(y):(Gl.call(this),m=e(g=v||ca.mouse(this)),l(t)),y=setTimeout(function(){y=null,c(t)},50),T(),i(Math.pow(2,.002*Qa())*k.k),o(g,m),u(t)}function d(){var t=ca.mouse(this),r=Math.log(k.k)/Math.LN2;a(this,t,e(t),ca.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1)}var m,g,v,y,b,x,_,w,M,k={x:0,y:0,k:1},A=[960,500],E=Ja,L=250,z=0,I="mousedown.zoom",P="mousemove.zoom",C="mouseup.zoom",R="touchstart.zoom",j=S(t,"zoomstart","zoom","zoomend");return Ka||(Ka="onwheel"in pa?(Qa=function(){return-ca.event.deltaY*(ca.event.deltaMode?120:1)},"wheel"):"onmousewheel"in pa?(Qa=function(){return ca.event.wheelDelta},"mousewheel"):(Qa=function(){return-ca.event.detail},"MozMousePixelScroll")),t.event=function(t){t.each(function(){var t=j.of(this,arguments),e=k;Vl?ca.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(t)}).tween("zoom:zoom",function(){var r=A[0],n=A[1],i=g?g[0]:r/2,o=g?g[1]:n/2,a=ca.interpolateZoom([(i-k.x)/k.k,(o-k.y)/k.k,r/k.k],[(i-e.x)/e.k,(o-e.y)/e.k,r/e.k]);return function(e){var n=a(e),s=r/n[2];this.__chart__=k={x:i-n[0]*s,y:o-n[1]*s,k:s},u(t)}}).each("interrupt.zoom",function(){c(t)}).each("end.zoom",function(){c(t)}):(this.__chart__=k,l(t),u(t),c(t))})},t.translate=function(e){return arguments.length?(k={x:+e[0],y:+e[1],k:k.k},s(),t):[k.x,k.y]},t.scale=function(e){return arguments.length?(k={x:k.x,y:k.y,k:null},i(+e),s(),t):k.k},t.scaleExtent=function(e){return arguments.length?(E=null==e?Ja:[+e[0],+e[1]],t):E},t.center=function(e){return arguments.length?(v=e&&[+e[0],+e[1]],t):v},t.size=function(e){return arguments.length?(A=e&&[+e[0],+e[1]],t):A},t.duration=function(e){return arguments.length?(L=+e,t):L},t.x=function(e){return arguments.length?(_=e,x=e.copy(),k={x:0,y:0,k:1},t):_},t.y=function(e){return arguments.length?(M=e,w=e.copy(),k={x:0,y:0,k:1},t):M},ca.rebind(t,j,"on")};var Qa,Ka,Ja=[0,1/0];ca.color=lt,lt.prototype.toString=function(){return this.rgb()+""},ca.hsl=ut;var $a=ut.prototype=new lt;$a.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,this.l/t)},$a.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,t*this.l)},$a.rgb=function(){return ct(this.h,this.s,this.l)},ca.hcl=ht;var ts=ht.prototype=new lt;ts.brighter=function(t){return new ht(this.h,this.c,Math.min(100,this.l+es*(arguments.length?t:1)))},ts.darker=function(t){return new ht(this.h,this.c,Math.max(0,this.l-es*(arguments.length?t:1)))},ts.rgb=function(){return ft(this.h,this.c,this.l).rgb()},ca.lab=pt;var es=18,rs=.95047,ns=1,is=1.08883,os=pt.prototype=new lt;os.brighter=function(t){return new pt(Math.min(100,this.l+es*(arguments.length?t:1)),this.a,this.b)},os.darker=function(t){return new pt(Math.max(0,this.l-es*(arguments.length?t:1)),this.a,this.b)},os.rgb=function(){return dt(this.l,this.a,this.b)},ca.rgb=bt;var as=bt.prototype=new lt;as.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,i=30;return e||r||n?(e&&i>e&&(e=i),r&&i>r&&(r=i),n&&i>n&&(n=i),new bt(Math.min(255,e/t),Math.min(255,r/t),Math.min(255,n/t))):new bt(i,i,i)},as.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new bt(t*this.r,t*this.g,t*this.b)},as.hsl=function(){return kt(this.r,this.g,this.b)},as.toString=function(){return"#"+wt(this.r)+wt(this.g)+wt(this.b)};var ss=ca.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});ss.forEach(function(t,e){ss.set(t,xt(e))}),ca.functor=St,ca.xhr=Lt(x),ca.dsv=function(t,e){function r(t,r,o){arguments.length<3&&(o=r,r=null);var a=zt(t,e,null==r?n:i(r),o);return a.row=function(t){return arguments.length?a.response(null==(r=t)?n:i(t)):r},a}function n(t){return r.parse(t.responseText)}function i(t){return function(e){return r.parse(e.responseText,t)}}function o(e){return e.map(a).join(t)}function a(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return r.parse=function(t,e){var n;return r.parseRows(t,function(t,r){if(n)return n(t,r-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");n=e?function(t,r){return e(i(t),r)}:i})},r.parseRows=function(t,e){function r(){if(c>=u)return a;if(i)return i=!1,o;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++c;){var n=t.charCodeAt(c++),s=1;if(10===n)i=!0;else if(13===n)i=!0,10===t.charCodeAt(c)&&(++c,++s);else if(n!==l)continue;return t.slice(e,c-s)}return t.slice(e)}for(var n,i,o={},a={},s=[],u=t.length,c=0,h=0;(n=r())!==a;){for(var f=[];n!==o&&n!==a;)f.push(n),n=r();e&&null==(f=e(f,h++))||s.push(f)}return s},r.format=function(e){if(Array.isArray(e[0]))return r.formatRows(e);var n=new b,i=[];return e.forEach(function(t){for(var e in t)n.has(e)||i.push(n.add(e))}),[i.map(a).join(t)].concat(e.map(function(e){return i.map(function(t){return a(e[t])}).join(t)})).join("\n")},r.formatRows=function(t){return t.map(o).join("\n")},r},ca.csv=ca.dsv(",","text/csv"),ca.tsv=ca.dsv(" ","text/tab-separated-values");var ls,us,cs,hs,fs=this[w(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};ca.timer=function(){Ct.apply(this,arguments)},ca.timer.flush=function(){jt(),Dt()},ca.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var ps=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Ft);ca.formatPrefix=function(t,e){var r=0;return(t=+t)&&(0>t&&(t*=-1),e&&(t=ca.round(t,Ot(t,e))),r=1+Math.floor(1e-12+Math.log(t)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((r-1)/3)))),ps[8+r/3]};var ds=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ms=ca.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ca.round(t,Ot(t,e))).toFixed(Math.max(0,Math.min(20,Ot(t*(1+1e-15),e))))}}),gs=ca.time={},vs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ys.setUTCDate.apply(this._,arguments)},setDay:function(){ys.setUTCDay.apply(this._,arguments)},setFullYear:function(){ys.setUTCFullYear.apply(this._,arguments)},setHours:function(){ys.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ys.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ys.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ys.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ys.setUTCSeconds.apply(this._,arguments)},setTime:function(){ys.setTime.apply(this._,arguments)}};var ys=Date.prototype;gs.year=Vt(function(t){return t=gs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),gs.years=gs.year.range,gs.years.utc=gs.year.utc.range,gs.day=Vt(function(t){var e=new vs(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}),gs.days=gs.day.range,gs.days.utc=gs.day.utc.range,gs.dayOfYear=function(t){var e=gs.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=gs[t]=Vt(function(t){return(t=gs.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=gs.year(t).getDay();return Math.floor((gs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});gs[t+"s"]=r.range,gs[t+"s"].utc=r.utc.range,gs[t+"OfYear"]=function(t){var r=gs.year(t).getDay();return Math.floor((gs.dayOfYear(t)+(r+e)%7)/7)}}),gs.week=gs.sunday,gs.weeks=gs.sunday.range,gs.weeks.utc=gs.sunday.utc.range,gs.weekOfYear=gs.sundayOfYear;var bs={"-":"",_:" ",0:"0"},xs=/^\s*\d+/,_s=/^%/;ca.locale=function(t){return{numberFormat:Nt(t),timeFormat:Gt(t)}};var ws=ca.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ca.format=ws.numberFormat,ca.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,Ms),fe(Ms.s,this.s,this),this.s?this.t+=Ms.t:this.s=Ms.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Ms=new he;ca.geo.stream=function(t,e){t&&ks.hasOwnProperty(t.type)?ks[t.type](t,e):pe(t,e)};var ks={Feature:function(t,e){pe(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nt?4*Ua+t:t,Ss.lineStart=Ss.lineEnd=Ss.point=M}};ca.geo.bounds=function(){function t(t,e){b.push(x=[c=t,f=t]),h>e&&(h=e),e>p&&(p=e)}function e(e,r){var n=ve([e*Ha,r*Ha]);if(v){var i=be(v,n),o=[i[1],-i[0],0],a=be(o,i);we(a),a=Me(a);var l=e-d,u=l>0?1:-1,m=a[0]*Xa*u,g=wa(l)>180;if(g^(m>u*d&&u*e>m)){var y=a[1]*Xa;y>p&&(p=y)}else if(m=(m+360)%360-180,g^(m>u*d&&u*e>m)){var y=-a[1]*Xa;h>y&&(h=y)}else h>r&&(h=r),r>p&&(p=r);g?d>e?s(c,e)>s(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e):f>=c?(c>e&&(c=e),e>f&&(f=e)):e>d?s(c,e)>s(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e)}else t(e,r);v=n,d=e}function r(){_.point=e}function n(){x[0]=c,x[1]=f,_.point=t,v=null}function i(t,r){if(v){var n=t-d;y+=wa(n)>180?n+(n>0?360:-360):n}else m=t,g=r;Ss.point(t,r),e(t,r)}function o(){Ss.lineStart()}function a(){i(m,g),Ss.lineEnd(),wa(y)>Na&&(c=-(f=180)),x[0]=c,x[1]=f,v=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tEs?(c=-(f=180),h=-(p=90)):y>Na?p=90:-Na>y&&(h=-90),x[0]=c,x[1]=f}};return function(t){p=f=-(c=h=1/0),b=[],ca.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],o=[i];e>n;++n)r=b[n],u(r[0],i)||u(r[1],i)?(s(i[0],r[1])>s(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(var a,r,d=-(1/0),e=o.length-1,n=0,i=o[e];e>=n;i=r,++n)r=o[n],(a=s(i[1],r[0]))>d&&(d=a,c=r[0],f=i[1])}return b=x=null,c===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,h],[f,p]]}}(),ca.geo.centroid=function(t){Ls=zs=Is=Ps=Cs=Rs=js=Ds=Os=Fs=Ns=0,ca.geo.stream(t,Bs);var e=Os,r=Fs,n=Ns,i=e*e+r*r+n*n;return Ba>i&&(e=Rs,r=js,n=Ds,Na>zs&&(e=Is,r=Ps,n=Cs),i=e*e+r*r+n*n,Ba>i)?[NaN,NaN]:[Math.atan2(r,e)*Xa,nt(n/Math.sqrt(i))*Xa]};var Ls,zs,Is,Ps,Cs,Rs,js,Ds,Os,Fs,Ns,Bs={sphere:M,point:Ae,lineStart:Ee,lineEnd:Se,polygonStart:function(){Bs.lineStart=Le},polygonEnd:function(){Bs.lineStart=Ee}},Us=je(Ie,Ne,Ue,[-Ua,-Ua/2]),Vs=1e9;ca.geo.clipExtent=function(){var t,e,r,n,i,o,a={stream:function(t){return i&&(i.valid=!1),i=o(t),i.valid=!0,i},extent:function(s){return arguments.length?(o=He(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),a):[[t,e],[r,n]]}};return a.extent([[0,0],[960,500]])},(ca.geo.conicEqualArea=function(){return Xe(Ye)}).raw=Ye,ca.geo.albers=function(){return ca.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ca.geo.albersUsa=function(){function t(t){var o=t[0],a=t[1];return e=null,r(o,a),e||(n(o,a),e)||i(o,a),e}var e,r,n,i,o=ca.geo.albers(),a=ca.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=ca.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};return t.invert=function(t){var e=o.scale(),r=o.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&.234>i&&n>=-.425&&-.214>n?a:i>=.166&&.234>i&&n>=-.214&&-.115>n?s:o).invert(t)},t.stream=function(t){var e=o.stream(t),r=a.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),a.precision(e),s.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),a.scale(.35*e),s.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var u=o.scale(),c=+e[0],h=+e[1];return r=o.translate(e).clipExtent([[c-.455*u,h-.238*u],[c+.455*u,h+.238*u]]).stream(l).point,n=a.translate([c-.307*u,h+.201*u]).clipExtent([[c-.425*u+Na,h+.12*u+Na],[c-.214*u-Na,h+.234*u-Na]]).stream(l).point,i=s.translate([c-.205*u,h+.212*u]).clipExtent([[c-.214*u+Na,h+.166*u+Na],[c-.115*u-Na,h+.234*u-Na]]).stream(l).point,t},t.scale(1070)};var qs,Gs,Hs,Xs,Ys,Ws,Zs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Gs=0,Zs.lineStart=We},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=M,qs+=wa(Gs/2)}},Qs={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Ks={point:Je,lineStart:$e,lineEnd:tr,polygonStart:function(){Ks.lineStart=er},polygonEnd:function(){Ks.point=Je,Ks.lineStart=$e,Ks.lineEnd=tr}};ca.geo.path=function(){function t(t){return t&&("function"==typeof s&&o.pointRadius(+s.apply(this,arguments)),a&&a.valid||(a=i(o)),ca.geo.stream(t,a)),o.result()}function e(){return a=null,t}var r,n,i,o,a,s=4.5;return t.area=function(t){return qs=0,ca.geo.stream(t,i(Zs)),qs},t.centroid=function(t){return Is=Ps=Cs=Rs=js=Ds=Os=Fs=Ns=0,ca.geo.stream(t,i(Ks)),Ns?[Os/Ns,Fs/Ns]:Ds?[Rs/Ds,js/Ds]:Cs?[Is/Cs,Ps/Cs]:[NaN,NaN]},t.bounds=function(t){return Ys=Ws=-(Hs=Xs=1/0),ca.geo.stream(t,i(Qs)),[[Hs,Xs],[Ys,Ws]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(o=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&o.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(o.pointRadius(+e),+e),t):s},t.projection(ca.geo.albersUsa()).context(null)},ca.geo.transform=function(t){return{stream:function(e){var r=new or(e);for(var n in t)r[n]=t[n];return r}}},or.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ca.geo.projection=sr,ca.geo.projectionMutator=lr,(ca.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,ca.geo.rotation=function(t){function e(e){return e=t(e[0]*Ha,e[1]*Ha),e[0]*=Xa,e[1]*=Xa,e}return t=fr(t[0]%360*Ha,t[1]*Ha,t.length>2?t[2]*Ha:0),e.invert=function(e){return e=t.invert(e[0]*Ha,e[1]*Ha),e[0]*=Xa,e[1]*=Xa,e},e},hr.invert=cr,ca.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=fr(-t[0]*Ha,-t[1]*Ha,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=Xa,t[1]*=Xa}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=gr((e=+n)*Ha,i*Ha),t):e},t.precision=function(n){return arguments.length?(r=gr(e*Ha,(i=+n)*Ha),t):i},t.angle(90)},ca.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ha,i=t[1]*Ha,o=e[1]*Ha,a=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(o),h=Math.cos(o);return Math.atan2(Math.sqrt((r=h*a)*r+(r=u*c-l*h*s)*r),l*c+u*h*s)},ca.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ca.range(Math.ceil(o/g)*g,i,g).map(f).concat(ca.range(Math.ceil(u/v)*v,l,v).map(p)).concat(ca.range(Math.ceil(n/d)*d,r,d).filter(function(t){return wa(t%g)>Na}).map(c)).concat(ca.range(Math.ceil(s/m)*m,a,m).filter(function(t){return wa(t%v)>Na}).map(h))}var r,n,i,o,a,s,l,u,c,h,f,p,d=10,m=d,g=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[f(o).concat(p(l).slice(1),f(i).reverse().slice(1),p(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],o>i&&(e=o,o=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[o,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],a=+e[1][1],n>r&&(e=n,n=r,r=e),s>a&&(e=s,s=a,a=e),t.precision(y)):[[n,s],[r,a]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],t):[g,v]},t.minorStep=function(e){return arguments.length?(d=+e[0],m=+e[1],t):[d,m]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,a,90),h=br(n,r,y),f=yr(u,l,90),p=br(o,i,y),t):y},t.majorExtent([[-180,-90+Na],[180,90-Na]]).minorExtent([[-180,-80-Na],[180,80+Na]])},ca.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=xr,i=_r;return t.distance=function(){return ca.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},ca.geo.interpolate=function(t,e){return wr(t[0]*Ha,t[1]*Ha,e[0]*Ha,e[1]*Ha)},ca.geo.length=function(t){return Js=0,ca.geo.stream(t,$s),Js};var Js,$s={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},tl=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ca.geo.azimuthalEqualArea=function(){return sr(tl)}).raw=tl;var el=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(ca.geo.azimuthalEquidistant=function(){return sr(el)}).raw=el,(ca.geo.conicConformal=function(){return Xe(Ar)}).raw=Ar,(ca.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var rl=kr(function(t){return 1/t},Math.atan);(ca.geo.gnomonic=function(){return sr(rl)}).raw=rl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ga]},(ca.geo.mercator=function(){return Sr(Er)}).raw=Er;var nl=kr(function(){return 1},Math.asin);(ca.geo.orthographic=function(){return sr(nl)}).raw=nl;var il=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ca.geo.stereographic=function(){return sr(il)}).raw=il,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ga]},(ca.geo.transverseMercator=function(){var t=Sr(Lr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Lr,ca.geom={},ca.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=St(r),o=St(n),a=t.length,s=[],l=[];for(e=0;a>e;e++)s.push([+i.call(this,t[e],e),+o.call(this,t[e],e),e]);for(s.sort(Cr),e=0;a>e;e++)l.push([s[e][0],-s[e][1]]);var u=Pr(s),c=Pr(l),h=c[0]===u[0],f=c[c.length-1]===u[u.length-1],p=[];for(e=u.length-1;e>=0;--e)p.push(t[s[u[e]][2]]);for(e=+h;e=n&&u.x<=o&&u.y>=i&&u.y<=a?[[n,a],[o,a],[o,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Na)*Na,y:Math.round(a(t,e)/Na)*Na,i:e}})}var n=zr,i=Ir,o=n,a=i,s=pl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,o,a=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,h=c.l===a?c.r:c.l;++l=u,f=n>=c,p=f<<1|h;t.leaf=!1,t=t.nodes[p]||(t.nodes[p]=dn()),h?i=u:s=u,f?a=c:l=c,o(t,e,r,n,i,a,s,l)}var c,h,f,p,d,m,g,v,y,b=St(s),x=St(l);if(null!=e)m=e,g=r,v=n,y=i;else if(v=y=-(m=g=1/0),h=[],f=[],d=t.length,a)for(p=0;d>p;++p)c=t[p],c.xv&&(v=c.x),c.y>y&&(y=c.y),h.push(c.x),f.push(c.y);else for(p=0;d>p;++p){var _=+b(c=t[p],p),w=+x(c,p);m>_&&(m=_),g>w&&(g=w),_>v&&(v=_),w>y&&(y=w),h.push(_),f.push(w)}var M=v-m,k=y-g;M>k?y=g+M:v=m+k;var A=dn();if(A.add=function(t){o(A,t,+b(t,++p),+x(t,p),m,g,v,y)},A.visit=function(t){mn(t,A,m,g,v,y)},A.find=function(t){return gn(A,t[0],t[1],m,g,v,y)},p=-1,null==e){for(;++p=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=vl.get(r)||gl,n=yl.get(n)||x,Mn(n(r.apply(null,ha.call(arguments,1))))},ca.interpolateHcl=Dn,ca.interpolateHsl=On,ca.interpolateLab=Fn,ca.interpolateRound=Nn,ca.transform=function(t){var e=pa.createElementNS(ca.ns.prefix.svg,"g");return(ca.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:bl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var bl={a:1,b:0,c:0,d:1,e:0,f:0};ca.interpolateTransform=Zn,ca.layout={},ca.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++rs*s/v){if(m>l){var u=e.charge/l;t.px-=o*u,t.py-=a*u}return!0}if(e.point&&l&&m>l){var u=e.pointCharge/l;t.px-=o*u,t.py-=a*u}}return!e.charge}}function e(t){t.px=ca.event.x,t.py=ca.event.y,l.resume()}var r,n,i,o,a,s,l={},u=ca.dispatch("start","tick","end"),c=[1,1],h=.9,f=xl,p=_l,d=-30,m=wl,g=.1,v=.64,y=[],b=[];return l.tick=function(){if((i*=.99)<.005)return r=null,u.end({type:"end",alpha:i=0}),!0;var e,n,l,f,p,m,v,x,_,w=y.length,M=b.length;for(n=0;M>n;++n)l=b[n],f=l.source,p=l.target,x=p.x-f.x,_=p.y-f.y,(m=x*x+_*_)&&(m=i*a[n]*((m=Math.sqrt(m))-o[n])/m,x*=m,_*=m,p.x-=x*(v=f.weight+p.weight?f.weight/(f.weight+p.weight):.5),p.y-=_*v,f.x+=x*(v=1-v),f.y+=_*v);if((v=i*g)&&(x=c[0]/2,_=c[1]/2,n=-1,v))for(;++n0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=Ct(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;i>l;++l)r[l]=[];for(l=0;u>l;++l){var o=b[l];r[o.source.index].push(o.target),r[o.target.index].push(o.source)}}for(var a,s=r[e],l=-1,c=s.length;++le;++e)(n=y[e]).index=e,n.weight=0;for(e=0;u>e;++e)n=b[e],"number"==typeof n.source&&(n.source=y[n.source]),"number"==typeof n.target&&(n.target=y[n.target]),++n.source.weight,++n.target.weight;for(e=0;i>e;++e)n=y[e],isNaN(n.x)&&(n.x=t("x",h)),isNaN(n.y)&&(n.y=t("y",m)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(o=[],"function"==typeof f)for(e=0;u>e;++e)o[e]=+f.call(this,b[e],e);else for(e=0;u>e;++e)o[e]=f;if(a=[],"function"==typeof p)for(e=0;u>e;++e)a[e]=+p.call(this,b[e],e);else for(e=0;u>e;++e)a[e]=p;if(s=[],"function"==typeof d)for(e=0;i>e;++e)s[e]=+d.call(this,y[e],e);else for(e=0;i>e;++e)s[e]=d;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return n||(n=ca.behavior.drag().origin(x).on("dragstart.force",ei).on("drag.force",e).on("dragend.force",ri)),arguments.length?void this.on("mouseover.force",ni).on("mouseout.force",ii).call(n):n},ca.rebind(l,u,"on")};var xl=20,_l=1,wl=1/0;ca.layout.hierarchy=function(){function t(i){var o,a=[i],s=[];for(i.depth=0;null!=(o=a.pop());)if(s.push(o),(u=r.call(t,o,o.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)a.push(c=u[l]),c.parent=o,c.depth=o.depth+1;n&&(o.value=0),o.children=u}else n&&(o.value=+n.call(t,o,o.depth)||0),delete o.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=hi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value)})),e},t},ca.layout.partition=function(){function t(e,r,n,i){var o=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,o&&(a=o.length)){var a,s,l,u=-1;for(n=e.value?n/e.value:0;++uh?-1:1),d=ca.sum(u),m=d?(h-l*p)/d:0,g=ca.range(l),v=[];return null!=r&&g.sort(r===Ml?function(t,e){return u[e]-u[t]}:function(t,e){return r(a[t],a[e])}),g.forEach(function(t){v[t]={data:a[t],value:s=u[t],startAngle:c,endAngle:c+=s*m+p,padAngle:f}}),v}var e=Number,r=Ml,n=0,i=Va,o=0;return t.value=function(r){return arguments.length?(e=r,t):e},t.sort=function(e){return arguments.length?(r=e,t):r},t.startAngle=function(e){return arguments.length?(n=e,t):n},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(o=e,t):o},t};var Ml={};ca.layout.stack=function(){function t(s,l){if(!(f=s.length))return s;var u=s.map(function(r,n){return e.call(t,r,n)}),c=u.map(function(e){return e.map(function(e,r){return[o.call(t,e,r),a.call(t,e,r)]})}),h=r.call(t,c,l);u=ca.permute(u,h),c=ca.permute(c,h);var f,p,d,m,g=n.call(t,c,l),v=u[0].length;for(d=0;v>d;++d)for(i.call(t,u[0][d],m=g[d],c[0][d][1]),p=1;f>p;++p)i.call(t,u[p][d],m+=c[p-1][d][1],c[p][d][1]);return s}var e=x,r=gi,n=vi,i=mi,o=pi,a=di;return t.values=function(r){return arguments.length?(e=r,t):e},t.order=function(e){return arguments.length?(r="function"==typeof e?e:kl.get(e)||gi,t):r},t.offset=function(e){return arguments.length?(n="function"==typeof e?e:Al.get(e)||vi,t):n},t.x=function(e){return arguments.length?(o=e,t):o},t.y=function(e){return arguments.length?(a=e,t):a},t.out=function(e){return arguments.length?(i=e,t):i},t};var kl=ca.map({"inside-out":function(t){var e,r,n=t.length,i=t.map(yi),o=t.map(bi),a=ca.range(n).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,u=[],c=[];for(e=0;n>e;++e)r=a[e],l>s?(s+=o[r],u.push(r)):(l+=o[r],c.push(r));return c.reverse().concat(u)},reverse:function(t){return ca.range(t.length).reverse()},"default":gi}),Al=ca.map({silhouette:function(t){var e,r,n,i=t.length,o=t[0].length,a=[],s=0,l=[];for(r=0;o>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];n>s&&(s=n),a.push(n)}for(r=0;o>r;++r)l[r]=(s-a[r])/2;return l},wiggle:function(t){var e,r,n,i,o,a,s,l,u,c=t.length,h=t[0],f=h.length,p=[];for(p[0]=l=u=0,r=1;f>r;++r){for(e=0,i=0;c>e;++e)i+=t[e][r][1];for(e=0,o=0,s=h[r][0]-h[r-1][0];c>e;++e){for(n=0,a=(t[e][r][1]-t[e][r-1][1])/(2*s);e>n;++n)a+=(t[n][r][1]-t[n][r-1][1])/s;o+=a*t[e][r][1]}p[r]=l-=i?o/i*s:0,u>l&&(u=l)}for(r=0;f>r;++r)p[r]-=u;return p},expand:function(t){var e,r,n,i=t.length,o=t[0].length,a=1/i,s=[];for(r=0;o>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];if(n)for(e=0;i>e;e++)t[e][r][1]/=n;else for(e=0;i>e;e++)t[e][r][1]=a}for(r=0;o>r;++r)s[r]=0;return s},zero:vi});ca.layout.histogram=function(){function t(t,o){for(var a,s,l=[],u=t.map(r,this),c=n.call(this,u,o),h=i.call(this,c,u,o),o=-1,f=u.length,p=h.length-1,d=e?1:1/f;++o0)for(o=-1;++o=c[0]&&s<=c[1]&&(a=l[ca.bisect(h,s,1,p)-1],a.y+=d,a.push(t[o]));return l}var e=!0,r=Number,n=Mi,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=St(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:St(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},ca.layout.pack=function(){function t(t,o){var a=r.call(this,t,o),s=a[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Si),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=h}),li(s,Si),li(s,function(t){t.r-=h})}return Ii(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),a}var e,r=ca.layout.hierarchy().sort(ki),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},ai(t,r)},ca.layout.tree=function(){function t(t,i){var c=a.call(this,t,i),h=c[0],f=e(h);if(li(f,r),f.parent.m=-f.z,si(f,n),u)si(h,o);else{var p=h,d=h,m=h;si(h,function(t){t.xd.x&&(d=t),t.depth>m.depth&&(m=t)});var g=s(p,d)/2-p.x,v=l[0]/(d.x+s(d,p)/2+g),y=l[1]/(m.depth||1);si(h,function(t){t.x=(t.x+g)*v,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,o=e.children,a=0,s=o.length;s>a;++a)n.push((o[a]=i={_:o[a],parent:e,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return r.children[0]}function r(t){var e=t.children,r=t.parent.children,n=t.i?r[t.i-1]:null;if(e.length){Oi(t);var o=(e[0].z+e[e.length-1].z)/2;n?(t.z=n.z+s(t._,n._),t.m=t.z-o):t.z=o}else n&&(t.z=n.z+s(t._,n._));t.parent.A=i(t,n,t.parent.A||r[0])}function n(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t,e,r){if(e){for(var n,i=t,o=t,a=e,l=i.parent.children[0],u=i.m,c=o.m,h=a.m,f=l.m;a=ji(a),i=Ri(i),a&&i;)l=Ri(l),o=ji(o),o.a=t,n=a.z+h-i.z-u+s(a._,i._),n>0&&(Di(Fi(a,t,r),t,n),u+=n,c+=n),h+=a.m,u+=i.m,f+=l.m,c+=o.m;a&&!ji(o)&&(o.t=a,o.m+=h-c),i&&!Ri(l)&&(l.t=i,l.m+=u-f,r=t)}return r}function o(t){t.x*=l[0],t.y=t.depth*l[1]}var a=ca.layout.hierarchy().sort(null).value(null),s=Ci,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?o:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:o,t):u?l:null},ai(t,a)},ca.layout.cluster=function(){function t(t,o){var a,s=e.call(this,t,o),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Ni(e)):(t.x=a?u+=r(t,a):0,t.y=0,a=t)});var c=Ui(l),h=Vi(l),f=c.x-r(c,h)/2,p=h.x+r(h,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-f)/(p-f)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=ca.layout.hierarchy().sort(null).value(null),r=Ci,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},ai(t,e)},ca.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,o=t.length;++ie?0:e),r.area=isNaN(n)||0>=n?0:n}function e(r){var o=r.children;if(o&&o.length){var a,s,l,u=h(r),c=[],f=o.slice(),d=1/0,m="slice"===p?u.dx:"dice"===p?u.dy:"slice-dice"===p?1&r.depth?u.dy:u.dx:Math.min(u.dx,u.dy);for(t(f,u.dx*u.dy/r.value),c.area=0;(l=f.length)>0;)c.push(a=f[l-1]),c.area+=a.area,"squarify"!==p||(s=n(c,m))<=d?(f.pop(),d=s):(c.area-=c.pop().area,i(c,m,u,!1),m=Math.min(u.dx,u.dy),c.length=c.area=0,d=1/0);c.length&&(i(c,m,u,!0),c.length=c.area=0),o.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var o,a=h(e),s=n.slice(),l=[];for(t(s,a.dx*a.dy/e.value),l.area=0;o=s.pop();)l.push(o),l.area+=o.area,null!=o.z&&(i(l,o.z?a.dx:a.dy,a,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,o=1/0,a=-1,s=t.length;++ar&&(o=r),r>i&&(i=r));return n*=n,e*=e,n?Math.max(e*i*d/n,n/(e*o*d)):1/0}function i(t,e,r,n){var i,o=-1,a=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++or.dx)&&(c=r.dx);++or&&(e=1),1>r&&(t=0),function(){var r,n,i;do r=2*Math.random()-1,n=2*Math.random()-1,i=r*r+n*n;while(!i||i>1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=ca.random.normal.apply(ca,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ca.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;t>r;r++)e+=Math.random();return e}}},ca.scale={};var Tl={floor:x,ceil:x};ca.scale.linear=function(){return Ki([0,1],[0,1],_n,!1)};var El={s:1,g:1,p:1,r:1,e:1};ca.scale.log=function(){return oo(ca.scale.linear().domain([0,1]),10,!0,[1,10])};var Sl=ca.format(".0e"),Ll={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};ca.scale.pow=function(){return ao(ca.scale.linear(),1,[0,1])},ca.scale.sqrt=function(){return ca.scale.pow().exponent(.5)},ca.scale.ordinal=function(){return lo([],{t:"range",a:[[]]})},ca.scale.category10=function(){return ca.scale.ordinal().range(zl)},ca.scale.category20=function(){return ca.scale.ordinal().range(Il)},ca.scale.category20b=function(){return ca.scale.ordinal().range(Pl)},ca.scale.category20c=function(){return ca.scale.ordinal().range(Cl)};var zl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(_t),Il=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(_t),Pl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(_t),Cl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(_t);ca.scale.quantile=function(){return uo([],[])},ca.scale.quantize=function(){return co(0,1,[0,1])},ca.scale.threshold=function(){return ho([.5],[0,1])},ca.scale.identity=function(){return fo([0,1])},ca.svg={},ca.svg.arc=function(){function t(){var t=Math.max(0,+r.apply(this,arguments)),u=Math.max(0,+n.apply(this,arguments)),c=a.apply(this,arguments)-Ga,h=s.apply(this,arguments)-Ga,f=Math.abs(h-c),p=c>h?0:1;if(t>u&&(d=u,u=t,t=d),f>=qa)return e(u,p)+(t?e(t,1-p):"")+"Z";var d,m,g,v,y,b,x,_,w,M,k,A,T=0,E=0,S=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=o===Rl?Math.sqrt(t*t+u*u):+o.apply(this,arguments),p||(E*=-1),u&&(E=nt(g/u*Math.sin(v))),t&&(T=nt(g/t*Math.sin(v)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(h-E),_=u*Math.sin(h-E);var L=Math.abs(h-c-2*E)<=Ua?0:1;if(E&&xo(y,b,x,_)===p^L){var z=(c+h)/2;y=u*Math.cos(z),b=u*Math.sin(z),x=_=null}}else y=b=0;if(t){w=t*Math.cos(h-T),M=t*Math.sin(h-T),k=t*Math.cos(c+T),A=t*Math.sin(c+T);var I=Math.abs(c-h+2*T)<=Ua?0:1;if(T&&xo(w,M,k,A)===1-p^I){var P=(c+h)/2;w=t*Math.cos(P),M=t*Math.sin(P),k=A=null}}else w=M=0;if(f>Na&&(d=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){m=u>t^p?0:1;var C=d,R=d;if(Ua>f){var j=null==k?[w,M]:null==x?[y,b]:jr([y,b],[k,A],[x,_],[w,M]),D=y-j[0],O=b-j[1],F=x-j[0],N=_-j[1],B=1/Math.sin(Math.acos((D*F+O*N)/(Math.sqrt(D*D+O*O)*Math.sqrt(F*F+N*N)))/2),U=Math.sqrt(j[0]*j[0]+j[1]*j[1]);R=Math.min(d,(t-U)/(B-1)),C=Math.min(d,(u-U)/(B+1))}if(null!=x){var V=_o(null==k?[w,M]:[k,A],[y,b],u,C,p),q=_o([x,_],[w,M],u,C,p);d===C?S.push("M",V[0],"A",C,",",C," 0 0,",m," ",V[1],"A",u,",",u," 0 ",1-p^xo(V[1][0],V[1][1],q[1][0],q[1][1]),",",p," ",q[1],"A",C,",",C," 0 0,",m," ",q[0]):S.push("M",V[0],"A",C,",",C," 0 1,",m," ",q[0])}else S.push("M",y,",",b);if(null!=k){var G=_o([y,b],[k,A],t,-R,p),H=_o([w,M],null==x?[y,b]:[x,_],t,-R,p);d===R?S.push("L",H[0],"A",R,",",R," 0 0,",m," ",H[1],"A",t,",",t," 0 ",p^xo(H[1][0],H[1][1],G[1][0],G[1][1]),",",1-p," ",G[1],"A",R,",",R," 0 0,",m," ",G[0]):S.push("L",H[0],"A",R,",",R," 0 0,",m," ",G[0])}else S.push("L",w,",",M)}else S.push("M",y,",",b),null!=x&&S.push("A",u,",",u," 0 ",L,",",p," ",x,",",_),S.push("L",w,",",M),null!=k&&S.push("A",t,",",t," 0 ",I,",",1-p," ",k,",",A);return S.push("Z"),S.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var r=mo,n=go,i=po,o=Rl,a=vo,s=yo,l=bo;return t.innerRadius=function(e){return arguments.length?(r=St(e),t):r},t.outerRadius=function(e){return arguments.length?(n=St(e),t):n},t.cornerRadius=function(e){return arguments.length?(i=St(e),t):i},t.padRadius=function(e){return arguments.length?(o=e==Rl?Rl:St(e),t):o},t.startAngle=function(e){return arguments.length?(a=St(e),t):a},t.endAngle=function(e){return arguments.length?(s=St(e),t):s},t.padAngle=function(e){return arguments.length?(l=St(e),t):l},t.centroid=function(){var t=(+r.apply(this,arguments)+ +n.apply(this,arguments))/2,e=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-Ga;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Rl="auto";ca.svg.line=function(){return wo(x)};var jl=ca.map({linear:Mo,"linear-closed":ko,step:Ao,"step-before":To,"step-after":Eo,basis:Co,"basis-open":Ro,"basis-closed":jo,bundle:Do,cardinal:zo,"cardinal-open":So,"cardinal-closed":Lo,monotone:Vo});jl.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var Dl=[0,2/3,1/3,0],Ol=[0,1/3,2/3,0],Fl=[0,1/6,2/3,1/6];ca.svg.line.radial=function(){var t=wo(qo);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},To.reverse=Eo,Eo.reverse=To,ca.svg.area=function(){return Go(x)},ca.svg.area.radial=function(){var t=Go(qo);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},ca.svg.chord=function(){function t(t,s){var l=e(this,o,t,s),u=e(this,a,t,s);return"M"+l.p0+n(l.r,l.p1,l.a1-l.a0)+(r(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+n(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function e(t,e,r,n){var i=e.call(t,r,n),o=s.call(t,i,n),a=l.call(t,i,n)-Ga,c=u.call(t,i,n)-Ga;return{r:o,a0:a,a1:c,p0:[o*Math.cos(a),o*Math.sin(a)],p1:[o*Math.cos(c),o*Math.sin(c)]}}function r(t,e){return t.a0==e.a0&&t.a1==e.a1}function n(t,e,r){return"A"+t+","+t+" 0 "+ +(r>Ua)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var o=xr,a=_r,s=Ho,l=vo,u=yo;return t.radius=function(e){return arguments.length?(s=St(e),t):s},t.source=function(e){return arguments.length?(o=St(e),t):o},t.target=function(e){return arguments.length?(a=St(e),t):a},t.startAngle=function(e){return arguments.length?(l=St(e),t):l},t.endAngle=function(e){return arguments.length?(u=St(e),t):u},t},ca.svg.diagonal=function(){function t(t,i){var o=e.call(this,t,i),a=r.call(this,t,i),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Xo;return t.source=function(r){return arguments.length?(e=St(r),t):e},t.target=function(e){return arguments.length?(r=St(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},ca.svg.diagonal.radial=function(){var t=ca.svg.diagonal(),e=Xo,r=t.projection;return t.projection=function(t){return arguments.length?r(Yo(e=t)):e},t},ca.svg.symbol=function(){function t(t,n){return(Nl.get(e.call(this,t,n))||Qo)(r.call(this,t,n))}var e=Zo,r=Wo;return t.type=function(r){return arguments.length?(e=St(r),t):e},t.size=function(e){return arguments.length?(r=St(e),t):r},t};var Nl=ca.map({circle:Qo,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Ul)),r=e*Ul;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Bl),r=e*Bl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Bl),r=e*Bl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ca.svg.symbolTypes=Nl.keys();var Bl=Math.sqrt(3),Ul=Math.tan(30*Ha);Ia.transition=function(t){for(var e,r,n=Vl||++Xl,i=ea(t),o=[],a=ql||{time:Date.now(),ease:Sn,delay:0,duration:250},s=-1,l=this.length;++so;o++){i.push(e=[]);for(var r=this[o],s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,o)&&e.push(n)}return Jo(i,this.namespace,this.id)},Hl.tween=function(t,e){var r=this.id,n=this.namespace;return arguments.length<2?this.node()[n][r].tween.get(t):H(this,null==e?function(e){e[n][r].tween.remove(t)}:function(i){i[n][r].tween.set(t,e)})},Hl.attr=function(t,e){function r(){this.removeAttribute(s)}function n(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?r:(t+="",function(){var e,r=this.getAttribute(s);return r!==t&&(e=a(r,t),function(t){this.setAttribute(s,e(t))})})}function o(t){return null==t?n:(t+="",function(){var e,r=this.getAttributeNS(s.space,s.local);return r!==t&&(e=a(r,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var a="transform"==t?Zn:_n,s=ca.ns.qualify(t);return $o(this,"attr."+t,e,s.local?o:i)},Hl.attrTween=function(t,e){function r(t,r){var n=e.call(this,t,r,this.getAttribute(i));return n&&function(t){this.setAttribute(i,n(t))}}function n(t,r){var n=e.call(this,t,r,this.getAttributeNS(i.space,i.local));return n&&function(t){this.setAttributeNS(i.space,i.local,n(t))}}var i=ca.ns.qualify(t);return this.tween("attr."+t,i.local?n:r)},Hl.style=function(t,e,r){function i(){this.style.removeProperty(t)}function o(e){return null==e?i:(e+="",function(){var i,o=n(this).getComputedStyle(this,null).getPropertyValue(t);return o!==e&&(i=_n(o,e),function(e){this.style.setProperty(t,i(e),r)})})}var a=arguments.length;if(3>a){if("string"!=typeof t){2>a&&(e="");for(r in t)this.style(r,t[r],e);return this}r=""}return $o(this,"style."+t,e,o)},Hl.styleTween=function(t,e,r){function i(i,o){var a=e.call(this,i,o,n(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(e){this.style.setProperty(t,a(e),r)}}return arguments.length<3&&(r=""),this.tween("style."+t,i)},Hl.text=function(t){return $o(this,"text",t,ta)},Hl.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Hl.ease=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].ease:("function"!=typeof t&&(t=ca.ease.apply(ca,arguments)),H(this,function(n){n[r][e].ease=t}))},Hl.delay=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].delay:H(this,"function"==typeof t?function(n,i,o){n[r][e].delay=+t.call(n,n.__data__,i,o)}:(t=+t,function(n){n[r][e].delay=t}))},Hl.duration=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].duration:H(this,"function"==typeof t?function(n,i,o){n[r][e].duration=Math.max(1,t.call(n,n.__data__,i,o))}:(t=Math.max(1,t),function(n){n[r][e].duration=t}))},Hl.each=function(t,e){var r=this.id,n=this.namespace;if(arguments.length<2){var i=ql,o=Vl;try{Vl=r,H(this,function(e,i,o){ql=e[n][r],t.call(e,e.__data__,i,o)})}finally{ql=i,Vl=o}}else H(this,function(i){var o=i[n][r];(o.event||(o.event=ca.dispatch("start","end","interrupt"))).on(t,e)});return this},Hl.transition=function(){for(var t,e,r,n,i=this.id,o=++Xl,a=this.namespace,s=[],l=0,u=this.length;u>l;l++){s.push(t=[]);for(var e=this[l],c=0,h=e.length;h>c;c++)(r=e[c])&&(n=r[a][i],ra(r,c,a,o,{time:n.time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration})),t.push(r)}return Jo(s,a,o)},ca.svg.axis=function(){function t(t){t.each(function(){var t,u=ca.select(this),c=this.__chart__||r,h=this.__chart__=r.copy(),f=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,p=null==e?h.tickFormat?h.tickFormat.apply(h,s):x:e,d=u.selectAll(".tick").data(f,h),m=d.enter().insert("g",".domain").attr("class","tick").style("opacity",Na),g=ca.transition(d.exit()).style("opacity",Na).remove(),v=ca.transition(d.order()).style("opacity",1),y=Math.max(i,0)+a,b=Xi(h),_=u.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),ca.transition(_));m.append("line"),m.append("text");var M,k,A,T,E=m.select("line"),S=v.select("line"),L=d.select("text").text(p),z=m.select("text"),I=v.select("text"),P="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(t=na,M="x",A="y",k="x2",T="y2",L.attr("dy",0>P?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+b[0]+","+P*o+"V0H"+b[1]+"V"+P*o)):(t=ia,M="y",A="x",k="y2",T="x2",L.attr("dy",".32em").style("text-anchor",0>P?"end":"start"),w.attr("d","M"+P*o+","+b[0]+"H0V"+b[1]+"H"+P*o)), +E.attr(T,P*i),z.attr(A,P*y),S.attr(k,0).attr(T,P*i),I.attr(M,0).attr(A,P*y),h.rangeBand){var C=h,R=C.rangeBand()/2;c=h=function(t){return C(t)+R}}else c.rangeBand?c=h:g.call(t,h,c);m.call(t,c,h),v.call(t,h,h)})}var e,r=ca.scale.linear(),n=Yl,i=6,o=6,a=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(r=e,t):r},t.orient=function(e){return arguments.length?(n=e in Wl?e+"":Yl,t):n},t.ticks=function(){return arguments.length?(s=fa(arguments),t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(r){return arguments.length?(e=r,t):e},t.tickSize=function(e){var r=arguments.length;return r?(i=+e,o=+arguments[r-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(o=+e,t):o},t.tickPadding=function(e){return arguments.length?(a=+e,t):a},t.tickSubdivide=function(){return arguments.length&&t},t};var Yl="bottom",Wl={top:1,right:1,bottom:1,left:1};ca.svg.brush=function(){function t(n){n.each(function(){var n=ca.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),a=n.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),n.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=n.selectAll(".resize").data(m,x);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Zl[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var l,h=ca.transition(n),f=ca.transition(a);u&&(l=Xi(u),f.attr("x",l[0]).attr("width",l[1]-l[0]),r(h)),c&&(l=Xi(c),f.attr("y",l[0]).attr("height",l[1]-l[0]),i(h)),e(h)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+h[+/e$/.test(t)]+","+f[+/^s/.test(t)]+")"})}function r(t){t.select(".extent").attr("x",h[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",h[1]-h[0])}function i(t){t.select(".extent").attr("y",f[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function o(){function o(){32==ca.event.keyCode&&(L||(b=null,I[0]-=h[1],I[1]-=f[1],L=2),T())}function m(){32==ca.event.keyCode&&2==L&&(I[0]+=h[1],I[1]+=f[1],L=0,T())}function g(){var t=ca.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),L||(ca.event.altKey?(b||(b=[(h[0]+h[1])/2,(f[0]+f[1])/2]),I[0]=h[+(t[0]c?(i=n,n=c):i=c),m[0]!=n||m[1]!=i?(r?s=null:a=null,m[0]=n,m[1]=i,!0):void 0}function y(){g(),k.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),ca.select("body").style("cursor",null),P.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),M({type:"brushend"})}var b,x,_=this,w=ca.select(ca.event.target),M=l.of(_,arguments),k=ca.select(_),A=w.datum(),E=!/^(n|s)$/.test(A)&&u,S=!/^(e|w)$/.test(A)&&c,L=w.classed("extent"),z=K(_),I=ca.mouse(_),P=ca.select(n(_)).on("keydown.brush",o).on("keyup.brush",m);if(ca.event.changedTouches?P.on("touchmove.brush",g).on("touchend.brush",y):P.on("mousemove.brush",g).on("mouseup.brush",y),k.interrupt().selectAll("*").interrupt(),L)I[0]=h[0]-I[0],I[1]=f[0]-I[1];else if(A){var C=+/w$/.test(A),R=+/^n/.test(A);x=[h[1-C]-I[0],f[1-R]-I[1]],I[0]=h[C],I[1]=f[R]}else ca.event.altKey&&(b=I.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),ca.select("body").style("cursor",w.style("cursor")),M({type:"brushstart"}),g()}var a,s,l=S(t,"brushstart","brush","brushend"),u=null,c=null,h=[0,0],f=[0,0],p=!0,d=!0,m=Ql[0];return t.event=function(t){t.each(function(){var t=l.of(this,arguments),e={x:h,y:f,i:a,j:s},r=this.__chart__||e;this.__chart__=e,Vl?ca.select(this).transition().each("start.brush",function(){a=r.i,s=r.j,h=r.x,f=r.y,t({type:"brushstart"})}).tween("brush:brush",function(){var r=wn(h,e.x),n=wn(f,e.y);return a=s=null,function(i){h=e.x=r(i),f=e.y=n(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(u=e,m=Ql[!u<<1|!c],t):u},t.y=function(e){return arguments.length?(c=e,m=Ql[!u<<1|!c],t):c},t.clamp=function(e){return arguments.length?(u&&c?(p=!!e[0],d=!!e[1]):u?p=!!e:c&&(d=!!e),t):u&&c?[p,d]:u?p:c?d:null},t.extent=function(e){var r,n,i,o,l;return arguments.length?(u&&(r=e[0],n=e[1],c&&(r=r[0],n=n[0]),a=[r,n],u.invert&&(r=u(r),n=u(n)),r>n&&(l=r,r=n,n=l),r==h[0]&&n==h[1]||(h=[r,n])),c&&(i=e[0],o=e[1],u&&(i=i[1],o=o[1]),s=[i,o],c.invert&&(i=c(i),o=c(o)),i>o&&(l=i,i=o,o=l),i==f[0]&&o==f[1]||(f=[i,o])),t):(u&&(a?(r=a[0],n=a[1]):(r=h[0],n=h[1],u.invert&&(r=u.invert(r),n=u.invert(n)),r>n&&(l=r,r=n,n=l))),c&&(s?(i=s[0],o=s[1]):(i=f[0],o=f[1],c.invert&&(i=c.invert(i),o=c.invert(o)),i>o&&(l=i,i=o,o=l))),u&&c?[[r,i],[n,o]]:u?[r,n]:c&&[i,o])},t.clear=function(){return t.empty()||(h=[0,0],f=[0,0],a=s=null),t},t.empty=function(){return!!u&&h[0]==h[1]||!!c&&f[0]==f[1]},ca.rebind(t,l,"on")};var Zl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ql=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Kl=gs.format=ws.timeFormat,Jl=Kl.utc,$l=Jl("%Y-%m-%dT%H:%M:%S.%LZ");Kl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?oa:$l,oa.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},oa.toString=$l.toString,gs.second=Vt(function(t){return new vs(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),gs.seconds=gs.second.range,gs.seconds.utc=gs.second.utc.range,gs.minute=Vt(function(t){return new vs(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),gs.minutes=gs.minute.range,gs.minutes.utc=gs.minute.utc.range,gs.hour=Vt(function(t){var e=t.getTimezoneOffset()/60;return new vs(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),gs.hours=gs.hour.range,gs.hours.utc=gs.hour.utc.range,gs.month=Vt(function(t){return t=gs.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),gs.months=gs.month.range,gs.months.utc=gs.month.utc.range;var tu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],eu=[[gs.second,1],[gs.second,5],[gs.second,15],[gs.second,30],[gs.minute,1],[gs.minute,5],[gs.minute,15],[gs.minute,30],[gs.hour,1],[gs.hour,3],[gs.hour,6],[gs.hour,12],[gs.day,1],[gs.day,2],[gs.week,1],[gs.month,1],[gs.month,3],[gs.year,1]],ru=Kl.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Ie]]),nu={range:function(t,e,r){return ca.range(Math.ceil(t/r)*r,+e,r).map(sa)},floor:x,ceil:x};eu.year=gs.year,gs.scale=function(){return aa(ca.scale.linear(),eu,ru)};var iu=eu.map(function(t){return[t[0].utc,t[1]]}),ou=Jl.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Ie]]);iu.year=gs.year.utc,gs.scale.utc=function(){return aa(ca.scale.linear(),iu,ou)},ca.text=Lt(function(t){return t.responseText}),ca.json=function(t,e){return zt(t,"application/json",la,e)},ca.html=function(t,e){return zt(t,"text/html",ua,e)},ca.xml=Lt(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=ca,t(ca)):"object"==typeof r&&r.exports?r.exports=ca:this.d3=ca}()},{}],125:[function(t,e,r){"use strict";function n(t,e){this.point=t,this.index=e}function i(t,e){for(var r=t.point,n=e.point,i=r.length,o=0;i>o;++o){var a=n[o]-r[o];if(a)return a}return 0}function o(t,e,r){if(1===t)return r?[[-1,0]]:[];var n=e.map(function(t,e){return[t[0],e]});n.sort(function(t,e){return t[0]-e[0]});for(var i=new Array(t-1),o=1;t>o;++o){var a=n[o-1],s=n[o];i[o-1]=[a[1],s[1]]}return r&&i.push([-1,i[0][1]],[i[t-1][1],-1]),i}function a(t,e){var r=t.length;if(0===r)return[];var a=t[0].length;if(1>a)return[];if(1===a)return o(r,t,e);for(var u=new Array(r),c=1,h=0;r>h;++h){for(var f=t[h],p=new Array(a+1),d=0,m=0;a>m;++m){var g=f[m];p[m]=g,d+=g*g}p[a]=d,u[h]=new n(p,h),c=Math.max(d,c)}l(u,i),r=u.length;for(var v=new Array(r+a+1),y=new Array(r+a+1),b=(a+1)*(a+1)*c,x=new Array(a+1),h=0;a>=h;++h)x[h]=0;x[a]=b,v[0]=x.slice(),y[0]=-1;for(var h=0;a>=h;++h){var p=x.slice();p[h]=1,v[h+1]=p,y[h+1]=-1}for(var h=0;r>h;++h){var _=u[h];v[h+a+1]=_.point,y[h+a+1]=_.index}var w=s(v,!1);if(w=e?w.filter(function(t){for(var e=0,r=0;a>=r;++r){var n=y[t[r]];if(0>n&&++e>=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;a>=e;++e){var r=y[t[e]];if(0>r)return!1;t[e]=r}return!0}),1&a)for(var h=0;h=i)return[];var o,a=new Array(i);if(r===t.length-1)for(o=0;i>o;++o)a[o]=e;else for(o=0;i>o;++o)a[o]=n(t,e,r+1);return a}function i(t,e){var r,n;for(r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e){switch("undefined"==typeof e&&(e=0),typeof t){case"number":if(t>0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=o},{}],127:[function(e,r,n){(function(n,i){(function(){"use strict";function o(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return"function"==typeof t}function s(t){X=t}function l(t){Q=t}function u(){return function(){n.nextTick(d)}}function c(){return function(){H(d)}}function h(){var t=0,e=new $(d),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}function f(){var t=new MessageChannel;return t.port1.onmessage=d,function(){t.port2.postMessage(0)}}function p(){return function(){setTimeout(d,1)}}function d(){for(var t=0;Z>t;t+=2){var e=rt[t],r=rt[t+1];e(r),rt[t]=void 0,rt[t+1]=void 0}Z=0}function m(){try{var t=e,r=t("vertx");return H=r.runOnLoop||r.runOnContext,c()}catch(n){return p()}}function g(t,e){var r=this,n=r._state;if(n===at&&!t||n===st&&!e)return this;var i=new this.constructor(y),o=r._result;if(n){var a=arguments[n-1];Q(function(){R(n,i,a,o)})}else z(r,i,t,e);return i}function v(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var r=new e(y);return T(r,t),r}function y(){}function b(){return new TypeError("You cannot resolve a promise with itself")}function x(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return lt.error=e,lt}}function w(t,e,r,n){try{t.call(e,r,n)}catch(i){return i}}function M(t,e,r){Q(function(t){var n=!1,i=w(r,e,function(r){n||(n=!0,e!==r?T(t,r):S(t,r))},function(e){n||(n=!0,L(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&i&&(n=!0,L(t,i))},t)}function k(t,e){e._state===at?S(t,e._result):e._state===st?L(t,e._result):z(e,void 0,function(e){T(t,e)},function(e){L(t,e)})}function A(t,e,r){e.constructor===t.constructor&&r===nt&&constructor.resolve===it?k(t,e):r===lt?L(t,lt.error):void 0===r?S(t,e):a(r)?M(t,e,r):S(t,e)}function T(t,e){t===e?L(t,b()):o(e)?A(t,e,_(e)):S(t,e)}function E(t){t._onerror&&t._onerror(t._result),I(t)}function S(t,e){t._state===ot&&(t._result=e,t._state=at,0!==t._subscribers.length&&Q(I,t))}function L(t,e){t._state===ot&&(t._state=st,t._result=e,Q(E,t))}function z(t,e,r,n){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+at]=r,i[o+st]=n,0===o&&t._state&&Q(I,t)}function I(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n,i,o=t._result,a=0;aa;a++)z(n.resolve(t[a]),void 0,e,r);return i}function F(t){var e=this,r=new e(y);return L(r,t),r}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this._id=pt++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==t&&("function"!=typeof t&&N(),this instanceof U?j(this,t):B())}function V(t,e){this._instanceConstructor=t,this.promise=new t(y),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):L(this.promise,this._validationError())}function q(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=t.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(t.Promise=dt)}var G;G=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var H,X,Y,W=G,Z=0,Q=function(t,e){rt[Z]=t,rt[Z+1]=e,Z+=2,2===Z&&(X?X(d):Y())},K="undefined"!=typeof window?window:void 0,J=K||{},$=J.MutationObserver||J.WebKitMutationObserver,tt="undefined"!=typeof n&&"[object process]"==={}.toString.call(n),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);Y=tt?u():$?h():et?f():void 0===K&&"function"==typeof e?m():p();var nt=g,it=v,ot=void 0,at=1,st=2,lt=new P,ut=new P,ct=D,ht=O,ft=F,pt=0,dt=U;U.all=ct,U.race=ht,U.resolve=it,U.reject=ft,U._setScheduler=s,U._setAsap=l,U._asap=Q,U.prototype={constructor:U,then:nt,"catch":function(t){return this.then(null,t)}};var mt=V;V.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},V.prototype._enumerate=function(){for(var t=this.length,e=this._input,r=0;this._state===ot&&t>r;r++)this._eachEntry(e[r],r)},V.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===it){var i=_(t);if(i===nt&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(r===dt){var o=new r(y);A(o,t,i),this._willSettleAt(o,e)}else this._willSettleAt(new r(function(e){e(t)}),e)}else this._willSettleAt(n(t),e)},V.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===ot&&(this._remaining--,t===st?L(n,r):this._result[e]=r),0===this._remaining&&S(n,this._result)},V.prototype._willSettleAt=function(t,e){var r=this;z(t,void 0,function(t){r._settledAt(at,e,t)},function(t){r._settledAt(st,e,t)})};var gt=q,vt={Promise:dt,polyfill:gt};"function"==typeof t&&t.amd?t(function(){return vt}):"undefined"!=typeof r&&r.exports?r.exports=vt:"undefined"!=typeof this&&(this.ES6Promise=vt),gt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:59}],128:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;r>n;n++)if(e=t.charCodeAt(n),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],129:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.gl=t,this.type=e,this.handle=r,this.length=n,this.usage=i}function i(t,e,r,n,i,o){var a=i.length*i.BYTES_PER_ELEMENT;if(0>o)return t.bufferData(e,i,n),a;if(a+o>r)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,o,i),r}function o(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;n>i;++i)r[i]=t[i];return r}function a(t,e){for(var r=1,n=e.length-1;n>=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var o=t.createBuffer(),a=new n(t,r,o,0,i);return a.update(e),a}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),h=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],f=n.prototype;f.bind=function(){this.gl.bindBuffer(this.type,this.handle)},f.unbind=function(){this.gl.bindBuffer(this.type,null)},f.dispose=function(){this.gl.deleteBuffer(this.handle)},f.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&a(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),f=c(s,t.shape);u.assign(f,t),0>e?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var p;p=this.type===this.gl.ELEMENT_ARRAY_BUFFER?o(t,"uint16"):o(t,"float32"),0>e?this.length=i(this.gl,this.type,this.length,this.usage,p,e):this.length=i(this.gl,this.type,this.length,this.usage,p.subarray(0,t.length),e),l.free(p)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t=0|t,0>=t&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:456,"ndarray-ops":455,"typedarray-pool":481}],130:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.shader=e,this.buffer=r,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.color=[0,0,0,1]}function i(t,e){var r=o(t.gl,l.vertex,l.fragment),i=a(t.gl),s=new n(t,r,i);return s.update(e),t.addObject(s),s}var o=t("gl-shader"),a=t("gl-buffer"),s=t("typedarray-pool"),l=t("./lib/shaders");e.exports=i;var u=[[1,0,0,1,0,0],[1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,1,0,0],[1,0,0,1,0,0],[1,0,-1,0,0,1],[1,0,-1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,1],[1,0,-1,0,0,1],[-1,0,-1,0,0,1],[-1,0,-1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,1],[-1,0,-1,0,0,1],[0,1,1,0,0,0],[0,1,-1,0,0,0],[0,-1,-1,0,0,0],[0,-1,-1,0,0,0],[0,1,1,0,0,0],[0,-1,1,0,0,0],[0,1,0,-1,1,0],[0,1,0,-1,-1,0],[0,1,0,1,-1,0],[0,1,0,1,1,0],[0,1,0,-1,1,0],[0,1,0,1,-1,0],[0,-1,0,-1,1,0],[0,-1,0,-1,-1,0],[0,-1,0,1,-1,0],[0,-1,0,1,1,0],[0,-1,0,-1,1,0],[0,-1,0,1,-1,0]],c=n.prototype;c.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[1,1];return function(){var r=this.plot,n=this.shader,i=this.buffer,o=this.bounds,a=this.numPoints;if(a){var s=r.gl,l=r.dataBox,c=r.viewBox,h=r.pixelRatio,f=o[2]-o[0],p=o[3]-o[1],d=l[2]-l[0],m=l[3]-l[1];t[0]=2*f/d,t[4]=2*p/m,t[6]=2*(o[0]-l[0])/d-1,t[7]=2*(o[1]-l[1])/m-1;var g=c[2]-c[0],v=c[3]-c[1];e[0]=2*h/g,e[1]=2*h/v,i.bind(),n.bind(),n.uniforms.viewTransform=t,n.uniforms.pixelScale=e,n.uniforms.color=this.color,n.attributes.position.pointer(s.FLOAT,!1,16,0),n.attributes.pixelOffset.pointer(s.FLOAT,!1,16,8),s.drawArrays(s.TRIANGLES,0,a*u.length)}}}(),c.drawPick=function(t){return t},c.pick=function(t,e){return null},c.update=function(t){t=t||{};var e,r,n,i=t.positions||[],o=t.errors||[],a=1;"lineWidth"in t&&(a=+t.lineWidth);var l=5;"capSize"in t&&(l=+t.capSize),this.color=(t.color||[0,0,0,1]).slice();var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=this.numPoints=i.length>>1;for(e=0;h>e;++e)r=i[2*e],n=i[2*e+1],c[0]=Math.min(r,c[0]),c[1]=Math.min(n,c[1]),c[2]=Math.max(r,c[2]),c[3]=Math.max(n,c[3]);c[2]===c[0]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);var f=1/(c[2]-c[0]),p=1/(c[3]-c[1]),d=c[0],m=c[1],g=s.mallocFloat32(h*u.length*4),v=0;for(e=0;h>e;++e){r=i[2*e],n=i[2*e+1];for(var y=o[4*e],b=o[4*e+1],x=o[4*e+2],_=o[4*e+3],w=0;wk?k*=y:k>0&&(k*=b),0>A?A*=x:A>0&&(A*=_),g[v++]=f*(r-d+k),g[v++]=p*(n-m+A),g[v++]=a*M[2]+(l+a)*M[4],g[v++]=a*M[3]+(l+a)*M[5]}}this.buffer.update(g),s.free(g)},c.dispose=function(){this.plot.removeObject(this),this.shader.dispose(),this.buffer.dispose()}},{"./lib/shaders":131,"gl-buffer":129,"gl-shader":208,"typedarray-pool":481}],131:[function(t,e,r){e.exports={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 pixelOffset;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvoid main() {\n vec3 scrPosition = viewTransform * vec3(position, 1);\n gl_Position = vec4(\n scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n 0,\n scrPosition.z);\n}\n",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"}},{}],132:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1}function i(t,e){for(var r=0;3>r;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}function o(t,e,r,n){for(var i=f[n],o=0;o=1},h.isTransparent=function(){return this.opacity<1},h.drawTransparent=h.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||c,i=r.projection=t.projection||c;r.model=t.model||c,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var o=n[12],a=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*o+i[7]*a+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;3>h;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*u,e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var f=function(){for(var t=new Array(3),e=0;3>e;++e){for(var r=[],n=1;2>=n;++n)for(var i=-1;1>=i;i+=2){var o=(n+e)%3,a=[0,0,0];a[o]=i,r.push(a)}t[e]=r}return t}();h.update=function(t){t=t||{},"lineWidth"in t&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var a=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.lineCount=[0,0,0];for(var u=0;3>u;++u){this.lineOffset[u]=l;t:for(var c=0;s>c;++c){for(var h=r[c],f=0;3>f;++f)if(isNaN(h[f])||!isFinite(h[f]))continue t;var p=n[c],d=e[u];if(Array.isArray(d[0])&&(d=e[c]),3===d.length&&(d=[d[0],d[1],d[2],1]),!isNaN(p[0][u])&&!isNaN(p[1][u])){if(p[0][u]<0){var m=h.slice();m[u]+=p[0][u],a.push(h[0],h[1],h[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),i(this.bounds,m),l+=2+o(a,m,d,u)}if(p[1][u]>0){var m=h.slice();m[u]+=p[1][u],a.push(h[0],h[1],h[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),i(this.bounds,m),l+=2+o(a,m,d,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(a)}},h.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":133,"gl-buffer":129,"gl-vao":237}],133:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}",o="precision mediump float;\n#define GLSLIFY 1\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(fragPosition, clipBounds[0])) || any(greaterThan(fragPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = opacity * fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":208}],134:[function(t,e,r){"use strict";function n(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING),r=t.getParameter(t.RENDERBUFFER_BINDING),n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function o(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);y=new Array(r+1);for(var n=0;r>=n;++n){for(var i=new Array(r),o=0;n>o;++o)i[o]=t.COLOR_ATTACHMENT0+o;for(var o=n;r>o;++o)i[o]=t.NONE;y[n]=i}}function a(t){switch(t){case d:throw new Error("gl-fbo: Framebuffer unsupported");case m:throw new Error("gl-fbo: Framebuffer incomplete attachment");case g:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case v:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function s(t,e,r,n,i,o){if(!n)return null;var a=p(t,e,r,i,n);return a.magFilter=t.NEAREST,a.minFilter=t.NEAREST,a.mipSamples=1,a.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,o,t.TEXTURE_2D,a.handle,0),a}function l(t,e,r,n,i){var o=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,o),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,o),o}function u(t){var e=n(t.gl),r=t.gl,o=t.handle=r.createFramebuffer(),u=t._shape[0],c=t._shape[1],h=t.color.length,f=t._ext,p=t._useStencil,d=t._useDepth,m=t._colorType;r.bindFramebuffer(r.FRAMEBUFFER,o);for(var g=0;h>g;++g)t.color[g]=s(r,u,c,m,r.RGBA,r.COLOR_ATTACHMENT0+g);0===h?(t._color_rb=l(r,u,c,r.RGBA4,r.COLOR_ATTACHMENT0),f&&f.drawBuffersWEBGL(y[0])):h>1&&f.drawBuffersWEBGL(y[h]);var v=r.getExtension("WEBGL_depth_texture");v?p?t.depth=s(r,u,c,v.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):d&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):d&&p?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):d?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):p&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var g=0;gl;++l)this.color[l]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=n,this._useDepth=o,this._useStencil=a;var c=this,h=[0|e,0|r];Object.defineProperties(h,{0:{get:function(){return c._shape[0]},set:function(t){return c.width=t}},1:{get:function(){return c._shape[1]},set:function(t){return c.height=t}}}),this._shapeVector=h,u(this)}function h(t,e,r){if(t._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(t._shape[0]!==e||t._shape[1]!==r){var o=t.gl,s=o.getParameter(o.MAX_RENDERBUFFER_SIZE);if(0>e||e>s||0>r||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(o),u=0;ue||e>a||0>r||r>a)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),0>s)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers"); +}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var h=!0;"depth"in n&&(h=!!n.depth);var f=!1;return"stencil"in n&&(f=!!n.stencil),new c(t,e,r,l,s,h,f,i)}var p=t("gl-texture2d");e.exports=f;var d,m,g,v,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return h(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t=0|t,h(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t=0|t,h(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e2&&!this.usingDashes){var z=this.mitreShader;z.bind();var I=z.uniforms;I.matrix=t,I.color=s,I.screenShape=e,I.radius=l*d,z.attributes.p.pointer(h.FLOAT,!1,48,0),h.drawArrays(h.POINTS,0,c/3|0)}}}}(),f.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0],r=[0,0,0,0];return function(n){var i=this.plot,o=this.pickShader,a=this.lineBuffer,s=this.pickBuffer,l=this.width,u=this.numPoints,c=this.bounds,h=this.vertCount,f=i.gl,p=i.viewBox,d=i.dataBox,m=i.pickPixelRatio,g=c[2]-c[0],v=c[3]-c[1],y=d[2]-d[0],b=d[3]-d[1],x=p[2]-p[0],_=p[3]-p[1];if(this.pickOffset=n,!h)return n+u;t[0]=2*g/y,t[4]=2*v/b,t[6]=2*(c[0]-d[0])/y-1,t[7]=2*(c[1]-d[1])/b-1,e[0]=x,e[1]=_,r[0]=255&n,r[1]=n>>>8&255,r[2]=n>>>16&255,r[3]=n>>>24,o.bind();var w=o.uniforms;w.matrix=t,w.width=l*m,w.pickOffset=r,w.screenShape=e;var M=o.attributes;return a.bind(),M.a.pointer(f.FLOAT,!1,16,0),M.d.pointer(f.FLOAT,!1,16,8),s.bind(),M.pick0.pointer(f.UNSIGNED_BYTE,!1,8,0),M.pick1.pointer(f.UNSIGNED_BYTE,!1,8,4),f.drawArrays(f.TRIANGLES,0,h),n+u}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var o=r-n,a=this.data;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}},f.update=function(t){t=t||{};var e=this.plot.gl;!!t.connectGaps;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);for(var r=t.dashes||[1],n=0,o=0;o1,this.dashPattern=l(e,u(a,[n,1,4],[1,0,0])),this.dashPattern.minFilter=e.NEAREST,this.dashPattern.magFilter=e.NEAREST,this.dashLength=n,c.free(a);var p=t.positions;this.data=p;var d=this.bounds;d[0]=d[1]=1/0,d[2]=d[3]=-(1/0);var m=this.numPoints=p.length>>>1;if(0!==m){for(var o=0;m>o;++o){var g=p[2*o],v=p[2*o+1];isNaN(g)||isNaN(v)||(d[0]=Math.min(d[0],g),d[1]=Math.min(d[1],v),d[2]=Math.max(d[2],g),d[3]=Math.max(d[3],v))}d[0]===d[2]&&(d[2]+=1),d[3]===d[1]&&(d[3]+=1);for(var y=c.mallocFloat32(24*(m-1)),b=c.mallocUint32(12*(m-1)),x=y.length,_=b.length,s=m,w=0;s>1;){var M=--s,g=p[2*s],v=p[2*s+1],k=M-1,A=p[2*k],T=p[2*k+1];if(!(isNaN(g)||isNaN(v)||isNaN(A)||isNaN(T))){w+=1,g=(g-d[0])/(d[2]-d[0]),v=(v-d[1])/(d[3]-d[1]),A=(A-d[0])/(d[2]-d[0]),T=(T-d[1])/(d[3]-d[1]);var E=A-g,S=T-v,L=M|1<<24,z=M-1,I=M,P=M-1|1<<24;y[--x]=-S,y[--x]=-E,y[--x]=v,y[--x]=g,b[--_]=L,b[--_]=z,y[--x]=S,y[--x]=E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=-S,y[--x]=-E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=S,y[--x]=E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=-S,y[--x]=-E,y[--x]=v,y[--x]=g,b[--_]=L,b[--_]=z,y[--x]=S,y[--x]=E,y[--x]=v,y[--x]=g,b[--_]=L,b[--_]=z}}this.vertCount=6*w,this.lineBuffer.update(y.subarray(x)),this.pickBuffer.update(b.subarray(_)),c.free(y),c.free(b)}},f.dispose=function(){this.plot.removeObject(this),this.lineBuffer.dispose(),this.pickBuffer.dispose(),this.lineShader.dispose(),this.mitreShader.dispose(),this.fillShader.dispose(),this.pickShader.dispose(),this.dashPattern.dispose()}},{"./lib/shaders":135,"gl-buffer":129,"gl-shader":208,"gl-texture2d":233,ndarray:456,"typedarray-pool":481}],137:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, nextPosition;\nattribute float arcLength, lineWidth;\nattribute vec4 color;\n\nuniform vec2 screenShape;\nuniform float pixelRatio;\nuniform mat4 model, view, projection;\n\nvarying vec4 fragColor;\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\n\nvoid main() {\n vec4 projected = projection * view * model * vec4(position, 1.0);\n vec4 tangentClip = projection * view * model * vec4(nextPosition - position, 0.0);\n vec2 tangent = normalize(screenShape * tangentClip.xy);\n vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(tangent.y, -tangent.x) / screenShape;\n\n gl_Position = vec4(projected.xy + projected.w * offset, projected.zw);\n\n worldPosition = position;\n pixelArcLength = arcLength;\n fragColor = color;\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D dashTexture;\nuniform float dashScale;\nuniform float opacity;\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\n if(dashWeight < 0.5) {\n discard;\n }\n gl_FragColor = fragColor * opacity;\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1_0(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\n\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1_0(pixelArcLength).xyz);\n}",s=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];r.createShader=function(t){return n(t,i,o,null,s)},r.createPickShader=function(t){return n(t,i,a,null,s)}},{"gl-shader":208}],138:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;3>n;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;3>r;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function o(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function a(t,e,r,n,i,o){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=o,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}function s(t){var e=t.gl||t.scene&&t.scene.gl,r=m(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var n=g(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=l(e),o=u(e,[{buffer:i,size:3,offset:0,stride:48},{buffer:i,size:3,offset:12,stride:48},{buffer:i,size:1,offset:24,stride:48},{buffer:i,size:1,offset:28,stride:48},{buffer:i,size:4,offset:32,stride:48}]),s=p(new Array(1024),[256,1,4]),h=0;1024>h;++h)s.data[h]=255;var f=c(e,s);f.wrap=e.REPEAT;var d=new a(e,r,n,i,o,f);return d.update(t),d}e.exports=s;var l=t("gl-buffer"),u=t("gl-vao"),c=t("gl-texture2d"),h=t("glsl-read-float"),f=t("binary-search-bounds"),p=t("ndarray"),d=t("./lib/shaders"),m=d.createShader,g=d.createPickShader,v=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],y=a.prototype;y.isTransparent=function(){return this.opacity<1},y.isOpaque=function(){return this.opacity>=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||v,view:t.view||v,projection:t.projection||v,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||v,view:t.view||v,projection:t.projection||v,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var o=t.position||t.positions;if(o){var a=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],h=0,d=0,m=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],g=!1;t:for(e=1;er;++r){if(isNaN(v[r])||isNaN(y[r])||!isFinite(v[r])||!isFinite(y[r])){if(!i&&l.length>0){for(var b=0;24>b;++b)l.push(l[l.length-12]);d+=2,g=!0}continue t}m[0][r]=Math.min(m[0][r],v[r],y[r]),m[1][r]=Math.max(m[1][r],v[r],y[r])}var x,_;Array.isArray(a[0])?(x=a[e-1],_=a[e]):x=_=a,3===x.length&&(x=[x[0],x[1],x[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var M=h;if(h+=n(v,y),g){for(r=0;2>r;++r)l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3]);d+=2,g=!1}l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3],v[0],v[1],v[2],y[0],y[1],y[2],M,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],v[0],v[1],v[2],h,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],v[0],v[1],v[2],h,w,_[0],_[1],_[2],_[3]),d+=4}if(this.buffer.update(l),u.push(h),c.push(o[o.length-1].slice()),this.bounds=m,this.vertexCount=d,this.points=c,this.arcLength=u,"dashes"in t){var k=t.dashes,A=k.slice();for(A.unshift(0),e=1;ee;++e){for(r=0;4>r;++r)T.set(e,0,r,0);1&f.le(A,A[A.length-1]*e/255)?T.set(e,0,0,0):T.set(e,0,0,255)}this.texture.setPixels(T)}}},y.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()},y.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=h(t.value[0],t.value[1],t.value[2],0),r=f.le(this.arcLength,e);if(0>r)return null;if(r===this.arcLength.length-1)return new o(this.arcLength[this.arcLength.length-1],this.points[this.points.length-1].slice(),r);for(var n=this.points[r],i=this.points[Math.min(r+1,this.points.length-1)],a=(e-this.arcLength[r])/(this.arcLength[r+1]-this.arcLength[r]),s=1-a,l=[0,0,0],u=0;3>u;++u)l[u]=s*n[u]+a*i[u];var c=Math.min(.5>a?r:r+1,this.points.length-1);return new o(e,l,c,this.points[c])}},{"./lib/shaders":137,"binary-search-bounds":139,"gl-buffer":129,"gl-texture2d":233,"gl-vao":237,"glsl-read-float":140,ndarray:456}],139:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],140:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,o[0]}e.exports=n;var i=new Uint8Array(4),o=new Float32Array(i.buffer)},{}],141:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=c*a-s*u,f=-c*o+s*l,p=u*o-a*l,d=r*h+n*f+i*p;return d?(d=1/d,t[0]=h*d,t[1]=(-c*n+i*u)*d,t[2]=(s*n-i*a)*d,t[3]=f*d,t[4]=(c*r-i*l)*d,t[5]=(-s*r+i*o)*d,t[6]=p*d,t[7]=(-u*r+n*l)*d,t[8]=(a*r-n*o)*d,t):null}e.exports=n},{}],142:[function(t,e,r){function n(t){var e=new Float32Array(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}e.exports=n},{}],143:[function(t,e,r){function n(){var t=new Float32Array(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],144:[function(t,e,r){function n(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],f=t[11],p=t[12],d=t[13],m=t[14],g=t[15],v=e*a-r*o,y=e*s-n*o,b=e*l-i*o,x=r*s-n*a,_=r*l-i*a,w=n*l-i*s,M=u*d-c*p,k=u*m-h*p,A=u*g-f*p,T=c*m-h*d,E=c*g-f*d,S=h*g-f*m;return v*S-y*E+b*T+x*A-_*k+w*M}e.exports=n},{}],145:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,h=n*s,f=i*a,p=i*s,d=i*l,m=o*a,g=o*s,v=o*l;return t[0]=1-h-d,t[1]=c+v,t[2]=f-g,t[3]=0,t[4]=c-v,t[5]=1-u-d,t[6]=p+m,t[7]=0,t[8]=f+g,t[9]=p-m,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],146:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,u=o+o,c=n*s,h=n*l,f=n*u,p=i*l,d=i*u,m=o*u,g=a*s,v=a*l,y=a*u;return t[0]=1-(p+m),t[1]=h+y,t[2]=f-v,t[3]=0,t[4]=h-y,t[5]=1-(c+m),t[6]=d+g,t[7]=0,t[8]=f+v,t[9]=d-g,t[10]=1-(c+p),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}e.exports=n},{}],147:[function(t,e,r){function n(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],148:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],f=e[10],p=e[11],d=e[12],m=e[13],g=e[14],v=e[15],y=r*s-n*a,b=r*l-i*a,x=r*u-o*a,_=n*l-i*s,w=n*u-o*s,M=i*u-o*l,k=c*m-h*d,A=c*g-f*d,T=c*v-p*d,E=h*g-f*m,S=h*v-p*m,L=f*v-p*g,z=y*L-b*S+x*E+_*T-w*A+M*k;return z?(z=1/z,t[0]=(s*L-l*S+u*E)*z,t[1]=(i*S-n*L-o*E)*z,t[2]=(m*M-g*w+v*_)*z,t[3]=(f*w-h*M-p*_)*z,t[4]=(l*T-a*L-u*A)*z,t[5]=(r*L-i*T+o*A)*z,t[6]=(g*x-d*M-v*b)*z,t[7]=(c*M-f*x+p*b)*z,t[8]=(a*S-s*T+u*k)*z,t[9]=(n*T-r*S-o*k)*z,t[10]=(d*w-m*x+v*y)*z,t[11]=(h*x-c*w-p*y)*z,t[12]=(s*A-a*E-l*k)*z,t[13]=(r*E-n*A+i*k)*z,t[14]=(m*b-d*_-g*y)*z,t[15]=(c*_-h*b+f*y)*z,t):null}e.exports=n},{}],149:[function(t,e,r){function n(t,e,r,n){var o,a,s,l,u,c,h,f,p,d,m=e[0],g=e[1],v=e[2],y=n[0],b=n[1],x=n[2],_=r[0],w=r[1],M=r[2];return Math.abs(m-_)<1e-6&&Math.abs(g-w)<1e-6&&Math.abs(v-M)<1e-6?i(t):(h=m-_,f=g-w,p=v-M,d=1/Math.sqrt(h*h+f*f+p*p),h*=d,f*=d,p*=d,o=b*p-x*f,a=x*h-y*p,s=y*f-b*h,d=Math.sqrt(o*o+a*a+s*s),d?(d=1/d,o*=d,a*=d,s*=d):(o=0,a=0,s=0),l=f*s-p*a,u=p*o-h*s,c=h*a-f*o,d=Math.sqrt(l*l+u*u+c*c),d?(d=1/d,l*=d,u*=d,c*=d):(l=0,u=0,c=0),t[0]=o,t[1]=l,t[2]=h,t[3]=0,t[4]=a,t[5]=u,t[6]=f,t[7]=0,t[8]=s,t[9]=c,t[10]=p,t[11]=0,t[12]=-(o*m+a*g+s*v),t[13]=-(l*m+u*g+c*v),t[14]=-(h*m+f*g+p*v),t[15]=1,t)}var i=t("./identity");e.exports=n},{"./identity":147}],150:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],p=e[10],d=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*h+w*m,t[1]=b*i+x*l+_*f+w*g,t[2]=b*o+x*u+_*p+w*v,t[3]=b*a+x*c+_*d+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*h+w*m,t[5]=b*i+x*l+_*f+w*g,t[6]=b*o+x*u+_*p+w*v,t[7]=b*a+x*c+_*d+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*h+w*m,t[9]=b*i+x*l+_*f+w*g,t[10]=b*o+x*u+_*p+w*v,t[11]=b*a+x*c+_*d+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*h+w*m,t[13]=b*i+x*l+_*f+w*g,t[14]=b*o+x*u+_*p+w*v,t[15]=b*a+x*c+_*d+w*y,t}e.exports=n},{}],151:[function(t,e,r){function n(t,e,r,n,i){var o=1/Math.tan(e/2),a=1/(n-i);return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t}e.exports=n},{}],152:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,u,c,h,f,p,d,m,g,v,y,b,x,_,w,M,k,A,T,E,S=n[0],L=n[1],z=n[2],I=Math.sqrt(S*S+L*L+z*z);return Math.abs(I)<1e-6?null:(I=1/I,S*=I,L*=I,z*=I,i=Math.sin(r),o=Math.cos(r),a=1-o,s=e[0],l=e[1],u=e[2],c=e[3],h=e[4],f=e[5],p=e[6],d=e[7],m=e[8],g=e[9],v=e[10],y=e[11],b=S*S*a+o,x=L*S*a+z*i,_=z*S*a-L*i,w=S*L*a-z*i,M=L*L*a+o,k=z*L*a+S*i,A=S*z*a+L*i,T=L*z*a-S*i,E=z*z*a+o,t[0]=s*b+h*x+m*_,t[1]=l*b+f*x+g*_,t[2]=u*b+p*x+v*_,t[3]=c*b+d*x+y*_,t[4]=s*w+h*M+m*k,t[5]=l*w+f*M+g*k,t[6]=u*w+p*M+v*k,t[7]=c*w+d*M+y*k,t[8]=s*A+h*T+m*E,t[9]=l*A+f*T+g*E,t[10]=u*A+p*T+v*E,t[11]=c*A+d*T+y*E,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}e.exports=n},{}],153:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=a*i+c*n,t[6]=s*i+h*n,t[7]=l*i+f*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=h*i-s*n,t[11]=f*i-l*n,t}e.exports=n},{}],154:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],h=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=a*i-c*n,t[2]=s*i-h*n,t[3]=l*i-f*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+h*i,t[11]=l*n+f*i,t}e.exports=n},{}],155:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],h=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*n,t[1]=a*i+c*n,t[2]=s*i+h*n,t[3]=l*i+f*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=h*i-s*n,t[7]=f*i-l*n,t}e.exports=n},{}],156:[function(t,e,r){function n(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}e.exports=n},{}],157:[function(t,e,r){function n(t,e,r){var n,i,o,a,s,l,u,c,h,f,p,d,m=r[0],g=r[1],v=r[2];return 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],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],p=e[10],d=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=f,t[10]=p,t[11]=d,t[12]=n*m+s*g+h*v+e[12],t[13]=i*m+l*g+f*v+e[13],t[14]=o*m+u*g+p*v+e[14],t[15]=a*m+c*g+d*v+e[15]),t}e.exports=n},{}],158:[function(t,e,r){function n(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}e.exports=n},{}],159:[function(t,e,r){"use strict";function n(t,e){for(var r=[0,0,0,0],n=0;4>n;++n)for(var i=0;4>i;++i)r[i]+=t[4*n+i]*e[n];return r}function i(t,e,r,i,o){for(var a=n(i,n(r,n(e,[t[0],t[1],t[2],1]))),s=0;3>s;++s)a[s]/=a[3];return[.5*o[0]*(1+a[0]),.5*o[1]*(1-a[1])]}function o(t,e){if(2===t.length){for(var r=0,n=0,i=0;2>i;++i)r+=Math.pow(e[i]-t[0][i],2),n+=Math.pow(e[i]-t[1][i],2);return r=Math.sqrt(r),n=Math.sqrt(n),1e-6>r+n?[1,0]:[n/(r+n),r/(n+r)]}if(3===t.length){var o=[0,0];return u(t[0],t[1],t[2],e,o),l(t,o)}return[]}function a(t,e){for(var r=[0,0,0],n=0;na;++a)r[a]+=o*i[a];return r}function s(t,e,r,n,s,l){if(1===t.length)return[0,t[0].slice()];for(var u=new Array(t.length),c=0;cd;++d)p+=Math.pow(u[c][d]-e[d],2);f>p&&(f=p,h=c)}for(var m=o(u,e),g=0,c=0;3>c;++c){if(m[c]<-.001||m[c]>1.0001)return null;g+=m[c]}return Math.abs(g-1)>.001?null:[h,a(t,m),m]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:162,"polytope-closest-point/lib/closest_point_2d.js":164}],160:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n f_data = position;\n f_uv = uv;\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",h="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}",f="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",p="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n"; +r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:o,fragment:a,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:f,fragment:p,attributes:[{name:"position",type:"vec3"}]}},{}],161:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c,h,f,p,d,m,g,v,y,b,x,_,w,M,k,A,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=o,this.pointPickShader=a,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=u,this.triangleVAO=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=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=M,this.pointIds=x,this.pointVAO=k,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=j,this._view=j,this._projection=j,this._resolution=[1,1]}function i(t){for(var e=k({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;256>n;++n){for(var i=e[n],o=0;3>o;++o)r[4*n+o]=i[o];r[4*n+3]=255*i[3]}return M(r,[256,256,4],[4,0,1])}function o(t,e,r){for(var n=new Array(e),i=0;e>i;++i)n[i]=0;for(var o=t.length,i=0;o>i;++i)for(var a=t[i],s=0;sn;++n)r[n]=t[n][2];return r}function s(t){var e=g(t,L);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function l(t){var e=g(t,z);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function u(t){var e=g(t,I);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.pointSize.location=4,e}function c(t){var e=g(t,P);return e.attributes.position.location=0,e.attributes.id.location=1,e}function h(t){var e=g(t,C);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function f(t){var e=g(t,R);return e.attributes.position.location=0,e}function p(t){var e=t.gl,r=s(e),i=l(e),o=u(e),a=c(e),p=h(e),d=f(e),m=b(e,M(new Uint8Array([255,255,255,255]),[1,1,4]));m.generateMipmap(),m.minFilter=e.LINEAR_MIPMAP_LINEAR,m.magFilter=e.LINEAR;var g=v(e),x=v(e),_=v(e),w=v(e),k=v(e),A=y(e,[{buffer:g,type:e.FLOAT,size:3},{buffer:k,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:x,type:e.FLOAT,size:4},{buffer:_,type:e.FLOAT,size:2},{buffer:w,type:e.FLOAT,size:3}]),T=v(e),E=v(e),S=v(e),L=v(e),z=y(e,[{buffer:T,type:e.FLOAT,size:3},{buffer:L,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:E,type:e.FLOAT,size:4},{buffer:S,type:e.FLOAT,size:2}]),I=v(e),P=v(e),C=v(e),R=v(e),j=v(e),D=y(e,[{buffer:I,type:e.FLOAT,size:3},{buffer:j,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:P,type:e.FLOAT,size:4},{buffer:C,type:e.FLOAT,size:2},{buffer:R,type:e.FLOAT,size:1}]),O=v(e),F=y(e,[{buffer:O,type:e.FLOAT,size:3}]),N=new n(e,m,r,i,o,a,p,d,g,k,x,_,w,A,T,L,E,S,z,I,j,P,C,R,D,O,F);return N.update(t),N}var d=1e-6,m=1e-6,g=t("gl-shader"),v=t("gl-buffer"),y=t("gl-vao"),b=t("gl-texture2d"),x=t("normals"),_=t("gl-mat4/multiply"),w=t("gl-mat4/invert"),M=t("ndarray"),k=t("colormap"),A=t("simplicial-complex-contour"),T=t("typedarray-pool"),E=t("./lib/shaders"),S=t("./lib/closest-point"),L=E.meshShader,z=E.wireShader,I=E.pointShader,P=E.pickShader,C=E.pointPickShader,R=E.contourShader,j=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],D=n.prototype;D.isOpaque=function(){return this.opacity>=1},D.isTransparent=function(){return this.opacity<1},D.pickSlots=1,D.setPickBase=function(t){this.pickId=t},D.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=A(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,o=r.length,a=T.mallocFloat32(6*o),s=0,l=0;o>l;++l)for(var u=r[l],c=0;2>c;++c){var h=u[0];2===u.length&&(h=u[c]);for(var f=n[h][0],p=n[h][1],d=i[h],m=1-d,g=this.positions[f],v=this.positions[p],y=0;3>y;++y)a[s++]=d*g[y]+m*v[y]}this.contourCount=s/3|0,this.contourPositions.update(a.subarray(0,s)),T.free(a)},D.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"contourEnable"in t&&(this.contourEnable=t.contourEnable),"contourColor"in t&&(this.contourColor=t.contourColor),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"lightPosition"in t&&(this.lightPosition=t.lightPosition),"opacity"in t&&(this.opacity=t.opacity),"ambient"in t&&(this.ambientLight=t.ambient),"diffuse"in t&&(this.diffuseLight=t.diffuse),"specular"in t&&(this.specularLight=t.specular),"roughness"in t&&(this.roughness=t.roughness),"fresnel"in t&&(this.fresnel=t.fresnel),t.texture?(this.texture.dispose(),this.texture=b(e,t.texture)):t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(i(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions;if(n&&r){var s=[],l=[],u=[],c=[],h=[],f=[],p=[],g=[],v=[],y=[],_=[],w=[],M=[],k=[];this.cells=r,this.positions=n;var A=t.vertexNormals,T=t.cellNormals,E=void 0===t.vertexNormalsEpsilon?d:t.vertexNormalsEpsilon,S=void 0===t.faceNormalsEpsilon?m:t.faceNormalsEpsilon;t.useFacetNormals&&!T&&(T=x.faceNormals(r,n,S)),T||A||(A=x.vertexNormals(r,n,E));var L=t.vertexColors,z=t.cellColors,I=t.meshColor||[1,1,1,1],P=t.vertexUVs,C=t.vertexIntensity,R=t.cellUVs,j=t.cellIntensity,D=1/0,O=-(1/0);if(!P&&!R)if(C)for(var F=0;Fq;++q)!isNaN(V[q])&&isFinite(V[q])&&(this.bounds[0][q]=Math.min(this.bounds[0][q],V[q]),this.bounds[1][q]=Math.max(this.bounds[1][q],V[q]));var G=0,H=0,X=0;t:for(var F=0;Fq;++q)if(isNaN(V[q])||!isFinite(V[q]))continue t;y.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[F]:I,3===Z.length?_.push(Z[0],Z[1],Z[2],1):_.push(Z[0],Z[1],Z[2],Z[3]);var Q;Q=P?P[W]:C?[(C[W]-D)/(O-D),0]:R?R[F]:j?[(j[F]-D)/(O-D),0]:[(V[2]-D)/(O-D),0],w.push(Q[0],Q[1]),B?M.push(B[W]):M.push(U),k.push(F),X+=1;break;case 2:for(var q=0;2>q;++q)for(var W=Y[q],V=n[W],K=0;3>K;++K)if(isNaN(V[K])||!isFinite(V[K]))continue t;for(var q=0;2>q;++q){var W=Y[q],V=n[W];f.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[F]:I,3===Z.length?p.push(Z[0],Z[1],Z[2],1):p.push(Z[0],Z[1],Z[2],Z[3]);var Q;Q=P?P[W]:C?[(C[W]-D)/(O-D),0]:R?R[F]:j?[(j[F]-D)/(O-D),0]:[(V[2]-D)/(O-D),0],g.push(Q[0],Q[1]),v.push(F)}H+=1;break;case 3:for(var q=0;3>q;++q)for(var W=Y[q],V=n[W],K=0;3>K;++K)if(isNaN(V[K])||!isFinite(V[K]))continue t;for(var q=0;3>q;++q){var W=Y[q],V=n[W];s.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[F]:I,3===Z.length?l.push(Z[0],Z[1],Z[2],1):l.push(Z[0],Z[1],Z[2],Z[3]);var Q;Q=P?P[W]:C?[(C[W]-D)/(O-D),0]:R?R[F]:j?[(j[F]-D)/(O-D),0]:[(V[2]-D)/(O-D),0],c.push(Q[0],Q[1]);var J;J=A?A[W]:T[F],u.push(J[0],J[1],J[2]),h.push(F)}G+=1}}this.pointCount=X,this.edgeCount=H,this.triangleCount=G,this.pointPositions.update(y),this.pointColors.update(_),this.pointUVs.update(w),this.pointSizes.update(M),this.pointIds.update(new Uint32Array(k)),this.edgePositions.update(f),this.edgeColors.update(p),this.edgeUVs.update(g),this.edgeIds.update(new Uint32Array(v)),this.trianglePositions.update(s),this.triangleColors.update(l),this.triangleUVs.update(c),this.triangleNormals.update(u),this.triangleIds.update(new Uint32Array(h))}},D.drawTransparent=D.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||j,n=t.view||j,i=t.projection||j,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);var s={model:r,view:n,projection:i,clipBounds:o,kambient:this.ambientLight,kdiffuse:this.diffuseLight,kspecular:this.specularLight,roughness:this.roughness,fresnel:this.fresnel,eyePosition:[0,0,0],lightPosition:[0,0,0],opacity:this.opacity,contourColor:this.contourColor,texture:0};this.texture.bind(0);var l=new Array(16);_(l,s.view,s.model),_(l,s.projection,l),w(l,l);for(var a=0;3>a;++a)s.eyePosition[a]=l[12+a]/l[15];for(var u=l[15],a=0;3>a;++a)u+=this.lightPosition[a]*l[4*a+3];for(var a=0;3>a;++a){for(var c=l[12+a],h=0;3>h;++h)c+=l[4*h+a]*this.lightPosition[h];s.lightPosition[a]=c/u}if(this.triangleCount>0){var f=this.triShader;f.bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var f=this.lineShader;f.bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var f=this.pointShader;f.bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var f=this.contourShader;f.bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},D.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||j,n=t.view||j,i=t.projection||j,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:o,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},D.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),o=0;oa;++a){for(var s=new Array(r+1),l=0;r>=l;++l)s[l]=t[l][a];i[a]=s}i[r]=new Array(r+1);for(var a=0;r>=a;++a)i[r][a]=1;for(var u=new Array(r+1),a=0;r>a;++a)u[a]=e[a];u[r]=1;var c=o(i,u),h=n(c[r+1]);0===h&&(h=1);for(var f=new Array(r+1),a=0;r>=a;++a)f[a]=n(c[a])/h;return f}e.exports=i;var o=t("robust-linear-solve")},{"robust-linear-solve":459}],163:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,o=new Array(i),a=void 0===r?n:r,s=0;i>s;++s)o[s]=[0,0,0];for(var s=0;sx;++x)g[x]=p[x]-d[x],v+=g[x]*g[x],y[x]=m[x]-d[x],b+=y[x]*y[x];if(v*b>a)for(var _=o[c],w=1/Math.sqrt(v*b),x=0;3>x;++x){var M=(x+1)%3,k=(x+2)%3;_[x]+=w*(y[M]*g[k]-y[k]*g[M])}}for(var s=0;i>s;++s){for(var _=o[s],A=0,x=0;3>x;++x)A+=_[x]*_[x];if(A>a)for(var w=1/Math.sqrt(A),x=0;3>x;++x)_[x]*=w;else for(var x=0;3>x;++x)_[x]=0}return o},r.faceNormals=function(t,e,r){for(var n=t.length,o=new Array(n),a=void 0===r?i:r,s=0;n>s;++s){for(var l=t[s],u=new Array(3),c=0;3>c;++c)u[c]=e[l[c]];for(var h=new Array(3),f=new Array(3),c=0;3>c;++c)h[c]=u[1][c]-u[0][c],f[c]=u[2][c]-u[0][c];for(var p=new Array(3),d=0,c=0;3>c;++c){var m=(c+1)%3,g=(c+2)%3;p[c]=h[m]*f[g]-h[g]*f[m],d+=p[c]*p[c]}d=d>a?1/Math.sqrt(d):0;for(var c=0;3>c;++c)p[c]*=d;o[s]=p}return o}},{}],164:[function(t,e,r){"use strict";function n(t,e,r,n,s){i.length=x+_)if(0>x)0>_&&0>f?(_=0,-f>=u?(x=1,y=u+2*f+d):(x=-f/u,y=f*x+d)):(x=0,p>=0?(_=0,y=d):-p>=h?(_=1,y=h+2*p+d):(_=-p/h,y=p*_+d));else if(0>_)_=0,f>=0?(x=0,y=d):-f>=u?(x=1,y=u+2*f+d):(x=-f/u,y=f*x+d);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*p)+d}else{var M,k,A,T;0>x?(M=c+f,k=h+p,k>M?(A=k-M,T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+d):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*p)+d)):(x=0,0>=k?(_=1,y=h+2*p+d):p>=0?(_=0,y=d):(_=-p/h,y=p*_+d))):0>_?(M=c+p,k=u+f,k>M?(A=k-M,T=u-2*c+h,A>=T?(_=1,x=0,y=h+2*p+d):(_=A/T,x=1-_,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*p)+d)):(_=0,0>=k?(x=1,y=u+2*f+d):f>=0?(x=0,y=d):(x=-f/u,y=f*x+d))):(A=h+p-c-f,0>=A?(x=0,_=1,y=h+2*p+d):(T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+d):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*p)+d)))}for(var E=1-x-_,l=0;ly?0:y}var i=new Float64Array(4),o=new Float64Array(4),a=new Float64Array(4);e.exports=n},{}],165:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r=0|Math.max(r,t[n].length);return r-1}function i(t,e){for(var r=t.length,n=h.mallocUint8(r),i=0;r>i;++i)n[i]=t[i]a;++a)for(var s=t[a],e=s.length,l=0;e>l;++l)for(var u=0;l>u;++u){var p=s[u],d=s[l];i[o++]=0|Math.min(p,d),i[o++]=0|Math.max(p,d)}var m=o/2|0;f(c(i,[m,2]));for(var g=2,a=2;o>a;a+=2)i[a-2]===i[a]&&i[a-1]===i[a+1]||(i[g++]=i[a],i[g++]=i[a+1]);return c(i,[g/2|0,2])}function a(t,e,r,n){for(var i=t.data,o=t.shape[0],a=h.mallocDouble(o),s=0,l=0;o>l;++l){var u=i[2*l],f=i[2*l+1];if(r[u]!==r[f]){var p=e[u],d=e[f];i[2*s]=u,i[2*s+1]=f,a[s++]=(d-n)/(d-p)}}return t.shape[0]=s,c(a,[s])}function s(t,e){var r=h.mallocInt32(2*e),n=t.shape[0],i=t.data;r[0]=0;for(var o=0,a=0;n>a;++a){var s=i[2*a];if(s!==o){for(r[2*o+1]=a;++oi;++i)n[i]=[r[2*i],r[2*i+1]];return n}function u(t,e,r,u){r=r||0,"undefined"==typeof u&&(u=n(t));var c=t.length;if(0===c||1>u)return{cells:[],vertexIds:[],vertexWeights:[]};var f=i(e,+r),d=o(t,u),m=a(d,e,f,+r),g=s(d,0|e.length),v=p(u)(t,d.data,g,f),y=l(d),b=[].slice.call(m.data,0,m.shape[0]);return h.free(f),h.free(d.data),h.free(m.data),h.free(g),{cells:v,vertexIds:y,vertexWeights:b}}e.exports=u;var c=t("ndarray"),h=t("typedarray-pool"),f=t("ndarray-sort"),p=t("./lib/codegen")},{"./lib/codegen":166,ndarray:456,"ndarray-sort":169,"typedarray-pool":481}],166:[function(t,e,r){"use strict";function n(t){function e(t){if(!(t.length<=0)){u.push("R.push(");for(var e=0;e0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;t>=i;++i)for(var s=n[i]=a(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){t+1>i&&u.push("else "),u.push("if(l===",i,"){");for(var c=[],l=0;i>l;++l)c.push("(S[c["+l+"]]<<"+l+")");u.push("var M=",c.join("+"),";if(M===0||M===",(1<i;++i)n[i]=0,i===e&&(n[i]+=.5),i===r&&(n[i]+=.5);return n}function i(t,e){if(0===e||e===(1<=o;++o)if(e&1<=s;++s)~e&1<n;++n)r[n]=i(t,n);return r}e.exports=o;var a=t("convex-hull")},{"convex-hull":113}],168:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;t>r;++r)e.push("s"+r);for(var r=0;t>r;++r)e.push("n"+r);for(var r=1;t>r;++r)e.push("d"+r);for(var r=1;t>r;++r)e.push("e"+r);for(var r=1;t>r;++r)e.push("f"+r);return e}function o(t,e){function r(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function o(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}var a=["'use strict'"],s=["ndarrayInsertionSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(i(t.length)),u=n(e),c=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var h=[],f=1;f1){a.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var p=t[f];0!==p&&a.push(["for(i",p,"=0;i",p,"left){","dptr=0","sptr=cptr-s0");for(var f=1;fb){break __l}"].join(""));for(var f=t.length-1;f>=1;--f)a.push("sptr+=e"+f,"dptr+=f"+f,"}");a.push("dptr=cptr;sptr=cptr-s0");for(var f=t.length-1;f>=0;--f){var p=t[f];0!==p&&a.push(["for(i",p,"=0;i",p,"=0;--f){var p=t[f];0!==p&&a.push(["for(i",p,"=0;i",p,"left)&&("+r("cptr-s0")+">scratch)){",o("cptr",r("cptr-s0")),"cptr-=s0","}",o("cptr","scratch"));if(a.push("}"),t.length>1&&u&&a.push("free(scratch)"),a.push("} return "+s),u){var d=new Function("malloc","free",a.join("\n"));return d(u[0],u[1])}var d=new Function(a.join("\n"));return d()}function a(t,e,r){function o(t){return["(offset+",t,"*s0)"].join("")}function a(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+o(e[0]));else for(var i=0;i=0;--i){var a=t[i];0!==a&&_.push(["for(i",a,"=0;i",a,"1)for(var i=0;i1?_.push("ptr_shift+=d"+a):_.push("ptr0+=d"+a),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+o(r[0]));else{for(var a=0;a1)for(var a=0;a=1;--a)n&&_.push("pivot_ptr+=f"+a),r.length>1?_.push("ptr_shift+=e"+a):_.push("ptr0+=e"+a),_.push("}")}function h(){t.length>1&&k&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++A;c(s,[n,i],!1,["comp=",a("ptr0"),"-",a("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",a(o(n)),">",a(o(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function p(e,r){t.length>1?l([e,r],!1,s("ptr0",a("ptr1"))):_.push(s(o(e),a(o(r))))}function d(e,r,n){if(t.length>1){var i="__l"+ ++A;c(i,[r],!0,[e,"=",a("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",a(o(r)),"-pivot",n].join(""))}function m(e,r){t.length>1?l([e,r],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join(""))}function g(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","ptr2=",o(n),"\n","++",r,"\n","--",n,"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join(""))}function v(t,e){m(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",a("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(o(e),a(o(r))),s(o(r),"pivot"+n))}function b(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function x(e,r,n){t.length>1?(_.push(["__l",++A,":while(true){"].join("")),l([e],!0,["if(",a("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",A,"}"].join("")),_.push(n,"}")):_.push(["while(",a(o(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),k=n(e),A=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],S=1;SS;++S)T.push("b_ptr"+S);T.push("ptr3","ptr4","ptr5","ptr6","ptr7","pivot_ptr","ptr_shift","elementSize="+E.join("*")),k?T.push("pivot1=malloc(elementSize)","pivot2=malloc(elementSize)"):T.push("pivot1=new Array(elementSize),pivot2=new Array(elementSize)")}else T.push("pivot1","pivot2");if(_.push("var "+T.join(",")),f(1,2),f(4,5),f(1,3),f(2,3),f(1,4),f(3,4),f(2,5),f(2,3),f(4,5),t.length>1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",a("ptr1"),"\n","pivot2[pivot_ptr]=",a("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",a("ptr0"),"\n","y=",a("ptr2"),"\n","z=",a("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",a(o("el2")),"\n","pivot2=",a(o("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",a(o("el1")),"\n","y=",a(o("el3")),"\n","z=",a(o("el5")),"\n",s(o("index1"),"x"),"\n",s(o("index3"),"y"),"\n",s(o("index5"),"z")].join("")),p("index2","left"),p("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),d("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),d("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),g("k","less","great"),_.push("break"),_.push("}else{"),v("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),d("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),d("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),d("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),d("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),d("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),d("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&k){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,k[0],k[1])}var L=new Function("insertionSort",_.join("\n"));return L(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",g,"=s",g,"-d",d,"*n",d].join("")):l.push(["d",g,"=s",g].join("")),d=g);var p=t.length-1-c;0!==p&&(m>0?l.push(["e",p,"=s",p,"-e",m,"*n",m,",f",p,"=",h[p],"-f",m,"*n",m].join("")):l.push(["e",p,"=s",p,",f",p,"=",h[p]].join("")),m=p)}r.push("var "+l.join(","));var v=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",v.join(","),")}else{","quickSort(",v.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=o(t,e),x=a(t,e,b);return y(b,x)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":481}],169:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],a=n.join(":"),s=o[a];return s||(o[a]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),o={};e.exports=n},{"./lib/compile_sort.js":168}],170:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=o(e,[0,0,0,1,1,0,1,1]),i=a(e,s.boxVert,s.lineFrag);return new n(t,r,i)}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawBox=function(){var t=[0,0],e=[0,0];return function(r,n,i,o,a){var s=this.plot,l=this.shader,u=s.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,l.uniforms.lo=t,l.uniforms.hi=e,l.uniforms.color=a,u.drawArrays(u.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":173,"gl-buffer":129,"gl-shader":208}],171:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.vbo=e,this.shader=r,this.tickShader=n,this.ticks=[[],[]]}function i(t,e){return t-e}function o(t){var e=t.gl,r=a(e),i=s(e,u.gridVert,u.gridFrag),o=s(e,u.tickVert,u.gridFrag),l=new n(t,r,i,o);return l}e.exports=o;var a=t("gl-buffer"),s=t("gl-shader"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.draw=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){for(var n=this.plot,i=this.vbo,o=this.shader,a=this.ticks,s=n.gl,l=n._tickBounds,u=n.dataBox,c=n.viewBox,h=n.gridLineWidth,f=n.gridLineColor,p=n.gridLineEnable,d=n.pixelRatio,m=0;2>m;++m){var g=l[m],v=l[m+2],y=v-g,b=.5*(u[m+2]+u[m]),x=u[m+2]-u[m];e[m]=2*y/x,t[m]=2*(g-b)/x}o.bind(),i.bind(),o.attributes.dataCoord.pointer(),o.uniforms.dataShift=t,o.uniforms.dataScale=e;for(var _=0,m=0;2>m;++m){r[0]=r[1]=0,r[m]=1,o.uniforms.dataAxis=r,o.uniforms.lineWidth=h[m]/(c[m+2]-c[m])*d,o.uniforms.color=f[m];var w=6*a[m].length;p[m]&&w&&s.drawArrays(s.TRIANGLES,_,w),_+=w}}}(),c.drawTickMarks=function(){var t=[0,0],e=[0,0],r=[1,0],n=[0,1],o=[0,0],a=[0,0];return function(){ +for(var s=this.plot,u=this.vbo,c=this.tickShader,h=this.ticks,f=s.gl,p=s._tickBounds,d=s.dataBox,m=s.viewBox,g=s.pixelRatio,v=s.screenBox,y=v[2]-v[0],b=v[3]-v[1],x=m[2]-m[0],_=m[3]-m[1],w=0;2>w;++w){var M=p[w],k=p[w+2],A=k-M,T=.5*(d[w+2]+d[w]),E=d[w+2]-d[w];e[w]=2*A/E,t[w]=2*(M-T)/E}e[0]*=x/y,t[0]*=x/y,e[1]*=_/b,t[1]*=_/b,c.bind(),u.bind(),c.attributes.dataCoord.pointer();var S=c.uniforms;S.dataShift=t,S.dataScale=e;var L=s.tickMarkLength,z=s.tickMarkWidth,I=s.tickMarkColor,P=0,C=6*h[0].length,R=Math.min(l.ge(h[0],(d[0]-p[0])/(p[2]-p[0]),i),h[0].length),j=Math.min(l.gt(h[0],(d[2]-p[0])/(p[2]-p[0]),i),h[0].length),D=P+6*R,O=6*Math.max(0,j-R),F=Math.min(l.ge(h[1],(d[1]-p[1])/(p[3]-p[1]),i),h[1].length),N=Math.min(l.gt(h[1],(d[3]-p[1])/(p[3]-p[1]),i),h[1].length),B=C+6*F,U=6*Math.max(0,N-F);o[0]=2*(m[0]-L[1])/y-1,o[1]=(m[3]+m[1])/b-1,a[0]=L[1]*g/y,a[1]=z[1]*g/b,U&&(S.color=I[1],S.tickScale=a,S.dataAxis=n,S.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U)),o[0]=(m[2]+m[0])/y-1,o[1]=2*(m[1]-L[0])/b-1,a[0]=z[0]*g/y,a[1]=L[0]*g/b,O&&(S.color=I[0],S.tickScale=a,S.dataAxis=r,S.screenOffset=o,f.drawArrays(f.TRIANGLES,D,O)),o[0]=2*(m[2]+L[3])/y-1,o[1]=(m[3]+m[1])/b-1,a[0]=L[3]*g/y,a[1]=z[3]*g/b,U&&(S.color=I[3],S.tickScale=a,S.dataAxis=n,S.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U)),o[0]=(m[2]+m[0])/y-1,o[1]=2*(m[3]+L[2])/b-1,a[0]=z[2]*g/y,a[1]=L[2]*g/b,O&&(S.color=I[2],S.tickScale=a,S.dataAxis=r,S.screenOffset=o,f.drawArrays(f.TRIANGLES,D,O))}}(),c.update=function(){var t=[1,1,-1,-1,1,-1],e=[1,-1,1,1,-1,-1];return function(r){for(var n=r.ticks,i=r.bounds,o=new Float32Array(18*(n[0].length+n[1].length)),a=(this.plot.zeroLineEnable,0),s=[[],[]],l=0;2>l;++l)for(var u=s[l],c=n[l],h=i[l],f=i[l+2],p=0;pm;++m)o[a++]=d,o[a++]=t[m],o[a++]=e[m]}this.ticks=s,this.vbo.update(o)}}(),c.dispose=function(){this.vbo.dispose(),this.shader.dispose(),this.tickShader.dispose()}},{"./shaders":173,"binary-search-bounds":175,"gl-buffer":129,"gl-shader":208}],172:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=o(e,[-1,-1,-1,1,1,-1,1,1]),i=a(e,s.lineVert,s.lineFrag),l=new n(t,r,i);return l}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawLine=function(){var t=[0,0],e=[0,0];return function(r,n,i,o,a,s){var l=this.plot,u=this.shader,c=l.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,u.uniforms.start=t,u.uniforms.end=e,u.uniforms.width=a*l.pixelRatio,u.uniforms.color=s,c.drawArrays(c.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":173,"gl-buffer":129,"gl-shader":208}],173:[function(t,e,r){"use strict";var n="precision lowp float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = vec4(color.xyz * color.w, color.w);\n}\n";e.exports={lineVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 start, end;\nuniform float width;\n\nvec2 perp(vec2 v) {\n return vec2(v.y, -v.x);\n}\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n vec2 delta = normalize(perp(start - end));\n vec2 offset = mix(start, end, 0.5 * (coord.y+1.0));\n gl_Position = vec4(screen(offset + 0.5 * width * delta * coord.x), 0, 1);\n}\n",lineFrag:n,textVert:"#define GLSLIFY 1\nattribute vec3 textCoordinate;\n\nuniform vec2 dataScale, dataShift, dataAxis, screenOffset, textScale;\nuniform float angle;\n\nvoid main() {\n float dataOffset = textCoordinate.z;\n vec2 glyphOffset = textCoordinate.xy;\n mat2 glyphMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n vec2 screenCoordinate = dataAxis * (dataScale * dataOffset + dataShift) +\n glyphMatrix * glyphOffset * textScale + screenOffset;\n gl_Position = vec4(screenCoordinate, 0, 1);\n}\n",textFrag:n,gridVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale;\nuniform float lineWidth;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n pos += 10.0 * dataCoord.y * vec2(dataAxis.y, -dataAxis.x) + dataCoord.z * lineWidth;\n gl_Position = vec4(pos, 0, 1);\n}\n",gridFrag:n,boxVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 lo, hi;\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n gl_Position = vec4(screen(mix(lo, hi, coord)), 0, 1);\n}\n",tickVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n"}},{}],174:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r,this.tickOffset=[[],[]],this.tickX=[[],[]],this.labelOffset=[0,0],this.labelCount=[0,0]}function i(t){var e=t.gl,r=o(e),i=a(e,u.textVert,u.textFrag),s=new n(t,r,i);return s}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("text-cache"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.drawTicks=function(){var t=[0,0],e=[0,0],r=[0,0];return function(n){var i=this.plot,o=this.shader,a=this.tickX[n],s=this.tickOffset[n],u=i.gl,c=i.viewBox,h=i.dataBox,f=i.screenBox,p=i.pixelRatio,d=i.tickEnable,m=i.tickPad,g=i.tickColor,v=i.tickAngle,y=(i.tickMarkLength,i.labelEnable),b=i.labelPad,x=i.labelColor,_=i.labelAngle,w=this.labelOffset[n],M=this.labelCount[n],k=l.lt(a,h[n]),A=l.le(a,h[n+2]);t[0]=t[1]=0,t[n]=1,e[n]=(c[2+n]+c[n])/(f[2+n]-f[n])-1;var T=2/f[2+(1^n)]-f[1^n];e[1^n]=T*c[1^n]-1,d[n]&&(e[1^n]-=T*p*m[n],A>k&&s[A]>s[k]&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=g[n],o.uniforms.angle=v[n],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n]&&M&&(e[1^n]-=T*p*b[n],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=x[n],o.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,M)),e[1^n]=T*c[2+(1^n)]-1,d[n+2]&&(e[1^n]+=T*p*m[n+2],A>k&&s[A]>s[k]&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=g[n+2],o.uniforms.angle=v[n+2],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n+2]&&M&&(e[1^n]+=T*p*b[n+2],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=x[n+2],o.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,M))}}(),c.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,o=r.screenBox,a=r.titleCenter,s=r.titleAngle,l=r.titleColor,a=r.titleCenter,u=r.pixelRatio;if(this.titleCount){for(var c=0;2>c;++c)e[c]=2*(a[c]*u-o[c])/(o[2+c]-o[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,o=n._tickBounds,a=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;2>u;++u){var c=o[u],h=o[u+2],f=h-c,p=.5*(a[u+2]+a[u]),d=a[u+2]-a[u],m=l[u],g=l[u+2],v=g-m,y=s[u],b=s[u+2],x=b-y;e[u]=2*f/d*v/x,t[u]=2*(c-p)/d*v/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){for(var e=[],r=t.ticks,n=t.bounds,i=0;2>i;++i){for(var o=[Math.floor(e.length/3)],a=[-(1/0)],l=r[i],u=0;ui;++i){this.labelOffset[i]=Math.floor(e.length/3);for(var m=s(t.labelFont[i],t.labels[i]).data,d=t.labelSize[i],u=0;ud;++d)if(h[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?a.drawLine(m,e[1],m,e[3],p[d],f[d]):a.drawLine(e[0],m,e[2],m,p[d],f[d])}}for(var d=0;dd;++d)s.drawTicks(d);this.titleEnable&&s.drawTitle();for(var b=this.overlays,d=0;du;++u){var c=s[u].slice(0);0!==c.length&&(c.sort(o),l[u]=Math.min(l[u],c[0].x),l[u+2]=Math.max(l[u+2],c[c.length-1].x))}this.grid.update({bounds:l,ticks:s}),this.text.update({bounds:l,ticks:s,labels:t.labels||["x","y"],labelSize:t.labelSize||[12,12],labelFont:t.labelFont||["sans-serif","sans-serif"],title:t.title||"",titleSize:t.titleSize||18,titleFont:t.titleFont||"sans-serif"}),this.setDirty()},f.dispose=function(){this.box.dispose(),this.grid.dispose(),this.text.dispose(),this.line.dispose();for(var t=this.objects.length-1;t>=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},f.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},f.removeObject=function(t){for(var e=this.objects,r=0;rf;++f)a=a&&l[f]===s[f],l[f]=s[f];var p=t.clientWidth===c&&t.clientHeight===h;return c=t.clientWidth,h=t.clientHeight,a?!p:(u=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(f,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){return n.setMode(t),n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return u},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var p=0,d=0;return a(t,function(e,r,o,a){var s=1/t.clientHeight,l=s*(r-p),c=s*(o-d),h=f.flipX?1:-1,m=f.flipY?1:-1,g=Math.PI*f.rotateSpeed,v=i();if(1&e)a.shift?n.rotate(v,0,0,-l*g):n.rotate(v,h*g*l,-m*g*c,0);else if(2&e)n.pan(v,-f.translateSpeed*l*u,f.translateSpeed*c*u,0);else if(4&e){var y=f.zoomSpeed*c/window.innerHeight*(v-n.lastT())*50;n.pan(v,0,0,u*(Math.exp(y)-1))}p=r,d=o}),s(t,function(t,e,r){var o=f.flipX?1:-1,a=f.flipY?1:-1,s=i();if(Math.abs(t)>Math.abs(e))n.rotate(s,0,0,-t*o*Math.PI*f.rotateSpeed/window.innerWidth);else{var l=f.zoomSpeed*a*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,u*(Math.exp(l)-1))}},!0),f}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":40,"mouse-change":444,"mouse-wheel":448,"right-now":458}],179:[function(t,e,r){!function(){"use strict";function t(e){e.permitHostObjects___&&e.permitHostObjects___(t)}function r(t){return!(t.substr(0,p.length)==p&&"___"===t.substr(t.length-3))}function n(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[d];if(e&&e.key===t)return e;if(f(t)){e={key:t};try{return h(t,d,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(r){return}}}function i(t){return t.prototype=null,Object.freeze(t)}function o(){y||"undefined"==typeof console||(y=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=t);var a=!1;if("function"==typeof WeakMap){var s=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var l=new s,u=Object.freeze({});if(l.set(u,1),1===l.get(u))return void(e.exports=WeakMap);a=!0}}var c=(Object.prototype.hasOwnProperty,Object.getOwnPropertyNames),h=Object.defineProperty,f=Object.isExtensible,p="weakmap:",d=p+"ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var m=new ArrayBuffer(25),g=new Uint8Array(m);crypto.getRandomValues(g),d=p+"rand:"+Array.prototype.map.call(g,function(t){return(t%36).toString(36)}).join("")+"___"}if(h(Object,"getOwnPropertyNames",{value:function(t){return c(t).filter(r)}}),"getPropertyNames"in Object){var v=Object.getPropertyNames;h(Object,"getPropertyNames",{value:function(t){return v(t).filter(r)}})}!function(){var t=Object.freeze;h(Object,"freeze",{value:function(e){return n(e),t(e)}});var e=Object.seal;h(Object,"seal",{value:function(t){return n(t),e(t)}});var r=Object.preventExtensions;h(Object,"preventExtensions",{value:function(t){return n(t),r(t)}})}();var y=!1,b=0,x=function(){function t(t,e){var r,i=n(t);return i?u in i?i[u]:e:(r=s.indexOf(t),r>=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function a(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),0>e?!1:(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||o();var s=[],l=[],u=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(a)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},"delete":{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||(c?c.has___(t):!1)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||o();var l,u=new s,c=void 0,h=!1;return l=a?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new x),c.set(t,e)),this}:function(t,e){if(h)try{u.set(t,e)}catch(r){c||(c=new x),c.set___(t,e)}else u.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");h=!0})}})}a&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],180:[function(t,e,r){"use strict";function n(t){var e=s.get(t);if(!e||!t.isBuffer(e._triangleBuffer.buffer)){var r=o(t,new Float32Array([-1,-1,-1,4,4,-1]));e=a(t,[{buffer:r,type:t.FLOAT,size:2}]),e._triangleBuffer=r,s.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}var i="undefined"==typeof WeakMap?t("weak-map"):WeakMap,o=t("gl-buffer"),a=t("gl-vao"),s=new i;e.exports=n},{"gl-buffer":129,"gl-vao":237,"weak-map":179}],181:[function(t,e,r){"use strict";function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function i(t){this.gl=t,this.pixelRatio=1,this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.autoTicks=!0,this.tickSpacing=[1,1,1],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[10,10,10],this.lastCubeProps={cubeEdges:[0,0,0],axis:[0,0,0]},this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont="sans-serif",this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[10,10,10],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[0,0,0],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!1,!1,!1],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._firstInit=!0,this._text=null,this._lines=null,this._background=c(t)}function o(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}function a(t,e,r,n,i){for(var o=t.primalOffset,a=t.primalMinor,s=t.mirrorOffset,l=t.mirrorMinor,u=n[e],c=0;3>c;++c)if(e!==c){var h=o,f=s,p=a,d=l;u&1<0?(p[c]=-1,d[c]=0):(p[c]=0,d[c]=1)}}function s(t,e){var r=new i(t);return r.update(e),r}e.exports=s;var l=t("./lib/text.js"),u=t("./lib/lines.js"),c=t("./lib/background.js"),h=t("./lib/cube.js"),f=t("./lib/ticks.js"),p=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),d=i.prototype;d.update=function(t){function e(e,r,n){if(n in t){var i,o=t[n],a=this[n];(e?Array.isArray(o)&&Array.isArray(o[0]):Array.isArray(o))?this[n]=i=[r(o[0]),r(o[1]),r(o[2])]:this[n]=i=[r(o),r(o),r(o)];for(var s=0;3>s;++s)if(i[s]!==a[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),o=e.bind(this,!1,String),a=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),s=!1,c=!1;if("bounds"in t)for(var h=t.bounds,p=0;2>p;++p)for(var d=0;3>d;++d)h[p][d]!==this.bounds[p][d]&&(c=!0),this.bounds[p][d]=h[p][d];if("ticks"in t){r=t.ticks,s=!0,this.autoTicks=!1;for(var p=0;3>p;++p)this.tickSpacing[p]=0}else n("tickSpacing")&&(this.autoTicks=!0,c=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),c=!0,s=!0,this._firstInit=!1),c&&this.autoTicks&&(r=f.create(this.bounds,this.tickSpacing),s=!0),s){for(var p=0;3>p;++p)r[p].sort(function(t,e){return t.x-e.x});f.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),o("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),a("tickColor");var m=o("labels");o("labelFont")&&(m=!0),i("labelEnable"),n("labelSize"),n("labelPad"),a("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),a("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),a("lineTickColor"),i("gridEnable"),n("gridWidth"),a("gridColor"),i("zeroEnable"),a("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),a("backgroundColor"),this._text?this._text&&(m||s)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=l(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&s&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=u(this.gl,this.bounds,this.ticks))};var m=[new o,new o,new o],g=[0,0,0],v={model:p,view:p,projection:p};d.isOpaque=function(){return!0},d.isTransparent=function(){return!1},d.drawTransparent=function(t){};var y=[0,0,0],b=[0,0,0],x=[0,0,0];d.draw=function(t){t=t||v;for(var e=this.gl,r=t.model||p,i=t.view||p,o=t.projection||p,s=this.bounds,l=h(r,i,o,s),u=l.cubeEdges,c=l.axis,f=i[12],d=i[13],_=i[14],w=i[15],M=this.pixelRatio*(o[3]*f+o[7]*d+o[11]*_+o[15]*w)/e.drawingBufferHeight,k=0;3>k;++k)this.lastCubeProps.cubeEdges[k]=u[k],this.lastCubeProps.axis[k]=c[k];for(var A=m,k=0;3>k;++k)a(m[k],k,this.bounds,u,c);for(var e=this.gl,T=g,k=0;3>k;++k)this.backgroundEnable[k]?T[k]=c[k]:T[k]=0;this._background.draw(r,i,o,s,T,this.backgroundColor),this._lines.bind(r,i,o,this);for(var k=0;3>k;++k){var E=[0,0,0];c[k]>0?E[k]=s[1][k]:E[k]=s[0][k];for(var S=0;2>S;++S){var L=(k+1+S)%3,z=(k+1+(1^S))%3;this.gridEnable[L]&&this._lines.drawGrid(L,z,this.bounds,E,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var S=0;2>S;++S){var L=(k+1+S)%3,z=(k+1+(1^S))%3;this.zeroEnable[z]&&s[0][z]<=0&&s[1][z]>=0&&this._lines.drawZero(L,z,this.bounds,E,this.zeroLineColor[z],this.zeroLineWidth[z]*this.pixelRatio)}}for(var k=0;3>k;++k){this.lineEnable[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);for(var I=n(y,A[k].primalMinor),P=n(b,A[k].mirrorMinor),C=this.lineTickLength,S=0;3>S;++S){var R=M/r[5*S];I[S]*=C[S]*R,P[S]*=C[S]*R}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,A[k].primalOffset,I,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,A[k].mirrorOffset,P,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,o,this.pixelRatio);for(var k=0;3>k;++k){for(var j=A[k].primalMinor,D=n(x,A[k].primalOffset),S=0;3>S;++S)this.lineTickEnable[k]&&(D[S]+=M*j[S]*Math.max(this.lineTickLength[S],0)/r[5*S]);if(this.tickEnable[k]){for(var S=0;3>S;++S)D[S]+=M*j[S]*this.tickPad[S]/r[5*S];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],D,this.tickColor[k])}if(this.labelEnable[k]){for(var S=0;3>S;++S)D[S]+=M*j[S]*this.labelPad[S]/r[5*S];D[k]+=.5*(s[0][k]+s[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],D,this.labelColor[k])}}},d.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":182,"./lib/cube.js":183,"./lib/lines.js":184,"./lib/text.js":186,"./lib/ticks.js":187}],182:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}function i(t){for(var e=[],r=[],i=0,l=0;3>l;++l)for(var u=(l+1)%3,c=(l+2)%3,h=[0,0,0],f=[0,0,0],p=-1;1>=p;p+=2){r.push(i,i+2,i+1,i+1,i+2,i+3),h[l]=p,f[l]=p;for(var d=-1;1>=d;d+=2){h[u]=d;for(var m=-1;1>=m;m+=2)h[c]=m,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var g=u;u=c,c=g}var v=o(t,new Float32Array(e)),y=o(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=a(t,[{buffer:v,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:v,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=s(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,v,b,x)}e.exports=i;var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.draw=function(t,e,r,n,i,o){for(var a=!1,s=0;3>s;++s)a=a||i[s];if(a){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2), +this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:o},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":185,"gl-buffer":129,"gl-vao":237}],183:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;4>n;++n){t[n]=r[12+n];for(var i=0;3>i;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;em;++m){p[2]=o[m][2];for(var b=0;2>b;++b){p[1]=o[b][1];for(var x=0;2>x;++x)p[0]=o[x][0],n(h[l],p,c),l+=1}}for(var _=-1,m=0;8>m;++m){for(var w=h[m][3],M=0;3>M;++M)f[m][M]=h[m][M]/w;0>w&&(0>_?_=m:f[m][2]_){_=0;for(var k=0;3>k;++k){for(var A=(k+2)%3,T=(k+1)%3,E=-1,S=-1,L=0;2>L;++L){var z=L<E||0>S)S>E&&(_|=1<L;++L){var z=L<E&&(_|=1<m;++m)m!==_&&m!==R&&(0>j?j=m:f[j][1]>f[m][1]&&(j=m));for(var D=-1,m=0;3>m;++m){var O=j^1<D&&(D=O);var T=f[O];T[0]m;++m){var O=j^1<F&&(F=O);var T=f[O];T[0]>f[F][0]&&(F=O)}}var N=g;N[0]=N[1]=N[2]=0,N[a.log2(D^j)]=j&D,N[a.log2(j^F)]=j&F;var B=7^F;B===_||B===R?(B=7^D,N[a.log2(F^B)]=B&F):N[a.log2(D^B)]=B&D;for(var U=v,V=_,k=0;3>k;++k)V&1<t;++t)h[t]=[1,1,1,1],f[t]=[1,1,1]}();var m=[[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]],g=[1,1,1],v=[0,0,0],y={cubeEdges:g,axis:v}},{"bit-twiddle":51,"gl-mat4/invert":148,"gl-mat4/multiply":150,"robust-orientation":462,"split-polygon":189}],184:[function(t,e,r){"use strict";function n(t){return t[0]=t[1]=t[2]=0,t}function i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(t,e,r,n,i,o,a,s){this.gl=t,this.vertBuffer=e,this.vao=r,this.shader=n,this.tickCount=i,this.tickOffset=o,this.gridCount=a,this.gridOffset=s}function a(t,e,r){var n=[],i=[0,0,0],a=[0,0,0],c=[0,0,0],h=[0,0,0];n.push(0,0,1,0,1,1,0,0,-1,0,0,-1,0,1,1,0,1,-1);for(var f=0;3>f;++f){for(var p=n.length/3|0,d=0;df;++f)for(var d=c[f],m=2;m>=0;--m){var g=u[d[m]];s.push(l*g[0],-l*g[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],u=[0,0,0],c=[0,0,0],p=[0,0,0],d=0;3>d;++d){c[d]=s.length/f|0,a(.5*(t[0][d]+t[1][d]),e[d],r),p[d]=(s.length/f|0)-c[d],l[d]=s.length/f|0;for(var m=0;m=0&&(i=r.length-n-1);var o=Math.pow(10,i),a=Math.round(t*e*o),s=a+"";if(s.indexOf("e")>=0)return s;var l=a/o,u=a%o;0>a?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u=0|u);var c=""+l;if(0>a&&(c="-"+c),i){for(var h=""+u;h.lengthi;++i){for(var o=[],a=(.5*(t[0][i]+t[1][i]),0);a*e[i]<=t[1][i];++a)o.push({x:a*e[i],text:n(e[i],a)});for(var a=-1;a*e[i]>=t[0][i];--a)o.push({x:a*e[i],text:n(e[i],a)});r.push(o)}return r}function o(t,e){for(var r=0;3>r;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;no?o=0:o>1&&(o=1);for(var a=1-o,s=t.length,l=new Array(s),u=0;s>u;++u)l[u]=o*t[u]+a*r[u];return l}function o(t,e){for(var r=[],o=[],a=n(t[t.length-1],e),s=t[t.length-1],l=t[0],u=0;ua&&c>0||a>0&&0>c){var h=i(s,c,l,a);r.push(h),o.push(h.slice())}0>c?o.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),o.push(l.slice())),a=c}return{positive:r,negative:o}}function a(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;lo&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),u>=0&&r.push(s.slice()),o=u}return r}function s(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;lo&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),0>=u&&r.push(s.slice()),o=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=o,e.exports.positive=a,e.exports.negative=s},{"robust-dot-product":190,"robust-sum":465}],190:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t[0],e[0]),n=1;no;++o){for(var a=d,s=m,l=0;3>l;++l)s[l]=a[l]=r[l];s[3]=a[3]=1,s[o]+=1,h(s,s,e),s[3]<0&&(t[o]=1/0),a[o]-=1,h(a,a,e),a[3]<0&&(t[o]=1/0);var u=(a[0]/a[3]-s[0]/s[3])*n,c=(a[1]/a[3]-s[1]/s[3])*i;t[o]=.25*Math.sqrt(u*u+c*c)}return t}function o(t,e,r,n,o){var h=e.model||f,d=e.view||f,m=e.projection||f,y=t.bounds,o=o||l(h,d,m,y),b=o.axis;o.edges;u(p,d,h),u(p,m,p);for(var x=g,_=0;3>_;++_)x[_].lo=1/0,x[_].hi=-(1/0),x[_].pixelsPerDataUnit=1/0;var w=a(c(p,p));c(p,p);for(var M=0;3>M;++M){var k=(M+1)%3,A=(M+2)%3,T=v;t:for(var _=0;2>_;++_){var E=[];if(b[M]<0!=!!_){T[M]=y[_][M];for(var S=0;2>S;++S){T[k]=y[S^_][k];for(var L=0;2>L;++L)T[A]=y[L^S^_][A],E.push(T.slice())}for(var S=0;SL;++L)x[L].lo=Math.min(x[L].lo,A[L]),x[L].hi=Math.max(x[L].hi,A[L]),L!==M&&(x[L].pixelsPerDataUnit=Math.min(x[L].pixelsPerDataUnit,Math.abs(z[L])))}}}return x}e.exports=o;var a=t("extract-frustum-planes"),s=t("split-polygon"),l=t("./lib/cube.js"),u=t("gl-mat4/multiply"),c=t("gl-mat4/transpose"),h=t("gl-vec4/transformMat4"),f=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),p=new Float32Array(16),d=[0,0,0,1],m=[0,0,0,1],g=[new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0)],v=[0,0,0]},{"./lib/cube.js":183,"extract-frustum-planes":188,"gl-mat4/multiply":150,"gl-mat4/transpose":158,"gl-vec4/transformMat4":238,"split-polygon":189}],192:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":208}],193:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}function i(t,e){function r(t,e,r,n,o,a){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=o,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=a,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s)}var i=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=o(t,i),u=a(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),c=s(t);c.attributes.position.location=0,c.attributes.color.location=1,c.attributes.weight.location=2;var h=new n(t,l,u,c);return h.update(e),h}var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders/index");e.exports=i;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype,c=[0,0,0],h=[0,0,0],f=[0,0];u.isTransparent=function(){return!1},u.drawTransparent=function(t){},u.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,o=t.model||l,a=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,p=h,d=0;3>d;++d)i&&i[d]<0?(u[d]=this.bounds[0][d],p[d]=this.bounds[1][d]):(u[d]=this.bounds[1][d],p[d]=this.bounds[0][d]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=o,n.uniforms.view=a,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,p],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var d=0;3>d;++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()},u.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},u.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":192,"gl-buffer":129,"gl-vao":237}],194:[function(t,e,r){"use strict";function n(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function i(t,e){var r=null;try{r=t.getContext("webgl",e),r||(r=t.getContext("experimental-webgl",e))}catch(n){return null}return r}function o(t){var e=Math.round(Math.log(Math.abs(t))/Math.log(10));if(0>e){var r=Math.round(Math.pow(10,-e));return Math.ceil(t*r)/r}if(e>0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function a(t){return"boolean"==typeof t?t:!0}function s(t){function e(){if(!_&&G.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*G.pixelRatio),i=0|Math.ceil(r*G.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var o=w.style;o.position=o.position||"absolute",o.left="0px",o.top="0px",o.width=e+"px",o.height=r+"px",F=!0}}}function r(){for(var t=R.length,e=O.length,r=0;e>r;++r)D[r]=0;t:for(var r=0;t>r;++r){var n=R[r],i=n.pickSlots;if(i){for(var o=0;e>o;++o)if(D[o]+i<255){j[r]=o,n.setPickBase(D[o]+1),D[o]+=i;continue t}var a=f(k,q);j[r]=e,O.push(a),D.push(i),n.setPickBase(1),e+=1}else j[r]=-1}for(;e>0&&0===D[e-1];)D.pop(),O.pop().dispose()}function s(){return G.contextLost?!0:void(k.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss()))}function y(){if(!s()){k.colorMask(!0,!0,!0,!0),k.depthMask(!0),k.disable(k.BLEND),k.enable(k.DEPTH_TEST);for(var t=R.length,e=O.length,r=0;e>r;++r){var n=O[r];n.shape=H,n.begin();for(var i=0;t>i;++i)if(j[i]===r){var o=R[i];o.drawPick&&(o.pixelRatio=1,o.drawPick(V))}n.end()}}}function b(){if(!s()){e();var t=G.camera.tick();V.view=G.camera.matrix,F=F||t,N=N||t,I.pixelRatio=G.pixelRatio,C.pixelRatio=G.pixelRatio;var r=R.length,n=W[0],i=W[1];n[0]=n[1]=n[2]=1/0,i[0]=i[1]=i[2]=-(1/0);for(var a=0;r>a;++a){var l=R[a];l.pixelRatio=G.pixelRatio,l.axes=G.axes,F=F||!!l.dirty,N=N||!!l.dirty;var u=l.bounds;if(u)for(var h=u[0],f=u[1],p=0;3>p;++p)n[p]=Math.min(n[p],h[p]),i[p]=Math.max(i[p],f[p])}var m=G.bounds;if(G.autoBounds)for(var p=0;3>p;++p){if(i[p]p;++p)b=b||Z[0][p]!==m[0][p]||Z[1][p]!==m[1][p],Z[0][p]=m[0][p],Z[1][p]=m[1][p];if(b){for(var x=[0,0,0],a=0;3>a;++a)x[a]=o((m[1][a]-m[0][a])/10);I.autoTicks?I.update({bounds:m,tickSpacing:x}):I.update({bounds:m})}N=N||b,F=F||b;var _=k.drawingBufferWidth,w=k.drawingBufferHeight;q[0]=_,q[1]=w,H[0]=0|Math.max(_/G.pixelRatio,1),H[1]=0|Math.max(w/G.pixelRatio,1),g(B,G.fovy,_/w,G.zNear,G.zFar);for(var a=0;16>a;++a)U[a]=0;U[15]=1;for(var M=0,a=0;3>a;++a)M=Math.max(M,m[1][a]-m[0][a]);for(var a=0;3>a;++a)G.autoScale?U[5*a]=G.aspect[a]/(m[1][a]-m[0][a]):U[5*a]=1/M,G.autoCenter&&(U[12+a]=.5*-U[5*a]*(m[0][a]+m[1][a]));for(var a=0;r>a;++a){var l=R[a];l.axesBounds=m,G.clipToBounds&&(l.clipBounds=m)}if(T.object&&(G.snapToData?C.position=T.dataCoordinate:C.position=T.dataPosition,C.bounds=m),N&&(N=!1,y()),F){G.axesPixels=c(G.axes,V,_,w),G.onrender&&G.onrender(),k.bindFramebuffer(k.FRAMEBUFFER,null),k.viewport(0,0,_,w);var A=G.clearColor;k.clearColor(A[0],A[1],A[2],A[3]),k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT),k.depthMask(!0),k.colorMask(!0,!0,!0,!0),k.enable(k.DEPTH_TEST),k.depthFunc(k.LEQUAL),k.disable(k.BLEND),k.disable(k.CULL_FACE);var L=!1;I.enable&&(L=L||I.isTransparent(),I.draw(V)),C.axes=I,T.object&&C.draw(V),k.disable(k.CULL_FACE);for(var a=0;r>a;++a){var l=R[a];l.axes=I,l.pixelRatio=G.pixelRatio,l.isOpaque&&l.isOpaque()&&l.draw(V),l.isTransparent&&l.isTransparent()&&(L=!0)}if(L){E.shape=q,E.bind(),k.clear(k.DEPTH_BUFFER_BIT),k.colorMask(!1,!1,!1,!1),k.depthMask(!0),k.depthFunc(k.LESS),I.enable&&I.isTransparent()&&I.drawTransparent(V);for(var a=0;r>a;++a){var l=R[a];l.isOpaque&&l.isOpaque()&&l.draw(V)}k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA),k.colorMask(!0,!0,!0,!0),k.depthMask(!1),k.clearColor(0,0,0,0),k.clear(k.COLOR_BUFFER_BIT),I.isTransparent()&&I.drawTransparent(V);for(var a=0;r>a;++a){var l=R[a];l.isTransparent&&l.isTransparent()&&l.drawTransparent(V)}k.bindFramebuffer(k.FRAMEBUFFER,null),k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA),k.disable(k.DEPTH_TEST),S.bind(),E.color[0].bind(0),S.uniforms.accumBuffer=0,d(k),k.disable(k.BLEND)}F=!1;for(var a=0;r>a;++a)R[a].dirty=!1}}}function x(){_||G.contextLost||(requestAnimationFrame(x),b())}t=t||{};var _=!1,w=(t.pixelRatio||parseFloat(window.devicePixelRatio),t.canvas);if(!w)if(w=document.createElement("canvas"),t.container){var M=t.container;M.appendChild(w)}else document.body.appendChild(w);var k=t.gl;if(k||(k=i(w,t.glOptions||{premultipliedAlpha:!0,antialias:!0})),!k)throw new Error("webgl not supported");var A=t.bounds||[[-10,-10,-10],[10,10,10]],T=new n,E=p(k,[k.drawingBufferWidth,k.drawingBufferHeight],{preferFloat:!0}),S=v(k),L=t.camera||{eye:[2,0,0],center:[0,0,0],up:[0,1,0],zoomMin:.1,zoomMax:100,mode:"turntable"},z=t.axes||{},I=u(k,z);I.enable=!z.disable;var P=t.spikes||{},C=h(k,P),R=[],j=[],D=[],O=[],F=!0,N=!0,B=new Array(16),U=new Array(16),V={view:null,projection:B,model:U},N=!0,q=[k.drawingBufferWidth,k.drawingBufferHeight],G={gl:k,contextLost:!1,pixelRatio:t.pixelRatio||parseFloat(window.devicePixelRatio),canvas:w,selection:T,camera:l(w,L),axes:I,axesPixels:null,spikes:C,bounds:A,objects:R,shape:q,aspect:t.aspectRatio||[1,1,1],pickRadius:t.pickRadius||10,zNear:t.zNear||.01,zFar:t.zFar||1e3,fovy:t.fovy||Math.PI/4,clearColor:t.clearColor||[0,0,0,0],autoResize:a(t.autoResize),autoBounds:a(t.autoBounds),autoScale:!!t.autoScale,autoCenter:a(t.autoCenter),clipToBounds:a(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:V,oncontextloss:null,mouseListener:null},H=[k.drawingBufferWidth/G.pixelRatio|0,k.drawingBufferHeight/G.pixelRatio|0];G.autoResize&&e(),window.addEventListener("resize",e),G.update=function(t){_||(t=t||{},F=!0,N=!0)},G.add=function(t){_||(t.axes=I,R.push(t),j.push(-1),F=!0,N=!0,r())},G.remove=function(t){if(!_){var e=R.indexOf(t);0>e||(R.splice(e,1),j.pop(),F=!0,N=!0,r())}},G.dispose=function(){if(!_&&(_=!0,window.removeEventListener("resize",e),w.removeEventListener("webglcontextlost",s),G.mouseListener.enabled=!1,!G.contextLost)){I.dispose(),C.dispose();for(var t=0;ts;++s){var l=O[s].query(e,H[1]-r-1,G.pickRadius);if(l){if(l.distance>T.distance)continue;for(var u=0;i>u;++u){var c=R[u];if(j[u]===s){var h=c.pick(l);h&&(T.buttons=t,T.screen=l.coord,T.distance=l.distance,T.object=c,T.index=h.distance,T.dataPosition=h.position,T.dataCoordinate=h.dataCoordinate,T.data=h,a=!0)}}}}}o&&o!==T.object&&(o.highlight&&o.highlight(null),F=!0),T.object&&(T.object.highlight&&T.object.highlight(T.data),F=!0),a=a||T.object!==o,a&&G.onselect&&G.onselect(T),1&t&&!(1&Y)&&G.onclick&&G.onclick(T),Y=t}}),w.addEventListener("webglcontextlost",s);var W=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],Z=[W[0].slice(),W[1].slice()];return x(),G.redraw=function(){_||(F=!0,b())},G}e.exports=s;var l=t("3d-view-controls"),u=t("gl-axes3d"),c=t("gl-axes3d/properties"),h=t("gl-spikes3d"),f=t("gl-select-static"),p=t("gl-fbo"),d=t("a-big-triangle"),m=t("mouse-change"),g=t("gl-mat4/perspective"),v=t("./lib/shader")},{"./lib/shader":177,"3d-view-controls":178,"a-big-triangle":180,"gl-axes3d":181,"gl-axes3d/properties":191,"gl-fbo":134,"gl-mat4/perspective":151,"gl-select-static":207,"gl-spikes3d":193,"mouse-change":444}],195:[function(t,e,r){"use strict";e.exports={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvarying vec4 fragColor;\n\nvec4 computePosition_1_0(vec2 position, vec2 offset, mat3 view, vec2 scale) {\n vec3 xposition = view * vec3(position, 1.0);\n return vec4(\n xposition.xy + scale * offset * xposition.z,\n 0,\n xposition.z);\n}\n\n\n\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n position,\n offset,\n viewTransform,\n pixelScale);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\nvec4 computePosition_1_0(vec2 position, vec2 offset, mat3 view, vec2 scale) {\n vec3 xposition = view * vec3(position, 1.0);\n return vec4(\n xposition.xy + scale * offset * xposition.z,\n 0,\n xposition.z);\n}\n\n\n\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n position,\n offset,\n viewTransform,\n pixelScale);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],196:[function(t,e,r){"use strict";function n(t){if(t in f)return f[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;ea;++a)i[a]=Math.min(i[a],r[o+a]),i[2+a]=Math.max(i[2+a],r[o+a]);return f[t]={coords:r,normals:n,bounds:i}}function i(t,e,r,n,i,o,a){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.offsetBuffer=i,this.colorBuffer=o,this.idBuffer=a,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.numVertices=0,this.pickOffset=0,this.points=null}function o(t,e){var r=t.gl,n=a(r,h.vertex,h.fragment),o=a(r,h.pickVertex,h.pickFragment),l=s(r),u=s(r),c=s(r),f=s(r),p=new i(t,n,o,l,u,c,f);return p.update(e),t.addObject(p),p}e.exports=o;var a=t("gl-shader"),s=t("gl-buffer"),l=t("text-cache"),u=t("typedarray-pool"),c=t("vectorize-text"),h=t("./lib/shaders"),f={},p=i.prototype;!function(){function t(){var t=this.plot,n=this.bounds,i=t.viewBox,o=t.dataBox,a=t.pixelRatio,s=n[2]-n[0],l=n[3]-n[1],u=o[2]-o[0],c=o[3]-o[1];e[0]=2*s/u,e[4]=2*l/c,e[6]=2*(n[0]-o[0])/u-1,e[7]=2*(n[1]-o[1])/c-1;var h=i[2]-i[0],f=i[3]-i[1];r[0]=2*a/h,r[1]=2*a/f}var e=[1,0,0,0,1,0,0,0,1],r=[1,1];p.draw=function(){var n=this.plot,i=this.shader,o=this.numVertices;if(o){var a=n.gl;t.call(this),i.bind(),i.uniforms.pixelScale=r,i.uniforms.viewTransform=e,this.positionBuffer.bind(),i.attributes.position.pointer(),this.offsetBuffer.bind(),i.attributes.offset.pointer(),this.colorBuffer.bind(),i.attributes.color.pointer(a.UNSIGNED_BYTE,!0),a.drawArrays(a.TRIANGLES,0,o)}};var n=[0,0,0,0];p.drawPick=function(i){var o=this.plot,a=this.pickShader,s=this.numVertices,l=o.gl;if(this.pickOffset=i,!s)return i;for(var u=0;4>u;++u)n[u]=i>>8*u&255;return t.call(this),a.bind(),a.uniforms.pixelScale=r,a.uniforms.viewTransform=e,a.uniforms.pickOffset=n,this.positionBuffer.bind(),a.attributes.position.pointer(),this.offsetBuffer.bind(),a.attributes.offset.pointer(),this.idBuffer.bind(),a.attributes.id.pointer(l.UNSIGNED_BYTE,!1),l.drawArrays(l.TRIANGLES,0,s),i+this.numPoints}}(),p.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}},p.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],i=t.glyphs||[],o=t.sizes||[],a=t.borderWidths||[],s=t.borderColors||[];this.points=e;for(var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=0,f=0;f>1;for(var p=0;2>p;++p)c[p]=Math.min(c[p],e[2*f+p]),c[2+p]=Math.max(c[2+p],e[2*f+p])}c[0]===c[2]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);for(var d=1/(c[2]-c[0]),m=1/(c[3]-c[1]),g=c[0],v=c[1],y=u.mallocFloat32(2*h),b=u.mallocFloat32(2*h),x=u.mallocUint8(4*h),_=u.mallocUint32(h),w=0,f=0;f=o?i(0,o-1,t,e,r,n):h(0,o-1,t,e,r,n)}function i(t,e,r,n,i,o){for(var a=t+1;e>=a;++a){for(var s=r[a],l=n[2*a],u=n[2*a+1],c=i[a],h=o[a],f=a;f>t;){var p=r[f-1],d=n[2*(f-1)];if((p-s||l-d)>=0)break;r[f]=p,n[2*f]=d,n[2*f+1]=n[2*f-1],i[f]=i[f-1],o[f]=o[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,o[f]=h}}function o(t,e,r,n,i,o){var a=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=o[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e],r[e]=a,n[2*e]=s,n[2*e+1]=l,i[e]=u,o[e]=c}function a(t,e,r,n,i,o){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e]}function s(t,e,r,n,i,o,a){var s=n[t],l=i[2*t],u=i[2*t+1],c=o[t],h=a[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],o[t]=o[e],a[t]=a[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],o[e]=o[r],a[e]=a[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,o[r]=c,a[r]=h}function l(t,e,r,n,i,o,a,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=o,c[e]=a}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,o,a,s){return(e-o[t]||a[2*t]-r||i-s[t])<0}function h(t,e,r,n,p,d){var m=(e-t+1)/6|0,g=t+m,v=e-m,y=t+e>>1,b=y-m,x=y+m,_=g,w=b,M=y,k=x,A=v,T=t+1,E=e-1,S=0;u(_,w,r,n,p,d)&&(S=_,_=w,w=S),u(k,A,r,n,p,d)&&(S=k,k=A,A=S),u(_,M,r,n,p,d)&&(S=_,_=M,M=S),u(w,M,r,n,p,d)&&(S=w,w=M,M=S),u(_,k,r,n,p,d)&&(S=_,_=k,k=S),u(M,k,r,n,p,d)&&(S=M,M=k,k=S),u(w,A,r,n,p,d)&&(S=w,w=A,A=S),u(w,M,r,n,p,d)&&(S=w,w=M,M=S),u(k,A,r,n,p,d)&&(S=k,k=A,A=S);var L=r[w],z=n[2*w],I=n[2*w+1],P=p[w],C=d[w],R=r[k],j=n[2*k],D=n[2*k+1],O=p[k],F=d[k],N=_,B=M,U=A,V=g,q=y,G=v,H=r[N],X=r[B],Y=r[U];r[V]=H,r[q]=X,r[G]=Y;for(var W=0;2>W;++W){var Z=n[2*N+W],Q=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=Q,n[2*G+W]=K}var J=p[N],$=p[B],tt=p[U];p[V]=J,p[q]=$,p[G]=tt;var et=d[N],rt=d[B],nt=d[U];d[V]=et,d[q]=rt,d[G]=nt,a(b,t,r,n,p,d),a(x,e,r,n,p,d);for(var it=T;E>=it;++it)if(c(it,L,z,I,P,r,n,p))it!==T&&o(it,T,r,n,p,d),++T;else if(!c(it,R,j,D,O,r,n,p))for(;;){if(c(E,R,j,D,O,r,n,p)){c(E,L,z,I,P,r,n,p)?(s(it,T,E,r,n,p,d),++T,--E):(o(it,E,r,n,p,d),--E);break}if(--E=T-2-t?i(t,T-2,r,n,p,d):h(t,T-2,r,n,p,d),f>=e-(E+2)?i(E+2,e,r,n,p,d):h(E+2,e,r,n,p,d),f>=E-T?i(T,E,r,n,p,d):h(T,E,r,n,p,d)}e.exports=n;var f=32},{}],200:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s){for(var l=r,u=r;n>u;++u){var c=t[2*u],h=t[2*u+1],f=e[u];c>=i&&a>=c&&h>=o&&s>=h&&(u===l?l+=1:(t[2*u]=t[2*l],t[2*u+1]=t[2*l+1],e[u]=e[l],t[2*l]=c,t[2*l+1]=h,e[l]=f,l+=1))}return l}function i(t,e,r){this.pixelSize=t,this.offset=e,this.count=r}function o(t,e,r,o){function l(i,o,a,s,u,c){var h=.5*a,f=s+1,p=u-s;r[_]=p,x[_++]=c;for(var d=0;2>d;++d)for(var m=0;2>m;++m){var g=i+d*h,v=o+m*h,y=n(t,e,f,u,g,v,g+h,v+h);if(y!==f){if(y-f>=Math.max(.9*p,32)){var b=u+s>>>1;l(g,v,h,f,b,c+1),f=b}l(g,v,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(1>u)return[];for(var c=1/0,h=1/0,f=-(1/0),p=-(1/0),d=0;u>d;++d){var m=t[2*d],g=t[2*d+1];c=Math.min(c,m),f=Math.max(f,m),h=Math.min(h,g),p=Math.max(p,g),e[d]=d}c===f&&(f+=1+Math.abs(f)),h===p&&(p+=1+Math.abs(f));var v=1/(f-c),y=1/(p-h),b=Math.max(f-c,p-h);o=o||[0,0,0,0],o[0]=c,o[1]=h,o[2]=f,o[3]=p;var x=a.mallocInt32(u),_=0;l(c,h,b,0,u,0),s(x,t,e,r,u);for(var w=[],M=0,k=u,_=u-1;_>=0;--_){t[2*_]=(t[2*_]-c)*v,t[2*_+1]=(t[2*_+1]-h)*y;var A=x[_];A!==M&&(w.push(new i(b*Math.pow(.5,A),_+1,k-(_+1))),k=_+1,M=A)}return w.push(new i(b*Math.pow(.5,A+1),0,k)),a.free(x),w}var a=t("typedarray-pool"),s=t("./lib/sort");e.exports=o},{"./lib/sort":199,"typedarray-pool":481}],201:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.weightBuffer=n,this.shader=i,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=a(r),s=a(r),l=a(r),u=o(r,c.pointVertex,c.pointFragment),h=o(r,c.pickVertex,c.pickFragment),f=new n(t,i,s,l,u,h);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),a=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var h=n.prototype;h.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},h.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords);var r=t.positions,n=u.mallocFloat32(r.length),i=u.mallocInt32(r.length>>>1);n.set(r);var o=u.mallocFloat32(r.length);this.points=r,this.scales=l(n,i,o,this.bounds),this.offsetBuffer.update(n),this.pickBuffer.update(i),this.weightBuffer.update(o);for(var a=u.mallocFloat32(r.length>>>1),s=0,c=0;s>>1,this.pickOffset=0},h.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0,0,0];return function(r){var n=this.plot,i=this.pickShader,o=this.scales,a=this.offsetBuffer,l=this.pickBuffer,u=this.bounds,c=this.size,h=this.borderSize,f=n.gl,p=n.pickPixelRatio,d=n.viewBox,m=n.dataBox;if(0===this.pointCount)return r;var g=u[2]-u[0],v=u[3]-u[1],y=m[2]-m[0],b=m[3]-m[1],x=(d[2]-d[0])*p/n.pixelRatio,_=(d[3]-d[1])*p/n.pixelRatio,w=Math.min(y/x,b/_);t[0]=2*g/y,t[4]=2*v/b,t[6]=2*(u[0]-m[0])/y-1,t[7]=2*(u[1]-m[1])/b-1,this.pickOffset=r,e[0]=255&r,e[1]=r>>8&255,e[2]=r>>16&255,e[3]=r>>24&255,i.bind(),i.uniforms.matrix=t,i.uniforms.color=this.color,i.uniforms.borderColor=this.borderColor,i.uniforms.pointSize=p*(c+h),i.uniforms.pickOffset=e,0===this.borderSize?i.uniforms.centerFraction=2:i.uniforms.centerFraction=c/(c+h+1.25),a.bind(),i.attributes.position.pointer(),l.bind(),i.attributes.pickId.pointer(f.UNSIGNED_BYTE);for(var M=this.xCoords,k=(m[0]-u[0]-w*c*p)/g,A=(m[2]-u[0]+w*c*p)/g,T=o.length-1;T>=0;--T){var E=o[T];if(!(E.pixelSize1)){var S=E.offset,L=E.count+S,z=s.ge(M,k,S,L-1),I=s.lt(M,A,z,L-1)+1;I>z&&f.drawArrays(f.POINTS,z,I-z)}}return r+this.pointCount}}(),h.draw=function(){var t=[1,0,0,0,1,0,0,0,1];return function(){var e=this.plot,r=this.shader,n=this.scales,i=this.offsetBuffer,o=this.bounds,a=this.size,l=this.borderSize,u=e.gl,c=e.pixelRatio,h=e.viewBox,f=e.dataBox;if(0!==this.pointCount){var p=o[2]-o[0],d=o[3]-o[1],m=f[2]-f[0],g=f[3]-f[1],v=h[2]-h[0],y=h[3]-h[1],b=Math.min(m/v,g/y);t[0]=2*p/m,t[4]=2*d/g,t[6]=2*(o[0]-f[0])/m-1,t[7]=2*(o[1]-f[1])/g-1,r.bind(),r.uniforms.matrix=t,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointSize=c*(a+l),r.uniforms.useWeight=1,0===this.borderSize?r.uniforms.centerFraction=2:r.uniforms.centerFraction=a/(a+l+1.25),i.bind(),r.attributes.position.pointer(),this.weightBuffer.bind(),r.attributes.weight.pointer();for(var x=this.xCoords,_=(f[0]-o[0]-b*a*c)/p,w=(f[2]-o[0]+b*a*c)/p,M=!0,k=n.length-1;k>=0;--k){var A=n[k];if(!(A.pixelSize1)){var T=A.offset,E=A.count+T,S=s.ge(x,_,T,E-1),L=s.lt(x,w,S,E-1)+1;L>S&&u.drawArrays(u.POINTS,S,L-S),M&&(M=!1,r.uniforms.useWeight=0)}}}}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}}},{"./lib/shader":197,"binary-search-bounds":198,"gl-buffer":129,"gl-shader":208,"snap-points-2d":200,"typedarray-pool":481}],202:[function(t,e,r){"use strict";function n(t,e){var r=o[e];if(r||(r=o[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),a=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lc;++c)s[0][c]=Math.min(s[0][c],u[c]),s[1][c]=Math.max(s[1][c],u[c]);return r[t]=[a,n,s]}var i=t("vectorize-text");e.exports=n;var o={}},{"vectorize-text":483}],203:[function(t,e,r){function n(t,e){var r=i(t,e),n=r.attributes;return n.position.location=0,n.color.location=1,n.glyph.location=2,n.id.location=3,r}var i=t("gl-shader"),o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\n\nuniform vec4 highlightId;\nuniform float highlightScale;\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = 1.0;\n if(distance(highlightId, id) < 0.0001) {\n scale = highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1);\n vec4 viewPosition = view * worldPosition;\n viewPosition = viewPosition / viewPosition.w;\n vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\n \n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float highlightScale, pixelRatio;\nuniform vec4 highlightId;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = pixelRatio;\n if(distance(highlightId.bgr, id.bgr) < 0.001) {\n scale *= highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1.0);\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n \n gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform float highlightScale;\nuniform vec4 highlightId;\nuniform vec3 axes[2];\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float scale, pixelRatio;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) ||\n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float lscale = pixelRatio * scale;\n if(distance(highlightId, id) < 0.0001) {\n lscale *= highlightScale;\n }\n\n vec4 clipCenter = projection * view * model * vec4(position, 1);\n vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\n vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = dataPosition;\n }\n}\n",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) ||\n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = interpColor * opacity;\n }\n}\n",u="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) || \n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n }\n}",c=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],h={vertex:o,fragment:l,attributes:c},f={vertex:a,fragment:l,attributes:c},p={vertex:s,fragment:l,attributes:c},d={vertex:o,fragment:u,attributes:c},m={vertex:a,fragment:u,attributes:c},g={vertex:s,fragment:u,attributes:c};r.createPerspective=function(t){return n(t,h)},r.createOrtho=function(t){return n(t,f)},r.createProject=function(t){return n(t,p)},r.createPickPerspective=function(t){return n(t,d)},r.createPickOrtho=function(t){return n(t,m)},r.createPickProject=function(t){return n(t,g)}},{"gl-shader":208}],204:[function(t,e,r){"use strict";function n(t,e){var r=t[0],n=t[1],i=t[2],o=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*i+e[12]*o,t[1]=e[1]*r+e[5]*n+e[9]*i+e[13]*o,t[2]=e[2]*r+e[6]*n+e[10]*i+e[14]*o,t[3]=e[3]*r+e[7]*n+e[11]*i+e[15]*o,t}function i(t,e,r,i){return n(i,i,r),n(i,i,e),n(i,i,t)}function o(t,e){this.index=t,this.dataCoordinate=this.position=e}function a(t,e,r,n,i,a,s,l,u,c,h,f){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=i,this.colorBuffer=a,this.glyphBuffer=s,this.idBuffer=l,this.vao=u,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.pickId=0,this.pickPerspectiveShader=c,this.pickOrthoShader=h,this.pickProjectShader=f,this.points=[],this._selectResult=new o(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.dirty=!0}function s(t){return t[0]=t[1]=t[2]=0,t}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function u(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function c(t){for(var e=L,r=0;2>r;++r)for(var n=0;3>n;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}function h(t,e,r,n,o){var a,h=e.axesProject,f=e.gl,p=t.uniforms,d=r.model||x,m=r.view||x,g=r.projection||x,y=e.axesBounds,b=c(e.clipBounds);a=e.axes?e.axes.lastCubeProps.axis:[1,1,1],w[0]=2/f.drawingBufferWidth,w[1]=2/f.drawingBufferHeight,t.bind(),p.view=m,p.projection=g,p.screenSize=w,p.highlightId=e.highlightId,p.highlightScale=e.highlightScale,p.clipBounds=b,p.pickGroup=e.pickId/255,p.pixelRatio=e.pixelRatio;for(var _=0;3>_;++_)if(h[_]&&e.projectOpacity[_]<1===n){p.scale=e.projectScale[_],p.opacity=e.projectOpacity[_];for(var L=E,z=0;16>z;++z)L[z]=0;for(var z=0;4>z;++z)L[5*z]=1;L[5*_]=0,a[_]<0?L[12+_]=y[0][_]:L[12+_]=y[1][_],v(L,d,L),p.model=L;var I=(_+1)%3,P=(_+2)%3,C=s(M),R=s(k);C[I]=1,R[P]=1;var j=i(g,m,d,l(A,C)),D=i(g,m,d,l(T,R));if(Math.abs(j[1])>Math.abs(D[1])){var O=j;j=D,D=O,O=C,C=R,R=O;var F=I;I=P,P=F}j[0]<0&&(C[I]=-1),D[1]>0&&(R[P]=-1);for(var N=0,B=0,z=0;4>z;++z)N+=Math.pow(d[4*I+z],2),B+=Math.pow(d[4*P+z],2);C[I]/=Math.sqrt(N),R[P]/=Math.sqrt(B),p.axes[0]=C,p.axes[1]=R,p.fragClipBounds[0]=u(S,b[0],_,-1e8),p.fragClipBounds[1]=u(S,b[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,o){var a=r.gl;if(r.vao.bind(),i===r.opacity<1||o){t.bind();var s=t.uniforms;s.model=n.model||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/a.drawingBufferWidth,w[1]=2/a.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=P,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(a.TRIANGLES,r.vertexCount),r.lineWidth>0&&(a.lineWidth(r.lineWidth),r.vao.draw(a.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,o),r.vao.unbind()}function p(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),o=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=d(e),c=d(e),h=d(e),f=d(e),p=m(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),g=new a(e,r,n,i,u,c,h,f,p,o,s,l);return g.update(t),g}var d=t("gl-buffer"),m=t("gl-vao"),g=t("typedarray-pool"),v=t("gl-mat4/multiply"),y=t("./lib/shaders"),b=t("./lib/glyphs"),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=p;var _=a.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],k=[0,0,0],A=[0,0,0,1],T=[0,0,0,1],E=x.slice(),S=[0,0,0],L=[[0,0,0],[0,0,0]],z=[-1e8,-1e8,-1e8],I=[1e8,1e8,1e8],P=[z,I];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;f(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||0>e)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;3>i;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",o=t.alignment||[0,0],a=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,h=t.angle,f=t.lineColor,p=0,d=0,m=0,v=n.length;t:for(var y=0;v>y;++y){for(var x=n[y],_=0;3>_;++_)if(isNaN(x[_])||!isFinite(x[_]))continue t;var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var M=w[0],k=w[1],A=w[2];d+=3*M.cells.length,m+=2*k.edges.length}var T=d+m,E=g.mallocFloat(3*T),S=g.mallocFloat(4*T),L=g.mallocFloat(2*T),z=g.mallocUint32(T),I=[0,o[1]],P=0,C=d,R=[0,0,0,1],j=[0,0,0,1],D=Array.isArray(u)&&Array.isArray(u[0]),O=Array.isArray(f)&&Array.isArray(f[0]);t:for(var y=0;v>y;++y){for(var x=n[y],_=0;3>_;++_){if(isNaN(x[_])||!isFinite(x[_])){p+=1;continue t}s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_])}var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var M=w[0],k=w[1],A=w[2];if(Array.isArray(u)){var F;if(F=D?u[y]:u,3===F.length){for(var _=0;3>_;++_)R[_]=F[_];R[3]=1}else if(4===F.length)for(var _=0;4>_;++_)R[_]=F[_]}else R[0]=R[1]=R[2]=0,R[3]=1;if(Array.isArray(f)){var F;if(F=O?f[y]:f,3===F.length){for(var _=0;3>_;++_)j[_]=F[_];j[_]=1}else if(4===F.length)for(var _=0;4>_;++_)j[_]=F[_]}else j[0]=j[1]=j[2]=0,j[3]=1;var N=.5;Array.isArray(c)?N=+c[y]:c?N=+c:this.useOrtho&&(N=12);var B=0;Array.isArray(h)?B=+h[y]:h&&(B=+h);for(var U=Math.cos(B),V=Math.sin(B),x=n[y],_=0;3>_;++_)s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_]);o[0]<0?I[0]=o[0]*(1+A[1][0]):o[0]>0&&(I[0]=-o[0]*(1+A[0][0]));for(var q=M.cells,G=M.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*P+Y]=x[Y];for(var Y=0;4>Y;++Y)S[4*P+Y]=R[Y];z[P]=p;var W=G[H[X]];L[2*P]=N*(U*W[0]-V*W[1]+I[0]),L[2*P+1]=N*(V*W[0]+U*W[1]+I[1]),P+=1}for(var q=k.edges,G=k.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*C+Y]=x[Y];for(var Y=0;4>Y;++Y)S[4*C+Y]=j[Y];z[C]=p;var W=G[H[X]];L[2*C]=N*(U*W[0]-V*W[1]+I[0]),L[2*C+1]=N*(V*W[0]+U*W[1]+I[1]),C+=1}p+=1}this.vertexCount=d,this.lineVertexCount=m,this.pointBuffer.update(E),this.colorBuffer.update(S),this.glyphBuffer.update(L),this.idBuffer.update(new Uint32Array(z)),g.free(E),g.free(S),g.free(L),g.free(z),this.bounds=[a,s],this.points=n,this.pointCount=n.length}},_.dispose=function(){this.shader.dispose(),this.orthoShader.dispose(),this.pickPerspectiveShader.dispose(),this.pickOrthoShader.dispose(),this.vao.dispose(),this.pointBuffer.dispose(),this.colorBuffer.dispose(),this.glyphBuffer.dispose(),this.idBuffer.dispose()}},{"./lib/glyphs":202,"./lib/shaders":203,"gl-buffer":129,"gl-mat4/multiply":150,"gl-vao":237,"typedarray-pool":481}],205:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],206:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=a(r,[0,0,0,1,1,0,1,1]),l=o(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var o=t("gl-shader"),a=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),o=this.borderColor,a=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,h=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],f=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],p=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],d=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(h=Math.max(h,u[0]),f=Math.max(f,u[1]),p=Math.min(p,u[2]),d=Math.min(d,u[3]),!(h>p||f>d)){a.bind();var m=s[2]-s[0],g=s[3]-s[1];if(this.outerFill&&(a.drawBox(0,0,m,f,i),a.drawBox(0,f,h,d,i),a.drawBox(0,d,m,g,i),a.drawBox(p,f,m,d,i)),this.innerFill&&a.drawBox(h,f,p,d,n),r>0){var v=r*c;a.drawBox(h-v,f-v,p+v,f+v,o),a.drawBox(h-v,d-v,p+v,d+v,o),a.drawBox(h-v,f-v,h+v,d+v,o),a.drawBox(p-v,f-v,p+v,d+v,o)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":205,"gl-buffer":129,"gl-shader":208}],207:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function o(t,e){var r=a(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=o;var a=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(255>_inline_46_arg0_||255>_inline_46_arg1_||255>_inline_46_arg2_||255>_inline_46_arg3_){var _inline_46_l=_inline_46_arg4_-_inline_46_arg6_[0],_inline_46_a=_inline_46_arg5_-_inline_46_arg6_[1],_inline_46_f=_inline_46_l*_inline_46_l+_inline_46_a*_inline_46_a;_inline_46_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;r*e*4>i;++i)n[i]=255}return t}}}),h.begin=function(){var t=this.gl;this.shape;t&&(this.fbo.bind(),t.clearColor(1,1,1,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT))},h.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},h.query=function(t,e,r){if(!this.gl)return null;var i=this.fbo.shape.slice();t=0|t,e=0|e,"number"!=typeof r&&(r=1);var o=0|Math.min(Math.max(t-r,0),i[0]),a=0|Math.min(Math.max(t+r,0),i[0]),s=0|Math.min(Math.max(e-r,0),i[1]),u=0|Math.min(Math.max(e+r,0),i[1]);if(o>=a||s>=u)return null;var h=[a-o,u-s],f=l(this.buffer,[h[0],h[1],4],[4,4*i[0],1],4*(o+i[0]*s)),p=c(f.hi(h[0],h[1],1),r,r),d=p[0],m=p[1];if(0>d||Math.pow(this.radius,2)=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;k>T;++T)A[T]=_.length,x.push(M.name+"["+T+"]"),"number"==typeof M.location?_.push(M.location+T):Array.isArray(M.location)&&M.location.length===k&&"number"==typeof M.location[T]?_.push(0|M.location[T]):_.push(-1);b.push({name:M.name,type:M.type,locations:A})}else b.push({name:M.name,type:M.type,locations:[_.length]}),x.push(M.name),"number"==typeof M.location?_.push(0|M.location):_.push(-1)}for(var E=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(E)>=0;)E+=1;_[w]=E}var S=new Array(r.length);o(),p._relink=o,p.types={uniforms:l(r),attributes:l(n)},p.attributes=s(d,p,b,_),Object.defineProperty(p,"uniforms",a(d,p,r,S))},e.exports=o},{"./lib/GLError":209,"./lib/create-attributes":210,"./lib/create-uniforms":211,"./lib/reflect":212,"./lib/runtime-reflect":213,"./lib/shader-cache":214}],209:[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},{}],210:[function(t,e,r){ +"use strict";function n(t,e,r,n,i,o){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=o}function i(t,e,r,i,o,a,s){for(var l=["gl","v"],u=[],c=0;o>c;++c)l.push("x"+c),u.push("x"+c);l.push("if(x0.length===void 0){return gl.vertexAttrib"+o+"f(v,"+u.join()+")}else{return gl.vertexAttrib"+o+"fv(v,x0)}");var h=Function.apply(null,l),f=new n(t,e,r,i,o,h);Object.defineProperty(a,s,{set:function(e){return t.disableVertexAttribArray(i[r]),h(t,i[r],e),e},get:function(){return f},enumerable:!0})}function o(t,e,r,n,o,a,s){for(var l=new Array(o),u=new Array(o),c=0;o>c;++c)i(t,e,r[c],n,o,l,c),u[c]=l[c];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;o>e;++e)u[e].location=t[e];else for(var e=0;o>e;++e)u[e].location=t+e;return t},get:function(){for(var t=new Array(o),e=0;o>e;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,a,s){e=e||t.FLOAT,i=!!i,a=a||o*o,s=s||0;for(var l=0;o>l;++l){var u=n[r[l]];t.vertexAttribPointer(u,o,e,i,a,s+l*o),t.enableVertexAttribArray(u)}};var h=new Array(o),f=t["vertexAttrib"+o+"fv"];Object.defineProperty(a,s,{set:function(e){for(var i=0;o>i;++i){var a=n[r[i]];if(t.disableVertexAttribArray(a),Array.isArray(e[0]))f.call(t,a,e[i]);else{for(var s=0;o>s;++s)h[s]=e[o*i+s];f.call(t,a,h)}}return e},get:function(){return l},enumerable:!0})}function a(t,e,r,n){for(var a={},l=0,u=r.length;u>l;++l){var c=r[l],h=c.name,f=c.type,p=c.locations;switch(f){case"bool":case"int":case"float":i(t,e,p[0],n,1,a,h);break;default:if(f.indexOf("vec")>=0){var d=f.charCodeAt(f.length-1)-48;if(2>d||d>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,p[0],n,d,a,h)}else{if(!(f.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+h+": "+f);var d=f.charCodeAt(f.length-1)-48;if(2>d||d>4)throw new s("","Invalid data type for attribute "+h+": "+f);o(t,e,p,n,d,a,h)}}}return a}e.exports=a;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,o=i._gl,a=i._locations[i._index];o.vertexAttribPointer(a,i._dimension,t||o.FLOAT,!!e,r||0,n||0),o.enableVertexAttribArray(a)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":209}],211:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e,r,o){function l(r){var n=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}");return n(t,e,o)}function u(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(n>=0&&1>=n&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],o=t;o+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(o,i)):r.push([o,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=c("",e),a=0;a=0&&1>=e&&t.length===4+e){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function p(t,e,i){if("object"==typeof i){var a=d(i);Object.defineProperty(t,e,{get:n(a),set:h(i),enumerable:!0,configurable:!1})}else o[i]?Object.defineProperty(t,e,{get:l(i),set:h(i),enumerable:!0,configurable:!1}):t[e]=f(r[i].type)}function d(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in a||(a[l[0]]=[]),a=a[l[0]];for(var u=1;uo;++o){var a=t.getActiveUniform(e,o);if(a){var s=n(t,a.type);if(a.size>1)for(var l=0;lo;++o){var a=t.getActiveAttrib(e,o);a&&i.push({name:a.name,type:n(t,a.type)})}return i}r.uniforms=i,r.attributes=o;var a={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},s=null},{}],214:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=o,this.programs=[],this.cache=a}function i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function o(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);try{var o=h(i,r,e)}catch(a){throw console.warn("Failed to format compiler error: "+a),new c(i,"Error compiling shader:\n"+i)}throw new c(i,o.short,o.long)}return n}function a(t,e,r,n,i){var o=t.createProgram();t.attachShader(o,e),t.attachShader(o,r);for(var a=0;an;++n){var o=t.programs[r[n]];o&&(delete t.programs[n],e.deleteProgram(o))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var m=i.prototype;m.getShaderReference=function(t,e){var r=this.gl,i=this.shaders[t===r.FRAGMENT_SHADER|0],a=i[e];if(a&&r.isShader(a.shader))a.count+=1;else{var s=o(r,t,e);a=i[e]=new n(d++,e,t,s,[],1,this)}return a},m.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),o=this.programs[i];return o&&this.gl.isProgram(o)||(this.programs[i]=o=a(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),o}},{"./GLError":209,"gl-format-compiler-error":215,"weakmap-shim":225}],215:[function(t,e,r){function n(t,e,r){"use strict";var n=a(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===o.FRAGMENT_SHADER?"fragment":"vertex");for(var u=i("Error compiling %s shader %s:\n",l,n),c=i("%s%s",u,t),h=t.split("\n"),f={},p=0;ps;s++)if(m=i(t[s]),"string"===m)g[g.length]=t[s];else if("array"===m){if(u=t[s],u[2])for(n=e[p],l=0;l=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}a.json.test(u[8])?g[g.length]=n:(!a.number.test(u[8])||v&&!u[3]?y="":(y=v?"+":"-",n=n.toString().replace(a.sign,"")),h=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",f=u[6]-(y+n).length,c=u[6]&&f>0?o(h,f):"",g[g.length]=u[5]?y+n+c:"0"===h?y+c+n:c+y+n)}return g.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=a.text.exec(e)))n[n.length]=r[0];else if(null!==(r=a.modulo.exec(e)))n[n.length]="%";else{if(null===(r=a.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var o=[],s=r[2],l=[];if(null===(l=a.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=a.key_access.exec(s)))o[o.length]=l[1];else{if(null===(l=a.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=l[1]}r[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],223:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":224}],224:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],225:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},"delete":function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":223}],226:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var o=n.prototype;o.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},o.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,o=i.line,a=i.dataBox,s=i.viewBox;if(o.bind(),a[0]<=n[0]&&n[0]<=a[2]&&a[1]<=n[1]&&n[1]<=a[3]){var l=s[0]+(n[0]-a[0])/(a[2]-a[0])*(s[2]-s[0]),u=s[1]+(n[1]-a[1])/(a[3]-a[1])*(s[3]-s[1]);t[0]&&o.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&o.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&o.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&o.drawLine(l,u,l,s[3],e[3],r[3])}},o.dispose=function(){this.plot.removeOverlay(this)}},{}],227:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n worldCoordinate = vec3(uv.zw, f.x);\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = beckmannSpecular_1_1(L, V, N, roughness);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = texture2D(colormap, vec2(value, value));\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,a,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},r.createPickContourShader=function(t){var e=n(t,a,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":208}],228:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],229:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;t>r;++r)e.push("out",r,"s=0.5*(inp",r,"l-inp",r,"r);");for(var n=["array"],i=["junk"],r=0;t>r;++r){n.push("array"),i.push("out"+r+"s");var o=a(t);o[r]=-1,n.push({array:0,offset:o.slice()}),o[r]=1,n.push({array:0,offset:o.slice()}),i.push("inp"+r+"l","inp"+r+"r")}return l[t]=s({args:n,pre:c,post:c,body:{body:e.join(""),args:i.map(function(t){return{name:t,lvalue:0===t.indexOf("out"),rvalue:0===t.indexOf("inp"),count:"junk"!==t|0}}),thisVars:[],localVars:[]},funcName:"fdTemplate"+t})}function i(t){function e(e){for(var r=o-e.length,n=[],i=[],s=[],l=0;o>l;++l)e.indexOf(l+1)>=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",p.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",p.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===r?a.push("dst.set(",s.join(),",",c,",0);"):a.push("zero(",h,");");break;case"wrap":var d=s.slice(),m=s.slice();e[l]<0?(d[c]="s["+c+"]-2",m[c]="0"):(d[c]="s["+c+"]-1",m[c]="1"),0===r?a.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",d.join(),")-src.get(",m.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>2){diff(",h,",src.pick(",d.join(),")",u,",src.pick(",m.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var o=t.length,a=["function gradient(dst,src){var s=src.shape.slice();"],s=0;1<s;++s){for(var c=[],p=0;o>p;++p)s&1<=s;++s)g.push("grad"+s),v.push(n(s));g.push(a.join(""));var y=Function.apply(void 0,g),i=y.apply(void 0,v);return l[r]=i,i}function o(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?a(e.dimension,r):a(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;nr;++r)for(a=a||e.surfaceProject[r],n=0;3>n;++n)s=s||e.contourProject[r][n];for(r=0;3>r;++r){var l=N.projections[r];for(n=0;16>n;++n)l[n]=0;for(n=0;4>n;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(o[r]>0)][r],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;2>i;++i)for(n=0;3>n;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=a,N.showContour=s,N}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||C,n.view=t.view||C,n.projection=t.projection||C,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=k(n.inverseModel,n.model);for(var i=0;2>i;++i)for(var o=n.clipBounds[i],s=0;3>s;++s)o[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),k(l,l),i=0;3>i;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;3>i;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;3>i;++i){var c=l[12+i];for(s=0;3>s;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=a(n,this);if(h.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;3>i;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[i],this._shader.uniforms.clipBounds=h.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(h.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var p=this._contourVAO;for(p.bind(),i=0;3>i;++i)for(f.uniforms.permutation=j[i],r.lineWidth(this.contourWidth[i]),s=0;si;++i)for(f.uniforms.model=h.projections[i],f.uniforms.clipBounds=h.clipBounds[i],s=0;3>s;++s)if(this.contourProject[i][s]){f.uniforms.permutation=j[s],r.lineWidth(this.contourWidth[s]);for(var d=0;di;++i)if(0!==this._dynamicCounts[i])for(f.uniforms.model=n.model,f.uniforms.clipBounds=n.clipBounds,f.uniforms.permutation=j[i],r.lineWidth(this.dynamicWidth[i]),f.uniforms.contourColor=this.dynamicColor[i],f.uniforms.contourTint=this.dynamicTint[i],f.uniforms.height=this.dynamicLevel[i],p.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]),s=0;3>s;++s)this.contourProject[s][i]&&(f.uniforms.model=h.projections[s],f.uniforms.clipBounds=h.clipBounds[s],p.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]));p.unbind()}}function l(t,e){var r=e.shape.slice(),n=t.shape.slice();b.assign(t.lo(1,1).hi(r[0],r[1]),e),b.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),b.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),b.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),b.assign(t.lo(n[0]-1,1).hi(1,r[1]),e.lo(r[0]-1)),t.set(0,0,e.get(0,0)),t.set(0,n[1]-1,e.get(0,r[1]-1)),t.set(n[0]-1,0,e.get(r[0]-1,0)),t.set(n[0]-1,n[1]-1,e.get(r[0]-1,r[1]-1))}function u(t,e){return Array.isArray(t)?[e(t[0]),e(t[1]),e(t[2])]:[e(t),e(t),e(t)]}function c(t){return Array.isArray(t)?3===t.length?[t[0],t[1],t[2],1]:[t[0],t[1],t[2],t[3]]:[0,0,0,1]}function h(t){if(Array.isArray(t)){if(Array.isArray(t))return[c(t[0]),c(t[1]),c(t[2])];var e=c(t);return[e.slice(),e.slice(),e.slice()]}}function f(t){var e=t.gl,r=S(e),n=z(e),i=L(e),a=I(e),s=d(e),l=m(e,[{buffer:s,size:4,stride:P,offset:0},{buffer:s,size:3,stride:P,offset:16},{buffer:s,size:3,stride:P,offset:28}]),u=d(e),c=m(e,[{buffer:u,size:4,stride:20,offset:0},{buffer:u,size:1,stride:20,offset:16}]),h=d(e),f=m(e,[{buffer:h,size:2,type:e.FLOAT}]),p=g(e,1,D,e.RGBA,e.UNSIGNED_BYTE);p.minFilter=e.LINEAR,p.magFilter=e.LINEAR;var v=new o(e,[0,0],[[0,0,0],[0,0,0]],r,n,s,l,p,i,a,u,c,h,f),y={levels:[[],[],[]]};for(var b in t)y[b]=t[b];return y.colormap=y.colormap||"jet",v.update(y),v}e.exports=f;var p=t("bit-twiddle"),d=t("gl-buffer"),m=t("gl-vao"),g=t("gl-texture2d"),v=t("typedarray-pool"),y=t("colormap"),b=t("ndarray-ops"),x=t("ndarray-pack"),_=t("ndarray"),w=t("surface-nets"),M=t("gl-mat4/multiply"),k=t("gl-mat4/invert"),A=t("binary-search-bounds"),T=t("ndarray-gradient"),E=t("./lib/shaders"),S=E.createShader,L=E.createContourShader,z=E.createPickShader,I=E.createPickContourShader,P=40,C=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],R=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],j=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];!function(){for(var t=0;3>t;++t){var e=j[t],r=(t+1)%3,n=(t+2)%3;e[r+0]=1,e[n+3]=1,e[t+6]=1}}();var D=265,O=o.prototype;O.isTransparent=function(){return this.opacity<1},O.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},O.pickSlots=1,O.setPickBase=function(t){this.pickId=t};var F=[0,0,0],N={showSurface:!1,showContour:!1,projections:[C.slice(),C.slice(),C.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:C,view:C,projection:C,inverseModel:C.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1},U=C.slice(),V=[1,0,0,0,1,0,0,0,1];O.draw=function(t){return s.call(this,t,!1)},O.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:C,view:C,projection:C,inverseModel:C,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};O.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||C,r.view=t.view||C,r.projection=t.projection||C,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;2>n;++n)for(var i=r.clipBounds[n],o=0;3>o;++o)i[o]=Math.min(Math.max(this.clipBounds[n][o],-1e8),1e8);var s=a(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;3>n;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),o=0;3>o;++o)for(e.lineWidth(this.contourWidth[o]),l.uniforms.permutation=j[o],n=0;nn;++n)for(l.uniforms.model=s.projections[n],l.uniforms.clipBounds=s.clipBounds[n],o=0;3>o;++o)if(this.contourProject[n][o]){l.uniforms.permutation=j[o],e.lineWidth(this.contourWidth[o]);for(var c=0;c>4)/16)/255,i=Math.floor(n),o=n-i,a=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(a),l=a-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;2>c;++c)for(var h=c?o:1-o,f=0;2>f;++f)for(var p=f?l:1-l,d=i+c,m=s+f,g=h*p,v=0;3>v;++v)u[v]+=this._field[v].get(d,m)*g;for(var y=this._pickResult.level,b=0;3>b;++b)if(y[b]=A.le(this.contourLevels[b],u[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]Math.abs(_-u[b])&&(y[b]+=1)}for(r.index[0]=.5>o?i:i+1,r.index[1]=.5>l?s:s+1,r.uv[0]=n/e[0],r.uv[1]=a/e[1],v=0;3>v;++v)r.dataCoordinate[v]=this._field[v].get(r.index[0],r.index[1]);return r},O.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=h(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=h(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(v.freeFloat(this._field[2].data),this._field[2].data=v.mallocFloat(p.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var o=this.shape,a=0;2>a;++a)this._field[2].size>this._field[a].data.length&&(v.freeFloat(this._field[a].data),this._field[a].data=v.mallocFloat(this._field[2].size)),this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(a=0;2>a;++a){var c=s[a];for(y=0;2>y;++y)if(c.shape[y]!==o[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[a],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(a=0;2>a;++a){var d=f[a];if((Array.isArray(d)||d.length)&&(d=_(d)),d.shape[0]!==o[a])throw new Error("gl-surface: invalid tick length");var m=_(d.data,o);m.stride[a]=d.stride[0],m.stride[1^a]=0,l(this._field[a],m)}}else{for(a=0;2>a;++a){var g=[0,0];g[a]=1,this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2],g,0)}this._field[0].set(0,0,0);for(var y=0;ya;++a)T(x.pick(a),b[a],"mirror");var M=_(v.mallocFloat(3*b[2].size),[o[0]+2,o[1]+2,3]);for(a=0;aj?(j=Math.max(Math.abs(I),Math.abs(P),Math.abs(C)),1e-8>j?(C=1,P=I=0,j=1):j=1/j):j=1/Math.sqrt(j),M.set(a,y,0,I*j),M.set(a,y,1,P*j),M.set(a,y,2,C*j)}v.free(x.data);var D=[1/0,1/0,1/0],O=[-(1/0),-(1/0),-(1/0)],F=1/0,N=-(1/0),B=(o[0]-1)*(o[1]-1)*6,U=v.mallocFloat(p.nextPow2(10*B)),V=0,q=0;for(a=0;aG;++G)for(var H=0;2>H;++H)for(var X=0;3>X;++X){var Y=this._field[X].get(1+a+G,1+y+H);if(isNaN(Y)||!isFinite(Y))continue t}for(X=0;6>X;++X){var W=a+R[X][0],Z=y+R[X][1],Q=this._field[0].get(W+1,Z+1),K=this._field[1].get(W+1,Z+1);Y=this._field[2].get(W+1,Z+1);var J=Y;I=M.get(W+1,Z+1,0),P=M.get(W+1,Z+1,1),C=M.get(W+1,Z+1,2),t.intensity&&(J=t.intensity.get(W,Z)),U[V++]=W,U[V++]=Z,U[V++]=Q,U[V++]=K,U[V++]=Y,U[V++]=0,U[V++]=J,U[V++]=I,U[V++]=P,U[V++]=C,D[0]=Math.min(D[0],Q),D[1]=Math.min(D[1],K),D[2]=Math.min(D[2],Y),F=Math.min(F,J),O[0]=Math.max(O[0],Q),O[1]=Math.max(O[1],K),O[2]=Math.max(O[2],Y),N=Math.max(N,J),q+=1}}for(t.intensityBounds&&(F=+t.intensityBounds[0],N=+t.intensityBounds[1]),a=6;V>a;a+=10)U[a]=(U[a]-F)/(N-F);this._vertexCount=q,this._coordinateBuffer.update(U.subarray(0,V)),v.freeFloat(U),v.free(M.data),this.bounds=[D,O],this.intensity=t.intensity||this._field[2],this.intensityBounds[0]===F&&this.intensityBounds[1]===N||(r=!0),this.intensityBounds=[F,N]}if("levels"in t){var $=t.levels;for($=Array.isArray($[0])?$.slice():[[],[],$],a=0;3>a;++a)$[a]=$[a].slice(),$.sort(function(t,e){return t-e});t:for(a=0;3>a;++a){if($[a].length!==this.contourLevels[a].length){r=!0;break}for(y=0;y<$[a].length;++y)if($[a][y]!==this.contourLevels[a][y]){r=!0;break t}}this.contourLevels=$}if(r){b=this._field,o=this.shape;for(var tt=[],et=0;3>et;++et){$=this.contourLevels[et];var rt=[],nt=[],it=[0,0,0];for(a=0;a<$.length;++a){var ot=w(this._field[et],$[a]);rt.push(tt.length/5|0),q=0;t:for(y=0;yX;++X){var st=ot.positions[at[X]],lt=st[0],ut=0|Math.floor(lt),ct=lt-ut,ht=st[1],ft=0|Math.floor(ht),pt=ht-ft,dt=!1;e:for(var mt=0;3>mt;++mt){it[mt]=0;var gt=(et+mt+1)%3;for(G=0;2>G;++G){var vt=G?ct:1-ct;for(W=0|Math.min(Math.max(ut+G,0),o[0]),H=0;2>H;++H){var yt=H?pt:1-pt;if(Z=0|Math.min(Math.max(ft+H,0),o[1]),Y=2>mt?this._field[gt].get(W,Z):(this.intensity.get(W,Z)-this.intensityBounds[0])/(this.intensityBounds[1]-this.intensityBounds[0]),!isFinite(Y)||isNaN(Y)){dt=!0;break e}var bt=vt*yt;it[mt]+=bt*Y}}}if(dt){if(X>0){for(var xt=0;5>xt;++xt)tt.pop();q-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),q+=1}}nt.push(q)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=v.mallocFloat(tt.length);for(a=0;at;++t)v.freeFloat(this._field[t].data)},O.highlight=function(t){if(!t)return this._dynamicCounts=[0,0,0],this.dyanamicLevel=[NaN,NaN,NaN],void(this.highlightLevel=[-1,-1,-1]);for(var e=0;3>e;++e)this.enableHighlight[e]?this.highlightLevel[e]=t.level[e]:this.highlightLevel[e]=-1;var r;if(r=this.snapToData?t.dataCoordinate:t.position,this.enableDynamic[0]&&r[0]!==this.dynamicLevel[0]||this.enableDynamic[1]&&r[1]!==this.dynamicLevel[1]||this.enableDynamic[2]&&r[2]!==this.dynamicLevel[2]){for(var n=0,i=this.shape,o=v.mallocFloat(12*i[0]*i[1]),a=0;3>a;++a)if(this.enableDynamic[a]){this.dynamicLevel[a]=r[a];var s=(a+1)%3,l=(a+2)%3,u=this._field[a],c=this._field[s],h=this._field[l],f=(this.intensity,w(u,r[a])),p=f.cells,d=f.positions;for(this._dynamicOffsets[a]=n,e=0;eg;++g){var y=d[m[g]],b=+y[0],x=0|b,_=0|Math.min(x+1,i[0]),M=b-x,k=1-M,A=+y[1],T=0|A,E=0|Math.min(T+1,i[1]),S=A-T,L=1-S,z=k*L,I=k*S,P=M*L,C=M*S,R=z*c.get(x,T)+I*c.get(x,E)+P*c.get(_,T)+C*c.get(_,E),j=z*h.get(x,T)+I*h.get(x,E)+P*h.get(_,T)+C*h.get(_,E);if(isNaN(R)||isNaN(j)){g&&(n-=1);break}o[2*n+0]=R,o[2*n+1]=j,n+=1}this._dynamicCounts[a]=n-this._dynamicOffsets[a]}else this.dynamicLevel[a]=NaN,this._dynamicCounts[a]=0;this._dynamicBuffer.update(o.subarray(0,2*n)),v.freeFloat(o)}}},{"./lib/shaders":227,"binary-search-bounds":228,"bit-twiddle":51,colormap:111,"gl-buffer":129,"gl-mat4/invert":148,"gl-mat4/multiply":150,"gl-texture2d":233,"gl-vao":237,ndarray:456,"ndarray-gradient":229,"ndarray-ops":455,"ndarray-pack":230,"surface-nets":475,"typedarray-pool":481}],233:[function(t,e,r){"use strict";function n(t){g=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],v=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(0>e||e>i||0>r||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function o(t,e,r,n,i,o){this.gl=t,this.handle=e,this.format=i,this.type=o,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var a=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return a._wrapS},set:function(t){return a.wrapS=t}},{get:function(){return a._wrapT},set:function(t){return a.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return a._shape[0]},set:function(t){return a.width=t}},{get:function(){return a._shape[1]},set:function(t){return a.height=t}}]),this._shapeVector=l}function a(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,o,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var h=0,f=0,g=a(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,g=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,g=!1,u="uint8");var v=1;if(2===c.length)f=t.LUMINANCE,c=[c[0],c[1],1],l=p(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])f=t.ALPHA;else if(2===c[2])f=t.LUMINANCE_ALPHA;else if(3===c[2])f=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}v=c[2]}if(f!==t.LUMINANCE&&f!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(f=i),f!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),h===o&&g)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data.subarray(l.offset,l.offset+y));else{var _;_=o===t.FLOAT?m.mallocFloat32(y):m.mallocUint8(y);var w=p(_,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&o===t.UNSIGNED_BYTE?b(w,l):d.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,_.subarray(0,y)),o===t.FLOAT?m.freeFloat32(_):m.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(0>e||e>a||0>r||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=a(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=p(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var h,f,g=e.size;if(s)h=0===e.offset&&e.data.length===g?e.data:e.data.subarray(e.offset,e.offset+g);else{var v=[n[2],n[2]*n[0],1];f=m.malloc(g,r);var y=p(f,n,v,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?d.assign(y,e):b(y,e),h=f.subarray(0,g)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,h),s||m.free(f),new o(t,x,n[0],n[1],c,u)}function f(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(g||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),d=t("ndarray-ops"),m=t("typedarray-pool");e.exports=f;var g=null,v=null,y=null,b=function(t,e){d.muls(t,e,255)},x=o.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&g.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),v.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&&g.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),v.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;2>e;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||0>e||0>r)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:456,"ndarray-ops":455,"typedarray-pool":481}],234:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;ii;++i)t.disableVertexAttribArray(i)}else{t.bindBuffer(t.ARRAY_BUFFER,null);for(var i=0;n>i;++i)t.disableVertexAttribArray(i)}}e.exports=n},{}],235:[function(t,e,r){"use strict";function n(t){this.gl=t,this._elements=null,this._attributes=null,this._elementsType=t.UNSIGNED_SHORT}function i(t){return new n(t)}var o=t("./do-bind.js");n.prototype.bind=function(){o(this.gl,this._elements,this._attributes)},n.prototype.update=function(t,e,r){this._elements=e,this._attributes=t,this._elementsType=r||this.gl.UNSIGNED_SHORT},n.prototype.dispose=function(){},n.prototype.unbind=function(){},n.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._elements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=i},{"./do-bind.js":234}],236:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.location=t,this.dimension=e,this.a=r,this.b=n,this.c=i,this.d=o}function i(t,e,r){this.gl=t,this._ext=e,this.handle=r,this._attribs=[],this._useElements=!1,this._elementsType=t.UNSIGNED_SHORT}function o(t,e){return new i(t,e,e.createVertexArrayOES())}var a=t("./do-bind.js");n.prototype.bind=function(t){switch(this.dimension){case 1:t.vertexAttrib1f(this.location,this.a);break;case 2:t.vertexAttrib2f(this.location,this.a,this.b);break;case 3:t.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:t.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d)}},i.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var t=0;tF;){switch(e=F,B){case h:F=S();break;case f:F=E();break;case p:F=T();break;case d:F=L();break;case m:F=P();break;case w:F=I();break;case g:F=C();break;case c:F=R();break;case x:F=A();break;case u:F=k()}if(e!==F)switch(W[e]){case"\n":G=0,++q;break;default:++G}}return N+=F,W=W.slice(F),V}function n(t){return U.length&&e(U.join("")),B=_,e("(eof)"),V}function k(){return U=U.length?[]:U,"/"===D&&"*"===j?(H=N+F-1,B=h,D=j,F+1):"/"===D&&"/"===j?(H=N+F-1,B=f,D=j,F+1):"#"===j?(B=p,H=N+F,F):/\s/.test(j)?(B=x,H=N+F,F):(X=/\d/.test(j),Y=/[^\w_]/.test(j),H=N+F,B=X?m:Y?d:c,F)}function A(){return/[^\s]/g.test(j)?(e(U.join("")), +B=u,F):(U.push(j),D=j,F+1)}function T(){return"\n"===j&&"\\"!==D?(e(U.join("")),B=u,F):(U.push(j),D=j,F+1)}function E(){return T()}function S(){return"/"===j&&"*"===D?(U.push(j),e(U.join("")),B=u,F+1):(U.push(j),D=j,F+1)}function L(){if("."===D&&/\d/.test(j))return B=g,F;if("/"===D&&"*"===j)return B=h,F;if("/"===D&&"/"===j)return B=f,F;if("."===j&&U.length){for(;z(U););return B=g,F}if(";"===j||")"===j||"("===j){if(U.length)for(;z(U););return e(j),B=u,F+1}var t=2===U.length&&"="!==j;if(/[\w_\d\s]/.test(j)||t){for(;z(U););return B=u,F}return U.push(j),D=j,F+1}function z(t){for(var r,n,i=0;;){if(r=o.indexOf(t.slice(0,t.length+i).join("")),n=o[r],-1===r){if(i--+t.length>0)continue;n=t.slice(0,1).join("")}return e(n),H+=n.length,U=U.slice(n.length),U.length}}function I(){return/[^a-fA-F0-9]/.test(j)?(e(U.join("")),B=u,F):(U.push(j),D=j,F+1)}function P(){return"."===j?(U.push(j),B=g,D=j,F+1):/[eE]/.test(j)?(U.push(j),B=g,D=j,F+1):"x"===j&&1===U.length&&"0"===U[0]?(B=w,U.push(j),D=j,F+1):/[^\d]/.test(j)?(e(U.join("")),B=u,F):(U.push(j),D=j,F+1)}function C(){return"f"===j&&(U.push(j),D=j,F+=1),/[eE]/.test(j)?(U.push(j),D=j,F+1):"-"===j&&/[eE]/.test(D)?(U.push(j),D=j,F+1):/[^\d]/.test(j)?(e(U.join("")),B=u,F):(U.push(j),D=j,F+1)}function R(){if(/[^\d\w_]/.test(j)){var t=U.join("");return B=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:v,e(U.join("")),B=u,F}return U.push(j),D=j,F+1}var j,D,O,F=0,N=0,B=u,U=[],V=[],q=1,G=0,H=0,X=!1,Y=!1,W="";t=t||{};var Z=a,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t):n()}}e.exports=n;var i=t("./lib/literals"),o=t("./lib/operators"),a=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,h=0,f=1,p=2,d=3,m=4,g=5,v=6,y=7,b=8,x=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":241,"./lib/builtins-300es":240,"./lib/literals":243,"./lib/literals-300es":242,"./lib/operators":244}],240:[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":241}],241:[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"]},{}],242:[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","uint","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":243}],243:[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","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"]},{}],244:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],245:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":239}],246:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function o(t,e){return c(t.vertices,e.vertices)}function a(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;t>=r;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(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 n=0;t>=n;++n)this.tuple[n]=this.vertices[n];var i=h[t];i||(i=h[t]=a(t)),this.orient=i}function l(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(i>=r)throw new Error("Must input at least d+1 points");var o=t.slice(0,i+1),a=u.apply(void 0,o);if(0===a)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;i>=c;++c)l[c]=c;0>a&&(l[0]=1,l[1]=0);for(var h=new n(l,new Array(i+1),!1),f=h.adjacent,p=new Array(i+2),c=0;i>=c;++c){for(var d=l.slice(),m=0;i>=m;++m)m===c&&(d[m]=-1);var g=d[0];d[0]=d[1],d[1]=g;var v=new n(d,new Array(i+1),!0);f[c]=v,p[c]=v}p[i+1]=h;for(var c=0;i>=c;++c)for(var d=f[c].vertices,y=f[c].adjacent,m=0;i>=m;++m){var b=d[m];if(0>b)y[m]=h;else for(var x=0;i>=x;++x)f[x].vertices.indexOf(b)<0&&(y[m]=f[x])}for(var _=new s(i,o,p),w=!!e,c=i+1;r>c;++c)_.insert(t[c],w);return _.boundary()}e.exports=l;var u=t("robust-orientation"),c=t("simplicial-complex").compareCells;n.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 h=[],f=s.prototype;f.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,o=this.vertices,a=[t];for(t.lastVisited=-n;a.length>0;){t=a.pop();for(var s=(t.vertices,t.adjacent),l=0;r>=l;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,h=0;r>=h;++h){var f=c[h];0>f?i[h]=e:i[h]=o[f]}var p=this.orient();if(p>0)return u;u.lastVisited=-n,0===p&&a.push(u)}}}return null},f.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,o=this.tuple,a=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[a];t:for(;!s.boundary;){for(var l=s.vertices,u=s.adjacent,c=0;n>=c;++c)o[c]=i[l[c]];s.lastVisited=r;for(var c=0;n>=c;++c){var h=u[c];if(!(h.lastVisited>=r)){var f=o[c];o[c]=t;var p=this.orient();if(o[c]=f,0>p){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},f.addPeaks=function(t,e){var r=this.vertices.length-1,a=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var f=[];h.length>0;){var e=h.pop(),p=e.vertices,d=e.adjacent,m=p.indexOf(r);if(!(0>m))for(var g=0;a>=g;++g)if(g!==m){var v=d[g];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var b=0,x=0;a>=x;++x)y[x]<0?(b=x,l[x]=t):l[x]=s[y[x]];var _=this.orient();if(_>0){y[b]=r,v.boundary=!1,u.push(v),h.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var w=v.adjacent,M=p.slice(),k=d.slice(),A=new n(M,k,!0);c.push(A);var T=w.indexOf(e);if(!(0>T)){w[T]=A,k[m]=v,M[g]=-1,k[g]=e,d[g]=A,A.flip();for(var x=0;a>=x;++x){var E=M[x];if(!(0>E||E===r)){for(var S=new Array(a-1),L=0,z=0;a>=z;++z){var I=M[z];0>I||z===x||(S[L++]=I)}f.push(new i(S,A,x))}}}}}}f.sort(o);for(var g=0;g+1R||0>j||(P.cell.adjacent[P.index]=C.cell,C.cell.adjacent[C.index]=P.cell)}},f.insert=function(t,e){var r=this.vertices;r.push(t);var n=this.walk(t,e);if(n){for(var i=this.dimension,o=this.tuple,a=0;i>=a;++a){var s=n.vertices[a];0>s?o[a]=t:o[a]=r[s]}var l=this.orient(o);0>l||(0!==l||(n=this.handleBoundaryDegeneracy(n,t)))&&this.addPeaks(t,n)}},f.boundary=function(){for(var t=this.dimension,e=[],r=this.simplices,n=r.length,i=0;n>i;++i){var o=r[i];if(o.boundary){for(var a=new Array(t),s=o.vertices,l=0,u=0,c=0;t>=c;++c)s[c]>=0?a[l++]=s[c]:u=1&c;if(u===(1&t)){var h=a[0];a[0]=a[1],a[1]=h}e.push(a)}}return e}},{"robust-orientation":462,"simplicial-complex":249}],247:[function(t,e,r){arguments[4][51][0].apply(r,arguments)},{dup:51}],248:[function(t,e,r){arguments[4][108][0].apply(r,arguments)},{dup:108}],249:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;i>n;++n)e=r(e,t[n].length);return e-1}function i(t){for(var e=-1,r=Math.max,n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)e=r(e,o[a]);return e+1}function o(t){for(var e=new Array(t.length),r=0,n=t.length;n>r;++r)e[r]=t[r].slice(0);return e}function a(t,e){var r=t.length,n=t.length-e.length,i=Math.min;if(n)return n;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:var o=t[0]+t[1]-e[0]-e[1];return o?o:i(t[0],t[1])-i(e[0],e[1]);case 3:var a=t[0]+t[1],s=e[0]+e[1];if(o=a+t[2]-(s+e[2]))return o;var l=i(t[0],t[1]),u=i(e[0],e[1]),o=i(l,t[2])-i(u,e[2]);return o?o:i(l+t[2],a)-i(u+e[2],s);default:var c=t.slice(0);c.sort();var h=e.slice(0);h.sort();for(var f=0;r>f;++f)if(n=c[f]-h[f])return n;return 0}}function s(t,e){return a(t[0],e[0])}function l(t,e){if(e){for(var r=t.length,n=new Array(r),i=0;r>i;++i)n[i]=[t[i],e[i]];n.sort(s);for(var i=0;r>i;++i)t[i]=n[i][0],e[i]=n[i][1];return t}return t.sort(a),t}function u(t){if(0===t.length)return[];for(var e=1,r=t.length,n=1;r>n;++n){var i=t[n];if(a(i,t[n-1])){if(n===e){e++;continue}t[e++]=i}}return t.length=e,t}function c(t,e){for(var r=0,n=t.length-1,i=-1;n>=r;){var o=r+n>>1,s=a(t[o],e);0>=s?(0===s&&(i=o),r=o+1):s>0&&(n=o-1)}return i}function h(t,e){for(var r=new Array(t.length),n=0,i=r.length;i>n;++n)r[n]=[];for(var o=[],n=0,s=e.length;s>n;++n)for(var l=e[n],u=l.length,h=1,f=1<h;++h){o.length=b.popCount(h);for(var p=0,d=0;u>d;++d)h&1<m))for(;;)if(r[m++].push(n),m>=t.length||0!==a(t[m],o))break}return r}function f(t,e){if(!e)return h(u(d(t,0)),t,0);for(var r=new Array(e),n=0;e>n;++n)r[n]=[];for(var n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)r[o[a]].push(n);return r}function p(t){for(var e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0|i.length,a=1,s=1<a;++a){for(var u=[],c=0;o>c;++c)a>>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function d(t,e){if(0>e)return[];for(var r=[],n=(1<r;++r)for(var i=t[r],o=0,a=i.length;a>o;++o){for(var s=new Array(i.length-1),u=0,c=0;a>u;++u)u!==o&&(s[c++]=i[u]);e.push(s)}return l(e)}function g(t,e){for(var r=new x(e),n=0;nr;++r)e[r]=r;return e}e.exports=n},{}],251:[function(t,e,r){e.exports=function(t){return!(null==t||!(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)))}},{}],252:[function(t,e,r){"use strict";function n(t){var e=t.layoutVertexArrayType;this.layoutVertexArray=new e;var r=t.elementArrayType;r&&(this.elementArray=new r);var n=t.elementArrayType2;n&&(this.elementArray2=new n),this.paintVertexArrays=i.mapObject(t.paintVertexArrayTypes,function(t){return new t})}var i=t("../util/util");e.exports=n,n.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,n.prototype.hasCapacityFor=function(t){return this.layoutVertexArray.length+t<=n.MAX_VERTEX_ARRAY_LENGTH},n.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},n.prototype.trim=function(){this.layoutVertexArray.trim(),this.elementArray&&this.elementArray.trim(),this.elementArray2&&this.elementArray2.trim();for(var t in this.paintVertexArrays)this.paintVertexArrays[t].trim()},n.prototype.serialize=function(){return{layoutVertexArray:this.layoutVertexArray.serialize(),elementArray:this.elementArray&&this.elementArray.serialize(),elementArray2:this.elementArray2&&this.elementArray2.serialize(),paintVertexArrays:i.mapObject(this.paintVertexArrays,function(t){return t.serialize()})}},n.prototype.getTransferables=function(t){t.push(this.layoutVertexArray.arrayBuffer),this.elementArray&&t.push(this.elementArray.arrayBuffer),this.elementArray2&&t.push(this.elementArray2.arrayBuffer);for(var e in this.paintVertexArrays)t.push(this.paintVertexArrays[e].arrayBuffer)}},{"../util/util":366}],253:[function(t,e,r){"use strict";function n(t){if(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layer=t.layer,this.childLayers=t.childLayers,this.type=this.layer.type,this.features=[],this.id=this.layer.id,this.index=t.index,this.sourceLayer=this.layer.sourceLayer,this.sourceLayerIndex=t.sourceLayerIndex,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,this.paintAttributes=i(this),t.arrays){var e=this.programInterfaces;this.bufferGroups=c.mapObject(t.arrays,function(r,n){var i=e[n],o=t.paintVertexArrayTypes[n];return r.map(function(t){return new u(t,{layoutVertexArrayType:i.layoutVertexArrayType.serialize(),elementArrayType:i.elementArrayType&&i.elementArrayType.serialize(),elementArrayType2:i.elementArrayType2&&i.elementArrayType2.serialize(),paintVertexArrayTypes:o})})})}}function i(t){var e={};for(var r in t.programInterfaces){for(var n=e[r]={},i=0;iT;T++)A.push(w[Math.min(k+T,w.length-1)]);m=["varying",u,h,b].join(" ")+";\n",v.vertexPragmas.define[b]=m+["uniform","lowp","float",_].join(" ")+";\n",v.fragmentPragmas.define[b]=m,v.uniforms.push(c.extend({},p,{name:_,getValue:a(p,k),components:1}));var E=p.components;if(1===E)v.attributes.push(c.extend({},p,{getValue:o(p,A),isFunction:!0,components:4*E})),v.vertexPragmas.define[b]+=["attribute",u,"vec4",y].join(" ")+";\n",v.vertexPragmas.initialize[b]=[b,"=","evaluate_zoom_function_1("+y+", "+_+")","/",p.multiplier.toFixed(1)].join(" ")+";\n";else{for(var S=[],L=0;4>L;L++)S.push(y+L),v.attributes.push(c.extend({},p,{getValue:o(p,[A[L]]),isFunction:!0,name:y+L})),v.vertexPragmas.define[b]+=["attribute",u,h,y+L].join(" ")+";\n";v.vertexPragmas.initialize[b]=[b," = ","evaluate_zoom_function_4("+S.join(", ")+", "+_+")","/",p.multiplier.toFixed(1)].join(" ")+";\n"}}}}}return e}function o(t,e){return function(r,n,i){if(1===e.length)return t.getValue(r,c.extend({},n,{zoom:e[0]}),i);for(var o=[],a=0;ab;b++)for(var x=h.get(b),_=0;v>_;_++){var w=v>1?d.name+_:d.name;x[w]=m[_]*g}}},n.VertexArrayType=function(t){return new h({members:t,alignment:4})},n.ElementArrayType=function(t){return new h({members:[{type:"Uint16",name:"vertices",components:t||3}]})}},{"../util/struct_array":364,"../util/util":366,"./array_group":252,"./bucket/circle_bucket":254,"./bucket/fill_bucket":255,"./bucket/line_bucket":256,"./bucket/symbol_bucket":257,"./buffer_group":259,"feature-filter":370}],254:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),o=t("../../util/util"),a=t("../load_geometry"),s=i.EXTENT;e.exports=n,n.prototype=o.inherit(i,{}),n.prototype.addCircleVertex=function(t,e,r,n,i){return t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)},n.prototype.programInterfaces={circle:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType,paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("circle-color",e,r)},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-radius",e,r)]},multiplier:10,paintProperty:"circle-radius"},{name:"a_blur",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-blur",e,r)]},multiplier:10,paintProperty:"circle-blur"},{name:"a_opacity",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-opacity",e,r)]},multiplier:255,paintProperty:"circle-opacity"}]}},n.prototype.addFeature=function(t){for(var e={zoom:this.zoom},r=a(t),n=this.prepareArrayGroup("circle",0),i=n.layoutVertexArray.length,o=0;ou||u>=s||0>c||c>=s)){var h=this.prepareArrayGroup("circle",4),f=h.layoutVertexArray,p=this.addCircleVertex(f,u,c,-1,-1);this.addCircleVertex(f,u,c,1,-1),this.addCircleVertex(f,u,c,1,1),this.addCircleVertex(f,u,c,-1,1),h.elementArray.emplaceBack(p,p+1,p+2),h.elementArray.emplaceBack(p,p+3,p+2)}}this.populatePaintArrays("circle",e,t.properties,n,i)}},{"../../util/util":366,"../bucket":253,"../load_geometry":261}],255:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),o=t("../../util/util"),a=t("../load_geometry"),s=t("earcut"),l=t("../../util/classify_rings"),u=500;e.exports=n,n.prototype=o.inherit(i,{}),n.prototype.programInterfaces={fill:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType(1),elementArrayType2:new i.ElementArrayType(2),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-color",e,r)},multiplier:255,paintProperty:"fill-color"},{name:"a_outline_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-outline-color",e,r)},multiplier:255,paintProperty:"fill-outline-color"},{name:"a_opacity",components:1,type:"Uint8",getValue:function(t,e,r){return[t.getPaintValue("fill-opacity",e,r)]},multiplier:255,paintProperty:"fill-opacity"}]}},n.prototype.addFeature=function(t){for(var e=a(t),r=l(e,u),n=this.prepareArrayGroup("fill",0),i=n.layoutVertexArray.length,o=0;o0&&o.push(i.length/2);for(var c=0;c=1&&n.elementArray2.emplaceBack(f-1,f),i.push(h.x),i.push(h.y)}}for(var p=s(i,o),d=0;do?-1:1)+1|(a*f&63)<<2,a*f>>6)},n.prototype.programInterfaces={line:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),elementArrayType:new i.ElementArrayType}},n.prototype.addFeature=function(t){for(var e=a(t,h),r=0;r2&&t[o-1].equals(t[o-2]);)o--;if(!(t.length<2)){"bevel"===e&&(n=1.05);var a=c*(s/(512*this.overscaling)),l=t[0],h=t[o-1],f=l.equals(h);if(this.prepareArrayGroup("line",10*o),2!==o||!f){this.distance=0;var p,d,m,g,v,y,b,x=r,_=f?"butt":r,w=!0;this.e1=this.e2=this.e3=-1,f&&(p=t[o-2],v=l.sub(p)._unit()._perp());for(var M=0;o>M;M++)if(m=f&&M===o-1?t[1]:t[M+1],!m||!t[M].equals(m)){v&&(g=v),p&&(d=p),p=t[M],v=m?m.sub(p)._unit()._perp():g,g=g||v;var k=g.add(v)._unit(),A=k.x*v.x+k.y*v.y,T=1/A,E=u>A&&d&&m;if(E&&M>0){var S=p.dist(d);if(S>2*a){var L=p.sub(p.sub(d)._mult(a/S)._round());this.distance+=L.dist(d),this.addCurrentVertex(L,this.distance,g.mult(1),0,0,!1),d=L}}var z=d&&m,I=z?e:m?x:_;if(z&&"round"===I&&(i>T?I="miter":2>=T&&(I="fakeround")),"miter"===I&&T>n&&(I="bevel"),"bevel"===I&&(T>2&&(I="flipbevel"),n>T&&(I="miter")),d&&(this.distance+=p.dist(d)),"miter"===I)k._mult(T),this.addCurrentVertex(p,this.distance,k,0,0,!1);else if("flipbevel"===I){if(T>100)k=v.clone();else{var P=g.x*v.y-g.y*v.x>0?-1:1,C=T*g.add(v).mag()/g.sub(v).mag();k._perp()._mult(C*P)}this.addCurrentVertex(p,this.distance,k,0,0,!1),this.addCurrentVertex(p,this.distance,k.mult(-1),0,0,!1)}else if("bevel"===I||"fakeround"===I){var R=g.x*v.y-g.y*v.x>0,j=-Math.sqrt(T*T-1);if(R?(b=0,y=j):(y=0,b=j),w||this.addCurrentVertex(p,this.distance,g,y,b,!1),"fakeround"===I){for(var D,O=Math.floor(8*(.5-(A-.5))),F=0;O>F;F++)D=v.mult((F+1)/(O+1))._add(g)._unit(),this.addPieSliceVertex(p,this.distance,D,R);this.addPieSliceVertex(p,this.distance,k,R);for(var N=O-1;N>=0;N--)D=g.mult((N+1)/(O+1))._add(v)._unit(),this.addPieSliceVertex(p,this.distance,D,R)}m&&this.addCurrentVertex(p,this.distance,v,-y,-b,!1)}else"butt"===I?(w||this.addCurrentVertex(p,this.distance,g,0,0,!1),m&&this.addCurrentVertex(p,this.distance,v,0,0,!1)):"square"===I?(w||(this.addCurrentVertex(p,this.distance,g,1,1,!1),this.e1=this.e2=-1),m&&this.addCurrentVertex(p,this.distance,v,-1,-1,!1)):"round"===I&&(w||(this.addCurrentVertex(p,this.distance,g,0,0,!1),this.addCurrentVertex(p,this.distance,g,1,1,!0),this.e1=this.e2=-1),m&&(this.addCurrentVertex(p,this.distance,v,-1,-1,!0),this.addCurrentVertex(p,this.distance,v,0,0,!1)));if(E&&o-1>M){var B=p.dist(m);if(B>2*a){var U=p.add(m.sub(p)._mult(a/B)._round());this.distance+=U.dist(p),this.addCurrentVertex(U,this.distance,v.mult(1),0,0,!1),p=U}}w=!1}}}},n.prototype.addCurrentVertex=function(t,e,r,n,i,o){var a,s=o?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1],u=l.layoutVertexArray,c=l.elementArray;a=r.clone(),n&&a._sub(r.perp()._mult(n)),this.e3=this.addLineVertex(u,t,a,s,0,n,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,a=r.mult(-1),i&&a._sub(r.perp()._mult(i)),this.e3=this.addLineVertex(u,t,a,s,1,-i,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>p/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,o))},n.prototype.addPieSliceVertex=function(t,e,r,n){var i=n?1:0;r=r.mult(n?-1:1);var o=this.arrayGroups.line[this.arrayGroups.line.length-1],a=o.layoutVertexArray,s=o.elementArray; +this.e3=this.addLineVertex(a,t,r,0,i,0,e),this.e1>=0&&this.e2>=0&&s.emplaceBack(this.e1,this.e2,this.e3),n?this.e2=this.e3:this.e1=this.e3}},{"../../util/util":366,"../bucket":253,"../load_geometry":261}],257:[function(t,e,r){"use strict";function n(t){a.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.symbolQuadsArray=t.symbolQuadsArray,this.symbolInstancesArray=t.symbolInstancesArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,r,n,i,o,a,s,l,u,c){return t.emplaceBack(e,r,Math.round(64*n),Math.round(64*i),o/4,a/4,10*(u||0),c,10*(s||0),10*Math.min(l||25,25))}var o=t("point-geometry"),a=t("../bucket"),s=t("../../symbol/anchor"),l=t("../../symbol/get_anchors"),u=t("../../util/token"),c=t("../../symbol/quads"),h=t("../../symbol/shaping"),f=t("../../symbol/resolve_text"),p=t("../../symbol/mergelines"),d=t("../../symbol/clip_line"),m=t("../../util/util"),g=t("../load_geometry"),v=t("../../symbol/collision_feature"),y=h.shapeText,b=h.shapeIcon,x=c.getGlyphQuads,_=c.getIconQuads,w=a.EXTENT;e.exports=n,n.prototype=m.inherit(a,{}),n.prototype.serialize=function(){var t=a.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var M=new a.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_texture_pos",components:2,type:"Uint16"},{name:"a_data",components:4,type:"Uint8"}]),k=new a.ElementArrayType;n.prototype.addCollisionBoxVertex=function(t,e,r,n,i){return t.emplaceBack(e.x,e.y,Math.round(r.x),Math.round(r.y),10*n,10*i)},n.prototype.programInterfaces={glyph:{layoutVertexArrayType:M,elementArrayType:k},icon:{layoutVertexArrayType:M,elementArrayType:k},collisionBox:{layoutVertexArrayType:new a.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}])}},n.prototype.populateArrays=function(t,e,r){var n={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:n}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:n}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:n}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:n});var i=512*this.overscaling;this.tilePixelRatio=w/i,this.compareText={},this.iconsNeedLinear=!1,this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var o=this.layer.layout,a=this.features,s=this.textFeatures,l=.5,c=.5;switch(o["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(o["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":c=1;break;case"top":case"top-right":case"top-left":c=0}for(var h="right"===o["text-justify"]?1:"left"===o["text-justify"]?0:.5,f=24,d=o["text-line-height"]*f,v="line"!==o["symbol-placement"]?o["text-max-width"]*f:0,x=o["text-letter-spacing"]*f,_=[o["text-offset"][0]*f,o["text-offset"][1]*f],M=this.fontstack=o["text-font"].join(","),k=[],A=0;AS;S++){var z=T[S];if(!(e&&M&&this.anchorIsTooClose(e.text,k,z))){var I=!(z.x<0||z.x>w||z.y<0||z.y>w);if(!m||I){var P=I||_;this.addSymbolInstance(z,E,e,r,this.layer,P,this.symbolInstancesArray.length,this.collisionBoxArray,n.index,this.sourceLayerIndex,this.index,c,g,b,f,v,x,{zoom:this.zoom},n.properties)}}}}},n.prototype.anchorIsTooClose=function(t,e,r){var n=this.compareText;if(t in n){for(var i=n[t],o=i.length-1;o>=0;o--)if(r.dist(i[o])=b&&this.addSymbols("glyph",f.glyphQuadStartIndex,f.glyphQuadEndIndex,b,r["text-keep-upright"],i,t.angle)),g&&(t.insertCollisionFeature(d,x,r["icon-ignore-placement"]),n>=x&&this.addSymbols("icon",f.iconQuadStartIndex,f.iconQuadEndIndex,x,r["icon-keep-upright"],o,t.angle))}e&&this.addToDebugBuffers(t)},n.prototype.addSymbols=function(t,e,r,n,o,a,s){for(var l=this.prepareArrayGroup(t,4*(r-e)),u=l.elementArray,c=l.layoutVertexArray,h=this.zoom,f=Math.max(Math.log(n)/Math.LN2+h,0),p=e;r>p;p++){var d=this.symbolQuadsArray.get(p).SymbolQuad,m=(d.anchorAngle+s+Math.PI)%(2*Math.PI);if(!(o&&a&&(m<=Math.PI/2||m>3*Math.PI/2))){var g=d.tl,v=d.tr,y=d.bl,b=d.br,x=d.tex,_=d.anchorPoint,w=Math.max(h+Math.log(d.minScale)/Math.LN2,f),M=Math.min(h+Math.log(d.maxScale)/Math.LN2,25);if(!(w>=M)){w===f&&(w=0);var k=Math.round(d.glyphAngle/(2*Math.PI)*256),A=i(c,_.x,_.y,g.x,g.y,x.x,x.y,w,M,f,k);i(c,_.x,_.y,v.x,v.y,x.x+x.w,x.y,w,M,f,k),i(c,_.x,_.y,y.x,y.y,x.x,x.y+x.h,w,M,f,k),i(c,_.x,_.y,b.x,b.y,x.x+x.w,x.y+x.h,w,M,f,k),u.emplaceBack(A,A+1,A+2),u.emplaceBack(A+1,A+2,A+3)}}}},n.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var r=0;rl;l++){var u=s[0===l?"textCollisionFeature":"iconCollisionFeature"];if(u)for(var c=u.boxStartIndex;c0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,r,n,i){if(!e[0]&&!e[1])return t;e=u.convert(e),"viewport"===r&&e._rotate(-n);for(var o=[],a=0;ar.max||h.yr.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return s}},{"../util/util":366,"./bucket":253}],262:[function(t,e,r){"use strict";function n(t,e,r){this.column=t,this.row=e,this.zoom=r}e.exports=n,n.prototype={clone:function(){return new n(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],263:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}e.exports=n;var i=t("../util/util").wrap;n.prototype.wrap=function(){return new n(i(this.lng,-180,180),this.lat)},n.prototype.toArray=function(){return[this.lng,this.lat]},n.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{"../util/util":366}],264:[function(t,e,r){"use strict";function n(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=n;var i=t("./lng_lat");n.prototype={extend:function(t){var e,r,o=this._sw,a=this._ne;if(t instanceof i)e=t,r=t;else{if(!(t instanceof n))return t?this.extend(i.convert(t)||n.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return o||a?(o.lng=Math.min(e.lng,o.lng),o.lat=Math.min(e.lat,o.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new i(e.lng,e.lat),this._ne=new i(r.lng,r.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},n.convert=function(t){return!t||t instanceof n?t:new n(t)}},{"./lng_lat":263}],265:[function(t,e,r){"use strict";function n(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),o=t("point-geometry"),a=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),u=t("../source/tile_coord"),c=t("../data/bucket").EXTENT,h=t("gl-matrix"),f=h.vec4,p=h.mat4,d=h.mat2;e.exports=n,n.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new o(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=d.create(),d.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcMatrices())},get zoom(){return this._zoom},set zoom(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._calcMatrices(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcMatrices(),this._constrain())},coveringZoomLevel:function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},coveringTiles:function(t){var e=this.coveringZoomLevel(t),r=e;if(et.maxzoom&&(e=t.maxzoom);var n=this,i=n.locationCoordinate(n.center)._zoomTo(e),a=new o(i.column-.5,i.row-.5);return u.cover(e,[n.pointCoordinate(new o(0,0))._zoomTo(e),n.pointCoordinate(new o(n.width,0))._zoomTo(e),n.pointCoordinate(new o(n.width,n.height))._zoomTo(e),n.pointCoordinate(new o(0,n.height))._zoomTo(e)],t.reparseOverscaled?r:e).sort(function(t,e){return a.dist(t)-a.dist(e)})},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcMatrices(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new o(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new o(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var r=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-r)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var r=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var r=this.locationCoordinate(t),n=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),o=n._sub(r);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(o))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,r=i.convert(t);return new a(this.lngX(r.lng)*e,this.latY(r.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=0,r=[t.x,t.y,0,1],n=[t.x,t.y,1,1];f.transformMat4(r,r,this.pixelMatrixInverse),f.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],o=n[3],s=r[0]/i,u=n[0]/o,c=r[1]/i,h=n[1]/o,p=r[2]/i,d=n[2]/o,m=p===d?0:(e-p)/(d-p),g=this.worldSize/this.zoomScale(this.tileZoom);return new a(l(s,u,m)/g,l(c,h,m)/g,this.tileZoom)},coordinatePoint:function(t){var e=this.worldSize/this.zoomScale(t.zoom),r=[t.column*e,t.row*e,0,1];return f.transformMat4(r,r,this.pixelMatrix),new o(r[0]/r[3],r[1]/r[3])},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof u&&(t=t.toCoordinate(e));var r=Math.min(t.zoom,e),n=this.worldSize/Math.pow(2,r),i=new Float64Array(16);return p.identity(i),p.translate(i,i,[t.column*n,t.row*n,0]),p.scale(i,i,[n/c,n/c,1]),p.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,r,n,i,a,s,l,u=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),e=this.latY(this.latRange[0]),i=e-tf-p&&(l=t+p),f+p>e&&(l=e-p)}if(this.lngRange){var d=this.x,m=u.x/2;r>d-m&&(s=r+m),d+m>n&&(s=n-m)}void 0===s&&void 0===l||(this.center=this.unproject(new o(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=c,this._constraining=!1}},_calcMatrices:function(){if(this.height){var t=Math.atan(.5/this.altitude),e=Math.sin(t)*this.altitude/Math.sin(Math.PI/2-this._pitch-t),r=Math.cos(Math.PI/2-this._pitch)*e+this.altitude,n=new Float64Array(16);if(p.perspective(n,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,r),p.translate(n,n,[0,0,-this.altitude]),p.scale(n,n,[1,-1,1/this.height]),p.rotateX(n,n,this._pitch),p.rotateZ(n,n,this.angle),p.translate(n,n,[-this.x,-this.y,0]),this.projMatrix=n,n=p.create(),p.scale(n,n,[this.width/2,-this.height/2,1]),p.translate(n,n,[1,-1,0]),this.pixelMatrix=p.multiply(new Float64Array(16),n,this.projMatrix),n=p.invert(new Float64Array(16),this.pixelMatrix),!n)throw new Error("failed to invert matrix");this.pixelMatrixInverse=n}}}},{"../data/bucket":253,"../source/tile_coord":293,"../util/interpolate":360,"../util/util":366,"./coordinate":262,"./lng_lat":263,"gl-matrix":382,"point-geometry":424}],266:[function(t,e,r){"use strict";var n={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]], +"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]};e.exports=function(t,e,r,i){i=i||1;var o,a,s,l,u,c,h,f,p=[];for(o=0,a=t.length;a>o;o++)if(u=n[t[o]]){for(f=null,s=0,l=u[1].length;l>s;s+=2)-1===u[1][s]&&-1===u[1][s+1]?f=null:(c=e+u[1][s]*i,h=r-u[1][s+1]*i,f&&p.push(f.x,f.y,c,h),f={x:c,y:h});e+=u[0]*i}return p}},{}],267:[function(t,e,r){"use strict";var n=e.exports={};n.version=t("../package.json").version,n.Map=t("./ui/map"),n.Control=t("./ui/control/control"),n.Navigation=t("./ui/control/navigation"),n.Geolocate=t("./ui/control/geolocate"),n.Attribution=t("./ui/control/attribution"),n.Popup=t("./ui/popup"),n.Marker=t("./ui/marker"),n.Style=t("./style/style"),n.LngLat=t("./geo/lng_lat"),n.LngLatBounds=t("./geo/lng_lat_bounds"),n.Point=t("point-geometry"),n.Evented=t("./util/evented"),n.util=t("./util/util"),n.supported=t("./util/browser").supported;var i=t("./util/ajax");n.util.getJSON=i.getJSON,n.util.getArrayBuffer=i.getArrayBuffer;var o=t("./util/config");n.config=o,Object.defineProperty(n,"accessToken",{get:function(){return o.ACCESS_TOKEN},set:function(t){o.ACCESS_TOKEN=t}})},{"../package.json":443,"./geo/lng_lat":263,"./geo/lng_lat_bounds":264,"./style/style":302,"./ui/control/attribution":333,"./ui/control/control":334,"./ui/control/geolocate":335,"./ui/control/navigation":336,"./ui/map":345,"./ui/marker":346,"./ui/popup":347,"./util/ajax":349,"./util/browser":350,"./util/config":355,"./util/evented":358,"./util/util":366,"point-geometry":424}],268:[function(t,e,r){"use strict";e.exports=function(t){for(var e={define:{},initialize:{}},r=0;r>16,_>>16),s.uniform2f(n.u_pixel_coord_lower,65535&x,65535&_)}s.uniformMatrix4fv(n.u_matrix,!1,t.transform.calculatePosMatrix(v)),s.drawArrays(s.TRIANGLE_STRIP,0,t.tileExtentBuffer.length)}s.stencilMask(0),s.stencilFunc(s.EQUAL,128,128)}var i=t("../source/pixels_to_tile_units"),o=t("./create_uniform_pragmas"),a=512;e.exports=n},{"../source/pixels_to_tile_units":287,"./create_uniform_pragmas":268}],270:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var o=t.gl;t.setDepthSublayer(0),t.depthMask(!1),o.disable(o.STENCIL_TEST);for(var a=0;a>16,f>>16),a.uniform2f(o.u_pixel_coord_lower,65535&h,65535&f),a.activeTexture(a.TEXTURE0),i.spriteAtlas.bind(a,!0)}}var s=t("../source/pixels_to_tile_units");e.exports=n},{"../source/pixels_to_tile_units":287}],274:[function(t,e,r){"use strict";var n=t("../util/browser"),i=t("gl-matrix").mat2,o=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,a){if(!t.isOpaquePass){t.setDepthSublayer(0),t.depthMask(!1);var s=t.gl;if(s.enable(s.STENCIL_TEST),!(r.paint["line-width"]<=0)){var l=1/n.devicePixelRatio,u=r.paint["line-blur"]+l,c=r.paint["line-color"],h=t.transform,f=i.create();i.scale(f,f,[1,Math.cos(h._pitch)]),i.rotate(f,f,t.transform.angle);var p,d,m,g,v,y=Math.sqrt(h.height*h.height/4*(1+h.altitude*h.altitude)),b=h.height/2*Math.tan(h._pitch),x=(y+b)/y-1,_=r.paint["line-dasharray"],w=r.paint["line-pattern"];if(_)p=t.useProgram("linesdfpattern"),s.uniform1f(p.u_linewidth,r.paint["line-width"]/2),s.uniform1f(p.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(p.u_antialiasing,l/2),s.uniform1f(p.u_blur,u),s.uniform4fv(p.u_color,c),s.uniform1f(p.u_opacity,r.paint["line-opacity"]),d=t.lineAtlas.getDash(_.from,"round"===r.layout["line-cap"]),m=t.lineAtlas.getDash(_.to,"round"===r.layout["line-cap"]),s.uniform1i(p.u_image,0),s.activeTexture(s.TEXTURE0),t.lineAtlas.bind(s),s.uniform1f(p.u_tex_y_a,d.y),s.uniform1f(p.u_tex_y_b,m.y),s.uniform1f(p.u_mix,_.t),s.uniform1f(p.u_extra,x),s.uniform1f(p.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(p.u_antialiasingmatrix,!1,f);else if(w){if(g=t.spriteAtlas.getPosition(w.from,!0),v=t.spriteAtlas.getPosition(w.to,!0),!g||!v)return;p=t.useProgram("linepattern"),s.uniform1i(p.u_image,0),s.activeTexture(s.TEXTURE0),t.spriteAtlas.bind(s,!0),s.uniform1f(p.u_linewidth,r.paint["line-width"]/2),s.uniform1f(p.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(p.u_antialiasing,l/2),s.uniform1f(p.u_blur,u),s.uniform2fv(p.u_pattern_tl_a,g.tl),s.uniform2fv(p.u_pattern_br_a,g.br),s.uniform2fv(p.u_pattern_tl_b,v.tl),s.uniform2fv(p.u_pattern_br_b,v.br),s.uniform1f(p.u_fade,w.t),s.uniform1f(p.u_opacity,r.paint["line-opacity"]),s.uniform1f(p.u_extra,x),s.uniform1f(p.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(p.u_antialiasingmatrix,!1,f)}else p=t.useProgram("line"),s.uniform1f(p.u_linewidth,r.paint["line-width"]/2),s.uniform1f(p.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(p.u_antialiasing,l/2),s.uniform1f(p.u_blur,u),s.uniform1f(p.u_extra,x),s.uniform1f(p.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(p.u_antialiasingmatrix,!1,f),s.uniform4fv(p.u_color,c),s.uniform1f(p.u_opacity,r.paint["line-opacity"]);for(var M=0;M0?1/(1-t):1+t}function s(t){return t>0?1-1/(1.001-t):-t}function l(t,e,r,n){var i=[1,0],o=r.paint["raster-fade-duration"];if(t.source&&o>0){var a=(new Date).getTime(),s=(a-t.timeAdded)/o,l=e?(a-e.timeAdded)/o:-1,c=n.coveringZoomLevel(t.source),h=e?Math.abs(e.coord.z-c)>Math.abs(t.coord.z-c):!1;!e||h?(i[0]=u.clamp(s,0,1),i[1]=1-i[0]):(i[0]=u.clamp(1-l,0,1),i[1]=1-i[0])}var f=r.paint["raster-opacity"];return i[0]*=f,i[1]*=f,i}var u=t("../util/util"),c=t("../util/struct_array");e.exports=n,n.RasterBoundsArray=new c({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":364,"../util/util":366}],276:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var o=!(r.layout["text-allow-overlap"]||r.layout["icon-allow-overlap"]||r.layout["text-ignore-placement"]||r.layout["icon-ignore-placement"]),a=t.gl;o?a.disable(a.STENCIL_TEST):a.enable(a.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.DEPTH_TEST),i(t,e,r,n,!1,r.paint["icon-translate"],r.paint["icon-translate-anchor"],r.layout["icon-rotation-alignment"],r.layout["icon-rotation-alignment"],r.layout["icon-size"],r.paint["icon-halo-width"],r.paint["icon-halo-color"],r.paint["icon-halo-blur"],r.paint["icon-opacity"],r.paint["icon-color"]),i(t,e,r,n,!0,r.paint["text-translate"],r.paint["text-translate-anchor"],r.layout["text-rotation-alignment"],r.layout["text-pitch-alignment"],r.layout["text-size"],r.paint["text-halo-width"],r.paint["text-halo-color"],r.paint["text-halo-blur"],r.paint["text-opacity"],r.paint["text-color"]),a.enable(a.DEPTH_TEST),e.map.showCollisionBoxes&&s(t,e,r,n)}}function i(t,e,r,n,i,a,s,l,u,c,h,f,p,d,m){for(var g=0;gthis.previousZoom;r--)this.changeTimes[r]=e,this.changeOpacities[r]=this.opacities[r];for(r=0;256>r;r++){var n=e-this.changeTimes[r],i=n/this.fadeDuration*255;t>=r?this.opacities[r]=this.changeOpacities[r]+i:this.opacities[r]=this.changeOpacities[r]-i}this.changed=!0,this.previousZoom=t},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],278:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}var i=t("../util/util");e.exports=n,n.prototype.setSprite=function(t){this.sprite=t},n.prototype.getDash=function(t,e){var r=t.join(",")+e;return this.positions[r]||(this.positions[r]=this.addDash(t,e)),this.positions[r]},n.prototype.addDash=function(t,e){var r=e?7:0,n=2*r+1,o=128;if(this.nextRow+n>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var a=0,s=0;s=h;h++)for(var f=this.nextRow+r+h,p=this.width*f,d=c?-t[t.length-1]:0,m=t[0],g=1,v=0;vm;)d=m,m+=t[g],c&&g===t.length-1&&(m+=t[0]),g++;var y,b=Math.abs(v-d*l),x=Math.abs(v-m*l),_=Math.min(b,x),w=g%2===1;if(e){var M=r?h/r*(u+1):0;if(w){var k=u-Math.abs(M);y=Math.sqrt(_*_+k*k)}else y=u-Math.sqrt(_*_+M*M)}else y=(w?1:-1)*_;this.data[3+4*(p+v)]=Math.max(0,Math.min(255,y+o))}var A={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:a};return this.nextRow+=n,this.dirty=!0,A},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,this.data))}},{"../util/util":366}],279:[function(t,e,r){"use strict";function n(t,e){this.gl=t,this.transform=e,this.reusableTextures={},this.preFbos={},this.frameHistory=new a,this.setup(),this.numSublayers=s.maxUnderzooming+s.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.lineWidthRange=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE)}var i=t("../util/browser"),o=t("gl-matrix").mat4,a=t("./frame_history"),s=t("../source/source_cache"),l=t("../data/bucket").EXTENT,u=t("../source/pixels_to_tile_units"),c=t("../util/util"),h=t("../util/struct_array"),f=t("../data/buffer"),p=t("./vertex_array_object"),d=t("./draw_raster").RasterBoundsArray,m=t("./create_uniform_pragmas");e.exports=n,c.extend(n.prototype,t("./painter/use_program")),n.prototype.resize=function(t,e){var r=this.gl;this.width=t*i.devicePixelRatio,this.height=e*i.devicePixelRatio,r.viewport(0,0,this.width,this.height)},n.prototype.setup=function(){var t=this.gl;t.verbose=!0,t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.enable(t.STENCIL_TEST),t.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),this._depthMask=!1,t.depthMask(!1);var e=this.PosArray=new h({members:[{name:"a_pos",type:"Int16",components:2}]}),r=new e;r.emplaceBack(0,0),r.emplaceBack(l,0),r.emplaceBack(0,l),r.emplaceBack(l,l),this.tileExtentBuffer=new f(r.serialize(),e.serialize(),f.BufferType.VERTEX),this.tileExtentVAO=new p,this.tileExtentPatternVAO=new p;var n=new e;n.emplaceBack(0,0),n.emplaceBack(l,0),n.emplaceBack(l,l),n.emplaceBack(0,l),n.emplaceBack(0,0),this.debugBuffer=new f(n.serialize(),e.serialize(),f.BufferType.VERTEX),this.debugVAO=new p;var i=new d;i.emplaceBack(0,0,0,0),i.emplaceBack(l,0,32767,0),i.emplaceBack(0,l,0,32767),i.emplaceBack(l,l,32767,32767),this.rasterBoundsBuffer=new f(i.serialize(),d.serialize(),f.BufferType.VERTEX),this.rasterBoundsVAO=new p},n.prototype.clearColor=function(){var t=this.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},n.prototype.clearStencil=function(){var t=this.gl;t.clearStencil(0),t.stencilMask(255),t.clear(t.STENCIL_BUFFER_BIT)},n.prototype.clearDepth=function(){var t=this.gl;t.clearDepth(1),this.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},n.prototype._renderTileClippingMasks=function(t){var e=this.gl;e.colorMask(!1,!1,!1,!1),this.depthMask(!1),e.disable(e.DEPTH_TEST),e.enable(e.STENCIL_TEST),e.stencilMask(248),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE);var r=1;this._tileClippingMaskIDs={};for(var n=0;n0?e.pop():null},n.prototype.lineWidth=function(t){this.gl.lineWidth(c.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},n.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);var r=8,n=1/r;e.blendColor(n,n,n,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":253,"../data/buffer":258,"../source/pixels_to_tile_units":287,"../source/source_cache":291,"../util/browser":350,"../util/struct_array":364,"../util/util":366,"./create_uniform_pragmas":268,"./draw_background":269,"./draw_circle":270,"./draw_debug":272,"./draw_fill":273,"./draw_line":274,"./draw_raster":275,"./draw_symbol":276,"./frame_history":277,"./painter/use_program":280,"./vertex_array_object":281,"gl-matrix":382}],280:[function(t,e,r){"use strict";function n(t,e){return t.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(t,r,n,i,o){return e[r][o].replace(/{type}/g,i).replace(/{precision}/g,n)})}var i=t("../../util/util"),o=t("mapbox-gl-shaders"),a=o.util;e.exports._createProgram=function(t,e,r,s){for(var l=this.gl,u=l.createProgram(),c=o[t],h="#define MAPBOX_GL_JS;\n",f=0;fv;v++){var y=l.getActiveAttrib(u,v);m[y.name]=l.getAttribLocation(u,y.name)}for(var b={},x=l.getProgramParameter(u,l.ACTIVE_UNIFORMS),_=0;x>_;_++){ +var w=l.getActiveUniform(u,_);b[w.name]=l.getUniformLocation(u,w.name)}return i.extend({program:u,definition:c,attributes:m,numAttributes:g},m,b)},e.exports._createProgramCached=function(t,e,r,n){this.cache=this.cache||{};var i=JSON.stringify({name:t,defines:e,vertexPragmas:r,fragmentPragmas:n});return this.cache[i]||(this.cache[i]=this._createProgram(t,e,r,n)),this.cache[i]},e.exports.useProgram=function(t,e,r,n){var i=this.gl;e=e||[],this._showOverdrawInspector&&(e=e.concat("OVERDRAW_INSPECTOR"));var o=this._createProgramCached(t,e,r,n),a=this.currentProgram;return a!==o&&(i.useProgram(o.program),this.currentProgram=o),o}},{"../../util/util":366,"mapbox-gl-shaders":394}],281:[function(t,e,r){"use strict";function n(){this.boundProgram=null,this.boundVertexBuffer=null,this.boundVertexBuffer2=null,this.boundElementBuffer=null,this.vao=null}e.exports=n,n.prototype.bind=function(t,e,r,n,i){void 0===t.extVertexArrayObject&&(t.extVertexArrayObject=t.getExtension("OES_vertex_array_object"));var o=!this.vao||this.boundProgram!==e||this.boundVertexBuffer!==r||this.boundVertexBuffer2!==i||this.boundElementBuffer!==n;!t.extVertexArrayObject||o?this.freshBind(t,e,r,n,i):t.extVertexArrayObject.bindVertexArrayOES(this.vao)},n.prototype.freshBind=function(t,e,r,n,i){var o,a=e.numAttributes;if(t.extVertexArrayObject)this.vao&&this.destroy(t),this.vao=t.extVertexArrayObject.createVertexArrayOES(),t.extVertexArrayObject.bindVertexArrayOES(this.vao),o=0,this.boundProgram=e,this.boundVertexBuffer=r,this.boundVertexBuffer2=i,this.boundElementBuffer=n;else{o=t.currentNumAttributes||0;for(var s=a;o>s;s++)t.disableVertexAttribArray(s)}for(var l=o;a>l;l++)t.enableVertexAttribArray(l);r.bind(t),r.setVertexAttribPointers(t,e),i&&(i.bind(t),i.setVertexAttribPointers(t,e)),n&&n.bind(t),t.currentNumAttributes=a},n.prototype.unbind=function(t){var e=t.extVertexArrayObject;e&&e.bindVertexArrayOES(null)},n.prototype.destroy=function(t){var e=t.extVertexArrayObject;e&&this.vao&&(e.deleteVertexArrayOES(this.vao),this.vao=null)}},{}],282:[function(t,e,r){"use strict";function n(t,e,r){e=e||{},this.id=t,this.dispatcher=r,this._data=e.data,void 0!==e.maxzoom&&(this.maxzoom=e.maxzoom),e.type&&(this.type=e.type);var n=s/this.tileSize;this.workerOptions=o.extend({source:this.id,cluster:e.cluster||!1,geojsonVtOptions:{buffer:(void 0!==e.buffer?e.buffer:128)*n,tolerance:(void 0!==e.tolerance?e.tolerance:.375)*n,extent:s,maxZoom:this.maxzoom},superclusterOptions:{maxZoom:Math.min(e.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:s,radius:(e.clusterRadius||50)*n,log:!1}},e.workerOptions),this._updateWorkerData(function(t){return t?void this.fire("error",{error:t}):void this.fire("load")}.bind(this))}var i=t("../util/evented"),o=t("../util/util"),a=t("resolve-url"),s=t("../data/bucket").EXTENT;e.exports=n,n.prototype=o.inherit(i,{type:"geojson",minzoom:0,maxzoom:18,tileSize:512,isTileClipped:!0,reparseOverscaled:!0,onAdd:function(t){this.map=t},setData:function(t){return this._data=t,this._updateWorkerData(function(t){return t?this.fire("error",{error:t}):void this.fire("change")}.bind(this)),this},_updateWorkerData:function(t){var e=o.extend({},this.workerOptions),r=this._data;"string"==typeof r?e.url="undefined"!=typeof window?a(window.location.href,r):r:e.data=JSON.stringify(r),this.workerID=this.dispatcher.send(this.type+".loadData",e,function(e){this._loaded=!0,t(e)}.bind(this))},loadTile:function(t,e){var r=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,n={type:this.type,uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:r,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load tile",n,function(r,n){return t.unloadVectorData(this.map.painter),t.aborted?void 0:r?e(r):(t.loadVectorData(n,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null))}.bind(this),this.workerID)},abortTile:function(t){t.aborted=!0},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},function(){},t.workerID)},serialize:function(){return{type:this.type,data:this._data}}})},{"../data/bucket":253,"../util/evented":358,"../util/util":366,"resolve-url":426}],283:[function(t,e,r){"use strict";function n(t,e,r){r&&(this.loadGeoJSON=r),h.call(this,t,e)}var i=t("../util/util"),o=t("../util/ajax"),a=t("geojson-rewind"),s=t("./geojson_wrapper"),l=t("vt-pbf"),u=t("supercluster"),c=t("geojson-vt"),h=t("./vector_tile_worker_source");e.exports=n,n.prototype=i.inherit(h,{_geoJSONIndexes:{},loadVectorData:function(t,e){var r=t.source,n=t.coord;if(!this._geoJSONIndexes[r])return e(null,null);var i=this._geoJSONIndexes[r].getTile(Math.min(n.z,t.maxZoom),n.x,n.y);if(!i)return e(null,null);var o=new s(i.features);o.name="_geojsonTileLayer";var a=l({layers:{_geojsonTileLayer:o}});0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),e(null,{tile:o,rawTileData:a.buffer})},loadData:function(t,e){var r=function(r,n){return r?e(r):"object"!=typeof n?e(new Error("Input data is not a valid GeoJSON object.")):(a(n,!0),void this._indexData(n,t,function(r,n){return r?e(r):(this._geoJSONIndexes[t.source]=n,void e(null))}.bind(this)))}.bind(this);this.loadGeoJSON(t,r)},loadGeoJSON:function(t,e){if(t.url)o.getJSON(t.url,e);else{if("string"!=typeof t.data)return e(new Error("Input data is not a valid GeoJSON object."));try{return e(null,JSON.parse(t.data))}catch(r){return e(new Error("Input data is not a valid GeoJSON object."))}}},_indexData:function(t,e,r){try{e.cluster?r(null,u(e.superclusterOptions).load(t.features)):r(null,c(t,e.geojsonVtOptions))}catch(n){return r(n)}}})},{"../util/ajax":349,"../util/util":366,"./geojson_wrapper":284,"./vector_tile_worker_source":295,"geojson-rewind":371,"geojson-vt":377,supercluster:428,"vt-pbf":438}],284:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length,this.extent=s}function i(t){if(this.type=t.type,1===t.type){this.rawGeometry=[];for(var e=0;ee)){var a=Math.pow(2,Math.min(o.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(o.coord.x/a)===t.x&&Math.floor(o.coord.y/a)===t.y)for(r[i]=!0,n=!0;o&&o.coord.z-1>t.z;){var s=o.coord.parent(this.maxzoom).id;o=this._tiles[s],o&&o.isRenderable()&&(delete r[i],r[s]=!0)}}}return n},findLoadedParent:function(t,e,r){for(var n=t.z-1;n>=e;n--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.isRenderable())return r[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),r[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=Math.ceil(t.width/t.tileSize)+1,r=Math.ceil(t.height/t.tileSize)+1,n=e*r,i=5;this._cache.setMaxSize(Math.floor(n*i))},update:function(t,e){if(this._sourceLoaded){var r,i,o;this.updateCacheSize(t);var a=(this.roundZoom?Math.round:Math.floor)(this.getZoom(t)),s=Math.max(a-n.maxOverzooming,this.minzoom),l=Math.max(a+n.maxUnderzooming,this.minzoom),c={},h=(new Date).getTime();this._coveredTiles={};var p=this.used?t.coveringTiles(this._source):[];for(r=0;rh-(e||0)&&(this.findLoadedChildren(i,l,c)&&(c[v]=!0),this.findLoadedParent(i,s,d))}var y;for(y in d)c[y]||(this._coveredTiles[y]=!0);for(y in d)c[y]=!0;var b=f.keysDifference(this._tiles,c);for(r=0;rthis.maxzoom?Math.pow(2,n-this.maxzoom):1;e=new s(r,this.tileSize*i,this.maxzoom),this.loadTile(e,this._tileLoaded.bind(this,e))}return e.uses++,this._tiles[t.id]=e,this.fire("tile.add",{tile:e}),this._source.fire("tile.add",{tile:e}),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this.fire("tile.remove",{tile:e}),this._source.fire("tile.remove",{tile:e}),e.uses>0||(e.isRenderable()?this._cache.add(e.coord.wrapped().id,e):(e.aborted=!0,this.abortTile(e),this.unloadTile(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},r=this.getIds(),n=1/0,o=1/0,a=-(1/0),s=-(1/0),l=t[0].zoom,c=0;c=0&&v[1].y>=0){for(var y=[],b=0;bn&&(n=-1*n-1);var i=1<0;o--)n=1<e.row){var r=t;t=e,e=r}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function a(t,e,r,n,i){var o=Math.max(r,Math.floor(e.y0)),a=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx0,h=e.dx<0,f=o;a>f;f++){var p=l*Math.max(0,Math.min(t.dy,f+c-t.y0))+t.x0,d=u*Math.max(0,Math.min(e.dy,f+h-e.y0))+e.x0;i(Math.floor(d),Math.ceil(p),f)}}function s(t,e,r,n,i,s){var l,u=o(t,e),c=o(e,r),h=o(r,t);u.dy>c.dy&&(l=u,u=c,c=l),u.dy>h.dy&&(l=u,u=h,h=l),c.dy>h.dy&&(l=c,c=h,h=l),u.dy&&a(h,u,n,i,s),c.dy&&a(h,c,n,i,s)}var l=t("whoots-js"),u=t("../geo/coordinate");e.exports=n,n.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},n.prototype.toCoordinate=function(t){var e=Math.min(this.z,t),r=Math.pow(2,e),n=this.y,i=this.x+r*this.w;return new u(i,n,e)},n.fromID=function(t){var e=t%32,r=1<t?new n(this.z-1,this.x,this.y,this.w):new n(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},n.prototype.wrapped=function(){return new n(this.z,this.x,this.y,0)},n.prototype.children=function(t){if(this.z>=t)return[new n(this.z+1,this.x,this.y,this.w)];var e=this.z+1,r=2*this.x,i=2*this.y;return[new n(e,r,i,this.w),new n(e,r+1,i,this.w),new n(e,r,i+1,this.w),new n(e,r+1,i+1,this.w)]},n.cover=function(t,e,r){function i(t,e,i){var s,l,u;if(i>=0&&o>=i)for(s=t;e>s;s++)l=(s%o+o)%o,u=new n(r,l,i,Math.floor(s/o)),a[u.id]=u}var o=1<this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,i={url:s(t.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*n,source:this.id,overscaling:n,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?"loading"===t.state?t.reloadCallback=e:(i.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",i,r.bind(this),t.workerID)):t.workerID=this.dispatcher.send("load tile",i,r.bind(this))},abortTile:function(t){this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)}})},{"../util/evented":358,"../util/mapbox":363,"../util/util":366,"./load_tilejson":286}],295:[function(t,e,r){"use strict";function n(t,e,r){this.actor=t,this.styleLayers=e,r&&(this.loadVectorData=r),this.loading={},this.loaded={}}var i=t("../util/ajax"),o=t("vector-tile"),a=t("pbf"),s=t("./worker_tile");e.exports=n,n.prototype={loadTile:function(t,e){function r(t,r){return delete this.loading[n][i],t?e(t):r?(o.data=r.tile,o.parse(o.data,this.styleLayers.getLayerFamilies(),this.actor,r.rawTileData,e),this.loaded[n]=this.loaded[n]||{},void(this.loaded[n][i]=o)):e(null,null)}var n=t.source,i=t.uid;this.loading[n]||(this.loading[n]={});var o=this.loading[n][i]=new s(t);o.abort=this.loadVectorData(t,r.bind(this))},reloadTile:function(t,e){var r=this.loaded[t.source],n=t.uid;if(r&&r[n]){var i=r[n];i.parse(i.data,this.styleLayers.getLayerFamilies(),this.actor,t.rawTileData,e)}},abortTile:function(t){var e=this.loading[t.source],r=t.uid;e&&e[r]&&e[r].abort&&(e[r].abort(),delete e[r])},removeTile:function(t){var e=this.loaded[t.source],r=t.uid;e&&e[r]&&delete e[r]},loadVectorData:function(t,e){function r(t,r){if(t)return e(t);var n=new o.VectorTile(new a(new Uint8Array(r)));e(t,{tile:n,rawTileData:r})}var n=i.getArrayBuffer(t.url,r.bind(this));return function(){n.abort()}},redoPlacement:function(t,e){var r=this.loaded[t.source],n=this.loading[t.source],i=t.uid;if(r&&r[i]){var o=r[i],a=o.redoPlacement(t.angle,t.pitch,t.showCollisionBoxes);a.result&&e(null,a.result,a.transferables)}else n&&n[i]&&(n[i].angle=t.angle)}}},{"../util/ajax":349,"./worker_tile":298,pbf:422,"vector-tile":434}],296:[function(t,e,r){"use strict";function n(t,e){this.id=t,this.urls=e.urls,this.coordinates=e.coordinates,u.getVideo(e.urls,function(t,r){if(t)return this.fire("error",{error:t});this.video=r,this.video.loop=!0;var n;this.video.addEventListener("playing",function(){n=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(n)}.bind(this)),this.map&&(this.video.play(),this.setCoordinates(e.coordinates)),this.fire("load")}.bind(this))}var i=t("../util/util"),o=t("./tile_coord"),a=t("../geo/lng_lat"),s=t("point-geometry"),l=t("../util/evented"),u=t("../util/ajax"),c=t("../data/bucket").EXTENT,h=t("../render/draw_raster").RasterBoundsArray,f=t("../data/buffer"),p=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(l,{minzoom:0,maxzoom:22,tileSize:512,roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map||(this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(a.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);return n.column=Math.round(n.column),n.row=Math.round(n.row),this.minzoom=this.maxzoom=n.zoom,this._coord=new o(n.zoom,n.column,n.row),this._tileCoords=r.map(function(t){var e=t.zoomTo(n.zoom);return new s(Math.round((e.column-n.column)*c),Math.round((e.row-n.row)*c))}),this.fire("change"),this},_setTile:function(t){this._prepared=!1,this.tile=t;var e=32767,r=new h;r.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),r.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,e,0),r.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,e),r.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,e,e),this.tile.buckets={},this.tile.boundsBuffer=new f(r.serialize(),h.serialize(),f.BufferType.VERTEX),this.tile.boundsVAO=new p,this.tile.state="loaded"},prepare:function(){if(!(this.video.readyState<2)&&this.tile){var t=this.map.painter.gl;this._prepared?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this._prepared=!0,this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},loadTile:function(t,e){this._coord&&this._coord.toString()===t.coord.toString()?(this._setTile(t),e(null)):(t.state="errored",e(null)); +},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":253,"../data/buffer":258,"../geo/lng_lat":263,"../render/draw_raster":275,"../render/vertex_array_object":281,"../util/ajax":349,"../util/evented":358,"../util/util":366,"./tile_coord":293,"point-geometry":424}],297:[function(t,e,r){"use strict";function n(t){this.self=t,this.actor=new o(t,this);var e={getLayers:function(){return this.layers}.bind(this),getLayerFamilies:function(){return this.layerFamilies}.bind(this)};this.workerSources={vector:new l(this.actor,e),geojson:new u(this.actor,e)},this.self.registerWorkerSource=function(t,r){if(this.workerSources[t])throw new Error('Worker source with name "'+t+'" already registered.');this.workerSources[t]=new r(this.actor,e)}.bind(this)}function i(t){var e={};for(var r in t){var n=t[r],i=n.ref||n.id,o=t[i];o.layout&&"none"===o.layout.visibility||(e[i]=e[i]||[],r===i?e[i].unshift(n):e[i].push(n))}return e}var o=t("../util/actor"),a=t("../style/style_layer"),s=t("../util/util"),l=t("./vector_tile_worker_source"),u=t("./geojson_worker_source");e.exports=function(t){return new n(t)},s.extend(n.prototype,{"set layers":function(t){function e(t){var e=a.create(t,t.ref&&r.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),r.layers[e.id]=e}this.layers={};for(var r=this,n=[],o=0;o=0;e--)b(S,R[e]);x()}}function b(t,e){if(e.populateArrays(A,F,O),"symbol"!==e.type)for(var r=0;r=w.maxzoom||w.layout&&"none"===w.layout.visibility||t.layers&&!t.layers[w.sourceLayer]||(k=c.create({layer:w,index:I++,childLayers:e[P],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:E.encode(w.sourceLayer||"_geojsonTileLayer")}),k.createFilter(),L[w.id]=k,t.layers&&(M=w.sourceLayer,z[M]=z[M]||{},z[M][w.id]=k)));if(t.layers)for(M in z)1===w.version&&p.warnOnce('Vector tile source "'+this.source+'" layer "'+M+'" does not use vector tile spec v2 and therefore may have some rendering errors.'),w=t.layers[M],w&&v(w,z[M]);else v(t,L);var C=[],R=this.symbolBuckets=[],j=[];T.bucketLayerIDs={};for(var D in L)k=L[D],0!==k.features.length&&(T.bucketLayerIDs[k.index]=k.childLayers.map(s),C.push(k),"symbol"===k.type?R.push(k):j.push(k));var O={},F={},N=0;if(R.length>0){for(_=R.length-1;_>=0;_--)R[_].updateIcons(O),R[_].updateFont(F);for(var B in F)F[B]=Object.keys(F[B]).map(Number);O=Object.keys(O),r.send("get glyphs",{uid:this.uid,stacks:F},function(t,e){F=e,y(t)}),O.length?r.send("get icons",{icons:O},function(t,e){O=e,y(t)}):y()}for(_=j.length-1;_>=0;_--)b(this,j[_]);return 0===R.length?x():void 0},n.prototype.redoPlacement=function(t,e,r){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var n=new u(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(n,r);var c=n.serialize(),h=s.filter(i);return{result:{buckets:h.map(o),collisionTile:c.data},transferables:a(h).concat(c.transferables)}}},{"../data/bucket":253,"../data/feature_index":260,"../symbol/collision_box":318,"../symbol/collision_tile":320,"../symbol/symbol_instances":329,"../symbol/symbol_quads":330,"../util/dictionary_coder":356,"../util/util":366}],299:[function(t,e,r){"use strict";function n(){this.n=0,this.times=[]}e.exports=n,n.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},n.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},n.prototype.cancel=function(t){this.times=this.times.filter(function(e){return e.id!==t})}},{}],300:[function(t,e,r){"use strict";function n(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";a.getJSON(l(t,e,".json"),function(t,e){return t?void this.fire("error",{error:t}):(this.data=e,void(this.img&&this.fire("load")))}.bind(this)),a.getImage(l(t,e,".png"),function(t,e){if(t)return void this.fire("error",{error:t});for(var r=e.getData(),n=e.data=new Uint8Array(r.length),i=0;i1!==this.retina){var t=new n(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},i.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},n.prototype.getSpritePosition=function(t){if(!this.loaded())return new i;var e=this.data&&this.data[t];return e&&this.img?e:new i}},{"../util/ajax":349,"../util/browser":350,"../util/evented":358,"../util/mapbox":363}],301:[function(t,e,r){"use strict";var n=t("csscolorparser").parseCSSColor,i=t("../util/util"),o=t("./style_function"),a={};e.exports=function s(t){if(o.isFunctionDefinition(t))return i.extend({},t,{stops:t.stops.map(function(t){return[t[0],s(t[1])]})});if("string"==typeof t){if(!a[t]){var e=n(t);if(!e)throw new Error("Invalid color "+t);a[t]=[e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]]}return a[t]}throw new Error("Invalid color "+t)}},{"../util/util":366,"./style_function":304,csscolorparser:368}],302:[function(t,e,r){"use strict";function n(t,e,r){this.animationLoop=e||new m,this.dispatcher=new d(r||1,this),this.spriteAtlas=new l(1024,1024),this.lineAtlas=new u(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},c.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var n=function(t,e){if(t)return void this.fire("error",{error:t});if(!g.emitErrors(this,g(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var r=e.sources;for(var n in r)this.addSource(n,r[n]);e.sprite&&(this.sprite=new a(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?h.getJSON(f(t),n):p.frame(n.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var r in this._layers){var n=this._layers[r];n.source===e.id&&this._validateLayer(n)}})}var i=t("../util/evented"),o=t("./style_layer"),a=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),u=t("../render/line_atlas"),c=t("../util/util"),h=t("../util/ajax"),f=t("../util/mapbox").normalizeStyleURL,p=t("../util/browser"),d=t("../util/dispatcher"),m=t("./animation_loop"),g=t("./validate_style"),v=t("../source/source"),y=t("../source/query_features"),b=t("../source/source_cache"),x=t("./style_spec"),_=t("./style_function");e.exports=n,n.prototype=c.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&-1===e.vectorLayerIds.indexOf(t.sourceLayer)&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;if(Object.keys(this._updates.sources).length)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!this.sprite||this.sprite.loaded()},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var r=0;rMath.floor(t)&&(e.lastIntegerZoom=Math.floor(t+1),e.lastIntegerZoomTime=Date.now()),e.lastZoom=t},_checkLoaded:function(){if(!this._loaded)throw new Error("Style is not done loading")},update:function(t,e){if(!this._updates.changed)return this;if(this._updates.allLayers)this._groupLayers(),this._updateWorkerLayers();else{var r=Object.keys(this._updates.layers);r.length&&this._updateWorkerLayers(r)}var n,i=Object.keys(this._updates.sources);for(n=0;n=0;return n&&this._handleErrors(g.source,"sources."+t,e)?this:(e=new b(t,e,this.dispatcher),this.sources[t]=e,e.style=this,e.on("load",this._forwardSourceEvent).on("error",this._forwardSourceEvent).on("change",this._forwardSourceEvent).on("tile.add",this._forwardTileEvent).on("tile.load",this._forwardTileEvent).on("tile.error",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.add",{source:e}]),this._updates.changed=!0,this)},removeSource:function(t){if(this._checkLoaded(),void 0===this.sources[t])throw new Error("There is no source with this ID");var e=this.sources[t];return delete this.sources[t],delete this._updates.sources[t],e.off("load",this._forwardSourceEvent).off("error",this._forwardSourceEvent).off("change",this._forwardSourceEvent).off("tile.add",this._forwardTileEvent).off("tile.load",this._forwardTileEvent).off("tile.error",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.remove",{source:e}]),this._updates.changed=!0,this},getSource:function(t){return this.sources[t]&&this.sources[t].getSource()},addLayer:function(t,e){if(this._checkLoaded(),!(t instanceof o)){if(this._handleErrors(g.layer,"layers."+t.id,t,!1,{arrayIndex:-1}))return this;var r=t.ref&&this.getLayer(t.ref);t=o.create(t,r)}return this._validateLayer(t),t.on("error",this._forwardLayerEvent),this._layers[t.id]=t,this._order.splice(e?this._order.indexOf(e):1/0,0,t.id),this._updates.allLayers=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.events.push(["layer.add",{layer:t}]),this.updateClasses(t.id)},removeLayer:function(t){this._checkLoaded();var e=this._layers[t];if(void 0===e)throw new Error("There is no layer with this ID");for(var r in this._layers)this._layers[r].ref===t&&this.removeLayer(r);return e.off("error",this._forwardLayerEvent),delete this._layers[t],delete this._updates.layers[t],delete this._updates.paintProps[t],this._order.splice(this._order.indexOf(t),1),this._updates.allLayers=!0,this._updates.events.push(["layer.remove",{layer:e}]),this._updates.changed=!0,this},getLayer:function(t){return this._layers[t]},getReferentLayer:function(t){var e=this.getLayer(t);return e.ref&&(e=this.getLayer(e.ref)),e},setLayerZoomRange:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return n.minzoom===e&&n.maxzoom===r?this:(null!=e&&(n.minzoom=e),null!=r&&(n.maxzoom=r),this._updateLayer(n))},setFilter:function(t,e){this._checkLoaded();var r=this.getReferentLayer(t);return null!==e&&this._handleErrors(g.filter,"layers."+r.id+".filter",e)?this:c.deepEqual(r.filter,e)?this:(r.filter=c.clone(e),this._updateLayer(r))},getFilter:function(t){return this.getReferentLayer(t).filter},setLayoutProperty:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return c.deepEqual(n.getLayoutProperty(e),r)?this:(n.setLayoutProperty(e,r),this._updateLayer(n))},getLayoutProperty:function(t,e){return this.getReferentLayer(t).getLayoutProperty(e)},setPaintProperty:function(t,e,r,n){this._checkLoaded();var i=this.getLayer(t);if(c.deepEqual(i.getPaintProperty(e,n),r))return this;var o=i.isPaintValueFeatureConstant(e);i.setPaintProperty(e,r,n);var a=!(r&&_.isFunctionDefinition(r)&&"$zoom"!==r.property&&void 0!==r.property);return a&&o||(this._updates.layers[t]=!0,i.source&&(this._updates.sources[i.source]=!0)),this.updateClasses(t,e)},getPaintProperty:function(t,e,r){return this.getLayer(t).getPaintProperty(e,r)},updateClasses:function(t,e){if(this._updates.changed=!0,t){var r=this._updates.paintProps;r[t]||(r[t]={}),r[t][e||"all"]=!0}else this._updates.allPaintProps=!0;return this},serialize:function(){return c.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:c.mapObject(this.sources,function(t){return t.serialize()}),layers:this._order.map(function(t){return this._layers[t].serialize()},this)},function(t){return void 0!==t})},_updateLayer:function(t){return this._updates.layers[t.id]=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.changed=!0,this},_flattenRenderedFeatures:function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var n=this._order[r],i=0;is.lastIntegerZoom?(n=u+(1-u)*c,h*=2,i=t({zoom:a-1},r),o=t({zoom:a},r)):(n=1-(1-c)*u,o=t({zoom:a},r),i=t({zoom:a+1},r),h/=2),void 0===i||void 0===o?void 0:{from:i,fromScale:h,to:o,toScale:f,t:n}}}var o=t("./style_function"),a=t("./parse_color"),s=t("../util/util");e.exports=n},{"../util/util":366,"./parse_color":301,"./style_function":304}],304:[function(t,e,r){"use strict";var n=t("mapbox-gl-function");r.interpolated=function(t){var e=n.interpolated(t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r["piecewise-constant"]=function(t){var e=n["piecewise-constant"](t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r.isFunctionDefinition=n.isFunctionDefinition},{"mapbox-gl-function":393}],305:[function(t,e,r){"use strict";function n(t,e){this.set(t,e)}function i(t){return t.value}var o=t("../util/util"),a=t("./style_transition"),s=t("./style_declaration"),l=t("./style_spec"),u=t("./validate_style"),c=t("./parse_color"),h=t("../util/evented");e.exports=n;var f="-transition";n.create=function(e,r){var n={background:t("./style_layer/background_style_layer"),circle:t("./style_layer/circle_style_layer"),fill:t("./style_layer/fill_style_layer"),line:t("./style_layer/line_style_layer"),raster:t("./style_layer/raster_style_layer"),symbol:t("./style_layer/symbol_style_layer")};return new n[(r||e).type](e,r)},n.prototype=o.inherit(h,{set:function(t,e){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(e||t).type,this.source=(e||t).source,this.sourceLayer=(e||t)["source-layer"],this.minzoom=(e||t).minzoom,this.maxzoom=(e||t).maxzoom,this.filter=(e||t).filter,this.paint={},this.layout={},this._paintSpecifications=l["paint_"+this.type],this._layoutSpecifications=l["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var r,n;for(var i in t){var o=i.match(/^paint(?:\.(.*))?$/);if(o){var a=o[1]||"";for(r in t[i])this.setPaintProperty(r,t[i][r],a)}}if(this.ref)this._layoutDeclarations=e._layoutDeclarations;else for(n in t.layout)this.setLayoutProperty(n,t.layout[n]);for(r in this._paintSpecifications)this.paint[r]=this.getPaintValue(r);for(n in this._layoutSpecifications)this._updateLayoutValue(n)},setLayoutProperty:function(t,e){if(null==e)delete this._layoutDeclarations[t];else{var r="layers."+this.id+".layout."+t;if(this._handleErrors(u.layoutProperty,r,t,e))return;this._layoutDeclarations[t]=new s(this._layoutSpecifications[t],e)}this._updateLayoutValue(t)},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,e,r){var n=this._layoutSpecifications[t],i=this._layoutDeclarations[t];return i?i.calculate(e,r):n.default},setPaintProperty:function(t,e,r){var n="layers."+this.id+(r?'["paint.'+r+'"].':".paint.")+t;if(o.endsWith(t,f))if(this._paintTransitionOptions[r||""]||(this._paintTransitionOptions[r||""]={}),null===e||void 0===e)delete this._paintTransitionOptions[r||""][t];else{if(this._handleErrors(u.paintProperty,n,t,e))return;this._paintTransitionOptions[r||""][t]=e}else if(this._paintDeclarations[r||""]||(this._paintDeclarations[r||""]={}),null===e||void 0===e)delete this._paintDeclarations[r||""][t];else{if(this._handleErrors(u.paintProperty,n,t,e))return;this._paintDeclarations[r||""][t]=new s(this._paintSpecifications[t],e)}},getPaintProperty:function(t,e){return e=e||"",o.endsWith(t,f)?this._paintTransitionOptions[e]&&this._paintTransitionOptions[e][t]:this._paintDeclarations[e]&&this._paintDeclarations[e][t]&&this._paintDeclarations[e][t].value},getPaintValue:function(t,e,r){var n=this._paintSpecifications[t],i=this._paintTransitions[t];return i?i.calculate(e,r):"color"===n.type&&n.default?c(n.default):n.default},getPaintValueStopZoomLevels:function(t){var e=this._paintTransitions[t];return e?e.declaration.stopZoomLevels:[]},getPaintInterpolationT:function(t,e){var r=this._paintTransitions[t];return r.declaration.calculateInterpolationT({zoom:e})},isPaintValueFeatureConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isFeatureConstant:!0},isLayoutValueFeatureConstant:function(t){var e=this._layoutDeclarations[t];return e?e.isFeatureConstant:!0},isPaintValueZoomConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isZoomConstant:!0},isHidden:function(t){return this.minzoom&&t=this.maxzoom?!0:"none"===this.layout.visibility?!0:0===this.paint[this.type+"-opacity"]},updatePaintTransitions:function(t,e,r,n){for(var i=o.extend({},this._paintDeclarations[""]),a=0;a-r/2;){if(a--,0>a)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;r/2>s;){var c=t[a-1],h=t[a],f=t[a+1];if(!f)return!1;var p=c.angleTo(h)-h.angleTo(f);for(p=Math.abs((p+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:p}),u+=p;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=h.dist(f)}return!0}e.exports=n},{}],317:[function(t,e,r){"use strict";function n(t,e,r,n,o){for(var a=[],s=0;s=n&&f.x>=n||(h.x>=n?h=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round():f.x>=n&&(f=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round()),h.y>=o&&f.y>=o||(h.y>=o?h=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round():f.y>=o&&(f=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round()),l&&h.equals(l[l.length-1])||(l=[h],a.push(l)),l.push(f)))))}return a}var i=t("point-geometry");e.exports=n},{"point-geometry":424}],318:[function(t,e,r){"use strict";var n=t("../util/struct_array"),i=t("../util/util"),o=t("point-geometry"),a=e.exports=new n({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});i.extendAll(a.prototype.StructType.prototype,{get anchorPoint(){return new o(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":364,"../util/util":366,"point-geometry":424}],319:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c){var h=a.top*s-l,f=a.bottom*s+l,p=a.left*s-l,d=a.right*s+l;if(this.boxStartIndex=t.length,u){var m=f-h,g=d-p;if(m>0)if(m=Math.max(10*s,m),c){var v=e[r.segment+1].sub(e[r.segment])._unit()._mult(g),y=[r.sub(v),r.add(v)];this._addLineCollisionBoxes(t,y,r,0,g,m,n,i,o)}else this._addLineCollisionBoxes(t,e,r,r.segment,g,m,n,i,o)}else t.emplaceBack(r.x,r.y,p,h,d,f,1/0,n,i,o,0,0,0,0,0);this.boxEndIndex=t.length}e.exports=n,n.prototype._addLineCollisionBoxes=function(t,e,r,n,i,o,a,s,l){var u=o/2,c=Math.floor(i/u),h=-o/2,f=this.boxes,p=r,d=n+1,m=h;do{if(d--,0>d)return f;m-=e[d].dist(p),p=e[d]}while(m>-i/2);for(var g=e[d].dist(e[d+1]),v=0;c>v;v++){for(var y=-i/2+v*u;y>m+g;){if(m+=g,d++,d+1>=e.length)return f;g=e[d].dist(e[d+1])}var b=y-m,x=e[d],_=e[d+1],w=_.sub(x)._unit()._mult(b)._add(x)._round(),M=Math.max(Math.abs(y-h)-u/2,0),k=i/2/M;t.emplaceBack(w.x,w.y,-o/2,-o/2,o/2,o/2,k,a,s,l,0,0,0,0,0)}return f}},{}],320:[function(t,e,r){"use strict";function n(t,e,r){if("object"==typeof t){var n=t;r=e,t=n.angle,e=n.pitch,this.grid=new a(n.grid),this.ignoredGrid=new a(n.ignoredGrid)}else this.grid=new a(o,12,6),this.ignoredGrid=new a(o,12,0);this.angle=t,this.pitch=e;var i=Math.sin(t),s=Math.cos(t);if(this.rotationMatrix=[s,-i,i,s],this.reverseRotationMatrix=[s,i,-i,s],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=r,0===r.length){r.emplaceBack();var l=32767;r.emplaceBack(0,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(o,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,0,-l,0,l,0,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,o,-l,0,l,0,l,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=r.get(0),this.edges=[r.get(1),r.get(2),r.get(3),r.get(4)]}var i=t("point-geometry"),o=t("../data/bucket").EXTENT,a=t("grid-index");e.exports=n,n.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},n.prototype.minScale=.25,n.prototype.maxScale=2,n.prototype.placeCollisionFeature=function(t,e,r){for(var n=this.collisionBoxArray,o=this.minScale,a=this.rotationMatrix,s=this.yStretch,l=t.boxStartIndex;l=this.maxScale)return o}if(r){var _;if(this.angle){var w=this.reverseRotationMatrix,M=new i(u.x1,u.y1).matMult(w),k=new i(u.x2,u.y1).matMult(w),A=new i(u.x1,u.y2).matMult(w),T=new i(u.x2,u.y2).matMult(w);_=this.tempCollisionBox,_.anchorPointX=u.anchorPoint.x,_.anchorPointY=u.anchorPoint.y,_.x1=Math.min(M.x,k.x,A.x,T.x),_.y1=Math.min(M.y,k.x,A.x,T.x),_.x2=Math.max(M.x,k.x,A.x,T.x),_.y2=Math.max(M.y,k.x,A.x,T.x),_.maxScale=u.maxScale}else _=u;for(var E=0;E=this.maxScale)return o}}}return o},n.prototype.queryRenderedSymbols=function(t,e,r,n,o){var a={},s=[],l=this.collisionBoxArray,u=this.rotationMatrix,c=new i(t,e)._matMult(u),h=this.tempCollisionBox;h.anchorX=c.x,h.anchorY=c.y,h.x1=0,h.y1=0,h.x2=r-t,h.y2=n-e,h.maxScale=o,o=h.maxScale;for(var f=[c.x+h.x1/o,c.y+h.y1/o*this.yStretch,c.x+h.x2/o,c.y+h.y2/o*this.yStretch],p=this.grid.query(f[0],f[1],f[2],f[3]),d=this.ignoredGrid.query(f[0],f[1],f[2],f[3]),m=0;m=o&&(a[y][b]=!0,s.push(p[g]))}}return s},n.prototype.getPlacementScale=function(t,e,r,n,i){var o=e.x-n.x,a=e.y-n.y,s=(i.x1-r.x2)/o,l=(i.x2-r.x1)/o,u=(i.y1-r.y2)*this.yStretch/a,c=(i.y2-r.y1)*this.yStretch/a;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(u)||isNaN(c))&&(u=c=1);var h=Math.min(Math.max(s,l),Math.max(u,c)),f=i.maxScale,p=r.maxScale;return h>f&&(h=f),h>p&&(h=p),h>t&&h>=i.placementScale&&(t=h),t},n.prototype.insertCollisionFeature=function(t,e,r){for(var n=r?this.ignoredGrid:this.grid,i=this.collisionBoxArray,o=t.boxStartIndex;oe-h*s&&(e=h*s+e/4);var p=2*a,d=f?e/2*l%e:(h/2+p)*s*l%e;return i(t,d,e,c,r,h*s,f,!1,u)}function i(t,e,r,n,l,u,c,h,f){for(var p=u/2,d=0,m=0;mv+r;){v+=r;var k=(v-g)/w,A=o(x.x,_.x,k),T=o(x.y,_.y,k);if(A>=0&&f>A&&T>=0&&f>T&&v-p>=0&&d>=v+p){var E=new a(A,T,M,b)._round();n&&!s(t,E,u,n,l)||y.push(E)}}g+=w}return h||y.length||c||(y=i(t,g/2,r,n,l,u,c,!0,f)),y}var o=t("../util/interpolate"),a=t("../symbol/anchor"),s=t("./check_max_angle");e.exports=n},{"../symbol/anchor":315,"../util/interpolate":360,"./check_max_angle":316}],322:[function(t,e,r){"use strict";function n(){this.width=s,this.height=s,this.bin=new i(this.width,this.height),this.index={},this.ids={},this.data=new Uint8Array(this.width*this.height)}var i=t("shelf-pack"),o=t("../util/util"),a=4,s=128,l=2048;e.exports=n,n.prototype.getGlyphs=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]=[]),n[e].push(r);return n},n.prototype.getRects=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]={}),n[e][r]=this.index[i];return n},n.prototype.addGlyph=function(t,e,r,n){if(!r)return null;var i=e+"#"+r.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!r.bitmap)return null;var a=r.width+2*n,s=r.height+2*n,l=1,u=a+2*l,c=s+2*l;u+=4-u%4,c+=4-c%4;var h=this.bin.packOne(u,c);if(h||(this.resize(),h=this.bin.packOne(u,c)),!h)return o.warnOnce("glyph bitmap overflow"),null;this.index[i]=h,this.ids[i]=[t];for(var f=this.data,p=r.bitmap,d=0;s>d;d++)for(var m=this.width*(h.y+d+l)+h.x+l,g=a*d,v=0;a>v;v++)f[m+v]=p[g+v];return this.dirty=!0,h},n.prototype.resize=function(){var t=this.width,e=this.height;if(!(t>=l||e>=l)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=a,this.height*=a,this.bin.resize(this.width,this.height);for(var r=new ArrayBuffer(this.width*this.height),n=0;e>n;n++){var i=new Uint8Array(this.data.buffer,e*n,t),o=new Uint8Array(r,e*n*a,t);o.set(i)}this.data=new Uint8Array(r)}},n.prototype.bind=function(t){this.gl=t,this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,null))},n.prototype.updateTexture=function(t){this.bind(t),this.dirty&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data),this.dirty=!1)}},{"../util/util":366,"shelf-pack":427}],323:[function(t,e,r){"use strict";function n(t){this.url=t&&a(t),this.atlases={},this.stacks={},this.loading={}}function i(t,e,r){var n=1;this.advance=t.advance,this.left=t.left-r-n,this.top=t.top+r+n,this.rect=e}function o(t,e,r,n){return n=n||"abc",r.replace("{s}",n[t.length%n.length]).replace("{fontstack}",t).replace("{range}",e)}var a=t("../util/mapbox").normalizeGlyphsURL,s=t("../util/ajax").getArrayBuffer,l=t("../util/glyphs"),u=t("../symbol/glyph_atlas"),c=t("pbf");e.exports=n,n.prototype.getSimpleGlyphs=function(t,e,r,n){void 0===this.stacks[t]&&(this.stacks[t]={}),void 0===this.atlases[t]&&(this.atlases[t]=new u);for(var o,a={},s=this.stacks[t],l=this.atlases[t],c=3,h={},f=0,p=0;p65535)return r("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var n=this.loading[t];if(n[e])n[e].push(r);else{n[e]=[r];var i=256*e+"-"+(256*e+255),a=o(t,i,this.url);s(a,function(t,r){for(var i=!t&&new l(new c(new Uint8Array(r))),o=0;or&&(o=!o),o&&i++;var u=new s(e.x,e.y),c=n[i],h=1/0;r=Math.abs(r);for(var f=l;;){var p=u.dist(c),d=r/p,m=Math.atan2(c.y-u.y,c.x-u.x);if(o||(m+=Math.PI),t.push({anchorPoint:u,offset:a?Math.PI:0,minScale:d,maxScale:h,angle:(m+2*Math.PI)%(2*Math.PI)}),f>=d)break;for(u=c;u.equals(c);)if(i+=o?1:-1,c=n[i],!c)return d;var g=c.sub(u)._unit();u=u.sub(g._mult(p)),h=d}return f}var s=t("point-geometry");e.exports={getIconQuads:i,getGlyphQuads:o,SymbolQuad:n};var l=.5},{"point-geometry":424}],326:[function(t,e,r){"use strict";function n(t,e,r){for(var n=[],o=0,a=t.length;a>o;o++){var s=i(t[o].properties,e["text-field"]);if(s){s=s.toString();var l=e["text-transform"];"uppercase"===l?s=s.toLocaleUpperCase():"lowercase"===l&&(s=s.toLocaleLowerCase());for(var u=0;un&&null!==c){var x=v[c+1].x;g=Math.max(x,g);for(var _=c+1;y>=_;_++)v[_].y+=r,v[_].x-=x;if(a){var w=c;h[v[c].codePoint]&&w--,s(v,e,d,w,a)}d=c+1,c=null,p+=x,m++}f[b.codePoint]&&(c=y)}var M=v[v.length-1],k=M.x+e[M.codePoint].advance;g=Math.max(g,k);var A=(m+1)*r;s(v,e,d,v.length-1,a),l(v,a,i,o,g,r,m,u),t.top+=-o*A,t.bottom=t.top+A,t.left+=-i*g,t.right=t.left+g}function s(t,e,r,n,i){for(var o=e[t[n].codePoint].advance,a=(t[n].x+o)*i,s=r;n>=s;s++)t[s].x-=a}function l(t,e,r,n,i,o,a,s){for(var l=(e-r)*i+s[0],u=(-n*(a+1)+.5)*o+s[1],c=0;c=f;f++,p=((f+u)%u+n)*e+r,d+=o)for(h=-1;l>=h;h++)i[d+h]=t[p+(h+l)%l];else for(f=0;u>f;f++,p+=e,d+=o)for(h=0;l>h;h++)i[d+h]=t[p+h]}function o(t,e,r,n,i){this.rect=t,this.width=e,this.height=r,this.sdf=n,this.pixelRatio=i}var a=t("shelf-pack"),s=t("../util/browser"),l=t("../util/util");e.exports=n,n.prototype.allocateImage=function(t,e){t/=this.pixelRatio,e/=this.pixelRatio;var r=2,n=t+r+(4-(t+r)%4),i=e+r+(4-(e+r)%4),o=this.bin.packOne(n,i);return o?o:(l.warnOnce("SpriteAtlas out of space."),null)},n.prototype.getImage=function(t,e){if(this.images[t])return this.images[t];if(!this.sprite)return null;var r=this.sprite.getSpritePosition(t);if(!r.width||!r.height)return null;var n=this.allocateImage(r.width,r.height);if(!n)return null;var i=new o(n,r.width/r.pixelRatio,r.height/r.pixelRatio,r.sdf,r.pixelRatio/this.pixelRatio);return this.images[t]=i,this.copy(n,r,e),i},n.prototype.getPosition=function(t,e){var r=this.getImage(t,e),n=r&&r.rect;if(!n)return null;var i=r.width*r.pixelRatio,o=r.height*r.pixelRatio,a=1;return{size:[r.width,r.height],tl:[(n.x+a)/this.width,(n.y+a)/this.height],br:[(n.x+a+i)/this.width,(n.y+a+o)/this.height]}},n.prototype.allocate=function(){if(!this.data){var t=Math.floor(this.width*this.pixelRatio),e=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(t*e);for(var r=0;r1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},n.prototype.addIcons=function(t,e){for(var r=0;r1||(w?(clearTimeout(w),w=null,v("dblclick",e)):w=setTimeout(p,300))}function c(t){y("touchmove",t)}function h(t){y("touchend",t)}function f(t){y("touchcancel",t)}function p(){w=null}function d(t){var e=n.mousePos(b,t);e.equals(_)&&v("click",t)}function m(t){v("dblclick",t),t.preventDefault()}function g(t){x=t,t.preventDefault()}function v(e,r){var i=n.mousePos(b,r);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:r})}function y(e,r){var o=n.touchPos(b,r),a=o.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new i(0,0));return t.fire(e,{lngLat:t.unproject(a),point:a,lngLats:o.map(function(e){return t.unproject(e)},this),points:o,originalEvent:r})}var b=t.getCanvasContainer(),x=null,_=null,w=null;for(var M in o)t[M]=new o[M](t,e),e.interactive&&e[M]&&t[M].enable();b.addEventListener("mouseout",r,!1),b.addEventListener("mousedown",a,!1),b.addEventListener("mouseup",s,!1),b.addEventListener("mousemove",l,!1),b.addEventListener("touchstart",u,!1),b.addEventListener("touchend",h,!1),b.addEventListener("touchmove",c,!1),b.addEventListener("touchcancel",f,!1),b.addEventListener("click",d,!1),b.addEventListener("dblclick",m,!1),b.addEventListener("contextmenu",g,!1)}},{"../util/dom":352,"./handler/box_zoom":337,"./handler/dblclick_zoom":338,"./handler/drag_pan":339,"./handler/drag_rotate":340,"./handler/keyboard":341,"./handler/scroll_zoom":342,"./handler/touch_zoom_rotate":343,"point-geometry":424}],332:[function(t,e,r){"use strict";var n=t("../util/util"),i=t("../util/interpolate"),o=t("../util/browser"),a=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),u=e.exports=function(){};n.extend(u.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,r){return this.panTo(this.transform.center,n.extend({offset:l.convert(t).mult(-1)},e),r),this},panTo:function(t,e,r){return this.easeTo(n.extend({center:t},e),r)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,r){return this.easeTo(n.extend({zoom:t},e),r)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,r){return this.easeTo(n.extend({bearing:t},e),r)},resetNorth:function(t,e){return this.rotateTo(0,n.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())180&&(c.center.lng>0&&m.lng<0?m.lng+=360:c.center.lng<0&&m.lng>0&&(m.lng-=360));var b=c.zoomScale(g-f),x=c.point,_="center"in t?c.project(m).sub(h.div(b)):x,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),A=k/b,T=_.sub(x).mag();if("minZoom"in t){var E=n.clamp(Math.min(t.minZoom,f,g),c.minZoom,c.maxZoom),S=k/c.zoomScale(E-f);M=Math.sqrt(S/T*2)}var L=M*M,z=r(0),I=function(t){return s(z)/s(z+M*t)},P=function(t){return k*((s(z)*u(z+M*t)-o(z))/L)/T},C=(r(1)-z)/M;if(Math.abs(T)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var R=k>A?-1:1;C=Math.abs(Math.log(A/k))/M,P=function(){return 0},I=function(t){return Math.exp(R*M*t)}}if("duration"in t)t.duration=+t.duration;else{var j="screenSpeed"in t?+t.screenSpeed/M:+t.speed;t.duration=1e3*C/j}return this.zooming=!0,p!==v&&(this.rotating=!0),d!==y&&(this.pitching=!0),this.fire("movestart",e),this.fire("zoomstart",e),this._ease(function(t){var r=t*C,n=P(r);c.zoom=f+c.scaleZoom(1/I(r)),c.center=c.unproject(x.add(_.sub(x).mult(n)),w),this.rotating&&(c.bearing=i(p,v,t)),this.pitching&&(c.pitch=i(d,y,t)),this.fire("move",e),this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){this.zooming=!1,this.rotating=!1,this.pitching=!1,this.fire("zoomend",e),this.fire("moveend",e)},t),this},isEasing:function(){return!!this._abortFn},stop:function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},_ease:function(t,e,r){this._finishFn=e,this._abortFn=o.timed(function(e){t.call(this,r.easing(e)),1===e&&this._finishEase()},r.animate===!1?0:r.duration,this)},_finishEase:function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},_normalizeBearing:function(t,e){t=n.wrap(t,-180,180);var r=Math.abs(t-e);return Math.abs(t-360-e)=0)return!1;return!0}),e.join(" | ")},n.prototype=a.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",r=this._container=o.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),r},_update:function(){this._map.style&&(this._container.innerHTML=n.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":352,"../../util/util":366,"./control":334}],334:[function(t,e,r){"use strict";function n(){}var i=t("../../util/util"),o=t("../../util/evented");e.exports=n,n.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var r=this.options.position,n=t._controlCorners[r];e.className+=" mapboxgl-ctrl",-1!==r.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},i.extend(n.prototype,o)},{"../../util/evented":358,"../../util/util":366}],335:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}var i=t("./control"),o=t("../../util/browser"),a=t("../../util/dom"),s=t("../../util/util");e.exports=n;var l={enableHighAccuracy:!1,timeout:6e3};n.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=a.create("div",e+"-group",t.getContainer());return o.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=a.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),r):r},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},_error:function(t){this.fire("error",t),this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":350,"../../util/dom":352,"../../util/util":366,"./control":334}],336:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var o=t("./control"),a=t("../../util/dom"),s=t("../../util/util");e.exports=n,n.prototype=s.inherit(o,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=a.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=a.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),r},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(a.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),a.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var r=a.create("button",t,this._container);return r.type="button",r.addEventListener("click",function(){e()}),r},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":352,"../../util/util":366,"./control":334}],337:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../geo/lng_lat_bounds"),a=t("../../util/util");e.exports=n,n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,r=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,r.x),o=Math.max(e.x,r.x),a=Math.min(e.y,r.y),s=Math.max(e.y,r.y);i.setTransform(this._box,"translate("+n+"px,"+a+"px)"),this._box.style.width=o-n+"px",this._box.style.height=s-a+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,r=i.mousePos(this._el,t),n=new o(this._map.unproject(e),this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:n})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":264,"../../util/dom":352,"../../util/util":366}],338:[function(t,e,r){"use strict";function n(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=n,n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)}}},{}],339:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=n;var a=.3,s=o.bezier(0,0,a,1),l=1400,u=2500;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),r=this._map;r.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),r.transform.setLocationAtPoint(r.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),r=this._inertia;if(r.length<2)return void e();var n=r[r.length-1],i=r[0],o=n[1].sub(i[1]),c=(n[0]-i[0])/1e3;if(0===c||n[1].equals(i[1]))return void e();var h=o.mult(a/c),f=h.mag();f>l&&(f=l,h._unit()._mult(f));var p=f/(u*a),d=h.mult(-p/2);this._map.panBy(d,{duration:1e3*p,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var r=1,n=0;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":352,"../../util/util":366}],340:[function(t,e,r){"use strict";function n(t,e){this._map=t,this._el=t.getCanvasContainer(),this._bearingSnap=e.bearingSnap,a.bindHandlers(this)}var i=t("../../util/dom"),o=t("point-geometry"),a=t("../../util/util");e.exports=n;var s=.25,l=a.bezier(0,0,s,1),u=180,c=720;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),r=e.mag();200>r&&(this._center=this._startPos.add(new o(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var r=this._pos,n=i.mousePos(this._el,t),o=this._center,a=r.sub(o).angleWith(n.sub(o))/Math.PI*180,s=e.getBearing()-a,l=this._inertia,u=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,u[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,r=e.getBearing(),n=this._inertia,i=function(){Math.abs(r)p?-1:1,m=(a[0]-o[0])/1e3;if(0===p||0===m)return void i();var g=Math.abs(p*(s/m));g>u&&(g=u);var v=g/(c*s),y=d*g*(v/2);f+=y,Math.abs(e._normalizeBearing(f,0))1;var r=t.ctrlKey?1:2,n=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":352,"../../util/util":366,"point-geometry":424}],341:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=n;var i=80,o=2,a=5;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,r={originalEvent:t};if(!e.isEasing())switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),r);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),r);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-o},r):(t.preventDefault(),e.panBy([-i,0],r));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+o},r):(t.preventDefault(),e.panBy([i,0],r));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+a},r):(t.preventDefault(),e.panBy([0,-i],r));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-a,0)},r):(t.preventDefault(),e.panBy([0,i],r))}}}}},{}],342:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/browser"),a=t("../../util/util");e.exports=n;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=-1!==s.indexOf("firefox"),u=-1!==s.indexOf("safari")&&-1===s.indexOf("chrom");n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=o.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,u&&(e/=3));var r=o.now(),n=r-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=r,0!==e&&e%4.000244140625===0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(n*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var r=this._map,n=2/(1+Math.exp(-Math.abs(t/100)));0>t&&0!==n&&(n=1/n);var i=r.ease?r.ease.to:r.transform.scale,o=r.transform.scaleZoom(i*n);r.zoomTo(o,{duration:0,around:r.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":350,"../../util/dom":352,"../../util/util":366}],343:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=n;var a=.15,s=o.bezier(0,0,a,1),l=12,u=2.5,c=.15,h=4;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(r),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]),n=e.add(r).div(2),o=e.sub(r),a=o.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*o.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var u={duration:0,around:l.unproject(n)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=l.transform.scaleZoom(this._startScale*a)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),a,n]),l.easeTo(u,{originalEvent:t})}else{var f=Math.abs(1-a)>c,p=Math.abs(s)>h;p?this._gestureIntent="rotate":f&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=o,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,r=this._map;if(e.length<2)return void r.snapToNorth({},{originalEvent:t});var n=e[e.length-1],i=e[0],o=r.transform.scaleZoom(this._startScale*n[1]),c=r.transform.scaleZoom(this._startScale*i[1]),h=o-c,f=(n[0]-i[0])/1e3,p=n[2];if(0===f||o===c)return void r.snapToNorth({},{originalEvent:t});var d=h*a/f;Math.abs(d)>u&&(d=d>0?u:-u);var m=1e3*Math.abs(d/(l*a)),g=o+d*m/2e3;0>g&&(g=0),r.easeTo({zoom:g,duration:m,easing:s,around:r.unproject(p)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>2&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":352,"../../util/util":366}],344:[function(t,e,r){"use strict";function n(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=n;var i=t("../util/util");n.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3?(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0):!1},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),r=this._map.getBearing(),n=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(n)+"/"+t.lng.toFixed(n)+(r?"/"+Math.round(10*r)/10:"");window.history.replaceState("","",i)}}},{"../util/util":366}],345:[function(t,e,r){"use strict";function n(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),o=t("../util/util"),a=t("../util/browser"),s=t("../util/browser").window,l=t("../util/evented"),u=t("../util/dom"),c=t("../style/style"),h=t("../style/animation_loop"),f=t("../render/painter"),p=t("../geo/transform"),d=t("./hash"),m=t("./bind_handlers"),g=t("./camera"),v=t("../geo/lng_lat"),y=t("../geo/lng_lat_bounds"),b=t("point-geometry"),x=t("./control/attribution"),_=0,w=20,M={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:_,maxZoom:w,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,workerCount:Math.max(a.hardwareConcurrency-1,1)},k=e.exports=function(t){if(t=o.extend({},M,t),t.workerCount<1)throw new Error("workerCount must an integer greater than or equal to 1.");this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._trackResize=t.trackResize,this._workerCount=t.workerCount,this._bearingSnap=t.bearingSnap,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new h,this.transform=new p(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),o.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowOnline","_onWindowResize","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof s&&(s.addEventListener("online",this._onWindowOnline,!1),s.addEventListener("resize",this._onWindowResize,!1)),m(this,t),this._hash=t.hash&&(new d).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new x(t.attributionControl));var e=this.fire.bind(this,"error");this.on("style.error",e),this.on("source.error",e),this.on("tile.error",e),this.on("layer.error",e)};o.extend(k.prototype,l),o.extend(k.prototype,g.prototype),o.extend(k.prototype,{addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var r=this._classes.indexOf(t);return 0>r||""===t?this:(this._classes.splice(r,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var r={},n=0;n=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new y(this.transform.pointLocation(new b(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new b(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new b(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=y.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?_:t,t>=_&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&w>=t)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+w+", inclusive")},project:function(t){return this.transform.locationPoint(v.convert(t))},unproject:function(t){return this.transform.pointLocation(b.convert(t))},queryRenderedFeatures:function(){function t(t){return t instanceof b||Array.isArray(t)}var e,r={};return 2===arguments.length?(e=arguments[0],r=arguments[1]):1===arguments.length&&t(arguments[0])?e=arguments[0]:1===arguments.length&&(r=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(e),r,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[b.convert([0,0]),b.convert([this.transform.width,this.transform.height])]);var e,r=t instanceof b||"number"==typeof t[0];if(r){var n=b.convert(t);e=[n]}else{var i=[b.convert(t[0]),b.convert(t[1])];e=[i[0],new b(i[1].x,i[0].y),i[1],new b(i[0].x,i[1].y),i[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement),this.off("pitch",this.style._redoPlacement)),t?(t instanceof c?this.style=t:this.style=new c(t,this.animationLoop,this._workerCount),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){return this.style?this.style.serialize():void 0},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},addSourceType:function(t,e,r){return this.style.addSourceType(t,e,r)},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,r,n){return this.style.setPaintProperty(t,e,r,n),this._update(!0),this},getPaintProperty:function(t,e,r){return this.style.getPaintProperty(t,e,r)},setLayoutProperty:function(t,e,r){return this.style.setLayoutProperty(t,e,r),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=u.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var r=this._controlContainer=u.create("div","mapboxgl-control-container",t),n=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){n[t]=u.create("div","mapboxgl-ctrl-"+t,r)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});return t?void(this.painter=new f(t,this.transform)):void this.fire("error",{error:new Error("Failed to initialize WebGL")})},_contextLost:function(t){t.preventDefault(),this._frameId&&a.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return this._styleDirty||this._sourcesDirty?!1:!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){try{this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||!this.animationLoop.stopped())&&this._rerender()}catch(t){this.fire("error",{error:t})}return this},remove:function(){this._hash&&this._hash.remove(),a.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof s&&s.removeEventListener("resize",this._onWindowResize,!1);var t=this.painter.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),n(this._canvasContainer),n(this._controlContainer),this._container.classList.remove("mapboxgl-map")},_rerender:function(){this.style&&!this._frameId&&(this._frameId=a.frame(this._render)); +},_forwardStyleEvent:function(t){this.fire("style."+t.type,o.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowOnline:function(){this._update()},_onWindowResize:function(){this._trackResize&&this.stop().resize()._update()}}),o.extendAll(k.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":263,"../geo/lng_lat_bounds":264,"../geo/transform":265,"../render/painter":279,"../style/animation_loop":299,"../style/style":302,"../util/browser":350,"../util/canvas":351,"../util/dom":352,"../util/evented":358,"../util/util":366,"./bind_handlers":331,"./camera":332,"./control/attribution":333,"./hash":344,"point-geometry":424}],346:[function(t,e,r){"use strict";function n(t,e){t||(t=i.create("div")),t.classList.add("mapboxgl-marker"),this._el=t,this._offset=a.convert(e&&e.offset||[0,0]),this._update=this._update.bind(this)}e.exports=n;var i=t("../util/dom"),o=t("../geo/lng_lat"),a=t("point-geometry");n.prototype={addTo:function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._el),t.on("move",this._update),this._update(),this},remove:function(){this._map&&(this._map.off("move",this._update),this._map=null);var t=this._el.parentNode;return t&&t.removeChild(this._el),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=o.convert(t),this._update(),this},getElement:function(){return this._el},_update:function(){if(this._map){var t=this._map.project(this._lngLat)._add(this._offset);i.setTransform(this._el,"translate("+t.x+"px,"+t.y+"px)")}}}},{"../geo/lng_lat":263,"../util/dom":352,"point-geometry":424}],347:[function(t,e,r){"use strict";function n(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=n;var i=t("../util/util"),o=t("../util/evented"),a=t("../util/dom"),s=t("../geo/lng_lat");n.prototype=i.inherit(o,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire("close"),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,r=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=t;;){if(e=n.firstChild,!e)break;r.appendChild(e)}return this.setDOMContent(r)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=a.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=a.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=a.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=a.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var r=this._container.offsetWidth,n=this._container.offsetHeight;e=t.ythis._map.transform.height-n?["bottom"]:[],t.xthis._map.transform.width-r/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},o=this._container.classList;for(var s in i)o.remove("mapboxgl-popup-anchor-"+s);o.add("mapboxgl-popup-anchor-"+e),a.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":263,"../util/dom":352,"../util/evented":358,"../util/util":366}],348:[function(t,e,r){"use strict";function n(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=n,n.prototype.receive=function(t){function e(t,e,r){this.postMessage({type:"",id:String(i),error:t?String(t):null,data:e},r)}var r,n=t.data,i=n.id;if(""===n.type)r=this.callbacks[n.id],delete this.callbacks[n.id],r&&r(n.error||null,n.data);else if("undefined"!=typeof n.id&&this.parent[n.type])this.parent[n.type](n.data,e.bind(this));else if("undefined"!=typeof n.id&&this.parent.workerSources){var o=n.type.split(".");this.parent.workerSources[o[0]][o[1]](n.data,e.bind(this))}else this.parent[n.type](n.data)},n.prototype.send=function(t,e,r,n){var i=null;r&&(this.callbacks[i=this.callbackID++]=r),this.postMessage({type:t,id:String(i),data:e},n)},n.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],349:[function(t,e,r){"use strict";function n(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}r.getJSON=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.setRequestHeader("Accept","application/json"),r.onerror=function(t){e(t)},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var t;try{t=JSON.parse(r.response)}catch(n){return e(n)}e(null,t)}else e(new Error(r.statusText))},r.send(),r},r.getArrayBuffer=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onerror=function(t){e(t)},r.onload=function(){r.status>=200&&r.status<300&&r.response?e(null,r.response):e(new Error(r.statusText))},r.send(),r},r.getImage=function(t,e){return r.getArrayBuffer(t,function(t,r){if(t)return e(t);var n=new Image;n.onload=function(){e(null,n),(window.URL||window.webkitURL).revokeObjectURL(n.src)};var i=new Blob([new Uint8Array(r)],{type:"image/png"});return n.src=(window.URL||window.webkitURL).createObjectURL(i),n.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=n.width,t.height=n.height,e.drawImage(n,0,0),e.getImageData(0,0,n.width,n.height).data},n})},r.getVideo=function(t,e){var r=document.createElement("video");r.onloadstart=function(){e(null,r)};for(var i=0;i=s+n?t.call(i,1):(t.call(i,(l-s)/n),r.frame(o)))}if(!n)return t.call(i,1),null;var a=!1,s=e.exports.now();return r.frame(o),function(){a=!0}},r.supported=t("mapbox-gl-supported"),r.hardwareConcurrency=navigator.hardwareConcurrency||4,Object.defineProperty(r,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),r.supportsWebp=!1;var o=document.createElement("img");o.onload=function(){r.supportsWebp=!0},o.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",r.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-supported":420}],351:[function(t,e,r){"use strict";function n(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),o=t("mapbox-gl-supported");e.exports=n,n.prototype.resize=function(t,e){var r=window.devicePixelRatio||1;this.canvas.width=r*t,this.canvas.height=r*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},n.prototype.getWebGLContext=function(t){return t=i.extend({},t,o.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},n.prototype.getElement=function(){return this.canvas}},{"../util":366,"mapbox-gl-supported":420}],352:[function(t,e,r){"use strict";function n(t){for(var e=0;ei;a=i++)e=t[i],r=t[a],n+=(r.x-e.x)*(e.y+r.y);return n}var o=t("quickselect");e.exports=function(t,e){var r=t.length;if(1>=r)return[t];for(var a,s,l=[],u=0;r>u;u++){var c=i(t[u]);0!==c&&(t[u].area=Math.abs(c),void 0===s&&(s=0>c),s===0>c?(a&&l.push(a),a=[t[u]]):a.push(t[u]))}if(a&&l.push(a),e>1)for(var h=0;hr;r++){var n=new a,i=new o(n,e);i.name="Worker "+r,this.actors.push(i)}}var i=t("./util"),o=t("./actor"),a=t("./web_worker");e.exports=n,n.prototype={broadcast:function(t,e,r){r=r||function(){},i.asyncAll(this.actors,function(r,n){r.send(t,e,n)},r)},send:function(t,e,r,n,i){return("number"!=typeof n||isNaN(n))&&(n=this.currentActor=(this.currentActor+1)%this.actors.length),this.actors[n].send(t,e,r,i),n},remove:function(){for(var t=0;t=0&&this._events[t].splice(r,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var r=function(n){this.off(t,r),e.call(this,n)}.bind(this);return this.on(t,r),this},fire:function(t,e){if(!this.listens(t))return n.endsWith(t,"error")&&console.error(e&&e.error||e||"Empty error event"),this;e=n.extend({},e),n.extend(e,{type:t,target:this});for(var r=this._events[t].slice(),i=0;i=3)for(var l=0;l1){if(s(t,e))return!0;for(var n=0;n(e.y-t.y)*(r.x-t.x)}function u(t,e,r,n){return l(t,r,n)!==l(e,r,n)&&l(t,e,r)!==l(t,e,n)}function c(t,e,r){var n=r*r;if(1===e.length)return t.distSqr(e[0])i?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function f(t,e){for(var r,n,i,o=!1,a=0;ae.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o)}return o}function p(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}e.exports={multiPolygonIntersectsBufferedMultiPoint:n,multiPolygonIntersectsMultiPolygon:i,multiPolygonIntersectsBufferedMultiLine:o}},{}],362:[function(t,e,r){"use strict";function n(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=n,n.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},n.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.get(this.order[0]);r&&this.onRemove(r)}return this},n.prototype.has=function(t){return t in this.data},n.prototype.keys=function(){return this.order},n.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},n.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],363:[function(t,e,r){"use strict";function n(t,e,r){if(r=r||a.ACCESS_TOKEN,!r&&a.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,a.API_URL+e),t+=-1!==t.indexOf("?")?"&access_token=":"?access_token=",a.REQUIRE_ACCESS_TOKEN){if("s"===r[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=r}return t}function i(t){return t?"?"+t:""}function o(t){return t.access_token&&"tk."===t.access_token.slice(0,3)?u.extend({},t,{access_token:a.ACCESS_TOKEN}):t}var a=t("./config"),s=t("./browser"),l=t("url"),u=t("./util");e.exports.normalizeStyleURL=function(t,e){var r=l.parse(t);return"mapbox:"!==r.protocol?t:n("mapbox:/"+r.pathname+i(r.query),"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){var r=l.parse(t);return"mapbox:"!==r.protocol?t:n(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var r=l.parse(t);if("mapbox:"!==r.protocol)return t;var o=r.pathname.split("/")[1];return n("mapbox://"+o+"/{fontstack}/{range}.pbf"+i(r.query),"/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,r,o){var a=l.parse(t);return"mapbox:"!==a.protocol?(a.pathname+=e+r,l.format(a)):n("mapbox:/"+a.pathname+"/sprite"+e+r+i(a.query),"/styles/v1/",o)},e.exports.normalizeTileURL=function(t,e,r){var n=l.parse(t,!0);if(!e)return t;var i=l.parse(e);if("mapbox:"!==i.protocol)return t;var a=s.supportsWebp?".webp":"$1",u=s.devicePixelRatio>=2||512===r?"@2x":"";return l.format({protocol:n.protocol,hostname:n.hostname,pathname:n.pathname.replace(/(\.(?:png|jpg)\d*)/,u+a),query:o(n.query)})}},{"./browser":350,"./config":355,"./util":366,url:64}],364:[function(t,e,r){"use strict";function n(t){function e(){f.apply(this,arguments)}function r(){p.apply(this,arguments),this.members=e.prototype.members}var n=JSON.stringify(t);if(m[n])return m[n];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(f.prototype);var s=0,u=0,d=["Uint8"];return e.prototype.members=t.members.map(function(r){r={name:r.name,type:r.type,components:r.components||1},d.indexOf(r.type)<0&&d.push(r.type);var n=a(r.type);u=Math.max(u,n),r.offset=s=o(s,Math.max(t.alignment,n));for(var i=0;ithis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},p.prototype._refreshViews=function(){for(var t=0;tn;n++){var i=this.get(n);r.push(i)}return r}},{}],365:[function(t,e,r){"use strict";function n(t,e){return e.replace(/{([^{}]+)}/g,function(e,r){return r in t?t[r]:""})}e.exports=n},{}],366:[function(t,e,r){"use strict";var n=t("unitbezier"),i=t("../geo/coordinate");r.easeCubicInOut=function(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(.5>t?r:3*(t-e)+r-.75)},r.bezier=function(t,e,r,i){var o=new n(t,e,r,i);return function(t){return o.solve(t)}},r.ease=r.bezier(.25,.1,.25,1),r.clamp=function(t,e,r){return Math.min(r,Math.max(e,t))},r.wrap=function(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i},r.coalesce=function(){for(var t=0;t=0)return!0;return!1};var a={};r.warnOnce=function(t){a[t]||("undefined"!=typeof console&&console.warn(t),a[t]=!0)}},{"../geo/coordinate":262,unitbezier:433}],367:[function(t,e,r){"use strict";function n(t,e,r,n){this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,null!=t.id&&(this.id=t.id)}e.exports=n,n.prototype={type:"Feature",get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},set geometry(t){this._geometry=t},toJSON:function(){var t={};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"toJSON"!==e&&(t[e]=this[e]);return t}}},{}],368:[function(t,e,r){function n(t){return t=Math.round(t),0>t?0:t>255?255:t}function i(t){return 0>t?0:t>1?1:t}function o(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return i("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function s(t,e,r){return 0>r?r+=1:r>1&&(r-=1),1>6*r?t+(e-t)*r*6:1>2*r?e:2>3*r?t+(e-t)*(2/3-r)*6:t}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in u)return u[e].slice();if("#"===e[0]){if(4===e.length){var r=parseInt(e.substr(1),16);return r>=0&&4095>=r?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null}if(7===e.length){var r=parseInt(e.substr(1),16);return r>=0&&16777215>=r?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(-1!==i&&l+1===e.length){var c=e.substr(0,i),h=e.substr(i+1,l-(i+1)).split(","),f=1;switch(c){case"rgba":if(4!==h.length)return null;f=a(h.pop());case"rgb":return 3!==h.length?null:[o(h[0]),o(h[1]),o(h[2]),f];case"hsla":if(4!==h.length)return null;f=a(h.pop());case"hsl":if(3!==h.length)return null;var p=(parseFloat(h[0])%360+360)%360/360,d=a(h[1]),m=a(h[2]),g=.5>=m?m*(d+1):m+d-m*d,v=2*m-g;return[n(255*s(v,g,p+1/3)),n(255*s(v,g,p)),n(255*s(v,g,p-1/3)),f];default:return null}}return null}var u={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{r.parseCSSColor=l}catch(c){}},{}],369:[function(t,e,r){"use strict"; +function n(t,e,r){r=r||2;var n=e&&e.length,o=n?e[0]*r:t.length,s=i(t,0,o,r,!0),l=[];if(!s)return l;var u,c,f,p,d,m,g;if(n&&(s=h(t,e,s,r)),t.length>80*r){u=f=t[0],c=p=t[1];for(var v=r;o>v;v+=r)d=t[v],m=t[v+1],u>d&&(u=d),c>m&&(c=m),d>f&&(f=d),m>p&&(p=m);g=Math.max(f-u,p-c)}return a(s,l,r,u,c,g),l}function i(t,e,r,n,i){var o,a;if(i===I(t,e,r,n)>0)for(o=e;r>o;o+=n)a=S(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=S(o,t[o],t[o+1],a);return a&&w(a,a.next)&&(L(a),a=a.next),a}function o(t,e){if(!t)return t;e||(e=t);var r,n=t;do if(r=!1,n.steiner||!w(n,n.next)&&0!==_(n.prev,n,n.next))n=n.next;else{if(L(n),n=e=n.prev,n===n.next)return null;r=!0}while(r||n!==e);return e}function a(t,e,r,n,i,h,f){if(t){!f&&h&&m(t,n,i,h);for(var p,d,g=t;t.prev!==t.next;)if(p=t.prev,d=t.next,h?l(t,n,i,h):s(t))e.push(p.i/r),e.push(t.i/r),e.push(d.i/r),L(t),t=d.next,g=d.next;else if(t=d,t===g){f?1===f?(t=u(t,e,r),a(t,e,r,n,i,h,2)):2===f&&c(t,e,r,n,i,h):a(o(t),e,r,n,i,h,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(_(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(b(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&_(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function l(t,e,r,n){var i=t.prev,o=t,a=t.next;if(_(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=v(s,l,e,r,n),f=v(u,c,e,r,n),p=t.nextZ;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&b(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&_(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=t.prevZ;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&b(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&_(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function u(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!w(i,o)&&M(i,n,n.next,o)&&A(i,o)&&A(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),L(n),L(n.next),n=t=o),n=n.next}while(n!==t);return n}function c(t,e,r,n,i,s){var l=t;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&x(l,u)){var c=E(l,u);return l=o(l,l.next),c=o(c,c.next),a(l,e,r,n,i,s),void a(c,e,r,n,i,s)}u=u.next}l=l.next}while(l!==t)}function h(t,e,r,n){var a,s,l,u,c,h=[];for(a=0,s=e.length;s>a;a++)l=e[a]*n,u=s-1>a?e[a+1]*n:t.length,c=i(t,l,u,n,!1),c===c.next&&(c.steiner=!0),h.push(y(c));for(h.sort(f),a=0;a=n.next.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(i>=s&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&b(h>o?i:a,o,c,h,h>o?a:i,o,n.x,n.y)&&(l=Math.abs(o-n.y)/(i-n.x),(f>l||l===f&&n.x>r.x)&&A(n,t)&&(r=n,f=l)),n=n.next;return r}function m(t,e,r,n){var i=t;do null===i.z&&(i.z=v(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,g(i)}function g(t){var e,r,n,i,o,a,s,l,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;u>e&&(s++,n=n.nextZ,n);e++);for(l=u;s>0||l>0&&n;)0===s?(i=n,n=n.nextZ,l--):0!==l&&n?r.z<=n.z?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--):(i=r,r=r.nextZ,s--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1);return t}function v(t,e,r,n,i){return t=32767*(t-r)/i,e=32767*(e-n)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function y(t){var e=t,r=t;do e.x=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function x(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!k(t,e)&&A(t,e)&&A(e,t)&&T(t,e)}function _(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function w(t,e){return t.x===e.x&&t.y===e.y}function M(t,e,r,n){return w(t,e)&&w(r,n)||w(t,n)&&w(r,e)?!0:_(t,e,r)>0!=_(t,e,n)>0&&_(r,n,t)>0!=_(r,n,e)>0}function k(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&&M(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function A(t,e){return _(t.prev,t,t.next)<0?_(t,e,t.next)>=0&&_(t,t.prev,e)>=0:_(t,e,t.prev)<0||_(t,t.next,e)<0}function T(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==t);return n}function E(t,e){var r=new z(t.i,t.x,t.y),n=new z(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function S(t,e,r,n){var i=new z(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 L(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 z(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 I(t,e,r,n){for(var i=0,o=e,a=r-n;r>o;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}e.exports=n,n.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(I(t,0,o,r));if(i)for(var s=0,l=e.length;l>s;s++){var u=e[s]*r,c=l-1>s?e[s+1]*r:t.length;a-=Math.abs(I(t,u,c,r))}var h=0;for(s=0;sa;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],370:[function(t,e,r){"use strict";function n(t){return new Function("f","var p = (f && f.properties || {}); return "+i(t))}function i(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";var r="=="===e?a(t[1],t[2],"===",!1):"!="===e?a(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?a(t[1],t[2],e,!0):"any"===e?s(t.slice(1),"||"):"all"===e?s(t.slice(1),"&&"):"none"===e?c(s(t.slice(1),"||")):"in"===e?l(t[1],t.slice(2)):"!in"===e?c(l(t[1],t.slice(2))):"has"===e?u(t[1]):"!has"===e?c(u([t[1]])):"true";return"("+r+")"}function o(t){return"$type"===t?"f.type":"$id"===t?"f.id":"p["+JSON.stringify(t)+"]"}function a(t,e,r,n){var i=o(t),a="$type"===t?f.indexOf(e):JSON.stringify(e);return(n?"typeof "+i+"=== typeof "+a+"&&":"")+i+r+a}function s(t,e){return t.map(i).join(e)}function l(t,e){"$type"===t&&(e=e.map(function(t){return f.indexOf(t)}));var r=JSON.stringify(e.sort(h)),n=o(t);return e.length<=200?r+".indexOf("+n+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+n+", "+r+",0,"+(e.length-1)+")"}function u(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function h(t,e){return e>t?-1:t>e?1:0}e.exports=n;var f=["Unknown","Point","LineString","Polygon"]},{}],371:[function(t,e,r){function n(t,e){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.map(i(n,e)),t;case"Feature":return t.geometry=n(t.geometry,e),t;case"Polygon":case"MultiPolygon":return o(t,e);default:return t}}function i(t,e){return function(r){return t(r,e)}}function o(t,e){return"Polygon"===t.type?t.coordinates=a(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(i(a,e))),t}function a(t,e){e=!!e,t[0]=s(t[0],!e);for(var r=1;r=0}var u=t("geojson-area");e.exports=n},{"geojson-area":372}],372:[function(t,e,r){function n(t){if("Polygon"===t.type)return i(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,r=0;r0){e+=Math.abs(o(t[0]));for(var r=1;r2){for(var r,n,i=0;i=r&&n>=c)return t;if(u>n||r>c)return null;for(var h=[],f=0;f=r&&n>=d)h.push(m);else if(!(p>n||r>d)){var y=1===v?i(g,r,n,a):o(g,r,n,a,l,3===v);y.length&&h.push(s(m.tags,v,y,m.id))}}return h.length?h:null}function i(t,e,r,n){for(var i=[],o=0;o=e&&r>=s&&i.push(a)}return i}function o(t,e,r,n,i,o){for(var s=[],l=0;lc;c++)u=d||m[c],d=m[c+1],f=p||u[n],p=d[n],e>f?p>r?(x.push(i(u,d,e),i(u,d,r)),o||(x=a(s,x,g,v,y))):p>=e&&x.push(i(u,d,e)):f>r?e>p?(x.push(i(u,d,r),i(u,d,e)),o||(x=a(s,x,g,v,y))):r>=p&&x.push(i(u,d,r)):(x.push(u),e>p?(x.push(i(u,d,e)),o||(x=a(s,x,g,v,y))):p>r&&(x.push(i(u,d,r)),o||(x=a(s,x,g,v,y))));u=m[b-1],f=u[n],f>=e&&r>=f&&x.push(u),h=x[x.length-1],o&&h&&(x[0][0]!==h[0]||x[0][1]!==h[1])&&x.push(x[0]),a(s,x,g,v,y)}return s}function a(t,e,r,n,i){return e.length&&(e.area=r,e.dist=n,void 0!==i&&(e.outer=i),t.push(e)),[]}e.exports=n;var s=t("./feature")},{"./feature":376}],375:[function(t,e,r){"use strict";function n(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;nn?0:n>1?1:n,[r,n,0]}function s(t){for(var e,r,n=0,i=0,o=0;o1)return!1;var o=i.geometry[0].length;if(5!==o)return!1;for(var a=0;o>a;a++){var s=h.point(i.geometry[0][a],e,t.z2,t.x,t.y);if(s[0]!==-r&&s[0]!==e+r||s[1]!==-r&&s[1]!==e+r)return!1}return!0}e.exports=n;var c=t("./convert"),h=t("./transform"),f=t("./clip"),p=t("./wrap"),d=t("./tile");i.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},i.prototype.splitTile=function(t,e,r,n,i,l,c){for(var h=[t,e,r,n],p=this.options,m=p.debug,g=null;h.length;){n=h.pop(),r=h.pop(),e=h.pop(),t=h.pop();var v=1<1&&console.time("creation"),b=this.tiles[y]=d(t,v,r,n,x,e===p.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),m)){m>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(b.source=t,i){if(e===p.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,k,A,T,E,S,L=.5*p.buffer/p.extent,z=.5-L,I=.5+L,P=1+L;M=k=A=T=null,E=f(t,v,r-L,r+I,0,a,b.min[0],b.max[0]),S=f(t,v,r+z,r+P,0,a,b.min[0],b.max[0]),E&&(M=f(E,v,n-L,n+I,1,s,b.min[1],b.max[1]),k=f(E,v,n+z,n+P,1,s,b.min[1],b.max[1])),S&&(A=f(S,v,n-L,n+I,1,s,b.min[1],b.max[1]),T=f(S,v,n+z,n+P,1,s,b.min[1],b.max[1])),m>1&&console.timeEnd("clipping"),t.length&&(h.push(M||[],e+1,2*r,2*n),h.push(k||[],e+1,2*r,2*n+1),h.push(A||[],e+1,2*r+1,2*n),h.push(T||[],e+1,2*r+1,2*n+1))}else i&&(g=e)}return g},i.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,a=n.debug,s=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var c,f=t,p=e,d=r;!c&&f>0;)f--,p=Math.floor(p/2),d=Math.floor(d/2),c=this.tiles[o(f,p,d)];if(!c||!c.source)return null;if(a>1&&console.log("found parent tile z%d-%d-%d",f,p,d),u(c,i,n.buffer))return h.tile(c,i);a>1&&console.time("drilling down");var m=this.splitTile(c.source,f,p,d,t,e,r);if(a>1&&console.timeEnd("drilling down"),null!==m){var g=1<r;r++)o=i(t[r],t[u],t[c]),o>n&&(a=r,n=o);n>s?(t[a][2]=n,h.push(u),h.push(a),u=a):(c=h.pop(),u=h.pop())}}function i(t,e,r){var n=e[0],i=e[1],o=r[0],a=r[1],s=t[0],l=t[1],u=o-n,c=a-i;if(0!==u||0!==c){var h=((s-n)*u+(l-i)*c)/(u*u+c*c);h>1?(n=o,i=a):h>0&&(n+=u*h,i+=c*h)}return u=s-n,c=l-i,u*u+c*c}e.exports=n},{}],379:[function(t,e,r){"use strict";function n(t,e,r,n,o,a){for(var s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z2:e,transformed:!1,min:[2,1],max:[-1,0]},l=0;ls.max[0]&&(s.max[0]=c[0]),c[1]>s.max[1]&&(s.max[1]=c[1])}return s}function i(t,e,r,n){var i,a,s,l,u=e.geometry,c=e.type,h=[],f=r*r;if(1===c)for(i=0;if)&&(p.push(l),t.numSimplified++),t.numPoints++;3===c&&o(p,s.outer),h.push(p)}else t.numPoints+=s.length;if(h.length){var d={geometry:h,type:c,tags:e.tags||null};null!==e.id&&(d.id=e.id),t.features.push(d)}}function o(t,e){var r=a(t);0>r===e&&t.reverse()}function a(t){for(var e,r,n=0,i=0,o=t.length,a=o-1;o>i;a=i++)e=t[i],r=t[a],n+=(r[0]-e[0])*(e[1]+r[1]);return n}e.exports=n},{}],380:[function(t,e,r){"use strict";function n(t,e){if(t.transformed)return t;var r,n,o,a=t.z2,s=t.x,l=t.y;for(r=0;r0?(n=2*Math.sqrt(r+1),t[3]=.25*n,t[0]=(e[6]-e[9])/n,t[1]=(e[8]-e[2])/n,t[2]=(e[1]-e[4])/n):e[0]>e[5]&e[0]>e[10]?(n=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/n,t[0]=.25*n,t[1]=(e[1]+e[4])/n,t[2]=(e[8]+e[2])/n):e[5]>e[10]?(n=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/n,t[0]=(e[1]+e[4])/n,t[1]=.25*n,t[2]=(e[6]+e[9])/n):(n=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/n,t[0]=(e[8]+e[2])/n,t[1]=(e[6]+e[9])/n,t[2]=.25*n),t},i.fromRotationTranslationScale=function(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3],l=i+i,u=o+o,c=a+a,h=i*l,f=i*u,p=i*c,d=o*u,m=o*c,g=a*c,v=s*l,y=s*u,b=s*c,x=n[0],_=n[1],w=n[2];return t[0]=(1-(d+g))*x,t[1]=(f+b)*x,t[2]=(p-y)*x,t[3]=0,t[4]=(f-b)*_,t[5]=(1-(h+g))*_,t[6]=(m+v)*_,t[7]=0,t[8]=(p+y)*w,t[9]=(m-v)*w,t[10]=(1-(h+d))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,r,n,i){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,h=s+s,f=o*u,p=o*c,d=o*h,m=a*c,g=a*h,v=s*h,y=l*u,b=l*c,x=l*h,_=n[0],w=n[1],M=n[2],k=i[0],A=i[1],T=i[2];return t[0]=(1-(m+v))*_,t[1]=(p+x)*_,t[2]=(d-b)*_,t[3]=0,t[4]=(p-x)*w,t[5]=(1-(f+v))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(d+b)*M,t[9]=(g-y)*M,t[10]=(1-(f+m))*M,t[11]=0,t[12]=r[0]+k-(t[0]*k+t[4]*A+t[8]*T),t[13]=r[1]+A-(t[1]*k+t[5]*A+t[9]*T),t[14]=r[2]+T-(t[2]*k+t[6]*A+t[10]*T),t[15]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,h=n*s,f=i*a,p=i*s,d=i*l,m=o*a,g=o*s,v=o*l;return t[0]=1-h-d,t[1]=c+v,t[2]=f-g,t[3]=0,t[4]=c-v,t[5]=1-u-d,t[6]=p+m,t[7]=0,t[8]=f+g,t[9]=p-m,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,r,n,i,o,a){var s=1/(r-e),l=1/(i-n),u=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t},i.perspective=function(t,e,r,n,i){var o=1/Math.tan(e/2),a=1/(n-i);return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((a-s)*l*.5),t[9]=(i-o)*u*.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},i.ortho=function(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);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*u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(a+o)*u,t[15]=1,t},i.lookAt=function(t,e,r,o){var a,s,l,u,c,h,f,p,d,m,g=e[0],v=e[1],y=e[2],b=o[0],x=o[1],_=o[2],w=r[0],M=r[1],k=r[2];return Math.abs(g-w)l?(o.cross(t,e,i),o.length(t)<1e-6&&o.cross(t,r,i),o.normalize(t,t),s.setAxisAngle(n,t,Math.PI),n):l>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(o.cross(t,i,a),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+l,s.normalize(n,n))}}(),s.setAxes=function(){var t=i.create();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=a.clone,s.fromValues=a.fromValues,s.copy=a.copy,s.set=a.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,r){r=.5*r;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t},s.getAxisAngle=function(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return 0!=n?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r},s.add=a.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+a*s+i*u-o*l,t[1]=i*c+a*l+o*s-n*u,t[2]=o*c+a*u+n*l-i*s,t[3]=a*c-n*s-i*l-o*u,t},s.mul=s.multiply,s.scale=a.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+a*s,t[1]=i*l+o*s,t[2]=o*l-i*s,t[3]=a*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l-o*s,t[1]=i*l+a*s,t[2]=o*l+n*s,t[3]=a*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=i*l-n*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t},s.calculateW=function(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t},s.dot=a.dot,s.lerp=a.lerp,s.slerp=function(t,e,r,n){var i,o,a,s,l,u=e[0],c=e[1],h=e[2],f=e[3],p=r[0],d=r[1],m=r[2],g=r[3];return o=u*p+c*d+h*m+f*g,0>o&&(o=-o,p=-p,d=-d,m=-m,g=-g),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-n)*i)/a,l=Math.sin(n*i)/a):(s=1-n,l=n),t[0]=s*u+l*p,t[1]=s*c+l*d,t[2]=s*h+l*m,t[3]=s*f+l*g,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,o,a,l){return s.slerp(t,n,a,l),s.slerp(e,i,o,l),s.slerp(r,t,e,2*l*(1-l)),r}}(),s.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o,s=a?1/a:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=o*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=a.length,s.len=s.length,s.squaredLength=a.squaredLength,s.sqrLen=s.squaredLength,s.normalize=a.normalize,s.fromMat3=function(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*a+a]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+a]-e[3*a+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[a]=(e[3*a+i]+e[3*i+a])*r}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=a.exactEquals,s.equals=a.equals,e.exports=s},{"./common.js":383,"./mat3.js":386,"./vec3.js":390,"./vec4.js":391}],389:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var r=new n.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,r){return t[0]=e,t[1]=r,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1];return e*e+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,e,r,n){var i=e[0],o=e[1];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t},i.transformMat2=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t},i.transformMat2d=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],o(t,t,a),e[s]=t[0],e[s+1]=t[1];return e}}(),i.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},i.equals=function(t,e){var r=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-a)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))},e.exports=i},{"./common.js":383}],390:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(3);return t[0]=0,t[1]=0,t[2]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},i.fromValues=function(t,e,r){var i=new n.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=r,i},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},i.set=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t},i.distance=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)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2]; +return t[0]=i*l-o*s,t[1]=o*a-n*l,t[2]=n*s-i*a,t},i.lerp=function(t,e,r,n){var i=e[0],o=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t},i.hermite=function(t,e,r,n,i,o){var a=o*o,s=a*(2*o-3)+1,l=a*(o-2)+o,u=a*(o-1),c=a*(3-2*o);return t[0]=e[0]*s+r[0]*l+n[0]*u+i[0]*c,t[1]=e[1]*s+r[1]*l+n[1]*u+i[1]*c,t[2]=e[2]*s+r[2]*l+n[2]*u+i[2]*c,t},i.bezier=function(t,e,r,n,i,o){var a=1-o,s=a*a,l=o*o,u=s*a,c=3*o*s,h=3*l*a,f=l*o;return t[0]=e[0]*u+r[0]*c+n[0]*h+i[0]*f,t[1]=e[1]*u+r[1]*c+n[1]*h+i[1]*f,t[2]=e[2]*u+r[2]*c+n[2]*h+i[2]*f,t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI,i=2*n.RANDOM()-1,o=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*o,t[1]=Math.sin(r)*o,t[2]=i*e,t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return a=a||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/a,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,h=u*i+l*n-a*o,f=u*o+a*i-s*n,p=-a*n-s*i-l*o;return t[0]=c*u+p*-a+h*-l-f*-s,t[1]=h*u+p*-s+f*-a-c*-l,t[2]=f*u+p*-l+c*-s-h*-a,t},i.rotateX=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.rotateY=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.rotateZ=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}}(),i.angle=function(t,e){var r=i.fromValues(t[0],t[1],t[2]),n=i.fromValues(e[0],e[1],e[2]);i.normalize(r,r),i.normalize(n,n);var o=i.dot(r,n);return o>1?0:Math.acos(o)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=e[0],s=e[1],l=e[2];return Math.abs(r-a)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(o-l)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(l))},e.exports=i},{"./common.js":383}],391:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,r,i){var o=new n.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=r,o[3]=i,o},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+o*o)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t},i.random=function(t,e){return e=e||1,t[0]=n.RANDOM(),t[1]=n.RANDOM(),t[2]=n.RANDOM(),t[3]=n.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,h=u*i+l*n-a*o,f=u*o+a*i-s*n,p=-a*n-s*i-l*o;return t[0]=c*u+p*-a+h*-l-f*-s,t[1]=h*u+p*-s+f*-a-c*-l,t[2]=f*u+p*-l+c*-s-h*-a,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}(),i.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=e[3];return Math.abs(r-s)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))},e.exports=i},{"./common.js":383}],392:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],e=o[1],r=o[2],this.d=e+2*r;for(var a=0;a=t&&i>=e&&r>=o&&n>=o)return Array.prototype.slice.call(this.keys);var a=[],s={};return this._forEachCell(t,e,r,n,this._queryCell,a,s),a},n.prototype._queryCell=function(t,e,r,n,i,o,a){var s=this.cells[i];if(null!==s)for(var l=this.keys,u=this.bboxes,c=0;c=u[f+0]&&n>=u[f+1]?(a[h]=!0,o.push(l[h])):a[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,o,a){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;u>=h;h++)for(var f=l;c>=f;f++){var p=this.d*f+h;if(i.call(this,t,e,r,n,p,o,a))return}},n.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},n.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,r=0,n=0;n=t.stops.length)break;if(e<=t.stops[n][0])break;n++}return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:s(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e,r,n,i,o){return"function"==typeof i?function(){var a=i.apply(void 0,arguments),l=o.apply(void 0,arguments);return s(t,e,r,n,a,l)}:i.length?u(t,e,r,n,i,o):l(t,e,r,n,i,o)}function l(t,e,r,n,i,o){var a,s=n-r,l=t-r;return a=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-a)+o*a}function u(t,e,r,n,i,o){for(var a=[],s=0;s -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n" +},pattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},collisionbox:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}},e.exports.util="float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"},{path:58}],395:[function(t,e,r){"use strict";function n(t,e){this.message=(t?t+": ":"")+i.apply(i,Array.prototype.slice.call(arguments,2)),null!==e&&void 0!==e&&e.__line__&&(this.line=e.__line__)}var i=t("util").format;e.exports=n},{util:67}],396:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1;e7)return[new n(c,l,"constants have been deprecated as of v8")];if(!(l in f.constants))return[new n(c,l,'constant "%s" not found',l)];e=o({},e,{value:f.constants[l]})}return u.function&&"object"===i(l)?r(e):u.type&&s[u.type]?s[u.type](e):a(o({},e,{valueSpec:u.type?h[u.type]:u}))}},{"../error/validation_error":395,"../util/extend":396,"../util/get_type":397,"./validate_array":400,"./validate_boolean":401,"./validate_color":402,"./validate_constants":403,"./validate_enum":404,"./validate_filter":405,"./validate_function":406,"./validate_layer":408,"./validate_number":410,"./validate_object":411,"./validate_source":413,"./validate_string":414}],400:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("./validate"),o=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.valueSpec,a=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==n(e))return[new o(l,e,"array expected, %s found",n(e))];if(r.length&&e.length!==r.length)return[new o(l,e,"array length %d expected, length %d found",r.length,e.length)];if(r["min-length"]&&e.length7)return r?[new n(e,r,"constants have been deprecated as of v8")]:[];var a=i(r);if("object"!==a)return[new n(e,r,"object expected, %s found",a)];var s=[];for(var l in r)"@"!==l[0]&&s.push(new n(e+"."+l,r[l],'constants must start with "@"'));return s}},{"../error/validation_error":395,"../util/get_type":397}],404:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,r=t.value,o=t.valueSpec,a=[];return-1===o.values.indexOf(i(r))&&a.push(new n(e,r,"expected one of [%s], %s found",o.values.join(", "),r)),a}},{"../error/validation_error":395,"../util/unbundle_jsonlint":398}],405:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_enum"),o=t("../util/get_type"),a=t("../util/unbundle_jsonlint");e.exports=function s(t){var e,r=t.value,l=t.key,u=t.styleSpec,c=[];if("array"!==o(r))return[new n(l,r,"array expected, %s found",o(r))];if(r.length<1)return[new n(l,r,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:r[0],valueSpec:u.filter_operator,style:t.style,styleSpec:t.styleSpec})),a(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"==r[1]&&c.push(new n(l,r,'"$type" cannot be use with operator "%s"',r[0]));case"==":case"!=":3!=r.length&&c.push(new n(l,r,'filter array for operator "%s" must have 3 elements',r[0]));case"in":case"!in":r.length>=2&&(e=o(r[1]),"string"!==e?c.push(new n(l+"[1]",r[1],"string expected, %s found",e)):"@"===r[1][0]&&c.push(new n(l+"[1]",r[1],"filter key cannot be a constant")));for(var h=2;h=8&&(f&&!t.valueSpec["property-function"]?d.push(new n(t.key,t.value,"property functions not supported")):p&&!t.valueSpec["zoom-function"]&&d.push(new n(t.key,t.value,"zoom functions not supported"))),d}},{"../error/validation_error":395,"../util/get_type":397,"./validate":399,"./validate_array":400,"./validate_number":410,"./validate_object":411}],407:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_string");e.exports=function(t){var e=t.value,r=t.key,o=i(t);return o.length?o:(-1===e.indexOf("{fontstack}")&&o.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&o.push(new n(r,e,'"glyphs" url must include a "{range}" token')),o)}},{"../error/validation_error":395,"./validate_string":414}],408:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),o=t("./validate_object"),a=t("./validate_filter"),s=t("./validate_paint_property"),l=t("./validate_layout_property"),u=t("../util/extend");e.exports=function(t){var e=[],r=t.value,c=t.key,h=t.style,f=t.styleSpec;r.type||r.ref||e.push(new n(c,r,'either "type" or "ref" is required'));var p=i(r.type),d=i(r.ref);if(r.id)for(var m=0;mo.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,o.maximum)]:[]}},{"../error/validation_error":395,"../util/get_type":397}],411:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),o=t("./validate");e.exports=function(t){var e=t.key,r=t.value,a=t.valueSpec,s=t.objectElementValidators||{},l=t.style,u=t.styleSpec,c=[],h=i(r);if("object"!==h)return[new n(e,r,"object expected, %s found",h)];for(var f in r){var p=f.split(".")[0],d=a&&(a[p]||a["*"]),m=s[p]||s["*"];d||m?c=c.concat((m||o)({key:(e?e+".":e)+f,value:r[f],valueSpec:d,style:l,styleSpec:u,object:r,objectKey:f})):""!==e&&1!==e.split(".").length&&c.push(new n(e,r[f],'unknown property "%s"',f))}for(p in a)a[p].required&&void 0===a[p].default&&void 0===r[p]&&c.push(new n(e,r,'missing required property "%s"',p));return c}},{"../error/validation_error":395,"../util/get_type":397,"./validate":399}],412:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["paint_"+t.layerType],u=s.match(/^(.*)-transition$/);return u&&l[u[1]]&&l[u[1]].transition?n({key:e,value:a,valueSpec:o.transition,style:r,styleSpec:o}):t.valueSpec||l[s]?n({key:t.key,value:a,valueSpec:t.valueSpec||l[s],style:r,styleSpec:o}):[new i(e,a,'unknown property "%s"',s)]}},{"../error/validation_error":395,"./validate":399}],413:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),o=t("./validate_object"),a=t("./validate_enum");e.exports=function(t){var e=t.value,r=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new n(r,e,'"type" is required')];var u=i(e.type);switch(u){case"vector":case"raster":var c=[];if(c=c.concat(o({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var h in e)["type","url","tileSize"].indexOf(h)<0&&c.push(new n(r+"."+h,e[h],'a source with a "url" property may not include a "%s" property',h));return c;case"geojson":return o({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return o({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return o({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return a({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":395,"../util/unbundle_jsonlint":398,"./validate_enum":404,"./validate_object":411}],414:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,o=n(e);return"string"!==o?[new i(r,e,"string expected, %s found",o)]:[]}},{"../error/validation_error":395,"../util/get_type":397}],415:[function(t,e,r){"use strict";function n(t,e){e=e||l;var r=[];return r=r.concat(s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:u}})),e.$version>7&&t.constants&&(r=r.concat(a({key:"constants",value:t.constants,style:t,styleSpec:e}))),i(r)}function i(t){return[].concat(t).sort(function(t,e){return t.line-e.line})}function o(t){return function(){return i(t.apply(this,arguments))}}var a=t("./validate/validate_constants"),s=t("./validate/validate"),l=t("../reference/latest.min"),u=t("./validate/validate_glyphs_url");n.source=o(t("./validate/validate_source")),n.layer=o(t("./validate/validate_layer")),n.filter=o(t("./validate/validate_filter")),n.paintProperty=o(t("./validate/validate_paint_property")),n.layoutProperty=o(t("./validate/validate_layout_property")),e.exports=n},{"../reference/latest.min":417,"./validate/validate":399,"./validate/validate_constants":403,"./validate/validate_filter":405,"./validate/validate_glyphs_url":407,"./validate/validate_layer":408,"./validate/validate_layout_property":409,"./validate/validate_paint_property":412,"./validate/validate_source":413}],416:[function(t,e,r){e.exports=t("./v8.json")},{"./v8.json":418}],417:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":419}],418:[function(t,e,r){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8],doc:"Style specification version number. Must be 8.",example:8},name:{type:"string",doc:"A human-readable name for the style.",example:"Bright"},metadata:{type:"*",doc:"Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},center:{type:"array",value:"number",doc:"Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:[-73.9749,40.7736]},zoom:{type:"number",doc:"Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:12.5},bearing:{type:"number","default":0,period:360,units:"degrees",doc:"Default bearing, in degrees. The style bearing will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:29},pitch:{type:"number","default":0,units:"degrees",doc:"Default pitch, in degrees. Zero is perpendicular to the surface. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:50},sources:{required:!0,type:"sources",doc:"Data source specifications.",example:{"mapbox-streets":{type:"vector",url:"mapbox://mapbox.mapbox-streets-v6"}}},sprite:{type:"string",doc:"A base URL for retrieving the sprite image and metadata. The extensions `.png`, `.json` and scale factor `@2x.png` will be automatically appended. This property is required if any layer uses the 'sprite-image' layout property.",example:"mapbox://sprites/mapbox/bright-v8"},glyphs:{type:"string",doc:"A URL template for loading signed-distance-field glyph sets in PBF format. The URL must include `{fontstack}` and `{range}` tokens. This property is required if any layer uses the 'text-field' layout property.",example:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},transition:{type:"transition",doc:"A global transition definition to use as a default across properties.",example:{duration:300,delay:0}},layers:{required:!0,type:"array",value:"layer",doc:"Layers will be drawn in the order of this array.",example:[{id:"water",source:"mapbox-streets","source-layer":"water",type:"fill",paint:{"fill-color":"#00ffff"}}]}},sources:{"*":{type:"source",doc:"Specification of a data source. For vector and raster sources, either TileJSON or a URL to a TileJSON must be provided. For GeoJSON and video sources, a URL must be provided."}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"],doc:"The data type of the tile source."},url:{type:"string",doc:"A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://`."},tiles:{type:"array",value:"string",doc:"An array of one or more tile source URLs, as in the TileJSON spec."},minzoom:{type:"number","default":0,doc:"Minimum zoom level for which tiles are available, as in the TileJSON spec."},maxzoom:{type:"number","default":22,doc:"Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."},tileSize:{type:"number","default":512,units:"pixels",doc:"The minimum visual size to display tiles for this layer. Only configurable for raster layers."},"*":{type:"*",doc:"Other keys to configure the data source."}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"],doc:"The data type of the GeoJSON source." +},data:{type:"*",doc:"A URL to a GeoJSON file, or inline GeoJSON."},maxzoom:{type:"number","default":14,doc:"Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."},buffer:{type:"number","default":64,doc:"Tile buffer size on each side (higher means fewer rendering artifacts near tile edges but slower performance)."},tolerance:{type:"number","default":3,doc:"Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance)."},cluster:{type:"boolean","default":!1,doc:"If the data is a collection of point features, setting this to true clusters the points by radius into groups."},clusterRadius:{type:"number","default":400,doc:"Radius of each cluster when clustering points, relative to 4096 tile."},clusterMaxZoom:{type:"number",doc:"Max zoom to cluster points on. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered)."}},source_video:{type:{required:!0,type:"enum",values:["video"],doc:"The data type of the video source."},urls:{required:!0,type:"array",value:"string",doc:"URLs to video content in order of preferred format."},coordinates:{required:!0,doc:"Corners of video specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},source_image:{type:{required:!0,type:"enum",values:["image"],doc:"The data type of the image source."},url:{required:!0,type:"string",doc:"URL that points to an image"},coordinates:{required:!0,doc:"Corners of image specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},layer:{id:{type:"string",doc:"Unique layer name.",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"],doc:"Rendering type of this layer."},metadata:{type:"*",doc:"Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},ref:{type:"string",doc:"References another layer to copy `type`, `source`, `source-layer`, `minzoom`, `maxzoom`, `filter`, and `layout` properties from. This allows the layers to share processing and be more efficient."},source:{type:"string",doc:"Name of a source description to be used for this layer."},"source-layer":{type:"string",doc:"Layer to use from a vector tile source. Required if the source supports multiple layers."},minzoom:{type:"number",minimum:0,maximum:22,doc:"The minimum zoom level on which the layer gets parsed and appears on."},maxzoom:{type:"number",minimum:0,maximum:22,doc:"The maximum zoom level on which the layer gets parsed and appears on."},interactive:{type:"boolean",doc:"Enable querying of feature data from this layer for interactivity.","default":!1},filter:{type:"filter",doc:"A expression specifying conditions on source features. Only features that match the filter are displayed."},layout:{type:"layout",doc:"Layout properties for the layer."},paint:{type:"paint",doc:"Default paint properties for this layer."},"paint.*":{type:"paint",doc:"Class-specific paint properties for this layer. The class name is the part after the first dot."}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["butt","round","square"],"default":"butt",doc:"The display of line endings.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-join":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["bevel","round","miter"],"default":"miter",doc:"The display of lines when joining.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-miter-limit":{type:"number","default":2,"function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Used to automatically convert miter joins to bevel joins for sharp angles.",requires:[{"line-join":"miter"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-round-limit":{type:"number","default":1.05,"function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Used to automatically convert round joins to miter joins for shallow angles.",requires:[{"line-join":"round"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["point","line"],"default":"point",doc:"Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",doc:"Distance between two symbol anchors.",requires:[{"symbol-placement":"line"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, the icon will be visible even if it collides with other previously drawn symbols.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, other symbols can be visible even if they collide with the icon.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-optional":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.",requires:["icon-image","text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"viewport",doc:"Orientation of icon when map is rotated.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Scale factor for icon. 1 is original size, 3 triples the size.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-text-fit":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!1,values:["none","both","width","height"],"default":"none",doc:"Position and scale an icon by the its corresponding text.",requires:["icon-image","text-field"],"sdk-support":{basic:{}}},"icon-text-fit-padding":{type:"array",value:"number",length:4,"default":[0,0,0,0],units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Size of padding area around the text-fit size in clockwise order: top, right, bottom, left.",requires:["icon-image","icon-text-fit","text-field"],"sdk-support":{basic:{}}},"icon-image":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,doc:"A string with {tokens} replaced, referencing the data property to pull from.",tokens:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"degrees",doc:"Rotates the icon clockwise.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",doc:"Size of the additional area around the icon bounding box used for detecting symbol collisions.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, the icon may be flipped to prevent it from being rendered upside-down.",requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-pitch-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Aligns text to the plane of the `viewport` or the `map` when the map is pitched. Matches `text-rotation-alignment` if unspecified.",requires:["text-field"],"sdk-support":{basic:{}}},"text-rotation-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"viewport",doc:"Orientation of text when map is rotated.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-field":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":"",tokens:!0,doc:"Value to use for a text label. Feature properties are specified using tokens like {field_name}.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-font":{type:"array",value:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":["Open Sans Regular","Arial Unicode MS Regular"],doc:"Font stack to use for displaying text.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Font size.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"The maximum line width for text wrapping.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Text leading value for multi-line text.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Text tracking amount.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-justify":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["left","center","right"],"default":"center",doc:"Text justification options.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",doc:"Part of the text placed closest to the anchor.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Maximum angle change between adjacent characters.",requires:["text-field",{"symbol-placement":"line"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Rotates the text clockwise.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,doc:"Size of the additional area around the text bounding box used for detecting symbol collisions.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-keep-upright":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!0,doc:"If true, the text may be flipped vertically to prevent it from being rendered upside-down.",requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-transform":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["none","uppercase","lowercase"],"default":"none",doc:"Specifies how to capitalize text, similar to the CSS `text-transform` property.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-offset":{type:"array",doc:"Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.",value:"number",units:"ems","function":"interpolated","zoom-function":!0,"property-function":!0,length:2,"default":[0,0],requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, the text will be visible even if it collides with other previously drawn symbols.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, other symbols can be visible even if they collide with the text.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-optional":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,doc:"If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.",requires:["text-field","icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},filter:{type:"array",value:"*",doc:"A filter selects specific features from a layer."},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"],doc:"The filter operator."},geometry_type:{type:"enum",values:["Point","LineString","Polygon"],doc:"The geometry type for the filter to select."},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"],doc:"A color operation to apply."},"function":{stops:{type:"array",required:!0,doc:"An array of stops.",value:"function_stop"},base:{type:"number","default":1,minimum:0,doc:"The exponential base of the interpolation curve. It controls the rate at which the result increases. Higher values make the result increase more towards the high end of the range. With `1` the stops are interpolated linearly."},property:{type:"string",doc:"The name of a global property or feature property to use as the function input.","default":"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],doc:"The interpolation strategy to use in function evaluation.","default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2,doc:"Zoom level and value pair."},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!0,doc:"Whether or not the fill should be antialiased.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"fill-opacity":{type:"number","function":"interpolated","zoom-function":!0,"property-function":!0,"default":1,minimum:0,maximum:1,doc:"The opacity of the entire fill layer. In contrast to the fill-color, this value will also affect the 1px stroke around the fill, if the stroke is used.",transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"fill-color":{type:"color","default":"#000000",doc:"The color of the filled part of this layer. This color can be specified as rgba with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.19.0"}}},"fill-outline-color":{type:"color",doc:"The outline color of the fill. Matches the value of `fill-color` if unspecified.","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.19.0"}}},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"fill-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["fill-translate"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"fill-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0,doc:"Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},paint_line:{"line-opacity":{type:"number",doc:"The opacity at which the line will be drawn.","function":"interpolated","zoom-function":!0,"property-function":!0,"default":1,minimum:0,maximum:1,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-color":{type:"color",doc:"The color with which the line will be drawn.","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"line-pattern"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["line-translate"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Stroke thickness.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-gap-width":{type:"number","default":0,minimum:0,doc:"Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-offset":{type:"number","default":0,doc:'The line\'s offset perpendicular to its direction. Values may be positive or negative, where positive indicates "rightwards" (if you were moving in the direction of the line) and negative indicates "leftwards."',"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels","sdk-support":{basic:{js:"0.12.1",ios:"3.1.0",android:"3.0.0"}}},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Blur applied to the line, in pixels.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant","zoom-function":!0,"property-function":!0,doc:"Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"line-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0,doc:"Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Circle radius.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.18.0"}}},"circle-color":{type:"color","default":"#000000",doc:"The color of the circle.","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.18.0"}}},"circle-blur":{type:"number","default":0,doc:"Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.20.0"}}},"circle-opacity":{type:"number",doc:"The opacity at which the circle will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"},"property-function":{js:"0.20.0"}}},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"circle-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["circle-translate"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"circle-pitch-scale":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",doc:"Controls the scaling behavior of the circle when the map is pitched. The value `map` scales circles according to their apparent distance to the camera. The value `viewport` results in no pitch-related scaling.","sdk-support":{basic:{}}}},paint_symbol:{"icon-opacity":{doc:"The opacity at which the icon will be drawn.",type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,doc:"The color of the icon. This can only be used with sdf icons.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,doc:"The color of the icon's halo. Icon halos can only be used with sdf icons.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Distance of halo to the icon outline.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Fade out the halo towards the outside.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"icon-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["icon-image","icon-translate"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-opacity":{type:"number",doc:"The opacity at which the text will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-color":{type:"color",doc:"The color with which the text will be drawn.","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,doc:"The color of the text's halo, which helps it stand out from backgrounds.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"The halo's fadeout distance towards the outside.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",doc:"Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["text-field"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"text-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["text-field","text-translate"],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},paint_raster:{"raster-opacity":{type:"number",doc:"The opacity at which the image will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated","zoom-function":!0,transition:!0,units:"degrees",doc:"Rotates hues around the color wheel.","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-brightness-min":{type:"number","function":"interpolated","zoom-function":!0,doc:"Increase or reduce the brightness of the image. The value is the minimum brightness.","default":0,minimum:0,maximum:1,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-brightness-max":{type:"number","function":"interpolated","zoom-function":!0,doc:"Increase or reduce the brightness of the image. The value is the maximum brightness.","default":1,minimum:0,maximum:1,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-saturation":{type:"number",doc:"Increase or reduce the saturation of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-contrast":{type:"number",doc:"Increase or reduce the contrast of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated","zoom-function":!0,transition:!0,units:"milliseconds",doc:"Fade duration when a new tile is added.", +"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},paint_background:{"background-color":{type:"color","default":"#000000",doc:"The color with which the background will be drawn.","function":"interpolated","zoom-function":!0,transition:!0,requires:[{"!":"background-pattern"}],"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"background-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,transition:!0,doc:"Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).","sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,doc:"The opacity at which the background will be drawn.","function":"interpolated","zoom-function":!0,transition:!0,"sdk-support":{basic:{js:"0.10.0",ios:"2.0.0",android:"2.0.1"}}}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds",doc:"Time allotted for transitions to complete."},delay:{type:"number","default":0,minimum:0,units:"milliseconds",doc:"Length of time before a transition begins."}}}},{}],419:[function(t,e,r){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number","default":0,period:360,units:"degrees"},pitch:{type:"number","default":0,units:"degrees"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number","default":0},maxzoom:{type:"number","default":22},tileSize:{type:"number","default":512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number","default":14},buffer:{type:"number","default":64},tolerance:{type:"number","default":3},cluster:{type:"boolean","default":!1},clusterRadius:{type:"number","default":400},clusterMaxZoom:{type:"number"}},source_video:{type:{required:!0,type:"enum",values:["video"]},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:["image"]},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean","default":!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["butt","round","square"],"default":"butt"},"line-join":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["bevel","round","miter"],"default":"miter"},"line-miter-limit":{type:"number","default":2,"function":"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number","default":1.05,"function":"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"round"}]},visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["point","line"],"default":"point"},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["icon-image"]},"icon-optional":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"viewport",requires:["icon-image"]},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"icon-text-fit":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!1,values:["none","both","width","height"],"default":"none",requires:["icon-image","text-field"]},"icon-text-fit-padding":{type:"array",value:"number",length:4,"default":[0,0,0,0],units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image","icon-text-fit","text-field"]},"icon-image":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,tokens:!0},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"text-pitch-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],requires:["text-field"]},"text-rotation-alignment":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"viewport",requires:["text-field"]},"text-field":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":"",tokens:!0},"text-font":{type:"array",value:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-justify":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["left","center","right"],"default":"center",requires:["text-field"]},"text-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",requires:["text-field"]},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-keep-upright":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["none","uppercase","lowercase"],"default":"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems","function":"interpolated","zoom-function":!0,"property-function":!0,length:2,"default":[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["text-field"]},"text-optional":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!1,requires:["text-field","icon-image"]},visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant","zoom-function":!0,values:["visible","none"],"default":"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},geometry_type:{type:"enum",values:["Point","LineString","Polygon"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},"function":{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number","default":1,minimum:0},property:{type:"string","default":"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],"default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","zoom-function":!0,"property-function":!0,"default":!0},"fill-opacity":{type:"number","function":"interpolated","zoom-function":!0,"property-function":!0,"default":1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",requires:["fill-translate"]},"fill-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0}},paint_line:{"line-opacity":{type:"number","function":"interpolated","zoom-function":!0,"property-function":!0,"default":1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",requires:["line-translate"]},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-gap-width":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-offset":{type:"number","default":0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant","zoom-function":!0,"property-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-blur":{type:"number","default":0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map"}},paint_symbol:{"icon-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum","function":"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],"default":"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated","zoom-function":!0,transition:!0,units:"degrees"},"raster-brightness-min":{type:"number","function":"interpolated","zoom-function":!0,"default":0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number","function":"interpolated","zoom-function":!0,"default":1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0},"raster-contrast":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated","zoom-function":!0,transition:!0,units:"milliseconds"}},paint_background:{"background-color":{type:"color","default":"#000000","function":"interpolated","zoom-function":!0,transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string","function":"piecewise-constant","zoom-function":!0,transition:!0},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated","zoom-function":!0,transition:!0}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds"},delay:{type:"number","default":0,minimum:0,units:"milliseconds"}}}},{}],420:[function(t,e,r){"use strict";function n(t){return!!(i()&&o()&&a()&&s()&&l()&&u()&&c()&&h(t&&t.failIfMajorPerformanceCaveat))}function i(){return"undefined"!=typeof window&&"undefined"!=typeof document}function o(){return Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray}function a(){return Function.prototype&&Function.prototype.bind}function s(){return Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions}function l(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function u(){return"Worker"in window}function c(){return"Uint8ClampedArray"in window}function h(t){return void 0===p[t]&&(p[t]=f(t)),p[t]}function f(t){var e=document.createElement("canvas"),r=Object.create(n.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,e.probablySupportsContext?e.probablySupportsContext("webgl",r)||e.probablySupportsContext("experimental-webgl",r):e.supportsContext?e.supportsContext("webgl",r)||e.supportsContext("experimental-webgl",r):e.getContext("webgl",r)||e.getContext("experimental-webgl",r)}"undefined"!=typeof e&&e.exports?e.exports=n:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=n);var p={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],421:[function(t,e,r){"use strict";function n(t){var e;t&&t.length&&(e=t,t=e.length);var r=new Uint8Array(t||0);return e&&r.set(e),r.readUInt32LE=o.readUInt32LE,r.writeUInt32LE=o.writeUInt32LE,r.readInt32LE=o.readInt32LE,r.writeInt32LE=o.writeInt32LE,r.readFloatLE=o.readFloatLE,r.writeFloatLE=o.writeFloatLE,r.readDoubleLE=o.readDoubleLE,r.writeDoubleLE=o.writeDoubleLE,r.toString=o.toString,r.write=o.write,r.slice=o.slice,r.copy=o.copy,r._isBuffer=!0,r}function i(t){for(var e,r,n=t.length,i=[],o=0;n>o;o++){if(e=t.charCodeAt(o),e>55295&&57344>e){if(!r){e>56319||o+1===n?i.push(239,191,189):r=e;continue}if(56320>e){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);128>e?i.push(e):2048>e?i.push(e>>6|192,63&e|128):65536>e?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=n;var o,a,s,l=t("ieee754");o={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var o=e;r>o;o++){var a=this[o];127>=a?(n+=decodeURIComponent(i)+String.fromCharCode(a),i=""):i+="%"+a.toString(16)}return n+=decodeURIComponent(i)},write:function(t,e){for(var r=t===a?s:i(t),n=0;nr)return t;if(r=n[e.pos++],t+=34359738368*(127&r),128>r)return t;if(r=n[e.pos++],t+=4398046511104*(127&r),128>r)return t;if(r=n[e.pos++],t+=562949953421312*(127&r),128>r)return t;if(r=n[e.pos++],t+=72057594037927940*(127&r),128>r)return t;if(r=n[e.pos++],t+=0x8000000000000000*(127&r),128>r)return t;throw new Error("Expected varint not more than 10 bytes")}function o(t,e){e.realloc(10);for(var r=e.pos+10;t>=1;){if(e.pos>=r)throw new Error("Given varint doesn't fit into 10 bytes");var n=255&t;e.buf[e.pos++]=n|(t>=128?128:0),t/=128}}function a(t,e,r){var n=16383>=e?1:2097151>=e?2:268435455>=e?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function s(t,e){for(var r=0;r>3,o=this.pos;t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*v;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*v;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,r=this.buf;return e=r[this.pos++],t=127&e,128>e?t:(e=r[this.pos++],t|=(127&e)<<7,128>e?t:(e=r[this.pos++],t|=(127&e)<<14,128>e?t:(e=r[this.pos++],t|=(127&e)<<21,128>e?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(b>e)return e;for(var r=this.pos-2;255===this.buf[r];)r--;t>r&&(r=t),e=0;for(var n=0;r-t+1>n;n++){var i=127&~this.buf[t+n];e+=4>n?i<<7*n:i*Math.pow(2,7*n)}return-e-1},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.buf.toString("utf8",this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.slice(this.pos,t);return this.pos=t,e},readPackedVarint:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455?void o(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=t>>>7&127)))))},writeSVarint:function(t){this.writeVarint(0>t?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);var e=g.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;e>r;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&a(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,n.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,s,e)},writePackedSVarint:function(t,e){this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){this.writeMessage(t,h,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,f,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,p,e)},writePackedFixed64:function(t,e){this.writeMessage(t,d,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,m,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":421}],423:[function(t,e,r){arguments[4][54][0].apply(r,arguments)},{dup:54}],424:[function(t,e,r){"use strict";function n(t,e){this.x=t,this.y=e}e.exports=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(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)},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[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,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},_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=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n, +this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{}],425:[function(t,e,r){"use strict";function n(t,e,r,a,s){for(r=r||0,a=a||t.length-1,s=s||o;a>r;){if(a-r>600){var l=a-r+1,u=e-r+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(0>u-l/2?-1:1),p=Math.max(r,Math.floor(e-u*h/l+f)),d=Math.min(a,Math.floor(e+(l-u)*h/l+f));n(t,e,p,d,s)}var m=t[e],g=r,v=a;for(i(t,r,e),s(t[a],m)>0&&i(t,r,a);v>g;){for(i(t,g,v),g++,v--;s(t[g],m)<0;)g++;for(;s(t[v],m)>0;)v--}0===s(t[r],m)?i(t,r,v):(v++,i(t,v,a)),e>=v&&(r=v+1),v>=e&&(a=v-1)}}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function o(t,e){return e>t?-1:t>e?1:0}e.exports=n},{}],426:[function(e,r,n){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof n?r.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(e,r.firstChild);for(var n,i=document.createElement("a"),o=1;t>o;o++)i.href=arguments[o],n=i.href,e.href=n;return r.removeChild(e),n}return t})},{}],427:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?r.exports=i():"function"==typeof t&&t.amd?t(i):e.ShelfPack=i()}(this,function(){function t(t,e,r){r=r||{},this.w=t||64,this.h=e||64,this.autoResize=!!r.autoResize,this.shelves=[],this.stats={},this.count=function(t){this.stats[t]=(0|this.stats[t])+1}}function e(t,e,r){this.x=0,this.y=t,this.w=this.free=e,this.h=r}return t.prototype.pack=function(t,e){t=[].concat(t),e=e||{};for(var r,n,i,o=[],a=0;a0){for(var s=0,l=0,u=0;un.h||t>n.free||r=c||t>c)&&(h=2*Math.max(t,c)),(c>l||r>l)&&(u=2*Math.max(r,l)),this.resize(h,u),this.packOne(t,r)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var r=0;rthis.free||e>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,{x:r,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t})},{}],428:[function(t,e,r){"use strict";function n(t){return new i(t)}function i(t){this.options=p(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function o(t,e,r,n){return{x:t,y:e,zoom:1/0,id:n,numPoints:r}}function a(t,e){var r=t.geometry.coordinates;return o(u(r[0]),c(r[1]),1,e)}function s(t){return{type:"Feature",properties:l(t),geometry:{type:"Point",coordinates:[h(t.x),f(t.y)]}}}function l(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:r}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return 0>r?0:r>1?1:r}function h(t){return 360*(t-.5)}function f(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function p(t,e){for(var r in e)t[r]=e[r];return t}function d(t){return t.x}function m(t){return t.y}var g=t("kdbush");e.exports=n,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(a);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var o=+Date.now();this.trees[i+1]=g(n,d,m,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-o)}return this.trees[this.options.minZoom]=g(n,d,m,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],o=0;o=f-p)for(var d=p;f>=d;d++)s=e[2*d],l=e[2*d+1],s>=r&&i>=s&&l>=n&&o>=l&&c.push(t[d]);else{var m=Math.floor((p+f)/2);s=e[2*m],l=e[2*m+1],s>=r&&i>=s&&l>=n&&o>=l&&c.push(t[m]);var g=(h+1)%2;(0===h?s>=r:l>=n)&&(u.push(p),u.push(m-1),u.push(g)),(0===h?i>=s:o>=l)&&(u.push(m+1),u.push(f),u.push(g))}}return c}e.exports=n},{}],431:[function(t,e,r){"use strict";function n(t,e,r,o,a,s){if(!(r>=a-o)){var l=Math.floor((o+a)/2);i(t,e,l,o,a,s%2),n(t,e,r,o,l-1,s+1),n(t,e,r,l+1,a,s+1)}}function i(t,e,r,n,a,s){for(;a>n;){if(a-n>600){var l=a-n+1,u=r-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(0>u-l/2?-1:1),p=Math.max(n,Math.floor(r-u*h/l+f)),d=Math.min(a,Math.floor(r+(l-u)*h/l+f));i(t,e,r,p,d,s)}var m=e[2*r+s],g=n,v=a;for(o(t,e,n,r),e[2*a+s]>m&&o(t,e,n,a);v>g;){for(o(t,e,g,v),g++,v--;e[2*g+s]m;)v--}e[2*n+s]===m?o(t,e,n,v):(v++,o(t,e,v,a)),r>=v&&(n=v+1),v>=r&&(a=v-1)}}function o(t,e,r,n){a(t,r,n),a(e,2*r,2*n),a(e,2*r+1,2*n+1)}function a(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],432:[function(t,e,r){"use strict";function n(t,e,r,n,o,a){for(var s=[0,t.length-1,0],l=[],u=o*o;s.length;){var c=s.pop(),h=s.pop(),f=s.pop();if(a>=h-f)for(var p=f;h>=p;p++)i(e[2*p],e[2*p+1],r,n)<=u&&l.push(t[p]);else{var d=Math.floor((f+h)/2),m=e[2*d],g=e[2*d+1];i(m,g,r,n)<=u&&l.push(t[d]);var v=(c+1)%2;(0===c?m>=r-o:g>=n-o)&&(s.push(f),s.push(d-1),s.push(v)),(0===c?r+o>=m:n+o>=g)&&(s.push(d+1),s.push(h),s.push(v))}}return l}function i(t,e,r,n){var i=t-r,o=e-n;return i*i+o*o}e.exports=n},{}],433:[function(t,e,r){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}e.exports=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){"undefined"==typeof e&&(e=1e-6);var r,n,i,o,a;for(i=t,a=0;8>a;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)i)return r;if(i>n)return n;for(;n>r;){if(o=this.sampleCurveX(i),Math.abs(o-t)o?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],434:[function(t,e,r){e.exports.VectorTile=t("./lib/vectortile.js"),e.exports.VectorTileFeature=t("./lib/vectortilefeature.js"),e.exports.VectorTileLayer=t("./lib/vectortilelayer.js")},{"./lib/vectortile.js":435,"./lib/vectortilefeature.js":436,"./lib/vectortilelayer.js":437}],435:[function(t,e,r){"use strict";function n(t,e){this.layers=t.readFields(i,{},e)}function i(t,e,r){if(3===t){var n=new o(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}var o=t("./vectortilelayer");e.exports=n},{"./vectortilelayer":437}],436:[function(t,e,r){"use strict";function n(t,e,r,n,o){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=o,t.readFields(i,this,e)}function i(t,e,r){1==t?e.id=r.readVarint():2==t?o(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function o(t,e){for(var r=t.readVarint()+t.pos;t.pos=e)return[t];for(var r,n,i=[],o=0;e>o;o++){var a=s(t[o]);0!==a&&(void 0===n&&(n=0>a),n===0>a?(r&&i.push(r),r=[t[o]]):r.push(t[o]))}return r&&i.push(r),i}function s(t){for(var e,r,n=0,i=0,o=t.length,a=o-1;o>i;a=i++)e=t[i],r=t[a],n+=(r.x-e.x)*(e.y+r.y);return n}var l=t("point-geometry");e.exports=n,n.types=["Unknown","Point","LineString","Polygon"],n.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,o=0,a=0,s=[];t.pos>3}if(i--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new l(o,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},n.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-(1/0),l=1/0,u=-(1/0);t.pos>3}if(n--,1===r||2===r)i+=t.readSVarint(),o+=t.readSVarint(),a>i&&(a=i),i>s&&(s=i),l>o&&(l=o),o>u&&(u=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,s,u]},n.prototype.toGeoJSON=function(t,e,r){function i(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}var a=t("./vectortilefeature.js");e.exports=n,n.prototype.feature=function(t){if(0>t||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new a(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":436}],438:[function(t,e,r){function n(t){var e=[];for(var r in t.layers)e.push(o(t.layers[r]));var n=new c;return h.tile.write({layers:e},n),n.finish()}function i(t){var e={};for(var r in t)e[r]=new f(t[r].features),e[r].name=r;return n({layers:e})}function o(t){for(var e={name:t.name||"",version:t.version||1,extent:t.extent||4096,keys:[],values:[],features:[]},r={},n={},i=0;i>31}function l(t){for(var e=[],r=0,n=0,i=t.length,o=0;i>o;o++){var l=t[o];e.push(a(1,1));for(var u=0;ut?{sint_value:t}:{uint_value:t}:(t=JSON.stringify(t),e={string_value:t}),e.key=r+":"+t,e}var c=t("pbf"),h=t("./vector-tile-pb"),f=t("./lib/geojson_wrapper");e.exports=n,e.exports.fromVectorTileJs=n,e.exports.fromGeojsonVt=i,e.exports.GeoJSONWrapper=f},{"./lib/geojson_wrapper":439,"./vector-tile-pb":440,pbf:422}],439:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length}function i(t){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=4096}var o=t("point-geometry"),a=t("vector-tile").VectorTileFeature;e.exports=n,n.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;el;l++){var c=s[l],h=o[c].exports;if(h===t||h&&h.default===t){r=c;break}}if(!r){r=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var f={},l=0,u=s.length;u>l;l++){var c=s[l];f[c]=c}i[r]=[Function(["require","module","exports"],"("+t+")(self)"),f]}var p=Math.floor(Math.pow(16,8)*Math.random()).toString(16),d={};d[r]=r,i[p]=[Function(["require"],"var f = require("+a(r)+");(f.default ? f.default : f)(self);"),d];var m="("+n+")({"+Object.keys(i).map(function(t){return a(t)+":["+i[t][0]+","+a(i[t][1])+"]"}).join(",")+"},{},["+a(p)+"])",g=window.URL||window.webkitURL||window.mozURL||window.msURL,v=new Blob([m],{type:"text/javascript"});if(e&&e.bare)return v;var y=g.createObjectURL(v),b=new Worker(y);return b.objectURL=y,b}},{}],442:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.WhooTS=e.WhooTS||{})}(this,function(t){function e(t,e,n,i,o,a){a=a||{};var s=t+"?"+["bbox="+r(n,i,o),"format="+(a.format||"image/png"),"service="+(a.service||"WMS"),"version="+(a.version||"1.1.1"),"request="+(a.request||"GetMap"),"srs="+(a.srs||"EPSG:3857"),"width="+(a.width||256),"height="+(a.height||256),"layers="+e].join("&");return s}function r(t,e,r){e=Math.pow(2,r)-e-1;var i=n(256*t,256*e,r),o=n(256*(t+1),256*(e+1),r);return i[0]+","+i[1]+","+o[0]+","+o[1]}function n(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=t*n-2*Math.PI*6378137/2,o=e*n-2*Math.PI*6378137/2;return[i,o]}t.getURL=e,t.getTileBBox=r,t.getMercCoords=n,Object.defineProperty(t,"__esModule",{value:!0})})},{}],443:[function(t,e,r){e.exports={name:"mapbox-gl",description:"A WebGL interactive maps library",version:"0.22.0",main:"js/mapbox-gl.js",license:"BSD-3-Clause",repository:{type:"git",url:"git://github.com/mapbox/mapbox-gl-js.git"},engines:{node:">=4.0.0"},dependencies:{csscolorparser:"^1.0.2",earcut:"^2.0.3","feature-filter":"^2.2.0","geojson-rewind":"^0.1.0","geojson-vt":"^2.4.0","gl-matrix":"^2.3.1","grid-index":"^1.0.0","mapbox-gl-function":"^1.2.1","mapbox-gl-shaders":"github:mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747","mapbox-gl-style-spec":"github:mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae","mapbox-gl-supported":"^1.2.0",pbf:"^1.3.2",pngjs:"^2.2.0","point-geometry":"^0.0.0",quickselect:"^1.0.0",request:"^2.39.0","resolve-url":"^0.2.1","shelf-pack":"^1.0.0",supercluster:"^2.0.1",unassertify:"^2.0.0",unitbezier:"^0.0.0","vector-tile":"^1.3.0","vt-pbf":"^2.0.2",webworkify:"^1.3.0","whoots-js":"^2.0.0"},devDependencies:{async:"^2.0.1","babel-preset-react":"^6.11.1",babelify:"^7.3.0",benchmark:"~2.1.0",browserify:"^13.0.0","browserify-middleware":"^7.0.0",clipboard:"^1.5.12","concat-stream":"1.5.1",coveralls:"^2.11.8",doctrine:"^1.2.1",documentation:"https://github.com/documentationjs/documentation/archive/bb41619c734e59ef3fbc3648610032efcfdaaace.tar.gz","documentation-theme-utils":"3.0.0",envify:"^3.4.0",eslint:"^2.5.3","eslint-config-mourner":"^2.0.0","eslint-plugin-html":"^1.5.1",express:"^4.13.4",gl:"^4.0.1",handlebars:"4.0.5","highlight.js":"9.3.0",istanbul:"^0.4.2","json-loader":"^0.5.4",lodash:"^4.13.1","mapbox-gl-test-suite":"github:mapbox/mapbox-gl-test-suite#1619d84e76ff3434becd51237720d370c7405ee5","memory-fs":"^0.3.0",minifyify:"^7.0.1",nyc:"6.4.0",proxyquire:"^1.7.9",react:"^15.3.0","react-dom":"^15.3.0",remark:"4.2.2","remark-html":"3.0.0",sinon:"^1.15.4",st:"^1.0.0",tap:"^5.7.0",through:"^2.3.7","transform-loader":"^0.2.3","unist-util-visit":"1.1.0",vinyl:"1.1.1","vinyl-fs":"2.4.3",watchify:"^3.2.2",webpack:"^1.13.1","webworkify-webpack":"^1.1.3"},browserify:{transform:["unassertify"]},browser:{"./js/util/ajax.js":"./js/util/browser/ajax.js","./js/util/browser.js":"./js/util/browser/browser.js","./js/util/canvas.js":"./js/util/browser/canvas.js","./js/util/dom.js":"./js/util/browser/dom.js","./js/util/web_worker.js":"./js/util/browser/web_worker.js"},scripts:{"build-dev":"browserify js/mapbox-gl.js --debug --ignore-transform unassertify --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js","build-docs":"documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/","build-min":"browserify js/mapbox-gl.js --debug --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js","//":"The 'build' script is invoked by publisher when publishing docs on the mb-pages branch",build:"npm run build-docs",lint:"eslint js test bench server.js docs/_posts/examples/*.html","open-changed-examples":"git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open","start-docs":"npm run build-min && npm run build-docs && jekyll serve -w",start:"node server.js","test-suite":"node test/render.test.js && node test/query.test.js",test:"npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js"},gitHead:"98461d3e2db6369cbcb66d70595e3032558fba9d",bugs:{url:"https://github.com/mapbox/mapbox-gl-js/issues"},homepage:"https://github.com/mapbox/mapbox-gl-js#readme",_id:"mapbox-gl@0.22.0",_shasum:"7fb1d70984dc7d8671abcd09ef6ab5fb98c0a310",_from:"mapbox-gl@latest",_npmVersion:"2.15.5",_nodeVersion:"4.4.5",_npmUser:{name:"lucaswoj",email:"lucas@lucaswoj.com"},dist:{shasum:"7fb1d70984dc7d8671abcd09ef6ab5fb98c0a310",tarball:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.0.tgz"},maintainers:[{name:"aaronlidman",email:"aaronlidman@gmail.com"},{name:"ajashton",email:"aj.ashton@gmail.com"},{name:"ansis",email:"ansis.brammanis@gmail.com"},{name:"bergwerkgis",email:"wb@bergwerk-gis.at"},{name:"bhousel",email:"bryan@mapbox.com"},{name:"bsudekum",email:"bobby@mapbox.com"},{name:"camilleanne",email:"camille@mapbox.com"},{name:"dnomadb",email:"damon@mapbox.com"},{name:"dthompson",email:"dthompson@gmail.com"},{name:"emilymcafee",email:"emily@mapbox.com"},{name:"flippmoke",email:"flippmoke@gmail.com"},{name:"freenerd",email:"spam@freenerd.de"},{name:"gretacb",email:"carol@mapbox.com"},{name:"ian29",email:"ian.villeda@gmail.com"},{name:"ianshward",email:"ian@mapbox.com"},{name:"ingalls",email:"nicholas.ingalls@gmail.com"},{name:"jfirebaugh",email:"john.firebaugh@gmail.com"},{name:"jrpruit1",email:"jake@jakepruitt.com"},{name:"karenzshea",email:"karen@mapbox.com"},{name:"kkaefer",email:"kkaefer@gmail.com"},{name:"lbud",email:"lauren@mapbox.com"},{name:"lucaswoj",email:"lucas@lucaswoj.com"},{name:"lxbarth",email:"alex@mapbox.com"},{name:"lyzidiamond",email:"lyzi@mapbox.com"},{name:"mapbox-admin",email:"accounts@mapbox.com"},{name:"mateov",email:"matt@mapbox.com"},{name:"mcwhittemore",email:"mcwhittemore@gmail.com"},{name:"miccolis",email:"jeff@miccolis.net"},{name:"mikemorris",email:"michael.patrick.morris@gmail.com"},{name:"morganherlocker",email:"morgan.herlocker@gmail.com"},{name:"mourner",email:"agafonkin@gmail.com"},{name:"nickidlugash",email:"nicki@mapbox.com"},{name:"rclark",email:"ryan.clark.j@gmail.com"},{name:"samanbb",email:"saman@mapbox.com"},{name:"sbma44",email:"tlee@mapbox.com"},{name:"scothis",email:"scothis@gmail.com"},{name:"sgillies",email:"sean@mapbox.com"},{name:"springmeyer",email:"dane@mapbox.com"},{name:"themarex",email:"patrick@mapbox.com"},{name:"tmcw",email:"tom@macwright.org"},{name:"tristen",email:"tristen.brown@gmail.com"},{name:"willwhite",email:"will@mapbox.com"},{name:"yhahn",email:"young@mapbox.com"}],_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/mapbox-gl-0.22.0.tgz_1471021366539_0.7491761057171971"},directories:{},_resolved:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.0.tgz"}},{}],444:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==m.alt,m.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==m.shift,m.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==m.control,m.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==m.meta,m.meta=!!t.metaKey),e}function n(t,n){var o=i.x(n),a=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==f||o!==p||a!==d||r(n))&&(f=0|t,p=o||0,d=a||0,e(f,p,d,m))}function o(t){n(0,t)}function a(){(f||p||d||m.shift||m.alt||m.meta||m.control)&&(p=d=0,f=0,m.shift=m.alt=m.control=m.meta=!1,e(0,0,0,m))}function s(t){r(t)&&e(f,p,d,m)}function l(t){0===i.buttons(t)?n(0,t):n(f,t)}function u(t){n(f|i.buttons(t),t)}function c(t){n(f&~i.buttons(t),t)}function h(){g||(g=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",o),t.addEventListener("mouseenter",o),t.addEventListener("mouseout",o),t.addEventListener("mouseover",o),t.addEventListener("blur",a),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",a),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var f=0,p=0,d=0,m={shift:!1,alt:!1,control:!1,meta:!1},g=!1;h();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return g},set:function(t){t&&h()},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return p},enumerable:!0},y:{get:function(){return d},enumerable:!0},mods:{get:function(){return m},enumerable:!0}}),v}e.exports=n;var i=t("mouse-event")},{"mouse-event":445}],445:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0&&r=0&&r+1=0&&n=0&&n+1=0&&s=0&&s+1=0&&i=0&&i+1=0&&l=0&&l+1=0&&f=0&&f+1e;++e)r=+arguments[e+1],i[e]=Math.floor(r),o[e]=r-i[e],a[e]=0<=i[e]&&i[e]e;++e){for(u=1,c=t.offset,l=0;n>l;++l)if(e&1<r;++r){t[r]=a[(n+1)*n+r];for(var i=0;n>i;++i)t[r]+=a[(n+1)*i+r]*e[i]}for(var o=a[(n+1)*(n+1)-1],i=0;n>i;++i)o+=a[(n+1)*i+n]*e[i];for(var s=1/o,r=0;n>r;++r)t[r]*=s;return t}),t}var i=t("ndarray-warp"),o=t("gl-matrix-invert");e.exports=n},{"gl-matrix-invert":450,"ndarray-warp":453}],455:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var h=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=a({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=a({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=a({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":120}],456:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;te&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var o="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}",a=new Function(o);return a()}if(0===e){var o="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}",a=new Function("TrivialArray",o);return a(h[t][0])}var o=["'use strict'"],s=l(e),u=s.map(function(t){return"i"+t}),c="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),f=s.map(function(t){return"b"+t}).join(","),p=s.map(function(t){return"c"+t}).join(",");o.push("function "+r+"(a,"+f+","+p+",d){this.data=a","this.shape=["+f+"]","this.stride=["+p+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),o.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>e?(o.push("function "+r+"_order(){"),2===e?o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?o.push("return this.data.set("+c+",v)}"):o.push("return this.data["+c+"]=v}"),o.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?o.push("return this.data.get("+c+")}"):o.push("return this.data["+c+"]}"),o.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),o.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var d=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),m=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+d.join(",")+","+m.join(","));for(var g=0;e>g;++g)o.push("if(typeof i"+g+"==='number'&&i"+g+">=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),o.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var g=0;e>g;++g)o.push("if(typeof i"+g+"==='number'){d=i"+g+"|0;if(d<0){c+=b"+g+"*(a"+g+"-1);a"+g+"=ceil(-a"+g+"/d)}else{a"+g+"=ceil(a"+g+"/d)}b"+g+"*=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");for(var v=new Array(e),y=new Array(e),g=0;e>g;++g)v[g]="a[i"+g+"]",y[g]="b[i"+g+"]";o.push("proto.transpose=function "+r+"_transpose("+u+"){"+u.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+v.join(",")+","+y.join(",")+",this.offset)}"),o.push("proto.pick=function "+r+"_pick("+u+"){var a=[],b=[],c=this.offset");for(var g=0;e>g;++g)o.push("if(typeof i"+g+"==='number'&&i"+g+">=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var a=new Function("CTOR_LIST","ORDER",o.join("\n"));return a(h[t],i)}function a(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=h.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;s>l;++l)r[l]<0&&(n-=(e[l]-1)*r[l])}for(var c=a(t),f=h[c];f.length<=s+1;)f.push(o(c,f.length-1));var i=f[s+1];return i(t,e,r,n)}var l=t("iota-array"),u=t("is-buffer"),c="undefined"!=typeof Float64Array,h={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s},{"iota-array":250,"is-buffer":251}],457:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,o="");r>o.length&&e>0&&(1&e&&(o+=t),e>>=1);)t+=t;return o.substr(0,r)}var i,o="";e.exports=n},{}],458:[function(t,e,r){(function(t){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],459:[function(t,e,r){"use strict";function n(t){for(var e="robustLinearSolve"+t+"d",r=["function ",e,"(A,b){return ["],n=0;t>n;++n){r.push("det([");for(var i=0;t>i;++i){i>0&&r.push(","),r.push("[");for(var o=0;t>o;++o)o>0&&r.push(","),o===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",o,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var a=new Function("det",r.join(""));return a(6>t?s[t]:s)}function i(){return[0]}function o(t,e){return[[e[0]],[t[0][0]]]}function a(){for(;u.lengthi;++i)t.push("s"+i),r.push("case ",i,":return s",i,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);e.exports=o.apply(void 0,u.concat([u,n]));for(var i=0;l>i;++i)e.exports[i]=u[i]}var s=t("robust-determinant"),l=6,u=[i,o];a()},{"robust-determinant":461}],460:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var o=r,a=t[i];r=o+a;var s=r-o,l=a-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;e>i;++i){var o=t[i],a=r;r=o+a;var s=r-o,l=a-s;l&&(t[u++]=l)}return t[u++]=r,t.length=u,t}e.exports=n},{}],461:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m[",r,"][",n,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;rn;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var i=Function.apply(void 0,t);e.exports=i.apply(void 0,m.concat([m,l]));for(var n=0;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;ru;++u)0===(1&u)?e.push.apply(e,s(n(o,u))):r.push.apply(r,s(n(o,u))),l.push("m"+u);var c=a(e),m=a(r),g="orientation"+t+"Exact",v=["function ",g,"(",l.join(),"){var p=",c,",n=",m,",d=sub(p,n);return d[d.length-1];};return ",g].join(""),y=new Function("sum","prod","scale","sub",v);return y(f,h,p,d)}function u(t){var e=_[t.length];return e||(e=_[t.length]=l(t.length)),e.apply(void 0,t)}function c(){for(;_.length<=m;)_.push(l(_.length));for(var t=[],r=["slow"],n=0;m>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;m>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i=n;++n)e.exports[n]=_[n]}var h=t("two-product"),f=t("robust-sum"),p=t("robust-scale"),d=t("robust-subtract"),m=5,g=1.1102230246251565e-16,v=(3+16*g)*g,y=(7+56*g)*g,b=l(3),x=l(4),_=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,r){var n,i=(t[1]-r[1])*(e[0]-r[0]),o=(t[0]-r[0])*(e[1]-r[1]),a=i-o;if(i>0){if(0>=o)return a;n=i+o}else{if(!(0>i))return a;if(o>=0)return a;n=-(i+o)}var s=v*n;return a>=s||-s>=a?a:b(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],o=e[0]-n[0],a=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],u=r[1]-n[1],c=t[2]-n[2],h=e[2]-n[2],f=r[2]-n[2],p=o*u,d=a*l,m=a*s,g=i*u,v=i*l,b=o*s,_=c*(p-d)+h*(m-g)+f*(v-b),w=(Math.abs(p)+Math.abs(d))*Math.abs(c)+(Math.abs(m)+Math.abs(g))*Math.abs(h)+(Math.abs(v)+Math.abs(b))*Math.abs(f),M=y*w;return _>M||-_>M?_:x(t,e,r,n)}];c()},{"robust-scale":463,"robust-subtract":464,"robust-sum":465,"two-product":479}],463:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if(1===r){var n=i(t[0],e);return n[0]?n:[n[1]]}var a=new Array(2*r),s=[.1,.1],l=[.1,.1],u=0;i(t[0],e,s),s[0]&&(a[u++]=s[0]);for(var c=1;r>c;++c){i(t[c],e,l);var h=s[1];o(h,l[0],s),s[0]&&(a[u++]=s[0]);var f=l[1],p=s[1],d=f+p,m=d-f,g=p-m;s[1]=d,g&&(a[u++]=g)}return s[1]&&(a[u++]=s[1]),0===u&&(a[u++]=0),a.length=u,a}var i=t("two-product"),o=t("two-sum");e.exports=n},{"two-product":479,"two-sum":480}],464:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,o=e-n,a=t-i,s=a+o;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var o,a,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,p=t[c],d=f(p),m=-e[h],g=f(m);g>d?(a=p,c+=1,r>c&&(p=t[c],d=f(p))):(a=m,h+=1,i>h&&(m=-e[h],g=f(m))),r>c&&g>d||h>=i?(o=p,c+=1,r>c&&(p=t[c],d=f(p))):(o=m,h+=1,i>h&&(m=-e[h],g=f(m)));for(var v,y,b,x,_,w=o+a,M=w-o,k=a-M,A=k,T=w;r>c&&i>h;)g>d?(o=p,c+=1,r>c&&(p=t[c],d=f(p))):(o=m,h+=1,i>h&&(m=-e[h],g=f(m))),a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),v=T+w,y=v-T,b=v-y,x=w-y,_=T-b,A=_+x,T=v;for(;r>c;)o=p,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),v=T+w,y=v-T,b=v-y,x=w-y,_=T-b,A=_+x,T=v,c+=1,r>c&&(p=t[c]);for(;i>h;)o=m,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),v=T+w,y=v-T,b=v-y,x=w-y,_=T-b,A=_+x,T=v,h+=1,i>h&&(m=-e[h]);return A&&(l[u++]=A),T&&(l[u++]=T),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],465:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,o=e-n,a=t-i,s=a+o;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],e[0]);var o,a,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,p=t[c],d=f(p),m=e[h],g=f(m);g>d?(a=p,c+=1,r>c&&(p=t[c],d=f(p))):(a=m,h+=1,i>h&&(m=e[h],g=f(m))),r>c&&g>d||h>=i?(o=p,c+=1,r>c&&(p=t[c],d=f(p))):(o=m,h+=1,i>h&&(m=e[h],g=f(m)));for(var v,y,b,x,_,w=o+a,M=w-o,k=a-M,A=k,T=w;r>c&&i>h;)g>d?(o=p,c+=1,r>c&&(p=t[c],d=f(p))):(o=m,h+=1,i>h&&(m=e[h],g=f(m))),a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),v=T+w,y=v-T,b=v-y,x=w-y,_=T-b,A=_+x,T=v;for(;r>c;)o=p,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),v=T+w,y=v-T,b=v-y,x=w-y,_=T-b,A=_+x,T=v,c+=1,r>c&&(p=t[c]);for(;i>h;)o=m,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),v=T+w,y=v-T,b=v-y,x=w-y,_=T-b,A=_+x,T=v,h+=1,i>h&&(m=e[h]);return A&&(l[u++]=A),T&&(l[u++]=T),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],466:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],467:[function(t,e,r){"use strict";function n(t){return"a"+t}function i(t){return"d"+t}function o(t,e){return"c"+t+"_"+e}function a(t){return"s"+t}function s(t,e){return"t"+t+"_"+e}function l(t){return"o"+t}function u(t){return"x"+t}function c(t){return"p"+t}function h(t,e){return"d"+t+"_"+e}function f(t){return"i"+t}function p(t,e){return"u"+t+"_"+e}function d(t){return"b"+t}function m(t){return"y"+t}function g(t){return"e"+t}function v(t){return"v"+t}function y(t,e,r){for(var n=0,i=0;t>i;++i)e&1<e;++e)F.push(c(e),"+=",p(e,x[t]),";");F.push("}")}function I(t){for(var e=t-1;e>=0;--e)L(e,0);for(var r=[],e=0;j>e;++e)S[e]?r.push(i(e)+".get("+c(e)+")"):r.push(i(e)+"["+c(e)+"]");for(var e=0;b>e;++e)r.push(u(e));F.push(M,"[",T,"++]=phase(",r.join(),");");for(var e=0;t>e;++e)z(e);for(var n=0;j>n;++n)F.push(c(n),"+=",p(n,x[t]),";")}function P(t){for(var e=0;j>e;++e)S[e]?F.push(o(e,0),"=",i(e),".get(",c(e),");"):F.push(o(e,0),"=",i(e),"[",c(e),"];");for(var r=[],e=0;j>e;++e)r.push(o(e,0));for(var e=0;b>e;++e)r.push(u(e));F.push(d(0),"=",M,"[",T,"]=phase(",r.join(),");");for(var n=1;1<n;++n)F.push(d(n),"=",M,"[",T,"+",g(n),"];");for(var a=[],n=1;1<n;++n)a.push("("+d(0)+"!=="+d(n)+")");F.push("if(",a.join("||"),"){");for(var s=[],e=0;D>e;++e)s.push(f(e));for(var e=0;j>e;++e){s.push(o(e,0));for(var n=1;1<n;++n)S[e]?F.push(o(e,n),"=",i(e),".get(",c(e),"+",h(e,n),");"):F.push(o(e,n),"=",i(e),"[",c(e),"+",h(e,n),"];"),s.push(o(e,n))}for(var e=0;1<e;++e)s.push(d(e));for(var e=0;b>e;++e)s.push(u(e));F.push("vertex(",s.join(),");",v(0),"=",w,"[",T,"]=",k,"++;");for(var l=(1<n;++n)if(0===(t&~(1<0;_=_-1&m)x.push(w+"["+T+"+"+g(_)+"]");x.push(v(0));for(var _=0;j>_;++_)1&n?x.push(o(_,l),o(_,m)):x.push(o(_,m),o(_,l));1&n?x.push(p,y):x.push(y,p);for(var _=0;b>_;++_)x.push(u(_));F.push("if(",p,"!==",y,"){","face(",x.join(),")}")}F.push("}",T,"+=1;")}function C(){for(var t=1;1<t;++t)F.push(E,"=",g(t),";",g(t),"=",m(t),";",m(t),"=",E,";")}function R(t,e){if(0>t)return void P(e);I(t),F.push("if(",a(x[t]),">0){",f(x[t]),"=1;"),R(t-1,e|1<r;++r)F.push(c(r),"+=",p(r,x[t]),";");t===D-1&&(F.push(T,"=0;"),C()),L(t,2),R(t-1,e),t===D-1&&(F.push("if(",f(x[D-1]),"&1){",T,"=0;}"),C()),z(t),F.push("}")}var j=S.length,D=x.length;if(2>D)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var O="extractContour"+x.join("_"),F=[],N=[],B=[],U=0;j>U;++U)B.push(n(U));for(var U=0;b>U;++U)B.push(u(U));for(var U=0;D>U;++U)N.push(a(U)+"="+n(0)+".shape["+U+"]|0");for(var U=0;j>U;++U){N.push(i(U)+"="+n(U)+".data",l(U)+"="+n(U)+".offset|0");for(var V=0;D>V;++V)N.push(s(U,V)+"="+n(U)+".stride["+V+"]|0")}for(var U=0;j>U;++U){N.push(c(U)+"="+l(U)),N.push(o(U,0));for(var V=1;1<V;++V){for(var q=[],G=0;D>G;++G)V&1<U;++U)for(var V=0;D>V;++V){var H=[s(U,x[V])];V>0&&H.push(s(U,x[V-1])+"*"+a(x[V-1])),N.push(p(U,x[V])+"=("+H.join("-")+")|0")}for(var U=0;D>U;++U)N.push(f(U)+"=0");N.push(k+"=0");for(var X=["2"],U=D-2;U>=0;--U)X.push(a(x[U]));N.push(A+"=("+X.join("*")+")|0",M+"=mallocUint32("+A+")",w+"=mallocUint32("+A+")",T+"=0"),N.push(d(0)+"=0");for(var V=1;1<V;++V){for(var Y=[],W=[],G=0;D>G;++G)V&1<n&&e("Must have at least one array argument");var i=t.scalarArguments||0;0>i&&e("Scalar arg count must be > 0"),"function"!=typeof t.vertex&&e("Must specify vertex creation function"),"function"!=typeof t.cell&&e("Must specify cell creation function"),"function"!=typeof t.phase&&e("Must specify phase function");for(var o=t.getters||[],a=new Array(n),s=0;n>s;++s)o.indexOf(s)>=0?a[s]=!0:a[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,a)}var _=t("typedarray-pool");e.exports=x;var w="V",M="P",k="N",A="Q",T="X",E="T"},{"typedarray-pool":481}],468:[function(t,e,r){function n(t){if(0>t)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,o=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function l(t){if(.5>t)return Math.PI/(Math.sin(Math.PI*t)*l(1-t));if(t>100)return Math.exp(n(t));t-=1;for(var e=o[0],r=1;i+2>r;r++)e+=o[r]/(t+r);var a=t+i+.5;return Math.sqrt(2*Math.PI)*Math.pow(a,t+.5)*Math.exp(-a)*e},e.exports.log=n},{}],469:[function(t,e,r){"use strict";function n(t){var e=t.length;if(i>e){for(var r=1,n=0;e>n;++n)for(var a=0;n>a;++a)if(t[n]n;++n)s[n]=0;for(var r=1,n=0;e>n;++n)if(!s[n]){var l=1;s[n]=1;for(var a=t[n];a!==n;a=t[a]){if(s[a])return o.freeUint8(s),0;l+=1,s[a]=1}1&l||(r=-r)}return o.freeUint8(s),r}e.exports=n;var i=32,o=t("typedarray-pool")},{"typedarray-pool":481}],470:[function(t,e,r){"use strict";function n(t){var e=t.length;switch(e){case 0:case 1:return 0;case 2:return t[1]}var r,n,i,s=o.mallocUint32(e),l=o.mallocUint32(e),u=0;for(a(t,l),i=0;e>i;++i)s[i]=t[i];for(i=e-1;i>0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return o.freeUint32(l),o.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,o,a=1;for(r[0]=0,o=1;t>o;++o)r[o]=o,a=a*o|0;for(o=t-1;o>0;--o)n=e/a|0,e=e-n*a|0,a=a/o|0,i=0|r[o],r[o]=0|r[n],r[n]=0|i;return r}var o=t("typedarray-pool"),a=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":471,"typedarray-pool":481}],471:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;rt)return[];if(0===t)return[[0]];for(var e=0|Math.round(a(t+1)),r=[],n=0;e>n;++n){for(var s=i.unrank(t,n),l=[0],u=0,c=0;c= 0) !== (_inline_1_db >= 0)) {\n _inline_1_arg2_.push(_inline_1_arg4_[0] + 0.5 + 0.5 * (_inline_1_da + _inline_1_db) / (_inline_1_da - _inline_1_db))\n }\n }",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg3_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:["_inline_1_da","_inline_1_db"]},funcName:"zeroCrossings"})},{"cwise-compiler":120}],474:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":473}],475:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var o=[],l=[],u=0;r>u;++u)o.push("d"+u),l.push("d"+u);for(var u=0;1<u;++u)o.push("v"+u),l.push("v"+u);for(var u=0;1<u;++u)o.push("p"+u),l.push("p"+u);o.push("a","b","c"),l.push("a","c"),n.push("vertex:function vertexFunc(",o.join(),"){");for(var c=[],u=0;1<u;++u)c.push("(p"+u+"<<"+u+")");n.push("var m=(",c.join("+"),")|0;if(m===0||m===",(1<<(1<=1<<(1<>>7){");for(var u=0;1<<(1<u;++u){if(1<<(1<128&&u%128===0){h.length>0&&f.push("}}");var p="vExtra"+h.length;n.push("case ",u>>>7,":",p,"(m&0x7f,",l.join(),");break;"),f=["function ",p,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&u,":");for(var d=new Array(r),m=new Array(r),g=new Array(r),v=new Array(r),y=0,b=0;r>b;++b)d[b]=[],m[b]=[],g[b]=0,v[b]=0;for(var b=0;1<b;++b)for(var x=0;r>x;++x){var _=b^1<b)&&!(u&1<<_)!=!(u&1<w?(d[x].push("-v"+b+"-v"+_),g[x]+=2):(d[x].push("v"+b+"+v"+_),g[x]-=2),y+=1;for(var M=0;r>M;++M)M!==x&&(_&1<x;++x)if(0===d[x].length)k.push("d"+x+"-0.5");else{var A="";g[x]<0?A=g[x]+"*c":g[x]>0&&(A="+"+g[x]+"*c");var T=.5*(d[x].length/y),E=.5+.5*(v[x]/y);k.push("d"+x+"-"+E+"-"+T+"*("+d[x].join("+")+A+")/("+m[x].join("+")+")")}f.push("a.push([",k.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var S=[],u=0;1<u;++u)S.push("v"+u);S.push("c0","c1","p0","p1","a","b","c"),n.push("cell:function cellFunc(",S.join(),"){");var L=s(r-1);n.push("if(p0){b.push(",L.map(function(t){return"["+t.map(function(t){return"v"+t})+"]"}).join(),")}else{b.push(",L.map(function(t){var e=t.slice();return e.reverse(),"["+e.map(function(t){return"v"+t})+"]"}).join(),")}}});function ",i,"(array,level){var verts=[],cells=[];contour(array,verts,cells,level);return {positions:verts,cells:cells};} return ",i,";");for(var u=0;ua;++a)i[a]=[r[a]],o[a]=[a];return{positions:i,cells:o}}function o(t,e){if(t.dimension<=0)return{positions:[],cells:[]};if(1===t.dimension)return i(t,e);var r=t.order.join()+"-"+t.dtype,o=u[r],e=+e||0;return o||(o=u[r]=n(t.order,t.dtype)),o(t,e)}e.exports=o;var a=t("ndarray-extract-contour"),s=t("triangulate-hypercube"),l=t("zero-crossings"),u={}},{"ndarray-extract-contour":467,"triangulate-hypercube":472,"zero-crossings":474}],476:[function(t,e,r){(function(r){"use strict";function n(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),i=0,o=0,a=0;al;++l){var u=r[s[l]];n[i++]=u[0],n[i++]=u[1]+1.4,o=Math.max(u[0],o)}return{data:n,shape:o}}function i(t,e){var r=s[t];r||(r=s[t]={" ":{data:new Float32Array(0),shape:.2}});var a=r[e];if(!a)if(e.length<=1||!/\d/.test(e))a=r[e]=n(o(e,{triangles:!0,font:t,textAlign:"left",textBaseline:"alphabetic"}));else{for(var l=e.split(/(\d|\s)/),u=new Array(l.length),c=0,h=0,f=0;f0&&(h+=.02);for(var p=new Float32Array(c),d=0,m=-.5*h,f=0;f.5?l/(2-o-a):l/(o+a),o){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,l:s}}function a(t,e,r){function n(t,e,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?t+6*(e-t)*r:.5>r?e:2/3>r?t+(e-t)*(2/3-r)*6:t}var i,o,a;if(t=T(t,360),e=T(e,100),r=T(r,100),0===e)i=o=a=r;else{var s=.5>r?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),o=n(l,s,t),a=n(l,s,t-1/3)}return{r:255*i,g:255*o,b:255*a}}function s(t,e,r){t=T(t,255),e=T(e,255),r=T(r,255);var n,i,o=q(t,e,r),a=V(t,e,r),s=o,l=o-a;if(i=0===o?0:l/o,o==a)n=0;else{switch(o){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,v:s}}function l(t,e,r){t=6*T(t,360),e=T(e,100),r=T(r,100);var n=B.floor(t),i=t-n,o=r*(1-e),a=r*(1-i*e),s=r*(1-(1-i)*e),l=n%6,u=[r,a,o,o,s,r][l],c=[s,r,r,a,o,o][l],h=[o,o,s,r,r,a][l];return{r:255*u,g:255*c,b:255*h}}function u(t,e,r,n){var i=[I(U(t).toString(16)),I(U(e).toString(16)),I(U(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function c(t,e,r,n){var i=[I(C(n)),I(U(t).toString(16)),I(U(e).toString(16)),I(U(r).toString(16))];return i.join("")}function h(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s-=r/100,n.s=E(n.s),e(n)}function f(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s+=r/100,n.s=E(n.s),e(n)}function p(t){return e(t).desaturate(100)}function d(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l+=r/100,n.l=E(n.l),e(n)}function m(t,r){r=0===r?0:r||10;var n=e(t).toRgb();return n.r=q(0,V(255,n.r-U(255*-(r/100)))),n.g=q(0,V(255,n.g-U(255*-(r/100)))),n.b=q(0,V(255,n.b-U(255*-(r/100)))),e(n)}function g(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l-=r/100,n.l=E(n.l),e(n)}function v(t,r){var n=e(t).toHsl(),i=(U(n.h)+r)%360;return n.h=0>i?360+i:i,e(n)}function y(t){var r=e(t).toHsl();return r.h=(r.h+180)%360,e(r)}function b(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+120)%360,s:r.s,l:r.l}),e({h:(n+240)%360,s:r.s,l:r.l})]}function x(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+90)%360,s:r.s,l:r.l}),e({h:(n+180)%360,s:r.s,l:r.l}),e({h:(n+270)%360,s:r.s,l:r.l})]}function _(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+72)%360,s:r.s,l:r.l}),e({h:(n+216)%360,s:r.s,l:r.l})]}function w(t,r,n){r=r||6,n=n||30;var i=e(t).toHsl(),o=360/n,a=[e(t)];for(i.h=(i.h-(o*r>>1)+720)%360;--r;)i.h=(i.h+o)%360,a.push(e(i));return a}function M(t,r){r=r||6;for(var n=e(t).toHsv(),i=n.h,o=n.s,a=n.v,s=[],l=1/r;r--;)s.push(e({h:i,s:o,v:a})),a=(a+l)%1;return s}function k(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function A(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function T(t,e){L(t)&&(t="100%");var r=z(t);return t=V(e,q(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),B.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function E(t){return V(1,q(0,t))}function S(t){return parseInt(t,16)}function L(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function z(t){return"string"==typeof t&&-1!=t.indexOf("%")}function I(t){return 1==t.length?"0"+t:""+t}function P(t){return 1>=t&&(t=100*t+"%"),t}function C(t){return Math.round(255*parseFloat(t)).toString(16)}function R(t){return S(t)/255}function j(t){t=t.replace(O,"").replace(F,"").toLowerCase();var e=!1;if(H[t])t=H[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Y.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Y.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Y.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Y.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Y.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Y.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Y.hex8.exec(t))?{a:R(r[1]),r:S(r[2]),g:S(r[3]),b:S(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=Y.hex3.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function D(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var O=/^\s+/,F=/\s+$/,N=0,B=Math,U=B.round,V=B.min,q=B.max,G=B.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,n,i,o,a=this.toRgb();return t=a.r/255,e=a.g/255,r=a.b/255,n=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),i=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),o=.03928>=r?r/12.92:Math.pow((r+.055)/1.055,2.4),.2126*n+.7152*i+.0722*o},setAlpha:function(t){return this._a=A(t),this._roundA=U(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return c(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:U(this._r),g:U(this._g),b:U(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+U(this._r)+", "+U(this._g)+", "+U(this._b)+")":"rgba("+U(this._r)+", "+U(this._g)+", "+U(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:U(100*T(this._r,255))+"%",g:U(100*T(this._g,255))+"%",b:U(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+U(100*T(this._r,255))+"%, "+U(100*T(this._g,255))+"%, "+U(100*T(this._b,255))+"%)":"rgba("+U(100*T(this._r,255))+"%, "+U(100*T(this._g,255))+"%, "+U(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:X[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+c(this._r,this._g,this._b,this._a),n=r,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=e(t);n=o.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(d,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(g,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(f,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(v,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(x,arguments)}},e.fromRatio=function(t,r){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?n[i]=t[i]:n[i]=P(t[i]));t=n}return e(t,r)},e.equals=function(t,r){return t&&r?e(t).toRgbString()==e(r).toRgbString():!1},e.random=function(){return e.fromRatio({r:G(),g:G(),b:G()})},e.mix=function(t,r,n){n=0===n?0:n||50;var i,o=e(t).toRgb(),a=e(r).toRgb(),s=n/100,l=2*s-1,u=a.a-o.a;i=l*u==-1?l:(l+u)/(1+l*u),i=(i+1)/2;var c=1-i,h={r:a.r*i+o.r*c,g:a.g*i+o.g*c,b:a.b*i+o.b*c,a:a.a*s+o.a*(1-s)};return e(h)},e.readability=function(t,r){var n=e(t),i=e(r);return(Math.max(n.getLuminance(),i.getLuminance())+.05)/(Math.min(n.getLuminance(),i.getLuminance())+.05)},e.isReadable=function(t,r,n){var i,o,a=e.readability(t,r);switch(o=!1,i=D(n),i.level+i.size){case"AAsmall":case"AAAlarge":o=a>=4.5;break;case"AAlarge":o=a>=3;break;case"AAAsmall":o=a>=7}return o},e.mostReadable=function(t,r,n){var i,o,a,s,l=null,u=0;n=n||{},o=n.includeFallbackColors,a=n.level,s=n.size;for(var c=0;cu&&(u=i,l=e(r[c]));return e.isReadable(t,l,{level:a,size:s})||!o?l:(n.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],n))};var H=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},X=e.hexNames=k(H),Y=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof r&&r.exports?r.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],478:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.topojson={})}(this,function(t){"use strict";function e(){}function r(t){if(!t)return e;var r,n,i=t.scale[0],o=t.scale[1],a=t.translate[0],s=t.translate[1];return function(t,e){e||(r=n=0),t[0]=(r+=t[0])*i+a,t[1]=(n+=t[1])*o+s}}function n(t){if(!t)return e;var r,n,i=t.scale[0],o=t.scale[1],a=t.translate[0],s=t.translate[1];return function(t,e){e||(r=n=0);var l=(t[0]-a)/i|0,u=(t[1]-s)/o|0;t[0]=l-r,t[1]=u-n,r=l,n=u}}function i(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r}function o(t,e){for(var r=0,n=t.length;n>r;){var i=r+n>>>1;t[i]t?~t:t],o=0,a=n.length;a>o;++o)e.push(r=n[o].slice()),c(r,o);0>t&&i(e,a)}function o(t){return t=t.slice(),c(t,0),t}function a(t){for(var e=[],r=0,i=t.length;i>r;++r)n(t[r],e);return e.length<2&&e.push(e[0].slice()),e}function s(t){for(var e=a(t);e.length<4;)e.push(e[0].slice());return e}function l(t){return t.map(s)}function u(t){var e=t.type;return"GeometryCollection"===e?{type:e,geometries:t.geometries.map(u)}:e in f?{type:e,coordinates:f[e](t)}:null}var c=r(t.transform),h=t.arcs,f={Point:function(t){return o(t.coordinates)},MultiPoint:function(t){return t.coordinates.map(o)},LineString:function(t){return a(t.arcs)},MultiLineString:function(t){return t.arcs.map(a)},Polygon:function(t){return l(t.arcs)},MultiPolygon:function(t){return t.arcs.map(l)}};return u(e)}function u(t,e){function r(e){var r,n=t.arcs[0>e?~e:e],i=n[0];return t.transform?(r=[0,0],n.forEach(function(t){r[0]+=t[0],r[1]+=t[1]})):r=n[n.length-1],0>e?[r,i]:[i,r]}function n(t,e){for(var r in t){var n=t[r];delete e[n.start],delete n.start,delete n.end,n.forEach(function(t){i[0>t?~t:t]=1}),s.push(n)}}var i={},o={},a={},s=[],l=-1;return e.forEach(function(r,n){var i,o=t.arcs[0>r?~r:r];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++l],e[l]=r,e[n]=i)}),e.forEach(function(t){var e,n,i=r(t),s=i[0],l=i[1];if(e=a[s])if(delete a[e.end],e.push(t),e.end=l,n=o[l]){delete o[n.start];var u=n===e?e:e.concat(n);o[u.start=e.start]=a[u.end=n.end]=u}else o[e.start]=a[e.end]=e;else if(e=o[l])if(delete o[e.start],e.unshift(t),e.start=s,n=a[s]){delete a[n.end];var c=n===e?e:n.concat(e);o[c.start=n.start]=a[c.end=e.end]=c}else o[e.start]=a[e.end]=e;else e=[t],o[e.start=s]=a[e.end=l]=e}),n(a,o),n(o,a),e.forEach(function(t){i[0>t?~t:t]||s.push([t])}),s}function c(t){return l(t,h.apply(this,arguments))}function h(t,e,r){function n(t){var e=0>t?~t:t;(c[e]||(c[e]=[])).push({i:t,g:l})}function i(t){t.forEach(n)}function o(t){t.forEach(i)}function a(t){"GeometryCollection"===t.type?t.geometries.forEach(a):t.type in h&&(l=t,h[t.type](t.arcs))}var s=[];if(arguments.length>1){var l,c=[],h={LineString:i,MultiLineString:o,Polygon:o,MultiPolygon:function(t){t.forEach(o)}};a(e),c.forEach(arguments.length<3?function(t){s.push(t[0].i)}:function(t){r(t[0].g,t[t.length-1].g)&&s.push(t[0].i)})}else for(var f=0,p=t.arcs.length;p>f;++f)s.push(f);return{type:"MultiLineString",arcs:u(t,s)}}function f(t){var e=t[0],r=t[1],n=t[2];return Math.abs((e[0]-n[0])*(r[1]-e[1])-(e[0]-r[0])*(n[1]-e[1]))}function p(t){for(var e,r=-1,n=t.length,i=t[n-1],o=0;++re?~e:e]||(i[e]=[])).push(t)})}),o.push(t)}function n(e){return p(l(t,{type:"Polygon",arcs:[e]}).coordinates[0])>0}var i={},o=[],a=[];return e.forEach(function(t){"Polygon"===t.type?r(t.arcs):"MultiPolygon"===t.type&&t.arcs.forEach(r)}),o.forEach(function(t){if(!t._){var e=[],r=[t];for(t._=1,a.push(e);t=r.pop();)e.push(t),t.forEach(function(t){t.forEach(function(t){i[0>t?~t:t].forEach(function(t){t._||(t._=1,r.push(t))})})})}}),o.forEach(function(t){delete t._}),{type:"MultiPolygon",arcs:a.map(function(e){var r,o=[];if(e.forEach(function(t){t.forEach(function(t){t.forEach(function(t){i[0>t?~t:t].length<2&&o.push(t)})})}),o=u(t,o),(r=o.length)>1)for(var a,s=n(e[0][0]),l=0;r>l;++l)if(s===n(o[l])){a=o[0],o[0]=o[l],o[l]=a;break}return o})}}function g(t){function e(t,e){t.forEach(function(t){0>t&&(t=~t);var r=i[t];r?r.push(e):i[t]=[e]})}function r(t,r){t.forEach(function(t){e(t,r)})}function n(t,e){"GeometryCollection"===t.type?t.geometries.forEach(function(t){n(t,e)}):t.type in s&&s[t.type](t.arcs,e)}var i={},a=t.map(function(){return[]}),s={LineString:e,MultiLineString:r,Polygon:r,MultiPolygon:function(t,e){t.forEach(function(t){r(t,e)})}};t.forEach(n);for(var l in i)for(var u=i[l],c=u.length,h=0;c>h;++h)for(var f=h+1;c>f;++f){var p,d=u[h],m=u[f];(p=a[d])[l=o(p,m)]!==m&&p.splice(l,0,m),(p=a[m])[l=o(p,d)]!==d&&p.splice(l,0,d)}return a}function v(t,e){return t[1][2]-e[1][2]}function y(){function t(t,e){for(;e>0;){var r=(e+1>>1)-1,i=n[r];if(v(t,i)>=0)break;n[i._=e]=i,n[t._=e=r]=t}}function e(t,e){for(;;){var r=e+1<<1,o=r-1,a=e,s=n[a];if(i>o&&v(n[o],s)<0&&(s=n[a=o]),i>r&&v(n[r],s)<0&&(s=n[a=r]),a===e)break;n[s._=e]=s,n[t._=e=a]=t}}var r={},n=[],i=0;return r.push=function(e){return t(n[e._=i]=e,i++),i},r.pop=function(){if(!(0>=i)){var t,r=n[0];return--i>0&&(t=n[i],e(n[t._=0]=t,0)),r}},r.remove=function(r){var o,a=r._;if(n[a]===r)return a!==--i&&(o=n[i],(v(o,r)<0?t:e)(n[o._=a]=o,a)),a},r}function b(t,e){function i(t){s.remove(t),t[1][2]=e(t),s.push(t)}var o=r(t.transform),a=n(t.transform),s=y();return e||(e=f),t.arcs.forEach(function(t){var r,n,l,u,c=[],h=0;for(n=0,l=t.length;l>n;++n)u=t[n],o(t[n]=[u[0],u[1],1/0],n);for(n=1,l=t.length-1;l>n;++n)r=t.slice(n-1,n+2),r[1][2]=e(r),c.push(r),s.push(r);for(n=0,l=c.length;l>n;++n)r=c[n],r.previous=c[n-1],r.next=c[n+1];for(;r=s.pop();){var f=r.previous,p=r.next;r[1][2]0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(a(t),0,t)}function l(t){return new Uint16Array(a(2*t),0,t)}function u(t){return new Uint32Array(a(4*t),0,t)}function c(t){return new Int8Array(a(t),0,t)}function h(t){return new Int16Array(a(2*t),0,t)}function f(t){return new Int32Array(a(4*t),0,t)}function p(t){return new Float32Array(a(4*t),0,t)}function d(t){return new Float64Array(a(8*t),0,t)}function m(t){return x?new Uint8ClampedArray(a(t),0,t):s(t)}function g(t){return new DataView(a(t),0,t)}function v(t){t=y.nextPow2(t);var e=y.log2(t),r=M[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,M=_.BUFFER;r.free=function(t){if(n.isBuffer(t))M[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=o,r.freeArrayBuffer=i,r.freeBuffer=function(t){M[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return a(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return h(t);case"int32":return f(t);case"float":case"float32":return p(t);case"double":case"float64":return d(t);case"uint8_clamped":return m(t);case"buffer":return v(t);case"data":case"dataview":return g(t);default:return null}return null},r.mallocArrayBuffer=a,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=h,r.mallocInt32=f,r.mallocFloat32=r.mallocFloat=p,r.mallocFloat64=r.mallocDouble=d,r.mallocUint8Clamped=m,r.mallocDataView=g,r.mallocBuffer=v,r.clearCache=function(){for(var t=0;32>t;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0, +_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,M[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":51,buffer:52,dup:126}],482:[function(t,e,r){"use strict";function n(t,e){for(var r=1,n=t.length,i=t[0],o=t[0],a=1;n>a;++a)if(o=i,i=t[a],e(i,o)){if(a===r){r++;continue}t[r++]=i}return t.length=r,t}function i(t){for(var e=1,r=t.length,n=t[0],i=t[0],o=1;r>o;++o,i=n)if(i=n,n=t[o],n!==i){if(o===e){e++;continue}t[e++]=n}return t.length=e,t}function o(t,e,r){return 0===t.length?t:e?(r||t.sort(e),n(t,e)):(r||t.sort(),i(t))}e.exports=o},{}],483:[function(t,e,r){"use strict";function n(t,e){return"object"==typeof e&&null!==e||(e={}),i(t,e.canvas||o,e.context||a,e)}e.exports=n;var i=t("./lib/vtext"),o=null,a=null;"undefined"!=typeof document&&(o=document.createElement("canvas"),o.width=8192,o.height=1024,a=o.getContext("2d"))},{"./lib/vtext":484}],484:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",o=[1<<30,1<<30],a=[0,0],s=t.length,l=0;s>l;++l)for(var u=t[l],c=0;2>c;++c)o[c]=0|Math.min(o[c],u[c]),a[c]=0|Math.max(a[c],u[c]);var h=0;switch(n){case"center":h=-.5*(o[0]+a[0]);break;case"right":case"end":h=-a[0];break;case"left":case"start":h=-o[0];break;default:throw new Error("vectorize-text: Unrecognized textAlign: '"+n+"'")}var f=0;switch(i){case"hanging":case"top":f=-o[1];break;case"middle":f=-.5*(o[1]+a[1]);break;case"alphabetic":case"ideographic":f=-3*r;break;case"bottom":f=-a[1];break;default:throw new Error("vectorize-text: Unrecoginized textBaseline: '"+i+"'")}var p=1/r;return"lineHeight"in e?p*=+e.lineHeight:"width"in e?p=e.width/(a[0]-o[0]):"height"in e&&(p=e.height/(a[1]-o[1])),t.map(function(t){return[p*(t[0]+h),p*(t[1]+f)]})}function i(t,e,r,n){var i=0|Math.ceil(e.measureText(r).width+2*n);if(i>8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var o=3*n;t.height=l&&a.push(s)}for(;a.length>0;){var u=a.pop();n[u]=!1;for(var c=r[u],s=0;sn;++n){var o=t[n];e=Math.max(e,o[0],o[1])}e=(0|e)+1}e=0|e;for(var a=new Array(e),n=0;e>n;++n)a[n]=[];for(var n=0;r>n;++n){var o=t[n];a[o[0]].push(o[1]),a[o[1]].push(o[0])}for(var s=0;e>s;++s)i(a[s],function(t,e){return t-e});return a}e.exports=n;var i=t("uniq")},{uniq:482}],487:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,o){for(var a,s,l,c=0;2>c;++c)if(u[c][n].length>0){a=u[c][n][0],l=c;break}s=a[1^l];for(var h=0;2>h;++h)for(var f=u[h][n],p=0;p0&&(a=d,s=m,l=h)}return o?s:(a&&r(a,l),s)}function o(t,o){var a=u[o][t][0],s=[t];r(a,o);for(var l=a[1^o];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],h=t,f=s[1],p=n(c,h,!0);if(i(e[c],e[h],e[f],e[p])<0)break;s.push(t),l=n(c,h)}return s}function a(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;s>c;++c)u[0][c]=[],u[1][c]=[];for(var c=0;l>c;++c){var h=t[c];u[0][h[0]].push(h),u[1][h[1]].push(h)}for(var f=[],c=0;s>c;++c)u[0][c].length+u[1][c].length===0&&f.push([c]);for(var c=0;s>c;++c)for(var p=0;2>p;++p){for(var d=[];u[p][c].length>0;){var m=(u[0][c].length,o(c,p));a(d,m)?d.push.apply(d,m):(d.length>0&&f.push(d),d=m)}d.length>0&&f.push(d)}return f}e.exports=n;var i=t("compare-angle")},{"compare-angle":488}],488:[function(t,e,r){"use strict";function n(t,e,r){var n=s(t[0],-e[0]),i=s(t[1],-e[1]),o=s(r[0],-e[0]),a=s(r[1],-e[1]),c=u(l(n,o),l(i,a));return c[c.length-1]>=0}function i(t,e,r,i){var s=o(e,r,i);if(0===s){var l=a(o(t,e,r)),u=a(o(t,e,i));if(l===u){if(0===l){var c=n(t,e,r),h=n(t,e,i);return c===h?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,i)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:a(u-l)}var f=o(t,e,r);if(f>0)return s>0&&o(t,e,i)>0?1:-1;if(0>f)return s>0||o(t,e,i)>0?1:-1;var p=o(t,e,i);return p>0?1:n(t,e,r)?1:-1}e.exports=i;var o=t("robust-orientation"),a=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":462,"robust-product":489,"robust-sum":465,signum:490,"two-sum":480}],489:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return o(e,t[0]);if(1===e.length)return o(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.lengtht?-1:t>0?1:0}},{}],491:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],492:[function(t,e,r){"use strict";function n(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}function i(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 o(t,e){var r=d(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 a(t,e){var r=t.intervals([]);r.push(e),o(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return 0>n?y:(r.splice(n,1),o(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],o=[],a=[],s=[],r=0;r3*(e+1)?a(this,t):this.left.insert(t):this.left=d([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?a(this,t):this.right.insert(t):this.right=d([t]);else{var r=v.ge(this.leftPoints,t,f),n=v.ge(this.rightPoints,t,p);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var o=this.left?this.left.count:0;if(4*o>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var a=this,l=this.left;l.right;)a=l,l=l.right;if(a===this)l.right=this.right;else{var u=this.left,n=this.right;a.count-=l.count,a.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=v.ge(this.leftPoints,t,f);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=m.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){return this.root?this.root.queryPoint(t,e):void 0},w.queryInterval=function(t,e,r){return e>=t&&this.root?this.root.queryInterval(t,e,r):void 0},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":491}],493:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),a=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return s>a?a-s:i>l?i-l:a-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var a,s;if(t[0][0]t[1][0]))return-n(t,e);a=t[1],s=t[0]}var l=o(r,i,s),u=o(r,i,a);if(0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;if(l=o(s,a,i),u=o(s,a,r),0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;return i[0]-s[0]}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":462}],494:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=o}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function o(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function a(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}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(0>=i){if(n.left){var o=u(t,e,r,n.left);if(o)return o}var o=r(n.key,n.value);if(o)return o}return n.right?u(t,e,r,n.right):void 0}function c(t,e,r,n,i){var o,a=r(t,i.key),s=r(e,i.key);if(0>=a){if(i.left&&(o=c(t,e,r,n,i.left)))return o;if(s>0&&(o=n(i.key,i.value)))return o}return s>0&&i.right?c(t,e,r,n,i.right):void 0}function h(t,e){this.tree=t,this._stack=e}function f(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 p(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=v);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===g){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=v,r._color=v,s._color=v,a(r),a(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===g){if(n=r.right=i(n),s=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=v,n._color=v,e._color=v,a(r),a(n),a(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===v){if(r._color===g)return r._color=v,void(r.right=o(g,n));r.right=o(g,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=g,a(r),a(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===g){if(n=r.left=i(n),s=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=v,n._color=v,e._color=v,a(r),a(n),a(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===v){if(r._color===g)return r._color=v,void(r.left=o(g,n));r.left=o(g,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=g,a(r),a(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1t?-1:t>e?1:0}function m(t){return new s(t||d,null)}e.exports=m;var g=0,v=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=0>=c?i.left:i.right}l.push(new n(g,t,e,null,null,1));for(var h=l.length-2;h>=0;--h){var i=l[h];u[h]<=0?l[h]=new n(i._color,i.key,i.value,l[h+1],i.right,i._count+1):l[h]=new n(i._color,i.key,i.value,i.left,l[h+1],i._count+1)}for(var h=l.length-1;h>1;--h){var f=l[h-1],i=l[h];if(f._color===v||i._color===v)break;var p=l[h-2];if(p.left===f)if(f.left===i){var d=p.right;if(!d||d._color!==g){if(p._color=g,p.left=f.right,f._color=v,f.right=p,l[h-2]=f,l[h-1]=i,a(p),a(f),h>=3){var m=l[h-3];m.left===p?m.left=f:m.right=f}break}f._color=v,p.right=o(v,d),p._color=g,h-=1}else{var d=p.right;if(!d||d._color!==g){if(f.right=i.left,p._color=g,p.left=i.right,i._color=v,i.left=f,i.right=p,l[h-2]=i,l[h-1]=f,a(p),a(f),a(i),h>=3){var m=l[h-3];m.left===p?m.left=i:m.right=i}break}f._color=v,p.right=o(v,d),p._color=g,h-=1}else if(f.right===i){var d=p.left;if(!d||d._color!==g){if(p._color=g,p.right=f.left,f._color=v,f.left=p,l[h-2]=f,l[h-1]=i,a(p),a(f),h>=3){var m=l[h-3];m.right===p?m.right=f:m.left=f}break}f._color=v,p.left=o(v,d),p._color=g,h-=1}else{var d=p.left;if(!d||d._color!==g){if(f.left=i.right,p._color=g,p.right=i.left,i._color=v,i.right=f,i.left=p,l[h-2]=i,l[h-1]=f,a(p),a(f),a(i),h>=3){var m=l[h-3];m.right===p?m.right=i:m.left=i}break}f._color=v,p.left=o(v,d),p._color=g,h-=1}}return l[0]._color=v,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),y.at=function(t){if(0>t)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new h(this,[])},y.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),0>=o&&(i=n.length),r=0>=o?r.left:r.right}return n.length=i,new h(this,n)},y.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),0>o&&(i=n.length),r=0>o?r.left:r.right}return n.length=i,new h(this,n)},y.lt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),o>0&&(i=n.length),r=0>=o?r.left:r.right}return n.length=i,new h(this,n)},y.le=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),o>=0&&(i=n.length),r=0>o?r.left:r.right}return n.length=i,new h(this,n)},y.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=0>=i?r.left:r.right}return new h(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.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=0>=n?r.left:r.right}};var b=h.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new h(this.tree,this._stack.slice())},b.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 i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var o=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var a=e[o-1];e.push(new n(r._color,a.key,a.value,r.left,r.right,r._count)),e[o-1].key=r.key,e[o-1].value=r.value;for(var i=e.length-2;i>=o;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[o-1].left=e[o]}if(r=e[e.length-1],r._color===g){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0?this._stack[this._stack.length-1].key:void 0},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1].value:void 0},enumerable:!0}),Object.defineProperty(b,"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}),b.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(b,"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}}),b.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 o=e.length-2;o>=0;--o)i=e[o],i.left===e[o+1]?r[o]=new n(i._color,i.key,i.value,r[o+1],i.right,i._count):r[o]=new n(i._color,i.key,i.value,i.left,r[o+1],i._count);return new s(this.tree._compare,r[0])},b.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(b,"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}})},{}],495:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function o(t,e){for(var r=null;t;){var n,i,a=t.key;a[0][0]s)t=t.left;else if(s>0)if(e[0]!==a[1][0])r=t,t=t.right;else{var l=o(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==a[1][0])return t;var l=o(t.right,e);if(l)return l;t=t.left}}return r}function a(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),o=0;e>o;++o){var l=t[o],u=l[0][0]o;){for(var g=i[o].x,v=[];r>o;){var y=i[o];if(y.x!==g)break;o+=1,y.segment[0][0]===y.x&&y.segment[1][0]===y.x?y.create&&(y.segment[0][1]e)return-1;var r=(this.slabs[e],o(this.slabs[e],t)),n=-1;if(r&&(n=r.value),this.coordinates[e]===t[0]){var a=null;if(r&&(a=r.key),e>0){var s=o(this.slabs[e-1],t);s&&(a?f(s.key,a)>0&&(a=s.key,n=s.value):(n=s.value,a=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;p=l[c]}}if(p.start)if(a){var d=h(a[0],a[1],[t[0],p.y]);a[0][0]>a[1][0]&&(d=-d),d>0&&(n=p.index)}else n=p.index;else p.y!==t[1]&&(n=p.index)}}}return n}},{"./lib/order-segments":493,"binary-search-bounds":491,"functional-red-black-tree":494,"robust-orientation":462}],496:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return i?!!i.queryPoint(r,n):!1}}function o(t){for(var e={},r=0;rn)return 1;var i=t[n];if(!i){if(!(n>0&&e[n]===r[0]))return 1;i=t[n-1]}for(var o=1;i;){var a=i.key,s=h(r,a[0],a[1]);if(a[0][0]s)i=i.left;else{if(!(s>0))return 0;o=-1,i=i.right}else if(s>0)i=i.left;else{if(!(0>s))return 0;o=1,i=i.right}}return o}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;e>i;++i)for(var c=t[i],h=c.length,p=h-1,d=0;h>d;p=d++){var m=c[p],g=c[d];m[0]===g[0]?n.push([m,g]):r.push([m,g])}if(0===r.length)return 0===n.length?s:l(o(n));var v=f(r),y=a(v.slabs,v.coordinates);return 0===n.length?y:u(o(n),y)}e.exports=c;var h=t("robust-orientation")[3],f=t("slab-decomposition"),p=t("interval-tree-1d"),d=t("binary-search-bounds")},{"binary-search-bounds":491,"interval-tree-1d":492,"robust-orientation":462,"slab-decomposition":495}],497:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function i(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=[];return e}function o(t,e){function r(t){for(var r=t.length,n=[0],i=0;r>i;++i){var o=e[t[i]],a=e[t[(i+1)%r]],s=u(-o[0],o[1]),l=u(-o[0],a[1]),h=u(a[0],o[1]),f=u(a[0],a[1]);n=c(n,c(c(s,l),c(h,f)))}return n[n.length-1]>0}function o(t){for(var e=t.length,r=0;e>r;++r)if(!R[t[r]])return!1;return!0}var p=f(t,e);t=p[0],e=p[1];for(var d=e.length,m=(t.length,a(t,e.length)),g=0;d>g;++g)if(m[g].length%2===1)throw new Error("planar-graph-to-polyline: graph must be manifold");var v=s(t,e);v=v.filter(r);for(var y=v.length,b=new Array(y),x=new Array(y),g=0;y>g;++g){b[g]=g;var _=new Array(y),w=v[g].map(function(t){return e[t]}),M=l([w]),k=0;t:for(var A=0;y>A;++A)if(_[A]=0,g!==A){for(var T=v[A],E=T.length,S=0;E>S;++S){var L=M(e[T[S]]);if(0!==L){0>L&&(_[A]=1,k+=1);continue t}}_[A]=1,k+=1}x[g]=[k,g,_]}x.sort(function(t,e){return e[0]-t[0]});for(var g=0;y>g;++g)for(var _=x[g],z=_[1],I=_[2],A=0;y>A;++A)I[A]&&(b[A]=z);for(var P=i(y),g=0;y>g;++g)P[g].push(b[g]),P[b[g]].push(g);for(var C={},R=n(d,!1),g=0;y>g;++g)for(var T=v[g],E=T.length,A=0;E>A;++A){var j=T[A],D=T[(A+1)%E],O=Math.min(j,D)+":"+Math.max(j,D);if(O in C){var F=C[O];P[F].push(g),P[g].push(F),R[j]=R[D]=!0}else C[O]=g}for(var N=[],B=n(y,-1),g=0;y>g;++g)b[g]!==g||o(v[g])?B[g]=-1:(N.push(g),B[g]=0);for(var p=[];N.length>0;){var U=N.pop(),V=P[U];h(V,function(t,e){return t-e});var q,G=V.length,H=B[U];if(0===H){var T=v[U];q=[T]}for(var g=0;G>g;++g){var X=V[g];if(!(B[X]>=0)&&(B[X]=1^H,N.push(X),0===H)){var T=v[X];o(T)||(T.reverse(),q.push(T))}}0===H&&p.push(q)}return p}e.exports=o;var a=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),h=t("uniq"),f=t("./lib/trim-leaves")},{"./lib/trim-leaves":485,"edges-to-adjacency-list":486,"planar-dual":487,"point-in-big-polygon":496,"robust-sum":465,"two-product":479,uniq:482}],498:[function(t,e,r){arguments[4][51][0].apply(r,arguments)},{dup:51}],499:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n,n.prototype.length=function(){return this.roots.length},n.prototype.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},n.prototype.find=function(t){for(var e=this.roots;e[t]!==t;){var r=e[t];e[t]=e[r],t=r}return t},n.prototype.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,o=this.roots,a=i[r],s=i[n];s>a?o[r]=n:a>s?o[n]=r:(o[n]=r,++i[r])}}},{}],500:[function(t,e,r){arguments[4][249][0].apply(r,arguments)},{"bit-twiddle":498,dup:249,"union-find":499}],501:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.abs(o(t,e,r)),i=Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2));return n/i}function i(t,e,r){function i(t){if(x[t])return 1/0;var r=v[t],i=y[t];return 0>r||0>i?1/0:n(e[t],e[r],e[i])}function o(t,e){var r=A[t],n=A[e];A[t]=n,A[e]=r,T[r]=e,T[n]=t}function s(t){return b[A[t]]}function l(t){return 1&t?t-1>>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(S>n){var l=s(n);r>l&&(a=n,r=l)}if(S>i){var u=s(i);r>u&&(a=i)}if(a===t)return t;o(t,a),t=a}}function c(t){for(var e=s(t);t>0;){var r=l(t);if(r>=0){var n=s(r);if(n>e){o(t,r),t=r;continue}}return t}}function h(){if(S>0){var t=A[0];return o(0,S-1),S-=1,u(0),t}return-1}function f(t,e){var r=A[t];return b[r]===e?t:(b[r]=-(1/0),c(t),h(),b[r]=e,S+=1,c(S-1))}function p(t){if(!x[t]){x[t]=!0;var e=v[t],r=y[t];v[r]>=0&&(v[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&f(T[e],i(e)),T[r]>=0&&f(T[r],i(r))}}function d(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||0>i||i===n)break;if(n=i,i=t[n],!x[n]||0>i||i===n)break;n=i,r=t[r]}while(r!==n);for(var o=e;o!==n;o=t[o])t[o]=n;return n}for(var m=e.length,g=t.length,v=new Array(m),y=new Array(m),b=new Array(m),x=new Array(m),_=0;m>_;++_)v[_]=y[_]=-1,b[_]=1/0,x[_]=!1;for(var _=0;g>_;++_){var w=t[_];if(2!==w.length)throw new Error("Input must be a graph");var M=w[1],k=w[0];-1!==y[k]?y[k]=-2:y[k]=M,-1!==v[M]?v[M]=-2:v[M]=k}for(var A=[],T=new Array(m),_=0;m>_;++_){var E=b[_]=i(_);1/0>E?(T[_]=A.length,A.push(_)):T[_]=-1}for(var S=A.length,_=S>>1;_>=0;--_)u(_);for(;;){var L=h();if(0>L||b[L]>r)break;p(L)}for(var z=[],_=0;m>_;++_)x[_]||(T[_]=z.length,z.push(e[_].slice()));var I=(z.length,[]);return t.forEach(function(t){var e=d(v,t[0]),r=d(y,t[1]);if(e>=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&I.push([n,i])}}),a.unique(a.normalize(I)),{positions:z,edges:I}}e.exports=i;var o=t("robust-orientation"),a=t("simplicial-complex")},{"robust-orientation":462,"simplicial-complex":500}],502:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],503:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),a=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:a({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":586, +"../../plots/cartesian/constants":620,"../../plots/font_attributes":633,"./arrow_paths":502}],504:[function(t,e,r){"use strict";function n(t,e){function r(e,r){return u.coerce(t,n,g.layoutAttributes,e,r)}var n={};r("opacity"),r("align"),r("bgcolor");var i=r("bordercolor"),o=h.opacity(i);r("borderpad");var a=r("borderwidth"),s=r("showarrow");s&&(r("arrowcolor",o?n.bordercolor:h.defaultLine),r("arrowhead"),r("arrowsize"),r("arrowwidth",2*(o&&a||1)),r("ax"),r("ay"),r("axref"),r("ayref"),u.noneOrAll(t,n,["ax","ay"])),r("text",s?" ":"new text"),r("textangle"),u.coerceFont(r,"font",e.font);for(var l=["x","y"],f=0;2>f;f++){var p=l[f],d={_fullLayout:e},m=c.coerceRef(t,n,d,p),v=c.coerceARef(t,n,d,p),y=.5;if("paper"!==m){var b=c.getFromId(d,m);if(y=b.range[0]+y*(b.range[1]-b.range[0]),-1!==["date","category"].indexOf(b.type)&&"string"==typeof t[p]){var x;if("date"===b.type){if(x=u.dateTime2ms(t[p]),x!==!1&&(t[p]=x),v===m){var _=u.dateTime2ms(t["a"+p]);_!==!1&&(t["a"+p]=_)}}else(b._categories||[]).length&&(x=b._categories.indexOf(t[p]),-1!==x&&(t[p]=x))}}r(p,y),s||r(p+"anchor")}return u.noneOrAll(t,n,["x","y"]),n}function i(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=c.getFromId(t,e.xref),n=c.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,a=(e._ysize||0)/2,s=e._yshift||0,l=i-o,u=i+o,h=a-s,f=a+s;if(e.showarrow){var p=3*e.arrowsize*e.arrowwidth;l=Math.max(l,p),u=Math.max(u,p),h=Math.max(h,p),f=Math.max(f,p)}r&&r.autorange&&c.expand(r,[r.l2c(e.x)],{ppadplus:u,ppadminus:l}),n&&n.autorange&&c.expand(n,[n.l2c(e.y)],{ppadplus:f,ppadminus:h})}})}function o(t,e,r,n,i,o,a,s){var l=r-t,u=i-t,c=a-i,h=n-e,f=o-e,p=s-o,d=l*p-c*h;if(0===d)return null;var m=(u*p-c*f)/d,g=(u*h-l*f)/d;return 0>g||g>1||0>m||m>1?null:{x:t+l*m,y:e+h*m}}var a=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),h=t("../color"),f=t("../drawing"),p=t("../../lib/svg_text_utils"),d=t("../../lib/setcursor"),m=t("../dragelement"),g=e.exports={};g.ARROWPATHS=t("./arrow_paths"),g.layoutAttributes=t("./attributes"),g.supplyLayoutDefaults=function(t,e){for(var r=t.annotations||[],i=e.annotations=[],o=0;ot?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var n=W.select(".annotation-math-group"),i=!n.empty(),s=f.bBox((i?n:tt).node()),p=s.width,v=s.height,y=Math.round(p+2*K),b=Math.round(v+2*K);U._w=p,U._h=v;var x=!1;if(["x","y"].forEach(function(e){var n,i=U[e+"ref"]||e,o=c.getFromId(t,i),a=(H+("x"===e?0:90))*Math.PI/180,s=y*Math.abs(Math.cos(a))+b*Math.abs(Math.sin(a)),l=U[e+"anchor"];if(o){if(!o.autorange&&(U[e]-o.range[0])*(U[e]-o.range[1])>0&&(U["a"+e+"ref"]===i?(U["a"+e]-o.range[0])*(U["a"+e]-o.range[1])>0&&(x=!0):x=!0,x))return;G[e]=o._offset+o.l2p(U[e]),n=.5}else n=U[e],"y"===e&&(n=1-n),G[e]="x"===e?L.l+L.w*n:L.t+L.h*n;var u=0;U["a"+e+"ref"]===i?G["aa"+e]=o._offset+o.l2p(U["a"+e]):(u=U.showarrow?U["a"+e]:s*r(n,l),G[e]+=u),U["_"+e+"type"]=o&&o.type,U["_"+e+"size"]=s,U["_"+e+"shift"]=u}),x)return void W.remove();var w,M;U.showarrow&&(w=U.axref===U.xref?G.x:u.constrain(G.x-U.ax,1,_.width-1),M=U.ayref===U.yref?G.y:u.constrain(G.y-U.ay,1,_.height-1)),G.x=u.constrain(G.x,1,_.width-1),G.y=u.constrain(G.y,1,_.height-1);var k=K-s.top,A=K-s.left;i?n.select("svg").attr({x:K-1,y:K}):(tt.attr({x:A,y:k}),tt.selectAll("tspan.line").attr({y:k,x:A})),J.call(f.setRect,Z/2,Z/2,y-Z,b-Z);var T=0,E=0;T=U.axref===U.xref?Math.round(G.aax-y/2):Math.round(G.x-y/2),E=U.ayref===U.yref?Math.round(G.aay-b/2):Math.round(G.y-b/2),W.call(u.setTranslate,T,E);var S="annotations["+e+"]",z=function(r,n){a.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=U.axref===U.xref?G.aax+r:G.x+r,s=U.ayref===U.yref?G.aay+n:G.y+n;var c=u.rotationXYMatrix(H,i,s),f=u.apply2DTransform(c),p=u.apply2DTransform2(c),d=J.attr("width")/2,v=J.attr("height")/2,y=[[i-d,s-v,i-d,s+v],[i-d,s+v,i+d,s+v],[i+d,s+v,i+d,s-v],[i+d,s-v,i-d,s-v]].map(p);if(!y.reduce(function(t,e){return t^!!o(w,M,w+1e6,M+1e6,e[0],e[1],e[2],e[3])},!1)){y.forEach(function(t){var e=o(i,s,w,M,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var b=U.arrowwidth,x=U.arrowcolor,_=X.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=_.append("path").attr("d","M"+i+","+s+"L"+w+","+M).style("stroke-width",b+"px").call(h.stroke,h.rgb(x));g.arrowhead(k,U.arrowhead,"end",U.arrowsize);var A=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-w)+","+(s-M),transform:"translate("+w+","+M+")"}).style("stroke-width",b+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,z;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate(W);E=t.x,z=t.y,T={},V&&V.autorange&&(T[V._name+".autorange"]=!0),q&&q.autorange&&(T[q._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var r=f(E,z),n=r[0]+t,i=r[1]+e;W.call(u.setTranslate,n,i),T[S+".x"]=V?U.x+t/V._m:(w+t-L.l)/L.w,T[S+".y"]=q?U.y+e/q._m:1-(M+e-L.t)/L.h,U.axref===U.xref&&(T[S+".ax"]=V?U.ax+t/V._m:(w+t-L.l)/L.w),U.ayref===U.yref&&(T[S+".ay"]=q?U.ay+e/q._m:1-(M+e-L.t)/L.h),Y.attr({transform:"rotate("+H+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};U.showarrow&&z(0,0);var I=u.rotationXYMatrix(H,G.x,G.y),P=u.apply2DTransform(I);if(t._context.editable){var C,R,j;m.init({element:W.node(),prepFn:function(){var t=u.getTranslate(W);C=t.x,R=t.y,j={}},moveFn:function(t,e){W.call(u.setTranslate,C+t,R+e);var r="pointer";if(U.showarrow)U.axref===U.xref?j[S+".ax"]=V.p2l(V.l2p(U.ax)+t):j[S+".ax"]=U.ax+t,U.ayref===U.yref?j[S+".ay"]=q.p2l(q.l2p(U.ay)+e):j[S+".ay"]=U.ay+e,z(t,e);else{if(V)j[S+".x"]=U.x+t/V._m;else{var n=U._xsize/L.w,i=U.x+U._xshift/L.w-n/2;j[S+".x"]=m.align(i+t/L.w,n,0,1,U.xanchor)}if(q)j[S+".y"]=U.y+e/q._m;else{var o=U._ysize/L.h,a=U.y-U._yshift/L.h-o/2;j[S+".y"]=m.align(a-e/L.h,o,0,1,U.yanchor)}V&&q||(r=m.getCursor(V?.5:j[S+".x"],q?.5:j[S+".y"],U.xanchor,U.yanchor))}var s=P(C,R),l=s[0]+t,c=s[1]+e;W.call(u.setTranslate,C+t,R+e),Y.attr({transform:"rotate("+H+","+l+","+c+")"}),d(W,r)},doneFn:function(e){if(d(W),e){l.relayout(t,j);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var b,x=t.layout,_=t._fullLayout;if(!s(e)||-1===e){if(!e&&Array.isArray(i))return x.annotations=i,g.supplyLayoutDefaults(x,_),void g.drawAll(t);if("remove"===i)return delete x.annotations,_.annotations=[],void g.drawAll(t);if(r&&"add"!==i){for(b=0;b<_.annotations.length;b++)g.draw(t,b,r,i);return}e=_.annotations.length,_.annotations.push({})}if(!r&&i){if("remove"===i){for(_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),_.annotations.splice(e,1),x.annotations.splice(e,1),b=e;b<_.annotations.length;b++)_._infolayer.selectAll('.annotation[data-index="'+(b+1)+'"]').attr("data-index",String(b)),g.draw(t,b);return}if("add"===i||u.isPlainObject(i)){_.annotations.splice(e,0,{});var w=u.isPlainObject(i)?u.extendFlat({},i):{text:"New text"};for(x.annotations?x.annotations.splice(e,0,w):x.annotations=[w],b=_.annotations.length-1;b>e;b--)_._infolayer.selectAll('.annotation[data-index="'+(b-1)+'"]').attr("data-index",String(b)),g.draw(t,b)}}_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var M=x.annotations[e],k=_.annotations[e];if(M){var A={xref:M.xref,yref:M.yref},T={};"string"==typeof r&&r?T[r]=i:u.isPlainObject(r)&&(T=r);var E=Object.keys(T);for(b=0;bb;b++){var I=z[b];if(void 0===T[I]&&void 0!==M[I]){var P=c.getFromId(t,c.coerceRef(A,{},t,I)),C=c.getFromId(t,c.coerceRef(M,{},t,I)),R=M[I],j=k["_"+I+"type"];if(void 0!==T[I+"ref"]){var D="auto"===M[I+"anchor"],O="x"===I?L.w:L.h,F=(k["_"+I+"size"]||0)/(2*O);if(P&&C)R=(R-P.range[0])/(P.range[1]-P.range[0]),R=C.range[0]+R*(C.range[1]-C.range[0]);else if(P){if(R=(R-P.range[0])/(P.range[1]-P.range[0]),R=P.domain[0]+R*(P.domain[1]-P.domain[0]),D){var N=R+F,B=R-F;2/3>R+B?R=B:R+N>4/3&&(R=N)}}else C&&(D&&(1/3>R?R+=F:R>2/3&&(R-=F)),R=(R-C.domain[0])/(C.domain[1]-C.domain[0]),R=C.range[0]+R*(C.range[1]-C.range[0]))}C&&C===P&&j&&("log"===j&&"log"!==C.type?R=Math.pow(10,R):"log"!==j&&"log"===C.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),M[I]=R}}var U=n(M,_);_.annotations[e]=U;var V=c.getFromId(t,U.xref),q=c.getFromId(t,U.yref),G={x:0,y:0},H=+U.textangle||0,X=_._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",U.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:M,fullAnnotation:U})}),Y=X.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),W=Y.append("g"),Z=U.borderwidth,Q=U.borderpad,K=Z+Q,J=W.append("rect").attr("class","bg").style("stroke-width",Z+"px").call(h.stroke,U.bordercolor).call(h.fill,U.bgcolor),$=U.font,tt=W.append("text").classed("annotation",!0).attr("data-unformatted",U.text).text(U.text);t._context.editable?tt.call(p.makeEditable,W).call(v).on("edit",function(r){U.text=r,this.attr({"data-unformatted":U.text}),this.call(v);var n={};n["annotations["+e+"].text"]=U.text,V&&V.autorange&&(n[V._name+".autorange"]=!0),q&&q.autorange&&(n[q._name+".autorange"]=!0),l.relayout(t,n)}):tt.call(v),Y.attr({transform:"rotate("+H+","+G.x+","+G.y+")"}).call(f.setPosition,G.x,G.y)}},g.arrowhead=function(t,e,r,n){s(n)||(n=1);var i=t.node(),o=g.ARROWPATHS[e||0];if(o){"string"==typeof r&&r||(r="end");var l,u,c,p,d=(f.getPx(t,"stroke-width")||1)*n,m=t.style("stroke")||h.defaultLine,v=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=o.backoff*d;if("line"===i.nodeName){if(l={x:+t.attr("x1"),y:+t.attr("y1")},u={x:+t.attr("x2"),y:+t.attr("y2")},c=Math.atan2(l.y-u.y,l.x-u.x),p=c+Math.PI,x){var _=x*Math.cos(c),w=x*Math.sin(c);y&&(l.x-=_,l.y-=w,t.attr({x1:l.x,y1:l.y})),b&&(u.x+=_,u.y+=w,t.attr({x2:u.x,y2:u.y}))}}else if("path"===i.nodeName){var M=i.getTotalLength(),k="";if(y){var A=i.getPointAtLength(0),T=i.getPointAtLength(.1);c=Math.atan2(A.y-T.y,A.x-T.x),l=i.getPointAtLength(Math.min(x,M)),x&&(k="0px,"+x+"px,")}if(b){var E=i.getPointAtLength(M),S=i.getPointAtLength(M-.1);if(p=Math.atan2(E.y-S.y,E.x-S.x),u=i.getPointAtLength(Math.max(0,M-x)),x){var L=k?2*x:x;k+=M-L+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var z=function(r,n){e>5&&(n=0),a.select(i.parentElement).append("path").attr({"class":t.attr("class"),d:o.path,transform:"translate("+r.x+","+r.y+")rotate("+180*n/Math.PI+")scale("+d+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&z(l,c),b&&z(u,p)}},g.calcAutorange=function(t){var e=t._fullLayout,r=e.annotations;if(r.length&&t._fullData.length){var n={};r.forEach(function(t){n[t.xref]=!0,n[t.yref]=!0});var o=c.list(t).filter(function(t){return t.autorange&&n[t._id]});if(o.length)return u.syncOrAsync([g.drawAll,i],t)}}},{"../../lib":591,"../../lib/setcursor":600,"../../lib/svg_text_utils":604,"../../plotly":612,"../../plots/cartesian/axes":615,"../color":506,"../dragelement":527,"../drawing":529,"./arrow_paths":502,"./attributes":503,d3:124,"fast-isnumeric":128}],505:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],506:[function(t,e,r){"use strict";function n(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var a=0;a=0))return t;if(3===a)n[a]>1&&(n[a]=1);else if(n[a]>=1)return t}var s=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),o=t("fast-isnumeric"),a=e.exports={},s=t("./attributes");a.defaults=s.defaults,a.defaultLine=s.defaultLine,a.lightLine=s.lightLine,a.background=s.background,a.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},a.rgb=function(t){return a.tinyRGB(i(t))},a.opacity=function(t){return t?i(t).getAlpha():0},a.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},a.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||a.background).toRgb(),o=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r:o.r*(1-r.a)+r.r*r.a,g:o.g*(1-r.a)+r.g*r.a,b:o.b*(1-r.a)+r.b*r.a};return i(s).toRgbString()},a.contrast=function(t,e,r){var n=i(t),o=n.isLight()?n.darken(r):n.lighten(e);return o.toString()},a.stroke=function(t,e){var r=i(e);t.style({stroke:a.tinyRGB(r),"stroke-opacity":r.getAlpha()})},a.fill=function(t,e){var r=i(e);t.style({fill:a.tinyRGB(r),"fill-opacity":r.getAlpha()})},a.clean=function(t){if(t&&"object"==typeof t){var e,r,i,o,s=Object.keys(t);for(e=0;el&&(o[1]-=(at-l)/2)):r.node()&&!r.classed("js-placeholder")&&(at=f.bBox(e.node()).height),at){if(at+=5,"top"===x.titleside)J.domain[1]-=at/A.h,o[1]*=-1;else{J.domain[0]+=at/A.h;var c=Math.max(1,r.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),J.setScale()}}it.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(A.h*(1-J.domain[1]))+")");var h=it.select(".cbfills").selectAll("rect.cbfill").data(L);h.enter().append("rect").classed("cbfill",!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?E[0]:(L[e]+L[e-1])/2,e===L.length-1?E[1]:(L[e]+L[e+1])/2].map(J.c2p).map(Math.round);e!==L.length-1&&(r[1]+=r[1]>r[0]?1:-1);var o=I(t).replace("e-",""),a=i(o).toHexString();n.select(this).attr({x:X,width:Math.max(N,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:a})});var p=it.select(".cblines").selectAll("path.cbline").data(x.line.color&&x.line.width?S:[]);return p.enter().append("path").classed("cbline",!0),p.exit().remove(),p.each(function(t){n.select(this).attr("d","M"+X+","+(Math.round(J.c2p(t))+x.line.width/2%1)+"h"+N).call(f.lineGroupStyle,x.line.width,z(t),x.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=X+N+(x.outlinewidth||0)/2-("outside"===x.ticks?1:0),J.side="right",u.syncOrAsync([function(){return s.doTicks(t,J,!0)},function(){if(-1===["top","bottom"].indexOf(x.titleside)){var e=J.titlefont.size,r=J._offset+J._length/2,i=A.l+(J.position||0)*A.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));w("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:x.titleside,offsetLeft:A.l,offsetTop:A.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,r){var n,i=b();n=a.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:it.select(".cbtitle")},s="h"===e.charAt(0)?e.substr(1):"h"+e;it.selectAll("."+s+",."+s+"-math-group").remove(),d.draw(t,e,c(o,r||{}))}function M(){var r=N+x.outlinewidth/2+f.bBox(J._axislayer.node()).width;if(D=ot.select("text"),D.node()&&!D.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&-1!==["top","bottom"].indexOf(x.titleside)?f.bBox(i).width:f.bBox(ot.node()).right-X-A.l,r=Math.max(r,n)}var o=2*x.xpad+r+x.borderwidth+x.outlinewidth/2,s=Z-Q;it.select(".cbbg").attr({x:X-x.xpad-(x.borderwidth+x.outlinewidth)/2,y:Q-G,width:Math.max(o,2),height:Math.max(s+2*G,2)}).call(p.fill,x.bgcolor).call(p.stroke,x.bordercolor).style({"stroke-width":x.borderwidth}),it.selectAll(".cboutline").attr({x:X,y:Q+x.ypad+("top"===x.titleside?at:0),width:Math.max(N,2),height:Math.max(s-2*x.ypad-at,2)}).call(p.stroke,x.outlinecolor).style({fill:"None","stroke-width":x.outlinewidth});var l=({center:.5,right:1}[x.xanchor]||0)*o;it.attr("transform","translate("+(A.l-l)+","+A.t+")"),a.autoMargin(t,e,{x:x.x,y:x.y,l:o*({right:1,center:.5}[x.xanchor]||0),r:o*({left:1,center:.5}[x.xanchor]||0),t:s*({bottom:1,middle:.5}[x.yanchor]||0),b:s*({top:1,middle:.5}[x.yanchor]||0)})}var k=t._fullLayout,A=k._size;if("function"!=typeof x.fillcolor&&"function"!=typeof x.line.color)return void k._infolayer.selectAll("g."+e).remove();var T,E=n.extent(("function"==typeof x.fillcolor?x.fillcolor:x.line.color).domain()),S=[],L=[],z="function"==typeof x.line.color?x.line.color:function(){return x.line.color},I="function"==typeof x.fillcolor?x.fillcolor:function(){return x.fillcolor},P=x.levels.end+x.levels.size/100,C=x.levels.size,R=1.001*E[0]-.001*E[1],j=1.001*E[1]-.001*E[0];for(T=x.levels.start;0>(T-P)*C;T+=C)T>R&&j>T&&S.push(T);if("function"==typeof x.fillcolor)if(x.filllevels)for(P=x.filllevels.end+x.filllevels.size/100,C=x.filllevels.size,T=x.filllevels.start;0>(T-P)*C;T+=C)T>E[0]&&T1){var nt=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));tt*=nt*u.roundUp(rt/nt,[2,5,10]),(Math.abs(x.levels.start)/x.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=tt}J.domain=[W+H,W+V-H],J.setScale();var it=k._infolayer.selectAll("g."+e).data([0]);it.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),it.attr("transform","translate("+Math.round(A.l)+","+Math.round(A.t)+")");var ot=it.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(A.l)+",-"+Math.round(A.t)+")");J._axislayer=it.select(".cbaxis");var at=0;if(-1!==["top","bottom"].indexOf(x.titleside)){var st,lt=A.l+(x.x+q)*A.w,ut=J.titlefont.size;st="top"===x.titleside?(1-(W+V-H))*A.h+A.t+3+.75*ut:(1-(W+H))*A.h+A.t-3-.25*ut,w(J._id+"title",{attributes:{x:lt,y:st,"text-anchor":"start"}})}var ct=u.syncOrAsync([a.previousPromises,_,a.previousPromises,M],t);if(ct&&ct.then&&(t._promises||[]).push(ct),t._context.editable){var ht,ft,pt;l.init({element:it.node(),prepFn:function(){ht=it.attr("transform"),h(it)},moveFn:function(t,e){it.attr("transform",ht+" translate("+t+","+e+")"),ft=l.align(Y+t/A.w,B,0,1,x.xanchor),pt=l.align(W-e/A.h,V,0,1,x.yanchor);var r=l.getCursor(ft,pt,x.xanchor,x.yanchor);h(it,r)},doneFn:function(e){h(it),e&&void 0!==ft&&void 0!==pt&&o.restyle(t,{"colorbar.x":ft,"colorbar.y":pt},b().index)}})}return ct}function b(){var r,n,i=e.substr(2);for(r=0;rc*h?i.RdBu:c>=0?i.Reds:i.Blues,l.colorscale=f,s.reversescale&&(f=o(f)),s.colorscale=f)}},{"../../lib":591,"./flip_scale":517,"./scales":524}],514:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":586,"./attributes":512,"./scales.js":524}],515:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":524}],516:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../colorbar/has_colorbar"),a=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,r,u,c){var h=c.prefix,f=c.cLetter,p=h.slice(0,h.length-1),d=h?i.nestedProperty(t,p).get()||{}:t,m=h?i.nestedProperty(e,p).get()||{}:e,g=d[f+"min"],v=d[f+"max"],y=d.colorscale,b=n(g)&&n(v)&&v>g;u(h+f+"auto",!b),u(h+f+"min"),u(h+f+"max");var x;void 0!==y&&(x=!s(y)),u(h+"autocolorscale",x);var _=u(h+"colorscale"),w=u(h+"reversescale");if(w&&(m.colorscale=l(_)),"marker.line."!==h){var M;h&&(M=o(d));var k=u(h+"showscale",M);k&&a(d,m,r)}}},{"../../lib":591,"../colorbar/defaults":508,"../colorbar/has_colorbar":510,"./flip_scale":517,"./is_valid_scale":521,"fast-isnumeric":128}],517:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=t.length,n=new Array(r),i=r-1,o=0;i>=0;i--,o++)e=t[i],n[o]=[1-e[0],e[1]];return n}},{}],518:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),o(t)?t:e):e}},{"./default_scale":515,"./is_valid_scale_array":522,"./scales":524}],519:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var r=e?i.nestedProperty(t,e).get()||{}:t,a=r.color,s=!1;if(Array.isArray(a))for(var l=0;lf;f++)l=t[f],c[f]=e+l[0]*(r-e),h[f]=i(l[1]).toRgb();var p=n.scale.linear().domain(c).interpolate(n.interpolateObject).range(h);return function(t){if(o(t)){var n=a.constrain(t,e,r),l=p(n);return i(l).toRgbString()}return i(t).isValid()?t:s.defaultLine}}},{"../../lib":591,"../color":506,d3:124,"fast-isnumeric":128,tinycolor2:477}],524:[function(t,e,r){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]], +Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],525:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){var o=(t-r)/(n-r),a=o+e/(n-r),s=(o+a)/2;return"left"===i||"bottom"===i?o:"center"===i||"middle"===i?s:"right"===i||"top"===i?a:2/3-s>o?o:a>4/3-s?a:s}},{}],526:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,o){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":591}],527:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),a=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=d,m._dragged=!1,m._dragging=!0,u=e.clientX,c=e.clientY,p=e.target,h=(new Date).getTime(),h-m._mouseDownTimev&&(g=Math.max(g-1,1)),t.doneFn&&t.doneFn(m._dragged,g),!m._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),p.dispatchEvent(r)}return i(m),m._dragged=!1,a.pauseEvent(e)}var u,c,h,f,p,d,m=a.getPlotDiv(t.element)||{},g=1,v=s.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),d=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":591,"../../plotly":612,"../../plots/cartesian/constants":620,"./align":525,"./cursor":526,"./unhover":528}],528:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":585}],529:[function(t,e,r){"use strict";function n(t,e,r,n){var o=t[0]-e[0],a=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(o*o+a*a,x/2),c=Math.pow(s*s+l*l,x/2),h=(c*c*o-u*u*s)*n,f=(c*c*a-u*u*l)*n,p=3*c*(u+c),d=3*u*(u+c);return[[i.round(e[0]+(p&&h/p),2),i.round(e[1]+(p&&f/p),2)],[i.round(e[0]-(d&&h/d),2),i.round(e[1]-(d&&f/d),2)]]}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../plots/plots"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),f=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),d=e.exports={};d.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},d.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},d.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},d.setRect=function(t,e,r,n,i){t.call(d.setPosition,e,r).call(d.setSize,n,i)},d.translatePoints=function(t,e,r){t.each(function(t){var n=t.xp||e.c2p(t.x),a=t.yp||r.c2p(t.y),s=i.select(this);o(n)&&o(a)?"text"===this.nodeName?s.attr("x",n).attr("y",a):s.attr("transform","translate("+n+","+a+")"):s.remove()})},d.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},d.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):r||0},d.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},a=e||o.width||0,l=n||o.dash||"";i.select(this).call(s.stroke,r||o.color).call(d.dashLine,l,a)})},d.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},d.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(n){u.error(n,t),r.remove()}})};var m=t("./symbol_defs");d.symbolNames=[],d.symbolFuncs=[],d.symbolNeedLines={},d.symbolNoDot={},d.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];d.symbolList=d.symbolList.concat([e.n,t,e.n+100,t+"-open"]),d.symbolNames[e.n]=t,d.symbolFuncs[e.n]=e.f,e.needLine&&(d.symbolNeedLines[e.n]=!0),e.noDot?d.symbolNoDot[e.n]=!0:d.symbolList=d.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var g=d.symbolNames.length,v="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";d.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=d.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=g||t>=400?0:Math.floor(Math.max(t,0))},d.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=r.line;if(a.traceIs(e,"symbols")){var o=p(e);t.attr("d",function(t){var n;n="various"===t.ms||"various"===r.size?3:f.isBubble(e)?o(t.ms):(r.size||6)/2,t.mrc=n;var i=d.symbolNumber(t.mx||r.symbol)||0,a=i%100;return t.om=i%200>=100,d.symbolFuncs[a](n)+(i>=200?v:"")}).style("opacity",function(t){return(t.mo+1||r.opacity+1)-1})}var l=(e._input||{}).marker||{},u=d.tryColorscale(r,l,""),c=d.tryColorscale(r,l,"line.");t.each(function(t){var e,o,a;t.so?(a=n.outlierwidth,o=n.outliercolor,e=r.outliercolor):(a=(t.mlw+1||n.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(n.color)?s.defaultLine:n.color,e="mc"in t?t.mcc=u(t.mc):Array.isArray(r.color)?s.defaultLine:r.color||"rgba(0,0,0,0)");var l=i.select(this);t.om?l.call(s.stroke,e).style({"stroke-width":(a||1)+"px",fill:"none"}):(l.style("stroke-width",a+"px").call(s.fill,e),a&&l.call(s.stroke,o))})}},d.tryColorscale=function(t,e,r){var n=u.nestedProperty(t,r+"color").get(),i=u.nestedProperty(t,r+"colorscale").get(),a=u.nestedProperty(t,r+"cauto").get(),s=u.nestedProperty(t,r+"cmin"),c=u.nestedProperty(t,r+"cmax"),h=s.get(),f=c.get();return i&&Array.isArray(n)?(!a&&o(h)&&o(f)||(h=1/0,f=-(1/0),n.forEach(function(t){o(t)&&(h>t&&(h=+t),t>f&&(f=+t))}),h>f&&(h=0,f=1),s.set(h),c.set(f),u.nestedProperty(e,r+"cmin").set(h),u.nestedProperty(e,r+"cmax").set(f)),l.makeScaleFunction(i,h,f)):u.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;d.textPointStyle=function(t,e){t.each(function(t){var r=i.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,s=-1!==a.indexOf("top")?"top":-1!==a.indexOf("bottom")?"bottom":"middle",l=-1!==a.indexOf("left")?"end":-1!==a.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,h=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(d.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(c.convertToTspans);var f=i.select(this.parentNode),p=r.selectAll("tspan.line"),m=((p[0].length||1)-1)*b+1,g=y[l]*h,v=.75*u+y[s]*h+(y[s]-1)*m*u/2;f.attr("transform","translate("+g+","+v+")"),m>1&&p.attr({x:r.attr("x"),y:r.attr("y")})})};var x=.5;d.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,i="M"+t[0],o=[];for(r=1;rr;r++)a.push(n(t[r-1],t[r],t[r+1],e));for(a.push(n(t[o-1],t[o],t[0],e)),r=1;o>=r;r++)i+="C"+a[r-1][1]+" "+a[r][0]+" "+t[r];return i+="C"+a[o][1]+" "+a[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+i.round(e[0],2)+"V"+i.round(e[1],2)},vh:function(t,e){return"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},hvh:function(t,e){return"H"+i.round((t[0]+e[0])/2,2)+"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},vhv:function(t,e){return"V"+i.round((t[1]+e[1])/2,2)+"H"+i.round(e[0],2)+"V"+i.round(e[1],2)}},w=function(t,e){return"L"+i.round(e[0],2)+","+i.round(e[1],2)};d.steps=function(t){var e=_[t]||w;return function(t){for(var r="M"+i.round(t[0][0],2)+","+i.round(t[0][1],2),n=1;n=k&&(i.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),u.extendFlat({},l)},d.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":579,"../../lib":591,"../../lib/svg_text_utils":604,"../../plots/plots":671,"../../traces/scatter/make_bubble_size_func":787,"../../traces/scatter/subtypes":792,"../color":506,"../colorscale":520,"./symbol_defs":530,d3:124,"fast-isnumeric":128}],530:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,o="l-"+e+",-"+e,a="l-"+e+","+e;return"M0,"+e+r+i+o+i+o+a+o+a+r+a+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),o=n.round(t*-.309,2),a=n.round(.809*t,2);return"M"+e+","+o+"L"+r+","+a+"H-"+r+"L-"+e+","+o+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),o=n.round(.363*e,2),a=n.round(.588*e,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),h=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+o+","+u+"L"+a+","+c+"L0,"+h+"L-"+a+","+c+"L-"+o+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+r+a+e+","+r+a+"0,-"+i+a+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+r+a+"-"+e+",-"+r+a+"0,"+i+a+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:124}],531:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],532:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},l=o.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(o),h=0;hs;s++)a[s]={x:r[s],y:i[s]};return a[0].trace=t,n.calc({calcdata:[a],_fullLayout:e}),a},n.plot=t("./plot"),n.style=t("./style"),n.hoverInfo=function(t,e,r){(e.error_y||{}).visible&&(r.yerr=t.yh-t.y,e.error_y.symmetric||(r.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(r.xerr=t.xh-t.x,e.error_x.symmetric||(r.xerrneg=t.x-t.xs))}},{"./attributes":531,"./calc":532,"./defaults":534,"./plot":536,"./style":537}],536:[function(t,e,r){"use strict";function n(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};return void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),o(n.ys)||(n.noYS=!0,n.ys=r.c2p(t.ys,!0))),void 0!==t.xh&&(n.xh=e.c2p(t.xh),n.xs=e.c2p(t.xs),o(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0))),n}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../lib"),s=t("../../traces/scatter/subtypes");e.exports=function(t,e){var r=e.x(),l=e.y();t.each(function(t){var e=t[0].trace,u=e.error_x||{},c=e.error_y||{},h=s.hasMarkers(e)&&e.marker.maxdisplayed>0;if(c.visible||u.visible){var f=i.select(this).selectAll("g.errorbar").data(a.identity);f.enter().append("g").classed("errorbar",!0),f.each(function(t){var e=i.select(this),a=n(t,r,l);if(!h||t.vis){var s;if(c.visible&&o(a.x)&&o(a.yh)&&o(a.ys)){var f=c.width;s="M"+(a.x-f)+","+a.yh+"h"+2*f+"m-"+f+",0V"+a.ys,a.noYS||(s+="m-"+f+",0h"+2*f),e.append("path").classed("yerror",!0).attr("d",s)}if(u.visible&&o(a.y)&&o(a.xh)&&o(a.xs)){var p=(u.copy_ystyle?c:u).width;s="M"+a.xh+","+(a.y-p)+"v"+2*p+"m0,-"+p+"H"+a.xs,a.noXS||(s+="m0,-"+p+"v"+2*p),e.append("path").classed("xerror",!0).attr("d",s)}}})}})}},{"../../lib":591,"../../traces/scatter/subtypes":792,d3:124,"fast-isnumeric":128}],537:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},a=n.select(this);a.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),o.copy_ystyle&&(o=r),a.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(i.stroke,o.color)})}},{"../color":506,d3:124}],538:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":620}],539:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;2>s;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],o=0;o=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],543:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":586,"../../plots/font_attributes":633,"../color/attributes":505}],544:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],545:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/plots"),o=t("./attributes"),a=t("./helpers");e.exports=function(t,e,r){function s(t,e){return n.coerce(f,p,o,t,e)}for(var l,u,c,h,f=t.legend||{},p=e.legend={},d=0,m="normal",g=0;g1);if(y!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),n.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(l=0,c="left",u=1.1,h="bottom"):(l=0,c="left",u=-.1,h="top")}s("traceorder",m),a.isGrouped(e.legend)&&s("tracegroupgap"),s("x",l),s("xanchor",c),s("y",u),s("yanchor",h),n.noneOrAll(f,p,["x","y"])}}},{"../../lib":591,"../../plots/plots":671,"./attributes":543,"./helpers":548}],546:[function(t,e,r){"use strict";function n(t,e){function r(r){c.util.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=f.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,h=t.selectAll("text.legendtext").data([0]);h.enter().append("text").classed("legendtext",!0),h.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(d.font,i.legend.font).text(u),e._context.editable&&!s?h.call(c.util.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" "),c.restyle(e,"name",t,l)}):h.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,o=t.data()[0][0],a=e._fullData,s=o.trace,l=s.legendgroup,u=[];if(f.traceIs(s,"pie")){var h=o.label,p=r.indexOf(h);-1===p?r.push(h):r.splice(p,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var d=0;dtspan"),p=f[0].length||1;r=l*p,n=c.node()&&d.bBox(c.node()).width;var m=l*(.3+(1-p)/2);c.attr("y",m),f.attr("y",m)}r=Math.max(r,16)+3,o.attr({x:0,y:-r/2,height:r}),i.height=r,i.width=n}function a(t,e,r){var n=t._fullLayout,i=n.legend,o=i.borderwidth,a=b.isGrouped(i);if(b.isVertical(i))a&&e.each(function(t,e){h.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;h.setTranslate(this,o,5+o+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*o,i.height+=10+2*o,a&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),r.selectAll(".legendtoggle").attr("width",(t._context.editable?0:i.width)+40),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height);else if(a){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,f=l.length;f>c;c++){var p=l[c].map(function(t){return t[0].width}),d=40+Math.max.apply(null,p);i.width+=i.tracegroupgap+d,s.push(i.width)}e.each(function(t,e){h.setTranslate(this,s[e],0)}),e.each(function(){var t=u.select(this),e=t.selectAll("g.traces"),r=0;e.each(function(t){var e=t[0],n=e.height;h.setTranslate(this,0,5+o+r+n/2),r+=n}),i.height=Math.max(i.height,r)}),i.height+=10+2*o,i.width+=2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}else{i.width=0,i.height=0;var m=0,g=0,v=0,y=0;r.each(function(t){v=Math.max(40+t[0].width,v)}),r.each(function(t){var e=t[0],r=v,a=i.tracegroupgap||5;o+y+a+r>n.width-(n.margin.r+n.margin.l)&&(y=0,m+=g,i.height=i.height+g,g=0),h.setTranslate(this,o+y,5+o+e.height/2+m),i.width+=a+r,i.height=Math.max(i.height,e.height),y+=a+r,g=Math.max(e.height,g)}),i.width+=2*o,i.height+=10+2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}}function s(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center");var i="top";x.isBottomAnchor(r)?i="bottom":x.isMiddleAnchor(r)&&(i="middle"),f.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center"),f.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),h=t("../../lib"),f=t("../../plots/plots"),p=t("../dragelement"),d=t("../drawing"),m=t("../color"),g=t("./constants"),v=t("./get_legend_data"),y=t("./style"),b=t("./helpers"),x=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(h.setTranslate,0,e),E.call(d.setRect,F,t,g.scrollBarWidth,g.scrollBarHeight),k.select("rect").attr({y:b.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var b=r.legend,_=r.showlegend&&v(t.calcdata,b),w=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void f.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({"class":"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+o).data([0]);k.enter().append("clipPath").attr("id",o).append("rect");var A=M.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(m.stroke,b.bordercolor),A.call(m.fill,b.bgcolor),A.style("stroke-width",b.borderwidth+"px");var T=M.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var E=M.selectAll("rect.scrollbar").data([0]);E.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var S=T.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var L=S.selectAll("g.traces").data(h.identity);L.enter().append("g").attr("class","traces"),L.exit().remove(),L.call(y).style("opacity",function(t){var e=t[0].trace;return f.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var z=0!==M.enter().size();z&&(a(t,S,L),s(t));var I=0,P=r.width,C=0,R=r.height;a(t,S,L),b.height>R?l(t):s(t);var j=r._size,D=j.l+j.w*b.x,O=j.t+j.h*(1-b.y);x.isRightAnchor(b)?D-=b.width:x.isCenterAnchor(b)&&(D-=b.width/2),x.isBottomAnchor(b)?O-=b.height:x.isMiddleAnchor(b)&&(O-=b.height/2);var F=b.width,N=j.w;F>N?(D=j.l,F=N):(D+F>P&&(D=P-F),I>D&&(D=I),F=Math.min(P-D,b.width));var B=b.height,U=j.h;B>U?(O=j.t,B=U):(O+B>R&&(O=R-B),C>O&&(O=C),B=Math.min(R-O,b.height)),h.setTranslate(M,D,O);var V,q,G=B-g.scrollBarHeight-2*g.scrollBarMargin,H=b.height-B;if(b.height<=B||t._context.staticPlot)A.attr({width:F-b.borderwidth,height:B-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),h.setTranslate(T,0,0),k.select("rect").attr({width:F-2*b.borderwidth,height:B-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth}),T.call(d.setClipUrl,o);else{V=g.scrollBarMargin,q=T.attr("data-scroll")||0,A.attr({width:F-2*b.borderwidth+g.scrollBarWidth+g.scrollBarMargin,height:B-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),k.select("rect").attr({width:F-2*b.borderwidth+g.scrollBarWidth+g.scrollBarMargin,height:B-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth-q}),T.call(d.setClipUrl,o),z&&e(V,q),M.on("wheel",null),M.on("wheel",function(){q=h.constrain(T.attr("data-scroll")-u.event.deltaY/G*H,-H,0),V=g.scrollBarMargin-q/H*G,e(V,q),u.event.preventDefault()}),E.on(".drag",null),T.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=h.constrain(u.event.y-g.scrollBarHeight/2,g.scrollBarMargin,g.scrollBarMargin+G),q=-(V-g.scrollBarMargin)/G*H,e(V,q)});E.call(X),T.call(X)}if(t._context.editable){var Y,W,Z,Q;M.classed("cursor-move",!0),p.init({element:M.node(),prepFn:function(){var t=h.getTranslate(M);Z=t.x,Q=t.y},moveFn:function(t,e){var r=Z+t,n=Q+e;h.setTranslate(M,r,n),Y=p.align(r,0,j.l,j.l+j.w,b.xanchor),W=p.align(n,0,j.t+j.h,j.t,b.yanchor)},doneFn:function(e){e&&void 0!==Y&&void 0!==W&&c.relayout(t,{"legend.x":Y,"legend.y":W})}})}}}},{"../../lib":591,"../../plotly":612,"../../plots/plots":671,"../color":506,"../dragelement":527,"../drawing":529,"./anchor_utils":542,"./constants":544,"./get_legend_data":547,"./helpers":548,"./style":550,d3:124}],547:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+h;l.push(n),s[n]=[[r]],h++}}var o,a,s={},l=[],u=!1,c={},h=0;for(o=0;oo;o++)v=s[l[o]],y[o]=i.isReversed(e)?v.reverse():v;else{for(y=[new Array(b)],o=0;b>o;o++)v=s[l[o]][0],y[0][i.isReversed(e)?b-o-1:o]=v;b=1}return e._lgroupsLength=b,y}},{"../../plots/plots":671,"./helpers":548}],548:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.legendGetsTrace=function(t){return t.visible&&n.traceIs(t,"showLegend")},r.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},r.isVertical=function(t){return"h"!==t.orientation},r.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":671}],549:[function(t,e,r){"use strict";var n=e.exports={};n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.draw=t("./draw"),n.style=t("./style")},{"./attributes":543,"./defaults":545,"./draw":546,"./style":550}],550:[function(t,e,r){"use strict";function n(t){var e=t[0].trace,r=e.visible&&e.fill&&"none"!==e.fill,n=p.hasLines(e),i=l.select(this).select(".legendfill").selectAll("path").data(r?[t]:[]);i.enter().append("path").classed("js-fill",!0),i.exit().remove(),i.attr("d","M5,0h30v6h-30z").call(h.fillGroupStyle);var o=l.select(this).select(".legendlines").selectAll("path").data(n?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(h.lineGroupStyle)}function i(t){function e(t,e,r){var n=u.nestedProperty(a,t).get(),i=Array.isArray(n)&&e?e(n):n;if(r){if(ir[1])return r[1]}return i}function r(t){return t[0]}var n,i,o=t[0],a=o.trace,s=p.hasMarkers(a),c=p.hasText(a),f=p.hasLines(a);if(s||c||f){var d={},m={};s&&(d.mc=e("marker.color",r),d.mo=e("marker.opacity",u.mean,[.2,1]),d.ms=e("marker.size",u.mean,[2,16]),d.mlc=e("marker.line.color",r),d.mlw=e("marker.line.width",u.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(m.line={width:e("line.width",r,[0,10])}),c&&(d.tx="Aa",d.tp=e("textposition",r),d.ts=10,d.tc=e("textfont.color",r),d.tf=e("textfont.family",r)),n=[u.minExtend(o,d)],i=u.minExtend(a,m)}var g=l.select(this).select("g.legendpoints"),v=g.selectAll("path.scatterpts").data(s?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(h.pointStyle,i),s&&(n[0].mrc=3);var y=g.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(h.textPointStyle,i)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(f.fill,t.mc||r.color),e&&i.call(f.stroke,t.mlc||n.color)})}function a(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(f.fill,t.fc||e.fillcolor),r&&n.call(f.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(d,t[0],e)}var l=t("d3"),u=t("../../lib"),c=t("../../plots/plots"),h=t("../drawing"),f=t("../color"),p=t("../../traces/scatter/subtypes"),d=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(a).each(s).each(n).each(i)}},{"../../lib":591,"../../plots/plots":671,"../../traces/pie/style_one":771,"../../traces/scatter/subtypes":792,"../color":506,"../drawing":529,d3:124}],551:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,o=t._fullLayout,a={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,f=(1-c)/2,p=u.Axes.list(t,null,!0),d=0;dy;y++){var b=s[y];f=v[b]={};for(var x=0;x1)return n(["resetViews","toggleHover"]),a(g,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=i(s),y=[];return((u||d)&&!v||m)&&(y=["zoom2d","pan2d"]),(u||m)&&o(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!d||v||m||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&p?n(["toggleHover"]):d?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):p&&n(["hoverClosestPie"]),a(g,r)}function i(t){for(var e=l.Axes.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(d){var m=i(e,r,l);c("x",m[0]),c("y",m[1]),o.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),o.coerceFont(c,"font",r.font);var g=c("bgcolor");c("activecolor",a.contrast(g,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":591,"../color":506,"./attributes":554,"./button_attributes":555,"./constants":556}],558:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;ne){var r=e;e=t,t=r}s.setAttributes(w,{"data-min":t,"data-max":e}),s.setAttributes(C,{x:t,width:e-t}),s.setAttributes(A,{width:t}),s.setAttributes(T,{x:e,width:d-e}),s.setAttributes(E,{transform:"translate("+(t-g-1)+")"}),s.setAttributes(z,{transform:"translate("+e+")"})}var h=t._fullLayout,f=h._infolayer.selectAll("g.range-slider"),p=h.xaxis.rangeslider,d=h._size.w,m=(h.height-h.margin.b-h.margin.t)*p.thickness,g=2,v=Math.floor(p.borderwidth/2),y=h.margin.l,b=h.height-m-h.margin.b,x=0,_=d,w=document.createElementNS(a,"g");s.setAttributes(w,{"class":"range-slider","data-min":x,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+b+")" +});var M=document.createElementNS(a,"rect"),k=p.borderwidth%2===0?p.borderwidth:p.borderwidth-1;s.setAttributes(M,{fill:p.bgcolor,stroke:p.bordercolor,"stroke-width":p.borderwidth,height:m+k,width:d+k,transform:"translate(-"+v+", -"+v+")","shape-rendering":"crispEdges"});var A=document.createElementNS(a,"rect");s.setAttributes(A,{x:0,width:x,height:m,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(a,"rect");s.setAttributes(T,{x:_,width:d-_,height:m,fill:"rgba(0,0,0,0.4)"});var E=document.createElementNS(a,"g"),S=document.createElementNS(a,"rect"),L=document.createElementNS(a,"rect");s.setAttributes(E,{transform:"translate("+(x-g-1)+")"}),s.setAttributes(S,{width:10,height:m,x:-6,fill:"transparent",cursor:"col-resize"}),s.setAttributes(L,{width:g,height:m/2,y:m/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(E,[L,S]);var z=document.createElementNS(a,"g"),I=document.createElementNS(a,"rect"),P=document.createElementNS(a,"rect");s.setAttributes(z,{transform:"translate("+_+")"}),s.setAttributes(I,{width:10,height:m,x:-2,fill:"transparent",cursor:"col-resize"}),s.setAttributes(P,{width:g,height:m/2,y:m/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(z,[P,I]);var C=document.createElementNS(a,"rect");s.setAttributes(C,{x:x,width:_-x,height:m,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function r(t){var r,n,h=+t.clientX-o;switch(i){case C:w.style.cursor="ew-resize",r=+s+h,n=+l+h,c(r,n),u(e(r),e(n));break;case S:w.style.cursor="col-resize",r=+s+h,n=+l,c(r,n),u(e(r),e(n));break;case I:w.style.cursor="col-resize",r=+s,n=+l+h,c(r,n),u(e(r),e(n));break;default:w.style.cursor="ew-resize",r=a,n=a+h,c(r,n),u(e(r),e(n))}}function n(){window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n),w.style.cursor="auto"}var i=t.target,o=t.clientX,a=o-w.getBoundingClientRect().left,s=w.getAttribute("data-min"),l=w.getAttribute("data-max");window.addEventListener("mousemove",r),window.addEventListener("mouseup",n)}),p.range||(p.range=i.getAutoRange(h.xaxis));var R=l(t,d,m);s.appendChildren(w,[M,R,A,T,C,E,z]),r(h.xaxis.range[0],h.xaxis.range[1]),f.data([0]).enter().append(function(){return p.setRange=r,w})}},{"../../constants/xmlns_namespaces":579,"../../lib":591,"../../plotly":612,"../../plots/cartesian/axes":615,"./helpers":564,"./range_plot":566}],563:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,o){function a(t,e){return n.coerce(s,l,i,t,e)}if(t[r].rangeslider){var s=n.isPlainObject(t[r].rangeslider)?t[r].rangeslider:{},l=e[r].rangeslider={};if(a("bgcolor"),a("bordercolor"),a("borderwidth"),a("thickness"),a("visible"),a("range"),l.range&&!e[r].autorange){var u=l.range,c=e[r].range;u[0]=Math.min(u[0],c[0]),u[1]=Math.max(u[1],c[1])}else e[r]._needsExpand=!0;l.visible&&o.forEach(function(t){var r=e[t]||{};r.fixedrange=!0,e[t]=r})}}},{"../../lib":591,"./attributes":561}],564:[function(t,e,r){"use strict";r.setAttributes=function(t,e){for(var r in e)t.setAttribute(r,e[r])},r.appendChildren=function(t,e){for(var r=0;rl;l++){var u=s[l],c={_fullLayout:e},h=A.coerceRef(t,n,c,u);if("path"!==a){var f=.25,p=.75;if("paper"!==h){var d=A.getFromId(c,h),m=o(d);f=m(d.range[0]+f*(d.range[1]-d.range[0])),p=m(d.range[0]+p*(d.range[1]-d.range[0]))}r(u+"0",f),r(u+"1",p)}}return"path"===a?r("path"):k.noneOrAll(t,n,["x0","x1","y0","y1"]),n}function i(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function a(t,e){t.layout.shapes=e,z.supplyLayoutDefaults(t.layout,t._fullLayout),z.drawAll(t)}function s(t){delete t.layout.shapes,t._fullLayout.shapes=[],z.drawAll(t)}function l(t,e,r){for(var n=0;ne;i--)p(t,i).selectAll('[data-index="'+(i-1)+'"]').attr("data-index",i),z.draw(t,i)}function h(t,e,r,a){function s(r){var n={"data-index":e,"fill-rule":"evenodd",d:b(t,z)},i=z.line.width?z.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",z.opacity).call(T.stroke,i).call(T.fill,z.fillcolor).call(E.dashLine,z.line.dash,z.line.width);I&&o.call(E.setClipUrl,"clip"+t._fullLayout._uid+I),t._context.editable&&f(t,o,z,e)}var l,u;p(t,e).selectAll('[data-index="'+e+'"]').remove();var c=t.layout.shapes[e];if(c){var h={xref:c.xref,yref:c.yref},m={};"string"==typeof r&&r?m[r]=a:k.isPlainObject(r)&&(m=r);var g=Object.keys(m);for(l=0;ll;l++){var x=y[l];if(void 0===m[x]&&void 0!==c[x]){var _,w=x.charAt(0),M=A.getFromId(t,A.coerceRef(h,{},t,w)),S=A.getFromId(t,A.coerceRef(c,{},t,w)),L=c[x];void 0!==m[w+"ref"]&&(M?(_=i(M)(L),L=(_-M.range[0])/(M.range[1]-M.range[0])):L=(L-S.domain[0])/(S.domain[1]-S.domain[0]),S?(_=S.range[0]+L*(S.range[1]-S.range[0]),L=o(S)(_)):L=M.domain[0]+L*(M.domain[1]-M.domain[0])),c[x]=L}}var z=n(c,t._fullLayout);t._fullLayout.shapes[e]=z;var I;if("below"!==z.layer)I=(z.xref+z.yref).replace(/paper/g,""),s(t._fullLayout._shapeUpperLayer);else if("paper"===z.xref&&"paper"===z.yref)I="",s(t._fullLayout._shapeLowerLayer);else{var P,C=t._fullLayout._plots||{},R=Object.keys(C);for(l=0,u=R.length;u>l;l++)P=C[R[l]],I=R[l],d(t,z,P)&&s(P.shapelayer)}}}function f(t,e,r,n){function i(t){var r=K.right-K.left,n=K.bottom-K.top,i=t.clientX-K.left,o=t.clientY-K.top,a=r>W&&n>Z&&!t.shiftKey?S.getCursor(i/r,1-o/n):"move";L(e,a),Y=a.split("-")[0]}function o(e){U=A.getFromId(t,r.xref),V=A.getFromId(t,r.yref),q=v(t,U),G=v(t,V,!0),H=y(t,U),X=y(t,V,!0);var o="shapes["+n+"]";"path"===r.type?(N=r.path,B=o+".path"):(c=q(r.x0),h=G(r.y0),f=q(r.x1),p=G(r.y1),d=o+".x0",m=o+".y0",_=o+".x1",w=o+".y1"),f>c?(E=c,C=o+".x0",O="x0",z=f,R=o+".x1",F="x1"):(E=f,C=o+".x1",O="x1",z=c,R=o+".x0",F="x0"),p>h?(k=h,I=o+".y0",j="y0",T=p,P=o+".y1",D="y1"):(k=p,I=o+".y1",j="y1",T=h,P=o+".y0",D="y0"),u={},i(e),Q.moveFn="move"===Y?s:l}function a(r){L(e),r&&M.relayout(t,u)}function s(n,i){if("path"===r.type){var o=function(t){return H(q(t)+n)};U&&"date"===U.type&&(o=g(o));var a=function(t){return X(G(t)+i)};V&&"date"===V.type&&(a=g(a)),r.path=x(N,o,a),u[B]=r.path}else u[d]=r.x0=H(c+n),u[m]=r.y0=X(h+i),u[_]=r.x1=H(f+n),u[w]=r.y1=X(p+i);e.attr("d",b(t,r))}function l(n,i){if("path"===r.type){var o=function(t){return H(q(t)+n)};U&&"date"===U.type&&(o=g(o));var a=function(t){return X(G(t)+i)};V&&"date"===V.type&&(a=g(a)),r.path=x(N,o,a),u[B]=r.path}else{var s=~Y.indexOf("n")?k+i:k,l=~Y.indexOf("s")?T+i:T,c=~Y.indexOf("w")?E+n:E,h=~Y.indexOf("e")?z+n:z;l-s>Z&&(u[I]=r[j]=X(s),u[P]=r[D]=X(l)),h-c>W&&(u[C]=r[O]=H(c),u[R]=r[F]=H(h))}e.attr("d",b(t,r))}var u,c,h,f,p,d,m,_,w,k,T,E,z,I,P,C,R,j,D,O,F,N,B,U,V,q,G,H,X,Y,W=10,Z=10,Q={setCursor:i,element:e.node(),prepFn:o,doneFn:a},K=Q.element.getBoundingClientRect();S.init(Q)}function p(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):k.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=M.Axes.getFromId(t,r.id,"x")._id,i=M.Axes.getFromId(t,r.id,"y")._id,o="below"===e.layer,a=n===e.xref||i===e.yref,s=!!r.shapelayer;return o&&a&&s}function m(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function g(t){return function(e){return t(e).replace(" ","_")}}function v(t,e,r){var n,o=t._fullLayout._size;if(e){var a=i(e);n=function(t){return e._offset+e.l2p(a(t,!0))},"date"===e.type&&(n=m(n))}else n=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return n}function y(t,e,r){var n,i=t._fullLayout._size;if(e){var a=o(e);n=function(t){return a(e.p2l(t-e._offset))}}else n=r?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return n}function b(t,e){var r,n,o,a,s=e.type,l=A.getFromId(t,e.xref),u=A.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=i(l),n=function(t){return l._offset+l.l2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(o=i(u),a=function(t){return u._offset+u.l2p(o(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===s)return l&&"date"===l.type&&(n=m(n)),u&&"date"===u.type&&(a=m(a)),z.convertPath(e.path,n,a);var h=n(e.x0),f=n(e.x1),p=a(e.y0),d=a(e.y1);if("line"===s)return"M"+h+","+p+"L"+f+","+d;if("rect"===s)return"M"+h+","+p+"H"+f+"V"+d+"H"+h+"Z";var g=(h+f)/2,v=(p+d)/2,y=Math.abs(g-h),b=Math.abs(v-p),x="A"+y+","+b,_=g+y+","+v,w=g+","+(v-b);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function x(t,e,r){return t.replace(I,function(t){var n=0,i=t.charAt(0),o=C[i],a=R[i],s=j[i],l=t.substr(1).replace(P,function(t){return n>=s?t:(o[n]?t=e(t):a[n]&&(t=r(t)),n++,t)});return i+l})}function _(t,e,r,n,i){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(r)];if(n){var a,s,l,u,c,h=1/0,f=-(1/0),p=n.match(I);for("date"===t.type&&(o=m(o)),a=0;ac&&(h=c),c>f&&(f=c)));return f>=h?[h,f]:void 0}}var w=t("fast-isnumeric"),M=t("../../plotly"),k=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),E=t("../drawing"),S=t("../dragelement"),L=t("../../lib/setcursor"),z=e.exports={};z.layoutAttributes=t("./attributes"),z.supplyLayoutDefaults=function(t,e){for(var r=t.shapes||[],i=e.shapes=[],o=0;os&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),k.log("Ignoring extra params in segment "+t)),i+l})},z.calcAutorange=function(t){var e,r,n,i,o,a=t._fullLayout,s=a.shapes;if(s.length&&t._fullData.length)for(e=0;ef?r=f:(c.left-=b.offsetLeft,c.right-=b.offsetLeft,c.top-=b.offsetTop,c.bottom-=b.offsetTop,b.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(r=Math.max(r,a*(t[b.side]-c[o])+u))}),r=Math.min(f,r)),r>0||0>f){var p={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+p+")")}}}function d(){E=0,S=!0,L=I,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var m=r.propContainer,g=r.propName,v=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,k=m.titlefont.family,A=m.titlefont.size,T=m.titlefont.color,E=1,S=!1,L=m.title.trim();""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,S=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(h);var I="Click to enter "+y+" title";t._context.editable?(L||d(),z.call(c.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,g,e,v):o.relayout(t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",S)}},{"../../lib":591,"../../lib/svg_text_utils":604,"../../plotly":612,"../../plots/plots":671,"../color":506,"../drawing":529,d3:124,"fast-isnumeric":128}],570:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat,a={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:a,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":586,"../../plots/font_attributes":633,"../color/attributes":505}],571:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],572:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return o.coerce(n,i,u,t,e)}for(var n,i,a=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(l.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&v(t),0!==r.length){var u=l.selectAll("g."+T.headerGroupClassName).data(r,i);u.enter().append("g").classed(T.headerGroupClassName,!0);var c=l.selectAll("g."+T.buttonGroupClassName).data([0]);c.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(g).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){y.select(this).remove(),c.call(g).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],579:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],580:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.16.3",r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=n.register,r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=n.Snapshot,r.PlotSchema=n.PlotSchema,r.Queue=n.Queue,r.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":609,"./plot_api/to_image":610,"./plot_api/validate":611,"./plotly":612,"./snapshot/download":686,d3:124}],581:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],582:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],583:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),o=t("./nested_property"),a=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)}},"boolean":{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r?!0:"string"!=typeof t?!1:!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),o=0;o2)return!1;var l=a[0].split("-");if(l.length>3||3!==l.length&&a[1])return!1;if(4===l[0].length)r=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();r=((Number(l[0])-u+70)%100+200)%100+u-70}return s(r)?1===l.length?new Date(r,0,1).getTime():(n=Number(l[1])-1,l[1].length>2||!(n>=0&&11>=n)?!1:2===l.length?new Date(r,n,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(r,n,i).getTime(),a[1]?(l=a[1].split(":"),l.length>3?!1:(o=Number(l[0]),l[0].length>2||!(o>=0&&23>=o)?!1:(i+=36e5*o,1===l.length?i:(n=Number(l[1]),l[1].length>2||!(n>=0&&59>=n)?!1:(i+=6e4*n,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){if("undefined"==typeof a)return void l.error("d3 is not defined.");e||(e=0);var r=new Date(t),i=a.time.format("%Y-%m-%d")(r);return 7776e6>e?(i+=" "+n(r.getHours(),2),432e6>e&&(i+=":"+n(r.getMinutes(),2),108e5>e&&(i+=":"+n(r.getSeconds(),2),3e5>e&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={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"]},c={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"]},h=a.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(h),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(h)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(h)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){f[t].D.push(h(e)),["H","I","D"].forEach(function(r){u[r].forEach(function(n){var i=f[t][r];i.push(h(e+"~"+n)),i.push(h(n+"~"+e))})})})});var p=/[a-z]*/g,d=function(t){return t.substr(0,3)},m=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},b=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,M=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return k[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(p,d).replace(m,"").replace(g,"~").replace(v,y).replace(M,A).trim().replace(T,"");var e,r,n=null,a=i(t),s=o(t);e=f[a][s],r=e.length;for(var l=0;r>l&&!(n=e[l].parse(t));l++);if(!(n instanceof Date))return!1;var u=n.getTimezoneOffset();return n.setTime(n.getTime()+60*u*1e3),n}},{"../lib":591,d3:124,"fast-isnumeric":128}],585:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof n)return t;var e=new n;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(r,n){"undefined"!=typeof jQuery&&jQuery(t).trigger(r,n),e.emit(r,n)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof jQuery&&(n=jQuery(t).triggerHandler(e,r));var o=t._ev;if(!o)return n;var a=o._events[e];if(!a)return n;"function"==typeof a&&(a=[a]);for(var s=a.pop(),l=0;lv;v++){l=t[v];for(u in l)c=m[u],h=l[u],s&&a(h)?m[u]=h:e&&h&&(o(h)||(f=a(h)))?(f?(f=!1,p=c&&a(c)?c:[]):p=c&&o(c)?c:{},m[u]=i([p,h],e,r,s)):("undefined"!=typeof h||r)&&(m[u]=h)}return m}var o=t("./is_plain_object.js"),a=Array.isArray;r.extendFlat=function(){return i(arguments,!1,!1,!1)},r.extendDeep=function(){return i(arguments,!0,!1,!1)},r.extendDeepAll=function(){return i(arguments,!0,!0,!1)},r.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":592}],587:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=0;ry;y++)h=s(d,y),p=l(e,y),v[y]=n(h,p);else v=n(d,e);return v}var s=t("tinycolor2"),l=t("fast-isnumeric"),u=t("../components/colorscale/make_scale_function"),c=t("../components/color/attributes").defaultLine,h=t("./str2rgbarray"),f=1;e.exports=a},{"../components/color/attributes":505,"../components/colorscale/make_scale_function":523,"./str2rgbarray":603,"fast-isnumeric":128,tinycolor2:477}],590:[function(t,e,r){"use strict";function n(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(e>r)break;t=t.slice(0,e)+l(t.slice(e+5,r))+t.slice(r+6)}return t}function i(t){return t.replace(/\/g,"\n")}function o(t){return t.replace(/\<.*\>/g,"")}function a(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(r>n)r+=1;else{var i=e[t.slice(r+1,n)];t=i?t.slice(0,r)+i+t.slice(n+1):t.slice(0,r)+t.slice(n+1)}}return t}function s(t){return""+a(o(n(i(t))))}var l=t("superscript-text"),u=t("../constants/string_mappings");e.exports=s},{"../constants/string_mappings":578,"superscript-text":466}],591:[function(t,e,r){"use strict";var n=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var o=t("./coerce");i.valObjects=o.valObjects,i.coerce=o.coerce,i.coerce2=o.coerce2,i.coerceFont=o.coerceFont,i.validate=o.validate;var a=t("./dates");i.dateTime2ms=a.dateTime2ms,i.isDateTime=a.isDateTime,i.ms2DateTime=a.ms2DateTime,i.parseDate=a.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var h=t("./loggers");i.log=h.log,i.warn=h.warn,i.error=h.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var o=0;or?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.randstr=function f(t,e,r){if(r||(r=16),void 0===e&&(e=24),0>=e)return"0";var n,i,o,a=Math.log(Math.pow(2,e))/Math.log(r),s="";for(n=2;a===1/0;n*=2)a=Math.log(Math.pow(2,e/n))/Math.log(r)*n;var l=a-Math.floor(a);for(n=0;n-1||u!==1/0&&u>=Math.pow(2,e)?f(t,e,r):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var r,n,i,o,a=t.length,s=2*a,l=2*e-1,u=new Array(l),c=new Array(a);for(r=0;l>r;r++)u[r]=(1-Math.cos(Math.PI*(r+1)/e))/(2*e);for(r=0;a>r;r++){for(o=0,n=0;l>n;n++)i=r+n+1-e,-a>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=a&&(i=s-1-i),o+=t[i]*u[n];c[r]=o}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var o,a;t.length;)if(a=t.splice(0,1)[0],o=a(e),o&&o.then)return o.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,o=!1,a=!0;for(n=0;ni;i++)e[i][r]=t[i]},i.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,o,a,s=3,l=Object.keys(t);for(n=0;n1?n+o[1]:"";if(i&&(o.length>1||a.length>4))for(;r.test(a);)a=a.replace(r,"$1"+i+"$2");return a+s}},{"./coerce":583,"./dates":584,"./extend":586,"./is_plain_object":592,"./loggers":593,"./matrix":594,"./nested_property":595,"./notifier":596,"./search":599,"./stats":602,d3:124}],592:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],593:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;en;n++)r[n]=new Array(e);return r},r.transposeRagged=function(t){var e,r,n=0,i=t.length;for(e=0;i>e;e++)n=Math.max(n,t[e].length);var o=new Array(n);for(e=0;n>e;e++)for(o[e]=new Array(i),r=0;i>r;r++)o[e][r]=t[r][e];return o},r.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var n,i,o=t.length;if(t[0].length)for(n=new Array(o),i=0;o>i;i++)n[i]=r.dot(t[i],e);else if(e[0].length){var a=r.transposeRagged(e);for(n=new Array(a.length),i=0;ii;i++)n+=t[i]*e[i];return n},r.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},r.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},r.rotationXYMatrix=function(t,e,n){return r.dot(r.dot(r.translationMatrix(e,n),r.rotationMatrix(t)),r.translationMatrix(-e,-n))},r.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var n=1===arguments.length?e[0]:[e[0],e[1]];return r.dot(t,[n[0],n[1],1]).slice(0,2)}},r.apply2DTransform2=function(t){var e=r.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],595:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,o,a,s,l=t;for(a=0;a=0;e--){if(n=t[e],a=!1,Array.isArray(n))for(r=n.length-1;r>=0;r--)u(n[r])?a?n[r]=void 0:n.pop():a=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),a=!1,r=o.length-1;r>=0;r--)u(n[o[r]])&&!i(n[o[r]],o[r])?delete n[o[r]]:a=!0;if(a)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric");e.exports=function(t,e){if(h(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,a,s=0,l=e.split(".");sr||r>o||a>n||n>s?!1:!e||!u(t)}function r(t,e){var r=t[0],l=t[1];if(i>r||r>o||a>l||l>s)return!1;var u,c,h,f,p,d=n.length,m=n[0][0],g=n[0][1],v=0;for(u=1;d>u;u++)if(c=m,h=g,m=n[u][0],g=n[u][1],f=Math.min(c,m),!(f>r||r>Math.max(c,m)||l>Math.max(h,g)))if(l=l&&r!==f&&v++}return v%2===1}var n=t.slice(),i=n[0][0],o=i,a=n[0][1],s=a;n.push(n[0]);for(var l=1;lo;o++)if(a=[t[o][0]-l[0],t[o][1]-l[1]],s=n(a,u),0>s||s>c||Math.abs(n(a,f))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":594}],598:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},a.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},a.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},a.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;rt}function i(t,e){return e>=t}function o(t,e){return t>e}function a(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,h=0,f=e.length,p=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?a:o;f>h&&p++<100;)u=Math.floor((h+f)/2),c(e[u],t)?h=u+1:f=u;return p>90&&l.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,o=i/(n||1)/1e4,a=[e[0]],s=0;n>s;s++)e[s+1]>e[s]+o&&(i=Math.min(i,e[s+1]-e[s]),a.push(e[s+1]));return{vals:a,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,o=e.length-1,a=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;o>i&&a++<100;)n=u((i+o)/2),e[n]<=t?i=n+s:o=n-l;return e[i]}},{"../lib":591,"fast-isnumeric":128}],600:[function(t,e,r){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],601:[function(t,e,r){"use strict";var n=t("../components/color"),i=function(){};e.exports=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=i);t.destroy=function(){t.container.parentNode.removeChild(t.container)};var r=document.createElement("div");return r.textContent="Webgl is not supported by your browser - visit http://get.webgl.org for more info",r.style.cursor="pointer",r.style.fontSize="24px",r.style.color=n.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../components/color":506}],602:[function(t,e,r){"use strict";var n=t("fast-isnumeric");r.aggNums=function(t,e,i,o){var a,s;if(o||(o=i.length),n(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(o),a=0;o>a;a++)s[a]=r.aggNums(t,e,i[a]);i=s}for(a=0;o>a;a++)n(e)?n(i[a])&&(e=t(+e,+i[a])):e=i[a];return e},r.len=function(t){return r.aggNums(function(t){return t+1},0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums(function(t,e){return t+e},0,t)/e},r.variance=function(t,e,i){return e||(e=r.len(t)),n(i)||(i=r.mean(t,e)),r.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":128}],603:[function(t,e,r){"use strict";function n(t){return t=i(t),o.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),o=t("arraytools");e.exports=n},{arraytools:50,tinycolor2:477}],604:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+f.randstr([],64),o=h.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())f.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function a(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=m[n];if(void 0!==i){var o=e[1],a=e[3],s=a.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"
";if("href"!==a.substr(0,4).toLowerCase())return"";var u=a.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,-1===g.indexOf(c.protocol)?"":''}if("br"===n)return"
";if(o)return"sup"===n?'':"sub"===n?'':"";var h=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),i="",a=n.length-1;a>=0;a--){var s=n[a].match(/<(\/?).*>/i);if(s&&"
"!==n[a]){s[1]||(i=n[a]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),o+=2)});var a=e.join(""),u=a.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,o,a=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},o="right"===a?function(){return l.right-n.width}:"center"===a?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:o()-u.left+"px","z-index":1e3}),this}}var h=t("d3"),f=t("../lib"),p=t("../constants/xmlns_namespaces"),d=t("../constants/string_mappings");h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(f.log(r.querySelector("parsererror div").textContent),null):h.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=h.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){p.empty()||(d=s.attr("class")+"-math",p.select("svg."+d).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),c=t.appendSVG(a),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),a=u(i),s=t,l=!s.attr("data-notex")&&a.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,p=h.select(s.node().parentNode);if(!p.empty()){var d=s.attr("class")?s.attr("class").split(" ")[0]:"text";d+="-math",p.selectAll("svg."+d).remove(),p.selectAll("g."+d+"-group").remove(),t.style({visibility:null});for(var m=t.node();m&&m.removeAttribute;m=m.parentNode)m.removeAttribute("data-bb");if(l){var g=f.getPlotDiv(s.node());(g&&g._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};o(l[2],i,function(i,o,a){p.selectAll("svg."+d).remove(),p.selectAll("g."+d+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=p.append("g").classed(d+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),o&&o.node()&&l.node().insertBefore(o.node().cloneNode(!0),l.node().firstChild),l.attr({"class":d,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var h=n(l,"width"),f=n(l,"height"),m=+s.attr("x")-h*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],g=parseInt(s.style("font-size"),10)||n(s,"height"),v=-g/4;"y"===d[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-h/2,v-f/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===d[0]?l.attr({x:s.attr("x"),y:v-f/2}):"a"===d[0]?l.attr({x:0,y:v}):l.attr({x:m,y:+s.attr("y")+v-f/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var m={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},g=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(d.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:d.entityToUnicode[t]}}),b=Object.keys(d.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+d.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){o(),a.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(a.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=h.select(f.getPlotDiv(a.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":a.style("font-family")||"Arial","font-size":a.style("font-size")||12,color:r.fill||a.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(a.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||a.attr("data-unformatted")).call(c(a,e,r)).on("blur",function(){a.text(this.textContent).style({opacity:1});var t,e=h.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(a.node().parentNode).select(t).style({opacity:0});var r=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(a,r)}).on("focus",function(){var t=this;h.select(document).on("mouseup",function(){return h.event.target===t?!1:void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===h.event.which?(a.style({opacity:1 +}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(a,this.textContent)):(s.input.call(a,this.textContent),h.select(this).call(c(a,e,r)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(i)}r||(r={});var a=this,s=h.dispatch("edit","input","cancel"),l=h.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),h.rebind(this,s,"on")}},{"../constants/string_mappings":578,"../constants/xmlns_namespaces":579,"../lib":591,d3:124}],605:[function(t,e,r){"use strict";var n=e.exports={},i=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson").feature;n.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},n.getTopojsonPath=function(t,e){return t+e+".json"},n.getTopojsonFeatures=function(t,e){var r=i[t.locationmode],n=e.objects[r];return o(e,n).features}},{"../plots/geo/constants":634,topojson:478}],606:[function(t,e,r){"use strict";function n(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function i(t){Array.isArray(t._promises)&&t._promises.length>0&&R.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),C.defaultConfig.setBackground(t,e)}function a(t,e){t._context||(t._context=R.extendFlat({},C.defaultConfig));var r=t._context;e&&(Object.keys(e).forEach(function(t){t in r&&("setBackground"===t&&"opaque"===e[t]?r[t]=o:r[t]=e[t])}),e.plot3dPixelRatio&&!r.plotGlPixelRatio&&(r.plotGlPixelRatio=r.plot3dPixelRatio)),r.staticPlot&&(r.editable=!1,r.autosizable=!1,r.scrollZoom=!1,r.doubleClick=!1,r.showTips=!1,r.showLink=!1,r.displayModeBar=!1)}function s(t,e,r){var n=z.select(t).selectAll(".plot-container").data([0]);n.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=n.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),r&&(t.layout=r),C.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(M(t,{}),t._fullLayout.autosize=r.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=C.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var o=t.framework.svg(),a=1,s=t._fullLayout.title;""!==s&&s||(a=0);var l="Click to enter title",u=function(){this.call(C.util.convertToTspans)},c=o.select(".title-group text").call(u);if(t._context.editable){c.attr({"data-unformatted":s}),s&&s!==l||(a=.2,c.attr({"data-unformatted":l}).text(l).style({opacity:a}).on("mouseover.opacity",function(){z.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){z.select(this).transition().duration(1e3).style("opacity",0)}));var h=function(){this.call(C.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(u),this.call(h)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(u)})};c.call(h)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),O.addLinks(t),Promise.resolve()}function l(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var n=C.Axes.list({_fullLayout:t});for(e=0;ee;e++){var a=t.annotations[e];a.ref&&("paper"===a.ref?(a.xref="paper",a.yref="paper"):"data"===a.ref&&(a.xref="x",a.yref="y"),delete a.ref),u(a,"xref"),u(a,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(R.warn("Shapes must be an array."),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var l=t.shapes[e];u(l,"xref"),u(l,"yref")}var c=t.legend;c&&(c.x>3?(c.x=1.02,c.xanchor="left"):c.x<-2&&(c.x=-.02,c.xanchor="right"),c.y>3?(c.y=1.02,c.yanchor="bottom"):c.y<-2&&(c.y=-.02,c.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var h=O.getSubplotIds(t,"gl3d");for(e=0;er;++r)b[r]=g[e]+v*y[2+4*r];p.camera={eye:{x:b[0],y:b[1],z:b[2]},center:{x:g[0],y:g[1],z:g[2]},up:{x:y[1],y:y[5],z:y[9]}},delete p.cameraposition}}return N.clean(t),t}function u(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=C.Axes.cleanId(r,n))}function c(t,e){for(var r=[],n=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),i=0;io&&(s=R.randstr(n),-1!==r.indexOf(s));o++);a.uid=R.randstr(n),n.push(a.uid)}if(r.push(a.uid),"histogramy"===a.type&&"xbins"in a&&!("ybins"in a)&&(a.ybins=a.xbins,delete a.xbins),a.error_y&&"opacity"in a.error_y){var l=N.defaults,u=a.error_y.color||(O.traceIs(a,"bar")?N.defaultLine:l[i%l.length]);a.error_y.color=N.addOpacity(N.rgb(u),N.opacity(u)*a.error_y.opacity),delete a.error_y.opacity}if("bardir"in a&&("h"!==a.bardir||!O.traceIs(a,"bar")&&"histogram"!==a.type.substr(0,9)||(a.orientation="h",_(a)),delete a.bardir),"histogramy"===a.type&&_(a),"histogramx"!==a.type&&"histogramy"!==a.type||(a.type="histogram"),"scl"in a&&(a.colorscale=a.scl,delete a.scl),"reversescl"in a&&(a.reversescale=a.reversescl,delete a.reversescl),a.xaxis&&(a.xaxis=C.Axes.cleanId(a.xaxis,"x")),a.yaxis&&(a.yaxis=C.Axes.cleanId(a.yaxis,"y")),O.traceIs(a,"gl3d")&&a.scene&&(a.scene=O.subplotsRegistry.gl3d.cleanId(a.scene)),O.traceIs(a,"pie")||(Array.isArray(a.textposition)?a.textposition=a.textposition.map(h):a.textposition&&(a.textposition=h(a.textposition))),O.traceIs(a,"2dMap")&&("YIGnBu"===a.colorscale&&(a.colorscale="YlGnBu"),"YIOrRd"===a.colorscale&&(a.colorscale="YlOrRd")),O.traceIs(a,"markerColorscale")&&a.marker){var c=a.marker;"YIGnBu"===c.colorscale&&(c.colorscale="YlGnBu"),"YIOrRd"===c.colorscale&&(c.colorscale="YlOrRd")}if("surface"===a.type&&R.isPlainObject(a.contours)){var p=["x","y","z"];for(o=0;on?o.push(i+n):o.push(n);return o}function m(t,e,r){var n,i;for(n=0;n=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||0>i&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function g(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),m(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&m(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function v(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&l0){var s=w(t._boundingBoxMargins),l=s.left+s.right,u=s.bottom+s.top,c=o._container.node().getBoundingClientRect(),h=1-2*a.frameMargins;i=Math.round(h*(c.width-l)),n=Math.round(h*(c.height-u))}else r=window.getComputedStyle(t),n=parseFloat(r.height)||o.height,i=parseFloat(r.width)||o.width;return Math.abs(o.width-i)>1||Math.abs(o.height-n)>1?(o.height=t.layout.height=n,o.width=t.layout.width=i):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),O.sanitizeMargins(o),e}function k(t){var e=z.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===r.autosize&&(M(t,{}),r.autosize=!0,t.layout.autosize=!0),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];z.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=R.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0);var o=C.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),r._has("cartesian")&&T(t,o),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.selectAll(".layer-subplot");r._imageSubplotLayer=a.selectAll(".imagelayer"),r._shapeSubplotLayer=a.selectAll(".shapelayer");var s=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=s.append("g").classed("imagelayer",!0),r._shapeUpperLayer=s.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var l=R.syncOrAsync([E,function(){return C.Axes.doTicks(t,"redraw")},F.init],t);return l&&l.then&&t._promises.push(l),l}function A(t,e){function r(e,r){return function(){return C.Axes.getFromId(t,e,r)}}for(var n,i,o=t._fullLayout._plots={},a=0;a0,_=C.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),M=w===_;x?t.framework===k&&!b&&M||(t.framework=k,k(t)):M?b&&k(t):(t.framework=k,k(t)),b&&C.Axes.saveRangeInitial(t);var A=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&p(t);for(var S=0;SW.range[0]?[1,2]:[2,1]);else{var Q=W.range[0],K=W.range[1];"log"===F?(0>=Q&&0>=K&&o(H+".autorange",!0),0>=Q?Q=K/1e6:0>=K&&(K=Q/1e6),o(H+".range[0]",Math.log(Q)/Math.LN10),o(H+".range[1]",Math.log(K)/Math.LN10)):(o(H+".range[0]",Math.pow(10,Q)),o(H+".range[1]",Math.pow(10,K)))}else o(H+".autorange",!0)}if("reverse"===U)X.range?X.range.reverse():(o(H+".autorange",!0),X.range=[1,0]),Y.autorange?w=!0:_=!0;else if("annotations"===j.parts[0]||"shapes"===j.parts[0]){var J=j.parts[1],$=j.parts[0],tt=m[$]||[],et=C[R.titleCase($)],rt=tt[J]||{};2===j.parts.length&&("add"===v[I]||R.isPlainObject(v[I])?S[I]="remove":"remove"===v[I]?-1===J?(S[$]=tt,delete S[I]):S[I]=rt:R.log("???",v)),!a(rt,"x")&&!a(rt,"y")||R.containsAny(I,["color","opacity","align","dash"])||(w=!0),et.draw(t,J,j.parts.slice(2).join("."),v[I]),delete v[I]}else if("images"===j.parts[0]){var it=R.objectFromPath(I,F);R.extendDeepAll(t.layout,it),V.supplyLayoutDefaults(t.layout,t._fullLayout),V.draw(t)}else if("mapbox"===j.parts[0]&&"layers"===j.parts[1]){R.extendDeepAll(t.layout,R.objectFromPath(I,F));var ot=(t._fullLayout.mapbox||{}).layers||[];for(P=j.parts[2]+1-ot.length,d=0;P>d;d++)ot.push({});_=!0}else if("updatemenus"===j.parts[0]){R.extendDeepAll(t.layout,R.objectFromPath(I,F));var at=t._fullLayout.updatemenus||[];for(P=j.parts[2]+1-at.length,d=0;P>d;d++)at.push({});_=!0}else 0===j.parts[0].indexOf("scene")?_=!0:0===j.parts[0].indexOf("geo")?_=!0:0===j.parts[0].indexOf("ternary")?_=!0:!g._has("gl2d")||-1===I.indexOf("axis")&&"plot_bgcolor"!==j.parts[0]?"hiddenlabels"===I?w=!0:-1!==j.parts[0].indexOf("legend")?y=!0:-1!==I.indexOf("title")?b=!0:-1!==j.parts[0].indexOf("bgcolor")?x=!0:j.parts.length>1&&R.containsAny(j.parts[1],["tick","exponent","grid","zeroline"])?b=!0:-1!==I.indexOf(".linewidth")&&-1!==I.indexOf("axis")?b=x=!0:j.parts.length>1&&-1!==j.parts[1].indexOf("line")?x=!0:j.parts.length>1&&"mirror"===j.parts[1]?b=x=!0:"margin.pad"===I?b=x=!0:"margin"===j.parts[0]||"autorange"===j.parts[1]||"rangemode"===j.parts[1]||"type"===j.parts[1]||"domain"===j.parts[1]||I.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(I)?k=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(I)&&(_=!0):_=!0,j.set(F)}D.add(t,nt,[t,S],nt,[t,T]),v.autosize&&(v=M(t,v)),(v.height||v.width||v.autosize)&&(w=!0);var st=Object.keys(v),lt=[O.previousPromises];if(_||w)lt.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),C.plot(t,"",m)});else if(st.length&&(O.supplyDefaults(t),g=t._fullLayout,y&<.push(function(){return q.draw(t),O.previousPromises(t)}),x&<.push(E),b&<.push(function(){return C.Axes.doTicks(t,"redraw"),L(t),O.previousPromises(t)}),k)){var ut;for(Z(t),C.Fx.supplyLayoutDefaults(t.layout,g,t._fullData),C.Fx.init(t),ut=O.getSubplotIds(g,"gl3d"),d=0;d1)};u(r.width)&&u(r.height)||s(new Error("Height and width should be pixel values."));var c=n.clone(e,{format:"png",height:r.height,width:r.width}),h=c.td;h.style.position="absolute",h.style.left="-5000px",document.body.appendChild(h);var f=n.getRedrawFunc(h);o.plot(h,c.data,c.layout,c.config).then(f).then(l).then(function(e){t(e)}).catch(function(t){s(t)})});return s}var i=t("fast-isnumeric"),o=t("../plotly"),a=t("../lib");e.exports=n},{"../lib":591,"../plotly":612,"../snapshot":688,"fast-isnumeric":128}],611:[function(t,e,r){"use strict";function n(t,e,r,i,o,u){u=u||[];for(var c=Object.keys(t),f=0;f1&&l.push(a("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,g=r.length,v=0;g>v;v++){var y=r[v],b=["data",v];if(d(y)){var x=c[v],_=x.type,w=s.traces[_].attributes;w.type={valType:"enumerated",values:[_]},x.visible===!1&&y.visible!==!1&&l.push(a("invisible",b)),n(y,x,w,l,b);var M=y.transforms,k=x.transforms;if(M){m(M)||l.push(a("array",b,["transforms"])),b.push("transforms");for(var A=0;Au&&c>e&&(void 0===i[r]?o[h]=T.tickText(t,e):o[h]=s(t,e,String(i[r])),h++);return h=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{b(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function a(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,o))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,o=e.x,s=t._tickround,l=new Date(o),u="";r&&t.hoverformat?i=a(t.hoverformat,o):t.tickformat?i=a(t.tickformat,o):(n&&(b(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=j(l):"m"===s?i=D(l):(o!==t._tmin||r||(u="
"+j(l)),"d"===s?i=O(l):"H"===s?i=F(l):(o!==t._tmin||r||(u="
"+O(l)+", "+j(l)),i=N(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=f(v(o/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var o=t.dtick,a=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=f(Math.pow(10,a),t,i,n);else if(b(o)||"D"===o.charAt(0)&&v(a+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(a);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=f(Math.pow(10,a),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(a,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>a?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}function f(t,e,r,n){var i=0>t,a=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat;if(n){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(c),a=(Number(c._tickround)||0)+4,l=c._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-a)/2;if("none"===s&&(l=0),t=Math.abs(t),h>t)t="0",i=!1;else{if(t+=h,l&&(t*=Math.pow(10,-l),a+=l),0===a)t=String(Math.floor(t));else if(0>a){t=String(Math.round(t)),t=t.substr(0,t.length+a);for(var f=a;0>f;f++)t+="0"}else{t=String(t);var p=t.indexOf(".")+1;p&&(t=t.substr(0,p+a).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(l&&"hide"!==s){var d;d=0>l?"\u2212"+-l:"power"!==s?"+"+l:String(l),"e"===s||("SI"===s||"B"===s)&&(l>12||-15>l)?t+="e"+d:"E"===s?t+="E"+d:"power"===s?t+="\xd710"+d+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function p(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&h/c>f&&(l=a,u=s,f=h/c);if(n===i){var d=n-1,m=n+1;r="tozero"===t.rangemode?0>n?[d,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,d),Math.max(0,m)]:[d,m]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),f=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-f*l.pad,u.val+f*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),p&&r.reverse(),r},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,i=0;id&&(d=m/10),u=t.c2l(d),c=t.c2l(m),y&&(u=Math.min(0,u),c=Math.max(0,c)),n(u)){for(p=!0,a=0;a=f?p=!1:s.val>=u&&s.pad<=f&&(t._min.splice(a,1),a--);p&&t._min.push({val:u,pad:y&&0===u?0:f})}if(n(c)){for(p=!0,a=0;a=c&&s.pad>=h?p=!1:s.val<=c&&s.pad<=h&&(t._max.splice(a,1),a--);p&&t._max.push({val:c,pad:y&&0===c?0:h})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,a,s,l,u,c,h,f,p,d,m,g=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(o=0;6>o;o++)i(o);for(o=g-1;o>5;o--)i(o)}},T.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-p)/h.dtick)%100<2}var o=_.aggNums(Math.min,null,t),a=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:a+.5,size:1};var s;if(r)s=(a-o)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var h={type:"log"===e.type?"linear":e.type,range:[o,a]};T.autoTicks(h,s);var f,p=T.tickIncrement(T.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var d=0,m=0,g=0,v=0,y=0;ym&&(d>.3*x||i(o)||i(a))){var w=h.dtick/2;p+=o>p+w?w:-w}var M=1+Math.floor((a-p)/h.dtick);f=p+M*h.dtick}else for(f=p;a>=f;)f=T.tickIncrement(f,h.dtick);return{start:p,end:f,size:h.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return n(t);if("auto"===t.tickmode||!t.dtick){var e,r=t.nticks;r||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/e):(e="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var i=t.range[1]=s:s>=l)&&(a.push(l),!(a.length>1e3));l=T.tickIncrement(l,t.dtick,i));t._tmax=a[a.length-1];for(var u=new Array(a.length),c=0;c157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,L)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,z)):e>432e5?(t.dtick=i(e,864e5,P),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,z):e>3e4?t.dtick=i(e,6e4,I):e>500?t.dtick=i(e,1e3,I):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,L));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,L)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,L));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),o=n*Number(e.substr(1));if("M"===i){var a=new Date(t);return a.setMonth(a.getMonth()+o)}if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10; +if("D"===i){var s="D2"===e?R:C,l=t+.01*n,u=_.roundUp(v(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]n:n>u;)u=T.tickIncrement(u,i,e);return u}if("L"===c)return Math.log(r((Math.pow(10,n)-o)/h)*h+o)/Math.LN10;if("D"===c){var f="D2"===i?R:C,p=_.roundUp(v(n,1),f,e);return Math.floor(n)+Math.log(y.round(Math.pow(10,p),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var j=y.time.format("%Y"),D=y.time.format("%b %Y"),O=y.time.format("%b %-d"),F=y.time.format("%b %-d %Hh"),N=y.time.format("%H:%M"),B=y.time.format(":%S"),U=/%(\d?)f/g;T.tickText=function(t,e,r){function n(n){var i;return void 0===n?!0:r?"none"===n:(i={first:t._tmin,last:t._tmax}[n],"all"!==n&&e!==i)}var i,o,a=s(t,e),f="array"===t.tickmode,p=r||f;if(f&&Array.isArray(t.ticktext)){var d=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&er&&(k=90),i(c,k)}u._lastangle=k}return a(e),e+" done"}function l(){u._boundingBox=r.node().getBoundingClientRect()}var c=r.selectAll("g."+z).data(S,L);if(!u.showticklabels||!b(n))return c.remove(),void a(e);var h,f,d,v,x;"x"===g?(x="bottom"===B?1:-1,h=function(t){return t.dx+j*x},v=n+(R+C)*x,f=function(t){return t.dy+v+t.fontSize*("bottom"===B?1:-.5)},d=function(t){return b(t)&&0!==t&&180!==t?0>t*x?"end":"start":"middle"}):(x="right"===B?1:-1,f=function(t){return t.dy+t.fontSize/2-j*x},h=function(t){return t.dx+n+(R+C+(90===Math.abs(u.tickangle)?t.fontSize/2:0))*x},d=function(t){return b(t)&&90===Math.abs(t)?"middle":"right"===B?"start":"end"});var M=0,k=0,T=[];c.enter().append("g").classed(z,1).append("text").attr("text-anchor","middle").each(function(e){var r=y.select(this),n=t._promises.length;r.call(A.setPosition,h(e),f(e)).call(A.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),n=t._promises[n],n?T.push(t._promises.pop().then(function(){i(r,u.tickangle)})):i(r,u.tickangle)}),c.exit().remove(),c.each(function(t){M=Math.max(M,t.fontSize)}),i(c,u._lastangle||u.tickangle);var E=_.syncOrAsync([o,s,l]);return E&&E.then&&t._promises.push(E),E}function a(e){if(!r){var n,i,o,a,s=E.getFromId(t,e),l=y.select(t).selectAll("g."+e+"tick"),u={selection:l,side:s.side},h=e.charAt(0),f=t._fullLayout._size,p=1.5,d=s.titlefont.size;if(l.size()){var m=y.select(l.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);m&&(u.offsetLeft=+m[1],u.offsetTop=+m[2])}"x"===h?(i="free"===s.anchor?{_offset:f.t+(1-(s.position||0))*f.h,_length:0}:E.getFromId(t,s.anchor),o=s._offset+s._length/2,a=i._offset+("top"===s.side?-10-d*(p+(s.showticklabels?1:0)):i._length+10+d*(p+(s.showticklabels?1.5:.5))),s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(a+=(c.height-c.margin.b-c.margin.t)*s.rangeslider.thickness+s._boundingBox.height),u.side||(u.side="bottom")):(i="free"===s.anchor?{_offset:f.l+(s.position||0)*f.w,_length:0}:E.getFromId(t,s.anchor),a=s._offset+s._length/2,o=i._offset+("right"===s.side?i._length+10+d*(p+(s.showticklabels?1:.5)):-10-d*(p+(s.showticklabels?.5:0))),n={rotate:"-90",offset:0},u.side||(u.side="left")),M.draw(t,e+"title",{propContainer:s,propName:s._name+".title",dfltName:h.toUpperCase()+" axis",avoid:u,transform:n,attributes:{x:o,y:a,"text-anchor":"middle"}})}}function s(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:x.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[g]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===g}function l(e,r,i){var o=e.gridlayer,a=e.zerolinelayer,l=e["hidegrid"+g]?[]:V,c=u._gridpath||"M0,0"+("x"===g?"v":"h")+r._length,h=o.selectAll("path."+I).data(u.showgrid===!1?[]:l,L);if(h.enter().append("path").classed(I,1).classed("crisp",1).attr("d",c).each(function(t){u.zeroline&&("linear"===u.type||"-"===u.type)&&Math.abs(t.x)m;m++){var y=u.mirrors[a._id+f[m]];"ticks"!==y&&"labels"!==y||(h[m]=!0)}return void 0!==n[2]&&(h[2]=!0),h.forEach(function(t,e){var r=n[e],i=U[e];t&&b(r)&&(p+=d(r+C*i,i*u.ticklen))}),i(r,p),l(e,a,t),o(r,n[3])}}).filter(function(t){return t&&t.then});return G.length?Promise.all(G):0},T.swap=function(t,e){for(var r=p(t,e),n=0;n2*n}function c(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,o=0;o2*n}var h=t("fast-isnumeric"),f=t("tinycolor2").mix,p=t("../../lib"),d=t("../plots"),m=t("../../components/color/attributes").lightFraction,g=t("./layout_attributes"),v=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),b=t("./tick_label_defaults"),x=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),M=t("./clean_datum"),k=t("./axis_ids");e.exports=function(t,e,r,i){function o(r,n){return p.coerce2(t,e,g,r,n)}var a=i.letter,s=i.font||{},l="Click to enter "+(i.title||a.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=k.name2id(i.name));var u=r("type");"-"===u&&(n(e,i.data),"-"===e.type?e.type="linear":u=t.type=e.type),_(e);var c=r("color"),d=c===t.color?c:s.color;r("title",l),p.coerceFont(r,"titlefont",{family:s.family,size:Math.round(1.2*s.size),color:d});var M=2===(t.range||[]).length&&h(t.range[0])&&h(t.range[1]),A=r("autorange",!M);A&&r("rangemode");var T=r("range",[-1,"x"===a?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),p.noneOrAll(t.range,e.range,[0,1]),r("fixedrange"),v(t,e,r,u),b(t,e,r,u,i),y(t,e,r,i),x(t,e,r);var E=o("linecolor",c),S=o("linewidth"),L=r("showline",!!E||!!S);L||(delete e.linecolor,delete e.linewidth),(L||e.ticks)&&r("mirror");var z=o("gridcolor",f(c,i.bgColor,m).toRgbString()),I=o("gridwidth"),P=r("showgrid",i.showGrid||!!z||!!I);P||(delete e.gridcolor,delete e.gridwidth);var C=o("zerolinecolor",c),R=o("zerolinewidth"),j=r("zeroline",i.showGrid||!!C||!!R);return j||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===u?w(a,e.categoryorder,e.categoryarray,i.data):[],e}},{"../../components/color/attributes":505,"../../lib":591,"../plots":671,"./axis_ids":617,"./category_order_defaults":618,"./clean_datum":619,"./layout_attributes":624,"./ordered_categories":626,"./set_convert":629,"./tick_label_defaults":630,"./tick_mark_defaults":631,"./tick_value_defaults":632,"fast-isnumeric":128,tinycolor2:477}],617:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,o=[],a=0;a0;o&&(n="array");var a=r("categoryorder",n);"array"===a&&r("categoryarray"),o||"array"!==a||(e.categoryorder="trace")}}},{}],619:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":591,"fast-isnumeric":128}],620:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],621:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?c.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function a(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../lib"),h=t("../../lib/svg_text_utils"),f=t("../../components/color"),p=t("../../components/drawing"),d=t("../../lib/setcursor"),m=t("../../components/dragelement"),g=t("./axes"),v=t("./select"),y=t("./constants"),b=!0;e.exports=function(t,e,r,s,x,_,w,M){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+dt+", "+mt+")").attr("d",lt+"Z"),ft=pt.append("path").attr("class","zoombox-corners").style({fill:f.background,stroke:f.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+dt+", "+mt+")").attr("d","M0,0Z"),E();for(var o=0;oi?(ct="",at.r=at.l,at.t=at.b,ft.attr("d","M0,0Z")):(at.t=0,at.b=q,ct="x",ft.attr("d","M"+(at.l-.5)+","+(ot-H-.5)+"h-3v"+(2*H+1)+"h3ZM"+(at.r+.5)+","+(ot-H-.5)+"h3v"+(2*H+1)+"h-3Z")):!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ft.transition().style("opacity",1).duration(200),ut=!0)}function L(t,e,r){var n,i,o;for(n=0;nzoom back out","long"),b=!1)))}function I(e,r){var i=1===(w+M).length;if(e)D();else if(2!==r||i){if(1===r&&i){var o=w?U[0]:B[0],a="s"===w||"w"===M?0:1,s=o._name+".range["+a+"]",l=n(o,a),c="left",f="middle";if(o.fixedrange)return;w?(f="n"===w?"top":"bottom","right"===o.side&&(c="right")):"e"===M&&(c="right"),et.call(h.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(l),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r="category"===o.type?o.c2l(e):o.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else j()}function P(e){function r(t,e,r){if(!t.fixedrange){A(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||F._enablescrollzoom){var n=t.querySelector(".plotly");if(!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(vt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void c.log("Did not find wheel motion attributes: ",e);var o,a=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=gt[0]+gt[2]*l,h=(s.bottom-e.clientY)/s.height,f=gt[1]+gt[3]*(1-h);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function i(t,e,r){for(var i=1-e,o=0,a=0;a0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nT;T++){var E=o[T],S=p[E];if(S)k[T]=w.getFromId(t,S.xaxis._id),A[T]=w.getFromId(t,S.yaxis._id);else{var L=a[E]._subplot;k[T]=L.xaxis,A[T]=L.yaxis}}var z=e.hovermode||a.hovermode;if(-1===["x","y","closest"].indexOf(z)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var I,P,C,R,j,D,O,F,N,B,U,V,q=[],G=[];if(Array.isArray(e))for(z="array",C=0;CH||H>Y.width||0>X||X>Y.height)return _.unhoverRaw(t,e)}else H="xpx"in e?e.xpx:k[0]._length/2,X="ypx"in e?e.ypx:A[0]._length/2;if(I="xval"in e?n(o,e.xval):i(k,H),P="yval"in e?n(o,e.yval):i(A,X),!m(I[0])||!m(P[0]))return g.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(R=0;R1||-1!==D.hoverinfo.indexOf("name")?D.name:void 0,index:!1,distance:Math.min(W,M.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},V=q.length,"array"===F){var Z=e[R];"pointNumber"in Z?(U.index=Z.pointNumber,F="closest"):(F="","xval"in Z&&(N=Z.xval,F="x"),"yval"in Z&&(B=Z.yval,F=F?"closest":"y"))}else N=I[O],B=P[O];if(D._module&&D._module.hoverPoints){var Q=D._module.hoverPoints(U,N,B,F);if(Q)for(var K,J=0;JV&&(q.splice(0,V),W=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var $="y"===z&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var tt=b.combine(a.plot_bgcolor||b.background,a.paper_bgcolor),et={hovermode:z,rotateLabels:$,bgColor:tt,container:a._hoverlayer,outerContainer:a._paperdiv},rt=u(q,et);c(q,$?"xa":"ya"),h(rt,$);var nt=t._hoverdata,it=[];for(C=0;C128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):A&&t[i+"Label"]===m?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var h=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);h.selectAll("tspan.line").call(x.setPosition,0,0);var f=e.select("text.name"),g=0;r&&r!==n?(f.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),f.selectAll("tspan.line").call(x.setPosition,0,0),g=f.node().getBoundingClientRect().width+2*P):(f.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var v,M,E=h.node().getBoundingClientRect(),S=t.xa._offset+(t.x0+t.x1)/2,L=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),C=Math.abs(t.y1-t.y0),R=E.width+I+P+g;t.ty0=_-E.top,t.bx=E.width+2*P,t.by=E.height+2*P,t.anchor="start",t.txwidth=E.width,t.tx2width=g,t.offset=0,o?(t.pos=S,v=k>=L+C/2+R,M=L-C/2-R>=0,"top"!==t.idealAlign&&v||!M?v?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")):(t.pos=L,v=w>=S+z/2+R,M=S-z/2-R>=0,"left"!==t.idealAlign&&v||!M?v?(S+=z/2,t.anchor="start"):t.anchor="middle":(S-=z/2,t.anchor="end")),h.attr("text-anchor",t.anchor),g&&f.attr("text-anchor",t.anchor),e.attr("transform","translate("+S+","+L+")"+(o?"rotate("+T+")":""))}),L}function c(t,e){function r(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(.01>o)){if(-.01>i){for(s=t.length-1;s>=0;s--)t[s].dp-=o;n=!1}if(n){var u=0;for(a=0;ae.pmax&&u++;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos>e.pmax-1&&(l.del=!0,u--);for(a=0;a=u);a++)if(l=t[a],l.pos=0;s--)t[s].dp-=o;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,o,a,s,l,u,c=0,h=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,a=0;a.01&&d.pmin===m.pmin&&d.pmax===m.pmax){for(s=p.length-1;s>=0;s--)p[s].dp+=i;for(f.push.apply(f,p),h.splice(a+1,1),u=0,s=f.length-1;s>=0;s--)u+=f[s].dp;for(o=u/f.length,s=f.length-1;s>=0;s--)f[s].dp-=o;n=!1}else a++}h.forEach(r)}for(a=h.length-1;a>=0;a--){var g=h[a];for(s=g.length-1;s>=0;s--){var v=g[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function h(t,e){t.each(function(t){var r=p.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],a=o*(I+P),s=a+o*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(a-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-z,l=t.offset*L),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*I+l)+","+(I+u)+"v"+(t.by/2-I)+"h"+n*t.bx+"v-"+t.by+"H"+(n*I+l)+"V"+(u-I)+"Z"),i.call(x.setPosition,a+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+o*P+l,u+t.ty0-t.by/2+P),r.select("rect").call(x.setRect,s+(o-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function f(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],o=t._hoverdata[n];if(i.curveNumber!==o.curveNumber||String(i.pointNumber)!==String(o.pointNumber))return!0}return!1}var p=t("d3"),d=t("tinycolor2"),m=t("fast-isnumeric"),g=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,r){function n(r,n){return g.coerce(t,e,A.layoutAttributes,r,n)}n("dragmode");var i;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(r);i=o?"y":"x"}else i="closest";n("hovermode",i)},A.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+M.HOVERMINTIME?(a(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){a(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},A.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},A.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indext*e||0===t?M.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":506,"../../components/dragelement":527,"../../components/drawing":529,"../../lib":591,"../../lib/events":585,"../../lib/svg_text_utils":604,"./axes":615,"./constants":620,"./dragbox":621,d3:124,"fast-isnumeric":128,tinycolor2:477}],623:[function(t,e,r){"use strict";var n=t("../plots"),i=t("./constants");r.name="cartesian",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex=i.idRegex,r.attrRegex=i.attrRegex,r.attributes=t("./attributes"),r.plot=function(t){function e(t,e){for(var r=[],n=0;nh[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":591,"fast-isnumeric":128}],628:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),o=t("../../components/color"),a=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,h){function f(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function p(t,e){return t-e}var d,m=i.gd._fullLayout._zoomlayer,g=i.element.getBoundingClientRect(),v=i.plotinfo.x()._offset,y=i.plotinfo.y()._offset,b=e-g.left,x=r-g.top,_=b,w=x,M="M"+b+","+x,k=i.xaxes[0]._length,A=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),S=i.xaxes.concat(i.yaxes);"lasso"===h&&(d=l([[b,x]],s.BENDPX));var L=m.selectAll("path.select-outline").data([1,2]);L.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var z,I,P,C,R,j=m.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),D=[],O=i.gd,F=[];for(z=0;z0)return Math.log(e)/Math.LN10;if(0>=e&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*c*Math.abs(n-i))}return a.BADNUM}function r(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):a.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?r:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var n=l.getFromId(t._gd,t.overlaying);t.domain=n.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)i(t.range[e])||(t.range[e]=i(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):a.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):a.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?o.ms2DateTime(t):a.BADNUM},t.d2c=function(t){return i(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var h=t.range.map(o.dateTime2ms);!i(t.range[0])&&i(h[0])&&(t.range[0]=h[0]),!i(t.range[1])&&i(h[1])&&(t.range[1]=h[1])}catch(f){o.error(f,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var r=t._categories.indexOf(e);return-1===r?a.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,o;if(r in e)for(n=e[r],i=new Array(n.length),o=0;on?"0":"1.0"}var r=this.framework,n=r.select("g.choroplethlayer"),i=r.select("g.scattergeolayer"),o=this.projection,a=this.path,s=this.clipAngle;r.selectAll("path.basepath").attr("d",a),r.selectAll("path.graticulepath").attr("d",a),n.selectAll("path.choroplethlocation").attr("d",a),n.selectAll("path.basepath").attr("d",a),i.selectAll("path.js-line").attr("d",a),null!==s?(i.selectAll("path.point").style("opacity",e).attr("transform",t),i.selectAll("text").style("opacity",e).attr("transform",t)):(i.selectAll("path.point").attr("transform",t),i.selectAll("text").attr("transform",t))}},{"../../components/color":506, +"../../components/drawing":529,"../../constants/xmlns_namespaces":579,"../../lib/filter_visible":587,"../../lib/topojson_utils":605,"../../plots/cartesian/axes":615,"./constants":634,"./projections":642,"./set_scale":643,"./zoom":644,"./zoom_reset":645,d3:124,topojson:478}],636:[function(t,e,r){"use strict";var n=t("./geo"),i=t("../../plots/plots");r.name="geo",r.attr="geo",r.idRoot="geo",r.idRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"geo");void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var a=0;a=n}function o(t,e){for(var r=e[0],n=e[1],i=!1,o=0,a=t.length,s=a-1;a>o;s=o++){var l=t[o],u=l[0],c=l[1],h=t[s],f=h[0],p=h[1];c>n^p>n&&(f-u)*(n-c)/(p-c)+u>r&&(i=!i)}return i}function a(t){return t?t/Math.sin(t):1}function s(t){return t>1?P:-1>t?-P:Math.asin(t)}function l(t){return t>1?0:-1>t?I:Math.acos(t)}function u(t,e){var r=(2+P)*Math.sin(e);e/=2;for(var n=0,i=1/0;10>n&&Math.abs(i)>L;n++){var o=Math.cos(e);e-=i=(e+Math.sin(e)*(o+2)-r)/(2*o*(1+o))}return[2/Math.sqrt(I*(4+I))*t*(1+Math.cos(e)),2*Math.sqrt(I/(4+I))*Math.sin(e)]}function c(t,e){function r(r,n){var i=O(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?O:e===1/0?f:(r.invert=function(r,n){var i=O.invert(r/t,n);return i[0]*=e,i},r)}function h(){var t=2,e=D(c),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}function f(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function p(t,e){return[3*t/(2*I)*Math.sqrt(I*I/3-e*e),e]}function d(t,e){return[t,1.25*Math.log(Math.tan(I/4+.4*e))]}function m(t){return function(e){var r,n=t*Math.sin(e),i=30;do e-=r=(e+Math.sin(e)-n)/(1+Math.cos(e));while(Math.abs(r)>L&&--i>0);return e/2}}function g(t,e,r){function n(r,n){return[t*r*Math.cos(n=i(n)),e*Math.sin(n)]}var i=m(r);return n.invert=function(n,i){var o=s(i/e);return[n/(t*Math.cos(o)),s((2*o+Math.sin(2*o))/r)]},n}function v(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(-.013791+n*(.003971*r-.001529*n))),e*(1.007226+r*(.015085+n*(-.044475+.028874*r-.005916*n)))]}function y(t,e){var r,n=Math.min(18,36*Math.abs(e)/I),i=Math.floor(n),o=n-i,a=(r=N[i])[0],s=r[1],l=(r=N[++i])[0],u=r[1],c=(r=N[Math.min(19,++i)])[0],h=r[1];return[t*(l+o*(c-a)/2+o*o*(c-2*l+a)/2),(e>0?P:-P)*(u+o*(h-s)/2+o*o*(h-2*u+s)/2)]}function b(t,e){return[t*Math.cos(e),e]}function x(t,e){var r=Math.cos(e),n=a(l(r*Math.cos(t/=2)));return[2*r*Math.sin(t)*n,Math.sin(e)*n]}function _(t,e){var r=x(t,e);return[(r[0]+t/P)/2,(r[1]+e)/2]}t.geo.project=function(t,e){var n=e.stream;if(!n)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:r)(t,n)};var w={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},M=[],k=[],A={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(k.push(M),M=[])},result:function(){var t=k.length?k.length<2?{type:"LineString",coordinates:k[0]}:{type:"MultiLineString",coordinates:k}:null;return k=[],t}},E={polygonStart:n,lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);k.push(M),M=[]}},polygonEnd:n,result:function(){if(!k.length)return null;var t=[],e=[];return k.forEach(function(r){i(r)?t.push([r]):e.push(r)}),e.forEach(function(e){var r=e[0];t.some(function(t){return o(t[0],r)?(t.push(e),!0):void 0})||t.push([e])}),k=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},S={Point:A,MultiPoint:A,LineString:T,MultiLineString:T,Polygon:E,MultiPolygon:E,Sphere:E},L=1e-6,z=L*L,I=Math.PI,P=I/2,C=(Math.sqrt(I),I/180),R=180/I,j=t.geo.projection,D=t.geo.projectionMutator;t.geo.interrupt=function(e){function r(t,r){for(var n=0>r?-1:1,i=l[+(0>r)],o=0,a=i.length-1;a>o&&t>i[o][2][0];++o);var s=e(t-i[o][1][0],r);return s[0]+=e(i[o][1][0],n*r>n*i[o][0][1]?i[o][0][1]:r)[0],s}function n(){s=l.map(function(t){return t.map(function(t){var r,n=e(t[0][0],t[0][1])[0],i=e(t[2][0],t[2][1])[0],o=e(t[1][0],t[0][1])[1],a=e(t[1][0],t[1][1])[1];return o>a&&(r=o,o=a,a=r),[[n,o],[i,a]]})})}function i(){for(var e=1e-6,r=[],n=0,i=l[0].length;i>n;++n){var a=l[0][n],s=180*a[0][0]/I,u=180*a[0][1]/I,c=180*a[1][1]/I,h=180*a[2][0]/I,f=180*a[2][1]/I;r.push(o([[s+e,u+e],[s+e,c-e],[h-e,c-e],[h-e,f+e]],30))}for(var n=l[1].length-1;n>=0;--n){var a=l[1][n],s=180*a[0][0]/I,u=180*a[0][1]/I,c=180*a[1][1]/I,h=180*a[2][0]/I,f=180*a[2][1]/I;r.push(o([[h-e,f-e],[h-e,c+e],[s+e,c+e],[s+e,u-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}function o(t,e){for(var r,n,i,o=-1,a=t.length,s=t[0],l=[];++ou;++u)l.push([s[0]+u*n,s[1]+u*i]);s=r}return l.push(r),l}function a(t,e){return Math.abs(t[0]-e[0])n)],o=l[+(0>n)],u=0,c=i.length;c>u;++u){var h=i[u];if(h[0][0]<=t&&tL&&--i>0);return[t/(.8707+(o=n*n)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),n]},(t.geo.naturalEarth=function(){return j(v)}).raw=v;var N=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];N.forEach(function(t){t[1]*=1.0144}),y.invert=function(t,e){var r=e/P,n=90*r,i=Math.min(18,Math.abs(n/5)),o=Math.max(0,Math.floor(i));do{var a=N[o][1],s=N[o+1][1],l=N[Math.min(19,o+2)][1],u=l-a,c=l-2*s+a,h=2*(Math.abs(r)-s)/u,f=c/u,p=h*(1-f*h*(1-2*f*h));if(p>=0||1===o){n=(e>=0?5:-5)*(p+i);var d,m=50;do i=Math.min(18,Math.abs(n)/5),o=Math.floor(i),p=i-o,a=N[o][1],s=N[o+1][1],l=N[Math.min(19,o+2)][1],n-=(d=(e>=0?P:-P)*(s+p*(l-a)/2+p*p*(l-2*s+a)/2)-e)*R;while(Math.abs(d)>z&&--m>0);break}}while(--o>=0);var g=N[o][0],v=N[o+1][0],y=N[Math.min(19,o+2)][0];return[t/(v+p*(y-g)/2+p*p*(y-2*v+g)/2),n*C]},(t.geo.robinson=function(){return j(y)}).raw=y,b.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return j(b)}).raw=b,x.invert=function(t,e){if(!(t*t+4*e*e>I*I+L)){var r=t,n=e,i=25;do{var o,a=Math.sin(r),s=Math.sin(r/2),u=Math.cos(r/2),c=Math.sin(n),h=Math.cos(n),f=Math.sin(2*n),p=c*c,d=h*h,m=s*s,g=1-d*u*u,v=g?l(h*u)*Math.sqrt(o=1/g):o=0,y=2*v*h*s-t,b=v*c-e,x=o*(d*m+v*h*u*p),_=o*(.5*a*f-2*v*c*s),w=.25*o*(f*s-v*c*d*a),M=o*(p*u+v*m*h),k=_*w-M*x;if(!k)break;var A=(b*_-y*M)/k,T=(y*w-b*x)/k;r-=A,n-=T}while((Math.abs(A)>L||Math.abs(T)>L)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return j(x)}).raw=x,_.invert=function(t,e){var r=t,n=e,i=25;do{var o,a=Math.cos(n),s=Math.sin(n),u=Math.sin(2*n),c=s*s,h=a*a,f=Math.sin(r),p=Math.cos(r/2),d=Math.sin(r/2),m=d*d,g=1-h*p*p,v=g?l(a*p)*Math.sqrt(o=1/g):o=0,y=.5*(2*v*a*d+r/P)-t,b=.5*(v*s+n)-e,x=.5*o*(h*m+v*a*p*c)+.5/P,_=o*(f*u/4-v*s*d),w=.125*o*(u*d-v*s*h*f),M=.5*o*(c*p+v*m*a)+.5,k=_*w-M*x,A=(b*_-y*M)/k,T=(y*w-b*x)/k;r-=A,n-=T}while((Math.abs(A)>L||Math.abs(T)>L)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return j(_)}).raw=_}e.exports=n},{}],643:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.lonaxis,a=t.lataxis,l=t.domain,u=t.framewidth||0,c=e.w*(l.x[1]-l.x[0]),h=e.h*(l.y[1]-l.y[0]),f=n.range[0]+s,p=n.range[1]-s,d=a.range[0]+s,m=a.range[1]-s,g=n._fullRange[0]+s,v=n._fullRange[1]-s,y=a._fullRange[0]+s,b=a._fullRange[1]-s;r._translate0=[e.l+c/2,e.t+h/2];var x=p-f,_=m-d,w=[f+x/2,d+_/2],M=r._rotate;r._center=[w[0]+M[0],w[1]+M[1]];var k=function(e){function n(t){return Math.min(_*c/(t[1][0]-t[0][0]),_*h/(t[1][1]-t[0][1]))}var a,s,l,x,_=e.scale(),w=r._translate0,M=i(f,d,p,m),k=i(g,y,v,b);l=o(e,M),a=n(l),x=o(e,k),r._fullScale=n(x),e.scale(a),l=o(e,M),s=[w[0]-l[0][0]+u,w[1]-l[0][1]+u],r._translate=s,e.translate(s),l=o(e,M),t._isAlbersUsa||e.clipExtent(l),a=r.scale*a,r._scale=a,t._width=Math.round(l[1][0])+u,t._height=Math.round(l[1][1])+u,t._marginX=(c-Math.round(l[1][0]))/2,t._marginY=(h-Math.round(l[1][1]))/2};return k}function i(t,e,r,n){var i=(r-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,n],[t+i,n],[t+2*i,n],[t+3*i,n],[r,n],[r,e],[r-i,e],[r-2*i,e],[r-3*i,e],[t,e]]]}}function o(t,e){return a.geo.path().projection(t).bounds(e)}var a=t("d3"),s=t("./constants").clipPad;e.exports=n},{"./constants":634,d3:124}],644:[function(t,e,r){"use strict";function n(t,e){var r;return(r=e._isScoped?o:e._clipAngle?s:a)(t,e.projection)}function i(t,e){var r=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*r,100*r])}function o(t,e){function r(){_.select(this).style(k)}function n(){a.scale(_.event.scale).translate(_.event.translate),t.render()}function o(){_.select(this).style(A)}var a=t.projection,s=i(a,e);return s.on("zoomstart",r).on("zoom",n).on("zoomend",o),s}function a(t,e){function r(t){return g.invert(t)}function n(t){var e=g(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(k),l=_.mouse(this),u=g.rotate(),c=g.translate(),h=u,f=r(l)}function a(){return p=_.mouse(this),n(l)?(v.scale(g.scale()),void v.translate(g.translate())):(g.scale(_.event.scale),g.translate([c[0],_.event.translate[1]]),f?r(p)&&(m=r(p),d=[h[0]+(m[0]-f[0]),u[1],u[2]],g.rotate(d),h=d):(l=p,f=r(l)),void t.render())}function s(){_.select(this).style(A)}var l,u,c,h,f,p,d,m,g=t.projection,v=i(g,e),y=2;return v.on("zoomstart",o).on("zoom",a).on("zoomend",s),v}function s(t,e){function r(t){v++||t({type:"zoomstart"})}function n(t){t({type:"zoom"})}function o(t){--v||t({type:"zoomend"})}var a,s=t.projection,p={r:s.rotate(),k:s.scale()},d=i(s,e),m=x(d,"zoomstart","zoom","zoomend"),v=0,y=d.on;return d.on("zoomstart",function(){_.select(this).style(k);var t=_.mouse(this),e=s.rotate(),i=e,o=s.translate(),v=u(e);a=l(s,t),y.call(d,"zoom",function(){var r=_.mouse(this);if(s.scale(p.k=_.event.scale),a){if(l(s,r)){s.rotate(e).translate(o);var u=l(s,r),d=h(a,u),y=g(c(v,d)),b=p.r=f(y,a,i);isFinite(b[0])&&isFinite(b[1])&&isFinite(b[2])||(b=i),s.rotate(b),i=b}}else t=r,a=l(s,t);n(m.of(this,arguments))}),r(m.of(this,arguments))}).on("zoomend",function(){_.select(this).style(A),y.call(d,"zoom",null),o(m.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(d,m,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&v(r)}function u(t){var e=.5*t[0]*w,r=.5*t[1]*w,n=.5*t[2]*w,i=Math.sin(e),o=Math.cos(e),a=Math.sin(r),s=Math.cos(r),l=Math.sin(n),u=Math.cos(n);return[o*s*u+i*a*l,i*s*u-o*a*l,o*a*u+i*s*l,o*s*l-i*a*u]}function c(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],l=e[2],u=e[3];return[r*a-n*s-i*l-o*u,r*s+n*a+i*u-o*l,r*l-n*u+i*a+o*s,r*u+n*l-i*s+o*a]}function h(t,e){if(t&&e){var r=b(t,e),n=Math.sqrt(y(r,r)),i=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),o=Math.sin(i)/n;return n&&[Math.cos(i),r[2]*o,-r[1]*o,r[0]*o]}}function f(t,e,r){var n=m(e,2,t[0]);n=m(n,1,t[1]),n=m(n,0,t[2]-r[2]);var i,o,a=e[0],s=e[1],l=e[2],u=n[0],c=n[1],h=n[2],f=Math.atan2(s,a)*M,d=Math.sqrt(a*a+s*s);Math.abs(c)>d?(o=(c>0?90:-90)-f,i=0):(o=Math.asin(c/d)*M-f,i=Math.sqrt(d*d-c*c));var g=180-o-2*f,v=(Math.atan2(h,u)-Math.atan2(l,i))*M,y=(Math.atan2(h,u)-Math.atan2(l,-i))*M,b=p(r[0],r[1],o,v),x=p(r[0],r[1],g,y);return x>=b?[o,v,r[2]]:[g,y,r[2]]}function p(t,e,r,n){var i=d(r-t),o=d(n-e);return Math.sqrt(i*i+o*o)}function d(t){return(t%360+540)%360-180}function m(t,e,r){var n=r*w,i=t.slice(),o=0===e?1:0,a=2===e?1:2,s=Math.cos(n),l=Math.sin(n);return i[o]=t[o]*s-t[a]*l,i[a]=t[a]*s+t[o]*l,i}function g(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function v(t){var e=t[0]*w,r=t[1]*w,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function y(t,e){for(var r=0,n=0,i=t.length;i>n;++n)r+=t[n]*e[n];return r}function b(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 x(t){for(var e=0,r=arguments.length,n=[];++ep;++p){for(e=u[p],r=t[this.scene[e]._name],n=/Click to enter .+ title/.test(r.title)?"":r.title,d=0;2>=d;d+=2)this.labelEnable[p+d]=!1,this.labels[p+d]=a(n),this.labelColor[p+d]=s(r.titlefont.color),this.labelFont[p+d]=r.titlefont.family,this.labelSize[p+d]=r.titlefont.size,this.labelPad[p+d]=this.getLabelPad(e,r),this.tickEnable[p+d]=!1,this.tickColor[p+d]=s((r.tickfont||{}).color),this.tickAngle[p+d]="auto"===r.tickangle?0:Math.PI*-r.tickangle/180,this.tickPad[p+d]=this.getTickPad(r),this.tickMarkLength[p+d]=0,this.tickMarkWidth[p+d]=r.tickwidth||0,this.tickMarkColor[p+d]=s(r.tickcolor),this.borderLineEnable[p+d]=!1,this.borderLineColor[p+d]=s(r.linecolor),this.borderLineWidth[p+d]=r.linewidth||0;c=this.hasSharedAxis(r),o=this.hasAxisInDfltPos(e,r)&&!c,l=this.hasAxisInAltrPos(e,r)&&!c,i=r.mirror||!1,h=c?-1!==String(i).indexOf("all"):!!i,f=c?"allticks"===i:-1!==String(i).indexOf("ticks"),o?this.labelEnable[p]=!0:l&&(this.labelEnable[p+2]=!0),o?this.tickEnable[p]=r.showticklabels:l&&(this.tickEnable[p+2]=r.showticklabels),(o||h)&&(this.borderLineEnable[p]=r.showline),(l||h)&&(this.borderLineEnable[p+2]=r.showline),(o||f)&&(this.tickMarkLength[p]=this.getTickMarkLength(r)),(l||f)&&(this.tickMarkLength[p+2]=this.getTickMarkLength(r)),this.gridLineEnable[p]=r.showgrid,this.gridLineColor[p]=s(r.gridcolor),this.gridLineWidth[p]=r.gridwidth,this.zeroLineEnable[p]=r.zeroline,this.zeroLineColor[p]=s(r.zerolinecolor),this.zeroLineWidth[p]=r.zerolinewidth}},l.hasSharedAxis=function(t){var e=this.scene,r=o.Plots.getSubplotIds(e.fullLayout,"gl2d"),n=o.Axes.findSubplotsWithAxis(r,t);return 0!==n.indexOf(e.id)},l.hasAxisInDfltPos=function(t,e){var r=e.side;return"xaxis"===t?"bottom"===r:"yaxis"===t?"left"===r:void 0},l.hasAxisInAltrPos=function(t,e){var r=e.side;return"xaxis"===t?"top"===r:"yaxis"===t?"right"===r:void 0},l.getLabelPad=function(t,e){var r=1.5,n=e.titlefont.size,i=e.showticklabels;return"xaxis"===t?"top"===e.side?-10+n*(r+(i?1:0)):-10+n*(r+(i?.5:0)):"yaxis"===t?"right"===e.side?10+n*(r+(i?1:.5)):10+n*(r+(i?.5:0)):void 0},l.getTickPad=function(t){return"outside"===t.ticks?10+t.ticklen:15},l.getTickMarkLength=function(t){if(!t.ticks)return 0;var e=t.ticklen;return"inside"===t.ticks?-e:e},e.exports=i},{"../../lib/html2unicode":590,"../../lib/str2rgbarray":603,"../../plotly":612}],648:[function(t,e,r){"use strict";var n=t("./scene2d"),i=t("../plots"),o=t("../../constants/xmlns_namespaces");r.name="gl2d",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex={x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},r.attrRegex={x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},r.attributes=t("../cartesian/attributes"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"gl2d"),a=0;ar;++r){var n=t[r],i=e[r];if(n.length!==i.length)return!0;for(var o=0;oa;++a,--s)for(var l=0;r>l;++l)for(var u=0;4>u;++u){var c=i[4*(r*a+l)+u];i[4*(r*a+l)+u]=i[4*(r*s+l)+u],i[4*(r*s+l)+u]=c}var h=document.createElement("canvas");h.width=r,h.height=n;var f=h.getContext("2d"),p=f.createImageData(r,n);p.data.set(i),f.putImageData(p,0,0);var d;switch(t){case"jpeg":d=h.toDataURL("image/jpeg");break;case"webp":d=h.toDataURL("image/webp");break;default:d=h.toDataURL("image/png")}return this.staticPlot&&this.container.removeChild(o),d},v.computeTickMarks=function(){this.xaxis._length=this.glplot.viewBox[2]-this.glplot.viewBox[0],this.yaxis._length=this.glplot.viewBox[3]-this.glplot.viewBox[1];for(var t=[s.calcTicks(this.xaxis),s.calcTicks(this.yaxis)],e=0;2>e;++e)for(var r=0;r_;++_)m[_]=Math.min(m[_],x.bounds[_]),m[_+2]=Math.max(m[_+2],x.bounds[_+2]);for(y=0;2>y;++y)m[y]>m[y+2]&&(m[y]=-1,m[y+2]=1),v=this[g[y]],v._length=h.viewBox[y+2]-h.viewBox[y],s.doAutoRange(v);h.ticks=this.computeTickMarks();var w=this.xaxis.range,M=this.yaxis.range;h.dataBox=[w[0],M[0],w[1],M[1]],h.merge(r),n.update(h),this.glplot.draw()},v.updateTraces=function(t,e){var r,n,i,o=Object.keys(this.traces);t:for(r=0;rf;++f)a=a&&l[f]===s[f],l[f]=s[f];var p=t.clientWidth===c&&t.clientHeight===h;return c=t.clientWidth,h=t.clientHeight,a?!p:(u=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(f,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){var e=n.computedUp.slice(),r=n.computedEye.slice(),o=n.computedCenter.slice();if(n.setMode(t),"turntable"===t){var a=i();n._active.lookAt(a,r,o,e),n._active.lookAt(a+500,r,o,[0,0,1]),n._active.flush(a)}return n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return u},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var p=0,d=0;return a(t,function(e,r,o,a){var s="rotate"===f.keyBindingMode,l="pan"===f.keyBindingMode,c="zoom"===f.keyBindingMode,h=!!a.control,m=!!a.alt,g=!!a.shift,v=!!(1&e),y=!!(2&e),b=!!(4&e),x=1/t.clientHeight,_=x*(r-p),w=x*(o-d),M=f.flipX?1:-1,k=f.flipY?1:-1,A=i(),T=Math.PI*f.rotateSpeed;if((s&&v&&!h&&!m&&!g||v&&!h&&!m&&g)&&n.rotate(A,M*T*_,-k*T*w,0),(l&&v&&!h&&!m&&!g||y||v&&h&&!m&&!g)&&n.pan(A,-f.translateSpeed*_*u,f.translateSpeed*w*u,0),c&&v&&!h&&!m&&!g||b||v&&!h&&m&&!g){var E=-f.zoomSpeed*w/window.innerHeight*(A-n.lastT())*100;n.pan(A,0,0,u*(Math.exp(E)-1))}return p=r,d=o,!0}),s(t,function(t,e){var r=f.flipX?1:-1,o=f.flipY?1:-1,a=i();if(Math.abs(t)>Math.abs(e))n.rotate(a,0,0,-t*r*Math.PI*f.rotateSpeed/window.innerWidth);else{var s=-f.zoomSpeed*o*e/window.innerHeight*(a-n.lastT())/100;n.pan(a,0,0,u*(Math.exp(s)-1))}},!0),f}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":40,"mouse-change":444,"mouse-wheel":448,"right-now":458}],651:[function(t,e,r){"use strict";function n(t,e){for(var r=0;3>r;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),o=t("../plots"),a=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,a=o.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sr;++r){var n=t[u[r]];e.labels[r]=a(n.title),"titlefont"in n&&(n.titlefont.color&&(e.labelColor[r]=s(n.titlefont.color)),n.titlefont.family&&(e.labelFont[r]=n.titlefont.family),n.titlefont.size&&(e.labelSize[r]=n.titlefont.size)),"showline"in n&&(e.lineEnable[r]=n.showline),"linecolor"in n&&(e.lineColor[r]=s(n.linecolor)),"linewidth"in n&&(e.lineWidth[r]=n.linewidth),"showgrid"in n&&(e.gridEnable[r]=n.showgrid),"gridcolor"in n&&(e.gridColor[r]=s(n.gridcolor)),"gridwidth"in n&&(e.gridWidth[r]=n.gridwidth),"log"===n.type?e.zeroEnable[r]=!1:"zeroline"in n&&(e.zeroEnable[r]=n.zeroline),"zerolinecolor"in n&&(e.zeroLineColor[r]=s(n.zerolinecolor)),"zerolinewidth"in n&&(e.zeroLineWidth[r]=n.zerolinewidth),"ticks"in n&&n.ticks?e.lineTickEnable[r]=!0:e.lineTickEnable[r]=!1,"ticklen"in n&&(e.lineTickLength[r]=e._defaultLineTickLength[r]=n.ticklen),"tickcolor"in n&&(e.lineTickColor[r]=s(n.tickcolor)),"tickwidth"in n&&(e.lineTickWidth[r]=n.tickwidth),"tickangle"in n&&(e.tickAngle[r]="auto"===n.tickangle?0:Math.PI*-n.tickangle/180),"showticklabels"in n&&(e.tickEnable[r]=n.showticklabels),"tickfont"in n&&(n.tickfont.color&&(e.tickColor[r]=s(n.tickfont.color)),n.tickfont.family&&(e.tickFont[r]=n.tickfont.family),n.tickfont.size&&(e.tickSize[r]=n.tickfont.size)),"mirror"in n?-1!==["ticks","all","allticks"].indexOf(n.mirror)?(e.lineTickMirror[r]=!0,e.lineMirror[r]=!0):n.mirror===!0?(e.lineTickMirror[r]=!1,e.lineMirror[r]=!0):(e.lineTickMirror[r]=!1,e.lineMirror[r]=!1):e.lineMirror[r]=!1,"showbackground"in n&&n.showbackground!==!1?(e.backgroundEnable[r]=!0,e.backgroundColor[r]=s(n.backgroundcolor)):e.backgroundEnable[r]=!1}},e.exports=i},{"../../../lib/html2unicode":590,"../../../lib/str2rgbarray":603,arraytools:50}],656:[function(t,e,r){"use strict";function n(t,e,r,n){for(var o=r("bgcolor"),l=i.combine(o,n.paper_bgcolor),u=Object.keys(a.camera),c=0;ce;++e){var r=t[a[e]];this.enabled[e]=r.showspikes,this.colors[e]=o(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness}},e.exports=i},{"../../../lib/str2rgbarray":603}],659:[function(t,e,r){"use strict";function n(t){for(var e=new Array(3),r=0;3>r;++r){for(var n=t[r],i=new Array(n.length),o=0;oc;++c){var h=i[s[c]];if(h._length=(r[c].hi-r[c].lo)*r[c].pixelsPerDataUnit/t.dataScale[c],Math.abs(h._length)===1/0)u[c]=[];else{h.range[0]=r[c].lo/t.dataScale[c],h.range[1]=r[c].hi/t.dataScale[c],h._m=1/(t.dataScale[c]*r[c].pixelsPerDataUnit),h.range[0]===h.range[1]&&(h.range[0]-=1,h.range[1]+=1);var f=h.tickmode;if("auto"===h.tickmode){h.tickmode="linear";var p=h.nticks||o.Lib.constrain(h._length/40,4,9);o.Axes.autoTicks(h,Math.abs(h.range[1]-h.range[0])/p)}for(var d=o.Axes.calcTicks(h),m=0;mc;++c){l[c]=.5*(t.glplot.bounds[0][c]+t.glplot.bounds[1][c]);for(var m=0;2>m;++m)e.bounds[m][c]=t.glplot.bounds[m][c]}t.contourLevels=n(u)}e.exports=i;var o=t("../../../plotly"),a=t("../../../lib/html2unicode"),s=["xaxis","yaxis","zaxis"],l=[0,0,0]},{"../../../lib/html2unicode":590,"../../../plotly":612}],660:[function(t,e,r){"use strict";function n(t,e){var r,n,i=[0,0,0,0];for(r=0;4>r;++r)for(n=0;4>n;++n)i[n]+=t[4*r+n]*e[r];return i}function i(t,e){var r=n(t.projection,n(t.view,n(t.model,[e[0],e[1],e[2],1])));return r}e.exports=i},{}],661:[function(t,e,r){"use strict";function n(t){function e(e,r){if("string"==typeof r)return r;var n=t.fullSceneLayout[e];return m.tickText(n,n.c2l(r),"hover").text}var r,n=t.svgContainer,i=t.container.getBoundingClientRect(),o=i.width,a=i.height;n.setAttributeNS(null,"viewBox","0 0 "+o+" "+a),n.setAttributeNS(null,"width",o),n.setAttributeNS(null,"height",a),k(t),t.glplot.axes.update(t.axesOptions);for(var s=Object.keys(t.traces),l=null,u=t.glplot.selection,c=0;co;++o)l=c[T[o]],_(l);t?Array.isArray(t)||(t=[t]):t=[];var f=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]];for(o=0;oa;++a)f[0][a]>f[1][a]?p[a]=1:f[1][a]===f[0][a]?p[a]=1:p[a]=1/(f[1][a]-f[0][a]);for(this.dataScale=p,o=0;oo;++o){if(l=c[T[o]],u=l.type,u in x?(x[u].acc*=p[o],x[u].count+=1):x[u]={acc:p[o],count:1},l.autorange){for(y[0][o]=1/0,y[1][o]=-(1/0),a=0;ay[1][o])y[0][o]=-1,y[1][o]=1;else{var M=y[1][o]-y[0][o];y[0][o]-=M/32,y[1][o]+=M/32}}else{var k=c[T[o]].range;y[0][o]=k[0],y[1][o]=k[1]}y[0][o]===y[1][o]&&(y[0][o]-=1,y[1][o]+=1),b[o]=y[1][o]-y[0][o],this.glplot.bounds[0][o]=y[0][o]*p[o],this.glplot.bounds[1][o]=y[1][o]*p[o]}var A=[1,1,1];for(o=0;3>o;++o){l=c[T[o]],u=l.type;var E=x[u];A[o]=Math.pow(E.acc,1/E.count)/p[o]}var S,L=4;if("auto"===c.aspectmode)S=Math.max.apply(null,A)/Math.min.apply(null,A)<=L?A:[1,1,1];else if("cube"===c.aspectmode)S=[1,1,1];else if("data"===c.aspectmode)S=A;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var z=c.aspectratio;S=[z.x,z.y,z.z]}c.aspectratio.x=h.aspectratio.x=S[0],c.aspectratio.y=h.aspectratio.y=S[1],c.aspectratio.z=h.aspectratio.z=S[2],this.glplot.aspect=S;var I=c.domain||null,P=e._size||null;if(I&&P){var C=this.container.style;C.position="absolute",C.left=P.l+I.x[0]*P.w+"px",C.top=P.t+(1-I.y[1])*P.h+"px",C.width=P.w*(I.x[1]-I.x[0])+"px",C.height=P.h*(I.y[1]-I.y[0])+"px"}this.glplot.redraw()}},A.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},A.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},A.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},A.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},A.saveCamera=function(t){function e(t,e,r,n){var i=["up","center","eye"],o=["x","y","z"];return e[i[r]]&&t[i[r]][o[n]]===e[i[r]][o[n]]}var r=this.getCamera(),n=p.nestedProperty(t,this.id+".camera"),i=n.get(),o=!1;if(void 0===i)o=!0;else for(var a=0;3>a;a++)for(var s=0;3>s;s++)if(!e(r,i,a,s)){o=!0;break}return o&&n.set(r),o},A.updateFx=function(t,e){var r=this.camera;r&&("orbit"===t?(r.mode="orbit",r.keyBindingMode="rotate"):"turntable"===t?(r.up=[0,0,1],r.mode="turntable",r.keyBindingMode="rotate"):r.keyBindingMode=t),this.fullSceneLayout.hovermode=e},A.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var o=0,a=n-1;a>o;++o,--a)for(var s=0;r>s;++s)for(var l=0;4>l;++l){var u=i[4*(r*o+s)+l];i[4*(r*o+s)+l]=i[4*(r*a+s)+l],i[4*(r*a+s)+l]=u}var h=document.createElement("canvas");h.width=r,h.height=n;var f=h.getContext("2d"),p=f.createImageData(r,n);p.data.set(i),f.putImageData(p,0,0);var d;switch(t){case"jpeg":d=h.toDataURL("image/jpeg");break;case"webp":d=h.toDataURL("image/webp");break;default:d=h.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(c),d},e.exports=o},{"../../lib":591,"../../lib/show_no_webgl_msg":601,"../../lib/str2rgbarray":603,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622,"../../plots/plots":671,"./camera":650,"./layout/convert":655,"./layout/spikes":658,"./layout/tick_marks":659,"./project":660,"./set_convert":662,"gl-plot3d":194}],662:[function(t,e,r){"use strict";var n=t("../cartesian/axes"),i=function(){};e.exports=function(t){n.setConvert(t),t.setScale=i}},{"../cartesian/axes":615}],663:[function(t,e,r){"use strict";var n=t("../plotly"),i=t("./font_attributes"),o=t("../components/color/attributes"),a=n.Lib.extendFlat;e.exports={font:{family:a({},i.family,{dflt:'"Open Sans", verdana, arial, sans-serif'}),size:a({},i.size,{dflt:12}),color:a({},i.color,{dflt:o.defaultLine})},title:{valType:"string",dflt:"Click to enter Plot title"},titlefont:a({},i,{}),autosize:{valType:"enumerated",values:[!0,!1,"initial"]},width:{valType:"number",min:10,dflt:700},height:{valType:"number",min:10,dflt:450},margin:{l:{valType:"number",min:0,dflt:80},r:{valType:"number",min:0,dflt:80},t:{valType:"number",min:0,dflt:100},b:{valType:"number",min:0,dflt:80},pad:{valType:"number",min:0,dflt:0},autoexpand:{valType:"boolean",dflt:!0}},paper_bgcolor:{valType:"color",dflt:o.background},plot_bgcolor:{valType:"color",dflt:o.background},separators:{valType:"string",dflt:".,"},hidesources:{valType:"boolean",dflt:!1},smith:{valType:"enumerated",values:[!1],dflt:!1},showlegend:{valType:"boolean"},_composedModules:{"*":"Fx"},_nestedModules:{xaxis:"Axes",yaxis:"Axes",scene:"gl3d",geo:"geo",legend:"Legend",annotations:"Annotations",shapes:"Shapes",images:"Images",updatemenus:"UpdateMenus",ternary:"ternary",mapbox:"mapbox"}}},{"../components/color/attributes":505,"../plotly":612,"./font_attributes":633}],664:[function(t,e,r){"use strict";e.exports={styleUrlPrefix:"mapbox://styles/mapbox/",styleUrlSuffix:"v9",controlContainerClassName:"mapboxgl-control-container",noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:"," Plotly.plot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join("\n"),mapOnErrorMsg:"Mapbox error."}},{}],665:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r=t.split(" "),i=r[0],o=r[1],a=Array.isArray(e)?n.mean(e):e,s=.5+a/100,l=1.5+a/100,u=["",""],c=[0,0];switch(i){case"top":u[0]="top",c[1]=-l;break;case"bottom":u[0]="bottom",c[1]=l}switch(o){case"left":u[1]="right",c[0]=-s;break;case"right":u[1]="left",c[0]=s}var h;return h=u[0]&&u[1]?u.join("-"):u[0]?u[0]:u[1]?u[1]:"center",{anchor:h,offset:c}}},{"../../lib":591}],666:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n0}function o(t){var e={},r={};switch(t.type){ +case"circle":s.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var n=t.symbol,i=l(n.textposition,n.iconsize);s.extendFlat(e,{"icon-image":n.icon+"-15","icon-size":n.iconsize/10,"text-field":n.text,"text-size":n.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(r,{"icon-color":t.color,"text-color":n.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:r}}function a(t){var e,r=t.sourcetype,n=t.source,i={type:r},o="string"==typeof n;return"geojson"===r?e="data":"vector"===r&&(e=o?"url":"tiles"),i[e]=n,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=n.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var r=a(t);e.addSource(this.idSource,r)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var r={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",r)}},u.updateStyle=function(t){var e=o(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,r){var i=new n(t,e);return i.update(r),i}},{"../../lib":591,"./convert_text_opts":665}],668:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color").defaultLine,o=t("../font_attributes"),a=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},accesstoken:{valType:"string",noBlank:!0,strict:!0},style:{valType:"any",values:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],dflt:"basic"},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},layers:{_isLinkedToArray:!0,sourcetype:{valType:"enumerated",values:["geojson","vector"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},type:{valType:"enumerated",values:["circle","line","fill","symbol"],dflt:"circle"},below:{valType:"string",dflt:""},color:{valType:"color",dflt:i},opacity:{valType:"number",min:0,max:1,dflt:1},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2}},fill:{outlinecolor:{valType:"color",dflt:i}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},textfont:n.extendDeep({},o,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:n.extendFlat({},a,{arrayOk:!1})}}}},{"../../components/color":506,"../../lib":591,"../../traces/scatter/attributes":773,"../font_attributes":633}],669:[function(t,e,r){"use strict";function n(t,e,r){r("accesstoken"),r("style"),r("center.lon"),r("center.lat"),r("zoom"),r("bearing"),r("pitch"),i(t,e),e._input=t}function i(t,e){function r(t,e){return o.coerce(n,i,s.layers,t,e)}for(var n,i,a=t.layers||[],l=e.layers=[],u=0;u=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),r.attr(o);var a=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&i(t,a),s.text(a.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},i=t.layout||{},a=t._fullData||[],s=t._fullData=[],l=t.data||[];p.supplyLayoutGlobalDefaults(i,n),n._dataLength=l.length,p.supplyDataDefaults(l,s,n),n._has=p._hasPlotType.bind(n);var u=n._modules;for(e=0;eo&&(e=(r-1)/(i.l+i.r),i.l=Math.floor(e*i.l),i.r=Math.floor(e*i.r)),0>a&&(e=(n-1)/(i.t+i.b),i.t=Math.floor(e*i.t),i.b=Math.floor(e*i.b))}},p.autoMargin=function(t,e,r){var n=t._fullLayout;if(n._pushmargin||(n._pushmargin={}),n.margin.autoexpand!==!1){if(r){var i=void 0===r.pad?12:r.pad;r.l+r.r>.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),a=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;return e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:o},t:{val:1,size:a},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,h=r.size,f=n.val,p=n.size;Object.keys(l).forEach(function(t){if(u(h)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var d=(h*r+(n-e.width)*c)/(r-c),m=(n*(1-c)+(h-e.width)*(1-r))/(r-c);d>=0&&m>=0&&d+m>i+o&&(i=d,o=m)}}if(u(p)&&l[t].t){var g=l[t].t.val,v=l[t].t.size;if(g>f){var y=(p*g+(v-e.height)*f)/(g-f),b=(v*(1-f)+(p-e.height)*(1-g))/(g-f);y>=0&&b>=0&&y+b>s+a&&(s=y,a=b)}}})})),r.l=Math.round(i),r.r=Math.round(o),r.t=Math.round(a),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,t._replotting||"{}"===n||n===JSON.stringify(e._size)?void 0:c.plot(t)},p.graphJson=function(t,e,r,n,i){function o(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=o(t[e])}return i}return Array.isArray(t)?t.map(o):t&&t.getTime?h.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var a=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(a||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(l.layout=o(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)}},{"../components/color":506,"../lib":591,"../plotly":612,"./attributes":613,"./font_attributes":633,"./layout_attributes":663,d3:124,"fast-isnumeric":128}],672:[function(t,e,r){"use strict";var n=t("../../traces/scatter/attributes"),i=n.marker;e.exports={r:n.r,t:n.t,marker:{color:i.color,size:i.size,symbol:i.symbol,opacity:i.opacity}}},{"../../traces/scatter/attributes":773}],673:[function(t,e,r){"use strict";function n(t,e){var r={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,r)}var i=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,a=o({},i.domain,{});e.exports={radialaxis:n("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:a,orientation:{valType:"number"}}),angularaxis:n("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:a}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":586,"../cartesian/layout_attributes":624}],674:[function(t,e,r){var n=t("../../plotly"),i=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},a=n.Lib.extendDeepAll;o.Axis=function(){function t(t){r=t||r;var u=l.data,h=l.layout;return("string"==typeof r||r.nodeName)&&(r=i.select(r)),r.datum(u).each(function(t,r){function l(t,e){return s(t)%360+h.orientation}var u=t.slice();c={data:o.util.cloneJson(u),layout:o.util.cloneJson(h)};var f=0;u.forEach(function(t,e){t.color||(t.color=h.defaultColorRange[f],f=(f+1)%h.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:i.rgb(t.color).darker().toString()),c.data[e].color=t.color,c.data[e].strokeColor=t.strokeColor,c.data[e].strokeDash=t.strokeDash,c.data[e].strokeSize=t.strokeSize});var p=u.filter(function(t,e){var r=t.visible;return"undefined"==typeof r||r===!0}),d=!1,m=p.map(function(t,e){return d=d||"undefined"!=typeof t.groupId,t});if(d){var g=i.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(m),v=[],y=g.map(function(t,e){if("unstacked"===t.key)return t.values;var r=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,n){t.yStack=[r],v.push(r),r=o.util.sumArrays(t.r,r)}),t.values});p=i.merge(y)}p.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var b=Math.min(h.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2;b=Math.max(10,b);var x,_=[h.margin.left+b,h.margin.top+b];if(d){var w=i.max(o.util.sumArrays(o.util.arrayLast(p).r[0],o.util.arrayLast(v)));x=[0,w]}else x=i.extent(o.util.flattenArray(p.map(function(t,e){return t.r})));h.radialAxis.domain!=o.DATAEXTENT&&(x[0]=0),n=i.scale.linear().domain(h.radialAxis.domain!=o.DATAEXTENT&&h.radialAxis.domain?h.radialAxis.domain:x).range([0,b]),c.layout.radialAxis.domain=n.domain();var M,k=o.util.flattenArray(p.map(function(t,e){return t.t})),A="string"==typeof k[0];A&&(k=o.util.deduplicate(k),M=k.slice(),k=i.range(k.length),p=p.map(function(t,e){var r=t;return t.t=[k],d&&(r.yStack=t.yStack),r}));var T=p.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===p.length,E=null===h.needsEndSpacing?A||!T:h.needsEndSpacing,S=h.angularAxis.domain&&h.angularAxis.domain!=o.DATAEXTENT&&!A&&h.angularAxis.domain[0]>=0,L=S?h.angularAxis.domain:i.extent(k),z=Math.abs(k[1]-k[0]);T&&!A&&(z=0);var I=L.slice();E&&A&&(I[1]+=z);var P=h.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),h.angularAxis.ticksStep&&(P=(I[1]-I[0])/P);var C=h.angularAxis.ticksStep||(I[1]-I[0])/(P*(h.minorTicks+1));M&&(C=Math.max(Math.round(C),1)),I[2]||(I[2]=C);var R=i.range.apply(this,I);if(R=R.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=i.scale.linear().domain(I.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?z:0,e=i.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var j="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",D=(new DOMParser).parseFromString(j,"application/xml"),O=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=i.select(O)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,N=e.select(".chart-group"),B={fill:"none",stroke:h.tickColor},U={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[b,h.margin.top]+")"}).style({display:"block"});var V=p.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:p.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:F,elements:V,reverseOrder:h.legend.reverseOrder})})();var q=F.node().getBBox();b=Math.min(h.width-q.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,b=Math.max(10,b),_=[h.margin.left+b,h.margin.top+b],n.range([0,b]),c.layout.radialAxis.domain=n.domain(),F.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),N.attr("transform","translate("+_+")").style({cursor:"crosshair"});var G=[(h.width-(h.margin.left+h.margin.right+2*b+(q?q.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*b))/2];if(G[0]=Math.max(0,G[0]),G[1]=Math.max(0,G[1]),e.select(".outer-group").attr("transform","translate("+G+")"),h.title){var H=e.select("g.title-group text").style(U).text(h.title),X=H.node().getBBox();H.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(n.ticks(5));W.enter().append("circle").attr({"class":"grid-circle"}).style(B),W.attr("r",n),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(B);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var Q=i.svg.axis().scale(n).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+h.radialAxis.orientation+")"}),Y.selectAll(".domain").style(B),Y.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var K=e.select(".angular.axis-group").selectAll("g.angular-tick").data(R),J=K.enter().append("g").classed("angular-tick",!0);K.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),K.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(B),J.selectAll(".minor").style({stroke:h.minorTickColor}),K.select("line.grid-line").attr({x1:h.tickLength?b-h.tickLength:0,x2:b}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(U);var $=K.select("text.axis-text").attr({x:b+h.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+h.labelOffset,i=h.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?270>r&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(180>=r&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:h.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(h.minorTicks+1)!=0?"":M?M[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(U);h.angularAxis.rewriteTicks&&$.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var tt=i.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[b+tt,h.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(rt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),p[0]||et){var nt=[];p.forEach(function(t,e){var r={};r.radialScale=n,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=i.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),ot=[];it.forEach(function(t,e){ +"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var at,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!A){var pt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;pt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;at=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(at)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var dt=lt.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;dt.attr({r:r}).style({opacity:.5}),st=n.invert(o.util.getMousePos(Z).radius);var i=o.util.convertToCartesian(r,h.radialAxis.orientation);ht.text(o.util.round(st)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ft.hide(),ct.hide(),ht.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var n=i.select(this),a=n.style("fill"),s="black",l=n.style("opacity")||1;if(n.attr({"data-opacity":l}),"none"!=a){n.attr({"data-fill":a}),s=i.hsl(a).darker().toString(),n.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,h=this.getBoundingClientRect(),f=e.node().getBoundingClientRect(),p=[h.left+h.width/2-G[0]-f.left,h.top+h.height/2-G[1]-f.top];ft.config({color:s}).text(c),ft.move(p)}else a=n.style("stroke"),n.attr({"data-stroke":a}),s=i.hsl(a).darker().toString(),n.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=i.event.which?!1:void(i.select(this).attr("data-fill")&&ft.show())}).on("mouseout.tooltip",function(t,e){ft.hide();var r=i.select(this),n=r.attr("data-fill");n?r.style({fill:n,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),f}var e,r,n,s,l={data:[],layout:{}},u={},c={},h=i.dispatch("hover"),f={};return f.render=function(e){return t(e),this},f.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},f.getLiveConfig=function(){return c},f.getinputConfig=function(){return u},f.radialScale=function(t){return n},f.angularScale=function(t){return s},f.svg=function(){return e},i.rebind(f,h,"on"),f},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:i.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,n=i.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return n},o.util.dataFromEquation=function(t,e,r){var n=e||6,o=[],a=[];i.range(0,360+n,n).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);o.push(e),a.push(i)});var s={t:o,r:a};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return i.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return i.zip(t,e).map(function(t,e){return i.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=i.mouse(t.node()),r=e[0],n=e[1],o={};return o.x=r,o.y=n,o.pos=e,o.angle=180*(Math.atan2(n,r)+Math.PI)/Math.PI,o.radius=Math.sqrt(r*r+n*n),o},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,o=t.length;o>i;i++)e=t[i],e in r?(r[e]++,n[e]=r[e]):r[e]=1;return n},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,r,n){if(n){var i=r.slice();r=e,e=i}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,r,n){return"undefined"!=typeof t?(n===e.length-1&&delete t[r],t[r]):void 0},t),r.reduce(function(t,e,n){return"undefined"==typeof t[e]&&(t[e]={}),n===r.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=r[0].geometryConfig,e=t.container;"string"==typeof e&&(e=i.select(e)),e.datum(r).each(function(e,r){function n(e,r){var n=t.radialScale(e[1]),i=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:n,t:i}}function o(t){var e=t.r*Math.cos(t.t),r=t.r*Math.sin(t.t);return{x:e,y:r}}var a=!!e[0].data.yStack,l=e.map(function(t,e){return a?i.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):i.zip(t.data.t[0],t.data.r[0])}),u=t.angularScale,c=t.radialScale.domain()[0],h={};h.bar=function(r,n,o){var a=e[o].data,s=t.radialScale(r[1])-t.radialScale(0),l=t.radialScale(r[2]||0),c=a.barWidth;i.select(this).attr({"class":"mark bar",d:"M"+[[s+l,-c/2],[s+l,c/2],[l,c/2],[l,-c/2]].join("L")+"Z",transform:function(e,r){return"rotate("+(t.orientation+u(e[0]))+")"}})},h.dot=function(t,r,a){var s=t[2]?[t[0],t[1]+t[2]]:t,l=i.svg.symbol().size(e[a].data.dotSize).type(e[a].data.dotType)(t,r);i.select(this).attr({"class":"mark dot",d:l,transform:function(t,e){var r=o(n(s));return"translate("+[r.x,r.y]+")"}})};var f=i.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});h.line=function(r,n,o){var a=r[2]?l[o].map(function(t,e){return[t[0],t[1]+t[2]]}):l[o];if(i.select(this).each(h.dot).style({opacity:function(t,r){return+e[o].data.dotVisible},fill:g.stroke(r,n,o)}).attr({"class":"mark dot"}),!(n>0)){var s=i.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({"class":"line",d:f(a),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return g.fill(r,n,o)},"fill-opacity":0,stroke:function(t,e){return g.stroke(r,n,o)},"stroke-width":function(t,e){return g["stroke-width"](r,n,o)},"stroke-dasharray":function(t,e){return g["stroke-dasharray"](r,n,o)},opacity:function(t,e){return g.opacity(r,n,o)},display:function(t,e){return g.display(r,n,o)}})}};var p=t.angularScale.range(),d=Math.abs(p[1]-p[0])/l[0].length*Math.PI/180,m=i.svg.arc().startAngle(function(t){return-d/2}).endAngle(function(t){return d/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});h.arc=function(e,r,n){i.select(this).attr({"class":"mark arc",d:m,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var g={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},v=i.select(this).selectAll("g.layer").data(l);v.enter().append("g").attr({"class":"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(g).each(h[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],n=i.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},i.rebind(t,n,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:i.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,n=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=i.merge(n);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=i.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,h=c?r.height:u*o.length,f=s.classed("legend-group",!0),p=f.selectAll("svg").data([0]),d=p.enter().append("svg").attr({width:300,height:h+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});d.append("g").classed("legend-axis",!0),d.append("g").classed("legend-marks",!0);var m=i.range(o.length),g=i.scale[c?"linear":"ordinal"]().domain(m).range(l),v=i.scale[c?"linear":"ordinal"]().domain(m)[c?"range":"rangePoints"]([0,h]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=i.svg.symbolTypes.indexOf(t)?i.svg.symbol().type(t).size(r)():i.svg.symbol().type("square").size(r)()};if(c){var b=p.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),p.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=p.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,v(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return g(e)}}),x.exit().remove()}var _=i.svg.axis().scale(v).orient("right"),w=p.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=i.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},i.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,n={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=n.container.selectAll("g."+s).data([0]);var i=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return r=i.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=i.append("text").attr({dx:n.padding+l,dy:.3*+n.fontSize}),u};return u.text=function(o){var a=i.hsl(n.color).l,s=a>=.5?"#aaa":"white",c=a>=.5?"black":"white",h=o||"";e.style({fill:c,"font-size":n.fontSize+"px"}).text(h);var f=n.padding,p=e.node().getBBox(),d={fill:n.color,stroke:s,"stroke-width":"2px"},m=p.width+2*f+l,g=p.height+2*f;return r.attr({d:"M"+[[l,-g/2],[l,-g/4],[n.hasTick?0:l,0],[l,g/4],[l,g/2],[m,g/2],[m,-g/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[l,-g/2+2*f]+")"}),t.style({display:"block"}),u},u.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u):void 0},u.hide=function(){return t?(t.style({display:"none"}),u):void 0},u.show=function(){return t?(t.style({display:"block"}),u):void 0},u.config=function(t){return a(n,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var n=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var i=n.indexOf(t.geometry);-1!=i&&(r.data[e].groupId=i)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],h={};i.entries(s.margin).forEach(function(t,e){h[c[u.indexOf(t.key)]]=t.value}),s.margin=h}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../plotly":612,"./micropolar_manager":675,d3:124}],675:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("d3"),o=t("./undo_manager"),a=e.exports={},s=n.Lib.extendDeepAll;a.framework=function(t){function e(e,o){return o&&(h=o),i.select(i.select(h).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?s(r,e):e,u||(u=n.micropolar.Axis()),c=n.micropolar.adapter.plotly().convert(r),u.config(c).render(h),t.data=r.data,t.layout=r.layout,a.fillLayout(t),r}var r,l,u,c,h,f=new o;return e.isPolar=!0,e.svg=function(){return u.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return n.micropolar.adapter.plotly().convert(u.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:u.angularScale(),r:u.radialScale()}},e.setUndoPoint=function(){var t=this,e=n.micropolar.util.cloneJson(r);!function(e,r){f.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,l),l=n.micropolar.util.cloneJson(e)},e.undo=function(){f.undo()},e.redo=function(){f.redo()},e},a.fillLayout=function(t){var e=i.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),a={width:800,height:600,paper_bgcolor:n.Color.background,_container:e,_paperdiv:r,_paper:o};t._fullLayout=s(a,t.layout)}},{"../../plotly":612,"./undo_manager":676,d3:124}],676:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return nm;m++){var g=p[m];s=t[g]?t[g]:t[g]={},e[g]=l={},a("domain."+f,[m/d,(m+1)/d]),a("domain."+{x:"y",y:"x"}[f]),o.id=g,h(s,l,a,o)}}},{"../lib":591,"./plots":671}],678:[function(t,e,r){"use strict";var n=t("./ternary"),i=t("../../plots/plots");r.name="ternary",r.attr="subplot",r.idRoot="ternary",r.idRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"ternary"),a=0;a=a&&(p.min=0,d.min=0,m.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),o=t("../../subplot_defaults"),a=t("./layout_attributes"),s=t("./axis_defaults"),l=["aaxis","baxis","caxis"];e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:a,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":506,"../../subplot_defaults":677,"./axis_defaults":681,"./layout_attributes":683}],683:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:i,baxis:i,caxis:i}},{"../../../components/color/attributes":505,"./axis_attributes":680}],684:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function i(t){o.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var o=t("d3"),a=t("tinycolor2"),s=t("../../plotly"),l=t("../../lib"),u=t("../../components/color"),c=t("../../components/drawing"),h=t("../cartesian/set_convert"),f=t("../../lib/extend").extendFlat,p=t("../cartesian/axes"),d=t("../../lib/filter_visible"),m=t("../../components/dragelement"),g=t("../../components/titles"),v=t("../cartesian/select"),y=t("../cartesian/constants"),b=t("../cartesian/graph_interact");e.exports=n;var x=n.prototype;x.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},x.plot=function(t,e){var r,n=this,i=e[n.id],o=e._size;l.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(i,o);var a=n.traceHash,s={};for(r=0;r_*y?(o=y,i=o*_):(i=v,o=i/_),a=m*i/v,s=g*o/y,r=e.l+e.w*p-i/2,n=e.t+e.h*(1-d)-o/2,l.x0=r,l.y0=n,l.w=i,l.h=o,l.sum=b,l.xaxis={type:"linear",range:[x+2*M-b,b-x-2*w],domain:[p-a/2,p+a/2],_id:"x",_gd:l.graphDiv},h(l.xaxis),l.xaxis.setScale(),l.yaxis={type:"linear",range:[x,b-w-M],domain:[d-s/2,d+s/2],_id:"y",_gd:l.graphDiv},h(l.yaxis),l.yaxis.setScale();var k=l.yaxis.domain[0],A=l.aaxis=f({},t.aaxis,{range:[x,b-w-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[k,k+s*_],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l"+o+",-"+i/2});h(A);var T=l.baxis=f({},t.baxis,{range:[b-x-M,w],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_gd:l.graphDiv,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+o});h(T),A._counteraxis=T;var E=l.caxis=f({},t.caxis,{range:[b-x-w,M],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[k,k+s*_],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l-"+o+","+i/2});h(E);var S="M"+r+","+(n+o)+"h"+i+"l-"+i/2+",-"+o+"Z";l.clipDef.select("path").attr("d",S),l.layers.plotbg.select("path").attr("d",S);var L="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",L);var z="translate("+r+","+(n+o)+")";l.layers.baxis.attr("transform",z),l.layers.bgrid.attr("transform",z);var I="translate("+(r+i/2)+","+n+")rotate(30)";l.layers.aaxis.attr("transform",I),l.layers.agrid.attr("transform",I);var P="translate("+(r+i/2)+","+n+")rotate(-30)";l.layers.caxis.attr("transform",P),l.layers.cgrid.attr("transform",P),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1);var C=l.layers.axlines;C.select(".aline").attr("d",A.showline?"M"+r+","+(n+o)+"l"+i/2+",-"+o:"M0,0").call(u.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),C.select(".bline").attr("d",T.showline?"M"+r+","+(n+o)+"h"+i:"M0,0").call(u.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),C.select(".cline").attr("d",E.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+o:"M0,0").call(u.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px")},x.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",i=e.aaxis,o=e.baxis,a=e.caxis;if(p.doTicks(r,i,!0),p.doTicks(r,o,!0),p.doTicks(r,a,!0),t){var s=Math.max(i.showticklabels?i.tickfont.size/2:0,(a.showticklabels?.75*a.tickfont.size:0)+("outside"===a.ticks?.87*a.ticklen:0));g.draw(r,"a"+n,{propContainer:i,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-i.titlefont.size/3-s,"text-anchor":"middle"}});var l=(o.showticklabels?o.tickfont.size:0)+("outside"===o.ticks?o.ticklen:0)+3;g.draw(r,"b"+n,{propContainer:o,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-l,y:e.y0+e.h+.83*o.titlefont.size+l,"text-anchor":"middle"}}),g.draw(r,"c"+n,{propContainer:a,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+l,y:e.y0+e.h+.83*a.titlefont.size+l,"text-anchor":"middle"}})}};var w=y.MINZOOM/2+.87,M="m-0.87,.5h"+w+"v3h-"+(w+5.2)+"l"+(w/2+2.6)+",-"+(.87*w+4.5)+"l2.6,1.5l-"+w/2+","+.87*w+"Z",k="m0.87,.5h-"+w+"v3h"+(w+5.2)+"l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-2.6,1.5l"+w/2+","+.87*w+"Z",A="m0,1l"+w/2+","+.87*w+"l2.6,-1.5l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-"+(w/2+2.6)+","+(.87*w+4.5)+"l2.6,1.5l"+w/2+",-"+.87*w+"Z",T="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",E=!0; +x.initInteractions=function(){function t(t,e,r){var n=O.getBoundingClientRect();x=e-n.left,w=r-n.top,S={a:D.aaxis.range[0],b:D.baxis.range[1],c:D.caxis.range[1]},z=S,L=D.aaxis.range[1]-S.a,I=a(D.graphDiv._fullLayout[D.id].bgcolor).getLuminance(),P="M0,"+D.h+"L"+D.w/2+", 0L"+D.w+","+D.h+"Z",C=!1,R=N.append("path").attr("class","zoombox").style({fill:I>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",P),j=N.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),d()}function e(t,e){return 1-e/D.h}function r(t,e){return 1-(t+(D.h-e)/Math.sqrt(3))/D.w}function n(t,e){return(t-(D.h-e)/Math.sqrt(3))/D.w}function o(t,i){var o=x+t,a=w+i,s=Math.max(0,Math.min(1,e(x,w),e(o,a))),l=Math.max(0,Math.min(1,r(x,w),r(o,a))),u=Math.max(0,Math.min(1,n(x,w),n(o,a))),c=(s/2+u)*D.w,h=(1-s/2-l)*D.w,f=(c+h)/2,p=h-c,d=(1-s)*D.h,m=d-p/_;p.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),j.transition().style("opacity",1).duration(200),C=!0)}function c(t,e){if(z===S)return 2===e&&g(),i(F);i(F);var r={};r[D.id+".aaxis.min"]=z.a,r[D.id+".baxis.min"]=z.b,r[D.id+".caxis.min"]=z.c,s.relayout(F,r),E&&F.data&&F._context.showTips&&(l.notifier("Double-click to
zoom back out","long"),E=!1)}function h(){S={a:D.aaxis.range[0],b:D.baxis.range[1],c:D.caxis.range[1]},z=S}function f(t,e){var r=t/D.xaxis._m,n=e/D.yaxis._m;z={a:S.a-n,b:S.b+(r+n)/2,c:S.c-(r-n)/2};var i=[z.a,z.b,z.c].sort(),o={a:i.indexOf(z.a),b:i.indexOf(z.b),c:i.indexOf(z.c)};i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),z={a:i[o.a],b:i[o.b],c:i[o.c]},e=(S.a-z.a)*D.yaxis._m,t=(S.c-z.c-S.b+z.b)*D.xaxis._m);var a="translate("+(D.x0+t)+","+(D.y0+e)+")";D.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",a),D.aaxis.range=[z.a,D.sum-z.b-z.c],D.baxis.range=[D.sum-z.a-z.c,z.b],D.caxis.range=[D.sum-z.a-z.b,z.c],D.drawAxes(!1),D.plotContainer.selectAll(".crisp").classed("crisp",!1)}function p(t,e){if(t){var r={};r[D.id+".aaxis.min"]=z.a,r[D.id+".baxis.min"]=z.b,r[D.id+".caxis.min"]=z.c,s.relayout(F,r)}else 2===e&&g()}function d(){D.plotContainer.selectAll(".select-outline").remove()}function g(){var t={};t[D.id+".aaxis.min"]=0,t[D.id+".baxis.min"]=0,t[D.id+".caxis.min"]=0,F.emit("plotly_doubleclick",null),s.relayout(F,t)}var x,w,S,L,z,I,P,C,R,j,D=this,O=D.layers.plotbg.select("path").node(),F=D.graphDiv,N=D.layers.zoom,B={element:O,gd:F,plotinfo:{plot:N},doubleclick:g,subplot:D.id,prepFn:function(e,r,n){B.xaxes=[D.xaxis],B.yaxes=[D.yaxis];var i=F._fullLayout.dragmode;e.shiftKey&&(i="pan"===i?"zoom":"pan"),"lasso"===i?B.minDrag=1:B.minDrag=void 0,"zoom"===i?(B.moveFn=o,B.doneFn=c,t(e,r,n)):"pan"===i?(B.moveFn=f,B.doneFn=p,h(),d()):"select"!==i&&"lasso"!==i||v(e,r,n,B,i)}};O.onmousemove=function(t){b.hover(F,t,D.id),F._fullLayout._lasthover=O,F._fullLayout._hoversubplot=D.id},O.onmouseout=function(t){F._dragging||m.unhover(F,t)},O.onclick=function(t){b.click(F,t)},m.init(B)}},{"../../components/color":506,"../../components/dragelement":527,"../../components/drawing":529,"../../components/titles":569,"../../lib":591,"../../lib/extend":586,"../../lib/filter_visible":587,"../../plotly":612,"../cartesian/axes":615,"../cartesian/constants":620,"../cartesian/graph_interact":622,"../cartesian/select":628,"../cartesian/set_convert":629,d3:124,tinycolor2:477}],685:[function(t,e,r){"use strict";function n(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function i(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),a=o.Lib.extendFlat,s=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,l=t.data,u=t.layout,c=s([],l),h=s({},u,n(e.tileClass));if(e.width&&(h.width=e.width),e.height&&(h.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){h.annotations=[];var f=Object.keys(h);for(r=0;rl;l++)n(r[l])&&p.push({p:r[l],s:s[l],b:0});return o(e,"marker")&&a(e,e.marker.color,"marker","c"),o(e,"marker.line")&&a(e,e.marker.line.color,"marker.line","c"),p}},{"../../components/colorscale/calc":513,"../../components/colorscale/has_colorscale":519,"../../plots/cartesian/axes":615,"fast-isnumeric":128}],695:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),o=t("../scatter/xy_defaults"),a=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=o(t,e,c);return h?(c("orientation",e.x&&!e.y?"h":"v"),c("text"),a(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),void s(t,e,i.defaultLine,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/color":506,"../../components/errorbars/defaults":534,"../../lib":591,"../bar/style_defaults":703,"../scatter/xy_defaults":794,"./attributes":693}],696:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/graph_interact"),i=t("../../components/errorbars"),o=t("../../components/color");e.exports=function(t,e,r,a){var s,l=t.cd,u=l[0].trace,c=l[0].t,h=t.xa,f=t.ya,p="closest"===a?c.barwidth/2:c.dbar*(1-h._gd._fullLayout.bargap)/2;s="closest"!==a?function(t){return t.p}:"h"===u.orientation?function(t){return t.y}:function(t){return t.x};var d,m;"h"===u.orientation?(d=function(t){return n.inbox(t.b-e,t.x-e)+(t.x-e)/(t.x-t.b)},m=function(t){var e=s(t)-r;return n.inbox(e-p,e+p)}):(m=function(t){return n.inbox(t.b-r,t.y-r)+(t.y-r)/(t.y-t.b)},d=function(t){var r=s(t)-e;return n.inbox(r-p,r+p)});var g=n.getDistanceFunction(a,d,m);if(n.getClosest(l,g,t),t.index!==!1){var v=l[t.index],y=v.mcc||u.marker.color,b=v.mlcc||u.marker.line.color,x=v.mlw||u.marker.line.width;return o.opacity(y)?t.color=y:o.opacity(b)&&x&&(t.color=b),"h"===u.orientation?(t.x0=t.x1=h.c2p(v.x,!0),t.xLabelVal=v.s,t.y0=f.c2p(s(v)-p,!0),t.y1=f.c2p(s(v)+p,!0),t.yLabelVal=v.p):(t.y0=t.y1=f.c2p(v.y,!0),t.yLabelVal=v.s,t.x0=h.c2p(s(v)-p,!0),t.x1=h.c2p(s(v)+p,!0),t.xLabelVal=v.p),v.tx&&(t.text=v.tx),i.hoverInfo(v,u,t),[t]}}},{"../../components/color":506,"../../components/errorbars":535,"../../plots/cartesian/graph_interact":622}],697:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("./layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.calc=t("./calc"),n.setPositions=t("./set_positions"),n.colorbar=t("../scatter/colorbar"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="bar",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","oriented","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":623,"../scatter/colorbar":776,"./arrays_to_calcdata":692,"./attributes":693,"./calc":694,"./defaults":695,"./hover":696,"./layout_attributes":698,"./layout_defaults":699,"./plot":700,"./set_positions":701,"./style":702}],698:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:""},bargap:{valType:"number",min:0,max:1},bargroupgap:{valType:"number",min:0,max:1,dflt:0}}},{}],699:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){function s(r,n){return o.coerce(t,e,a,r,n)}for(var l=!1,u=!1,c=!1,h={},f=0;f=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var f,p,d,m;if("h"===s.orientation?(d=c.c2p(r.poffset+e.p,!0),m=c.c2p(r.poffset+e.p+r.barwidth,!0),f=u.c2p(e.b,!0),p=u.c2p(e.s+e.b,!0)):(f=u.c2p(r.poffset+e.p,!0),p=u.c2p(r.poffset+e.p+r.barwidth,!0),m=c.c2p(e.s+e.b,!0),d=c.c2p(e.b,!0)),!(i(f)&&i(p)&&i(d)&&i(m)&&f!==p&&d!==m))return void n.select(this).remove();var g=(e.mlw+1||s.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,v=n.round(g/2%1,2);if(!t._context.staticPlot){var y=a.opacity(e.mc||s.marker.color),b=1>y||g>.01?o:l;f=b(f,p),p=b(p,f),d=b(d,m),m=b(m,d)}n.select(this).attr("d","M"+f+","+d+"V"+m+"H"+p+"V"+d+"Z")})}),f.call(s.plot,e)}},{"../../components/color":506,"../../components/errorbars":535,"../../lib":591,"./arrays_to_calcdata":692,d3:124,"fast-isnumeric":128}],701:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/plots"),o=t("../../plots/cartesian/axes"),a=t("../../lib");e.exports=function(t,e){var r,s,l=t._fullLayout,u=e.x(),c=e.y();["v","h"].forEach(function(h){function f(e){function r(t){t[d]=t.p+f}var n=[];e.forEach(function(e){t.calcdata[e].forEach(function(t){n.push(t.p)})});var i=a.distinctVals(n),s=i.vals,u=i.minDiff,c=!1,h=[];"group"===l.barmode&&e.forEach(function(e){c||(t.calcdata[e].forEach(function(t){c||h.forEach(function(e){Math.abs(t.p-e)_&&(L=!0,A=_),_>k+C&&(L=!0,k=_))}o.expand(v,[A,k],{tozero:!0,padded:L})}else{var R=function(t){return t[m]=t.s,t.s};for(r=0;r1||0===s.bargap&&0===s.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,a=r.line,s=(e._input||{}).marker||{},l=o.tryColorscale(r,s,""),u=o.tryColorscale(r,s,"line.");n.select(this).selectAll("path").each(function(t){var e,o,s=(t.mlw+1||a.width+1)-1,c=n.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(r.color)?i.defaultLine:r.color,c.style("stroke-width",s+"px").call(i.fill,e),s&&(o="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(a.color)?i.defaultLine:a.color,c.call(i.stroke,o))})}),e.call(a.style)}},{"../../components/color":506,"../../components/drawing":529,"../../components/errorbars":535,d3:124}],703:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,s){r("marker.color",a),i(t,"marker")&&o(t,e,s,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),i(t,"marker.line")&&o(t,e,s,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width")}},{"../../components/color":506,"../../components/colorscale/defaults":516,"../../components/colorscale/has_colorscale":519}],704:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,a=n.marker,s=a.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},a.symbol,{arrayOk:!1}),opacity:o({},a.opacity,{arrayOk:!1,dflt:1}),size:o({},a.size,{arrayOk:!1}),color:o({},a.color,{arrayOk:!1}),line:{color:o({},s.color,{arrayOk:!1,dflt:i.defaultLine}),width:o({},s.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":505,"../../lib/extend":586,"../scatter/attributes":773}],705:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,o,a){var s;return r in e?d=o.makeCalcdata(e,r):(s=r+"0"in e?e[r+"0"]:"name"in e&&("category"===o.type||n(e.name)&&-1!==["linear","log"].indexOf(o.type)||i.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,s=o.d2c(s),d=a.map(function(){return s})),d}function a(t,e,r,o,a){var s,l,u,c,h=o.length,f=e.length,p=[],d=[];for(s=0;h>s;++s)l=o[s],t[s]={pos:l},d[s]=l-a,p[s]=[];for(d.push(o[h-1]+a),s=0;f>s;++s)c=e[s],n(c)&&(u=i.findBin(r[s],d),u>=0&&f>u&&p[u].push(c));return p}function s(t,e){var r,n,o,a;for(a=0;a1,v=r.dPos*(1-f.boxgap)*(1-f.boxgroupgap)/(g?t.numboxes:1),y=g?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-f.boxgap):0,b=v*m.whiskerwidth;return m.visible!==!0||r.emptybox?void o.select(this).remove():("h"===m.orientation?(l=d,h=p):(l=p,h=d),r.bPos=y,r.bdPos=v,n(),o.select(this).selectAll("path.box").data(a.identity).enter().append("path").attr("class","box").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=l.c2p(t.pos+y-b,!0),s=l.c2p(t.pos+y+b,!0),u=h.c2p(t.q1,!0),c=h.c2p(t.q3,!0),f=a.constrain(h.c2p(t.med,!0),Math.min(u,c)+1,Math.max(u,c)-1),p=h.c2p(m.boxpoints===!1?t.min:t.lf,!0),d=h.c2p(m.boxpoints===!1?t.max:t.uf,!0);"h"===m.orientation?o.select(this).attr("d","M"+f+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+c+"V"+r+"ZM"+u+","+e+"H"+p+"M"+c+","+e+"H"+d+(0===m.whiskerwidth?"":"M"+p+","+i+"V"+s+"M"+d+","+i+"V"+s)):o.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+u+"H"+n+"V"+c+"H"+r+"ZM"+e+","+u+"V"+p+"M"+e+","+c+"V"+d+(0===m.whiskerwidth?"":"M"+i+","+p+"H"+s+"M"+i+","+d+"H"+s))}),m.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=m}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,s,l,h,f="all"===m.boxpoints?t.val:t.val.filter(function(e){return et.uf}),p=(t.q3-t.q1)*c,d=[],g=0;if(m.jitter){for(e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(s.translatePoints,p,d),void(m.boxmean&&o.select(this).selectAll("path.mean").data(a.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=h.c2p(t.mean,!0),a=h.c2p(t.mean-t.sd,!0),s=h.c2p(t.mean+t.sd,!0);"h"===m.orientation?o.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==m.boxmean?"":"m0,0L"+a+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):o.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==m.boxmean?"":"m0,0L"+e+","+a+"L"+r+","+i+"L"+e+","+s+"Z"))})))})}},{"../../components/drawing":529,"../../lib":591,d3:124}],712:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var r,a,s,l,u=t._fullLayout,c=e.x(),h=e.y(),f=["v","h"];for(a=0;al&&(e.z=c.slice(0,l)),s("locationmode"),s("text"),s("marker.line.color"),s("marker.line.width"),i(t,e,a,s,{prefix:"",cLetter:"z"}),void s("hoverinfo",1===a._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":714}],717:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot").plot,n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":636,"../heatmap/colorbar":731,"./attributes":714,"./calc":715,"./defaults":716,"./plot":718}],718:[function(t,e,r){"use strict";function n(t,e){function r(e){var r=t.mockAxis;return a.tickText(r,r.c2l(e),"hover").text}var n=e.hoverinfo;if("none"===n)return function(t){delete t.nameLabel,delete t.textLabel};var i="all"===n?g.hoverinfo.flags:n.split("+"),o=-1!==i.indexOf("name"),s=-1!==i.indexOf("location"),l=-1!==i.indexOf("z"),u=-1!==i.indexOf("text"),c=!o&&s;return function(t){var n=[];c?t.nameLabel=t.id:(o&&(t.nameLabel=e.name),s&&n.push(t.id)),l&&n.push(r(t.z)),u&&n.push(t.tx),t.textLabel=n.join("
")}}function i(t){return function(e,r){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:r,location:e.id,z:e.z}]}}}var o=t("d3"),a=t("../../plots/cartesian/axes"),s=t("../../plots/cartesian/graph_interact"),l=t("../../components/color"),u=t("../../components/drawing"),c=t("../../components/colorscale/get_scale"),h=t("../../components/colorscale/make_scale_function"),f=t("../../lib/topojson_utils").getTopojsonFeatures,p=t("../../lib/geo_location_utils").locationToFeature,d=t("../../lib/array_to_calc_item"),m=t("../../plots/geo/constants"),g=t("./attributes"),v=e.exports={};v.calcGeoJSON=function(t,e){for(var r,n=[],i=t.locations,o=i.length,a=f(t,e),s=(t.marker||{}).line||{},l=0;o>l;l++)r=p(t.locationmode,i[l],a),void 0!==r&&(r.z=t.z[l],void 0!==t.text&&(r.tx=t.text[l]),d(s.color,r,"mlc",l),d(s.width,r,"mlw",l),n.push(r));return n.length>0&&(n[0].trace=t),n},v.plot=function(t,e,r){var a,l=t.framework,u=l.select("g.choroplethlayer"),c=l.select("g.baselayer"),h=l.select("g.baselayeroverchoropleth"),f=m.baseLayersOverChoropleth,p=u.selectAll("g.trace.choropleth").data(e,function(t){return t.uid});p.enter().append("g").attr("class","trace choropleth"),p.exit().remove(),p.each(function(e){function r(e,r){if(t.showHover){var n=t.projection(e.properties.ct);u(e),s.loneHover({x:n[0],y:n[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),h=c(e,r),t.graphDiv.emit("plotly_hover",h)}}function a(e,r){t.graphDiv.emit("plotly_click",c(e,r))}var l=v.calcGeoJSON(e,t.topojson),u=n(t,e),c=i(e),h=null,f=o.select(this).selectAll("path.choroplethlocation").data(l);f.enter().append("path").classed("choroplethlocation",!0).on("mouseover",r).on("click",a).on("mouseout",function(){s.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",h)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",r),f.exit().remove()}),h.selectAll("*").remove();for(var d=0;dr;r++)e=h[r],p[r]=e[0]*(t.zmax-t.zmin)+t.zmin,d[r]=e[1];var m=n.extent([t.zmin,t.zmax,o.start,o.start+l*(u-1)]),g=m[t.zminr;r++)e=h[r],p[r]=(e[0]*(u+c-1)-c/2)*l+a,d[r]=e[1];var y=n.scale.linear().interpolate(n.interpolateRgb).domain(p).range(d);return y}},{"../../components/colorscale/get_scale":518,d3:124}],726:[function(t,e,r){"use strict";function n(t,e,r){var n=r[0].trace,o=r[0].x,s=r[0].y,u=n.contours,c=n.uid,h=e.x(),f=e.y(),g=t._fullLayout,b="contour"+c,x=i(u,e,r[0]);if(n.visible!==!0)return g._paper.selectAll("."+b+",.hm"+c).remove(),void g._infolayer.selectAll(".cb"+c).remove();"heatmap"===u.coloring?(n.zauto&&n.autocontour===!1&&(n._input.zmin=n.zmin=u.start-u.size/2,n._input.zmax=n.zmax=n.zmin+x.length*u.size),M(t,e,[r])):g._paper.selectAll(".hm"+c).remove(),a(x),l(x);var _=h.c2p(o[0],!0),w=h.c2p(o[o.length-1],!0),k=f.c2p(s[0],!0),A=f.c2p(s[s.length-1],!0),T=[[_,A],[w,A],[w,k],[_,k]],E=p(e,r,b);d(E,T,u),m(E,x,T,u),v(E,x,u),y(E,e,r[0],T)}function i(t,e,r){for(var n=t.size||1,i=[],o=t.start;ot?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function a(t){var e,r,n,i,a,s,l,u,c,h=t[0].z,f=h.length,p=h[0].length,d=2===f||2===p;for(r=0;f-1>r;r++)for(i=[],0===r&&(i=i.concat(k)),r===f-2&&(i=i.concat(A)),e=0;p-1>e;e++)for(n=i.slice(),0===e&&(n=n.concat(T)),e===p-2&&(n=n.concat(E)),a=e+","+r,s=[[h[r][e],h[r][e+1]],[h[r+1][e],h[r+1][e+1]]],c=0;ci;i++){if(s>20?(s=L[s][(l[0]||l[1])<0?0:1],t.crossings[a]=z[s]):delete t.crossings[a],l=S[s],!l){_.log("Found bad marching index:",s,e,t.level);break}if(p.push(f(t,e,l)),e[0]+=l[0],e[1]+=l[1],c(p[p.length-1],p[p.length-2])&&p.pop(),a=e.join(","),a===o&&l.join(",")===d||r&&(l[0]&&(e[0]<0||e[0]>g-2)||l[1]&&(e[1]<0||e[1]>m-2)))break;s=t.crossings[a]}1e4===i&&_.log("Infinite loop in contour?");var v,y,b,x,w,M,k,A=c(p[0],p[p.length-1]),T=0,E=.2*t.smoothing,I=[],P=0;for(i=1;i=P;i--)if(v=I[i],C>v){for(b=0,y=i-1;y>=P&&v+I[y]b&&v+I[b]e;)e++,r=Object.keys(i.crossings)[0].split(",").map(Number),s(i,r);1e4===e&&_.log("Infinite loop in contour?")}}function u(t,e,r){var n=0,i=0;return t>20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==k.indexOf(t)?i=1:-1!==T.indexOf(t)?n=1:-1!==A.indexOf(t)?i=-1:n=-1,[n,i]}function c(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function h(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function f(t,e,r){var n=e[0]+Math.max(r[0],0),i=e[1]+Math.max(r[1],0),o=t.z[i][n],a=t.xaxis,s=t.yaxis;if(r[1]){var l=(t.level-o)/(t.z[i][n+1]-o);return[a.c2p((1-l)*t.x[n]+l*t.x[n+1],!0),s.c2p(t.y[i],!0)]}var u=(t.level-o)/(t.z[i+1][n]-o);return[a.c2p(t.x[n],!0),s.c2p((1-u)*t.y[i]+u*t.y[i+1],!0)]}function p(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function d(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var i=n.selectAll("path").data("fill"===r.coloring?[0]:[]);i.enter().append("path"),i.exit().remove(),i.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function m(t,e,r,n){var i=t.selectAll("g.contourfill").data([0]);i.enter().append("g").classed("contourfill",!0);var o=i.selectAll("path").data("fill"===n.coloring?e:[]);o.enter().append("path"),o.exit().remove(),o.each(function(t){var e=g(t,r);e?x.select(this).attr("d",e).style("stroke","none"):x.select(this).remove()})}function g(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function i(t){return Math.abs(t[0]-e[0][0])<.01}function o(t){return Math.abs(t[0]-e[2][0])<.01}for(var a,s,l,u,c,h,f=t.edgepaths.length||t.z[0][0]l;l++){if(!a){_.log("Missing end?",p,t);break}for(r(a)&&!o(a)?s=e[1]:i(a)?s=e[0]:n(a)?s=e[3]:o(a)&&(s=e[2]),c=0;c=0&&(s=g,u=c):Math.abs(a[1]-s[1])<.01?Math.abs(a[1]-g[1])<.01&&(g[0]-a[0])*(s[0]-g[0])>=0&&(s=g,u=c):_.log("endpt to newendpt is not vert. or horz.",a,s,g)}if(a=s,u>=0)break;f+="L"+s}if(u===t.edgepaths.length){_.log("unclosed perimeter path");break}p=u,m=-1===d.indexOf(p),m&&(p=d[0],f+="Z")}for(p=0;pe;e++)s.push(1);for(e=0;o>e;e++)i.push(s.slice());for(e=0;ea;a++)for(n=i(l,a),c[a]=new Array(n),s=0;n>s;s++)c[a][s]=e(o(l,a,s));return c}function i(t,e,r,n,i,o){var a,s,l,u=[],c=f.traceIs(t,"contour"),h=f.traceIs(t,"histogram"),p=f.traceIs(t,"gl2d"),d=Array.isArray(e)&&e.length>1;if(d&&!h&&"category"!==o.type){e=e.map(o.d2c);var m=e.length;if(!(i>=m))return c?e.slice(0,i):e.slice(0,i+1);if(c||p)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;m>l;l++)u.push(.5*(e[l-1]+e[l]));u.push(1.5*e[m-1]-.5*e[m-2])}if(i>m){var g=u[u.length-1],v=g-u[u.length-2];for(l=m;i>l;l++)g+=v,u.push(g)}}else for(s=n||1,a=h||"category"===o.type?r||0:Array.isArray(e)&&1===e.length?e[0]:void 0===r?0:o.d2c(r),l=c||p?0:-.5;i>l;l++)u.push(a+s*l);return u}function o(t){return.5-.25*Math.min(1,.5*t)}function a(t,e,r){var n,i,a=1;if(Array.isArray(r))for(n=0;nn&&a>y;n++)a=l(t,e,o(a));return a>y&&c.log("interp2d didn't converge quickly",a),t}function s(t){var e,r,n,i,o,a,s,l,u=[],c={},h=[],f=t[0],p=[],d=[0,0,0],m=v(t);for(r=0;rn;n++)void 0===p[n]&&(a=(void 0!==p[n-1]?1:0)+(void 0!==p[n+1]?1:0)+(void 0!==e[n]?1:0)+(void 0!==f[n]?1:0),a?(0===r&&a++,0===n&&a++,r===t.length-1&&a++,n===p.length-1&&a++,4>a&&(c[[r,n]]=[r,n,a]),u.push([r,n,a])):h.push([r,n]));for(;h.length;){for(s={},l=!1,o=h.length-1;o>=0;o--)i=h[o],r=i[0],n=i[1],a=((c[[r-1,n]]||d)[2]+(c[[r+1,n]]||d)[2]+(c[[r,n-1]]||d)[2]+(c[[r,n+1]]||d)[2])/20,a&&(s[i]=[r,n,a],h.splice(o,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,o,a,s,l,u,c,h,f,p,d,m,g=0;for(a=0;as;s++)l=b[s],u=t[i+l[0]],u&&(c=u[o+l[1]],void 0!==c&&(0===f?d=m=c:(d=Math.min(d,c),m=Math.max(m,c)),h++,f+=c));if(0===h)throw"iterateInterp2d order is wrong: no defined neighbors";t[i][o]=f/h,void 0===p?4>h&&(g=1):(t[i][o]=(1+r)*t[i][o]-r*p,m>d&&(g=Math.max(g,Math.abs(t[i][o]-p)/(m-d))))}return g}var u=t("fast-isnumeric"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../../plots/plots"),p=t("../histogram2d/calc"),d=t("../../components/colorscale/calc"),m=t("./has_columns"),g=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function r(t){S=e._input.zsmooth=e.zsmooth=!1,c.notifier("cannot fast-zsmooth: "+t)}var o,l,u,y,b,x,_,w,M=h.getFromId(t,e.xaxis||"x"),k=h.getFromId(t,e.yaxis||"y"),A=f.traceIs(e,"contour"),T=f.traceIs(e,"histogram"),E=f.traceIs(e,"gl2d"),S=A?"best":e.zsmooth;if(M._minDtick=0,k._minDtick=0,T){var L=p(t,e);o=L.x,l=L.x0,u=L.dx,y=L.y,b=L.y0,x=L.dy,_=L.z}else m(e)&&g(e,M,k),o=e.x?M.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(A||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=a(_,e._emptypoints,e._interpz));if("fast"===S)if("log"===M.type||"log"===k.type)r("log axis found");else if(!T){if(o.length){var z=(o[o.length-1]-o[0])/(o.length-1),I=Math.abs(z/100);for(w=0;wI){r("x scale is not linear");break}}if(y.length&&"fast"===S){var P=(y[y.length-1]-y[0])/(y.length-1),C=Math.abs(P/100);for(w=0;wC){r("y scale is not linear");break}}}var R=v(_),j="scaled"===e.xtype?"":e.x,D=i(e,j,l,u,R,M),O="scaled"===e.ytype?"":e.y,F=i(e,O,b,x,_.length,k);E||(h.expand(M,D),h.expand(k,F));var N={x:D,y:F,z:_};if(d(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var B="contour"===e.type?"heatmap":"histogram2d";N.xfill=i(B,j,l,u,R,M),N.yfill=i(B,O,b,x,_.length,k)}return[N]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":513,"../../lib":591,"../../plots/cartesian/axes":615,"../../plots/plots":671,"../histogram2d/calc":750,"./convert_column_xyz":732,"./has_columns":734,"./max_row_length":737,"fast-isnumeric":128}],731:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u="cb"+r.uid,c=s(r.colorscale),h=r.zmin,f=r.zmax;if(i(h)||(h=o.aggNums(Math.min,null,r.z)),i(f)||(f=o.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+u).remove(),!r.showscale)return void a.autoMargin(t,u);var p=e[0].t.cb=l(t,u);p.fillcolor(n.scale.linear().domain(c.map(function(t){return h+t[0]*(f-h)})).range(c.map(function(t){return t[1]}))).filllevels({start:h,end:f,size:(f-h)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":509,"../../components/colorscale/get_scale":518,"../../lib":591,"../../plots/plots":671,d3:124,"fast-isnumeric":128}],732:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,o=t.x.slice(),a=t.y.slice(),s=t.z,l=t.text,u=Math.min(o.length,a.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(ui;i++)o[i]=e.d2c(o[i]),a[i]=r.d2c(a[i]);var h,f,p,d=n.distinctVals(o),m=d.vals,g=n.distinctVals(a),v=g.vals,y=n.init2dArray(v.length,m.length);for(c&&(p=n.init2dArray(v.length,m.length)),i=0;u>i;i++)h=n.findBin(o[i]+d.minDiff/2,m),f=n.findBin(a[i]+g.minDiff/2,v),y[f][h]=s[i],c&&(p[f][h]=l[i]);t.x=m,t.y=v,t.z=y,c&&(t.text=p)}},{"../../lib":591}],733:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./has_columns"),o=t("./xyz_defaults"),a=t("../../components/colorscale/defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function u(r,i){return n.coerce(t,e,s,r,i)}var c=o(t,e,u);return c?(u("text"),u("zsmooth"),u("connectgaps",i(e)&&e.zsmooth!==!1),void a(t,e,l,u,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":729,"./has_columns":734,"./xyz_defaults":740}],734:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],735:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/graph_interact"),i=t("../../lib"),o=t("../../plots/cartesian/constants").MAXDIST;e.exports=function(t,e,r,a,s){if(!(t.distancec||c>=y[0].length||0>h||h>y.length)return}else{if(n.inbox(e-g[0],e-g[g.length-1])>o||n.inbox(r-v[0],r-v[v.length-1])>o)return;if(s){var M;for(x=[2*g[0]-g[1]],M=1;M0;)_=g.c2p(z[A]),A--;for(x>_&&(w=_,_=x,x=w,D=!0),A=0;void 0===M&&A0;)k=v.c2p(I[A]),A--;if(M>k&&(w=M,M=k,k=w,O=!0),P&&(z=r[0].xfill,I=r[0].yfill),"fast"!==C){var F="best"===C?0:.5;x=Math.max(-F*g._length,x),_=Math.min((1+F)*g._length,_),M=Math.max(-F*v._length,M),k=Math.min((1+F)*v._length,k)}var N=Math.round(_-x),B=Math.round(k-M),U=0>=N||0>=B,V=e.plot.select(".imagelayer").selectAll("g.hm."+b).data(U?[]:[0]);if(V.enter().append("g").classed("hm",!0).classed(b,!0),V.exit().remove(),!U){var q,G;"fast"===C?(q=j,G=R):(q=N,G=B);var H=document.createElement("canvas");H.width=q,H.height=G;var X,Y,W=H.getContext("2d"),Z=i.scale.linear().domain(L.map(function(t){return t[0]})).range(L.map(function(t){var e=o(t[1]).toRgb();return[e.r,e.g,e.b,e.a]})).clamp(!0);"fast"===C?(X=D?function(t){return j-1-t}:a.identity,Y=O?function(t){return R-1-t}:a.identity):(X=function(t){return a.constrain(Math.round(g.c2p(z[t])-x),0,N)},Y=function(t){return a.constrain(Math.round(v.c2p(I[t])-M),0,B)});var Q,K,J,$,tt,et,rt=Y(0),nt=[rt,rt],it=D?0:1,ot=O?0:1,at=0,st=0,lt=0,ut=0;if(C){var ct=0,ht=new Uint8Array(N*B*4);if("best"===C){var ft,pt,dt,mt=new Array(z.length),gt=new Array(I.length),vt=new Array(N);for(A=0;AA;A++)vt[A]=n(A,mt);for(K=0;B>K;K++)for(ft=n(K,gt),pt=T[ft.bin0],dt=T[ft.bin1],A=0;N>A;A++,ct+=4)et=p(pt,dt,vt[A],ft),f(ht,ct,et)}else for(K=0;R>K;K++)for(tt=T[K],nt=Y(K),A=0;N>A;A++)et=h(tt[A],1),ct=4*(nt*N+X(A)),f(ht,ct,et);var yt=W.createImageData(N,B);yt.data.set(ht),W.putImageData(yt,0,0)}else for(K=0;R>K;K++)if(tt=T[K],nt.reverse(),nt[ot]=Y(K+1),nt[0]!==nt[1]&&void 0!==nt[0]&&void 0!==nt[1])for(J=X(0),Q=[J,J],A=0;j>A;A++)Q.reverse(),Q[it]=X(A+1),Q[0]!==Q[1]&&void 0!==Q[0]&&void 0!==Q[1]&&($=tt[A],et=h($,(Q[1]-Q[0])*(nt[1]-nt[0])),W.fillStyle="rgba("+et.join(",")+")",W.fillRect(Q[0],nt[0],Q[1]-Q[0],nt[1]-nt[0]));st=Math.round(st/at),lt=Math.round(lt/at),ut=Math.round(ut/at);var bt=o("rgb("+st+","+lt+","+ut+")");t._hmpixcount=(t._hmpixcount||0)+at,t._hmlumcount=(t._hmlumcount||0)+at*bt.getLuminance();var xt=V.selectAll("image").data(r);xt.enter().append("svg:image").attr({xmlns:u.svg,preserveAspectRatio:"none"}),xt.attr({height:B,width:N,x:x,y:M,"xlink:href":H.toDataURL("image/png")}),xt.exit().remove()}}var i=t("d3"),o=t("tinycolor2"),a=t("../../lib"),s=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),u=t("../../constants/xmlns_namespaces"),c=t("./max_row_length");e.exports=function(t,e,r){for(var i=0;i0&&(n=!0);for(var s=0;si;i++)e[i]?(t[i]/=e[i],n+=t[i]):t[i]=null;return n}},{}],743:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){return r("histnorm"),n.forEach(function(t){var e=r(t+"bins.start"),n=r(t+"bins.end"),i=r("autobin"+t,!(e&&n));r(i?"nbins"+t:t+"bins.size")}),e}},{}],744:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports={count:function(t,e,r){return r[t]++,1},sum:function(t,e,r,i){var o=i[e];return n(o)?(o=Number(o),r[t]+=o,o):0},avg:function(t,e,r,i,o){var a=i[e];return n(a)&&(a=Number(a),r[t]+=a,o[t]++),0},min:function(t,e,r,i){var o=i[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]>o)return r[t]=o,o-r[t]}return 0},max:function(t,e,r,i){var o=i[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]r&&u.length<5e3;)m=o.tickIncrement(r,b.size),u.push((r+m)/2),c.push(L),x&&_.push(r),E&&w.push(1/(m-r)),P&&M.push(0),r=m;var C=c.length;for(r=0;r=0&&C>v&&(k+=z(v,r,c,y,M));P&&(k=l(c,M)),I&&I(c,k,w);var R=Math.min(u.length,c.length),j=[],D=0,O=R-1;for(r=0;R>r;r++)if(c[r]){D=r;break}for(r=R-1;r>D;r--)if(c[r]){O=r;break}for(r=D;O>=r;r++)n(u[r])&&n(c[r])&&j.push({p:u[r],s:c[r],b:0});return j}}},{"../../lib":591,"../../plots/cartesian/axes":615,"./average":742,"./bin_functions":744,"./norm_functions":748,"fast-isnumeric":128}],746:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),o=t("./bin_defaults"),a=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=c("x"),f=c("y");c("text");var p=c("orientation",f&&!h?"h":"v"),d=e["v"===p?"x":"y"];if(!d||!d.length)return void(e.visible=!1);var m=e["h"===p?"x":"y"];m&&c("histfunc");var g="h"===p?["y"]:["x"];o(t,e,c,g),a(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),s(t,e,i.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":506,"../../components/errorbars/defaults":534,"../../lib":591,"../bar/style_defaults":703,"./attributes":741,"./bin_defaults":743}],747:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":623,"../bar/hover":696,"../bar/layout_attributes":698,"../bar/layout_defaults":699,"../bar/plot":700,"../bar/set_positions":701,"../bar/style":702,"../scatter/colorbar":776,"./attributes":741,"./calc":745,"./defaults":746}],748:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;r>i;i++)t[i]*=n},probability:function(t,e){for(var r=t.length,n=0;r>n;n++)t[n]/=e},density:function(t,e,r,n){var i=t.length;n=n||1;for(var o=0;i>o;o++)t[o]*=r[o]*n},"probability density":function(t,e,r,n){var i=t.length;n&&(e/=n);for(var o=0;i>o;o++)t[o]*=r[o]/e}}},{}],749:[function(t,e,r){"use strict";var n=t("../histogram/attributes"),i=t("../heatmap/attributes"),o=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat;e.exports=a({},{x:n.x,y:n.y,z:{valType:"data_array"},marker:{color:{valType:"data_array"}},histnorm:n.histnorm,histfunc:n.histfunc,autobinx:n.autobinx,nbinsx:n.nbinsx,xbins:n.xbins,autobiny:n.autobiny,nbinsy:n.nbinsy,ybins:n.ybins,zsmooth:i.zsmooth,_nestedModules:{colorbar:"Colorbar"}},o,{autocolorscale:a({},o.autocolorscale,{dflt:!1})})},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../heatmap/attributes":729,"../histogram/attributes":741}],750:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("../histogram/bin_functions"),a=t("../histogram/norm_functions"),s=t("../histogram/average");e.exports=function(t,e){var r,l,u,c,h,f,p=i.getFromId(t,e.xaxis||"x"),d=e.x?p.makeCalcdata(e,"x"):[],m=i.getFromId(t,e.yaxis||"y"),g=e.y?m.makeCalcdata(e,"y"):[],v=Math.min(d.length,g.length);d.length>v&&d.splice(v,d.length-v),g.length>v&&g.splice(v,g.length-v),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(d,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(g,m,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),h=[];var y,b,x=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,M="string"==typeof e.xbins.size?[]:e.ybins,k=0,A=[],T=e.histnorm,E=e.histfunc,S=-1!==T.indexOf("density"),L="max"===E||"min"===E,z=L?null:0,I=o.count,P=a[T],C=!1,R=[],j=[],D="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";D&&"count"!==E&&(C="avg"===E,I=o[E]);var O=e.xbins,F=O.end+(O.start-i.tickIncrement(O.start,O.size))/1e6;for(f=O.start;F>f;f=i.tickIncrement(f,O.size))x.push(z),Array.isArray(w)&&w.push(f),C&&_.push(0);Array.isArray(w)&&w.push(f);var N=x.length;for(r=e.xbins.start,l=(f-r)/N,r+=l/2,O=e.ybins,F=O.end+(O.start-i.tickIncrement(O.start,O.size))/1e6,f=O.start;F>f;f=i.tickIncrement(f,O.size))h.push(x.concat()),Array.isArray(M)&&M.push(f),C&&A.push(_.concat());Array.isArray(M)&&M.push(f);var B=h.length;for(u=e.ybins.start,c=(f-u)/B,u+=c/2,S&&(R=x.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/l}),j=h.map(function(t,e){return Array.isArray(M)?1/(M[e+1]-M[e]):1/c})),f=0;v>f;f++)y=n.findBin(d[f],w),b=n.findBin(g[f],M),y>=0&&N>y&&b>=0&&B>b&&(k+=I(y,f,h[b],D,A[b]));if(C)for(b=0;B>b;b++)k+=s(h[b],A[b]);if(P)for(b=0;B>b;b++)P(h[b],k,R,j[b]);return{x:d,x0:r,dx:l,y:g,y0:u,dy:c,z:h}}},{"../../lib":591,"../../plots/cartesian/axes":615,"../histogram/average":742,"../histogram/bin_functions":744,"../histogram/norm_functions":748}],751:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./sample_defaults"),o=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r){function s(r,i){return n.coerce(t,e,a,r,i)}i(t,e,s),s("zsmooth"),o(t,e,r,s,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":749,"./sample_defaults":753}],752:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../heatmap/calc"),n.plot=t("../heatmap/plot"),n.colorbar=t("../heatmap/colorbar"),n.style=t("../heatmap/style"),n.hoverPoints=t("../heatmap/hover"),n.moduleType="trace",n.name="histogram2d",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","histogram"],n.meta={},e.exports=n},{"../../plots/cartesian":623,"../heatmap/calc":730,"../heatmap/colorbar":731,"../heatmap/hover":735,"../heatmap/plot":738,"../heatmap/style":739,"./attributes":749,"./defaults":751}],753:[function(t,e,r){"use strict";var n=t("../histogram/bin_defaults");e.exports=function(t,e,r){var i=r("x"),o=r("y");if(!(i&&i.length&&o&&o.length))return void(e.visible=!1);var a=r("z")||r("marker.color");a&&r("histfunc");var s=["x","y"];n(t,e,r,s)}},{"../histogram/bin_defaults":743}],754:[function(t,e,r){"use strict";var n=t("../histogram2d/attributes"),i=t("../contour/attributes"),o=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat;e.exports=a({},{x:n.x,y:n.y,z:n.z,marker:n.marker,histnorm:n.histnorm,histfunc:n.histfunc,autobinx:n.autobinx,nbinsx:n.nbinsx,xbins:n.xbins,autobiny:n.autobiny,nbinsy:n.nbinsy,ybins:n.ybins,autocontour:i.autocontour,ncontours:i.ncontours,contours:i.contours,line:i.line,_nestedModules:{colorbar:"Colorbar"}},o)},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../contour/attributes":719,"../histogram2d/attributes":749}],755:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../histogram2d/sample_defaults"),o=t("../contour/style_defaults"),a=t("./attributes");e.exports=function(t,e,r,s){function l(r,i){return n.coerce(t,e,a,r,i)}i(t,e,l);var u=n.coerce2(t,e,a,"contours.start"),c=n.coerce2(t,e,a,"contours.end"),h=l("autocontour",!(u&&c));l(h?"ncontours":"contours.size"),o(t,e,l,s)}},{"../../lib":591,"../contour/style_defaults":728,"../histogram2d/sample_defaults":753,"./attributes":754}],756:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../contour/calc"),n.plot=t("../contour/plot"),n.style=t("../contour/style"),n.colorbar=t("../contour/colorbar"),n.hoverPoints=t("../contour/hover"),n.moduleType="trace",n.name="histogram2dcontour",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","contour","histogram"],n.meta={},e.exports=n},{"../../plots/cartesian":623,"../contour/calc":720,"../contour/colorbar":721,"../contour/hover":723,"../contour/plot":726,"../contour/style":727,"./attributes":754,"./defaults":755}],757:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../surface/attributes"),o=t("../../lib/extend").extendFlat;e.exports={x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},i:{valType:"data_array"},j:{valType:"data_array"},k:{valType:"data_array"},delaunayaxis:{valType:"enumerated",values:["x","y","z"],dflt:"z"},alphahull:{valType:"number",dflt:-1},intensity:{valType:"data_array"},color:{valType:"color"},vertexcolor:{valType:"data_array"},facecolor:{valType:"data_array"},opacity:o({},i.opacity),flatshading:{valType:"boolean",dflt:!1},contour:{show:o({},i.contours.x.show,{}),color:o({},i.contours.x.color),width:o({},i.contours.x.width)},colorscale:n.colorscale,reversescale:n.reversescale,showscale:n.showscale,lightposition:{x:o({},i.lightposition.x,{dflt:1e5}),y:o({},i.lightposition.y,{dflt:1e5}),z:o({},i.lightposition.z,{dflt:0})},lighting:o({},{vertexnormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-12},facenormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-6}},i.lighting),_nestedModules:{colorbar:"Colorbar"}}},{"../../components/colorscale/attributes":512,"../../lib/extend":586,"../surface/attributes":825}],758:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.mesh=e,this.name="",this.color="#fff",this.data=null,this.showContour=!1}function i(t){return t.map(function(t){var e=t[0],r=u(t[1]),n=r.toRgb();return{index:e,rgb:[n.r,n.g,n.b,1]}})}function o(t){return t.map(p)}function a(t,e,r){for(var n=new Array(t.length),i=0;i0)s=h(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var d={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:p(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",d.vertexIntensity=t.intensity,d.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],d.vertexColors=o(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],d.cellColors=o(t.facecolor)):(this.color=t.color,d.meshColor=p(t.color)),this.mesh.update(d)},d.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":603,"alpha-shape":41,"convex-hull":113,"delaunay-triangulate":125,"gl-mesh3d":161,tinycolor2:477}],759:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),o=t("./attributes");e.exports=function(t,e,r,a){function s(r,i){return n.coerce(t,e,o,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;el||(u=d[r],void 0!==u&&""!==u||(u=r),u=String(u),void 0===y[u]&&(y[u]=!0,c=o(e.marker.colors[r]),c.isValid()?(c=a.addOpacity(c,c.getAlpha()),v[u]||(v[u]=c)):v[u]?c=v[u]:(c=!1,b=!0),h=-1!==_.indexOf(u),h||(x+=l),m.push({v:l,label:u,color:c,i:r,hidden:h}))));if(e.sort&&m.sort(function(t,e){return e.v-t.v}),b)for(r=0;r")}return m};var l},{"../../components/color":506,"./helpers":765,"fast-isnumeric":128,tinycolor2:477}],764:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,o){function a(r,o){return n.coerce(t,e,i,r,o)}var s=n.coerceFont,l=a("values");if(!Array.isArray(l)||!l.length)return void(e.visible=!1);var u=a("labels");Array.isArray(u)||(a("label0"),a("dlabel"));var c=a("marker.line.width");c&&a("marker.line.color");var h=a("marker.colors");Array.isArray(h)||(e.marker.colors=[]),a("scalegroup");var f=a("text"),p=a("textinfo",Array.isArray(f)?"text+percent":"percent");if(a("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),p&&"none"!==p){var d=a("textposition"),m=Array.isArray(d)||"auto"===d,g=m||"inside"===d,v=m||"outside"===d;if(g||v){var y=s(a,"textfont",o.font);g&&s(a,"insidetextfont",y),v&&s(a,"outsidetextfont",y)}}a("domain.x"),a("domain.y"),a("hole"),a("sort"),a("direction"),a("rotation"),a("pull")}},{"../../lib":591,"./attributes":761}],765:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":591}],766:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":761,"./base_plot":762,"./calc":763,"./defaults":764,"./layout_attributes":767,"./layout_defaults":768,"./plot":769,"./style":770,"./style_one":771}],767:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],768:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,o){return n.coerce(t,e,i,r,o)}r("hiddenlabels")}},{"../../lib":591,"./layout_attributes":767}],769:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,a=Math.PI*Math.min(e.v/r.vTotal,.5),s=1-r.trace.hole,l=i(e,r),u={scale:l*r.r*2/n,rCenter:1-l,rotate:0};if(u.scale>=1)return u;var c=o+1/(2*Math.tan(a)),h=r.r*Math.min(1/(Math.sqrt(c*c+.5)+c),s/(Math.sqrt(o*o+s/2)+o)),f={scale:2*h/t.height,rCenter:Math.cos(h/r.r)-h*o/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},p=1/o,d=p+1/(2*Math.tan(a)),m=r.r*Math.min(1/(Math.sqrt(d*d+.5)+d),s/(Math.sqrt(p*p+s/2)+p)),g={scale:2*m/t.width,rCenter:Math.cos(m/r.r)-m/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=g.scale>f.scale?g:f;return u.scale<1&&v.scale>u.scale?v:u}function i(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function o(t,e){var r=e.pxmid[0],n=e.pxmid[1],i=t.width/2,o=t.height/2;return 0>r&&(i*=-1),0>n&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:i+Math.abs(o)*(i>0?1:-1)/2,y:o/(1+r*r/(n*n)),outside:!0}}function a(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function i(t,r){r||(r={});var n,i,o,s,f,p,m=r.labelExtraY+(a?r.yLabelMax:r.yLabelMin),g=a?t.yLabelMin:t.yLabelMax,v=a?t.yLabelMax:t.yLabelMin,y=t.cyFinal+u(t.px0[1],t.px1[1]),b=m-g;if(b*h>0&&(t.labelExtraY=b),Array.isArray(e.pull))for(i=0;i=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*h>0?(s=o.cyFinal+u(o.px0[1],o.px1[1]),b=s-g-t.labelExtraY,b*h>0&&(t.labelExtraY+=b)):(v+t.labelExtraY-y)*h>0&&(n=3*c*Math.abs(i-d.indexOf(t)),f=o.cxFinal+l(o.px0[0],o.px1[0]),p=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,p*c>0&&(t.labelExtraX+=p)))}var o,a,s,l,u,c,h,f,p,d,m,g,v;for(a=0;2>a;a++)for(s=a?r:n,u=a?Math.max:Math.min,h=a?1:-1,o=0;2>o;o++){for(l=o?Math.max:Math.min,c=o?1:-1,f=t[a][o],f.sort(s),p=t[1-a][o],d=p.concat(f),g=[],m=0;mc&&(c=s.pull[o]);a.r=Math.min(r/u(s.tilt,Math.sin(l),s.depth),n/u(s.tilt,Math.cos(l),s.depth))/(2+2*c),a.cx=e.l+e.w*(s.domain.x[1]+s.domain.x[0])/2,a.cy=e.t+e.h*(2-s.domain.y[1]-s.domain.y[0])/2,s.scalegroup&&-1===p.indexOf(s.scalegroup)&&p.push(s.scalegroup)}for(o=0;oh.vTotal/2?1:0)}function u(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var c=t("d3"),h=t("../../plots/cartesian/graph_interact"),f=t("../../components/color"),p=t("../../components/drawing"),d=t("../../lib/svg_text_utils"),m=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round","class":"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],g=u.trace,v=0,y=(g.depth||0)*u.r*Math.sin(v)/2,b=g.tiltaxis||0,x=b*Math.PI/180,_=[y*Math.sin(x),y*Math.cos(x)],w=u.r*Math.cos(v),M=s.selectAll("g.part").data(g.tilt?["top","sides"]:["top"]);M.enter().append("g").attr("class",function(t){return t+" part"}),M.exit().remove(),M.order(),l(e),s.selectAll(".top").each(function(){var s=c.select(this).selectAll("g.slice").data(e);s.enter().append("g").classed("slice",!0),s.exit().remove();var l=[[[],[]],[[],[]]],v=!1;s.each(function(a){function s(e){var n=t._fullLayout,o=t._fullData[g.index],s=o.hoverinfo;if("all"===s&&(s="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==s&&s){var l=i(a,u),c=M+a.pxmid[0]*(1-l),f=k+a.pxmid[1]*(1-l),p=r.separators,d=[];-1!==s.indexOf("label")&&d.push(a.label),o.text&&o.text[a.i]&&-1!==s.indexOf("text")&&d.push(o.text[a.i]),-1!==s.indexOf("value")&&d.push(m.formatPieValue(a.v,p)),-1!==s.indexOf("percent")&&d.push(m.formatPiePercent(a.v/u.vTotal,p)),h.loneHover({x0:c-l*u.r,x1:c+l*u.r,y:f,text:d.join("
"),name:-1!==s.indexOf("name")?o.name:void 0,color:a.color,idealAlign:a.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),h.hover(t,e,"pie"),E=!0}}function f(e){t.emit("plotly_unhover",{points:[e]}),E&&(h.loneUnhover(r._hoverlayer.node()),E=!1)}function y(){t._hoverdata=[a],t._hoverdata.trace=e.trace,h.click(t,{target:!0})}function x(t,e,r,n){return"a"+n*u.r+","+n*w+" "+b+" "+a.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(a.hidden)return void c.select(this).selectAll("path,g").remove();l[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var M=u.cx+_[0],k=u.cy+_[1],A=c.select(this),T=A.selectAll("path.surface").data([a]),E=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",s).on("mouseout",f).on("click",y),g.pull){var S=+(Array.isArray(g.pull)?g.pull[a.i]:g.pull)||0;S>0&&(M+=S*a.pxmid[0],k+=S*a.pxmid[1])}a.cxFinal=M,a.cyFinal=k;var L=g.hole;if(a.v===u.vTotal){var z="M"+(M+a.px0[0])+","+(k+a.px0[1])+x(a.px0,a.pxmid,!0,1)+x(a.pxmid,a.px0,!0,1)+"Z";L?T.attr("d","M"+(M+L*a.px0[0])+","+(k+L*a.px0[1])+x(a.px0,a.pxmid,!1,L)+x(a.pxmid,a.px0,!1,L)+"Z"+z):T.attr("d",z)}else{var I=x(a.px0,a.px1,!0,1);if(L){var P=1-L;T.attr("d","M"+(M+L*a.px1[0])+","+(k+L*a.px1[1])+x(a.px1,a.px0,!1,L)+"l"+P*a.px0[0]+","+P*a.px0[1]+I+"Z")}else T.attr("d","M"+M+","+k+"l"+a.px0[0]+","+a.px0[1]+I+"Z")}var C=Array.isArray(g.textposition)?g.textposition[a.i]:g.textposition,R=A.selectAll("g.slicetext").data(a.text&&"none"!==C?[0]:[]);R.enter().append("g").classed("slicetext",!0),R.exit().remove(),R.each(function(){var t=c.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(a.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(p.font,"outside"===C?g.outsidetextfont:g.insidetextfont).call(d.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=p.bBox(t.node());"outside"===C?e=o(r,a):(e=n(r,a,u),"auto"===C&&e.scale<1&&(t.call(p.font,g.outsidetextfont),g.outsidetextfont.family===g.insidetextfont.family&&g.outsidetextfont.size===g.insidetextfont.size||(t.attr({"data-bb":""}),r=p.bBox(t.node())),e=o(r,a)));var i=M+a.pxmid[0]*e.rCenter+(e.x||0),s=k+a.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(a.yLabelMin=s-r.height/2,a.yLabelMid=s,a.yLabelMax=s+r.height/2,a.labelExtraX=0,a.labelExtraY=0,v=!0),t.attr("transform","translate("+i+","+s+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),v&&a(l,g),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],o="M"+n+","+i,a=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var s=t.labelExtraX*t.pxmid[1]/t.pxmid[0],l=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(s)>Math.abs(l)?"l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+a):"l"+t.labelExtraX+","+s+"v"+(l-s)+"h"+a}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+a;e.append("path").classed("textline",!0).call(f.stroke,g.outsidetextfont.color).attr({"stroke-width":Math.min(2,g.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){u.selectAll("tspan").each(function(){var t=c.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":506,"../../components/drawing":529,"../../lib/svg_text_utils":604,"../../plots/cartesian/graph_interact":622,"./helpers":765,d3:124}],770:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,o=n.select(this);o.style({opacity:r.opacity}),o.selectAll(".top path.surface").each(function(t){n.select(this).call(i,t,r)})})}},{"./style_one":771,d3:124}],771:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var o=r.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(n.stroke,i)}},{"../../components/color":506}],772:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var i=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(i.color,t,"mlc"),n.mergeArray(i.width,t,"mlw")}}},{"../../lib":591}],773:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number", +dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":514,"../../components/drawing":529,"../../lib/extend":586,"./constants":778}],774:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./subtypes"),s=t("./colorscale_calc");e.exports=function(t,e){var r,l,u,c=i.getFromId(t,e.xaxis||"x"),h=i.getFromId(t,e.yaxis||"y"),f=c.makeCalcdata(e,"x"),p=h.makeCalcdata(e,"y"),d=Math.min(f.length,p.length);c._minDtick=0,h._minDtick=0,f.length>d&&f.splice(d,f.length-d),p.length>d&&p.splice(d,p.length-d);var m={padded:!0},g={padded:!0};if(a.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var v={type:"linear"};i.setConvert(v),l=v.makeCalcdata(e.marker,"size"),l.length>d&&l.splice(d,l.length-d)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},m.ppad=g.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||f[0]===f[d-1]&&p[0]===p[d-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(a.hasMarkers(e)||a.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||f[0]===f[d-1]&&p[0]===p[d-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(g.padded=!1):g.tozero=!0,i.expand(c,f,m),i.expand(h,p,g);var x=new Array(d);for(u=0;d>u;u++)x[u]=n(f[u])&&n(p[u])?{x:f[u],y:p[u]}:{x:!1,y:!1};return void 0!==typeof l&&o.mergeArray(l,x,"ms"),t.firstscatter=!1,x}},{"../../lib":591,"../../plots/cartesian/axes":615,"./colorscale_calc":777,"./subtypes":792,"fast-isnumeric":128}],775:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i,o;for(e=0;e=0;i--)if(o=t[i],"scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}},{}],776:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void a.autoMargin(t,c);var h=s(u.colorscale),f=u.color,p=u.cmin,d=u.cmax;i(p)||(p=o.aggNums(Math.min,null,f)),i(d)||(d=o.aggNums(Math.max,null,f));var m=e[0].t.cb=l(t,c);m.fillcolor(n.scale.linear().domain(h.map(function(t){return p+t[0]*(d-p)})).range(h.map(function(t){return t[1]}))).filllevels({start:p,end:d,size:(d-p)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":509,"../../components/colorscale/get_scale":518,"../../lib":591,"../../plots/plots":671,d3:124,"fast-isnumeric":128}],777:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),o.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":513,"../../components/colorscale/has_colorscale":519,"./subtypes":792}],778:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],779:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),o=t("./constants"),a=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),p=t("../../components/errorbars/defaults");e.exports=function(t,e,r,d){function m(r,o){return n.coerce(t,e,i,r,o)}var g=s(t,e,m),v=gU!=C>=U&&(z=S[T-1][0],I=S[T][0],L=z+(I-z)*(U-P)/(C-P),O=Math.min(O,L),F=Math.max(F,L));O=Math.max(O,0),F=Math.min(F,f._length);var V=l.defaultLine;return l.opacity(h.fillcolor)?V=h.fillcolor:l.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:o.MAXDIST+10,x0:O,x1:F,y0:U,y1:U,color:V}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":506,"../../components/errorbars":535,"../../lib":591,"../../plots/cartesian/constants":620,"../../plots/cartesian/graph_interact":622,"./get_trace_color":781}],783:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":623,"./arrays_to_calcdata":772,"./attributes":773,"./calc":774,"./clean_data":775,"./colorbar":776,"./defaults":779,"./hover":782,"./plot":789,"./select":790,"./style":791,"./subtypes":792}],784:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,a){var s=(t.marker||{}).color;if(a("line.color",r),n(t,"line"))i(t,e,o,a,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||r;a("line.color",l)}a("line.width"),a("line.dash")}},{"../../components/colorscale/defaults":516,"../../components/colorscale/has_colorscale":519}],785:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=M.c2p(t[e].y);return r===S||n===S?!1:[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}function o(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var a,s,l,u,c,h,f,p,d,m,g,v,y,b,x,_,w=e.xaxis,M=e.yaxis,k=e.connectGaps,A=e.baseTolerance,T=e.linear,E=[],S=n.BADNUM,L=.2,z=new Array(t.length),I=0;for(a=0;ai(h))break;l=h,y=m[0]*d[0]+m[1]*d[1],y>g?(g=y,u=h,p=!1):v>y&&(v=y,c=h,p=!0)}if(p?(z[I++]=u,l!==c&&(z[I++]=c)):(c!==s&&(z[I++]=c),l!==u&&(z[I++]=u)),z[I++]=l,a>=t.length||!h)break;z[I++]=h,s=h}}else z[I++]=u}E.push(z.slice(0,I))}return E}},{"../../plots/cartesian/axes":615}],786:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],787:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t){var e=t.marker,r=e.sizeref||1,i=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/r)}:function(t){return t/r};return function(t){var e=o(t/2);return n(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":128}],788:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),a=t("./subtypes");e.exports=function(t,e,r,s,l){var u,c=a.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&o(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=h&&!Array.isArray(h)&&e.marker.color!==h?h:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&o(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":506,"../../components/colorscale/defaults":516,"../../components/colorscale/has_colorscale":519,"./subtypes":792}],789:[function(t,e,r){"use strict";function n(t,e,r){var n=e.x(),o=e.y(),a=i.extent(n.range.map(n.l2c)),s=i.extent(o.range.map(o.l2c));r.forEach(function(t,e){var n=t[0].trace;if(u.hasMarkers(n)){var i=n.marker.maxdisplayed;if(0!==i){var o=t.filter(function(t){return t.x>=a[0]&&t.x<=a[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(o.length/i),c=0;r.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&e>r&&c++});var h=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+h)%l)&&(t.vis=!0)})}}})}var i=t("d3"),o=t("../../lib"),a=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),h=t("./line_points");e.exports=function(t,e,r){function f(t){return t.filter(function(t){return t.vis})}n(t,e,r);var p=e.x(),d=e.y(),m=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(r);m.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),m.call(s.plot,e);var g,v,y,b,x="",_=[];m.each(function(t){var e=t[0].trace,r=e.line,n=i.select(this);if(e.visible===!0&&(v=e.fill.charAt(e.fill.length-1),"x"!==v&&"y"!==v&&(v=""),t[0].node3=n,c(t),u.hasLines(e)||"none"!==e.fill)){var o,s,f,m,w,M="",k="";g="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!x?n.append("path").classed("js-fill",!0):null,b&&(y=b.datum(t)),b=n.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(r.shape)?(f=a.steps(r.shape),m=a.steps(r.shape.split("").reverse().join(""))):f=m="spline"===r.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?a.smoothclosed(t.slice(1),r.smoothing):a.smoothopen(t,r.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return m(t.reverse())};var A,T=h(t,{xaxis:p,yaxis:d,connectGaps:e.connectgaps,baseTolerance:Math.max(r.width||1,3)/4,linear:"linear"===r.shape}),E=e._polygons=new Array(T.length);for(A=0;A1&&n.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}g?S&&z&&(v?("y"===v?S[1]=z[1]=d.c2p(0,!0):"x"===v&&(S[0]=z[0]=p.c2p(0,!0)),g.attr("d",M+"L"+z+"L"+S+"Z")):g.attr("d",M+"Z")):"tonext"===e.fill.substr(0,6)&&M&&x&&("tonext"===e.fill?y.attr("d",M+"Z"+x+"Z"):y.attr("d",M+"L"+x.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),x=k,_=E}}}),m.selectAll("path:not([d])").remove(),m.append("g").attr("class","points").each(function(t){var e=t[0].trace,r=i.select(this),n=u.hasMarkers(e),s=u.hasText(e);!n&&!s||e.visible!==!0?r.remove():(n&&r.selectAll("path.point").data(e.marker.maxdisplayed?f:o.identity).enter().append("path").classed("point",!0).call(a.translatePoints,p,d),s&&r.selectAll("g").data(e.marker.maxdisplayed?f:o.identity).enter().append("g").append("text").call(a.translatePoints,p,d))})}},{"../../components/drawing":529,"../../components/errorbars":535,"../../lib":591,"../../lib/polygon":597,"./arrays_to_calcdata":772,"./line_points":785,"./subtypes":792,d3:124}],790:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,o,a,s,l=t.cd,u=t.xaxis,c=t.yaxis,h=[],f=l[0].trace,p=f.index,d=f.marker,m=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!m){var g=Array.isArray(d.opacity)?1:d.opacity;if(e===!1)for(r=0;rs;s++){for(var l=[[0,0,0],[0,0,0]],u=0;3>u;u++)if(r[u])for(var c=0;2>c;c++)l[c][u]=r[u][s][c];a[s]=l}return a}var a=t("../../components/errorbars/compute_error");e.exports=o},{"../../components/errorbars/compute_error":533}],798:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.linePlot=null,this.scatterPlot=null,this.errorBars=null,this.textMarkers=null,this.delaunayMesh=null,this.color=null,this.mode="",this.dataPoints=[],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.textLabels=null,this.data=null}function i(t,e,r){var n,i=(r+1)%3,o=(r+2)%3,a=[],s=[];for(n=0;ni;i++){var o=t[i];o&&o.copy_zstyle!==!1&&(o=t[2]),o&&(e[i]=o.width/2,r[i]=b(o.color),n=o.thickness)}return{capSize:e,color:r,lineWidth:n}}function a(t){var e=[0,0];return Array.isArray(t)?[0,-1]:(t.indexOf("bottom")>=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return M[t]}function u(t,e,r,n,i){var o=null;if(Array.isArray(t)){o=[];for(var a=0;e>a;a++)void 0===t[a]?o[a]=n:o[a]=r(t[a],i)}else o=r(t,y.identity);return o}function c(t,e){var r,n,i,c,h,f,p=[],d=t.fullSceneLayout,m=t.dataScale,g=d.xaxis,v=d.yaxis,w=d.zaxis,M=e.marker,A=e.line,T=e.x||[],E=e.y||[],S=e.z||[],L=T.length;for(n=0;L>n;n++)i=g.d2l(T[n])*m[0],c=v.d2l(E[n])*m[1],h=w.d2l(S[n])*m[2],p[n]=[i,c,h];if(Array.isArray(e.text))f=e.text;else if(void 0!==e.text)for(f=new Array(L),n=0;L>n;n++)f[n]=e.text;if(r={position:p,mode:e.mode,text:f},"line"in e&&(r.lineColor=x(A,1,L),r.lineWidth=A.width,r.lineDashes=A.dash),"marker"in e){var z=_(e);r.scatterColor=x(M,1,L),r.scatterSize=u(M.size,L,s,20,z),r.scatterMarker=u(M.symbol,L,l,"\u25cf"),r.scatterLineWidth=M.line.width,r.scatterLineColor=x(M.line,1,L),r.scatterAngle=0}"textposition"in e&&(r.textOffset=a(e.textposition),r.textColor=x(e.textfont,1,L),r.textSize=u(e.textfont.size,L,y.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var I=["x","y","z"];for(r.project=[!1,!1,!1],r.projectScale=[1,1,1],r.projectOpacity=[1,1,1],n=0;3>n;++n){var P=e.projection[I[n]];(r.project[n]=P.show)&&(r.projectOpacity[n]=P.opacity,r.projectScale[n]=P.scale)}r.errorBounds=k(e,m);var C=o([e.error_x,e.error_y,e.error_z]);return r.errorColor=C.color,r.errorLineWidth=C.lineWidth,r.errorCapSize=C.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=b(e.surfacecolor),r}function h(t){if(Array.isArray(t)){var e=t[0];return Array.isArray(e)&&(t=e),"rgb("+t.slice(0,3).map(function(t){return Math.round(255*t)})+")"}return null}function f(t,e){var r=new n(t,e.uid);return r.update(e),r}var p=t("gl-line3d"),d=t("gl-scatter3d"),m=t("gl-error3d"),g=t("gl-mesh3d"),v=t("delaunay-triangulate"),y=t("../../lib"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/make_bubble_size_func"),w=t("../../constants/gl3d_dashes"),M=t("../../constants/gl_markers"),k=t("./calc_errors"),A=n.prototype;A.handlePick=function(t){if(t.object&&(t.object===this.linePlot||t.object===this.delaunayMesh||t.object===this.textMarkers||t.object===this.scatterPlot)){t.object.highlight&&t.object.highlight(null),this.scatterPlot&&(t.object=this.scatterPlot,this.scatterPlot.highlight(t.data)),this.textLabels&&void 0!==this.textLabels[t.data.index]?t.textLabel=this.textLabels[t.data.index]:t.textLabel="";var e=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},A.update=function(t){var e,r,n,o,a=this.scene.glplot.gl,s=w.solid;this.data=t;var l=c(this.scene,t);"mode"in l&&(this.mode=l.mode),"lineDashes"in l&&l.lineDashes in w&&(s=w[l.lineDashes]),this.color=h(l.scatterColor)||h(l.lineColor),this.dataPoints=l.position,e={gl:a,position:l.position,color:l.lineColor,lineWidth:l.lineWidth||1,dashes:s[0],dashScale:s[1],opacity:t.opacity,connectGaps:t.connectgaps},-1!==this.mode.indexOf("lines")?this.linePlot?this.linePlot.update(e):(this.linePlot=p(e),this.scene.glplot.add(this.linePlot)):this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose(),this.linePlot=null);var u=t.opacity;if(t.marker&&t.marker.opacity&&(u*=t.marker.opacity),r={gl:a,position:l.position,color:l.scatterColor,size:l.scatterSize,glyph:l.scatterMarker,opacity:u,orthographic:!0,lineWidth:l.scatterLineWidth,lineColor:l.scatterLineColor,project:l.project,projectScale:l.projectScale,projectOpacity:l.projectOpacity},-1!==this.mode.indexOf("markers")?this.scatterPlot?this.scatterPlot.update(r):(this.scatterPlot=d(r),this.scatterPlot.highlightScale=1,this.scene.glplot.add(this.scatterPlot)):this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose(),this.scatterPlot=null),o={gl:a,position:l.position,glyph:l.text,color:l.textColor,size:l.textSize,angle:l.textAngle,alignment:l.textOffset,font:l.textFont,orthographic:!0,lineWidth:0,project:!1,opacity:t.opacity},this.textLabels=l.text,-1!==this.mode.indexOf("text")?this.textMarkers?this.textMarkers.update(o):(this.textMarkers=d(o),this.textMarkers.highlightScale=1,this.scene.glplot.add(this.textMarkers)):this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose(),this.textMarkers=null),n={gl:a,position:l.position,color:l.errorColor,error:l.errorBounds,lineWidth:l.errorLineWidth,capSize:l.errorCapSize,opacity:t.opacity},this.errorBars?l.errorBounds?this.errorBars.update(n):(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose(),this.errorBars=null):l.errorBounds&&(this.errorBars=m(n),this.scene.glplot.add(this.errorBars)),l.delaunayAxis>=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);f.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=a,this.delaunayMesh=g(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},A.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":576,"../../constants/gl_markers":577,"../../lib":591,"../../lib/gl_format_color":589,"../../lib/str2rgbarray":603,"../scatter/make_bubble_size_func":787,"./calc_errors":797,"delaunay-triangulate":125,"gl-error3d":132,"gl-line3d":138,"gl-mesh3d":161,"gl-scatter3d":204}],799:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),o=r("y"),a=r("z");return i&&o&&a&&(n=Math.min(i.length,o.length,a.length),n=0&&f("surfacecolor",d||m);for(var g=["x","y","z"],v=0;3>v;++v){var y="projection."+g[v];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":534,"../../lib":591,"../scatter/line_defaults":784,"../scatter/marker_defaults":788,"../scatter/subtypes":792,"../scatter/text_defaults":793,"./attributes":795}],800:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":577,"../../plots/gl3d":651,"../scatter/colorbar":776,"./attributes":795,"./calc":796,"./convert":798,"./defaults":799}],801:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array"},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names"],dflt:"ISO-3"},mode:a({},n.mode,{dflt:"markers"}),text:a({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash},marker:a({},{symbol:s.symbol,opacity:s.opacity,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:a({},{width:u.width},o("marker.line"))},o("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:a({},i.hoverinfo,{flags:["lon","lat","location","text","name"]}),_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":514,"../../lib/extend":586,"../../plots/attributes":613,"../scatter/attributes":773}],802:[function(t,e,r){"use strict";var n=t("../scatter/colorscale_calc");e.exports=function(t,e){var r=[{x:!1,y:!1,trace:e,t:{}}];return n(e),r}},{"../scatter/colorscale_calc":777}],803:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=0,a=r("locations");return a?(r("locationmode"),o=a.length):(n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length),on;n++)r[n]=[t.lon[n],t.lat[n]];return{type:"LineString",coordinates:r,trace:t}}function o(t,e){function r(e){var r=t.mockAxis;return u.tickText(r,r.c2l(e),"hover").text+"\xb0"}var n=e.hoverinfo;if("none"===n)return function(t){delete t.textLabel};var i="all"===n?g.hoverinfo.flags:n.split("+"),o=-1!==i.indexOf("location")&&Array.isArray(e.locations),a=-1!==i.indexOf("lon"),s=-1!==i.indexOf("lat"),l=-1!==i.indexOf("text"); +return function(t){var n=[];o?n.push(t.location):a&&s?n.push("("+r(t.lon)+", "+r(t.lat)+")"):a?n.push("lon: "+r(t.lon)):s&&n.push("lat: "+r(t.lat)),l&&n.push(t.tx||e.text),t.textLabel=n.join("
")}}function a(t){var e=Array.isArray(t.locations);return function(r,n){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:n,lon:r.lon,lat:r.lat,location:e?r.location:null}]}}}var s=t("d3"),l=t("../../plots/cartesian/graph_interact"),u=t("../../plots/cartesian/axes"),c=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/array_to_calc_item"),p=t("../../components/color"),d=t("../../components/drawing"),m=t("../scatter/subtypes"),g=t("./attributes"),v=e.exports={};v.calcGeoJSON=function(t,e){var r,i,o,a,s=[],l=Array.isArray(t.locations);l?(a=t.locations,r=a.length,i=c(t,e),o=function(t,e){var r=h(t.locationmode,a[e],i);return void 0!==r?r.properties.ct:void 0}):(r=t.lon.length,o=function(t,e){return[t.lon[e],t.lat[e]]});for(var u=0;r>u;u++){var f=o(t,u);if(f){var p={lon:f[0],lat:f[1],location:l?t.locations[u]:null};n(t,p,u),s.push(p)}}return s.length>0&&(s[0].trace=t),s},v.plot=function(t,e){var r=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,function(t){return t.uid});r.enter().append("g").attr("class","trace scattergeo"),r.exit().remove(),r.selectAll("*").remove(),r.each(function(t){var e=s.select(this);m.hasLines(t)&&e.selectAll("path.js-line").data([i(t)]).enter().append("path").classed("js-line",!0)}),r.each(function(e){function r(r,n){if(t.showHover){var i=t.projection([r.lon,r.lat]);f(r),l.loneHover({x:i[0],y:i[1],name:g?e.name:void 0,text:r.textLabel,color:r.mc||(e.marker||{}).color},{container:t.hoverContainer.node()}),y=p(r,n),t.graphDiv.emit("plotly_hover",y)}}function n(e,r){t.graphDiv.emit("plotly_click",p(e,r))}var i=s.select(this),u=m.hasMarkers(e),c=m.hasText(e);if(u||c){var h=v.calcGeoJSON(e,t.topojson),f=o(t,e),p=a(e),d=e.hoverinfo,g="all"===d||-1!==d.indexOf("name"),y=null;u&&i.selectAll("path.point").data(h).enter().append("path").classed("point",!0).on("mouseover",r).on("click",n).on("mouseout",function(){l.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",y)}).on("mousedown",function(){l.loneUnhover(t.hoverContainer)}).on("mouseup",r),c&&i.selectAll("g").data(h).enter().append("g").append("text")}}),v.style(t)},v.style=function(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t.opacity}),e.each(function(t){s.select(this).selectAll("path.point").call(d.pointStyle,t),s.select(this).selectAll("text").call(d.textPointStyle,t)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=t.trace,r=e.line||{};s.select(this).call(p.stroke,r.color).call(d.dashLine,r.dash||"",r.width||0)})}},{"../../components/color":506,"../../components/drawing":529,"../../lib/array_to_calc_item":582,"../../lib/geo_location_utils":588,"../../lib/topojson_utils":605,"../../plots/cartesian/axes":615,"../../plots/cartesian/graph_interact":622,"../scatter/subtypes":792,"./attributes":801,d3:124}],806:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/color_attributes"),o=t("../../constants/gl2d_dashes"),a=t("../../constants/gl_markers"),s=t("../../lib/extend").extendFlat,l=t("../../lib/extend").extendDeep,u=n.line,c=n.marker,h=c.line;e.exports={x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:s({},n.text,{}),mode:{valType:"flaglist",flags:["lines","markers"],extras:["none"]},line:{color:u.color,width:u.width,dash:{valType:"enumerated",values:Object.keys(o),dflt:"solid"}},marker:l({},i("marker"),{symbol:{valType:"enumerated",values:Object.keys(a),dflt:"circle",arrayOk:!0},size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,opacity:c.opacity,showscale:c.showscale,line:l({},i("marker.line"),{width:h.width})}),connectgaps:n.connectgaps,fill:s({},n.fill,{values:["none","tozeroy","tozerox"]}),fillcolor:n.fillcolor,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":514,"../../constants/gl2d_dashes":575,"../../constants/gl_markers":577,"../../lib/extend":586,"../scatter/attributes":773}],807:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.type="scattergl",this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.connectgaps=!0,this.idToIndex=[],this.bounds=[0,0,0,0],this.hasLines=!1,this.lineOptions={positions:new Float32Array(0),color:[0,0,0,1],width:1,fill:[!1,!1,!1,!1],fillColor:[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],dashes:[1]},this.line=p(t.glplot,this.lineOptions),this.line._trace=this,this.hasErrorX=!1,this.errorXOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorX=d(t.glplot,this.errorXOptions),this.errorX._trace=this,this.hasErrorY=!1,this.errorYOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorY=d(t.glplot,this.errorYOptions),this.errorY._trace=this,this.hasMarkers=!1,this.scatterOptions={positions:new Float32Array(0),sizes:[],colors:[],glyphs:[],borderWidths:[],borderColors:[],size:12,color:[0,0,0,1],borderSize:1,borderColor:[0,0,0,1]},this.scatter=h(t.glplot,this.scatterOptions),this.scatter._trace=this,this.fancyScatter=f(t.glplot,this.scatterOptions),this.fancyScatter._trace=this}function i(t,e,r){return Array.isArray(e)||(e=[e]),o(t,e,r)}function o(t,e,r){for(var n=new Array(r),i=e[0],o=0;r>o;++o)n[o]=t(o>=e.length?i:e[o]);return n}function a(t,e,r){return l(L(t,r),S(e,r),r)}function s(t,e,r,n){var i=x(t,e,n);return i=Array.isArray(i[0])?i:o(g.identity,[i],n),l(i,S(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;r>i;++i){for(var o=0;3>o;++o)n[4*i+o]=t[i][o];n[4*i+3]=t[i][3]*e[i]}return n}function u(t,e){if(void 0===Float32Array.slice){for(var r=new Float32Array(e),n=0;e>n;n++)r[n]=t[n];return r}return t.slice(0,e)}function c(t,e){var r=new n(t,e.uid);return r.update(e),r}var h=t("gl-scatter2d"),f=t("gl-scatter2d-fancy"),p=t("gl-line2d"),d=t("gl-error2d"),m=t("fast-isnumeric"),g=t("../../lib"),v=t("../../plots/cartesian/axes"),y=t("../../components/errorbars"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/subtypes"),w=t("../scatter/make_bubble_size_func"),M=t("../scatter/get_trace_color"),k=t("../../constants/gl_markers"),A=t("../../constants/gl2d_dashes"),T=["xaxis","yaxis"],E=n.prototype;E.handlePick=function(t){var e=t.pointId;return(t.object!==this.line||this.connectgaps)&&(e=this.idToIndex[t.pointId]),{trace:this,dataCoord:t.dataCoord,traceCoord:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:Array.isArray(this.color)?this.color[e]:this.color,name:this.name,hoverinfo:this.hoverinfo}},E.isFancy=function(t){if("linear"!==this.scene.xaxis.type)return!0;if("linear"!==this.scene.yaxis.type)return!0;if(!t.x||!t.y)return!0;if(this.hasMarkers){var e=t.marker||{};if(Array.isArray(e.symbol)||"circle"!==e.symbol||Array.isArray(e.size)||Array.isArray(e.color)||Array.isArray(e.line.width)||Array.isArray(e.line.color)||Array.isArray(e.opacity))return!0}return this.hasLines&&!this.connectgaps?!0:this.hasErrorX?!0:!!this.hasErrorY};var S=i.bind(null,function(t){return+t}),L=i.bind(null,b),z=i.bind(null,function(t){return k[t]||"\u25cf"});E.update=function(t){t.visible!==!0?(this.hasLines=!1,this.hasErrorX=!1,this.hasErrorY=!1,this.hasMarkers=!1):(this.hasLines=_.hasLines(t),this.hasErrorX=t.error_x.visible===!0,this.hasErrorY=t.error_y.visible===!0,this.hasMarkers=_.hasMarkers(t)),this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.connectgaps=!!t.connectgaps,this.isFancy(t)?this.updateFancy(t):this.updateFast(t),this.color=M(t,{})},E.updateFast=function(t){for(var e,r,n=this.xData=this.pickXData=t.x,i=this.yData=this.pickYData=t.y,o=n.length,a=new Array(o),s=new Float32Array(2*o),l=this.bounds,c=0,h=0,f=0;o>f;++f)e=n[f],r=i[f],m(e)&&m(r)&&(a[c++]=f,s[h++]=e,s[h++]=r,l[0]=Math.min(l[0],e),l[1]=Math.min(l[1],r),l[2]=Math.max(l[2],e),l[3]=Math.max(l[3],r));s=u(s,h),this.idToIndex=a,this.updateLines(t,s),this.updateError("X",t),this.updateError("Y",t);var p;if(this.hasMarkers){this.scatterOptions.positions=s;var d=b(t.marker.color),g=b(t.marker.line.color),v=t.opacity*t.marker.opacity;d[3]*=v,this.scatterOptions.color=d,g[3]*=v,this.scatterOptions.borderColor=g,p=t.marker.size,this.scatterOptions.size=p,this.scatterOptions.borderSize=t.marker.line.width,this.scatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions),this.expandAxesFast(l,p)},E.updateFancy=function(t){var e=this.scene,r=e.xaxis,n=e.yaxis,o=this.bounds,a=this.pickXData=r.makeCalcdata(t,"x").slice(),l=this.pickYData=n.makeCalcdata(t,"y").slice();this.xData=a.slice(),this.yData=l.slice();var c,h,f,p,d,m,g,v,b=y.calcFromTrace(t,e.fullLayout),x=a.length,_=new Array(x),M=new Float32Array(2*x),k=new Float32Array(4*x),A=new Float32Array(4*x),T=0,E=0,L=0,I=0,P="log"===r.type?function(t){return r.d2l(t)}:function(t){return t},C="log"===n.type?function(t){return n.d2l(t)}:function(t){return t};for(c=0;x>c;++c)this.xData[c]=f=P(a[c]),this.yData[c]=p=C(l[c]),isNaN(f)||isNaN(p)||(_[T++]=c,M[E++]=f,M[E++]=p,d=k[L++]=f-b[c].xs||0,m=k[L++]=b[c].xh-f||0,k[L++]=0,k[L++]=0,A[I++]=0,A[I++]=0,g=A[I++]=p-b[c].ys||0,v=A[I++]=b[c].yh-p||0,o[0]=Math.min(o[0],f-d),o[1]=Math.min(o[1],p-g),o[2]=Math.max(o[2],f+m),o[3]=Math.max(o[3],p+v));M=u(M,E),this.idToIndex=_,this.updateLines(t,M),this.updateError("X",t,M,k),this.updateError("Y",t,M,A);var R;if(this.hasMarkers){this.scatterOptions.positions=M,this.scatterOptions.sizes=new Array(T),this.scatterOptions.glyphs=new Array(T),this.scatterOptions.borderWidths=new Array(T),this.scatterOptions.colors=new Array(4*T),this.scatterOptions.borderColors=new Array(4*T);var j,D=w(t),O=t.marker,F=O.opacity,N=t.opacity,B=s(O,F,N,x),U=z(O.symbol,x),V=S(O.line.width,x),q=s(O.line,F,N,x);for(R=i(D,O.size,x),c=0;T>c;++c)for(j=_[c],this.scatterOptions.sizes[c]=4*R[j],this.scatterOptions.glyphs[c]=U[j],this.scatterOptions.borderWidths[c]=.5*V[j],h=0;4>h;++h)this.scatterOptions.colors[4*c+h]=B[4*j+h],this.scatterOptions.borderColors[4*c+h]=q[4*j+h];this.fancyScatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions),this.expandAxesFancy(a,l,R)},E.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var i=0,o=this.xData,s=this.yData;for(n=new Float32Array(2*o.length),r=0;ra;a++)r=this.scene[T[a]],n=r._min,n||(n=[]),n.push({val:t[a],pad:o}),i=r._max,i||(i=[]),i.push({val:t[a+2],pad:o})},E.expandAxesFancy=function(t,e,r){var n=this.scene,i={padded:!0,ppad:r};v.expand(n.xaxis,t,i),v.expand(n.yaxis,e,i)},E.dispose=function(){this.line.dispose(),this.errorX.dispose(),this.errorY.dispose(),this.scatter.dispose(),this.fancyScatter.dispose()},e.exports=c},{"../../components/errorbars":535,"../../constants/gl2d_dashes":575,"../../constants/gl_markers":577,"../../lib":591,"../../lib/gl_format_color":589,"../../lib/str2rgbarray":603,"../../plots/cartesian/axes":615,"../scatter/get_trace_color":781,"../scatter/make_bubble_size_func":787,"../scatter/subtypes":792,"fast-isnumeric":128,"gl-error2d":130,"gl-line2d":136,"gl-scatter2d":201,"gl-scatter2d-fancy":196}],808:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/xy_defaults"),s=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),u=t("../scatter/fillcolor_defaults"),c=t("../../components/errorbars/defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function p(r,i){return n.coerce(t,e,h,r,i)}var d=a(t,e,p);return d?(p("text"),p("mode",dx;x++){var _=e.lon[x],w=e.lat[x];if(n(_)&&n(w)){var M={};if(b++,M.lonlat=[+_,+w],h){if(f){var k=c.color[x];M.mc=k,M.mcc=g(k)}if(p){var A=c.size[x];M.ms=A,M.mrc=v(A)}if(d){var T=c.symbol[x];M.mx="string"==typeof T?T:"circle"}}if(m){var E=e.text[x];M.tx="string"==typeof E?E:""}y.push(M)}else b>0&&(y[b-1].gapAfter=!0)}return y}},{"../../components/colorscale/has_colorscale":519,"../../components/colorscale/make_scale_function":523,"../../lib":591,"../scatter/colorscale_calc":777,"../scatter/make_bubble_size_func":787,"../scatter/subtypes":792,"fast-isnumeric":128}],812:[function(t,e,r){"use strict";function n(){return{geojson:i(),layout:{visibility:"none"},paint:{}}}function i(){return{type:"Point",coordinates:[]}}function o(t,e){if(1===e.length)return{type:"Polygon",coordinates:e};for(var r=new Array(e.length),n=0;n0&&(n.push(i),i=[])}return n.push(i),n}function f(t){return Array.isArray(t)?function(t){return t}:t?function(){return t}:p}function p(){return""}var d=t("../../lib"),m=t("../scatter/subtypes"),g=t("../../plots/mapbox/convert_text_opts"),v="circle-color",y="circle-radius";e.exports=function(t){var e=t[0].trace,r=e.visible===!0,i="none"!==e.fill,f=m.hasLines(e),p=m.hasMarkers(e),b=m.hasText(e),x=p&&"circle"===e.marker.symbol,_=p&&"circle"!==e.marker.symbol,w=n(),M=n(),k=n(),A=n(),T={fill:w,line:M,circle:k,symbol:A};if(!r)return T;var E;if((i||f)&&(E=h(t)),i&&(w.geojson=o(t,E),w.layout.visibility="visible",d.extendFlat(w.paint,{"fill-color":e.fillcolor})),f&&(M.geojson=a(t,E),M.layout.visibility="visible",d.extendFlat(M.paint,{"line-width":e.line.width,"line-color":e.line.color,"line-opacity":e.opacity})),x){var S={};S[v]={},S[y]={},k.geojson=s(t,S),k.layout.visibility="visible",d.extendFlat(k.paint,{"circle-opacity":e.opacity*e.marker.opacity,"circle-color":u(e,S),"circle-radius":c(e,S)})}if((_||b)&&(A.geojson=l(t),d.extendFlat(A.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),_&&(d.extendFlat(A.layout,{"icon-size":e.marker.size/10}),d.extendFlat(A.paint,{"icon-opacity":e.opacity*e.marker.opacity,"icon-color":e.marker.color})),b)){var L=(e.marker||{}).size,z=g(e.textposition,L);d.extendFlat(A.layout,{"text-size":e.textfont.size,"text-anchor":z.anchor,"text-offset":z.offset}),d.extendFlat(A.paint,{"text-color":e.textfont.color,"text-opacity":e.opacity})}return T}},{"../../lib":591,"../../plots/mapbox/convert_text_opts":665,"../scatter/subtypes":792}],813:[function(t,e,r){"use strict";function n(t,e,r){var n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length);return o")}var i=t("../../plots/cartesian/graph_interact"),o=t("../scatter/get_trace_color");e.exports=function(t,e,r){function a(t){var e=t.lonlat,n=Math.abs(u.c2p(e)-u.c2p([p,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],r])),o=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-o,1-3/o)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya,h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),f=360*h,p=e-f;if(i.getClosest(s,a,t),t.index!==!1){var d=s[t.index],m=d.lonlat,g=[m[0]+f,m[1]],v=u.c2p(g),y=c.c2p(g),b=d.mrc||1;return t.x0=v-b,t.x1=v+b,t.y0=y-b,t.y1=y+b,t.color=o(l,d),t.extraText=n(l,d),[t]}}},{"../../plots/cartesian/graph_interact":622,"../scatter/get_trace_color":781}],815:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.hoverPoints=t("./hover"),n.plot=t("./plot"),n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/mapbox":666,"../scatter/colorbar":776,"./attributes":810,"./calc":811,"./defaults":813,"./hover":814,"./plot":816}],816:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var o=t("./convert"),a=n.prototype;a.update=function(t){var e=this.mapbox,r=o(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout),i(r.fill)&&(e.setSourceData(this.idSourceFill,r.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(e.setSourceData(this.idSourceLine,r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(e.setSourceData(this.idSourceCircle,r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(e.setSourceData(this.idSourceSymbol,r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint))},a.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=e[0].trace,i=new n(t,r.uid);return i.update(e),i}},{"./convert":812}],817:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},mode:a({},n.mode,{dflt:"markers"}),text:a({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash,shape:a({},l.shape,{values:["linear","spline"]}),smoothing:l.smoothing},connectgaps:n.connectgaps,fill:a({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:a({},{symbol:s.symbol,opacity:s.opacity,maxdisplayed:s.maxdisplayed,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:a({},{width:u.width},o("marker".line))},o("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:a({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron,_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":514,"../../lib/extend":586,"../../plots/attributes":613,"../scatter/attributes":773}],818:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("../scatter/subtypes"),s=t("../scatter/colorscale_calc"),l=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,c,h,f,p,d,m=t._fullLayout[e.subplot],g=m.sum,v=e.sum||g;for(r=0;rr;r++)y=e.a[r],b=e.b[r],x=e.c[r],n(y)&&n(b)&&n(x)?(y=+y,b=+b,x=+x,_=g/(y+b+x),1!==_&&(y*=_,b*=_,x*=_),M=y,w=x-b,A[r]={x:w,y:M,a:y,b:b,c:x}):A[r]={x:!1,y:!1};var T,E;if(a.hasMarkers(e)&&(T=e.marker,E=T.size,Array.isArray(E))){var S={type:"linear"};i.setConvert(S),E=S.makeCalcdata(e.marker,"size"),E.length>k&&E.splice(k,E.length-k)}return s(e),void 0!==typeof E&&o.mergeArray(E,A,"ms"),A}},{"../../lib":591,"../../plots/cartesian/axes":615,"../scatter/colorscale_calc":777,"../scatter/subtypes":792,"fast-isnumeric":128}],819:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),u=t("../scatter/text_defaults"),c=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function p(r,i){return n.coerce(t,e,h,r,i)}var d,m=p("a"),g=p("b"),v=p("c");if(m?(d=m.length,g?(d=Math.min(d,g.length),v&&(d=Math.min(d,v.length))):d=v?Math.min(d,v.length):0):g&&v&&(d=Math.min(g.length,v.length)),!d)return void(e.visible=!1);m&&d"),s}}},{"../../plots/cartesian/axes":615,"../scatter/hover":782}],821:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":678,"../scatter/colorbar":776,"./attributes":817,"./calc":818,"./defaults":819,"./hover":820,"./plot":822,"./select":823,"./style":824}],822:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={x:function(){return t.xaxis},y:function(){return t.yaxis},plot:r},o=new Array(e.length),a=t.graphDiv.calcdata,s=0;se){for(var r=m/e,n=[0|Math.floor(t[0].shape[0]*r+1),0|Math.floor(t[0].shape[1]*r+1)],i=n[0]*n[1],a=0;ar;++r)this.showContour[r]&&(e=!0,t[r]=this.scene.contourLevels[r]);e&&this.surface.update({levels:t})},g.update=function(t){var e,r=this.scene,n=r.fullSceneLayout,o=this.surface,s=t.opacity,l=i(t.colorscale,s),c=t.z,f=t.x,p=t.y,m=n.xaxis,g=n.yaxis,v=n.zaxis,y=r.dataScale,b=c[0].length,x=c.length,_=[u(new Float32Array(b*x),[b,x]),u(new Float32Array(b*x),[b,x]),u(new Float32Array(b*x),[b,x])],w=_[0],M=_[1],k=r.contourLevels;this.data=t,h(_[2],function(t,e){return v.d2l(c[e][t])*y[2]}),Array.isArray(f[0])?h(w,function(t,e){return m.d2l(f[e][t])*y[0]}):h(w,function(t){return m.d2l(f[t])*y[0]}),Array.isArray(p[0])?h(M,function(t,e){return g.d2l(p[e][t])*y[1]}):h(M,function(t,e){return g.d2l(p[e])*y[1]});var A={colormap:l,levels:[[],[],[]],showContour:[!0,!0,!0],showSurface:!t.hidesurface,contourProject:[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],contourWidth:[1,1,1],contourColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],contourTint:[1,1,1],dynamicColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],dynamicWidth:[1,1,1],dynamicTint:[1,1,1],opacity:1};if(A.intensityBounds=[t.cmin,t.cmax],t.surfacecolor){var T=u(new Float32Array(b*x),[b,x]);h(T,function(e,r){return t.surfacecolor[r][e]}),_.push(T)}else A.intensityBounds[0]*=y[2],A.intensityBounds[1]*=y[2];this.dataScale=a(_),t.surfacecolor&&(A.intensity=_.pop()),"opacity"in t&&t.opacity<1&&(A.opacity=.25*t.opacity);var E=[!0,!0,!0],S=["x","y","z"];for(e=0;3>e;++e){var L=t.contours[S[e]];E[e]=L.highlight,A.showContour[e]=L.show||L.highlight,A.showContour[e]&&(A.contourProject[e]=[L.project.x,L.project.y,L.project.z],L.show?(this.showContour[e]=!0,A.levels[e]=k[e],o.highlightColor[e]=A.contourColor[e]=d(L.color),L.usecolormap?o.highlightTint[e]=A.contourTint[e]=0:o.highlightTint[e]=A.contourTint[e]=1,A.contourWidth[e]=L.width):this.showContour[e]=!1,L.highlight&&(A.dynamicColor[e]=d(L.highlightcolor),A.dynamicWidth[e]=L.highlightwidth))}A.coords=_,o.update(A),o.visible=t.visible,o.enableDynamic=E,o.snapToData=!0,"lighting"in t&&(o.ambientLight=t.lighting.ambient,o.diffuseLight=t.lighting.diffuse,o.specularLight=t.lighting.specular,o.roughness=t.lighting.roughness,o.fresnel=t.lighting.fresnel),"lightposition"in t&&(o.lightPosition=[t.lightposition.x,t.lightposition.y,t.lightposition.z]),s&&1>s&&(o.supportsTransparency=!0)},g.dispose=function(){this.scene.glplot.remove(this.surface),this.surface.dispose()},e.exports=s},{"../../lib/str2rgbarray":603,"gl-surface3d":232,ndarray:456,"ndarray-fill":449,"ndarray-homography":454,"ndarray-ops":455,tinycolor2:477}],829:[function(t,e,r){"use strict";function n(t,e,r){e in t&&!(r in t)&&(t[r]=t[e])}var i=t("../../lib"),o=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,a,r,n)}var u,c,h=l("z");if(!h)return void(e.visible=!1);var f=h[0].length,p=h.length;if(l("x"),l("y"),!Array.isArray(e.x))for(e.x=[],u=0;f>u;++u)e.x[u]=u;if(l("text"),!Array.isArray(e.y))for(e.y=[],u=0;p>u;++u)e.y[u]=u;["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lightposition.x","lightposition.y","lightposition.z","hidesurface","opacity"].forEach(function(t){l(t)});var d=l("surfacecolor");l("colorscale");var m=["x","y","z"];for(u=0;3>u;++u){var g="contours."+m[u],v=l(g+".show"),y=l(g+".highlight");if(v||y)for(c=0;3>c;++c)l(g+".project."+m[c]);v&&(l(g+".color"),l(g+".width"),l(g+".usecolormap")),y&&(l(g+".highlightcolor"),l(g+".highlightwidth"))}d||(n(t,"zmin","cmin"),n(t,"zmax","cmax"),n(t,"zauto","cauto")),o(t,e,s,l,{prefix:"",cLetter:"c"})}},{"../../components/colorscale/defaults":516,"../../lib":591,"./attributes":825}],830:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("./colorbar"),n.calc=t("./calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="surface",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","noOpacity"],n.meta={},e.exports=n},{"../../plots/gl3d":651,"./attributes":825,"./calc":826,"./colorbar":827,"./convert":828,"./defaults":829}]},{},[12])(12)}); \ No newline at end of file diff --git a/package.json b/package.json index 5184e6aa2ca..3baefba9324 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plotly.js", - "version": "1.16.2", + "version": "1.16.3", "description": "The open source javascript graphing library that powers plotly", "license": "MIT", "main": "./lib/index.js", diff --git a/src/assets/geo_assets.js b/src/assets/geo_assets.js index aebb42f9d82..a46a4f471c1 100644 --- a/src/assets/geo_assets.js +++ b/src/assets/geo_assets.js @@ -12,6 +12,6 @@ var saneTopojson = require('sane-topojson'); // package version injected by `npm run preprocess` -exports.version = '1.16.2'; +exports.version = '1.16.3'; exports.topojson = saneTopojson; diff --git a/src/core.js b/src/core.js index 046e186e438..e264484ad40 100644 --- a/src/core.js +++ b/src/core.js @@ -15,7 +15,7 @@ var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.16.2'; +exports.version = '1.16.3'; // inject promise polyfill require('es6-promise').polyfill();